TypeScript
fix(contracts): accept CLI event origins (#8905)
Yukun Shan2921050c698f
diff --git a/apps/server/src/persistence/Layers/OrchestrationEventStore.test.ts b/apps/server/src/persistence/Layers/OrchestrationEventStore.test.tsindex 2bac5de920c..1e21501e409 100644--- a/apps/server/src/persistence/Layers/OrchestrationEventStore.test.ts+++ b/apps/server/src/persistence/Layers/OrchestrationEventStore.test.ts@@ -17,7 +17,7 @@ const layer = it.layer();layer("OrchestrationEventStore", (it) => {- it.effect("stores json columns as strings and replays decoded events", () =>+ it.effect("stores json columns as strings and replays CLI-origin events", () =>Effect.gen(function* () {const eventStore = yield* OrchestrationEventStore;const sql = yield* SqlClient.SqlClient;@@ -34,6 +34,9 @@ layer("OrchestrationEventStore", (it) => {correlationId: CommandId.make("cmd-store-roundtrip"),metadata: {adapterKey: "codex",+ origin: {+ surface: "cli",+ },},payload: {projectId: ProjectId.make("project-roundtrip"),@@ -66,6 +69,7 @@ layer("OrchestrationEventStore", (it) => {assert.equal(replayed.length, 1);assert.equal(replayed[0]?.type, "project.created");assert.equal(replayed[0]?.metadata.adapterKey, "codex");+ assert.deepEqual(replayed[0]?.metadata.origin, { surface: "cli" });}),);diff --git a/packages/contracts/src/baseSchemas.ts b/packages/contracts/src/baseSchemas.tsindex aa6360a04ed..afa9e979b72 100644--- a/packages/contracts/src/baseSchemas.ts+++ b/packages/contracts/src/baseSchemas.ts@@ -86,12 +86,12 @@ export const RpcClientId = NonNegativeInt.pipe(Schema.brand("RpcClientId"));export type RpcClientId = typeof RpcClientId.Type;/**- * Which client app a connection comes from. Unlike+ * Which client surface a connection or command comes from. Unlike* `AuthClientMetadataDeviceType` (a UA-style device class where web and* desktop are both "desktop"), this names the actual product surface.* Optional everywhere it appears: old clients never send it.*/-export const ClientSurface = Schema.Literals(["web", "desktop", "mobile"]);+export const ClientSurface = Schema.Literals(["web", "desktop", "mobile", "cli"]);export type ClientSurface = typeof ClientSurface.Type;export const ClientOs = Schema.Literals([