@anhlp/alp-protocol 0.0.0-stage → 0.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +16 -2
- package/conformance/cases.json +951 -0
- package/conformance/run.d.mts +32 -0
- package/conformance/run.mjs +403 -0
- package/dist/connection.d.ts +13 -0
- package/dist/connection.js +0 -0
- package/dist/contract-v1.d.ts +8783 -0
- package/dist/contract-v1.js +5 -0
- package/dist/contract.d.ts +25 -0
- package/dist/contract.js +28 -0
- package/dist/dto.d.ts +104 -0
- package/dist/dto.js +0 -0
- package/dist/events.d.ts +354 -0
- package/dist/events.js +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -0
- package/dist/public.d.ts +1 -0
- package/dist/public.js +2 -0
- package/dist/rpc.d.ts +1210 -0
- package/dist/rpc.js +0 -0
- package/dist/schedule.d.ts +43 -0
- package/dist/schedule.js +0 -0
- package/dist/session.d.ts +285 -0
- package/dist/session.js +0 -0
- package/dist/validate.d.ts +12 -0
- package/dist/validate.js +151 -0
- package/dist/wire.d.ts +192 -0
- package/dist/wire.js +137 -0
- package/fixtures/ipc-v1.jsonl +4 -0
- package/fixtures/v1/cases.json +7166 -0
- package/package.json +127 -4
- package/schema/ipc-v1.json +3271 -0
- package/schema/methods-v1.json +8678 -0
- package/src/connection.ts +13 -0
- package/src/contract-v1.js +2 -0
- package/src/contract.js +44 -0
- package/src/dto.ts +78 -0
- package/src/events.ts +207 -0
- package/src/index.ts +7 -0
- package/src/public.js +2 -0
- package/src/rpc.ts +272 -0
- package/src/schedule.ts +43 -0
- package/src/session.ts +213 -0
- package/src/validate.js +115 -0
- package/src/wire.js +213 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// packages/protocol/src/contract-v1.js
|
|
2
|
+
var METHODS_V1 = { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://alp.dev/schemas/methods-v1.json", "protocolVersion": 1, "errors": { "parseError": -32700, "invalidRequest": -32600, "methodNotFound": -32601, "invalidParams": -32602, "failed": 1e3, "notFound": 1001, "forbidden": 1003, "conflict": 1004, "unavailable": 1005, "protocol": 1006 }, "capabilities": { "attach.after": "session.attach accepts `after` and answers `cursor`/`reset`; envelopes kept in a tree timeline carry `cursor`.", "prompt.receipts": "session.prompt is answered at most once per (sessionId, clientMessageId) from a durable receipt; repeats answer the first outcome or outcome_unknown.", "extension.methods": "extension.register/unregister, and the daemon sends extension.invoke requests to the owning connection.", "team": "team.list: the teams a project can use, from the daemon host's built-ins, library and project.", "task": "task.list, task.create, task.update and task.gate.resolve on a project's .alp/tasks, written by the daemon under the task lock.", "library": "library.list/get/save/delete/duplicate/rename, library.skills.set and library.models on the daemon user's library and a project's .alp overrides; secrets are redacted on read.", "settings.language": "settings.language.get/set: the language the daemon user reads, in the daemon's ALP_HOME/settings.json.", "session.list.page": "session.list accepts `limit`, `cursor` and `query` and answers `nextCursor` while more sessions follow; without them it answers every session as before.", "question.watch": "question.watch: the connection is told of `question` and `question.resolved` in every tree (of a projectRoot when given), attached or not.", "question.watch.turns": "question.watch accepts `turns`: the connection is also told of `turn.ended` of every root in the trees it watches.", "session.attention": "question.watch accepts `attention`: its answer holds each watched root's finished or error attention, kept by alpd for every client, and the connection is told when one is set or cleared (an `attention` event); session.attention.clear acknowledges one.", "workspace.files": "workspace.files.search: files under a directory whose relative path matches a query; read-only, names only, links never followed.", "workspace.files.read": "workspace.files.list and workspace.files.read: the entries of a directory and the content of a UTF-8 text file (at most 1 MiB) under a directory; read-only, links never followed, .git, .env* and key or credential files refused, .gitignore'd paths hidden unless asked.", "prompt.images": 'session.prompt takes inline image parts { type: "image", mimeType, data } (base64, no paths or URLs) within the image limits; a session snapshot says whether its runtime takes them in promptImages.', "library.project.write": "library save/delete/duplicate/rename accept policy project-data: only project-only pure-data agents and skills, no executable configuration, sidecars or library/built-in collisions.", "schedule": "schedule.create/list/get/cancel: one-shot continuations of a root session. alpd opens the turn by itself when the time comes; a job that comes due late says how late it is, and a job that cannot run says why.", "session.history": "Durable bounded backward envelope pages, persisted generation and numeric attach watermark.", "workspace.registry": "Daemon-owned project/workspace registry, durable pins, revision CAS and requestId replay.", "workspace.worktree": "Host-approved managed user worktrees; opt-in workspace.manage and named destination mappings.", "workspace.git": "workspace.git.status and workspace.git.diff: a registered workspace's read-only Git status and structured diff hunks by workspaceId; enumerated comparisons only, bounded (1 MiB per file, 2 MiB per page, 200 untracked files) with an opaque snapshot and next cursor; blocked secret paths withheld on both sides of a rename; no Git mutation.", "attachments": 'attachment.begin/chunk/commit/abort/get/delete: daemon-owned immutable non-image attachments by opaque id, uploaded in bounded chunks, and session.prompt content parts `{ type: "attachment", attachmentId }`; daemon.hello carries `attachmentLimits`. Listed only with a home and a store, on macOS and Linux.', "session.fork": "session.fork: a new root whose conversation is a root's up to a completed turn (or a branch a rewind set aside), by native fork of Codex and Claude sessions; files are never copied or changed. Listed with a store and a runtime that forks native conversations, on macOS and Linux (not Windows).", "session.rewind": "session.rewind: a root's conversation from before a turn on, under the same session id; the later turns stay a recoverable branch, files are never changed, history generation advances (`history.reset` event). Same condition as session.fork.", "session.reload": "session.reload: restarts a live root's native process on its own conversation and configuration at the idle barrier (no turn, child, question, mail or parked work), keeping its session id, history and receipts; through the lifecycle journal. Listed with a store and a runtime that restarts a root on its own conversation, on macOS and Linux (not Windows).", "session.resumeCommand": "session.resumeCommand: the ALP CLI command (`alp attach <sessionId>`) that follows a session in a terminal, as argv and POSIX and Windows (cmd.exe) command lines built by alpd; for the clipboard only, never run, never a native runtime's command, credential, env or path.", "session.configure.live": "session.configure takes model, thinking and team (with requestId and ifGeneration) besides mode, and session.configure.preview answers the configuration a change would run with: a live root's model, effort or team changes at the idle barrier (no turn, child, question, mail or parked work) through a controlled restart of its native process on the same conversation; the effective configuration is written only after the runtime took it, through the lifecycle journal (\xA712.9). Never another runtime and never more permissions. Listed with a store and a runtime that restarts a root with a new configuration, on macOS and Linux (not Windows).", "terminal": "terminal.create/list/attach/input/resize/close/revoke and terminal.event notifications: a real PTY shell on the daemon host as the daemon's account (a cwd is not a sandbox), served only when the host owner opted in (<ALP_HOME>/terminal.json allowRemoteTerminal) on macOS and Linux.", "session.interrupt.turn": "session.interrupt accepts turnId and atomically cancels only that active turn, including its subtree. Conditional requests answer interrupted:true when canceled, false when the named turn is no longer active; false changes nothing. Without this capability clients must not send turnId or infer targeted cancellation from a legacy interrupt." }, "methods": { "assignment.recall": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "projectRoot", "required": false, "alternatives": ["assignmentId", "taskId"] }, "idempotent": false, "risks": ["model call"] }, "params": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "taskId": { "type": "string" }, "projectRoot": { "type": "string" }, "question": { "type": "string" } }, "required": ["question"], "additionalProperties": true }, "result": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "taskId": { "type": "string" }, "finishedAt": { "type": "string" }, "answer": { "type": "string" } }, "required": ["assignmentId", "agent", "finishedAt", "answer"], "additionalProperties": true } }, "board.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "pins": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["pins"], "additionalProperties": true } }, "catalog.get": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object" } }, "modes": { "type": "array", "items": { "type": "object" } }, "thinkingOptions": {}, "defaultModel": { "type": "string" } }, "required": ["models", "modes", "defaultModel"], "additionalProperties": true } }, "daemon.hello": { "x-alp": { "effect": "query", "scope": { "kind": "connection" }, "idempotent": true }, "params": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "client": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "string" } }, "required": ["name", "version"], "additionalProperties": true }, "capabilities": { "type": "array", "items": { "type": "string" } } }, "required": ["protocolVersion"], "additionalProperties": true }, "result": { "type": "object", "properties": { "protocolVersion": { "const": 1 }, "daemonVersion": { "type": "string" }, "pid": { "type": "integer" }, "hostname": { "type": "string" }, "capabilities": { "type": "array", "items": { "type": "string" } }, "promptImageLimits": { "type": "object", "description": "Optional effective inline image limits for this connection, when prompt.images is advertised. Missing on older peers. Byte limits count decoded bytes.", "properties": { "maxCount": { "type": "integer", "minimum": 0 }, "maxBytes": { "type": "integer", "minimum": 0 }, "maxTotalBytes": { "type": "integer", "minimum": 0 } }, "required": ["maxCount", "maxBytes", "maxTotalBytes"], "additionalProperties": false }, "attachmentLimits": { "type": "object", "description": "Effective attachment limits for this connection, when `attachments` is advertised. Byte limits count decoded bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxObjectBytes": { "type": "integer", "minimum": 0 }, "maxPerPrompt": { "type": "integer", "minimum": 0 }, "maxPromptBytes": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 0 }, "maxActiveUploads": { "type": "integer", "minimum": 0 }, "maxPrincipalBytes": { "type": "integer", "minimum": 0 }, "maxDaemonBytes": { "type": "integer", "minimum": 0 }, "uploadTimeoutMs": { "type": "integer", "minimum": 0 }, "unreferencedRetentionMs": { "type": "integer", "minimum": 0 }, "releasedGraceMs": { "type": "integer", "minimum": 0 } }, "required": ["maxObjectBytes", "maxPerPrompt", "maxPromptBytes", "maxChunkBytes", "maxActiveUploads", "maxPrincipalBytes", "maxDaemonBytes", "uploadTimeoutMs", "unreferencedRetentionMs", "releasedGraceMs"], "additionalProperties": false }, "terminalLimits": { "type": "object", "description": "Effective terminal limits for this connection, when `terminal` is advertised. Byte limits count UTF-8 bytes; times are milliseconds. An operator or a gateway may lower them, never raise them.", "properties": { "maxPerPrincipal": { "type": "integer", "minimum": 0 }, "maxPerDaemon": { "type": "integer", "minimum": 0 }, "maxInputBytes": { "type": "integer", "minimum": 0 }, "maxOutputFrameBytes": { "type": "integer", "minimum": 0 }, "replayBytes": { "type": "integer", "minimum": 0 }, "idleMs": { "type": "integer", "minimum": 0 }, "maxLifetimeMs": { "type": "integer", "minimum": 0 }, "reconnectMs": { "type": "integer", "minimum": 0 } }, "required": ["maxPerPrincipal", "maxPerDaemon", "maxInputBytes", "maxOutputFrameBytes", "replayBytes", "idleMs", "maxLifetimeMs", "reconnectMs"], "additionalProperties": false } }, "required": ["protocolVersion"], "additionalProperties": true } }, "daemon.pause": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] }, "now": { "type": "boolean" }, "reason": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.pauses": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.resume": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": { "runtime": { "enum": ["codex", "claude", "acp", "antigravity"] } }, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/pauseState" } }, "daemon.shutdown": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "idempotent": true, "risks": ["admin"] }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "daemon.status": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "pid": { "type": "integer" }, "startedAt": { "type": "string" }, "version": { "type": "string" }, "protocolVersion": { "type": "integer" }, "sessions": { "type": "integer" }, "questions": { "type": "integer" }, "previousExit": { "type": "object", "properties": { "kind": { "enum": ["clean", "crash"] }, "at": { "type": "string" } }, "required": ["kind"], "additionalProperties": true }, "persistence": { "type": "object" }, "health": { "$ref": "#/$defs/health" } }, "required": ["pid", "startedAt", "version", "protocolVersion", "sessions", "questions", "health"], "additionalProperties": true } }, "daemon.usage": { "x-alp": { "effect": "query", "scope": { "kind": "host" }, "idempotent": true, "risks": ["refresh asks every provider (spawns on the daemon host)"] }, "params": { "type": "object", "properties": { "refresh": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "providers": { "type": "array", "items": { "type": "object" } } }, "required": ["providers"], "additionalProperties": true } }, "extension.register": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "registered": { "type": "string" } }, "required": ["registered"], "additionalProperties": true } }, "extension.unregister": { "x-alp": { "effect": "mutation", "scope": { "kind": "connection" }, "idempotent": false, "risks": ["admin"] }, "params": { "type": "object", "properties": { "method": { "type": "string" } }, "required": ["method"], "additionalProperties": true }, "result": { "type": "object", "properties": { "unregistered": { "type": "string" } }, "required": ["unregistered"], "additionalProperties": true } }, "library.delete": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "revision": { "type": "string" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "removed": { "const": true }, "now": { "enum": ["builtin", "library"] } }, "required": ["removed"], "additionalProperties": true } }, "library.duplicate": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope", "reads": ["builtin", "library"] }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.get": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true, "redacts": ["mcp /server/env/*", "mcp /server/headers/*", "providers /provider/env/*"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "scope": { "$ref": "#/$defs/libraryScope" } }, "required": ["kind", "name"], "additionalProperties": true }, "result": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "usedBy": { "type": "array", "items": { "type": "string" } }, "librarySkills": { "type": "array", "items": { "type": "string" } }, "secrets": { "type": "array", "items": { "type": "string" } } }, "required": ["kind", "name", "source", "content", "revision", "usedBy"], "additionalProperties": true } }, "library.list": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["kind"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "entries": { "type": "array", "items": { "$ref": "#/$defs/libraryEntryRow" } } }, "required": ["projectRoot", "entries"], "additionalProperties": true } }, "library.models": { "x-alp": { "effect": "query", "capability": "library", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "efforts": { "type": "array", "items": { "type": "string" } }, "effort": { "type": "string" } }, "required": ["id", "label", "efforts"], "additionalProperties": true } } }, "required": ["models"], "additionalProperties": true } }, "library.rename": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": false, "risks": ["exec-config when kind is mcp, hooks or providers"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "from": { "$ref": "#/$defs/entryName" }, "to": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "from", "to", "scope"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" } }, "required": ["revision"], "additionalProperties": true } }, "library.save": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "library-or-project", "param": "projectRoot", "selector": "scope" }, "idempotent": "with revision (a repeat fails revision_conflict)", "risks": ["exec-config when kind is mcp, hooks or providers, or agents naming mcp/hooks/provider", "writes every known project's .alp/settings.json when kind is teams and sync is known-projects"] }, "params": { "type": "object", "properties": { "kind": { "$ref": "#/$defs/libraryKind" }, "name": { "$ref": "#/$defs/entryName" }, "scope": { "$ref": "#/$defs/libraryScope" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "content": { "type": "object" }, "revision": { "$ref": "#/$defs/libraryRevision" }, "sync": { "enum": ["none", "known-projects"] }, "policy": { "enum": ["project-data"], "description": "Opt-in strict project-only non-executable mutation policy; requires library.project.write capability." } }, "required": ["kind", "name", "scope", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "revision": { "$ref": "#/$defs/libraryRevision" }, "syncedProjects": { "type": "integer", "minimum": 0 }, "syncErrors": { "type": "array", "items": { "type": "string" } } }, "required": ["revision"], "additionalProperties": true } }, "library.skills.set": { "x-alp": { "effect": "mutation", "capability": "library", "scope": { "kind": "host" }, "writes": ["ALP_HOME/role-skills.json"], "idempotent": true }, "params": { "type": "object", "properties": { "agent": { "$ref": "#/$defs/entryName" }, "skills": { "type": "array", "items": { "$ref": "#/$defs/entryName" }, "maxItems": 100 } }, "required": ["agent", "skills"], "additionalProperties": true }, "result": { "type": "object", "properties": { "skills": { "type": "array", "items": { "type": "string" } } }, "required": ["skills"], "additionalProperties": true } }, "question.answer": { "x-alp": { "effect": "mutation", "scope": { "kind": "question", "param": "questionId", "prefix": true }, "idempotent": false }, "params": { "type": "object", "properties": { "questionId": { "type": "string" }, "text": { "type": "string" }, "dismiss": { "type": "boolean" }, "reason": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "questionId": { "type": "string" } }, "required": ["questionId"], "additionalProperties": true } }, "question.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } } }, "required": ["questions"], "additionalProperties": true } }, "question.watch": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true, "capability": "question.watch" }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "turns": { "type": "boolean" }, "attention": { "type": "boolean" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "attention": { "type": "array", "items": { "type": "object", "properties": { "sessionId": { "type": "string" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["sessionId", "attention"], "additionalProperties": true } } }, "required": ["questions"], "additionalProperties": true } }, "session.attention.clear": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.attention" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "at": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "cleared": { "type": "boolean" } }, "required": ["cleared"], "additionalProperties": true } }, "schedule.create": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "prompt": { "type": "string", "minLength": 1, "maxLength": 8e3, "pattern": "\\S" } }, "required": ["projectRoot", "sessionId", "dueAt", "prompt"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.list": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "jobs": { "type": "array", "items": { "$ref": "#/$defs/scheduleJob" } } }, "required": ["jobs"], "additionalProperties": true } }, "schedule.get": { "x-alp": { "effect": "query", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "schedule.cancel": { "x-alp": { "effect": "mutation", "capability": "schedule", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["ALP_HOME/schedules"], "idempotent": true }, "params": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["id", "projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "job": { "$ref": "#/$defs/scheduleJob" } }, "required": ["job"], "additionalProperties": true } }, "session.archive": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "archived": { "type": "boolean" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.attach": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "replay": { "type": "boolean" }, "after": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "generation": { "type": "string", "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reset": { "const": true } }, "required": ["session", "cursor"], "additionalProperties": true } }, "session.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.configure": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "mode alone: yes; with model, thinking or team: with requestId", "risks": ["with model, thinking or team: restarts the root's native process on its own conversation; never another runtime, never more permissions"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Native model, or runtime-prefixed (codex:/claude:); the session's own runtime only (capability session.configure.live)." }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200, "description": "An effort the model takes (capability session.configure.live)." }, "team": { "type": "string", "minLength": 1, "maxLength": 200, "description": "A team id the daemon host defines (capability session.configure.live); no path or configuration." }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId"], "anyOf": [{ "not": { "anyOf": [{ "required": ["model"] }, { "required": ["thinking"] }, { "required": ["team"] }] } }, { "required": ["requestId", "ifGeneration"] }], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "configured": { "$ref": "#/$defs/configureOutcome" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.configure.preview": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.configure.live", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "mode": { "type": "string" }, "model": { "type": "string", "minLength": 1, "maxLength": 200 }, "thinking": { "type": "string", "minLength": 1, "maxLength": 200 }, "team": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/configurePreview" } }, "required": ["preview"], "additionalProperties": true } }, "session.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": false, "risks": ["exec: spec.env and stdio spec.mcpServers run on the daemon host", "spec.workdir/writeRoot/copy*/restore/keepThread are internal"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "spec": { "anyOf": [{ "$ref": "#/$defs/spec" }, { "type": "object", "properties": { "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "workflow": { "type": "string" } }, "required": [], "additionalProperties": false }] }, "history": { "enum": ["skip", "replay"] }, "delegation": { "type": "boolean" }, "resume": { "type": "boolean" }, "workspaceId": { "type": "string" } }, "required": ["spec"], "additionalProperties": true, "anyOf": [{ "required": ["workspaceId"] }, { "properties": { "spec": { "$ref": "#/$defs/spec" } } }] }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/session" }, "attached": { "type": "boolean" }, "resumed": { "const": true }, "durable": { "type": "boolean" } }, "required": ["session", "attached"], "additionalProperties": true } }, "session.get": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.interrupt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "turnId": { "type": "string", "minLength": 1 } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "interrupted": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": false }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "rootsOnly": { "type": "boolean" }, "includeClosed": { "type": "boolean" }, "includeArchived": { "type": "boolean" }, "limit": { "type": "integer", "minimum": 1, "maximum": 1e3 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 }, "query": { "type": "string", "maxLength": 200 }, "projectRoots": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 1024 } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "sessions": { "type": "array", "items": { "$ref": "#/$defs/sessionSummary" } }, "nextCursor": { "type": "string", "minLength": 1 } }, "required": ["sessions"], "additionalProperties": true } }, "session.log": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "rootId": { "type": "string" }, "entries": { "type": "array", "items": { "type": "object" } } }, "required": ["rootId", "entries"], "additionalProperties": true } }, "session.message": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": false }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "text": { "type": "string" } }, "required": ["sessionId", "text"], "additionalProperties": true }, "result": { "type": "object", "properties": {}, "required": [], "additionalProperties": true } }, "session.preview": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "spec.cwd" }, "idempotent": true }, "params": { "type": "object", "properties": { "spec": { "$ref": "#/$defs/spec" } }, "required": ["spec"], "additionalProperties": true }, "result": { "type": "object", "properties": { "preview": { "$ref": "#/$defs/preview" } }, "required": ["preview"], "additionalProperties": true } }, "session.prompt": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": "with prompt.receipts" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "clientMessageId": { "type": "string" }, "delivery": { "enum": ["auto", "steer"] }, "content": { "type": "array", "items": { "anyOf": [{ "type": "object", "properties": { "type": { "const": "text" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "$ref": "#/$defs/promptImage" }, { "type": "object", "properties": { "type": { "const": "attachment" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["type", "attachmentId"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["text", "image", "attachment"] } } }, "required": ["type"], "additionalProperties": true }] } }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "clientMessageId", "content"], "additionalProperties": true }, "result": { "type": "object", "properties": { "outcome": { "enum": ["accepted", "failed"] }, "error": { "$ref": "#/$defs/alpError" }, "duplicate": { "type": "boolean" }, "durable": { "type": "boolean" } }, "required": [], "additionalProperties": true } }, "session.release": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "closed": { "type": "boolean" } }, "required": ["closed"], "additionalProperties": true } }, "session.rename": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" } }, "required": ["sessionId", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" } }, "required": ["session"], "additionalProperties": true } }, "session.status": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" } }, "required": ["sessionId"], "additionalProperties": true }, "result": { "type": "object", "properties": { "status": { "$ref": "#/$defs/treeStatus" } }, "required": ["status"], "additionalProperties": true } }, "settings.language.get": { "x-alp": { "effect": "query", "capability": "settings.language", "scope": { "kind": "host" }, "idempotent": true }, "params": { "type": "object", "properties": {}, "required": [], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "settings.language.set": { "x-alp": { "effect": "mutation", "capability": "settings.language", "scope": { "kind": "host" }, "writes": ["ALP_HOME/settings.json"], "idempotent": true }, "params": { "type": "object", "properties": { "language": { "anyOf": [{ "type": "string", "minLength": 1, "maxLength": 40, "pattern": "\\S" }, { "type": "null" }] } }, "required": ["language"], "additionalProperties": true }, "result": { "$ref": "#/$defs/languageSetting" } }, "task.create": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": "per requestId within one alpd process (10 minutes)" }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "title": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S" }, "priority": { "type": "integer", "minimum": 0, "maximum": 4 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["projectRoot", "title"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "duplicate": { "const": true } }, "required": ["id"], "additionalProperties": true } }, "task.gate.resolve": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "gate": { "type": "string", "minLength": 1, "maxLength": 128 }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 } }, "required": ["projectRoot", "id", "gate"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "task.list": { "x-alp": { "effect": "query", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "tasks": { "type": "array", "items": { "$ref": "#/$defs/taskRow" } }, "unreadable": { "type": "array", "items": { "type": "object", "properties": { "file": { "type": "string" }, "error": { "type": "string" } }, "required": ["file", "error"], "additionalProperties": true } }, "revision": { "type": "string" } }, "required": ["projectRoot", "tasks", "unreadable", "revision"], "additionalProperties": true } }, "task.update": { "x-alp": { "effect": "mutation", "capability": "task", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "writes": ["<projectRoot>/.alp/tasks"], "idempotent": false }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" }, "id": { "$ref": "#/$defs/taskId" }, "action": { "enum": ["close", "reopen"] }, "note": { "type": "string", "maxLength": 2e3 }, "ifRev": { "type": "integer", "minimum": 0 } }, "required": ["projectRoot", "id", "action"], "additionalProperties": true }, "result": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "status": { "type": "string" }, "rev": { "type": "integer", "minimum": 0 }, "landed": { "type": "string" } }, "required": ["id", "status", "rev"], "additionalProperties": true } }, "team.list": { "x-alp": { "effect": "query", "capability": "team", "scope": { "kind": "project", "param": "projectRoot", "required": false, "reads": ["builtin", "library"] }, "idempotent": true }, "params": { "type": "object", "properties": { "projectRoot": { "$ref": "#/$defs/projectRoot" } }, "required": [], "additionalProperties": true }, "result": { "type": "object", "properties": { "projectRoot": { "type": ["string", "null"] }, "teams": { "type": "array", "items": { "$ref": "#/$defs/teamRow" } } }, "required": ["projectRoot", "teams"], "additionalProperties": true } }, "workspace.files.search": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files", "risks": ["lists file names of the directory (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "query": { "type": "string", "maxLength": 200 }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "files": { "type": "array", "maxItems": 100, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 } }, "required": ["path"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["files"], "additionalProperties": true } }, "workspace.files.list": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["lists names, kinds, sizes and times of a directory's entries (not contents)"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" } }, "required": ["projectRoot"], "additionalProperties": true }, "result": { "type": "object", "properties": { "entries": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "path": { "type": "string", "minLength": 1 }, "kind": { "enum": ["file", "directory"] }, "size": { "type": "integer", "minimum": 0 }, "modifiedAt": { "type": "string" } }, "required": ["name", "path", "kind"], "additionalProperties": true } }, "truncated": { "type": "boolean" } }, "required": ["entries"], "additionalProperties": true } }, "workspace.files.read": { "x-alp": { "effect": "query", "scope": { "kind": "project", "param": "projectRoot", "required": true }, "idempotent": true, "capability": "workspace.files.read", "risks": ["returns the content of a text file under the directory"] }, "params": { "type": "object", "properties": { "projectRoot": { "type": "string" }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "includeIgnored": { "type": "boolean" } }, "required": ["projectRoot", "path"], "additionalProperties": true }, "result": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1 }, "content": { "type": "string" }, "size": { "type": "integer", "minimum": 0, "maximum": 1048576 }, "modifiedAt": { "type": "string" } }, "required": ["path", "content", "size"], "additionalProperties": true } }, "session.history": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "idempotent": true, "capability": "session.history" }, "params": { "type": "object", "properties": { "sessionId": { "type": "string" }, "before": { "type": "string", "maxLength": 4096 }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "maxBytes": { "type": "integer", "minimum": 2048, "maximum": 524288 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "generation": { "type": "string" }, "items": { "type": "array", "maxItems": 500, "items": { "oneOf": [{ "$ref": "#/$defs/envelope" }, { "type": "object", "properties": { "cursor": { "type": "integer", "minimum": 0 }, "oversized": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"] } }, "required": ["cursor", "oversized"], "additionalProperties": false }] } }, "olderCursor": { "type": "string" }, "hasOlder": { "type": "boolean" }, "tipCursor": { "type": "integer", "minimum": 0 } }, "required": ["generation", "items", "hasOlder", "tipCursor"], "additionalProperties": true } }, "project.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeRemoved": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "projects": { "type": "array", "items": { "$ref": "#/$defs/registryProject" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["projects", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.list": { "params": { "type": "object", "properties": { "cursor": { "type": "string", "pattern": "^[0-9]+$" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500 }, "projectRoots": { "type": "array", "items": { "type": "string" } }, "includeArchived": { "type": "boolean" } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspaces": { "type": "array", "items": { "$ref": "#/$defs/registryWorkspace" } }, "revision": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 }, "nextCursor": { "type": ["string", "null"] } }, "required": ["workspaces", "revision", "total", "nextCursor"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.get": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.register": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "directory": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["directory", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "project.remove": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "projectId": { "type": "string" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["projectId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "project": { "$ref": "#/$defs/registryProject" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["project", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "workspace.update": { "params": { "type": "object", "properties": { "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "workspaceId": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinned": { "type": "boolean" }, "archived": { "type": "boolean" }, "authorizedRoots": { "type": "array", "items": { "type": "string" } } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.registry", "idempotent": true } }, "registry.owner": { "params": { "type": "object", "properties": { "operation": { "enum": ["project.add", "project.rename", "project.remove", "workspace.create", "workspace.update", "placement.prepare", "placement.assign", "label.assign", "label.update", "label.delete", "placement.remove"] }, "args": { "type": "object" }, "requestId": { "type": "string" }, "ifRevision": { "type": "integer", "minimum": 0 } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "registry": { "type": "object" } }, "required": ["registry"] }, "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "workspace.registry", "idempotent": false } }, "workspace.worktree.create": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "mappingId": { "type": "string", "maxLength": 64 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision", "mappingId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.remove": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "ifRevision": { "type": "integer", "minimum": 0 }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId", "requestId", "ifRevision"], "additionalProperties": false }, "result": { "type": "object", "properties": { "workspace": { "$ref": "#/$defs/registryWorkspace" }, "revision": { "type": "integer", "minimum": 0 }, "filesRemoved": { "type": "boolean" }, "branchRetained": { "type": "boolean" } }, "required": ["workspace", "revision"], "additionalProperties": false }, "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "workspace.worktree.options": { "params": { "type": "object", "properties": { "workspaceId": { "type": "string" }, "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "mappingIds": { "type": "array", "items": { "type": "string" } } }, "required": ["mappingIds"], "additionalProperties": false }, "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.worktree", "idempotent": true } }, "registry.worktree": { "params": { "type": "object", "properties": { "principalId": { "type": "string" }, "mappingIds": { "type": "array", "items": { "type": "string" } }, "authorizedRoots": { "type": "array", "items": { "type": "string" } }, "principalEpoch": { "type": "string" } }, "additionalProperties": false }, "result": { "type": "object", "additionalProperties": true }, "x-alp": { "effect": "query", "scope": { "kind": "host" }, "capability": "workspace.worktree" } }, "workspace.git.status": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["lists the changed file paths, branch and remote of a workspace checkout"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 } }, "required": ["workspaceId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "state": { "enum": ["repository", "not_repository", "unsupported"] }, "reason": { "type": "string" }, "branch": { "type": ["string", "null"] }, "detached": { "type": "boolean" }, "head": { "type": ["string", "null"] }, "upstream": { "type": ["object", "null"], "properties": { "ref": { "type": "string" }, "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ref", "ahead", "behind"], "additionalProperties": false }, "baseRef": { "type": ["string", "null"] }, "aheadBehind": { "type": ["object", "null"], "properties": { "ahead": { "type": "integer", "minimum": 0 }, "behind": { "type": "integer", "minimum": 0 } }, "required": ["ahead", "behind"], "additionalProperties": false }, "hasRemote": { "type": "boolean" }, "remoteUrl": { "type": ["string", "null"] }, "dirty": { "type": "boolean" }, "files": { "type": "array", "maxItems": 1e3, "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "staged": { "type": "boolean" }, "unstaged": { "type": "boolean" } }, "required": ["path", "change", "staged", "unstaged"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "snapshot": { "type": "string", "maxLength": 1024 } }, "required": ["state", "branch", "detached", "head", "upstream", "baseRef", "aheadBehind", "hasRemote", "remoteUrl", "dirty", "files", "hiddenCount", "truncated", "snapshot"], "additionalProperties": false } }, "workspace.git.diff": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "workspace.git", "idempotent": true, "risks": ["returns changed file content of a workspace checkout as diff hunks, including deleted and historical lines"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1 }, "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string", "minLength": 1, "maxLength": 255 }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode"], "additionalProperties": false }, "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "cursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["workspaceId", "compare"], "additionalProperties": false }, "result": { "type": "object", "properties": { "compare": { "type": "object", "properties": { "mode": { "enum": ["uncommitted", "staged", "unstaged", "base"] }, "baseRef": { "type": "string" }, "ignoreWhitespace": { "type": "boolean" } }, "required": ["mode", "ignoreWhitespace"], "additionalProperties": false }, "snapshot": { "type": "string", "maxLength": 1024 }, "files": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 }, "oldPath": { "type": "string", "minLength": 1, "maxLength": 4096 }, "change": { "enum": ["modified", "added", "deleted", "renamed", "copied", "typechange", "untracked", "conflicted"] }, "kind": { "enum": ["text", "binary", "too_large", "withheld", "symlink", "submodule"] }, "additions": { "type": "integer", "minimum": 0 }, "deletions": { "type": "integer", "minimum": 0 }, "hunks": { "type": "array", "items": { "type": "object", "properties": { "oldStart": { "type": "integer", "minimum": 0 }, "oldCount": { "type": "integer", "minimum": 0 }, "newStart": { "type": "integer", "minimum": 0 }, "newCount": { "type": "integer", "minimum": 0 }, "context": { "type": "string" }, "lines": { "type": "array", "items": { "type": "object", "properties": { "type": { "enum": ["add", "remove", "context"] }, "content": { "type": "string" }, "noNewline": { "const": true } }, "required": ["type", "content"], "additionalProperties": false } } }, "required": ["oldStart", "oldCount", "newStart", "newCount", "lines"], "additionalProperties": false } } }, "required": ["path", "change", "kind", "additions", "deletions", "hunks"], "additionalProperties": false } }, "hiddenCount": { "type": "integer", "minimum": 0 }, "truncated": { "type": "boolean" }, "nextCursor": { "type": "string", "minLength": 1, "maxLength": 1024 } }, "required": ["compare", "snapshot", "files", "hiddenCount", "truncated"], "additionalProperties": false } }, "attachment.begin": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "attachments", "idempotent": "with requestId", "risks": ["reserves stored bytes of the daemon host for a file the client uploads"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" }, "name": { "type": "string", "minLength": 1, "maxLength": 1024 }, "size": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "mimeType": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "requestId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "name", "size", "mimeType", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "state": { "enum": ["uploading", "committed"] }, "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 }, "maxChunkBytes": { "type": "integer", "minimum": 1 }, "expiresAt": { "type": "string" }, "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" } }, "required": ["uploadId", "state", "received", "size", "maxChunkBytes"], "additionalProperties": false } }, "attachment.chunk": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": "same offset and bytes", "risks": ["writes uploaded bytes to the daemon host"] }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "offset": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "data": { "type": "string", "minLength": 4, "maxLength": 349528, "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "offset", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "received": { "type": "integer", "minimum": 0 }, "size": { "type": "integer", "minimum": 0 } }, "required": ["received", "size"], "additionalProperties": false } }, "attachment.commit": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId", "sha256"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.abort": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "uploadId": { "type": "string", "pattern": "^upl_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["uploadId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "aborted": { "const": true } }, "required": ["aborted"], "additionalProperties": false } }, "attachment.get": { "x-alp": { "effect": "query", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": true }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "attachment": { "$ref": "#/$defs/attachment" } }, "required": ["attachment"], "additionalProperties": false } }, "attachment.delete": { "x-alp": { "effect": "mutation", "scope": { "kind": "session" }, "capability": "attachments", "idempotent": false }, "params": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["attachmentId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "deleted": { "const": true } }, "required": ["deleted"], "additionalProperties": false } }, "session.fork": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.fork", "idempotent": "with requestId", "risks": ["creates a new root session in the source workspace or a granted destination workspace; files are never copied, restored or changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "boundary": { "oneOf": [{ "type": "object", "properties": { "throughTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["throughTurnId"], "additionalProperties": false }, { "type": "object", "properties": { "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["beforeTurnId"], "additionalProperties": false }] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "newSessionId": { "type": "string", "pattern": "^[\\w.:-]{1,128}$" }, "title": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the bound project must be one of them." } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "duplicate": { "const": true } }, "required": ["session", "forkedFrom"], "additionalProperties": true } }, "session.rewind": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.rewind", "idempotent": "with requestId", "risks": ["replaces the conversation the runtime continues from; the later turns stay recoverable and no file is changed"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["sessionId", "requestId", "ifGeneration", "beforeTurnId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "branch": { "$ref": "#/$defs/conversationBranch" }, "duplicate": { "const": true } }, "required": ["session", "generation", "branch"], "additionalProperties": true } }, "session.reload": { "x-alp": { "effect": "mutation", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.reload", "idempotent": "with requestId", "risks": ["restarts the root's native process; its conversation, configuration, history and receipts are kept"] }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "ifGeneration": { "type": "string", "pattern": "^[0-9a-f]{32}$" } }, "required": ["sessionId", "requestId", "ifGeneration"], "additionalProperties": false }, "result": { "type": "object", "properties": { "session": { "$ref": "#/$defs/sessionSummary" }, "duplicate": { "const": true } }, "required": ["session"], "additionalProperties": true } }, "session.resumeCommand": { "x-alp": { "effect": "query", "scope": { "kind": "session", "param": "sessionId" }, "capability": "session.resumeCommand", "idempotent": true }, "params": { "type": "object", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 } }, "required": ["sessionId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "argv": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\u0000-\\u001f\\u007f]+$" } }, "posix": { "type": "string", "minLength": 1, "maxLength": 2048 }, "windows": { "type": "string", "minLength": 1, "maxLength": 2048 }, "display": { "type": "string", "minLength": 1, "maxLength": 2048 }, "platform": { "enum": ["posix", "windows"] } }, "required": ["argv", "posix", "windows", "display", "platform"], "additionalProperties": false } }, "terminal.create": { "x-alp": { "effect": "mutation", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": false, "risks": ["starts a shell on the daemon host as the daemon's account: host-level execution, not confined to the workspace"] }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "requestId": { "type": "string", "minLength": 1, "maxLength": 128 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["workspaceId", "cols", "rows", "requestId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" } }, "required": ["terminal"], "additionalProperties": false } }, "terminal.list": { "x-alp": { "effect": "query", "scope": { "kind": "project" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": [], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminals": { "type": "array", "items": { "$ref": "#/$defs/terminal" } } }, "required": ["terminals"], "additionalProperties": false } }, "terminal.attach": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true, "risks": ["streams the terminal's output, which may show anything the shell printed"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "after": { "type": "integer", "minimum": 0 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "terminal": { "$ref": "#/$defs/terminal" }, "nextSeq": { "type": "integer", "minimum": 1 }, "gap": { "type": "object", "properties": { "fromSeq": { "type": "integer", "minimum": 1 }, "toSeq": { "type": "integer", "minimum": 1 } }, "required": ["fromSeq", "toSeq"], "additionalProperties": false } }, "required": ["terminal", "nextSeq"], "additionalProperties": false } }, "terminal.input": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false, "risks": ["types into a host shell: runs any command as the daemon's account"] }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "data"], "additionalProperties": false }, "result": { "type": "object", "properties": { "bytes": { "type": "integer", "minimum": 1 } }, "required": ["bytes"], "additionalProperties": false } }, "terminal.resize": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": true }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId", "cols", "rows"], "additionalProperties": false }, "result": { "type": "object", "properties": { "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 } }, "required": ["cols", "rows"], "additionalProperties": false } }, "terminal.close": { "x-alp": { "effect": "mutation", "scope": { "kind": "terminal", "param": "terminalId" }, "capability": "terminal", "idempotent": false }, "params": { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "principalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Set by a trusted gateway on its own connection: the remote principal the request acts for. Absent: the local owner." }, "principalEpoch": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The grant epoch of principalId (a gateway credential scope). Absent: the local owner." }, "authorizedRoots": { "type": "array", "maxItems": 1024, "items": { "type": "string", "minLength": 1, "maxLength": 4096 }, "description": "Set by a trusted gateway: the canonical workspaces the principal may use now; the terminal's workspace must be one of them." } }, "required": ["terminalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "const": true } }, "required": ["closed"], "additionalProperties": false } }, "terminal.revoke": { "x-alp": { "effect": "mutation", "scope": { "kind": "host" }, "capability": "terminal", "idempotent": true, "risks": ["kills every terminal of a principal; for a trusted gateway, never exposed"] }, "params": { "type": "object", "properties": { "principalId": { "type": "string", "minLength": 1, "maxLength": 200 } }, "required": ["principalId"], "additionalProperties": false }, "result": { "type": "object", "properties": { "closed": { "type": "integer", "minimum": 0 } }, "required": ["closed"], "additionalProperties": false } } }, "$defs": { "error": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" }, "data": {} }, "required": ["code", "message"], "additionalProperties": true }, "session": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "promptImages": { "type": "boolean" }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy"], "additionalProperties": true }, "usage": { "type": "object", "properties": { "contextWindowUsedTokens": { "type": "integer", "minimum": 0 }, "contextWindowMaxTokens": { "type": "integer", "minimum": 1 }, "inputTokens": { "type": "integer", "minimum": 0 }, "cachedInputTokens": { "type": "integer", "minimum": 0 }, "outputTokens": { "type": "integer", "minimum": 0 }, "totalCostUsd": { "type": "number", "minimum": 0 } }, "additionalProperties": true }, "assignment": { "type": "object", "properties": { "id": { "type": "string" }, "agent": { "type": "string" }, "mode": { "type": "string" }, "status": { "type": "string" }, "startedAt": { "type": "string" }, "worktree": { "type": "object", "properties": { "branch": { "type": "string" }, "path": { "type": "string" } }, "required": ["branch", "path"], "additionalProperties": true } }, "required": ["id", "agent", "mode", "status", "startedAt"], "additionalProperties": true }, "mail": { "type": "object", "properties": { "id": { "type": "string" }, "kind": { "enum": ["question", "answer", "note", "steer", "result", "stalled", "board", "checkin"] }, "from": { "type": "string" }, "assignment": { "type": "string" }, "body": { "type": "string" }, "replyTo": { "type": "string" }, "result": { "type": "object" }, "redelivered": { "type": "boolean" } }, "required": ["id", "kind", "from", "assignment"], "additionalProperties": true }, "pin": { "type": "object", "properties": { "id": { "type": "string" }, "project": { "type": "string" }, "kind": { "enum": ["claim", "decision", "finding"] }, "body": { "type": "string" }, "paths": { "type": "array", "items": { "type": "string" } }, "agent": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "at": { "type": "string" }, "released": { "type": "string" }, "task": { "type": "string" } }, "required": ["id", "project", "kind", "body", "agent", "sessionId", "rootId", "at"], "additionalProperties": true }, "question": { "type": "object", "properties": { "id": { "type": "string" }, "sessionId": { "type": "string" }, "rootId": { "type": "string" }, "agent": { "type": "string" }, "body": { "type": "string" }, "options": { "type": "array", "items": { "type": "string" } }, "askedAt": { "type": "string" } }, "required": ["id", "sessionId", "rootId", "agent", "body", "askedAt"], "additionalProperties": true }, "attention": { "type": "object", "properties": { "reason": { "enum": ["finished", "error"] }, "at": { "type": "string" }, "turnId": { "type": "string" }, "message": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "spec": { "type": "object", "properties": { "cwd": { "type": "string" }, "agent": { "type": "string" }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "persist": { "type": "boolean" }, "restore": { "type": "object" } }, "required": ["cwd"], "additionalProperties": true }, "item": { "anyOf": [{ "$ref": "#/$defs/knownItem" }, { "$ref": "#/$defs/unknownItem" }] }, "event": { "anyOf": [{ "$ref": "#/$defs/knownEvent" }, { "$ref": "#/$defs/unknownEvent" }] }, "envelope": { "type": "object", "properties": { "sessionId": { "type": "string" }, "epoch": { "type": "string" }, "seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "ts": { "type": "string" }, "event": { "$ref": "#/$defs/event" }, "cursor": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, "required": ["sessionId", "epoch", "seq", "ts", "event"], "additionalProperties": true }, "request": { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }] }, "method": { "type": "string" }, "params": { "type": "object" } }, "required": ["jsonrpc", "method", "id"], "additionalProperties": true }, "response": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "result": {} }, "required": ["jsonrpc", "id", "result"], "additionalProperties": true }, { "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "id": { "anyOf": [{ "type": "string", "maxLength": 128 }, { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" }] }, "error": { "$ref": "#/$defs/error" } }, "required": ["jsonrpc", "id", "error"], "additionalProperties": true }] }, "notification": { "oneOf": [{ "type": "object", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "event" }, "params": { "$ref": "#/$defs/envelope" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }, { "type": "object", "description": "A terminal's output, exit or detach (capability terminal, \xA712.10).", "properties": { "jsonrpc": { "const": "2.0" }, "method": { "const": "terminal.event" }, "params": { "$ref": "#/$defs/terminalEvent" } }, "required": ["jsonrpc", "method", "params"], "additionalProperties": true }] }, "knownEvent": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "session.opened" }, "session": { "$ref": "#/$defs/session" }, "cwd": { "type": "string" }, "effective": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["model", "thinking"], "additionalProperties": true } }, "required": ["type", "session", "cwd", "effective"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.ready" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.updated" }, "session": { "$ref": "#/$defs/session" } }, "required": ["type", "session"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.closed" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "session.failed" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.accepted" }, "clientMessageId": { "type": "string" }, "result": { "enum": ["turn", "steer"] }, "turnId": { "type": "string" } }, "required": ["type", "clientMessageId", "result", "turnId"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "prompt.failed" }, "clientMessageId": { "type": "string" }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "clientMessageId", "error"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.started" }, "turnId": { "type": "string" }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["type", "turnId", "origin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "turn.ended" }, "turnId": { "type": "string" }, "state": { "enum": ["completed", "failed", "canceled"] }, "error": { "$ref": "#/$defs/alpError" } }, "required": ["type", "turnId", "state"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "item" }, "item": { "$ref": "#/$defs/item" } }, "required": ["type", "item"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "usage" }, "usage": { "$ref": "#/$defs/usage" } }, "required": ["type", "usage"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "mail" }, "mail": { "$ref": "#/$defs/mail" } }, "required": ["type", "mail"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "assignment" }, "assignment": { "$ref": "#/$defs/assignment" } }, "required": ["type", "assignment"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question" }, "question": { "$ref": "#/$defs/question" } }, "required": ["type", "question"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "question.resolved" }, "questionId": { "type": "string" }, "outcome": { "enum": ["answered", "dismissed", "timeout", "canceled"] }, "answer": { "type": "string" } }, "required": ["type", "questionId", "outcome"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "pin" }, "pin": { "$ref": "#/$defs/pin" } }, "required": ["type", "pin"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unpin" }, "pinId": { "type": "string" }, "reason": { "enum": ["unpinned", "session_ended"] } }, "required": ["type", "pinId", "reason"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "attention" }, "attention": { "$ref": "#/$defs/attention" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "history.reset" }, "generation": { "type": "string", "pattern": "^[0-9a-f]{32}$" }, "reason": { "const": "rewind" }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" } }, "required": ["type", "generation", "reason", "branchId"], "additionalProperties": true }] }, "unknownEvent": { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["session.opened", "session.ready", "session.updated", "session.closed", "session.failed", "prompt.accepted", "prompt.failed", "turn.started", "turn.ended", "item", "usage", "mail", "assignment", "question", "question.resolved", "pin", "unpin", "attention", "history.reset"] } } }, "required": ["type"], "additionalProperties": true }, "knownItem": { "oneOf": [{ "type": "object", "properties": { "kind": { "const": "user_message" }, "id": { "type": "string" }, "text": { "type": "string" }, "clientMessageId": { "type": "string" }, "images": { "type": "integer", "minimum": 1 }, "attachments": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "name": { "type": "string" }, "mimeType": { "type": "string" }, "size": { "type": "integer", "minimum": 0 } }, "required": ["attachmentId", "name", "mimeType", "size"], "additionalProperties": false } }, "origin": { "enum": ["user", "wake", "assignment", "runtime"] } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "assistant_message" }, "id": { "type": "string" }, "text": { "type": "string" } }, "required": ["kind", "id", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "notice" }, "id": { "type": "string" }, "level": { "enum": ["info", "warning", "error"] }, "text": { "type": "string" } }, "required": ["kind", "id", "level", "text"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "compaction" }, "id": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "trigger": { "type": "string" }, "preTokens": { "type": "integer" }, "postTokens": { "type": "integer" } }, "required": ["kind", "id", "status"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "todo" }, "id": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "text": { "type": "string" }, "status": { "enum": ["pending", "in_progress", "completed"] } }, "required": ["id", "text", "status"], "additionalProperties": true } } }, "required": ["kind", "id", "items"], "additionalProperties": true }, { "type": "object", "properties": { "kind": { "const": "tool_call" }, "id": { "type": "string" }, "callId": { "type": "string" }, "name": { "type": "string" }, "status": { "enum": ["running", "completed", "failed"] }, "error": { "type": "string" }, "detail": { "$ref": "#/$defs/toolCallDetail" } }, "required": ["kind", "id", "callId", "name", "status", "detail"], "additionalProperties": true }] }, "unknownItem": { "type": "object", "properties": { "kind": { "type": "string", "not": { "enum": ["user_message", "assistant_message", "notice", "compaction", "todo", "tool_call"] } }, "id": { "type": "string" } }, "required": ["kind", "id"], "additionalProperties": true }, "toolCallDetail": { "oneOf": [{ "type": "object", "properties": { "type": { "const": "shell" }, "command": { "type": "string" }, "cwd": { "type": "string" }, "output": { "type": "string" }, "exitCode": { "type": ["integer", "null"] } }, "required": ["type", "command", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "read" }, "filePath": { "type": "string" }, "content": { "type": "string" }, "offset": { "type": "integer" }, "limit": { "type": "integer" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "edit" }, "filePath": { "type": "string" }, "oldString": { "type": "string" }, "newString": { "type": "string" }, "unifiedDiff": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "write" }, "filePath": { "type": "string" }, "content": { "type": "string" } }, "required": ["type", "filePath"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "search" }, "query": { "type": "string" }, "toolName": { "enum": ["search", "grep", "glob", "web_search"] }, "content": { "type": "string" }, "filePaths": { "type": "array", "items": { "type": "string" } }, "webResults": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string" }, "url": { "type": "string" } }, "required": ["title", "url"], "additionalProperties": true } }, "numFiles": { "type": "integer" }, "numMatches": { "type": "integer" }, "truncated": { "type": "boolean" } }, "required": ["type", "query"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "fetch" }, "url": { "type": "string" }, "prompt": { "type": "string" }, "result": { "type": "string" }, "code": { "type": "integer" } }, "required": ["type", "url"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "sub_agent" }, "subAgentType": { "type": "string" }, "description": { "type": "string" }, "log": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plan" }, "text": { "type": "string" } }, "required": ["type", "text"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "plain_text" }, "label": { "type": "string" }, "text": { "type": "string" } }, "required": ["type"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "const": "unknown" }, "input": {}, "output": {} }, "required": ["type", "input", "output"], "additionalProperties": true }, { "type": "object", "properties": { "type": { "type": "string", "not": { "enum": ["shell", "read", "edit", "write", "search", "fetch", "sub_agent", "plan", "plain_text", "unknown"] } } }, "required": ["type"], "additionalProperties": true }] }, "alpError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "sessionSummary": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "status": { "enum": ["initializing", "idle", "running", "error", "closed"] }, "title": { "type": "string" }, "archived": { "type": "boolean" }, "attention": { "$ref": "#/$defs/attention" }, "lastError": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "conversation": { "type": "object", "properties": { "fork": { "type": "boolean" }, "rewind": { "type": "boolean" }, "reload": { "type": "boolean", "description": "Whether session.reload can restart this root's native process (\xA712.8); the root must also be open and idle." }, "reason": { "enum": ["runtime_unsupported", "not_persistent", "not_root"] }, "configure": { "type": "boolean", "description": "Whether session.configure can change this root's model, effort or team (\xA712.9); the root must also be open and idle." } }, "required": ["fork", "rewind"], "additionalProperties": true }, "forkedFrom": { "$ref": "#/$defs/forkProvenance" }, "branches": { "type": "array", "maxItems": 100, "items": { "$ref": "#/$defs/conversationBranch" } }, "promptAttachments": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["file.path", "document.native", "text.extract"] } } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "status"], "additionalProperties": true }, "pause": { "type": "object", "properties": { "since": { "type": "string" }, "by": { "type": "string" }, "reason": { "type": "string" }, "resetsAt": { "type": "string" }, "checkedAt": { "type": "string" } }, "required": ["since", "by", "reason"], "additionalProperties": true }, "pauseState": { "type": "object", "properties": { "all": { "$ref": "#/$defs/pause" }, "runtimes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/pause" } }, "parked": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "type": "string" }, "rootId": { "type": "string" }, "reason": { "type": "string" }, "since": { "type": "string" } }, "required": ["assignmentId", "agent", "runtime", "rootId", "reason", "since"], "additionalProperties": true } } }, "required": ["runtimes", "parked"], "additionalProperties": true }, "preview": { "type": "object", "properties": { "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } }, "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" } }, "required": ["teams", "team", "agent", "runtime", "model", "mode", "thinking"], "additionalProperties": true }, "treeStatus": { "type": "object", "properties": { "rootId": { "type": "string" }, "sessions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "projectRoot": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "mode": { "type": "string" }, "thinking": { "type": "string" }, "workflow": { "type": "object", "properties": { "mode": { "type": "string" }, "maxPeers": { "type": "integer" }, "supervisor": { "type": "boolean" } }, "required": ["mode", "maxPeers", "supervisor"], "additionalProperties": true }, "threadId": { "type": "string" }, "persistent": { "type": "boolean" }, "busy": { "type": "boolean" }, "parentId": { "type": "string" }, "toolCallId": { "type": "string" }, "activeTurnId": { "type": "string" }, "parked": { "type": "string" }, "instructionsSha": { "type": "string" }, "teamLabel": { "type": "string" }, "state": { "enum": ["running", "waiting", "waiting_parent", "waiting_user", "idle"] }, "idleMs": { "type": "number" }, "workdir": { "type": "string" }, "unreadMail": { "type": "integer", "minimum": 0 } }, "required": ["id", "projectRoot", "agent", "runtime", "model", "mode", "thinking", "workflow", "threadId", "persistent", "busy", "state", "idleMs", "workdir", "unreadMail"], "additionalProperties": true } }, "assignments": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "requester": { "type": "string" }, "isolation": { "enum": ["shared", "worktree"] }, "idleMs": { "type": "number" } }, "required": ["id", "requester", "isolation", "idleMs"], "additionalProperties": true } }, "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "worktrees": { "type": "array", "items": { "type": "object", "properties": { "assignmentId": { "type": "string" }, "requester": { "type": "string" }, "agent": { "type": "string" }, "branch": { "type": "string" }, "files": { "type": "array", "items": { "type": "string" } }, "stat": { "type": "string" } }, "required": ["assignmentId", "requester", "agent", "branch", "files", "stat"], "additionalProperties": true } }, "leases": { "type": "array", "items": { "type": "object", "properties": { "checkout": { "type": "string" }, "assignmentId": { "type": "string" }, "agent": { "type": "string" } }, "required": ["checkout", "assignmentId", "agent"], "additionalProperties": true } }, "claims": { "type": "array", "items": { "$ref": "#/$defs/pin" } } }, "required": ["rootId", "sessions", "assignments", "questions", "worktrees", "leases", "claims"], "additionalProperties": true }, "health": { "type": "object", "properties": { "live": { "type": "boolean" }, "ready": { "type": "boolean" }, "checks": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "ok": { "type": "boolean" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": ["id", "ok"], "additionalProperties": true } } }, "required": ["live", "ready", "checks"], "additionalProperties": true }, "projectRoot": { "type": "string", "minLength": 1, "maxLength": 4096, "description": "An absolute, normalized path on the daemon host to a directory holding .alp/. Compared as is: the daemon never walks up to a parent." }, "taskId": { "type": "string", "pattern": "^t-[0-9a-f]{4,12}(?:\\.\\d+)*$" }, "taskRow": { "type": "object", "properties": { "id": { "$ref": "#/$defs/taskId" }, "title": { "type": "string" }, "type": { "type": "string" }, "priority": { "type": "integer" }, "status": { "enum": ["open", "in_progress", "review", "closed"] }, "rev": { "type": "integer", "minimum": 0 }, "parent": { "type": "string" }, "assignee": { "type": "string" }, "ready": { "type": "boolean" }, "blockedBy": { "type": "array", "items": { "type": "string" } }, "waits": { "type": "array", "items": { "type": "string" } }, "approvals": { "type": "array", "items": { "type": "object", "properties": { "gate": { "type": "string" }, "note": { "type": "string" } }, "required": ["gate", "note"], "additionalProperties": true } }, "handoff": { "type": "object", "properties": { "outcome": { "type": "string" }, "summary": { "type": "string" }, "agent": { "type": "string" } }, "required": ["outcome", "summary"], "additionalProperties": true }, "closed": { "type": "object", "properties": { "reason": { "type": "string" }, "summary": { "type": "string" }, "at": { "type": "string" } }, "required": ["reason", "at"], "additionalProperties": true }, "description": { "type": "string" }, "labels": { "type": "array", "items": { "type": "string" } }, "paths": { "type": "array", "items": { "type": "string" } }, "progress": { "type": "object", "properties": { "done": { "type": "integer", "minimum": 0 }, "total": { "type": "integer", "minimum": 0 } }, "required": ["done", "total"], "additionalProperties": true }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": ["id", "title", "type", "priority", "status", "rev", "ready", "updatedAt"], "additionalProperties": true }, "libraryKind": { "enum": ["agents", "skills", "mcp", "hooks", "teams", "providers"] }, "libraryScope": { "enum": ["library", "project"] }, "librarySource": { "enum": ["builtin", "library", "project"] }, "entryName": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9_.-]+$", "not": { "enum": [".", ".."] } }, "libraryRevision": { "type": ["string", "null"] }, "libraryEntryRow": { "type": "object", "properties": { "name": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "description": { "type": "string" }, "usedBy": { "type": "array", "items": { "type": "string" } } }, "required": ["name", "source"], "additionalProperties": true }, "secretMarker": { "type": "object", "properties": { "$secret": { "const": "keep" } }, "required": ["$secret"], "additionalProperties": false, "description": "Stands for a stored secret value: read results carry it in place of the value; a save that sends it back keeps the stored value." }, "languageSetting": { "type": "object", "properties": { "language": { "type": ["string", "null"] }, "applies": { "type": "string" }, "default": { "type": "string" } }, "required": ["language", "applies", "default"], "additionalProperties": true }, "teamRow": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" }, "source": { "$ref": "#/$defs/librarySource" }, "overrides": { "$ref": "#/$defs/librarySource" }, "error": { "type": "string" } }, "required": ["id", "source"], "additionalProperties": true }, "promptImage": { "type": "object", "properties": { "type": { "const": "image" }, "mimeType": { "enum": ["image/png", "image/jpeg", "image/gif", "image/webp"] }, "data": { "type": "string", "minLength": 4, "maxLength": 6990508, "pattern": "^[A-Za-z0-9+/]+={0,2}$" }, "name": { "type": "string", "maxLength": 255 } }, "required": ["type", "mimeType", "data"], "additionalProperties": false }, "scheduleId": { "type": "string", "pattern": "^sch_[0-9a-f]{16}$" }, "scheduleError": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string" } }, "required": ["message"], "additionalProperties": true }, "scheduleJob": { "type": "object", "properties": { "id": { "$ref": "#/$defs/scheduleId" }, "projectRoot": { "$ref": "#/$defs/projectRoot" }, "sessionId": { "type": "string" }, "prompt": { "type": "string" }, "dueAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?(Z|[+-]\\d{2}:\\d{2})$" }, "status": { "enum": ["pending", "delivered", "failed", "cancelled"] }, "attempts": { "type": "integer", "minimum": 0 }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "deliveredAt": { "type": "string" }, "failedAt": { "type": "string" }, "cancelledAt": { "type": "string" }, "attemptedAt": { "type": "string" }, "lateByMs": { "type": "integer", "minimum": 0 }, "lastError": { "$ref": "#/$defs/scheduleError" } }, "required": ["id", "projectRoot", "sessionId", "prompt", "dueAt", "status", "attempts", "createdAt", "updatedAt"], "additionalProperties": true }, "registryProject": { "type": "object", "properties": { "id": { "type": "string" }, "root": { "type": "string" }, "customName": { "type": ["string", "null"] }, "addedAt": { "type": "string" }, "removedAt": { "type": ["string", "null"] }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" } }, "required": ["id", "root", "addedAt"], "additionalProperties": false }, "registryWorkspace": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "directory": { "type": "string" }, "title": { "type": ["string", "null"] }, "pinnedAt": { "type": ["string", "null"] }, "archivedAt": { "type": ["string", "null"] }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "revision": { "type": "integer", "minimum": 0 }, "canonical": { "type": "string" }, "idempotencyKey": { "type": "string" }, "branch": { "type": ["string", "null"] }, "managedWorktree": { "type": "boolean" } }, "required": ["id", "projectId", "directory", "labels", "createdAt"], "additionalProperties": false }, "attachment": { "type": "object", "description": "A committed attachment as clients see it: ids, display metadata and its digest, never a host path or URL.", "properties": { "attachmentId": { "type": "string", "pattern": "^att_[0-9a-f]{32}$" }, "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "mimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "detectedMimeType": { "type": "string", "minLength": 3, "maxLength": 255 }, "size": { "type": "integer", "minimum": 0 }, "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }, "createdAt": { "type": "string" }, "committedAt": { "type": "string" }, "referenced": { "type": "boolean" } }, "required": ["attachmentId", "sessionId", "name", "mimeType", "detectedMimeType", "size", "sha256", "createdAt", "committedAt", "referenced"], "additionalProperties": false }, "forkProvenance": { "type": "object", "description": "Where a fork came from (\xA712.7): the source root, and the turn its conversation was cut at.", "properties": { "sessionId": { "type": "string", "minLength": 1, "maxLength": 128 }, "turnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "boundary": { "enum": ["through", "before", "whole"] }, "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["sessionId", "boundary", "at"], "additionalProperties": true }, "conversationBranch": { "type": "object", "description": "Later turns a rewind set aside (\xA712.7): kept, never deleted, recoverable as a new session with session.fork { branchId }.", "properties": { "branchId": { "type": "string", "pattern": "^br_[0-9a-f]{16}$" }, "beforeTurnId": { "type": "string", "minLength": 1, "maxLength": 200 }, "turns": { "type": "integer", "minimum": 0 }, "at": { "type": "string", "minLength": 1, "maxLength": 64 } }, "required": ["branchId", "beforeTurnId", "turns", "at"], "additionalProperties": true }, "effectiveConfig": { "type": "object", "description": "The configuration a root runs with, or would after a change, as alpd resolved it (\xA712.9).", "properties": { "team": { "type": "string" }, "teamLabel": { "type": "string" }, "agent": { "type": "string" }, "runtime": { "enum": ["claude", "codex", "acp", "antigravity"] }, "model": { "type": "string" }, "thinking": { "type": "string" }, "mode": { "type": "string" }, "permissionProfile": { "type": "string", "description": "The permission profile capping the agent's mode, when one does." }, "supervisor": { "type": "boolean" }, "maxPeers": { "type": "integer" }, "delegates": { "type": "array", "items": { "type": "string" }, "description": "Agents the root may delegate to." }, "tools": { "type": "array", "items": { "type": "string" }, "description": "ALP tools the root's agent is given." }, "mcpServers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "kind": { "enum": ["stdio", "http"] } }, "required": ["name", "kind"], "additionalProperties": true } }, "hooks": { "type": "integer", "minimum": 0, "description": "How many hook commands the agent runs." }, "instructionsSha": { "type": "string" } }, "required": ["team", "agent", "runtime", "model", "thinking", "mode", "supervisor", "delegates", "tools", "mcpServers", "hooks"], "additionalProperties": true }, "configurePreview": { "type": "object", "properties": { "current": { "$ref": "#/$defs/effectiveConfig" }, "proposed": { "$ref": "#/$defs/effectiveConfig" }, "changes": { "type": "array", "items": { "enum": ["model", "thinking", "team", "mode"] } }, "restart": { "type": "boolean", "description": "Whether applying it restarts the root's native process (on its own conversation)." }, "allowed": { "type": "boolean", "description": "Whether session.configure would take it now; a busy tree may still refuse it later." }, "reason": { "enum": ["session_busy", "session_closed", "not_root", "runtime_unsupported", "runtime_mismatch", "agent_mismatch", "permission_escalation", "team_not_found", "invalid_params", "not_persistent"] }, "message": { "type": "string" }, "teams": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "label": { "type": "string" }, "description": { "type": "string" } }, "required": ["id", "label"], "additionalProperties": true } } }, "required": ["current", "proposed", "changes", "restart", "allowed", "teams"], "additionalProperties": true }, "configureOutcome": { "type": "object", "properties": { "status": { "enum": ["applied", "unchanged"] }, "requested": { "type": "object", "properties": { "model": { "type": "string" }, "thinking": { "type": "string" }, "team": { "type": "string" }, "mode": { "type": "string" } }, "additionalProperties": false }, "effective": { "$ref": "#/$defs/effectiveConfig" }, "restarted": { "type": "boolean" } }, "required": ["status", "requested", "effective", "restarted"], "additionalProperties": true }, "terminal": { "type": "object", "description": "A terminal as clients see it: ids, size and state, never a process id, shell path or host path.", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "workspaceId": { "type": "string", "minLength": 1, "maxLength": 200 }, "title": { "type": "string", "maxLength": 64 }, "cols": { "type": "integer", "minimum": 2, "maximum": 500 }, "rows": { "type": "integer", "minimum": 1, "maximum": 200 }, "state": { "enum": ["running", "exited"] }, "attached": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "lastActivityAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time" }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "endReason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] } }, "required": ["terminalId", "workspaceId", "title", "cols", "rows", "state", "attached", "createdAt", "lastActivityAt", "expiresAt"], "additionalProperties": false }, "terminalEvent": { "description": "params of a terminal.event notification (\xA712.10): sent only to the connection attached to the terminal.", "oneOf": [{ "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "output" }, "seq": { "type": "integer", "minimum": 1 }, "data": { "type": "string", "minLength": 1, "maxLength": 65536 } }, "required": ["terminalId", "type", "seq", "data"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "exit" }, "seq": { "type": "integer", "minimum": 1 }, "exitCode": { "type": ["integer", "null"] }, "signal": { "type": ["integer", "null"] }, "reason": { "enum": ["exited", "closed", "idle", "lifetime", "detached", "revoked", "disabled", "shutdown"] } }, "required": ["terminalId", "type", "seq", "exitCode", "signal", "reason"], "additionalProperties": false }, { "type": "object", "properties": { "terminalId": { "type": "string", "pattern": "^term_[0-9a-f]{32}$" }, "type": { "const": "detached" }, "reason": { "enum": ["replaced", "slow_consumer"] } }, "required": ["terminalId", "type", "reason"], "additionalProperties": false }] } } };
|
|
3
|
+
export {
|
|
4
|
+
METHODS_V1
|
|
5
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks the params of a v1 method. Absent params count as `{}`.
|
|
3
|
+
* @param {string} method
|
|
4
|
+
* @param {unknown} params
|
|
5
|
+
* @returns {import('./validate.js').SchemaIssue[] | undefined} undefined for a method v1 does not define
|
|
6
|
+
*/
|
|
7
|
+
export function validateParams(method: string, params: unknown): import("./validate.js").SchemaIssue[] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Checks the result of a v1 method.
|
|
10
|
+
* @param {string} method
|
|
11
|
+
* @param {unknown} result
|
|
12
|
+
* @returns {import('./validate.js').SchemaIssue[] | undefined} undefined for a method v1 does not define
|
|
13
|
+
*/
|
|
14
|
+
export function validateResult(method: string, result: unknown): import("./validate.js").SchemaIssue[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Checks one shared definition, such as `envelope`, `error` or `request`.
|
|
17
|
+
* @param {string} name
|
|
18
|
+
* @param {unknown} value
|
|
19
|
+
*/
|
|
20
|
+
export function validateDefinition(name: string, value: unknown): import("./validate.js").SchemaIssue[];
|
|
21
|
+
/** Capabilities a v1 daemon may list in its daemon.hello result; the schema documents each. */
|
|
22
|
+
export const CAPABILITIES: readonly string[];
|
|
23
|
+
import { METHODS_V1 } from './contract-v1.js';
|
|
24
|
+
import { validateSchema } from './validate.js';
|
|
25
|
+
export { METHODS_V1, validateSchema };
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// packages/protocol/src/contract.js
|
|
2
|
+
import { METHODS_V1 } from "./contract-v1.js";
|
|
3
|
+
import { validateSchema } from "./validate.js";
|
|
4
|
+
var CAPABILITIES = Object.freeze(Object.keys(METHODS_V1.capabilities));
|
|
5
|
+
var methodOf = (method) => Object.hasOwn(METHODS_V1.methods, method) ? (
|
|
6
|
+
/** @type {any} */
|
|
7
|
+
METHODS_V1.methods[method]
|
|
8
|
+
) : void 0;
|
|
9
|
+
function validateParams(method, params) {
|
|
10
|
+
const entry = methodOf(method);
|
|
11
|
+
return entry && validateSchema(entry.params, params === void 0 ? {} : params, METHODS_V1);
|
|
12
|
+
}
|
|
13
|
+
function validateResult(method, result) {
|
|
14
|
+
const entry = methodOf(method);
|
|
15
|
+
return entry && validateSchema(entry.result, result, METHODS_V1);
|
|
16
|
+
}
|
|
17
|
+
function validateDefinition(name, value) {
|
|
18
|
+
if (!Object.hasOwn(METHODS_V1.$defs, name)) throw new Error(`No definition ${name}`);
|
|
19
|
+
return validateSchema({ $ref: `#/$defs/${name}` }, value, METHODS_V1);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
CAPABILITIES,
|
|
23
|
+
METHODS_V1,
|
|
24
|
+
validateDefinition,
|
|
25
|
+
validateParams,
|
|
26
|
+
validateResult,
|
|
27
|
+
validateSchema
|
|
28
|
+
};
|