chore: generate

This commit is contained in:
opencode-agent[bot] 2026-06-05 06:31:37 +00:00
commit f6197cefe1
12 changed files with 136 additions and 39 deletions

View file

@ -3,13 +3,15 @@ import { ScopedKey, ServerScope, SessionRouteKey, SessionStateKey, migrateLegacy
describe("ServerScope", () => {
test("uses a stable local scope for the canonical sidecar", () => {
expect(String(ServerScope.fromServerKey("sidecar" as Parameters<typeof ServerScope.fromServerKey>[0]))).toBe("local")
expect(String(ServerScope.fromServerKey("sidecar" as Parameters<typeof ServerScope.fromServerKey>[0]))).toBe(
"local",
)
})
test("keeps configured loopback servers distinct from the canonical sidecar", () => {
expect(String(ServerScope.fromServerKey("http://localhost:4096" as Parameters<typeof ServerScope.fromServerKey>[0]))).toBe(
"http://localhost:4096",
)
expect(
String(ServerScope.fromServerKey("http://localhost:4096" as Parameters<typeof ServerScope.fromServerKey>[0])),
).toBe("http://localhost:4096")
})
test("uses a stable local scope for an explicit canonical web server", () => {
@ -52,6 +54,8 @@ describe("migrateLegacySessionStateKeys", () => {
})
test("rejects invalid identity fragments", () => {
expect(() => ScopedKey.from(ServerScope.local, "bad\0directory")).toThrow("Scoped key part cannot contain null bytes")
expect(() => ScopedKey.from(ServerScope.local, "bad\0directory")).toThrow(
"Scoped key part cannot contain null bytes",
)
})
})

View file

@ -19,7 +19,10 @@ function compose(scope: ServerScope, parts: string[]) {
export const ServerScope = {
local: "local" as ServerScope,
fromServerKey(key: ServerConnection.Key, canonicalLocalServer?: ServerConnection.Key) {
return fragment("Server scope", key === "sidecar" || key === canonicalLocalServer ? ServerScope.local : key) as ServerScope
return fragment(
"Server scope",
key === "sidecar" || key === canonicalLocalServer ? ServerScope.local : key,
) as ServerScope
},
}