diff --git a/.gitignore b/.gitignore index a8fdd94..a2fbacd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ *.tsbuildinfo .env .env.* +target diff --git a/README.md b/README.md index 9472d0a..97e7527 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,89 @@ -# rivethub-workflows +# rivethub-plugins -Workflows for RivetHub, and the start of its plugin system: custom parts of RivetHub that anyone can add. A plugin that -proves valuable for everyone gets promoted into the platform, with its domain moving into a -[rivethub-runtime](https://github.com/philbert440/rivethub-runtime) context and its payloads into the contract. +Plug-ins for RivetHub, and the SDKs and templates for writing them. A plug-in is a program that runs in its own process on +one node and reaches the runtime only over its published contract (row B17 and notes 50 to 60 of the +[rivethub-runtime](https://github.com/philbert440/rivethub-runtime) CONTRACT): rh starts it, proxies clients to its +views, delivers its events and offers its tools to agents through `rh mcp`. A plug-in that proves valuable for everyone +gets promoted into the platform, with its domain moving into a runtime context and its payloads into the contract. -Workflows run outside the runtime and talk to it only through its published contract, the same way every client does. +## Layout + +- `packages/contract`: `@rivethub/contract`, the runtime's schemas and the types generated from them. +- `packages/plugin-sdk`: `@rivethub/plugin-sdk`, for plug-ins in TypeScript, with the `rivethub-plugin-dev` harness. +- `rust/rivethub-plugin`: the `rivethub-plugin` crate, for plug-ins in Rust, in a Cargo workspace of its own. +- `templates/typescript`, `templates/rust`: a checklist plug-in in each language to start from: a page with a form and + a list (and a canvas board in TypeScript), an `add_item` agent tool and a `session.placed` subscription. +- `templates/javascript`: the same checklist with its canvas board, in JavaScript that Node runs as it is, and a + `GUIDE.md` for an agent building from it. It is the template rh's plug-in creator scaffolds from. ## The contract `contract.json` pins a runtime commit. `npm run contract` fetches that commit's `contract/sent.schema.json` and -`contract/accepted.schema.json`, vendors them under `packages/contract/schema/`, and generates the -`@rivethub/contract` types: +`contract/accepted.schema.json`, vendors them under `packages/contract/schema/`, and generates: -- `Sent`: what the runtime sends (responses, events). -- `Accepted`: what the runtime accepts (requests, capture batches). +- the `@rivethub/contract` types: `Sent`, what the runtime sends (responses, events), and `Accepted`, what it accepts + (requests, and a plug-in's answers); +- `rust/rivethub-plugin/src/contract.rs`, the plug-in types (the manifest, views, canvas, events, jobs, tools, the + plug-in API and `GatewayError`) as Rust, from the accepted schema. To move to a newer runtime, set `ref` in `contract.json` to a commit on the runtime's `main`, run `npm run contract`, and -commit the schema and type diff in its own PR. If a workflow needs something the contract doesn't offer, propose the +commit the schema and type diff in its own PR. If a plug-in needs something the contract doesn't offer, propose the change to the runtime first. +## Writing a plug-in + +A plug-in is a directory holding `rivethub-plugin.json` and the program its `run.command` starts. Both SDKs answer what rh +asks on the plug-in socket (`GET /health`, views, actions, canvas events, tools, events and jobs), drop an event +delivery they have already handled (by `seq`), pass `settings.changed` and the starting settings to the settings +handler, and call rh on the plug-in API socket with the per-start token: the plug-in's own record, `viewsChanged`, +`notify`, and any route its permissions name. + +```ts +await serve({ + views: { main: () => ({ title: 'Checklist', blocks: [] }) }, + actions: { add: ({ values }) => [{ type: 'refresh' }] }, + tools: { add_item: ({ title }) => `Added ${String(title)}` }, + events: { 'session.placed': ({ sessionId }) => {} }, +}) +``` + +```rust +Plugin::new(state) + .view("main", |state, request| async move { Ok(view(&state)) }) + .tool("add_item", |state, call| async move { add(&state, call.parse()?) }) + .events(|state, delivery| async move { record(&state, delivery.event) }) + .serve() + .await +``` + +On Linux rh confines a plug-in with Landlock to its own directory, its data and run folders and the program it runs, so +a TypeScript plug-in runs a bundle (`npm run build` writes `dist/plugin.js` with esbuild) rather than sources that +import from outside its directory, and a Rust plug-in runs its release binary. + +`rivethub-plugin-dev ` starts a plug-in the way rh does, standing in for its own `/api/plugin` routes, and reads +commands from stdin (`view main`, `action add {"values":{"title":"x"}}`, `tool add_item {"title":"x"}`, +`event session.placed {...}`, `job `), printing each answer. To run one on a node, `POST /api/plugins` with +`{"path": ""}` and enable it from a paired device. + +## Templates on a node + +rh's plug-in creator (note 70 of the runtime's CONTRACT) lets an agent on a node scaffold a plug-in from a template, +edit it, install it and read its log through `rh mcp`. rh carries no templates; it reads them from the node's +`/plugin-templates/` (`~/.rivethub/plugin-templates/` unless the state folder moved), one folder each, and never +fetches one. `npm run templates:install` writes the templates that need no build there: the `javascript` folder with +`sdk/`, the SDK's own TypeScript sources, which Node 22.18 and later runs without a build. Pass another state folder as +`npm run templates:install -- `. Run it again after pulling a newer SDK; plug-ins already scaffolded keep the +SDK they were made with. + ## Rules -- Talk to the runtime only over its HTTP and WebSocket API. Never read its database or files. -- Types come from `@rivethub/contract`. Never hand-write a DTO. +- Talk to the runtime only over its HTTP and WebSocket API and the plug-in sockets. Never read its database or files. +- Types come from `@rivethub/contract` and the generated `contract` module. Never hand-write a DTO. - No code comments: names and types carry the meaning. - Conventional Commits, authored by people, with no AI attribution trailers or text. ## Checks -`npm run check` runs what CI runs: Biome lint and format, `tsc` in strict mode, the tests, the contract freshness check -and the privacy scan. Run it before every push. +`npm run check` runs what CI runs: Biome lint and format, `tsc` in strict mode, the tests, the contract freshness check, +the privacy scan, and `npm run rust` (rustfmt, Clippy with warnings as errors, and the tests, for the crate and the Rust +template). Run it before every push. diff --git a/contract.json b/contract.json index 6d5d7fa..55ed360 100644 --- a/contract.json +++ b/contract.json @@ -1,4 +1,4 @@ { "repository": "philbert440/rivethub-runtime", - "ref": "ba386c48eca72acb93d9a26bafb9abd30a48253f" + "ref": "5d5cc2744c01cb9f991b65b74b9a859b1d35f517" } diff --git a/package-lock.json b/package-lock.json index 4b65fc5..adedb40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "workspaces": [ - "packages/*" + "packages/*", + "templates/typescript" ], "devDependencies": { "@biomejs/biome": "2.5.15", @@ -229,6 +230,448 @@ "node": ">=14.21.3" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@jsdevtools/ono": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", @@ -240,6 +683,10 @@ "resolved": "packages/contract", "link": true }, + "node_modules/@rivethub/plugin-sdk": { + "resolved": "packages/plugin-sdk", + "link": true + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -621,6 +1068,52 @@ ], "license": "PSF-2.0" }, + "node_modules/checklist-ts": { + "resolved": "templates/typescript", + "link": true + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -792,7 +1285,27 @@ }, "packages/contract": { "name": "@rivethub/contract", - "version": "0.0.0" + "version": "0.7.0" + }, + "packages/plugin-sdk": { + "name": "@rivethub/plugin-sdk", + "version": "0.7.0", + "dependencies": { + "@rivethub/contract": "0.7.0" + }, + "bin": { + "rivethub-plugin-dev": "src/dev.ts" + } + }, + "templates/typescript": { + "name": "checklist-ts", + "version": "0.1.0", + "dependencies": { + "@rivethub/plugin-sdk": "0.7.0" + }, + "devDependencies": { + "esbuild": "0.28.2" + } } } } diff --git a/package.json b/package.json index ee71e43..3811e67 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,25 @@ { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "private": true, "type": "module", "engines": { "node": ">=22.19.0" }, "workspaces": [ - "packages/*" + "packages/*", + "templates/typescript" ], "scripts": { - "check": "npm run lint && npm run typecheck && npm test && npm run contract:check && npm run privacy", + "check": "npm run lint && npm run typecheck && npm test && npm run contract:check && npm run privacy && npm run rust", "lint": "biome check .", "format": "biome check --write .", "typecheck": "tsc", "test": "node --test 'tests/**/*.test.ts'", "contract": "node scripts/contract.ts", "contract:check": "node scripts/contract.ts --check", - "privacy": "node scripts/privacy.ts --tracked" + "templates:install": "node scripts/templates.ts", + "privacy": "node scripts/privacy.ts --tracked", + "rust": "cargo fmt --check --manifest-path rust/rivethub-plugin/Cargo.toml && cargo clippy --locked --all-targets --manifest-path rust/rivethub-plugin/Cargo.toml -- -D warnings && cargo test --locked --manifest-path rust/rivethub-plugin/Cargo.toml && cargo fmt --check --manifest-path templates/rust/Cargo.toml && cargo clippy --locked --all-targets --manifest-path templates/rust/Cargo.toml -- -D warnings" }, "devDependencies": { "@biomejs/biome": "2.5.15", diff --git a/packages/contract/package.json b/packages/contract/package.json index 96d3a11..d249d0a 100644 --- a/packages/contract/package.json +++ b/packages/contract/package.json @@ -1,6 +1,6 @@ { "name": "@rivethub/contract", - "version": "0.0.0", + "version": "0.7.0", "private": true, "type": "module", "exports": { diff --git a/packages/contract/schema/accepted.schema.json b/packages/contract/schema/accepted.schema.json index 7eb15ef..6ccc381 100644 --- a/packages/contract/schema/accepted.schema.json +++ b/packages/contract/schema/accepted.schema.json @@ -1,8 +1,8 @@ { - "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.1.0/accepted.schema.json", + "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.7.0/accepted.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "RivetHub contract (accepted by the runtime)", - "version": "0.1.0", + "version": "0.7.0", "$defs": { "AgentPreset": { "type": "object", @@ -97,8 +97,8 @@ "hermes", "codex", "opencode", - "pi", - "qwen-code", + "omp", + "dsh", "cursor", "cowork" ] @@ -333,6 +333,250 @@ "agent" ] }, + "HubProjectDefaults": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" + }, + { + "type": "null" + } + ] + }, + "harnessId": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "node": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "type": [ + "string", + "null" + ] + } + } + }, + "ThinkingLevel": { + "type": "string", + "enum": [ + "off", + "low", + "medium", + "high", + "xhigh" + ] + }, + "HubProject": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double", + "default": 0.0 + }, + "createdAt": { + "type": "integer", + "format": "int64", + "default": 0 + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/HubProjectDefaults" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name" + ] + }, + "HubLastSession": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "key", + "at" + ] + }, + "HubSessionMode": { + "type": "string", + "enum": [ + "chat", + "terminal" + ] + }, + "HubState": { + "type": "object", + "properties": { + "projects": { + "type": "array", + "items": { + "$ref": "#/$defs/HubProject" + }, + "default": [] + }, + "defaultProjectId": { + "type": [ + "string", + "null" + ] + }, + "membership": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "names": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "archived": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "pinned": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "hidden": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "modes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/HubSessionMode" + }, + "default": {} + }, + "lastSession": { + "anyOf": [ + { + "$ref": "#/$defs/HubLastSession" + }, + { + "type": "null" + } + ] + } + } + }, + "HubStateResponse": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "version", + "state" + ] + }, + "HubStatePutRequest": { + "type": "object", + "properties": { + "baseVersion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "baseVersion", + "state" + ] + }, + "hub.state": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "v", + "version" + ] + }, + "ProtocolVersion": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, "HarnessDescriptor": { "type": "object", "properties": { @@ -513,6 +757,12 @@ "null" ] }, + "effort": { + "type": [ + "string", + "null" + ] + }, "directory": { "type": [ "string", @@ -580,345 +830,44 @@ } ] }, - "CatalogCommand": { + "CatalogAgentsResponse": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "argHint": { - "type": [ - "string", - "null" - ] - }, - "source": { - "type": "string" + "agents": { + "type": "array", + "items": { + "$ref": "#/$defs/CatalogAgent" + } } }, "required": [ - "name", - "description", - "source" + "agents" ] }, - "CatalogExecutorEntry": { + "MeshOverview": { "type": "object", "properties": { - "key": { - "type": "string" - }, - "capabilities": { - "$ref": "#/$defs/HarnessExecutorCapabilities" + "updatedAt": { + "type": "integer", + "format": "int64" }, - "commands": { + "nodes": { "type": "array", "items": { - "$ref": "#/$defs/CatalogCommand" + "$ref": "#/$defs/MeshOverviewNode" } - }, - "harnessId": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessId" - }, - { - "type": "null" - } - ] - }, - "implemented": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "key", - "capabilities", - "commands" - ] - }, - "HarnessExecutorCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - }, - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - }, - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - }, - "mcpInjection": { - "$ref": "#/$defs/McpInjection" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream", - "usageInResult", - "sessionIdCapture", - "slashCommands", - "effortSelection", - "mcpInjection" - ] - }, - "McpInjection": { - "type": "string", - "enum": [ - "flag", - "cwdFile", - "persistentConfig", - "none" - ] - }, - "CatalogSkillEntry": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "required": [ - "name", - "description" - ] - }, - "CatalogSheet": { - "type": "object", - "properties": { - "node": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - }, - "executors": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogExecutorEntry" - } - }, - "tools": { - "type": "array", - "items": { - "type": "string" - } - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogSkillEntry" - } - } - }, - "required": [ - "node", - "agents", - "executors", - "tools", - "skills" - ] - }, - "CatalogAgentsResponse": { - "type": "object", - "properties": { - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - } - }, - "required": [ - "agents" - ] - }, - "OutcomeBucket": { - "type": "object", - "properties": { - "tasks": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "failed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "verified": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "refuted": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "escalated": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "diverged": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "divergenceRate": { - "type": "number", - "format": "double" - }, - "totalCostUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "avgDurationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "tasks", - "completed", - "failed", - "verified", - "refuted", - "escalated", - "diverged", - "divergenceRate" - ] - }, - "OutcomesFilter": { - "type": "object", - "properties": { - "since": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "until": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "agentId": { - "type": [ - "string", - "null" - ] - }, - "origin": { - "type": [ - "string", - "null" - ] - } - } - }, - "OutcomesResponse": { - "type": "object", - "properties": { - "filter": { - "$ref": "#/$defs/OutcomesFilter" - }, - "totals": { - "$ref": "#/$defs/OutcomeBucket" - }, - "byAgent": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byExecutor": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byDay": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - } - }, - "required": [ - "filter", - "totals", - "byAgent", - "byExecutor", - "byDay" - ] - }, - "MeshOverview": { - "type": "object", - "properties": { - "updatedAt": { - "type": "integer", - "format": "int64" - }, - "nodes": { - "type": "array", - "items": { - "$ref": "#/$defs/MeshOverviewNode" - } - } - }, - "required": [ - "updatedAt", - "nodes" - ] - }, - "MeshOverviewNode": { - "type": "object", - "properties": { - "id": { - "type": "string" + } + }, + "required": [ + "updatedAt", + "nodes" + ] + }, + "MeshOverviewNode": { + "type": "object", + "properties": { + "id": { + "type": "string" }, "name": { "type": "string" @@ -946,6 +895,18 @@ "type": "null" } ] + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -1828,12 +1789,6 @@ } ] }, - "ProtocolVersion": { - "type": "integer", - "format": "uint8", - "minimum": 0, - "maximum": 255 - }, "AudioStatus": { "type": "object", "properties": { @@ -2214,12 +2169,28 @@ "null" ] }, - "tag": { - "type": [ - "string", - "null" - ] - } + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, + "tag": { + "type": [ + "string", + "null" + ] + } }, "required": [ "query" @@ -2245,6 +2216,15 @@ "both" ] }, + "Role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "tool" + ] + }, "MemoryHitSource": { "type": "string", "enum": [ @@ -2389,15 +2369,6 @@ "content" ] }, - "Role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant", - "tool" - ] - }, "MemoryFallback": { "type": "string", "enum": [ @@ -3217,6 +3188,165 @@ "messages" ] }, + "VectorState": { + "type": "string", + "enum": [ + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryNode": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "parentId": { + "type": [ + "string", + "null" + ] + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "content": { + "type": "string" + }, + "messageCount": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "earliestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "latestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sourceMessageIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "vector": { + "$ref": "#/$defs/VectorState" + } + }, + "required": [ + "id", + "level", + "kind", + "content", + "messageCount", + "createdAt", + "sourceMessageIds", + "vector" + ] + }, + "MemoryMessageTally": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "user": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "assistant": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "system": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "tool": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "embedded": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pending": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "failed": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "total", + "user", + "assistant", + "system", + "tool", + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryDagResponse": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "summaries": { + "type": "array", + "items": { + "$ref": "#/$defs/MemorySummaryNode" + } + }, + "messages": { + "$ref": "#/$defs/MemoryMessageTally" + } + }, + "required": [ + "sessionId", + "summaries", + "messages" + ] + }, "TopTool": { "type": "object", "properties": { @@ -4216,6 +4346,18 @@ "items": { "$ref": "#/$defs/DegradedProvider" } + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -4426,72 +4568,233 @@ "cmd" ] }, - "TranscriptTurn": { + "SessionDeleted": { "type": "object", "properties": { - "role": { - "$ref": "#/$defs/Role" + "ok": { + "type": "boolean" }, - "text": { - "type": "string" + "session": { + "$ref": "#/$defs/SessionId" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "conversations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "messages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summaries": { + "type": "integer", + "format": "uint64", + "minimum": 0 } }, "required": [ - "role", - "text" + "ok", + "session", + "conversations", + "messages", + "summaries" ] }, - "TranscriptResponse": { + "SessionDeleteRequest": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "command": { - "type": "string" - }, - "turns": { + "sessions": { "type": "array", "items": { - "$ref": "#/$defs/TranscriptTurn" + "$ref": "#/$defs/SessionId" } - }, - "contextWindow": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "compactAt": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] } }, "required": [ - "id", + "sessions" + ] + }, + "SessionDeleteError": { + "type": "string", + "enum": [ + "session is live", + "not found", + "delete failed" + ] + }, + "SessionDeleteRefused": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "ok": { + "type": "boolean" + }, + "error": { + "$ref": "#/$defs/SessionDeleteError" + } + }, + "required": [ + "session", + "ok", + "error" + ] + }, + "SessionDeleteResult": { + "anyOf": [ + { + "$ref": "#/$defs/SessionDeleted" + }, + { + "$ref": "#/$defs/SessionDeleteRefused" + } + ] + }, + "SessionDeleteResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionDeleteResult" + } + } + }, + "required": [ + "results" + ] + }, + "SessionTrashReason": { + "type": "string", + "enum": [ + "empty", + "one-word-reply" + ] + }, + "SessionTrashCandidate": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "harness": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "reason": { + "$ref": "#/$defs/SessionTrashReason" + }, + "userTurns": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reply": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "session", + "harness", + "updatedAt", + "reason", + "userTurns" + ] + }, + "SessionTrashList": { + "type": "object", + "properties": { + "candidates": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionTrashCandidate" + } + } + }, + "required": [ + "candidates" + ] + }, + "TranscriptTurn": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "text": { + "type": "string" + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "role", + "text" + ] + }, + "TranscriptResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "type": "string" + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/TranscriptTurn" + } + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", "command", "turns" ] @@ -4695,22 +4998,43 @@ "string", "null" ] + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] } }, "required": [ "text" ] }, - "ThinkingLevel": { - "type": "string", - "enum": [ - "off", - "low", - "medium", - "high", - "xhigh" - ] - }, "SessionPostAccepted": { "type": "object", "properties": { @@ -4737,6 +5061,45 @@ "message" ] }, + "SessionSteerRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + } + }, + "required": [ + "text" + ] + }, + "SessionSteerResponse": { + "type": "object", + "properties": { + "outcome": { + "$ref": "#/$defs/SteerOutcome" + } + }, + "required": [ + "outcome" + ] + }, + "SteerOutcome": { + "type": "string", + "enum": [ + "steered", + "startedNewTurn", + "promptRequired" + ] + }, "SessionWsClientMessage": { "type": "object", "properties": { @@ -4972,11 +5335,34 @@ } ] }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TranscriptAttachment" + } + }, "complete": { "type": "boolean" }, "compact": { "type": "boolean" + }, + "startedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "endedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -5042,15 +5428,44 @@ "tool_result" ] }, - "TranscriptWsFrame": { + "TranscriptAttachment": { "type": "object", "properties": { - "session": { + "mediaType": { "type": "string" }, - "rev": { - "type": "integer", - "format": "uint64", + "name": { + "type": [ + "string", + "null" + ] + }, + "uri": { + "type": [ + "string", + "null" + ] + }, + "uploadId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "mediaType" + ] + }, + "TranscriptWsFrame": { + "type": "object", + "properties": { + "session": { + "type": "string" + }, + "rev": { + "type": "integer", + "format": "uint64", "minimum": 0 }, "from": { @@ -5136,6 +5551,53 @@ "contextSource" ] }, + "SessionPreviewKind": { + "type": "string", + "enum": [ + "running", + "asking", + "approval", + "said" + ] + }, + "SessionPreview": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "kind": { + "$ref": "#/$defs/SessionPreviewKind" + }, + "text": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "kind", + "text", + "at" + ] + }, + "SessionPreviewList": { + "type": "object", + "properties": { + "previews": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionPreview" + } + } + }, + "required": [ + "previews" + ] + }, "HarnessTurnAccepted": { "type": "object", "properties": { @@ -5254,6 +5716,16 @@ } ] }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + }, "redirectedTo": { "anyOf": [ { @@ -5263,6 +5735,16 @@ "type": "null" } ] + }, + "switches": { + "anyOf": [ + { + "$ref": "#/$defs/SessionSwitches" + }, + { + "type": "null" + } + ] } }, "required": [ @@ -5293,6 +5775,165 @@ "protocol" ] }, + "StartupContext": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSection" + } + }, + "tokens": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "deliveredVia": { + "$ref": "#/$defs/DeliveredVia" + } + }, + "required": [ + "topicId", + "sections", + "tokens", + "deliveredVia" + ] + }, + "StartupSection": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/StartupKind" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "sources": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSource" + } + } + }, + "required": [ + "kind", + "title", + "text", + "sources" + ] + }, + "StartupKind": { + "type": "string", + "enum": [ + "topic", + "recent", + "relevant" + ] + }, + "StartupSource": { + "oneOf": [ + { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "wiki": { + "$ref": "#/$defs/WikiSlug" + } + }, + "required": [ + "wiki" + ], + "additionalProperties": false + } + ] + }, + "WikiSlug": { + "type": "string" + }, + "DeliveredVia": { + "type": "string", + "enum": [ + "metaAppend", + "cliFlag", + "none" + ] + }, + "SessionSwitches": { + "type": "object", + "properties": { + "model": { + "type": "boolean" + }, + "effort": { + "type": "boolean" + } + }, + "required": [ + "model", + "effort" + ] + }, + "HarnessSessionTitleRequest": { + "type": "object", + "properties": { + "title": { + "type": "string" + } + }, + "required": [ + "title" + ] + }, + "HarnessSessionForkRequest": { + "type": "object", + "properties": { + "prompts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "prompts" + ] + }, + "HarnessToolOutput": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "isError": { + "type": "boolean" + }, + "truncated": { + "type": "boolean" + } + }, + "required": [ + "text", + "isError", + "truncated" + ] + }, "HarnessSocketRefusalCode": { "type": "string", "enum": [ @@ -5402,6 +6043,12 @@ "format": "uint16", "minimum": 0, "maximum": 65535 + }, + "topicId": { + "type": [ + "string", + "null" + ] } } }, @@ -5979,6 +6626,9 @@ "id": { "type": "string" }, + "uri": { + "type": "string" + }, "name": { "type": "string" }, @@ -6003,6 +6653,7 @@ }, "required": [ "id", + "uri", "name", "bytes", "mediaType", @@ -6638,9 +7289,6 @@ "slug" ] }, - "WikiSlug": { - "type": "string" - }, "WikiHistoryEntry": { "type": "object", "properties": { @@ -6687,6 +7335,40 @@ "string", "null" ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6735,7 +7417,8 @@ "conversation", "task", "leaf", - "extract-wiki" + "extract-wiki", + "user" ] }, "WikiSourceSpan": { @@ -6846,6 +7529,12 @@ "items": { "type": "string" } + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6925,7 +7614,7 @@ "stalest": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/WikiTopic" } } }, @@ -6960,9 +7649,15 @@ }, "excerpt": { "type": "string" - } - }, - "required": [ + }, + "topicId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ "slug", "title", "tags", @@ -6991,4298 +7686,8430 @@ "total" ] }, - "AgentEvent": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { - "type": "string" - } - }, - "required": [ - "v", - "session" - ], + "ProposalState": { + "type": "string", + "enum": [ + "pending", + "approved", + "rejected" + ] + }, + "Proposer": { + "type": "string", + "enum": [ + "categorizer", + "backfill" + ] + }, + "TidyChange": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "merge" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "source": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type" + "kind", + "source", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "move" }, - "ts": { + "topic": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.user" + "const": "rename" }, - "text": { + "topic": { "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "name": { + "type": "string" } }, "required": [ - "type", - "text" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.agent" + "const": "close" }, - "text": { + "topic": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "thinking.delta" + "const": "delete" }, - "text": { + "topic": { "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "tool.start" + "const": "createTopic" }, - "tool": { + "topic": { "type": "string" }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true + "name": { + "type": "string" }, - "ts": { + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] + }, + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + }, + "default": [] + }, + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tool" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.plan" + "const": "fileInto" }, - "tasks": { + "topic": { + "type": "string" + }, + "sessions": { "type": "array", "items": { - "type": "string" - } + "$ref": "#/$defs/SessionId" + }, + "default": [] }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tasks" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.check" + "const": "mergePage" }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "page": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type", - "index" + "kind", + "page", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" + "const": "removePage" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "page": { + "type": "string" } }, "required": [ - "type", - "activity" + "kind", + "page" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "turn.end" + "const": "addType" }, - "ts": { + "topic": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic", + "name" ] } - ], - "unevaluatedProperties": true + ] }, - "SessionHarness": { - "type": "string" + "TidySample": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "id" + ] }, - "AgentUsage": { + "TidyEvidence": { "type": "object", "properties": { - "promptTokens": { + "sessions": { "type": "integer", "format": "uint64", "minimum": 0 }, - "completionTokens": { + "samples": { + "type": "array", + "items": { + "$ref": "#/$defs/TidySample" + }, + "default": [] + } + }, + "required": [ + "sessions" + ] + }, + "TidyProposal": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "batchId": { + "type": "string" + }, + "change": { + "$ref": "#/$defs/TidyChange" + }, + "reason": { + "type": "string" + }, + "evidence": { + "$ref": "#/$defs/TidyEvidence" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "state": { + "$ref": "#/$defs/ProposalState" + }, + "decidedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "id", + "batchId", + "change", + "reason", + "evidence", + "proposedBy", + "proposedAt", + "state" + ] + }, + "TidyBatch": { + "type": "object", + "properties": { + "batchId": { + "type": "string" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "proposals": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + } + }, + "required": [ + "batchId", + "proposedBy", + "proposedAt", + "proposals" + ] + }, + "TidyPending": { + "type": "object", + "properties": { + "batches": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyBatch" + } + } + }, + "required": [ + "batches" + ] + }, + "TidyFailure": { + "type": "object", + "properties": { + "proposalId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "proposalId", + "error" + ] + }, + "TidyBatchDecision": { + "type": "object", + "properties": { + "decided": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + }, + "failed": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyFailure" + }, + "default": [] + } + }, + "required": [ + "decided" + ] + }, + "FilingUpkeep": { + "type": "object", + "properties": { + "categorizer": { "type": "integer", "format": "uint64", "minimum": 0 }, - "cachedTokens": { + "you": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "uncategorized": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "leftOut": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "correctionsLastWeek": { "type": "integer", "format": "uint64", "minimum": 0 } }, "required": [ - "promptTokens", - "completionTokens", - "cachedTokens" + "categorizer", + "you", + "uncategorized", + "leftOut", + "correctionsLastWeek" ] }, - "AgentEventKind": { + "EntityTypeCount": { + "type": "object", + "properties": { + "typeId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "entities": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "typeId", + "name", + "entities" + ] + }, + "WikiUpkeep": { + "type": "object", + "properties": { + "topicPages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "entityTypes": { + "type": "array", + "items": { + "$ref": "#/$defs/EntityTypeCount" + } + }, + "loosePages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "topicPages", + "entityTypes", + "loosePages" + ] + }, + "WorkerActivity": { + "type": "object", + "properties": { + "lastFinishedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "failing": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "failing" + ] + }, + "WorkerUpkeep": { + "type": "object", + "properties": { + "embedder": { + "$ref": "#/$defs/WorkerActivity" + }, + "summarizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "categorizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "wikiBuilder": { + "$ref": "#/$defs/WorkerActivity" + } + }, + "required": [ + "embedder", + "summarizer", + "categorizer", + "wikiBuilder" + ] + }, + "MemoryUpkeep": { + "type": "object", + "properties": { + "filing": { + "$ref": "#/$defs/FilingUpkeep" + }, + "wiki": { + "$ref": "#/$defs/WikiUpkeep" + }, + "workers": { + "$ref": "#/$defs/WorkerUpkeep" + }, + "pendingProposals": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "filing", + "wiki", + "workers", + "pendingProposals" + ] + }, + "TopicDirectory": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "local" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "path": { + "type": "string" } }, "required": [ - "type" + "kind", + "node", + "path" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "shared" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.user" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.agent" - }, - "text": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "thinking.delta" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool.start" - }, - "tool": { + "path": { "type": "string" - }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tool" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.plan" - }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tasks" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.check" - }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "index" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "activity" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type" + "kind", + "path" ] } ] }, - "LiveSessionSummary": { + "TopicKind": { + "type": "string", + "enum": [ + "work", + "type", + "entity" + ] + }, + "PlacedBy": { + "type": "string", + "enum": [ + "you", + "categorizer" + ] + }, + "TopicRecord": { "type": "object", "properties": { "id": { "type": "string" }, + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { + "type": "string" + }, "name": { "type": "string" }, - "harness": { + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { "anyOf": [ { - "$ref": "#/$defs/SessionHarness" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] }, - "lastEventTs": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "pty": { - "type": [ - "string", - "null" - ] + "createdAt": { + "type": "integer", + "format": "int64" }, - "contextWindow": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "updatedAt": { + "type": "integer", + "format": "int64" }, - "compactAt": { + "closedAt": { "type": [ "integer", "null" ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ "id", - "name" + "slug", + "name", + "aliases", + "createdAt", + "updatedAt" ] }, - "SessionLogLine": { + "TopicSummary": { "type": "object", "properties": { - "who": { + "id": { "type": "string" }, - "text": { + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { "type": "string" - } - }, - "required": [ - "who", - "text" - ] - }, - "SessionView": { - "type": "object", - "properties": { - "title": { + }, + "name": { "type": "string" }, - "activity": { - "$ref": "#/$defs/Activity" + "aliases": { + "type": "array", + "items": { + "type": "string" + } }, - "tool": { + "parent": { "type": [ "string", "null" ] }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] }, - "thought": { - "type": "string" + "createdAt": { + "type": "integer", + "format": "int64" }, - "lastMessage": { - "type": "string" + "updatedAt": { + "type": "integer", + "format": "int64" }, - "log": { - "type": "array", - "items": { - "$ref": "#/$defs/SessionLogLine" - } + "closedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" }, - "term": { - "type": "array", - "items": { - "type": "string" - } + "sessionCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "ended": { - "type": "boolean" + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "title", - "activity", - "tasks", - "thought", - "lastMessage", - "log", - "term", - "ended" + "id", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt", + "sessionCount" ] }, - "LiveSessionList": { + "TopicList": { "type": "object", "properties": { - "sessions": { + "topics": { "type": "array", "items": { - "$ref": "#/$defs/LiveSessionSummary" + "$ref": "#/$defs/TopicSummary" } } }, "required": [ - "sessions" + "topics" ] }, - "StateResponse": { + "TopicCreateRequest": { "type": "object", "properties": { - "session": { - "type": "string" + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" }, - "state": { - "$ref": "#/$defs/SessionView" - } - }, - "required": [ - "session", - "state" - ] - }, - "snapshot": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "name": { + "type": "string" }, - "sessions": { + "aliases": { "type": "array", "items": { - "$ref": "#/$defs/LiveSessionSummary" - } + "type": "string" + }, + "default": [] }, - "rooms": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/SessionView" - } - } - }, - "required": [ - "v", - "sessions", - "rooms" - ] - }, - "session.removed": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "parent": { + "type": [ + "string", + "null" + ] }, - "session": { - "type": "string" + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "v", - "session" - ] - }, - "SessionBroadcast": { - "anyOf": [ - { - "$ref": "#/$defs/snapshot" - }, - { - "$ref": "#/$defs/session.removed" - }, - { - "$ref": "#/$defs/AgentEvent" - } + "name" ] }, - "CaptureBatchRequest": { + "WikiPageEdit": { "type": "object", "properties": { - "session_key": { - "type": "string" - }, - "agent": { - "type": "string" - }, - "channel": { + "currentState": { "type": [ "string", "null" ] }, - "title": { + "article": { "type": [ "string", "null" ] - }, - "settings": { + } + }, + "additionalProperties": false + }, + "TopicUpdate": { + "type": "object", + "properties": { + "name": { "type": [ - "object", + "string", "null" - ], - "additionalProperties": true + ] }, - "task_id": { + "aliases": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "type": "string" + } }, - "finalize": { + "parent": { "type": [ - "boolean", + "string", "null" ] }, - "created_at": { + "directory": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] - }, - "updated_at": { - "anyOf": [ - { - "$ref": "#/$defs/Millis" - }, - { - "type": "null" - } - ] - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/CaptureMessage" - } } }, - "required": [ - "session_key", - "agent", - "messages" - ] + "additionalProperties": false }, - "CaptureMessage": { + "TopicMergeRequest": { "type": "object", "properties": { - "event_id": { - "type": "string" - }, - "role": { - "$ref": "#/$defs/Role" - }, - "content": { + "into": { "type": "string" - }, - "tool_name": { - "type": [ - "string", - "null" - ] - }, - "tool_args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "tool_result": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "created_at": { - "anyOf": [ - { - "$ref": "#/$defs/Millis" - }, - { - "type": "null" - } - ] } }, + "additionalProperties": false, "required": [ - "event_id", - "role", - "content" + "into" ] }, - "CaptureResult": { + "TopicPlacement": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "conversation_id": { + "topicId": { "type": "string" }, - "inserted": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "by": { + "$ref": "#/$defs/PlacedBy" }, - "skipped": { + "at": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" } }, "required": [ - "ok", - "conversation_id", - "inserted", - "skipped" - ] - }, - "HookEventName": { - "type": "string", - "enum": [ - "provider:before", - "provider:after", - "provider:error", - "tool:before", - "tool:after", - "session:start", - "session:end", - "turn:before", - "turn:after", - "turn:reflect", - "skill:before", - "skill:after", - "compact:before", - "compact:after", - "delegation:before", - "delegation:after" + "sessionId", + "topicId", + "by", + "at" ] }, - "HookContextBase": { + "TopicSuggestion": { "type": "object", "properties": { - "agentId": { + "name": { + "type": "string" + }, + "topicId": { "type": [ "string", "null" ] }, - "sessionId": { + "parentId": { "type": [ "string", "null" ] - }, - "timestamp": { - "type": "integer", - "format": "int64" - }, - "metadata": { - "type": "object", - "additionalProperties": true } }, "required": [ - "timestamp", - "metadata" - ] - }, - "ReflectionSource": { - "type": "string", - "enum": [ - "complexity", - "periodic", - "manual" - ] - }, - "DelegationHookStatus": { - "type": "string", - "enum": [ - "completed", - "failed", - "timeout", - "cached" + "name" ] }, - "HookUsage": { + "PlacementReply": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "placement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicPlacement" + }, + { + "type": "null" + } + ] }, - "completionTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "suggestion": { + "anyOf": [ + { + "$ref": "#/$defs/TopicSuggestion" + }, + { + "type": "null" + } + ] + } + } + }, + "PlacementRequest": { + "type": "object", + "properties": { + "topicId": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "promptTokens", - "completionTokens" + "topicId" ] }, - "SessionTokens": { + "SessionHistoryMark": { "type": "object", "properties": { - "prompt": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "completion": { + "markedAt": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" } }, "required": [ - "prompt", - "completion" + "sessionId", + "markedAt" ] }, - "TurnComplexity": { + "SessionHistoryList": { "type": "object", "properties": { - "toolCallCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hadErrorRecovery": { - "type": "boolean" - }, - "hadUserCorrection": { - "type": "boolean" - }, - "uniqueTools": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } } }, "required": [ - "toolCallCount", - "hadErrorRecovery", - "hadUserCorrection", - "uniqueTools" + "sessions" ] }, - "HookContext": { + "TopicSession": { "type": "object", "properties": { - "agentId": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "title": { "type": [ "string", "null" ] }, - "sessionId": { + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "node": { "type": [ "string", "null" ] }, - "timestamp": { - "type": "integer", - "format": "int64" + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] }, - "metadata": { - "type": "object", - "additionalProperties": true + "taskId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "timestamp", - "metadata" - ], - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } - }, - "skip": { - "type": [ - "boolean", - "null" - ] - } + "sessionId", + "topicId", + "by", + "at" + ] + }, + "TopicSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } + }, + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" }, - "required": [ - "event", - "providerId", - "model", - "messages" + "default": [] + } + }, + "required": [ + "sessions" + ] + }, + "TopicConversation": { + "type": "object", + "properties": { + "conversationId": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "channel": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:after" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "node": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "conversationId", + "topicId", + "by", + "at", + "channel" + ] + }, + "TopicFiling": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } + }, + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + } + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } + } + }, + "required": [ + "sessions", + "conversations", + "history" + ] + }, + "SessionSuggestion": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "name": { + "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "parentId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "name" + ] + }, + "SessionSuggestionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionSuggestion" + } + } + }, + "required": [ + "sessions" + ] + }, + "ConversationPlacement": { + "type": "object", + "properties": { + "conversationId": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "conversationId", + "topicId", + "by", + "at" + ] + }, + "ConversationPlacementReply": { + "type": "object", + "properties": { + "placement": { + "anyOf": [ + { + "$ref": "#/$defs/ConversationPlacement" }, - "hasToolCalls": { - "type": "boolean" + { + "type": "null" } - }, - "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" ] + } + } + }, + "TopicPage": { + "type": "object", + "properties": { + "topic": { + "$ref": "#/$defs/TopicRecord" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "error": { - "type": "string" + "page": { + "anyOf": [ + { + "$ref": "#/$defs/WikiPageResponse" }, - "statusCode": { - "type": [ - "integer", - "null" - ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + { + "type": "null" } - }, - "required": [ - "event", - "providerId", - "model", - "error" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "tool:before" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { - "type": [ - "string", - "null" - ] - } + "mentions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicMention" }, - "required": [ - "event", - "toolName", - "args" + "default": [] + } + }, + "required": [ + "topic" + ] + }, + "TopicMention": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "topicId", + "name" + ] + }, + "DecisionStatus": { + "type": "string", + "enum": [ + "active", + "superseded" + ] + }, + "TopicDecision": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "text": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DecisionStatus" + }, + "supersededBy": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "tool:after" - }, - "toolName": { - "type": "string" + "by": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "args": { - "type": "object", - "additionalProperties": true + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "id", + "topicId", + "text", + "status", + "by", + "createdAt", + "updatedAt" + ] + }, + "TopicDecisionList": { + "type": "object", + "properties": { + "decisions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicDecision" + } + } + }, + "required": [ + "decisions" + ] + }, + "DecisionCreateRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "result": { - "type": "object", - "additionalProperties": true + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionUpdate": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionSupersedeRequest": { + "type": "object", + "properties": { + "text": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "DecisionSuperseded": { + "type": "object", + "properties": { + "superseded": { + "$ref": "#/$defs/TopicDecision" + }, + "replacement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDecision" }, - "isError": { - "type": "boolean" + { + "type": "null" } - }, - "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" ] + } + }, + "required": [ + "superseded" + ] + }, + "AgentEvent": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ], + "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:start" + "const": "session.start" }, - "platform": { + "title": { "type": [ "string", "null" ] }, - "userId": { + "name": { "type": [ "string", "null" ] + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/SessionHarness" + }, + { + "type": "null" + } + ] + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "session.end" }, - "turnCount": { + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:before" + "const": "message.user" }, - "userMessage": { - "$ref": "#/$defs/Message" + "text": { + "type": "string" }, - "skip": { - "type": [ - "boolean", - "null" - ] - }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "userMessage" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:after" + "const": "message.agent" }, - "response": { + "text": { "type": "string" }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "model": { + "type": [ + "string", + "null" + ] }, - "iterations": { - "type": "integer", - "format": "uint32", + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", "minimum": 0 }, - "aborted": { - "type": "boolean" - }, "usage": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/AgentUsage" }, { "type": "null" } ] + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:reflect" + "const": "thinking.delta" }, - "response": { + "text": { "type": "string" }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" - }, - "userMessage": { - "$ref": "#/$defs/Message" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" + "const": "tool.start" }, - "skillLocation": { + "tool": { "type": "string" }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" - }, - "skip": { + "args": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" + "const": "task.plan" }, - "toolsUsed": { + "tasks": { "type": "array", "items": { "type": "string" } }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:before" + "const": "task.check" }, - "messageCount": { + "index": { "type": "integer", - "format": "uint64", + "format": "uint32", "minimum": 0 + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "messageCount" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:after" + "const": "activity" }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "activity": { + "$ref": "#/$defs/Activity" }, - "summary": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "remainingMessages" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "const": "turn.end" }, - "blocked": { + "ts": { "type": [ - "boolean", - "null" - ] - }, - "blockReason": { - "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" + "type" ] + } + ], + "unevaluatedProperties": true + }, + "SessionHarness": { + "type": "string" + }, + "AgentUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, + "cachedTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens", + "cachedTokens" + ] + }, + "AgentEventKind": { + "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" + "const": "session.start" }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" + "title": { + "type": [ + "string", + "null" + ] }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] }, - "toolsUsed": { + "ts": { "type": [ - "array", + "integer", "null" ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" - ] - } - ] - }, - "Message": { - "type": "object", - "properties": { - "role": { - "$ref": "#/$defs/Role" - }, - "content": { - "$ref": "#/$defs/MessageContent" - }, - "reasoning": { - "type": [ - "string", - "null" - ] - }, - "toolCalls": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ToolCall" - } - }, - "toolCallId": { - "type": [ - "string", - "null" + "type" ] - } - }, - "required": [ - "role", - "content" - ] - }, - "MessageContent": { - "anyOf": [ - { - "type": "string" }, { - "type": "array", - "items": { - "$ref": "#/$defs/ContentPart" - } - } - ] - }, - "ToolCall": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "arguments": { "type": "object", - "additionalProperties": true - }, - "thoughtSignature": { - "type": [ - "string", - "null" + "properties": { + "type": { + "type": "string", + "const": "session.end" + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "type" ] - } - }, - "required": [ - "id", - "name", - "arguments" - ] - }, - "HookContextKind": { - "oneOf": [ + }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" + "const": "message.user" }, - "model": { + "text": { "type": "string" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } - }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "messages" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:after" + "const": "message.agent" }, - "providerId": { + "text": { "type": "string" }, "model": { - "type": "string" + "type": [ + "string", + "null" + ] + }, + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 }, "usage": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/AgentUsage" }, { "type": "null" } ] }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" + "const": "thinking.delta" }, - "error": { + "text": { "type": "string" }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" + "const": "tool.start" }, - "toolName": { + "tool": { "type": "string" }, "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "const": "task.plan" }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "tasks": { + "type": "array", + "items": { + "type": "string" + } }, - "isError": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:start" + "const": "task.check" }, - "platform": { - "type": [ - "string", - "null" - ] + "index": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "userId": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "activity" }, - "turnCount": { + "activity": { + "$ref": "#/$defs/Activity" + }, + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:before" - }, - "userMessage": { - "$ref": "#/$defs/Message" - }, - "skip": { - "type": [ - "boolean", - "null" - ] + "const": "turn.end" }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "userMessage" + "type" ] + } + ] + }, + "ContextUsageSource": { + "type": "string", + "enum": [ + "harness", + "last-call" + ] + }, + "LiveSessionSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" + "name": { + "type": "string" + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/SessionHarness" }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" + "lastEventTs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "pty": { + "type": [ + "string", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" }, - "userMessage": { - "$ref": "#/$defs/Message" + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + ] + } + }, + "required": [ + "id", + "name" + ] + }, + "SessionLogLine": { + "type": "object", + "properties": { + "who": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "required": [ + "who", + "text" + ] + }, + "SessionView": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "activity": { + "$ref": "#/$defs/Activity" + }, + "tool": { + "type": [ + "string", + "null" ] }, - { + "tasks": { + "type": "array", + "items": { + "type": "string" + } + }, + "thought": { + "type": "string" + }, + "lastMessage": { + "type": "string" + }, + "log": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionLogLine" + } + }, + "term": { + "type": "array", + "items": { + "type": "string" + } + }, + "ended": { + "type": "boolean" + } + }, + "required": [ + "title", + "activity", + "tasks", + "thought", + "lastMessage", + "log", + "term", + "ended" + ] + }, + "LiveSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "StateResponse": { + "type": "object", + "properties": { + "session": { + "type": "string" + }, + "state": { + "$ref": "#/$defs/SessionView" + } + }, + "required": [ + "session", + "state" + ] + }, + "snapshot": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + }, + "rooms": { "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" + "additionalProperties": { + "$ref": "#/$defs/SessionView" + } + } + }, + "required": [ + "v", + "sessions", + "rooms" + ] + }, + "session.removed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ] + }, + "SessionBroadcast": { + "type": "object", + "additionalProperties": true + }, + "CaptureBatchRequest": { + "type": "object", + "properties": { + "session_key": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "settings": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "task_id": { + "type": [ + "string", + "null" + ] + }, + "finalize": { + "type": [ + "boolean", + "null" + ] + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" + { + "type": "null" + } + ] + }, + "updated_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" }, - "skip": { - "type": [ - "boolean", - "null" - ] + { + "type": "null" + } + ] + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/CaptureMessage" + } + } + }, + "required": [ + "session_key", + "agent", + "messages" + ] + }, + "CaptureMessage": { + "type": "object", + "properties": { + "event_id": { + "type": "string" + }, + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "type": "string" + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, + "tool_args": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "tool_result": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" }, - "skipReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" ] + } + }, + "required": [ + "event_id", + "role", + "content" + ] + }, + "CaptureResult": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "conversation_id": { + "type": "string" + }, + "inserted": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "conversation_id", + "inserted", + "skipped" + ] + }, + "HookEventName": { + "type": "string", + "enum": [ + "provider:before", + "provider:after", + "provider:error", + "tool:before", + "tool:after", + "session:start", + "session:end", + "turn:before", + "turn:after", + "turn:reflect", + "skill:before", + "skill:after", + "compact:before", + "compact:after", + "delegation:before", + "delegation:after" + ] + }, + "HookContextBase": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ] + }, + "ReflectionSource": { + "type": "string", + "enum": [ + "complexity", + "periodic", + "manual" + ] + }, + "DelegationHookStatus": { + "type": "string", + "enum": [ + "completed", + "failed", + "timeout", + "cached" + ] + }, + "HookUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "SessionTokens": { + "type": "object", + "properties": { + "prompt": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "prompt", + "completion" + ] + }, + "TurnComplexity": { + "type": "object", + "properties": { + "toolCallCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hadErrorRecovery": { + "type": "boolean" + }, + "hadUserCorrection": { + "type": "boolean" + }, + "uniqueTools": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "toolCallCount", + "hadErrorRecovery", + "hadUserCorrection", + "uniqueTools" + ] + }, + "HookContext": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ], + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "event", + "providerId", + "model", + "messages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" + } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 + } + }, + "required": [ + "event", + "providerId", + "model", + "error" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] + } + ] + }, + "Message": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "$ref": "#/$defs/MessageContent" + }, + "reasoning": { + "type": [ + "string", + "null" + ] + }, + "toolCalls": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ToolCall" + } + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "role", + "content" + ] + }, + "MessageContent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ContentPart" + } + } + ] + }, + "ToolCall": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "arguments": { + "type": "object", + "additionalProperties": true + }, + "thoughtSignature": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "arguments" + ] + }, + "HookContextKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "event", + "providerId", + "model", + "messages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" + } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 + } + }, + "required": [ + "event", + "providerId", + "model", + "error" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] + } + ] + }, + "HookPipelineError": { + "type": "object", + "properties": { + "hookId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "hookId", + "error" + ] + }, + "HookPipelineResult": { + "type": "object", + "properties": { + "context": { + "$ref": "#/$defs/HookContext" + }, + "aborted": { + "type": "boolean" + }, + "skipped": { + "type": "boolean" + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/$defs/HookPipelineError" + } + }, + "ran": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "context", + "aborted", + "skipped", + "errors", + "ran" + ] + }, + "HookErrorMode": { + "type": "string", + "enum": [ + "continue", + "abort", + "retry" + ] + }, + "HookConfig": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "event": { + "$ref": "#/$defs/HookEventName" + }, + "type": { + "$ref": "#/$defs/HookConfigKind" + }, + "target": { + "type": "string" + }, + "priority": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "onError": { + "anyOf": [ + { + "$ref": "#/$defs/HookErrorMode" + }, + { + "type": "null" + } + ] + }, + "agentFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "toolFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "enabled": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "event", + "type", + "target" + ] + }, + "HookConfigKind": { + "type": "string", + "enum": [ + "shell", + "http", + "internal" + ] + }, + "RosterCommand": { + "type": "string", + "enum": [ + "claude", + "grok", + "kimi", + "opencode", + "hermes", + "codex", + "omp", + "dsh", + "cursor", + "cowork" + ] + }, + "ApprovalDecision": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session" + ] + }, + "ApprovalOutcome": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session", + "external" + ] + }, + "HarnessStatus": { + "type": "string", + "enum": [ + "working", + "blocked", + "idle" + ] + }, + "StatusPhase": { + "type": "string", + "enum": [ + "thinking", + "tool", + "writing", + "prompt" + ] + }, + "StatusSource": { + "type": "string", + "enum": [ + "herdr", + "transcript", + "hooks", + "protocol" + ] + }, + "HarnessEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "assistant-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "reasoning-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-use" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-update" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-result" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "output": { + "type": "string" + }, + "isError": { + "type": [ + "boolean", + "null" + ] + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "output" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "options": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ApprovalOption" + } + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/ApprovalOutcome" + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "decision" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-created" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "summary": { + "$ref": "#/$defs/HarnessSessionSummary" + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "summary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "plan" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/$defs/PlanEntry" + } + } + }, + "required": [ + "type", + "sessionId", + "entries" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn-complete" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "turnId": { + "type": [ + "string", + "null" + ] + }, + "stopReason": { + "type": [ + "string", + "null" + ] + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/LlmUsage" + }, + { + "type": "null" + } + ] + }, + "modelMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "context" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "window": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "source": { + "$ref": "#/$defs/ContextUsageSource" + } + }, + "required": [ + "type", + "sessionId", + "used", + "source" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "error" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "code": { + "type": "string" + }, + "deliveryId": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "retryable": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "code", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-updated" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "previousSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "transcript" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessTranscriptTurn" + } + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "truncatedBefore": { + "type": [ + "boolean", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "rev", + "from", + "total", + "turns", + "command" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "$ref": "#/$defs/HarnessStatusFrame", + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "prompt" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "promptId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/PromptKind" + }, + "toolName": { + "type": "string" + }, + "questions": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptQuestion" + } + }, + "resolved": { + "anyOf": [ + { + "$ref": "#/$defs/PromptResolution" + }, + { + "type": "null" + } + ] + }, + "screen": { + "anyOf": [ + { + "$ref": "#/$defs/PromptScreen" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "promptId", + "kind", + "toolName", + "questions" + ] + } + ] + }, + "ApprovalOption": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "key", + "label" + ] + }, + "HarnessSessionSummary": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/$defs/Millis" + }, + "updatedAt": { + "$ref": "#/$defs/Millis" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "transport": { + "anyOf": [ + { + "$ref": "#/$defs/Transport" + }, + { + "type": "null" + } + ] + }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sessionId", + "harnessId", + "createdAt", + "updatedAt", + "status" + ], + "additionalProperties": true + }, + "PlanEntry": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/PlanStatus" + } + }, + "required": [ + "content", + "status" + ] + }, + "PlanStatus": { + "type": "string", + "enum": [ + "pending", + "in_progress", + "completed" + ] + }, + "LlmUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reasoningTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheCreationTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheReadTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "StatusTool": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name" + ] + }, + "HarnessStatusFrame": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessStatus" + }, + "since": { + "type": "integer", + "format": "int64" + }, + "source": { + "anyOf": [ + { + "$ref": "#/$defs/StatusSource" + }, + { + "type": "null" + } + ] + }, + "phase": { + "anyOf": [ + { + "$ref": "#/$defs/StatusPhase" + }, + { + "type": "null" + } + ] + }, + "tool": { + "anyOf": [ + { + "$ref": "#/$defs/StatusTool" + }, + { + "type": "null" + } + ] + }, + "promptId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "status", + "since" + ] + }, + "PromptKind": { + "type": "string", + "enum": [ + "ask-user" + ] + }, + "PromptQuestion": { + "type": "object", + "properties": { + "question": { + "type": [ + "string", + "null" + ] + }, + "header": { + "type": [ + "string", + "null" + ] + }, + "multiSelect": { + "type": "boolean" + }, + "freeText": { + "type": [ + "boolean", + "null" + ] + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptOption" + } + } + }, + "required": [ + "multiSelect", + "options" + ] + }, + "PromptOption": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "label" + ] + }, + "PromptResolution": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "answerText": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "at" + ] + }, + "PromptScreen": { + "type": "object", + "properties": { + "current": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "current", + "total" + ] + }, + "HarnessCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + }, + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + }, + "turnOptions": { + "type": [ + "boolean", + "null" + ] + }, + "launchModel": { + "type": [ + "boolean", + "null" + ] + }, + "imageAttachments": { + "type": [ + "boolean", + "null" + ] + }, + "models": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/HarnessModelOption" + } + }, + "modelsSource": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessModelsSource" + }, + { + "type": "null" + } + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + }, + "modelFlag": { + "type": [ + "string", + "null" + ] + }, + "effortFlag": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals", + "liveStream", + "listSessions" + ] + }, + "HarnessModelOption": { + "type": "object", + "properties": { + "inputModalities": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + } + }, + "required": [ + "id", + "label" + ] + }, + "EffortOption": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "label" + ] + }, + "HarnessModelsSource": { + "type": "string", + "enum": [ + "discovered", + "config", + "merged", + "static" + ] + }, + "HarnessControlCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals" + ] + }, + "HarnessObservationCapabilities": { + "type": "object", + "properties": { + "liveStream": { + "type": "boolean" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "liveStream", + "listSessions" + ] + }, + "HarnessSessionCreateRequest": { + "type": "object", + "properties": { + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" - }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "event", - "messageCount" + "model": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "summary": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "remainingMessages" + "cwd": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" + "agentId": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "toolsUsed": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" + "topicId": { + "type": [ + "string", + "null" + ] + }, + "prompt": { + "type": [ + "string", + "null" ] } + } + }, + "HarnessSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessSessionSummary" + } + } + }, + "required": [ + "sessions" ] }, - "HookPipelineError": { + "HarnessOffering": { "type": "object", "properties": { - "hookId": { - "type": "string" + "harnessId": { + "$ref": "#/$defs/HarnessId" }, - "error": { - "type": "string" + "chat": { + "type": "boolean" + }, + "capabilities": { + "$ref": "#/$defs/HarnessCapabilities" } }, "required": [ - "hookId", - "error" + "harnessId", + "chat", + "capabilities" ] }, - "HookPipelineResult": { + "HarnessOfferingList": { "type": "object", "properties": { - "context": { - "$ref": "#/$defs/HookContext" - }, - "aborted": { - "type": "boolean" - }, - "skipped": { - "type": "boolean" - }, - "errors": { - "type": "array", - "items": { - "$ref": "#/$defs/HookPipelineError" - } - }, - "ran": { + "harnesses": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/HarnessOffering" } } }, "required": [ - "context", - "aborted", - "skipped", - "errors", - "ran" + "harnesses" ] }, - "HookErrorMode": { + "HarnessCode": { "type": "string", "enum": [ - "continue", - "abort", - "retry" + "invalid_session_id", + "bad_request", + "session_id_collision", + "turn_in_flight", + "capability_unsupported", + "unknown_approval", + "unknown_prompt", + "turn_failed" ] }, - "HookConfig": { + "HarnessStoreSession": { "type": "object", "properties": { "id": { "type": "string" }, - "event": { - "$ref": "#/$defs/HookEventName" - }, - "type": { - "$ref": "#/$defs/HookConfigKind" + "command": { + "$ref": "#/$defs/RosterCommand" }, - "target": { + "title": { "type": "string" }, - "priority": { + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "parentSessionId": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] }, - "onError": { - "anyOf": [ - { - "$ref": "#/$defs/HookErrorMode" - }, - { - "type": "null" - } + "agentName": { + "type": [ + "string", + "null" ] }, - "agentFilter": { + "model": { "type": [ - "array", + "string", "null" - ], - "items": { - "type": "string" - } + ] }, - "toolFilter": { + "taskId": { "type": [ - "array", + "string", "null" - ], + ] + } + }, + "required": [ + "id", + "command", + "title", + "updatedAt" + ] + }, + "HarnessStoreSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/HarnessStoreSession" } + } + }, + "required": [ + "sessions" + ] + }, + "task.done": { + "type": "object", + "properties": { + "taskId": { + "type": "string" }, - "description": { + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "parentSessionId": { "type": [ "string", "null" ] }, - "enabled": { + "childSessionId": { "type": [ - "boolean", + "string", "null" ] + }, + "ts": { + "type": "integer", + "format": "int64" } }, "required": [ - "id", - "event", - "type", - "target" + "taskId", + "status", + "ts" ] }, - "HookConfigKind": { + "TaskVerdict": { "type": "string", "enum": [ - "shell", - "http", - "internal" + "completed", + "failed", + "killed", + "timeout", + "budget-exceeded" ] }, - "RosterCommand": { + "CriterionKind": { "type": "string", "enum": [ - "claude", - "grok", - "kimi", - "opencode", - "hermes", - "codex", - "pi", - "qwen", - "cursor", - "cowork" + "manual", + "automated" ] }, - "ApprovalDecision": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession" + "AcceptanceCriterion": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/CriterionKind" + }, + "check": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "description", + "kind" ] }, - "ApprovalOutcome": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession", - "external" + "TaskBudget": { + "type": "object", + "properties": { + "maxTurns": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "maxWallClockMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + } + }, + "TaskUsage": { + "type": "object", + "properties": { + "inputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "outputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "totalTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "wallClockMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "turns", + "wallClockMs" ] }, - "HarnessStatus": { + "Effort": { "type": "string", "enum": [ - "working", - "blocked", - "idle" + "low", + "medium", + "high" ] }, - "StatusPhase": { - "type": "string", - "enum": [ - "thinking", - "tool", - "writing", - "prompt" + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "usage" ] }, - "StatusSource": { + "LogLevel": { "type": "string", "enum": [ - "herdr", - "transcript", - "hooks", - "protocol" + "debug", + "info", + "warn", + "error" ] }, - "HarnessEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "assistant-delta" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "text": { - "type": "string" - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "reasoning-delta" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "text": { - "type": "string" - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "text" - ] + "TaskWire": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool-use" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "input" - ] + "goal": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool-result" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "output": { - "type": "string" - }, - "isError": { - "type": [ - "boolean", - "null" - ] - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "output" - ] + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-request" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "requestId": { - "type": "string" - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "reason": { - "type": [ - "string", - "null" - ] - }, - "options": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ApprovalOption" - } - } - }, - "required": [ - "type", - "sessionId", - "requestId", - "name", - "input" - ] + "agentId": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-resolved" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "requestId": { - "type": "string" + "node": { + "type": "string" + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" }, - "decision": { - "$ref": "#/$defs/ApprovalOutcome" + { + "type": "null" } - }, - "required": [ - "type", - "sessionId", - "requestId", - "decision" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session-created" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "summary": { - "$ref": "#/$defs/HarnessSessionSummary" - }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "type", - "sessionId", - "summary" + "model": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn-complete" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "turnId": { - "type": [ - "string", - "null" - ] + "effort": { + "type": [ + "string", + "null" + ] + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "depth": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, + "childSessionId": { + "type": [ + "string", + "null" + ] + }, + "budget": { + "$ref": "#/$defs/TaskBudget" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/TaskUsage" }, - "stopReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "type", - "sessionId" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "error" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "code": { - "type": "string" - }, - "deliveryId": { - "type": [ - "string", - "null" - ] - }, - "message": { - "type": "string" + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "error": { + "type": [ + "string", + "null" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/$defs/TaskResult" }, - "retryable": { - "type": [ - "boolean", - "null" - ] + { + "type": "null" } - }, - "required": [ - "type", - "sessionId", - "code", - "message" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session-updated" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" - }, - "previousSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "createdAt": { + "type": "integer", + "format": "int64" + }, + "startedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "completedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "id", + "goal", + "acceptanceCriteria", + "agentId", + "node", + "depth", + "budget", + "status", + "createdAt" + ] + }, + "TaskCreateRequest": { + "type": "object", + "properties": { + "goal": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "acceptanceCriteria": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "budget": { + "anyOf": [ + { + "$ref": "#/$defs/TaskBudget" }, - "blocked": { - "type": [ - "boolean", - "null" - ] + { + "type": "null" } - }, - "required": [ - "type", - "sessionId", - "status" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "transcript" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "from": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "turns": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessTranscriptTurn" - } - }, - "command": { - "$ref": "#/$defs/RosterCommand" - }, - "truncatedBefore": { - "type": [ - "boolean", - "null" - ] - }, - "contextWindow": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "compactAt": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "type", - "sessionId", - "rev", - "from", - "total", - "turns", - "command" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "status" - } - }, - "$ref": "#/$defs/HarnessStatusFrame", - "required": [ - "type" + "workingDir": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "prompt" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "promptId": { - "type": "string" - }, - "kind": { - "$ref": "#/$defs/PromptKind" - }, - "toolName": { - "type": "string" - }, - "questions": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptQuestion" - } - }, - "resolved": { - "anyOf": [ - { - "$ref": "#/$defs/PromptResolution" - }, - { - "type": "null" - } - ] + "requestedBy": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true + }, + "TaskResponse": { + "type": "object", + "properties": { + "task": { + "$ref": "#/$defs/TaskWire" + } + }, + "required": [ + "task" + ] + }, + "TasksListResponse": { + "type": "object", + "properties": { + "tasks": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskWire" + } + } + }, + "required": [ + "tasks" + ] + }, + "TaskKillResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "prior": { + "anyOf": [ + { + "$ref": "#/$defs/TaskStatus" }, - "screen": { - "anyOf": [ - { - "$ref": "#/$defs/PromptScreen" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "type", - "sessionId", - "promptId", - "kind", - "toolName", - "questions" ] } + }, + "required": [ + "ok" ] }, - "ApprovalOption": { + "TaskWaitTimeoutResponse": { "type": "object", "properties": { - "key": { + "error": { "type": "string" }, - "label": { - "type": "string" + "task": { + "anyOf": [ + { + "$ref": "#/$defs/TaskWire" + }, + { + "type": "null" + } + ] } }, "required": [ - "key", - "label" + "error" ] }, - "HarnessSessionSummary": { + "MemorySearchResult": { "type": "object", "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "cwd": { - "type": [ - "string", - "null" + "chunk": { + "anyOf": [ + { + "$ref": "#/$defs/MemoryChunkMatch" + }, + { + "type": "null" + } ] }, - "createdAt": { - "$ref": "#/$defs/Millis" - }, - "updatedAt": { - "$ref": "#/$defs/Millis" + "id": { + "type": "string" }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" + "source": { + "$ref": "#/$defs/MemoryHitSource" }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "content": { + "type": "string" }, - "supersedes": { + "role": { "anyOf": [ { - "$ref": "#/$defs/SessionId" + "$ref": "#/$defs/Role" }, { "type": "null" } ] }, - "model": { + "agent": { "type": [ "string", "null" ] }, - "parentSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "relevanceScore": { + "type": "number", + "format": "double" }, - "agentName": { + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sessionId": { "type": [ "string", "null" ] - }, - "taskId": { + } + }, + "required": [ + "id", + "source", + "content", + "relevanceScore", + "createdAt" + ] + }, + "PluginId": { + "type": "string", + "pattern": "^[a-z](-?[a-z0-9])+$", + "maxLength": 24 + }, + "ToolName": { + "type": "string", + "pattern": "^[a-z](_?[a-z0-9])*$", + "maxLength": 24 + }, + "RouteName": { + "type": "string", + "pattern": "^[a-z0-9][a-z0-9_-]*$", + "maxLength": 64 + }, + "PluginManifest": { + "type": "object", + "properties": { + "$schema": { "type": [ "string", "null" ] }, - "effort": { + "manifest": { + "$ref": "#/$defs/ProtocolVersion" + }, + "id": { + "$ref": "#/$defs/PluginId" + }, + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { "type": [ "string", "null" ] }, - "transport": { - "anyOf": [ - { - "$ref": "#/$defs/Transport" - }, - { - "type": "null" - } - ] + "run": { + "$ref": "#/$defs/PluginRun" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTool" + } + }, + "contributes": { + "$ref": "#/$defs/PluginContributions", + "default": {} + }, + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJob" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginEventKind" + } } }, + "additionalProperties": false, "required": [ - "sessionId", - "harnessId", - "createdAt", - "updatedAt", - "status" - ], - "additionalProperties": true + "manifest", + "id", + "name", + "version", + "description", + "run" + ] }, - "StatusTool": { + "PluginRun": { "type": "object", "properties": { - "name": { - "type": "string" + "command": { + "type": "array", + "items": { + "type": "string" + } }, - "toolCallId": { + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "readyTimeoutMs": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "uint64", + "minimum": 0 } }, + "additionalProperties": false, "required": [ - "name" + "command" ] }, - "HarnessStatusFrame": { + "Permission": { + "type": "string", + "enum": [ + "memory.read", + "memory.write", + "sessions.read", + "sessions.control", + "topics.read", + "topics.write", + "tasks.read", + "tasks.delegate", + "agents.read", + "notifications.send", + "host.files.read", + "host.files.write", + "host.network", + "host.exec" + ] + }, + "ViewField": { "type": "object", "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" + "key": { + "type": "string" }, - "status": { - "$ref": "#/$defs/HarnessStatus" + "label": { + "type": "string" }, - "since": { - "type": "integer", - "format": "int64" + "input": { + "$ref": "#/$defs/ViewInput" }, - "source": { + "value": { "anyOf": [ { - "$ref": "#/$defs/StatusSource" + "$ref": "#/$defs/ViewValue" }, { "type": "null" } ] }, - "phase": { - "anyOf": [ - { - "$ref": "#/$defs/StatusPhase" + "required": { + "type": "boolean" + }, + "help": { + "type": [ + "string", + "null" + ] + }, + "placeholder": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "key", + "label", + "input" + ] + }, + "ViewInput": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "multiline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "number" + }, + "min": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "max": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "step": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toggle" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "select" }, - { - "type": "null" + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewOption" + } + }, + "multiple": { + "type": "boolean" } + }, + "additionalProperties": false, + "required": [ + "type", + "options" ] }, - "tool": { - "anyOf": [ - { - "$ref": "#/$defs/StatusTool" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file" }, - { - "type": "null" + "multiple": { + "type": "boolean" + }, + "accept": { + "type": "array", + "items": { + "type": "string" + } } + }, + "additionalProperties": false, + "required": [ + "type" ] + } + ] + }, + "ViewOption": { + "type": "object", + "properties": { + "value": { + "type": "string" }, - "promptId": { - "type": [ - "string", - "null" - ] + "label": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "sessionId", - "status", - "since" - ] - }, - "PromptKind": { - "type": "string", - "enum": [ - "ask-user" + "value", + "label" ] }, - "PromptQuestion": { - "type": "object", - "properties": { - "question": { - "type": [ - "string", - "null" - ] + "ViewValue": { + "anyOf": [ + { + "type": "boolean" }, - "header": { - "type": [ - "string", - "null" - ] + { + "type": "number", + "format": "double" }, - "multiSelect": { - "type": "boolean" + { + "type": "string" }, - "freeText": { - "type": [ - "boolean", - "null" - ] + { + "type": "array", + "items": { + "type": "string" + } }, - "options": { + { "type": "array", "items": { - "$ref": "#/$defs/PromptOption" + "$ref": "#/$defs/ViewFile" } } - }, - "required": [ - "multiSelect", - "options" ] }, - "PromptOption": { + "ViewFile": { "type": "object", "properties": { - "label": { + "name": { "type": "string" }, - "description": { - "type": [ - "string", - "null" - ] + "mimeType": { + "type": "string" + }, + "data": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "label" + "name", + "mimeType", + "data" ] }, - "PromptResolution": { + "PluginTool": { "type": "object", "properties": { - "at": { - "type": "integer", - "format": "int64" + "name": { + "$ref": "#/$defs/ToolName" }, - "answerText": { + "title": { "type": [ "string", "null" ] + }, + "description": { + "type": "string" + }, + "inputSchema": { + "type": "object", + "additionalProperties": true + }, + "hints": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolHint" + } } }, + "additionalProperties": false, "required": [ - "at" + "name", + "description", + "inputSchema" ] }, - "PromptScreen": { - "type": "object", - "properties": { - "current": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "current", - "total" + "PluginToolHint": { + "type": "string", + "enum": [ + "readOnly", + "destructive", + "idempotent", + "openWorld" ] }, - "HarnessCapabilities": { + "PluginContributions": { "type": "object", "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" - }, - "approvals": { - "type": "boolean" - }, - "liveStream": { - "type": "boolean" - }, - "listSessions": { - "type": "boolean" - }, - "drive": { - "type": [ - "boolean", - "null" - ] - }, - "turnOptions": { - "type": [ - "boolean", - "null" - ] - }, - "launchModel": { - "type": [ - "boolean", - "null" - ] - }, - "imageAttachments": { - "type": [ - "boolean", - "null" - ] - }, - "models": { - "type": [ - "array", - "null" - ], + "pages": { + "type": "array", "items": { - "$ref": "#/$defs/HarnessModelOption" + "$ref": "#/$defs/PluginPage" } }, - "modelsSource": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessModelsSource" - }, - { - "type": "null" - } - ] + "topicCards": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTopicCard" + } }, - "efforts": { - "type": [ - "array", - "null" - ], + "sessionActions": { + "type": "array", "items": { - "$ref": "#/$defs/EffortOption" + "$ref": "#/$defs/PluginSessionAction" } + } + }, + "additionalProperties": false + }, + "PluginPage": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" }, - "modelFlag": { + "icon": { "type": [ "string", "null" ] }, - "effortFlag": { - "type": [ - "string", - "null" - ] + "view": { + "$ref": "#/$defs/RouteName" } }, + "additionalProperties": false, "required": [ - "interrupt", - "resume", - "approvals", - "liveStream", - "listSessions" + "id", + "title", + "view" ] }, - "HarnessModelOption": { + "PluginTopicCard": { "type": "object", "properties": { - "inputModalities": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, "id": { - "type": "string" + "$ref": "#/$defs/RouteName" }, - "label": { + "title": { "type": "string" }, - "isDefault": { - "type": [ - "boolean", - "null" - ] - }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } + "view": { + "$ref": "#/$defs/RouteName" } }, + "additionalProperties": false, "required": [ "id", - "label" + "title", + "view" ] }, - "EffortOption": { + "PluginSessionAction": { "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/$defs/RouteName" }, - "label": { + "title": { "type": "string" }, - "isDefault": { + "icon": { "type": [ - "boolean", + "string", "null" ] + }, + "action": { + "$ref": "#/$defs/ViewAction" } }, + "additionalProperties": false, "required": [ "id", - "label" - ] - }, - "HarnessModelsSource": { - "type": "string", - "enum": [ - "discovered", - "config", - "merged", - "static" + "title", + "action" ] }, - "HarnessControlCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" + "ViewAction": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "call" + }, + "action": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "action" + ] }, - "resume": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "navigate" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "replace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] }, - "approvals": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "back" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "refresh" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toast" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "copy" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openSession" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openTopic" + }, + "topicId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "topicId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openUrl" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false, + "required": [ + "type", + "url" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "download" + }, + "path": { + "type": "string" + }, + "filename": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "path" + ] } - }, - "required": [ - "interrupt", - "resume", - "approvals" ] }, - "HarnessObservationCapabilities": { + "ViewTone": { + "type": "string", + "enum": [ + "neutral", + "info", + "success", + "warning", + "danger" + ] + }, + "PluginJob": { "type": "object", "properties": { - "liveStream": { - "type": "boolean" + "id": { + "$ref": "#/$defs/RouteName" }, - "listSessions": { - "type": "boolean" + "title": { + "type": "string" }, - "drive": { + "schedule": { "type": [ - "boolean", + "string", "null" ] + }, + "timeoutMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 } }, + "additionalProperties": false, "required": [ - "liveStream", - "listSessions" + "id", + "title" ] }, - "HarnessSessionList": { + "PluginEventKind": { + "type": "string", + "enum": [ + "session.started", + "session.idle", + "session.ended", + "session.placed", + "summary.written", + "task.done" + ] + }, + "View": { "type": "object", "properties": { - "sessions": { + "title": { + "type": "string" + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "toolbar": { "type": "array", "items": { - "$ref": "#/$defs/HarnessSessionSummary" + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" } } }, + "additionalProperties": false, "required": [ - "sessions" + "title", + "blocks" ] }, - "HarnessOffering": { + "ViewButton": { "type": "object", "properties": { - "harnessId": { - "$ref": "#/$defs/HarnessId" + "label": { + "type": "string" }, - "chat": { - "type": "boolean" + "icon": { + "type": [ + "string", + "null" + ] }, - "capabilities": { - "$ref": "#/$defs/HarnessCapabilities" - } - }, - "required": [ - "harnessId", - "chat", - "capabilities" - ] - }, - "HarnessOfferingList": { - "type": "object", - "properties": { - "harnesses": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessOffering" - } + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButtonStyle" + }, + { + "type": "null" + } + ] + }, + "action": { + "$ref": "#/$defs/ViewAction" + }, + "confirm": { + "anyOf": [ + { + "$ref": "#/$defs/ViewConfirm" + }, + { + "type": "null" + } + ] + }, + "disabled": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "harnesses" + "label", + "action" ] }, - "HarnessCode": { + "ViewButtonStyle": { "type": "string", "enum": [ - "invalid_session_id", - "bad_request", - "session_id_collision", - "turn_in_flight", - "capability_unsupported", - "unknown_approval", - "unknown_prompt" + "primary", + "secondary", + "danger" ] }, - "HarnessStoreSession": { + "ViewConfirm": { "type": "object", "properties": { - "id": { + "title": { "type": "string" }, - "command": { - "$ref": "#/$defs/RosterCommand" + "text": { + "type": "string" + }, + "confirmLabel": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "title", + "text" + ] + }, + "ViewBlock": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "section" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "collapsed": { + "type": [ + "boolean", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "blocks" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "split" + }, + "primary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "secondary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "ratio": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "primary", + "secondary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tabs" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewTab" + } + }, + "selected": { + "anyOf": [ + { + "$ref": "#/$defs/RouteName" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "tabs" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "markdown" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "code" + }, + "text": { + "type": "string" + }, + "language": { + "type": [ + "string", + "null" + ] + }, + "follow": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "path": { + "type": "string" + }, + "alt": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "path", + "alt" + ] }, - "title": { - "type": "string" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "properties" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewProperty" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] }, - "updatedAt": { - "type": "integer", - "format": "int64" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "progress" + }, + "value": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "label": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type" + ] }, - "parentSessionId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "notice" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "tone", + "text" ] }, - "agentName": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "list" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewListItem" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" ] }, - "model": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "table" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewColumn" + } + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewRow" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "columns", + "rows" ] }, - "taskId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "breadcrumbs" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewCrumb" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "actions" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "buttons" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "form" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "fields", + "buttons" ] - } - }, - "required": [ - "id", - "command", - "title", - "updatedAt" - ] - }, - "HarnessStoreSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessStoreSession" - } - } - }, - "required": [ - "sessions" - ] - }, - "TaskExecutorKind": { - "type": "string", - "enum": [ - "chat-loop", - "harness-session", - "mesh" - ] - }, - "TaskVerdict": { - "type": "string", - "enum": [ - "completed", - "failed", - "killed", - "timeout", - "budget-exceeded" - ] - }, - "ContextRefKind": { - "type": "string", - "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" - ] - }, - "ContextRef": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" }, - "ref": { - "type": "string" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "canvas" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "scene": { + "$ref": "#/$defs/CanvasScene" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "readOnly": { + "type": "boolean" + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "scene" + ] }, - "note": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "webPanel" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "entry": { + "type": "string" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "entry" ] } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionKind": { - "type": "string", - "enum": [ - "manual", - "automated" ] }, - "AcceptanceCriterion": { + "ViewTab": { "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/$defs/RouteName" }, - "description": { + "title": { "type": "string" }, - "kind": { - "$ref": "#/$defs/CriterionKind" - }, - "check": { + "badge": { "type": [ "string", "null" ] + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } } }, + "additionalProperties": false, "required": [ "id", - "description", - "kind" + "title", + "blocks" ] }, - "TaskBudget": { + "ViewProperty": { "type": "object", "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "maxTurns": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 + "label": { + "type": "string" }, - "maxWallClockMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "value": { + "$ref": "#/$defs/ViewInline" } - } + }, + "additionalProperties": false, + "required": [ + "label", + "value" + ] }, - "TaskUsage": { - "type": "object", - "properties": { - "inputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "outputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "ViewInline": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] }, - "totalTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "badge" + }, + "text": { + "type": "string" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text", + "tone" + ] }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "time" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTimeStyle" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "at" + ] }, - "turns": { - "type": "integer", - "format": "uint32", - "minimum": 0 + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "duration" + }, + "ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "ms" + ] }, - "wallClockMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "inputTokens", - "outputTokens", - "totalTokens", - "turns", - "wallClockMs" - ] - }, - "Effort": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "bytes" + }, + "value": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "value" + ] + } ] }, - "TaskPromptMode": { + "ViewTimeStyle": { "type": "string", "enum": [ - "task", - "heartbeat" + "relative", + "absolute" ] }, - "TaskSpec": { + "ViewListItem": { "type": "object", "properties": { - "delegation": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "subtitle": { "type": [ - "boolean", + "string", "null" ] }, - "meshFrom": { + "icon": { "type": [ "string", "null" ] }, - "taskId": { + "trailing": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } + }, + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "title" + ] + }, + "ViewEmpty": { + "type": "object", + "properties": { + "title": { "type": "string" }, - "agentId": { + "text": { + "type": [ + "string", + "null" + ] + }, + "button": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButton" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "ViewColumn": { + "type": "object", + "properties": { + "title": { "type": "string" }, - "goal": { + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] + }, + "sortable": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "ViewAlign": { + "type": "string", + "enum": [ + "start", + "center", + "end" + ] + }, + "ViewRow": { + "type": "object", + "properties": { + "id": { "type": "string" }, - "resolvedContext": { + "cells": { "type": "array", "items": { - "$ref": "#/$defs/ContextRef" + "$ref": "#/$defs/ViewInline" } }, - "acceptanceCriteria": { + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + }, + "menu": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/ViewButton" } + } + }, + "additionalProperties": false, + "required": [ + "id", + "cells" + ] + }, + "ViewCrumb": { + "type": "object", + "properties": { + "label": { + "type": "string" }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} - }, - "tools": { - "type": [ - "array", - "null" - ], + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "label" + ] + }, + "CanvasScene": { + "type": "object", + "properties": { + "items": { + "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/CanvasItem" } }, - "workingDir": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": [ - "string", - "null" + "grid": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasGrid" + }, + { + "type": "null" + } ] }, - "effort": { + "viewport": { "anyOf": [ { - "$ref": "#/$defs/Effort" + "$ref": "#/$defs/CanvasViewport" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "items" + ] + }, + "CanvasItem": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "node" + }, + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "shapes": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasShape" + } + }, + "anchors": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasAnchor" + } + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "locked": { + "type": "boolean" + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "x", + "y", + "width", + "height", + "shapes" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "connector" + }, + "id": { + "type": "string" + }, + "from": { + "$ref": "#/$defs/CanvasEnd" + }, + "to": { + "$ref": "#/$defs/CanvasEnd" + }, + "route": { + "$ref": "#/$defs/CanvasRoute" + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" + }, + "arrow": { + "$ref": "#/$defs/CanvasArrow" + }, + "label": { + "type": [ + "string", + "null" + ] }, - { - "type": "null" + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "decorative": { + "type": "boolean" } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "from", + "to", + "route", + "arrow" ] - }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" + } + ] + }, + "CanvasShape": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "rect" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "radius": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ellipse" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - }, - "session": { - "type": "string" - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "presetId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "text": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "weight": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasWeight" + }, + { + "type": "null" + } + ] + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] + }, + "maxWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "text" ] }, - "presetName": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "path" + }, + "d": { + "type": "string" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "d" ] }, - "auditOnly": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "icon" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "name": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "name" ] } - }, - "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "session" - ], - "additionalProperties": true + ] + }, + "ColorRole": { + "type": "string", + "enum": [ + "surface", + "surfaceContainer", + "surfaceContainerHigh", + "primary", + "primaryContainer", + "onPrimary", + "onPrimaryContainer", + "secondaryContainer", + "onSurface", + "onSurfaceVariant", + "outline", + "outlineVariant", + "info", + "success", + "warning", + "danger", + "category1", + "category2", + "category3", + "category4", + "category5", + "category6" + ] + }, + "CanvasWeight": { + "type": "string", + "enum": [ + "regular", + "medium", + "bold" + ] }, - "TaskPermissionDecision": { + "CanvasAnchor": { "type": "object", "properties": { - "requestId": { + "id": { "type": "string" }, - "tool": { - "type": "string" + "x": { + "type": "number", + "format": "double" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "y": { + "type": "number", + "format": "double" }, - "at": { - "type": "integer", - "format": "int64" + "side": { + "$ref": "#/$defs/CanvasSide" }, - "message": { - "type": [ - "string", - "null" - ] + "direction": { + "$ref": "#/$defs/CanvasDirection" } }, + "additionalProperties": false, "required": [ - "requestId", - "tool", - "decision", - "at" + "id", + "x", + "y", + "side", + "direction" ] }, - "TaskPermissionOutcome": { + "CanvasSide": { "type": "string", "enum": [ - "allow", - "deny", - "timeout" + "top", + "right", + "bottom", + "left" ] }, - "ArtifactKind": { + "CanvasDirection": { "type": "string", "enum": [ - "file", - "url", - "commit", - "message" + "in", + "out", + "both" ] }, - "TaskArtifact": { + "CanvasMenuItem": { "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" + "id": { + "type": "string" }, - "ref": { + "label": { "type": "string" }, - "note": { + "icon": { "type": [ "string", "null" ] - } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionReport": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "met": { + "danger": { "type": "boolean" - }, - "evidence": { - "type": "string", - "default": "" } }, + "additionalProperties": false, "required": [ "id", - "met" + "label" ] }, - "TaskResult": { + "CanvasEnd": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { + "node": { "type": "string" }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "error": { + "anchor": { "type": [ "string", "null" ] } }, + "additionalProperties": false, "required": [ - "verdict", - "summary", - "artifacts", - "usage" + "node" + ] + }, + "CanvasRoute": { + "type": "string", + "enum": [ + "straight", + "curved", + "orthogonal" ] }, - "EvalVerdict": { + "CanvasArrow": { "type": "string", "enum": [ - "verified", - "refuted", - "escalated" + "none", + "end", + "start", + "both" ] }, - "EvalOutcome": { + "CanvasGrid": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "verifierTaskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } + "size": { + "type": "number", + "format": "double" }, - "diverged": { + "snap": { "type": "boolean" - }, - "escalatedAt": { - "type": [ - "string", - "null" - ], - "format": "date-time" } }, + "additionalProperties": false, "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" + "size" ] }, - "ExecutorTurnCapabilities": { + "CanvasViewport": { "type": "object", "properties": { - "steerable": { - "type": "boolean" + "x": { + "type": "number", + "format": "double" }, - "multiTurn": { - "type": "boolean" + "y": { + "type": "number", + "format": "double" }, - "structuredStream": { - "type": "boolean" + "zoom": { + "type": "number", + "format": "double" } }, + "additionalProperties": false, "required": [ - "steerable", - "multiTurn", - "structuredStream" + "x", + "y", + "zoom" ] }, - "ExecutorResultCapabilities": { + "ViewRequest": { "type": "object", "properties": { - "usageInResult": { - "type": "boolean" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "sessionIdCapture": { - "type": "boolean" + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, - "required": [ - "usageInResult", - "sessionIdCapture" - ] + "additionalProperties": false }, - "ExecutorInteractionCapabilities": { + "ViewContext": { "type": "object", "properties": { - "slashCommands": { - "type": "boolean" + "topicId": { + "type": [ + "string", + "null" + ] }, - "effortSelection": { - "type": "boolean" + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] } }, - "required": [ - "slashCommands", - "effortSelection" - ] + "additionalProperties": false }, - "TaskApprovalRequest": { + "ViewActionRequest": { "type": "object", "properties": { - "taskId": { - "type": "string" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "requestId": { - "type": "string" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } }, - "name": { + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} + } + }, + "additionalProperties": false + }, + "ViewActionResult": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] + } + }, + "additionalProperties": false + }, + "ViewActionRefusal": { + "type": "object", + "properties": { + "message": { "type": "string" }, - "input": { + "fields": { "type": "object", - "additionalProperties": true + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "message" + ] + }, + "CanvasEventRequest": { + "type": "object", + "properties": { + "event": { + "$ref": "#/$defs/CanvasEvent" }, - "toolCallId": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "taskId", - "requestId", - "name", - "input" + "event" ] }, - "TaskEvent": { + "CanvasEvent": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "den" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "selected" + }, + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "moved" }, - "event": { - "$ref": "#/$defs/AgentEvent" + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasPosition" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "event" + "items" ] }, { @@ -11290,22 +16117,20 @@ "properties": { "type": { "type": "string", - "const": "turn.start" + "const": "connected" }, - "ts": { - "type": "integer", - "format": "int64" + "from": { + "$ref": "#/$defs/CanvasEnd" }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "to": { + "$ref": "#/$defs/CanvasEnd" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn" + "from", + "to" ] }, { @@ -11313,36 +16138,19 @@ "properties": { "type": { "type": "string", - "const": "turn.end" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "$ref": "#/$defs/TaskUsage" + "const": "deleted" }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "items": { + "type": "array", + "items": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn", - "usage" + "items" ] }, { @@ -11350,26 +16158,16 @@ "properties": { "type": { "type": "string", - "const": "session.spawned" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "activated" }, - "nativeSessionId": { + "item": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] } }, + "additionalProperties": false, "required": [ "type", - "ts", - "nativeSessionId" + "item" ] }, { @@ -11377,51 +16175,95 @@ "properties": { "type": { "type": "string", - "const": "cost" + "const": "menu" }, - "ts": { - "type": "integer", - "format": "int64" + "item": { + "type": [ + "string", + "null" + ] + }, + "choice": { + "type": "string" }, - "deltaUsd": { + "x": { "type": "number", "format": "double" }, - "totalUsd": { + "y": { "type": "number", "format": "double" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "deltaUsd", - "totalUsd" + "choice", + "x", + "y" ] + } + ] + }, + "CanvasPosition": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "id", + "x", + "y" + ] + }, + "CanvasResponse": { + "type": "object", + "properties": { + "ops": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasOp" + }, + "default": [] }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] + } + }, + "additionalProperties": false + }, + "CanvasOp": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "log" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "level": { - "$ref": "#/$defs/LogLevel" + "const": "upsert" }, - "message": { - "type": "string" + "item": { + "$ref": "#/$defs/CanvasItem" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "level", - "message" + "item" ] }, { @@ -11429,39 +16271,222 @@ "properties": { "type": { "type": "string", - "const": "approval-request" + "const": "remove" }, - "ts": { - "type": "integer", - "format": "int64" + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "ids" + ] + } + ] + }, + "PanelTheme": { + "type": "object", + "properties": { + "scheme": { + "$ref": "#/$defs/PanelScheme" + }, + "colors": { + "type": "object", + "properties": { + "category1": { + "type": "string" }, - "taskId": { + "category2": { "type": "string" }, - "requestId": { + "category3": { "type": "string" }, - "name": { + "category4": { "type": "string" }, - "input": { - "type": "object", - "additionalProperties": true + "category5": { + "type": "string" }, - "toolCallId": { + "category6": { + "type": "string" + }, + "danger": { + "type": "string" + }, + "info": { + "type": "string" + }, + "onPrimary": { + "type": "string" + }, + "onPrimaryContainer": { + "type": "string" + }, + "onSurface": { + "type": "string" + }, + "onSurfaceVariant": { + "type": "string" + }, + "outline": { + "type": "string" + }, + "outlineVariant": { + "type": "string" + }, + "primary": { + "type": "string" + }, + "primaryContainer": { + "type": "string" + }, + "secondaryContainer": { + "type": "string" + }, + "success": { + "type": "string" + }, + "surface": { + "type": "string" + }, + "surfaceContainer": { + "type": "string" + }, + "surfaceContainerHigh": { + "type": "string" + }, + "warning": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fontFamily": { + "type": "string" + }, + "fontMono": { + "type": "string" + }, + "fontSize": { + "type": "number", + "format": "double" + }, + "radius": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "scheme", + "colors", + "fontFamily", + "fontMono", + "fontSize", + "radius" + ] + }, + "PanelScheme": { + "type": "string", + "enum": [ + "light", + "dark" + ] + }, + "PanelHostMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "init" + }, + "theme": { + "$ref": "#/$defs/PanelTheme" + }, + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "name", - "input" + "theme", + "context", + "plugin", + "node" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "theme" + }, + "theme": { + "$ref": "#/$defs/PanelTheme" + } + }, + "additionalProperties": false, + "required": [ + "type", + "theme" + ] + } + ] + }, + "PanelMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ready" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "resize" + }, + "height": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "height" ] }, { @@ -11469,393 +16494,673 @@ "properties": { "type": { "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" + "const": "action" }, - "requestId": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "action": { + "$ref": "#/$defs/ViewAction" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "decision" + "action" ] } ] }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" + "PluginList": { + "type": "object", + "properties": { + "node": { + "type": "string" + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginRecord" + } + } + }, + "additionalProperties": false, + "required": [ + "node", + "plugins" ] }, - "TaskWire": { + "PluginRecord": { "type": "object", "properties": { "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { "type": "string" }, - "goal": { + "path": { "type": "string" }, - "contextRefs": { + "manifest": { + "$ref": "#/$defs/PluginManifest" + }, + "enabled": { + "type": "boolean" + }, + "state": { + "$ref": "#/$defs/PluginState" + }, + "granted": { "type": "array", "items": { - "$ref": "#/$defs/ContextRef" + "$ref": "#/$defs/Permission" } }, - "acceptanceCriteria": { + "pending": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/Permission" } }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { + "error": { "type": [ "string", "null" ] }, - "agentId": { - "type": "string" - }, - "requestedBy": { - "type": [ - "string", - "null" + "lastExit": { + "anyOf": [ + { + "$ref": "#/$defs/PluginExit" + }, + { + "type": "null" + } ] }, - "origin": { - "type": "string" + "restarts": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "parentTaskId": { + "startedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "chainDepth": { + "installedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 + "format": "int64" }, - "nodeAffinity": { + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJobStatus" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "node", + "path", + "manifest", + "enabled", + "state", + "granted", + "pending", + "restarts", + "installedAt", + "jobs" + ] + }, + "PluginState": { + "type": "string", + "enum": [ + "disabled", + "awaitingApproval", + "starting", + "running", + "backoff", + "invalid" + ] + }, + "PluginExit": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "code": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int32" }, - "claimedBy": { + "signal": { "type": [ "string", "null" ] + } + }, + "additionalProperties": false, + "required": [ + "at" + ] + }, + "PluginJobStatus": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" }, - "budget": { - "$ref": "#/$defs/TaskBudget" - }, - "usage": { + "lastRun": { "anyOf": [ { - "$ref": "#/$defs/TaskUsage" + "$ref": "#/$defs/PluginJobRun" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "id" + ] + }, + "PluginJobRun": { + "type": "object", + "properties": { + "runId": { + "type": "string" }, - "status": { - "$ref": "#/$defs/TaskStatus" - }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" }, - "maxAttempts": { + "startedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "pendingMessage": { - "type": [ - "string", - "null" - ] + "format": "int64" }, - "error": { + "finishedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "result": { + "outcome": { "anyOf": [ { - "$ref": "#/$defs/TaskResult" + "$ref": "#/$defs/PluginJobOutcome" }, { "type": "null" } ] }, - "conversationId": { - "type": [ - "string", - "null" - ] + "message": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "runId", + "trigger", + "startedAt" + ] + }, + "PluginJobTrigger": { + "type": "string", + "enum": [ + "schedule", + "manual" + ] + }, + "PluginJobOutcome": { + "type": "string", + "enum": [ + "succeeded", + "failed" + ] + }, + "PluginInstallRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "path" + ] + }, + "PluginEnableRequest": { + "type": "object", + "properties": { + "approve": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + } + }, + "additionalProperties": false + }, + "PluginLogs": { + "type": "object", + "properties": { + "lines": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginLogLine" + } + } + }, + "additionalProperties": false, + "required": [ + "lines" + ] + }, + "PluginLogLine": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "stream": { + "$ref": "#/$defs/PluginLogStream" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "at", + "stream", + "text" + ] + }, + "PluginLogStream": { + "type": "string", + "enum": [ + "stdout", + "stderr", + "host" + ] + }, + "PluginSettings": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "secretsSet": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginSettingsUpdate": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "plugin.changed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + } + }, + "required": [ + "v", + "plugin" + ] + }, + "plugin.views": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, - "sessionKey": { - "type": [ - "string", - "null" - ] + "plugin": { + "$ref": "#/$defs/PluginId" }, - "harnessSessionIds": { + "views": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/RouteName" } + } + }, + "required": [ + "v", + "plugin", + "views" + ] + }, + "PluginToolList": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "eval": { - "anyOf": [ - { - "$ref": "#/$defs/EvalOutcome" - }, - { - "type": "null" - } - ] + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolEntry" + } + } + }, + "additionalProperties": false, + "required": [ + "version", + "tools" + ] + }, + "PluginToolEntry": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "evalAttempt": { + "tool": { + "$ref": "#/$defs/PluginTool" + } + }, + "additionalProperties": false, + "required": [ + "plugin", + "tool" + ] + }, + "PluginEventDelivery": { + "type": "object", + "properties": { + "seq": { "type": "integer", - "format": "uint32", + "format": "uint64", "minimum": 0 }, - "createdAt": { + "at": { "type": "integer", "format": "int64" }, - "startedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "lastHeartbeatAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "completedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "durationMs": { - "type": [ - "integer", - "null" - ], + "missed": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskApprovalRequest" - } + "event": { + "$ref": "#/$defs/PluginEvent" } }, + "additionalProperties": false, "required": [ - "id", - "goal", - "contextRefs", - "acceptanceCriteria", - "spec", - "executor", - "agentId", - "origin", - "chainDepth", - "budget", - "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", - "createdAt" + "seq", + "at", + "missed", + "event" ] }, - "TaskCreateRequest": { - "type": "object", - "properties": { - "goal": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" + "PluginEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.started" }, - { - "type": "null" + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": [ + "string", + "null" + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "executorTarget": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.idle" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "requestedBy": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.ended" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "parentTaskId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.placed" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId", + "topicId", + "by" ] }, - "chainDepth": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "summary.written" + }, + "summaryId": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "summaryId", + "kind", + "level" ] }, - "spec": { - "anyOf": [ - { - "$ref": "#/$defs/TaskSpec" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "task.done" }, - { - "type": "null" + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" } + }, + "additionalProperties": false, + "required": [ + "type", + "taskId", + "status" ] }, - "budget": { - "anyOf": [ - { - "$ref": "#/$defs/TaskBudget" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "settings.changed" }, - { - "type": "null" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } } + }, + "additionalProperties": false, + "required": [ + "type", + "values" ] - }, - "contextRefs": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - } - }, - "required": [ - "goal", - "agentId" - ] - }, - "TaskResponse": { - "type": "object", - "properties": { - "task": { - "$ref": "#/$defs/TaskWire" } - }, - "required": [ - "task" ] }, - "TasksListResponse": { + "PluginJobRequest": { "type": "object", "properties": { - "tasks": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskWire" - } + "runId": { + "type": "string" + }, + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" + }, + "scheduledAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, + "additionalProperties": false, "required": [ - "tasks" + "runId", + "trigger" ] }, - "TaskSteerAccepted": { + "PluginJobResult": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "outcome": { + "$ref": "#/$defs/PluginJobOutcome" + }, + "message": { + "type": [ + "string", + "null" + ] } }, + "additionalProperties": false, "required": [ - "ok" + "outcome" ] }, - "TaskKillResponse": { + "PluginToolCall": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "arguments": { + "type": "object", + "additionalProperties": true }, - "prior": { + "sessionId": { "anyOf": [ { - "$ref": "#/$defs/TaskStatus" + "$ref": "#/$defs/SessionId" }, { "type": "null" @@ -11863,214 +17168,165 @@ ] } }, + "additionalProperties": false, "required": [ - "ok" + "arguments" ] }, - "TaskApprovalAccepted": { + "PluginToolResult": { "type": "object", "properties": { - "ok": { + "text": { + "type": "string" + }, + "isError": { "type": "boolean" } }, + "additionalProperties": false, "required": [ - "ok" + "text" ] }, - "TaskApprovalWaitResponse": { + "PluginSelf": { "type": "object", "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" + "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" + }, + "version": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "dataDir": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "approval" + "id", + "node", + "version", + "permissions", + "settings", + "dataDir" ] }, - "TaskWaitTimeoutResponse": { + "PluginViewsChanged": { "type": "object", "properties": { - "error": { - "type": "string" - }, - "task": { - "anyOf": [ - { - "$ref": "#/$defs/TaskWire" - }, - { - "type": "null" - } - ] + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } } }, + "additionalProperties": false, "required": [ - "error" + "views" ] }, - "TaskOverrides": { + "PluginNotify": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] + "title": { + "type": "string" }, - "model": { + "text": { "type": [ "string", "null" ] }, - "effort": { + "tone": { "anyOf": [ { - "$ref": "#/$defs/Effort" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { + "action": { "anyOf": [ { - "$ref": "#/$defs/TaskIsolation" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "plugin.notification": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "title": { + "type": "string" }, - "resumeMessage": { + "text": { "type": [ "string", "null" ] - } - }, - "additionalProperties": true - }, - "MemorySearchResult": { - "type": "object", - "properties": { - "chunk": { + }, + "tone": { "anyOf": [ { - "$ref": "#/$defs/MemoryChunkMatch" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "id": { - "type": "string" - }, - "source": { - "$ref": "#/$defs/MemoryHitSource" - }, - "content": { - "type": "string" - }, - "role": { + "action": { "anyOf": [ { - "$ref": "#/$defs/Role" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] }, - "agent": { - "type": [ - "string", - "null" - ] - }, - "relevanceScore": { - "type": "number", - "format": "double" - }, - "createdAt": { - "type": "string", - "format": "date-time" + "ts": { + "type": "integer", + "format": "int64" } }, "required": [ - "id", - "source", - "content", - "relevanceScore", - "createdAt" + "plugin", + "node", + "title", + "ts" ] } } diff --git a/packages/contract/schema/sent.schema.json b/packages/contract/schema/sent.schema.json index 2384aad..d063648 100644 --- a/packages/contract/schema/sent.schema.json +++ b/packages/contract/schema/sent.schema.json @@ -1,8 +1,8 @@ { - "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.1.0/sent.schema.json", + "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.7.0/sent.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "RivetHub contract (sent by the runtime)", - "version": "0.1.0", + "version": "0.7.0", "$defs": { "AgentPreset": { "type": "object", @@ -97,8 +97,8 @@ "hermes", "codex", "opencode", - "pi", - "qwen-code", + "omp", + "dsh", "cursor", "cowork" ] @@ -336,6 +336,261 @@ "agent" ] }, + "HubProjectDefaults": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" + }, + { + "type": "null" + } + ] + }, + "harnessId": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "node": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "type": [ + "string", + "null" + ] + } + } + }, + "ThinkingLevel": { + "type": "string", + "enum": [ + "off", + "low", + "medium", + "high", + "xhigh" + ] + }, + "HubProject": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double", + "default": 0.0 + }, + "createdAt": { + "type": "integer", + "format": "int64", + "default": 0 + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/HubProjectDefaults" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name", + "order", + "createdAt" + ] + }, + "HubLastSession": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "key", + "at" + ] + }, + "HubSessionMode": { + "type": "string", + "enum": [ + "chat", + "terminal" + ] + }, + "HubState": { + "type": "object", + "properties": { + "projects": { + "type": "array", + "items": { + "$ref": "#/$defs/HubProject" + }, + "default": [] + }, + "defaultProjectId": { + "type": [ + "string", + "null" + ] + }, + "membership": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "names": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "archived": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "pinned": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "hidden": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "modes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/HubSessionMode" + }, + "default": {} + }, + "lastSession": { + "anyOf": [ + { + "$ref": "#/$defs/HubLastSession" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "projects", + "membership", + "names", + "archived", + "pinned", + "hidden", + "modes" + ] + }, + "HubStateResponse": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "version", + "state" + ] + }, + "HubStatePutRequest": { + "type": "object", + "properties": { + "baseVersion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "baseVersion", + "state" + ] + }, + "hub.state": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "v", + "version" + ] + }, + "ProtocolVersion": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, "HarnessDescriptor": { "type": "object", "properties": { @@ -516,6 +771,12 @@ "null" ] }, + "effort": { + "type": [ + "string", + "null" + ] + }, "directory": { "type": [ "string", @@ -583,332 +844,31 @@ } ] }, - "CatalogCommand": { + "CatalogAgentsResponse": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "argHint": { - "type": [ - "string", - "null" - ] - }, - "source": { - "type": "string" + "agents": { + "type": "array", + "items": { + "$ref": "#/$defs/CatalogAgent" + } } }, "required": [ - "name", - "description", - "source" + "agents" ] }, - "CatalogExecutorEntry": { + "MeshOverview": { "type": "object", "properties": { - "key": { - "type": "string" - }, - "capabilities": { - "$ref": "#/$defs/HarnessExecutorCapabilities" + "updatedAt": { + "type": "integer", + "format": "int64" }, - "commands": { + "nodes": { "type": "array", "items": { - "$ref": "#/$defs/CatalogCommand" - } - }, - "harnessId": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessId" - }, - { - "type": "null" - } - ] - }, - "implemented": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "key", - "capabilities", - "commands" - ] - }, - "HarnessExecutorCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - }, - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - }, - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - }, - "mcpInjection": { - "$ref": "#/$defs/McpInjection" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream", - "usageInResult", - "sessionIdCapture", - "slashCommands", - "effortSelection", - "mcpInjection" - ] - }, - "McpInjection": { - "type": "string", - "enum": [ - "flag", - "cwdFile", - "persistentConfig", - "none" - ] - }, - "CatalogSkillEntry": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "required": [ - "name", - "description" - ] - }, - "CatalogSheet": { - "type": "object", - "properties": { - "node": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - }, - "executors": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogExecutorEntry" - } - }, - "tools": { - "type": "array", - "items": { - "type": "string" - } - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogSkillEntry" - } - } - }, - "required": [ - "node", - "agents", - "executors", - "tools", - "skills" - ] - }, - "CatalogAgentsResponse": { - "type": "object", - "properties": { - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - } - }, - "required": [ - "agents" - ] - }, - "OutcomeBucket": { - "type": "object", - "properties": { - "tasks": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "failed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "verified": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "refuted": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "escalated": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "diverged": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "divergenceRate": { - "type": "number", - "format": "double" - }, - "totalCostUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "avgDurationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "tasks", - "completed", - "failed", - "verified", - "refuted", - "escalated", - "diverged", - "divergenceRate" - ] - }, - "OutcomesFilter": { - "type": "object", - "properties": { - "since": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "until": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "agentId": { - "type": [ - "string", - "null" - ] - }, - "origin": { - "type": [ - "string", - "null" - ] - } - } - }, - "OutcomesResponse": { - "type": "object", - "properties": { - "filter": { - "$ref": "#/$defs/OutcomesFilter" - }, - "totals": { - "$ref": "#/$defs/OutcomeBucket" - }, - "byAgent": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byExecutor": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byDay": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - } - }, - "required": [ - "filter", - "totals", - "byAgent", - "byExecutor", - "byDay" - ] - }, - "MeshOverview": { - "type": "object", - "properties": { - "updatedAt": { - "type": "integer", - "format": "int64" - }, - "nodes": { - "type": "array", - "items": { - "$ref": "#/$defs/MeshOverviewNode" + "$ref": "#/$defs/MeshOverviewNode" } } }, @@ -949,6 +909,18 @@ "type": "null" } ] + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -1834,12 +1806,6 @@ } ] }, - "ProtocolVersion": { - "type": "integer", - "format": "uint8", - "minimum": 0, - "maximum": 255 - }, "AudioStatus": { "type": "object", "properties": { @@ -2220,6 +2186,22 @@ "null" ] }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, "tag": { "type": [ "string", @@ -2251,6 +2233,15 @@ "both" ] }, + "Role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "tool" + ] + }, "MemoryHitSource": { "type": "string", "enum": [ @@ -2395,16 +2386,7 @@ "content" ] }, - "Role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant", - "tool" - ] - }, - "MemoryFallback": { + "MemoryFallback": { "type": "string", "enum": [ "trigram" @@ -3223,6 +3205,165 @@ "messages" ] }, + "VectorState": { + "type": "string", + "enum": [ + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryNode": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "parentId": { + "type": [ + "string", + "null" + ] + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "content": { + "type": "string" + }, + "messageCount": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "earliestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "latestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sourceMessageIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "vector": { + "$ref": "#/$defs/VectorState" + } + }, + "required": [ + "id", + "level", + "kind", + "content", + "messageCount", + "createdAt", + "sourceMessageIds", + "vector" + ] + }, + "MemoryMessageTally": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "user": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "assistant": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "system": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "tool": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "embedded": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pending": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "failed": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "total", + "user", + "assistant", + "system", + "tool", + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryDagResponse": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "summaries": { + "type": "array", + "items": { + "$ref": "#/$defs/MemorySummaryNode" + } + }, + "messages": { + "$ref": "#/$defs/MemoryMessageTally" + } + }, + "required": [ + "sessionId", + "summaries", + "messages" + ] + }, "TopTool": { "type": "object", "properties": { @@ -4222,6 +4363,18 @@ "items": { "$ref": "#/$defs/DegradedProvider" } + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -4437,113 +4590,46 @@ "env" ] }, - "TranscriptTurn": { - "type": "object", - "properties": { - "role": { - "$ref": "#/$defs/Role" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "role", - "text" - ] - }, - "TranscriptResponse": { + "SessionDeleted": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "command": { - "type": "string" + "ok": { + "type": "boolean" }, - "turns": { - "type": "array", - "items": { - "$ref": "#/$defs/TranscriptTurn" - } + "session": { + "$ref": "#/$defs/SessionId" }, - "contextWindow": { - "type": [ - "integer", - "null" - ], + "conversations": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "compactAt": { - "type": [ - "integer", - "null" - ], + "messages": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "id", - "command", - "turns" - ] - }, - "ContextSource": { - "type": "string", - "enum": [ - "spawn", - "default", - "observed" - ] - }, - "SessionSummary": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "lastActive": { - "type": "integer", - "format": "int64" - }, - "messages": { + "summaries": { "type": "integer", "format": "uint64", "minimum": 0 } }, "required": [ - "id", - "lastActive", - "messages" + "ok", + "session", + "conversations", + "messages", + "summaries" ] }, - "SessionList": { + "SessionDeleteRequest": { "type": "object", "properties": { "sessions": { "type": "array", "items": { - "$ref": "#/$defs/SessionSummary" + "$ref": "#/$defs/SessionId" } } }, @@ -4551,10 +4637,240 @@ "sessions" ] }, - "MessageList": { + "SessionDeleteError": { + "type": "string", + "enum": [ + "session is live", + "not found", + "delete failed" + ] + }, + "SessionDeleteRefused": { "type": "object", "properties": { - "messages": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "ok": { + "type": "boolean" + }, + "error": { + "$ref": "#/$defs/SessionDeleteError" + } + }, + "required": [ + "session", + "ok", + "error" + ] + }, + "SessionDeleteResult": { + "anyOf": [ + { + "$ref": "#/$defs/SessionDeleted" + }, + { + "$ref": "#/$defs/SessionDeleteRefused" + } + ] + }, + "SessionDeleteResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionDeleteResult" + } + } + }, + "required": [ + "results" + ] + }, + "SessionTrashReason": { + "type": "string", + "enum": [ + "empty", + "one-word-reply" + ] + }, + "SessionTrashCandidate": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "harness": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "reason": { + "$ref": "#/$defs/SessionTrashReason" + }, + "userTurns": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reply": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "session", + "harness", + "title", + "updatedAt", + "reason", + "userTurns", + "reply" + ] + }, + "SessionTrashList": { + "type": "object", + "properties": { + "candidates": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionTrashCandidate" + } + } + }, + "required": [ + "candidates" + ] + }, + "TranscriptTurn": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "text": { + "type": "string" + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "role", + "text" + ] + }, + "TranscriptResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "type": "string" + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/TranscriptTurn" + } + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "command", + "turns" + ] + }, + "ContextSource": { + "type": "string", + "enum": [ + "spawn", + "default", + "observed" + ] + }, + "SessionSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "lastActive": { + "type": "integer", + "format": "int64" + }, + "messages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "id", + "lastActive", + "messages" + ] + }, + "SessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "MessageList": { + "type": "object", + "properties": { + "messages": { "type": "array", "items": { "$ref": "#/$defs/SessionMessage" @@ -4706,22 +5022,43 @@ "string", "null" ] + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] } }, "required": [ "text" ] }, - "ThinkingLevel": { - "type": "string", - "enum": [ - "off", - "low", - "medium", - "high", - "xhigh" - ] - }, "SessionPostAccepted": { "type": "object", "properties": { @@ -4748,20 +5085,59 @@ "message" ] }, - "SessionWsClientMessage": { + "SessionSteerRequest": { "type": "object", "properties": { - "type": { - "$ref": "#/$defs/SessionClientKind" - }, - "session": { + "text": { "type": "string" - } - }, - "required": [ - "type", - "session" - ] + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + } + }, + "required": [ + "text" + ] + }, + "SessionSteerResponse": { + "type": "object", + "properties": { + "outcome": { + "$ref": "#/$defs/SteerOutcome" + } + }, + "required": [ + "outcome" + ] + }, + "SteerOutcome": { + "type": "string", + "enum": [ + "steered", + "startedNewTurn", + "promptRequired" + ] + }, + "SessionWsClientMessage": { + "type": "object", + "properties": { + "type": { + "$ref": "#/$defs/SessionClientKind" + }, + "session": { + "type": "string" + } + }, + "required": [ + "type", + "session" + ] }, "SessionClientKind": { "type": "string", @@ -4983,11 +5359,34 @@ } ] }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TranscriptAttachment" + } + }, "complete": { "type": "boolean" }, "compact": { "type": "boolean" + }, + "startedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "endedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -5053,6 +5452,35 @@ "tool_result" ] }, + "TranscriptAttachment": { + "type": "object", + "properties": { + "mediaType": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "uri": { + "type": [ + "string", + "null" + ] + }, + "uploadId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "mediaType" + ] + }, "TranscriptWsFrame": { "type": "object", "properties": { @@ -5147,6 +5575,53 @@ "contextSource" ] }, + "SessionPreviewKind": { + "type": "string", + "enum": [ + "running", + "asking", + "approval", + "said" + ] + }, + "SessionPreview": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "kind": { + "$ref": "#/$defs/SessionPreviewKind" + }, + "text": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "kind", + "text", + "at" + ] + }, + "SessionPreviewList": { + "type": "object", + "properties": { + "previews": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionPreview" + } + } + }, + "required": [ + "previews" + ] + }, "HarnessTurnAccepted": { "type": "object", "properties": { @@ -5265,6 +5740,16 @@ } ] }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + }, "redirectedTo": { "anyOf": [ { @@ -5274,6 +5759,16 @@ "type": "null" } ] + }, + "switches": { + "anyOf": [ + { + "$ref": "#/$defs/SessionSwitches" + }, + { + "type": "null" + } + ] } }, "required": [ @@ -5304,96 +5799,255 @@ "protocol" ] }, - "HarnessSocketRefusalCode": { + "StartupContext": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSection" + } + }, + "tokens": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "deliveredVia": { + "$ref": "#/$defs/DeliveredVia" + } + }, + "required": [ + "topicId", + "sections", + "tokens", + "deliveredVia" + ] + }, + "StartupSection": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/StartupKind" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "sources": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSource" + } + } + }, + "required": [ + "kind", + "title", + "text", + "sources" + ] + }, + "StartupKind": { "type": "string", "enum": [ - "invalid_session_id", - "forbidden" + "topic", + "recent", + "relevant" ] }, - "HarnessSocketRefusal": { + "StartupSource": { "oneOf": [ { "type": "object", "properties": { - "type": { - "type": "string", - "const": "error" - }, - "code": { - "$ref": "#/$defs/HarnessSocketRefusalCode" - }, - "message": { - "type": "string" + "session": { + "$ref": "#/$defs/SessionId" } }, "required": [ - "type", - "code", - "message" - ] - } - ] - }, - "HarnessSocketMessage": { - "oneOf": [ + "session" + ], + "additionalProperties": false + }, { "type": "object", "properties": { - "type": { - "type": "string", - "const": "sync" + "wiki": { + "$ref": "#/$defs/WikiSlug" } }, "required": [ - "type" - ] + "wiki" + ], + "additionalProperties": false } ] }, - "TermSpawnRequest": { + "WikiSlug": { + "type": "string" + }, + "DeliveredVia": { + "type": "string", + "enum": [ + "metaAppend", + "cliFlag", + "none" + ] + }, + "SessionSwitches": { "type": "object", "properties": { - "command": { - "type": [ - "string", - "null" - ] - }, "model": { - "type": [ - "string", - "null" - ] + "type": "boolean" }, "effort": { - "type": [ - "string", - "null" - ] - }, - "session": { - "type": [ - "string", - "null" - ] - }, - "resume": { - "type": [ - "string", - "null" - ] - }, - "agentId": { - "type": [ - "string", - "null" - ] - }, - "force": { - "type": [ - "boolean", - "null" + "type": "boolean" + } + }, + "required": [ + "model", + "effort" + ] + }, + "HarnessSessionTitleRequest": { + "type": "object", + "properties": { + "title": { + "type": "string" + } + }, + "required": [ + "title" + ] + }, + "HarnessSessionForkRequest": { + "type": "object", + "properties": { + "prompts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "prompts" + ] + }, + "HarnessToolOutput": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "isError": { + "type": "boolean" + }, + "truncated": { + "type": "boolean" + } + }, + "required": [ + "text", + "isError", + "truncated" + ] + }, + "HarnessSocketRefusalCode": { + "type": "string", + "enum": [ + "invalid_session_id", + "forbidden" + ] + }, + "HarnessSocketRefusal": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "error" + }, + "code": { + "$ref": "#/$defs/HarnessSocketRefusalCode" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "code", + "message" + ] + } + ] + }, + "HarnessSocketMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sync" + } + }, + "required": [ + "type" + ] + } + ] + }, + "TermSpawnRequest": { + "type": "object", + "properties": { + "command": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "session": { + "type": [ + "string", + "null" + ] + }, + "resume": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "force": { + "type": [ + "boolean", + "null" ] }, "cols": { @@ -5413,6 +6067,12 @@ "format": "uint16", "minimum": 0, "maximum": 65535 + }, + "topicId": { + "type": [ + "string", + "null" + ] } } }, @@ -5990,6 +6650,9 @@ "id": { "type": "string" }, + "uri": { + "type": "string" + }, "name": { "type": "string" }, @@ -6014,6 +6677,7 @@ }, "required": [ "id", + "uri", "name", "bytes", "mediaType", @@ -6660,9 +7324,6 @@ "slug" ] }, - "WikiSlug": { - "type": "string" - }, "WikiHistoryEntry": { "type": "object", "properties": { @@ -6709,6 +7370,40 @@ "string", "null" ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6757,7 +7452,8 @@ "conversation", "task", "leaf", - "extract-wiki" + "extract-wiki", + "user" ] }, "WikiSourceSpan": { @@ -6868,6 +7564,12 @@ "items": { "type": "string" } + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6947,7 +7649,7 @@ "stalest": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/WikiTopic" } } }, @@ -6982,6 +7684,12 @@ }, "excerpt": { "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -7013,2697 +7721,2769 @@ "total" ] }, - "AgentEvent": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { - "type": "string" - } - }, - "required": [ - "v", - "session" - ], + "ProposalState": { + "type": "string", + "enum": [ + "pending", + "approved", + "rejected" + ] + }, + "Proposer": { + "type": "string", + "enum": [ + "categorizer", + "backfill" + ] + }, + "TidyChange": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "merge" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "source": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type" + "kind", + "source", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "move" }, - "ts": { + "topic": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.user" + "const": "rename" }, - "text": { + "topic": { "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "name": { + "type": "string" } }, "required": [ - "type", - "text" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.agent" + "const": "close" }, - "text": { + "topic": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "thinking.delta" + "const": "delete" }, - "text": { + "topic": { "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "tool.start" + "const": "createTopic" }, - "tool": { + "topic": { "type": "string" }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true + "name": { + "type": "string" }, - "ts": { + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] + }, + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + }, + "default": [] + }, + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tool" + "kind", + "topic", + "name", + "sessions", + "conversations" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.plan" + "const": "fileInto" }, - "tasks": { + "topic": { + "type": "string" + }, + "sessions": { "type": "array", "items": { - "type": "string" - } + "$ref": "#/$defs/SessionId" + }, + "default": [] }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tasks" + "kind", + "topic", + "sessions", + "conversations" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.check" + "const": "mergePage" }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "page": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type", - "index" + "kind", + "page", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" + "const": "removePage" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "page": { + "type": "string" } }, "required": [ - "type", - "activity" + "kind", + "page" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "turn.end" + "const": "addType" }, - "ts": { + "topic": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic", + "name" ] } - ], - "unevaluatedProperties": true + ] }, - "SessionHarness": { - "type": "string" + "TidySample": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "id" + ] }, - "AgentUsage": { + "TidyEvidence": { "type": "object", "properties": { - "promptTokens": { + "sessions": { "type": "integer", "format": "uint64", "minimum": 0 }, - "completionTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "samples": { + "type": "array", + "items": { + "$ref": "#/$defs/TidySample" + }, + "default": [] + } + }, + "required": [ + "sessions", + "samples" + ] + }, + "TidyProposal": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "cachedTokens": { + "batchId": { + "type": "string" + }, + "change": { + "$ref": "#/$defs/TidyChange" + }, + "reason": { + "type": "string" + }, + "evidence": { + "$ref": "#/$defs/TidyEvidence" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" + }, + "state": { + "$ref": "#/$defs/ProposalState" + }, + "decidedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "promptTokens", - "completionTokens", - "cachedTokens" + "id", + "batchId", + "change", + "reason", + "evidence", + "proposedBy", + "proposedAt", + "state" ] }, - "AgentEventKind": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } + "TidyBatch": { + "type": "object", + "properties": { + "batchId": { + "type": "string" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "proposals": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + } + }, + "required": [ + "batchId", + "proposedBy", + "proposedAt", + "proposals" + ] + }, + "TidyPending": { + "type": "object", + "properties": { + "batches": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyBatch" + } + } + }, + "required": [ + "batches" + ] + }, + "TidyFailure": { + "type": "object", + "properties": { + "proposalId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "proposalId", + "error" + ] + }, + "TidyBatchDecision": { + "type": "object", + "properties": { + "decided": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + }, + "failed": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyFailure" }, - "required": [ - "type" - ] + "default": [] + } + }, + "required": [ + "decided", + "failed" + ] + }, + "FilingUpkeep": { + "type": "object", + "properties": { + "categorizer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "you": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "uncategorized": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "leftOut": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "correctionsLastWeek": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "categorizer", + "you", + "uncategorized", + "leftOut", + "correctionsLastWeek" + ] + }, + "EntityTypeCount": { + "type": "object", + "properties": { + "typeId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "entities": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "typeId", + "name", + "entities" + ] + }, + "WikiUpkeep": { + "type": "object", + "properties": { + "topicPages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "entityTypes": { + "type": "array", + "items": { + "$ref": "#/$defs/EntityTypeCount" + } + }, + "loosePages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "topicPages", + "entityTypes", + "loosePages" + ] + }, + "WorkerActivity": { + "type": "object", + "properties": { + "lastFinishedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "failing": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "failing" + ] + }, + "WorkerUpkeep": { + "type": "object", + "properties": { + "embedder": { + "$ref": "#/$defs/WorkerActivity" + }, + "summarizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "categorizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "wikiBuilder": { + "$ref": "#/$defs/WorkerActivity" + } + }, + "required": [ + "embedder", + "summarizer", + "categorizer", + "wikiBuilder" + ] + }, + "MemoryUpkeep": { + "type": "object", + "properties": { + "filing": { + "$ref": "#/$defs/FilingUpkeep" }, + "wiki": { + "$ref": "#/$defs/WikiUpkeep" + }, + "workers": { + "$ref": "#/$defs/WorkerUpkeep" + }, + "pendingProposals": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "filing", + "wiki", + "workers", + "pendingProposals" + ] + }, + "TopicDirectory": { + "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "local" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "node": { + "type": "string" + }, + "path": { + "type": "string" } }, "required": [ - "type" + "kind", + "node", + "path" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.user" + "const": "shared" }, - "text": { + "path": { "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "path" ] + } + ] + }, + "TopicKind": { + "type": "string", + "enum": [ + "work", + "type", + "entity" + ] + }, + "PlacedBy": { + "type": "string", + "enum": [ + "you", + "categorizer" + ] + }, + "TopicRecord": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.agent" - }, - "text": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "thinking.delta" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] + "slug": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool.start" - }, - "tool": { - "type": "string" - }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tool" - ] + "name": { + "type": "string" }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.plan" - }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tasks" - ] + "aliases": { + "type": "array", + "items": { + "type": "string" + } }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.check" - }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "index" + "parent": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + { + "type": "null" } - }, - "required": [ - "type", - "activity" ] }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type" - ] + "createdAt": { + "type": "integer", + "format": "int64" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "closedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } + }, + "required": [ + "id", + "kind", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt" ] }, - "LiveSessionSummary": { + "TopicSummary": { "type": "object", "properties": { "id": { "type": "string" }, + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { + "type": "string" + }, "name": { "type": "string" }, - "harness": { + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { "anyOf": [ { - "$ref": "#/$defs/SessionHarness" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] }, - "lastEventTs": { - "type": [ - "integer", - "null" - ], + "createdAt": { + "type": "integer", "format": "int64" }, - "pty": { - "type": [ - "string", - "null" - ] + "updatedAt": { + "type": "integer", + "format": "int64" }, - "contextWindow": { + "closedAt": { "type": [ "integer", "null" ], + "format": "int64" + }, + "sessionCount": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "compactAt": { + "lastActive": { "type": [ "integer", "null" ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ "id", - "name" + "kind", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt", + "sessionCount" ] }, - "SessionLogLine": { + "TopicList": { "type": "object", "properties": { - "who": { - "type": "string" - }, - "text": { - "type": "string" + "topics": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSummary" + } } }, "required": [ - "who", - "text" + "topics" ] }, - "SessionView": { + "TopicCreateRequest": { "type": "object", "properties": { - "title": { + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "name": { "type": "string" }, - "activity": { - "$ref": "#/$defs/Activity" + "aliases": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] }, - "tool": { + "parent": { "type": [ "string", "null" ] }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "thought": { - "type": "string" - }, - "lastMessage": { - "type": "string" - }, - "log": { - "type": "array", - "items": { - "$ref": "#/$defs/SessionLogLine" - } - }, - "term": { - "type": "array", - "items": { - "type": "string" - } - }, - "ended": { - "type": "boolean" - } - }, - "required": [ - "title", - "activity", - "tasks", - "thought", - "lastMessage", - "log", - "term", - "ended" - ] - }, - "LiveSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/LiveSessionSummary" - } + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "sessions" + "kind", + "name", + "aliases" ] }, - "StateResponse": { + "WikiPageEdit": { "type": "object", "properties": { - "session": { - "type": "string" + "currentState": { + "type": [ + "string", + "null" + ] }, - "state": { - "$ref": "#/$defs/SessionView" + "article": { + "type": [ + "string", + "null" + ] } }, - "required": [ - "session", - "state" - ] + "additionalProperties": false }, - "snapshot": { + "TopicUpdate": { "type": "object", "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "name": { + "type": [ + "string", + "null" + ] }, - "sessions": { - "type": "array", + "aliases": { + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/$defs/LiveSessionSummary" + "type": "string" } }, - "rooms": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/SessionView" - } + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, - "required": [ - "v", - "sessions", - "rooms" - ] + "additionalProperties": false }, - "session.removed": { + "TopicMergeRequest": { "type": "object", "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { + "into": { "type": "string" } }, + "additionalProperties": false, "required": [ - "v", - "session" + "into" ] }, - "SessionBroadcast": { - "anyOf": [ - { - "$ref": "#/$defs/snapshot" + "TopicPlacement": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" }, - { - "$ref": "#/$defs/session.removed" + "topicId": { + "type": "string" }, - { - "$ref": "#/$defs/AgentEvent" + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" } + }, + "required": [ + "sessionId", + "topicId", + "by", + "at" ] }, - "CaptureBatchRequest": { + "TopicSuggestion": { "type": "object", "properties": { - "session_key": { - "type": "string" - }, - "agent": { + "name": { "type": "string" }, - "channel": { - "type": [ - "string", - "null" - ] - }, - "title": { + "topicId": { "type": [ "string", "null" ] }, - "settings": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "task_id": { + "parentId": { "type": [ "string", "null" ] - }, - "finalize": { - "type": [ - "boolean", - "null" - ] - }, - "created_at": { + } + }, + "required": [ + "name" + ] + }, + "PlacementReply": { + "type": "object", + "properties": { + "placement": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicPlacement" }, { "type": "null" } ] }, - "updated_at": { + "suggestion": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicSuggestion" }, { "type": "null" } ] + } + } + }, + "PlacementRequest": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "topicId" + ] + }, + "SessionHistoryMark": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "messages": { + "markedAt": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "markedAt" + ] + }, + "SessionHistoryList": { + "type": "object", + "properties": { + "sessions": { "type": "array", "items": { - "$ref": "#/$defs/CaptureMessage" + "$ref": "#/$defs/SessionHistoryMark" } } }, "required": [ - "session_key", - "agent", - "messages" + "sessions" ] }, - "CaptureMessage": { + "TopicSession": { "type": "object", "properties": { - "event_id": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { "type": "string" }, - "role": { - "$ref": "#/$defs/Role" + "by": { + "$ref": "#/$defs/PlacedBy" }, - "content": { - "type": "string" + "at": { + "type": "integer", + "format": "int64" }, - "tool_name": { + "title": { "type": [ "string", "null" ] }, - "tool_args": { + "lastActive": { "type": [ - "object", + "integer", "null" ], - "additionalProperties": true + "format": "int64" }, - "tool_result": { + "node": { "type": [ "string", "null" ] }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "created_at": { + "parentSessionId": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/SessionId" }, { "type": "null" } ] + }, + "taskId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "event_id", - "role", - "content" + "sessionId", + "topicId", + "by", + "at" ] }, - "CaptureResult": { + "TopicSessionList": { "type": "object", "properties": { - "ok": { - "type": "boolean" - }, - "conversation_id": { - "type": "string" - }, - "inserted": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } }, - "skipped": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + }, + "default": [] } }, "required": [ - "ok", - "conversation_id", - "inserted", - "skipped" - ] - }, - "HookEventName": { - "type": "string", - "enum": [ - "provider:before", - "provider:after", - "provider:error", - "tool:before", - "tool:after", - "session:start", - "session:end", - "turn:before", - "turn:after", - "turn:reflect", - "skill:before", - "skill:after", - "compact:before", - "compact:after", - "delegation:before", - "delegation:after" + "sessions", + "conversations" ] }, - "HookContextBase": { + "TopicConversation": { "type": "object", "properties": { - "agentId": { + "conversationId": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "channel": { + "type": "string" + }, + "title": { "type": [ "string", "null" ] }, - "sessionId": { + "lastActive": { "type": [ - "string", + "integer", "null" - ] - }, - "timestamp": { - "type": "integer", + ], "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": true + "node": { + "type": [ + "string", + "null" + ] } }, "required": [ - "timestamp", - "metadata" + "conversationId", + "topicId", + "by", + "at", + "channel" ] }, - "ReflectionSource": { - "type": "string", - "enum": [ - "complexity", - "periodic", - "manual" - ] - }, - "DelegationHookStatus": { - "type": "string", - "enum": [ - "completed", - "failed", - "timeout", - "cached" + "TopicFiling": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } + }, + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + } + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } + } + }, + "required": [ + "sessions", + "conversations", + "history" ] }, - "HookUsage": { + "SessionSuggestion": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "completionTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "parentId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "promptTokens", - "completionTokens" + "sessionId", + "name" ] }, - "SessionTokens": { + "SessionSuggestionList": { "type": "object", "properties": { - "prompt": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completion": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionSuggestion" + } } }, "required": [ - "prompt", - "completion" + "sessions" ] }, - "TurnComplexity": { + "ConversationPlacement": { "type": "object", "properties": { - "toolCallCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "conversationId": { + "type": "string" }, - "hadErrorRecovery": { - "type": "boolean" + "topicId": { + "type": "string" }, - "hadUserCorrection": { - "type": "boolean" + "by": { + "$ref": "#/$defs/PlacedBy" }, - "uniqueTools": { + "at": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" } }, "required": [ - "toolCallCount", - "hadErrorRecovery", - "hadUserCorrection", - "uniqueTools" + "conversationId", + "topicId", + "by", + "at" ] }, - "HookContext": { + "ConversationPlacementReply": { "type": "object", "properties": { - "agentId": { - "type": [ - "string", - "null" + "placement": { + "anyOf": [ + { + "$ref": "#/$defs/ConversationPlacement" + }, + { + "type": "null" + } ] + } + } + }, + "TopicPage": { + "type": "object", + "properties": { + "topic": { + "$ref": "#/$defs/TopicRecord" }, - "sessionId": { - "type": [ - "string", - "null" + "page": { + "anyOf": [ + { + "$ref": "#/$defs/WikiPageResponse" + }, + { + "type": "null" + } ] }, - "timestamp": { + "mentions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicMention" + }, + "default": [] + } + }, + "required": [ + "topic", + "mentions" + ] + }, + "TopicMention": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "topicId", + "name" + ] + }, + "DecisionStatus": { + "type": "string", + "enum": [ + "active", + "superseded" + ] + }, + "TopicDecision": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "text": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DecisionStatus" + }, + "supersededBy": { + "type": [ + "string", + "null" + ] + }, + "by": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "createdAt": { "type": "integer", "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": true + "updatedAt": { + "type": "integer", + "format": "int64" } }, "required": [ - "timestamp", - "metadata" - ], - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" + "id", + "topicId", + "text", + "status", + "by", + "createdAt", + "updatedAt" + ] + }, + "TopicDecisionList": { + "type": "object", + "properties": { + "decisions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicDecision" + } + } + }, + "required": [ + "decisions" + ] + }, + "DecisionCreateRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "model": { - "type": "string" + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionUpdate": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionSupersedeRequest": { + "type": "object", + "properties": { + "text": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "DecisionSuperseded": { + "type": "object", + "properties": { + "superseded": { + "$ref": "#/$defs/TopicDecision" + }, + "replacement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDecision" }, - "skip": { - "type": [ - "boolean", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "providerId", - "model", - "messages" ] + } + }, + "required": [ + "superseded" + ] + }, + "AgentEvent": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ], + "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:after" + "const": "session.start" }, - "providerId": { - "type": "string" + "title": { + "type": [ + "string", + "null" + ] }, - "model": { - "type": "string" + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "error": { - "type": "string" + "const": "session.end" }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" + "const": "message.user" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" + "const": "message.agent" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "model": { + "type": [ + "string", + "null" + ] }, "durationMs": { - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint64", "minimum": 0 }, - "isError": { - "type": "boolean" - } - }, - "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:start" - }, - "platform": { - "type": [ - "string", - "null" + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/AgentUsage" + }, + { + "type": "null" + } ] }, - "userId": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "thinking.delta" }, - "turnCount": { + "text": { + "type": "string" + }, + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:before" + "const": "tool.start" }, - "userMessage": { - "$ref": "#/$defs/Message" + "tool": { + "type": "string" }, - "skip": { + "args": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "userMessage" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" + "const": "task.plan" }, - "toolsUsed": { + "tasks": { "type": "array", "items": { "type": "string" } }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "const": "task.check" }, - "iterations": { + "index": { "type": "integer", "format": "uint32", "minimum": 0 }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" - }, - "userMessage": { - "$ref": "#/$defs/Message" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } + "const": "activity" }, - "matchScore": { - "type": "number", - "format": "double" + "activity": { + "$ref": "#/$defs/Activity" }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] - }, - "skipReason": { - "type": [ - "string", - "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" + "const": "turn.end" }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "type" + ] + } + ], + "unevaluatedProperties": true + }, + "SessionHarness": { + "type": "string" + }, + "AgentUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens", + "cachedTokens" + ] + }, + "AgentEventKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.start" }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "title": { + "type": [ + "string", + "null" + ] }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] - } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "messageCount" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "const": "session.end" }, - "summary": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "remainingMessages" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" + "const": "message.user" }, - "task": { + "text": { "type": "string" }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" + "const": "message.agent" }, - "task": { + "text": { "type": "string" }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" + "model": { + "type": [ + "string", + "null" + ] }, "durationMs": { - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint64", "minimum": 0 }, "usage": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/AgentUsage" }, { "type": "null" } ] }, - "toolsUsed": { + "ts": { "type": [ - "array", + "integer", "null" ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" - ] - } - ] - }, - "Message": { - "type": "object", - "properties": { - "role": { - "$ref": "#/$defs/Role" - }, - "content": { - "$ref": "#/$defs/MessageContent" - }, - "reasoning": { - "type": [ - "string", - "null" + "type", + "text" ] }, - "toolCalls": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ToolCall" - } - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "role", - "content" - ] - }, - "MessageContent": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/ContentPart" - } - } - ] - }, - "ToolCall": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "arguments": { - "type": "object", - "additionalProperties": true - }, - "thoughtSignature": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "arguments" - ] - }, - "HookContextKind": { - "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" + "const": "thinking.delta" }, - "model": { + "text": { "type": "string" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } - }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] - } - }, - "required": [ - "event", - "providerId", - "model", - "messages" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:after" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hasToolCalls": { - "type": "boolean" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" + "const": "tool.start" }, - "model": { + "tool": { "type": "string" }, - "error": { - "type": "string" + "args": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true + "const": "task.plan" }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "tasks": { + "type": "array", + "items": { + "type": "string" + } }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "const": "task.check" }, - "durationMs": { + "index": { "type": "integer", - "format": "uint64", + "format": "uint32", "minimum": 0 }, - "isError": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:start" + "const": "activity" }, - "platform": { - "type": [ - "string", - "null" - ] + "activity": { + "$ref": "#/$defs/Activity" }, - "userId": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "turn.end" }, - "turnCount": { + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type" ] + } + ] + }, + "ContextUsageSource": { + "type": "string", + "enum": [ + "harness", + "last-call" + ] + }, + "LiveSessionSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:before" - }, - "userMessage": { - "$ref": "#/$defs/Message" - }, - "skip": { - "type": [ - "boolean", - "null" - ] + "name": { + "type": "string" + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/SessionHarness" }, - "skipReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "userMessage" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" + "lastEventTs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "pty": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" }, - "userMessage": { - "$ref": "#/$defs/Message" + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" ] + } + }, + "required": [ + "id", + "name" + ] + }, + "SessionLogLine": { + "type": "object", + "properties": { + "who": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" - }, - "skip": { - "type": [ - "boolean", - "null" - ] - }, - "skipReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + "text": { + "type": "string" + } + }, + "required": [ + "who", + "text" + ] + }, + "SessionView": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "activity": { + "$ref": "#/$defs/Activity" + }, + "tool": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" - ] + "tasks": { + "type": "array", + "items": { + "type": "string" + } }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" - }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "event", - "messageCount" - ] + "thought": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "summary": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "remainingMessages" - ] + "lastMessage": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" - ] + "log": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionLogLine" + } }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "toolsUsed": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" - ] + "term": { + "type": "array", + "items": { + "type": "string" + } + }, + "ended": { + "type": "boolean" } + }, + "required": [ + "title", + "activity", + "tasks", + "thought", + "lastMessage", + "log", + "term", + "ended" ] }, - "HookPipelineError": { + "LiveSessionList": { "type": "object", "properties": { - "hookId": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "StateResponse": { + "type": "object", + "properties": { + "session": { "type": "string" }, - "error": { - "type": "string" + "state": { + "$ref": "#/$defs/SessionView" } }, "required": [ - "hookId", - "error" + "session", + "state" ] }, - "HookPipelineResult": { + "snapshot": { "type": "object", "properties": { - "context": { - "$ref": "#/$defs/HookContext" - }, - "aborted": { - "type": "boolean" - }, - "skipped": { - "type": "boolean" + "v": { + "$ref": "#/$defs/ProtocolVersion" }, - "errors": { + "sessions": { "type": "array", "items": { - "$ref": "#/$defs/HookPipelineError" + "$ref": "#/$defs/LiveSessionSummary" } }, - "ran": { - "type": "array", - "items": { - "type": "string" - } + "rooms": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/SessionView" + } } }, "required": [ - "context", - "aborted", - "skipped", - "errors", - "ran" + "v", + "sessions", + "rooms" ] }, - "HookErrorMode": { + "session.removed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ] + }, + "SessionBroadcast": { + "anyOf": [ + { + "$ref": "#/$defs/snapshot" + }, + { + "$ref": "#/$defs/session.removed" + }, + { + "$ref": "#/$defs/hub.state" + }, + { + "$ref": "#/$defs/plugin.changed" + }, + { + "$ref": "#/$defs/plugin.views" + }, + { + "$ref": "#/$defs/AgentEvent" + } + ] + }, + "plugin.changed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + } + }, + "required": [ + "v", + "plugin" + ] + }, + "PluginId": { "type": "string", - "enum": [ - "continue", - "abort", - "retry" + "pattern": "^[a-z](-?[a-z0-9])+$", + "maxLength": 24 + }, + "plugin.views": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } + } + }, + "required": [ + "v", + "plugin", + "views" ] }, - "HookConfig": { + "RouteName": { + "type": "string", + "pattern": "^[a-z0-9][a-z0-9_-]*$", + "maxLength": 64 + }, + "CaptureBatchRequest": { "type": "object", "properties": { - "id": { + "session_key": { "type": "string" }, - "event": { - "$ref": "#/$defs/HookEventName" + "agent": { + "type": "string" }, - "type": { - "$ref": "#/$defs/HookConfigKind" + "channel": { + "type": [ + "string", + "null" + ] }, - "target": { - "type": "string" + "title": { + "type": [ + "string", + "null" + ] }, - "priority": { + "settings": { "type": [ - "integer", + "object", "null" ], - "format": "int64" + "additionalProperties": true }, - "onError": { + "task_id": { + "type": [ + "string", + "null" + ] + }, + "finalize": { + "type": [ + "boolean", + "null" + ] + }, + "created_at": { "anyOf": [ { - "$ref": "#/$defs/HookErrorMode" + "$ref": "#/$defs/Millis" }, { "type": "null" } ] }, - "agentFilter": { - "type": [ - "array", - "null" - ], + "updated_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } + ] + }, + "messages": { + "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/CaptureMessage" } + } + }, + "required": [ + "session_key", + "agent", + "messages" + ] + }, + "CaptureMessage": { + "type": "object", + "properties": { + "event_id": { + "type": "string" }, - "toolFilter": { + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "type": "string" + }, + "tool_name": { "type": [ - "array", + "string", + "null" + ] + }, + "tool_args": { + "type": [ + "object", "null" ], - "items": { - "type": "string" - } + "additionalProperties": true }, - "description": { + "tool_result": { "type": [ "string", "null" ] }, - "enabled": { + "metadata": { "type": [ - "boolean", + "object", "null" + ], + "additionalProperties": true + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } ] } }, "required": [ - "id", - "event", - "type", - "target" + "event_id", + "role", + "content" ] }, - "HookConfigKind": { - "type": "string", - "enum": [ - "shell", - "http", - "internal" + "CaptureResult": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "conversation_id": { + "type": "string" + }, + "inserted": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "conversation_id", + "inserted", + "skipped" ] }, - "RosterCommand": { + "HookEventName": { "type": "string", "enum": [ - "claude", - "grok", - "kimi", - "opencode", - "hermes", - "codex", - "pi", - "qwen", - "cursor", - "cowork" + "provider:before", + "provider:after", + "provider:error", + "tool:before", + "tool:after", + "session:start", + "session:end", + "turn:before", + "turn:after", + "turn:reflect", + "skill:before", + "skill:after", + "compact:before", + "compact:after", + "delegation:before", + "delegation:after" ] }, - "ApprovalDecision": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession" + "HookContextBase": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" ] }, - "ApprovalOutcome": { + "ReflectionSource": { "type": "string", "enum": [ - "allow", - "deny", - "allowSession", - "external" + "complexity", + "periodic", + "manual" ] }, - "HarnessStatus": { + "DelegationHookStatus": { "type": "string", "enum": [ - "working", - "blocked", - "idle" + "completed", + "failed", + "timeout", + "cached" ] }, - "StatusPhase": { - "type": "string", - "enum": [ - "thinking", - "tool", - "writing", - "prompt" + "HookUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" ] }, - "StatusSource": { - "type": "string", - "enum": [ - "herdr", - "transcript", - "hooks", - "protocol" + "SessionTokens": { + "type": "object", + "properties": { + "prompt": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "prompt", + "completion" ] }, - "HarnessEvent": { + "TurnComplexity": { + "type": "object", + "properties": { + "toolCallCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hadErrorRecovery": { + "type": "boolean" + }, + "hadUserCorrection": { + "type": "boolean" + }, + "uniqueTools": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "toolCallCount", + "hadErrorRecovery", + "hadUserCorrection", + "uniqueTools" + ] + }, + "HookContext": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ], "oneOf": [ { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "assistant-delta" + "const": "provider:before" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "providerId": { + "type": "string" }, - "text": { + "model": { "type": "string" }, - "turnId": { + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { "type": [ - "string", + "boolean", "null" ] } }, "required": [ - "type", - "sessionId", - "text" + "event", + "providerId", + "model", + "messages" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "reasoning-delta" + "const": "provider:after" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "providerId": { + "type": "string" }, - "text": { + "model": { "type": "string" }, - "turnId": { - "type": [ - "string", - "null" + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" } }, "required": [ - "type", - "sessionId", - "text" + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "tool-use" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "provider:error" }, - "toolCallId": { + "providerId": { "type": "string" }, - "name": { + "model": { "type": "string" }, - "input": { - "type": "object", - "additionalProperties": true + "error": { + "type": "string" }, - "turnId": { + "statusCode": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 } }, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "input" + "event", + "providerId", + "model", + "error" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "tool-result" + "const": "tool:before" }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" - }, - "name": { + "toolName": { "type": "string" }, - "output": { - "type": "string" + "args": { + "type": "object", + "additionalProperties": true }, - "isError": { + "blocked": { "type": [ "boolean", "null" ] }, - "turnId": { + "blockReason": { "type": [ "string", "null" @@ -9711,104 +10491,90 @@ } }, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "output" + "event", + "toolName", + "args" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "approval-request" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "tool:after" }, - "requestId": { + "toolName": { "type": "string" }, - "toolCallId": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": "string" + "args": { + "type": "object", + "additionalProperties": true }, - "input": { + "result": { "type": "object", "additionalProperties": true }, - "reason": { - "type": [ - "string", - "null" - ] + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "options": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ApprovalOption" - } + "isError": { + "type": "boolean" } }, "required": [ - "type", - "sessionId", - "requestId", - "name", - "input" + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "approval-resolved" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "session:start" }, - "requestId": { - "type": "string" + "platform": { + "type": [ + "string", + "null" + ] }, - "decision": { - "$ref": "#/$defs/ApprovalOutcome" + "userId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "type", - "sessionId", - "requestId", - "decision" + "event" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "session-created" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "session:end" }, - "summary": { - "$ref": "#/$defs/HarnessSessionSummary" + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 }, - "supersedes": { + "totalTokens": { "anyOf": [ { - "$ref": "#/$defs/SessionId" + "$ref": "#/$defs/SessionTokens" }, { "type": "null" @@ -9817,28 +10583,26 @@ } }, "required": [ - "type", - "sessionId", - "summary" + "event" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "turn-complete" + "const": "turn:before" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "userMessage": { + "$ref": "#/$defs/Message" }, - "turnId": { + "skip": { "type": [ - "string", + "boolean", "null" ] }, - "stopReason": { + "skipReason": { "type": [ "string", "null" @@ -9846,152 +10610,181 @@ } }, "required": [ - "type", - "sessionId" + "event", + "userMessage" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "error" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "turn:after" }, - "code": { + "response": { "type": "string" }, - "deliveryId": { - "type": [ - "string", - "null" - ] + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } }, - "message": { - "type": "string" + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "retryable": { - "type": [ - "boolean", - "null" + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } ] } }, "required": [ - "type", - "sessionId", - "code", - "message" + "event", + "response", + "toolsUsed", + "iterations", + "aborted" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "session-updated" + "const": "turn:reflect" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "response": { + "type": "string" }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } }, - "previousSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "supersedes": { + "usage": { "anyOf": [ { - "$ref": "#/$defs/SessionId" + "$ref": "#/$defs/HookUsage" }, { "type": "null" } ] }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" } }, "required": [ - "type", - "sessionId", - "status" + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "transcript" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "skill:before" }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "from": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "skillName": { + "type": "string" }, - "total": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "skillLocation": { + "type": "string" }, - "turns": { + "matchedTriggers": { "type": "array", "items": { - "$ref": "#/$defs/HarnessTranscriptTurn" + "type": "string" } }, - "command": { - "$ref": "#/$defs/RosterCommand" + "matchScore": { + "type": "number", + "format": "double" }, - "truncatedBefore": { + "skip": { "type": [ "boolean", "null" ] }, - "contextWindow": { + "skipReason": { "type": [ - "integer", + "string", "null" - ], - "format": "uint64", + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", "minimum": 0 }, - "compactAt": { - "type": [ - "integer", - "null" - ], + "durationMs": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "contextSource": { + "usage": { "anyOf": [ { - "$ref": "#/$defs/ContextSource" + "$ref": "#/$defs/HookUsage" }, { "type": "null" @@ -10000,207 +10793,220 @@ } }, "required": [ - "type", - "sessionId", - "rev", - "from", - "total", - "turns", - "command" + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "status" + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 } }, - "$ref": "#/$defs/HarnessStatusFrame", "required": [ - "type" + "event", + "messageCount" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "prompt" + "const": "compact:after" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "promptId": { + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { "type": "string" }, - "kind": { - "$ref": "#/$defs/PromptKind" + "toAgent": { + "type": "string" }, - "toolName": { + "task": { "type": "string" }, - "questions": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptQuestion" - } + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "resolved": { - "anyOf": [ - { - "$ref": "#/$defs/PromptResolution" - }, - { - "type": "null" - } + "blocked": { + "type": [ + "boolean", + "null" ] }, - "screen": { + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { "anyOf": [ { - "$ref": "#/$defs/PromptScreen" + "$ref": "#/$defs/HookUsage" }, { "type": "null" } ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" } }, "required": [ - "type", - "sessionId", - "promptId", - "kind", - "toolName", - "questions" + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" ] } ] }, - "ApprovalOption": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": [ - "key", - "label" - ] - }, - "HarnessSessionSummary": { + "Message": { "type": "object", "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" + "role": { + "$ref": "#/$defs/Role" }, - "harnessId": { - "$ref": "#/$defs/HarnessId" + "content": { + "$ref": "#/$defs/MessageContent" }, - "title": { - "type": [ - "string", - "null" - ] - }, - "cwd": { - "type": [ - "string", - "null" - ] - }, - "createdAt": { - "$ref": "#/$defs/Millis" - }, - "updatedAt": { - "$ref": "#/$defs/Millis" - }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "parentSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - }, - "agentName": { + "reasoning": { "type": [ "string", "null" ] }, - "taskId": { + "toolCalls": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "$ref": "#/$defs/ToolCall" + } }, - "effort": { + "toolCallId": { "type": [ "string", "null" ] - }, - "transport": { - "anyOf": [ - { - "$ref": "#/$defs/Transport" - }, - { - "type": "null" - } - ] } }, "required": [ - "sessionId", - "harnessId", - "createdAt", - "updatedAt", - "status" - ], - "additionalProperties": true + "role", + "content" + ] }, - "StatusTool": { + "MessageContent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ContentPart" + } + } + ] + }, + "ToolCall": { "type": "object", "properties": { + "id": { + "type": "string" + }, "name": { "type": "string" }, - "toolCallId": { + "arguments": { + "type": "object", + "additionalProperties": true + }, + "thoughtSignature": { "type": [ "string", "null" @@ -10208,1105 +11014,5197 @@ } }, "required": [ - "name" + "id", + "name", + "arguments" ] }, - "HarnessStatusFrame": { - "type": "object", - "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "status": { - "$ref": "#/$defs/HarnessStatus" - }, - "since": { - "type": "integer", - "format": "int64" - }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/StatusSource" + "HookContextKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] } + }, + "required": [ + "event", + "providerId", + "model", + "messages" ] }, - "phase": { - "anyOf": [ - { - "$ref": "#/$defs/StatusPhase" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" ] }, - "tool": { - "anyOf": [ - { - "$ref": "#/$defs/StatusTool" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 } + }, + "required": [ + "event", + "providerId", + "model", + "error" ] }, - "promptId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "sessionId", - "status", - "since" - ] - }, - "PromptKind": { - "type": "string", - "enum": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] + } + ] + }, + "HookPipelineError": { + "type": "object", + "properties": { + "hookId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "hookId", + "error" + ] + }, + "HookPipelineResult": { + "type": "object", + "properties": { + "context": { + "$ref": "#/$defs/HookContext" + }, + "aborted": { + "type": "boolean" + }, + "skipped": { + "type": "boolean" + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/$defs/HookPipelineError" + } + }, + "ran": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "context", + "aborted", + "skipped", + "errors", + "ran" + ] + }, + "HookErrorMode": { + "type": "string", + "enum": [ + "continue", + "abort", + "retry" + ] + }, + "HookConfig": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "event": { + "$ref": "#/$defs/HookEventName" + }, + "type": { + "$ref": "#/$defs/HookConfigKind" + }, + "target": { + "type": "string" + }, + "priority": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "onError": { + "anyOf": [ + { + "$ref": "#/$defs/HookErrorMode" + }, + { + "type": "null" + } + ] + }, + "agentFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "toolFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "enabled": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "event", + "type", + "target" + ] + }, + "HookConfigKind": { + "type": "string", + "enum": [ + "shell", + "http", + "internal" + ] + }, + "RosterCommand": { + "type": "string", + "enum": [ + "claude", + "grok", + "kimi", + "opencode", + "hermes", + "codex", + "omp", + "dsh", + "cursor", + "cowork" + ] + }, + "ApprovalDecision": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session" + ] + }, + "ApprovalOutcome": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session", + "external" + ] + }, + "HarnessStatus": { + "type": "string", + "enum": [ + "working", + "blocked", + "idle" + ] + }, + "StatusPhase": { + "type": "string", + "enum": [ + "thinking", + "tool", + "writing", + "prompt" + ] + }, + "StatusSource": { + "type": "string", + "enum": [ + "herdr", + "transcript", + "hooks", + "protocol" + ] + }, + "HarnessEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "assistant-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "reasoning-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-use" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-update" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-result" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "output": { + "type": "string" + }, + "isError": { + "type": [ + "boolean", + "null" + ] + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "output" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "options": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ApprovalOption" + } + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/ApprovalOutcome" + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "decision" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-created" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "summary": { + "$ref": "#/$defs/HarnessSessionSummary" + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "summary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "plan" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/$defs/PlanEntry" + } + } + }, + "required": [ + "type", + "sessionId", + "entries" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn-complete" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "turnId": { + "type": [ + "string", + "null" + ] + }, + "stopReason": { + "type": [ + "string", + "null" + ] + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/LlmUsage" + }, + { + "type": "null" + } + ] + }, + "modelMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "context" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "window": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "source": { + "$ref": "#/$defs/ContextUsageSource" + } + }, + "required": [ + "type", + "sessionId", + "used", + "source" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "error" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "code": { + "type": "string" + }, + "deliveryId": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "retryable": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "code", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-updated" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "previousSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "transcript" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessTranscriptTurn" + } + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "truncatedBefore": { + "type": [ + "boolean", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "rev", + "from", + "total", + "turns", + "command" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "$ref": "#/$defs/HarnessStatusFrame", + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "prompt" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "promptId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/PromptKind" + }, + "toolName": { + "type": "string" + }, + "questions": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptQuestion" + } + }, + "resolved": { + "anyOf": [ + { + "$ref": "#/$defs/PromptResolution" + }, + { + "type": "null" + } + ] + }, + "screen": { + "anyOf": [ + { + "$ref": "#/$defs/PromptScreen" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "promptId", + "kind", + "toolName", + "questions" + ] + } + ] + }, + "ApprovalOption": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "key", + "label" + ] + }, + "HarnessSessionSummary": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/$defs/Millis" + }, + "updatedAt": { + "$ref": "#/$defs/Millis" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "transport": { + "anyOf": [ + { + "$ref": "#/$defs/Transport" + }, + { + "type": "null" + } + ] + }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sessionId", + "harnessId", + "createdAt", + "updatedAt", + "status" + ], + "additionalProperties": true + }, + "PlanEntry": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/PlanStatus" + } + }, + "required": [ + "content", + "status" + ] + }, + "PlanStatus": { + "type": "string", + "enum": [ + "pending", + "in_progress", + "completed" + ] + }, + "LlmUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reasoningTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheCreationTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheReadTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "StatusTool": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name" + ] + }, + "HarnessStatusFrame": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessStatus" + }, + "since": { + "type": "integer", + "format": "int64" + }, + "source": { + "anyOf": [ + { + "$ref": "#/$defs/StatusSource" + }, + { + "type": "null" + } + ] + }, + "phase": { + "anyOf": [ + { + "$ref": "#/$defs/StatusPhase" + }, + { + "type": "null" + } + ] + }, + "tool": { + "anyOf": [ + { + "$ref": "#/$defs/StatusTool" + }, + { + "type": "null" + } + ] + }, + "promptId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "status", + "since" + ] + }, + "PromptKind": { + "type": "string", + "enum": [ "ask-user" ] }, - "PromptQuestion": { + "PromptQuestion": { + "type": "object", + "properties": { + "question": { + "type": [ + "string", + "null" + ] + }, + "header": { + "type": [ + "string", + "null" + ] + }, + "multiSelect": { + "type": "boolean" + }, + "freeText": { + "type": [ + "boolean", + "null" + ] + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptOption" + } + } + }, + "required": [ + "multiSelect", + "options" + ] + }, + "PromptOption": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "label" + ] + }, + "PromptResolution": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "answerText": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "at" + ] + }, + "PromptScreen": { + "type": "object", + "properties": { + "current": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "current", + "total" + ] + }, + "HarnessCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + }, + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + }, + "turnOptions": { + "type": [ + "boolean", + "null" + ] + }, + "launchModel": { + "type": [ + "boolean", + "null" + ] + }, + "imageAttachments": { + "type": [ + "boolean", + "null" + ] + }, + "models": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/HarnessModelOption" + } + }, + "modelsSource": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessModelsSource" + }, + { + "type": "null" + } + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + }, + "modelFlag": { + "type": [ + "string", + "null" + ] + }, + "effortFlag": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals", + "liveStream", + "listSessions" + ] + }, + "HarnessModelOption": { + "type": "object", + "properties": { + "inputModalities": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + } + }, + "required": [ + "id", + "label" + ] + }, + "EffortOption": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "label" + ] + }, + "HarnessModelsSource": { + "type": "string", + "enum": [ + "discovered", + "config", + "merged", + "static" + ] + }, + "HarnessControlCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals" + ] + }, + "HarnessObservationCapabilities": { + "type": "object", + "properties": { + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "liveStream", + "listSessions" + ] + }, + "HarnessSessionCreateRequest": { + "type": "object", + "properties": { + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "prompt": { + "type": [ + "string", + "null" + ] + } + } + }, + "HarnessSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "HarnessOffering": { + "type": "object", + "properties": { + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "chat": { + "type": "boolean" + }, + "capabilities": { + "$ref": "#/$defs/HarnessCapabilities" + } + }, + "required": [ + "harnessId", + "chat", + "capabilities" + ] + }, + "HarnessOfferingList": { + "type": "object", + "properties": { + "harnesses": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessOffering" + } + } + }, + "required": [ + "harnesses" + ] + }, + "HarnessCode": { + "type": "string", + "enum": [ + "invalid_session_id", + "bad_request", + "session_id_collision", + "turn_in_flight", + "capability_unsupported", + "unknown_approval", + "unknown_prompt", + "turn_failed" + ] + }, + "HarnessStoreSession": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "command", + "title", + "updatedAt" + ] + }, + "HarnessStoreSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessStoreSession" + } + } + }, + "required": [ + "sessions" + ] + }, + "task.done": { + "type": "object", + "properties": { + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "childSessionId": { + "type": [ + "string", + "null" + ] + }, + "ts": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "taskId", + "status", + "ts" + ] + }, + "TaskVerdict": { + "type": "string", + "enum": [ + "completed", + "failed", + "killed", + "timeout", + "budget-exceeded" + ] + }, + "CriterionKind": { + "type": "string", + "enum": [ + "manual", + "automated" + ] + }, + "AcceptanceCriterion": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/CriterionKind" + }, + "check": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "description", + "kind" + ] + }, + "TaskBudget": { + "type": "object", + "properties": { + "maxTurns": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "maxWallClockMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + } + }, + "TaskUsage": { + "type": "object", + "properties": { + "inputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "outputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "totalTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "wallClockMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "turns", + "wallClockMs" + ] + }, + "Effort": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "usage" + ] + }, + "LogLevel": { + "type": "string", + "enum": [ + "debug", + "info", + "warn", + "error" + ] + }, + "TaskWire": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "agentId": { + "type": "string" + }, + "node": { + "type": "string" + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "depth": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, + "childSessionId": { + "type": [ + "string", + "null" + ] + }, + "budget": { + "$ref": "#/$defs/TaskBudget" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/TaskUsage" + }, + { + "type": "null" + } + ] + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "error": { + "type": [ + "string", + "null" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/$defs/TaskResult" + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "startedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "completedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "id", + "goal", + "acceptanceCriteria", + "agentId", + "node", + "depth", + "budget", + "status", + "createdAt" + ] + }, + "TaskCreateRequest": { + "type": "object", + "properties": { + "goal": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "acceptanceCriteria": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "budget": { + "anyOf": [ + { + "$ref": "#/$defs/TaskBudget" + }, + { + "type": "null" + } + ] + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" + }, + { + "type": "null" + } + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true + }, + "TaskResponse": { + "type": "object", + "properties": { + "task": { + "$ref": "#/$defs/TaskWire" + } + }, + "required": [ + "task" + ] + }, + "TasksListResponse": { + "type": "object", + "properties": { + "tasks": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskWire" + } + } + }, + "required": [ + "tasks" + ] + }, + "TaskKillResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "prior": { + "anyOf": [ + { + "$ref": "#/$defs/TaskStatus" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "ok" + ] + }, + "TaskWaitTimeoutResponse": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "task": { + "anyOf": [ + { + "$ref": "#/$defs/TaskWire" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "error" + ] + }, + "MemorySearchResult": { + "type": "object", + "properties": { + "chunk": { + "anyOf": [ + { + "$ref": "#/$defs/MemoryChunkMatch" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "source": { + "$ref": "#/$defs/MemoryHitSource" + }, + "content": { + "type": "string" + }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "agent": { + "type": [ + "string", + "null" + ] + }, + "relevanceScore": { + "type": "number", + "format": "double" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sessionId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "source", + "content", + "role", + "agent", + "relevanceScore", + "createdAt" + ] + }, + "ToolName": { + "type": "string", + "pattern": "^[a-z](_?[a-z0-9])*$", + "maxLength": 24 + }, + "PluginManifest": { + "type": "object", + "properties": { + "$schema": { + "type": [ + "string", + "null" + ] + }, + "manifest": { + "$ref": "#/$defs/ProtocolVersion" + }, + "id": { + "$ref": "#/$defs/PluginId" + }, + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "run": { + "$ref": "#/$defs/PluginRun" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTool" + } + }, + "contributes": { + "$ref": "#/$defs/PluginContributions", + "default": {} + }, + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJob" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginEventKind" + } + } + }, + "additionalProperties": false, + "required": [ + "manifest", + "id", + "name", + "version", + "description", + "run", + "contributes" + ] + }, + "PluginRun": { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "readyTimeoutMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "command" + ] + }, + "Permission": { + "type": "string", + "enum": [ + "memory.read", + "memory.write", + "sessions.read", + "sessions.control", + "topics.read", + "topics.write", + "tasks.read", + "tasks.delegate", + "agents.read", + "notifications.send", + "host.files.read", + "host.files.write", + "host.network", + "host.exec" + ] + }, + "ViewField": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + }, + "input": { + "$ref": "#/$defs/ViewInput" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + }, + "required": { + "type": "boolean" + }, + "help": { + "type": [ + "string", + "null" + ] + }, + "placeholder": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "key", + "label", + "input" + ] + }, + "ViewInput": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "multiline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "number" + }, + "min": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "max": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "step": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toggle" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "select" + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewOption" + } + }, + "multiple": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "options" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file" + }, + "multiple": { + "type": "boolean" + }, + "accept": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + } + ] + }, + "ViewOption": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "value", + "label" + ] + }, + "ViewValue": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number", + "format": "double" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ViewFile" + } + } + ] + }, + "ViewFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "data": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "mimeType", + "data" + ] + }, + "PluginTool": { + "type": "object", + "properties": { + "name": { + "$ref": "#/$defs/ToolName" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": "string" + }, + "inputSchema": { + "type": "object", + "additionalProperties": true + }, + "hints": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolHint" + } + } + }, + "additionalProperties": false, + "required": [ + "name", + "description", + "inputSchema" + ] + }, + "PluginToolHint": { + "type": "string", + "enum": [ + "readOnly", + "destructive", + "idempotent", + "openWorld" + ] + }, + "PluginContributions": { + "type": "object", + "properties": { + "pages": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginPage" + } + }, + "topicCards": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTopicCard" + } + }, + "sessionActions": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginSessionAction" + } + } + }, + "additionalProperties": false + }, + "PluginPage": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginTopicCard": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginSessionAction": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "action": { + "$ref": "#/$defs/ViewAction" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "action" + ] + }, + "ViewAction": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "call" + }, + "action": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "action" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "navigate" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "replace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "back" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "refresh" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toast" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "copy" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openSession" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openTopic" + }, + "topicId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "topicId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openUrl" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false, + "required": [ + "type", + "url" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "download" + }, + "path": { + "type": "string" + }, + "filename": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "path" + ] + } + ] + }, + "ViewTone": { + "type": "string", + "enum": [ + "neutral", + "info", + "success", + "warning", + "danger" + ] + }, + "PluginJob": { "type": "object", "properties": { - "question": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "schedule": { "type": [ "string", "null" ] }, - "header": { + "timeoutMs": { "type": [ - "string", + "integer", "null" - ] - }, - "multiSelect": { - "type": "boolean" + ], + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "id", + "title" + ] + }, + "PluginEventKind": { + "type": "string", + "enum": [ + "session.started", + "session.idle", + "session.ended", + "session.placed", + "summary.written", + "task.done" + ] + }, + "View": { + "type": "object", + "properties": { + "title": { + "type": "string" }, - "freeText": { + "subtitle": { "type": [ - "boolean", + "string", "null" ] }, - "options": { + "toolbar": { "type": "array", "items": { - "$ref": "#/$defs/PromptOption" + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" } } }, + "additionalProperties": false, "required": [ - "multiSelect", - "options" + "title", + "blocks" ] }, - "PromptOption": { + "ViewButton": { "type": "object", "properties": { "label": { "type": "string" }, - "description": { + "icon": { + "type": [ + "string", + "null" + ] + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButtonStyle" + }, + { + "type": "null" + } + ] + }, + "action": { + "$ref": "#/$defs/ViewAction" + }, + "confirm": { + "anyOf": [ + { + "$ref": "#/$defs/ViewConfirm" + }, + { + "type": "null" + } + ] + }, + "disabled": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "label", + "action" + ] + }, + "ViewButtonStyle": { + "type": "string", + "enum": [ + "primary", + "secondary", + "danger" + ] + }, + "ViewConfirm": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "confirmLabel": { "type": [ "string", "null" ] - } - }, - "required": [ - "label" - ] - }, - "PromptResolution": { - "type": "object", - "properties": { - "at": { - "type": "integer", - "format": "int64" + } + }, + "additionalProperties": false, + "required": [ + "title", + "text" + ] + }, + "ViewBlock": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "section" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "collapsed": { + "type": [ + "boolean", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "blocks" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "split" + }, + "primary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "secondary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "ratio": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "primary", + "secondary" + ] }, - "answerText": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tabs" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewTab" + } + }, + "selected": { + "anyOf": [ + { + "$ref": "#/$defs/RouteName" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "tabs" ] - } - }, - "required": [ - "at" - ] - }, - "PromptScreen": { - "type": "object", - "properties": { - "current": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "current", - "total" - ] - }, - "HarnessCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" }, - "approvals": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] }, - "liveStream": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "markdown" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] }, - "listSessions": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "code" + }, + "text": { + "type": "string" + }, + "language": { + "type": [ + "string", + "null" + ] + }, + "follow": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] }, - "drive": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "path": { + "type": "string" + }, + "alt": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "path", + "alt" ] }, - "turnOptions": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "properties" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewProperty" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" ] }, - "launchModel": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "progress" + }, + "value": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "label": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type" ] }, - "imageAttachments": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "notice" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "tone", + "text" ] }, - "models": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/HarnessModelOption" - } + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "list" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewListItem" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] }, - "modelsSource": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessModelsSource" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "table" }, - { - "type": "null" + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewColumn" + } + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewRow" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "columns", + "rows" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } - }, - "modelFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "breadcrumbs" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewCrumb" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" ] }, - "effortFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "actions" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "buttons" ] - } - }, - "required": [ - "interrupt", - "resume", - "approvals", - "liveStream", - "listSessions" - ] - }, - "HarnessModelOption": { - "type": "object", - "properties": { - "inputModalities": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "label": { - "type": "string" }, - "isDefault": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "form" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "fields", + "buttons" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } - } - }, - "required": [ - "id", - "label" - ] - }, - "EffortOption": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "label": { - "type": "string" - }, - "isDefault": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "canvas" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "scene": { + "$ref": "#/$defs/CanvasScene" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "readOnly": { + "type": "boolean" + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "scene" ] - } - }, - "required": [ - "id", - "label" - ] - }, - "HarnessModelsSource": { - "type": "string", - "enum": [ - "discovered", - "config", - "merged", - "static" - ] - }, - "HarnessControlCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" - }, - "approvals": { - "type": "boolean" - } - }, - "required": [ - "interrupt", - "resume", - "approvals" - ] - }, - "HarnessObservationCapabilities": { - "type": "object", - "properties": { - "liveStream": { - "type": "boolean" - }, - "listSessions": { - "type": "boolean" }, - "drive": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "webPanel" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "entry": { + "type": "string" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "entry" ] } - }, - "required": [ - "liveStream", - "listSessions" ] }, - "HarnessSessionList": { + "ViewTab": { "type": "object", "properties": { - "sessions": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "badge": { + "type": [ + "string", + "null" + ] + }, + "blocks": { "type": "array", "items": { - "$ref": "#/$defs/HarnessSessionSummary" + "$ref": "#/$defs/ViewBlock" } } }, + "additionalProperties": false, "required": [ - "sessions" + "id", + "title", + "blocks" ] }, - "HarnessOffering": { + "ViewProperty": { "type": "object", "properties": { - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "chat": { - "type": "boolean" + "label": { + "type": "string" }, - "capabilities": { - "$ref": "#/$defs/HarnessCapabilities" + "value": { + "$ref": "#/$defs/ViewInline" } }, + "additionalProperties": false, "required": [ - "harnessId", - "chat", - "capabilities" + "label", + "value" ] }, - "HarnessOfferingList": { - "type": "object", - "properties": { - "harnesses": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessOffering" - } + "ViewInline": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "badge" + }, + "text": { + "type": "string" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text", + "tone" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "time" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTimeStyle" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "at" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "duration" + }, + "ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "ms" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "bytes" + }, + "value": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "value" + ] } - }, - "required": [ - "harnesses" ] }, - "HarnessCode": { + "ViewTimeStyle": { "type": "string", "enum": [ - "invalid_session_id", - "bad_request", - "session_id_collision", - "turn_in_flight", - "capability_unsupported", - "unknown_approval", - "unknown_prompt" + "relative", + "absolute" ] }, - "HarnessStoreSession": { + "ViewListItem": { "type": "object", "properties": { "id": { "type": "string" }, - "command": { - "$ref": "#/$defs/RosterCommand" - }, "title": { "type": "string" }, - "updatedAt": { - "type": "integer", - "format": "int64" - }, - "parentSessionId": { + "subtitle": { "type": [ "string", "null" ] }, - "agentName": { + "icon": { "type": [ "string", "null" ] }, - "model": { - "type": [ - "string", - "null" - ] + "trailing": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } }, - "taskId": { - "type": [ - "string", - "null" + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } } }, + "additionalProperties": false, "required": [ "id", - "command", - "title", - "updatedAt" + "title" ] }, - "HarnessStoreSessionList": { + "ViewEmpty": { "type": "object", "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessStoreSession" - } + "title": { + "type": "string" + }, + "text": { + "type": [ + "string", + "null" + ] + }, + "button": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButton" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "sessions" - ] - }, - "TaskExecutorKind": { - "type": "string", - "enum": [ - "chat-loop", - "harness-session", - "mesh" - ] - }, - "TaskVerdict": { - "type": "string", - "enum": [ - "completed", - "failed", - "killed", - "timeout", - "budget-exceeded" - ] - }, - "ContextRefKind": { - "type": "string", - "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" + "title" ] }, - "ContextRef": { + "ViewColumn": { "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" - }, - "ref": { + "title": { "type": "string" }, - "note": { - "type": [ - "string", - "null" + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } ] + }, + "sortable": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "kind", - "ref" + "title" ] }, - "CriterionKind": { + "ViewAlign": { "type": "string", "enum": [ - "manual", - "automated" + "start", + "center", + "end" ] }, - "AcceptanceCriterion": { + "ViewRow": { "type": "object", "properties": { "id": { "type": "string" }, - "description": { - "type": "string" - }, - "kind": { - "$ref": "#/$defs/CriterionKind" + "cells": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } }, - "check": { - "type": [ - "string", - "null" + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } } }, + "additionalProperties": false, "required": [ "id", - "description", - "kind" + "cells" ] }, - "TaskBudget": { - "type": "object", - "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "maxTurns": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "maxWallClockMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - } - } - }, - "TaskUsage": { + "ViewCrumb": { "type": "object", "properties": { - "inputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "outputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "totalTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "turns": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "label": { + "type": "string" }, - "wallClockMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "inputTokens", - "outputTokens", - "totalTokens", - "turns", - "wallClockMs" - ] - }, - "Effort": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" - ] - }, - "TaskPromptMode": { - "type": "string", - "enum": [ - "task", - "heartbeat" + "label" ] }, - "TaskSpec": { + "CanvasScene": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "taskId": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "goal": { - "type": "string" - }, - "resolvedContext": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { + "items": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/CanvasItem" } }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} + "grid": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasGrid" + }, + { + "type": "null" + } + ] }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "viewport": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasViewport" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "items" + ] + }, + "CanvasItem": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "node" + }, + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "shapes": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasShape" + } + }, + "anchors": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasAnchor" + } + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "locked": { + "type": "boolean" + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "x", + "y", + "width", + "height", + "shapes" + ] }, - "workingDir": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "connector" + }, + "id": { + "type": "string" + }, + "from": { + "$ref": "#/$defs/CanvasEnd" + }, + "to": { + "$ref": "#/$defs/CanvasEnd" + }, + "route": { + "$ref": "#/$defs/CanvasRoute" + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" + }, + "arrow": { + "$ref": "#/$defs/CanvasArrow" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "from", + "to", + "route", + "arrow" ] - }, - "model": { - "type": [ - "string", - "null" + } + ] + }, + "CanvasShape": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "rect" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "radius": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ellipse" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "text": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "weight": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasWeight" + }, + { + "type": "null" + } + ] + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] + }, + "maxWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "text" ] }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "path" }, - { - "type": "null" + "d": { + "type": "string" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" } + }, + "additionalProperties": false, + "required": [ + "type", + "d" ] }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "icon" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "name": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "name" ] + } + ] + }, + "ColorRole": { + "type": "string", + "enum": [ + "surface", + "surfaceContainer", + "surfaceContainerHigh", + "primary", + "primaryContainer", + "onPrimary", + "onPrimaryContainer", + "secondaryContainer", + "onSurface", + "onSurfaceVariant", + "outline", + "outlineVariant", + "info", + "success", + "warning", + "danger", + "category1", + "category2", + "category3", + "category4", + "category5", + "category6" + ] + }, + "CanvasWeight": { + "type": "string", + "enum": [ + "regular", + "medium", + "bold" + ] + }, + "CanvasAnchor": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "x": { + "type": "number", + "format": "double" }, - "resumeMessage": { - "type": [ - "string", - "null" - ] + "y": { + "type": "number", + "format": "double" }, - "session": { - "type": "string" + "side": { + "$ref": "#/$defs/CanvasSide" }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } + "direction": { + "$ref": "#/$defs/CanvasDirection" + } + }, + "additionalProperties": false, + "required": [ + "id", + "x", + "y", + "side", + "direction" + ] + }, + "CanvasSide": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ] + }, + "CanvasDirection": { + "type": "string", + "enum": [ + "in", + "out", + "both" + ] + }, + "CanvasMenuItem": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "presetId": { - "type": [ - "string", - "null" - ] + "label": { + "type": "string" }, - "presetName": { + "icon": { "type": [ "string", "null" ] }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] + "danger": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "budget", - "session" - ], - "additionalProperties": true + "id", + "label" + ] }, - "TaskPermissionDecision": { + "CanvasEnd": { "type": "object", "properties": { - "requestId": { - "type": "string" - }, - "tool": { + "node": { "type": "string" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - }, - "at": { - "type": "integer", - "format": "int64" - }, - "message": { + "anchor": { "type": [ "string", "null" ] } }, + "additionalProperties": false, "required": [ - "requestId", - "tool", - "decision", - "at" + "node" ] }, - "TaskPermissionOutcome": { + "CanvasRoute": { "type": "string", "enum": [ - "allow", - "deny", - "timeout" + "straight", + "curved", + "orthogonal" ] }, - "ArtifactKind": { + "CanvasArrow": { "type": "string", "enum": [ - "file", - "url", - "commit", - "message" + "none", + "end", + "start", + "both" ] }, - "TaskArtifact": { + "CanvasGrid": { "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" - }, - "ref": { - "type": "string" + "size": { + "type": "number", + "format": "double" }, - "note": { - "type": [ - "string", - "null" - ] + "snap": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "kind", - "ref" + "size" ] }, - "CriterionReport": { + "CanvasViewport": { "type": "object", "properties": { - "id": { - "type": "string" + "x": { + "type": "number", + "format": "double" }, - "met": { - "type": "boolean" + "y": { + "type": "number", + "format": "double" }, - "evidence": { - "type": "string", - "default": "" + "zoom": { + "type": "number", + "format": "double" } }, + "additionalProperties": false, "required": [ - "id", - "met", - "evidence" + "x", + "y", + "zoom" ] }, - "TaskResult": { + "ViewRequest": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { - "type": "string" - }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { + "params": { "type": [ - "array", + "object", "null" ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" + "additionalProperties": true }, - "error": { - "type": [ - "string", - "null" - ] + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "verdict", - "summary", - "artifacts", - "usage" - ] - }, - "EvalVerdict": { - "type": "string", - "enum": [ - "verified", - "refuted", - "escalated" + "context" ] }, - "EvalOutcome": { + "ViewContext": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "verifierTaskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "diverged": { - "type": "boolean" - }, - "escalatedAt": { + "topicId": { "type": [ "string", "null" - ], - "format": "date-time" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] } }, - "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" - ] + "additionalProperties": false }, - "ExecutorTurnCapabilities": { + "ViewActionRequest": { "type": "object", "properties": { - "steerable": { - "type": "boolean" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "multiTurn": { - "type": "boolean" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } }, - "structuredStream": { - "type": "boolean" + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "steerable", - "multiTurn", - "structuredStream" + "context" ] }, - "ExecutorResultCapabilities": { + "ViewActionResult": { "type": "object", "properties": { - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] } }, + "additionalProperties": false, "required": [ - "usageInResult", - "sessionIdCapture" + "actions" ] }, - "ExecutorInteractionCapabilities": { + "ViewActionRefusal": { "type": "object", "properties": { - "slashCommands": { - "type": "boolean" + "message": { + "type": "string" }, - "effortSelection": { - "type": "boolean" + "fields": { + "type": "object", + "additionalProperties": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ - "slashCommands", - "effortSelection" + "message" ] }, - "TaskApprovalRequest": { + "CanvasEventRequest": { "type": "object", "properties": { - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true + "event": { + "$ref": "#/$defs/CanvasEvent" }, - "toolCallId": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "taskId", - "requestId", - "name", - "input" + "event", + "context" ] }, - "TaskEvent": { + "CanvasEvent": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "den" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "selected" }, - "event": { - "$ref": "#/$defs/AgentEvent" + "items": { + "type": "array", + "items": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "event" + "items" ] }, { @@ -11314,22 +16212,19 @@ "properties": { "type": { "type": "string", - "const": "turn.start" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "moved" }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasPosition" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn" + "items" ] }, { @@ -11337,36 +16232,20 @@ "properties": { "type": { "type": "string", - "const": "turn.end" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "const": "connected" }, - "usage": { - "$ref": "#/$defs/TaskUsage" + "from": { + "$ref": "#/$defs/CanvasEnd" }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "to": { + "$ref": "#/$defs/CanvasEnd" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn", - "usage" + "from", + "to" ] }, { @@ -11374,26 +16253,36 @@ "properties": { "type": { "type": "string", - "const": "session.spawned" + "const": "deleted" }, - "ts": { - "type": "integer", - "format": "int64" + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "activated" }, - "nativeSessionId": { + "item": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] } }, + "additionalProperties": false, "required": [ "type", - "ts", - "nativeSessionId" + "item" ] }, { @@ -11401,91 +16290,322 @@ "properties": { "type": { "type": "string", - "const": "cost" + "const": "menu" }, - "ts": { - "type": "integer", - "format": "int64" + "item": { + "type": [ + "string", + "null" + ] + }, + "choice": { + "type": "string" }, - "deltaUsd": { + "x": { "type": "number", "format": "double" }, - "totalUsd": { + "y": { "type": "number", "format": "double" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "deltaUsd", - "totalUsd" + "choice", + "x", + "y" ] + } + ] + }, + "CanvasPosition": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "id", + "x", + "y" + ] + }, + "CanvasResponse": { + "type": "object", + "properties": { + "ops": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasOp" + }, + "default": [] }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] + } + }, + "additionalProperties": false, + "required": [ + "ops", + "actions" + ] + }, + "CanvasOp": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "log" + "const": "upsert" }, - "ts": { - "type": "integer", - "format": "int64" + "item": { + "$ref": "#/$defs/CanvasItem" + } + }, + "additionalProperties": false, + "required": [ + "type", + "item" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "remove" }, - "level": { - "$ref": "#/$defs/LogLevel" + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "ids" + ] + } + ] + }, + "PanelTheme": { + "type": "object", + "properties": { + "scheme": { + "$ref": "#/$defs/PanelScheme" + }, + "colors": { + "type": "object", + "properties": { + "category1": { + "type": "string" }, - "message": { + "category2": { + "type": "string" + }, + "category3": { + "type": "string" + }, + "category4": { + "type": "string" + }, + "category5": { + "type": "string" + }, + "category6": { + "type": "string" + }, + "danger": { + "type": "string" + }, + "info": { + "type": "string" + }, + "onPrimary": { + "type": "string" + }, + "onPrimaryContainer": { + "type": "string" + }, + "onSurface": { + "type": "string" + }, + "onSurfaceVariant": { + "type": "string" + }, + "outline": { + "type": "string" + }, + "outlineVariant": { + "type": "string" + }, + "primary": { + "type": "string" + }, + "primaryContainer": { + "type": "string" + }, + "secondaryContainer": { + "type": "string" + }, + "success": { + "type": "string" + }, + "surface": { + "type": "string" + }, + "surfaceContainer": { + "type": "string" + }, + "surfaceContainerHigh": { + "type": "string" + }, + "warning": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fontFamily": { + "type": "string" + }, + "fontMono": { + "type": "string" + }, + "fontSize": { + "type": "number", + "format": "double" + }, + "radius": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "scheme", + "colors", + "fontFamily", + "fontMono", + "fontSize", + "radius" + ] + }, + "PanelScheme": { + "type": "string", + "enum": [ + "light", + "dark" + ] + }, + "PanelHostMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "init" + }, + "theme": { + "$ref": "#/$defs/PanelTheme" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "node": { "type": "string" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "level", - "message" + "theme", + "context", + "plugin", + "node" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "theme" + }, + "theme": { + "$ref": "#/$defs/PanelTheme" + } + }, + "additionalProperties": false, + "required": [ + "type", + "theme" ] + } + ] + }, + "PanelMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ready" + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", - "const": "approval-request" + "const": "resize" }, - "ts": { + "height": { "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] + "format": "uint32", + "minimum": 0 } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "name", - "input" + "height" ] }, { @@ -11493,393 +16613,636 @@ "properties": { "type": { "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" + "const": "action" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "action": { + "$ref": "#/$defs/ViewAction" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "decision" + "action" ] } ] }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" + "PluginList": { + "type": "object", + "properties": { + "node": { + "type": "string" + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginRecord" + } + } + }, + "additionalProperties": false, + "required": [ + "node", + "plugins" ] }, - "TaskWire": { + "PluginRecord": { "type": "object", "properties": { "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { "type": "string" }, - "goal": { + "path": { "type": "string" }, - "contextRefs": { + "manifest": { + "$ref": "#/$defs/PluginManifest" + }, + "enabled": { + "type": "boolean" + }, + "state": { + "$ref": "#/$defs/PluginState" + }, + "granted": { "type": "array", "items": { - "$ref": "#/$defs/ContextRef" + "$ref": "#/$defs/Permission" } }, - "acceptanceCriteria": { + "pending": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/Permission" } }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { + "error": { "type": [ "string", "null" ] }, - "agentId": { - "type": "string" - }, - "requestedBy": { - "type": [ - "string", - "null" + "lastExit": { + "anyOf": [ + { + "$ref": "#/$defs/PluginExit" + }, + { + "type": "null" + } ] }, - "origin": { - "type": "string" + "restarts": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "parentTaskId": { + "startedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "chainDepth": { + "installedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 + "format": "int64" }, - "nodeAffinity": { + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJobStatus" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "node", + "path", + "manifest", + "enabled", + "state", + "granted", + "pending", + "restarts", + "installedAt", + "jobs" + ] + }, + "PluginState": { + "type": "string", + "enum": [ + "disabled", + "awaitingApproval", + "starting", + "running", + "backoff", + "invalid" + ] + }, + "PluginExit": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "code": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int32" }, - "claimedBy": { + "signal": { "type": [ "string", "null" ] + } + }, + "additionalProperties": false, + "required": [ + "at" + ] + }, + "PluginJobStatus": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" }, - "budget": { - "$ref": "#/$defs/TaskBudget" - }, - "usage": { + "lastRun": { "anyOf": [ { - "$ref": "#/$defs/TaskUsage" + "$ref": "#/$defs/PluginJobRun" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "id" + ] + }, + "PluginJobRun": { + "type": "object", + "properties": { + "runId": { + "type": "string" }, - "status": { - "$ref": "#/$defs/TaskStatus" - }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" }, - "maxAttempts": { + "startedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "pendingMessage": { - "type": [ - "string", - "null" - ] + "format": "int64" }, - "error": { + "finishedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "result": { + "outcome": { "anyOf": [ { - "$ref": "#/$defs/TaskResult" + "$ref": "#/$defs/PluginJobOutcome" }, { "type": "null" } ] }, - "conversationId": { + "message": { "type": [ "string", "null" ] + } + }, + "additionalProperties": false, + "required": [ + "runId", + "trigger", + "startedAt" + ] + }, + "PluginJobTrigger": { + "type": "string", + "enum": [ + "schedule", + "manual" + ] + }, + "PluginJobOutcome": { + "type": "string", + "enum": [ + "succeeded", + "failed" + ] + }, + "PluginInstallRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "path" + ] + }, + "PluginEnableRequest": { + "type": "object", + "properties": { + "approve": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + } + }, + "additionalProperties": false + }, + "PluginLogs": { + "type": "object", + "properties": { + "lines": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginLogLine" + } + } + }, + "additionalProperties": false, + "required": [ + "lines" + ] + }, + "PluginLogLine": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" }, - "sessionKey": { - "type": [ - "string", - "null" - ] + "stream": { + "$ref": "#/$defs/PluginLogStream" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "at", + "stream", + "text" + ] + }, + "PluginLogStream": { + "type": "string", + "enum": [ + "stdout", + "stderr", + "host" + ] + }, + "PluginSettings": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } }, - "harnessSessionIds": { + "secretsSet": { "type": "array", "items": { "type": "string" } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginSettingsUpdate": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginToolList": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "eval": { - "anyOf": [ - { - "$ref": "#/$defs/EvalOutcome" - }, - { - "type": "null" - } - ] + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolEntry" + } + } + }, + "additionalProperties": false, + "required": [ + "version", + "tools" + ] + }, + "PluginToolEntry": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "evalAttempt": { + "tool": { + "$ref": "#/$defs/PluginTool" + } + }, + "additionalProperties": false, + "required": [ + "plugin", + "tool" + ] + }, + "PluginEventDelivery": { + "type": "object", + "properties": { + "seq": { "type": "integer", - "format": "uint32", + "format": "uint64", "minimum": 0 }, - "createdAt": { + "at": { "type": "integer", "format": "int64" }, - "startedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "lastHeartbeatAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "completedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "durationMs": { - "type": [ - "integer", - "null" - ], + "missed": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskApprovalRequest" - } + "event": { + "$ref": "#/$defs/PluginEvent" } }, + "additionalProperties": false, "required": [ - "id", - "goal", - "contextRefs", - "acceptanceCriteria", - "spec", - "executor", - "agentId", - "origin", - "chainDepth", - "budget", - "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", - "createdAt" + "seq", + "at", + "missed", + "event" ] }, - "TaskCreateRequest": { - "type": "object", - "properties": { - "goal": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" + "PluginEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.started" }, - { - "type": "null" + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": [ + "string", + "null" + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "executorTarget": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.idle" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "requestedBy": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.ended" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "parentTaskId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.placed" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId", + "topicId", + "by" ] }, - "chainDepth": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "summary.written" + }, + "summaryId": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "summaryId", + "kind", + "level" ] }, - "spec": { - "anyOf": [ - { - "$ref": "#/$defs/TaskSpec" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "task.done" }, - { - "type": "null" + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" } + }, + "additionalProperties": false, + "required": [ + "type", + "taskId", + "status" ] }, - "budget": { - "anyOf": [ - { - "$ref": "#/$defs/TaskBudget" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "settings.changed" }, - { - "type": "null" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } } + }, + "additionalProperties": false, + "required": [ + "type", + "values" ] - }, - "contextRefs": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - } - }, - "required": [ - "goal", - "agentId" - ] - }, - "TaskResponse": { - "type": "object", - "properties": { - "task": { - "$ref": "#/$defs/TaskWire" } - }, - "required": [ - "task" ] }, - "TasksListResponse": { + "PluginJobRequest": { "type": "object", "properties": { - "tasks": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskWire" - } + "runId": { + "type": "string" + }, + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" + }, + "scheduledAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, + "additionalProperties": false, "required": [ - "tasks" + "runId", + "trigger" ] }, - "TaskSteerAccepted": { + "PluginJobResult": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "outcome": { + "$ref": "#/$defs/PluginJobOutcome" + }, + "message": { + "type": [ + "string", + "null" + ] } }, + "additionalProperties": false, "required": [ - "ok" + "outcome" ] }, - "TaskKillResponse": { + "PluginToolCall": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "arguments": { + "type": "object", + "additionalProperties": true }, - "prior": { + "sessionId": { "anyOf": [ { - "$ref": "#/$defs/TaskStatus" + "$ref": "#/$defs/SessionId" }, { "type": "null" @@ -11887,216 +17250,165 @@ ] } }, + "additionalProperties": false, "required": [ - "ok" + "arguments" ] }, - "TaskApprovalAccepted": { + "PluginToolResult": { "type": "object", "properties": { - "ok": { + "text": { + "type": "string" + }, + "isError": { "type": "boolean" } }, + "additionalProperties": false, "required": [ - "ok" + "text" ] }, - "TaskApprovalWaitResponse": { + "PluginSelf": { "type": "object", "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" + "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" + }, + "version": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "dataDir": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "approval" + "id", + "node", + "version", + "permissions", + "settings", + "dataDir" ] }, - "TaskWaitTimeoutResponse": { + "PluginViewsChanged": { "type": "object", "properties": { - "error": { - "type": "string" - }, - "task": { - "anyOf": [ - { - "$ref": "#/$defs/TaskWire" - }, - { - "type": "null" - } - ] + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } } }, + "additionalProperties": false, "required": [ - "error" + "views" ] }, - "TaskOverrides": { + "PluginNotify": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] + "title": { + "type": "string" }, - "model": { + "text": { "type": [ "string", "null" ] }, - "effort": { + "tone": { "anyOf": [ { - "$ref": "#/$defs/Effort" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { + "action": { "anyOf": [ { - "$ref": "#/$defs/TaskIsolation" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "plugin.notification": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "title": { + "type": "string" }, - "resumeMessage": { + "text": { "type": [ "string", "null" ] - } - }, - "additionalProperties": true - }, - "MemorySearchResult": { - "type": "object", - "properties": { - "chunk": { + }, + "tone": { "anyOf": [ { - "$ref": "#/$defs/MemoryChunkMatch" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "id": { - "type": "string" - }, - "source": { - "$ref": "#/$defs/MemoryHitSource" - }, - "content": { - "type": "string" - }, - "role": { + "action": { "anyOf": [ { - "$ref": "#/$defs/Role" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] }, - "agent": { - "type": [ - "string", - "null" - ] - }, - "relevanceScore": { - "type": "number", - "format": "double" - }, - "createdAt": { - "type": "string", - "format": "date-time" + "ts": { + "type": "integer", + "format": "int64" } }, "required": [ - "id", - "source", - "content", - "role", - "agent", - "relevanceScore", - "createdAt" + "plugin", + "node", + "title", + "ts" ] } } diff --git a/packages/contract/src/accepted.ts b/packages/contract/src/accepted.ts index 7053204..f2409a0 100644 --- a/packages/contract/src/accepted.ts +++ b/packages/contract/src/accepted.ts @@ -1,20 +1,11 @@ -// Generated from philbert440/rivethub-runtime@ba386c48eca72acb93d9a26bafb9abd30a48253f contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/accepted.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessId". */ export type HarnessId = - | "claude-code" - | "grok-build" - | "kimi-code" - | "hermes" - | "codex" - | "opencode" - | "pi" - | "qwen-code" - | "cursor" - | "cowork"; + "claude-code" | "grok-build" | "kimi-code" | "hermes" | "codex" | "opencode" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "KnownHarness". @@ -25,6 +16,21 @@ export type KnownHarness = string; * via the `definition` "AgentStoreBackend". */ export type AgentStoreBackend = "postgres" | "file"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ThinkingLevel". + */ +export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubSessionMode". + */ +export type HubSessionMode = "chat" | "terminal"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ProtocolVersion". + */ +export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "SessionId". @@ -35,11 +41,6 @@ export type SessionId = string; * via the `definition` "CatalogAgent". */ export type CatalogAgent = Preset | CatalogNode; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "McpInjection". - */ -export type McpInjection = "flag" | "cwdFile" | "persistentConfig" | "none"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "Activity". @@ -137,11 +138,6 @@ export type AudioMicClientFrame = | { type: "stop"; }; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ProtocolVersion". - */ -export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "FileEntryKind". @@ -179,14 +175,14 @@ export type BrowseWindow = "today" | "yesterday" | "this_morning" | "this_week" export type MemoryScope = "messages" | "summaries" | "both"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHitSource". + * via the `definition` "Role". */ -export type MemoryHitSource = "message" | "summary"; +export type Role = "system" | "user" | "assistant" | "tool"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Role". + * via the `definition` "MemoryHitSource". */ -export type Role = "system" | "user" | "assistant" | "tool"; +export type MemoryHitSource = "message" | "summary"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MemoryFallback". @@ -235,6 +231,11 @@ export type ContentPart = } | MediaFields | MediaFields1; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VectorState". + */ +export type VectorState = "embedded" | "pending" | "failed" | "skipped"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MemoryHealthStatus". @@ -265,6 +266,21 @@ export type ProjectRule = "git-remote" | "git-root" | "cwd-basename"; * via the `definition` "ProviderRecovery". */ export type ProviderRecovery = "retrying" | "permanent"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteError". + */ +export type SessionDeleteError = "session is live" | "not found" | "delete failed"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResult". + */ +export type SessionDeleteResult = SessionDeleted | SessionDeleteRefused; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashReason". + */ +export type SessionTrashReason = "empty" | "one-word-reply"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ContextSource". @@ -277,9 +293,9 @@ export type ContextSource = "spawn" | "default" | "observed"; export type SessionMessageRole = "user" | "assistant"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ThinkingLevel". + * via the `definition` "SteerOutcome". */ -export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +export type SteerOutcome = "steered" | "startedNewTurn" | "promptRequired"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "SessionClientKind". @@ -328,6 +344,11 @@ export type TranscriptToolStatus = "running" | "done" | "error"; * via the `definition` "TranscriptBlock". */ export type TranscriptBlock = "thinking" | "text" | "tool_use" | "tool_result"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPreviewKind". + */ +export type SessionPreviewKind = "running" | "asking" | "approval" | "said"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "Millis". @@ -343,6 +364,32 @@ export type HarnessSessionStatus = "active" | "idle" | "ended" | "error"; * via the `definition` "Transport". */ export type Transport = "protocol"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StartupKind". + */ +export type StartupKind = "topic" | "recent" | "relevant"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StartupSource". + */ +export type StartupSource = + | { + session: SessionId; + } + | { + wiki: WikiSlug; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "WikiSlug". + */ +export type WikiSlug = string; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeliveredVia". + */ +export type DeliveredVia = "metaAppend" | "cliFlag" | "none"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessSocketRefusalCode". @@ -443,23 +490,107 @@ export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter"; export type ErrorKind = "invalid_request_error" | "server_error"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSlug". + * via the `definition` "WikiSourceKind". */ -export type WikiSlug = string; +export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki" | "user"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceKind". + * via the `definition` "ProposalState". */ -export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki"; +export type ProposalState = "pending" | "approved" | "rejected"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentEvent". + * via the `definition` "Proposer". */ -export type AgentEvent = { - v: ProtocolVersion; - session: string; -} & AgentEvent1; -export type AgentEvent1 = +export type Proposer = "categorizer" | "backfill"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TidyChange". + */ +export type TidyChange = + | { + kind: "merge"; + source: string; + into: string; + } + | { + kind: "move"; + topic: string; + parent?: string | null; + } + | { + kind: "rename"; + topic: string; + name: string; + } + | { + kind: "close"; + topic: string; + } + | { + kind: "delete"; + topic: string; + } + | { + kind: "createTopic"; + topic: string; + name: string; + parent?: string | null; + aliases?: string[]; + sessions?: SessionId[]; + conversations?: string[]; + } + | { + kind: "fileInto"; + topic: string; + sessions?: SessionId[]; + conversations?: string[]; + } + | { + kind: "mergePage"; + page: string; + into: string; + } + | { + kind: "removePage"; + page: string; + } + | { + kind: "addType"; + topic: string; + name: string; + parent?: string | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicDirectory". + */ +export type TopicDirectory = + | { + kind: "local"; + node: string; + path: string; + } + | { + kind: "shared"; + path: string; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicKind". + */ +export type TopicKind = "work" | "type" | "entity"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PlacedBy". + */ +export type PlacedBy = "you" | "categorizer"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DecisionStatus". + */ +export type DecisionStatus = "active" | "superseded"; +export type AgentEvent = | { type: "session.start"; title?: string | null; @@ -584,9 +715,9 @@ export type AgentEventKind = }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionBroadcast". + * via the `definition` "ContextUsageSource". */ -export type SessionBroadcast = Snapshot | SessionRemoved | AgentEvent; +export type ContextUsageSource = "harness" | "last-call"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HookEventName". @@ -904,17 +1035,17 @@ export type HookConfigKind = "shell" | "http" | "internal"; * via the `definition` "RosterCommand". */ export type RosterCommand = - "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "pi" | "qwen" | "cursor" | "cowork"; + "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalDecision". */ -export type ApprovalDecision = "allow" | "deny" | "allowSession"; +export type ApprovalDecision = "allow" | "deny" | "allow-session"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalOutcome". */ -export type ApprovalOutcome = "allow" | "deny" | "allowSession" | "external"; +export type ApprovalOutcome = "allow" | "deny" | "allow-session" | "external"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessStatus". @@ -957,6 +1088,15 @@ export type HarnessEvent = }; turnId?: string | null; } + | { + type: "tool-update"; + sessionId: SessionId; + toolCallId: string; + input: { + [k: string]: unknown; + }; + turnId?: string | null; + } | { type: "tool-result"; sessionId: SessionId; @@ -990,11 +1130,25 @@ export type HarnessEvent = summary: HarnessSessionSummary; supersedes?: SessionId | null; } + | { + type: "plan"; + sessionId: SessionId; + entries: PlanEntry[]; + } | { type: "turn-complete"; sessionId: SessionId; turnId?: string | null; stopReason?: string | null; + usage?: LlmUsage | null; + modelMs?: number | null; + } + | { + type: "context"; + sessionId: SessionId; + used: number; + window?: number | null; + source: ContextUsageSource; } | { type: "error"; @@ -1036,6 +1190,11 @@ export type HarnessEvent = resolved?: PromptResolution | null; screen?: PromptScreen | null; }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PlanStatus". + */ +export type PlanStatus = "pending" | "in_progress" | "completed"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "PromptKind". @@ -1057,22 +1216,13 @@ export type HarnessCode = | "turn_in_flight" | "capability_unsupported" | "unknown_approval" - | "unknown_prompt"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskExecutorKind". - */ -export type TaskExecutorKind = "chat-loop" | "harness-session" | "mesh"; + | "unknown_prompt" + | "turn_failed"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskVerdict". */ export type TaskVerdict = "completed" | "failed" | "killed" | "timeout" | "budget-exceeded"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRefKind". - */ -export type ContextRefKind = "conversation" | "message" | "task" | "file" | "url" | "wiki"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "CriterionKind". @@ -1085,2763 +1235,4357 @@ export type CriterionKind = "manual" | "automated"; export type Effort = "low" | "medium" | "high"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskIsolation". + * via the `definition` "LogLevel". */ -export type TaskIsolation = "inherit" | "isolated"; +export type LogLevel = "debug" | "info" | "warn" | "error"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPromptMode". + * via the `definition` "PluginId". */ -export type TaskPromptMode = "task" | "heartbeat"; +export type PluginId = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionOutcome". + * via the `definition` "ToolName". */ -export type TaskPermissionOutcome = "allow" | "deny" | "timeout"; +export type ToolName = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ArtifactKind". + * via the `definition` "RouteName". */ -export type ArtifactKind = "file" | "url" | "commit" | "message"; +export type RouteName = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EvalVerdict". + * via the `definition` "Permission". */ -export type EvalVerdict = "verified" | "refuted" | "escalated"; +export type Permission = + | "memory.read" + | "memory.write" + | "sessions.read" + | "sessions.control" + | "topics.read" + | "topics.write" + | "tasks.read" + | "tasks.delegate" + | "agents.read" + | "notifications.send" + | "host.files.read" + | "host.files.write" + | "host.network" + | "host.exec"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskEvent". + * via the `definition` "ViewInput". */ -export type TaskEvent = - | { - type: "den"; - ts: number; - event: AgentEvent; - } - | { - type: "turn.start"; - ts: number; - turn: number; - } +export type ViewInput = | { - type: "turn.end"; - ts: number; - turn: number; - usage: TaskUsage; - harnessSessionId?: SessionId | null; + type: "text"; + multiline?: boolean; } | { - type: "session.spawned"; - ts: number; - nativeSessionId: string; - model?: string | null; + type: "secret"; } | { - type: "cost"; - ts: number; - deltaUsd: number; - totalUsd: number; + type: "number"; + min?: number | null; + max?: number | null; + step?: number | null; } | { - type: "log"; - ts: number; - level: LogLevel; - message: string; + type: "toggle"; } | { - type: "approval-request"; - ts: number; - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; + type: "select"; + options: ViewOption[]; + multiple?: boolean; } | { - type: "approval-resolved"; - ts: number; - taskId: string; - requestId: string; - decision: TaskPermissionOutcome; + type: "file"; + multiple?: boolean; + accept?: string[]; }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "LogLevel". + * via the `definition` "ViewValue". */ -export type LogLevel = "debug" | "info" | "warn" | "error"; - -export interface RivetHubContractAcceptedByTheRuntime { - [k: string]: unknown; -} +export type ViewValue = boolean | number | string | string[] | ViewFile[]; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPreset". + * via the `definition` "PluginToolHint". */ -export interface AgentPreset { - id: string; - name: string; - color: string; - harnessId?: HarnessId | null; - model: string; - effort: string; - systemPrompt: string; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; - createdAt: number; - updatedAt: number; - [k: string]: unknown; -} +export type PluginToolHint = "readOnly" | "destructive" | "idempotent" | "openWorld"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentsFile". + * via the `definition` "ViewAction". */ -export interface AgentsFile { - agents: AgentPreset[]; -} +export type ViewAction = + | { + type: "call"; + action: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "navigate"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + replace?: boolean; + } + | { + type: "dialog"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "back"; + } + | { + type: "refresh"; + } + | { + type: "toast"; + text: string; + tone?: ViewTone | null; + } + | { + type: "copy"; + text: string; + } + | { + type: "openSession"; + sessionId: SessionId; + } + | { + type: "openTopic"; + topicId: string; + } + | { + type: "openUrl"; + url: string; + } + | { + type: "download"; + path: string; + filename?: string | null; + }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetCreateRequest". + * via the `definition` "ViewTone". */ -export interface AgentPresetCreateRequest { - name?: string; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type ViewTone = "neutral" | "info" | "success" | "warning" | "danger"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetUpdate". + * via the `definition` "PluginEventKind". */ -export interface AgentPresetUpdate { - name?: string | null; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type PluginEventKind = + "session.started" | "session.idle" | "session.ended" | "session.placed" | "summary.written" | "task.done"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentListResponse". + * via the `definition` "ViewButtonStyle". */ -export interface AgentListResponse { - agents: AgentPreset[]; - node: string; +export type ViewButtonStyle = "primary" | "secondary" | "danger"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewBlock". + */ +export type ViewBlock = + | { + type: "section"; + title?: string | null; + subtitle?: string | null; + actions?: ViewButton[]; + blocks: ViewBlock[]; + collapsed?: boolean | null; + } + | { + type: "split"; + primary: ViewBlock[]; + secondary: ViewBlock[]; + ratio?: number | null; + } + | { + type: "tabs"; + tabs: ViewTab[]; + selected?: RouteName | null; + } + | { + type: "text"; + text: string; + tone?: ViewTone | null; + monospace?: boolean; + } + | { + type: "markdown"; + text: string; + } + | { + type: "code"; + text: string; + language?: string | null; + follow?: boolean; + } + | { + type: "image"; + path: string; + alt: string; + } + | { + type: "properties"; + items: ViewProperty[]; + } + | { + type: "progress"; + value?: number | null; + label?: string | null; + } + | { + type: "notice"; + tone: ViewTone; + title?: string | null; + text: string; + actions?: ViewButton[]; + } + | { + type: "list"; + items: ViewListItem[]; + empty?: ViewEmpty | null; + } + | { + type: "table"; + columns: ViewColumn[]; + rows: ViewRow[]; + empty?: ViewEmpty | null; + } + | { + type: "breadcrumbs"; + items: ViewCrumb[]; + } + | { + type: "actions"; + buttons: ViewButton[]; + } + | { + type: "form"; + id: RouteName; + fields: ViewField[]; + buttons: ViewButton[]; + } + | { + type: "canvas"; + id: RouteName; + scene: CanvasScene; + height?: number | null; + readOnly?: boolean; + menu?: CanvasMenuItem[]; + } + | { + type: "webPanel"; + id: RouteName; + entry: string; + height?: number | null; + params?: { + [k: string]: unknown; + } | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewInline". + */ +export type ViewInline = + | { + type: "text"; + text: string; + tone?: ViewTone | null; + icon?: string | null; + monospace?: boolean; + } + | { + type: "badge"; + text: string; + tone: ViewTone; + } + | { + type: "time"; + at: number; + style?: ViewTimeStyle | null; + } + | { + type: "duration"; + ms: number; + } + | { + type: "bytes"; + value: number; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewTimeStyle". + */ +export type ViewTimeStyle = "relative" | "absolute"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewAlign". + */ +export type ViewAlign = "start" | "center" | "end"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasItem". + */ +export type CanvasItem = + | { + type: "node"; + id: string; + x: number; + y: number; + width: number; + height: number; + shapes: CanvasShape[]; + anchors?: CanvasAnchor[]; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + locked?: boolean; + decorative?: boolean; + } + | { + type: "connector"; + id: string; + from: CanvasEnd; + to: CanvasEnd; + route: CanvasRoute; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + arrow: CanvasArrow; + label?: string | null; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + decorative?: boolean; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasShape". + */ +export type CanvasShape = + | { + type: "rect"; + x: number; + y: number; + width: number; + height: number; + radius?: number | null; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "ellipse"; + x: number; + y: number; + width: number; + height: number; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "text"; + x: number; + y: number; + text: string; + size?: number | null; + weight?: CanvasWeight | null; + color?: ColorRole | null; + align?: ViewAlign | null; + maxWidth?: number | null; + monospace?: boolean; + } + | { + type: "path"; + d: string; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + } + | { + type: "icon"; + x: number; + y: number; + name: string; + size?: number | null; + color?: ColorRole | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ColorRole". + */ +export type ColorRole = + | "surface" + | "surfaceContainer" + | "surfaceContainerHigh" + | "primary" + | "primaryContainer" + | "onPrimary" + | "onPrimaryContainer" + | "secondaryContainer" + | "onSurface" + | "onSurfaceVariant" + | "outline" + | "outlineVariant" + | "info" + | "success" + | "warning" + | "danger" + | "category1" + | "category2" + | "category3" + | "category4" + | "category5" + | "category6"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasWeight". + */ +export type CanvasWeight = "regular" | "medium" | "bold"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasSide". + */ +export type CanvasSide = "top" | "right" | "bottom" | "left"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasDirection". + */ +export type CanvasDirection = "in" | "out" | "both"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasRoute". + */ +export type CanvasRoute = "straight" | "curved" | "orthogonal"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasArrow". + */ +export type CanvasArrow = "none" | "end" | "start" | "both"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasEvent". + */ +export type CanvasEvent = + | { + type: "selected"; + items: string[]; + } + | { + type: "moved"; + items: CanvasPosition[]; + } + | { + type: "connected"; + from: CanvasEnd; + to: CanvasEnd; + } + | { + type: "deleted"; + items: string[]; + } + | { + type: "activated"; + item: string; + } + | { + type: "menu"; + item?: string | null; + choice: string; + x: number; + y: number; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasOp". + */ +export type CanvasOp = + | { + type: "upsert"; + item: CanvasItem; + } + | { + type: "remove"; + ids: string[]; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelScheme". + */ +export type PanelScheme = "light" | "dark"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelHostMessage". + */ +export type PanelHostMessage = + | { + type: "init"; + theme: PanelTheme; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext1; + plugin: PluginId; + node: string; + } + | { + type: "theme"; + theme: PanelTheme; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelMessage". + */ +export type PanelMessage = + | { + type: "ready"; + } + | { + type: "resize"; + height: number; + } + | { + type: "action"; + action: ViewAction; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginState". + */ +export type PluginState = "disabled" | "awaitingApproval" | "starting" | "running" | "backoff" | "invalid"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobTrigger". + */ +export type PluginJobTrigger = "schedule" | "manual"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobOutcome". + */ +export type PluginJobOutcome = "succeeded" | "failed"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginLogStream". + */ +export type PluginLogStream = "stdout" | "stderr" | "host"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginEvent". + */ +export type PluginEvent = + | { + type: "session.started"; + sessionId: SessionId; + topicId?: string | null; + } + | { + type: "session.idle"; + sessionId: SessionId; + } + | { + type: "session.ended"; + sessionId: SessionId; + } + | { + type: "session.placed"; + sessionId: SessionId; + topicId: string; + by: PlacedBy; + } + | { + type: "summary.written"; + summaryId: string; + sessionId?: SessionId | null; + kind: SummaryKind; + level: number; + } + | { + type: "task.done"; + taskId: string; + status: TaskStatus; + } + | { + type: "settings.changed"; + values: { + [k: string]: ViewValue; + }; + }; + +export interface RivetHubContractAcceptedByTheRuntime { + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPreset". + */ +export interface AgentPreset { + id: string; + name: string; + color: string; + harnessId?: HarnessId | null; + model: string; + effort: string; + systemPrompt: string; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; + createdAt: number; + updatedAt: number; + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentsFile". + */ +export interface AgentsFile { + agents: AgentPreset[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetCreateRequest". + */ +export interface AgentPresetCreateRequest { + name?: string; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetUpdate". + */ +export interface AgentPresetUpdate { + name?: string | null; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentListResponse". + */ +export interface AgentListResponse { + agents: AgentPreset[]; + node: string; directoryRoot?: string | null; sharedDir?: string | null; backend?: AgentStoreBackend | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentResponse". + * via the `definition` "AgentResponse". + */ +export interface AgentResponse { + agent: AgentPreset; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubProjectDefaults". + */ +export interface HubProjectDefaults { + agentId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + harnessId?: HarnessId | null; + node?: string | null; + directory?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubProject". + */ +export interface HubProject { + id: string; + name: string; + order?: number; + createdAt?: number; + defaults?: HubProjectDefaults | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubLastSession". + */ +export interface HubLastSession { + key: string; + at: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubState". + */ +export interface HubState { + projects?: HubProject[]; + defaultProjectId?: string | null; + membership?: { + [k: string]: string; + }; + names?: { + [k: string]: string; + }; + archived?: string[]; + pinned?: string[]; + hidden?: string[]; + modes?: { + [k: string]: HubSessionMode; + }; + lastSession?: HubLastSession | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubStateResponse". + */ +export interface HubStateResponse { + version: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubStatePutRequest". + */ +export interface HubStatePutRequest { + baseVersion: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "hub.state". + */ +export interface HubState1 { + v: ProtocolVersion; + version: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDescriptor". + */ +export interface HarnessDescriptor { + installed?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DelegatedSessionLink". + */ +export interface DelegatedSessionLink { + taskId: string; + parentTaskId?: string | null; + spawnedSessionId: SessionId; + parentSessionId: SessionId; + agentName?: string | null; + model?: string | null; + owner?: string | null; + harnessId?: HarnessId | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurnAttachment". + */ +export interface UserTurnAttachment { + mime: string; + pathOrUri: string; + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurn". + */ +export interface UserTurn { + deliveryId?: string | null; + model?: string | null; + effort?: string | null; + text: string; + attachments?: UserTurnAttachment[] | null; + systemPrompt?: string | null; + bypassDialogGate?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SendUserTurnResult". + */ +export interface SendUserTurnResult { + dismissedDialog?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "preset". + */ +export interface Preset { + id: string; + name: string; + node: string; + local: boolean; + harnessId?: HarnessId | null; + model?: string | null; + effort?: string | null; + directory?: string | null; + implemented?: boolean | null; + gap?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogNode". + */ +export interface CatalogNode { + id: string; + node: string; + local: boolean; + provider?: string | null; + model?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogAgentsResponse". + */ +export interface CatalogAgentsResponse { + agents: CatalogAgent[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverview". + */ +export interface MeshOverview { + updatedAt: number; + nodes: MeshOverviewNode[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverviewNode". + */ +export interface MeshOverviewNode { + id: string; + name: string; + denUrl: string; + online: boolean; + sessions?: number | null; + latest?: MeshLatest | null; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshLatest". + */ +export interface MeshLatest { + activity: Activity; + title: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "NodeCapabilities". + */ +export interface NodeCapabilities { + subsystems: Subsystems; + harnesses: HarnessCapability[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "Subsystems". + */ +export interface Subsystems { + den: boolean; + devices: boolean; + mesh: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessCapability". + */ +export interface HarnessCapability { + harnessId: HarnessId; + list: boolean; + read: boolean; + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessInspectCapability". + */ +export interface HarnessInspectCapability { + list: boolean; + read: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDriveCapability". + */ +export interface HarnessDriveCapability { + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshDevice". + */ +export interface MeshDevice { + id: string; + name: string; + publicKey: string; + address: string; + createdAt: number; + enrolledAt?: number | null; + lastHandshake?: number | null; + pgRole?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceListResponse". + */ +export interface DeviceListResponse { + devices: MeshDevice[]; + pending: PendingEnrollment[]; + relayConfigured: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PendingEnrollment". + */ +export interface PendingEnrollment { + id: string; + name: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StoredPending". + */ +export interface StoredPending { + id: string; + name: string; + token: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceRosterFile". + */ +export interface DeviceRosterFile { + v: number; + devices: MeshDevice[]; + pending: StoredPending[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateRequest". + */ +export interface DeviceCreateRequest { + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "rivet-mesh-enroll". + */ +export interface RivetMeshEnroll { + v: number; + gateway: string; + token: string; + config: DeviceEnrollConfig; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollConfig". + */ +export interface DeviceEnrollConfig { + sharedHost: string; + sharedExport: string; + pgUrl: string; + embedUrl: string; + wgEndpoint: string; + wgPeerPublicKey: string; + wgAddress: string; + wgAllowedIps: string; + homeSubnet: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateResponse". + */ +export interface DeviceCreateResponse { + pending: PendingEnrollment; + qr: RivetMeshEnroll; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EnrolledDevice". + */ +export interface EnrolledDevice { + id: string; + name: string; + address: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SignedCertificate". + */ +export interface SignedCertificate { + leaf: string; + chain: string[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollResponse". + */ +export interface DeviceEnrollResponse { + ok: boolean; + device: EnrolledDevice; + config: DeviceEnrollConfig; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemResponse". + */ +export interface PairRedeemResponse { + deviceId: string; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairingRecord". + */ +export interface PairingRecord { + v: number; + deviceId: string; + name: string; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollRequest". + */ +export interface DeviceEnrollRequest { + token?: string | null; + publicKey?: string | null; + name?: string | null; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingCode". + */ +export interface PhonePairingCode { + deviceId: string; + gateway: string; + expiresAt: number; + qrText: string; + reshown: number; + addedToUsers: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingStatus". + */ +export interface PhonePairingStatus { + state: PhonePairingState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingAvailability". + */ +export interface PhonePairingAvailability { + available: boolean; + reason?: string | null; + gateway?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingRequest". + */ +export interface PhonePairingRequest { + name: string; + host?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AudioStatus". + */ +export interface AudioStatus { + enabled: boolean; + backend: AudioBackend; + device: string; + sampleRate: number; + channels: number; + format: AudioFormat; + fifoPath: string; + armed: boolean; + publisherId?: string | null; + armedAt?: number | null; + bytesWritten: number; + runtimeReady: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AudioHealth". + */ +export interface AudioHealth { + ok: boolean; + runtimeReady: boolean; + fifoPath: string; + message?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceSpeakRequest". + */ +export interface VoiceSpeakRequest { + input: string; + instructions?: string | null; + voice?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceTranscribeResponse". + */ +export interface VoiceTranscribeResponse { + text: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceFileEntry". + */ +export interface DeviceFileEntry { + name: string; + type: FileEntryKind; + size: number; + mtime: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FilesListResponse". + */ +export interface FilesListResponse { + path: string; + root: string; + entries: DeviceFileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StagedUploadResponse". + */ +export interface StagedUploadResponse { + uri: string; + name: string; + mime: string; + size: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileEntry". + */ +export interface FileEntry { + name: string; + type: FileKind; + size: number; + mtime: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileList". + */ +export interface FileList { + path: string; + root: string; + entries: FileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileChanged". + */ +export interface FileChanged { + ok: boolean; + path: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchToolArgs". + */ +export interface MemorySearchToolArgs { + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + expand?: boolean | null; + synthesize?: boolean | null; + query: string; + mode?: SearchMode | null; + scope?: MemoryScope | null; + limit?: number | null; + agent?: string | null; + role?: Role | null; + tool_name?: string | null; + tag?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchHit". + */ +export interface MemorySearchHit { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + createdAt: string; + score: number; + role?: Role | null; + agent?: string | null; + kind?: SummaryKind | null; + toolName?: string | null; + conversationId?: string | null; + sessionId?: string | null; + fallback?: MemoryFallback | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryChunkMatch". + */ +export interface MemoryChunkMatch { + index: number; + total: number; + charStart: number; + charEnd: number; + content: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagWire". + */ +export interface TagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryDegraded". + */ +export interface MemoryDegraded { + reason: string; + effect: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchResponse". + */ +export interface MemorySearchResponse { + query: string; + scope: MemoryScope; + degraded?: MemoryDegraded | null; + fallback?: MemoryFallback | null; + results: MemorySearchHit[]; + expanded?: MemoryEntry[]; + synthesis?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryEntry". + */ +export interface MemoryEntry { + id?: string | null; + sessionId: string; + agent: string; + channel: string; + role: Role; + content: string; + toolName?: string | null; + toolArgs?: { + [k: string]: unknown; + } | null; + toolResult?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseToolArgs". + */ +export interface MemoryBrowseToolArgs { + conversation_id?: string | null; + include_tools?: boolean | null; + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + agent?: string | null; + tag?: string | null; + limit?: number | null; + order?: MemoryBrowseOrder | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryAppendToolArgs". + */ +export interface MemoryAppendToolArgs { + session_id: string; + content: string; + role: Role; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + event_id?: string | null; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestMessage". + */ +export interface MemoryIngestMessage { + role: Role; + content: string; + created_at?: string | null; + tool_calls?: MemoryIngestToolCall[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestToolCall". + */ +export interface MemoryIngestToolCall { + id?: string | null; + name: string; + input?: { + [k: string]: unknown; + } | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestSessionToolArgs". + */ +export interface MemoryIngestSessionToolArgs { + session_id: string; + messages: MemoryIngestMessage[]; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryGetFullToolArgs". + */ +export interface MemoryGetFullToolArgs { + id?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsToolArgs". + */ +export interface MemoryTagsToolArgs { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + key?: string | null; + value?: string | null; + tag?: string | null; + display?: string | null; + state?: TagState | null; + ids?: string[] | null; + session_keys?: string[] | null; + entries?: TagEntryPair[] | null; + parent_value?: string | null; + aliases?: string[] | null; + from?: string | null; + into?: string | null; + reason?: string | null; + decided_by?: string | null; + limit?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagEntryPair". + */ +export interface TagEntryPair { + key: string; + value: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryToolResponse". + */ +export interface MemoryToolResponse { + ok: boolean; + result: ToolResult; +} +export interface MediaFields { + type: "image"; +} +export interface MediaFields1 { + type: "video"; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MediaFields". + */ +export interface MediaFields2 { + data?: string | null; + url?: string | null; + mimeType?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseMessage". + */ +export interface MemoryBrowseMessage { + id: string; + role: Role; + agent?: string | null; + content: string; + createdAt: string; + conversationId?: string | null; + sessionId?: string | null; + toolName?: string | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseResponse". + */ +export interface MemoryBrowseResponse { + messages: MemoryBrowseMessage[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryNode". + */ +export interface MemorySummaryNode { + id: string; + parentId?: string | null; + level: number; + kind: SummaryKind; + content: string; + messageCount: number; + earliestAt?: string | null; + latestAt?: string | null; + createdAt: string; + sourceMessageIds: string[]; + vector: VectorState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryMessageTally". + */ +export interface MemoryMessageTally { + total: number; + user: number; + assistant: number; + system: number; + tool: number; + embedded: number; + pending: number; + failed: number; + skipped: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryDagResponse". + */ +export interface MemorySummaryDagResponse { + sessionId: string; + summaries: MemorySummaryNode[]; + messages: MemoryMessageTally; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopTool". + */ +export interface TopTool { + tool: string; + count: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "RecentSession". + */ +export interface RecentSession { + sessionId: string; + title?: string | null; + agent: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryStatsResponse". + */ +export interface MemoryStatsResponse { + conversations: number; + messages: number; + toolCalls: number; + summaries: number; + embedQueueDepth: number; + embeddedMessages: number; + failedEmbeddings: number; + topTools: TopTool[]; + recentSessions: RecentSession[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EmbedHealth". + */ +export interface EmbedHealth { + status: EmbedStatus; + error?: string | null; + impact?: string | null; + checkedAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryHealthResponse". + */ +export interface MemoryHealthResponse { + observedAt?: string | null; + queueStatus?: QueueStatus | null; + queues?: QueueHealth | null; + compaction?: SummarizerHealth | null; + failedEmbeddings?: number | null; + skippedEmbeddings?: number | null; + capture?: CaptureHealth | null; + status: MemoryHealthStatus; + embeddings: EmbedHealth; + embedQueueDepth: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "QueueHealth". + */ +export interface QueueHealth { + task: string; + pending: number; + running: number; + scheduled: number; + dead: number; + oldestPendingMinutes?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SummarizerHealth". + */ +export interface SummarizerHealth { + eligible: boolean; + activeTail: boolean; + belowFloor: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CaptureHealth". + */ +export interface CaptureHealth { + status: CaptureStatus; + impact: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagWire". + */ +export interface PendingTagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; + action?: PendingTagAction | null; + sessionKey?: string | null; + title?: string | null; + agent?: string | null; + conversationId?: string | null; + excerpt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsDecideRequest". + */ +export interface MemoryTagsDecideRequest { + ids?: string[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsAddRequest". + */ +export interface MemoryTagsAddRequest { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + tag?: string | null; + key?: string | null; + value?: string | null; + display?: string | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsLookupRequest". + */ +export interface MemoryTagsLookupRequest { + session_keys?: string[] | null; + states?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyEntry". + */ +export interface TagTaxonomyEntry { + key: string; + value: string; + display: string; + parentValue?: string | null; + aliases: string[]; + state: TagState; + source: string; + reason: string; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyWire". + */ +export interface TagTaxonomyWire { + key: string; + entries: TagTaxonomyEntry[]; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertRequest". + */ +export interface TagTaxonomyUpsertRequest { + key?: string | null; + value?: string | null; + display?: string | null; + parent_value?: string | null; + aliases?: string[] | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyDecideRequest". */ -export interface AgentResponse { - agent: AgentPreset; +export interface TagTaxonomyDecideRequest { + entries?: TagEntryPair[] | null; + state?: TagState | null; + decided_by?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDescriptor". + * via the `definition` "TagTaxonomyMerge". */ -export interface HarnessDescriptor { - installed?: boolean | null; +export interface TagTaxonomyMerge { + key: string; + from: string; + into: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DelegatedSessionLink". + * via the `definition` "TagTaxonomyMergeRequest". */ -export interface DelegatedSessionLink { - taskId: string; - parentTaskId?: string | null; - spawnedSessionId: SessionId; - parentSessionId: SessionId; - agentName?: string | null; - model?: string | null; - owner?: string | null; - harnessId?: HarnessId | null; +export interface TagTaxonomyMergeRequest { + key?: string | null; + from?: string | null; + into?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurnAttachment". + * via the `definition` "TagTaxonomyMergeResult". */ -export interface UserTurnAttachment { - mime: string; - pathOrUri: string; - name?: string | null; +export interface TagTaxonomyMergeResult { + moved: number; + dropped: number; + into: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurn". + * via the `definition` "TagCount". */ -export interface UserTurn { - deliveryId?: string | null; - model?: string | null; - effort?: string | null; - text: string; - attachments?: UserTurnAttachment[] | null; - systemPrompt?: string | null; - bypassDialogGate?: boolean | null; +export interface TagCount { + key: string; + value: string; + display: string; + conversations: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SendUserTurnResult". + * via the `definition` "TagListResult". */ -export interface SendUserTurnResult { - dismissedDialog?: boolean | null; +export interface TagListResult { + tags: TagWire[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "preset". + * via the `definition` "PendingTagListResult". */ -export interface Preset { - id: string; - name: string; - node: string; - local: boolean; - harnessId?: HarnessId | null; - model?: string | null; - directory?: string | null; - implemented?: boolean | null; - gap?: string | null; +export interface PendingTagListResult { + tags: PendingTagWire[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogNode". + * via the `definition` "TagCountsResult". */ -export interface CatalogNode { - id: string; - node: string; - local: boolean; - provider?: string | null; - model?: string | null; +export interface TagCountsResult { + counts: TagCount[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". + * via the `definition` "TagTaxonomyListResult". */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; +export interface TagTaxonomyListResult { + entries: TagTaxonomyEntry[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". + * via the `definition` "TagDecisionResult". */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; +export interface TagDecisionResult { + changed: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagAddResult". + */ +export interface TagAddResult { + tag: TagWire; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". + * via the `definition` "TagLookupResult". */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; +export interface TagLookupResult { + sessions: { + [k: string]: TagWire[]; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". + * via the `definition` "TagTaxonomyUpsertResult". */ -export interface CatalogSkillEntry { - name: string; - description: string; +export interface TagTaxonomyUpsertResult { + entry: TagTaxonomyEntry; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ProjectRuleResult". + */ +export interface ProjectRuleResult { + key: string; + rule: ProjectRule; + gitRoot?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". + * via the `definition` "HealthzResponse". */ -export interface CatalogSheet { +export interface HealthzResponse { + ok: boolean; + sessions: number; + name: string; node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; + degraded?: string | null; + degradedProviders?: DegradedProvider[]; + version?: string | null; + revision?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogAgentsResponse". + * via the `definition` "DegradedProvider". */ -export interface CatalogAgentsResponse { - agents: CatalogAgent[]; +export interface DegradedProvider { + id: string; + recovery: ProviderRecovery; + reason: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". + * via the `definition` "GatewayError". */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; +export interface GatewayError { + error: string; + detail?: string | null; + hint?: string | null; + code?: string | null; + harnessId?: HarnessId | null; + node?: string | null; + retryable?: boolean | null; + reason?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". + * via the `definition` "OkReply". */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; +export interface OkReply { + ok: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EventsIngested". + */ +export interface EventsIngested { + ok: boolean; + ingested: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemRequest". + */ +export interface PairRedeemRequest { + token: string; + csr?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". + * via the `definition` "RosterFile". */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; +export interface RosterFile { + default: string; + cwd?: string | null; + env?: { + [k: string]: string; }; - byExecutor: { - [k: string]: OutcomeBucket; + commands: { + [k: string]: RosterEntry; }; - byDay: { - [k: string]: OutcomeBucket; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "RosterEntry". + */ +export interface RosterEntry { + label: string; + cmd: string[]; + room?: boolean | null; + cwd?: string | null; + env?: { + [k: string]: string; }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverview". + * via the `definition` "SessionDeleted". */ -export interface MeshOverview { - updatedAt: number; - nodes: MeshOverviewNode[]; +export interface SessionDeleted { + ok: boolean; + session: SessionId; + conversations: number; + messages: number; + summaries: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverviewNode". + * via the `definition` "SessionDeleteRequest". */ -export interface MeshOverviewNode { +export interface SessionDeleteRequest { + sessions: SessionId[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteRefused". + */ +export interface SessionDeleteRefused { + session: SessionId; + ok: boolean; + error: SessionDeleteError; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResults". + */ +export interface SessionDeleteResults { + results: SessionDeleteResult[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashCandidate". + */ +export interface SessionTrashCandidate { + session: SessionId; + harness: HarnessId; + title?: string | null; + updatedAt: string; + reason: SessionTrashReason; + userTurns: number; + reply?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashList". + */ +export interface SessionTrashList { + candidates: SessionTrashCandidate[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptTurn". + */ +export interface TranscriptTurn { + role: Role; + text: string; + ts?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptResponse". + */ +export interface TranscriptResponse { id: string; - name: string; - denUrl: string; - online: boolean; - sessions?: number | null; - latest?: MeshLatest | null; + command: string; + turns: TranscriptTurn[]; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshLatest". + * via the `definition` "SessionSummary". */ -export interface MeshLatest { - activity: Activity; - title: string; +export interface SessionSummary { + id: string; + lastActive: number; + messages: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "NodeCapabilities". + * via the `definition` "SessionList". */ -export interface NodeCapabilities { - subsystems: Subsystems; - harnesses: HarnessCapability[]; +export interface SessionList { + sessions: SessionSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Subsystems". + * via the `definition` "MessageList". */ -export interface Subsystems { - den: boolean; - devices: boolean; - mesh: boolean; +export interface MessageList { + messages: SessionMessage[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapability". + * via the `definition` "SessionMessage". */ -export interface HarnessCapability { - harnessId: HarnessId; - list: boolean; - read: boolean; - drive: boolean; - resume: boolean; +export interface SessionMessage { + id: string; + sessionId: string; + role: SessionMessageRole; + text: string; + ts: number; + usage?: MessageUsage | null; + model?: string | null; + durationMs?: number | null; + thinking?: boolean | null; + tools?: string[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessInspectCapability". + * via the `definition` "MessageUsage". */ -export interface HarnessInspectCapability { - list: boolean; - read: boolean; +export interface MessageUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDriveCapability". + * via the `definition` "SessionPostRequest". */ -export interface HarnessDriveCapability { - drive: boolean; - resume: boolean; +export interface SessionPostRequest { + excludeTools?: string[] | null; + text: string; + userId?: string | null; + agent?: string | null; + thinking?: ThinkingLevel | null; + systemPrompt?: string | null; + attachments?: UserTurnAttachment[] | null; + harness?: HarnessId | null; + model?: string | null; + workingDir?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshDevice". + * via the `definition` "SessionPostAccepted". */ -export interface MeshDevice { - id: string; - name: string; - publicKey: string; - address: string; - createdAt: number; - enrolledAt?: number | null; - lastHandshake?: number | null; - pgRole?: string | null; +export interface SessionPostAccepted { + accepted: boolean; + session: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceListResponse". + * via the `definition` "SessionPostReply". */ -export interface DeviceListResponse { - devices: MeshDevice[]; - pending: PendingEnrollment[]; - relayConfigured: boolean; +export interface SessionPostReply { + message: SessionMessage; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingEnrollment". + * via the `definition` "SessionSteerRequest". */ -export interface PendingEnrollment { - id: string; - name: string; - address: string; - createdAt: number; - expiresAt: number; +export interface SessionSteerRequest { + text: string; + attachments?: UserTurnAttachment[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StoredPending". + * via the `definition` "SessionSteerResponse". */ -export interface StoredPending { - id: string; - name: string; - token: string; - address: string; - createdAt: number; - expiresAt: number; +export interface SessionSteerResponse { + outcome: SteerOutcome; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceRosterFile". + * via the `definition` "SessionWsClientMessage". */ -export interface DeviceRosterFile { - v: number; - devices: MeshDevice[]; - pending: StoredPending[]; +export interface SessionWsClientMessage { + type: SessionClientKind; + session: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateRequest". + * via the `definition` "StreamEvent". */ -export interface DeviceCreateRequest { - name?: string | null; +export interface StreamEvent { + type: StreamEventKind; + content: string; + metadata?: { + [k: string]: unknown; + } | null; +} +export interface TranscriptWsFrame { + kind: "transcript"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "rivet-mesh-enroll". + * via the `definition` "HarnessTranscriptTurn". */ -export interface RivetMeshEnroll { - v: number; - gateway: string; - token: string; - config: DeviceEnrollConfig; +export interface HarnessTranscriptTurn { + role: SessionMessageRole; + text: string; + thinking?: string | null; + tools?: HarnessTranscriptTool[] | null; + usage?: MessageUsage | null; + model?: string | null; + stopReason?: string | null; + lastBlock?: TranscriptBlock | null; + attachments?: TranscriptAttachment[] | null; + complete?: boolean; + compact?: boolean; + startedAtMs?: number | null; + endedAtMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollConfig". + * via the `definition` "HarnessTranscriptTool". */ -export interface DeviceEnrollConfig { - sharedHost: string; - sharedExport: string; - pgUrl: string; - embedUrl: string; - wgEndpoint: string; - wgPeerPublicKey: string; - wgAddress: string; - wgAllowedIps: string; - homeSubnet: string; +export interface HarnessTranscriptTool { + name: string; + status: TranscriptToolStatus; + args?: { + [k: string]: unknown; + } | null; + id?: string | null; + input?: { + [k: string]: unknown; + } | null; + resultText?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateResponse". + * via the `definition` "TranscriptAttachment". */ -export interface DeviceCreateResponse { - pending: PendingEnrollment; - qr: RivetMeshEnroll; +export interface TranscriptAttachment { + mediaType: string; + name?: string | null; + uri?: string | null; + uploadId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EnrolledDevice". + * via the `definition` "TranscriptWsFrame". */ -export interface EnrolledDevice { - id: string; - name: string; - address: string; +export interface TranscriptWsFrame1 { + session: string; + rev: number; + from: number; + turns: HarnessTranscriptTurn[]; + total: number; + command: string; + truncatedBefore?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SignedCertificate". + * via the `definition` "HarnessSessionTranscriptResponse". */ -export interface SignedCertificate { - leaf: string; - chain: string[]; +export interface HarnessSessionTranscriptResponse { + sessionId: SessionId; + harnessId: HarnessId; + turns: HarnessTranscriptTurn[]; + contextWindow: number; + compactAt: number; + contextSource: ContextSource; + redirectedTo?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollResponse". + * via the `definition` "SessionPreview". */ -export interface DeviceEnrollResponse { - ok: boolean; - device: EnrolledDevice; - config: DeviceEnrollConfig; - certificate: SignedCertificate; +export interface SessionPreview { + sessionId: SessionId; + kind: SessionPreviewKind; + text: string; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemResponse". + * via the `definition` "SessionPreviewList". */ -export interface PairRedeemResponse { - deviceId: string; - certificate: SignedCertificate; +export interface SessionPreviewList { + previews: SessionPreview[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairingRecord". + * via the `definition` "HarnessTurnAccepted". */ -export interface PairingRecord { - v: number; - deviceId: string; - name: string; - expiresAt: number; +export interface HarnessTurnAccepted { + ok: boolean; + sessionId: SessionId; + redirectedTo?: SessionId | null; + dismissedDialog?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollRequest". + * via the `definition` "HarnessSessionResponse". */ -export interface DeviceEnrollRequest { - token?: string | null; - publicKey?: string | null; - name?: string | null; - csr?: string | null; +export interface HarnessSessionResponse { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + redirectedTo?: SessionId | null; + switches?: SessionSwitches | null; + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StartupContext". + */ +export interface StartupContext { + topicId: string; + sections: StartupSection[]; + tokens: number; + deliveredVia: DeliveredVia; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingCode". + * via the `definition` "StartupSection". */ -export interface PhonePairingCode { - deviceId: string; - gateway: string; - expiresAt: number; - qrText: string; - reshown: number; - addedToUsers: boolean; +export interface StartupSection { + kind: StartupKind; + title: string; + text: string; + sources: StartupSource[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingStatus". + * via the `definition` "SessionSwitches". */ -export interface PhonePairingStatus { - state: PhonePairingState; +export interface SessionSwitches { + model: boolean; + effort: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingAvailability". + * via the `definition` "HarnessSessionTitleRequest". */ -export interface PhonePairingAvailability { - available: boolean; - reason?: string | null; - gateway?: string | null; +export interface HarnessSessionTitleRequest { + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingRequest". + * via the `definition` "HarnessSessionForkRequest". */ -export interface PhonePairingRequest { - name: string; - host?: string | null; +export interface HarnessSessionForkRequest { + prompts: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AudioStatus". + * via the `definition` "HarnessToolOutput". */ -export interface AudioStatus { - enabled: boolean; - backend: AudioBackend; - device: string; - sampleRate: number; - channels: number; - format: AudioFormat; - fifoPath: string; - armed: boolean; - publisherId?: string | null; - armedAt?: number | null; - bytesWritten: number; - runtimeReady: boolean; +export interface HarnessToolOutput { + text: string; + isError: boolean; + truncated: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AudioHealth". + * via the `definition` "TermSpawnRequest". */ -export interface AudioHealth { - ok: boolean; - runtimeReady: boolean; - fifoPath: string; - message?: string | null; +export interface TermSpawnRequest { + command?: string | null; + model?: string | null; + effort?: string | null; + session?: string | null; + resume?: string | null; + agentId?: string | null; + force?: boolean | null; + cols?: number | null; + rows?: number | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceSpeakRequest". + * via the `definition` "TermAttachInfo". */ -export interface VoiceSpeakRequest { - input: string; - instructions?: string | null; - voice?: string | null; +export interface TermAttachInfo { + socket: string; + session: string; + host: string; + sshUser: string; + local: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceTranscribeResponse". + * via the `definition` "TermSpawnResponse". */ -export interface VoiceTranscribeResponse { - text: string; +export interface TermSpawnResponse { + harnessSessionId?: SessionId | null; + id: string; + denSession: string; + command: string; + cwd?: string | null; + pid: number; + createdAt: number; + mux?: Mux | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceFileEntry". + * via the `definition` "PtyInfo". */ -export interface DeviceFileEntry { - name: string; - type: FileEntryKind; - size: number; - mtime: string; +export interface PtyInfo { + id: string; + denSession: string; + command: string; + state: PtyState; + pid?: number | null; + attached: number; + exitCode?: number | null; + createdAt: number; + lastOutputTs?: number | null; + cols?: number | null; + rows?: number | null; + mux?: Mux | null; + persisted?: boolean | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FilesListResponse". + * via the `definition` "PtyList". */ -export interface FilesListResponse { - path: string; - root: string; - entries: DeviceFileEntry[]; +export interface PtyList { + ptys: PtyInfo[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StagedUploadResponse". + * via the `definition` "TermCommand". */ -export interface StagedUploadResponse { - uri: string; - name: string; - mime: string; - size: number; - expiresAt: number; +export interface TermCommand { + id: string; + label: string; + room: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileEntry". + * via the `definition` "TermConfig". */ -export interface FileEntry { - name: string; - type: FileKind; - size: number; - mtime: number; +export interface TermConfig { + enabled: boolean; + default: string; + maxPtys: number; + active: number; + commands: TermCommand[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileList". + * via the `definition` "TermInjectRequest". */ -export interface FileList { - path: string; - root: string; - entries: FileEntry[]; +export interface TermInjectRequest { + session: string; + text: string; + submit?: boolean | null; + interrupt?: boolean | null; + bypassDialogGate?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileChanged". + * via the `definition` "TermInjectResponse". */ -export interface FileChanged { +export interface TermInjectResponse { ok: boolean; - path: string; + ptyId: string; + dismissedDialog?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchToolArgs". + * via the `definition` "DeviceOwner". */ -export interface MemorySearchToolArgs { - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - expand?: boolean | null; - synthesize?: boolean | null; - query: string; - mode?: SearchMode | null; - scope?: MemoryScope | null; - limit?: number | null; - agent?: string | null; - tag?: string | null; +export interface DeviceOwner { + device?: string | null; + self: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchHit". + * via the `definition` "UploadCreated". */ -export interface MemorySearchHit { - chunk?: MemoryChunkMatch | null; +export interface UploadCreated { id: string; - source: MemoryHitSource; - content: string; - createdAt: string; - score: number; - role?: Role | null; - agent?: string | null; - kind?: SummaryKind | null; - toolName?: string | null; - conversationId?: string | null; - sessionId?: string | null; - fallback?: MemoryFallback | null; - tags?: TagWire[] | null; + uri: string; + name: string; + bytes: number; + mediaType: string; + expiresAt: string; + session?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryChunkMatch". + * via the `definition` "UploadList". */ -export interface MemoryChunkMatch { - index: number; - total: number; - charStart: number; - charEnd: number; - content: string; +export interface UploadList { + uploads: UploadCreated[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagWire". + * via the `definition` "UsersRegistry". */ -export interface TagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface UsersRegistry { + ownerUserId: string; + unmappedIsOwner: boolean; + localStores?: boolean | null; + users: { + [k: string]: UserRecord; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryDegraded". + * via the `definition` "UserRecord". */ -export interface MemoryDegraded { - reason: string; - effect: string; +export interface UserRecord { + id?: string | null; + devices?: string[] | null; + pgUrl?: string | null; + envFile?: string | null; + persona?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResponse". + * via the `definition` "ChatRequest". */ -export interface MemorySearchResponse { - query: string; - scope: MemoryScope; - degraded?: MemoryDegraded | null; - fallback?: MemoryFallback | null; - results: MemorySearchHit[]; - expanded?: MemoryEntry[]; - synthesis?: string | null; +export interface ChatRequest { + model: string; + messages: OpenAiMessage[]; + stream?: boolean | null; + max_tokens?: number | null; + stream_options?: StreamOptions | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryEntry". + * via the `definition` "OpenAiMessage". */ -export interface MemoryEntry { - id?: string | null; - sessionId: string; - agent: string; - channel: string; +export interface OpenAiMessage { role: Role; - content: string; - toolName?: string | null; - toolArgs?: { - [k: string]: unknown; - } | null; - toolResult?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - createdAt?: string | null; + content?: string | null; + reasoning_content?: string | null; + tool_calls?: MessageToolCall[] | null; + tool_call_id?: string | null; +} +export interface StreamedPlainToolCall { + type: "function"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseToolArgs". + * via the `definition` "StreamOptions". */ -export interface MemoryBrowseToolArgs { - conversation_id?: string | null; - include_tools?: boolean | null; - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - agent?: string | null; - tag?: string | null; - limit?: number | null; - order?: MemoryBrowseOrder | null; +export interface StreamOptions { + include_usage: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryAppendToolArgs". + * via the `definition` "FunctionDelta". */ -export interface MemoryAppendToolArgs { - session_id: string; - content: string; - role: Role; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - event_id?: string | null; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface FunctionDelta { + name?: string | null; + arguments?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestMessage". + * via the `definition` "StreamedPlainToolCall". */ -export interface MemoryIngestMessage { - role: Role; - content: string; - created_at?: string | null; - tool_calls?: MemoryIngestToolCall[] | null; +export interface StreamedPlainToolCall1 { + index?: number | null; + id?: string | null; + function: FunctionDelta; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestToolCall". + * via the `definition` "chat.completion". */ -export interface MemoryIngestToolCall { - id?: string | null; - name: string; - input?: { - [k: string]: unknown; - } | null; +export interface ChatCompletion { + id: string; + created: number; + model: string; + choices: CompletionChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestSessionToolArgs". + * via the `definition` "CompletionChoice". */ -export interface MemoryIngestSessionToolArgs { - session_id: string; - messages: MemoryIngestMessage[]; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface CompletionChoice { + index: number; + message: OpenAiMessage; + finish_reason: FinishReason; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryGetFullToolArgs". + * via the `definition` "Usage". */ -export interface MemoryGetFullToolArgs { - id?: string | null; +export interface Usage { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; + prompt_tokens_details?: PromptTokensDetails | null; + completion_tokens_details?: CompletionTokensDetails | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsToolArgs". + * via the `definition` "PromptTokensDetails". */ -export interface MemoryTagsToolArgs { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - key?: string | null; - value?: string | null; - tag?: string | null; - display?: string | null; - state?: TagState | null; - ids?: string[] | null; - session_keys?: string[] | null; - entries?: TagEntryPair[] | null; - parent_value?: string | null; - aliases?: string[] | null; - from?: string | null; - into?: string | null; - reason?: string | null; - decided_by?: string | null; - limit?: number | null; +export interface PromptTokensDetails { + cached_tokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagEntryPair". + * via the `definition` "CompletionTokensDetails". */ -export interface TagEntryPair { - key: string; - value: string; +export interface CompletionTokensDetails { + reasoning_tokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryToolResponse". + * via the `definition` "chat.completion.chunk". */ -export interface MemoryToolResponse { - ok: boolean; - result: ToolResult; -} -export interface MediaFields { - type: "image"; +export interface ChatCompletionChunk { + id: string; + created: number; + model: string; + choices: ChunkChoice[]; + usage?: Usage | null; } -export interface MediaFields1 { - type: "video"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ChunkChoice". + */ +export interface ChunkChoice { + index: number; + delta: CompletionDelta; + finish_reason?: FinishReason | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MediaFields". + * via the `definition` "CompletionDelta". */ -export interface MediaFields2 { - data?: string | null; - url?: string | null; - mimeType?: string | null; +export interface CompletionDelta { + role?: Role | null; + content?: string | null; + reasoning_content?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseMessage". + * via the `definition` "list". */ -export interface MemoryBrowseMessage { - id: string; - role: Role; - agent?: string | null; - content: string; - createdAt: string; - conversationId?: string | null; - sessionId?: string | null; - toolName?: string | null; - tags?: TagWire[] | null; +export interface List { + data: Model[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseResponse". + * via the `definition` "model". */ -export interface MemoryBrowseResponse { - messages: MemoryBrowseMessage[]; +export interface Model { + id: string; + created: number; + owned_by: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TopTool". + * via the `definition` "ErrorDetail". */ -export interface TopTool { - tool: string; - count: number; +export interface ErrorDetail { + message: string; + type: ErrorKind; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RecentSession". + * via the `definition` "ErrorResponse". */ -export interface RecentSession { - sessionId: string; - title?: string | null; - agent: string; - lastActive: number; - messages: number; +export interface ErrorResponse { + error: ErrorDetail; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryStatsResponse". + * via the `definition` "Conversation". */ -export interface MemoryStatsResponse { - conversations: number; - messages: number; - toolCalls: number; - summaries: number; - embedQueueDepth: number; - embeddedMessages: number; - failedEmbeddings: number; - topTools: TopTool[]; - recentSessions: RecentSession[]; +export interface Conversation { + id: string; + title: string; + createdAt: number; + updatedAt: number; + messages: OpenAiMessage[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EmbedHealth". + * via the `definition` "Conversations". */ -export interface EmbedHealth { - status: EmbedStatus; - error?: string | null; - impact?: string | null; - checkedAt?: string | null; +export interface Conversations { + conversations: Conversation[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHealthResponse". + * via the `definition` "ConversationTitle". */ -export interface MemoryHealthResponse { - observedAt?: string | null; - queueStatus?: QueueStatus | null; - queues?: QueueHealth | null; - compaction?: SummarizerHealth | null; - failedEmbeddings?: number | null; - skippedEmbeddings?: number | null; - capture?: CaptureHealth | null; - status: MemoryHealthStatus; - embeddings: EmbedHealth; - embedQueueDepth: number; +export interface ConversationTitle { + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "QueueHealth". + * via the `definition` "WikiQuery". */ -export interface QueueHealth { - task: string; - pending: number; - running: number; - scheduled: number; - dead: number; - oldestPendingMinutes?: number | null; +export interface WikiQuery { + q?: string | null; + tag?: string | null; + limit?: number | null; + offset?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SummarizerHealth". + * via the `definition` "WikiPageQuery". */ -export interface SummarizerHealth { - eligible: boolean; - activeTail: boolean; - belowFloor: boolean; +export interface WikiPageQuery { + slug: WikiSlug; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureHealth". + * via the `definition` "WikiHistoryEntry". */ -export interface CaptureHealth { - status: CaptureStatus; - impact: string; +export interface WikiHistoryEntry { + date: string; + title: string; + body: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagWire". + * via the `definition` "WikiCitation". */ -export interface PendingTagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; - action?: PendingTagAction | null; - sessionKey?: string | null; +export interface WikiCitation { + summaryId: string; + date?: Millis | null; + kind?: string | null; + note?: string | null; + conversationId?: string | null; + sessionId?: SessionId | null; title?: string | null; - agent?: string | null; + channel?: string | null; + topicId?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "WikiSource". + */ +export interface WikiSource { + kind: WikiSourceKind; + ids: string[]; conversationId?: string | null; - excerpt?: string | null; + span?: WikiSourceSpan | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsDecideRequest". + * via the `definition` "WikiSourceSpan". */ -export interface MemoryTagsDecideRequest { - ids?: string[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface WikiSourceSpan { + earliest: Millis; + latest: Millis; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsAddRequest". + * via the `definition` "WikiPageResponse". */ -export interface MemoryTagsAddRequest { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - tag?: string | null; - key?: string | null; - value?: string | null; - display?: string | null; - reason?: string | null; - decided_by?: string | null; +export interface WikiPageResponse { + slug: string; + title: string; + aliases: string[]; + tags: string[]; + entities: string[]; + currentState: string; + article?: string | null; + seeAlso?: string[] | null; + history: WikiHistoryEntry[]; + citations: WikiCitation[]; + markdown: string; + sources: WikiSource[]; + gitSha?: string | null; + lastVerified?: Millis | null; + updatedAt: Millis; + related?: string[] | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsLookupRequest". + * via the `definition` "WikiMissSuggestion". */ -export interface MemoryTagsLookupRequest { - session_keys?: string[] | null; - states?: string[] | null; +export interface WikiMissSuggestion { + slug: string; + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyEntry". + * via the `definition` "WikiMissBody". */ -export interface TagTaxonomyEntry { - key: string; - value: string; - display: string; - parentValue?: string | null; - aliases: string[]; - state: TagState; - source: string; - reason: string; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiMissBody { + error: string; + suggestions: WikiMissSuggestion[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyWire". + * via the `definition` "WikiRedLink". */ -export interface TagTaxonomyWire { - key: string; - entries: TagTaxonomyEntry[]; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiRedLink { + entity: string; + referencedBy: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertRequest". + * via the `definition` "WikiGapsResponse". */ -export interface TagTaxonomyUpsertRequest { - key?: string | null; - value?: string | null; - display?: string | null; - parent_value?: string | null; - aliases?: string[] | null; - reason?: string | null; - decided_by?: string | null; +export interface WikiGapsResponse { + redLinks: WikiRedLink[]; + stalest: WikiTopic[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyDecideRequest". + * via the `definition` "WikiTopic". */ -export interface TagTaxonomyDecideRequest { - entries?: TagEntryPair[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface WikiTopic { + slug: string; + title: string; + tags: string[]; + entities: string[]; + updatedAt: Millis; + excerpt: string; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMerge". + * via the `definition` "WikiTopicList". */ -export interface TagTaxonomyMerge { - key: string; - from: string; - into: string; +export interface WikiTopicList { + topics: WikiTopic[]; + total: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeRequest". + * via the `definition` "TidySample". */ -export interface TagTaxonomyMergeRequest { - key?: string | null; - from?: string | null; - into?: string | null; +export interface TidySample { + id: string; + title?: string | null; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeResult". + * via the `definition` "TidyEvidence". */ -export interface TagTaxonomyMergeResult { - moved: number; - dropped: number; - into: string; +export interface TidyEvidence { + sessions: number; + samples?: TidySample[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagCount". + * via the `definition` "TidyProposal". */ -export interface TagCount { - key: string; - value: string; - display: string; - conversations: number; +export interface TidyProposal { + id: string; + batchId: string; + change: TidyChange; + reason: string; + evidence: TidyEvidence; + proposedBy: Proposer; + proposedAt: number; + state: ProposalState; + decidedAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagListResult". + * via the `definition` "TidyBatch". */ -export interface TagListResult { - tags: TagWire[]; +export interface TidyBatch { + batchId: string; + proposedBy: Proposer; + proposedAt: number; + proposals: TidyProposal[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagListResult". + * via the `definition` "TidyPending". */ -export interface PendingTagListResult { - tags: PendingTagWire[]; +export interface TidyPending { + batches: TidyBatch[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagCountsResult". + * via the `definition` "TidyFailure". */ -export interface TagCountsResult { - counts: TagCount[]; +export interface TidyFailure { + proposalId: string; + error: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyListResult". + * via the `definition` "TidyBatchDecision". */ -export interface TagTaxonomyListResult { - entries: TagTaxonomyEntry[]; +export interface TidyBatchDecision { + decided: TidyProposal[]; + failed?: TidyFailure[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagDecisionResult". + * via the `definition` "FilingUpkeep". */ -export interface TagDecisionResult { - changed: number; +export interface FilingUpkeep { + categorizer: number; + you: number; + uncategorized: number; + leftOut: number; + correctionsLastWeek: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagAddResult". + * via the `definition` "EntityTypeCount". */ -export interface TagAddResult { - tag: TagWire; +export interface EntityTypeCount { + typeId: string; + name: string; + entities: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagLookupResult". + * via the `definition` "WikiUpkeep". */ -export interface TagLookupResult { - sessions: { - [k: string]: TagWire[]; - }; +export interface WikiUpkeep { + topicPages: number; + entityTypes: EntityTypeCount[]; + loosePages: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertResult". + * via the `definition` "WorkerActivity". */ -export interface TagTaxonomyUpsertResult { - entry: TagTaxonomyEntry; +export interface WorkerActivity { + lastFinishedAt?: number | null; + failing: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ProjectRuleResult". + * via the `definition` "WorkerUpkeep". */ -export interface ProjectRuleResult { - key: string; - rule: ProjectRule; - gitRoot?: string | null; +export interface WorkerUpkeep { + embedder: WorkerActivity; + summarizer: WorkerActivity; + categorizer: WorkerActivity; + wikiBuilder: WorkerActivity; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HealthzResponse". + * via the `definition` "MemoryUpkeep". */ -export interface HealthzResponse { - ok: boolean; - sessions: number; +export interface MemoryUpkeep { + filing: FilingUpkeep; + wiki: WikiUpkeep; + workers: WorkerUpkeep; + pendingProposals: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicRecord". + */ +export interface TopicRecord { + id: string; + kind?: "work" | "type" | "entity"; + slug: string; name: string; - node: string; - degraded?: string | null; - degradedProviders?: DegradedProvider[]; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DegradedProvider". + * via the `definition` "TopicSummary". */ -export interface DegradedProvider { +export interface TopicSummary { id: string; - recovery: ProviderRecovery; - reason: string; + kind?: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; + sessionCount: number; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "GatewayError". + * via the `definition` "TopicList". */ -export interface GatewayError { - error: string; - detail?: string | null; - hint?: string | null; - code?: string | null; - harnessId?: HarnessId | null; - node?: string | null; - retryable?: boolean | null; - reason?: string | null; +export interface TopicList { + topics: TopicSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OkReply". + * via the `definition` "TopicCreateRequest". */ -export interface OkReply { - ok: boolean; +export interface TopicCreateRequest { + kind?: "work" | "type" | "entity"; + name: string; + aliases?: string[]; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EventsIngested". + * via the `definition` "WikiPageEdit". */ -export interface EventsIngested { - ok: boolean; - ingested: number; +export interface WikiPageEdit { + currentState?: string | null; + article?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemRequest". + * via the `definition` "TopicUpdate". */ -export interface PairRedeemRequest { - token: string; - csr?: string | null; +export interface TopicUpdate { + name?: string | null; + aliases?: string[] | null; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RosterFile". + * via the `definition` "TopicMergeRequest". */ -export interface RosterFile { - default: string; - cwd?: string | null; - env?: { - [k: string]: string; - }; - commands: { - [k: string]: RosterEntry; - }; +export interface TopicMergeRequest { + into: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RosterEntry". + * via the `definition` "TopicPlacement". */ -export interface RosterEntry { - label: string; - cmd: string[]; - room?: boolean | null; - cwd?: string | null; - env?: { - [k: string]: string; - }; +export interface TopicPlacement { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptTurn". + * via the `definition` "TopicSuggestion". */ -export interface TranscriptTurn { - role: Role; - text: string; - ts?: number | null; +export interface TopicSuggestion { + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptResponse". + * via the `definition` "PlacementReply". */ -export interface TranscriptResponse { - id: string; - command: string; - turns: TranscriptTurn[]; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface PlacementReply { + placement?: TopicPlacement | null; + suggestion?: TopicSuggestion | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionSummary". + * via the `definition` "PlacementRequest". */ -export interface SessionSummary { - id: string; - lastActive: number; - messages: number; +export interface PlacementRequest { + topicId: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionList". + * via the `definition` "SessionHistoryMark". */ -export interface SessionList { - sessions: SessionSummary[]; +export interface SessionHistoryMark { + sessionId: SessionId; + markedAt: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MessageList". + * via the `definition` "SessionHistoryList". */ -export interface MessageList { - messages: SessionMessage[]; +export interface SessionHistoryList { + sessions: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionMessage". + * via the `definition` "TopicSession". */ -export interface SessionMessage { - id: string; - sessionId: string; - role: SessionMessageRole; - text: string; - ts: number; - usage?: MessageUsage | null; - model?: string | null; - durationMs?: number | null; - thinking?: boolean | null; - tools?: string[] | null; +export interface TopicSession { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; + title?: string | null; + lastActive?: number | null; + node?: string | null; + parentSessionId?: SessionId | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MessageUsage". + * via the `definition` "TopicSessionList". */ -export interface MessageUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface TopicSessionList { + sessions: TopicSession[]; + conversations?: TopicConversation[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostRequest". + * via the `definition` "TopicConversation". */ -export interface SessionPostRequest { - excludeTools?: string[] | null; - text: string; - userId?: string | null; - agent?: string | null; - thinking?: ThinkingLevel | null; - systemPrompt?: string | null; +export interface TopicConversation { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; + channel: string; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostAccepted". + * via the `definition` "TopicFiling". */ -export interface SessionPostAccepted { - accepted: boolean; - session: string; +export interface TopicFiling { + sessions: TopicSession[]; + conversations: TopicConversation[]; + history: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostReply". + * via the `definition` "SessionSuggestion". */ -export interface SessionPostReply { - message: SessionMessage; +export interface SessionSuggestion { + sessionId: SessionId; + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionWsClientMessage". + * via the `definition` "SessionSuggestionList". */ -export interface SessionWsClientMessage { - type: SessionClientKind; - session: string; +export interface SessionSuggestionList { + sessions: SessionSuggestion[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamEvent". + * via the `definition` "ConversationPlacement". */ -export interface StreamEvent { - type: StreamEventKind; - content: string; - metadata?: { - [k: string]: unknown; - } | null; -} -export interface TranscriptWsFrame { - kind: "transcript"; +export interface ConversationPlacement { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTurn". + * via the `definition` "ConversationPlacementReply". */ -export interface HarnessTranscriptTurn { - role: SessionMessageRole; - text: string; - thinking?: string | null; - tools?: HarnessTranscriptTool[] | null; - usage?: MessageUsage | null; - model?: string | null; - stopReason?: string | null; - lastBlock?: TranscriptBlock | null; - complete?: boolean; - compact?: boolean; +export interface ConversationPlacementReply { + placement?: ConversationPlacement | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTool". + * via the `definition` "TopicPage". */ -export interface HarnessTranscriptTool { - name: string; - status: TranscriptToolStatus; - args?: { - [k: string]: unknown; - } | null; - id?: string | null; - input?: { - [k: string]: unknown; - } | null; - resultText?: string | null; +export interface TopicPage { + topic: TopicRecord; + page?: WikiPageResponse | null; + mentions?: TopicMention[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptWsFrame". + * via the `definition` "TopicMention". */ -export interface TranscriptWsFrame1 { - session: string; - rev: number; - from: number; - turns: HarnessTranscriptTurn[]; - total: number; - command: string; - truncatedBefore?: boolean | null; +export interface TopicMention { + topicId: string; + name: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionTranscriptResponse". + * via the `definition` "TopicDecision". */ -export interface HarnessSessionTranscriptResponse { - sessionId: SessionId; - harnessId: HarnessId; - turns: HarnessTranscriptTurn[]; - contextWindow: number; - compactAt: number; - contextSource: ContextSource; - redirectedTo?: SessionId | null; +export interface TopicDecision { + id: string; + topicId: string; + text: string; + status: DecisionStatus; + supersededBy?: string | null; + by: string; + sessionId?: SessionId | null; + createdAt: number; + updatedAt: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTurnAccepted". + * via the `definition` "TopicDecisionList". */ -export interface HarnessTurnAccepted { - ok: boolean; - sessionId: SessionId; - redirectedTo?: SessionId | null; - dismissedDialog?: boolean; +export interface TopicDecisionList { + decisions: TopicDecision[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionResponse". + * via the `definition` "DecisionCreateRequest". */ -export interface HarnessSessionResponse { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - redirectedTo?: SessionId | null; - [k: string]: unknown; +export interface DecisionCreateRequest { + text: string; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnRequest". + * via the `definition` "DecisionUpdate". */ -export interface TermSpawnRequest { - command?: string | null; - model?: string | null; - effort?: string | null; - session?: string | null; - resume?: string | null; - agentId?: string | null; - force?: boolean | null; - cols?: number | null; - rows?: number | null; +export interface DecisionUpdate { + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermAttachInfo". + * via the `definition` "DecisionSupersedeRequest". */ -export interface TermAttachInfo { - socket: string; - session: string; - host: string; - sshUser: string; - local: boolean; +export interface DecisionSupersedeRequest { + text?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnResponse". + * via the `definition` "DecisionSuperseded". */ -export interface TermSpawnResponse { - harnessSessionId?: SessionId | null; - id: string; - denSession: string; - command: string; - cwd?: string | null; - pid: number; - createdAt: number; - mux?: Mux | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; +export interface DecisionSuperseded { + superseded: TopicDecision; + replacement?: TopicDecision | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PtyInfo". + * via the `definition` "AgentUsage". */ -export interface PtyInfo { - id: string; - denSession: string; - command: string; - state: PtyState; - pid?: number | null; - attached: number; - exitCode?: number | null; - createdAt: number; - lastOutputTs?: number | null; - cols?: number | null; - rows?: number | null; - mux?: Mux | null; - persisted?: boolean | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; +export interface AgentUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; +} +export interface AgentEvent1 { + v: ProtocolVersion; + session: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PtyList". + * via the `definition` "LiveSessionSummary". */ -export interface PtyList { - ptys: PtyInfo[]; +export interface LiveSessionSummary { + id: string; + name: string; + harness?: SessionHarness | null; + lastEventTs?: number | null; + pty?: string | null; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermCommand". + * via the `definition` "SessionLogLine". */ -export interface TermCommand { - id: string; - label: string; - room: boolean; +export interface SessionLogLine { + who: string; + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermConfig". + * via the `definition` "SessionView". */ -export interface TermConfig { - enabled: boolean; - default: string; - maxPtys: number; - active: number; - commands: TermCommand[]; +export interface SessionView { + title: string; + activity: Activity; + tool?: string | null; + tasks: string[]; + thought: string; + lastMessage: string; + log: SessionLogLine[]; + term: string[]; + ended: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectRequest". + * via the `definition` "LiveSessionList". */ -export interface TermInjectRequest { - session: string; - text: string; - submit?: boolean | null; - interrupt?: boolean | null; - bypassDialogGate?: boolean | null; +export interface LiveSessionList { + sessions: LiveSessionSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectResponse". + * via the `definition` "StateResponse". */ -export interface TermInjectResponse { - ok: boolean; - ptyId: string; - dismissedDialog?: boolean | null; +export interface StateResponse { + session: string; + state: SessionView; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceOwner". + * via the `definition` "snapshot". */ -export interface DeviceOwner { - device?: string | null; - self: boolean; +export interface Snapshot { + v: ProtocolVersion; + sessions: LiveSessionSummary[]; + rooms: { + [k: string]: SessionView; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UploadCreated". + * via the `definition` "session.removed". */ -export interface UploadCreated { - id: string; - name: string; - bytes: number; - mediaType: string; - expiresAt: string; - session?: string | null; +export interface SessionRemoved { + v: ProtocolVersion; + session: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UploadList". + * via the `definition` "SessionBroadcast". */ -export interface UploadList { - uploads: UploadCreated[]; +export interface SessionBroadcast { + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UsersRegistry". + * via the `definition` "CaptureBatchRequest". */ -export interface UsersRegistry { - ownerUserId: string; - unmappedIsOwner: boolean; - localStores?: boolean | null; - users: { - [k: string]: UserRecord; - }; +export interface CaptureBatchRequest { + session_key: string; + agent: string; + channel?: string | null; + title?: string | null; + settings?: { + [k: string]: unknown; + } | null; + task_id?: string | null; + finalize?: boolean | null; + created_at?: Millis | null; + updated_at?: Millis | null; + messages: CaptureMessage[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserRecord". + * via the `definition` "CaptureMessage". */ -export interface UserRecord { - id?: string | null; - devices?: string[] | null; - pgUrl?: string | null; - envFile?: string | null; - persona?: string | null; +export interface CaptureMessage { + event_id: string; + role: Role; + content: string; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + created_at?: Millis | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ChatRequest". + * via the `definition` "CaptureResult". */ -export interface ChatRequest { - model: string; - messages: OpenAiMessage[]; - stream?: boolean | null; - max_tokens?: number | null; - stream_options?: StreamOptions | null; +export interface CaptureResult { + ok: boolean; + conversation_id: string; + inserted: number; + skipped: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OpenAiMessage". + * via the `definition` "HookContextBase". */ -export interface OpenAiMessage { - role: Role; - content?: string | null; - reasoning_content?: string | null; - tool_calls?: MessageToolCall[] | null; - tool_call_id?: string | null; -} -export interface StreamedPlainToolCall { - type: "function"; +export interface HookContextBase { + agentId?: string | null; + sessionId?: string | null; + timestamp: number; + metadata: { + [k: string]: unknown; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamOptions". + * via the `definition` "HookUsage". */ -export interface StreamOptions { - include_usage: boolean; +export interface HookUsage { + promptTokens: number; + completionTokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FunctionDelta". + * via the `definition` "SessionTokens". */ -export interface FunctionDelta { - name?: string | null; - arguments?: string | null; +export interface SessionTokens { + prompt: number; + completion: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamedPlainToolCall". + * via the `definition` "TurnComplexity". */ -export interface StreamedPlainToolCall1 { - index?: number | null; - id?: string | null; - function: FunctionDelta; +export interface TurnComplexity { + toolCallCount: number; + hadErrorRecovery: boolean; + hadUserCorrection: boolean; + uniqueTools: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion". + * via the `definition` "Message". */ -export interface ChatCompletion { - id: string; - created: number; - model: string; - choices: CompletionChoice[]; - usage?: Usage | null; +export interface Message { + role: Role; + content: MessageContent; + reasoning?: string | null; + toolCalls?: ToolCall[] | null; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionChoice". + * via the `definition` "ToolCall". */ -export interface CompletionChoice { - index: number; - message: OpenAiMessage; - finish_reason: FinishReason; +export interface ToolCall { + id: string; + name: string; + arguments: { + [k: string]: unknown; + }; + thoughtSignature?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Usage". + * via the `definition` "HookPipelineError". */ -export interface Usage { - prompt_tokens: number; - completion_tokens: number; - total_tokens: number; - prompt_tokens_details?: PromptTokensDetails | null; - completion_tokens_details?: CompletionTokensDetails | null; +export interface HookPipelineError { + hookId: string; + error: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptTokensDetails". + * via the `definition` "HookPipelineResult". */ -export interface PromptTokensDetails { - cached_tokens: number; +export interface HookPipelineResult { + context: HookContext; + aborted: boolean; + skipped: boolean; + errors: HookPipelineError[]; + ran: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionTokensDetails". + * via the `definition` "HookConfig". */ -export interface CompletionTokensDetails { - reasoning_tokens: number; +export interface HookConfig { + id: string; + event: HookEventName; + type: HookConfigKind; + target: string; + priority?: number | null; + onError?: HookErrorMode | null; + agentFilter?: string[] | null; + toolFilter?: string[] | null; + description?: string | null; + enabled?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion.chunk". + * via the `definition` "ApprovalOption". */ -export interface ChatCompletionChunk { - id: string; - created: number; - model: string; - choices: ChunkChoice[]; - usage?: Usage | null; +export interface ApprovalOption { + key: string; + label: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ChunkChoice". + * via the `definition` "HarnessSessionSummary". */ -export interface ChunkChoice { - index: number; - delta: CompletionDelta; - finish_reason?: FinishReason | null; +export interface HarnessSessionSummary { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionDelta". + * via the `definition` "PlanEntry". */ -export interface CompletionDelta { - role?: Role | null; - content?: string | null; - reasoning_content?: string | null; +export interface PlanEntry { + content: string; + status: PlanStatus; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "list". + * via the `definition` "LlmUsage". */ -export interface List { - data: Model[]; +export interface LlmUsage { + promptTokens: number; + completionTokens: number; + reasoningTokens?: number | null; + cachedTokens?: number | null; + cacheCreationTokens?: number | null; + cacheReadTokens?: number | null; +} +export interface HarnessStatusFrame { + type: "status"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "model". + * via the `definition` "PromptQuestion". */ -export interface Model { - id: string; - created: number; - owned_by: string; +export interface PromptQuestion { + question?: string | null; + header?: string | null; + multiSelect: boolean; + freeText?: boolean | null; + options: PromptOption[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorDetail". + * via the `definition` "PromptOption". */ -export interface ErrorDetail { - message: string; - type: ErrorKind; +export interface PromptOption { + label: string; + description?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorResponse". + * via the `definition` "PromptResolution". */ -export interface ErrorResponse { - error: ErrorDetail; +export interface PromptResolution { + at: number; + answerText?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Conversation". + * via the `definition` "PromptScreen". */ -export interface Conversation { - id: string; - title: string; - createdAt: number; - updatedAt: number; - messages: OpenAiMessage[]; +export interface PromptScreen { + current: number; + total: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Conversations". + * via the `definition` "StatusTool". */ -export interface Conversations { - conversations: Conversation[]; +export interface StatusTool { + name: string; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ConversationTitle". + * via the `definition` "HarnessStatusFrame". */ -export interface ConversationTitle { - title: string; +export interface HarnessStatusFrame1 { + sessionId: SessionId; + status: HarnessStatus; + since: number; + source?: StatusSource | null; + phase?: StatusPhase | null; + tool?: StatusTool | null; + promptId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiQuery". + * via the `definition` "HarnessCapabilities". */ -export interface WikiQuery { - q?: string | null; - tag?: string | null; - limit?: number | null; - offset?: number | null; +export interface HarnessCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; + turnOptions?: boolean | null; + launchModel?: boolean | null; + imageAttachments?: boolean | null; + models?: HarnessModelOption[] | null; + modelsSource?: HarnessModelsSource | null; + efforts?: EffortOption[] | null; + modelFlag?: string | null; + effortFlag?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageQuery". + * via the `definition` "HarnessModelOption". */ -export interface WikiPageQuery { - slug: WikiSlug; +export interface HarnessModelOption { + inputModalities?: string[] | null; + id: string; + label: string; + isDefault?: boolean | null; + efforts?: EffortOption[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiHistoryEntry". + * via the `definition` "EffortOption". */ -export interface WikiHistoryEntry { - date: string; - title: string; - body: string; +export interface EffortOption { + id: string; + label: string; + isDefault?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiCitation". + * via the `definition` "HarnessControlCapabilities". */ -export interface WikiCitation { - summaryId: string; - date?: Millis | null; - kind?: string | null; - note?: string | null; +export interface HarnessControlCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSource". + * via the `definition` "HarnessObservationCapabilities". */ -export interface WikiSource { - kind: WikiSourceKind; - ids: string[]; - conversationId?: string | null; - span?: WikiSourceSpan | null; +export interface HarnessObservationCapabilities { + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceSpan". + * via the `definition` "HarnessSessionCreateRequest". */ -export interface WikiSourceSpan { - earliest: Millis; - latest: Millis; +export interface HarnessSessionCreateRequest { + harness?: HarnessId | null; + model?: string | null; + cwd?: string | null; + agentId?: string | null; + topicId?: string | null; + prompt?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageResponse". + * via the `definition` "HarnessSessionList". */ -export interface WikiPageResponse { - slug: string; - title: string; - aliases: string[]; - tags: string[]; - entities: string[]; - currentState: string; - article?: string | null; - seeAlso?: string[] | null; - history: WikiHistoryEntry[]; - citations: WikiCitation[]; - markdown: string; - sources: WikiSource[]; - gitSha?: string | null; - lastVerified?: Millis | null; - updatedAt: Millis; - related?: string[] | null; +export interface HarnessSessionList { + sessions: HarnessSessionSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissSuggestion". + * via the `definition` "HarnessOffering". */ -export interface WikiMissSuggestion { - slug: string; - title: string; +export interface HarnessOffering { + harnessId: HarnessId; + chat: boolean; + capabilities: HarnessCapabilities; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissBody". + * via the `definition` "HarnessOfferingList". */ -export interface WikiMissBody { - error: string; - suggestions: WikiMissSuggestion[]; +export interface HarnessOfferingList { + harnesses: HarnessOffering[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiRedLink". + * via the `definition` "HarnessStoreSession". */ -export interface WikiRedLink { - entity: string; - referencedBy: string[]; +export interface HarnessStoreSession { + id: string; + command: RosterCommand; + title: string; + updatedAt: number; + parentSessionId?: string | null; + agentName?: string | null; + model?: string | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiGapsResponse". + * via the `definition` "HarnessStoreSessionList". */ -export interface WikiGapsResponse { - redLinks: WikiRedLink[]; - stalest: string[]; +export interface HarnessStoreSessionList { + sessions: HarnessStoreSession[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopic". + * via the `definition` "task.done". */ -export interface WikiTopic { - slug: string; - title: string; - tags: string[]; - entities: string[]; - updatedAt: Millis; - excerpt: string; +export interface TaskDone { + taskId: string; + status: TaskStatus; + parentSessionId?: string | null; + childSessionId?: string | null; + ts: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopicList". + * via the `definition` "AcceptanceCriterion". */ -export interface WikiTopicList { - topics: WikiTopic[]; - total: number; +export interface AcceptanceCriterion { + id: string; + description: string; + kind: CriterionKind; + check?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentUsage". + * via the `definition` "TaskBudget". */ -export interface AgentUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface TaskBudget { + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionSummary". + * via the `definition` "TaskUsage". */ -export interface LiveSessionSummary { - id: string; - name: string; - harness?: SessionHarness | null; - lastEventTs?: number | null; - pty?: string | null; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface TaskUsage { + inputTokens?: number | null; + outputTokens?: number | null; + totalTokens?: number | null; + turns: number; + wallClockMs: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionLogLine". + * via the `definition` "TaskResult". */ -export interface SessionLogLine { - who: string; - text: string; +export interface TaskResult { + verdict: TaskVerdict; + summary: string; + usage: TaskUsage; + error?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionView". + * via the `definition` "TaskWire". */ -export interface SessionView { - title: string; - activity: Activity; - tool?: string | null; - tasks: string[]; - thought: string; - lastMessage: string; - log: SessionLogLine[]; - term: string[]; - ended: boolean; +export interface TaskWire { + id: string; + goal: string; + acceptanceCriteria: AcceptanceCriterion[]; + agentId: string; + node: string; + harness?: HarnessId | null; + model?: string | null; + effort?: string | null; + requestedBy?: string | null; + parentSessionId?: string | null; + parentTaskId?: string | null; + depth: number; + childSessionId?: string | null; + budget: TaskBudget; + usage?: TaskUsage | null; + status: TaskStatus; + error?: string | null; + result?: TaskResult | null; + createdAt: number; + startedAt?: number | null; + completedAt?: number | null; + durationMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionList". + * via the `definition` "TaskCreateRequest". */ -export interface LiveSessionList { - sessions: LiveSessionSummary[]; +export interface TaskCreateRequest { + goal?: string | null; + agentId?: string | null; + nodeAffinity?: string | null; + acceptanceCriteria?: AcceptanceCriterion[] | null; + budget?: TaskBudget | null; + parentSessionId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + workingDir?: string | null; + requestedBy?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StateResponse". + * via the `definition` "TaskResponse". */ -export interface StateResponse { - session: string; - state: SessionView; +export interface TaskResponse { + task: TaskWire; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "snapshot". + * via the `definition` "TasksListResponse". */ -export interface Snapshot { - v: ProtocolVersion; - sessions: LiveSessionSummary[]; - rooms: { - [k: string]: SessionView; - }; +export interface TasksListResponse { + tasks: TaskWire[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "session.removed". + * via the `definition` "TaskKillResponse". */ -export interface SessionRemoved { - v: ProtocolVersion; - session: string; +export interface TaskKillResponse { + ok: boolean; + prior?: TaskStatus | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureBatchRequest". + * via the `definition` "TaskWaitTimeoutResponse". */ -export interface CaptureBatchRequest { - session_key: string; - agent: string; - channel?: string | null; - title?: string | null; - settings?: { - [k: string]: unknown; - } | null; - task_id?: string | null; - finalize?: boolean | null; - created_at?: Millis | null; - updated_at?: Millis | null; - messages: CaptureMessage[]; +export interface TaskWaitTimeoutResponse { + error: string; + task?: TaskWire | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureMessage". + * via the `definition` "MemorySearchResult". */ -export interface CaptureMessage { - event_id: string; - role: Role; +export interface MemorySearchResult { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; content: string; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - created_at?: Millis | null; + role?: Role | null; + agent?: string | null; + relevanceScore: number; + createdAt: string; + sessionId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureResult". + * via the `definition` "PluginManifest". */ -export interface CaptureResult { - ok: boolean; - conversation_id: string; - inserted: number; - skipped: number; +export interface PluginManifest { + $schema?: string | null; + manifest: ProtocolVersion; + id: PluginId; + name: string; + version: string; + description: string; + icon?: string | null; + run: PluginRun; + permissions?: Permission[]; + settings?: ViewField[]; + tools?: PluginTool[]; + contributes?: PluginContributions; + jobs?: PluginJob[]; + events?: PluginEventKind[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookContextBase". + * via the `definition` "PluginRun". */ -export interface HookContextBase { - agentId?: string | null; - sessionId?: string | null; - timestamp: number; - metadata: { - [k: string]: unknown; +export interface PluginRun { + command: string[]; + env?: { + [k: string]: string; }; + readyTimeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookUsage". + * via the `definition` "ViewField". */ -export interface HookUsage { - promptTokens: number; - completionTokens: number; +export interface ViewField { + key: string; + label: string; + input: ViewInput; + value?: ViewValue | null; + required?: boolean; + help?: string | null; + placeholder?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionTokens". + * via the `definition` "ViewOption". */ -export interface SessionTokens { - prompt: number; - completion: number; +export interface ViewOption { + value: string; + label: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TurnComplexity". + * via the `definition` "ViewFile". */ -export interface TurnComplexity { - toolCallCount: number; - hadErrorRecovery: boolean; - hadUserCorrection: boolean; - uniqueTools: number; +export interface ViewFile { + name: string; + mimeType: string; + data: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Message". + * via the `definition` "PluginTool". */ -export interface Message { - role: Role; - content: MessageContent; - reasoning?: string | null; - toolCalls?: ToolCall[] | null; - toolCallId?: string | null; +export interface PluginTool { + name: ToolName; + title?: string | null; + description: string; + inputSchema: { + [k: string]: unknown; + }; + hints?: PluginToolHint[]; +} +export interface PluginContributions { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ToolCall". + * via the `definition` "PluginPage". */ -export interface ToolCall { - id: string; - name: string; - arguments: { - [k: string]: unknown; - }; - thoughtSignature?: string | null; +export interface PluginPage { + id: RouteName; + title: string; + icon?: string | null; + view: RouteName; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineError". + * via the `definition` "PluginTopicCard". */ -export interface HookPipelineError { - hookId: string; - error: string; +export interface PluginTopicCard { + id: RouteName; + title: string; + view: RouteName; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineResult". + * via the `definition` "PluginSessionAction". */ -export interface HookPipelineResult { - context: HookContext; - aborted: boolean; - skipped: boolean; - errors: HookPipelineError[]; - ran: string[]; +export interface PluginSessionAction { + id: RouteName; + title: string; + icon?: string | null; + action: ViewAction; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookConfig". + * via the `definition` "PluginJob". */ -export interface HookConfig { - id: string; - event: HookEventName; - type: HookConfigKind; - target: string; - priority?: number | null; - onError?: HookErrorMode | null; - agentFilter?: string[] | null; - toolFilter?: string[] | null; - description?: string | null; - enabled?: boolean | null; +export interface PluginJob { + id: RouteName; + title: string; + schedule?: string | null; + timeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ApprovalOption". + * via the `definition` "PluginContributions". */ -export interface ApprovalOption { - key: string; - label: string; +export interface PluginContributions1 { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionSummary". + * via the `definition` "View". */ -export interface HarnessSessionSummary { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - [k: string]: unknown; +export interface View { + title: string; + subtitle?: string | null; + toolbar?: ViewButton[]; + blocks: ViewBlock[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewButton". + */ +export interface ViewButton { + label: string; + icon?: string | null; + style?: ViewButtonStyle | null; + action: ViewAction; + confirm?: ViewConfirm | null; + disabled?: boolean; } -export interface HarnessStatusFrame { - type: "status"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewConfirm". + */ +export interface ViewConfirm { + title: string; + text: string; + confirmLabel?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptQuestion". + * via the `definition` "ViewTab". */ -export interface PromptQuestion { - question?: string | null; - header?: string | null; - multiSelect: boolean; - freeText?: boolean | null; - options: PromptOption[]; +export interface ViewTab { + id: RouteName; + title: string; + badge?: string | null; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptOption". + * via the `definition` "ViewProperty". */ -export interface PromptOption { +export interface ViewProperty { label: string; - description?: string | null; + value: ViewInline; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptResolution". + * via the `definition` "ViewListItem". */ -export interface PromptResolution { - at: number; - answerText?: string | null; +export interface ViewListItem { + id: string; + title: string; + subtitle?: string | null; + icon?: string | null; + trailing?: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptScreen". + * via the `definition` "ViewEmpty". */ -export interface PromptScreen { - current: number; - total: number; +export interface ViewEmpty { + title: string; + text?: string | null; + button?: ViewButton | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StatusTool". + * via the `definition` "ViewColumn". */ -export interface StatusTool { - name: string; - toolCallId?: string | null; +export interface ViewColumn { + title: string; + align?: ViewAlign | null; + sortable?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStatusFrame". + * via the `definition` "ViewRow". */ -export interface HarnessStatusFrame1 { - sessionId: SessionId; - status: HarnessStatus; - since: number; - source?: StatusSource | null; - phase?: StatusPhase | null; - tool?: StatusTool | null; - promptId?: string | null; +export interface ViewRow { + id: string; + cells: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapabilities". + * via the `definition` "ViewCrumb". */ -export interface HarnessCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; - turnOptions?: boolean | null; - launchModel?: boolean | null; - imageAttachments?: boolean | null; - models?: HarnessModelOption[] | null; - modelsSource?: HarnessModelsSource | null; - efforts?: EffortOption[] | null; - modelFlag?: string | null; - effortFlag?: string | null; +export interface ViewCrumb { + label: string; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessModelOption". + * via the `definition` "CanvasScene". */ -export interface HarnessModelOption { - inputModalities?: string[] | null; +export interface CanvasScene { + items: CanvasItem[]; + grid?: CanvasGrid | null; + viewport?: CanvasViewport | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasAnchor". + */ +export interface CanvasAnchor { id: string; - label: string; - isDefault?: boolean | null; - efforts?: EffortOption[] | null; + x: number; + y: number; + side: CanvasSide; + direction: CanvasDirection; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EffortOption". + * via the `definition` "CanvasMenuItem". */ -export interface EffortOption { +export interface CanvasMenuItem { id: string; label: string; - isDefault?: boolean | null; + icon?: string | null; + danger?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessControlCapabilities". + * via the `definition` "CanvasEnd". */ -export interface HarnessControlCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; +export interface CanvasEnd { + node: string; + anchor?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessObservationCapabilities". + * via the `definition` "CanvasGrid". */ -export interface HarnessObservationCapabilities { - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; +export interface CanvasGrid { + size: number; + snap?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionList". + * via the `definition` "CanvasViewport". */ -export interface HarnessSessionList { - sessions: HarnessSessionSummary[]; +export interface CanvasViewport { + x: number; + y: number; + zoom: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOffering". + * via the `definition` "ViewRequest". */ -export interface HarnessOffering { - harnessId: HarnessId; - chat: boolean; - capabilities: HarnessCapabilities; +export interface ViewRequest { + params?: { + [k: string]: unknown; + } | null; + context?: ViewContext; +} +export interface ViewContext { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOfferingList". + * via the `definition` "ViewContext". */ -export interface HarnessOfferingList { - harnesses: HarnessOffering[]; +export interface ViewContext1 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSession". + * via the `definition` "ViewActionRequest". */ -export interface HarnessStoreSession { - id: string; - command: RosterCommand; - title: string; - updatedAt: number; - parentSessionId?: string | null; - agentName?: string | null; - model?: string | null; - taskId?: string | null; +export interface ViewActionRequest { + params?: { + [k: string]: unknown; + } | null; + values?: { + [k: string]: ViewValue; + }; + context?: ViewContext2; +} +export interface ViewContext2 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSessionList". + * via the `definition` "ViewActionResult". */ -export interface HarnessStoreSessionList { - sessions: HarnessStoreSession[]; +export interface ViewActionResult { + actions?: ViewAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". + * via the `definition` "ViewActionRefusal". */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; +export interface ViewActionRefusal { + message: string; + fields?: { + [k: string]: string; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AcceptanceCriterion". + * via the `definition` "CanvasEventRequest". */ -export interface AcceptanceCriterion { +export interface CanvasEventRequest { + event: CanvasEvent; + params?: { + [k: string]: unknown; + } | null; + context?: ViewContext3; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasPosition". + */ +export interface CanvasPosition { id: string; - description: string; - kind: CriterionKind; - check?: string | null; + x: number; + y: number; +} +export interface ViewContext3 { + topicId?: string | null; + sessionId?: SessionId | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasResponse". + */ +export interface CanvasResponse { + ops?: CanvasOp[]; + actions?: ViewAction[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelTheme". + */ +export interface PanelTheme { + scheme: PanelScheme; + colors: { + category1?: string; + category2?: string; + category3?: string; + category4?: string; + category5?: string; + category6?: string; + danger?: string; + info?: string; + onPrimary?: string; + onPrimaryContainer?: string; + onSurface?: string; + onSurfaceVariant?: string; + outline?: string; + outlineVariant?: string; + primary?: string; + primaryContainer?: string; + secondaryContainer?: string; + success?: string; + surface?: string; + surfaceContainer?: string; + surfaceContainerHigh?: string; + warning?: string; + }; + fontFamily: string; + fontMono: string; + fontSize: number; + radius: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskBudget". + * via the `definition` "PluginList". */ -export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface PluginList { + node: string; + plugins: PluginRecord[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskUsage". + * via the `definition` "PluginRecord". */ -export interface TaskUsage { - inputTokens: number; - outputTokens: number; - totalTokens: number; - costUsd?: number | null; - turns: number; - wallClockMs: number; +export interface PluginRecord { + id: PluginId; + node: string; + path: string; + manifest: PluginManifest; + enabled: boolean; + state: PluginState; + granted: Permission[]; + pending: Permission[]; + error?: string | null; + lastExit?: PluginExit | null; + restarts: number; + startedAt?: number | null; + installedAt: number; + jobs: PluginJobStatus[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". + * via the `definition` "PluginExit". */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget?: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; +export interface PluginExit { + at: number; + code?: number | null; + signal?: string | null; } -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobStatus". + */ +export interface PluginJobStatus { + id: RouteName; + lastRun?: PluginJobRun | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". + * via the `definition` "PluginJobRun". */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; - at: number; +export interface PluginJobRun { + runId: string; + trigger: PluginJobTrigger; + startedAt: number; + finishedAt?: number | null; + outcome?: PluginJobOutcome | null; message?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". + * via the `definition` "PluginInstallRequest". */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; +export interface PluginInstallRequest { + path: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". + * via the `definition` "PluginEnableRequest". */ -export interface CriterionReport { - id: string; - met: boolean; - evidence?: string; +export interface PluginEnableRequest { + approve?: Permission[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResult". + * via the `definition` "PluginLogs". */ -export interface TaskResult { - verdict: TaskVerdict; - summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; - usage: TaskUsage; - error?: string | null; +export interface PluginLogs { + lines: PluginLogLine[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". + * via the `definition` "PluginLogLine". */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; +export interface PluginLogLine { + at: number; + stream: PluginLogStream; + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". + * via the `definition` "PluginSettings". */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; +export interface PluginSettings { + values: { + [k: string]: ViewValue; + }; + secretsSet?: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". + * via the `definition` "PluginSettingsUpdate". */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; +export interface PluginSettingsUpdate { + values: { + [k: string]: ViewValue | null; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". + * via the `definition` "plugin.changed". */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; +export interface PluginChanged { + v: ProtocolVersion; + plugin: PluginId; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". + * via the `definition` "plugin.views". */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; +export interface PluginViews { + v: ProtocolVersion; + plugin: PluginId; + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWire". + * via the `definition` "PluginToolList". */ -export interface TaskWire { - id: string; - goal: string; - contextRefs: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; - agentId: string; - requestedBy?: string | null; - origin: string; - parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; - budget: TaskBudget; - usage?: TaskUsage | null; - status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; - error?: string | null; - result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; - createdAt: number; - startedAt?: number | null; - lastHeartbeatAt?: number | null; - completedAt?: number | null; - durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; +export interface PluginToolList { + version: number; + tools: PluginToolEntry[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskCreateRequest". + * via the `definition` "PluginToolEntry". */ -export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; - nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; - acceptanceCriteria?: AcceptanceCriterion[] | null; +export interface PluginToolEntry { + plugin: PluginId; + tool: PluginTool; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResponse". + * via the `definition` "PluginEventDelivery". */ -export interface TaskResponse { - task: TaskWire; +export interface PluginEventDelivery { + seq: number; + at: number; + missed: number; + event: PluginEvent; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TasksListResponse". + * via the `definition` "PluginJobRequest". */ -export interface TasksListResponse { - tasks: TaskWire[]; +export interface PluginJobRequest { + runId: string; + trigger: PluginJobTrigger; + scheduledAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". + * via the `definition` "PluginJobResult". */ -export interface TaskSteerAccepted { - ok: boolean; +export interface PluginJobResult { + outcome: PluginJobOutcome; + message?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskKillResponse". + * via the `definition` "PluginToolCall". */ -export interface TaskKillResponse { - ok: boolean; - prior?: TaskStatus | null; +export interface PluginToolCall { + arguments: { + [k: string]: unknown; + }; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". + * via the `definition` "PluginToolResult". */ -export interface TaskApprovalAccepted { - ok: boolean; +export interface PluginToolResult { + text: string; + isError?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". + * via the `definition` "PluginSelf". */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; +export interface PluginSelf { + id: PluginId; + node: string; + version: string; + permissions: Permission[]; + settings: { + [k: string]: ViewValue; + }; + dataDir: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWaitTimeoutResponse". + * via the `definition` "PluginViewsChanged". */ -export interface TaskWaitTimeoutResponse { - error: string; - task?: TaskWire | null; +export interface PluginViewsChanged { + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". + * via the `definition` "PluginNotify". */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; +export interface PluginNotify { + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResult". + * via the `definition` "plugin.notification". */ -export interface MemorySearchResult { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - role?: Role | null; - agent?: string | null; - relevanceScore: number; - createdAt: string; +export interface PluginNotification { + plugin: PluginId; + node: string; + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; + ts: number; } diff --git a/packages/contract/src/sent.ts b/packages/contract/src/sent.ts index 9bf50d9..ddf9c74 100644 --- a/packages/contract/src/sent.ts +++ b/packages/contract/src/sent.ts @@ -1,20 +1,11 @@ -// Generated from philbert440/rivethub-runtime@ba386c48eca72acb93d9a26bafb9abd30a48253f contract/sent.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/sent.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessId". */ export type HarnessId = - | "claude-code" - | "grok-build" - | "kimi-code" - | "hermes" - | "codex" - | "opencode" - | "pi" - | "qwen-code" - | "cursor" - | "cowork"; + "claude-code" | "grok-build" | "kimi-code" | "hermes" | "codex" | "opencode" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "KnownHarness". @@ -25,6 +16,21 @@ export type KnownHarness = string; * via the `definition` "AgentStoreBackend". */ export type AgentStoreBackend = "postgres" | "file"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ThinkingLevel". + */ +export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubSessionMode". + */ +export type HubSessionMode = "chat" | "terminal"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ProtocolVersion". + */ +export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionId". @@ -35,11 +41,6 @@ export type SessionId = string; * via the `definition` "CatalogAgent". */ export type CatalogAgent = Preset | CatalogNode; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "McpInjection". - */ -export type McpInjection = "flag" | "cwdFile" | "persistentConfig" | "none"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "Activity". @@ -137,11 +138,6 @@ export type AudioMicClientFrame = | { type: "stop"; }; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ProtocolVersion". - */ -export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "FileEntryKind". @@ -179,14 +175,14 @@ export type BrowseWindow = "today" | "yesterday" | "this_morning" | "this_week" export type MemoryScope = "messages" | "summaries" | "both"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHitSource". + * via the `definition` "Role". */ -export type MemoryHitSource = "message" | "summary"; +export type Role = "system" | "user" | "assistant" | "tool"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Role". + * via the `definition` "MemoryHitSource". */ -export type Role = "system" | "user" | "assistant" | "tool"; +export type MemoryHitSource = "message" | "summary"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MemoryFallback". @@ -235,6 +231,11 @@ export type ContentPart = } | MediaFields | MediaFields1; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VectorState". + */ +export type VectorState = "embedded" | "pending" | "failed" | "skipped"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MemoryHealthStatus". @@ -265,6 +266,21 @@ export type ProjectRule = "git-remote" | "git-root" | "cwd-basename"; * via the `definition` "ProviderRecovery". */ export type ProviderRecovery = "retrying" | "permanent"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteError". + */ +export type SessionDeleteError = "session is live" | "not found" | "delete failed"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResult". + */ +export type SessionDeleteResult = SessionDeleted | SessionDeleteRefused; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashReason". + */ +export type SessionTrashReason = "empty" | "one-word-reply"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ContextSource". @@ -277,9 +293,9 @@ export type ContextSource = "spawn" | "default" | "observed"; export type SessionMessageRole = "user" | "assistant"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ThinkingLevel". + * via the `definition` "SteerOutcome". */ -export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +export type SteerOutcome = "steered" | "startedNewTurn" | "promptRequired"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionClientKind". @@ -328,6 +344,11 @@ export type TranscriptToolStatus = "running" | "done" | "error"; * via the `definition` "TranscriptBlock". */ export type TranscriptBlock = "thinking" | "text" | "tool_use" | "tool_result"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPreviewKind". + */ +export type SessionPreviewKind = "running" | "asking" | "approval" | "said"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "Millis". @@ -343,6 +364,32 @@ export type HarnessSessionStatus = "active" | "idle" | "ended" | "error"; * via the `definition` "Transport". */ export type Transport = "protocol"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StartupKind". + */ +export type StartupKind = "topic" | "recent" | "relevant"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StartupSource". + */ +export type StartupSource = + | { + session: SessionId; + } + | { + wiki: WikiSlug; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "WikiSlug". + */ +export type WikiSlug = string; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeliveredVia". + */ +export type DeliveredVia = "metaAppend" | "cliFlag" | "none"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessSocketRefusalCode". @@ -443,14 +490,106 @@ export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter"; export type ErrorKind = "invalid_request_error" | "server_error"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSlug". + * via the `definition` "WikiSourceKind". */ -export type WikiSlug = string; +export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki" | "user"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceKind". + * via the `definition` "ProposalState". + */ +export type ProposalState = "pending" | "approved" | "rejected"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "Proposer". + */ +export type Proposer = "categorizer" | "backfill"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TidyChange". + */ +export type TidyChange = + | { + kind: "merge"; + source: string; + into: string; + } + | { + kind: "move"; + topic: string; + parent?: string | null; + } + | { + kind: "rename"; + topic: string; + name: string; + } + | { + kind: "close"; + topic: string; + } + | { + kind: "delete"; + topic: string; + } + | { + kind: "createTopic"; + topic: string; + name: string; + parent?: string | null; + aliases?: string[]; + sessions: SessionId[]; + conversations: string[]; + } + | { + kind: "fileInto"; + topic: string; + sessions: SessionId[]; + conversations: string[]; + } + | { + kind: "mergePage"; + page: string; + into: string; + } + | { + kind: "removePage"; + page: string; + } + | { + kind: "addType"; + topic: string; + name: string; + parent?: string | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopicDirectory". + */ +export type TopicDirectory = + | { + kind: "local"; + node: string; + path: string; + } + | { + kind: "shared"; + path: string; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopicKind". + */ +export type TopicKind = "work" | "type" | "entity"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PlacedBy". + */ +export type PlacedBy = "you" | "categorizer"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DecisionStatus". */ -export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki"; +export type DecisionStatus = "active" | "superseded"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "AgentEvent". @@ -582,11 +721,26 @@ export type AgentEventKind = type: "turn.end"; ts?: number | null; }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ContextUsageSource". + */ +export type ContextUsageSource = "harness" | "last-call"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionBroadcast". */ -export type SessionBroadcast = Snapshot | SessionRemoved | AgentEvent; +export type SessionBroadcast = Snapshot | SessionRemoved | HubState1 | PluginChanged | PluginViews | AgentEvent; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginId". + */ +export type PluginId = string; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RouteName". + */ +export type RouteName = string; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HookEventName". @@ -904,17 +1058,17 @@ export type HookConfigKind = "shell" | "http" | "internal"; * via the `definition` "RosterCommand". */ export type RosterCommand = - "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "pi" | "qwen" | "cursor" | "cowork"; + "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalDecision". */ -export type ApprovalDecision = "allow" | "deny" | "allowSession"; +export type ApprovalDecision = "allow" | "deny" | "allow-session"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalOutcome". */ -export type ApprovalOutcome = "allow" | "deny" | "allowSession" | "external"; +export type ApprovalOutcome = "allow" | "deny" | "allow-session" | "external"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessStatus". @@ -957,6 +1111,15 @@ export type HarnessEvent = }; turnId?: string | null; } + | { + type: "tool-update"; + sessionId: SessionId; + toolCallId: string; + input: { + [k: string]: unknown; + }; + turnId?: string | null; + } | { type: "tool-result"; sessionId: SessionId; @@ -990,11 +1153,25 @@ export type HarnessEvent = summary: HarnessSessionSummary; supersedes?: SessionId | null; } + | { + type: "plan"; + sessionId: SessionId; + entries: PlanEntry[]; + } | { type: "turn-complete"; sessionId: SessionId; turnId?: string | null; stopReason?: string | null; + usage?: LlmUsage | null; + modelMs?: number | null; + } + | { + type: "context"; + sessionId: SessionId; + used: number; + window?: number | null; + source: ContextUsageSource; } | { type: "error"; @@ -1036,6 +1213,11 @@ export type HarnessEvent = resolved?: PromptResolution | null; screen?: PromptScreen | null; }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PlanStatus". + */ +export type PlanStatus = "pending" | "in_progress" | "completed"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "PromptKind". @@ -1057,22 +1239,13 @@ export type HarnessCode = | "turn_in_flight" | "capability_unsupported" | "unknown_approval" - | "unknown_prompt"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskExecutorKind". - */ -export type TaskExecutorKind = "chat-loop" | "harness-session" | "mesh"; + | "unknown_prompt" + | "turn_failed"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskVerdict". */ export type TaskVerdict = "completed" | "failed" | "killed" | "timeout" | "budget-exceeded"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRefKind". - */ -export type ContextRefKind = "conversation" | "message" | "task" | "file" | "url" | "wiki"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "CriterionKind". @@ -1085,2763 +1258,4336 @@ export type CriterionKind = "manual" | "automated"; export type Effort = "low" | "medium" | "high"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskIsolation". + * via the `definition` "LogLevel". + */ +export type LogLevel = "debug" | "info" | "warn" | "error"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ToolName". */ -export type TaskIsolation = "inherit" | "isolated"; +export type ToolName = string; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPromptMode". + * via the `definition` "Permission". */ -export type TaskPromptMode = "task" | "heartbeat"; +export type Permission = + | "memory.read" + | "memory.write" + | "sessions.read" + | "sessions.control" + | "topics.read" + | "topics.write" + | "tasks.read" + | "tasks.delegate" + | "agents.read" + | "notifications.send" + | "host.files.read" + | "host.files.write" + | "host.network" + | "host.exec"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionOutcome". + * via the `definition` "ViewInput". */ -export type TaskPermissionOutcome = "allow" | "deny" | "timeout"; +export type ViewInput = + | { + type: "text"; + multiline?: boolean; + } + | { + type: "secret"; + } + | { + type: "number"; + min?: number | null; + max?: number | null; + step?: number | null; + } + | { + type: "toggle"; + } + | { + type: "select"; + options: ViewOption[]; + multiple?: boolean; + } + | { + type: "file"; + multiple?: boolean; + accept?: string[]; + }; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ArtifactKind". + * via the `definition` "ViewValue". */ -export type ArtifactKind = "file" | "url" | "commit" | "message"; +export type ViewValue = boolean | number | string | string[] | ViewFile[]; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EvalVerdict". + * via the `definition` "PluginToolHint". */ -export type EvalVerdict = "verified" | "refuted" | "escalated"; +export type PluginToolHint = "readOnly" | "destructive" | "idempotent" | "openWorld"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskEvent". + * via the `definition` "ViewAction". */ -export type TaskEvent = +export type ViewAction = | { - type: "den"; - ts: number; - event: AgentEvent; + type: "call"; + action: RouteName; + params?: { + [k: string]: unknown; + } | null; } | { - type: "turn.start"; - ts: number; - turn: number; + type: "navigate"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + replace?: boolean; } | { - type: "turn.end"; - ts: number; - turn: number; - usage: TaskUsage; - harnessSessionId?: SessionId | null; + type: "dialog"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; } | { - type: "session.spawned"; - ts: number; - nativeSessionId: string; - model?: string | null; + type: "back"; } | { - type: "cost"; - ts: number; - deltaUsd: number; - totalUsd: number; + type: "refresh"; } | { - type: "log"; - ts: number; - level: LogLevel; - message: string; + type: "toast"; + text: string; + tone?: ViewTone | null; } | { - type: "approval-request"; - ts: number; - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; + type: "copy"; + text: string; } | { - type: "approval-resolved"; - ts: number; - taskId: string; - requestId: string; - decision: TaskPermissionOutcome; + type: "openSession"; + sessionId: SessionId; + } + | { + type: "openTopic"; + topicId: string; + } + | { + type: "openUrl"; + url: string; + } + | { + type: "download"; + path: string; + filename?: string | null; }; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "LogLevel". - */ -export type LogLevel = "debug" | "info" | "warn" | "error"; - -export interface RivetHubContractSentByTheRuntime { - [k: string]: unknown; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPreset". + * via the `definition` "ViewTone". */ -export interface AgentPreset { - id: string; - name: string; - color: string; - harnessId?: HarnessId | null; - model: string; - effort: string; - systemPrompt: string; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; - createdAt: number; - updatedAt: number; - [k: string]: unknown; -} +export type ViewTone = "neutral" | "info" | "success" | "warning" | "danger"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentsFile". + * via the `definition` "PluginEventKind". */ -export interface AgentsFile { - agents: AgentPreset[]; -} +export type PluginEventKind = + "session.started" | "session.idle" | "session.ended" | "session.placed" | "summary.written" | "task.done"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetCreateRequest". + * via the `definition` "ViewButtonStyle". */ -export interface AgentPresetCreateRequest { - name: string; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type ViewButtonStyle = "primary" | "secondary" | "danger"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetUpdate". + * via the `definition` "ViewBlock". */ -export interface AgentPresetUpdate { - name?: string | null; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; +export type ViewBlock = + | { + type: "section"; + title?: string | null; + subtitle?: string | null; + actions?: ViewButton[]; + blocks: ViewBlock[]; + collapsed?: boolean | null; + } + | { + type: "split"; + primary: ViewBlock[]; + secondary: ViewBlock[]; + ratio?: number | null; + } + | { + type: "tabs"; + tabs: ViewTab[]; + selected?: RouteName | null; + } + | { + type: "text"; + text: string; + tone?: ViewTone | null; + monospace?: boolean; + } + | { + type: "markdown"; + text: string; + } + | { + type: "code"; + text: string; + language?: string | null; + follow?: boolean; + } + | { + type: "image"; + path: string; + alt: string; + } + | { + type: "properties"; + items: ViewProperty[]; + } + | { + type: "progress"; + value?: number | null; + label?: string | null; + } + | { + type: "notice"; + tone: ViewTone; + title?: string | null; + text: string; + actions?: ViewButton[]; + } + | { + type: "list"; + items: ViewListItem[]; + empty?: ViewEmpty | null; + } + | { + type: "table"; + columns: ViewColumn[]; + rows: ViewRow[]; + empty?: ViewEmpty | null; + } + | { + type: "breadcrumbs"; + items: ViewCrumb[]; + } + | { + type: "actions"; + buttons: ViewButton[]; + } + | { + type: "form"; + id: RouteName; + fields: ViewField[]; + buttons: ViewButton[]; + } + | { + type: "canvas"; + id: RouteName; + scene: CanvasScene; + height?: number | null; + readOnly?: boolean; + menu?: CanvasMenuItem[]; + } + | { + type: "webPanel"; + id: RouteName; + entry: string; + height?: number | null; + params?: { + [k: string]: unknown; + } | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewInline". + */ +export type ViewInline = + | { + type: "text"; + text: string; + tone?: ViewTone | null; + icon?: string | null; + monospace?: boolean; + } + | { + type: "badge"; + text: string; + tone: ViewTone; + } + | { + type: "time"; + at: number; + style?: ViewTimeStyle | null; + } + | { + type: "duration"; + ms: number; + } + | { + type: "bytes"; + value: number; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewTimeStyle". + */ +export type ViewTimeStyle = "relative" | "absolute"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewAlign". + */ +export type ViewAlign = "start" | "center" | "end"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasItem". + */ +export type CanvasItem = + | { + type: "node"; + id: string; + x: number; + y: number; + width: number; + height: number; + shapes: CanvasShape[]; + anchors?: CanvasAnchor[]; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + locked?: boolean; + decorative?: boolean; + } + | { + type: "connector"; + id: string; + from: CanvasEnd; + to: CanvasEnd; + route: CanvasRoute; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + arrow: CanvasArrow; + label?: string | null; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + decorative?: boolean; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasShape". + */ +export type CanvasShape = + | { + type: "rect"; + x: number; + y: number; + width: number; + height: number; + radius?: number | null; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "ellipse"; + x: number; + y: number; + width: number; + height: number; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "text"; + x: number; + y: number; + text: string; + size?: number | null; + weight?: CanvasWeight | null; + color?: ColorRole | null; + align?: ViewAlign | null; + maxWidth?: number | null; + monospace?: boolean; + } + | { + type: "path"; + d: string; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + } + | { + type: "icon"; + x: number; + y: number; + name: string; + size?: number | null; + color?: ColorRole | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ColorRole". + */ +export type ColorRole = + | "surface" + | "surfaceContainer" + | "surfaceContainerHigh" + | "primary" + | "primaryContainer" + | "onPrimary" + | "onPrimaryContainer" + | "secondaryContainer" + | "onSurface" + | "onSurfaceVariant" + | "outline" + | "outlineVariant" + | "info" + | "success" + | "warning" + | "danger" + | "category1" + | "category2" + | "category3" + | "category4" + | "category5" + | "category6"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasWeight". + */ +export type CanvasWeight = "regular" | "medium" | "bold"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasSide". + */ +export type CanvasSide = "top" | "right" | "bottom" | "left"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasDirection". + */ +export type CanvasDirection = "in" | "out" | "both"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasRoute". + */ +export type CanvasRoute = "straight" | "curved" | "orthogonal"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasArrow". + */ +export type CanvasArrow = "none" | "end" | "start" | "both"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasEvent". + */ +export type CanvasEvent = + | { + type: "selected"; + items: string[]; + } + | { + type: "moved"; + items: CanvasPosition[]; + } + | { + type: "connected"; + from: CanvasEnd; + to: CanvasEnd; + } + | { + type: "deleted"; + items: string[]; + } + | { + type: "activated"; + item: string; + } + | { + type: "menu"; + item?: string | null; + choice: string; + x: number; + y: number; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasOp". + */ +export type CanvasOp = + | { + type: "upsert"; + item: CanvasItem; + } + | { + type: "remove"; + ids: string[]; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelScheme". + */ +export type PanelScheme = "light" | "dark"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelHostMessage". + */ +export type PanelHostMessage = + | { + type: "init"; + theme: PanelTheme; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext1; + plugin: PluginId; + node: string; + } + | { + type: "theme"; + theme: PanelTheme; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelMessage". + */ +export type PanelMessage = + | { + type: "ready"; + } + | { + type: "resize"; + height: number; + } + | { + type: "action"; + action: ViewAction; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginState". + */ +export type PluginState = "disabled" | "awaitingApproval" | "starting" | "running" | "backoff" | "invalid"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobTrigger". + */ +export type PluginJobTrigger = "schedule" | "manual"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobOutcome". + */ +export type PluginJobOutcome = "succeeded" | "failed"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginLogStream". + */ +export type PluginLogStream = "stdout" | "stderr" | "host"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginEvent". + */ +export type PluginEvent = + | { + type: "session.started"; + sessionId: SessionId; + topicId?: string | null; + } + | { + type: "session.idle"; + sessionId: SessionId; + } + | { + type: "session.ended"; + sessionId: SessionId; + } + | { + type: "session.placed"; + sessionId: SessionId; + topicId: string; + by: PlacedBy; + } + | { + type: "summary.written"; + summaryId: string; + sessionId?: SessionId | null; + kind: SummaryKind; + level: number; + } + | { + type: "task.done"; + taskId: string; + status: TaskStatus; + } + | { + type: "settings.changed"; + values: { + [k: string]: ViewValue; + }; + }; + +export interface RivetHubContractSentByTheRuntime { + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPreset". + */ +export interface AgentPreset { + id: string; + name: string; + color: string; + harnessId?: HarnessId | null; + model: string; + effort: string; + systemPrompt: string; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; + createdAt: number; + updatedAt: number; + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentsFile". + */ +export interface AgentsFile { + agents: AgentPreset[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetCreateRequest". + */ +export interface AgentPresetCreateRequest { + name: string; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetUpdate". + */ +export interface AgentPresetUpdate { + name?: string | null; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; nodeBaseUrl?: string | null; sortOrder?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentListResponse". + * via the `definition` "AgentListResponse". + */ +export interface AgentListResponse { + agents: AgentPreset[]; + node: string; + directoryRoot?: string | null; + sharedDir?: string | null; + backend?: AgentStoreBackend | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentResponse". + */ +export interface AgentResponse { + agent: AgentPreset; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubProjectDefaults". + */ +export interface HubProjectDefaults { + agentId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + harnessId?: HarnessId | null; + node?: string | null; + directory?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubProject". + */ +export interface HubProject { + id: string; + name: string; + order: number; + createdAt: number; + defaults?: HubProjectDefaults | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubLastSession". + */ +export interface HubLastSession { + key: string; + at: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubState". + */ +export interface HubState { + projects: HubProject[]; + defaultProjectId?: string | null; + membership: { + [k: string]: string; + }; + names: { + [k: string]: string; + }; + archived: string[]; + pinned: string[]; + hidden: string[]; + modes: { + [k: string]: HubSessionMode; + }; + lastSession?: HubLastSession | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubStateResponse". + */ +export interface HubStateResponse { + version: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubStatePutRequest". + */ +export interface HubStatePutRequest { + baseVersion: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "hub.state". + */ +export interface HubState1 { + v: ProtocolVersion; + version: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDescriptor". + */ +export interface HarnessDescriptor { + installed?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DelegatedSessionLink". + */ +export interface DelegatedSessionLink { + taskId: string; + parentTaskId?: string | null; + spawnedSessionId: SessionId; + parentSessionId: SessionId; + agentName?: string | null; + model?: string | null; + owner?: string | null; + harnessId?: HarnessId | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurnAttachment". + */ +export interface UserTurnAttachment { + mime: string; + pathOrUri: string; + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurn". + */ +export interface UserTurn { + deliveryId?: string | null; + model?: string | null; + effort?: string | null; + text: string; + attachments?: UserTurnAttachment[] | null; + systemPrompt?: string | null; + bypassDialogGate?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SendUserTurnResult". + */ +export interface SendUserTurnResult { + dismissedDialog?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "preset". + */ +export interface Preset { + id: string; + name: string; + node: string; + local: boolean; + harnessId?: HarnessId | null; + model?: string | null; + effort?: string | null; + directory?: string | null; + implemented?: boolean | null; + gap?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogNode". + */ +export interface CatalogNode { + id: string; + node: string; + local: boolean; + provider?: string | null; + model?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogAgentsResponse". + */ +export interface CatalogAgentsResponse { + agents: CatalogAgent[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverview". + */ +export interface MeshOverview { + updatedAt: number; + nodes: MeshOverviewNode[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverviewNode". + */ +export interface MeshOverviewNode { + id: string; + name: string; + denUrl: string; + online: boolean; + sessions?: number | null; + latest?: MeshLatest | null; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshLatest". + */ +export interface MeshLatest { + activity: Activity; + title: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "NodeCapabilities". + */ +export interface NodeCapabilities { + subsystems: Subsystems; + harnesses: HarnessCapability[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "Subsystems". + */ +export interface Subsystems { + den: boolean; + devices: boolean; + mesh: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessCapability". + */ +export interface HarnessCapability { + harnessId: HarnessId; + list: boolean; + read: boolean; + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessInspectCapability". + */ +export interface HarnessInspectCapability { + list: boolean; + read: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDriveCapability". + */ +export interface HarnessDriveCapability { + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshDevice". + */ +export interface MeshDevice { + id: string; + name: string; + publicKey: string; + address: string; + createdAt: number; + enrolledAt?: number | null; + lastHandshake?: number | null; + pgRole?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceListResponse". + */ +export interface DeviceListResponse { + devices: MeshDevice[]; + pending: PendingEnrollment[]; + relayConfigured: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PendingEnrollment". + */ +export interface PendingEnrollment { + id: string; + name: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StoredPending". + */ +export interface StoredPending { + id: string; + name: string; + token: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceRosterFile". + */ +export interface DeviceRosterFile { + v: number; + devices: MeshDevice[]; + pending: StoredPending[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateRequest". + */ +export interface DeviceCreateRequest { + name: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "rivet-mesh-enroll". + */ +export interface RivetMeshEnroll { + v: number; + gateway: string; + token: string; + config: DeviceEnrollConfig; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollConfig". + */ +export interface DeviceEnrollConfig { + sharedHost: string; + sharedExport: string; + pgUrl: string; + embedUrl: string; + wgEndpoint: string; + wgPeerPublicKey: string; + wgAddress: string; + wgAllowedIps: string; + homeSubnet: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateResponse". + */ +export interface DeviceCreateResponse { + pending: PendingEnrollment; + qr: RivetMeshEnroll; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EnrolledDevice". + */ +export interface EnrolledDevice { + id: string; + name: string; + address: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SignedCertificate". + */ +export interface SignedCertificate { + leaf: string; + chain: string[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollResponse". + */ +export interface DeviceEnrollResponse { + ok: boolean; + device: EnrolledDevice; + config: DeviceEnrollConfig; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemResponse". + */ +export interface PairRedeemResponse { + deviceId: string; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairingRecord". + */ +export interface PairingRecord { + v: number; + deviceId: string; + name: string; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollRequest". + */ +export interface DeviceEnrollRequest { + token?: string | null; + publicKey?: string | null; + name?: string | null; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingCode". + */ +export interface PhonePairingCode { + deviceId: string; + gateway: string; + expiresAt: number; + qrText: string; + reshown: number; + addedToUsers: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingStatus". + */ +export interface PhonePairingStatus { + state: PhonePairingState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingAvailability". + */ +export interface PhonePairingAvailability { + available: boolean; + reason?: string | null; + gateway?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingRequest". + */ +export interface PhonePairingRequest { + name: string; + host?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AudioStatus". + */ +export interface AudioStatus { + enabled: boolean; + backend: AudioBackend; + device: string; + sampleRate: number; + channels: number; + format: AudioFormat; + fifoPath: string; + armed: boolean; + publisherId?: string | null; + armedAt?: number | null; + bytesWritten: number; + runtimeReady: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AudioHealth". + */ +export interface AudioHealth { + ok: boolean; + runtimeReady: boolean; + fifoPath: string; + message?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceSpeakRequest". + */ +export interface VoiceSpeakRequest { + input: string; + instructions?: string | null; + voice?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceTranscribeResponse". + */ +export interface VoiceTranscribeResponse { + text: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceFileEntry". + */ +export interface DeviceFileEntry { + name: string; + type: FileEntryKind; + size: number; + mtime: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FilesListResponse". + */ +export interface FilesListResponse { + path: string; + root: string; + entries: DeviceFileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StagedUploadResponse". + */ +export interface StagedUploadResponse { + uri: string; + name: string; + mime: string; + size: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileEntry". + */ +export interface FileEntry { + name: string; + type: FileKind; + size: number; + mtime: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileList". + */ +export interface FileList { + path: string; + root: string; + entries: FileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileChanged". + */ +export interface FileChanged { + ok: boolean; + path: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchToolArgs". + */ +export interface MemorySearchToolArgs { + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + expand?: boolean | null; + synthesize?: boolean | null; + query: string; + mode?: SearchMode | null; + scope?: MemoryScope | null; + limit?: number | null; + agent?: string | null; + role?: Role | null; + tool_name?: string | null; + tag?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchHit". + */ +export interface MemorySearchHit { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + createdAt: string; + score: number; + role?: Role | null; + agent?: string | null; + kind?: SummaryKind | null; + toolName?: string | null; + conversationId?: string | null; + sessionId?: string | null; + fallback?: MemoryFallback | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryChunkMatch". + */ +export interface MemoryChunkMatch { + index: number; + total: number; + charStart: number; + charEnd: number; + content: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagWire". + */ +export interface TagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryDegraded". + */ +export interface MemoryDegraded { + reason: string; + effect: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchResponse". + */ +export interface MemorySearchResponse { + query: string; + scope: MemoryScope; + degraded?: MemoryDegraded | null; + fallback?: MemoryFallback | null; + results: MemorySearchHit[]; + expanded?: MemoryEntry[]; + synthesis?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryEntry". + */ +export interface MemoryEntry { + id?: string | null; + sessionId: string; + agent: string; + channel: string; + role: Role; + content: string; + toolName?: string | null; + toolArgs?: { + [k: string]: unknown; + } | null; + toolResult?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseToolArgs". + */ +export interface MemoryBrowseToolArgs { + conversation_id?: string | null; + include_tools?: boolean | null; + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + agent?: string | null; + tag?: string | null; + limit?: number | null; + order?: MemoryBrowseOrder | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryAppendToolArgs". + */ +export interface MemoryAppendToolArgs { + session_id: string; + content: string; + role: Role; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + event_id?: string | null; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestMessage". + */ +export interface MemoryIngestMessage { + role: Role; + content: string; + created_at?: string | null; + tool_calls?: MemoryIngestToolCall[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestToolCall". + */ +export interface MemoryIngestToolCall { + id?: string | null; + name: string; + input?: { + [k: string]: unknown; + } | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestSessionToolArgs". + */ +export interface MemoryIngestSessionToolArgs { + session_id: string; + messages: MemoryIngestMessage[]; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryGetFullToolArgs". + */ +export interface MemoryGetFullToolArgs { + id?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsToolArgs". + */ +export interface MemoryTagsToolArgs { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + key?: string | null; + value?: string | null; + tag?: string | null; + display?: string | null; + state?: TagState | null; + ids?: string[] | null; + session_keys?: string[] | null; + entries?: TagEntryPair[] | null; + parent_value?: string | null; + aliases?: string[] | null; + from?: string | null; + into?: string | null; + reason?: string | null; + decided_by?: string | null; + limit?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagEntryPair". + */ +export interface TagEntryPair { + key: string; + value: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryToolResponse". + */ +export interface MemoryToolResponse { + ok: boolean; + result: ToolResult; +} +export interface MediaFields { + type: "image"; +} +export interface MediaFields1 { + type: "video"; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MediaFields". + */ +export interface MediaFields2 { + data?: string | null; + url?: string | null; + mimeType?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseMessage". + */ +export interface MemoryBrowseMessage { + id: string; + role: Role; + agent?: string | null; + content: string; + createdAt: string; + conversationId?: string | null; + sessionId?: string | null; + toolName?: string | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseResponse". + */ +export interface MemoryBrowseResponse { + messages: MemoryBrowseMessage[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryNode". + */ +export interface MemorySummaryNode { + id: string; + parentId?: string | null; + level: number; + kind: SummaryKind; + content: string; + messageCount: number; + earliestAt?: string | null; + latestAt?: string | null; + createdAt: string; + sourceMessageIds: string[]; + vector: VectorState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryMessageTally". + */ +export interface MemoryMessageTally { + total: number; + user: number; + assistant: number; + system: number; + tool: number; + embedded: number; + pending: number; + failed: number; + skipped: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryDagResponse". + */ +export interface MemorySummaryDagResponse { + sessionId: string; + summaries: MemorySummaryNode[]; + messages: MemoryMessageTally; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopTool". + */ +export interface TopTool { + tool: string; + count: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RecentSession". + */ +export interface RecentSession { + sessionId: string; + title?: string | null; + agent: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryStatsResponse". + */ +export interface MemoryStatsResponse { + conversations: number; + messages: number; + toolCalls: number; + summaries: number; + embedQueueDepth: number; + embeddedMessages: number; + failedEmbeddings: number; + topTools: TopTool[]; + recentSessions: RecentSession[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EmbedHealth". + */ +export interface EmbedHealth { + status: EmbedStatus; + error?: string | null; + impact?: string | null; + checkedAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryHealthResponse". + */ +export interface MemoryHealthResponse { + observedAt?: string | null; + queueStatus?: QueueStatus | null; + queues?: QueueHealth | null; + compaction?: SummarizerHealth | null; + failedEmbeddings?: number | null; + skippedEmbeddings?: number | null; + capture?: CaptureHealth | null; + status: MemoryHealthStatus; + embeddings: EmbedHealth; + embedQueueDepth: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "QueueHealth". + */ +export interface QueueHealth { + task: string; + pending: number; + running: number; + scheduled: number; + dead: number; + oldestPendingMinutes?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SummarizerHealth". + */ +export interface SummarizerHealth { + eligible: boolean; + activeTail: boolean; + belowFloor: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CaptureHealth". + */ +export interface CaptureHealth { + status: CaptureStatus; + impact: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagWire". + */ +export interface PendingTagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; + action?: PendingTagAction | null; + sessionKey?: string | null; + title?: string | null; + agent?: string | null; + conversationId?: string | null; + excerpt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsDecideRequest". + */ +export interface MemoryTagsDecideRequest { + ids?: string[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsAddRequest". + */ +export interface MemoryTagsAddRequest { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + tag?: string | null; + key?: string | null; + value?: string | null; + display?: string | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsLookupRequest". + */ +export interface MemoryTagsLookupRequest { + session_keys?: string[] | null; + states?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyEntry". + */ +export interface TagTaxonomyEntry { + key: string; + value: string; + display: string; + parentValue?: string | null; + aliases: string[]; + state: TagState; + source: string; + reason: string; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyWire". + */ +export interface TagTaxonomyWire { + key: string; + entries: TagTaxonomyEntry[]; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertRequest". */ -export interface AgentListResponse { - agents: AgentPreset[]; - node: string; - directoryRoot?: string | null; - sharedDir?: string | null; - backend?: AgentStoreBackend | null; +export interface TagTaxonomyUpsertRequest { + key?: string | null; + value?: string | null; + display?: string | null; + parent_value?: string | null; + aliases?: string[] | null; + reason?: string | null; + decided_by?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentResponse". + * via the `definition` "TagTaxonomyDecideRequest". */ -export interface AgentResponse { - agent: AgentPreset; +export interface TagTaxonomyDecideRequest { + entries?: TagEntryPair[] | null; + state?: TagState | null; + decided_by?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDescriptor". + * via the `definition` "TagTaxonomyMerge". */ -export interface HarnessDescriptor { - installed?: boolean | null; +export interface TagTaxonomyMerge { + key: string; + from: string; + into: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DelegatedSessionLink". + * via the `definition` "TagTaxonomyMergeRequest". */ -export interface DelegatedSessionLink { - taskId: string; - parentTaskId?: string | null; - spawnedSessionId: SessionId; - parentSessionId: SessionId; - agentName?: string | null; - model?: string | null; - owner?: string | null; - harnessId?: HarnessId | null; +export interface TagTaxonomyMergeRequest { + key?: string | null; + from?: string | null; + into?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurnAttachment". + * via the `definition` "TagTaxonomyMergeResult". */ -export interface UserTurnAttachment { - mime: string; - pathOrUri: string; - name?: string | null; +export interface TagTaxonomyMergeResult { + moved: number; + dropped: number; + into: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurn". + * via the `definition` "TagCount". */ -export interface UserTurn { - deliveryId?: string | null; - model?: string | null; - effort?: string | null; - text: string; - attachments?: UserTurnAttachment[] | null; - systemPrompt?: string | null; - bypassDialogGate?: boolean | null; +export interface TagCount { + key: string; + value: string; + display: string; + conversations: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SendUserTurnResult". + * via the `definition` "TagListResult". */ -export interface SendUserTurnResult { - dismissedDialog?: boolean | null; +export interface TagListResult { + tags: TagWire[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "preset". + * via the `definition` "PendingTagListResult". */ -export interface Preset { - id: string; - name: string; - node: string; - local: boolean; - harnessId?: HarnessId | null; - model?: string | null; - directory?: string | null; - implemented?: boolean | null; - gap?: string | null; +export interface PendingTagListResult { + tags: PendingTagWire[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogNode". + * via the `definition` "TagCountsResult". */ -export interface CatalogNode { - id: string; - node: string; - local: boolean; - provider?: string | null; - model?: string | null; +export interface TagCountsResult { + counts: TagCount[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". + * via the `definition` "TagTaxonomyListResult". */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; +export interface TagTaxonomyListResult { + entries: TagTaxonomyEntry[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". + * via the `definition` "TagDecisionResult". */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; +export interface TagDecisionResult { + changed: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". + * via the `definition` "TagAddResult". */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; +export interface TagAddResult { + tag: TagWire; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". + * via the `definition` "TagLookupResult". */ -export interface CatalogSkillEntry { - name: string; - description: string; +export interface TagLookupResult { + sessions: { + [k: string]: TagWire[]; + }; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertResult". + */ +export interface TagTaxonomyUpsertResult { + entry: TagTaxonomyEntry; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ProjectRuleResult". + */ +export interface ProjectRuleResult { + key: string; + rule: ProjectRule; + gitRoot?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". + * via the `definition` "HealthzResponse". */ -export interface CatalogSheet { +export interface HealthzResponse { + ok: boolean; + sessions: number; + name: string; node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; + degraded?: string | null; + degradedProviders?: DegradedProvider[]; + version?: string | null; + revision?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogAgentsResponse". + * via the `definition` "DegradedProvider". */ -export interface CatalogAgentsResponse { - agents: CatalogAgent[]; +export interface DegradedProvider { + id: string; + recovery: ProviderRecovery; + reason: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". + * via the `definition` "GatewayError". */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; +export interface GatewayError { + error: string; + detail?: string | null; + hint?: string | null; + code?: string | null; + harnessId?: HarnessId | null; + node?: string | null; + retryable?: boolean | null; + reason?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". + * via the `definition` "OkReply". */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; +export interface OkReply { + ok: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EventsIngested". + */ +export interface EventsIngested { + ok: boolean; + ingested: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemRequest". + */ +export interface PairRedeemRequest { + token: string; + csr?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". + * via the `definition` "RosterFile". */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; +export interface RosterFile { + default: string; + cwd: string | null; + env: { + [k: string]: string; }; - byExecutor: { - [k: string]: OutcomeBucket; + commands: { + [k: string]: RosterEntry; }; - byDay: { - [k: string]: OutcomeBucket; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RosterEntry". + */ +export interface RosterEntry { + label: string; + cmd: string[]; + room: boolean | null; + cwd: string | null; + env: { + [k: string]: string; }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverview". + * via the `definition` "SessionDeleted". */ -export interface MeshOverview { - updatedAt: number; - nodes: MeshOverviewNode[]; +export interface SessionDeleted { + ok: boolean; + session: SessionId; + conversations: number; + messages: number; + summaries: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverviewNode". + * via the `definition` "SessionDeleteRequest". */ -export interface MeshOverviewNode { - id: string; - name: string; - denUrl: string; - online: boolean; - sessions?: number | null; - latest?: MeshLatest | null; +export interface SessionDeleteRequest { + sessions: SessionId[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshLatest". + * via the `definition` "SessionDeleteRefused". */ -export interface MeshLatest { - activity: Activity; - title: string; +export interface SessionDeleteRefused { + session: SessionId; + ok: boolean; + error: SessionDeleteError; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResults". + */ +export interface SessionDeleteResults { + results: SessionDeleteResult[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashCandidate". + */ +export interface SessionTrashCandidate { + session: SessionId; + harness: HarnessId; + title: string | null; + updatedAt: string; + reason: SessionTrashReason; + userTurns: number; + reply: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashList". + */ +export interface SessionTrashList { + candidates: SessionTrashCandidate[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptTurn". + */ +export interface TranscriptTurn { + role: Role; + text: string; + ts?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "NodeCapabilities". + * via the `definition` "TranscriptResponse". */ -export interface NodeCapabilities { - subsystems: Subsystems; - harnesses: HarnessCapability[]; +export interface TranscriptResponse { + id: string; + command: string; + turns: TranscriptTurn[]; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Subsystems". + * via the `definition` "SessionSummary". */ -export interface Subsystems { - den: boolean; - devices: boolean; - mesh: boolean; +export interface SessionSummary { + id: string; + lastActive: number; + messages: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapability". + * via the `definition` "SessionList". */ -export interface HarnessCapability { - harnessId: HarnessId; - list: boolean; - read: boolean; - drive: boolean; - resume: boolean; +export interface SessionList { + sessions: SessionSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessInspectCapability". + * via the `definition` "MessageList". */ -export interface HarnessInspectCapability { - list: boolean; - read: boolean; +export interface MessageList { + messages: SessionMessage[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDriveCapability". + * via the `definition` "SessionMessage". */ -export interface HarnessDriveCapability { - drive: boolean; - resume: boolean; +export interface SessionMessage { + id: string; + sessionId: string; + role: SessionMessageRole; + text: string; + ts: number; + usage?: MessageUsage | null; + model?: string | null; + durationMs?: number | null; + thinking?: boolean | null; + tools?: string[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshDevice". + * via the `definition` "MessageUsage". */ -export interface MeshDevice { - id: string; - name: string; - publicKey: string; - address: string; - createdAt: number; - enrolledAt?: number | null; - lastHandshake?: number | null; - pgRole?: string | null; +export interface MessageUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceListResponse". + * via the `definition` "SessionPostRequest". */ -export interface DeviceListResponse { - devices: MeshDevice[]; - pending: PendingEnrollment[]; - relayConfigured: boolean; +export interface SessionPostRequest { + excludeTools?: string[] | null; + text: string; + userId?: string | null; + agent?: string | null; + thinking?: ThinkingLevel | null; + systemPrompt?: string | null; + attachments?: UserTurnAttachment[] | null; + harness?: HarnessId | null; + model?: string | null; + workingDir?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingEnrollment". + * via the `definition` "SessionPostAccepted". */ -export interface PendingEnrollment { - id: string; - name: string; - address: string; - createdAt: number; - expiresAt: number; +export interface SessionPostAccepted { + accepted: boolean; + session: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StoredPending". + * via the `definition` "SessionPostReply". */ -export interface StoredPending { - id: string; - name: string; - token: string; - address: string; - createdAt: number; - expiresAt: number; +export interface SessionPostReply { + message: SessionMessage; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceRosterFile". + * via the `definition` "SessionSteerRequest". */ -export interface DeviceRosterFile { - v: number; - devices: MeshDevice[]; - pending: StoredPending[]; +export interface SessionSteerRequest { + text: string; + attachments?: UserTurnAttachment[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateRequest". + * via the `definition` "SessionSteerResponse". */ -export interface DeviceCreateRequest { - name: string | null; +export interface SessionSteerResponse { + outcome: SteerOutcome; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "rivet-mesh-enroll". + * via the `definition` "SessionWsClientMessage". */ -export interface RivetMeshEnroll { - v: number; - gateway: string; - token: string; - config: DeviceEnrollConfig; +export interface SessionWsClientMessage { + type: SessionClientKind; + session: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollConfig". + * via the `definition` "StreamEvent". */ -export interface DeviceEnrollConfig { - sharedHost: string; - sharedExport: string; - pgUrl: string; - embedUrl: string; - wgEndpoint: string; - wgPeerPublicKey: string; - wgAddress: string; - wgAllowedIps: string; - homeSubnet: string; +export interface StreamEvent { + type: StreamEventKind; + content: string; + metadata?: { + [k: string]: unknown; + } | null; +} +export interface TranscriptWsFrame { + kind: "transcript"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateResponse". + * via the `definition` "HarnessTranscriptTurn". */ -export interface DeviceCreateResponse { - pending: PendingEnrollment; - qr: RivetMeshEnroll; +export interface HarnessTranscriptTurn { + role: SessionMessageRole; + text: string; + thinking?: string | null; + tools?: HarnessTranscriptTool[] | null; + usage?: MessageUsage | null; + model?: string | null; + stopReason?: string | null; + lastBlock?: TranscriptBlock | null; + attachments?: TranscriptAttachment[] | null; + complete?: boolean; + compact?: boolean; + startedAtMs?: number | null; + endedAtMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EnrolledDevice". + * via the `definition` "HarnessTranscriptTool". */ -export interface EnrolledDevice { - id: string; +export interface HarnessTranscriptTool { name: string; - address: string; + status: TranscriptToolStatus; + args?: { + [k: string]: unknown; + } | null; + id?: string | null; + input?: { + [k: string]: unknown; + } | null; + resultText?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SignedCertificate". + * via the `definition` "TranscriptAttachment". */ -export interface SignedCertificate { - leaf: string; - chain: string[]; +export interface TranscriptAttachment { + mediaType: string; + name?: string | null; + uri?: string | null; + uploadId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollResponse". + * via the `definition` "TranscriptWsFrame". */ -export interface DeviceEnrollResponse { - ok: boolean; - device: EnrolledDevice; - config: DeviceEnrollConfig; - certificate: SignedCertificate; +export interface TranscriptWsFrame1 { + session: string; + rev: number; + from: number; + turns: HarnessTranscriptTurn[]; + total: number; + command: string; + truncatedBefore?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemResponse". + * via the `definition` "HarnessSessionTranscriptResponse". */ -export interface PairRedeemResponse { - deviceId: string; - certificate: SignedCertificate; +export interface HarnessSessionTranscriptResponse { + sessionId: SessionId; + harnessId: HarnessId; + turns: HarnessTranscriptTurn[]; + contextWindow: number; + compactAt: number; + contextSource: ContextSource; + redirectedTo?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairingRecord". + * via the `definition` "SessionPreview". */ -export interface PairingRecord { - v: number; - deviceId: string; - name: string; - expiresAt: number; +export interface SessionPreview { + sessionId: SessionId; + kind: SessionPreviewKind; + text: string; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollRequest". + * via the `definition` "SessionPreviewList". */ -export interface DeviceEnrollRequest { - token?: string | null; - publicKey?: string | null; - name?: string | null; - csr?: string | null; +export interface SessionPreviewList { + previews: SessionPreview[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingCode". + * via the `definition` "HarnessTurnAccepted". */ -export interface PhonePairingCode { - deviceId: string; - gateway: string; - expiresAt: number; - qrText: string; - reshown: number; - addedToUsers: boolean; +export interface HarnessTurnAccepted { + ok: boolean; + sessionId: SessionId; + redirectedTo?: SessionId | null; + dismissedDialog?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingStatus". + * via the `definition` "HarnessSessionResponse". */ -export interface PhonePairingStatus { - state: PhonePairingState; +export interface HarnessSessionResponse { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + redirectedTo?: SessionId | null; + switches?: SessionSwitches | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingAvailability". + * via the `definition` "StartupContext". */ -export interface PhonePairingAvailability { - available: boolean; - reason?: string | null; - gateway?: string | null; +export interface StartupContext { + topicId: string; + sections: StartupSection[]; + tokens: number; + deliveredVia: DeliveredVia; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingRequest". + * via the `definition` "StartupSection". */ -export interface PhonePairingRequest { - name: string; - host?: string | null; +export interface StartupSection { + kind: StartupKind; + title: string; + text: string; + sources: StartupSource[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AudioStatus". + * via the `definition` "SessionSwitches". */ -export interface AudioStatus { - enabled: boolean; - backend: AudioBackend; - device: string; - sampleRate: number; - channels: number; - format: AudioFormat; - fifoPath: string; - armed: boolean; - publisherId?: string | null; - armedAt?: number | null; - bytesWritten: number; - runtimeReady: boolean; +export interface SessionSwitches { + model: boolean; + effort: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AudioHealth". + * via the `definition` "HarnessSessionTitleRequest". */ -export interface AudioHealth { - ok: boolean; - runtimeReady: boolean; - fifoPath: string; - message?: string | null; +export interface HarnessSessionTitleRequest { + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceSpeakRequest". + * via the `definition` "HarnessSessionForkRequest". */ -export interface VoiceSpeakRequest { - input: string; - instructions?: string | null; - voice?: string | null; +export interface HarnessSessionForkRequest { + prompts: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceTranscribeResponse". + * via the `definition` "HarnessToolOutput". */ -export interface VoiceTranscribeResponse { +export interface HarnessToolOutput { text: string; + isError: boolean; + truncated: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceFileEntry". - */ -export interface DeviceFileEntry { - name: string; - type: FileEntryKind; - size: number; - mtime: string; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FilesListResponse". + * via the `definition` "TermSpawnRequest". */ -export interface FilesListResponse { - path: string; - root: string; - entries: DeviceFileEntry[]; +export interface TermSpawnRequest { + command?: string | null; + model?: string | null; + effort?: string | null; + session?: string | null; + resume?: string | null; + agentId?: string | null; + force?: boolean | null; + cols?: number | null; + rows?: number | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StagedUploadResponse". + * via the `definition` "TermAttachInfo". */ -export interface StagedUploadResponse { - uri: string; - name: string; - mime: string; - size: number; - expiresAt: number; +export interface TermAttachInfo { + socket: string; + session: string; + host: string; + sshUser: string; + local: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileEntry". + * via the `definition` "TermSpawnResponse". */ -export interface FileEntry { - name: string; - type: FileKind; - size: number; - mtime: number; +export interface TermSpawnResponse { + harnessSessionId?: SessionId | null; + id: string; + denSession: string; + command: string; + cwd?: string | null; + pid: number; + createdAt: number; + mux?: Mux | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileList". + * via the `definition` "PtyInfo". */ -export interface FileList { - path: string; - root: string; - entries: FileEntry[]; +export interface PtyInfo { + id: string; + denSession: string; + command: string; + state: PtyState; + pid?: number | null; + attached: number; + exitCode?: number | null; + createdAt: number; + lastOutputTs?: number | null; + cols?: number | null; + rows?: number | null; + mux?: Mux | null; + persisted?: boolean | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileChanged". + * via the `definition` "PtyList". */ -export interface FileChanged { - ok: boolean; - path: string; +export interface PtyList { + ptys: PtyInfo[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchToolArgs". + * via the `definition` "TermCommand". */ -export interface MemorySearchToolArgs { - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - expand?: boolean | null; - synthesize?: boolean | null; - query: string; - mode?: SearchMode | null; - scope?: MemoryScope | null; - limit?: number | null; - agent?: string | null; - tag?: string | null; +export interface TermCommand { + id: string; + label: string; + room: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchHit". + * via the `definition` "TermConfig". */ -export interface MemorySearchHit { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - createdAt: string; - score: number; - role?: Role | null; - agent?: string | null; - kind?: SummaryKind | null; - toolName?: string | null; - conversationId?: string | null; - sessionId?: string | null; - fallback?: MemoryFallback | null; - tags?: TagWire[] | null; +export interface TermConfig { + enabled: boolean; + default: string; + maxPtys: number; + active: number; + commands: TermCommand[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryChunkMatch". + * via the `definition` "TermInjectRequest". */ -export interface MemoryChunkMatch { - index: number; - total: number; - charStart: number; - charEnd: number; - content: string; +export interface TermInjectRequest { + session: string; + text: string; + submit?: boolean | null; + interrupt?: boolean | null; + bypassDialogGate?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagWire". + * via the `definition` "TermInjectResponse". */ -export interface TagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface TermInjectResponse { + ok: boolean; + ptyId: string; + dismissedDialog?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryDegraded". + * via the `definition` "DeviceOwner". */ -export interface MemoryDegraded { - reason: string; - effect: string; +export interface DeviceOwner { + device?: string | null; + self: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResponse". + * via the `definition` "UploadCreated". */ -export interface MemorySearchResponse { - query: string; - scope: MemoryScope; - degraded?: MemoryDegraded | null; - fallback?: MemoryFallback | null; - results: MemorySearchHit[]; - expanded?: MemoryEntry[]; - synthesis?: string | null; +export interface UploadCreated { + id: string; + uri: string; + name: string; + bytes: number; + mediaType: string; + expiresAt: string; + session?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryEntry". + * via the `definition` "UploadList". */ -export interface MemoryEntry { - id?: string | null; - sessionId: string; - agent: string; - channel: string; - role: Role; - content: string; - toolName?: string | null; - toolArgs?: { - [k: string]: unknown; - } | null; - toolResult?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - createdAt?: string | null; +export interface UploadList { + uploads: UploadCreated[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseToolArgs". + * via the `definition` "UsersRegistry". */ -export interface MemoryBrowseToolArgs { - conversation_id?: string | null; - include_tools?: boolean | null; - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - agent?: string | null; - tag?: string | null; - limit?: number | null; - order?: MemoryBrowseOrder | null; +export interface UsersRegistry { + ownerUserId: string; + unmappedIsOwner: boolean; + localStores?: boolean | null; + users: { + [k: string]: UserRecord; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryAppendToolArgs". + * via the `definition` "UserRecord". */ -export interface MemoryAppendToolArgs { - session_id: string; - content: string; - role: Role; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - event_id?: string | null; - agent?: string | null; +export interface UserRecord { + id?: string | null; + devices?: string[] | null; + pgUrl?: string | null; + envFile?: string | null; persona?: string | null; - source?: string | null; - channel?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestMessage". + * via the `definition` "ChatRequest". */ -export interface MemoryIngestMessage { +export interface ChatRequest { + model: string; + messages: OpenAiMessage[]; + stream: boolean | null; + max_tokens: number | null; + stream_options: StreamOptions | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "OpenAiMessage". + */ +export interface OpenAiMessage { role: Role; - content: string; - created_at?: string | null; - tool_calls?: MemoryIngestToolCall[] | null; + content: string | null; + reasoning_content?: string | null; + tool_calls?: MessageToolCall[] | null; + tool_call_id?: string | null; +} +export interface StreamedPlainToolCall { + type: "function"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestToolCall". + * via the `definition` "StreamOptions". */ -export interface MemoryIngestToolCall { - id?: string | null; - name: string; - input?: { - [k: string]: unknown; - } | null; +export interface StreamOptions { + include_usage: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestSessionToolArgs". + * via the `definition` "FunctionDelta". */ -export interface MemoryIngestSessionToolArgs { - session_id: string; - messages: MemoryIngestMessage[]; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface FunctionDelta { + name?: string | null; + arguments?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryGetFullToolArgs". + * via the `definition` "StreamedPlainToolCall". */ -export interface MemoryGetFullToolArgs { +export interface StreamedPlainToolCall1 { + index?: number | null; id?: string | null; + function: FunctionDelta; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsToolArgs". + * via the `definition` "chat.completion". */ -export interface MemoryTagsToolArgs { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - key?: string | null; - value?: string | null; - tag?: string | null; - display?: string | null; - state?: TagState | null; - ids?: string[] | null; - session_keys?: string[] | null; - entries?: TagEntryPair[] | null; - parent_value?: string | null; - aliases?: string[] | null; - from?: string | null; - into?: string | null; - reason?: string | null; - decided_by?: string | null; - limit?: number | null; +export interface ChatCompletion { + id: string; + created: number; + model: string; + choices: CompletionChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagEntryPair". + * via the `definition` "CompletionChoice". */ -export interface TagEntryPair { - key: string; - value: string; +export interface CompletionChoice { + index: number; + message: OpenAiMessage; + finish_reason: FinishReason; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryToolResponse". + * via the `definition` "Usage". */ -export interface MemoryToolResponse { - ok: boolean; - result: ToolResult; -} -export interface MediaFields { - type: "image"; +export interface Usage { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; + prompt_tokens_details?: PromptTokensDetails | null; + completion_tokens_details?: CompletionTokensDetails | null; } -export interface MediaFields1 { - type: "video"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PromptTokensDetails". + */ +export interface PromptTokensDetails { + cached_tokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MediaFields". + * via the `definition` "CompletionTokensDetails". */ -export interface MediaFields2 { - data?: string | null; - url?: string | null; - mimeType?: string | null; +export interface CompletionTokensDetails { + reasoning_tokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseMessage". + * via the `definition` "chat.completion.chunk". */ -export interface MemoryBrowseMessage { +export interface ChatCompletionChunk { id: string; - role: Role; - agent?: string | null; - content: string; - createdAt: string; - conversationId?: string | null; - sessionId?: string | null; - toolName?: string | null; - tags?: TagWire[] | null; + created: number; + model: string; + choices: ChunkChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseResponse". + * via the `definition` "ChunkChoice". */ -export interface MemoryBrowseResponse { - messages: MemoryBrowseMessage[]; +export interface ChunkChoice { + index: number; + delta: CompletionDelta; + finish_reason: FinishReason | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TopTool". + * via the `definition` "CompletionDelta". */ -export interface TopTool { - tool: string; - count: number; +export interface CompletionDelta { + role?: Role | null; + content?: string | null; + reasoning_content?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RecentSession". + * via the `definition` "list". */ -export interface RecentSession { - sessionId: string; - title?: string | null; - agent: string; - lastActive: number; - messages: number; +export interface List { + data: Model[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryStatsResponse". + * via the `definition` "model". */ -export interface MemoryStatsResponse { - conversations: number; - messages: number; - toolCalls: number; - summaries: number; - embedQueueDepth: number; - embeddedMessages: number; - failedEmbeddings: number; - topTools: TopTool[]; - recentSessions: RecentSession[]; +export interface Model { + id: string; + created: number; + owned_by: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EmbedHealth". + * via the `definition` "ErrorDetail". */ -export interface EmbedHealth { - status: EmbedStatus; - error?: string | null; - impact?: string | null; - checkedAt?: string | null; +export interface ErrorDetail { + message: string; + type: ErrorKind; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHealthResponse". + * via the `definition` "ErrorResponse". */ -export interface MemoryHealthResponse { - observedAt?: string | null; - queueStatus?: QueueStatus | null; - queues?: QueueHealth | null; - compaction?: SummarizerHealth | null; - failedEmbeddings?: number | null; - skippedEmbeddings?: number | null; - capture?: CaptureHealth | null; - status: MemoryHealthStatus; - embeddings: EmbedHealth; - embedQueueDepth: number; +export interface ErrorResponse { + error: ErrorDetail; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "QueueHealth". + * via the `definition` "Conversation". */ -export interface QueueHealth { - task: string; - pending: number; - running: number; - scheduled: number; - dead: number; - oldestPendingMinutes?: number | null; +export interface Conversation { + id: string; + title: string; + createdAt: number; + updatedAt: number; + messages: OpenAiMessage[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SummarizerHealth". + * via the `definition` "Conversations". */ -export interface SummarizerHealth { - eligible: boolean; - activeTail: boolean; - belowFloor: boolean; +export interface Conversations { + conversations: Conversation[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureHealth". + * via the `definition` "ConversationTitle". */ -export interface CaptureHealth { - status: CaptureStatus; - impact: string; +export interface ConversationTitle { + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagWire". + * via the `definition` "WikiQuery". */ -export interface PendingTagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; - action?: PendingTagAction | null; - sessionKey?: string | null; - title?: string | null; - agent?: string | null; - conversationId?: string | null; - excerpt?: string | null; +export interface WikiQuery { + q: string | null; + tag: string | null; + limit: number | null; + offset: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsDecideRequest". + * via the `definition` "WikiPageQuery". */ -export interface MemoryTagsDecideRequest { - ids?: string[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface WikiPageQuery { + slug: WikiSlug; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsAddRequest". + * via the `definition` "WikiHistoryEntry". */ -export interface MemoryTagsAddRequest { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - tag?: string | null; - key?: string | null; - value?: string | null; - display?: string | null; - reason?: string | null; - decided_by?: string | null; +export interface WikiHistoryEntry { + date: string; + title: string; + body: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsLookupRequest". + * via the `definition` "WikiCitation". */ -export interface MemoryTagsLookupRequest { - session_keys?: string[] | null; - states?: string[] | null; +export interface WikiCitation { + summaryId: string; + date?: Millis | null; + kind?: string | null; + note?: string | null; + conversationId?: string | null; + sessionId?: SessionId | null; + title?: string | null; + channel?: string | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyEntry". + * via the `definition` "WikiSource". */ -export interface TagTaxonomyEntry { - key: string; - value: string; - display: string; - parentValue?: string | null; - aliases: string[]; - state: TagState; - source: string; - reason: string; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiSource { + kind: WikiSourceKind; + ids: string[]; + conversationId?: string | null; + span?: WikiSourceSpan | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyWire". + * via the `definition` "WikiSourceSpan". */ -export interface TagTaxonomyWire { - key: string; - entries: TagTaxonomyEntry[]; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiSourceSpan { + earliest: Millis; + latest: Millis; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertRequest". + * via the `definition` "WikiPageResponse". */ -export interface TagTaxonomyUpsertRequest { - key?: string | null; - value?: string | null; - display?: string | null; - parent_value?: string | null; - aliases?: string[] | null; - reason?: string | null; - decided_by?: string | null; +export interface WikiPageResponse { + slug: string; + title: string; + aliases: string[]; + tags: string[]; + entities: string[]; + currentState: string; + article?: string | null; + seeAlso?: string[] | null; + history: WikiHistoryEntry[]; + citations: WikiCitation[]; + markdown: string; + sources: WikiSource[]; + gitSha?: string | null; + lastVerified?: Millis | null; + updatedAt: Millis; + related?: string[] | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyDecideRequest". + * via the `definition` "WikiMissSuggestion". */ -export interface TagTaxonomyDecideRequest { - entries?: TagEntryPair[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface WikiMissSuggestion { + slug: string; + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMerge". + * via the `definition` "WikiMissBody". */ -export interface TagTaxonomyMerge { - key: string; - from: string; - into: string; +export interface WikiMissBody { + error: string; + suggestions: WikiMissSuggestion[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeRequest". + * via the `definition` "WikiRedLink". */ -export interface TagTaxonomyMergeRequest { - key?: string | null; - from?: string | null; - into?: string | null; +export interface WikiRedLink { + entity: string; + referencedBy: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeResult". + * via the `definition` "WikiGapsResponse". */ -export interface TagTaxonomyMergeResult { - moved: number; - dropped: number; - into: string; +export interface WikiGapsResponse { + redLinks: WikiRedLink[]; + stalest: WikiTopic[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagCount". + * via the `definition` "WikiTopic". */ -export interface TagCount { - key: string; - value: string; - display: string; - conversations: number; +export interface WikiTopic { + slug: string; + title: string; + tags: string[]; + entities: string[]; + updatedAt: Millis; + excerpt: string; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagListResult". + * via the `definition` "WikiTopicList". */ -export interface TagListResult { - tags: TagWire[]; +export interface WikiTopicList { + topics: WikiTopic[]; + total: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagListResult". + * via the `definition` "TidySample". */ -export interface PendingTagListResult { - tags: PendingTagWire[]; +export interface TidySample { + id: string; + title?: string | null; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagCountsResult". + * via the `definition` "TidyEvidence". */ -export interface TagCountsResult { - counts: TagCount[]; +export interface TidyEvidence { + sessions: number; + samples: TidySample[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyListResult". + * via the `definition` "TidyProposal". */ -export interface TagTaxonomyListResult { - entries: TagTaxonomyEntry[]; +export interface TidyProposal { + id: string; + batchId: string; + change: TidyChange; + reason: string; + evidence: TidyEvidence; + proposedBy: Proposer; + proposedAt: number; + state: ProposalState; + decidedAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagDecisionResult". + * via the `definition` "TidyBatch". */ -export interface TagDecisionResult { - changed: number; +export interface TidyBatch { + batchId: string; + proposedBy: Proposer; + proposedAt: number; + proposals: TidyProposal[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagAddResult". + * via the `definition` "TidyPending". */ -export interface TagAddResult { - tag: TagWire; +export interface TidyPending { + batches: TidyBatch[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagLookupResult". + * via the `definition` "TidyFailure". */ -export interface TagLookupResult { - sessions: { - [k: string]: TagWire[]; - }; +export interface TidyFailure { + proposalId: string; + error: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertResult". + * via the `definition` "TidyBatchDecision". */ -export interface TagTaxonomyUpsertResult { - entry: TagTaxonomyEntry; +export interface TidyBatchDecision { + decided: TidyProposal[]; + failed: TidyFailure[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ProjectRuleResult". + * via the `definition` "FilingUpkeep". */ -export interface ProjectRuleResult { - key: string; - rule: ProjectRule; - gitRoot?: string | null; +export interface FilingUpkeep { + categorizer: number; + you: number; + uncategorized: number; + leftOut: number; + correctionsLastWeek: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HealthzResponse". + * via the `definition` "EntityTypeCount". */ -export interface HealthzResponse { - ok: boolean; - sessions: number; +export interface EntityTypeCount { + typeId: string; name: string; - node: string; - degraded?: string | null; - degradedProviders?: DegradedProvider[]; + entities: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DegradedProvider". + * via the `definition` "WikiUpkeep". */ -export interface DegradedProvider { - id: string; - recovery: ProviderRecovery; - reason: string; +export interface WikiUpkeep { + topicPages: number; + entityTypes: EntityTypeCount[]; + loosePages: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "GatewayError". - */ -export interface GatewayError { - error: string; - detail?: string | null; - hint?: string | null; - code?: string | null; - harnessId?: HarnessId | null; - node?: string | null; - retryable?: boolean | null; - reason?: string | null; + * via the `definition` "WorkerActivity". + */ +export interface WorkerActivity { + lastFinishedAt?: number | null; + failing: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OkReply". + * via the `definition` "WorkerUpkeep". */ -export interface OkReply { - ok: boolean; +export interface WorkerUpkeep { + embedder: WorkerActivity; + summarizer: WorkerActivity; + categorizer: WorkerActivity; + wikiBuilder: WorkerActivity; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EventsIngested". + * via the `definition` "MemoryUpkeep". */ -export interface EventsIngested { - ok: boolean; - ingested: number; +export interface MemoryUpkeep { + filing: FilingUpkeep; + wiki: WikiUpkeep; + workers: WorkerUpkeep; + pendingProposals: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemRequest". + * via the `definition` "TopicRecord". */ -export interface PairRedeemRequest { - token: string; - csr?: string | null; +export interface TopicRecord { + id: string; + kind: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RosterFile". + * via the `definition` "TopicSummary". */ -export interface RosterFile { - default: string; - cwd: string | null; - env: { - [k: string]: string; - }; - commands: { - [k: string]: RosterEntry; - }; +export interface TopicSummary { + id: string; + kind: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; + sessionCount: number; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RosterEntry". + * via the `definition` "TopicList". */ -export interface RosterEntry { - label: string; - cmd: string[]; - room: boolean | null; - cwd: string | null; - env: { - [k: string]: string; - }; +export interface TopicList { + topics: TopicSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptTurn". + * via the `definition` "TopicCreateRequest". */ -export interface TranscriptTurn { - role: Role; - text: string; - ts?: number | null; +export interface TopicCreateRequest { + kind: "work" | "type" | "entity"; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptResponse". + * via the `definition` "WikiPageEdit". */ -export interface TranscriptResponse { - id: string; - command: string; - turns: TranscriptTurn[]; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface WikiPageEdit { + currentState?: string | null; + article?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionSummary". + * via the `definition` "TopicUpdate". */ -export interface SessionSummary { - id: string; - lastActive: number; - messages: number; +export interface TopicUpdate { + name?: string | null; + aliases?: string[] | null; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionList". + * via the `definition` "TopicMergeRequest". */ -export interface SessionList { - sessions: SessionSummary[]; +export interface TopicMergeRequest { + into: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MessageList". + * via the `definition` "TopicPlacement". */ -export interface MessageList { - messages: SessionMessage[]; +export interface TopicPlacement { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionMessage". + * via the `definition` "TopicSuggestion". */ -export interface SessionMessage { - id: string; - sessionId: string; - role: SessionMessageRole; - text: string; - ts: number; - usage?: MessageUsage | null; - model?: string | null; - durationMs?: number | null; - thinking?: boolean | null; - tools?: string[] | null; +export interface TopicSuggestion { + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MessageUsage". + * via the `definition` "PlacementReply". */ -export interface MessageUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface PlacementReply { + placement?: TopicPlacement | null; + suggestion?: TopicSuggestion | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostRequest". + * via the `definition` "PlacementRequest". */ -export interface SessionPostRequest { - excludeTools?: string[] | null; - text: string; - userId?: string | null; - agent?: string | null; - thinking?: ThinkingLevel | null; - systemPrompt?: string | null; +export interface PlacementRequest { + topicId: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostAccepted". + * via the `definition` "SessionHistoryMark". */ -export interface SessionPostAccepted { - accepted: boolean; - session: string; +export interface SessionHistoryMark { + sessionId: SessionId; + markedAt: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostReply". + * via the `definition` "SessionHistoryList". */ -export interface SessionPostReply { - message: SessionMessage; +export interface SessionHistoryList { + sessions: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionWsClientMessage". + * via the `definition` "TopicSession". */ -export interface SessionWsClientMessage { - type: SessionClientKind; - session: string; +export interface TopicSession { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; + title?: string | null; + lastActive?: number | null; + node?: string | null; + parentSessionId?: SessionId | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamEvent". + * via the `definition` "TopicSessionList". */ -export interface StreamEvent { - type: StreamEventKind; - content: string; - metadata?: { - [k: string]: unknown; - } | null; -} -export interface TranscriptWsFrame { - kind: "transcript"; +export interface TopicSessionList { + sessions: TopicSession[]; + conversations: TopicConversation[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTurn". + * via the `definition` "TopicConversation". */ -export interface HarnessTranscriptTurn { - role: SessionMessageRole; - text: string; - thinking?: string | null; - tools?: HarnessTranscriptTool[] | null; - usage?: MessageUsage | null; - model?: string | null; - stopReason?: string | null; - lastBlock?: TranscriptBlock | null; - complete?: boolean; - compact?: boolean; +export interface TopicConversation { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; + channel: string; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTool". + * via the `definition` "TopicFiling". */ -export interface HarnessTranscriptTool { - name: string; - status: TranscriptToolStatus; - args?: { - [k: string]: unknown; - } | null; - id?: string | null; - input?: { - [k: string]: unknown; - } | null; - resultText?: string | null; +export interface TopicFiling { + sessions: TopicSession[]; + conversations: TopicConversation[]; + history: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptWsFrame". + * via the `definition` "SessionSuggestion". */ -export interface TranscriptWsFrame1 { - session: string; - rev: number; - from: number; - turns: HarnessTranscriptTurn[]; - total: number; - command: string; - truncatedBefore?: boolean | null; +export interface SessionSuggestion { + sessionId: SessionId; + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionTranscriptResponse". + * via the `definition` "SessionSuggestionList". */ -export interface HarnessSessionTranscriptResponse { - sessionId: SessionId; - harnessId: HarnessId; - turns: HarnessTranscriptTurn[]; - contextWindow: number; - compactAt: number; - contextSource: ContextSource; - redirectedTo?: SessionId | null; +export interface SessionSuggestionList { + sessions: SessionSuggestion[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTurnAccepted". + * via the `definition` "ConversationPlacement". */ -export interface HarnessTurnAccepted { - ok: boolean; - sessionId: SessionId; - redirectedTo?: SessionId | null; - dismissedDialog?: boolean; +export interface ConversationPlacement { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionResponse". + * via the `definition` "ConversationPlacementReply". */ -export interface HarnessSessionResponse { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - redirectedTo?: SessionId | null; - [k: string]: unknown; +export interface ConversationPlacementReply { + placement?: ConversationPlacement | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnRequest". + * via the `definition` "TopicPage". */ -export interface TermSpawnRequest { - command?: string | null; - model?: string | null; - effort?: string | null; - session?: string | null; - resume?: string | null; - agentId?: string | null; - force?: boolean | null; - cols?: number | null; - rows?: number | null; +export interface TopicPage { + topic: TopicRecord; + page?: WikiPageResponse | null; + mentions: TopicMention[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermAttachInfo". + * via the `definition` "TopicMention". */ -export interface TermAttachInfo { - socket: string; - session: string; - host: string; - sshUser: string; - local: boolean; +export interface TopicMention { + topicId: string; + name: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnResponse". + * via the `definition` "TopicDecision". */ -export interface TermSpawnResponse { - harnessSessionId?: SessionId | null; +export interface TopicDecision { id: string; - denSession: string; - command: string; - cwd?: string | null; - pid: number; + topicId: string; + text: string; + status: DecisionStatus; + supersededBy?: string | null; + by: string; + sessionId?: SessionId | null; createdAt: number; - mux?: Mux | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; + updatedAt: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PtyInfo". + * via the `definition` "TopicDecisionList". */ -export interface PtyInfo { - id: string; - denSession: string; - command: string; - state: PtyState; - pid?: number | null; - attached: number; - exitCode?: number | null; - createdAt: number; - lastOutputTs?: number | null; - cols?: number | null; - rows?: number | null; - mux?: Mux | null; - persisted?: boolean | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; +export interface TopicDecisionList { + decisions: TopicDecision[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DecisionCreateRequest". + */ +export interface DecisionCreateRequest { + text: string; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PtyList". + * via the `definition` "DecisionUpdate". */ -export interface PtyList { - ptys: PtyInfo[]; +export interface DecisionUpdate { + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermCommand". + * via the `definition` "DecisionSupersedeRequest". */ -export interface TermCommand { - id: string; - label: string; - room: boolean; +export interface DecisionSupersedeRequest { + text?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermConfig". + * via the `definition` "DecisionSuperseded". */ -export interface TermConfig { - enabled: boolean; - default: string; - maxPtys: number; - active: number; - commands: TermCommand[]; +export interface DecisionSuperseded { + superseded: TopicDecision; + replacement?: TopicDecision | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectRequest". + * via the `definition` "AgentUsage". */ -export interface TermInjectRequest { - session: string; - text: string; - submit?: boolean | null; - interrupt?: boolean | null; - bypassDialogGate?: boolean | null; +export interface AgentUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectResponse". + * via the `definition` "LiveSessionSummary". */ -export interface TermInjectResponse { - ok: boolean; - ptyId: string; - dismissedDialog?: boolean | null; +export interface LiveSessionSummary { + id: string; + name: string; + harness?: SessionHarness | null; + lastEventTs?: number | null; + pty?: string | null; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceOwner". + * via the `definition` "SessionLogLine". */ -export interface DeviceOwner { - device?: string | null; - self: boolean; +export interface SessionLogLine { + who: string; + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UploadCreated". + * via the `definition` "SessionView". */ -export interface UploadCreated { - id: string; - name: string; - bytes: number; - mediaType: string; - expiresAt: string; - session?: string | null; +export interface SessionView { + title: string; + activity: Activity; + tool?: string | null; + tasks: string[]; + thought: string; + lastMessage: string; + log: SessionLogLine[]; + term: string[]; + ended: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UploadList". + * via the `definition` "LiveSessionList". */ -export interface UploadList { - uploads: UploadCreated[]; +export interface LiveSessionList { + sessions: LiveSessionSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UsersRegistry". + * via the `definition` "StateResponse". */ -export interface UsersRegistry { - ownerUserId: string; - unmappedIsOwner: boolean; - localStores?: boolean | null; - users: { - [k: string]: UserRecord; - }; +export interface StateResponse { + session: string; + state: SessionView; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserRecord". + * via the `definition` "snapshot". */ -export interface UserRecord { - id?: string | null; - devices?: string[] | null; - pgUrl?: string | null; - envFile?: string | null; - persona?: string | null; +export interface Snapshot { + v: ProtocolVersion; + sessions: LiveSessionSummary[]; + rooms: { + [k: string]: SessionView; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ChatRequest". + * via the `definition` "session.removed". */ -export interface ChatRequest { - model: string; - messages: OpenAiMessage[]; - stream: boolean | null; - max_tokens: number | null; - stream_options: StreamOptions | null; +export interface SessionRemoved { + v: ProtocolVersion; + session: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OpenAiMessage". + * via the `definition` "plugin.changed". */ -export interface OpenAiMessage { - role: Role; - content: string | null; - reasoning_content?: string | null; - tool_calls?: MessageToolCall[] | null; - tool_call_id?: string | null; +export interface PluginChanged { + v: ProtocolVersion; + plugin: PluginId; } -export interface StreamedPlainToolCall { - type: "function"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "plugin.views". + */ +export interface PluginViews { + v: ProtocolVersion; + plugin: PluginId; + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamOptions". + * via the `definition` "CaptureBatchRequest". */ -export interface StreamOptions { - include_usage: boolean; +export interface CaptureBatchRequest { + session_key: string; + agent: string; + channel?: string | null; + title?: string | null; + settings?: { + [k: string]: unknown; + } | null; + task_id?: string | null; + finalize?: boolean | null; + created_at?: Millis | null; + updated_at?: Millis | null; + messages: CaptureMessage[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FunctionDelta". + * via the `definition` "CaptureMessage". */ -export interface FunctionDelta { - name?: string | null; - arguments?: string | null; +export interface CaptureMessage { + event_id: string; + role: Role; + content: string; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + created_at?: Millis | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamedPlainToolCall". + * via the `definition` "CaptureResult". */ -export interface StreamedPlainToolCall1 { - index?: number | null; - id?: string | null; - function: FunctionDelta; +export interface CaptureResult { + ok: boolean; + conversation_id: string; + inserted: number; + skipped: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion". + * via the `definition` "HookContextBase". */ -export interface ChatCompletion { - id: string; - created: number; - model: string; - choices: CompletionChoice[]; - usage?: Usage | null; +export interface HookContextBase { + agentId?: string | null; + sessionId?: string | null; + timestamp: number; + metadata: { + [k: string]: unknown; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionChoice". + * via the `definition` "HookUsage". */ -export interface CompletionChoice { - index: number; - message: OpenAiMessage; - finish_reason: FinishReason; +export interface HookUsage { + promptTokens: number; + completionTokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Usage". + * via the `definition` "SessionTokens". */ -export interface Usage { - prompt_tokens: number; - completion_tokens: number; - total_tokens: number; - prompt_tokens_details?: PromptTokensDetails | null; - completion_tokens_details?: CompletionTokensDetails | null; +export interface SessionTokens { + prompt: number; + completion: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptTokensDetails". + * via the `definition` "TurnComplexity". */ -export interface PromptTokensDetails { - cached_tokens: number; +export interface TurnComplexity { + toolCallCount: number; + hadErrorRecovery: boolean; + hadUserCorrection: boolean; + uniqueTools: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionTokensDetails". + * via the `definition` "Message". */ -export interface CompletionTokensDetails { - reasoning_tokens: number; +export interface Message { + role: Role; + content: MessageContent; + reasoning?: string | null; + toolCalls?: ToolCall[] | null; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion.chunk". + * via the `definition` "ToolCall". */ -export interface ChatCompletionChunk { +export interface ToolCall { id: string; - created: number; - model: string; - choices: ChunkChoice[]; - usage?: Usage | null; + name: string; + arguments: { + [k: string]: unknown; + }; + thoughtSignature?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HookPipelineError". + */ +export interface HookPipelineError { + hookId: string; + error: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HookPipelineResult". + */ +export interface HookPipelineResult { + context: HookContext; + aborted: boolean; + skipped: boolean; + errors: HookPipelineError[]; + ran: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ChunkChoice". + * via the `definition` "HookConfig". */ -export interface ChunkChoice { - index: number; - delta: CompletionDelta; - finish_reason: FinishReason | null; +export interface HookConfig { + id: string; + event: HookEventName; + type: HookConfigKind; + target: string; + priority?: number | null; + onError?: HookErrorMode | null; + agentFilter?: string[] | null; + toolFilter?: string[] | null; + description?: string | null; + enabled?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionDelta". + * via the `definition` "ApprovalOption". */ -export interface CompletionDelta { - role?: Role | null; - content?: string | null; - reasoning_content?: string | null; +export interface ApprovalOption { + key: string; + label: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "list". + * via the `definition` "HarnessSessionSummary". */ -export interface List { - data: Model[]; +export interface HarnessSessionSummary { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "model". + * via the `definition` "PlanEntry". */ -export interface Model { - id: string; - created: number; - owned_by: string; +export interface PlanEntry { + content: string; + status: PlanStatus; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorDetail". + * via the `definition` "LlmUsage". */ -export interface ErrorDetail { - message: string; - type: ErrorKind; +export interface LlmUsage { + promptTokens: number; + completionTokens: number; + reasoningTokens?: number | null; + cachedTokens?: number | null; + cacheCreationTokens?: number | null; + cacheReadTokens?: number | null; +} +export interface HarnessStatusFrame { + type: "status"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorResponse". + * via the `definition` "PromptQuestion". */ -export interface ErrorResponse { - error: ErrorDetail; +export interface PromptQuestion { + question?: string | null; + header?: string | null; + multiSelect: boolean; + freeText?: boolean | null; + options: PromptOption[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Conversation". + * via the `definition` "PromptOption". */ -export interface Conversation { - id: string; - title: string; - createdAt: number; - updatedAt: number; - messages: OpenAiMessage[]; +export interface PromptOption { + label: string; + description?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Conversations". + * via the `definition` "PromptResolution". */ -export interface Conversations { - conversations: Conversation[]; +export interface PromptResolution { + at: number; + answerText?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ConversationTitle". + * via the `definition` "PromptScreen". */ -export interface ConversationTitle { - title: string; +export interface PromptScreen { + current: number; + total: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiQuery". + * via the `definition` "StatusTool". */ -export interface WikiQuery { - q: string | null; - tag: string | null; - limit: number | null; - offset: number | null; +export interface StatusTool { + name: string; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageQuery". + * via the `definition` "HarnessStatusFrame". */ -export interface WikiPageQuery { - slug: WikiSlug; +export interface HarnessStatusFrame1 { + sessionId: SessionId; + status: HarnessStatus; + since: number; + source?: StatusSource | null; + phase?: StatusPhase | null; + tool?: StatusTool | null; + promptId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiHistoryEntry". + * via the `definition` "HarnessCapabilities". */ -export interface WikiHistoryEntry { - date: string; - title: string; - body: string; +export interface HarnessCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; + turnOptions?: boolean | null; + launchModel?: boolean | null; + imageAttachments?: boolean | null; + models?: HarnessModelOption[] | null; + modelsSource?: HarnessModelsSource | null; + efforts?: EffortOption[] | null; + modelFlag?: string | null; + effortFlag?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiCitation". + * via the `definition` "HarnessModelOption". */ -export interface WikiCitation { - summaryId: string; - date?: Millis | null; - kind?: string | null; - note?: string | null; +export interface HarnessModelOption { + inputModalities?: string[] | null; + id: string; + label: string; + isDefault?: boolean | null; + efforts?: EffortOption[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSource". + * via the `definition` "EffortOption". */ -export interface WikiSource { - kind: WikiSourceKind; - ids: string[]; - conversationId?: string | null; - span?: WikiSourceSpan | null; +export interface EffortOption { + id: string; + label: string; + isDefault?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceSpan". + * via the `definition` "HarnessControlCapabilities". */ -export interface WikiSourceSpan { - earliest: Millis; - latest: Millis; +export interface HarnessControlCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageResponse". + * via the `definition` "HarnessObservationCapabilities". */ -export interface WikiPageResponse { - slug: string; - title: string; - aliases: string[]; - tags: string[]; - entities: string[]; - currentState: string; - article?: string | null; - seeAlso?: string[] | null; - history: WikiHistoryEntry[]; - citations: WikiCitation[]; - markdown: string; - sources: WikiSource[]; - gitSha?: string | null; - lastVerified?: Millis | null; - updatedAt: Millis; - related?: string[] | null; +export interface HarnessObservationCapabilities { + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissSuggestion". + * via the `definition` "HarnessSessionCreateRequest". */ -export interface WikiMissSuggestion { - slug: string; - title: string; +export interface HarnessSessionCreateRequest { + harness?: HarnessId | null; + model?: string | null; + cwd?: string | null; + agentId?: string | null; + topicId?: string | null; + prompt?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissBody". + * via the `definition` "HarnessSessionList". */ -export interface WikiMissBody { - error: string; - suggestions: WikiMissSuggestion[]; +export interface HarnessSessionList { + sessions: HarnessSessionSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiRedLink". + * via the `definition` "HarnessOffering". */ -export interface WikiRedLink { - entity: string; - referencedBy: string[]; +export interface HarnessOffering { + harnessId: HarnessId; + chat: boolean; + capabilities: HarnessCapabilities; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiGapsResponse". + * via the `definition` "HarnessOfferingList". */ -export interface WikiGapsResponse { - redLinks: WikiRedLink[]; - stalest: string[]; +export interface HarnessOfferingList { + harnesses: HarnessOffering[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopic". + * via the `definition` "HarnessStoreSession". */ -export interface WikiTopic { - slug: string; +export interface HarnessStoreSession { + id: string; + command: RosterCommand; title: string; - tags: string[]; - entities: string[]; - updatedAt: Millis; - excerpt: string; + updatedAt: number; + parentSessionId?: string | null; + agentName?: string | null; + model?: string | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopicList". + * via the `definition` "HarnessStoreSessionList". */ -export interface WikiTopicList { - topics: WikiTopic[]; - total: number; +export interface HarnessStoreSessionList { + sessions: HarnessStoreSession[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentUsage". + * via the `definition` "task.done". */ -export interface AgentUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface TaskDone { + taskId: string; + status: TaskStatus; + parentSessionId?: string | null; + childSessionId?: string | null; + ts: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionSummary". + * via the `definition` "AcceptanceCriterion". */ -export interface LiveSessionSummary { +export interface AcceptanceCriterion { id: string; - name: string; - harness?: SessionHarness | null; - lastEventTs?: number | null; - pty?: string | null; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; + description: string; + kind: CriterionKind; + check?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionLogLine". + * via the `definition` "TaskBudget". */ -export interface SessionLogLine { - who: string; - text: string; +export interface TaskBudget { + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionView". + * via the `definition` "TaskUsage". */ -export interface SessionView { - title: string; - activity: Activity; - tool?: string | null; - tasks: string[]; - thought: string; - lastMessage: string; - log: SessionLogLine[]; - term: string[]; - ended: boolean; +export interface TaskUsage { + inputTokens?: number | null; + outputTokens?: number | null; + totalTokens?: number | null; + turns: number; + wallClockMs: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionList". + * via the `definition` "TaskResult". */ -export interface LiveSessionList { - sessions: LiveSessionSummary[]; +export interface TaskResult { + verdict: TaskVerdict; + summary: string; + usage: TaskUsage; + error?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StateResponse". + * via the `definition` "TaskWire". */ -export interface StateResponse { - session: string; - state: SessionView; +export interface TaskWire { + id: string; + goal: string; + acceptanceCriteria: AcceptanceCriterion[]; + agentId: string; + node: string; + harness?: HarnessId | null; + model?: string | null; + effort?: string | null; + requestedBy?: string | null; + parentSessionId?: string | null; + parentTaskId?: string | null; + depth: number; + childSessionId?: string | null; + budget: TaskBudget; + usage?: TaskUsage | null; + status: TaskStatus; + error?: string | null; + result?: TaskResult | null; + createdAt: number; + startedAt?: number | null; + completedAt?: number | null; + durationMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "snapshot". + * via the `definition` "TaskCreateRequest". */ -export interface Snapshot { - v: ProtocolVersion; - sessions: LiveSessionSummary[]; - rooms: { - [k: string]: SessionView; - }; +export interface TaskCreateRequest { + goal?: string | null; + agentId?: string | null; + nodeAffinity?: string | null; + acceptanceCriteria?: AcceptanceCriterion[] | null; + budget?: TaskBudget | null; + parentSessionId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + workingDir?: string | null; + requestedBy?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "session.removed". + * via the `definition` "TaskResponse". */ -export interface SessionRemoved { - v: ProtocolVersion; - session: string; +export interface TaskResponse { + task: TaskWire; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureBatchRequest". + * via the `definition` "TasksListResponse". */ -export interface CaptureBatchRequest { - session_key: string; - agent: string; - channel?: string | null; - title?: string | null; - settings?: { - [k: string]: unknown; - } | null; - task_id?: string | null; - finalize?: boolean | null; - created_at?: Millis | null; - updated_at?: Millis | null; - messages: CaptureMessage[]; +export interface TasksListResponse { + tasks: TaskWire[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureMessage". + * via the `definition` "TaskKillResponse". */ -export interface CaptureMessage { - event_id: string; - role: Role; - content: string; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - created_at?: Millis | null; +export interface TaskKillResponse { + ok: boolean; + prior?: TaskStatus | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureResult". + * via the `definition` "TaskWaitTimeoutResponse". */ -export interface CaptureResult { - ok: boolean; - conversation_id: string; - inserted: number; - skipped: number; +export interface TaskWaitTimeoutResponse { + error: string; + task?: TaskWire | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookContextBase". + * via the `definition` "MemorySearchResult". */ -export interface HookContextBase { - agentId?: string | null; +export interface MemorySearchResult { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + role: Role | null; + agent: string | null; + relevanceScore: number; + createdAt: string; sessionId?: string | null; - timestamp: number; - metadata: { - [k: string]: unknown; - }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookUsage". + * via the `definition` "PluginManifest". */ -export interface HookUsage { - promptTokens: number; - completionTokens: number; +export interface PluginManifest { + $schema?: string | null; + manifest: ProtocolVersion; + id: PluginId; + name: string; + version: string; + description: string; + icon?: string | null; + run: PluginRun; + permissions?: Permission[]; + settings?: ViewField[]; + tools?: PluginTool[]; + contributes: PluginContributions; + jobs?: PluginJob[]; + events?: PluginEventKind[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionTokens". + * via the `definition` "PluginRun". */ -export interface SessionTokens { - prompt: number; - completion: number; +export interface PluginRun { + command: string[]; + env?: { + [k: string]: string; + }; + readyTimeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TurnComplexity". + * via the `definition` "ViewField". */ -export interface TurnComplexity { - toolCallCount: number; - hadErrorRecovery: boolean; - hadUserCorrection: boolean; - uniqueTools: number; +export interface ViewField { + key: string; + label: string; + input: ViewInput; + value?: ViewValue | null; + required?: boolean; + help?: string | null; + placeholder?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Message". + * via the `definition` "ViewOption". */ -export interface Message { - role: Role; - content: MessageContent; - reasoning?: string | null; - toolCalls?: ToolCall[] | null; - toolCallId?: string | null; +export interface ViewOption { + value: string; + label: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ToolCall". + * via the `definition` "ViewFile". */ -export interface ToolCall { - id: string; +export interface ViewFile { name: string; - arguments: { - [k: string]: unknown; - }; - thoughtSignature?: string | null; + mimeType: string; + data: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineError". + * via the `definition` "PluginTool". */ -export interface HookPipelineError { - hookId: string; - error: string; +export interface PluginTool { + name: ToolName; + title?: string | null; + description: string; + inputSchema: { + [k: string]: unknown; + }; + hints?: PluginToolHint[]; +} +export interface PluginContributions { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineResult". + * via the `definition` "PluginPage". */ -export interface HookPipelineResult { - context: HookContext; - aborted: boolean; - skipped: boolean; - errors: HookPipelineError[]; - ran: string[]; +export interface PluginPage { + id: RouteName; + title: string; + icon?: string | null; + view: RouteName; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookConfig". + * via the `definition` "PluginTopicCard". */ -export interface HookConfig { - id: string; - event: HookEventName; - type: HookConfigKind; - target: string; - priority?: number | null; - onError?: HookErrorMode | null; - agentFilter?: string[] | null; - toolFilter?: string[] | null; - description?: string | null; - enabled?: boolean | null; +export interface PluginTopicCard { + id: RouteName; + title: string; + view: RouteName; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ApprovalOption". + * via the `definition` "PluginSessionAction". */ -export interface ApprovalOption { - key: string; - label: string; +export interface PluginSessionAction { + id: RouteName; + title: string; + icon?: string | null; + action: ViewAction; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionSummary". + * via the `definition` "PluginJob". */ -export interface HarnessSessionSummary { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - [k: string]: unknown; +export interface PluginJob { + id: RouteName; + title: string; + schedule?: string | null; + timeoutMs?: number | null; } -export interface HarnessStatusFrame { - type: "status"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginContributions". + */ +export interface PluginContributions1 { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptQuestion". + * via the `definition` "View". */ -export interface PromptQuestion { - question?: string | null; - header?: string | null; - multiSelect: boolean; - freeText?: boolean | null; - options: PromptOption[]; +export interface View { + title: string; + subtitle?: string | null; + toolbar?: ViewButton[]; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptOption". + * via the `definition` "ViewButton". */ -export interface PromptOption { +export interface ViewButton { label: string; - description?: string | null; + icon?: string | null; + style?: ViewButtonStyle | null; + action: ViewAction; + confirm?: ViewConfirm | null; + disabled?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptResolution". + * via the `definition` "ViewConfirm". */ -export interface PromptResolution { - at: number; - answerText?: string | null; +export interface ViewConfirm { + title: string; + text: string; + confirmLabel?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptScreen". + * via the `definition` "ViewTab". */ -export interface PromptScreen { - current: number; - total: number; +export interface ViewTab { + id: RouteName; + title: string; + badge?: string | null; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StatusTool". + * via the `definition` "ViewProperty". */ -export interface StatusTool { - name: string; - toolCallId?: string | null; +export interface ViewProperty { + label: string; + value: ViewInline; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStatusFrame". + * via the `definition` "ViewListItem". */ -export interface HarnessStatusFrame1 { - sessionId: SessionId; - status: HarnessStatus; - since: number; - source?: StatusSource | null; - phase?: StatusPhase | null; - tool?: StatusTool | null; - promptId?: string | null; +export interface ViewListItem { + id: string; + title: string; + subtitle?: string | null; + icon?: string | null; + trailing?: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapabilities". + * via the `definition` "ViewEmpty". */ -export interface HarnessCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; - turnOptions?: boolean | null; - launchModel?: boolean | null; - imageAttachments?: boolean | null; - models?: HarnessModelOption[] | null; - modelsSource?: HarnessModelsSource | null; - efforts?: EffortOption[] | null; - modelFlag?: string | null; - effortFlag?: string | null; +export interface ViewEmpty { + title: string; + text?: string | null; + button?: ViewButton | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessModelOption". + * via the `definition` "ViewColumn". */ -export interface HarnessModelOption { - inputModalities?: string[] | null; +export interface ViewColumn { + title: string; + align?: ViewAlign | null; + sortable?: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewRow". + */ +export interface ViewRow { id: string; + cells: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewCrumb". + */ +export interface ViewCrumb { label: string; - isDefault?: boolean | null; - efforts?: EffortOption[] | null; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EffortOption". + * via the `definition` "CanvasScene". */ -export interface EffortOption { +export interface CanvasScene { + items: CanvasItem[]; + grid?: CanvasGrid | null; + viewport?: CanvasViewport | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasAnchor". + */ +export interface CanvasAnchor { id: string; - label: string; - isDefault?: boolean | null; + x: number; + y: number; + side: CanvasSide; + direction: CanvasDirection; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessControlCapabilities". + * via the `definition` "CanvasMenuItem". */ -export interface HarnessControlCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; +export interface CanvasMenuItem { + id: string; + label: string; + icon?: string | null; + danger?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessObservationCapabilities". + * via the `definition` "CanvasEnd". */ -export interface HarnessObservationCapabilities { - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; +export interface CanvasEnd { + node: string; + anchor?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionList". + * via the `definition` "CanvasGrid". */ -export interface HarnessSessionList { - sessions: HarnessSessionSummary[]; +export interface CanvasGrid { + size: number; + snap?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOffering". + * via the `definition` "CanvasViewport". */ -export interface HarnessOffering { - harnessId: HarnessId; - chat: boolean; - capabilities: HarnessCapabilities; +export interface CanvasViewport { + x: number; + y: number; + zoom: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOfferingList". + * via the `definition` "ViewRequest". */ -export interface HarnessOfferingList { - harnesses: HarnessOffering[]; +export interface ViewRequest { + params?: { + [k: string]: unknown; + } | null; + context: ViewContext; +} +export interface ViewContext { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSession". + * via the `definition` "ViewContext". */ -export interface HarnessStoreSession { - id: string; - command: RosterCommand; - title: string; - updatedAt: number; - parentSessionId?: string | null; - agentName?: string | null; - model?: string | null; - taskId?: string | null; +export interface ViewContext1 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSessionList". + * via the `definition` "ViewActionRequest". */ -export interface HarnessStoreSessionList { - sessions: HarnessStoreSession[]; +export interface ViewActionRequest { + params?: { + [k: string]: unknown; + } | null; + values?: { + [k: string]: ViewValue; + }; + context: ViewContext2; +} +export interface ViewContext2 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". + * via the `definition` "ViewActionResult". */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; +export interface ViewActionResult { + actions: ViewAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AcceptanceCriterion". + * via the `definition` "ViewActionRefusal". */ -export interface AcceptanceCriterion { - id: string; - description: string; - kind: CriterionKind; - check?: string | null; +export interface ViewActionRefusal { + message: string; + fields?: { + [k: string]: string; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskBudget". + * via the `definition` "CanvasEventRequest". */ -export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface CanvasEventRequest { + event: CanvasEvent; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext3; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskUsage". + * via the `definition` "CanvasPosition". */ -export interface TaskUsage { - inputTokens: number; - outputTokens: number; - totalTokens: number; - costUsd?: number | null; - turns: number; - wallClockMs: number; +export interface CanvasPosition { + id: string; + x: number; + y: number; +} +export interface ViewContext3 { + topicId?: string | null; + sessionId?: SessionId | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasResponse". + */ +export interface CanvasResponse { + ops: CanvasOp[]; + actions: ViewAction[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelTheme". + */ +export interface PanelTheme { + scheme: PanelScheme; + colors: { + category1?: string; + category2?: string; + category3?: string; + category4?: string; + category5?: string; + category6?: string; + danger?: string; + info?: string; + onPrimary?: string; + onPrimaryContainer?: string; + onSurface?: string; + onSurfaceVariant?: string; + outline?: string; + outlineVariant?: string; + primary?: string; + primaryContainer?: string; + secondaryContainer?: string; + success?: string; + surface?: string; + surfaceContainer?: string; + surfaceContainerHigh?: string; + warning?: string; + }; + fontFamily: string; + fontMono: string; + fontSize: number; + radius: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". + * via the `definition` "PluginList". */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; +export interface PluginList { + node: string; + plugins: PluginRecord[]; } -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginRecord". + */ +export interface PluginRecord { + id: PluginId; + node: string; + path: string; + manifest: PluginManifest; + enabled: boolean; + state: PluginState; + granted: Permission[]; + pending: Permission[]; + error?: string | null; + lastExit?: PluginExit | null; + restarts: number; + startedAt?: number | null; + installedAt: number; + jobs: PluginJobStatus[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". + * via the `definition` "PluginExit". */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; +export interface PluginExit { at: number; - message?: string | null; + code?: number | null; + signal?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". + * via the `definition` "PluginJobStatus". */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; +export interface PluginJobStatus { + id: RouteName; + lastRun?: PluginJobRun | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". + * via the `definition` "PluginJobRun". */ -export interface CriterionReport { - id: string; - met: boolean; - evidence: string; +export interface PluginJobRun { + runId: string; + trigger: PluginJobTrigger; + startedAt: number; + finishedAt?: number | null; + outcome?: PluginJobOutcome | null; + message?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResult". + * via the `definition` "PluginInstallRequest". */ -export interface TaskResult { - verdict: TaskVerdict; - summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; - usage: TaskUsage; - error?: string | null; +export interface PluginInstallRequest { + path: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". + * via the `definition` "PluginEnableRequest". */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; +export interface PluginEnableRequest { + approve?: Permission[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". + * via the `definition` "PluginLogs". */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; +export interface PluginLogs { + lines: PluginLogLine[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". + * via the `definition` "PluginLogLine". */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; +export interface PluginLogLine { + at: number; + stream: PluginLogStream; + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". + * via the `definition` "PluginSettings". */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; +export interface PluginSettings { + values: { + [k: string]: ViewValue; + }; + secretsSet?: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". + * via the `definition` "PluginSettingsUpdate". */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; +export interface PluginSettingsUpdate { + values: { + [k: string]: ViewValue | null; }; - toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWire". + * via the `definition` "PluginToolList". */ -export interface TaskWire { - id: string; - goal: string; - contextRefs: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; - agentId: string; - requestedBy?: string | null; - origin: string; - parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; - budget: TaskBudget; - usage?: TaskUsage | null; - status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; - error?: string | null; - result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; - createdAt: number; - startedAt?: number | null; - lastHeartbeatAt?: number | null; - completedAt?: number | null; - durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; +export interface PluginToolList { + version: number; + tools: PluginToolEntry[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskCreateRequest". + * via the `definition` "PluginToolEntry". */ -export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; - nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; - acceptanceCriteria?: AcceptanceCriterion[] | null; +export interface PluginToolEntry { + plugin: PluginId; + tool: PluginTool; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResponse". + * via the `definition` "PluginEventDelivery". */ -export interface TaskResponse { - task: TaskWire; +export interface PluginEventDelivery { + seq: number; + at: number; + missed: number; + event: PluginEvent; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TasksListResponse". + * via the `definition` "PluginJobRequest". */ -export interface TasksListResponse { - tasks: TaskWire[]; +export interface PluginJobRequest { + runId: string; + trigger: PluginJobTrigger; + scheduledAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". + * via the `definition` "PluginJobResult". */ -export interface TaskSteerAccepted { - ok: boolean; +export interface PluginJobResult { + outcome: PluginJobOutcome; + message?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskKillResponse". + * via the `definition` "PluginToolCall". */ -export interface TaskKillResponse { - ok: boolean; - prior?: TaskStatus | null; +export interface PluginToolCall { + arguments: { + [k: string]: unknown; + }; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". + * via the `definition` "PluginToolResult". */ -export interface TaskApprovalAccepted { - ok: boolean; +export interface PluginToolResult { + text: string; + isError?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". + * via the `definition` "PluginSelf". */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; +export interface PluginSelf { + id: PluginId; + node: string; + version: string; + permissions: Permission[]; + settings: { + [k: string]: ViewValue; + }; + dataDir: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWaitTimeoutResponse". + * via the `definition` "PluginViewsChanged". */ -export interface TaskWaitTimeoutResponse { - error: string; - task?: TaskWire | null; +export interface PluginViewsChanged { + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". + * via the `definition` "PluginNotify". */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; +export interface PluginNotify { + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResult". + * via the `definition` "plugin.notification". */ -export interface MemorySearchResult { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - role: Role | null; - agent: string | null; - relevanceScore: number; - createdAt: string; +export interface PluginNotification { + plugin: PluginId; + node: string; + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; + ts: number; } diff --git a/packages/plugin-sdk/package.json b/packages/plugin-sdk/package.json new file mode 100644 index 0000000..652c154 --- /dev/null +++ b/packages/plugin-sdk/package.json @@ -0,0 +1,15 @@ +{ + "name": "@rivethub/plugin-sdk", + "version": "0.7.0", + "private": true, + "type": "module", + "exports": { + ".": "./src/index.ts" + }, + "bin": { + "rivethub-plugin-dev": "./src/dev.ts" + }, + "dependencies": { + "@rivethub/contract": "0.7.0" + } +} diff --git a/packages/plugin-sdk/src/dev.ts b/packages/plugin-sdk/src/dev.ts new file mode 100755 index 0000000..20eea8e --- /dev/null +++ b/packages/plugin-sdk/src/dev.ts @@ -0,0 +1,162 @@ +#!/usr/bin/env node +import { spawn } from 'node:child_process' +import { randomBytes } from 'node:crypto' +import { mkdirSync, mkdtempSync, readFileSync, rmSync } from 'node:fs' +import { createServer, request, type ServerResponse } from 'node:http' +import { tmpdir } from 'node:os' +import { join, resolve } from 'node:path' +import { createInterface } from 'node:readline' +import type { GatewayError, PluginEventDelivery, PluginManifest, PluginSelf } from './types.ts' + +const USAGE = `rivethub-plugin-dev [dir]: starts the plug-in in dir like rh does, then reads commands from stdin: + view [{"params":{},"context":{}}] + action [{"values":{},"params":{}}] + canvas {"event":{"type":"activated","item":""}} + tool [arguments] + event [fields] + job ` + +const dir = resolve(process.argv[2] ?? '.') +const manifest = JSON.parse(readFileSync(join(dir, 'rivethub-plugin.json'), 'utf8')) as PluginManifest +const root = mkdtempSync(join(tmpdir(), 'rhp-')) +const data = join(root, 'data') +const run = join(root, 'run') +const socket = join(run, 'plugin.sock') +const api = join(root, 'api.sock') +const token = randomBytes(32).toString('hex') +mkdirSync(data) +mkdirSync(run, { mode: 0o700 }) + +const own: PluginSelf = { + id: manifest.id, + node: 'dev', + version: manifest.version, + permissions: manifest.permissions ?? [], + settings: Object.fromEntries( + (manifest.settings ?? []).flatMap((field) => + field.value === undefined || field.value === null ? [] : [[field.key, field.value]], + ), + ), + dataDir: data, +} + +function reply(response: ServerResponse, status: number, body?: unknown): void { + response.writeHead(status, body === undefined ? {} : { 'content-type': 'application/json' }) + response.end(body === undefined ? undefined : JSON.stringify(body)) +} + +const stand = createServer(async (incoming, response) => { + const chunks: Buffer[] = [] + for await (const chunk of incoming) chunks.push(chunk as Buffer) + const text = Buffer.concat(chunks).toString('utf8') + if (incoming.headers.authorization !== `Bearer ${token}`) return reply(response, 401, { error: 'unauthorized' }) + if (incoming.method === 'GET' && incoming.url === '/api/plugin/self') return reply(response, 200, own) + if (incoming.method === 'POST' && incoming.url?.startsWith('/api/plugin/')) { + console.log(`rh ← ${incoming.url.slice('/api/plugin/'.length)} ${text}`) + return reply(response, 204) + } + const refused: GatewayError = { + error: 'the dev harness answers only the /api/plugin routes; use a throwaway rh node for the rest', + code: 'not_in_dev_harness', + } + return reply(response, 501, refused) +}) +await new Promise((done) => stand.listen(api, done)) + +const [program, ...args] = manifest.run.command +if (program === undefined) throw new Error('run.command is empty') +const inherited = ['PATH', 'HOME', 'USER', 'LANG', 'LC_ALL', 'TZ'].flatMap((name) => { + const value = process.env[name] + return value === undefined ? [] : [[name, value]] +}) +const child = spawn(program.includes('/') ? resolve(dir, program) : program, args, { + cwd: dir, + stdio: ['ignore', 'inherit', 'inherit'], + env: { + ...Object.fromEntries(inherited), + ...manifest.run.env, + RIVETHUB_PLUGIN_ID: manifest.id, + RIVETHUB_PLUGIN_NODE: 'dev', + RIVETHUB_PLUGIN_DATA: data, + RIVETHUB_PLUGIN_SOCKET: socket, + RIVETHUB_API_SOCKET: api, + RIVETHUB_PLUGIN_TOKEN: token, + TMPDIR: run, + }, +}) + +function call(method: string, path: string, body?: unknown): Promise<{ status: number; text: string }> { + return new Promise((done, fail) => { + const headers = { 'content-type': 'application/json', 'x-rivethub-user': 'owner', 'x-rivethub-node': 'dev' } + const outgoing = request({ socketPath: socket, method, path, headers }, (response) => { + const chunks: Buffer[] = [] + response.on('data', (chunk: Buffer) => chunks.push(chunk)) + response.on('end', () => done({ status: response.statusCode ?? 0, text: Buffer.concat(chunks).toString('utf8') })) + }) + outgoing.on('error', fail) + outgoing.end(body === undefined ? undefined : JSON.stringify(body)) + }) +} + +function stop(code: number): never { + child.removeAllListeners('exit') + child.kill('SIGTERM') + stand.close() + rmSync(root, { recursive: true, force: true }) + process.exit(code) +} + +child.on('exit', (code, signal) => { + console.error(`the plug-in exited (${signal ?? code})`) + stop(1) +}) + +const deadline = Date.now() + (manifest.run.readyTimeoutMs ?? 10_000) +for (;;) { + const healthy = await call('GET', '/health').then( + (answer) => answer.status >= 200 && answer.status < 300, + () => false, + ) + if (healthy) break + if (Date.now() > deadline) { + console.error(`the plug-in did not answer GET /health within ${manifest.run.readyTimeoutMs ?? 10_000} ms`) + stop(1) + } + await new Promise((done) => setTimeout(done, 100)) +} +console.log(`${manifest.id} is ready; its data folder is ${data}\n${USAGE}`) + +let seq = 0 +const routes: Record) => [string, unknown]> = { + view: (name, body) => [`/views/${name}`, { context: {}, ...body }], + action: (name, body) => [`/actions/${name}`, { context: {}, ...body }], + canvas: (name, body) => [`/canvas/${name}/events`, { context: {}, ...body }], + tool: (name, body) => [`/tools/${name}`, { arguments: body }], + job: (name) => [`/jobs/${name}`, { runId: `dev-${Date.now()}`, trigger: 'manual' }], + event: (name, body) => { + seq += 1 + const delivery = { seq, at: Date.now(), missed: 0, event: { type: name, ...body } } + return ['/events', delivery as PluginEventDelivery] + }, +} + +for await (const line of createInterface({ input: process.stdin })) { + const match = /^(\w+)\s+(\S+)\s*(.*)$/.exec(line.trim()) + const route = match?.[1] === undefined ? undefined : routes[match[1]] + if (match === null || route === undefined) { + if (line.trim() !== '') console.log(USAGE) + continue + } + try { + const [path, body] = route(match[2] ?? '', match[3] ? (JSON.parse(match[3]) as Record) : {}) + const answer = await call('POST', path, body) + let shown = answer.text + try { + shown = JSON.stringify(JSON.parse(answer.text), null, 2) + } catch {} + console.log(`${answer.status} ${shown}`) + } catch (error) { + console.error(error instanceof Error ? error.message : String(error)) + } +} +stop(0) diff --git a/packages/plugin-sdk/src/index.ts b/packages/plugin-sdk/src/index.ts new file mode 100644 index 0000000..a379926 --- /dev/null +++ b/packages/plugin-sdk/src/index.ts @@ -0,0 +1,4 @@ +export { type EventHandlers, type EventKind, type EventOf, type Plugin, Refusal, type Reply, router } from './plugin.ts' +export { connect, type PluginEnv, pluginEnv, RivetHub, RivetHubError } from './rivethub.ts' +export { serve } from './serve.ts' +export type * from './types.ts' diff --git a/packages/plugin-sdk/src/plugin.ts b/packages/plugin-sdk/src/plugin.ts new file mode 100644 index 0000000..0f41c56 --- /dev/null +++ b/packages/plugin-sdk/src/plugin.ts @@ -0,0 +1,142 @@ +import type { + CanvasEventRequest, + CanvasResponse, + PluginEvent, + PluginEventDelivery, + PluginJobRequest, + PluginJobResult, + PluginToolCall, + PluginToolResult, + Settings, + View, + ViewAction, + ViewActionRequest, + ViewRequest, +} from './types.ts' + +type Awaitable = T | Promise + +export type EventKind = Exclude +export type EventOf = Extract +export type EventHandlers = { + [K in EventKind]?: (event: EventOf, delivery: PluginEventDelivery) => Awaitable +} + +export interface Plugin { + views?: Record Awaitable> + actions?: Record Awaitable> + canvas?: Record Awaitable> + tools?: Record< + string, + (args: PluginToolCall['arguments'], call: PluginToolCall) => Awaitable + > + events?: EventHandlers + jobs?: Record Awaitable> + settings?: (values: Settings) => Awaitable +} + +export class Refusal extends Error { + readonly fields: Record + + constructor(message: string, fields: Record = {}) { + super(message) + this.fields = fields + } +} + +export type Reply = { status: number; body?: unknown } + +const named = (table: Record | undefined, name: string | undefined): T | undefined => + table !== undefined && name !== undefined && Object.hasOwn(table, name) ? table[name] : undefined + +const failure = (error: unknown): string => (error instanceof Error ? error.message : String(error)) + +const missing: Reply = { status: 404, body: 'not found' } + +export function router(plugin: Plugin): (method: string, path: string, text: string) => Promise { + let seen = 0 + + async function event(delivery: PluginEventDelivery): Promise { + if (delivery.seq <= seen) return { status: 204 } + const { event } = delivery + if (event.type === 'settings.changed') { + await plugin.settings?.(event.values) + } else { + const handler = plugin.events?.[event.type] as + | ((event: PluginEvent, delivery: PluginEventDelivery) => Awaitable) + | undefined + await handler?.(event, delivery) + } + seen = delivery.seq + return { status: 204 } + } + + async function action(name: string | undefined, request: ViewActionRequest): Promise { + const handler = named(plugin.actions, name) + if (handler === undefined) return missing + try { + return { status: 200, body: { actions: await handler(request) } } + } catch (error) { + if (error instanceof Refusal) return { status: 422, body: { message: error.message, fields: error.fields } } + throw error + } + } + + async function tool(name: string | undefined, call: PluginToolCall): Promise { + const handler = named(plugin.tools, name) + if (handler === undefined) return missing + try { + const result = await handler(call.arguments, call) + return { status: 200, body: typeof result === 'string' ? { text: result } : result } + } catch (error) { + return { status: 200, body: { text: failure(error), isError: true } satisfies PluginToolResult } + } + } + + async function job(name: string | undefined, request: PluginJobRequest): Promise { + const handler = named(plugin.jobs, name) + if (handler === undefined) return missing + let result: PluginJobResult + try { + const message = await handler(request) + result = message === undefined ? { outcome: 'succeeded' } : { outcome: 'succeeded', message } + } catch (error) { + result = { outcome: 'failed', message: failure(error) } + } + return { status: 200, body: result } + } + + async function answer(segments: string[], body: unknown): Promise { + const [kind, name, tail] = segments + if (kind === 'views' && segments.length === 2) { + const handler = named(plugin.views, name) + return handler === undefined ? missing : { status: 200, body: await handler(body as ViewRequest) } + } + if (kind === 'canvas' && tail === 'events' && segments.length === 3) { + const handler = named(plugin.canvas, name) + return handler === undefined ? missing : { status: 200, body: await handler(body as CanvasEventRequest) } + } + if (kind === 'actions' && segments.length === 2) return action(name, body as ViewActionRequest) + if (kind === 'tools' && segments.length === 2) return tool(name, body as PluginToolCall) + if (kind === 'jobs' && segments.length === 2) return job(name, body as PluginJobRequest) + if (kind === 'events' && segments.length === 1) return event(body as PluginEventDelivery) + return missing + } + + return async (method, path, text) => { + const segments = new URL(path, 'http://plugin').pathname.split('/').filter(Boolean) + if (method === 'GET' && segments.length === 1 && segments[0] === 'health') return { status: 200, body: 'ok' } + if (method !== 'POST') return missing + let body: unknown + try { + body = JSON.parse(text) + } catch (error) { + return { status: 400, body: failure(error) } + } + try { + return await answer(segments, body) + } catch (error) { + return { status: 500, body: failure(error) } + } + } +} diff --git a/packages/plugin-sdk/src/rivethub.ts b/packages/plugin-sdk/src/rivethub.ts new file mode 100644 index 0000000..38f39b0 --- /dev/null +++ b/packages/plugin-sdk/src/rivethub.ts @@ -0,0 +1,98 @@ +import { request as send } from 'node:http' +import type { Accepted, GatewayError, PluginNotify, PluginSelf } from './types.ts' + +export type PluginEnv = { + id: string + node: string + dataDir: string + socket: string + apiSocket: string + token: string +} + +export function pluginEnv(env: NodeJS.ProcessEnv = process.env): PluginEnv { + const read = (name: string): string => { + const value = env[name] + if (value === undefined || value === '') { + throw new Error(`${name} is not set: run the plug-in from rh or rivethub-plugin-dev`) + } + return value + } + return { + id: read('RIVETHUB_PLUGIN_ID'), + node: read('RIVETHUB_PLUGIN_NODE'), + dataDir: read('RIVETHUB_PLUGIN_DATA'), + socket: read('RIVETHUB_PLUGIN_SOCKET'), + apiSocket: read('RIVETHUB_API_SOCKET'), + token: read('RIVETHUB_PLUGIN_TOKEN'), + } +} + +export class RivetHubError extends Error { + readonly status: number + readonly code: string | undefined + readonly detail: string | undefined + + constructor(status: number, body: GatewayError) { + super(body.detail ? `${body.error}: ${body.detail}` : body.error) + this.status = status + this.code = body.code ?? undefined + this.detail = body.detail ?? undefined + } +} + +function gatewayError(status: number, text: string): GatewayError { + try { + const body = JSON.parse(text) as Partial + if (typeof body.error === 'string') return body as GatewayError + } catch {} + return { error: text || `rh answered ${status}` } +} + +export class RivetHub { + readonly #socket: string + readonly #token: string + + constructor(socket: string, token: string) { + this.#socket = socket + this.#token = token + } + + self(): Promise { + return this.request('GET', '/api/plugin/self') + } + + async viewsChanged(views: string[]): Promise { + await this.request('POST', '/api/plugin/views/changed', { views } satisfies Accepted.PluginViewsChanged) + } + + async notify(notice: PluginNotify): Promise { + await this.request('POST', '/api/plugin/notify', notice) + } + + request(method: string, path: string, body?: unknown): Promise { + const payload = body === undefined ? undefined : JSON.stringify(body) + const headers: Record = { authorization: `Bearer ${this.#token}` } + if (payload !== undefined) headers['content-type'] = 'application/json' + return new Promise((resolve, reject) => { + const outgoing = send({ socketPath: this.#socket, path, method, headers }, (response) => { + const chunks: Buffer[] = [] + response.on('data', (chunk: Buffer) => chunks.push(chunk)) + response.on('error', reject) + response.on('end', () => { + const status = response.statusCode ?? 0 + const text = Buffer.concat(chunks).toString('utf8') + if (status < 200 || status > 299) reject(new RivetHubError(status, gatewayError(status, text))) + else resolve((text === '' ? undefined : JSON.parse(text)) as T) + }) + }) + outgoing.on('error', reject) + outgoing.end(payload) + }) + } +} + +export function connect(env: NodeJS.ProcessEnv = process.env): RivetHub { + const { apiSocket, token } = pluginEnv(env) + return new RivetHub(apiSocket, token) +} diff --git a/packages/plugin-sdk/src/serve.ts b/packages/plugin-sdk/src/serve.ts new file mode 100644 index 0000000..4993208 --- /dev/null +++ b/packages/plugin-sdk/src/serve.ts @@ -0,0 +1,29 @@ +import { createServer, type Server, type ServerResponse } from 'node:http' +import { type Plugin, type Reply, router } from './plugin.ts' +import { connect, pluginEnv } from './rivethub.ts' + +function write(response: ServerResponse, reply: Reply): void { + if (reply.body === undefined) { + response.writeHead(reply.status).end() + } else if (typeof reply.body === 'string') { + response.writeHead(reply.status, { 'content-type': 'text/plain; charset=utf-8' }).end(reply.body) + } else { + response.writeHead(reply.status, { 'content-type': 'application/json' }).end(JSON.stringify(reply.body)) + } +} + +export async function serve(plugin: Plugin, env: NodeJS.ProcessEnv = process.env): Promise { + const { socket } = pluginEnv(env) + if (plugin.settings !== undefined) await plugin.settings((await connect(env).self()).settings) + const route = router(plugin) + const server = createServer(async (request, response) => { + const chunks: Buffer[] = [] + for await (const chunk of request) chunks.push(chunk as Buffer) + write(response, await route(request.method ?? 'GET', request.url ?? '/', Buffer.concat(chunks).toString('utf8'))) + }) + await new Promise((resolve, reject) => { + server.once('error', reject) + server.listen(socket, resolve) + }) + return server +} diff --git a/packages/plugin-sdk/src/types.ts b/packages/plugin-sdk/src/types.ts new file mode 100644 index 0000000..b8fa3df --- /dev/null +++ b/packages/plugin-sdk/src/types.ts @@ -0,0 +1,32 @@ +import type { Accepted, Sent } from '@rivethub/contract' + +export type { Accepted, Sent } + +export type PluginManifest = Accepted.PluginManifest +export type View = Accepted.View +export type ViewBlock = Accepted.ViewBlock +export type ViewInline = Accepted.ViewInline +export type ViewButton = Accepted.ViewButton +export type ViewField = Accepted.ViewField +export type ViewAction = Accepted.ViewAction +export type ViewValue = Accepted.ViewValue +export type CanvasScene = Accepted.CanvasScene +export type CanvasItem = Accepted.CanvasItem +export type CanvasShape = Accepted.CanvasShape +export type CanvasOp = Accepted.CanvasOp +export type CanvasResponse = Accepted.CanvasResponse +export type PluginToolResult = Accepted.PluginToolResult +export type PluginJobResult = Accepted.PluginJobResult +export type PluginNotify = Accepted.PluginNotify + +export type ViewRequest = Sent.ViewRequest +export type ViewActionRequest = Sent.ViewActionRequest +export type CanvasEventRequest = Sent.CanvasEventRequest +export type CanvasEvent = Sent.CanvasEvent +export type PluginToolCall = Sent.PluginToolCall +export type PluginEventDelivery = Sent.PluginEventDelivery +export type PluginEvent = Sent.PluginEvent +export type PluginJobRequest = Sent.PluginJobRequest +export type PluginSelf = Sent.PluginSelf +export type GatewayError = Sent.GatewayError +export type Settings = PluginSelf['settings'] diff --git a/rust/rivethub-plugin/Cargo.lock b/rust/rivethub-plugin/Cargo.lock new file mode 100644 index 0000000..033e01a --- /dev/null +++ b/rust/rivethub-plugin/Cargo.lock @@ -0,0 +1,308 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rivethub-plugin" +version = "0.7.0" +dependencies = [ + "http-body-util", + "hyper", + "hyper-util", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/rust/rivethub-plugin/Cargo.toml b/rust/rivethub-plugin/Cargo.toml new file mode 100644 index 0000000..6132d6c --- /dev/null +++ b/rust/rivethub-plugin/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "rivethub-plugin" +version = "0.7.0" +edition = "2024" +rust-version = "1.88" +description = "Write RivetHub plug-ins in Rust: serve views, actions, canvases, tools, events and settings, and call rh" +license = "Apache-2.0" +repository = "https://github.com/philbert440/rivethub-plugins" +publish = false + +[workspace] + +[dependencies] +http-body-util = "0.1.3" +hyper = { version = "1.7", features = ["client", "http1", "server"] } +hyper-util = { version = "0.1.17", features = ["tokio"] } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" +tokio = { version = "1.48", features = ["net", "rt"] } + +[dev-dependencies] +tokio = { version = "1.48", features = ["macros", "rt"] } + +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +pedantic = { level = "warn", priority = -1 } +missing_errors_doc = "allow" diff --git a/rust/rivethub-plugin/src/contract.rs b/rust/rivethub-plugin/src/contract.rs new file mode 100644 index 0000000..0514a9c --- /dev/null +++ b/rust/rivethub-plugin/src/contract.rs @@ -0,0 +1,1231 @@ +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/accepted.schema.json by npm run contract. Do not edit. + +use std::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; + +pub type JsonObject = serde_json::Map; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasAnchor { + pub id: String, + pub x: f64, + pub y: f64, + pub side: CanvasSide, + pub direction: CanvasDirection, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasArrow { + #[serde(rename = "none")] + None, + #[serde(rename = "end")] + End, + #[serde(rename = "start")] + Start, + #[serde(rename = "both")] + Both, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasDirection { + #[serde(rename = "in")] + In, + #[serde(rename = "out")] + Out, + #[serde(rename = "both")] + Both, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasEnd { + pub node: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub anchor: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasEvent { + #[serde(rename = "selected")] + Selected { + items: Vec, + }, + #[serde(rename = "moved")] + Moved { + items: Vec, + }, + #[serde(rename = "connected")] + Connected { + from: CanvasEnd, + to: CanvasEnd, + }, + #[serde(rename = "deleted")] + Deleted { + items: Vec, + }, + #[serde(rename = "activated")] + Activated { + item: String, + }, + #[serde(rename = "menu")] + Menu { + #[serde(skip_serializing_if = "Option::is_none")] + item: Option, + choice: String, + x: f64, + y: f64, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasEventRequest { + pub event: CanvasEvent, + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasGrid { + pub size: f64, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub snap: bool, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasItem { + #[serde(rename = "node")] + Node { + id: String, + x: f64, + y: f64, + width: f64, + height: f64, + shapes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + anchors: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + tooltip: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + locked: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + decorative: bool, + }, + #[serde(rename = "connector")] + Connector { + id: String, + from: CanvasEnd, + to: CanvasEnd, + route: CanvasRoute, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + dashed: bool, + arrow: CanvasArrow, + #[serde(skip_serializing_if = "Option::is_none")] + label: Option, + #[serde(skip_serializing_if = "Option::is_none")] + tooltip: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + decorative: bool, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasMenuItem { + pub id: String, + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub danger: bool, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasOp { + #[serde(rename = "upsert")] + Upsert { + item: CanvasItem, + }, + #[serde(rename = "remove")] + Remove { + ids: Vec, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasPosition { + pub id: String, + pub x: f64, + pub y: f64, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ops: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasRoute { + #[serde(rename = "straight")] + Straight, + #[serde(rename = "curved")] + Curved, + #[serde(rename = "orthogonal")] + Orthogonal, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasScene { + pub items: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub grid: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub viewport: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasShape { + #[serde(rename = "rect")] + Rect { + x: f64, + y: f64, + width: f64, + height: f64, + #[serde(skip_serializing_if = "Option::is_none")] + radius: Option, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + }, + #[serde(rename = "ellipse")] + Ellipse { + x: f64, + y: f64, + width: f64, + height: f64, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + }, + #[serde(rename = "text")] + Text { + x: f64, + y: f64, + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + size: Option, + #[serde(skip_serializing_if = "Option::is_none")] + weight: Option, + #[serde(skip_serializing_if = "Option::is_none")] + color: Option, + #[serde(skip_serializing_if = "Option::is_none")] + align: Option, + #[serde(rename = "maxWidth", skip_serializing_if = "Option::is_none")] + max_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "path")] + Path { + d: String, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + dashed: bool, + }, + #[serde(rename = "icon")] + Icon { + x: f64, + y: f64, + name: String, + #[serde(skip_serializing_if = "Option::is_none")] + size: Option, + #[serde(skip_serializing_if = "Option::is_none")] + color: Option, + }, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasSide { + #[serde(rename = "top")] + Top, + #[serde(rename = "right")] + Right, + #[serde(rename = "bottom")] + Bottom, + #[serde(rename = "left")] + Left, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasViewport { + pub x: f64, + pub y: f64, + pub zoom: f64, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasWeight { + #[serde(rename = "regular")] + Regular, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "bold")] + Bold, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ColorRole { + #[serde(rename = "surface")] + Surface, + #[serde(rename = "surfaceContainer")] + SurfaceContainer, + #[serde(rename = "surfaceContainerHigh")] + SurfaceContainerHigh, + #[serde(rename = "primary")] + Primary, + #[serde(rename = "primaryContainer")] + PrimaryContainer, + #[serde(rename = "onPrimary")] + OnPrimary, + #[serde(rename = "onPrimaryContainer")] + OnPrimaryContainer, + #[serde(rename = "secondaryContainer")] + SecondaryContainer, + #[serde(rename = "onSurface")] + OnSurface, + #[serde(rename = "onSurfaceVariant")] + OnSurfaceVariant, + #[serde(rename = "outline")] + Outline, + #[serde(rename = "outlineVariant")] + OutlineVariant, + #[serde(rename = "info")] + Info, + #[serde(rename = "success")] + Success, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "danger")] + Danger, + #[serde(rename = "category1")] + Category1, + #[serde(rename = "category2")] + Category2, + #[serde(rename = "category3")] + Category3, + #[serde(rename = "category4")] + Category4, + #[serde(rename = "category5")] + Category5, + #[serde(rename = "category6")] + Category6, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +pub struct GatewayError { + pub error: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub detail: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub hint: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "harnessId", skip_serializing_if = "Option::is_none")] + pub harness_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub node: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub retryable: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum HarnessId { + #[serde(rename = "claude-code")] + ClaudeCode, + #[serde(rename = "grok-build")] + GrokBuild, + #[serde(rename = "kimi-code")] + KimiCode, + #[serde(rename = "hermes")] + Hermes, + #[serde(rename = "codex")] + Codex, + #[serde(rename = "opencode")] + Opencode, + #[serde(rename = "omp")] + Omp, + #[serde(rename = "dsh")] + Dsh, + #[serde(rename = "cursor")] + Cursor, + #[serde(rename = "cowork")] + Cowork, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Permission { + #[serde(rename = "memory.read")] + MemoryRead, + #[serde(rename = "memory.write")] + MemoryWrite, + #[serde(rename = "sessions.read")] + SessionsRead, + #[serde(rename = "sessions.control")] + SessionsControl, + #[serde(rename = "topics.read")] + TopicsRead, + #[serde(rename = "topics.write")] + TopicsWrite, + #[serde(rename = "tasks.read")] + TasksRead, + #[serde(rename = "tasks.delegate")] + TasksDelegate, + #[serde(rename = "agents.read")] + AgentsRead, + #[serde(rename = "notifications.send")] + NotificationsSend, + #[serde(rename = "host.files.read")] + HostFilesRead, + #[serde(rename = "host.files.write")] + HostFilesWrite, + #[serde(rename = "host.network")] + HostNetwork, + #[serde(rename = "host.exec")] + HostExec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PlacedBy { + #[serde(rename = "you")] + You, + #[serde(rename = "categorizer")] + Categorizer, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginContributions { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pages: Vec, + #[serde(rename = "topicCards", default, skip_serializing_if = "Vec::is_empty")] + pub topic_cards: Vec, + #[serde(rename = "sessionActions", default, skip_serializing_if = "Vec::is_empty")] + pub session_actions: Vec, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum PluginEvent { + #[serde(rename = "session.started")] + SessionStarted { + #[serde(rename = "sessionId")] + session_id: SessionId, + #[serde(rename = "topicId", skip_serializing_if = "Option::is_none")] + topic_id: Option, + }, + #[serde(rename = "session.idle")] + SessionIdle { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "session.ended")] + SessionEnded { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "session.placed")] + SessionPlaced { + #[serde(rename = "sessionId")] + session_id: SessionId, + #[serde(rename = "topicId")] + topic_id: String, + by: PlacedBy, + }, + #[serde(rename = "summary.written")] + SummaryWritten { + #[serde(rename = "summaryId")] + summary_id: String, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + session_id: Option, + kind: SummaryKind, + level: u32, + }, + #[serde(rename = "task.done")] + TaskDone { + #[serde(rename = "taskId")] + task_id: String, + status: TaskStatus, + }, + #[serde(rename = "settings.changed")] + SettingsChanged { + values: BTreeMap, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginEventDelivery { + pub seq: u64, + pub at: i64, + pub missed: u64, + pub event: PluginEvent, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginEventKind { + #[serde(rename = "session.started")] + SessionStarted, + #[serde(rename = "session.idle")] + SessionIdle, + #[serde(rename = "session.ended")] + SessionEnded, + #[serde(rename = "session.placed")] + SessionPlaced, + #[serde(rename = "summary.written")] + SummaryWritten, + #[serde(rename = "task.done")] + TaskDone, +} + +pub type PluginId = String; + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJob { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub schedule: Option, + #[serde(rename = "timeoutMs", skip_serializing_if = "Option::is_none")] + pub timeout_ms: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginJobOutcome { + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJobRequest { + #[serde(rename = "runId")] + pub run_id: String, + pub trigger: PluginJobTrigger, + #[serde(rename = "scheduledAt", skip_serializing_if = "Option::is_none")] + pub scheduled_at: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJobResult { + pub outcome: PluginJobOutcome, + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginJobTrigger { + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "manual")] + Manual, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginManifest { + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + pub manifest: ProtocolVersion, + pub id: PluginId, + pub name: String, + pub version: String, + pub description: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub run: PluginRun, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub permissions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub settings: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tools: Vec, + #[serde(default)] + pub contributes: PluginContributions, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub jobs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub events: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginNotify { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tone: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginPage { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub view: RouteName, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginRun { + pub command: Vec, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub env: BTreeMap, + #[serde(rename = "readyTimeoutMs", skip_serializing_if = "Option::is_none")] + pub ready_timeout_ms: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginSelf { + pub id: PluginId, + pub node: String, + pub version: String, + pub permissions: Vec, + pub settings: BTreeMap, + #[serde(rename = "dataDir")] + pub data_dir: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginSessionAction { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub action: ViewAction, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginTool { + pub name: ToolName, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + pub description: String, + #[serde(rename = "inputSchema")] + pub input_schema: JsonObject, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hints: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginToolCall { + pub arguments: JsonObject, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginToolHint { + #[serde(rename = "readOnly")] + ReadOnly, + #[serde(rename = "destructive")] + Destructive, + #[serde(rename = "idempotent")] + Idempotent, + #[serde(rename = "openWorld")] + OpenWorld, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginToolResult { + pub text: String, + #[serde(rename = "isError", default, skip_serializing_if = "std::ops::Not::not")] + pub is_error: bool, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginTopicCard { + pub id: RouteName, + pub title: String, + pub view: RouteName, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginViewsChanged { + pub views: Vec, +} + +pub type ProtocolVersion = u8; + +pub type RouteName = String; + +pub type SessionId = String; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum SummaryKind { + #[serde(rename = "leaf")] + Leaf, + #[serde(rename = "branch")] + Branch, + #[serde(rename = "root")] + Root, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum TaskStatus { + #[serde(rename = "queued")] + Queued, + #[serde(rename = "running")] + Running, + #[serde(rename = "awaiting-input")] + AwaitingInput, + #[serde(rename = "completed")] + Completed, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "killed")] + Killed, + #[serde(rename = "timeout")] + Timeout, +} + +pub type ToolName = String; + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct View { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub toolbar: Vec, + pub blocks: Vec, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewAction { + #[serde(rename = "call")] + Call { + action: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, + #[serde(rename = "navigate")] + Navigate { + view: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + replace: bool, + }, + #[serde(rename = "dialog")] + Dialog { + view: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, + #[serde(rename = "back")] + Back, + #[serde(rename = "refresh")] + Refresh, + #[serde(rename = "toast")] + Toast { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + }, + #[serde(rename = "copy")] + Copy { + text: String, + }, + #[serde(rename = "openSession")] + OpenSession { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "openTopic")] + OpenTopic { + #[serde(rename = "topicId")] + topic_id: String, + }, + #[serde(rename = "openUrl")] + OpenUrl { + url: String, + }, + #[serde(rename = "download")] + Download { + path: String, + #[serde(skip_serializing_if = "Option::is_none")] + filename: Option, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionRefusal { + pub message: String, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub fields: BTreeMap, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionRequest { + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub values: BTreeMap, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewAlign { + #[serde(rename = "start")] + Start, + #[serde(rename = "center")] + Center, + #[serde(rename = "end")] + End, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewBlock { + #[serde(rename = "section")] + Section { + #[serde(skip_serializing_if = "Option::is_none")] + title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + subtitle: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + actions: Vec, + blocks: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + collapsed: Option, + }, + #[serde(rename = "split")] + Split { + primary: Vec, + secondary: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + ratio: Option, + }, + #[serde(rename = "tabs")] + Tabs { + tabs: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + selected: Option, + }, + #[serde(rename = "text")] + Text { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "markdown")] + Markdown { + text: String, + }, + #[serde(rename = "code")] + Code { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + language: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + follow: bool, + }, + #[serde(rename = "image")] + Image { + path: String, + alt: String, + }, + #[serde(rename = "properties")] + Properties { + items: Vec, + }, + #[serde(rename = "progress")] + Progress { + #[serde(skip_serializing_if = "Option::is_none")] + value: Option, + #[serde(skip_serializing_if = "Option::is_none")] + label: Option, + }, + #[serde(rename = "notice")] + Notice { + tone: ViewTone, + #[serde(skip_serializing_if = "Option::is_none")] + title: Option, + text: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + actions: Vec, + }, + #[serde(rename = "list")] + List { + items: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + empty: Option, + }, + #[serde(rename = "table")] + Table { + columns: Vec, + rows: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + empty: Option, + }, + #[serde(rename = "breadcrumbs")] + Breadcrumbs { + items: Vec, + }, + #[serde(rename = "actions")] + Actions { + buttons: Vec, + }, + #[serde(rename = "form")] + Form { + id: RouteName, + fields: Vec, + buttons: Vec, + }, + #[serde(rename = "canvas")] + Canvas { + id: RouteName, + scene: CanvasScene, + #[serde(skip_serializing_if = "Option::is_none")] + height: Option, + #[serde(rename = "readOnly", default, skip_serializing_if = "std::ops::Not::not")] + read_only: bool, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + }, + #[serde(rename = "webPanel")] + WebPanel { + id: RouteName, + entry: String, + #[serde(skip_serializing_if = "Option::is_none")] + height: Option, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewButton { + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub style: Option, + pub action: ViewAction, + #[serde(skip_serializing_if = "Option::is_none")] + pub confirm: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub disabled: bool, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewButtonStyle { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + #[serde(rename = "danger")] + Danger, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewColumn { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub align: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub sortable: bool, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewConfirm { + pub title: String, + pub text: String, + #[serde(rename = "confirmLabel", skip_serializing_if = "Option::is_none")] + pub confirm_label: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewContext { + #[serde(rename = "topicId", skip_serializing_if = "Option::is_none")] + pub topic_id: Option, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewCrumb { + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewEmpty { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub button: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewField { + pub key: String, + pub label: String, + pub input: ViewInput, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub required: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub help: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub placeholder: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewFile { + pub name: String, + #[serde(rename = "mimeType")] + pub mime_type: String, + pub data: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewInline { + #[serde(rename = "text")] + Text { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + #[serde(skip_serializing_if = "Option::is_none")] + icon: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "badge")] + Badge { + text: String, + tone: ViewTone, + }, + #[serde(rename = "time")] + Time { + at: i64, + #[serde(skip_serializing_if = "Option::is_none")] + style: Option, + }, + #[serde(rename = "duration")] + Duration { + ms: u64, + }, + #[serde(rename = "bytes")] + Bytes { + value: u64, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewInput { + #[serde(rename = "text")] + Text { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiline: bool, + }, + #[serde(rename = "secret")] + Secret, + #[serde(rename = "number")] + Number { + #[serde(skip_serializing_if = "Option::is_none")] + min: Option, + #[serde(skip_serializing_if = "Option::is_none")] + max: Option, + #[serde(skip_serializing_if = "Option::is_none")] + step: Option, + }, + #[serde(rename = "toggle")] + Toggle, + #[serde(rename = "select")] + Select { + options: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiple: bool, + }, + #[serde(rename = "file")] + File { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiple: bool, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + accept: Vec, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewListItem { + pub id: String, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub trailing: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub menu: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewOption { + pub value: String, + pub label: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewProperty { + pub label: String, + pub value: ViewInline, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewRequest { + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewRow { + pub id: String, + pub cells: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub menu: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewTab { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub badge: Option, + pub blocks: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewTimeStyle { + #[serde(rename = "relative")] + Relative, + #[serde(rename = "absolute")] + Absolute, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewTone { + #[serde(rename = "neutral")] + Neutral, + #[serde(rename = "info")] + Info, + #[serde(rename = "success")] + Success, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "danger")] + Danger, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ViewValue { + Bool(bool), + Number(f64), + Text(String), + List(Vec), + Files(Vec), +} diff --git a/rust/rivethub-plugin/src/error.rs b/rust/rivethub-plugin/src/error.rs new file mode 100644 index 0000000..3b971fb --- /dev/null +++ b/rust/rivethub-plugin/src/error.rs @@ -0,0 +1,78 @@ +use std::fmt; + +use crate::contract::{GatewayError, ViewActionRefusal}; + +#[derive(Debug)] +pub enum Error { + Refused(ViewActionRefusal), + Failed(String), + Missing(&'static str), + RivetHub { + status: u16, + error: Box, + }, + Io(std::io::Error), + Json(serde_json::Error), + Http(hyper::Error), +} + +impl Error { + pub fn failed(message: impl Into) -> Self { + Self::Failed(message.into()) + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Refused(refusal) => f.write_str(&refusal.message), + Self::Failed(message) => f.write_str(message), + Self::Missing(name) => write!( + f, + "{name} is not set: run the plug-in from rh or rivethub-plugin-dev" + ), + Self::RivetHub { status, error } => match &error.detail { + Some(detail) => write!(f, "rh answered {status}: {}: {detail}", error.error), + None => write!(f, "rh answered {status}: {}", error.error), + }, + Self::Io(error) => error.fmt(f), + Self::Json(error) => error.fmt(f), + Self::Http(error) => error.fmt(f), + } + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Io(error) => Some(error), + Self::Json(error) => Some(error), + Self::Http(error) => Some(error), + Self::Refused(_) | Self::Failed(_) | Self::Missing(_) | Self::RivetHub { .. } => None, + } + } +} + +impl From for Error { + fn from(error: std::io::Error) -> Self { + Self::Io(error) + } +} + +impl From for Error { + fn from(error: serde_json::Error) -> Self { + Self::Json(error) + } +} + +impl From for Error { + fn from(error: hyper::Error) -> Self { + Self::Http(error) + } +} + +impl From for Error { + fn from(refusal: ViewActionRefusal) -> Self { + Self::Refused(refusal) + } +} diff --git a/rust/rivethub-plugin/src/lib.rs b/rust/rivethub-plugin/src/lib.rs new file mode 100644 index 0000000..a970a47 --- /dev/null +++ b/rust/rivethub-plugin/src/lib.rs @@ -0,0 +1,11 @@ +#[rustfmt::skip] +pub mod contract; +mod error; +mod plugin; +mod rivethub; +mod socket; + +pub use error::Error; +pub use hyper::{Method, StatusCode}; +pub use plugin::{Plugin, Reply}; +pub use rivethub::{Env, RivetHub}; diff --git a/rust/rivethub-plugin/src/plugin.rs b/rust/rivethub-plugin/src/plugin.rs new file mode 100644 index 0000000..e31e937 --- /dev/null +++ b/rust/rivethub-plugin/src/plugin.rs @@ -0,0 +1,466 @@ +use std::collections::{BTreeMap, HashMap}; +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; + +use http_body_util::{BodyExt, Full}; +use hyper::body::{Bytes, Incoming}; +use hyper::header::CONTENT_TYPE; +use hyper::server::conn::http1; +use hyper::service::service_fn; +use hyper::{Method, Request, Response, StatusCode}; +use hyper_util::rt::TokioIo; +use serde::Serialize; +use serde::de::DeserializeOwned; +use tokio::net::UnixListener; + +use crate::contract::{ + CanvasEventRequest, CanvasResponse, PluginEvent, PluginEventDelivery, PluginJobOutcome, + PluginJobRequest, PluginJobResult, PluginToolCall, PluginToolResult, View, ViewAction, + ViewActionRefusal, ViewActionRequest, ViewActionResult, ViewRequest, ViewValue, +}; +use crate::{Env, Error}; + +type Answer = Pin> + Send>>; +type Handler = Box, A) -> Answer + Send + Sync>; +type Routes = HashMap>; + +fn boxed(handler: F) -> Handler +where + F: Fn(Arc, A) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, +{ + Box::new(move |state, input| Box::pin(handler(state, input))) +} + +pub struct Plugin { + state: Arc, + views: Routes, + actions: Routes>, + canvases: Routes, + tools: Routes, + jobs: Routes>, + events: Option>, + settings: Option, ()>>, + seen: AtomicU64, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Reply { + pub status: StatusCode, + pub json: bool, + pub body: Vec, +} + +impl Reply { + fn json(status: StatusCode, value: &T) -> Self { + match serde_json::to_vec(value) { + Ok(body) => Self { + status, + json: true, + body, + }, + Err(error) => Self::text(StatusCode::INTERNAL_SERVER_ERROR, &error.to_string()), + } + } + + fn text(status: StatusCode, text: &str) -> Self { + Self { + status, + json: false, + body: text.as_bytes().to_vec(), + } + } + + fn empty() -> Self { + Self { + status: StatusCode::NO_CONTENT, + json: false, + body: Vec::new(), + } + } + + fn missing() -> Self { + Self::text(StatusCode::NOT_FOUND, "not found") + } + + fn failed(error: &Error) -> Self { + Self::text(StatusCode::INTERNAL_SERVER_ERROR, &error.to_string()) + } + + fn into_response(self) -> Response> { + let kind = if self.json { + "application/json" + } else { + "text/plain; charset=utf-8" + }; + let mut response = Response::new(Full::new(Bytes::from(self.body))); + *response.status_mut() = self.status; + if let Ok(value) = kind.parse() { + response.headers_mut().insert(CONTENT_TYPE, value); + } + response + } +} + +impl PluginToolCall { + pub fn parse(&self) -> Result { + Ok(serde_json::from_value(serde_json::Value::Object( + self.arguments.clone(), + ))?) + } +} + +impl ViewActionRefusal { + pub fn new(message: impl Into) -> Self { + Self { + message: message.into(), + fields: BTreeMap::new(), + } + } + + #[must_use] + pub fn field(mut self, key: impl Into, message: impl Into) -> Self { + self.fields.insert(key.into(), message.into()); + self + } +} + +impl Plugin { + pub fn new(state: S) -> Self { + Self { + state: Arc::new(state), + views: HashMap::new(), + actions: HashMap::new(), + canvases: HashMap::new(), + tools: HashMap::new(), + jobs: HashMap::new(), + events: None, + settings: None, + seen: AtomicU64::new(0), + } + } + + #[must_use] + pub fn view(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, ViewRequest) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.views.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn action(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, ViewActionRequest) -> Fut + Send + Sync + 'static, + Fut: Future, Error>> + Send + 'static, + { + self.actions.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn canvas(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, CanvasEventRequest) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.canvases.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn tool(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, PluginToolCall) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.tools.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn job(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, PluginJobRequest) -> Fut + Send + Sync + 'static, + Fut: Future, Error>> + Send + 'static, + { + self.jobs.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn events(mut self, handler: F) -> Self + where + F: Fn(Arc, PluginEventDelivery) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.events = Some(boxed(handler)); + self + } + + #[must_use] + pub fn settings(mut self, handler: F) -> Self + where + F: Fn(Arc, BTreeMap) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.settings = Some(boxed(handler)); + self + } + + pub async fn serve(self) -> Result<(), Error> { + let env = Env::from_env()?; + if let Some(settings) = &self.settings { + let own = env.rivethub().own().await?; + settings(Arc::clone(&self.state), own.settings).await?; + } + let listener = UnixListener::bind(&env.socket)?; + let plugin = Arc::new(self); + loop { + let (stream, _) = listener.accept().await?; + let plugin = Arc::clone(&plugin); + tokio::spawn(async move { + let service = service_fn(move |request| { + let plugin = Arc::clone(&plugin); + async move { plugin.respond(request).await } + }); + if let Err(error) = http1::Builder::new() + .serve_connection(TokioIo::new(stream), service) + .await + { + eprintln!("rivethub-plugin: {error}"); + } + }); + } + } + + async fn respond(&self, request: Request) -> Result>, Error> { + let (parts, body) = request.into_parts(); + let body = body.collect().await?.to_bytes(); + Ok(self + .handle(&parts.method, parts.uri.path(), &body) + .await + .into_response()) + } + + pub async fn handle(&self, method: &Method, path: &str, body: &[u8]) -> Reply { + let segments: Vec<&str> = path.split('/').filter(|part| !part.is_empty()).collect(); + if method == Method::GET && segments == ["health"] { + return Reply::text(StatusCode::OK, "ok"); + } + if method != Method::POST { + return Reply::missing(); + } + match segments.as_slice() { + ["views", name] => match self.call(self.views.get(*name), body).await { + Ok(Ok(view)) => Reply::json(StatusCode::OK, &view), + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["actions", name] => match self.call(self.actions.get(*name), body).await { + Ok(Ok(actions)) => Reply::json(StatusCode::OK, &ViewActionResult { actions }), + Ok(Err(Error::Refused(refusal))) => { + Reply::json(StatusCode::UNPROCESSABLE_ENTITY, &refusal) + } + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["canvas", name, "events"] => match self.call(self.canvases.get(*name), body).await { + Ok(Ok(answer)) => Reply::json(StatusCode::OK, &answer), + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["tools", name] => match self.call(self.tools.get(*name), body).await { + Ok(outcome) => { + let is_error = outcome.is_err(); + let text = outcome.unwrap_or_else(|error| error.to_string()); + Reply::json(StatusCode::OK, &PluginToolResult { text, is_error }) + } + Err(reply) => reply, + }, + ["jobs", name] => match self.call(self.jobs.get(*name), body).await { + Ok(outcome) => { + let result = match outcome { + Ok(message) => PluginJobResult { + outcome: PluginJobOutcome::Succeeded, + message, + }, + Err(error) => PluginJobResult { + outcome: PluginJobOutcome::Failed, + message: Some(error.to_string()), + }, + }; + Reply::json(StatusCode::OK, &result) + } + Err(reply) => reply, + }, + ["events"] => self.event(body).await, + _ => Reply::missing(), + } + } + + async fn call( + &self, + handler: Option<&Handler>, + body: &[u8], + ) -> Result, Reply> + where + A: DeserializeOwned, + { + let handler = handler.ok_or_else(Reply::missing)?; + let input = serde_json::from_slice(body) + .map_err(|error| Reply::text(StatusCode::BAD_REQUEST, &error.to_string()))?; + Ok(handler(Arc::clone(&self.state), input).await) + } + + async fn event(&self, body: &[u8]) -> Reply { + let delivery: PluginEventDelivery = match serde_json::from_slice(body) { + Ok(delivery) => delivery, + Err(error) => return Reply::text(StatusCode::BAD_REQUEST, &error.to_string()), + }; + let seq = delivery.seq; + if seq <= self.seen.load(Ordering::Acquire) { + return Reply::empty(); + } + let handled = match (delivery.event, &self.settings) { + (PluginEvent::SettingsChanged { values }, Some(settings)) => { + settings(Arc::clone(&self.state), values).await + } + (event, _) => match &self.events { + Some(events) => { + let delivery = PluginEventDelivery { event, ..delivery }; + events(Arc::clone(&self.state), delivery).await + } + None => Ok(()), + }, + }; + match handled { + Ok(()) => { + self.seen.store(seq, Ordering::Release); + Reply::empty() + } + Err(error) => Reply::failed(&error), + } + } +} + +#[cfg(test)] +mod tests { + use std::sync::Mutex; + + use serde_json::{Value, json}; + + use super::*; + + async fn post(plugin: &Plugin>>, path: &str, body: &Value) -> Reply { + plugin + .handle(&Method::POST, path, body.to_string().as_bytes()) + .await + } + + fn parsed(reply: &Reply) -> Value { + serde_json::from_slice(&reply.body).unwrap_or(Value::Null) + } + + #[tokio::test] + async fn an_action_refusal_answers_422_naming_its_fields() { + let plugin = Plugin::new(Mutex::new(Vec::new())).action("add", |_, request| async move { + if request.values.contains_key("title") { + Ok(vec![ViewAction::Refresh]) + } else { + Err(ViewActionRefusal::new("Give it a title") + .field("title", "Required") + .into()) + } + }); + let refused = post(&plugin, "/actions/add", &json!({"context": {}})).await; + assert_eq!(refused.status, StatusCode::UNPROCESSABLE_ENTITY); + assert_eq!( + parsed(&refused), + json!({"message": "Give it a title", "fields": {"title": "Required"}}) + ); + let accepted = post(&plugin, "/actions/add", &json!({"values": {"title": "x"}})).await; + assert_eq!(parsed(&accepted), json!({"actions": [{"type": "refresh"}]})); + } + + #[tokio::test] + async fn a_failing_tool_answers_its_message_as_an_error_result() { + let plugin = Plugin::new(Mutex::new(Vec::new())).tool("add_item", |_, call| async move { + let title: String = call.parse::()?["title"] + .as_str() + .ok_or_else(|| Error::failed("title must be a string"))? + .to_owned(); + Ok(format!("added {title}")) + }); + let added = post( + &plugin, + "/tools/add_item", + &json!({"arguments": {"title": "x"}}), + ) + .await; + assert_eq!(parsed(&added), json!({"text": "added x"})); + let failed = post(&plugin, "/tools/add_item", &json!({"arguments": {}})).await; + assert_eq!( + parsed(&failed), + json!({"text": "title must be a string", "isError": true}) + ); + } + + #[tokio::test] + async fn a_repeated_delivery_is_handled_once_and_a_failed_one_is_retried() { + let plugin = Plugin::new(Mutex::new(Vec::new())) + .events(|seen, delivery| async move { + if let PluginEvent::SessionIdle { session_id } = delivery.event { + let mut seen = seen + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + if session_id == "b" && !seen.contains(&"failed".to_owned()) { + seen.push("failed".to_owned()); + return Err(Error::failed("not yet")); + } + seen.push(session_id); + } + Ok(()) + }) + .settings(|seen, values| async move { + let text = serde_json::to_string(&values)?; + seen.lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .push(text); + Ok(()) + }); + let deliver = + |seq: u64, event: Value| json!({"seq": seq, "at": 0, "missed": 0, "event": event}); + let idle = |session: &str| json!({"type": "session.idle", "sessionId": session}); + let settings = json!({"type": "settings.changed", "values": {"on": true}}); + let statuses = [ + post(&plugin, "/events", &deliver(1, idle("a"))) + .await + .status, + post(&plugin, "/events", &deliver(1, idle("a"))) + .await + .status, + post(&plugin, "/events", &deliver(2, settings)).await.status, + post(&plugin, "/events", &deliver(3, idle("b"))) + .await + .status, + post(&plugin, "/events", &deliver(3, idle("b"))) + .await + .status, + ]; + assert_eq!( + statuses.map(|status| status.as_u16()), + [204, 204, 204, 500, 204] + ); + let seen = plugin + .state + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .clone(); + assert_eq!(seen, ["a", r#"{"on":true}"#, "failed", "b"]); + } +} diff --git a/rust/rivethub-plugin/src/rivethub.rs b/rust/rivethub-plugin/src/rivethub.rs new file mode 100644 index 0000000..caf2a19 --- /dev/null +++ b/rust/rivethub-plugin/src/rivethub.rs @@ -0,0 +1,131 @@ +use std::path::PathBuf; + +use http_body_util::Full; +use hyper::body::Bytes; +use hyper::header::{AUTHORIZATION, CONTENT_TYPE, HOST}; +use hyper::{Method, Request}; +use serde::Serialize; +use serde::de::DeserializeOwned; + +use crate::Error; +use crate::contract::{GatewayError, PluginNotify, PluginSelf, PluginViewsChanged}; + +#[derive(Debug, Clone)] +pub struct Env { + pub id: String, + pub node: String, + pub data_dir: PathBuf, + pub socket: PathBuf, + pub api_socket: PathBuf, + pub token: String, +} + +impl Env { + pub fn from_env() -> Result { + let read = |name: &'static str| { + std::env::var(name) + .ok() + .filter(|value| !value.is_empty()) + .ok_or(Error::Missing(name)) + }; + Ok(Self { + id: read("RIVETHUB_PLUGIN_ID")?, + node: read("RIVETHUB_PLUGIN_NODE")?, + data_dir: read("RIVETHUB_PLUGIN_DATA")?.into(), + socket: read("RIVETHUB_PLUGIN_SOCKET")?.into(), + api_socket: read("RIVETHUB_API_SOCKET")?.into(), + token: read("RIVETHUB_PLUGIN_TOKEN")?, + }) + } + + #[must_use] + pub fn rivethub(&self) -> RivetHub { + RivetHub::new(&self.api_socket, &self.token) + } +} + +#[derive(Debug, Clone)] +pub struct RivetHub { + socket: PathBuf, + token: String, +} + +impl RivetHub { + pub fn new(socket: impl Into, token: impl Into) -> Self { + Self { + socket: socket.into(), + token: token.into(), + } + } + + pub async fn own(&self) -> Result { + self.get("/api/plugin/self").await + } + + pub async fn views_changed(&self, views: I) -> Result<(), Error> + where + I: IntoIterator, + I::Item: Into, + { + let changed = PluginViewsChanged { + views: views.into_iter().map(Into::into).collect(), + }; + self.post("/api/plugin/views/changed", &changed).await + } + + pub async fn notify(&self, notice: &PluginNotify) -> Result<(), Error> { + self.post("/api/plugin/notify", notice).await + } + + pub async fn get(&self, path: &str) -> Result { + self.request(Method::GET, path, None::<&()>).await + } + + pub async fn post(&self, path: &str, body: &B) -> Result + where + B: Serialize + ?Sized, + T: DeserializeOwned, + { + self.request(Method::POST, path, Some(body)).await + } + + pub async fn request( + &self, + method: Method, + path: &str, + body: Option<&B>, + ) -> Result + where + B: Serialize + ?Sized, + T: DeserializeOwned, + { + let mut builder = Request::builder() + .method(method) + .uri(path) + .header(HOST, "rivethub") + .header(AUTHORIZATION, format!("Bearer {}", self.token)); + let payload = match body { + Some(body) => { + builder = builder.header(CONTENT_TYPE, "application/json"); + serde_json::to_vec(body)? + } + None => Vec::new(), + }; + let request = builder + .body(Full::new(Bytes::from(payload))) + .map_err(|error| Error::failed(error.to_string()))?; + let (status, bytes) = crate::socket::send(&self.socket, request).await?; + if !status.is_success() { + let error = serde_json::from_slice(&bytes).unwrap_or_else(|_| GatewayError { + error: String::from_utf8_lossy(&bytes).into_owned(), + ..GatewayError::default() + }); + return Err(Error::RivetHub { + status: status.as_u16(), + error: Box::new(error), + }); + } + let bytes: &[u8] = if bytes.is_empty() { b"null" } else { &bytes }; + Ok(serde_json::from_slice(bytes)?) + } +} diff --git a/rust/rivethub-plugin/src/socket.rs b/rust/rivethub-plugin/src/socket.rs new file mode 100644 index 0000000..5b5aef8 --- /dev/null +++ b/rust/rivethub-plugin/src/socket.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use http_body_util::{BodyExt, Full}; +use hyper::body::Bytes; +use hyper::{Request, StatusCode}; +use hyper_util::rt::TokioIo; +use tokio::net::UnixStream; + +use crate::Error; + +pub(crate) async fn send( + socket: &Path, + request: Request>, +) -> Result<(StatusCode, Bytes), Error> { + let stream = UnixStream::connect(socket).await?; + let (mut sender, connection) = + hyper::client::conn::http1::handshake(TokioIo::new(stream)).await?; + tokio::spawn(connection); + let response = sender.send_request(request).await?; + let status = response.status(); + let body = response.into_body().collect().await?.to_bytes(); + Ok((status, body)) +} diff --git a/scripts/contract.ts b/scripts/contract.ts index df6b82f..e4dec19 100644 --- a/scripts/contract.ts +++ b/scripts/contract.ts @@ -1,6 +1,7 @@ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { compile } from 'json-schema-to-typescript' +import { rustContract } from './rust.ts' type Pin = { repository: string; ref: string } @@ -50,6 +51,10 @@ for (const [direction, name] of Object.entries(DIRECTIONS)) { bannerComment: `// Generated from ${pin.repository}@${pin.ref} contract/${direction}.schema.json by npm run contract. Do not edit.`, }) emit(join(PACKAGE, 'src', `${direction}.ts`), types) + if (direction === 'accepted') { + const banner = `Generated from ${pin.repository}@${pin.ref} contract/accepted.schema.json by npm run contract. Do not edit.` + emit(join(ROOT, 'rust', 'rivethub-plugin', 'src', 'contract.rs'), rustContract(JSON.parse(schema), banner)) + } } if (stale.length > 0) { diff --git a/scripts/rust.ts b/scripts/rust.ts new file mode 100644 index 0000000..e5b0a71 --- /dev/null +++ b/scripts/rust.ts @@ -0,0 +1,313 @@ +type Json = null | boolean | number | string | Json[] | { [key: string]: Json } +type Node = { [key: string]: Json } + +type Field = { json: string; rust: string; type: string; attrs: string[] } +type Variant = { value: string; name: string; fields: Field[] } +type Item = + | { kind: 'alias'; name: string; target: string } + | { kind: 'struct'; name: string; fields: Field[]; deny: boolean } + | { kind: 'enum'; name: string; values: string[] } + | { kind: 'tagged'; name: string; tag: string; variants: Variant[]; deny: boolean } + | { kind: 'untagged'; name: string; variants: { name: string; type: string }[] } +type Shape = { rust: string; nullable: boolean; kind: 'bool' | 'vec' | 'map' | 'other' } + +export const RUST_ROOTS = [ + 'PluginManifest', + 'View', + 'ViewRequest', + 'ViewActionRequest', + 'ViewActionResult', + 'ViewActionRefusal', + 'CanvasEventRequest', + 'CanvasResponse', + 'PluginToolCall', + 'PluginToolResult', + 'PluginEventDelivery', + 'PluginJobRequest', + 'PluginJobResult', + 'PluginSelf', + 'PluginViewsChanged', + 'PluginNotify', + 'GatewayError', +] + +const KEYWORDS = new Set( + 'as async await break const continue crate dyn else enum extern false fn for gen if impl in let loop match mod move mut pub ref return self static struct super trait true try type unsafe use where while yield'.split( + ' ', + ), +) +const INTEGERS: Record = { + int8: 'i8', + int16: 'i16', + int32: 'i32', + int64: 'i64', + uint8: 'u8', + uint16: 'u16', + uint32: 'u32', + uint64: 'u64', +} +const DEFAULTABLE = new Set(['String', 'bool', 'f64', 'JsonObject', ...Object.values(INTEGERS)]) + +const isNode = (value: Json | undefined): value is Node => + typeof value === 'object' && value !== null && !Array.isArray(value) + +function unsupported(at: string, schema: Json | undefined): never { + throw new Error(`${at}: no Rust mapping for ${JSON.stringify(schema)}`) +} + +function refName(ref: Json | undefined, at: string): string { + if (typeof ref !== 'string' || !ref.startsWith('#/$defs/')) unsupported(at, ref) + return ref.slice('#/$defs/'.length) +} + +const pascal = (value: string): string => { + const name = value + .split(/[^A-Za-z0-9]+/) + .filter(Boolean) + .map((part) => part.charAt(0).toUpperCase() + part.slice(1)) + .join('') + return /^[0-9]/.test(name) ? `V${name}` : name +} + +const snake = (json: string): string => { + const name = json + .replace(/^\$/, '') + .replace(/([a-z0-9])([A-Z])/g, '$1_$2') + .toLowerCase() + return KEYWORDS.has(name) ? `r#${name}` : name +} + +function references(schema: Json, found: string[]): void { + if (Array.isArray(schema)) { + for (const item of schema) references(item, found) + } else if (isNode(schema)) { + for (const [key, value] of Object.entries(schema)) { + if (key === '$ref') found.push(refName(value, key)) + else references(value, found) + } + } +} + +function reachable(defs: Node, roots: string[]): string[] { + const kept = new Set() + const pending = [...roots] + for (let name = pending.pop(); name !== undefined; name = pending.pop()) { + if (kept.has(name)) continue + const schema = defs[name] + if (schema === undefined) throw new Error(`the contract has no definition ${name}`) + kept.add(name) + references(schema, pending) + } + return [...kept].sort() +} + +function shape(schema: Json | undefined, at: string): Shape { + if (!isNode(schema)) unsupported(at, schema) + const plain = (rust: string): Shape => ({ rust, nullable: false, kind: 'other' }) + if (schema.$ref !== undefined) return plain(refName(schema.$ref, at)) + if (Array.isArray(schema.anyOf)) { + const present = schema.anyOf.filter((branch) => !(isNode(branch) && branch.type === 'null')) + if (present.length !== 1 || schema.anyOf.length !== 2) unsupported(at, schema) + return { ...shape(present[0], at), nullable: true } + } + if (Array.isArray(schema.type)) { + const present = schema.type.filter((type) => type !== 'null') + if (present.length !== 1 || schema.type.length !== 2) unsupported(at, schema) + return { ...shape({ ...schema, type: present[0] ?? null }, at), nullable: true } + } + switch (schema.type) { + case 'string': + return plain('String') + case 'boolean': + return { rust: 'bool', nullable: false, kind: 'bool' } + case 'number': + return plain('f64') + case 'integer': { + const rust = INTEGERS[typeof schema.format === 'string' ? schema.format : 'int64'] + if (rust === undefined) unsupported(at, schema) + return plain(rust) + } + case 'array': { + const item = shape(schema.items, `${at}[]`) + return { rust: `Vec<${item.nullable ? `Option<${item.rust}>` : item.rust}>`, nullable: false, kind: 'vec' } + } + case 'object': { + if (schema.properties !== undefined) unsupported(at, schema) + if (schema.additionalProperties === true) return plain('JsonObject') + const value = shape(schema.additionalProperties, `${at}{}`) + const rust = value.nullable ? `Option<${value.rust}>` : value.rust + return { rust: `BTreeMap`, nullable: false, kind: 'map' } + } + default: + return unsupported(at, schema) + } +} + +function fields(schema: Node, at: string, skip?: string): Field[] { + const properties = isNode(schema.properties) ? schema.properties : {} + const required = new Set(Array.isArray(schema.required) ? schema.required : []) + return Object.entries(properties) + .filter(([json]) => json !== skip) + .map(([json, property]) => { + const where = `${at}.${json}` + const found = shape(property, where) + const rust = snake(json) + const attrs = rust.replace(/^r#/, '') === json ? [] : [`rename = "${json}"`] + let type = found.rust + if (found.nullable) { + type = `Option<${found.rust}>` + if (!required.has(json)) attrs.push('skip_serializing_if = "Option::is_none"') + } else if (!required.has(json)) { + if (found.kind === 'bool') attrs.push('default', 'skip_serializing_if = "std::ops::Not::not"') + else if (found.kind === 'vec') attrs.push('default', 'skip_serializing_if = "Vec::is_empty"') + else if (found.kind === 'map') attrs.push('default', 'skip_serializing_if = "BTreeMap::is_empty"') + else if (isNode(property) && property.default !== undefined) attrs.push('default') + else { + type = `Option<${found.rust}>` + attrs.push('skip_serializing_if = "Option::is_none"') + } + } + return { json, rust, type, attrs } + }) +} + +function untaggedName(branch: Json, at: string): string { + if (!isNode(branch)) unsupported(at, branch) + if (branch.$ref !== undefined) return refName(branch.$ref, at) + if (branch.type === 'boolean') return 'Bool' + if (branch.type === 'number') return 'Number' + if (branch.type === 'integer') return 'Integer' + if (branch.type === 'string') return 'Text' + if (branch.type === 'array' && isNode(branch.items)) { + if (branch.items.type === 'string') return 'List' + const words = refName(branch.items.$ref, at).match(/[A-Z][a-z0-9]*/g) ?? [] + return `${words.at(-1) ?? ''}s` + } + return unsupported(at, branch) +} + +function item(name: string, schema: Json | undefined): Item { + if (!isNode(schema)) unsupported(name, schema) + if (Array.isArray(schema.oneOf)) { + const branches = schema.oneOf.map((branch) => (isNode(branch) ? branch : unsupported(name, branch))) + const tags = branches.map((branch) => + Object.entries(isNode(branch.properties) ? branch.properties : {}).find( + ([, property]) => isNode(property) && typeof property.const === 'string', + ), + ) + const tag = tags[0]?.[0] + if (tag === undefined || tags.some((found) => found?.[0] !== tag)) unsupported(name, schema) + const variants = branches.map((branch, index) => { + const found = tags[index]?.[1] + const value = isNode(found) && typeof found.const === 'string' ? found.const : unsupported(name, branch) + return { value, name: pascal(value), fields: fields(branch, `${name}.${value}`, tag) } + }) + return { kind: 'tagged', name, tag, variants, deny: branches.every((b) => b.additionalProperties === false) } + } + if (Array.isArray(schema.anyOf)) { + const variants = schema.anyOf.map((branch, index) => ({ + name: untaggedName(branch, `${name}.anyOf[${index}]`), + type: shape(branch, `${name}.anyOf[${index}]`).rust, + })) + if (new Set(variants.map((variant) => variant.name)).size !== variants.length) unsupported(name, schema) + return { kind: 'untagged', name, variants } + } + if (schema.type === 'string' && Array.isArray(schema.enum)) { + return { kind: 'enum', name, values: schema.enum.map((value) => String(value)) } + } + if (schema.type === 'object' && isNode(schema.properties)) { + return { kind: 'struct', name, fields: fields(schema, name), deny: schema.additionalProperties === false } + } + return { kind: 'alias', name, target: shape(schema, name).rust } +} + +function defaults(items: Map): Set { + const known = new Map() + const defaultable = (type: string): boolean => { + if (DEFAULTABLE.has(type) || /^(Option|Vec|BTreeMap) defaultable(field.type)) + known.set(type, result) + return result + } + return new Set([...items.keys()].filter((name) => items.get(name)?.kind === 'struct' && defaultable(name))) +} + +function fieldLines(field: Field, indent: string, visibility: string): string[] { + const attrs = field.attrs.length > 0 ? [`${indent}#[serde(${field.attrs.join(', ')})]`] : [] + return [...attrs, `${indent}${visibility}${field.rust}: ${field.type},`] +} + +function render(item: Item, defaultable: Set): string[] { + const derive = (extra: string[]) => + `#[derive(${['Debug', 'Clone', ...extra, 'Serialize', 'Deserialize'].join(', ')})]` + switch (item.kind) { + case 'alias': + return [`pub type ${item.name} = ${item.target};`] + case 'struct': + return [ + derive(defaultable.has(item.name) ? ['Default', 'PartialEq'] : ['PartialEq']), + ...(item.deny ? ['#[serde(deny_unknown_fields)]'] : []), + `pub struct ${item.name} {`, + ...item.fields.flatMap((field) => fieldLines(field, ' ', 'pub ')), + '}', + ] + case 'enum': + return [ + derive(['Copy', 'PartialEq', 'Eq', 'Hash']), + `pub enum ${item.name} {`, + ...item.values.flatMap((value) => [` #[serde(rename = "${value}")]`, ` ${pascal(value)},`]), + '}', + ] + case 'tagged': + return [ + derive(['PartialEq']), + `#[serde(tag = "${item.tag}"${item.deny ? ', deny_unknown_fields' : ''})]`, + `pub enum ${item.name} {`, + ...item.variants.flatMap((variant) => [ + ` #[serde(rename = "${variant.value}")]`, + ...(variant.fields.length === 0 + ? [` ${variant.name},`] + : [ + ` ${variant.name} {`, + ...variant.fields.flatMap((field) => fieldLines(field, ' ', '')), + ' },', + ]), + ]), + '}', + ] + case 'untagged': + return [ + derive(['PartialEq']), + '#[serde(untagged)]', + `pub enum ${item.name} {`, + ...item.variants.map((variant) => ` ${variant.name}(${variant.type}),`), + '}', + ] + } +} + +export function rustContract(schema: Json, banner: string): string { + const defs = isNode(schema) && isNode(schema.$defs) ? schema.$defs : unsupported('$defs', schema) + const items = new Map(reachable(defs, RUST_ROOTS).map((name) => [name, item(name, defs[name])])) + const defaultable = defaults(items) + const body = [...items.values()].map((found) => render(found, defaultable).join('\n')) + const usesMap = body.some((text) => text.includes('BTreeMap<')) + return [ + `// ${banner}`, + '', + ...(usesMap ? ['use std::collections::BTreeMap;', ''] : []), + 'use serde::{Deserialize, Serialize};', + '', + 'pub type JsonObject = serde_json::Map;', + '', + body.join('\n\n'), + '', + ].join('\n') +} diff --git a/scripts/templates.ts b/scripts/templates.ts new file mode 100644 index 0000000..7f50a18 --- /dev/null +++ b/scripts/templates.ts @@ -0,0 +1,19 @@ +import { cpSync, mkdirSync, rmSync } from 'node:fs' +import { homedir } from 'node:os' +import { join } from 'node:path' + +const ROOT = join(import.meta.dirname, '..') +const TEMPLATES = ['javascript'] +const SDK = ['index.ts', 'plugin.ts', 'rivethub.ts', 'serve.ts', 'types.ts'] + +const state = process.argv[2] ?? process.env.RIVETHUB_STATE_DIR ?? join(homedir(), '.rivethub') +const target = join(state, 'plugin-templates') + +for (const name of TEMPLATES) { + const into = join(target, name) + rmSync(into, { recursive: true, force: true }) + cpSync(join(ROOT, 'templates', name), into, { recursive: true }) + mkdirSync(join(into, 'sdk')) + for (const file of SDK) cpSync(join(ROOT, 'packages', 'plugin-sdk', 'src', file), join(into, 'sdk', file)) + console.log(`installed the ${name} template in ${into}`) +} diff --git a/templates/javascript/GUIDE.md b/templates/javascript/GUIDE.md new file mode 100644 index 0000000..b881403 --- /dev/null +++ b/templates/javascript/GUIDE.md @@ -0,0 +1,110 @@ +# Building this plug-in + +This folder is a RivetHub plug-in: a small program rh starts on this node, reaches over a unix socket and draws in +the RivetHub apps with their own widgets. It starts as a working example (a checklist page with a form, a list and a +canvas board, an `add_item` agent tool and a `session.placed` subscription). Rewrite it into what the person asked for. + +## The loop + +1. Edit the files here: `rivethub-plugin.json` (the manifest), `plugin.js` (the program) and any modules you add. +2. Call `plugins-install` with this plug-in's id. It checks the manifest (an invalid one changes nothing and the answer + names the field), installs the folder or reloads it, waits for the process to start and asks each page for its view + the way the apps do. Read the whole answer: it says whether the plug-in runs, why not, and what to do next. +3. Call `plugins-status` to read its state and its last log lines: your `console.log` and `console.error` output, a + crash's stack trace, and rh's own lines, marked `host` (start, exit status, and every answer rh refused or that + failed, with the field it refused). +4. Fix what the answer or the log names and go back to 2. Repeat until it runs and its pages answer valid views. + +You can install and reload. You cannot turn a plug-in on or grant it permissions: a person does that in the RivetHub +app (Settings › Plug-ins › the plug-in › Turn on, or Approve and turn on when it asks for permissions), from a device +paired with this node. A new plug-in stays off until they do. Once it is on, every reload restarts it with your changes, +unless the manifest asks for a permission it does not hold yet: then it waits, off, for the person to approve again. +When an answer says a person has to act, tell them exactly that. + +## Files + +- `sdk/` is `@rivethub/plugin-sdk`, as TypeScript sources that Node runs directly. Import from `./sdk/index.ts`, read + `sdk/plugin.ts` and `sdk/rivethub.ts` for its API, and do not edit it. +- `plugin.js` calls `serve({ views, actions, canvas, tools, events, jobs, settings })`; every key is optional. +- Keep state in `pluginEnv().dataDir` (a folder rh keeps across reloads), as `checklist.js` does with one JSON file. +- The process runs as `node plugin.js` (Node 22.18 or later) with this folder as its working directory. Use Node's + built-in modules. Anything else must live inside this folder: on Linux rh confines the process to it, its data folder + and the program it runs. + +## The manifest + +`manifest` 1; `id` (2 to 24 of `a-z`, `0-9` and single hyphens; it must stay the folder's name); `name`; `version`; +`description`; `icon` (a Material Symbols name, as every icon here); `run.command` (`["node", "plugin.js"]`); +`permissions`; `settings` (fields as in a form, drawn in Settings, read with `rh.self()` and the `settings` handler); +`tools` (`{name, title?, description, inputSchema, hints?}`, offered to agents as `-`; `name` uses `a-z`, +`0-9` and single underscores); `contributes.pages` (`{id, title, icon?, view}`: a sidebar entry opening that view), +`contributes.topicCards` (`{id, title, view}`: a card in a topic, its view gets `context.topicId`) and +`contributes.sessionActions` (`{id, title, icon?, action}`: a session menu entry, `context.sessionId`); `jobs` (`{id, +title, schedule?, timeoutMs?}`, `schedule` a five-field cron in the node's time); `events` (`session.started`, +`session.idle`, `session.ended`, `session.placed` need `sessions.read`; `summary.written` needs `memory.read`; +`task.done` needs `tasks.read`). Unknown fields are refused. Remove what you do not use, the example's `sessions.read` +and `session.placed` among them, so the person is not asked to approve it. + +## Views + +A view handler gets `{params, context}` and returns `{title, subtitle?, toolbar?, blocks}`. rh checks every answer: +an unknown field, a missing one or a wrong type is refused and logged, and the app shows an error instead of the view. + +Blocks (`type`): `section` `{title?, subtitle?, actions?, blocks, collapsed?}`; `split` `{primary, secondary, +ratio?}`; `tabs` `{tabs: [{id, title, badge?, blocks}], selected?}`; `text` `{text, tone?, monospace?}`; `markdown` +`{text}`; `code` `{text, language?, follow?}`; `properties` `{items: [{label, value: inline}]}`; `progress` `{value? +(0 to 1), label?}`; `notice` `{tone, title?, text, actions?}`; `list` `{items: [{id, title, subtitle?, icon?, trailing?: +[inline], action?, menu?: [button]}], empty?}`; `table` `{columns: [{title, align?, sortable?}], rows: [{id, cells: +[inline], action?, menu?}], empty?}`; `breadcrumbs` `{items: [{label, action?}]}`; `actions` `{buttons}`; `form` `{id, +fields, buttons}`; `canvas` (below). `empty` is `{title, text?, button?}`. Do not use `image`, `webPanel` or the +`download` action: they need routes this SDK does not serve. + +Inlines (`type`): `text` `{text, tone?, icon?, monospace?}`, `badge` `{text, tone}`, `time` `{at: epoch ms, style?: +relative|absolute}`, `duration` `{ms}`, `bytes` `{value}`. Tones: `neutral`, `info`, `success`, `warning`, `danger`. + +A button is `{label, icon?, style?: primary|secondary|danger, action, confirm?: {title, text, confirmLabel?}, +disabled?}`. A field is `{key, label, input, value?, required?, help?, placeholder?}`, `input` one of `{type: 'text', +multiline?}`, `{type: 'secret'}`, `{type: 'number', min?, max?, step?}`, `{type: 'toggle'}` and `{type: 'select', +options: [{value, label}], multiple?}`. + +Actions (`type`): `call` `{action, params?}` runs your action handler with `{params, values, context}` (`values` are +the form's when the button is in a form) and shows the actions it returns; throw `new Refusal(message, {field: +message})` to show errors beside fields. `navigate` `{view, params?, replace?}`, `dialog` `{view, params?}`, `back`, +`refresh`, `toast` `{text, tone?}`, `copy` `{text}`, `openSession` `{sessionId}`, `openTopic` `{topicId}`, `openUrl` +`{url}`. An action handler cannot answer with another `call`. + +Apps never poll. A page shows what its view answered when it was opened; when your state changes on its own (a timer, +an event, an agent's tool call), call `await rh.viewsChanged(['main'])` (with `const rh = connect()`) and every app +showing that view fetches it again. A `time` inline with `style: 'relative'` or a `progress` block is drawn as of the +last fetch. + +## Canvas + +`{type: 'canvas', id, scene: {items, grid?: {size, snap}, viewport?}, height?, readOnly?, menu?}`, at most 5000 items. +An item is a `node` `{id, x, y, width, height, shapes, anchors?, tooltip?, menu?, locked?, decorative?}` or a +`connector` `{id, from: {node, anchor?}, to, route?: straight|curved|orthogonal, dashed?, arrow?: none|end|start|both, +label?}`. Shapes, relative to their node: `rect` `{x, y, width, height, radius?, fill?, stroke?, strokeWidth?}`, +`ellipse`, `text` `{x, y, text, size?, weight?: regular|medium|bold, color?, align?, maxWidth?, monospace?}`, `path` `{d, +fill?, stroke?}` and `icon` `{x, y, name, size?, color?}`. Colours are theme roles, never literal values: `surface`, +`surfaceContainer`, `surfaceContainerHigh`, `primary`, `primaryContainer`, `onPrimary`, `onPrimaryContainer`, +`secondaryContainer`, `onSurface`, `onSurfaceVariant`, `outline`, `outlineVariant`, the tones and `category1` to +`category6`. The app pans, zooms, selects and drags itself and sends your `canvas.` handler `{event, params, +context}`, `event.type` one of `selected`, `moved` `{items: [{id, x, y}]}`, `connected`, `deleted` `{items}`, +`activated` `{item}` and `menu`. Answer `{ops?: [{type: 'upsert', item} | {type: 'remove', ids}], actions?}`. + +## Tools, events, jobs and settings + +`tools.(arguments, call)` returns text (or `{text, isError}`); a thrown error becomes an error result. `events` +handlers get `(event, delivery)`, at least once and in order. `jobs.(request)` returns an optional message; a thrown +error fails the run. `settings(values)` gets the starting values and every change. + +## Permissions + +Ask only for what the plug-in uses; each is shown to the person when they approve. `rh.request(method, path, body)` +reaches the routes a permission opens, as the node's owner: `memory.read` (`GET /api/memory/*`, `GET /api/wiki*`), +`memory.write` (`POST /api/capture`), `sessions.read` (`GET /api/harness-sessions*`), `sessions.control`, +`topics.read` (`GET /api/topics*`), `topics.write`, `tasks.read` (`GET /api/tasks*`), `tasks.delegate` (`POST +/api/tasks`), `agents.read` (`GET /api/agents*`) and `notifications.send` (`rh.notify({title, text?, tone?, +action?})`, a notification in every app). Without a host permission the process opens no network connection, reads +and writes only its folders and runs no other program; `host.network`, `host.files.read`, `host.files.write` and +`host.exec` widen that and need the person's approval like the rest. Any other route answers 403. diff --git a/templates/javascript/checklist.js b/templates/javascript/checklist.js new file mode 100644 index 0000000..e65cbad --- /dev/null +++ b/templates/javascript/checklist.js @@ -0,0 +1,70 @@ +import { readFileSync, renameSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' + +const KEPT_FILINGS = 5 + +export class Checklist { + #file + #state + + constructor(dataDir) { + this.#file = join(dataDir, 'checklist.json') + try { + this.#state = JSON.parse(readFileSync(this.#file, 'utf8')) + } catch { + this.#state = { next: 1, items: [], filings: [] } + } + } + + get items() { + return this.#state.items + } + + get filings() { + return this.#state.filings + } + + get open() { + return this.#state.items.filter((item) => !item.done).length + } + + add(title) { + const item = { id: String(this.#state.next), title, done: false } + this.#state.next += 1 + this.#state.items.push(item) + this.#save() + return item + } + + toggle(id) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) { + item.done = !item.done + this.#save() + } + return item + } + + remove(ids) { + this.#state.items = this.#state.items.filter((item) => !ids.includes(item.id)) + this.#save() + } + + place(positions) { + for (const { id, x, y } of positions) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) Object.assign(item, { x, y }) + } + this.#save() + } + + filed(filing) { + this.#state.filings = [filing, ...this.#state.filings].slice(0, KEPT_FILINGS) + this.#save() + } + + #save() { + writeFileSync(`${this.#file}.tmp`, JSON.stringify(this.#state)) + renameSync(`${this.#file}.tmp`, this.#file) + } +} diff --git a/templates/javascript/plugin.js b/templates/javascript/plugin.js new file mode 100644 index 0000000..ea05b33 --- /dev/null +++ b/templates/javascript/plugin.js @@ -0,0 +1,179 @@ +import { Checklist } from './checklist.js' +import { connect, pluginEnv, Refusal, serve } from './sdk/index.ts' + +const NODE = { width: 180, height: 56, columns: 4, gap: 24 } + +const checklist = new Checklist(pluginEnv().dataDir) +const rh = connect() + +function node(item, index) { + return { + type: 'node', + id: item.id, + x: item.x ?? NODE.gap + (index % NODE.columns) * (NODE.width + NODE.gap), + y: item.y ?? NODE.gap + Math.floor(index / NODE.columns) * (NODE.height + NODE.gap), + width: NODE.width, + height: NODE.height, + shapes: [ + { + type: 'rect', + x: 0, + y: 0, + width: NODE.width, + height: NODE.height, + radius: 12, + fill: item.done ? 'secondaryContainer' : 'surfaceContainerHigh', + stroke: item.done ? 'success' : 'outlineVariant', + }, + { + type: 'icon', + x: 12, + y: 16, + name: item.done ? 'check_circle' : 'pending', + size: 24, + color: item.done ? 'success' : 'onSurfaceVariant', + }, + { type: 'text', x: 44, y: 19, text: item.title, weight: 'medium', maxWidth: NODE.width - 56 }, + ], + tooltip: item.done ? 'Done: double-click to reopen' : 'Double-click to mark done', + } +} + +function filed(filing) { + return [ + { type: 'badge', text: filing.by === 'you' ? 'by you' : 'by the categorizer', tone: 'neutral' }, + { type: 'time', at: filing.at, style: 'relative' }, + ] +} + +function main() { + return { + title: 'Checklist', + subtitle: `${checklist.open} open, ${checklist.items.length - checklist.open} done`, + blocks: [ + { + type: 'form', + id: 'add', + fields: [ + { + key: 'title', + label: 'New item', + input: { type: 'text' }, + required: true, + placeholder: 'What needs doing?', + }, + ], + buttons: [{ label: 'Add', icon: 'add', style: 'primary', action: { type: 'call', action: 'add' } }], + }, + { + type: 'list', + items: checklist.items.map((item) => ({ + id: item.id, + title: item.title, + icon: item.done ? 'check_circle' : 'pending', + action: { type: 'call', action: 'toggle', params: { id: item.id } }, + menu: [ + { + label: 'Delete', + icon: 'delete', + style: 'danger', + action: { type: 'call', action: 'remove', params: { id: item.id } }, + }, + ], + })), + empty: { title: 'Nothing on the list', text: 'Add an item above, or ask an agent to use the add_item tool.' }, + }, + { + type: 'section', + title: 'Board', + subtitle: 'Drag items to arrange them, double-click one to mark it done.', + blocks: [ + { + type: 'canvas', + id: 'board', + scene: { items: checklist.items.map(node), grid: { size: 8, snap: true } }, + height: 280, + }, + ], + }, + { + type: 'section', + title: 'Recently filed sessions', + blocks: [ + { + type: 'list', + items: checklist.filings.map((filing) => ({ + id: `${filing.sessionId}-${filing.at}`, + title: `Session ${filing.sessionId.split(':').pop().slice(0, 8)}`, + icon: 'folder', + trailing: filed(filing), + action: { type: 'openSession', sessionId: filing.sessionId }, + menu: [ + { label: 'Open topic', icon: 'folder_open', action: { type: 'openTopic', topicId: filing.topicId } }, + ], + })), + empty: { title: 'No sessions filed yet', text: 'Sessions filed into a topic show here.' }, + }, + ], + }, + ], + } +} + +const idOf = (params) => String(params?.id ?? '') + +await serve({ + views: { main }, + actions: { + add: ({ values }) => { + const title = typeof values?.title === 'string' ? values.title.trim() : '' + if (title === '') throw new Refusal('Give the item a title', { title: 'Required' }) + checklist.add(title) + return [{ type: 'refresh' }, { type: 'toast', text: `Added ${title}`, tone: 'success' }] + }, + toggle: ({ params }) => { + checklist.toggle(idOf(params)) + return [{ type: 'refresh' }] + }, + remove: ({ params }) => { + checklist.remove([idOf(params)]) + return [{ type: 'refresh' }] + }, + }, + canvas: { + board: ({ event }) => { + switch (event.type) { + case 'moved': + checklist.place(event.items) + return {} + case 'activated': { + const item = checklist.toggle(event.item) + const index = checklist.items.findIndex((found) => found.id === event.item) + return { + ops: item === undefined ? [] : [{ type: 'upsert', item: node(item, index) }], + actions: [{ type: 'refresh' }], + } + } + case 'deleted': + checklist.remove(event.items) + return { ops: [{ type: 'remove', ids: event.items }], actions: [{ type: 'refresh' }] } + default: + return {} + } + }, + }, + tools: { + add_item: async ({ title }) => { + if (typeof title !== 'string' || title.trim() === '') throw new Error('title must be a non-empty string') + const item = checklist.add(title.trim()) + await rh.viewsChanged(['main']) + return `Added "${item.title}" to the checklist; ${checklist.open} open.` + }, + }, + events: { + 'session.placed': async ({ sessionId, topicId, by }, delivery) => { + checklist.filed({ sessionId, topicId, by, at: delivery.at }) + await rh.viewsChanged(['main']) + }, + }, +}) diff --git a/templates/javascript/rivethub-plugin.json b/templates/javascript/rivethub-plugin.json new file mode 100644 index 0000000..f091f83 --- /dev/null +++ b/templates/javascript/rivethub-plugin.json @@ -0,0 +1,40 @@ +{ + "manifest": 1, + "id": "checklist-js", + "name": "Checklist (JavaScript)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with a board to arrange it and the sessions filed lately.", + "icon": "checklist", + "run": { + "command": ["node", "plugin.js"] + }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "What needs doing" + } + }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [ + { + "id": "checklist", + "title": "Checklist", + "icon": "checklist", + "view": "main" + } + ] + }, + "events": ["session.placed"] +} diff --git a/templates/rust/Cargo.lock b/templates/rust/Cargo.lock new file mode 100644 index 0000000..7cc4a9f --- /dev/null +++ b/templates/rust/Cargo.lock @@ -0,0 +1,318 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "checklist-rust" +version = "0.1.0" +dependencies = [ + "rivethub-plugin", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rivethub-plugin" +version = "0.7.0" +dependencies = [ + "http-body-util", + "hyper", + "hyper-util", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml new file mode 100644 index 0000000..283d0e2 --- /dev/null +++ b/templates/rust/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "checklist-rust" +version = "0.1.0" +edition = "2024" +rust-version = "1.88" +license = "Apache-2.0" +publish = false + +[workspace] + +[dependencies] +rivethub-plugin = { path = "../../rust/rivethub-plugin" } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" +tokio = { version = "1.48", features = ["macros", "rt-multi-thread"] } + +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +pedantic = { level = "warn", priority = -1 } +missing_errors_doc = "allow" diff --git a/templates/rust/rivethub-plugin.json b/templates/rust/rivethub-plugin.json new file mode 100644 index 0000000..6def433 --- /dev/null +++ b/templates/rust/rivethub-plugin.json @@ -0,0 +1,26 @@ +{ + "manifest": 1, + "id": "checklist-rust", + "name": "Checklist (Rust)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with the sessions filed lately.", + "icon": "checklist", + "run": { "command": ["target/release/checklist-rust"] }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { "title": { "type": "string", "description": "What needs doing" } }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [{ "id": "checklist", "title": "Checklist", "icon": "checklist", "view": "main" }] + }, + "events": ["session.placed"] +} diff --git a/templates/rust/src/checklist.rs b/templates/rust/src/checklist.rs new file mode 100644 index 0000000..b25218e --- /dev/null +++ b/templates/rust/src/checklist.rs @@ -0,0 +1,104 @@ +use std::path::{Path, PathBuf}; +use std::sync::{Mutex, MutexGuard, PoisonError}; + +use rivethub_plugin::Error; +use rivethub_plugin::contract::PlacedBy; +use serde::{Deserialize, Serialize}; + +const KEPT_FILINGS: usize = 5; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Item { + pub id: String, + pub title: String, + pub done: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Filing { + pub session_id: String, + pub topic_id: String, + pub by: PlacedBy, + pub at: i64, +} + +#[derive(Debug, Serialize, Deserialize)] +struct State { + next: u64, + items: Vec, + filings: Vec, +} + +pub struct Checklist { + file: PathBuf, + state: Mutex, +} + +impl Checklist { + pub fn open(data_dir: &Path) -> Self { + let file = data_dir.join("checklist.json"); + let state = std::fs::read(&file) + .ok() + .and_then(|bytes| serde_json::from_slice(&bytes).ok()) + .unwrap_or(State { + next: 1, + items: Vec::new(), + filings: Vec::new(), + }); + Self { + file, + state: Mutex::new(state), + } + } + + pub fn items(&self) -> Vec { + self.lock().items.clone() + } + + pub fn filings(&self) -> Vec { + self.lock().filings.clone() + } + + pub fn add(&self, title: &str) -> Result { + self.change(|state| { + state.items.push(Item { + id: state.next.to_string(), + title: title.to_owned(), + done: false, + }); + state.next += 1; + }) + } + + pub fn toggle(&self, id: &str) -> Result { + self.change(|state| { + if let Some(item) = state.items.iter_mut().find(|item| item.id == id) { + item.done = !item.done; + } + }) + } + + pub fn remove(&self, id: &str) -> Result { + self.change(|state| state.items.retain(|item| item.id != id)) + } + + pub fn filed(&self, filing: Filing) -> Result { + self.change(|state| { + state.filings.insert(0, filing); + state.filings.truncate(KEPT_FILINGS); + }) + } + + fn lock(&self) -> MutexGuard<'_, State> { + self.state.lock().unwrap_or_else(PoisonError::into_inner) + } + + fn change(&self, edit: impl FnOnce(&mut State)) -> Result { + let mut state = self.lock(); + edit(&mut state); + let saving = self.file.with_extension("json.tmp"); + std::fs::write(&saving, serde_json::to_vec(&*state)?)?; + std::fs::rename(&saving, &self.file)?; + Ok(state.items.iter().filter(|item| !item.done).count()) + } +} diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs new file mode 100644 index 0000000..9d8cbb8 --- /dev/null +++ b/templates/rust/src/main.rs @@ -0,0 +1,237 @@ +mod checklist; + +use rivethub_plugin::contract::{ + JsonObject, PlacedBy, PluginEvent, PluginEventDelivery, PluginToolCall, View, ViewAction, + ViewActionRefusal, ViewActionRequest, ViewBlock, ViewButton, ViewButtonStyle, ViewEmpty, + ViewField, ViewInline, ViewInput, ViewListItem, ViewTimeStyle, ViewTone, ViewValue, +}; +use rivethub_plugin::{Env, Error, Plugin, RivetHub}; +use serde::Deserialize; + +use crate::checklist::{Checklist, Filing, Item}; + +struct App { + checklist: Checklist, + rh: RivetHub, +} + +#[derive(Deserialize)] +struct AddItem { + title: String, +} + +#[tokio::main] +async fn main() -> Result<(), Error> { + let env = Env::from_env()?; + let app = App { + checklist: Checklist::open(&env.data_dir), + rh: env.rivethub(), + }; + Plugin::new(app) + .view( + "main", + |app, _| async move { Ok(main_view(&app.checklist)) }, + ) + .action("add", |app, request| async move { add(&app, &request) }) + .action("toggle", |app, request| async move { + app.checklist.toggle(id(&request))?; + Ok(vec![ViewAction::Refresh]) + }) + .action("remove", |app, request| async move { + app.checklist.remove(id(&request))?; + Ok(vec![ViewAction::Refresh]) + }) + .tool("add_item", |app, call| async move { + add_item(&app, &call).await + }) + .events(|app, delivery| async move { filed(&app, delivery).await }) + .serve() + .await +} + +fn id(request: &ViewActionRequest) -> &str { + request + .params + .as_ref() + .and_then(|params| params.get("id")) + .and_then(serde_json::Value::as_str) + .unwrap_or_default() +} + +fn call(action: &str, id: &str) -> ViewAction { + ViewAction::Call { + action: action.to_owned(), + params: Some(JsonObject::from_iter([("id".to_owned(), id.into())])), + } +} + +fn add(app: &App, request: &ViewActionRequest) -> Result, Error> { + let title = match request.values.get("title") { + Some(ViewValue::Text(title)) => title.trim(), + _ => "", + }; + if title.is_empty() { + return Err(ViewActionRefusal::new("Give the item a title") + .field("title", "Required") + .into()); + } + app.checklist.add(title)?; + Ok(vec![ + ViewAction::Refresh, + ViewAction::Toast { + text: format!("Added {title}"), + tone: Some(ViewTone::Success), + }, + ]) +} + +async fn add_item(app: &App, call: &PluginToolCall) -> Result { + let AddItem { title } = call.parse()?; + let title = title.trim(); + if title.is_empty() { + return Err(Error::failed("title must be a non-empty string")); + } + let open = app.checklist.add(title)?; + app.rh.views_changed(["main"]).await?; + Ok(format!("Added \"{title}\" to the checklist; {open} open.")) +} + +async fn filed(app: &App, delivery: PluginEventDelivery) -> Result<(), Error> { + if let PluginEvent::SessionPlaced { + session_id, + topic_id, + by, + } = delivery.event + { + app.checklist.filed(Filing { + session_id, + topic_id, + by, + at: delivery.at, + })?; + app.rh.views_changed(["main"]).await?; + } + Ok(()) +} + +fn main_view(checklist: &Checklist) -> View { + let items = checklist.items(); + let open = items.iter().filter(|item| !item.done).count(); + View { + title: "Checklist".to_owned(), + subtitle: Some(format!("{open} open, {} done", items.len() - open)), + toolbar: Vec::new(), + blocks: vec![ + add_form(), + ViewBlock::List { + items: items.iter().map(item_row).collect(), + empty: Some(ViewEmpty { + title: "Nothing on the list".to_owned(), + text: Some( + "Add an item above, or ask an agent to use the add_item tool.".to_owned(), + ), + button: None, + }), + }, + ViewBlock::Section { + title: Some("Recently filed sessions".to_owned()), + subtitle: None, + actions: Vec::new(), + collapsed: None, + blocks: vec![ViewBlock::List { + items: checklist.filings().iter().map(filing_row).collect(), + empty: Some(ViewEmpty { + title: "No sessions filed yet".to_owned(), + text: Some("Sessions filed into a topic show here.".to_owned()), + button: None, + }), + }], + }, + ], + } +} + +fn add_form() -> ViewBlock { + ViewBlock::Form { + id: "add".to_owned(), + fields: vec![ViewField { + key: "title".to_owned(), + label: "New item".to_owned(), + input: ViewInput::Text { multiline: false }, + value: None, + required: true, + help: None, + placeholder: Some("What needs doing?".to_owned()), + }], + buttons: vec![ViewButton { + label: "Add".to_owned(), + icon: Some("add".to_owned()), + style: Some(ViewButtonStyle::Primary), + action: ViewAction::Call { + action: "add".to_owned(), + params: None, + }, + confirm: None, + disabled: false, + }], + } +} + +fn item_row(item: &Item) -> ViewListItem { + let icon = if item.done { "check_circle" } else { "pending" }; + ViewListItem { + id: item.id.clone(), + title: item.title.clone(), + icon: Some(icon.to_owned()), + action: Some(call("toggle", &item.id)), + menu: vec![ViewButton { + label: "Delete".to_owned(), + icon: Some("delete".to_owned()), + style: Some(ViewButtonStyle::Danger), + action: call("remove", &item.id), + confirm: None, + disabled: false, + }], + ..ViewListItem::default() + } +} + +fn filing_row(filing: &Filing) -> ViewListItem { + let by = match filing.by { + PlacedBy::You => "by you", + PlacedBy::Categorizer => "by the categorizer", + }; + let (harness, native) = filing + .session_id + .split_once(':') + .unwrap_or(("", &filing.session_id)); + ViewListItem { + id: format!("{}-{}", filing.session_id, filing.at), + title: format!("Session {}", native.get(..8).unwrap_or(native)), + subtitle: Some(harness.to_owned()), + icon: Some("folder".to_owned()), + trailing: vec![ + ViewInline::Badge { + text: by.to_owned(), + tone: ViewTone::Neutral, + }, + ViewInline::Time { + at: filing.at, + style: Some(ViewTimeStyle::Relative), + }, + ], + action: Some(ViewAction::OpenSession { + session_id: filing.session_id.clone(), + }), + menu: vec![ViewButton { + label: "Open topic".to_owned(), + icon: Some("folder_open".to_owned()), + style: None, + action: ViewAction::OpenTopic { + topic_id: filing.topic_id.clone(), + }, + confirm: None, + disabled: false, + }], + } +} diff --git a/templates/typescript/package.json b/templates/typescript/package.json new file mode 100644 index 0000000..f64b3ed --- /dev/null +++ b/templates/typescript/package.json @@ -0,0 +1,16 @@ +{ + "name": "checklist-ts", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "build": "esbuild src/plugin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/plugin.js", + "dev": "npm run build && rivethub-plugin-dev ." + }, + "dependencies": { + "@rivethub/plugin-sdk": "0.7.0" + }, + "devDependencies": { + "esbuild": "0.28.2" + } +} diff --git a/templates/typescript/rivethub-plugin.json b/templates/typescript/rivethub-plugin.json new file mode 100644 index 0000000..c921503 --- /dev/null +++ b/templates/typescript/rivethub-plugin.json @@ -0,0 +1,26 @@ +{ + "manifest": 1, + "id": "checklist-ts", + "name": "Checklist (TypeScript)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with a board to arrange it and the sessions filed lately.", + "icon": "checklist", + "run": { "command": ["node", "dist/plugin.js"] }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { "title": { "type": "string", "description": "What needs doing" } }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [{ "id": "checklist", "title": "Checklist", "icon": "checklist", "view": "main" }] + }, + "events": ["session.placed"] +} diff --git a/templates/typescript/src/checklist.ts b/templates/typescript/src/checklist.ts new file mode 100644 index 0000000..4d1e311 --- /dev/null +++ b/templates/typescript/src/checklist.ts @@ -0,0 +1,75 @@ +import { readFileSync, renameSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' +import type { EventOf } from '@rivethub/plugin-sdk' + +export type Item = { id: string; title: string; done: boolean; x?: number; y?: number } +export type Filing = Omit, 'type'> & { at: number } +type State = { next: number; items: Item[]; filings: Filing[] } + +const KEPT_FILINGS = 5 + +export class Checklist { + readonly #file: string + #state: State + + constructor(dataDir: string) { + this.#file = join(dataDir, 'checklist.json') + try { + this.#state = JSON.parse(readFileSync(this.#file, 'utf8')) as State + } catch { + this.#state = { next: 1, items: [], filings: [] } + } + } + + get items(): readonly Item[] { + return this.#state.items + } + + get filings(): readonly Filing[] { + return this.#state.filings + } + + get open(): number { + return this.#state.items.filter((item) => !item.done).length + } + + add(title: string): Item { + const item = { id: String(this.#state.next), title, done: false } + this.#state.next += 1 + this.#state.items.push(item) + this.#save() + return item + } + + toggle(id: string): Item | undefined { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) { + item.done = !item.done + this.#save() + } + return item + } + + remove(ids: readonly string[]): void { + this.#state.items = this.#state.items.filter((item) => !ids.includes(item.id)) + this.#save() + } + + place(positions: readonly { id: string; x: number; y: number }[]): void { + for (const { id, x, y } of positions) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) Object.assign(item, { x, y }) + } + this.#save() + } + + filed(filing: Filing): void { + this.#state.filings = [filing, ...this.#state.filings].slice(0, KEPT_FILINGS) + this.#save() + } + + #save(): void { + writeFileSync(`${this.#file}.tmp`, JSON.stringify(this.#state)) + renameSync(`${this.#file}.tmp`, this.#file) + } +} diff --git a/templates/typescript/src/plugin.ts b/templates/typescript/src/plugin.ts new file mode 100644 index 0000000..c6c1a49 --- /dev/null +++ b/templates/typescript/src/plugin.ts @@ -0,0 +1,187 @@ +import { + type CanvasItem, + connect, + pluginEnv, + Refusal, + serve, + type View, + type ViewBlock, + type ViewInline, +} from '@rivethub/plugin-sdk' +import { Checklist, type Filing, type Item } from './checklist.ts' + +const NODE = { width: 180, height: 56, columns: 4, gap: 24 } + +const checklist = new Checklist(pluginEnv().dataDir) +const rh = connect() + +function node(item: Item, index: number): CanvasItem { + return { + type: 'node', + id: item.id, + x: item.x ?? NODE.gap + (index % NODE.columns) * (NODE.width + NODE.gap), + y: item.y ?? NODE.gap + Math.floor(index / NODE.columns) * (NODE.height + NODE.gap), + width: NODE.width, + height: NODE.height, + shapes: [ + { + type: 'rect', + x: 0, + y: 0, + width: NODE.width, + height: NODE.height, + radius: 12, + fill: item.done ? 'secondaryContainer' : 'surfaceContainerHigh', + stroke: item.done ? 'success' : 'outlineVariant', + }, + { + type: 'icon', + x: 12, + y: 16, + name: item.done ? 'check_circle' : 'pending', + size: 24, + color: item.done ? 'success' : 'onSurfaceVariant', + }, + { type: 'text', x: 44, y: 19, text: item.title, weight: 'medium', maxWidth: NODE.width - 56 }, + ], + tooltip: item.done ? 'Done: double-click to reopen' : 'Double-click to mark done', + } +} + +function filed(filing: Filing): ViewInline[] { + return [ + { type: 'badge', text: filing.by === 'you' ? 'by you' : 'by the categorizer', tone: 'neutral' }, + { type: 'time', at: filing.at, style: 'relative' }, + ] +} + +function main(): View { + const blocks: ViewBlock[] = [ + { + type: 'form', + id: 'add', + fields: [ + { key: 'title', label: 'New item', input: { type: 'text' }, required: true, placeholder: 'What needs doing?' }, + ], + buttons: [{ label: 'Add', icon: 'add', style: 'primary', action: { type: 'call', action: 'add' } }], + }, + { + type: 'list', + items: checklist.items.map((item) => ({ + id: item.id, + title: item.title, + icon: item.done ? 'check_circle' : 'pending', + action: { type: 'call', action: 'toggle', params: { id: item.id } }, + menu: [ + { + label: 'Delete', + icon: 'delete', + style: 'danger', + action: { type: 'call', action: 'remove', params: { id: item.id } }, + }, + ], + })), + empty: { title: 'Nothing on the list', text: 'Add an item above, or ask an agent to use the add_item tool.' }, + }, + { + type: 'section', + title: 'Board', + subtitle: 'Drag items to arrange them, double-click one to mark it done.', + blocks: [ + { + type: 'canvas', + id: 'board', + scene: { items: checklist.items.map(node), grid: { size: 8, snap: true } }, + height: 280, + }, + ], + }, + { + type: 'section', + title: 'Recently filed sessions', + blocks: [ + { + type: 'list', + items: checklist.filings.map((filing) => { + const [harness, native] = filing.sessionId.split(':', 2) + return { + id: `${filing.sessionId}-${filing.at}`, + title: `Session ${(native ?? filing.sessionId).slice(0, 8)}`, + subtitle: harness ?? '', + icon: 'folder', + trailing: filed(filing), + action: { type: 'openSession', sessionId: filing.sessionId }, + menu: [ + { label: 'Open topic', icon: 'folder_open', action: { type: 'openTopic', topicId: filing.topicId } }, + ], + } + }), + empty: { title: 'No sessions filed yet', text: 'Sessions filed into a topic show here.' }, + }, + ], + }, + ] + return { + title: 'Checklist', + subtitle: `${checklist.open} open, ${checklist.items.length - checklist.open} done`, + blocks, + } +} + +const idOf = (params: Record | null | undefined): string => String(params?.id ?? '') + +await serve({ + views: { main }, + actions: { + add: ({ values }) => { + const title = typeof values?.title === 'string' ? values.title.trim() : '' + if (title === '') throw new Refusal('Give the item a title', { title: 'Required' }) + checklist.add(title) + return [{ type: 'refresh' }, { type: 'toast', text: `Added ${title}`, tone: 'success' }] + }, + toggle: ({ params }) => { + checklist.toggle(idOf(params)) + return [{ type: 'refresh' }] + }, + remove: ({ params }) => { + checklist.remove([idOf(params)]) + return [{ type: 'refresh' }] + }, + }, + canvas: { + board: ({ event }) => { + switch (event.type) { + case 'moved': + checklist.place(event.items) + return {} + case 'activated': { + const item = checklist.toggle(event.item) + const index = checklist.items.findIndex((found) => found.id === event.item) + return { + ops: item === undefined ? [] : [{ type: 'upsert', item: node(item, index) }], + actions: [{ type: 'refresh' }], + } + } + case 'deleted': + checklist.remove(event.items) + return { ops: [{ type: 'remove', ids: event.items }], actions: [{ type: 'refresh' }] } + default: + return {} + } + }, + }, + tools: { + add_item: async ({ title }) => { + if (typeof title !== 'string' || title.trim() === '') throw new Error('title must be a non-empty string') + const item = checklist.add(title.trim()) + await rh.viewsChanged(['main']) + return `Added "${item.title}" to the checklist; ${checklist.open} open.` + }, + }, + events: { + 'session.placed': async ({ sessionId, topicId, by }, delivery) => { + checklist.filed({ sessionId, topicId, by, at: delivery.at }) + await rh.viewsChanged(['main']) + }, + }, +}) diff --git a/tests/plugin-sdk.test.ts b/tests/plugin-sdk.test.ts new file mode 100644 index 0000000..b21964b --- /dev/null +++ b/tests/plugin-sdk.test.ts @@ -0,0 +1,76 @@ +import assert from 'node:assert/strict' +import { test } from 'node:test' +import { Refusal, router } from '@rivethub/plugin-sdk' + +const deliver = (seq: number, event: object): string => JSON.stringify({ seq, at: 0, missed: 0, event }) + +test('an action refusal answers 422 naming its fields, and an accepted action answers its actions', async () => { + const route = router({ + actions: { + add: ({ values }) => { + if (values?.title === undefined) throw new Refusal('Give it a title', { title: 'Required' }) + return [{ type: 'refresh' }] + }, + }, + }) + assert.deepEqual(await route('POST', '/actions/add', JSON.stringify({ context: {} })), { + status: 422, + body: { message: 'Give it a title', fields: { title: 'Required' } }, + }) + assert.deepEqual(await route('POST', '/actions/add', JSON.stringify({ values: { title: 'x' }, context: {} })), { + status: 200, + body: { actions: [{ type: 'refresh' }] }, + }) +}) + +test('a tool that throws answers its message as an error result', async () => { + const route = router({ + tools: { + add_item: ({ title }) => { + if (typeof title !== 'string') throw new Error('title must be a string') + return `added ${title}` + }, + }, + }) + assert.deepEqual(await route('POST', '/tools/add_item', JSON.stringify({ arguments: { title: 'x' } })), { + status: 200, + body: { text: 'added x' }, + }) + assert.deepEqual(await route('POST', '/tools/add_item', JSON.stringify({ arguments: {} })), { + status: 200, + body: { text: 'title must be a string', isError: true }, + }) +}) + +test('a repeated delivery is handled once, a failed one is retried, settings go to the settings handler', async () => { + const seen: string[] = [] + let failing = true + const route = router({ + events: { + 'session.idle': ({ sessionId }) => { + if (sessionId === 'b' && failing) { + failing = false + throw new Error('not yet') + } + seen.push(sessionId) + }, + }, + settings: (values) => { + seen.push(JSON.stringify(values)) + }, + }) + const idle = (sessionId: string) => ({ type: 'session.idle', sessionId }) + const status = async (seq: number, event: object) => (await route('POST', '/events', deliver(seq, event))).status + assert.equal(await status(1, idle('a')), 204) + assert.equal(await status(1, idle('a')), 204) + assert.equal(await status(2, { type: 'settings.changed', values: { on: true } }), 204) + assert.equal(await status(3, idle('b')), 500) + assert.equal(await status(3, idle('b')), 204) + assert.deepEqual(seen, ['a', '{"on":true}', 'b']) +}) + +test('health answers and an unknown route is the plug-in’s own 404', async () => { + const route = router({}) + assert.equal((await route('GET', '/health', '')).status, 200) + assert.equal((await route('POST', '/views/main', '{}')).status, 404) +}) diff --git a/tsconfig.json b/tsconfig.json index b2df04d..e858d8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,5 +17,5 @@ "noEmit": true, "skipLibCheck": true }, - "include": ["scripts", "tests", "packages/*/src"] + "include": ["scripts", "tests", "packages/*/src", "templates/typescript/src"] }