diff --git a/bun.lock b/bun.lock index cc810558f38..73d7c1063ab 100644 --- a/bun.lock +++ b/bun.lock @@ -1043,10 +1043,10 @@ "@astrojs/starlight": "0.41.11", "@cloudflare/workers-types": "4.20251008.0", "@corvu/drawer": "0.2.4", - "@effect/opentelemetry": "4.0.6", - "@effect/platform-node": "4.0.6", - "@effect/platform-node-shared": "4.0.6", - "@effect/sql-sqlite-bun": "4.0.6", + "@effect/opentelemetry": "4.1.0", + "@effect/platform-node": "4.1.0", + "@effect/platform-node-shared": "4.1.0", + "@effect/sql-sqlite-bun": "4.1.0", "@kobalte/core": "0.13.13", "@lydell/node-pty": "1.2.0-beta.12", "@npmcli/arborist": "9.4.0", @@ -1083,7 +1083,7 @@ "dompurify": "3.4.17", "drizzle-kit": "1.0.0-rc.5-ab785fc", "drizzle-orm": "1.0.0-rc.5-169397b", - "effect": "4.0.6", + "effect": "4.1.0", "fast-check": "4.9.0", "fuzzysort": "3.1.0", "get-east-asian-width": "1.6.0", @@ -1530,13 +1530,13 @@ "@drizzle-team/brocli": ["@drizzle-team/brocli@0.12.0", "", {}, "sha512-mlUE+rZ8CatQekLhnaiN91Iemdd+e2gFKooGlnRB3oPTL3VghLfX24dx7HrzMNeC1JrIB/0kpsfyty3f5HNfxQ=="], - "@effect/opentelemetry": ["@effect/opentelemetry@4.0.6", "", { "peerDependencies": { "@opentelemetry/api": ">=1.9.0 <2.0.0", "@opentelemetry/api-logs": ">=0.203.0 <0.300.0", "@opentelemetry/resources": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-logs": ">=0.203.0 <0.300.0", "@opentelemetry/sdk-metrics": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-base": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-node": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-web": ">=2.0.0 <3.0.0", "@opentelemetry/semantic-conventions": ">=1.33.0 <2.0.0", "effect": "^4.0.6" }, "optionalPeers": ["@opentelemetry/api", "@opentelemetry/api-logs", "@opentelemetry/resources", "@opentelemetry/sdk-logs", "@opentelemetry/sdk-metrics", "@opentelemetry/sdk-trace-base", "@opentelemetry/sdk-trace-node", "@opentelemetry/sdk-trace-web"] }, "sha512-xhLR1EN4ZNaKM7Bx59SCFiRNduFzgH8LZXDrCpPN8MpQ93V0GQcFHTBah5T3EXO2v+5HTEacdTgetIA0Creqvw=="], + "@effect/opentelemetry": ["@effect/opentelemetry@4.1.0", "", { "peerDependencies": { "@opentelemetry/api": ">=1.9.0 <2.0.0", "@opentelemetry/api-logs": ">=0.203.0 <0.300.0", "@opentelemetry/resources": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-logs": ">=0.203.0 <0.300.0", "@opentelemetry/sdk-metrics": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-base": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-node": ">=2.0.0 <3.0.0", "@opentelemetry/sdk-trace-web": ">=2.0.0 <3.0.0", "@opentelemetry/semantic-conventions": ">=1.33.0 <2.0.0", "effect": "^4.1.0" }, "optionalPeers": ["@opentelemetry/api", "@opentelemetry/api-logs", "@opentelemetry/resources", "@opentelemetry/sdk-logs", "@opentelemetry/sdk-metrics", "@opentelemetry/sdk-trace-base", "@opentelemetry/sdk-trace-node", "@opentelemetry/sdk-trace-web"] }, "sha512-j9bNzQaoQvcnimBFMG0i3piEW20E8HjkXAQHTJN/XqG2e4uJ9zCv53/HCNzD7+ooFn5S4nwQy/BOXeNReMIe+A=="], - "@effect/platform-node": ["@effect/platform-node@4.0.6", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.6", "undici": "^8.12.2" }, "peerDependencies": { "effect": "^4.0.6", "redis": ">=5.0.0 <7.0.0" } }, "sha512-gXvGHAy0/8PZbWvMMguloDUyeSP+rzYEo3FSEqUuGduxo9ORcGioDxPI+GOLCIFfam7VuNkmSUxBOiRMIrMrBw=="], + "@effect/platform-node": ["@effect/platform-node@4.1.0", "", { "dependencies": { "@effect/platform-node-shared": "^4.1.0", "undici": "^8.12.2" }, "peerDependencies": { "effect": "^4.1.0", "redis": ">=5.0.0 <7.0.0" } }, "sha512-v+X7moGVF9k5oMVvz0slA+NgtEod+W+oygeI285MDJgSlUCW3JcqElj+cD3rlijFZtpKhC7RLkU1GuCxjGHTpA=="], - "@effect/platform-node-shared": ["@effect/platform-node-shared@4.0.6", "", { "dependencies": { "@types/ws": "^8.18.2", "ws": "^8.22.0" }, "peerDependencies": { "effect": "^4.0.6" } }, "sha512-0PhyC4uG30xGtsajnxjkcBWfTjNRzUh4ZKl1Kvo/MNyCTb+W2O+fBzf7wCRCoqt+nLudiq4V7vX40Q8XIBuMaQ=="], + "@effect/platform-node-shared": ["@effect/platform-node-shared@4.1.0", "", { "dependencies": { "@types/ws": "^8.18.2", "ws": "^8.22.0" }, "peerDependencies": { "effect": "^4.1.0" } }, "sha512-uYQfFRoxWLo8fIhiSeBcmz/R1ooOfE3HF3cWHFgxz82tZMk2Wn02BGABcdLmaAch9VpDLbtWnuhSxNyBsGMUFg=="], - "@effect/sql-sqlite-bun": ["@effect/sql-sqlite-bun@4.0.6", "", { "peerDependencies": { "effect": "^4.0.6" } }, "sha512-IUf0d6NrrG+m/yKqziGyE9xQO5cOPzyDcb98S39OpdQMKHBZjVtx+TN+nz3b8Spc6AvfKjFYTcvXSjSzgjDRug=="], + "@effect/sql-sqlite-bun": ["@effect/sql-sqlite-bun@4.1.0", "", { "peerDependencies": { "effect": "^4.1.0" } }, "sha512-V05HFjGmSnzIvXuxiHABw67SNf70dNbIvhUfyM7woDrgOu0JlqA8BTIhrwEPy0+GPwyvS5ALolcyNOMRgPVxyA=="], "@electron-internal/extract-zip": ["@electron-internal/extract-zip@1.0.5", "", {}, "sha512-+bqFCP98pLI0Tt0XQo1TmlXtwjWchISndDOxCkEcIuUgXWpBnLyRI+2DU+mesvnMMX6L1XDqYNA0lXNDHd/yiA=="], @@ -3090,7 +3090,7 @@ "ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="], - "effect": ["effect@4.0.6", "", {}, "sha512-Tc3mkzuLR6t6P9dhLt0D2GrxYtmU5td4XEJEiXCmILz53IRIfJyHsKZWjTA3xEjiwpNTtXBgI4iqYPxMztBDrw=="], + "effect": ["effect@4.1.0", "", {}, "sha512-lGx2MJJyrXA8RZb2UpQ/0Nkb5Utaimby7oD92+18noBxLPE85IFOvptdzau8dvcxAOwfwHo9iqapbKeFzqQM/Q=="], "ejs": ["ejs@3.1.10", "", { "dependencies": { "jake": "^10.8.5" }, "bin": { "ejs": "bin/cli.js" } }, "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA=="], diff --git a/package.json b/package.json index d5d30c7a352..8271b2ad027 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,10 @@ "packages/stats/*" ], "catalog": { - "@effect/opentelemetry": "4.0.6", - "@effect/platform-node": "4.0.6", - "@effect/platform-node-shared": "4.0.6", - "@effect/sql-sqlite-bun": "4.0.6", + "@effect/opentelemetry": "4.1.0", + "@effect/platform-node": "4.1.0", + "@effect/platform-node-shared": "4.1.0", + "@effect/sql-sqlite-bun": "4.1.0", "@npmcli/arborist": "9.4.0", "@types/bun": "1.4.3", "@types/cross-spawn": "6.0.6", @@ -79,7 +79,7 @@ "dompurify": "3.4.17", "drizzle-kit": "1.0.0-rc.5-ab785fc", "drizzle-orm": "1.0.0-rc.5-169397b", - "effect": "4.0.6", + "effect": "4.1.0", "fast-check": "4.9.0", "cross-spawn": "7.0.6", "hono": "4.13.13", diff --git a/packages/ai/test/recorded-test.ts b/packages/ai/test/recorded-test.ts index d2aed8b7d65..2954322dace 100644 --- a/packages/ai/test/recorded-test.ts +++ b/packages/ai/test/recorded-test.ts @@ -1,5 +1,5 @@ import { HttpRecorder } from "@opencode/http-recorder" -import { NodeSocket } from "@effect/platform-node" +import { NodeWS } from "@effect/platform-node" import { Effect, Layer } from "effect" import { Socket } from "effect/socket" import * as path from "node:path" @@ -100,7 +100,7 @@ export const recordedTests = (options: RecordedTestsOptions) => ...recorderOptions, directory: FIXTURES_DIR, metadata: recorderMetadata, - }).pipe(Layer.provide(NodeSocket.layerWebSocketConstructorWS)) + }).pipe(Layer.provide(NodeWS.layerWebSocketConstructor)) const layer = Layer.mergeAll( requestExecutor, LLMClient.layer.pipe(Layer.provide(requestExecutor)), diff --git a/packages/app/src/composer/schema.ts b/packages/app/src/composer/schema.ts index 017cd9af16b..3ccd71bf56d 100644 --- a/packages/app/src/composer/schema.ts +++ b/packages/app/src/composer/schema.ts @@ -392,7 +392,7 @@ export const LineComment = Persistence.struct({ export type LineComment = typeof LineComment.Type export const CommentStore = Persistence.struct({ - comments: Schema.Record(Schema.String, Schema.mutableKey(Persistence.array(LineComment))), + comments: Schema.Record(Schema.String, Persistence.entry(Persistence.array(LineComment))), }) export type CommentStore = typeof CommentStore.Type diff --git a/packages/app/src/providers/models/selection.tsx b/packages/app/src/providers/models/selection.tsx index 65f09367751..d90095c7c08 100644 --- a/packages/app/src/providers/models/selection.tsx +++ b/packages/app/src/providers/models/selection.tsx @@ -41,7 +41,7 @@ type State = typeof StateSchema.Type const SessionsSchema = Schema.Record( Schema.String, - Schema.mutableKey(Persistence.fallback(Schema.UndefinedOr(StateSchema), () => undefined)), + Persistence.entry(Persistence.fallback(Schema.UndefinedOr(StateSchema), () => undefined)), ) const Current = Persistence.struct({ session: SessionsSchema }) diff --git a/packages/app/src/runtime/persistence/README.md b/packages/app/src/runtime/persistence/README.md index 3f543192e06..63137fc13bc 100644 --- a/packages/app/src/runtime/persistence/README.md +++ b/packages/app/src/runtime/persistence/README.md @@ -43,8 +43,10 @@ migration rules remain explicit in their schemas. each field's optionality and codec. It does not add defaults or error recovery. - `Persistence.record(valueSchema)` creates a mutable string-keyed record, defaulting missing or invalid records to a fresh `{}`. Its value schema determines entry - recovery: pass `Persistence.optional(valueSchema)` to discard only invalid entries, - or `Persistence.fallback(valueSchema, factory)` to replace those entries. + recovery: pass `valueSchema.pipe(Schema.catchDecoding(() => Effect.succeed(Option.none())))` + to discard only invalid entries, or `Persistence.fallback(valueSchema, factory)` to + replace those entries. Don't pass `Persistence.optional(valueSchema)`: Effect rejects + optional record values, and the record throws when it is built. - `Persistence.array(schema)` defaults to an empty mutable array and discards invalid entries individually. Valid entries still pass through their codecs. - Recovery is not a substitute for an explicit historical shape transformation. diff --git a/packages/app/src/runtime/persistence/schema.test.ts b/packages/app/src/runtime/persistence/schema.test.ts index 7ea76ce3527..29f728b3ac8 100644 --- a/packages/app/src/runtime/persistence/schema.test.ts +++ b/packages/app/src/runtime/persistence/schema.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test" -import { Effect, Predicate, Schema, SchemaGetter } from "effect" +import { Effect, Option, Predicate, Schema, SchemaGetter } from "effect" import { Persistence } from "./schema" describe("persistence schemas", () => { @@ -87,7 +87,9 @@ describe("persistence schemas", () => { }) const decode = Schema.decodeUnknownSync(schema) - expect(decode({ general: { expanded: true, theme: "dark", nested: { keep: true } }, other: { flag: true } })).toEqual({ + expect( + decode({ general: { expanded: true, theme: "dark", nested: { keep: true } }, other: { flag: true } }), + ).toEqual({ general: { mode: "full", theme: "dark", nested: { keep: true } }, other: { flag: true }, }) @@ -169,7 +171,7 @@ describe("persistence schemas", () => { first.changed = true expect(decode(undefined)).toEqual({}) - const recover = Persistence.record(Persistence.optional(Schema.Boolean)) + const recover = Persistence.record(Schema.Boolean.pipe(Schema.catchDecoding(() => Effect.succeed(Option.none())))) const state = Schema.decodeUnknownSync(recover)({ valid: true, invalid: "true" }) expect(state).toEqual({ valid: true }) expect(Schema.encodeSync(recover)(state)).toEqual({ valid: true }) diff --git a/packages/app/src/runtime/persistence/schema.ts b/packages/app/src/runtime/persistence/schema.ts index 6bdc9dd56e6..e419d3ef14d 100644 --- a/packages/app/src/runtime/persistence/schema.ts +++ b/packages/app/src/runtime/persistence/schema.ts @@ -97,8 +97,18 @@ export function struct(fields: Fields return Schema.Struct(fields).mapFields(Struct.map(Schema.mutableKey)) } +// Record values can't have an optional encoded side (as `fallback` does), so each entry decodes from +// `Unknown` and keeps its own recovery. +export function entry>(schema: S) { + return Schema.mutableKey( + Schema.Unknown.pipe( + Schema.decodeTo(schema, { decode: SchemaGetter.passthrough(), encode: SchemaGetter.passthrough() }), + ), + ) +} + export function record>(schema: S) { - const entries = Schema.Record(Schema.String, Schema.mutableKey(schema)) + const entries = Schema.Record(Schema.String, entry(schema)) return fallback(entries, () => Schema.decodeUnknownSync(entries)({})) } diff --git a/packages/cli/test/updater-install.test.ts b/packages/cli/test/updater-install.test.ts index 8c7bc742c44..298aab305e1 100644 --- a/packages/cli/test/updater-install.test.ts +++ b/packages/cli/test/updater-install.test.ts @@ -5,7 +5,7 @@ import { Global } from "@opencode/util/global" import { AppProcess } from "@opencode/util/process" import { expect, spyOn, test } from "bun:test" import { Effect, FileSystem, Layer, PlatformError, Stream } from "effect" -import { ChildProcess, ChildProcessSpawner } from "effect/process" +import { ChildProcessSpawner } from "effect/process" import { existsSync, readdirSync, readFileSync } from "node:fs" import path from "node:path" import { Updater } from "../src/services/updater" @@ -16,7 +16,10 @@ const it = testEffect(NodeServices.layer) declare const OPENCODE_CLI_NAME: string | undefined function fixture( - respond: (command: ChildProcess.StandardCommand) => Partial & { + respond: (command: { + readonly command: string + readonly args: ReadonlyArray + }) => Partial & { error?: AppProcess.AppProcessError } = () => ({}), name = "@opencode/cli", @@ -110,11 +113,12 @@ function fixture( run: (command) => Effect.suspend(() => { if (command._tag !== "StandardCommand") return Effect.die("Unexpected piped install command") - const lookup = command.command === "git" && command.args[0] === "--exec-path" - if (!lookup) commands.push([command.command, ...command.args]) + const args = command.args.map(String) + const lookup = command.command === "git" && args[0] === "--exec-path" + if (!lookup) commands.push([command.command, ...args]) const result = lookup ? { stdout: Buffer.from(`${path.join(git, "mingw64", "libexec", "git-core")}\n`) } - : respond(command) + : respond({ command: command.command, args }) if (result.error) return Effect.fail(result.error) return Effect.succeed({ command: command.command, diff --git a/packages/core/src/config/plugin/skill-scan.ts b/packages/core/src/config/plugin/skill-scan.ts index c955270c5d5..47335ecbd9f 100644 --- a/packages/core/src/config/plugin/skill-scan.ts +++ b/packages/core/src/config/plugin/skill-scan.ts @@ -18,27 +18,27 @@ export const scan = Effect.fn("SkillScan.scan")(function* (root: string) { entries.filter((entry) => !entry.name.startsWith(".") && !FSUtil.ignoredDirectories.includes(entry.name)), (entry) => { const target = path.join(item.directory, entry.name) - if (entry.type !== "symlink") return Effect.succeed({ name: entry.name, path: target, type: entry.type }) + if (entry.type !== "SymbolicLink") return Effect.succeed({ name: entry.name, path: target, type: entry.type }) return fs.stat(target).pipe( - Effect.map((info) => (info.type === "Directory" ? "directory" : info.type === "File" ? "file" : "other")), - Effect.orElseSucceed(() => "other" as const), + Effect.map((info) => info.type), + Effect.orElseSucceed(() => "Unknown" as const), Effect.map((type) => ({ name: entry.name, path: target, type })), ) }, ) - const skill = children.find((child) => child.type === "file" && child.name === "SKILL.md") + const skill = children.find((child) => child.type === "File" && child.name === "SKILL.md") if (skill) { files.push(skill.path) continue } if (item.depth === 0) files.push( - ...children.filter((child) => child.type === "file" && child.name.endsWith(".md")).map((child) => child.path), + ...children.filter((child) => child.type === "File" && child.name.endsWith(".md")).map((child) => child.path), ) if (item.depth < MAX_DEPTH) queue.push( ...children - .filter((child) => child.type === "directory") + .filter((child) => child.type === "Directory") .map((child) => ({ directory: child.path, depth: item.depth + 1 })), ) } diff --git a/packages/core/src/database/sqlite.ts b/packages/core/src/database/sqlite.ts index 86f57b2d185..566e9520d80 100644 --- a/packages/core/src/database/sqlite.ts +++ b/packages/core/src/database/sqlite.ts @@ -1,6 +1,6 @@ export * as Sqlite from "./sqlite.js" -import { Context, Effect, Fiber, Scope, Semaphore, Stream } from "effect" +import { Context, Effect, type Scope, Semaphore, Stream } from "effect" import { identity } from "effect/Function" import { SqlClient, Statement } from "effect/sql" import type { Connection } from "effect/sql/SqlConnection" @@ -61,14 +61,9 @@ export const makeClient = < Effect.gen(function* () { const semaphore = yield* Semaphore.make(1) const acquirer = semaphore.withPermits(1)(Effect.succeed(connection)) - const transactionAcquirer = Effect.uninterruptibleMask((restore) => { - const fiber = Fiber.getCurrent()! - const scope = Context.getUnsafe(fiber.context, Scope.Scope) - return Effect.as( - Effect.tap(restore(semaphore.take(1)), () => Scope.addFinalizer(scope, semaphore.release(1))), - connection, - ) - }) + const transactionAcquirer = Effect.uninterruptibleMask((restore) => + Effect.as(restore(semaphore.takeScoped(1)), connection), + ) const transformRows = options.transformResultNames ? Statement.defaultTransforms(options.transformResultNames).array : undefined diff --git a/packages/core/src/database/sqlite.workerd.ts b/packages/core/src/database/sqlite.workerd.ts index 2923d2e60e0..6dd73bd2c93 100644 --- a/packages/core/src/database/sqlite.workerd.ts +++ b/packages/core/src/database/sqlite.workerd.ts @@ -1,4 +1,4 @@ -import { Context, Effect, Exit, Fiber, Layer, Scope, Semaphore } from "effect" +import { Context, Effect, Exit, Layer, Semaphore } from "effect" import { Reactivity } from "effect/reactivity" import { SqlClient, Statement } from "effect/sql" import type { Connection } from "effect/sql/SqlConnection" @@ -170,14 +170,9 @@ const make = (options: Config) => const semaphore = yield* Semaphore.make(1) const acquirer = semaphore.withPermits(1)(Effect.succeed(connection)) - const transactionAcquirer = Effect.uninterruptibleMask((restore) => { - const fiber = Fiber.getCurrent()! - const scope = Context.getUnsafe(fiber.context, Scope.Scope) - return Effect.as( - Effect.tap(restore(semaphore.take(1)), () => Scope.addFinalizer(scope, semaphore.release(1))), - connection, - ) - }) + const transactionAcquirer = Effect.uninterruptibleMask((restore) => + Effect.as(restore(semaphore.takeScoped(1)), connection), + ) const client = Object.assign( (yield* SqlClient.make({ diff --git a/packages/core/src/effect/websocket-constructor.ts b/packages/core/src/effect/websocket-constructor.ts index 444ff1d8bad..fdc331c3912 100644 --- a/packages/core/src/effect/websocket-constructor.ts +++ b/packages/core/src/effect/websocket-constructor.ts @@ -1,5 +1,5 @@ // The platform barrel also exposes Redis and its optional native hash loader, which workerd cannot resolve. -import { NodeWS } from "@effect/platform-node/NodeSocket" +import { WebSocket as NodeWebSocket } from "@effect/platform-node/NodeWS" import { HttpProxyAgent } from "http-proxy-agent" import { HttpsProxyAgent } from "https-proxy-agent" import { Layer } from "effect" @@ -75,7 +75,7 @@ const layer = Layer.succeed(Socket.WebSocketConstructor, (url, input) => { // Reject redirects before headers can cross an origin boundary; the caller safely falls back to HTTP. followRedirects: false, } - return config.protocols ? new NodeWS.WebSocket(url, config.protocols, native) : new NodeWS.WebSocket(url, native) + return config.protocols ? new NodeWebSocket(url, config.protocols, native) : new NodeWebSocket(url, native) }) export const WebSocketConstructor = { layer, proxy } as const diff --git a/packages/core/src/environment/local.ts b/packages/core/src/environment/local.ts index 24b237855ea..d0c246c4708 100644 --- a/packages/core/src/environment/local.ts +++ b/packages/core/src/environment/local.ts @@ -8,11 +8,8 @@ import { Failed, NotFound, WrongKind, type FileInfo, type FilesImpl, type FileTy /** * The host filesystem binding. Deliberately raw node:fs rather than effect's * FileSystem service or FSUtil: the contract needs lstat semantics (stat - * reports "symlink") and typed directory entries, and effect's node - * FileSystem provides neither — its stat always follows symlinks and - * readDirectory returns names only. FSUtil hits the same gap and its - * readDirectoryEntries already bypasses to raw node readdir internally. - * Nothing above the environment seam touches node:fs. + * reports "symlink"), and effect's node FileSystem stat always follows + * symlinks. Nothing above the environment seam touches node:fs. */ export const makeLocalDriver = (spawner: ChildProcessSpawner["Service"]): Driver => { const overrides: FilesImpl = { diff --git a/packages/core/src/filesystem.ts b/packages/core/src/filesystem.ts index ab421a7737a..98aec9400f5 100644 --- a/packages/core/src/filesystem.ts +++ b/packages/core/src/filesystem.ts @@ -183,13 +183,14 @@ const baseLayer = Layer.effect( Effect.map((items) => items .flatMap((item) => { - if (item.type !== "file" && item.type !== "directory") return [] + if (item.type !== "File" && item.type !== "Directory") return [] + const type = item.type === "Directory" ? "directory" : "file" const absolute = path.join(directory, item.name) const relative = path.relative(location.directory, absolute) || "." return [ Entry.make({ - path: RelativePath.make(relative + (item.type === "directory" ? path.sep : "")), - type: item.type, + path: RelativePath.make(relative + (type === "directory" ? path.sep : "")), + type, }), ] }) diff --git a/packages/core/src/plugin/source-directory.ts b/packages/core/src/plugin/source-directory.ts index 79c247cb0a6..68a8336ac35 100644 --- a/packages/core/src/plugin/source-directory.ts +++ b/packages/core/src/plugin/source-directory.ts @@ -21,9 +21,9 @@ export const discover = Effect.fn("PluginSourceDirectory.discover")(function* ( const targets = yield* Effect.forEach(children, (entry) => Effect.gen(function* () { const source = entry.target.endsWith(".ts") || entry.target.endsWith(".js") - if (entry.type === "file" && source) return Option.some(entry.target) - if (entry.type === "directory") return Option.some(entry.target) - if (entry.type !== "symlink") return Option.none() + if (entry.type === "File" && source) return Option.some(entry.target) + if (entry.type === "Directory") return Option.some(entry.target) + if (entry.type !== "SymbolicLink") return Option.none() if (source && (yield* fs.isFile(entry.target))) return Option.some(entry.target) if (yield* fs.isDir(entry.target)) return Option.some(entry.target) return Option.none() diff --git a/packages/core/src/project/icon.ts b/packages/core/src/project/icon.ts index c90e8c8c79b..e9208aac754 100644 --- a/packages/core/src/project/icon.ts +++ b/packages/core/src/project/icon.ts @@ -58,7 +58,7 @@ export const discover = Effect.fn("ProjectIcon.discover")(function* (fs: FSUtil. const root = yield* fs.realPath(directory) const children = yield* fs.readDirectoryEntries(root).pipe(Effect.orElseSucceed(() => [])) const catalogs = children - .filter((e) => e.type === "directory" && !e.name.startsWith(".")) + .filter((e) => e.type === "Directory" && !e.name.startsWith(".")) .map((e) => e.name) .toSorted() .slice(0, 128) @@ -102,7 +102,7 @@ export const discover = Effect.fn("ProjectIcon.discover")(function* (fs: FSUtil. windows ? Math.abs(Number(file.match(/^icon-(\d+)\.png$/i)?.[1]) - 128) : /128|256/.test(file) ? 0 : 1 const files = entries ?.flatMap((e) => - e.type === "file" && + e.type === "File" && (windows ? /^icon-\d+\.png$/i.test(e.name) : IMAGES.has(path.extname(e.name).toLowerCase())) ? [e.name] : [], diff --git a/packages/core/src/session/prompt.ts b/packages/core/src/session/prompt.ts index af4464e88d8..73496fb313d 100644 --- a/packages/core/src/session/prompt.ts +++ b/packages/core/src/session/prompt.ts @@ -196,9 +196,9 @@ const readFileAttachment = Effect.fn("SessionPrompt.readFileAttachment")(functio return { bytes: Buffer.from( entries - .filter((entry) => entry.type === "file" || entry.type === "directory") - .sort((a, b) => (a.type === b.type ? a.name.localeCompare(b.name) : a.type === "directory" ? -1 : 1)) - .map((entry) => entry.name + (entry.type === "directory" ? path.sep : "")) + .filter((entry) => entry.type === "File" || entry.type === "Directory") + .sort((a, b) => (a.type === b.type ? a.name.localeCompare(b.name) : a.type === "Directory" ? -1 : 1)) + .map((entry) => entry.name + (entry.type === "Directory" ? path.sep : "")) .join("\n"), ), source: { type: "uri" as const, uri }, diff --git a/packages/core/src/session/runner/step.ts b/packages/core/src/session/runner/step.ts index 8d1a6c07627..bb1c279c816 100644 --- a/packages/core/src/session/runner/step.ts +++ b/packages/core/src/session/runner/step.ts @@ -144,7 +144,12 @@ export const make = Effect.gen(function* () { const streamFailure = Option.getOrUndefined(Exit.findErrorOption(stream)) const streamInterrupted = Exit.hasInterrupts(stream) // Cancelled before the start snapshot existed: record nothing, as when the capture preceded the request. - if (streamInterrupted && !publisher.hasStarted() && !pendingStartSnapshot.pollUnsafe()) + if ( + Exit.isFailure(stream) && + streamInterrupted && + !publisher.hasStarted() && + !pendingStartSnapshot.pollUnsafe() + ) return yield* Effect.failCause(stream.cause) if (!overflowFailure && publisher.hasStarted()) yield* publisher.streamed() if (streamInterrupted) yield* interruptTools diff --git a/packages/core/src/shell.ts b/packages/core/src/shell.ts index 995c82b6507..e7cfea7b517 100644 --- a/packages/core/src/shell.ts +++ b/packages/core/src/shell.ts @@ -93,7 +93,7 @@ export const cleanup = Effect.fn("Shell.cleanup")(function* () { const global = yield* Global.Service const directory = path.join(global.data, DIRECTORY) const projects = yield* fs.readDirectoryEntries(directory).pipe( - Effect.map((entries) => entries.filter((entry) => entry.type === "directory")), + Effect.map((entries) => entries.filter((entry) => entry.type === "Directory")), Effect.orElseSucceed(() => []), ) const files = yield* Effect.forEach( @@ -102,7 +102,7 @@ export const cleanup = Effect.fn("Shell.cleanup")(function* () { fs.readDirectoryEntries(path.join(directory, project.name)).pipe( Effect.map((entries) => entries.flatMap((entry) => - entry.type === "file" && /^sh_[0-9a-f]{12}.*\.out$/.test(entry.name) + entry.type === "File" && /^sh_[0-9a-f]{12}.*\.out$/.test(entry.name) ? [path.join(directory, project.name, entry.name)] : [], ), diff --git a/packages/core/test/effect/cross-spawn-spawner.test.ts b/packages/core/test/effect/cross-spawn-spawner.test.ts index d4b70701320..d022f305d81 100644 --- a/packages/core/test/effect/cross-spawn-spawner.test.ts +++ b/packages/core/test/effect/cross-spawn-spawner.test.ts @@ -2,7 +2,8 @@ import { describe, expect } from "bun:test" import fs from "node:fs/promises" import os from "node:os" import path from "node:path" -import { Deferred, Effect, Exit, PlatformError, Stream } from "effect" +import { inspect } from "node:util" +import { Cause, Deferred, Effect, Exit, PlatformError, Redacted, Stream } from "effect" import { ChildProcess, ChildProcessSpawner } from "effect/process" import { CrossSpawnSpawner } from "@opencode/util/cross-spawn-spawner" import { LayerNode } from "@opencode/util/effect/layer-node" @@ -404,6 +405,58 @@ describe("cross-spawn spawner", () => { expect(Exit.isFailure(exit) ? true : exit.value !== ChildProcessSpawner.ExitCode(0)).toBe(true) }), ) + + fx.effect( + "rejects NUL characters without exposing Redacted values", + Effect.gen(function* () { + const secret = Redacted.make("hunter2\0") + const commands = [ + () => ChildProcess.make("echo", [secret]), + () => ChildProcess.make`echo ${secret}`, + () => ChildProcess.make("echo", [], { env: { SECRET: secret } }), + ] + for (const command of commands) { + const exit = yield* Effect.exit(Effect.scoped(Effect.flatMap(command(), (handle) => handle.exitCode))) + expect(Exit.isFailure(exit)).toBe(true) + if (Exit.isSuccess(exit)) continue + expect(Cause.hasDies(exit.cause)).toBe(false) + const error = Cause.squash(exit.cause) + expect(PlatformError.isPlatformError(error) && error.reason._tag).toBe("BadArgument") + expect(inspect(exit, { depth: Infinity })).not.toContain("hunter2") + } + }), + ) + + fx.live( + "reports a duplex write failure to a later reader without an uncaught error", + Effect.gen(function* () { + if (process.platform === "win32") return + const uncaught: Array = [] + const onUncaught = (error: unknown) => uncaught.push(error) + yield* Effect.acquireRelease( + Effect.sync(() => process.on("uncaughtException", onUncaught)), + () => Effect.sync(() => process.off("uncaughtException", onUncaught)), + ) + // Under `bun test` (1.4.4) the process's first child with an extra fd never emits "spawn", so spawn one without. + yield* Effect.scoped(Effect.flatMap(ChildProcess.make("true"), (warmUp) => warmUp.exitCode)) + + // The child closes fd3 before signalling readiness on stdout. + const handle = yield* ChildProcess.make("sh", ["-c", "exec 3>&-; echo ready; exec sleep 10"], { + additionalFds: { fd3: { type: "duplex" } }, + }) + yield* Stream.runDrain(Stream.take(handle.stdout, 1)) + + // Write before anyone reads fd3, and start reading only after the write has failed. + const writeError = yield* Effect.flip( + Stream.run(Stream.make(new TextEncoder().encode("request")), handle.getInputFd(3)), + ) + const readError = yield* Effect.flip(Stream.runDrain(handle.getOutputFd(3)).pipe(Effect.timeout("2 seconds"))) + + expect(writeError._tag).toBe("PlatformError") + expect(uncaught).toEqual([]) + expect(readError._tag).toBe("PlatformError") + }), + ) }) describe("pipeline", () => { diff --git a/packages/core/test/fixture/spawn.ts b/packages/core/test/fixture/spawn.ts index 0436f15a06f..c2973b63f57 100644 --- a/packages/core/test/fixture/spawn.ts +++ b/packages/core/test/fixture/spawn.ts @@ -12,7 +12,7 @@ export function countingSpawner(fail?: (args: readonly string[]) => boolean) { Effect.map(ChildProcessSpawner.ChildProcessSpawner, (spawner) => ChildProcessSpawner.make((command) => { state.spawns++ - if (fail && command._tag === "StandardCommand" && fail(command.args)) + if (fail && command._tag === "StandardCommand" && fail(command.args.map(String))) return Effect.fail(PlatformError.systemError({ _tag: "Busy", module: "ChildProcess", method: "spawn" })) return spawner.spawn(command) }), diff --git a/packages/core/test/plugin/provider-azure.test.ts b/packages/core/test/plugin/provider-azure.test.ts index 5bdf8f214cb..49ec8b8a8fe 100644 --- a/packages/core/test/plugin/provider-azure.test.ts +++ b/packages/core/test/plugin/provider-azure.test.ts @@ -136,11 +136,12 @@ const fakeAzureCli = Effect.fn(function* (respond: (args: readonly string[]) => ...processes, run: (command) => { if (command._tag !== "StandardCommand") return processes.run(command) - commands.push([...command.args]) - const value = respond(command.args) + const args = command.args.map(String) + commands.push(args) + const value = respond(args) if (value instanceof Error) return Effect.fail(new AppProcess.AppProcessError({ command: "az", cause: value })) return Effect.succeed({ - command: `az ${command.args.join(" ")}`, + command: `az ${args.join(" ")}`, exitCode: 0, stdout: Buffer.from(JSON.stringify(value)), stderr: Buffer.alloc(0), diff --git a/packages/core/test/schedule.test.ts b/packages/core/test/schedule.test.ts index 147850fd6af..391e92dab92 100644 --- a/packages/core/test/schedule.test.ts +++ b/packages/core/test/schedule.test.ts @@ -125,7 +125,7 @@ const testEnvironment = Layer.effect( yield* files.mkdir(toggleDirectory).pipe(Effect.orDie) const spawner = ChildProcessSpawner.make((command) => Effect.gen(function* () { - const script = command._tag === "StandardCommand" ? (command.args.at(-1) ?? command.command) : "pipeline" + const script = command._tag === "StandardCommand" ? String(command.args.at(-1) ?? command.command) : "pipeline" shellState.runs.push(script) if (shellState.hangMs > 0) yield* Effect.sleep(shellState.hangMs) const outBytes = new TextEncoder().encode(shellState.stdout) diff --git a/packages/core/test/sqlite-interrupt.test.ts b/packages/core/test/sqlite-interrupt.test.ts new file mode 100644 index 00000000000..9242b08c252 --- /dev/null +++ b/packages/core/test/sqlite-interrupt.test.ts @@ -0,0 +1,78 @@ +import { describe, expect, test } from "bun:test" +import { Effect, Fiber, Layer, References } from "effect" +import { SqlClient } from "effect/sql" +import { sqliteLayer as bunSqliteLayer } from "@opencode/core/database/sqlite.bun" +import { sqliteLayer as workerdSqliteLayer } from "@opencode/core/database/sqlite.workerd" +import { makeDurableObjectStorage } from "./fixture/durable-object-storage" + +// The holder keeps the connection across yields, so the queued fiber parks in +// the semaphore's waiter queue and is woken when the holder lets go. The sweep +// moves the interrupt across that wait and the gap between the woken fiber +// taking the connection's only permit and registering its release. A leaked +// permit makes every later query wait forever. +const sweep = ( + layer: () => Layer.Layer, + queue: (sql: SqlClient.SqlClient) => Effect.Effect, +) => + Effect.runPromise( + Effect.gen(function* () { + const leaked: Array = [] + for (let delay = 0; delay < 31; delay++) { + yield* Effect.scoped( + Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient + const holder = yield* Effect.forkChild( + Effect.scoped(Effect.andThen(sql.reserve, Effect.andThen(Effect.yieldNow, Effect.yieldNow))), + ) + const queued = yield* queue(sql).pipe( + Effect.provideService(References.MaxOpsBeforeYield, 3), + Effect.forkChild, + ) + for (let i = 0; i < delay; i++) yield* Effect.yieldNow + yield* Fiber.interrupt(queued) + yield* Fiber.join(holder) + const next = yield* Effect.forkChild(sql`SELECT 3`, { startImmediately: true }) + if (next.pollUnsafe() === undefined) { + leaked.push(delay) + yield* Fiber.interrupt(next) + } + }).pipe(Effect.provide(layer())), + ) + } + return leaked + }), + ) + +describe("sqlite transaction interrupts", () => { + test("bun client releases the connection when a queued transaction is interrupted", async () => { + const leaked = await sweep( + () => bunSqliteLayer({ filename: ":memory:", disableWAL: true }), + (sql) => sql.withTransaction(sql`SELECT 2`), + ) + expect(leaked).toEqual([]) + }) + + test("bun client releases the connection when a queued reserve is interrupted", async () => { + const leaked = await sweep( + () => bunSqliteLayer({ filename: ":memory:", disableWAL: true }), + (sql) => Effect.scoped(Effect.andThen(sql.reserve, Effect.yieldNow)), + ) + expect(leaked).toEqual([]) + }) + + test("workerd client releases the connection when a queued reserve is interrupted", async () => { + const leaked = await sweep( + () => workerdSqliteLayer({ storage: makeDurableObjectStorage() }), + (sql) => Effect.scoped(Effect.andThen(sql.reserve, Effect.yieldNow)), + ) + expect(leaked).toEqual([]) + }) + + test("workerd client releases the connection when a queued transaction is interrupted", async () => { + const leaked = await sweep( + () => workerdSqliteLayer({ storage: makeDurableObjectStorage() }), + (sql) => sql.withTransaction(sql`SELECT 2`), + ) + expect(leaked).toEqual([]) + }) +}) diff --git a/packages/core/test/workspace.test.ts b/packages/core/test/workspace.test.ts index a09a7fa616f..db256e35d0c 100644 --- a/packages/core/test/workspace.test.ts +++ b/packages/core/test/workspace.test.ts @@ -424,7 +424,7 @@ it.effect("falls back to execDefaults over the connection spawner for unprovided const spawner = makeSpawner((command) => Effect.sync(() => { if (command._tag === "StandardCommand") { - spawned.push(command.args.at(3) ?? command.command) + spawned.push(String(command.args.at(3) ?? command.command)) } return makeHandle({ pid: ProcessId(1), diff --git a/packages/http-recorder/src/http/recorder.ts b/packages/http-recorder/src/http/recorder.ts index 53ad8801be8..bc215638ae0 100644 --- a/packages/http-recorder/src/http/recorder.ts +++ b/packages/http-recorder/src/http/recorder.ts @@ -63,7 +63,11 @@ const responseFromSnapshot = (request: HttpClientRequest.HttpClientRequest, snap export const redactedErrorRequest = ( request: HttpClientRequest.HttpClientRequest, redactedUrl = redactUrl(request.url), -) => HttpClientRequest.make(request.method)(redactedUrl) +) => { + // Received requests can carry any method string, which HttpClientRequest.make does not accept. + const base = HttpClientRequest.get(redactedUrl) + return HttpClientRequest.makeWith(request.method, base.url, base.urlParams, base.hash, base.headers, base.body) +} const transportError = (request: HttpClientRequest.HttpClientRequest, description: string, redactedUrl?: string) => new HttpClientError.HttpClientError({ reason: new HttpClientError.TransportError({ request: redactedErrorRequest(request, redactedUrl), description }), diff --git a/packages/protocol/openapi.json b/packages/protocol/openapi.json index a9862f86ba6..d16865b2af2 100644 --- a/packages/protocol/openapi.json +++ b/packages/protocol/openapi.json @@ -150,27 +150,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -278,27 +271,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -392,27 +378,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -492,27 +471,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -588,27 +560,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -696,27 +661,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -815,27 +773,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -924,9 +875,6 @@ "anyOf": [ { "type": "string" - }, - { - "type": "null" } ], "description": "Maximum number of sessions to return. Defaults to the newest 50 sessions." @@ -941,9 +889,6 @@ { "type": "string", "enum": ["asc", "desc"] - }, - { - "type": "null" } ], "description": "Session order for the first page. Use desc for newest first or asc for oldest first." @@ -954,14 +899,7 @@ "name": "search", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -971,21 +909,14 @@ "schema": { "anyOf": [ { - "anyOf": [ - { - "$ref": "#/components/schemas/Session.ID" - }, - { - "type": "string", - "enum": ["null"] - } - ], - "description": "Filter by parent session. Use null to return only root sessions." + "$ref": "#/components/schemas/Session.ID" }, { - "type": "null" + "type": "string", + "enum": ["null"] } - ] + ], + "description": "Filter by parent session. Use null to return only root sessions." }, "required": false }, @@ -993,15 +924,8 @@ "name": "archived", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["true", "false"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["true", "false"] }, "required": false }, @@ -1009,14 +933,7 @@ "name": "directory", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/AbsolutePath" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/AbsolutePath" }, "required": false }, @@ -1024,14 +941,7 @@ "name": "project", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Project.ID" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/Project.ID" }, "required": false }, @@ -1039,14 +949,7 @@ "name": "subpath", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/RelativePath" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/RelativePath" }, "required": false }, @@ -1054,14 +957,7 @@ "name": "cursor", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/SessionsCursor" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/SessionsCursor" }, "required": false } @@ -1269,14 +1165,7 @@ "name": "from", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -1284,14 +1173,7 @@ "name": "to", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -1299,14 +1181,7 @@ "name": "project", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Project.ID" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/Project.ID" }, "required": false }, @@ -1314,14 +1189,7 @@ "name": "timezone", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -1329,15 +1197,8 @@ "name": "tools", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["none", "summary", "detail"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["none", "summary", "detail"] }, "required": false } @@ -1502,15 +1363,8 @@ "name": "sanitize", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["true", "false"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["true", "false"] }, "required": false } @@ -3338,9 +3192,6 @@ "anyOf": [ { "$ref": "#/components/schemas/Session.Message.ID" - }, - { - "type": "null" } ], "description": "User message whose turn to diff. Defaults to the turn of the newest user message." @@ -3354,9 +3205,6 @@ "anyOf": [ { "$ref": "#/components/schemas/Session.Message.ID" - }, - { - "type": "null" } ], "description": "Later user message whose turn ends the range. Defaults to the turn of `from` alone." @@ -3370,9 +3218,6 @@ "anyOf": [ { "type": "string" - }, - { - "type": "null" } ], "description": "Unchanged lines around each hunk. Omit for full-file patches." @@ -4007,14 +3852,7 @@ "name": "after", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Event.SeqEncoded" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -4022,15 +3860,8 @@ "name": "follow", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["true", "false"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["true", "false"] }, "required": false } @@ -4180,15 +4011,8 @@ "name": "resume", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["true", "false"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["true", "false"] }, "required": false } @@ -4657,14 +4481,7 @@ "name": "message", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -4993,9 +4810,6 @@ "anyOf": [ { "type": "string" - }, - { - "type": "null" } ], "description": "Maximum number of messages to return. When omitted, the endpoint returns its default page size." @@ -5010,9 +4824,6 @@ { "type": "string", "enum": ["asc", "desc"] - }, - { - "type": "null" } ], "description": "Message order for the first page. Use desc for newest first or asc for oldest first." @@ -5023,15 +4834,8 @@ "name": "cursor", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "description": "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order." - }, - { - "type": "null" - } - ] + "type": "string", + "description": "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order." }, "required": false }, @@ -5055,9 +4859,6 @@ "compaction", "idle" ] - }, - { - "type": "null" } ], "description": "Filter by message type before pagination. When omitted, all message types are returned. Pass the same type when following cursors." @@ -5138,27 +4939,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -5177,9 +4971,6 @@ "items": { "$ref": "#/components/schemas/Model.Type" } - }, - { - "type": "null" } ], "description": "Only list models of these types. Defaults to chat, the only type offered for sessions." @@ -5266,27 +5057,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -5973,27 +5757,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6087,27 +5864,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6197,27 +5967,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6301,27 +6064,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6401,27 +6157,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6502,27 +6251,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6630,27 +6372,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6758,27 +6493,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -6904,27 +6632,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7021,27 +6742,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7113,27 +6827,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7230,27 +6937,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7376,27 +7076,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7493,27 +7186,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7569,27 +7255,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7673,27 +7352,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7779,27 +7451,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7870,27 +7535,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -7961,27 +7619,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -8044,27 +7695,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -8137,14 +7781,7 @@ "name": "x-opencode-ticket", "in": "header", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -8152,27 +7789,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -8263,27 +7893,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false }, @@ -8299,14 +7922,7 @@ "name": "ticket", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -8644,15 +8260,8 @@ "name": "archived", "in": "query", "schema": { - "anyOf": [ - { - "type": "string", - "enum": ["true", "false"] - }, - { - "type": "null" - } - ] + "type": "string", + "enum": ["true", "false"] }, "required": false } @@ -8792,27 +8401,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -8888,27 +8490,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -8984,14 +8579,7 @@ "name": "projectID", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Project.ID" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/Project.ID" }, "required": false } @@ -9616,27 +9204,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -9707,27 +9288,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -9740,9 +9314,6 @@ "anyOf": [ { "type": "string" - }, - { - "type": "null" } ], "description": "An absolute path or a path relative to the requested location. Defaults to the location directory." @@ -9826,27 +9397,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -9873,14 +9437,7 @@ "name": "limit", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -9954,27 +9511,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10067,27 +9617,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10176,27 +9719,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10270,27 +9806,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10366,27 +9895,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10478,27 +10000,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -10805,9 +10320,6 @@ } ] } - }, - { - "type": "null" } ], "description": "Only send events of these types, plus the initial server.connected event. When omitted, all events are sent." @@ -10942,27 +10454,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11036,27 +10541,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11171,27 +10669,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11277,27 +10768,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11416,27 +10900,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11507,14 +10984,7 @@ "name": "x-opencode-ticket", "in": "header", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -11522,27 +10992,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -11740,14 +11203,7 @@ "name": "lines", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/PersistentPty.ReadLinesEncoded" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -12387,14 +11843,7 @@ "name": "x-opencode-ticket", "in": "header", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -13120,27 +12569,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -13234,27 +12676,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false }, @@ -13262,14 +12697,7 @@ "name": "sessionID", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Session.ID" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/Session.ID" }, "required": false }, @@ -13277,14 +12705,7 @@ "name": "provider", "in": "query", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/Artifact.ProviderIDEncoded" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -13383,27 +12804,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -13522,27 +12936,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -13646,27 +13053,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -13783,27 +13183,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -13892,27 +13285,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false } @@ -14004,27 +13390,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14098,27 +13477,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14227,27 +13599,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14333,27 +13698,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14417,27 +13775,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14555,27 +13906,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14908,27 +14252,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -14938,14 +14275,7 @@ "name": "provider", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -15029,27 +14359,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15122,27 +14445,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15232,27 +14548,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15328,27 +14637,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15358,14 +14660,7 @@ "name": "search", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -15373,14 +14668,7 @@ "name": "limit", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false } @@ -15451,27 +14739,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15497,14 +14778,7 @@ "name": "context", "in": "query", "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "string" }, "required": false }, @@ -15599,9 +14873,6 @@ "anyOf": [ { "type": "string" - }, - { - "type": "null" } ], "description": "Absolute server-local directory to write the snapshot into, created when missing. Defaults to the server's log directory." @@ -15783,27 +15054,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -15962,27 +15226,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -16068,27 +15325,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -16191,27 +15441,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -16301,27 +15544,20 @@ "name": "location", "in": "query", "schema": { - "anyOf": [ - { - "type": "object", - "properties": { - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "type": "object", + "properties": { + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" } - }, - "additionalProperties": false - }, - { - "type": "null" + ] } - ] + }, + "additionalProperties": false }, "required": false, "style": "deepObject", @@ -18177,8 +17413,40 @@ } ] }, - "Event.SeqEncoded": { - "type": "string" + "Event.ID": { + "type": "string", + "pattern": "^evt_" + }, + "Event.Seq": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "Event.VersionEncoded_c3ea984aceae": { + "type": "number", + "enum": [2] + }, + "Event.VersionEncoded_c77c5abcb68d": { + "type": "number", + "enum": [1] + }, + "EventLog.Synced": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["log.synced"] + }, + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + } + }, + "required": ["type", "aggregateID"], + "additionalProperties": false, + "description": "Marker emitted once when a log read reaches its captured watermark. The reader holds every event committed at or below seq." }, "FileDiff.Info": { "type": "object", @@ -18272,6 +17540,12 @@ "$ref": "#/components/schemas/Form.Value" } }, + "Form.Answer_1": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Form.Value_1" + } + }, "Form.BooleanField": { "type": "object", "properties": { @@ -18307,6 +17581,41 @@ "required": ["key", "type"], "additionalProperties": false }, + "Form.BooleanField_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "when": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.When_1" + } + }, + "type": { + "type": "string", + "enum": ["boolean"] + }, + "default": { + "type": "boolean" + } + }, + "required": ["key", "type"], + "additionalProperties": false + }, "Form.CreatePayload": { "type": "object", "properties": { @@ -18403,6 +17712,28 @@ } ] }, + "Form.Field_1": { + "anyOf": [ + { + "$ref": "#/components/schemas/Form.StringField_1" + }, + { + "$ref": "#/components/schemas/Form.NumberField_1" + }, + { + "$ref": "#/components/schemas/Form.IntegerField_1" + }, + { + "$ref": "#/components/schemas/Form.BooleanField_1" + }, + { + "$ref": "#/components/schemas/Form.MultiselectField_1" + }, + { + "$ref": "#/components/schemas/Form.ExternalField" + } + ] + }, "Form.Fields": { "type": "array", "prefixItems": [ @@ -18415,6 +17746,18 @@ "$ref": "#/components/schemas/Form.Field" } }, + "Form.Fields_1": { + "type": "array", + "prefixItems": [ + { + "$ref": "#/components/schemas/Form.Field_1" + } + ], + "minItems": 1, + "items": { + "$ref": "#/components/schemas/Form.Field_1" + } + }, "Form.ID": { "type": "string", "pattern": "^frm_" @@ -18441,6 +17784,28 @@ "required": ["id", "sessionID", "title", "fields"], "additionalProperties": false }, + "Form.Info_1": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Form.ID" + }, + "sessionID": { + "type": "string" + }, + "title": { + "type": "string" + }, + "metadata": { + "$ref": "#/components/schemas/Form.Metadata" + }, + "fields": { + "$ref": "#/components/schemas/Form.Fields_1" + } + }, + "required": ["id", "sessionID", "title", "fields"], + "additionalProperties": false + }, "Form.IntegerField": { "type": "object", "properties": { @@ -18506,6 +17871,71 @@ "required": ["key", "type"], "additionalProperties": false }, + "Form.IntegerField_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "when": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.When_1" + } + }, + "type": { + "type": "string", + "enum": ["integer"] + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + }, + "default": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + } + }, + "required": ["key", "type"], + "additionalProperties": false + }, "Form.Metadata": { "type": "object" }, @@ -18566,6 +17996,63 @@ "required": ["key", "type", "options"], "additionalProperties": false }, + "Form.MultiselectField_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "when": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.When_1" + } + }, + "type": { + "type": "string", + "enum": ["multiselect"] + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.Option" + } + }, + "minItems": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "maxItems": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "custom": { + "type": "boolean" + }, + "default": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["key", "type", "options"], + "additionalProperties": false + }, "Form.NumberField": { "type": "object", "properties": { @@ -18631,6 +18118,71 @@ "required": ["key", "type"], "additionalProperties": false }, + "Form.NumberField_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "when": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.When_1" + } + }, + "type": { + "type": "string", + "enum": ["number"] + }, + "minimum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + }, + "maximum": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + }, + "default": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + } + ] + } + }, + "required": ["key", "type"], + "additionalProperties": false + }, "Form.Option": { "type": "object", "properties": { @@ -18764,6 +18316,70 @@ "required": ["key", "type"], "additionalProperties": false }, + "Form.StringField_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "required": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "when": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.When_1" + } + }, + "type": { + "type": "string", + "enum": ["string"] + }, + "format": { + "type": "string", + "enum": ["email", "uri", "date", "date-time"] + }, + "minLength": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "maxLength": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "pattern": { + "type": "string" + }, + "placeholder": { + "type": "string" + }, + "default": { + "type": "string" + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Form.Option" + } + }, + "custom": { + "type": "boolean" + } + }, + "required": ["key", "type"], + "additionalProperties": false + }, "Form.Value": { "anyOf": [ { @@ -18787,6 +18403,29 @@ } ] }, + "Form.Value_1": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, "Form.When": { "type": "object", "properties": { @@ -18818,6 +18457,37 @@ "required": ["key", "op", "value"], "additionalProperties": false }, + "Form.When_1": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "op": { + "type": "string", + "enum": ["eq", "neq"] + }, + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "string", + "enum": ["NaN", "Infinity", "-Infinity"] + }, + { + "type": "boolean" + } + ] + } + }, + "required": ["key", "op", "value"], + "additionalProperties": false + }, "FormAlreadySettledErrorEncoded": { "type": "object", "properties": { @@ -19393,6 +19063,14 @@ "required": ["data"], "additionalProperties": false }, + "Instruction.Hash": { + "type": "string", + "pattern": "^[a-f0-9]{64}$" + }, + "Instruction.Key": { + "type": "string", + "pattern": "^[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._/-]*$" + }, "InstructionEntry.Info": { "type": "object", "properties": { @@ -19411,6 +19089,25 @@ "pattern": "^[a-z0-9][a-z0-9._-]*$", "description": "Instruction entry key (lowercase alphanumerics plus . _ -)" }, + "InstructionEntry.Snapshot": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "$ref": "#/components/schemas/InstructionEntry.Key" + }, + "value": { + "description": "JSON value attached to the session's instructions" + }, + "removed": { + "type": "boolean" + } + }, + "required": ["key", "value", "removed"], + "additionalProperties": false + } + }, "InstructionEntryValueTooLargeErrorEncoded": { "type": "object", "properties": { @@ -20154,6 +19851,19 @@ "required": ["directory"], "additionalProperties": false }, + "Location.Ref": { + "type": "object", + "properties": { + "directory": { + "$ref": "#/components/schemas/AbsolutePath" + }, + "workspaceID": { + "$ref": "#/components/schemas/Workspace.ID" + } + }, + "required": ["directory"], + "additionalProperties": false + }, "LocationNotFoundErrorEncoded": { "type": "object", "properties": { @@ -21239,9 +20949,6 @@ ], "additionalProperties": false }, - "PersistentPty.ReadLinesEncoded": { - "type": "string" - }, "PersistentPty.ReadResult": { "type": "object", "properties": { @@ -22821,6 +22528,151 @@ "required": ["_tag", "message"], "additionalProperties": false }, + "Session.Event.Durable": { + "anyOf": [ + { + "$ref": "#/components/schemas/session.created" + }, + { + "$ref": "#/components/schemas/session.agent.selected" + }, + { + "$ref": "#/components/schemas/session.model.selected" + }, + { + "$ref": "#/components/schemas/session.moved" + }, + { + "$ref": "#/components/schemas/session.renamed" + }, + { + "$ref": "#/components/schemas/session.metadata.updated" + }, + { + "$ref": "#/components/schemas/session.permissions" + }, + { + "$ref": "#/components/schemas/session.viewed" + }, + { + "$ref": "#/components/schemas/session.archived" + }, + { + "$ref": "#/components/schemas/session.unarchived" + }, + { + "$ref": "#/components/schemas/session.deleted" + }, + { + "$ref": "#/components/schemas/session.forked" + }, + { + "$ref": "#/components/schemas/session.inbox.delivered" + }, + { + "$ref": "#/components/schemas/session.inbox.enqueued" + }, + { + "$ref": "#/components/schemas/session.inbox.cancelled" + }, + { + "$ref": "#/components/schemas/session.inbox.delivery.changed" + }, + { + "$ref": "#/components/schemas/session.execution.started" + }, + { + "$ref": "#/components/schemas/session.execution.succeeded" + }, + { + "$ref": "#/components/schemas/session.execution.failed" + }, + { + "$ref": "#/components/schemas/session.execution.interrupted" + }, + { + "$ref": "#/components/schemas/session.instructions.updated" + }, + { + "$ref": "#/components/schemas/session.synthetic" + }, + { + "$ref": "#/components/schemas/session.skill.activated" + }, + { + "$ref": "#/components/schemas/session.shell.started" + }, + { + "$ref": "#/components/schemas/session.shell.ended" + }, + { + "$ref": "#/components/schemas/session.step.started" + }, + { + "$ref": "#/components/schemas/session.step.streamed" + }, + { + "$ref": "#/components/schemas/session.step.ended" + }, + { + "$ref": "#/components/schemas/session.step.failed" + }, + { + "$ref": "#/components/schemas/session.text.started" + }, + { + "$ref": "#/components/schemas/session.text.ended" + }, + { + "$ref": "#/components/schemas/session.reasoning.started" + }, + { + "$ref": "#/components/schemas/session.reasoning.ended" + }, + { + "$ref": "#/components/schemas/session.tool.input.started" + }, + { + "$ref": "#/components/schemas/session.tool.input.ended" + }, + { + "$ref": "#/components/schemas/session.tool.called" + }, + { + "$ref": "#/components/schemas/session.tool.success" + }, + { + "$ref": "#/components/schemas/session.tool.failed" + }, + { + "$ref": "#/components/schemas/session.retry.scheduled" + }, + { + "$ref": "#/components/schemas/session.compaction.started" + }, + { + "$ref": "#/components/schemas/session.compaction.ended" + }, + { + "$ref": "#/components/schemas/session.compaction.failed" + }, + { + "$ref": "#/components/schemas/session.revert.staged" + }, + { + "$ref": "#/components/schemas/session.revert.cleared" + }, + { + "$ref": "#/components/schemas/session.revert.committed" + }, + { + "$ref": "#/components/schemas/session.usage.recorded" + }, + { + "$ref": "#/components/schemas/session.message.content.updated" + } + ] + }, "Session.ForkBoundary": { "anyOf": [ { @@ -22915,6 +22767,78 @@ } ] }, + "Session.Inbox.Item": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["user"] + }, + "payload": { + "$ref": "#/components/schemas/Session.Inbox.UserPayload" + }, + "delivery": { + "$ref": "#/components/schemas/Session.Inbox.Delivery" + } + }, + "required": ["type", "payload", "delivery"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["synthetic"] + }, + "payload": { + "$ref": "#/components/schemas/Session.Inbox.SyntheticPayload" + }, + "delivery": { + "$ref": "#/components/schemas/Session.Inbox.Delivery" + } + }, + "required": ["type", "payload", "delivery"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["compaction"] + }, + "payload": { + "$ref": "#/components/schemas/Session.Inbox.CompactionPayload" + }, + "delivery": { + "$ref": "#/components/schemas/Session.Inbox.Delivery" + } + }, + "required": ["type", "payload", "delivery"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["move"] + }, + "payload": { + "$ref": "#/components/schemas/Session.Inbox.MovePayload_1" + }, + "delivery": { + "$ref": "#/components/schemas/Session.Inbox.Delivery" + } + }, + "required": ["type", "payload", "delivery"], + "additionalProperties": false + } + ] + }, "Session.Inbox.Move": { "type": "object", "properties": { @@ -22964,6 +22888,22 @@ "required": ["projectID", "location"], "additionalProperties": false }, + "Session.Inbox.MovePayload_1": { + "type": "object", + "properties": { + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "projectID": { + "$ref": "#/components/schemas/Project.ID" + }, + "subpath": { + "$ref": "#/components/schemas/RelativePath" + } + }, + "required": ["location", "projectID"], + "additionalProperties": false + }, "Session.Inbox.Synthetic": { "type": "object", "properties": { @@ -23413,6 +23353,19 @@ "required": ["type", "id", "name", "state", "time"], "additionalProperties": false }, + "Session.Message.AssistantContent.Encoded": { + "anyOf": [ + { + "$ref": "#/components/schemas/Session.Message.Assistant.Text" + }, + { + "$ref": "#/components/schemas/Session.Message.Assistant.Reasoning" + }, + { + "$ref": "#/components/schemas/Session.Message.Assistant.Tool" + } + ] + }, "Session.Message.Compaction": { "anyOf": [ { @@ -24158,9 +24111,22 @@ "required": ["interrupted"], "additionalProperties": false }, + "SessionLogItem": { + "anyOf": [ + { + "$ref": "#/components/schemas/Session.Event.Durable" + }, + { + "$ref": "#/components/schemas/EventLog.Synced" + } + ] + }, "SessionLogItemEncoded": { "type": "string", - "contentMediaType": "application/json" + "contentMediaType": "application/json", + "contentSchema": { + "$ref": "#/components/schemas/SessionLogItem" + } }, "SessionMessagesResponse": { "type": "object", @@ -24447,6 +24413,117 @@ } ] }, + "SessionStatus": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["idle"] + } + }, + "required": ["type"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["retry"] + }, + "attempt": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "message": { + "type": "string" + }, + "action": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "title": { + "type": "string" + }, + "message": { + "type": "string" + }, + "label": { + "type": "string" + }, + "link": { + "type": "string" + } + }, + "required": ["reason", "provider", "title", "message", "label"], + "additionalProperties": false + }, + "next": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["type", "attempt", "message", "next"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["busy"] + } + }, + "required": ["type"], + "additionalProperties": false + } + ] + }, + "SessionStatusUpdated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.status"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "status": { + "$ref": "#/components/schemas/SessionStatus" + } + }, + "required": ["sessionID", "status"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, "SessionTransfer.Data": { "type": "object", "properties": { @@ -24924,9 +25001,382 @@ "required": ["percent", "limited", "resetsAt"], "additionalProperties": false }, + "V2Event": { + "anyOf": [ + { + "$ref": "#/components/schemas/location.shutdown" + }, + { + "$ref": "#/components/schemas/models-dev.refreshed" + }, + { + "$ref": "#/components/schemas/credential.updated" + }, + { + "$ref": "#/components/schemas/credential.switched" + }, + { + "$ref": "#/components/schemas/integration.updated" + }, + { + "$ref": "#/components/schemas/provider.updated" + }, + { + "$ref": "#/components/schemas/model.updated" + }, + { + "$ref": "#/components/schemas/agent.updated" + }, + { + "$ref": "#/components/schemas/session.created" + }, + { + "$ref": "#/components/schemas/session.agent.selected" + }, + { + "$ref": "#/components/schemas/session.model.selected" + }, + { + "$ref": "#/components/schemas/session.moved" + }, + { + "$ref": "#/components/schemas/session.renamed" + }, + { + "$ref": "#/components/schemas/session.metadata.updated" + }, + { + "$ref": "#/components/schemas/session.permissions" + }, + { + "$ref": "#/components/schemas/session.viewed" + }, + { + "$ref": "#/components/schemas/session.archived" + }, + { + "$ref": "#/components/schemas/session.unarchived" + }, + { + "$ref": "#/components/schemas/session.usage.updated" + }, + { + "$ref": "#/components/schemas/session.deleted" + }, + { + "$ref": "#/components/schemas/session.forked" + }, + { + "$ref": "#/components/schemas/session.inbox.delivered" + }, + { + "$ref": "#/components/schemas/session.inbox.enqueued" + }, + { + "$ref": "#/components/schemas/session.inbox.cancelled" + }, + { + "$ref": "#/components/schemas/session.inbox.delivery.changed" + }, + { + "$ref": "#/components/schemas/session.execution.started" + }, + { + "$ref": "#/components/schemas/session.execution.succeeded" + }, + { + "$ref": "#/components/schemas/session.execution.failed" + }, + { + "$ref": "#/components/schemas/session.execution.interrupted" + }, + { + "$ref": "#/components/schemas/session.instructions.updated" + }, + { + "$ref": "#/components/schemas/session.synthetic" + }, + { + "$ref": "#/components/schemas/session.skill.activated" + }, + { + "$ref": "#/components/schemas/session.shell.started" + }, + { + "$ref": "#/components/schemas/session.shell.ended" + }, + { + "$ref": "#/components/schemas/session.step.started" + }, + { + "$ref": "#/components/schemas/session.step.streamed" + }, + { + "$ref": "#/components/schemas/session.step.ended" + }, + { + "$ref": "#/components/schemas/session.step.failed" + }, + { + "$ref": "#/components/schemas/session.text.started" + }, + { + "$ref": "#/components/schemas/session.text.delta" + }, + { + "$ref": "#/components/schemas/session.text.ended" + }, + { + "$ref": "#/components/schemas/session.reasoning.started" + }, + { + "$ref": "#/components/schemas/session.reasoning.delta" + }, + { + "$ref": "#/components/schemas/session.reasoning.ended" + }, + { + "$ref": "#/components/schemas/session.tool.input.started" + }, + { + "$ref": "#/components/schemas/session.tool.input.delta" + }, + { + "$ref": "#/components/schemas/session.tool.input.ended" + }, + { + "$ref": "#/components/schemas/session.tool.called" + }, + { + "$ref": "#/components/schemas/session.tool.progress" + }, + { + "$ref": "#/components/schemas/session.tool.success" + }, + { + "$ref": "#/components/schemas/session.tool.failed" + }, + { + "$ref": "#/components/schemas/session.retry.scheduled" + }, + { + "$ref": "#/components/schemas/session.compaction.started" + }, + { + "$ref": "#/components/schemas/session.compaction.delta" + }, + { + "$ref": "#/components/schemas/session.compaction.ended" + }, + { + "$ref": "#/components/schemas/session.compaction.failed" + }, + { + "$ref": "#/components/schemas/session.revert.staged" + }, + { + "$ref": "#/components/schemas/session.revert.cleared" + }, + { + "$ref": "#/components/schemas/session.revert.committed" + }, + { + "$ref": "#/components/schemas/filesystem.changed" + }, + { + "$ref": "#/components/schemas/reference.updated" + }, + { + "$ref": "#/components/schemas/permission.asked" + }, + { + "$ref": "#/components/schemas/permission.replied" + }, + { + "$ref": "#/components/schemas/plugin.updated" + }, + { + "$ref": "#/components/schemas/project.updated" + }, + { + "$ref": "#/components/schemas/worktree.updated" + }, + { + "$ref": "#/components/schemas/worktree.resolved" + }, + { + "$ref": "#/components/schemas/command.updated" + }, + { + "$ref": "#/components/schemas/config.updated" + }, + { + "$ref": "#/components/schemas/skill.updated" + }, + { + "$ref": "#/components/schemas/pty.created" + }, + { + "$ref": "#/components/schemas/pty.updated" + }, + { + "$ref": "#/components/schemas/pty.exited" + }, + { + "$ref": "#/components/schemas/pty.deleted" + }, + { + "$ref": "#/components/schemas/persistent-pty.added" + }, + { + "$ref": "#/components/schemas/persistent-pty.removed" + }, + { + "$ref": "#/components/schemas/persistent-pty.updated" + }, + { + "$ref": "#/components/schemas/shell.created" + }, + { + "$ref": "#/components/schemas/shell.exited" + }, + { + "$ref": "#/components/schemas/shell.deleted" + }, + { + "$ref": "#/components/schemas/form.created" + }, + { + "$ref": "#/components/schemas/form.replied" + }, + { + "$ref": "#/components/schemas/form.cancelled" + }, + { + "$ref": "#/components/schemas/websearch.updated" + }, + { + "$ref": "#/components/schemas/artifact.updated" + }, + { + "$ref": "#/components/schemas/SessionStatusUpdated" + }, + { + "$ref": "#/components/schemas/session.idle" + }, + { + "$ref": "#/components/schemas/tui.prompt.append" + }, + { + "$ref": "#/components/schemas/tui.command.execute" + }, + { + "$ref": "#/components/schemas/tui.toast.show" + }, + { + "$ref": "#/components/schemas/tui.session.select" + }, + { + "$ref": "#/components/schemas/installation.updated" + }, + { + "$ref": "#/components/schemas/installation.update-available" + }, + { + "$ref": "#/components/schemas/vcs.branch.updated" + }, + { + "$ref": "#/components/schemas/mcp.status.changed" + }, + { + "$ref": "#/components/schemas/mcp.resources.changed" + }, + { + "$ref": "#/components/schemas/V2Event.rpc" + }, + { + "$ref": "#/components/schemas/V2Event.server.connected" + } + ] + }, + "V2Event.rpc": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "pattern": "^rpc\\.[\\s\\S]*?$" + }, + "location": { + "$ref": "#/components/schemas/Location.PublicRef" + }, + "data": { + "type": "object" + } + }, + "required": ["id", "created", "type", "location", "data"], + "additionalProperties": false + }, + "V2Event.server.connected": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "metadata": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "location": { + "anyOf": [ + { + "$ref": "#/components/schemas/Location.PublicRef" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "enum": ["server.connected"] + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "type", "data"], + "additionalProperties": false + }, "V2EventEncoded": { "type": "string", - "contentMediaType": "application/json" + "contentMediaType": "application/json", + "contentSchema": { + "$ref": "#/components/schemas/V2Event" + } }, "Vcs.Base": { "type": "object", @@ -25256,6 +25706,10 @@ "required": ["url", "time"], "additionalProperties": false }, + "Workspace.ID": { + "type": "string", + "pattern": "^wrk" + }, "Worktree.CreateInput": { "type": "object", "properties": { @@ -25357,6 +25811,4593 @@ }, "required": ["_tag", "name", "data"], "additionalProperties": false + }, + "agent.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["agent.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "artifact.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["artifact.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "command.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["command.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "config.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["config.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "credential.switched": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["credential.switched"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "integrationID": { + "$ref": "#/components/schemas/Integration.ID" + }, + "credentialID": { + "anyOf": [ + { + "$ref": "#/components/schemas/Credential.ID" + }, + { + "type": "null" + } + ] + } + }, + "required": ["integrationID", "credentialID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "credential.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["credential.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "filesystem.changed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["filesystem.changed"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "event": { + "type": "string", + "enum": ["add", "change", "unlink"] + } + }, + "required": ["file", "event"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "form.cancelled": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["form.cancelled"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Form.ID" + }, + "sessionID": { + "type": "string" + } + }, + "required": ["id", "sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "form.created": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["form.created"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "form": { + "$ref": "#/components/schemas/Form.Info_1" + } + }, + "required": ["form"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "form.replied": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["form.replied"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Form.ID" + }, + "sessionID": { + "type": "string" + }, + "answer": { + "$ref": "#/components/schemas/Form.Answer_1" + } + }, + "required": ["id", "sessionID", "answer"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "installation.update-available": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["installation.update-available"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "version": { + "type": "string" + } + }, + "required": ["version"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "installation.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["installation.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "version": { + "type": "string" + } + }, + "required": ["version"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "integration.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["integration.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "location.shutdown": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["location.shutdown"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "mcp.resources.changed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["mcp.resources.changed"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "server": { + "type": "string" + } + }, + "required": ["server"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "mcp.status.changed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["mcp.status.changed"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "server": { + "type": "string" + } + }, + "required": ["server"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "model.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["model.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "models-dev.refreshed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["models-dev.refreshed"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "permission.asked": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["permission.asked"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Permission.ID" + }, + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "action": { + "type": "string" + }, + "resources": { + "type": "array", + "items": { + "type": "string" + } + }, + "save": { + "type": "array", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object" + }, + "source": { + "$ref": "#/components/schemas/Permission.Source" + }, + "message": { + "type": "string" + } + }, + "required": ["id", "sessionID", "action", "resources"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "permission.replied": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["permission.replied"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "requestID": { + "$ref": "#/components/schemas/Permission.ID" + }, + "reply": { + "$ref": "#/components/schemas/Permission.Reply" + } + }, + "required": ["sessionID", "requestID", "reply"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "persistent-pty.added": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["persistent-pty.added"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "terminal": { + "$ref": "#/components/schemas/PersistentPty.Info" + } + }, + "required": ["sessionID", "terminal"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "persistent-pty.removed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["persistent-pty.removed"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "ptyID": { + "$ref": "#/components/schemas/Pty.ID" + } + }, + "required": ["sessionID", "ptyID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "persistent-pty.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["persistent-pty.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "terminal": { + "$ref": "#/components/schemas/PersistentPty.Info" + } + }, + "required": ["sessionID", "terminal"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "plugin.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["plugin.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "project.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["project.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Project.ID" + }, + "canonical": { + "$ref": "#/components/schemas/AbsolutePath" + }, + "vcs": { + "$ref": "#/components/schemas/Project.Vcs" + }, + "name": { + "type": "string" + }, + "icon": { + "$ref": "#/components/schemas/Project.Icon" + }, + "commands": { + "$ref": "#/components/schemas/Project.Commands" + }, + "time": { + "$ref": "#/components/schemas/Project.Time" + }, + "sandboxes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["id", "canonical", "time", "sandboxes"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "provider.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["provider.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "pty.created": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["pty.created"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Pty" + } + }, + "required": ["info"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "pty.deleted": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["pty.deleted"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Pty.ID" + } + }, + "required": ["id"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "pty.exited": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["pty.exited"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Pty.ID" + }, + "exitCode": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["id", "exitCode"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "pty.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["pty.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Pty" + } + }, + "required": ["info"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "reference.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["reference.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.agent.selected": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.agent.selected"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "agent": { + "$ref": "#/components/schemas/Agent.ID" + }, + "previous": { + "$ref": "#/components/schemas/Agent.ID" + } + }, + "required": ["sessionID", "agent"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.archived": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.archived"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.compaction.delta": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.compaction.delta"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "text": { + "type": "string" + } + }, + "required": ["sessionID", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.compaction.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.compaction.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "reason": { + "type": "string", + "enum": ["auto", "manual"] + }, + "model": { + "$ref": "#/components/schemas/Model.Ref" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + }, + "text": { + "type": "string" + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + } + }, + "required": ["sessionID", "reason", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.compaction.failed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.compaction.failed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "reason": { + "type": "string", + "enum": ["auto", "manual"] + }, + "error": { + "$ref": "#/components/schemas/Session.StructuredError" + }, + "inputID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + } + }, + "required": ["sessionID", "reason", "error"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.compaction.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.compaction.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "reason": { + "type": "string", + "enum": ["auto", "manual"] + }, + "inputID": { + "$ref": "#/components/schemas/Session.Message.ID" + } + }, + "required": ["sessionID", "reason"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.created": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.created"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "projectID": { + "$ref": "#/components/schemas/Project.ID" + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "subpath": { + "$ref": "#/components/schemas/RelativePath" + }, + "parentID": { + "$ref": "#/components/schemas/Session.ID" + }, + "slug": { + "type": "string" + }, + "title": { + "type": "string" + }, + "agent": { + "$ref": "#/components/schemas/Agent.ID" + }, + "model": { + "$ref": "#/components/schemas/Model.Ref" + }, + "metadata": { + "$ref": "#/components/schemas/Session.Metadata" + }, + "permissions": { + "$ref": "#/components/schemas/Permission.Ruleset" + }, + "version": { + "type": "string" + } + }, + "required": ["sessionID", "projectID", "location", "slug", "version"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.deleted": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.deleted"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c3ea984aceae" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.execution.failed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.execution.failed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "error": { + "$ref": "#/components/schemas/Session.StructuredError" + } + }, + "required": ["sessionID", "error"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.execution.interrupted": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.execution.interrupted"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "reason": { + "type": "string", + "enum": ["user", "shutdown", "superseded", "inactivity"] + } + }, + "required": ["sessionID", "reason"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.execution.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.execution.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.execution.succeeded": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.execution.succeeded"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.forked": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.forked"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c3ea984aceae" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "parentID": { + "$ref": "#/components/schemas/Session.ID" + }, + "boundary": { + "$ref": "#/components/schemas/Session.ForkBoundary" + }, + "instructions": { + "type": "object", + "patternProperties": { + "^[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._/-]*$": { + "$ref": "#/components/schemas/Instruction.Hash" + } + }, + "additionalProperties": false + }, + "instructionEntries": { + "$ref": "#/components/schemas/InstructionEntry.Snapshot" + } + }, + "required": ["sessionID", "parentID", "boundary"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.idle": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.idle"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.inbox.cancelled": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.inbox.cancelled"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "inboxID": { + "$ref": "#/components/schemas/Session.Message.ID" + } + }, + "required": ["sessionID", "inboxID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.inbox.delivered": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.inbox.delivered"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "inboxID": { + "$ref": "#/components/schemas/Session.Message.ID" + } + }, + "required": ["sessionID", "inboxID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.inbox.delivery.changed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.inbox.delivery.changed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "inboxID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "delivery": { + "$ref": "#/components/schemas/Session.Inbox.Delivery" + } + }, + "required": ["sessionID", "inboxID", "delivery"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.inbox.enqueued": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.inbox.enqueued"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "inboxID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "item": { + "$ref": "#/components/schemas/Session.Inbox.Item" + } + }, + "required": ["sessionID", "inboxID", "item"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.instructions.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.instructions.updated"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c3ea984aceae" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "delta": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/components/schemas/Instruction.Hash" + }, + { + "type": "string", + "enum": ["removed"] + } + ] + } + }, + "text": { + "type": "string" + } + }, + "required": ["sessionID", "delta"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.message.content.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.message.content.updated"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "messageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Session.Message.AssistantContent.Encoded" + } + } + }, + "required": ["sessionID", "messageID", "content"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.metadata.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.metadata.updated"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "metadata": { + "$ref": "#/components/schemas/Session.Metadata" + } + }, + "required": ["sessionID", "metadata"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.model.selected": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.model.selected"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "model": { + "$ref": "#/components/schemas/Model.Ref" + }, + "previous": { + "$ref": "#/components/schemas/Model.Ref" + } + }, + "required": ["sessionID", "model"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.moved": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.moved"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "projectID": { + "$ref": "#/components/schemas/Project.ID" + }, + "subpath": { + "$ref": "#/components/schemas/RelativePath" + } + }, + "required": ["sessionID", "location", "projectID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.permissions": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.permissions"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "permissions": { + "$ref": "#/components/schemas/Permission.Ruleset" + } + }, + "required": ["sessionID", "permissions"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.reasoning.delta": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.reasoning.delta"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "delta": { + "type": "string" + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal", "delta"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.reasoning.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.reasoning.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "text": { + "type": "string" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.reasoning.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.reasoning.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.renamed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.renamed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "title": { + "type": "string" + } + }, + "required": ["sessionID", "title"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.retry.scheduled": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.retry.scheduled"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "attempt": { + "type": "integer", + "maximum": 9007199254740991, + "exclusiveMinimum": 0 + }, + "at": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "error": { + "$ref": "#/components/schemas/Session.StructuredError" + } + }, + "required": ["sessionID", "assistantMessageID", "attempt", "at", "error"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.revert.cleared": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.revert.cleared"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.revert.committed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.revert.committed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "to": { + "$ref": "#/components/schemas/Session.Message.ID" + } + }, + "required": ["sessionID", "to"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.revert.staged": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.revert.staged"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "revert": { + "$ref": "#/components/schemas/Session.Revert" + } + }, + "required": ["sessionID", "revert"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.shell.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.shell.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "shell": { + "$ref": "#/components/schemas/Shell.Info" + }, + "output": { + "type": "object", + "properties": { + "output": { + "type": "string" + }, + "cursor": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "size": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "truncated": { + "type": "boolean" + } + }, + "required": ["output", "cursor", "size", "truncated"], + "additionalProperties": false + } + }, + "required": ["sessionID", "shell", "output"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.shell.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.shell.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "shell": { + "$ref": "#/components/schemas/Shell.Info" + } + }, + "required": ["sessionID", "shell"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.skill.activated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.skill.activated"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "id": { + "$ref": "#/components/schemas/Skill.ID" + }, + "name": { + "$ref": "#/components/schemas/Skill.Name" + }, + "text": { + "type": "string" + } + }, + "required": ["sessionID", "id", "name", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.step.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.step.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "finish": { + "type": "string", + "enum": ["stop", "length", "tool-calls", "content-filter", "error", "unknown"] + }, + "rawFinish": { + "type": "string" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + }, + "snapshot": { + "$ref": "#/components/schemas/Snapshot.ID" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelativePath" + } + } + }, + "required": ["sessionID", "assistantMessageID", "finish", "cost", "tokens"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.step.failed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.step.failed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "error": { + "$ref": "#/components/schemas/Session.StructuredError" + }, + "finish": { + "anyOf": [ + { + "type": "string", + "enum": ["content-filter"] + } + ] + }, + "rawFinish": { + "type": "string" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + }, + "snapshot": { + "$ref": "#/components/schemas/Snapshot.ID" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelativePath" + } + } + }, + "required": ["sessionID", "assistantMessageID", "error"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.step.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.step.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "agent": { + "$ref": "#/components/schemas/Agent.ID" + }, + "model": { + "$ref": "#/components/schemas/Model.Ref" + }, + "snapshot": { + "$ref": "#/components/schemas/Snapshot.ID" + }, + "started": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["sessionID", "assistantMessageID", "agent", "model", "started"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.step.streamed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.step.streamed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + } + }, + "required": ["sessionID", "assistantMessageID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.synthetic": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.synthetic"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "text": { + "type": "string" + }, + "description": { + "type": "string" + }, + "metadata": { + "type": "object" + } + }, + "required": ["sessionID", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.text.delta": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.text.delta"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "delta": { + "type": "string" + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal", "delta"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.text.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.text.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "text": { + "type": "string" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.text.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.text.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "ordinal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["sessionID", "assistantMessageID", "ordinal"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.tool.called": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.called"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "input": { + "type": "object" + }, + "executed": { + "type": "boolean" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "input", "executed"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.tool.failed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.failed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c3ea984aceae" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "error": { + "$ref": "#/components/schemas/Session.StructuredError" + }, + "content": { + "type": "array", + "prefixItems": [ + { + "$ref": "#/components/schemas/Tool.Content" + } + ], + "minItems": 1, + "items": { + "$ref": "#/components/schemas/Tool.Content" + } + }, + "metadata": { + "type": "object" + }, + "executed": { + "type": "boolean" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "error", "executed"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.tool.input.delta": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.input.delta"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "delta": { + "type": "string" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "delta"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.tool.input.ended": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.input.ended"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.tool.input.started": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.input.started"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "name"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.tool.progress": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.progress"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "metadata": { + "type": "object" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "metadata"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.tool.success": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.tool.success"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c3ea984aceae" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "assistantMessageID": { + "$ref": "#/components/schemas/Session.Message.ID" + }, + "id": { + "type": "string" + }, + "content": { + "type": "array", + "prefixItems": [ + { + "$ref": "#/components/schemas/Tool.Content" + } + ], + "minItems": 1, + "items": { + "$ref": "#/components/schemas/Tool.Content" + } + }, + "metadata": { + "type": "object" + }, + "executed": { + "type": "boolean" + }, + "native": { + "$ref": "#/components/schemas/Session.Message.Native" + } + }, + "required": ["sessionID", "assistantMessageID", "id", "content", "executed"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.unarchived": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.unarchived"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.usage.recorded": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.usage.recorded"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "source": { + "type": "string", + "enum": ["title", "compaction"] + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + } + }, + "required": ["sessionID", "source", "cost", "tokens"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "session.usage.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.usage.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "cost": { + "$ref": "#/components/schemas/Money.USD" + }, + "tokens": { + "$ref": "#/components/schemas/TokenUsage.Info" + } + }, + "required": ["sessionID", "cost", "tokens"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "session.viewed": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["session.viewed"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "$ref": "#/components/schemas/Session.ID" + }, + "idle": { + "type": "number" + } + }, + "required": ["sessionID", "idle"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "shell.created": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["shell.created"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "info": { + "$ref": "#/components/schemas/Shell.Info" + } + }, + "required": ["info"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "shell.deleted": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["shell.deleted"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Shell.ID" + } + }, + "required": ["id"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "shell.exited": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["shell.exited"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Shell.ID" + }, + "exit": { + "type": "number" + }, + "status": { + "type": "string", + "enum": ["running", "exited", "timeout", "killed"] + } + }, + "required": ["id", "status"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "skill.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["skill.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "tui.command.execute": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["tui.command.execute"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "command": { + "anyOf": [ + { + "type": "string", + "enum": [ + "session.list", + "session.new", + "session.interrupt", + "session.background", + "session.compact", + "session.page.up", + "session.page.down", + "session.line.up", + "session.line.down", + "session.half.page.up", + "session.half.page.down", + "session.first", + "session.last", + "prompt.clear", + "prompt.submit", + "agent.cycle" + ] + }, + { + "type": "string" + } + ] + } + }, + "required": ["command"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "tui.prompt.append": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["tui.prompt.append"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "required": ["text"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "tui.session.select": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["tui.session.select"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "sessionID": { + "allOf": [ + { + "$ref": "#/components/schemas/Session.ID" + }, + { + "description": "Session ID to navigate to" + } + ] + } + }, + "required": ["sessionID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "tui.toast.show": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["tui.toast.show"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "message": { + "type": "string" + }, + "variant": { + "type": "string", + "enum": ["info", "success", "warning", "error"] + }, + "duration": { + "anyOf": [ + { + "type": "integer", + "maximum": 9007199254740991, + "exclusiveMinimum": 0 + }, + { + "type": "null" + } + ] + } + }, + "required": ["message", "variant"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "vcs.branch.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["vcs.branch.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "branch": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "websearch.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["websearch.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "not": { + "type": "null" + } + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false + }, + "worktree.resolved": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["worktree.resolved"] + }, + "durable": { + "type": "object", + "properties": { + "aggregateID": { + "type": "string" + }, + "seq": { + "$ref": "#/components/schemas/Event.Seq" + }, + "version": { + "$ref": "#/components/schemas/Event.VersionEncoded_c77c5abcb68d" + } + }, + "required": ["aggregateID", "seq", "version"], + "additionalProperties": false + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "projectID": { + "$ref": "#/components/schemas/Project.ID" + }, + "directory": { + "$ref": "#/components/schemas/AbsolutePath" + }, + "previous": { + "$ref": "#/components/schemas/Project.ID" + }, + "adopted": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Project.ID" + } + } + }, + "required": ["projectID", "directory", "previous"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "durable", "data"], + "additionalProperties": false + }, + "worktree.updated": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Event.ID" + }, + "created": { + "type": "number" + }, + "metadata": { + "type": "object" + }, + "type": { + "type": "string", + "enum": ["worktree.updated"] + }, + "location": { + "$ref": "#/components/schemas/Location.Ref" + }, + "data": { + "type": "object", + "properties": { + "projectID": { + "$ref": "#/components/schemas/Project.ID" + } + }, + "required": ["projectID"], + "additionalProperties": false + } + }, + "required": ["id", "created", "type", "data"], + "additionalProperties": false } }, "securitySchemes": {} diff --git a/packages/protocol/script/openapi-stabilize.ts b/packages/protocol/script/openapi-stabilize.ts index c962ef6a41b..c44044275ad 100644 --- a/packages/protocol/script/openapi-stabilize.ts +++ b/packages/protocol/script/openapi-stabilize.ts @@ -1,5 +1,6 @@ -// Effect gives shared anonymous schemas encounter-order names (`Union_3`). Replace those names -// with a hash of their canonical shape and sort components so unrelated additions stay local. +// Effect gives shared anonymous schemas encounter-order names (`Union_3`), and does the same for the encoded side of a +// named schema when it differs between uses (`Event.VersionEncoded_37`). Replace those names with a hash of their +// canonical shape and sort components so unrelated additions stay local. export function stabilizeOpenApi(source: object) { const document = source as { components: { schemas: Record } @@ -9,7 +10,9 @@ export function stabilizeOpenApi(source: object) { const families = ["Union", "Objects", "Arrays"].filter((name) => `${name}_` in schemas) const anonymous = new Map( Object.keys(schemas) - .filter((name) => families.some((family) => new RegExp(`^${family}_\\d*$`).test(name))) + .filter( + (name) => families.some((family) => new RegExp(`^${family}_\\d*$`).test(name)) || /^.+Encoded_\d+$/.test(name), + ) .map((name) => [name, schemas[name]]), ) @@ -69,5 +72,71 @@ export function stabilizeOpenApi(source: object) { result.components.schemas = Object.fromEntries( [...stable].sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0)), ) + return collapseCopies(result) +} + +// Effect names a second AST copy of an identified schema `_`; event streams reach their schemas without the +// JSON codec that REST bodies get. Fold a copy into `` only when the two are deeply equal, treating a reference +// to another copy as equal to its original only when that copy folds too. Any real difference keeps its own name. +function collapseCopies } }>(document: Document) { + const schemas = document.components.schemas + const prefix = "#/components/schemas/" + const copies = new Map() + for (const name of Object.keys(schemas)) { + const original = /^(.+)_\d+$/.exec(name)?.[1] + if (original !== undefined && Object.hasOwn(schemas, original)) copies.set(name, original) + } + const sameReference = (left: string, right: string) => { + if (left === right) return true + if (!left.startsWith(prefix) || !right.startsWith(prefix)) return false + const a = left.slice(prefix.length) + const b = right.slice(prefix.length) + return copies.get(a) === b || copies.get(b) === a + } + const equal = (left: unknown, right: unknown): boolean => { + if (Array.isArray(left) || Array.isArray(right)) { + return ( + Array.isArray(left) && + Array.isArray(right) && + left.length === right.length && + left.every((item, index) => equal(item, right[index])) + ) + } + if (typeof left !== "object" || left === null || typeof right !== "object" || right === null) return left === right + const entries = new Map(Object.entries(left)) + const others = new Map(Object.entries(right)) + if (entries.size !== others.size) return false + return [...entries].every(([key, a]) => { + if (!others.has(key)) return false + const b = others.get(key) + if (key === "$ref" && typeof a === "string" && typeof b === "string") return sameReference(a, b) + return equal(a, b) + }) + } + let changed = true + while (changed) { + changed = false + for (const [copy, original] of copies) { + if (equal(schemas[copy], schemas[original])) continue + copies.delete(copy) + changed = true + } + } + if (copies.size === 0) return document + const rewrite = (node: unknown): unknown => { + if (Array.isArray(node)) return node.map(rewrite) + if (typeof node !== "object" || node === null) return node + return Object.fromEntries( + Object.entries(node).map(([key, value]) => { + if (key !== "$ref" || typeof value !== "string" || !value.startsWith(prefix)) return [key, rewrite(value)] + const name = value.slice(prefix.length) + return [key, `${prefix}${copies.get(name) ?? name}`] + }), + ) + } + const result = rewrite(document) as Document + result.components.schemas = Object.fromEntries( + Object.entries(result.components.schemas).filter(([name]) => !copies.has(name)), + ) return result } diff --git a/packages/protocol/test/openapi-stabilize.test.ts b/packages/protocol/test/openapi-stabilize.test.ts index 4532b8f0051..5fcb26c5a7a 100644 --- a/packages/protocol/test/openapi-stabilize.test.ts +++ b/packages/protocol/test/openapi-stabilize.test.ts @@ -68,6 +68,59 @@ test("includes reference siblings in anonymous component hashes", () => { expect(Object.keys(result.components.schemas).filter((name) => name.startsWith("Arrays_"))).toHaveLength(2) }) +test("content-addresses encounter-order names of encoded variants", () => { + const generate = (one: string, two: string) => + stabilizeOpenApi({ + components: { + schemas: { + [one]: { type: "number", enum: [1] }, + [two]: { type: "number", enum: [2] }, + Event: { anyOf: [{ $ref: `#/components/schemas/${one}` }, { $ref: `#/components/schemas/${two}` }] }, + }, + }, + }) as { components: { schemas: Record } } + + const result = generate("Event.VersionEncoded_47", "Event.VersionEncoded_37") + expect(result).toEqual(generate("Event.VersionEncoded_3", "Event.VersionEncoded_9")) + expect( + Object.keys(result.components.schemas).filter((name) => /^Event\.VersionEncoded_[a-f0-9]{12}$/.test(name)), + ).toHaveLength(2) +}) + +test("folds numbered copies of a named component only when they are deeply equal", () => { + const ref = (name: string) => ({ $ref: `#/components/schemas/${name}` }) + const result = stabilizeOpenApi({ + components: { + schemas: { + Info: { type: "object", properties: { content: ref("Content") }, required: ["content"] }, + Info_1: { required: ["content"], properties: { content: ref("Content_1") }, type: "object" }, + Content: { type: "string" }, + Content_1: { type: "string" }, + Field: { type: "object", properties: { value: ref("Value") } }, + Field_1: { type: "object", properties: { value: ref("Value_1") } }, + Value: { type: "string", enum: ["a", "b"] }, + Value_1: { type: "string", enum: ["b", "a"] }, + }, + }, + paths: { "/info": { schema: ref("Info_1") }, "/field": { schema: ref("Field_1") } }, + }) as { + components: { schemas: Record } + paths: Record + } + + expect(Object.keys(result.components.schemas).sort()).toEqual([ + "Content", + "Field", + "Field_1", + "Info", + "Value", + "Value_1", + ]) + expect(result.paths["/info"].schema).toEqual(ref("Info")) + expect(result.paths["/field"].schema).toEqual(ref("Field_1")) + expect(result.components.schemas.Field_1).toEqual({ type: "object", properties: { value: ref("Value_1") } }) +}) + test("preserves authored synthetic-looking names without an anonymous family root", () => { const result = stabilizeOpenApi({ components: { schemas: { Union_2: { type: "string" } } }, diff --git a/packages/schema/src/tui-event.ts b/packages/schema/src/tui-event.ts index 36fa8bc9f49..4d13fe76de0 100644 --- a/packages/schema/src/tui-event.ts +++ b/packages/schema/src/tui-event.ts @@ -52,7 +52,7 @@ export const ToastShow = Event.ephemeral({ export const SessionSelect = Event.ephemeral({ type: "tui.session.select", schema: { - sessionID: SessionID.annotate({ description: "Session ID to navigate to" }), + sessionID: SessionID.annotateKey({ description: "Session ID to navigate to" }), }, }) diff --git a/packages/util/src/cross-spawn-spawner.ts b/packages/util/src/cross-spawn-spawner.ts index 65a0b31cdc5..fa4c5ee5ebb 100644 --- a/packages/util/src/cross-spawn-spawner.ts +++ b/packages/util/src/cross-spawn-spawner.ts @@ -1,7 +1,19 @@ import { isArrayNonEmpty } from "effect/Array" import * as NodeSink from "@effect/platform-node/NodeSink" import * as NodeStream from "@effect/platform-node/NodeStream" -import { Deferred, Effect, Exit, FileSystem, Layer, Path, PlatformError, Predicate, Sink, Stream } from "effect" +import { + Deferred, + Effect, + Exit, + FileSystem, + Layer, + Path, + PlatformError, + Predicate, + Redacted, + Sink, + Stream, +} from "effect" import type { Scope } from "effect" import { ChildProcess } from "effect/process" import { @@ -36,6 +48,31 @@ const killGroups = () => } }) +const unwrap = (value: string | Redacted.Redacted): string => + Redacted.isRedacted(value) ? Redacted.value(value) : value + +// Node's own NUL check throws an error that includes the value, so NUL is rejected here to keep Redacted values +// out of errors. +const findNulCharacter = (command: ChildProcess.StandardCommand): string | undefined => { + if (command.command.includes("\0")) return "The command contains a NUL character" + const index = command.args.findIndex((arg) => unwrap(arg).includes("\0")) + if (index !== -1) return `Argument ${index + 1} contains a NUL character` + for (const [name, value] of Object.entries(command.options.env ?? {})) { + if (value !== undefined && unwrap(value).includes("\0")) { + return `The environment variable ${name} contains a NUL character` + } + } + return undefined +} + +// Buffered writes can fail after the sink has been interrupted and removed its error listener. Keep a fallback until +// close, without replacing the sink listener that propagates errors while it is active. +const handleInputErrors = (writable: NodeJS.WritableStream) => { + const onError = () => {} + writable.on("error", onError) + writable.once("close", () => writable.off("error", onError)) +} + const toError = (err: unknown): Error => (err instanceof globalThis.Error ? err : new globalThis.Error(String(err))) const toTag = (err: NodeJS.ErrnoException): PlatformError.SystemErrorTag => { @@ -129,8 +166,15 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { return path.resolve(opts.cwd) }) - const env = (opts: ChildProcess.CommandOptions) => - opts.extendEnv ? { ...globalThis.process.env, ...opts.env } : opts.env + const env = (opts: ChildProcess.CommandOptions) => { + if (opts.env === undefined) return opts.extendEnv ? globalThis.process.env : undefined + const result: Record = opts.extendEnv ? { ...globalThis.process.env } : {} + for (const [key, value] of Object.entries(opts.env)) { + if (value === undefined) delete result[key] + else result[key] = unwrap(value) + } + return result + } const input = (x: ChildProcess.CommandInput | undefined): NodeChildProcess.IOType | undefined => Stream.isStream(x) ? "pipe" : x @@ -203,37 +247,64 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { const ins = new Map>() const outs = new Map>() + const setupInput = Effect.fnUntraced(function* ( + fd: number, + node: NodeChildProcess.ChildProcess["stdio"][number], + source: Stream.Stream | undefined, + ) { + let sink: Sink.Sink = Sink.drain + if (node && "write" in node) { + handleInputErrors(node) + sink = NodeSink.fromWritable({ + evaluate: () => node, + onError: (err) => toPlatformError(`fromWritable(fd${fd})`, toError(err), command), + endOnDone: true, + }) + } + if (source) yield* Effect.forkScoped(Stream.run(source, sink)) + ins.set(fd, sink) + }) + + const setupOutput = ( + fd: number, + node: NodeChildProcess.ChildProcess["stdio"][number], + sink: Sink.Sink | undefined, + ) => { + let stream: Stream.Stream = Stream.empty + if (node && "read" in node) { + const tap = new PassThrough() + // Retain errors raised before anyone reads, e.g. a failed write on a duplex fd, so they neither go uncaught + // nor leave later readers hanging. + let error: unknown = undefined + tap.on("error", (cause) => { + error ??= cause + }) + node.on("error", (err) => tap.destroy(toError(err))) + node.pipe(tap) + const onError = (err: unknown) => toPlatformError(`fromReadable(fd${fd})`, toError(err), command) + stream = Stream.suspend(() => + error === undefined ? NodeStream.fromReadable({ evaluate: () => tap, onError }) : Stream.fail(onError(error)), + ) + } + if (sink) stream = Stream.transduce(stream, sink) + outs.set(fd, stream) + } + for (const x of extra) { const node = proc.stdio[x.fd] switch (x.config.type) { - case "input": { - let sink: Sink.Sink = Sink.drain - if (node && "write" in node) { - sink = NodeSink.fromWritable({ - evaluate: () => node, - onError: (err) => toPlatformError(`fromWritable(fd${x.fd})`, toError(err), command), - endOnDone: true, - }) - } - if (x.config.stream) yield* Effect.forkScoped(Stream.run(x.config.stream, sink)) - ins.set(x.fd, sink) + case "input": + yield* setupInput(x.fd, node, x.config.stream) break - } - case "output": { - let stream: Stream.Stream = Stream.empty - if (node && "read" in node) { - const tap = new PassThrough() - node.on("error", (err) => tap.destroy(toError(err))) - node.pipe(tap) - stream = NodeStream.fromReadable({ - evaluate: () => tap, - onError: (err) => toPlatformError(`fromReadable(fd${x.fd})`, toError(err), command), - }) - } - if (x.config.sink) stream = Stream.transduce(stream, x.config.sink) - outs.set(x.fd, stream) + case "output": + setupOutput(x.fd, node, x.config.sink) + break + case "duplex": + // Keep writing possible after the child closes its write side. + if (node && "allowHalfOpen" in node) node.allowHalfOpen = true + setupOutput(x.fd, node, x.config.sink) + yield* setupInput(x.fd, node, x.config.stream) break - } } } @@ -251,6 +322,7 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { Effect.suspend(() => { let sink: Sink.Sink = Sink.drain if (Predicate.isNotNull(proc.stdin)) { + handleInputErrors(proc.stdin) sink = NodeSink.fromWritable({ evaluate: () => proc.stdin!, onError: (err) => toPlatformError("fromWritable(stdin)", toError(err), command), @@ -302,11 +374,17 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { Effect.callback((resume) => { const closed = Deferred.makeUnsafe() const exited = Deferred.makeUnsafe() - const proc = launch(command.command, command.args, opts) + const proc = launch(command.command, command.args.map(unwrap), opts) let settle = () => {} let end = false let exit: readonly [code: number | null, signal: NodeJS.Signals | null] | undefined proc.on("error", (err) => { + // Node copies the arguments into `spawnargs`. + if (command.args.some(Redacted.isRedacted)) { + Object.assign(err, { + spawnargs: [command.command, ...command.args.map((arg) => (Redacted.isRedacted(arg) ? "" : arg))], + }) + } resume(Effect.fail(toPlatformError("spawn", err, command))) }) proc.on("exit", (...args) => { @@ -452,6 +530,12 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { function* (command) { switch (command._tag) { case "StandardCommand": { + const nul = findNulCharacter(command) + if (nul !== undefined) { + return yield* Effect.fail( + PlatformError.badArgument({ module: "ChildProcess", method: "spawn", description: nul }), + ) + } const sin = stdin(command.options) const sout = stdio(command.options, "stdout") const serr = stdio(command.options, "stderr") @@ -567,12 +651,14 @@ const makeCrossSpawnSpawner = Effect.gen(function* () { ) continue } + const name = ChildProcess.fdName(fd) as `fd${number}` + const existing = next.options.additionalFds?.[name] handle = spawnCommand( ChildProcess.make(next.command, next.args, { ...next.options, additionalFds: { ...next.options.additionalFds, - [ChildProcess.fdName(fd) as `fd${number}`]: { type: "input", stream }, + [name]: existing?.type === "duplex" ? { ...existing, stream } : { type: "input", stream }, }, }), ) diff --git a/packages/util/src/fs-util.ts b/packages/util/src/fs-util.ts index a8b680ca314..f814d38b0a1 100644 --- a/packages/util/src/fs-util.ts +++ b/packages/util/src/fs-util.ts @@ -1,6 +1,5 @@ import path, { dirname, isAbsolute, join, relative, sep } from "path" import { realpathSync } from "fs" -import { readdir } from "fs/promises" import { lookup } from "mime-types" import { Context, Effect, FileSystem, Layer, Schema } from "effect" import type { PlatformError } from "effect/PlatformError" @@ -22,11 +21,6 @@ export namespace FSUtil { export type Error = PlatformError | FileSystemError - export interface DirEntry { - readonly name: string - readonly type: "file" | "directory" | "symlink" | "other" - } - export interface UpOptions { readonly targets: string[] readonly start: string @@ -45,7 +39,6 @@ export namespace FSUtil { readonly writeJson: (path: string, data: unknown, mode?: number) => Effect.Effect readonly ensureDir: (path: string) => Effect.Effect readonly writeWithDirs: (path: string, content: string | Uint8Array, mode?: number) => Effect.Effect - readonly readDirectoryEntries: (path: string) => Effect.Effect readonly resolve: (path: string) => Effect.Effect readonly findUp: (target: string, start: string, stop?: string) => Effect.Effect readonly up: (options: UpOptions) => Effect.Effect @@ -57,7 +50,7 @@ export namespace FSUtil { export class Service extends Context.Service()("@opencode/FSUtil") {} // Exported so simulation can wrap this layer and override the methods that - // bypass the injected FileSystem (readDirectoryEntries, scan, globUp). + // bypass the injected FileSystem (scan, globUp). export const layer = Layer.effect( Service, Effect.gen(function* () { @@ -85,21 +78,6 @@ export namespace FSUtil { return info?.type === "File" }) - const readDirectoryEntries = Effect.fn("FileSystem.readDirectoryEntries")(function* (dirPath: string) { - return yield* Effect.tryPromise({ - try: async () => { - const entries = await readdir(dirPath, { withFileTypes: true }) - return entries.map( - (e): DirEntry => ({ - name: e.name, - type: e.isDirectory() ? "directory" : e.isSymbolicLink() ? "symlink" : e.isFile() ? "file" : "other", - }), - ) - }, - catch: (cause) => new FileSystemError({ method: "readDirectoryEntries", cause }), - }) - }) - const resolve = Effect.fn("FileSystem.resolve")(function* (input: string) { const resolved = path.resolve(windowsPath(input)) // Sandboxes deny reads outside granted paths; canonicalize what we can see. @@ -218,7 +196,6 @@ export namespace FSUtil { readFileStringSafe, isDir, isFile, - readDirectoryEntries, resolve, readJson, writeJson,