From 939a3baf1837fc8a8d64b8c6ad85af9952794e82 Mon Sep 17 00:00:00 2001 From: Philip Date: Thu, 29 Oct 2026 23:51:38 -0400 Subject: [PATCH 01/11] chore(contract): pin the runtime at 542f8efd for the plug-in host The runtime's integration/next branch adds the plug-in host (CONTRACT row B17, notes 50 to 60): the manifest, views, canvas, events, jobs, tools, settings and the plug-in API. Vendor its schemas and regenerate @rivethub/contract so the SDKs can build on those types. --- contract.json | 2 +- packages/contract/schema/accepted.schema.json | 13309 +++++++++++----- packages/contract/schema/sent.schema.json | 13291 +++++++++++---- packages/contract/src/accepted.ts | 5511 +++++-- packages/contract/src/sent.ts | 5505 +++++-- 5 files changed, 27018 insertions(+), 10600 deletions(-) diff --git a/contract.json b/contract.json index 6d5d7fa..6b761c9 100644 --- a/contract.json +++ b/contract.json @@ -1,4 +1,4 @@ { "repository": "philbert440/rivethub-runtime", - "ref": "ba386c48eca72acb93d9a26bafb9abd30a48253f" + "ref": "542f8efdef0080940149a275fbfd883e4e63a6ab" } diff --git a/packages/contract/schema/accepted.schema.json b/packages/contract/schema/accepted.schema.json index 7eb15ef..1e7fc92 100644 --- a/packages/contract/schema/accepted.schema.json +++ b/packages/contract/schema/accepted.schema.json @@ -97,8 +97,8 @@ "hermes", "codex", "opencode", - "pi", - "qwen-code", + "omp", + "dsh", "cursor", "cowork" ] @@ -333,6 +333,250 @@ "agent" ] }, + "HubProjectDefaults": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" + }, + { + "type": "null" + } + ] + }, + "harnessId": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "node": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "type": [ + "string", + "null" + ] + } + } + }, + "ThinkingLevel": { + "type": "string", + "enum": [ + "off", + "low", + "medium", + "high", + "xhigh" + ] + }, + "HubProject": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double", + "default": 0.0 + }, + "createdAt": { + "type": "integer", + "format": "int64", + "default": 0 + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/HubProjectDefaults" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name" + ] + }, + "HubLastSession": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "key", + "at" + ] + }, + "HubSessionMode": { + "type": "string", + "enum": [ + "chat", + "terminal" + ] + }, + "HubState": { + "type": "object", + "properties": { + "projects": { + "type": "array", + "items": { + "$ref": "#/$defs/HubProject" + }, + "default": [] + }, + "defaultProjectId": { + "type": [ + "string", + "null" + ] + }, + "membership": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "names": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "archived": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "pinned": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "hidden": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "modes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/HubSessionMode" + }, + "default": {} + }, + "lastSession": { + "anyOf": [ + { + "$ref": "#/$defs/HubLastSession" + }, + { + "type": "null" + } + ] + } + } + }, + "HubStateResponse": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "version", + "state" + ] + }, + "HubStatePutRequest": { + "type": "object", + "properties": { + "baseVersion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "baseVersion", + "state" + ] + }, + "hub.state": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "v", + "version" + ] + }, + "ProtocolVersion": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, "HarnessDescriptor": { "type": "object", "properties": { @@ -513,6 +757,12 @@ "null" ] }, + "effort": { + "type": [ + "string", + "null" + ] + }, "directory": { "type": [ "string", @@ -946,6 +1196,18 @@ "type": "null" } ] + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -1828,12 +2090,6 @@ } ] }, - "ProtocolVersion": { - "type": "integer", - "format": "uint8", - "minimum": 0, - "maximum": 255 - }, "AudioStatus": { "type": "object", "properties": { @@ -2214,6 +2470,22 @@ "null" ] }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, "tag": { "type": [ "string", @@ -2245,6 +2517,15 @@ "both" ] }, + "Role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "tool" + ] + }, "MemoryHitSource": { "type": "string", "enum": [ @@ -2389,16 +2670,7 @@ "content" ] }, - "Role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant", - "tool" - ] - }, - "MemoryFallback": { + "MemoryFallback": { "type": "string", "enum": [ "trigram" @@ -3217,6 +3489,165 @@ "messages" ] }, + "VectorState": { + "type": "string", + "enum": [ + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryNode": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "parentId": { + "type": [ + "string", + "null" + ] + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "content": { + "type": "string" + }, + "messageCount": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "earliestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "latestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sourceMessageIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "vector": { + "$ref": "#/$defs/VectorState" + } + }, + "required": [ + "id", + "level", + "kind", + "content", + "messageCount", + "createdAt", + "sourceMessageIds", + "vector" + ] + }, + "MemoryMessageTally": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "user": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "assistant": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "system": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "tool": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "embedded": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pending": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "failed": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "total", + "user", + "assistant", + "system", + "tool", + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryDagResponse": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "summaries": { + "type": "array", + "items": { + "$ref": "#/$defs/MemorySummaryNode" + } + }, + "messages": { + "$ref": "#/$defs/MemoryMessageTally" + } + }, + "required": [ + "sessionId", + "summaries", + "messages" + ] + }, "TopTool": { "type": "object", "properties": { @@ -4216,6 +4647,18 @@ "items": { "$ref": "#/$defs/DegradedProvider" } + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -4695,22 +5138,43 @@ "string", "null" ] + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] } }, "required": [ "text" ] }, - "ThinkingLevel": { - "type": "string", - "enum": [ - "off", - "low", - "medium", - "high", - "xhigh" - ] - }, "SessionPostAccepted": { "type": "object", "properties": { @@ -4737,6 +5201,45 @@ "message" ] }, + "SessionSteerRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + } + }, + "required": [ + "text" + ] + }, + "SessionSteerResponse": { + "type": "object", + "properties": { + "outcome": { + "$ref": "#/$defs/SteerOutcome" + } + }, + "required": [ + "outcome" + ] + }, + "SteerOutcome": { + "type": "string", + "enum": [ + "steered", + "startedNewTurn", + "promptRequired" + ] + }, "SessionWsClientMessage": { "type": "object", "properties": { @@ -4972,11 +5475,34 @@ } ] }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TranscriptAttachment" + } + }, "complete": { "type": "boolean" }, "compact": { "type": "boolean" + }, + "startedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "endedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -5042,19 +5568,48 @@ "tool_result" ] }, - "TranscriptWsFrame": { + "TranscriptAttachment": { "type": "object", "properties": { - "session": { + "mediaType": { "type": "string" }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "from": { - "type": "integer", + "uri": { + "type": [ + "string", + "null" + ] + }, + "uploadId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "mediaType" + ] + }, + "TranscriptWsFrame": { + "type": "object", + "properties": { + "session": { + "type": "string" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { + "type": "integer", "format": "uint64", "minimum": 0 }, @@ -5136,6 +5691,53 @@ "contextSource" ] }, + "SessionPreviewKind": { + "type": "string", + "enum": [ + "running", + "asking", + "approval", + "said" + ] + }, + "SessionPreview": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "kind": { + "$ref": "#/$defs/SessionPreviewKind" + }, + "text": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "kind", + "text", + "at" + ] + }, + "SessionPreviewList": { + "type": "object", + "properties": { + "previews": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionPreview" + } + } + }, + "required": [ + "previews" + ] + }, "HarnessTurnAccepted": { "type": "object", "properties": { @@ -5254,6 +5856,16 @@ } ] }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + }, "redirectedTo": { "anyOf": [ { @@ -5263,6 +5875,16 @@ "type": "null" } ] + }, + "switches": { + "anyOf": [ + { + "$ref": "#/$defs/SessionSwitches" + }, + { + "type": "null" + } + ] } }, "required": [ @@ -5293,6 +5915,165 @@ "protocol" ] }, + "StartupContext": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSection" + } + }, + "tokens": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "deliveredVia": { + "$ref": "#/$defs/DeliveredVia" + } + }, + "required": [ + "topicId", + "sections", + "tokens", + "deliveredVia" + ] + }, + "StartupSection": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/StartupKind" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "sources": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSource" + } + } + }, + "required": [ + "kind", + "title", + "text", + "sources" + ] + }, + "StartupKind": { + "type": "string", + "enum": [ + "topic", + "recent", + "relevant" + ] + }, + "StartupSource": { + "oneOf": [ + { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "wiki": { + "$ref": "#/$defs/WikiSlug" + } + }, + "required": [ + "wiki" + ], + "additionalProperties": false + } + ] + }, + "WikiSlug": { + "type": "string" + }, + "DeliveredVia": { + "type": "string", + "enum": [ + "metaAppend", + "cliFlag", + "none" + ] + }, + "SessionSwitches": { + "type": "object", + "properties": { + "model": { + "type": "boolean" + }, + "effort": { + "type": "boolean" + } + }, + "required": [ + "model", + "effort" + ] + }, + "HarnessSessionTitleRequest": { + "type": "object", + "properties": { + "title": { + "type": "string" + } + }, + "required": [ + "title" + ] + }, + "HarnessSessionForkRequest": { + "type": "object", + "properties": { + "prompts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "prompts" + ] + }, + "HarnessToolOutput": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "isError": { + "type": "boolean" + }, + "truncated": { + "type": "boolean" + } + }, + "required": [ + "text", + "isError", + "truncated" + ] + }, "HarnessSocketRefusalCode": { "type": "string", "enum": [ @@ -5402,6 +6183,12 @@ "format": "uint16", "minimum": 0, "maximum": 65535 + }, + "topicId": { + "type": [ + "string", + "null" + ] } } }, @@ -5979,6 +6766,9 @@ "id": { "type": "string" }, + "uri": { + "type": "string" + }, "name": { "type": "string" }, @@ -6003,6 +6793,7 @@ }, "required": [ "id", + "uri", "name", "bytes", "mediaType", @@ -6638,9 +7429,6 @@ "slug" ] }, - "WikiSlug": { - "type": "string" - }, "WikiHistoryEntry": { "type": "object", "properties": { @@ -6687,6 +7475,40 @@ "string", "null" ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6735,7 +7557,8 @@ "conversation", "task", "leaf", - "extract-wiki" + "extract-wiki", + "user" ] }, "WikiSourceSpan": { @@ -6846,6 +7669,12 @@ "items": { "type": "string" } + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6925,7 +7754,7 @@ "stalest": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/WikiTopic" } } }, @@ -6960,6 +7789,12 @@ }, "excerpt": { "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6991,2669 +7826,6855 @@ "total" ] }, - "AgentEvent": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { - "type": "string" - } - }, - "required": [ - "v", - "session" - ], + "ProposalState": { + "type": "string", + "enum": [ + "pending", + "approved", + "rejected" + ] + }, + "Proposer": { + "type": "string", + "enum": [ + "categorizer", + "backfill" + ] + }, + "TidyChange": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "merge" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "source": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type" + "kind", + "source", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "move" }, - "ts": { + "topic": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.user" + "const": "rename" }, - "text": { + "topic": { "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "name": { + "type": "string" } }, "required": [ - "type", - "text" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.agent" + "const": "close" }, - "text": { + "topic": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "thinking.delta" + "const": "delete" }, - "text": { + "topic": { "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "tool.start" + "const": "createTopic" }, - "tool": { + "topic": { "type": "string" }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true + "name": { + "type": "string" }, - "ts": { + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] + }, + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + }, + "default": [] + }, + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tool" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.plan" + "const": "fileInto" }, - "tasks": { + "topic": { + "type": "string" + }, + "sessions": { "type": "array", "items": { - "type": "string" - } + "$ref": "#/$defs/SessionId" + }, + "default": [] }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tasks" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.check" + "const": "mergePage" }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "page": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type", - "index" + "kind", + "page", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" + "const": "removePage" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "page": { + "type": "string" } }, "required": [ - "type", - "activity" + "kind", + "page" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "turn.end" + "const": "addType" }, - "ts": { + "topic": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic", + "name" ] } - ], - "unevaluatedProperties": true - }, - "SessionHarness": { - "type": "string" + ] }, - "AgentUsage": { + "TidySample": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "id": { + "type": "string" }, - "completionTokens": { + "title": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id" + ] + }, + "TidyEvidence": { + "type": "object", + "properties": { + "sessions": { "type": "integer", "format": "uint64", "minimum": 0 }, - "cachedTokens": { + "samples": { + "type": "array", + "items": { + "$ref": "#/$defs/TidySample" + }, + "default": [] + } + }, + "required": [ + "sessions" + ] + }, + "TidyProposal": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "batchId": { + "type": "string" + }, + "change": { + "$ref": "#/$defs/TidyChange" + }, + "reason": { + "type": "string" + }, + "evidence": { + "$ref": "#/$defs/TidyEvidence" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "state": { + "$ref": "#/$defs/ProposalState" + }, + "decidedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "id", + "batchId", + "change", + "reason", + "evidence", + "proposedBy", + "proposedAt", + "state" + ] + }, + "TidyBatch": { + "type": "object", + "properties": { + "batchId": { + "type": "string" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "proposals": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + } + }, + "required": [ + "batchId", + "proposedBy", + "proposedAt", + "proposals" + ] + }, + "TidyPending": { + "type": "object", + "properties": { + "batches": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyBatch" + } + } + }, + "required": [ + "batches" + ] + }, + "TidyFailure": { + "type": "object", + "properties": { + "proposalId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "proposalId", + "error" + ] + }, + "TidyBatchDecision": { + "type": "object", + "properties": { + "decided": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + }, + "failed": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyFailure" + }, + "default": [] + } + }, + "required": [ + "decided" + ] + }, + "FilingUpkeep": { + "type": "object", + "properties": { + "categorizer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "you": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "uncategorized": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "leftOut": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "correctionsLastWeek": { "type": "integer", "format": "uint64", "minimum": 0 } }, "required": [ - "promptTokens", - "completionTokens", - "cachedTokens" + "categorizer", + "you", + "uncategorized", + "leftOut", + "correctionsLastWeek" ] }, - "AgentEventKind": { + "EntityTypeCount": { + "type": "object", + "properties": { + "typeId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "entities": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "typeId", + "name", + "entities" + ] + }, + "WikiUpkeep": { + "type": "object", + "properties": { + "topicPages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "entityTypes": { + "type": "array", + "items": { + "$ref": "#/$defs/EntityTypeCount" + } + }, + "loosePages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "topicPages", + "entityTypes", + "loosePages" + ] + }, + "WorkerActivity": { + "type": "object", + "properties": { + "lastFinishedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "failing": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "failing" + ] + }, + "WorkerUpkeep": { + "type": "object", + "properties": { + "embedder": { + "$ref": "#/$defs/WorkerActivity" + }, + "summarizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "categorizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "wikiBuilder": { + "$ref": "#/$defs/WorkerActivity" + } + }, + "required": [ + "embedder", + "summarizer", + "categorizer", + "wikiBuilder" + ] + }, + "MemoryUpkeep": { + "type": "object", + "properties": { + "filing": { + "$ref": "#/$defs/FilingUpkeep" + }, + "wiki": { + "$ref": "#/$defs/WikiUpkeep" + }, + "workers": { + "$ref": "#/$defs/WorkerUpkeep" + }, + "pendingProposals": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "filing", + "wiki", + "workers", + "pendingProposals" + ] + }, + "TopicDirectory": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "local" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "path": { + "type": "string" } }, "required": [ - "type" + "kind", + "node", + "path" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "shared" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "path": { + "type": "string" } }, "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.user" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.agent" - }, - "text": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "thinking.delta" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool.start" - }, - "tool": { - "type": "string" - }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tool" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.plan" - }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tasks" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.check" - }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "index" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "activity" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type" + "kind", + "path" ] } ] }, - "LiveSessionSummary": { + "TopicKind": { + "type": "string", + "enum": [ + "work", + "type", + "entity" + ] + }, + "PlacedBy": { + "type": "string", + "enum": [ + "you", + "categorizer" + ] + }, + "TopicRecord": { "type": "object", "properties": { "id": { "type": "string" }, + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { + "type": "string" + }, "name": { "type": "string" }, - "harness": { + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { "anyOf": [ { - "$ref": "#/$defs/SessionHarness" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] }, - "lastEventTs": { + "createdAt": { + "type": "integer", + "format": "int64" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "closedAt": { "type": [ "integer", "null" ], "format": "int64" - }, - "pty": { + } + }, + "required": [ + "id", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt" + ] + }, + "TopicSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { + "type": "string" + }, + "name": { + "type": "string" + }, + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { "type": [ "string", "null" ] }, - "contextWindow": { + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "closedAt": { "type": [ "integer", "null" ], + "format": "int64" + }, + "sessionCount": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "compactAt": { + "lastActive": { "type": [ "integer", "null" ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ "id", - "name" + "slug", + "name", + "aliases", + "createdAt", + "updatedAt", + "sessionCount" ] }, - "SessionLogLine": { + "TopicList": { "type": "object", "properties": { - "who": { - "type": "string" - }, - "text": { - "type": "string" + "topics": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSummary" + } } }, "required": [ - "who", - "text" + "topics" ] }, - "SessionView": { + "TopicCreateRequest": { "type": "object", "properties": { - "title": { + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "name": { "type": "string" }, - "activity": { - "$ref": "#/$defs/Activity" + "aliases": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] }, - "tool": { + "parent": { "type": [ "string", "null" ] }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "thought": { - "type": "string" - }, - "lastMessage": { - "type": "string" - }, - "log": { - "type": "array", - "items": { - "$ref": "#/$defs/SessionLogLine" - } - }, - "term": { - "type": "array", - "items": { - "type": "string" - } - }, - "ended": { - "type": "boolean" - } - }, - "required": [ - "title", - "activity", - "tasks", - "thought", - "lastMessage", - "log", - "term", - "ended" - ] - }, - "LiveSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/LiveSessionSummary" - } + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "sessions" + "name" ] }, - "StateResponse": { + "WikiPageEdit": { "type": "object", "properties": { - "session": { - "type": "string" + "currentState": { + "type": [ + "string", + "null" + ] }, - "state": { - "$ref": "#/$defs/SessionView" + "article": { + "type": [ + "string", + "null" + ] } }, - "required": [ - "session", - "state" - ] + "additionalProperties": false }, - "snapshot": { + "TopicUpdate": { "type": "object", "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "name": { + "type": [ + "string", + "null" + ] }, - "sessions": { - "type": "array", + "aliases": { + "type": [ + "array", + "null" + ], "items": { - "$ref": "#/$defs/LiveSessionSummary" + "type": "string" } }, - "rooms": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/SessionView" - } + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, - "required": [ - "v", - "sessions", - "rooms" - ] + "additionalProperties": false }, - "session.removed": { + "TopicMergeRequest": { "type": "object", "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { + "into": { "type": "string" } }, + "additionalProperties": false, "required": [ - "v", - "session" + "into" ] }, - "SessionBroadcast": { - "anyOf": [ - { - "$ref": "#/$defs/snapshot" + "TopicPlacement": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" }, - { - "$ref": "#/$defs/session.removed" + "topicId": { + "type": "string" }, - { - "$ref": "#/$defs/AgentEvent" + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" } + }, + "required": [ + "sessionId", + "topicId", + "by", + "at" ] }, - "CaptureBatchRequest": { + "TopicSuggestion": { "type": "object", "properties": { - "session_key": { - "type": "string" - }, - "agent": { + "name": { "type": "string" }, - "channel": { + "topicId": { "type": [ "string", "null" ] }, - "title": { + "parentId": { "type": [ "string", "null" ] - }, - "settings": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "task_id": { - "type": [ - "string", - "null" - ] - }, - "finalize": { - "type": [ - "boolean", - "null" - ] - }, - "created_at": { + } + }, + "required": [ + "name" + ] + }, + "PlacementReply": { + "type": "object", + "properties": { + "placement": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicPlacement" }, { "type": "null" } ] }, - "updated_at": { + "suggestion": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicSuggestion" }, { "type": "null" } ] + } + } + }, + "PlacementRequest": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "topicId" + ] + }, + "SessionHistoryMark": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "messages": { + "markedAt": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "markedAt" + ] + }, + "SessionHistoryList": { + "type": "object", + "properties": { + "sessions": { "type": "array", "items": { - "$ref": "#/$defs/CaptureMessage" + "$ref": "#/$defs/SessionHistoryMark" } } }, "required": [ - "session_key", - "agent", - "messages" + "sessions" ] }, - "CaptureMessage": { + "TopicSession": { "type": "object", "properties": { - "event_id": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { "type": "string" }, - "role": { - "$ref": "#/$defs/Role" + "by": { + "$ref": "#/$defs/PlacedBy" }, - "content": { - "type": "string" + "at": { + "type": "integer", + "format": "int64" }, - "tool_name": { + "title": { "type": [ "string", "null" ] }, - "tool_args": { + "lastActive": { "type": [ - "object", + "integer", "null" ], - "additionalProperties": true + "format": "int64" }, - "tool_result": { + "node": { "type": [ "string", "null" ] + } + }, + "required": [ + "sessionId", + "topicId", + "by", + "at" + ] + }, + "TopicSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } }, - "metadata": { + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + }, + "default": [] + } + }, + "required": [ + "sessions" + ] + }, + "TopicConversation": { + "type": "object", + "properties": { + "conversationId": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "channel": { + "type": "string" + }, + "title": { "type": [ - "object", + "string", + "null" + ] + }, + "lastActive": { + "type": [ + "integer", "null" ], - "additionalProperties": true + "format": "int64" }, - "created_at": { + "node": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "conversationId", + "topicId", + "by", + "at", + "channel" + ] + }, + "ConversationPlacement": { + "type": "object", + "properties": { + "conversationId": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "conversationId", + "topicId", + "by", + "at" + ] + }, + "ConversationPlacementReply": { + "type": "object", + "properties": { + "placement": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/ConversationPlacement" + }, + { + "type": "null" + } + ] + } + } + }, + "TopicPage": { + "type": "object", + "properties": { + "topic": { + "$ref": "#/$defs/TopicRecord" + }, + "page": { + "anyOf": [ + { + "$ref": "#/$defs/WikiPageResponse" }, { "type": "null" } ] + }, + "mentions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicMention" + }, + "default": [] } }, "required": [ - "event_id", - "role", - "content" + "topic" ] }, - "CaptureResult": { + "TopicMention": { "type": "object", "properties": { - "ok": { - "type": "boolean" - }, - "conversation_id": { + "topicId": { "type": "string" }, - "inserted": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "skipped": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": "string" } }, "required": [ - "ok", - "conversation_id", - "inserted", - "skipped" + "topicId", + "name" ] }, - "HookEventName": { + "DecisionStatus": { "type": "string", "enum": [ - "provider:before", - "provider:after", - "provider:error", - "tool:before", - "tool:after", - "session:start", - "session:end", - "turn:before", - "turn:after", - "turn:reflect", - "skill:before", - "skill:after", - "compact:before", - "compact:after", - "delegation:before", - "delegation:after" + "active", + "superseded" ] }, - "HookContextBase": { + "TopicDecision": { "type": "object", "properties": { - "agentId": { + "id": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "text": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DecisionStatus" + }, + "supersededBy": { "type": [ "string", "null" ] }, + "by": { + "type": "string" + }, "sessionId": { - "type": [ - "string", - "null" + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } ] }, - "timestamp": { + "createdAt": { "type": "integer", "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": true + "updatedAt": { + "type": "integer", + "format": "int64" } }, "required": [ - "timestamp", - "metadata" - ] - }, - "ReflectionSource": { - "type": "string", - "enum": [ - "complexity", - "periodic", - "manual" - ] - }, - "DelegationHookStatus": { - "type": "string", - "enum": [ - "completed", - "failed", - "timeout", - "cached" + "id", + "topicId", + "text", + "status", + "by", + "createdAt", + "updatedAt" ] }, - "HookUsage": { + "TopicDecisionList": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completionTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "decisions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicDecision" + } } }, "required": [ - "promptTokens", - "completionTokens" + "decisions" ] }, - "SessionTokens": { + "DecisionCreateRequest": { "type": "object", "properties": { - "prompt": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "text": { + "type": "string" }, - "completion": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "prompt", - "completion" + "text" ] }, - "TurnComplexity": { + "DecisionUpdate": { "type": "object", "properties": { - "toolCallCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hadErrorRecovery": { - "type": "boolean" - }, - "hadUserCorrection": { - "type": "boolean" - }, - "uniqueTools": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "text": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "toolCallCount", - "hadErrorRecovery", - "hadUserCorrection", - "uniqueTools" + "text" ] }, - "HookContext": { + "DecisionSupersedeRequest": { "type": "object", "properties": { - "agentId": { + "text": { "type": [ "string", "null" ] }, "sessionId": { - "type": [ - "string", - "null" + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } ] + } + }, + "additionalProperties": false + }, + "DecisionSuperseded": { + "type": "object", + "properties": { + "superseded": { + "$ref": "#/$defs/TopicDecision" }, - "timestamp": { - "type": "integer", - "format": "int64" + "replacement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDecision" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "superseded" + ] + }, + "AgentEvent": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, - "metadata": { - "type": "object", - "additionalProperties": true + "session": { + "type": "string" } }, "required": [ - "timestamp", - "metadata" + "v", + "session" ], "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } + "const": "session.start" }, - "skip": { + "title": { "type": [ - "boolean", + "string", "null" ] - } - }, - "required": [ - "event", - "providerId", - "model", - "messages" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:after" - }, - "providerId": { - "type": "string" }, - "model": { - "type": "string" + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "error": { - "type": "string" + "const": "session.end" }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" + "const": "message.user" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" + "const": "message.agent" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "model": { + "type": [ + "string", + "null" + ] }, "durationMs": { - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint64", "minimum": 0 }, - "isError": { - "type": "boolean" - } - }, - "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:start" - }, - "platform": { - "type": [ - "string", - "null" + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/AgentUsage" + }, + { + "type": "null" + } ] }, - "userId": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "thinking.delta" }, - "turnCount": { + "text": { + "type": "string" + }, + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:before" + "const": "tool.start" }, - "userMessage": { - "$ref": "#/$defs/Message" + "tool": { + "type": "string" }, - "skip": { + "args": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "userMessage" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" + "const": "task.plan" }, - "toolsUsed": { + "tasks": { "type": "array", "items": { "type": "string" } }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "const": "task.check" }, - "iterations": { + "index": { "type": "integer", "format": "uint32", "minimum": 0 }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" - }, - "userMessage": { - "$ref": "#/$defs/Message" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" + "const": "activity" }, - "skip": { - "type": [ - "boolean", - "null" - ] + "activity": { + "$ref": "#/$defs/Activity" }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" + "const": "turn.end" }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "type" + ] + } + ], + "unevaluatedProperties": true + }, + "SessionHarness": { + "type": "string" + }, + "AgentUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens", + "cachedTokens" + ] + }, + "AgentEventKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.start" }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "title": { + "type": [ + "string", + "null" + ] }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:before" + "const": "session.end" }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "messageCount" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:after" + "const": "message.user" }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "text": { + "type": "string" }, - "summary": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "remainingMessages" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" + "const": "message.agent" }, - "task": { + "text": { "type": "string" }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { + "model": { "type": [ - "boolean", + "string", "null" ] }, - "blockReason": { + "durationMs": { "type": [ - "string", + "integer", "null" + ], + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/AgentUsage" + }, + { + "type": "null" + } ] + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:after" + "const": "thinking.delta" }, - "fromAgent": { + "text": { "type": "string" }, - "toAgent": { - "type": "string" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool.start" }, - "task": { + "tool": { "type": "string" }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "toolsUsed": { + "args": { "type": [ - "array", + "object", "null" ], - "items": { - "type": "string" - } + "additionalProperties": true }, - "cached": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" + "type", + "tool" ] - } - ] - }, - "Message": { - "type": "object", - "properties": { - "role": { - "$ref": "#/$defs/Role" - }, - "content": { - "$ref": "#/$defs/MessageContent" - }, - "reasoning": { - "type": [ - "string", - "null" - ] - }, - "toolCalls": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ToolCall" - } - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "role", - "content" - ] - }, - "MessageContent": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/ContentPart" - } - } - ] - }, - "ToolCall": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "arguments": { - "type": "object", - "additionalProperties": true }, - "thoughtSignature": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "arguments" - ] - }, - "HookContextKind": { - "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" + "const": "task.plan" }, - "messages": { + "tasks": { "type": "array", "items": { - "$ref": "#/$defs/Message" + "type": "string" } }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "messages" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:after" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "const": "task.check" }, - "latencyMs": { + "index": { "type": "integer", - "format": "uint64", + "format": "uint32", "minimum": 0 }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" + "const": "activity" }, - "error": { - "type": "string" + "activity": { + "$ref": "#/$defs/Activity" }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "const": "turn.end" }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type" ] + } + ] + }, + "LiveSessionSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "tool:after" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": "string" + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/SessionHarness" }, - "isError": { - "type": "boolean" + { + "type": "null" } - }, - "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:start" - }, - "platform": { - "type": [ - "string", - "null" - ] - }, - "userId": { - "type": [ + "lastEventTs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "pty": { + "type": [ + "string", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name" + ] + }, + "SessionLogLine": { + "type": "object", + "properties": { + "who": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "required": [ + "who", + "text" + ] + }, + "SessionView": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "activity": { + "$ref": "#/$defs/Activity" + }, + "tool": { + "type": [ + "string", + "null" + ] + }, + "tasks": { + "type": "array", + "items": { + "type": "string" + } + }, + "thought": { + "type": "string" + }, + "lastMessage": { + "type": "string" + }, + "log": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionLogLine" + } + }, + "term": { + "type": "array", + "items": { + "type": "string" + } + }, + "ended": { + "type": "boolean" + } + }, + "required": [ + "title", + "activity", + "tasks", + "thought", + "lastMessage", + "log", + "term", + "ended" + ] + }, + "LiveSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "StateResponse": { + "type": "object", + "properties": { + "session": { + "type": "string" + }, + "state": { + "$ref": "#/$defs/SessionView" + } + }, + "required": [ + "session", + "state" + ] + }, + "snapshot": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + }, + "rooms": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/SessionView" + } + } + }, + "required": [ + "v", + "sessions", + "rooms" + ] + }, + "session.removed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ] + }, + "SessionBroadcast": { + "type": "object", + "additionalProperties": true + }, + "CaptureBatchRequest": { + "type": "object", + "properties": { + "session_key": { + "type": "string" + }, + "agent": { + "type": "string" + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "settings": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "task_id": { + "type": [ + "string", + "null" + ] + }, + "finalize": { + "type": [ + "boolean", + "null" + ] + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } + ] + }, + "updated_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } + ] + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/CaptureMessage" + } + } + }, + "required": [ + "session_key", + "agent", + "messages" + ] + }, + "CaptureMessage": { + "type": "object", + "properties": { + "event_id": { + "type": "string" + }, + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "type": "string" + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, + "tool_args": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "tool_result": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event_id", + "role", + "content" + ] + }, + "CaptureResult": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "conversation_id": { + "type": "string" + }, + "inserted": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "conversation_id", + "inserted", + "skipped" + ] + }, + "HookEventName": { + "type": "string", + "enum": [ + "provider:before", + "provider:after", + "provider:error", + "tool:before", + "tool:after", + "session:start", + "session:end", + "turn:before", + "turn:after", + "turn:reflect", + "skill:before", + "skill:after", + "compact:before", + "compact:after", + "delegation:before", + "delegation:after" + ] + }, + "HookContextBase": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ] + }, + "ReflectionSource": { + "type": "string", + "enum": [ + "complexity", + "periodic", + "manual" + ] + }, + "DelegationHookStatus": { + "type": "string", + "enum": [ + "completed", + "failed", + "timeout", + "cached" + ] + }, + "HookUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "SessionTokens": { + "type": "object", + "properties": { + "prompt": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "prompt", + "completion" + ] + }, + "TurnComplexity": { + "type": "object", + "properties": { + "toolCallCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hadErrorRecovery": { + "type": "boolean" + }, + "hadUserCorrection": { + "type": "boolean" + }, + "uniqueTools": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "toolCallCount", + "hadErrorRecovery", + "hadUserCorrection", + "uniqueTools" + ] + }, + "HookContext": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ], + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "event", + "providerId", + "model", + "messages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" + } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 + } + }, + "required": [ + "event", + "providerId", + "model", + "error" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] + } + ] + }, + "Message": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "$ref": "#/$defs/MessageContent" + }, + "reasoning": { + "type": [ + "string", + "null" + ] + }, + "toolCalls": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ToolCall" + } + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "role", + "content" + ] + }, + "MessageContent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ContentPart" + } + } + ] + }, + "ToolCall": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "arguments": { + "type": "object", + "additionalProperties": true + }, + "thoughtSignature": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "arguments" + ] + }, + "HookContextKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "event", + "providerId", + "model", + "messages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" + } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" + }, + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 + } + }, + "required": [ + "event", + "providerId", + "model", + "error" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] + } + ] + }, + "HookPipelineError": { + "type": "object", + "properties": { + "hookId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "hookId", + "error" + ] + }, + "HookPipelineResult": { + "type": "object", + "properties": { + "context": { + "$ref": "#/$defs/HookContext" + }, + "aborted": { + "type": "boolean" + }, + "skipped": { + "type": "boolean" + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/$defs/HookPipelineError" + } + }, + "ran": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "context", + "aborted", + "skipped", + "errors", + "ran" + ] + }, + "HookErrorMode": { + "type": "string", + "enum": [ + "continue", + "abort", + "retry" + ] + }, + "HookConfig": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "event": { + "$ref": "#/$defs/HookEventName" + }, + "type": { + "$ref": "#/$defs/HookConfigKind" + }, + "target": { + "type": "string" + }, + "priority": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "onError": { + "anyOf": [ + { + "$ref": "#/$defs/HookErrorMode" + }, + { + "type": "null" + } + ] + }, + "agentFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "toolFilter": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "enabled": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "event", + "type", + "target" + ] + }, + "HookConfigKind": { + "type": "string", + "enum": [ + "shell", + "http", + "internal" + ] + }, + "RosterCommand": { + "type": "string", + "enum": [ + "claude", + "grok", + "kimi", + "opencode", + "hermes", + "codex", + "omp", + "dsh", + "cursor", + "cowork" + ] + }, + "ApprovalDecision": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session" + ] + }, + "ApprovalOutcome": { + "type": "string", + "enum": [ + "allow", + "deny", + "allow-session", + "external" + ] + }, + "HarnessStatus": { + "type": "string", + "enum": [ + "working", + "blocked", + "idle" + ] + }, + "StatusPhase": { + "type": "string", + "enum": [ + "thinking", + "tool", + "writing", + "prompt" + ] + }, + "StatusSource": { + "type": "string", + "enum": [ + "herdr", + "transcript", + "hooks", + "protocol" + ] + }, + "HarnessEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "assistant-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "reasoning-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-use" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-update" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-result" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "output": { + "type": "string" + }, + "isError": { + "type": [ + "boolean", + "null" + ] + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "output" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "options": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ApprovalOption" + } + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/ApprovalOutcome" + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "decision" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-created" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "summary": { + "$ref": "#/$defs/HarnessSessionSummary" + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "summary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "plan" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/$defs/PlanEntry" + } + } + }, + "required": [ + "type", + "sessionId", + "entries" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn-complete" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "turnId": { + "type": [ + "string", + "null" + ] + }, + "stopReason": { + "type": [ + "string", + "null" + ] + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/LlmUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "error" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "code": { + "type": "string" + }, + "deliveryId": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "retryable": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "code", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-updated" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "previousSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "transcript" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessTranscriptTurn" + } + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "truncatedBefore": { + "type": [ + "boolean", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "rev", + "from", + "total", + "turns", + "command" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "$ref": "#/$defs/HarnessStatusFrame", + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "prompt" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "promptId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/PromptKind" + }, + "toolName": { + "type": "string" + }, + "questions": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptQuestion" + } + }, + "resolved": { + "anyOf": [ + { + "$ref": "#/$defs/PromptResolution" + }, + { + "type": "null" + } + ] + }, + "screen": { + "anyOf": [ + { + "$ref": "#/$defs/PromptScreen" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "promptId", + "kind", + "toolName", + "questions" + ] + } + ] + }, + "ApprovalOption": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "key", + "label" + ] + }, + "HarnessSessionSummary": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/$defs/Millis" + }, + "updatedAt": { + "$ref": "#/$defs/Millis" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "transport": { + "anyOf": [ + { + "$ref": "#/$defs/Transport" + }, + { + "type": "null" + } + ] + }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sessionId", + "harnessId", + "createdAt", + "updatedAt", + "status" + ], + "additionalProperties": true + }, + "PlanEntry": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/PlanStatus" + } + }, + "required": [ + "content", + "status" + ] + }, + "PlanStatus": { + "type": "string", + "enum": [ + "pending", + "in_progress", + "completed" + ] + }, + "LlmUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reasoningTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheCreationTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheReadTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "StatusTool": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name" + ] + }, + "HarnessStatusFrame": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessStatus" + }, + "since": { + "type": "integer", + "format": "int64" + }, + "source": { + "anyOf": [ + { + "$ref": "#/$defs/StatusSource" + }, + { + "type": "null" + } + ] + }, + "phase": { + "anyOf": [ + { + "$ref": "#/$defs/StatusPhase" + }, + { + "type": "null" + } + ] + }, + "tool": { + "anyOf": [ + { + "$ref": "#/$defs/StatusTool" + }, + { + "type": "null" + } + ] + }, + "promptId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "status", + "since" + ] + }, + "PromptKind": { + "type": "string", + "enum": [ + "ask-user" + ] + }, + "PromptQuestion": { + "type": "object", + "properties": { + "question": { + "type": [ + "string", + "null" + ] + }, + "header": { + "type": [ + "string", + "null" + ] + }, + "multiSelect": { + "type": "boolean" + }, + "freeText": { + "type": [ + "boolean", + "null" + ] + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptOption" + } + } + }, + "required": [ + "multiSelect", + "options" + ] + }, + "PromptOption": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "label" + ] + }, + "PromptResolution": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "answerText": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "at" + ] + }, + "PromptScreen": { + "type": "object", + "properties": { + "current": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "current", + "total" + ] + }, + "HarnessCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + }, + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + }, + "turnOptions": { + "type": [ + "boolean", + "null" + ] + }, + "launchModel": { + "type": [ + "boolean", + "null" + ] + }, + "imageAttachments": { + "type": [ + "boolean", + "null" + ] + }, + "models": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/HarnessModelOption" + } + }, + "modelsSource": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessModelsSource" + }, + { + "type": "null" + } + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + }, + "modelFlag": { + "type": [ + "string", + "null" + ] + }, + "effortFlag": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals", + "liveStream", + "listSessions" + ] + }, + "HarnessModelOption": { + "type": "object", + "properties": { + "inputModalities": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + } + }, + "required": [ + "id", + "label" + ] + }, + "EffortOption": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "label" + ] + }, + "HarnessModelsSource": { + "type": "string", + "enum": [ + "discovered", + "config", + "merged", + "static" + ] + }, + "HarnessControlCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals" + ] + }, + "HarnessObservationCapabilities": { + "type": "object", + "properties": { + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "liveStream", + "listSessions" + ] + }, + "HarnessSessionCreateRequest": { + "type": "object", + "properties": { + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "prompt": { + "type": [ + "string", + "null" + ] + } + } + }, + "HarnessSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "HarnessOffering": { + "type": "object", + "properties": { + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "chat": { + "type": "boolean" + }, + "capabilities": { + "$ref": "#/$defs/HarnessCapabilities" + } + }, + "required": [ + "harnessId", + "chat", + "capabilities" + ] + }, + "HarnessOfferingList": { + "type": "object", + "properties": { + "harnesses": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessOffering" + } + } + }, + "required": [ + "harnesses" + ] + }, + "HarnessCode": { + "type": "string", + "enum": [ + "invalid_session_id", + "bad_request", + "session_id_collision", + "turn_in_flight", + "capability_unsupported", + "unknown_approval", + "unknown_prompt", + "turn_failed" + ] + }, + "HarnessStoreSession": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "command", + "title", + "updatedAt" + ] + }, + "HarnessStoreSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessStoreSession" + } + } + }, + "required": [ + "sessions" + ] + }, + "TaskExecutorKind": { + "type": "string", + "enum": [ + "chat-loop", + "harness-session", + "mesh" + ] + }, + "task.done": { + "type": "object", + "properties": { + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "ts": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "taskId", + "status", + "ts" + ] + }, + "TaskVerdict": { + "type": "string", + "enum": [ + "completed", + "failed", + "killed", + "timeout", + "budget-exceeded" + ] + }, + "ContextRefKind": { + "type": "string", + "enum": [ + "conversation", + "message", + "task", + "file", + "url", + "wiki" + ] + }, + "ContextRef": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ContextRefKind" + }, + "ref": { + "type": "string" + }, + "note": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "kind", + "ref" + ] + }, + "CriterionKind": { + "type": "string", + "enum": [ + "manual", + "automated" + ] + }, + "AcceptanceCriterion": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/CriterionKind" + }, + "check": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "description", + "kind" + ] + }, + "TaskBudget": { + "type": "object", + "properties": { + "maxUsd": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "maxTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "maxTurns": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "maxWallClockMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + } + }, + "TaskUsage": { + "type": "object", + "properties": { + "inputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "outputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "totalTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "costUsd": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "turns": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "wallClockMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "turns", + "wallClockMs" + ] + }, + "Effort": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "TaskIsolation": { + "type": "string", + "enum": [ + "inherit", + "isolated" + ] + }, + "TaskPromptMode": { + "type": "string", + "enum": [ + "task", + "heartbeat" + ] + }, + "TaskSpec": { + "type": "object", + "properties": { + "delegation": { + "type": [ + "boolean", + "null" + ] + }, + "meshFrom": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "resolvedContext": { + "type": "array", + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "budget": { + "$ref": "#/$defs/TaskBudget", + "default": {} + }, + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "workingDir": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/Effort" + }, + { + "type": "null" + } + ] + }, + "systemPromptAppend": { + "type": [ + "string", + "null" + ] + }, + "isolation": { + "anyOf": [ + { + "$ref": "#/$defs/TaskIsolation" + }, + { + "type": "null" + } + ] + }, + "promptMode": { + "anyOf": [ + { + "$ref": "#/$defs/TaskPromptMode" + }, + { + "type": "null" + } + ] + }, + "excludeTools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "resumeMessage": { + "type": [ + "string", + "null" + ] + }, + "session": { + "type": "string" + }, + "permissionDecisions": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskPermissionDecision" + } + }, + "presetId": { + "type": [ + "string", + "null" + ] + }, + "presetName": { + "type": [ + "string", + "null" + ] + }, + "auditOnly": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "taskId", + "agentId", + "goal", + "resolvedContext", + "acceptanceCriteria", + "session" + ], + "additionalProperties": true + }, + "TaskPermissionDecision": { + "type": "object", + "properties": { + "requestId": { + "type": "string" + }, + "tool": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/TaskPermissionOutcome" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "requestId", + "tool", + "decision", + "at" + ] + }, + "TaskPermissionOutcome": { + "type": "string", + "enum": [ + "allow", + "deny", + "timeout" + ] + }, + "ArtifactKind": { + "type": "string", + "enum": [ + "file", + "url", + "commit", + "message" + ] + }, + "TaskArtifact": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ArtifactKind" + }, + "ref": { + "type": "string" + }, + "note": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "kind", + "ref" + ] + }, + "CriterionReport": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "met": { + "type": "boolean" + }, + "evidence": { + "type": "string", + "default": "" + } + }, + "required": [ + "id", + "met" + ] + }, + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "output": { + "type": [ + "string", + "null" + ] + }, + "artifacts": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskArtifact" + } + }, + "criteriaSelfReport": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/CriterionReport" + } + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "artifacts", + "usage" + ] + }, + "EvalVerdict": { + "type": "string", + "enum": [ + "verified", + "refuted", + "escalated" + ] + }, + "EvalOutcome": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/EvalVerdict" + }, + "attempts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "verifierTaskIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "criteriaReport": { + "type": "array", + "items": { + "$ref": "#/$defs/CriterionReport" + } + }, + "diverged": { + "type": "boolean" + }, + "escalatedAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + } + }, + "required": [ + "verdict", + "attempts", + "verifierTaskIds", + "criteriaReport", + "diverged" + ] + }, + "ExecutorTurnCapabilities": { + "type": "object", + "properties": { + "steerable": { + "type": "boolean" + }, + "multiTurn": { + "type": "boolean" + }, + "structuredStream": { + "type": "boolean" + } + }, + "required": [ + "steerable", + "multiTurn", + "structuredStream" + ] + }, + "ExecutorResultCapabilities": { + "type": "object", + "properties": { + "usageInResult": { + "type": "boolean" + }, + "sessionIdCapture": { + "type": "boolean" + } + }, + "required": [ + "usageInResult", + "sessionIdCapture" + ] + }, + "ExecutorInteractionCapabilities": { + "type": "object", + "properties": { + "slashCommands": { + "type": "boolean" + }, + "effortSelection": { + "type": "boolean" + } + }, + "required": [ + "slashCommands", + "effortSelection" + ] + }, + "TaskApprovalRequest": { + "type": "object", + "properties": { + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "taskId", + "requestId", + "name", + "input" + ] + }, + "TaskEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "den" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "event": { + "$ref": "#/$defs/AgentEvent" + } + }, + "required": [ + "type", + "ts", + "event" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn.start" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "turn": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "type", + "ts", + "turn" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn.end" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "turn": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "harnessSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "ts", + "turn", + "usage" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.spawned" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "nativeSessionId": { + "type": "string" + }, + "model": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "ts", + "nativeSessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cost" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "deltaUsd": { + "type": "number", + "format": "double" + }, + "totalUsd": { + "type": "number", + "format": "double" + } + }, + "required": [ + "type", + "ts", + "deltaUsd", + "totalUsd" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "log" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "level": { + "$ref": "#/$defs/LogLevel" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "ts", + "level", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "toolCallId": { + "type": [ "string", "null" ] } }, "required": [ - "event" + "type", + "ts", + "taskId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/TaskPermissionOutcome" + } + }, + "required": [ + "type", + "ts", + "taskId", + "requestId", + "decision" + ] + } + ] + }, + "LogLevel": { + "type": "string", + "enum": [ + "debug", + "info", + "warn", + "error" + ] + }, + "TaskWire": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "contextRefs": { + "type": "array", + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "spec": { + "$ref": "#/$defs/TaskSpec" + }, + "executor": { + "$ref": "#/$defs/TaskExecutorKind" + }, + "executorTarget": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": "string" + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "origin": { + "type": "string" + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "claimedBy": { + "type": [ + "string", + "null" + ] + }, + "budget": { + "$ref": "#/$defs/TaskBudget" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/TaskUsage" + }, + { + "type": "null" + } + ] + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "attempt": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "maxAttempts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pendingMessage": { + "type": [ + "string", + "null" + ] + }, + "error": { + "type": [ + "string", + "null" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/$defs/TaskResult" + }, + { + "type": "null" + } + ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionKey": { + "type": [ + "string", + "null" + ] + }, + "harnessSessionIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "eval": { + "anyOf": [ + { + "$ref": "#/$defs/EvalOutcome" + }, + { + "type": "null" + } ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:end" - }, - "turnCount": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 + "evalAttempt": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "startedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "lastHeartbeatAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "completedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "pendingApprovals": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskApprovalRequest" + } + } + }, + "required": [ + "id", + "goal", + "contextRefs", + "acceptanceCriteria", + "spec", + "executor", + "agentId", + "origin", + "chainDepth", + "budget", + "status", + "attempt", + "maxAttempts", + "harnessSessionIds", + "evalAttempt", + "createdAt" + ] + }, + "TaskCreateRequest": { + "type": "object", + "properties": { + "goal": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/$defs/TaskExecutorKind" }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "event" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:before" - }, - "userMessage": { - "$ref": "#/$defs/Message" - }, - "skip": { - "type": [ - "boolean", - "null" - ] + "executorTarget": { + "type": [ + "string", + "null" + ] + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "chainDepth": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "spec": { + "anyOf": [ + { + "$ref": "#/$defs/TaskSpec" }, - "skipReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "userMessage" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" + "budget": { + "anyOf": [ + { + "$ref": "#/$defs/TaskBudget" }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" + "contextRefs": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + } + }, + "required": [ + "goal", + "agentId" + ] + }, + "TaskResponse": { + "type": "object", + "properties": { + "task": { + "$ref": "#/$defs/TaskWire" + } + }, + "required": [ + "task" + ] + }, + "TasksListResponse": { + "type": "object", + "properties": { + "tasks": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskWire" + } + } + }, + "required": [ + "tasks" + ] + }, + "TaskSteerAccepted": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": [ + "ok" + ] + }, + "TaskKillResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "prior": { + "anyOf": [ + { + "$ref": "#/$defs/TaskStatus" }, - "userMessage": { - "$ref": "#/$defs/Message" + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" ] + } + }, + "required": [ + "ok" + ] + }, + "TaskApprovalAccepted": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": [ + "ok" + ] + }, + "TaskApprovalWaitResponse": { + "type": "object", + "properties": { + "approval": { + "$ref": "#/$defs/TaskApprovalRequest" + } + }, + "required": [ + "approval" + ] + }, + "TaskWaitTimeoutResponse": { + "type": "object", + "properties": { + "error": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" - }, - "skip": { - "type": [ - "boolean", - "null" - ] + "task": { + "anyOf": [ + { + "$ref": "#/$defs/TaskWire" }, - "skipReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + ] + } + }, + "required": [ + "error" + ] + }, + "TaskOverrides": { + "type": "object", + "properties": { + "delegation": { + "type": [ + "boolean", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" + "meshFrom": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" - }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "event", - "messageCount" + "presetId": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "summary": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "remainingMessages" + "presetName": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "permissionDecisions": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskPermissionDecision" + } + }, + "auditOnly": { + "type": [ + "boolean", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/Effort" }, - "blockReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "systemPromptAppend": { + "type": [ + "string", + "null" + ] + }, + "isolation": { + "anyOf": [ + { + "$ref": "#/$defs/TaskIsolation" }, - "toolsUsed": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + { + "type": "null" + } + ] + }, + "promptMode": { + "anyOf": [ + { + "$ref": "#/$defs/TaskPromptMode" }, - "cached": { - "type": "boolean" + { + "type": "null" } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" + ] + }, + "excludeTools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "resumeMessage": { + "type": [ + "string", + "null" ] } - ] + }, + "additionalProperties": true }, - "HookPipelineError": { + "MemorySearchResult": { "type": "object", "properties": { - "hookId": { + "chunk": { + "anyOf": [ + { + "$ref": "#/$defs/MemoryChunkMatch" + }, + { + "type": "null" + } + ] + }, + "id": { "type": "string" }, - "error": { + "source": { + "$ref": "#/$defs/MemoryHitSource" + }, + "content": { "type": "string" + }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "agent": { + "type": [ + "string", + "null" + ] + }, + "relevanceScore": { + "type": "number", + "format": "double" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sessionId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "hookId", - "error" + "id", + "source", + "content", + "relevanceScore", + "createdAt" ] }, - "HookPipelineResult": { + "PluginId": { + "type": "string", + "pattern": "^[a-z](-?[a-z0-9])+$", + "maxLength": 24 + }, + "ToolName": { + "type": "string", + "pattern": "^[a-z](_?[a-z0-9])*$", + "maxLength": 24 + }, + "RouteName": { + "type": "string", + "pattern": "^[a-z0-9][a-z0-9_-]*$", + "maxLength": 64 + }, + "PluginManifest": { "type": "object", "properties": { - "context": { - "$ref": "#/$defs/HookContext" + "$schema": { + "type": [ + "string", + "null" + ] }, - "aborted": { - "type": "boolean" + "manifest": { + "$ref": "#/$defs/ProtocolVersion" }, - "skipped": { - "type": "boolean" + "id": { + "$ref": "#/$defs/PluginId" }, - "errors": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "run": { + "$ref": "#/$defs/PluginRun" + }, + "permissions": { "type": "array", "items": { - "$ref": "#/$defs/HookPipelineError" + "$ref": "#/$defs/Permission" } }, - "ran": { + "settings": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTool" + } + }, + "contributes": { + "$ref": "#/$defs/PluginContributions", + "default": {} + }, + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJob" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginEventKind" + } + } + }, + "additionalProperties": false, + "required": [ + "manifest", + "id", + "name", + "version", + "description", + "run" + ] + }, + "PluginRun": { + "type": "object", + "properties": { + "command": { "type": "array", "items": { "type": "string" } + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "readyTimeoutMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 } }, + "additionalProperties": false, "required": [ - "context", - "aborted", - "skipped", - "errors", - "ran" + "command" ] }, - "HookErrorMode": { + "Permission": { "type": "string", "enum": [ - "continue", - "abort", - "retry" - ] - }, - "HookConfig": { + "memory.read", + "memory.write", + "sessions.read", + "sessions.control", + "topics.read", + "topics.write", + "tasks.read", + "tasks.delegate", + "agents.read", + "notifications.send", + "host.files.read", + "host.files.write", + "host.network", + "host.exec" + ] + }, + "ViewField": { "type": "object", "properties": { - "id": { + "key": { "type": "string" }, - "event": { - "$ref": "#/$defs/HookEventName" - }, - "type": { - "$ref": "#/$defs/HookConfigKind" - }, - "target": { + "label": { "type": "string" }, - "priority": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "input": { + "$ref": "#/$defs/ViewInput" }, - "onError": { + "value": { "anyOf": [ { - "$ref": "#/$defs/HookErrorMode" + "$ref": "#/$defs/ViewValue" }, { "type": "null" } ] }, - "agentFilter": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "toolFilter": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "required": { + "type": "boolean" }, - "description": { + "help": { "type": [ "string", "null" ] }, - "enabled": { + "placeholder": { "type": [ - "boolean", + "string", "null" ] } }, + "additionalProperties": false, "required": [ - "id", - "event", - "type", - "target" - ] - }, - "HookConfigKind": { - "type": "string", - "enum": [ - "shell", - "http", - "internal" - ] - }, - "RosterCommand": { - "type": "string", - "enum": [ - "claude", - "grok", - "kimi", - "opencode", - "hermes", - "codex", - "pi", - "qwen", - "cursor", - "cowork" - ] - }, - "ApprovalDecision": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession" - ] - }, - "ApprovalOutcome": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession", - "external" - ] - }, - "HarnessStatus": { - "type": "string", - "enum": [ - "working", - "blocked", - "idle" - ] - }, - "StatusPhase": { - "type": "string", - "enum": [ - "thinking", - "tool", - "writing", - "prompt" - ] - }, - "StatusSource": { - "type": "string", - "enum": [ - "herdr", - "transcript", - "hooks", - "protocol" + "key", + "label", + "input" ] }, - "HarnessEvent": { + "ViewInput": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "assistant-delta" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "text": { - "type": "string" - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "reasoning-delta" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "text": { - "type": "string" - }, - "turnId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "sessionId", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool-use" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true + "const": "text" }, - "turnId": { - "type": [ - "string", - "null" - ] + "multiline": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "input" + "type" ] }, { @@ -9661,89 +14682,46 @@ "properties": { "type": { "type": "string", - "const": "tool-result" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "output": { - "type": "string" - }, - "isError": { - "type": [ - "boolean", - "null" - ] - }, - "turnId": { - "type": [ - "string", - "null" - ] + "const": "secret" } }, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "output" - ] + "type" + ], + "additionalProperties": false }, { "type": "object", "properties": { - "type": { - "type": "string", - "const": "approval-request" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "requestId": { - "type": "string" - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": "string" + "type": { + "type": "string", + "const": "number" }, - "input": { - "type": "object", - "additionalProperties": true + "min": { + "type": [ + "number", + "null" + ], + "format": "double" }, - "reason": { + "max": { "type": [ - "string", + "number", "null" - ] + ], + "format": "double" }, - "options": { + "step": { "type": [ - "array", + "number", "null" ], - "items": { - "$ref": "#/$defs/ApprovalOption" - } + "format": "double" } }, + "additionalProperties": false, "required": [ - "type", - "sessionId", - "requestId", - "name", - "input" + "type" ] }, { @@ -9751,23 +14729,35 @@ "properties": { "type": { "type": "string", - "const": "approval-resolved" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "toggle" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "select" }, - "requestId": { - "type": "string" + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewOption" + } }, - "decision": { - "$ref": "#/$defs/ApprovalOutcome" + "multiple": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ "type", - "sessionId", - "requestId", - "decision" + "options" ] }, { @@ -9775,57 +14765,249 @@ "properties": { "type": { "type": "string", - "const": "session-created" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "file" }, - "summary": { - "$ref": "#/$defs/HarnessSessionSummary" + "multiple": { + "type": "boolean" }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "accept": { + "type": "array", + "items": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ - "type", - "sessionId", - "summary" + "type" + ] + } + ] + }, + "ViewOption": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "value", + "label" + ] + }, + "ViewValue": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number", + "format": "double" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ViewFile" + } + } + ] + }, + "ViewFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "data": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "mimeType", + "data" + ] + }, + "PluginTool": { + "type": "object", + "properties": { + "name": { + "$ref": "#/$defs/ToolName" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": "string" + }, + "inputSchema": { + "type": "object", + "additionalProperties": true + }, + "hints": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolHint" + } + } + }, + "additionalProperties": false, + "required": [ + "name", + "description", + "inputSchema" + ] + }, + "PluginToolHint": { + "type": "string", + "enum": [ + "readOnly", + "destructive", + "idempotent", + "openWorld" + ] + }, + "PluginContributions": { + "type": "object", + "properties": { + "pages": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginPage" + } + }, + "topicCards": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTopicCard" + } + }, + "sessionActions": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginSessionAction" + } + } + }, + "additionalProperties": false + }, + "PluginPage": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginTopicCard": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginSessionAction": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" ] }, + "action": { + "$ref": "#/$defs/ViewAction" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "action" + ] + }, + "ViewAction": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "turn-complete" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "call" }, - "turnId": { - "type": [ - "string", - "null" - ] + "action": { + "$ref": "#/$defs/RouteName" }, - "stopReason": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true } }, + "additionalProperties": false, "required": [ "type", - "sessionId" + "action" ] }, { @@ -9833,35 +15015,26 @@ "properties": { "type": { "type": "string", - "const": "error" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "navigate" }, - "code": { - "type": "string" + "view": { + "$ref": "#/$defs/RouteName" }, - "deliveryId": { + "params": { "type": [ - "string", + "object", "null" - ] - }, - "message": { - "type": "string" + ], + "additionalProperties": true }, - "retryable": { - "type": [ - "boolean", - "null" - ] + "replace": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ "type", - "sessionId", - "code", - "message" + "view" ] }, { @@ -9869,45 +15042,23 @@ "properties": { "type": { "type": "string", - "const": "session-updated" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" + "const": "dialog" }, - "previousSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "view": { + "$ref": "#/$defs/RouteName" }, - "blocked": { + "params": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true } }, + "additionalProperties": false, "required": [ "type", - "sessionId", - "status" + "view" ] }, { @@ -9915,130 +15066,41 @@ "properties": { "type": { "type": "string", - "const": "transcript" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "from": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "turns": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessTranscriptTurn" - } - }, - "command": { - "$ref": "#/$defs/RosterCommand" - }, - "truncatedBefore": { - "type": [ - "boolean", - "null" - ] - }, - "contextWindow": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "compactAt": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] + "const": "back" } }, "required": [ - "type", - "sessionId", - "rev", - "from", - "total", - "turns", - "command" - ] + "type" + ], + "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", - "const": "status" + "const": "refresh" } }, - "$ref": "#/$defs/HarnessStatusFrame", "required": [ "type" - ] + ], + "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", - "const": "prompt" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "promptId": { - "type": "string" + "const": "toast" }, - "kind": { - "$ref": "#/$defs/PromptKind" - }, - "toolName": { + "text": { "type": "string" }, - "questions": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptQuestion" - } - }, - "resolved": { - "anyOf": [ - { - "$ref": "#/$defs/PromptResolution" - }, - { - "type": "null" - } - ] - }, - "screen": { + "tone": { "anyOf": [ { - "$ref": "#/$defs/PromptScreen" + "$ref": "#/$defs/ViewTone" }, { "type": "null" @@ -10046,1243 +15108,1921 @@ ] } }, + "additionalProperties": false, "required": [ "type", - "sessionId", - "promptId", - "kind", - "toolName", - "questions" - ] - } - ] - }, - "ApprovalOption": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": [ - "key", - "label" - ] - }, - "HarnessSessionSummary": { - "type": "object", - "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "title": { - "type": [ - "string", - "null" + "text" ] }, - "cwd": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "copy" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" ] }, - "createdAt": { - "$ref": "#/$defs/Millis" - }, - "updatedAt": { - "$ref": "#/$defs/Millis" - }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" - }, - "blocked": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openSession" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openTopic" }, - { - "type": "null" + "topicId": { + "type": "string" } + }, + "additionalProperties": false, + "required": [ + "type", + "topicId" ] }, - "model": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openUrl" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false, + "required": [ + "type", + "url" ] }, - "parentSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "download" }, - { - "type": "null" + "path": { + "type": "string" + }, + "filename": { + "type": [ + "string", + "null" + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "path" ] + } + ] + }, + "ViewTone": { + "type": "string", + "enum": [ + "neutral", + "info", + "success", + "warning", + "danger" + ] + }, + "PluginJob": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" }, - "agentName": { - "type": [ - "string", - "null" - ] + "title": { + "type": "string" }, - "taskId": { + "schedule": { "type": [ "string", "null" ] }, - "effort": { + "timeoutMs": { "type": [ - "string", + "integer", "null" - ] - }, - "transport": { - "anyOf": [ - { - "$ref": "#/$defs/Transport" - }, - { - "type": "null" - } - ] + ], + "format": "uint64", + "minimum": 0 } }, + "additionalProperties": false, "required": [ - "sessionId", - "harnessId", - "createdAt", - "updatedAt", - "status" - ], - "additionalProperties": true + "id", + "title" + ] }, - "StatusTool": { + "PluginEventKind": { + "type": "string", + "enum": [ + "session.started", + "session.idle", + "session.ended", + "session.placed", + "summary.written", + "task.done" + ] + }, + "View": { "type": "object", "properties": { - "name": { + "title": { "type": "string" }, - "toolCallId": { + "subtitle": { "type": [ "string", "null" ] + }, + "toolbar": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } } }, + "additionalProperties": false, "required": [ - "name" + "title", + "blocks" ] }, - "HarnessStatusFrame": { + "ViewButton": { "type": "object", "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "status": { - "$ref": "#/$defs/HarnessStatus" - }, - "since": { - "type": "integer", - "format": "int64" + "label": { + "type": "string" }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/StatusSource" - }, - { - "type": "null" - } + "icon": { + "type": [ + "string", + "null" ] }, - "phase": { + "style": { "anyOf": [ { - "$ref": "#/$defs/StatusPhase" + "$ref": "#/$defs/ViewButtonStyle" }, { "type": "null" } ] }, - "tool": { + "action": { + "$ref": "#/$defs/ViewAction" + }, + "confirm": { "anyOf": [ { - "$ref": "#/$defs/StatusTool" + "$ref": "#/$defs/ViewConfirm" }, { "type": "null" } ] }, - "promptId": { - "type": [ - "string", - "null" - ] + "disabled": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "sessionId", - "status", - "since" + "label", + "action" ] }, - "PromptKind": { + "ViewButtonStyle": { "type": "string", "enum": [ - "ask-user" - ] - }, - "PromptQuestion": { - "type": "object", - "properties": { - "question": { - "type": [ - "string", - "null" - ] - }, - "header": { - "type": [ - "string", - "null" - ] - }, - "multiSelect": { - "type": "boolean" - }, - "freeText": { - "type": [ - "boolean", - "null" - ] - }, - "options": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptOption" - } - } - }, - "required": [ - "multiSelect", - "options" + "primary", + "secondary", + "danger" ] }, - "PromptOption": { + "ViewConfirm": { "type": "object", "properties": { - "label": { + "title": { "type": "string" }, - "description": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "label" - ] - }, - "PromptResolution": { - "type": "object", - "properties": { - "at": { - "type": "integer", - "format": "int64" + "text": { + "type": "string" }, - "answerText": { + "confirmLabel": { "type": [ "string", "null" ] } }, + "additionalProperties": false, "required": [ - "at" - ] - }, - "PromptScreen": { - "type": "object", - "properties": { - "current": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "current", - "total" + "title", + "text" ] }, - "HarnessCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" - }, - "approvals": { - "type": "boolean" + "ViewBlock": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "section" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "collapsed": { + "type": [ + "boolean", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "blocks" + ] }, - "liveStream": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "split" + }, + "primary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "secondary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "ratio": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "primary", + "secondary" + ] }, - "listSessions": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tabs" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewTab" + } + }, + "selected": { + "anyOf": [ + { + "$ref": "#/$defs/RouteName" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "tabs" + ] }, - "drive": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" ] }, - "turnOptions": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "markdown" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" ] }, - "launchModel": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "code" + }, + "text": { + "type": "string" + }, + "language": { + "type": [ + "string", + "null" + ] + }, + "follow": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" ] }, - "imageAttachments": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "path": { + "type": "string" + }, + "alt": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "path", + "alt" ] }, - "models": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/HarnessModelOption" - } + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "properties" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewProperty" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] }, - "modelsSource": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessModelsSource" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "progress" }, - { - "type": "null" + "value": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "label": { + "type": [ + "string", + "null" + ] } + }, + "additionalProperties": false, + "required": [ + "type" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "notice" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "tone", + "text" + ] }, - "modelFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "list" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewListItem" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" ] }, - "effortFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "table" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewColumn" + } + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewRow" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "columns", + "rows" ] - } - }, - "required": [ - "interrupt", - "resume", - "approvals", - "liveStream", - "listSessions" - ] - }, - "HarnessModelOption": { - "type": "object", - "properties": { - "inputModalities": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } }, - "id": { - "type": "string" - }, - "label": { - "type": "string" - }, - "isDefault": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "breadcrumbs" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewCrumb" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } - } - }, - "required": [ - "id", - "label" - ] - }, - "EffortOption": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "label": { - "type": "string" - }, - "isDefault": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "actions" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "buttons" ] - } - }, - "required": [ - "id", - "label" - ] - }, - "HarnessModelsSource": { - "type": "string", - "enum": [ - "discovered", - "config", - "merged", - "static" - ] - }, - "HarnessControlCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" - }, - "approvals": { - "type": "boolean" - } - }, - "required": [ - "interrupt", - "resume", - "approvals" - ] - }, - "HarnessObservationCapabilities": { - "type": "object", - "properties": { - "liveStream": { - "type": "boolean" - }, - "listSessions": { - "type": "boolean" }, - "drive": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "form" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "fields", + "buttons" ] - } - }, - "required": [ - "liveStream", - "listSessions" - ] - }, - "HarnessSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessSessionSummary" - } - } - }, - "required": [ - "sessions" - ] - }, - "HarnessOffering": { - "type": "object", - "properties": { - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "chat": { - "type": "boolean" }, - "capabilities": { - "$ref": "#/$defs/HarnessCapabilities" - } - }, - "required": [ - "harnessId", - "chat", - "capabilities" - ] - }, - "HarnessOfferingList": { - "type": "object", - "properties": { - "harnesses": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessOffering" - } + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "canvas" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "scene": { + "$ref": "#/$defs/CanvasScene" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "readOnly": { + "type": "boolean" + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "scene" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "webPanel" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "entry": { + "type": "string" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "entry" + ] } - }, - "required": [ - "harnesses" - ] - }, - "HarnessCode": { - "type": "string", - "enum": [ - "invalid_session_id", - "bad_request", - "session_id_collision", - "turn_in_flight", - "capability_unsupported", - "unknown_approval", - "unknown_prompt" ] }, - "HarnessStoreSession": { + "ViewTab": { "type": "object", "properties": { "id": { - "type": "string" - }, - "command": { - "$ref": "#/$defs/RosterCommand" + "$ref": "#/$defs/RouteName" }, "title": { "type": "string" }, - "updatedAt": { - "type": "integer", - "format": "int64" - }, - "parentSessionId": { - "type": [ - "string", - "null" - ] - }, - "agentName": { - "type": [ - "string", - "null" - ] - }, - "model": { + "badge": { "type": [ "string", "null" ] }, - "taskId": { - "type": [ - "string", - "null" - ] + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } } }, + "additionalProperties": false, "required": [ "id", - "command", "title", - "updatedAt" + "blocks" ] }, - "HarnessStoreSessionList": { + "ViewProperty": { "type": "object", "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessStoreSession" - } + "label": { + "type": "string" + }, + "value": { + "$ref": "#/$defs/ViewInline" } }, + "additionalProperties": false, "required": [ - "sessions" - ] - }, - "TaskExecutorKind": { - "type": "string", - "enum": [ - "chat-loop", - "harness-session", - "mesh" - ] - }, - "TaskVerdict": { - "type": "string", - "enum": [ - "completed", - "failed", - "killed", - "timeout", - "budget-exceeded" - ] - }, - "ContextRefKind": { - "type": "string", - "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" + "label", + "value" ] }, - "ContextRef": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" + "ViewInline": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] }, - "ref": { - "type": "string" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "badge" + }, + "text": { + "type": "string" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text", + "tone" + ] }, - "note": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "time" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTimeStyle" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "at" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "duration" + }, + "ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "ms" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "bytes" + }, + "value": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "value" ] } - }, - "required": [ - "kind", - "ref" ] }, - "CriterionKind": { + "ViewTimeStyle": { "type": "string", "enum": [ - "manual", - "automated" + "relative", + "absolute" ] }, - "AcceptanceCriterion": { + "ViewListItem": { "type": "object", "properties": { "id": { "type": "string" }, - "description": { + "title": { "type": "string" }, - "kind": { - "$ref": "#/$defs/CriterionKind" + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "trailing": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } }, - "check": { - "type": [ - "string", - "null" + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } } }, + "additionalProperties": false, "required": [ "id", - "description", - "kind" + "title" ] }, - "TaskBudget": { + "ViewEmpty": { "type": "object", "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "title": { + "type": "string" }, - "maxTurns": { + "text": { "type": [ - "integer", + "string", "null" - ], - "format": "uint32", - "minimum": 0 + ] }, - "maxWallClockMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "button": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButton" + }, + { + "type": "null" + } + ] } - } + }, + "additionalProperties": false, + "required": [ + "title" + ] }, - "TaskUsage": { + "ViewColumn": { "type": "object", "properties": { - "inputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "outputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "totalTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" + "title": { + "type": "string" }, - "turns": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] }, - "wallClockMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sortable": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "inputTokens", - "outputTokens", - "totalTokens", - "turns", - "wallClockMs" - ] - }, - "Effort": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" + "title" ] }, - "TaskPromptMode": { + "ViewAlign": { "type": "string", "enum": [ - "task", - "heartbeat" + "start", + "center", + "end" ] }, - "TaskSpec": { + "ViewRow": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "taskId": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "goal": { + "id": { "type": "string" }, - "resolvedContext": { + "cells": { "type": "array", "items": { - "$ref": "#/$defs/ContextRef" + "$ref": "#/$defs/ViewInline" } }, - "acceptanceCriteria": { + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + }, + "menu": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/ViewButton" } + } + }, + "additionalProperties": false, + "required": [ + "id", + "cells" + ] + }, + "ViewCrumb": { + "type": "object", + "properties": { + "label": { + "type": "string" }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} - }, - "tools": { - "type": [ - "array", - "null" - ], + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "label" + ] + }, + "CanvasScene": { + "type": "object", + "properties": { + "items": { + "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/CanvasItem" } }, - "workingDir": { - "type": [ - "string", - "null" + "grid": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasGrid" + }, + { + "type": "null" + } + ] + }, + "viewport": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasViewport" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "items" + ] + }, + "CanvasItem": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "node" + }, + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "shapes": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasShape" + } + }, + "anchors": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasAnchor" + } + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "locked": { + "type": "boolean" + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "x", + "y", + "width", + "height", + "shapes" ] }, - "model": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "connector" + }, + "id": { + "type": "string" + }, + "from": { + "$ref": "#/$defs/CanvasEnd" + }, + "to": { + "$ref": "#/$defs/CanvasEnd" + }, + "route": { + "$ref": "#/$defs/CanvasRoute" + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" + }, + "arrow": { + "$ref": "#/$defs/CanvasArrow" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "from", + "to", + "route", + "arrow" + ] + } + ] + }, + "CanvasShape": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "rect" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "radius": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ellipse" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "text": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "weight": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasWeight" + }, + { + "type": "null" + } + ] + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] + }, + "maxWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "text" ] }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "path" + }, + "d": { + "type": "string" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] }, - { - "type": "null" + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" } + }, + "additionalProperties": false, + "required": [ + "type", + "d" ] }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "icon" }, - { - "type": "null" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "name": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] } - ] - }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - }, - "session": { - "type": "string" - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "auditOnly": { - "type": [ - "boolean", - "null" + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "name" ] } - }, - "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "session" - ], - "additionalProperties": true + ] }, - "TaskPermissionDecision": { + "ColorRole": { + "type": "string", + "enum": [ + "surface", + "surfaceContainer", + "surfaceContainerHigh", + "primary", + "primaryContainer", + "onPrimary", + "onPrimaryContainer", + "secondaryContainer", + "onSurface", + "onSurfaceVariant", + "outline", + "outlineVariant", + "info", + "success", + "warning", + "danger", + "category1", + "category2", + "category3", + "category4", + "category5", + "category6" + ] + }, + "CanvasWeight": { + "type": "string", + "enum": [ + "regular", + "medium", + "bold" + ] + }, + "CanvasAnchor": { "type": "object", "properties": { - "requestId": { + "id": { "type": "string" }, - "tool": { - "type": "string" + "x": { + "type": "number", + "format": "double" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "y": { + "type": "number", + "format": "double" }, - "at": { - "type": "integer", - "format": "int64" + "side": { + "$ref": "#/$defs/CanvasSide" }, - "message": { - "type": [ - "string", - "null" - ] + "direction": { + "$ref": "#/$defs/CanvasDirection" } }, + "additionalProperties": false, "required": [ - "requestId", - "tool", - "decision", - "at" + "id", + "x", + "y", + "side", + "direction" ] }, - "TaskPermissionOutcome": { + "CanvasSide": { "type": "string", "enum": [ - "allow", - "deny", - "timeout" + "top", + "right", + "bottom", + "left" ] }, - "ArtifactKind": { + "CanvasDirection": { "type": "string", "enum": [ - "file", - "url", - "commit", - "message" + "in", + "out", + "both" ] }, - "TaskArtifact": { + "CanvasMenuItem": { "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" + "id": { + "type": "string" }, - "ref": { + "label": { "type": "string" }, - "note": { + "icon": { "type": [ "string", "null" ] - } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionReport": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "met": { + "danger": { "type": "boolean" - }, - "evidence": { - "type": "string", - "default": "" } }, + "additionalProperties": false, "required": [ "id", - "met" + "label" ] }, - "TaskResult": { + "CanvasEnd": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { + "node": { "type": "string" }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "error": { + "anchor": { "type": [ "string", "null" ] } }, + "additionalProperties": false, "required": [ - "verdict", - "summary", - "artifacts", - "usage" + "node" ] }, - "EvalVerdict": { + "CanvasRoute": { "type": "string", "enum": [ - "verified", - "refuted", - "escalated" + "straight", + "curved", + "orthogonal" ] }, - "EvalOutcome": { + "CanvasArrow": { + "type": "string", + "enum": [ + "none", + "end", + "start", + "both" + ] + }, + "CanvasGrid": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "verifierTaskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } + "size": { + "type": "number", + "format": "double" }, - "diverged": { + "snap": { "type": "boolean" - }, - "escalatedAt": { - "type": [ - "string", - "null" - ], - "format": "date-time" } }, + "additionalProperties": false, "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" + "size" ] }, - "ExecutorTurnCapabilities": { + "CanvasViewport": { "type": "object", "properties": { - "steerable": { - "type": "boolean" + "x": { + "type": "number", + "format": "double" }, - "multiTurn": { - "type": "boolean" + "y": { + "type": "number", + "format": "double" }, - "structuredStream": { - "type": "boolean" + "zoom": { + "type": "number", + "format": "double" } }, + "additionalProperties": false, "required": [ - "steerable", - "multiTurn", - "structuredStream" + "x", + "y", + "zoom" ] }, - "ExecutorResultCapabilities": { + "ViewRequest": { "type": "object", "properties": { - "usageInResult": { - "type": "boolean" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "sessionIdCapture": { - "type": "boolean" + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, - "required": [ - "usageInResult", - "sessionIdCapture" - ] + "additionalProperties": false }, - "ExecutorInteractionCapabilities": { + "ViewContext": { "type": "object", "properties": { - "slashCommands": { - "type": "boolean" + "topicId": { + "type": [ + "string", + "null" + ] }, - "effortSelection": { - "type": "boolean" + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] } }, - "required": [ - "slashCommands", - "effortSelection" - ] + "additionalProperties": false }, - "TaskApprovalRequest": { + "ViewActionRequest": { "type": "object", "properties": { - "taskId": { - "type": "string" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "requestId": { - "type": "string" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } }, - "name": { + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} + } + }, + "additionalProperties": false + }, + "ViewActionResult": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] + } + }, + "additionalProperties": false + }, + "ViewActionRefusal": { + "type": "object", + "properties": { + "message": { "type": "string" }, - "input": { + "fields": { "type": "object", - "additionalProperties": true + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "message" + ] + }, + "CanvasEventRequest": { + "type": "object", + "properties": { + "event": { + "$ref": "#/$defs/CanvasEvent" }, - "toolCallId": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "taskId", - "requestId", - "name", - "input" + "event" ] }, - "TaskEvent": { + "CanvasEvent": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "den" + "const": "selected" }, - "ts": { - "type": "integer", - "format": "int64" + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "moved" }, - "event": { - "$ref": "#/$defs/AgentEvent" + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasPosition" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "event" + "items" ] }, { @@ -11290,22 +17030,153 @@ "properties": { "type": { "type": "string", - "const": "turn.start" + "const": "connected" }, - "ts": { - "type": "integer", - "format": "int64" + "from": { + "$ref": "#/$defs/CanvasEnd" }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "to": { + "$ref": "#/$defs/CanvasEnd" + } + }, + "additionalProperties": false, + "required": [ + "type", + "from", + "to" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "deleted" + }, + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "activated" + }, + "item": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "item" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "menu" + }, + "item": { + "type": [ + "string", + "null" + ] + }, + "choice": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "choice", + "x", + "y" + ] + } + ] + }, + "CanvasPosition": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "id", + "x", + "y" + ] + }, + "CanvasResponse": { + "type": "object", + "properties": { + "ops": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasOp" + }, + "default": [] + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] + } + }, + "additionalProperties": false + }, + "CanvasOp": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "upsert" + }, + "item": { + "$ref": "#/$defs/CanvasItem" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn" + "item" ] }, { @@ -11313,90 +17184,169 @@ "properties": { "type": { "type": "string", - "const": "turn.end" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "const": "remove" }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "ids": { + "type": "array", + "items": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn", - "usage" + "ids" ] + } + ] + }, + "PanelTheme": { + "type": "object", + "properties": { + "scheme": { + "$ref": "#/$defs/PanelScheme" }, - { + "colors": { "type": "object", "properties": { - "type": { - "type": "string", - "const": "session.spawned" + "category1": { + "type": "string" }, - "ts": { - "type": "integer", - "format": "int64" + "category2": { + "type": "string" }, - "nativeSessionId": { + "category3": { "type": "string" }, - "model": { - "type": [ - "string", - "null" - ] + "category4": { + "type": "string" + }, + "category5": { + "type": "string" + }, + "category6": { + "type": "string" + }, + "danger": { + "type": "string" + }, + "info": { + "type": "string" + }, + "onPrimary": { + "type": "string" + }, + "onPrimaryContainer": { + "type": "string" + }, + "onSurface": { + "type": "string" + }, + "onSurfaceVariant": { + "type": "string" + }, + "outline": { + "type": "string" + }, + "outlineVariant": { + "type": "string" + }, + "primary": { + "type": "string" + }, + "primaryContainer": { + "type": "string" + }, + "secondaryContainer": { + "type": "string" + }, + "success": { + "type": "string" + }, + "surface": { + "type": "string" + }, + "surfaceContainer": { + "type": "string" + }, + "surfaceContainerHigh": { + "type": "string" + }, + "warning": { + "type": "string" } }, - "required": [ - "type", - "ts", - "nativeSessionId" - ] + "additionalProperties": false + }, + "fontFamily": { + "type": "string" }, + "fontMono": { + "type": "string" + }, + "fontSize": { + "type": "number", + "format": "double" + }, + "radius": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "scheme", + "colors", + "fontFamily", + "fontMono", + "fontSize", + "radius" + ] + }, + "PanelScheme": { + "type": "string", + "enum": [ + "light", + "dark" + ] + }, + "PanelHostMessage": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "cost" + "const": "init" }, - "ts": { - "type": "integer", - "format": "int64" + "theme": { + "$ref": "#/$defs/PanelTheme" }, - "deltaUsd": { - "type": "number", - "format": "double" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "totalUsd": { - "type": "number", - "format": "double" + "context": { + "$ref": "#/$defs/ViewContext" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "deltaUsd", - "totalUsd" + "theme", + "context", + "plugin", + "node" ] }, { @@ -11404,64 +17354,52 @@ "properties": { "type": { "type": "string", - "const": "log" + "const": "theme" }, - "ts": { - "type": "integer", - "format": "int64" - }, - "level": { - "$ref": "#/$defs/LogLevel" - }, - "message": { - "type": "string" + "theme": { + "$ref": "#/$defs/PanelTheme" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "level", - "message" + "theme" ] + } + ] + }, + "PanelMessage": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ready" + } + }, + "required": [ + "type" + ], + "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", - "const": "approval-request" + "const": "resize" }, - "ts": { + "height": { "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] + "format": "uint32", + "minimum": 0 } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "name", - "input" + "height" ] }, { @@ -11469,393 +17407,673 @@ "properties": { "type": { "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" + "const": "action" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "action": { + "$ref": "#/$defs/ViewAction" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "decision" + "action" ] } ] }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" - ] - }, - "TaskWire": { + "PluginList": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "goal": { + "node": { "type": "string" }, - "contextRefs": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { + "plugins": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/PluginRecord" } + } + }, + "additionalProperties": false, + "required": [ + "node", + "plugins" + ] + }, + "PluginRecord": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/PluginId" }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { - "type": [ - "string", - "null" - ] + "node": { + "type": "string" }, - "agentId": { + "path": { "type": "string" }, - "requestedBy": { - "type": [ - "string", - "null" - ] + "manifest": { + "$ref": "#/$defs/PluginManifest" }, - "origin": { - "type": "string" + "enabled": { + "type": "boolean" }, - "parentTaskId": { - "type": [ - "string", - "null" - ] + "state": { + "$ref": "#/$defs/PluginState" }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "granted": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } }, - "nodeAffinity": { - "type": [ - "string", - "null" - ] + "pending": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } }, - "claimedBy": { + "error": { "type": [ "string", "null" ] }, - "budget": { - "$ref": "#/$defs/TaskBudget" - }, - "usage": { + "lastExit": { "anyOf": [ { - "$ref": "#/$defs/TaskUsage" + "$ref": "#/$defs/PluginExit" }, { "type": "null" } ] }, - "status": { - "$ref": "#/$defs/TaskStatus" - }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "maxAttempts": { + "restarts": { "type": "integer", "format": "uint32", "minimum": 0 }, - "pendingMessage": { + "startedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "error": { - "type": [ - "string", - "null" - ] + "installedAt": { + "type": "integer", + "format": "int64" }, - "result": { - "anyOf": [ - { - "$ref": "#/$defs/TaskResult" - }, - { - "type": "null" - } - ] + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJobStatus" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "node", + "path", + "manifest", + "enabled", + "state", + "granted", + "pending", + "restarts", + "installedAt", + "jobs" + ] + }, + "PluginState": { + "type": "string", + "enum": [ + "disabled", + "awaitingApproval", + "starting", + "running", + "backoff", + "invalid" + ] + }, + "PluginExit": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" }, - "conversationId": { + "code": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int32" }, - "sessionKey": { + "signal": { "type": [ "string", "null" ] + } + }, + "additionalProperties": false, + "required": [ + "at" + ] + }, + "PluginJobStatus": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" }, - "harnessSessionIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "eval": { + "lastRun": { "anyOf": [ { - "$ref": "#/$defs/EvalOutcome" + "$ref": "#/$defs/PluginJobRun" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "id" + ] + }, + "PluginJobRun": { + "type": "object", + "properties": { + "runId": { + "type": "string" }, - "evalAttempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" }, - "createdAt": { + "startedAt": { "type": "integer", "format": "int64" }, - "startedAt": { + "finishedAt": { "type": [ "integer", "null" ], "format": "int64" }, - "lastHeartbeatAt": { + "outcome": { + "anyOf": [ + { + "$ref": "#/$defs/PluginJobOutcome" + }, + { + "type": "null" + } + ] + }, + "message": { "type": [ - "integer", + "string", "null" - ], + ] + } + }, + "additionalProperties": false, + "required": [ + "runId", + "trigger", + "startedAt" + ] + }, + "PluginJobTrigger": { + "type": "string", + "enum": [ + "schedule", + "manual" + ] + }, + "PluginJobOutcome": { + "type": "string", + "enum": [ + "succeeded", + "failed" + ] + }, + "PluginInstallRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "path" + ] + }, + "PluginEnableRequest": { + "type": "object", + "properties": { + "approve": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + } + }, + "additionalProperties": false + }, + "PluginLogs": { + "type": "object", + "properties": { + "lines": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginLogLine" + } + } + }, + "additionalProperties": false, + "required": [ + "lines" + ] + }, + "PluginLogLine": { + "type": "object", + "properties": { + "at": { + "type": "integer", "format": "int64" }, - "completedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "stream": { + "$ref": "#/$defs/PluginLogStream" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "at", + "stream", + "text" + ] + }, + "PluginLogStream": { + "type": "string", + "enum": [ + "stdout", + "stderr", + "host" + ] + }, + "PluginSettings": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "secretsSet": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginSettingsUpdate": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "plugin.changed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + } + }, + "required": [ + "v", + "plugin" + ] + }, + "plugin.views": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" }, - "durationMs": { - "type": [ - "integer", - "null" - ], + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } + } + }, + "required": [ + "v", + "plugin", + "views" + ] + }, + "PluginToolList": { + "type": "object", + "properties": { + "version": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], + "tools": { + "type": "array", "items": { - "$ref": "#/$defs/TaskApprovalRequest" + "$ref": "#/$defs/PluginToolEntry" } } }, + "additionalProperties": false, "required": [ - "id", - "goal", - "contextRefs", - "acceptanceCriteria", - "spec", - "executor", - "agentId", - "origin", - "chainDepth", - "budget", - "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", - "createdAt" + "version", + "tools" ] }, - "TaskCreateRequest": { + "PluginToolEntry": { "type": "object", "properties": { - "goal": { - "type": "string" + "plugin": { + "$ref": "#/$defs/PluginId" }, - "agentId": { - "type": "string" + "tool": { + "$ref": "#/$defs/PluginTool" + } + }, + "additionalProperties": false, + "required": [ + "plugin", + "tool" + ] + }, + "PluginEventDelivery": { + "type": "object", + "properties": { + "seq": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" - }, - { - "type": "null" - } - ] + "at": { + "type": "integer", + "format": "int64" }, - "executorTarget": { - "type": [ - "string", - "null" - ] + "missed": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "requestedBy": { - "type": [ - "string", - "null" + "event": { + "$ref": "#/$defs/PluginEvent" + } + }, + "additionalProperties": false, + "required": [ + "seq", + "at", + "missed", + "event" + ] + }, + "PluginEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.started" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "parentTaskId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.idle" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "chainDepth": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.ended" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "spec": { - "anyOf": [ - { - "$ref": "#/$defs/TaskSpec" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.placed" }, - { - "type": "null" + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId", + "topicId", + "by" ] }, - "budget": { - "anyOf": [ - { - "$ref": "#/$defs/TaskBudget" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "summary.written" }, - { - "type": "null" + "summaryId": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 } + }, + "additionalProperties": false, + "required": [ + "type", + "summaryId", + "kind", + "level" ] }, - "contextRefs": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - } - }, - "required": [ - "goal", - "agentId" - ] - }, - "TaskResponse": { - "type": "object", - "properties": { - "task": { - "$ref": "#/$defs/TaskWire" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "task.done" + }, + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" + } + }, + "additionalProperties": false, + "required": [ + "type", + "taskId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "settings.changed" + }, + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "values" + ] } - }, - "required": [ - "task" ] }, - "TasksListResponse": { + "PluginJobRequest": { "type": "object", "properties": { - "tasks": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskWire" - } + "runId": { + "type": "string" + }, + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" + }, + "scheduledAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, + "additionalProperties": false, "required": [ - "tasks" + "runId", + "trigger" ] }, - "TaskSteerAccepted": { + "PluginJobResult": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "outcome": { + "$ref": "#/$defs/PluginJobOutcome" + }, + "message": { + "type": [ + "string", + "null" + ] } }, + "additionalProperties": false, "required": [ - "ok" + "outcome" ] }, - "TaskKillResponse": { + "PluginToolCall": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "arguments": { + "type": "object", + "additionalProperties": true }, - "prior": { + "sessionId": { "anyOf": [ { - "$ref": "#/$defs/TaskStatus" + "$ref": "#/$defs/SessionId" }, { "type": "null" @@ -11863,214 +18081,165 @@ ] } }, + "additionalProperties": false, "required": [ - "ok" + "arguments" ] }, - "TaskApprovalAccepted": { + "PluginToolResult": { "type": "object", "properties": { - "ok": { + "text": { + "type": "string" + }, + "isError": { "type": "boolean" } }, + "additionalProperties": false, "required": [ - "ok" + "text" ] }, - "TaskApprovalWaitResponse": { + "PluginSelf": { "type": "object", "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" + "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" + }, + "version": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "dataDir": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "approval" + "id", + "node", + "version", + "permissions", + "settings", + "dataDir" ] }, - "TaskWaitTimeoutResponse": { + "PluginViewsChanged": { "type": "object", "properties": { - "error": { - "type": "string" - }, - "task": { - "anyOf": [ - { - "$ref": "#/$defs/TaskWire" - }, - { - "type": "null" - } - ] + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } } }, + "additionalProperties": false, "required": [ - "error" + "views" ] }, - "TaskOverrides": { + "PluginNotify": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] + "title": { + "type": "string" }, - "model": { + "text": { "type": [ "string", "null" ] }, - "effort": { + "tone": { "anyOf": [ { - "$ref": "#/$defs/Effort" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { + "action": { "anyOf": [ { - "$ref": "#/$defs/TaskIsolation" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "plugin.notification": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "title": { + "type": "string" }, - "resumeMessage": { + "text": { "type": [ "string", "null" ] - } - }, - "additionalProperties": true - }, - "MemorySearchResult": { - "type": "object", - "properties": { - "chunk": { + }, + "tone": { "anyOf": [ { - "$ref": "#/$defs/MemoryChunkMatch" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "id": { - "type": "string" - }, - "source": { - "$ref": "#/$defs/MemoryHitSource" - }, - "content": { - "type": "string" - }, - "role": { + "action": { "anyOf": [ { - "$ref": "#/$defs/Role" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] }, - "agent": { - "type": [ - "string", - "null" - ] - }, - "relevanceScore": { - "type": "number", - "format": "double" - }, - "createdAt": { - "type": "string", - "format": "date-time" + "ts": { + "type": "integer", + "format": "int64" } }, "required": [ - "id", - "source", - "content", - "relevanceScore", - "createdAt" + "plugin", + "node", + "title", + "ts" ] } } diff --git a/packages/contract/schema/sent.schema.json b/packages/contract/schema/sent.schema.json index 2384aad..2deaea8 100644 --- a/packages/contract/schema/sent.schema.json +++ b/packages/contract/schema/sent.schema.json @@ -97,8 +97,8 @@ "hermes", "codex", "opencode", - "pi", - "qwen-code", + "omp", + "dsh", "cursor", "cowork" ] @@ -336,6 +336,261 @@ "agent" ] }, + "HubProjectDefaults": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/ThinkingLevel" + }, + { + "type": "null" + } + ] + }, + "harnessId": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "node": { + "type": [ + "string", + "null" + ] + }, + "directory": { + "type": [ + "string", + "null" + ] + } + } + }, + "ThinkingLevel": { + "type": "string", + "enum": [ + "off", + "low", + "medium", + "high", + "xhigh" + ] + }, + "HubProject": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double", + "default": 0.0 + }, + "createdAt": { + "type": "integer", + "format": "int64", + "default": 0 + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/HubProjectDefaults" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "name", + "order", + "createdAt" + ] + }, + "HubLastSession": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "key", + "at" + ] + }, + "HubSessionMode": { + "type": "string", + "enum": [ + "chat", + "terminal" + ] + }, + "HubState": { + "type": "object", + "properties": { + "projects": { + "type": "array", + "items": { + "$ref": "#/$defs/HubProject" + }, + "default": [] + }, + "defaultProjectId": { + "type": [ + "string", + "null" + ] + }, + "membership": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "names": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "archived": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "pinned": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "hidden": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "modes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/HubSessionMode" + }, + "default": {} + }, + "lastSession": { + "anyOf": [ + { + "$ref": "#/$defs/HubLastSession" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "projects", + "membership", + "names", + "archived", + "pinned", + "hidden", + "modes" + ] + }, + "HubStateResponse": { + "type": "object", + "properties": { + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "version", + "state" + ] + }, + "HubStatePutRequest": { + "type": "object", + "properties": { + "baseVersion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/$defs/HubState" + } + }, + "required": [ + "baseVersion", + "state" + ] + }, + "hub.state": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "version": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "v", + "version" + ] + }, + "ProtocolVersion": { + "type": "integer", + "format": "uint8", + "minimum": 0, + "maximum": 255 + }, "HarnessDescriptor": { "type": "object", "properties": { @@ -516,6 +771,12 @@ "null" ] }, + "effort": { + "type": [ + "string", + "null" + ] + }, "directory": { "type": [ "string", @@ -949,6 +1210,18 @@ "type": "null" } ] + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -1834,12 +2107,6 @@ } ] }, - "ProtocolVersion": { - "type": "integer", - "format": "uint8", - "minimum": 0, - "maximum": 255 - }, "AudioStatus": { "type": "object", "properties": { @@ -2220,6 +2487,22 @@ "null" ] }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "tool_name": { + "type": [ + "string", + "null" + ] + }, "tag": { "type": [ "string", @@ -2251,6 +2534,15 @@ "both" ] }, + "Role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "tool" + ] + }, "MemoryHitSource": { "type": "string", "enum": [ @@ -2395,15 +2687,6 @@ "content" ] }, - "Role": { - "type": "string", - "enum": [ - "system", - "user", - "assistant", - "tool" - ] - }, "MemoryFallback": { "type": "string", "enum": [ @@ -3223,6 +3506,165 @@ "messages" ] }, + "VectorState": { + "type": "string", + "enum": [ + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryNode": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "parentId": { + "type": [ + "string", + "null" + ] + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "content": { + "type": "string" + }, + "messageCount": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "earliestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "latestAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sourceMessageIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "vector": { + "$ref": "#/$defs/VectorState" + } + }, + "required": [ + "id", + "level", + "kind", + "content", + "messageCount", + "createdAt", + "sourceMessageIds", + "vector" + ] + }, + "MemoryMessageTally": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "user": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "assistant": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "system": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "tool": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "embedded": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pending": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "failed": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "total", + "user", + "assistant", + "system", + "tool", + "embedded", + "pending", + "failed", + "skipped" + ] + }, + "MemorySummaryDagResponse": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "summaries": { + "type": "array", + "items": { + "$ref": "#/$defs/MemorySummaryNode" + } + }, + "messages": { + "$ref": "#/$defs/MemoryMessageTally" + } + }, + "required": [ + "sessionId", + "summaries", + "messages" + ] + }, "TopTool": { "type": "object", "properties": { @@ -4222,6 +4664,18 @@ "items": { "$ref": "#/$defs/DegradedProvider" } + }, + "version": { + "type": [ + "string", + "null" + ] + }, + "revision": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -4706,22 +5160,43 @@ "string", "null" ] + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + }, + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] } }, "required": [ "text" ] }, - "ThinkingLevel": { - "type": "string", - "enum": [ - "off", - "low", - "medium", - "high", - "xhigh" - ] - }, "SessionPostAccepted": { "type": "object", "properties": { @@ -4748,6 +5223,45 @@ "message" ] }, + "SessionSteerRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/UserTurnAttachment" + } + } + }, + "required": [ + "text" + ] + }, + "SessionSteerResponse": { + "type": "object", + "properties": { + "outcome": { + "$ref": "#/$defs/SteerOutcome" + } + }, + "required": [ + "outcome" + ] + }, + "SteerOutcome": { + "type": "string", + "enum": [ + "steered", + "startedNewTurn", + "promptRequired" + ] + }, "SessionWsClientMessage": { "type": "object", "properties": { @@ -4983,11 +5497,34 @@ } ] }, + "attachments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TranscriptAttachment" + } + }, "complete": { "type": "boolean" }, "compact": { "type": "boolean" + }, + "startedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "endedAtMs": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -5053,18 +5590,47 @@ "tool_result" ] }, - "TranscriptWsFrame": { + "TranscriptAttachment": { "type": "object", "properties": { - "session": { + "mediaType": { "type": "string" }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "from": { + "uri": { + "type": [ + "string", + "null" + ] + }, + "uploadId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "mediaType" + ] + }, + "TranscriptWsFrame": { + "type": "object", + "properties": { + "session": { + "type": "string" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { "type": "integer", "format": "uint64", "minimum": 0 @@ -5147,6 +5713,53 @@ "contextSource" ] }, + "SessionPreviewKind": { + "type": "string", + "enum": [ + "running", + "asking", + "approval", + "said" + ] + }, + "SessionPreview": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "kind": { + "$ref": "#/$defs/SessionPreviewKind" + }, + "text": { + "type": "string" + }, + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "kind", + "text", + "at" + ] + }, + "SessionPreviewList": { + "type": "object", + "properties": { + "previews": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionPreview" + } + } + }, + "required": [ + "previews" + ] + }, "HarnessTurnAccepted": { "type": "object", "properties": { @@ -5265,6 +5878,16 @@ } ] }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + }, "redirectedTo": { "anyOf": [ { @@ -5274,6 +5897,16 @@ "type": "null" } ] + }, + "switches": { + "anyOf": [ + { + "$ref": "#/$defs/SessionSwitches" + }, + { + "type": "null" + } + ] } }, "required": [ @@ -5304,6 +5937,165 @@ "protocol" ] }, + "StartupContext": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "sections": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSection" + } + }, + "tokens": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "deliveredVia": { + "$ref": "#/$defs/DeliveredVia" + } + }, + "required": [ + "topicId", + "sections", + "tokens", + "deliveredVia" + ] + }, + "StartupSection": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/StartupKind" + }, + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "sources": { + "type": "array", + "items": { + "$ref": "#/$defs/StartupSource" + } + } + }, + "required": [ + "kind", + "title", + "text", + "sources" + ] + }, + "StartupKind": { + "type": "string", + "enum": [ + "topic", + "recent", + "relevant" + ] + }, + "StartupSource": { + "oneOf": [ + { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "wiki": { + "$ref": "#/$defs/WikiSlug" + } + }, + "required": [ + "wiki" + ], + "additionalProperties": false + } + ] + }, + "WikiSlug": { + "type": "string" + }, + "DeliveredVia": { + "type": "string", + "enum": [ + "metaAppend", + "cliFlag", + "none" + ] + }, + "SessionSwitches": { + "type": "object", + "properties": { + "model": { + "type": "boolean" + }, + "effort": { + "type": "boolean" + } + }, + "required": [ + "model", + "effort" + ] + }, + "HarnessSessionTitleRequest": { + "type": "object", + "properties": { + "title": { + "type": "string" + } + }, + "required": [ + "title" + ] + }, + "HarnessSessionForkRequest": { + "type": "object", + "properties": { + "prompts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "prompts" + ] + }, + "HarnessToolOutput": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "isError": { + "type": "boolean" + }, + "truncated": { + "type": "boolean" + } + }, + "required": [ + "text", + "isError", + "truncated" + ] + }, "HarnessSocketRefusalCode": { "type": "string", "enum": [ @@ -5413,6 +6205,12 @@ "format": "uint16", "minimum": 0, "maximum": 65535 + }, + "topicId": { + "type": [ + "string", + "null" + ] } } }, @@ -5990,6 +6788,9 @@ "id": { "type": "string" }, + "uri": { + "type": "string" + }, "name": { "type": "string" }, @@ -6014,6 +6815,7 @@ }, "required": [ "id", + "uri", "name", "bytes", "mediaType", @@ -6660,9 +7462,6 @@ "slug" ] }, - "WikiSlug": { - "type": "string" - }, "WikiHistoryEntry": { "type": "object", "properties": { @@ -6709,6 +7508,40 @@ "string", "null" ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6757,7 +7590,8 @@ "conversation", "task", "leaf", - "extract-wiki" + "extract-wiki", + "user" ] }, "WikiSourceSpan": { @@ -6868,6 +7702,12 @@ "items": { "type": "string" } + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -6947,7 +7787,7 @@ "stalest": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/WikiTopic" } } }, @@ -6982,6 +7822,12 @@ }, "excerpt": { "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -7013,2697 +7859,2670 @@ "total" ] }, - "AgentEvent": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" - }, - "session": { - "type": "string" - } - }, - "required": [ - "v", - "session" - ], + "ProposalState": { + "type": "string", + "enum": [ + "pending", + "approved", + "rejected" + ] + }, + "Proposer": { + "type": "string", + "enum": [ + "categorizer", + "backfill" + ] + }, + "TidyChange": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] + "const": "merge" }, - "name": { - "type": [ - "string", - "null" - ] - }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "source": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type" + "kind", + "source", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "move" }, - "ts": { + "topic": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.user" + "const": "rename" }, - "text": { + "topic": { "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "name": { + "type": "string" } }, "required": [ - "type", - "text" + "kind", + "topic", + "name" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "message.agent" + "const": "close" }, - "text": { + "topic": { "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "thinking.delta" + "const": "delete" }, - "text": { + "topic": { "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" } }, "required": [ - "type", - "text" + "kind", + "topic" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "tool.start" + "const": "createTopic" }, - "tool": { + "topic": { "type": "string" }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true + "name": { + "type": "string" }, - "ts": { + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] + }, + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + }, + "default": [] + }, + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tool" + "kind", + "topic", + "name", + "sessions", + "conversations" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.plan" + "const": "fileInto" }, - "tasks": { + "topic": { + "type": "string" + }, + "sessions": { "type": "array", "items": { - "type": "string" - } + "$ref": "#/$defs/SessionId" + }, + "default": [] }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "conversations": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] } }, "required": [ - "type", - "tasks" + "kind", + "topic", + "sessions", + "conversations" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "task.check" + "const": "mergePage" }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "page": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "into": { + "type": "string" } }, "required": [ - "type", - "index" + "kind", + "page", + "into" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" + "const": "removePage" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "page": { + "type": "string" } }, "required": [ - "type", - "activity" + "kind", + "page" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "turn.end" + "const": "addType" }, - "ts": { + "topic": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parent": { "type": [ - "integer", + "string", "null" - ], - "format": "int64" + ] } }, "required": [ - "type" + "kind", + "topic", + "name" ] } - ], - "unevaluatedProperties": true - }, - "SessionHarness": { - "type": "string" + ] }, - "AgentUsage": { + "TidySample": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "id": { + "type": "string" }, - "completionTokens": { + "title": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id" + ] + }, + "TidyEvidence": { + "type": "object", + "properties": { + "sessions": { "type": "integer", "format": "uint64", "minimum": 0 }, - "cachedTokens": { + "samples": { + "type": "array", + "items": { + "$ref": "#/$defs/TidySample" + }, + "default": [] + } + }, + "required": [ + "sessions", + "samples" + ] + }, + "TidyProposal": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "batchId": { + "type": "string" + }, + "change": { + "$ref": "#/$defs/TidyChange" + }, + "reason": { + "type": "string" + }, + "evidence": { + "$ref": "#/$defs/TidyEvidence" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "state": { + "$ref": "#/$defs/ProposalState" + }, + "decidedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "id", + "batchId", + "change", + "reason", + "evidence", + "proposedBy", + "proposedAt", + "state" + ] + }, + "TidyBatch": { + "type": "object", + "properties": { + "batchId": { + "type": "string" + }, + "proposedBy": { + "$ref": "#/$defs/Proposer" + }, + "proposedAt": { + "type": "integer", + "format": "int64" + }, + "proposals": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + } + }, + "required": [ + "batchId", + "proposedBy", + "proposedAt", + "proposals" + ] + }, + "TidyPending": { + "type": "object", + "properties": { + "batches": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyBatch" + } + } + }, + "required": [ + "batches" + ] + }, + "TidyFailure": { + "type": "object", + "properties": { + "proposalId": { + "type": "string" + }, + "error": { + "type": "string" + } + }, + "required": [ + "proposalId", + "error" + ] + }, + "TidyBatchDecision": { + "type": "object", + "properties": { + "decided": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyProposal" + } + }, + "failed": { + "type": "array", + "items": { + "$ref": "#/$defs/TidyFailure" + }, + "default": [] + } + }, + "required": [ + "decided", + "failed" + ] + }, + "FilingUpkeep": { + "type": "object", + "properties": { + "categorizer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "you": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "uncategorized": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "leftOut": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "correctionsLastWeek": { "type": "integer", "format": "uint64", "minimum": 0 } }, "required": [ - "promptTokens", - "completionTokens", - "cachedTokens" + "categorizer", + "you", + "uncategorized", + "leftOut", + "correctionsLastWeek" ] }, - "AgentEventKind": { + "EntityTypeCount": { + "type": "object", + "properties": { + "typeId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "entities": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "typeId", + "name", + "entities" + ] + }, + "WikiUpkeep": { + "type": "object", + "properties": { + "topicPages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "entityTypes": { + "type": "array", + "items": { + "$ref": "#/$defs/EntityTypeCount" + } + }, + "loosePages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "topicPages", + "entityTypes", + "loosePages" + ] + }, + "WorkerActivity": { + "type": "object", + "properties": { + "lastFinishedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "failing": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "failing" + ] + }, + "WorkerUpkeep": { + "type": "object", + "properties": { + "embedder": { + "$ref": "#/$defs/WorkerActivity" + }, + "summarizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "categorizer": { + "$ref": "#/$defs/WorkerActivity" + }, + "wikiBuilder": { + "$ref": "#/$defs/WorkerActivity" + } + }, + "required": [ + "embedder", + "summarizer", + "categorizer", + "wikiBuilder" + ] + }, + "MemoryUpkeep": { + "type": "object", + "properties": { + "filing": { + "$ref": "#/$defs/FilingUpkeep" + }, + "wiki": { + "$ref": "#/$defs/WikiUpkeep" + }, + "workers": { + "$ref": "#/$defs/WorkerUpkeep" + }, + "pendingProposals": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "filing", + "wiki", + "workers", + "pendingProposals" + ] + }, + "TopicDirectory": { "oneOf": [ { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.start" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] + "const": "local" }, - "harness": { - "anyOf": [ - { - "$ref": "#/$defs/SessionHarness" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "path": { + "type": "string" } }, "required": [ - "type" + "kind", + "node", + "path" ] }, { "type": "object", "properties": { - "type": { + "kind": { "type": "string", - "const": "session.end" + "const": "shared" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" + "path": { + "type": "string" } }, "required": [ - "type" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.user" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "message.agent" - }, - "text": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "durationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/AgentUsage" - }, - { - "type": "null" - } - ] - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "thinking.delta" - }, - "text": { - "type": "string" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "text" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "tool.start" - }, - "tool": { - "type": "string" - }, - "args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tool" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.plan" - }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "tasks" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "task.check" - }, - "index": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "index" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "activity" - }, - "activity": { - "$ref": "#/$defs/Activity" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type", - "activity" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "type" + "kind", + "path" ] } ] }, - "LiveSessionSummary": { + "TopicKind": { + "type": "string", + "enum": [ + "work", + "type", + "entity" + ] + }, + "PlacedBy": { + "type": "string", + "enum": [ + "you", + "categorizer" + ] + }, + "TopicRecord": { "type": "object", "properties": { "id": { "type": "string" }, + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { + "type": "string" + }, "name": { "type": "string" }, - "harness": { + "aliases": { + "type": "array", + "items": { + "type": "string" + } + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "directory": { "anyOf": [ { - "$ref": "#/$defs/SessionHarness" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] }, - "lastEventTs": { + "createdAt": { + "type": "integer", + "format": "int64" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "closedAt": { "type": [ "integer", "null" ], "format": "int64" - }, - "pty": { - "type": [ - "string", - "null" - ] - }, - "contextWindow": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "compactAt": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, - "contextSource": { - "anyOf": [ - { - "$ref": "#/$defs/ContextSource" - }, - { - "type": "null" - } - ] } }, "required": [ "id", - "name" + "kind", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt" ] }, - "SessionLogLine": { + "TopicSummary": { "type": "object", "properties": { - "who": { + "id": { "type": "string" }, - "text": { + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" + }, + "slug": { "type": "string" - } - }, - "required": [ - "who", - "text" - ] - }, - "SessionView": { - "type": "object", - "properties": { - "title": { + }, + "name": { "type": "string" }, - "activity": { - "$ref": "#/$defs/Activity" + "aliases": { + "type": "array", + "items": { + "type": "string" + } }, - "tool": { + "parent": { "type": [ "string", "null" ] }, - "tasks": { - "type": "array", - "items": { - "type": "string" - } + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] }, - "thought": { - "type": "string" + "createdAt": { + "type": "integer", + "format": "int64" }, - "lastMessage": { - "type": "string" + "updatedAt": { + "type": "integer", + "format": "int64" }, - "log": { - "type": "array", - "items": { - "$ref": "#/$defs/SessionLogLine" - } + "closedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" }, - "term": { - "type": "array", - "items": { - "type": "string" - } + "sessionCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "ended": { - "type": "boolean" + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "title", - "activity", - "tasks", - "thought", - "lastMessage", - "log", - "term", - "ended" + "id", + "kind", + "slug", + "name", + "aliases", + "createdAt", + "updatedAt", + "sessionCount" ] }, - "LiveSessionList": { + "TopicList": { "type": "object", "properties": { - "sessions": { + "topics": { "type": "array", "items": { - "$ref": "#/$defs/LiveSessionSummary" + "$ref": "#/$defs/TopicSummary" } } }, "required": [ - "sessions" + "topics" ] }, - "StateResponse": { + "TopicCreateRequest": { "type": "object", "properties": { - "session": { - "type": "string" + "kind": { + "$ref": "#/$defs/TopicKind", + "default": "work" }, - "state": { - "$ref": "#/$defs/SessionView" - } - }, - "required": [ - "session", - "state" - ] - }, - "snapshot": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "name": { + "type": "string" }, - "sessions": { + "aliases": { "type": "array", "items": { - "$ref": "#/$defs/LiveSessionSummary" - } + "type": "string" + }, + "default": [] }, - "rooms": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/SessionView" - } - } - }, - "required": [ - "v", - "sessions", - "rooms" - ] - }, - "session.removed": { - "type": "object", - "properties": { - "v": { - "$ref": "#/$defs/ProtocolVersion" + "parent": { + "type": [ + "string", + "null" + ] }, - "session": { - "type": "string" + "directory": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDirectory" + }, + { + "type": "null" + } + ] } }, + "additionalProperties": false, "required": [ - "v", - "session" - ] - }, - "SessionBroadcast": { - "anyOf": [ - { - "$ref": "#/$defs/snapshot" - }, - { - "$ref": "#/$defs/session.removed" - }, - { - "$ref": "#/$defs/AgentEvent" - } + "kind", + "name", + "aliases" ] }, - "CaptureBatchRequest": { + "WikiPageEdit": { "type": "object", "properties": { - "session_key": { - "type": "string" - }, - "agent": { - "type": "string" - }, - "channel": { + "currentState": { "type": [ "string", "null" ] }, - "title": { + "article": { "type": [ "string", "null" ] - }, - "settings": { + } + }, + "additionalProperties": false + }, + "TopicUpdate": { + "type": "object", + "properties": { + "name": { "type": [ - "object", + "string", "null" - ], - "additionalProperties": true + ] }, - "task_id": { + "aliases": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "type": "string" + } }, - "finalize": { + "parent": { "type": [ - "boolean", + "string", "null" ] }, - "created_at": { + "directory": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicDirectory" }, { "type": "null" } ] - }, - "updated_at": { - "anyOf": [ - { - "$ref": "#/$defs/Millis" - }, - { - "type": "null" - } - ] - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/CaptureMessage" - } } }, + "additionalProperties": false + }, + "TopicMergeRequest": { + "type": "object", + "properties": { + "into": { + "type": "string" + } + }, + "additionalProperties": false, "required": [ - "session_key", - "agent", - "messages" + "into" ] }, - "CaptureMessage": { + "TopicPlacement": { "type": "object", "properties": { - "event_id": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { "type": "string" }, - "role": { - "$ref": "#/$defs/Role" + "by": { + "$ref": "#/$defs/PlacedBy" }, - "content": { + "at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "sessionId", + "topicId", + "by", + "at" + ] + }, + "TopicSuggestion": { + "type": "object", + "properties": { + "name": { "type": "string" }, - "tool_name": { + "topicId": { "type": [ "string", "null" ] }, - "tool_args": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "tool_result": { + "parentId": { "type": [ "string", "null" ] + } + }, + "required": [ + "name" + ] + }, + "PlacementReply": { + "type": "object", + "properties": { + "placement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicPlacement" + }, + { + "type": "null" + } + ] }, - "metadata": { - "type": [ - "object", - "null" - ], - "additionalProperties": true - }, - "created_at": { + "suggestion": { "anyOf": [ { - "$ref": "#/$defs/Millis" + "$ref": "#/$defs/TopicSuggestion" }, { "type": "null" } ] } + } + }, + "PlacementRequest": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + } }, + "additionalProperties": false, "required": [ - "event_id", - "role", - "content" + "topicId" ] }, - "CaptureResult": { + "SessionHistoryMark": { "type": "object", "properties": { - "ok": { - "type": "boolean" - }, - "conversation_id": { - "type": "string" - }, - "inserted": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessionId": { + "$ref": "#/$defs/SessionId" }, - "skipped": { + "markedAt": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" } }, "required": [ - "ok", - "conversation_id", - "inserted", - "skipped" + "sessionId", + "markedAt" ] }, - "HookEventName": { - "type": "string", - "enum": [ - "provider:before", - "provider:after", - "provider:error", - "tool:before", - "tool:after", - "session:start", - "session:end", - "turn:before", - "turn:after", - "turn:reflect", - "skill:before", - "skill:after", - "compact:before", - "compact:after", - "delegation:before", - "delegation:after" + "SessionHistoryList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } + } + }, + "required": [ + "sessions" ] }, - "HookContextBase": { + "TopicSession": { "type": "object", "properties": { - "agentId": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "title": { "type": [ "string", "null" ] }, - "sessionId": { + "lastActive": { "type": [ - "string", + "integer", "null" - ] - }, - "timestamp": { - "type": "integer", + ], "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": true + "node": { + "type": [ + "string", + "null" + ] } }, "required": [ - "timestamp", - "metadata" - ] - }, - "ReflectionSource": { - "type": "string", - "enum": [ - "complexity", - "periodic", - "manual" - ] - }, - "DelegationHookStatus": { - "type": "string", - "enum": [ - "completed", - "failed", - "timeout", - "cached" + "sessionId", + "topicId", + "by", + "at" ] }, - "HookUsage": { + "TopicSessionList": { "type": "object", "properties": { - "promptTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } }, - "completionTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + }, + "default": [] } }, "required": [ - "promptTokens", - "completionTokens" + "sessions", + "conversations" ] }, - "SessionTokens": { + "TopicConversation": { "type": "object", "properties": { - "prompt": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "conversationId": { + "type": "string" }, - "completion": { + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" + }, + "at": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" + }, + "channel": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "node": { + "type": [ + "string", + "null" + ] } }, "required": [ - "prompt", - "completion" + "conversationId", + "topicId", + "by", + "at", + "channel" ] }, - "TurnComplexity": { + "ConversationPlacement": { "type": "object", "properties": { - "toolCallCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "conversationId": { + "type": "string" }, - "hadErrorRecovery": { - "type": "boolean" + "topicId": { + "type": "string" }, - "hadUserCorrection": { - "type": "boolean" + "by": { + "$ref": "#/$defs/PlacedBy" }, - "uniqueTools": { + "at": { "type": "integer", - "format": "uint64", - "minimum": 0 + "format": "int64" } }, "required": [ - "toolCallCount", - "hadErrorRecovery", - "hadUserCorrection", - "uniqueTools" + "conversationId", + "topicId", + "by", + "at" ] }, - "HookContext": { + "ConversationPlacementReply": { "type": "object", "properties": { - "agentId": { + "placement": { + "anyOf": [ + { + "$ref": "#/$defs/ConversationPlacement" + }, + { + "type": "null" + } + ] + } + } + }, + "TopicPage": { + "type": "object", + "properties": { + "topic": { + "$ref": "#/$defs/TopicRecord" + }, + "page": { + "anyOf": [ + { + "$ref": "#/$defs/WikiPageResponse" + }, + { + "type": "null" + } + ] + }, + "mentions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicMention" + }, + "default": [] + } + }, + "required": [ + "topic", + "mentions" + ] + }, + "TopicMention": { + "type": "object", + "properties": { + "topicId": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "topicId", + "name" + ] + }, + "DecisionStatus": { + "type": "string", + "enum": [ + "active", + "superseded" + ] + }, + "TopicDecision": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "topicId": { + "type": "string" + }, + "text": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DecisionStatus" + }, + "supersededBy": { "type": [ "string", "null" ] }, + "by": { + "type": "string" + }, "sessionId": { - "type": [ - "string", - "null" + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } ] }, - "timestamp": { + "createdAt": { "type": "integer", "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": true + "updatedAt": { + "type": "integer", + "format": "int64" } }, "required": [ - "timestamp", - "metadata" - ], - "oneOf": [ - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" + "id", + "topicId", + "text", + "status", + "by", + "createdAt", + "updatedAt" + ] + }, + "TopicDecisionList": { + "type": "object", + "properties": { + "decisions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicDecision" + } + } + }, + "required": [ + "decisions" + ] + }, + "DecisionCreateRequest": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "model": { - "type": "string" + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionUpdate": { + "type": "object", + "properties": { + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "DecisionSupersedeRequest": { + "type": "object", + "properties": { + "text": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "DecisionSuperseded": { + "type": "object", + "properties": { + "superseded": { + "$ref": "#/$defs/TopicDecision" + }, + "replacement": { + "anyOf": [ + { + "$ref": "#/$defs/TopicDecision" }, - "skip": { - "type": [ - "boolean", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "providerId", - "model", - "messages" ] + } + }, + "required": [ + "superseded" + ] + }, + "AgentEvent": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ], + "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:after" + "const": "session.start" }, - "providerId": { - "type": "string" + "title": { + "type": [ + "string", + "null" + ] }, - "model": { - "type": "string" + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" - }, - "error": { - "type": "string" + "const": "session.end" }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" + "const": "message.user" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" + "const": "message.agent" }, - "toolName": { + "text": { "type": "string" }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "model": { + "type": [ + "string", + "null" + ] }, "durationMs": { - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint64", "minimum": 0 }, - "isError": { - "type": "boolean" - } - }, - "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:start" - }, - "platform": { - "type": [ - "string", - "null" + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/AgentUsage" + }, + { + "type": "null" + } ] }, - "userId": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:end" + "const": "thinking.delta" }, - "turnCount": { + "text": { + "type": "string" + }, + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:before" + "const": "tool.start" }, - "userMessage": { - "$ref": "#/$defs/Message" + "tool": { + "type": "string" }, - "skip": { + "args": { "type": [ - "boolean", + "object", "null" - ] + ], + "additionalProperties": true }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "userMessage" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" + "const": "task.plan" }, - "toolsUsed": { + "tasks": { "type": "array", "items": { "type": "string" } }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "const": "task.check" }, - "iterations": { + "index": { "type": "integer", "format": "uint32", "minimum": 0 }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" - }, - "userMessage": { - "$ref": "#/$defs/Message" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } + "const": "activity" }, - "matchScore": { - "type": "number", - "format": "double" + "activity": { + "$ref": "#/$defs/Activity" }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] + ], + "format": "int64" + } + }, + "required": [ + "type", + "activity" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn.end" }, - "skipReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" + "type" ] + } + ], + "unevaluatedProperties": true + }, + "SessionHarness": { + "type": "string" + }, + "AgentUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens", + "cachedTokens" + ] + }, + "AgentEventKind": { + "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } + "const": "session.start" }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "title": { + "type": [ + "string", + "null" + ] }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "name": { + "type": [ + "string", + "null" + ] }, - "usage": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/SessionHarness" }, { "type": "null" } ] - } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "messageCount" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "const": "session.end" }, - "summary": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "remainingMessages" + "type" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" + "const": "message.user" }, - "task": { + "text": { "type": "string" }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" + "const": "message.agent" }, - "task": { + "text": { "type": "string" }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" + "model": { + "type": [ + "string", + "null" + ] }, "durationMs": { - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint64", "minimum": 0 }, "usage": { "anyOf": [ { - "$ref": "#/$defs/HookUsage" + "$ref": "#/$defs/AgentUsage" }, { "type": "null" } ] }, - "toolsUsed": { + "ts": { "type": [ - "array", + "integer", "null" ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" + "format": "int64" } }, "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" - ] - } - ] - }, - "Message": { - "type": "object", - "properties": { - "role": { - "$ref": "#/$defs/Role" - }, - "content": { - "$ref": "#/$defs/MessageContent" - }, - "reasoning": { - "type": [ - "string", - "null" - ] - }, - "toolCalls": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ToolCall" - } - }, - "toolCallId": { - "type": [ - "string", - "null" + "type", + "text" ] - } - }, - "required": [ - "role", - "content" - ] - }, - "MessageContent": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/ContentPart" - } - } - ] - }, - "ToolCall": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "arguments": { - "type": "object", - "additionalProperties": true }, - "thoughtSignature": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "arguments" - ] - }, - "HookContextKind": { - "oneOf": [ { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:before" - }, - "providerId": { - "type": "string" + "const": "thinking.delta" }, - "model": { + "text": { "type": "string" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/$defs/Message" - } - }, - "skip": { + "ts": { "type": [ - "boolean", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "messages" + "type", + "text" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:after" - }, - "providerId": { - "type": "string" + "const": "tool.start" }, - "model": { + "tool": { "type": "string" }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "latencyMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "args": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "hasToolCalls": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "latencyMs", - "hasToolCalls" + "type", + "tool" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "provider:error" - }, - "providerId": { - "type": "string" - }, - "model": { - "type": "string" + "const": "task.plan" }, - "error": { - "type": "string" + "tasks": { + "type": "array", + "items": { + "type": "string" + } }, - "statusCode": { + "ts": { "type": [ "integer", "null" ], - "format": "uint16", - "minimum": 0, - "maximum": 65535 + "format": "int64" } }, "required": [ - "event", - "providerId", - "model", - "error" + "type", + "tasks" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:before" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true + "const": "task.check" }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "index": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "blockReason": { + "ts": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args" + "type", + "index" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "tool:after" - }, - "toolName": { - "type": "string" - }, - "args": { - "type": "object", - "additionalProperties": true - }, - "result": { - "type": "object", - "additionalProperties": true + "const": "activity" }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "activity": { + "$ref": "#/$defs/Activity" }, - "isError": { - "type": "boolean" + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ - "event", - "toolName", - "args", - "result", - "durationMs", - "isError" + "type", + "activity" ] }, { "type": "object", "properties": { - "event": { + "type": { "type": "string", - "const": "session:start" - }, - "platform": { - "type": [ - "string", - "null" - ] - }, - "userId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "session:end" + "const": "turn.end" }, - "turnCount": { + "ts": { "type": [ "integer", "null" ], - "format": "uint32", - "minimum": 0 - }, - "totalTokens": { - "anyOf": [ - { - "$ref": "#/$defs/SessionTokens" - }, - { - "type": "null" - } - ] + "format": "int64" } }, "required": [ - "event" + "type" ] + } + ] + }, + "LiveSessionSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:before" - }, - "userMessage": { - "$ref": "#/$defs/Message" - }, - "skip": { - "type": [ - "boolean", - "null" - ] - }, - "skipReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "userMessage" - ] + "name": { + "type": "string" }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:after" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "aborted": { - "type": "boolean" + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/SessionHarness" }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] + { + "type": "null" } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "aborted" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "turn:reflect" - }, - "response": { - "type": "string" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "complexity": { - "$ref": "#/$defs/TurnComplexity" - }, - "source": { - "$ref": "#/$defs/ReflectionSource" - }, - "userMessage": { - "$ref": "#/$defs/Message" - } - }, - "required": [ - "event", - "response", - "toolsUsed", - "iterations", - "complexity", - "source", - "userMessage" + "lastEventTs": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "pty": { + "type": [ + "string", + "null" ] }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:before" - }, - "skillName": { - "type": "string" - }, - "skillLocation": { - "type": "string" - }, - "matchedTriggers": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchScore": { - "type": "number", - "format": "double" - }, - "skip": { - "type": [ - "boolean", - "null" - ] + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" }, - "skipReason": { - "type": [ - "string", - "null" - ] + { + "type": "null" } - }, - "required": [ - "event", - "skillName", - "skillLocation", - "matchedTriggers", - "matchScore" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "skill:after" - }, - "skillName": { - "type": "string" - }, - "success": { - "type": "boolean" - }, - "toolsUsed": { - "type": "array", - "items": { - "type": "string" - } - }, - "iterations": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "event", - "skillName", - "success", - "toolsUsed", - "iterations", - "durationMs" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:before" - }, - "messageCount": { - "type": "integer", - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "event", - "messageCount" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "compact:after" - }, - "remainingMessages": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "summary": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "remainingMessages" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:before" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "chainDepth": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "blockReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "chainDepth" - ] - }, - { - "type": "object", - "properties": { - "event": { - "type": "string", - "const": "delegation:after" - }, - "fromAgent": { - "type": "string" - }, - "toAgent": { - "type": "string" - }, - "task": { - "type": "string" - }, - "status": { - "$ref": "#/$defs/DelegationHookStatus" - }, - "durationMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "usage": { - "anyOf": [ - { - "$ref": "#/$defs/HookUsage" - }, - { - "type": "null" - } - ] - }, - "toolsUsed": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "cached": { - "type": "boolean" - } - }, - "required": [ - "event", - "fromAgent", - "toAgent", - "task", - "status", - "durationMs", - "cached" ] } + }, + "required": [ + "id", + "name" ] }, - "HookPipelineError": { + "SessionLogLine": { "type": "object", "properties": { - "hookId": { + "who": { "type": "string" }, - "error": { + "text": { "type": "string" } }, "required": [ - "hookId", - "error" + "who", + "text" ] }, - "HookPipelineResult": { + "SessionView": { "type": "object", "properties": { - "context": { - "$ref": "#/$defs/HookContext" + "title": { + "type": "string" }, - "aborted": { - "type": "boolean" + "activity": { + "$ref": "#/$defs/Activity" }, - "skipped": { - "type": "boolean" + "tool": { + "type": [ + "string", + "null" + ] }, - "errors": { + "tasks": { "type": "array", "items": { - "$ref": "#/$defs/HookPipelineError" + "type": "string" } }, - "ran": { + "thought": { + "type": "string" + }, + "lastMessage": { + "type": "string" + }, + "log": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionLogLine" + } + }, + "term": { "type": "array", "items": { "type": "string" } + }, + "ended": { + "type": "boolean" } }, "required": [ - "context", - "aborted", - "skipped", - "errors", - "ran" - ] - }, - "HookErrorMode": { - "type": "string", - "enum": [ - "continue", - "abort", - "retry" + "title", + "activity", + "tasks", + "thought", + "lastMessage", + "log", + "term", + "ended" ] }, - "HookConfig": { + "LiveSessionList": { "type": "object", "properties": { - "id": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "StateResponse": { + "type": "object", + "properties": { + "session": { "type": "string" }, - "event": { - "$ref": "#/$defs/HookEventName" + "state": { + "$ref": "#/$defs/SessionView" + } + }, + "required": [ + "session", + "state" + ] + }, + "snapshot": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" }, - "type": { - "$ref": "#/$defs/HookConfigKind" + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/LiveSessionSummary" + } }, - "target": { + "rooms": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/SessionView" + } + } + }, + "required": [ + "v", + "sessions", + "rooms" + ] + }, + "session.removed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "session": { + "type": "string" + } + }, + "required": [ + "v", + "session" + ] + }, + "SessionBroadcast": { + "anyOf": [ + { + "$ref": "#/$defs/snapshot" + }, + { + "$ref": "#/$defs/session.removed" + }, + { + "$ref": "#/$defs/hub.state" + }, + { + "$ref": "#/$defs/plugin.changed" + }, + { + "$ref": "#/$defs/plugin.views" + }, + { + "$ref": "#/$defs/AgentEvent" + } + ] + }, + "plugin.changed": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + } + }, + "required": [ + "v", + "plugin" + ] + }, + "PluginId": { + "type": "string", + "pattern": "^[a-z](-?[a-z0-9])+$", + "maxLength": 24 + }, + "plugin.views": { + "type": "object", + "properties": { + "v": { + "$ref": "#/$defs/ProtocolVersion" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } + } + }, + "required": [ + "v", + "plugin", + "views" + ] + }, + "RouteName": { + "type": "string", + "pattern": "^[a-z0-9][a-z0-9_-]*$", + "maxLength": 64 + }, + "CaptureBatchRequest": { + "type": "object", + "properties": { + "session_key": { "type": "string" }, - "priority": { + "agent": { + "type": "string" + }, + "channel": { "type": [ - "integer", + "string", + "null" + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "settings": { + "type": [ + "object", "null" ], - "format": "int64" + "additionalProperties": true }, - "onError": { + "task_id": { + "type": [ + "string", + "null" + ] + }, + "finalize": { + "type": [ + "boolean", + "null" + ] + }, + "created_at": { "anyOf": [ { - "$ref": "#/$defs/HookErrorMode" + "$ref": "#/$defs/Millis" }, { "type": "null" } ] }, - "agentFilter": { - "type": [ - "array", - "null" - ], + "updated_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } + ] + }, + "messages": { + "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/CaptureMessage" } + } + }, + "required": [ + "session_key", + "agent", + "messages" + ] + }, + "CaptureMessage": { + "type": "object", + "properties": { + "event_id": { + "type": "string" }, - "toolFilter": { + "role": { + "$ref": "#/$defs/Role" + }, + "content": { + "type": "string" + }, + "tool_name": { "type": [ - "array", + "string", + "null" + ] + }, + "tool_args": { + "type": [ + "object", "null" ], - "items": { - "type": "string" - } + "additionalProperties": true }, - "description": { + "tool_result": { "type": [ "string", "null" ] }, - "enabled": { + "metadata": { "type": [ - "boolean", + "object", "null" + ], + "additionalProperties": true + }, + "created_at": { + "anyOf": [ + { + "$ref": "#/$defs/Millis" + }, + { + "type": "null" + } ] } }, "required": [ - "id", - "event", - "type", - "target" - ] - }, - "HookConfigKind": { - "type": "string", - "enum": [ - "shell", - "http", - "internal" - ] - }, - "RosterCommand": { - "type": "string", - "enum": [ - "claude", - "grok", - "kimi", - "opencode", - "hermes", - "codex", - "pi", - "qwen", - "cursor", - "cowork" + "event_id", + "role", + "content" ] }, - "ApprovalDecision": { - "type": "string", - "enum": [ - "allow", - "deny", - "allowSession" + "CaptureResult": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "conversation_id": { + "type": "string" + }, + "inserted": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skipped": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "conversation_id", + "inserted", + "skipped" ] }, - "ApprovalOutcome": { + "HookEventName": { "type": "string", "enum": [ - "allow", - "deny", - "allowSession", - "external" + "provider:before", + "provider:after", + "provider:error", + "tool:before", + "tool:after", + "session:start", + "session:end", + "turn:before", + "turn:after", + "turn:reflect", + "skill:before", + "skill:after", + "compact:before", + "compact:after", + "delegation:before", + "delegation:after" ] }, - "HarnessStatus": { - "type": "string", - "enum": [ - "working", - "blocked", - "idle" + "HookContextBase": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" ] }, - "StatusPhase": { + "ReflectionSource": { "type": "string", "enum": [ - "thinking", - "tool", - "writing", - "prompt" + "complexity", + "periodic", + "manual" ] }, - "StatusSource": { + "DelegationHookStatus": { "type": "string", "enum": [ - "herdr", - "transcript", - "hooks", - "protocol" + "completed", + "failed", + "timeout", + "cached" ] }, - "HarnessEvent": { + "HookUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "SessionTokens": { + "type": "object", + "properties": { + "prompt": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completion": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "prompt", + "completion" + ] + }, + "TurnComplexity": { + "type": "object", + "properties": { + "toolCallCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hadErrorRecovery": { + "type": "boolean" + }, + "hadUserCorrection": { + "type": "boolean" + }, + "uniqueTools": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "toolCallCount", + "hadErrorRecovery", + "hadUserCorrection", + "uniqueTools" + ] + }, + "HookContext": { + "type": "object", + "properties": { + "agentId": { + "type": [ + "string", + "null" + ] + }, + "sessionId": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "timestamp", + "metadata" + ], "oneOf": [ { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "assistant-delta" + "const": "provider:before" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "providerId": { + "type": "string" }, - "text": { + "model": { "type": "string" }, - "turnId": { + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { "type": [ - "string", + "boolean", "null" ] } }, "required": [ - "type", - "sessionId", - "text" + "event", + "providerId", + "model", + "messages" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "reasoning-delta" + "const": "provider:after" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "providerId": { + "type": "string" }, - "text": { + "model": { "type": "string" }, - "turnId": { - "type": [ - "string", - "null" + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" } }, "required": [ - "type", - "sessionId", - "text" + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "tool-use" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "provider:error" }, - "toolCallId": { + "providerId": { "type": "string" }, - "name": { + "model": { "type": "string" }, - "input": { - "type": "object", - "additionalProperties": true + "error": { + "type": "string" }, - "turnId": { + "statusCode": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 } }, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "input" + "event", + "providerId", + "model", + "error" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "tool-result" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "toolCallId": { - "type": "string" + "const": "tool:before" }, - "name": { + "toolName": { "type": "string" }, - "output": { - "type": "string" + "args": { + "type": "object", + "additionalProperties": true }, - "isError": { + "blocked": { "type": [ "boolean", "null" ] }, - "turnId": { + "blockReason": { "type": [ "string", "null" @@ -9711,104 +10530,90 @@ } }, "required": [ - "type", - "sessionId", - "toolCallId", - "name", - "output" + "event", + "toolName", + "args" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "approval-request" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "tool:after" }, - "requestId": { + "toolName": { "type": "string" }, - "toolCallId": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": "string" + "args": { + "type": "object", + "additionalProperties": true }, - "input": { + "result": { "type": "object", "additionalProperties": true }, - "reason": { - "type": [ - "string", - "null" - ] + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "options": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ApprovalOption" - } + "isError": { + "type": "boolean" } }, "required": [ - "type", - "sessionId", - "requestId", - "name", - "input" + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "approval-resolved" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "session:start" }, - "requestId": { - "type": "string" + "platform": { + "type": [ + "string", + "null" + ] }, - "decision": { - "$ref": "#/$defs/ApprovalOutcome" + "userId": { + "type": [ + "string", + "null" + ] } }, "required": [ - "type", - "sessionId", - "requestId", - "decision" + "event" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "session-created" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "session:end" }, - "summary": { - "$ref": "#/$defs/HarnessSessionSummary" + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 }, - "supersedes": { + "totalTokens": { "anyOf": [ { - "$ref": "#/$defs/SessionId" + "$ref": "#/$defs/SessionTokens" }, { "type": "null" @@ -9817,28 +10622,26 @@ } }, "required": [ - "type", - "sessionId", - "summary" + "event" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "turn-complete" + "const": "turn:before" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "userMessage": { + "$ref": "#/$defs/Message" }, - "turnId": { + "skip": { "type": [ - "string", + "boolean", "null" ] }, - "stopReason": { + "skipReason": { "type": [ "string", "null" @@ -9846,152 +10649,181 @@ } }, "required": [ - "type", - "sessionId" + "event", + "userMessage" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "error" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "const": "turn:after" }, - "code": { + "response": { "type": "string" }, - "deliveryId": { - "type": [ - "string", - "null" - ] + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } }, - "message": { - "type": "string" + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "retryable": { - "type": [ - "boolean", - "null" + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } ] } }, "required": [ - "type", - "sessionId", - "code", - "message" + "event", + "response", + "toolsUsed", + "iterations", + "aborted" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "session-updated" + "const": "turn:reflect" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "response": { + "type": "string" }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } }, - "previousSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "supersedes": { + "usage": { "anyOf": [ { - "$ref": "#/$defs/SessionId" + "$ref": "#/$defs/HookUsage" }, { "type": "null" } ] }, - "blocked": { - "type": [ - "boolean", - "null" - ] + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" } }, "required": [ - "type", - "sessionId", - "status" + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "transcript" - }, - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "rev": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "const": "skill:before" }, - "from": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "skillName": { + "type": "string" }, - "total": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "skillLocation": { + "type": "string" }, - "turns": { + "matchedTriggers": { "type": "array", "items": { - "$ref": "#/$defs/HarnessTranscriptTurn" + "type": "string" } }, - "command": { - "$ref": "#/$defs/RosterCommand" + "matchScore": { + "type": "number", + "format": "double" }, - "truncatedBefore": { + "skip": { "type": [ "boolean", "null" ] }, - "contextWindow": { + "skipReason": { "type": [ - "integer", + "string", "null" - ], - "format": "uint64", + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" + }, + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", "minimum": 0 }, - "compactAt": { - "type": [ - "integer", - "null" - ], + "durationMs": { + "type": "integer", "format": "uint64", "minimum": 0 }, - "contextSource": { + "usage": { "anyOf": [ { - "$ref": "#/$defs/ContextSource" + "$ref": "#/$defs/HookUsage" }, { "type": "null" @@ -10000,207 +10832,220 @@ } }, "required": [ - "type", - "sessionId", - "rev", - "from", - "total", - "turns", - "command" + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "status" + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 } }, - "$ref": "#/$defs/HarnessStatusFrame", "required": [ - "type" + "event", + "messageCount" ] }, { "type": "object", "properties": { - "type": { + "event": { "type": "string", - "const": "prompt" + "const": "compact:after" }, - "sessionId": { - "$ref": "#/$defs/SessionId" + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "promptId": { + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { "type": "string" }, - "kind": { - "$ref": "#/$defs/PromptKind" + "toAgent": { + "type": "string" }, - "toolName": { + "task": { "type": "string" }, - "questions": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptQuestion" - } + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "resolved": { - "anyOf": [ - { - "$ref": "#/$defs/PromptResolution" - }, - { - "type": "null" - } + "blocked": { + "type": [ + "boolean", + "null" ] }, - "screen": { + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" + ] + }, + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { "anyOf": [ { - "$ref": "#/$defs/PromptScreen" + "$ref": "#/$defs/HookUsage" }, { "type": "null" } ] - } - }, - "required": [ - "type", - "sessionId", - "promptId", - "kind", - "toolName", - "questions" + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" ] } ] }, - "ApprovalOption": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": [ - "key", - "label" - ] - }, - "HarnessSessionSummary": { + "Message": { "type": "object", "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "cwd": { - "type": [ - "string", - "null" - ] - }, - "createdAt": { - "$ref": "#/$defs/Millis" - }, - "updatedAt": { - "$ref": "#/$defs/Millis" - }, - "status": { - "$ref": "#/$defs/HarnessSessionStatus" - }, - "blocked": { - "type": [ - "boolean", - "null" - ] - }, - "supersedes": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - }, - "model": { - "type": [ - "string", - "null" - ] + "role": { + "$ref": "#/$defs/Role" }, - "parentSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "content": { + "$ref": "#/$defs/MessageContent" }, - "agentName": { + "reasoning": { "type": [ "string", "null" ] }, - "taskId": { + "toolCalls": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "$ref": "#/$defs/ToolCall" + } }, - "effort": { + "toolCallId": { "type": [ "string", "null" ] - }, - "transport": { - "anyOf": [ - { - "$ref": "#/$defs/Transport" - }, - { - "type": "null" - } - ] } }, "required": [ - "sessionId", - "harnessId", - "createdAt", - "updatedAt", - "status" - ], - "additionalProperties": true + "role", + "content" + ] }, - "StatusTool": { + "MessageContent": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ContentPart" + } + } + ] + }, + "ToolCall": { "type": "object", "properties": { + "id": { + "type": "string" + }, "name": { "type": "string" }, - "toolCallId": { + "arguments": { + "type": "object", + "additionalProperties": true + }, + "thoughtSignature": { "type": [ "string", "null" @@ -10208,1105 +11053,6249 @@ } }, "required": [ - "name" + "id", + "name", + "arguments" ] }, - "HarnessStatusFrame": { - "type": "object", - "properties": { - "sessionId": { - "$ref": "#/$defs/SessionId" - }, - "status": { - "$ref": "#/$defs/HarnessStatus" - }, - "since": { - "type": "integer", - "format": "int64" - }, - "source": { - "anyOf": [ - { - "$ref": "#/$defs/StatusSource" + "HookContextKind": { + "oneOf": [ + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:before" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "messages": { + "type": "array", + "items": { + "$ref": "#/$defs/Message" + } + }, + "skip": { + "type": [ + "boolean", + "null" + ] } + }, + "required": [ + "event", + "providerId", + "model", + "messages" ] }, - "phase": { - "anyOf": [ - { - "$ref": "#/$defs/StatusPhase" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:after" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "latencyMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "hasToolCalls": { + "type": "boolean" } + }, + "required": [ + "event", + "providerId", + "model", + "latencyMs", + "hasToolCalls" ] }, - "tool": { - "anyOf": [ - { - "$ref": "#/$defs/StatusTool" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "provider:error" }, - { - "type": "null" + "providerId": { + "type": "string" + }, + "model": { + "type": "string" + }, + "error": { + "type": "string" + }, + "statusCode": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0, + "maximum": 65535 } + }, + "required": [ + "event", + "providerId", + "model", + "error" ] }, - "promptId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "sessionId", - "status", - "since" - ] - }, - "PromptKind": { - "type": "string", - "enum": [ - "ask-user" - ] - }, - "PromptQuestion": { - "type": "object", - "properties": { - "question": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:before" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "toolName", + "args" ] }, - "header": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "tool:after" + }, + "toolName": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": true + }, + "result": { + "type": "object", + "additionalProperties": true + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "isError": { + "type": "boolean" + } + }, + "required": [ + "event", + "toolName", + "args", + "result", + "durationMs", + "isError" ] }, - "multiSelect": { - "type": "boolean" - }, - "freeText": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:start" + }, + "platform": { + "type": [ + "string", + "null" + ] + }, + "userId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event" ] }, - "options": { - "type": "array", - "items": { - "$ref": "#/$defs/PromptOption" - } - } - }, - "required": [ - "multiSelect", - "options" - ] - }, - "PromptOption": { - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "session:end" + }, + "turnCount": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "totalTokens": { + "anyOf": [ + { + "$ref": "#/$defs/SessionTokens" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event" ] - } - }, - "required": [ - "label" - ] - }, - "PromptResolution": { - "type": "object", - "properties": { - "at": { - "type": "integer", - "format": "int64" }, - "answerText": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:before" + }, + "userMessage": { + "$ref": "#/$defs/Message" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "userMessage" ] - } - }, - "required": [ - "at" - ] - }, - "PromptScreen": { - "type": "object", - "properties": { - "current": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "total": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "current", - "total" - ] - }, - "HarnessCapabilities": { - "type": "object", - "properties": { - "interrupt": { - "type": "boolean" - }, - "resume": { - "type": "boolean" - }, - "approvals": { - "type": "boolean" - }, - "liveStream": { - "type": "boolean" }, - "listSessions": { - "type": "boolean" - }, - "drive": { - "type": [ - "boolean", - "null" - ] - }, - "turnOptions": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:after" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "aborted": { + "type": "boolean" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "aborted" ] }, - "launchModel": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "turn:reflect" + }, + "response": { + "type": "string" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "complexity": { + "$ref": "#/$defs/TurnComplexity" + }, + "source": { + "$ref": "#/$defs/ReflectionSource" + }, + "userMessage": { + "$ref": "#/$defs/Message" + } + }, + "required": [ + "event", + "response", + "toolsUsed", + "iterations", + "complexity", + "source", + "userMessage" ] }, - "imageAttachments": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:before" + }, + "skillName": { + "type": "string" + }, + "skillLocation": { + "type": "string" + }, + "matchedTriggers": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchScore": { + "type": "number", + "format": "double" + }, + "skip": { + "type": [ + "boolean", + "null" + ] + }, + "skipReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "skillName", + "skillLocation", + "matchedTriggers", + "matchScore" ] }, - "models": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/HarnessModelOption" - } - }, - "modelsSource": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessModelsSource" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "skill:after" }, - { - "type": "null" + "skillName": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "toolsUsed": { + "type": "array", + "items": { + "type": "string" + } + }, + "iterations": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] } + }, + "required": [ + "event", + "skillName", + "success", + "toolsUsed", + "iterations", + "durationMs" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } - }, - "modelFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:before" + }, + "messageCount": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "event", + "messageCount" ] }, - "effortFlag": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "compact:after" + }, + "remainingMessages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summary": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "remainingMessages" ] - } - }, - "required": [ - "interrupt", - "resume", - "approvals", - "liveStream", - "listSessions" - ] - }, - "HarnessModelOption": { - "type": "object", - "properties": { - "inputModalities": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "id": { - "type": "string" }, - "label": { - "type": "string" - }, - "isDefault": { - "type": [ - "boolean", - "null" + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:before" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "blockReason": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "chainDepth" ] }, - "efforts": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/EffortOption" - } + { + "type": "object", + "properties": { + "event": { + "type": "string", + "const": "delegation:after" + }, + "fromAgent": { + "type": "string" + }, + "toAgent": { + "type": "string" + }, + "task": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/DelegationHookStatus" + }, + "durationMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/HookUsage" + }, + { + "type": "null" + } + ] + }, + "toolsUsed": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "cached": { + "type": "boolean" + } + }, + "required": [ + "event", + "fromAgent", + "toAgent", + "task", + "status", + "durationMs", + "cached" + ] } - }, - "required": [ - "id", - "label" ] }, - "EffortOption": { + "HookPipelineError": { "type": "object", "properties": { - "id": { + "hookId": { "type": "string" }, - "label": { + "error": { "type": "string" - }, - "isDefault": { - "type": [ - "boolean", - "null" - ] } }, "required": [ - "id", - "label" - ] - }, - "HarnessModelsSource": { - "type": "string", - "enum": [ - "discovered", - "config", - "merged", - "static" + "hookId", + "error" ] }, - "HarnessControlCapabilities": { + "HookPipelineResult": { "type": "object", "properties": { - "interrupt": { - "type": "boolean" + "context": { + "$ref": "#/$defs/HookContext" }, - "resume": { + "aborted": { "type": "boolean" }, - "approvals": { + "skipped": { "type": "boolean" + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/$defs/HookPipelineError" + } + }, + "ran": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "interrupt", - "resume", - "approvals" + "context", + "aborted", + "skipped", + "errors", + "ran" ] }, - "HarnessObservationCapabilities": { + "HookErrorMode": { + "type": "string", + "enum": [ + "continue", + "abort", + "retry" + ] + }, + "HookConfig": { "type": "object", "properties": { - "liveStream": { - "type": "boolean" + "id": { + "type": "string" }, - "listSessions": { - "type": "boolean" + "event": { + "$ref": "#/$defs/HookEventName" }, - "drive": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "liveStream", - "listSessions" - ] - }, - "HarnessSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessSessionSummary" - } - } - }, - "required": [ - "sessions" - ] - }, - "HarnessOffering": { - "type": "object", - "properties": { - "harnessId": { - "$ref": "#/$defs/HarnessId" - }, - "chat": { - "type": "boolean" - }, - "capabilities": { - "$ref": "#/$defs/HarnessCapabilities" - } - }, - "required": [ - "harnessId", - "chat", - "capabilities" - ] - }, - "HarnessOfferingList": { - "type": "object", - "properties": { - "harnesses": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessOffering" - } - } - }, - "required": [ - "harnesses" - ] - }, - "HarnessCode": { - "type": "string", - "enum": [ - "invalid_session_id", - "bad_request", - "session_id_collision", - "turn_in_flight", - "capability_unsupported", - "unknown_approval", - "unknown_prompt" - ] - }, - "HarnessStoreSession": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "command": { - "$ref": "#/$defs/RosterCommand" + "type": { + "$ref": "#/$defs/HookConfigKind" }, - "title": { + "target": { "type": "string" }, - "updatedAt": { - "type": "integer", + "priority": { + "type": [ + "integer", + "null" + ], "format": "int64" }, - "parentSessionId": { + "onError": { + "anyOf": [ + { + "$ref": "#/$defs/HookErrorMode" + }, + { + "type": "null" + } + ] + }, + "agentFilter": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "type": "string" + } }, - "agentName": { + "toolFilter": { "type": [ - "string", + "array", "null" - ] + ], + "items": { + "type": "string" + } }, - "model": { + "description": { "type": [ "string", "null" ] }, - "taskId": { + "enabled": { "type": [ - "string", + "boolean", "null" ] } }, "required": [ "id", - "command", - "title", - "updatedAt" + "event", + "type", + "target" ] }, - "HarnessStoreSessionList": { - "type": "object", - "properties": { - "sessions": { - "type": "array", - "items": { - "$ref": "#/$defs/HarnessStoreSession" - } - } - }, - "required": [ - "sessions" + "HookConfigKind": { + "type": "string", + "enum": [ + "shell", + "http", + "internal" ] }, - "TaskExecutorKind": { + "RosterCommand": { "type": "string", "enum": [ - "chat-loop", - "harness-session", - "mesh" + "claude", + "grok", + "kimi", + "opencode", + "hermes", + "codex", + "omp", + "dsh", + "cursor", + "cowork" ] }, - "TaskVerdict": { + "ApprovalDecision": { "type": "string", "enum": [ - "completed", - "failed", - "killed", - "timeout", - "budget-exceeded" + "allow", + "deny", + "allow-session" ] }, - "ContextRefKind": { + "ApprovalOutcome": { "type": "string", "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" + "allow", + "deny", + "allow-session", + "external" ] }, - "ContextRef": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" - }, - "ref": { - "type": "string" - }, - "note": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "kind", - "ref" + "HarnessStatus": { + "type": "string", + "enum": [ + "working", + "blocked", + "idle" ] }, - "CriterionKind": { + "StatusPhase": { "type": "string", "enum": [ - "manual", - "automated" + "thinking", + "tool", + "writing", + "prompt" ] }, - "AcceptanceCriterion": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "description": { - "type": "string" - }, - "kind": { - "$ref": "#/$defs/CriterionKind" - }, - "check": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "description", - "kind" + "StatusSource": { + "type": "string", + "enum": [ + "herdr", + "transcript", + "hooks", + "protocol" ] }, - "TaskBudget": { - "type": "object", - "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", + "HarnessEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "assistant-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "reasoning-delta" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "text": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-use" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-update" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tool-result" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "toolCallId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "output": { + "type": "string" + }, + "isError": { + "type": [ + "boolean", + "null" + ] + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "toolCallId", + "name", + "output" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "options": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ApprovalOption" + } + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/ApprovalOutcome" + } + }, + "required": [ + "type", + "sessionId", + "requestId", + "decision" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-created" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "summary": { + "$ref": "#/$defs/HarnessSessionSummary" + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "summary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "plan" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/$defs/PlanEntry" + } + } + }, + "required": [ + "type", + "sessionId", + "entries" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn-complete" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "turnId": { + "type": [ + "string", + "null" + ] + }, + "stopReason": { + "type": [ + "string", + "null" + ] + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/LlmUsage" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "error" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "code": { + "type": "string" + }, + "deliveryId": { + "type": [ + "string", + "null" + ] + }, + "message": { + "type": "string" + }, + "retryable": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "code", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session-updated" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "previousSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "type", + "sessionId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "transcript" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "rev": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "turns": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessTranscriptTurn" + } + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "truncatedBefore": { + "type": [ + "boolean", + "null" + ] + }, + "contextWindow": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "compactAt": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "contextSource": { + "anyOf": [ + { + "$ref": "#/$defs/ContextSource" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "rev", + "from", + "total", + "turns", + "command" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "status" + } + }, + "$ref": "#/$defs/HarnessStatusFrame", + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "prompt" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "promptId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/PromptKind" + }, + "toolName": { + "type": "string" + }, + "questions": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptQuestion" + } + }, + "resolved": { + "anyOf": [ + { + "$ref": "#/$defs/PromptResolution" + }, + { + "type": "null" + } + ] + }, + "screen": { + "anyOf": [ + { + "$ref": "#/$defs/PromptScreen" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "sessionId", + "promptId", + "kind", + "toolName", + "questions" + ] + } + ] + }, + "ApprovalOption": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "key", + "label" + ] + }, + "HarnessSessionSummary": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/$defs/Millis" + }, + "updatedAt": { + "$ref": "#/$defs/Millis" + }, + "status": { + "$ref": "#/$defs/HarnessSessionStatus" + }, + "blocked": { + "type": [ + "boolean", + "null" + ] + }, + "supersedes": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "type": [ + "string", + "null" + ] + }, + "transport": { + "anyOf": [ + { + "$ref": "#/$defs/Transport" + }, + { + "type": "null" + } + ] + }, + "startupContext": { + "anyOf": [ + { + "$ref": "#/$defs/StartupContext" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "sessionId", + "harnessId", + "createdAt", + "updatedAt", + "status" + ], + "additionalProperties": true + }, + "PlanEntry": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/PlanStatus" + } + }, + "required": [ + "content", + "status" + ] + }, + "PlanStatus": { + "type": "string", + "enum": [ + "pending", + "in_progress", + "completed" + ] + }, + "LlmUsage": { + "type": "object", + "properties": { + "promptTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "completionTokens": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reasoningTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cachedTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheCreationTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "cacheReadTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "promptTokens", + "completionTokens" + ] + }, + "StatusTool": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name" + ] + }, + "HarnessStatusFrame": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "status": { + "$ref": "#/$defs/HarnessStatus" + }, + "since": { + "type": "integer", + "format": "int64" + }, + "source": { + "anyOf": [ + { + "$ref": "#/$defs/StatusSource" + }, + { + "type": "null" + } + ] + }, + "phase": { + "anyOf": [ + { + "$ref": "#/$defs/StatusPhase" + }, + { + "type": "null" + } + ] + }, + "tool": { + "anyOf": [ + { + "$ref": "#/$defs/StatusTool" + }, + { + "type": "null" + } + ] + }, + "promptId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "status", + "since" + ] + }, + "PromptKind": { + "type": "string", + "enum": [ + "ask-user" + ] + }, + "PromptQuestion": { + "type": "object", + "properties": { + "question": { + "type": [ + "string", + "null" + ] + }, + "header": { + "type": [ + "string", + "null" + ] + }, + "multiSelect": { + "type": "boolean" + }, + "freeText": { + "type": [ + "boolean", + "null" + ] + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/PromptOption" + } + } + }, + "required": [ + "multiSelect", + "options" + ] + }, + "PromptOption": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "label" + ] + }, + "PromptResolution": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "answerText": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "at" + ] + }, + "PromptScreen": { + "type": "object", + "properties": { + "current": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "current", + "total" + ] + }, + "HarnessCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + }, + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + }, + "turnOptions": { + "type": [ + "boolean", + "null" + ] + }, + "launchModel": { + "type": [ + "boolean", + "null" + ] + }, + "imageAttachments": { + "type": [ + "boolean", + "null" + ] + }, + "models": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/HarnessModelOption" + } + }, + "modelsSource": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessModelsSource" + }, + { + "type": "null" + } + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + }, + "modelFlag": { + "type": [ + "string", + "null" + ] + }, + "effortFlag": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals", + "liveStream", + "listSessions" + ] + }, + "HarnessModelOption": { + "type": "object", + "properties": { + "inputModalities": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + }, + "efforts": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/EffortOption" + } + } + }, + "required": [ + "id", + "label" + ] + }, + "EffortOption": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "isDefault": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "id", + "label" + ] + }, + "HarnessModelsSource": { + "type": "string", + "enum": [ + "discovered", + "config", + "merged", + "static" + ] + }, + "HarnessControlCapabilities": { + "type": "object", + "properties": { + "interrupt": { + "type": "boolean" + }, + "resume": { + "type": "boolean" + }, + "approvals": { + "type": "boolean" + }, + "steering": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "interrupt", + "resume", + "approvals" + ] + }, + "HarnessObservationCapabilities": { + "type": "object", + "properties": { + "liveStream": { + "type": "boolean" + }, + "listSessions": { + "type": "boolean" + }, + "drive": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "liveStream", + "listSessions" + ] + }, + "HarnessSessionCreateRequest": { + "type": "object", + "properties": { + "harness": { + "anyOf": [ + { + "$ref": "#/$defs/HarnessId" + }, + { + "type": "null" + } + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "cwd": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": [ + "string", + "null" + ] + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "prompt": { + "type": [ + "string", + "null" + ] + } + } + }, + "HarnessSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessSessionSummary" + } + } + }, + "required": [ + "sessions" + ] + }, + "HarnessOffering": { + "type": "object", + "properties": { + "harnessId": { + "$ref": "#/$defs/HarnessId" + }, + "chat": { + "type": "boolean" + }, + "capabilities": { + "$ref": "#/$defs/HarnessCapabilities" + } + }, + "required": [ + "harnessId", + "chat", + "capabilities" + ] + }, + "HarnessOfferingList": { + "type": "object", + "properties": { + "harnesses": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessOffering" + } + } + }, + "required": [ + "harnesses" + ] + }, + "HarnessCode": { + "type": "string", + "enum": [ + "invalid_session_id", + "bad_request", + "session_id_collision", + "turn_in_flight", + "capability_unsupported", + "unknown_approval", + "unknown_prompt", + "turn_failed" + ] + }, + "HarnessStoreSession": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "$ref": "#/$defs/RosterCommand" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "integer", + "format": "int64" + }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "agentName": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "command", + "title", + "updatedAt" + ] + }, + "HarnessStoreSessionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/HarnessStoreSession" + } + } + }, + "required": [ + "sessions" + ] + }, + "TaskExecutorKind": { + "type": "string", + "enum": [ + "chat-loop", + "harness-session", + "mesh" + ] + }, + "task.done": { + "type": "object", + "properties": { + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "ts": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "taskId", + "status", + "ts" + ] + }, + "TaskVerdict": { + "type": "string", + "enum": [ + "completed", + "failed", + "killed", + "timeout", + "budget-exceeded" + ] + }, + "ContextRefKind": { + "type": "string", + "enum": [ + "conversation", + "message", + "task", + "file", + "url", + "wiki" + ] + }, + "ContextRef": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ContextRefKind" + }, + "ref": { + "type": "string" + }, + "note": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "kind", + "ref" + ] + }, + "CriterionKind": { + "type": "string", + "enum": [ + "manual", + "automated" + ] + }, + "AcceptanceCriterion": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/CriterionKind" + }, + "check": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "description", + "kind" + ] + }, + "TaskBudget": { + "type": "object", + "properties": { + "maxUsd": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "maxTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "maxTurns": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "maxWallClockMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + } + }, + "TaskUsage": { + "type": "object", + "properties": { + "inputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "outputTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "totalTokens": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "costUsd": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "turns": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "wallClockMs": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "turns", + "wallClockMs" + ] + }, + "Effort": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "TaskIsolation": { + "type": "string", + "enum": [ + "inherit", + "isolated" + ] + }, + "TaskPromptMode": { + "type": "string", + "enum": [ + "task", + "heartbeat" + ] + }, + "TaskSpec": { + "type": "object", + "properties": { + "delegation": { + "type": [ + "boolean", + "null" + ] + }, + "meshFrom": { + "type": [ + "string", + "null" + ] + }, + "taskId": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "resolvedContext": { + "type": "array", + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "budget": { + "$ref": "#/$defs/TaskBudget", + "default": {} + }, + "tools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "workingDir": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/Effort" + }, + { + "type": "null" + } + ] + }, + "systemPromptAppend": { + "type": [ + "string", + "null" + ] + }, + "isolation": { + "anyOf": [ + { + "$ref": "#/$defs/TaskIsolation" + }, + { + "type": "null" + } + ] + }, + "promptMode": { + "anyOf": [ + { + "$ref": "#/$defs/TaskPromptMode" + }, + { + "type": "null" + } + ] + }, + "excludeTools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "resumeMessage": { + "type": [ + "string", + "null" + ] + }, + "session": { + "type": "string" + }, + "permissionDecisions": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskPermissionDecision" + } + }, + "presetId": { + "type": [ + "string", + "null" + ] + }, + "presetName": { + "type": [ + "string", + "null" + ] + }, + "auditOnly": { + "type": [ + "boolean", + "null" + ] + } + }, + "required": [ + "taskId", + "agentId", + "goal", + "resolvedContext", + "acceptanceCriteria", + "budget", + "session" + ], + "additionalProperties": true + }, + "TaskPermissionDecision": { + "type": "object", + "properties": { + "requestId": { + "type": "string" + }, + "tool": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/TaskPermissionOutcome" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "message": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "requestId", + "tool", + "decision", + "at" + ] + }, + "TaskPermissionOutcome": { + "type": "string", + "enum": [ + "allow", + "deny", + "timeout" + ] + }, + "ArtifactKind": { + "type": "string", + "enum": [ + "file", + "url", + "commit", + "message" + ] + }, + "TaskArtifact": { + "type": "object", + "properties": { + "kind": { + "$ref": "#/$defs/ArtifactKind" + }, + "ref": { + "type": "string" + }, + "note": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "kind", + "ref" + ] + }, + "CriterionReport": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "met": { + "type": "boolean" + }, + "evidence": { + "type": "string", + "default": "" + } + }, + "required": [ + "id", + "met", + "evidence" + ] + }, + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "output": { + "type": [ + "string", + "null" + ] + }, + "artifacts": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskArtifact" + } + }, + "criteriaSelfReport": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/CriterionReport" + } + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "artifacts", + "usage" + ] + }, + "EvalVerdict": { + "type": "string", + "enum": [ + "verified", + "refuted", + "escalated" + ] + }, + "EvalOutcome": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/EvalVerdict" + }, + "attempts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "verifierTaskIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "criteriaReport": { + "type": "array", + "items": { + "$ref": "#/$defs/CriterionReport" + } + }, + "diverged": { + "type": "boolean" + }, + "escalatedAt": { + "type": [ + "string", + "null" + ], + "format": "date-time" + } + }, + "required": [ + "verdict", + "attempts", + "verifierTaskIds", + "criteriaReport", + "diverged" + ] + }, + "ExecutorTurnCapabilities": { + "type": "object", + "properties": { + "steerable": { + "type": "boolean" + }, + "multiTurn": { + "type": "boolean" + }, + "structuredStream": { + "type": "boolean" + } + }, + "required": [ + "steerable", + "multiTurn", + "structuredStream" + ] + }, + "ExecutorResultCapabilities": { + "type": "object", + "properties": { + "usageInResult": { + "type": "boolean" + }, + "sessionIdCapture": { + "type": "boolean" + } + }, + "required": [ + "usageInResult", + "sessionIdCapture" + ] + }, + "ExecutorInteractionCapabilities": { + "type": "object", + "properties": { + "slashCommands": { + "type": "boolean" + }, + "effortSelection": { + "type": "boolean" + } + }, + "required": [ + "slashCommands", + "effortSelection" + ] + }, + "TaskApprovalRequest": { + "type": "object", + "properties": { + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "taskId", + "requestId", + "name", + "input" + ] + }, + "TaskEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "den" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "event": { + "$ref": "#/$defs/AgentEvent" + } + }, + "required": [ + "type", + "ts", + "event" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn.start" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "turn": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "required": [ + "type", + "ts", + "turn" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "turn.end" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "turn": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "harnessSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "type", + "ts", + "turn", + "usage" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.spawned" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "nativeSessionId": { + "type": "string" + }, + "model": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "ts", + "nativeSessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "cost" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "deltaUsd": { + "type": "number", + "format": "double" + }, + "totalUsd": { + "type": "number", + "format": "double" + } + }, + "required": [ + "type", + "ts", + "deltaUsd", + "totalUsd" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "log" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "level": { + "$ref": "#/$defs/LogLevel" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "ts", + "level", + "message" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-request" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": true + }, + "toolCallId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "type", + "ts", + "taskId", + "requestId", + "name", + "input" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "approval-resolved" + }, + "ts": { + "type": "integer", + "format": "int64" + }, + "taskId": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "decision": { + "$ref": "#/$defs/TaskPermissionOutcome" + } + }, + "required": [ + "type", + "ts", + "taskId", + "requestId", + "decision" + ] + } + ] + }, + "LogLevel": { + "type": "string", + "enum": [ + "debug", + "info", + "warn", + "error" + ] + }, + "TaskWire": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "goal": { + "type": "string" + }, + "contextRefs": { + "type": "array", + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": "array", + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + }, + "spec": { + "$ref": "#/$defs/TaskSpec" + }, + "executor": { + "$ref": "#/$defs/TaskExecutorKind" + }, + "executorTarget": { + "type": [ + "string", + "null" + ] + }, + "agentId": { + "type": "string" + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "origin": { + "type": "string" + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "chainDepth": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "claimedBy": { + "type": [ + "string", + "null" + ] + }, + "budget": { + "$ref": "#/$defs/TaskBudget" + }, + "usage": { + "anyOf": [ + { + "$ref": "#/$defs/TaskUsage" + }, + { + "type": "null" + } + ] + }, + "status": { + "$ref": "#/$defs/TaskStatus" + }, + "attempt": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "maxAttempts": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "pendingMessage": { + "type": [ + "string", + "null" + ] + }, + "error": { + "type": [ + "string", + "null" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/$defs/TaskResult" + }, + { + "type": "null" + } + ] + }, + "conversationId": { + "type": [ + "string", + "null" + ] + }, + "sessionKey": { + "type": [ + "string", + "null" + ] + }, + "harnessSessionIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "eval": { + "anyOf": [ + { + "$ref": "#/$defs/EvalOutcome" + }, + { + "type": "null" + } + ] + }, + "evalAttempt": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "createdAt": { + "type": "integer", + "format": "int64" + }, + "startedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "lastHeartbeatAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "completedAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" + }, + "durationMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "pendingApprovals": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskApprovalRequest" + } + } + }, + "required": [ + "id", + "goal", + "contextRefs", + "acceptanceCriteria", + "spec", + "executor", + "agentId", + "origin", + "chainDepth", + "budget", + "status", + "attempt", + "maxAttempts", + "harnessSessionIds", + "evalAttempt", + "createdAt" + ] + }, + "TaskCreateRequest": { + "type": "object", + "properties": { + "goal": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "executor": { + "anyOf": [ + { + "$ref": "#/$defs/TaskExecutorKind" + }, + { + "type": "null" + } + ] + }, + "executorTarget": { + "type": [ + "string", + "null" + ] + }, + "requestedBy": { + "type": [ + "string", + "null" + ] + }, + "parentTaskId": { + "type": [ + "string", + "null" + ] + }, + "chainDepth": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "nodeAffinity": { + "type": [ + "string", + "null" + ] + }, + "spec": { + "anyOf": [ + { + "$ref": "#/$defs/TaskSpec" + }, + { + "type": "null" + } + ] + }, + "budget": { + "anyOf": [ + { + "$ref": "#/$defs/TaskBudget" + }, + { + "type": "null" + } + ] + }, + "contextRefs": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/ContextRef" + } + }, + "acceptanceCriteria": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } + } + }, + "required": [ + "goal", + "agentId" + ] + }, + "TaskResponse": { + "type": "object", + "properties": { + "task": { + "$ref": "#/$defs/TaskWire" + } + }, + "required": [ + "task" + ] + }, + "TasksListResponse": { + "type": "object", + "properties": { + "tasks": { + "type": "array", + "items": { + "$ref": "#/$defs/TaskWire" + } + } + }, + "required": [ + "tasks" + ] + }, + "TaskSteerAccepted": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": [ + "ok" + ] + }, + "TaskKillResponse": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + }, + "prior": { + "anyOf": [ + { + "$ref": "#/$defs/TaskStatus" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "ok" + ] + }, + "TaskApprovalAccepted": { + "type": "object", + "properties": { + "ok": { + "type": "boolean" + } + }, + "required": [ + "ok" + ] + }, + "TaskApprovalWaitResponse": { + "type": "object", + "properties": { + "approval": { + "$ref": "#/$defs/TaskApprovalRequest" + } + }, + "required": [ + "approval" + ] + }, + "TaskWaitTimeoutResponse": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "task": { + "anyOf": [ + { + "$ref": "#/$defs/TaskWire" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "error" + ] + }, + "TaskOverrides": { + "type": "object", + "properties": { + "delegation": { + "type": [ + "boolean", + "null" + ] + }, + "meshFrom": { + "type": [ + "string", + "null" + ] + }, + "presetId": { + "type": [ + "string", + "null" + ] + }, + "presetName": { + "type": [ + "string", + "null" + ] + }, + "permissionDecisions": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/$defs/TaskPermissionDecision" + } + }, + "auditOnly": { + "type": [ + "boolean", + "null" + ] + }, + "workingDir": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { + "anyOf": [ + { + "$ref": "#/$defs/Effort" + }, + { + "type": "null" + } + ] + }, + "systemPromptAppend": { + "type": [ + "string", + "null" + ] + }, + "isolation": { + "anyOf": [ + { + "$ref": "#/$defs/TaskIsolation" + }, + { + "type": "null" + } + ] + }, + "promptMode": { + "anyOf": [ + { + "$ref": "#/$defs/TaskPromptMode" + }, + { + "type": "null" + } + ] + }, + "excludeTools": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "resumeMessage": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": true + }, + "MemorySearchResult": { + "type": "object", + "properties": { + "chunk": { + "anyOf": [ + { + "$ref": "#/$defs/MemoryChunkMatch" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "source": { + "$ref": "#/$defs/MemoryHitSource" + }, + "content": { + "type": "string" + }, + "role": { + "anyOf": [ + { + "$ref": "#/$defs/Role" + }, + { + "type": "null" + } + ] + }, + "agent": { + "type": [ + "string", + "null" + ] + }, + "relevanceScore": { + "type": "number", + "format": "double" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "sessionId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "source", + "content", + "role", + "agent", + "relevanceScore", + "createdAt" + ] + }, + "ToolName": { + "type": "string", + "pattern": "^[a-z](_?[a-z0-9])*$", + "maxLength": 24 + }, + "PluginManifest": { + "type": "object", + "properties": { + "$schema": { + "type": [ + "string", + "null" + ] + }, + "manifest": { + "$ref": "#/$defs/ProtocolVersion" + }, + "id": { + "$ref": "#/$defs/PluginId" + }, + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "run": { + "$ref": "#/$defs/PluginRun" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTool" + } + }, + "contributes": { + "$ref": "#/$defs/PluginContributions", + "default": {} + }, + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJob" + } + }, + "events": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginEventKind" + } + } + }, + "additionalProperties": false, + "required": [ + "manifest", + "id", + "name", + "version", + "description", + "run", + "contributes" + ] + }, + "PluginRun": { + "type": "object", + "properties": { + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "readyTimeoutMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "command" + ] + }, + "Permission": { + "type": "string", + "enum": [ + "memory.read", + "memory.write", + "sessions.read", + "sessions.control", + "topics.read", + "topics.write", + "tasks.read", + "tasks.delegate", + "agents.read", + "notifications.send", + "host.files.read", + "host.files.write", + "host.network", + "host.exec" + ] + }, + "ViewField": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "label": { + "type": "string" + }, + "input": { + "$ref": "#/$defs/ViewInput" + }, + "value": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + }, + "required": { + "type": "boolean" + }, + "help": { + "type": [ + "string", + "null" + ] + }, + "placeholder": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "key", + "label", + "input" + ] + }, + "ViewInput": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "multiline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "secret" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "number" + }, + "min": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "max": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "step": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toggle" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "select" + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewOption" + } + }, + "multiple": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "options" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "file" + }, + "multiple": { + "type": "boolean" + }, + "accept": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + } + ] + }, + "ViewOption": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "value", + "label" + ] + }, + "ViewValue": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number", + "format": "double" + }, + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/ViewFile" + } + } + ] + }, + "ViewFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "data": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "mimeType", + "data" + ] + }, + "PluginTool": { + "type": "object", + "properties": { + "name": { + "$ref": "#/$defs/ToolName" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": "string" + }, + "inputSchema": { + "type": "object", + "additionalProperties": true + }, + "hints": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginToolHint" + } + } + }, + "additionalProperties": false, + "required": [ + "name", + "description", + "inputSchema" + ] + }, + "PluginToolHint": { + "type": "string", + "enum": [ + "readOnly", + "destructive", + "idempotent", + "openWorld" + ] + }, + "PluginContributions": { + "type": "object", + "properties": { + "pages": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginPage" + } + }, + "topicCards": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginTopicCard" + } + }, + "sessionActions": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginSessionAction" + } + } + }, + "additionalProperties": false + }, + "PluginPage": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginTopicCard": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "view": { + "$ref": "#/$defs/RouteName" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "view" + ] + }, + "PluginSessionAction": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "action": { + "$ref": "#/$defs/ViewAction" + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "action" + ] + }, + "ViewAction": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "call" + }, + "action": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "action" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "navigate" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + }, + "replace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "dialog" + }, + "view": { + "$ref": "#/$defs/RouteName" + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "view" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "back" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "refresh" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toast" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "copy" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openSession" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openTopic" + }, + "topicId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "topicId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "openUrl" + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false, + "required": [ + "type", + "url" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "download" + }, + "path": { + "type": "string" + }, + "filename": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "path" + ] + } + ] + }, + "ViewTone": { + "type": "string", + "enum": [ + "neutral", + "info", + "success", + "warning", + "danger" + ] + }, + "PluginJob": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "schedule": { + "type": [ + "string", + "null" + ] + }, + "timeoutMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "id", + "title" + ] + }, + "PluginEventKind": { + "type": "string", + "enum": [ + "session.started", + "session.idle", + "session.ended", + "session.placed", + "summary.written", + "task.done" + ] + }, + "View": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "toolbar": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + } + }, + "additionalProperties": false, + "required": [ + "title", + "blocks" + ] + }, + "ViewButton": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButtonStyle" + }, + { + "type": "null" + } + ] + }, + "action": { + "$ref": "#/$defs/ViewAction" + }, + "confirm": { + "anyOf": [ + { + "$ref": "#/$defs/ViewConfirm" + }, + { + "type": "null" + } + ] + }, + "disabled": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "label", + "action" + ] + }, + "ViewButtonStyle": { + "type": "string", + "enum": [ + "primary", + "secondary", + "danger" + ] + }, + "ViewConfirm": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "text": { + "type": "string" + }, + "confirmLabel": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "title", + "text" + ] + }, + "ViewBlock": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "section" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "collapsed": { + "type": [ + "boolean", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "blocks" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "split" + }, + "primary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "secondary": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + }, + "ratio": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "primary", + "secondary" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tabs" + }, + "tabs": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewTab" + } + }, + "selected": { + "anyOf": [ + { + "$ref": "#/$defs/RouteName" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "tabs" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "markdown" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "code" + }, + "text": { + "type": "string" + }, + "language": { + "type": [ + "string", + "null" + ] + }, + "follow": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "image" + }, + "path": { + "type": "string" + }, + "alt": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "path", + "alt" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "properties" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewProperty" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "progress" + }, + "value": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "label": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "notice" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "tone", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "list" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewListItem" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "table" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewColumn" + } + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewRow" + } + }, + "empty": { + "anyOf": [ + { + "$ref": "#/$defs/ViewEmpty" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "columns", + "rows" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "breadcrumbs" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewCrumb" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "actions" + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "buttons" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "form" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewField" + } + }, + "buttons": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "fields", + "buttons" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "canvas" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "scene": { + "$ref": "#/$defs/CanvasScene" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "readOnly": { + "type": "boolean" + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "scene" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "webPanel" + }, + "id": { + "$ref": "#/$defs/RouteName" + }, + "entry": { + "type": "string" + }, + "height": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0 + }, + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "entry" + ] + } + ] + }, + "ViewTab": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" + }, + "title": { + "type": "string" + }, + "badge": { + "type": [ + "string", "null" - ], - "format": "uint64", - "minimum": 0 + ] + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewBlock" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "title", + "blocks" + ] + }, + "ViewProperty": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "value": { + "$ref": "#/$defs/ViewInline" + } + }, + "additionalProperties": false, + "required": [ + "label", + "value" + ] + }, + "ViewInline": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "text": { + "type": "string" + }, + "tone": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTone" + }, + { + "type": "null" + } + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "badge" + }, + "text": { + "type": "string" + }, + "tone": { + "$ref": "#/$defs/ViewTone" + } + }, + "additionalProperties": false, + "required": [ + "type", + "text", + "tone" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "time" + }, + "at": { + "type": "integer", + "format": "int64" + }, + "style": { + "anyOf": [ + { + "$ref": "#/$defs/ViewTimeStyle" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "at" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "duration" + }, + "ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "ms" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "bytes" + }, + "value": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "type", + "value" + ] + } + ] + }, + "ViewTimeStyle": { + "type": "string", + "enum": [ + "relative", + "absolute" + ] + }, + "ViewListItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "subtitle": { + "type": [ + "string", + "null" + ] + }, + "icon": { + "type": [ + "string", + "null" + ] + }, + "trailing": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } + }, + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "title" + ] + }, + "ViewEmpty": { + "type": "object", + "properties": { + "title": { + "type": "string" }, - "maxTurns": { + "text": { "type": [ - "integer", + "string", "null" - ], - "format": "uint32", - "minimum": 0 + ] }, - "maxWallClockMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 + "button": { + "anyOf": [ + { + "$ref": "#/$defs/ViewButton" + }, + { + "type": "null" + } + ] } - } + }, + "additionalProperties": false, + "required": [ + "title" + ] }, - "TaskUsage": { + "ViewColumn": { "type": "object", "properties": { - "inputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "title": { + "type": "string" }, - "outputTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] }, - "totalTokens": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "sortable": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "ViewAlign": { + "type": "string", + "enum": [ + "start", + "center", + "end" + ] + }, + "ViewRow": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" + "cells": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewInline" + } }, - "turns": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] }, - "wallClockMs": { - "type": "integer", - "format": "uint64", - "minimum": 0 + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewButton" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "cells" + ] + }, + "ViewCrumb": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "action": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAction" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "label" + ] + }, + "CanvasScene": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasItem" + } + }, + "grid": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasGrid" + }, + { + "type": "null" + } + ] + }, + "viewport": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasViewport" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "items" + ] + }, + "CanvasItem": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "node" + }, + "id": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "shapes": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasShape" + } + }, + "anchors": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasAnchor" + } + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "locked": { + "type": "boolean" + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "x", + "y", + "width", + "height", + "shapes" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "connector" + }, + "id": { + "type": "string" + }, + "from": { + "$ref": "#/$defs/CanvasEnd" + }, + "to": { + "$ref": "#/$defs/CanvasEnd" + }, + "route": { + "$ref": "#/$defs/CanvasRoute" + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "dashed": { + "type": "boolean" + }, + "arrow": { + "$ref": "#/$defs/CanvasArrow" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "tooltip": { + "type": [ + "string", + "null" + ] + }, + "menu": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasMenuItem" + } + }, + "decorative": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "id", + "from", + "to", + "route", + "arrow" + ] } - }, - "required": [ - "inputTokens", - "outputTokens", - "totalTokens", - "turns", - "wallClockMs" - ] - }, - "Effort": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" - ] - }, - "TaskPromptMode": { - "type": "string", - "enum": [ - "task", - "heartbeat" ] }, - "TaskSpec": { - "type": "object", - "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" + "CanvasShape": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "rect" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "radius": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "taskId": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "goal": { - "type": "string" - }, - "resolvedContext": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": "array", - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} - }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "workingDir": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "ellipse" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "width": { + "type": "number", + "format": "double" + }, + "height": { + "type": "number", + "format": "double" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "width", + "height" ] }, - "model": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + }, + "text": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "weight": { + "anyOf": [ + { + "$ref": "#/$defs/CanvasWeight" + }, + { + "type": "null" + } + ] + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "align": { + "anyOf": [ + { + "$ref": "#/$defs/ViewAlign" + }, + { + "type": "null" + } + ] + }, + "maxWidth": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "monospace": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "text" ] }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "path" + }, + "d": { + "type": "string" + }, + "fill": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "stroke": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] + }, + "strokeWidth": { + "type": [ + "number", + "null" + ], + "format": "double" }, - { - "type": "null" + "dashed": { + "type": "boolean" } + }, + "additionalProperties": false, + "required": [ + "type", + "d" ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "icon" }, - { - "type": "null" - } - ] - }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" + "x": { + "type": "number", + "format": "double" }, - { - "type": "null" + "y": { + "type": "number", + "format": "double" + }, + "name": { + "type": "string" + }, + "size": { + "type": [ + "number", + "null" + ], + "format": "double" + }, + "color": { + "anyOf": [ + { + "$ref": "#/$defs/ColorRole" + }, + { + "type": "null" + } + ] } + }, + "additionalProperties": false, + "required": [ + "type", + "x", + "y", + "name" ] + } + ] + }, + "ColorRole": { + "type": "string", + "enum": [ + "surface", + "surfaceContainer", + "surfaceContainerHigh", + "primary", + "primaryContainer", + "onPrimary", + "onPrimaryContainer", + "secondaryContainer", + "onSurface", + "onSurfaceVariant", + "outline", + "outlineVariant", + "info", + "success", + "warning", + "danger", + "category1", + "category2", + "category3", + "category4", + "category5", + "category6" + ] + }, + "CanvasWeight": { + "type": "string", + "enum": [ + "regular", + "medium", + "bold" + ] + }, + "CanvasAnchor": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "x": { + "type": "number", + "format": "double" }, - "resumeMessage": { - "type": [ - "string", - "null" - ] + "y": { + "type": "number", + "format": "double" }, - "session": { - "type": "string" + "side": { + "$ref": "#/$defs/CanvasSide" }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } + "direction": { + "$ref": "#/$defs/CanvasDirection" + } + }, + "additionalProperties": false, + "required": [ + "id", + "x", + "y", + "side", + "direction" + ] + }, + "CanvasSide": { + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ] + }, + "CanvasDirection": { + "type": "string", + "enum": [ + "in", + "out", + "both" + ] + }, + "CanvasMenuItem": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "presetId": { - "type": [ - "string", - "null" - ] + "label": { + "type": "string" }, - "presetName": { + "icon": { "type": [ "string", "null" ] }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] + "danger": { + "type": "boolean" } }, + "additionalProperties": false, "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "budget", - "session" - ], - "additionalProperties": true + "id", + "label" + ] }, - "TaskPermissionDecision": { + "CanvasEnd": { "type": "object", "properties": { - "requestId": { - "type": "string" - }, - "tool": { + "node": { "type": "string" }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - }, - "at": { - "type": "integer", - "format": "int64" - }, - "message": { + "anchor": { "type": [ "string", "null" ] } }, + "additionalProperties": false, "required": [ - "requestId", - "tool", - "decision", - "at" + "node" ] }, - "TaskPermissionOutcome": { + "CanvasRoute": { "type": "string", "enum": [ - "allow", - "deny", - "timeout" + "straight", + "curved", + "orthogonal" ] }, - "ArtifactKind": { + "CanvasArrow": { "type": "string", "enum": [ - "file", - "url", - "commit", - "message" + "none", + "end", + "start", + "both" ] }, - "TaskArtifact": { + "CanvasGrid": { "type": "object", "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" + "size": { + "type": "number", + "format": "double" }, - "ref": { - "type": "string" + "snap": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "size" + ] + }, + "CanvasViewport": { + "type": "object", + "properties": { + "x": { + "type": "number", + "format": "double" }, - "note": { + "y": { + "type": "number", + "format": "double" + }, + "zoom": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "x", + "y", + "zoom" + ] + }, + "ViewRequest": { + "type": "object", + "properties": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "kind", - "ref" + "context" ] }, - "CriterionReport": { + "ViewContext": { "type": "object", "properties": { - "id": { - "type": "string" + "topicId": { + "type": [ + "string", + "null" + ] }, - "met": { - "type": "boolean" + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "ViewActionRequest": { + "type": "object", + "properties": { + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "evidence": { - "type": "string", - "default": "" + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "id", - "met", - "evidence" + "context" ] }, - "TaskResult": { + "ViewActionResult": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { - "type": "string" - }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { + "actions": { "type": "array", "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "error": { - "type": [ - "string", - "null" - ] + "$ref": "#/$defs/ViewAction" + }, + "default": [] } }, + "additionalProperties": false, "required": [ - "verdict", - "summary", - "artifacts", - "usage" - ] - }, - "EvalVerdict": { - "type": "string", - "enum": [ - "verified", - "refuted", - "escalated" + "actions" ] }, - "EvalOutcome": { + "ViewActionRefusal": { "type": "object", "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "message": { + "type": "string" }, - "verifierTaskIds": { - "type": "array", - "items": { + "fields": { + "type": "object", + "additionalProperties": { "type": "string" } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "diverged": { - "type": "boolean" - }, - "escalatedAt": { - "type": [ - "string", - "null" - ], - "format": "date-time" } }, + "additionalProperties": false, "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" + "message" ] }, - "ExecutorTurnCapabilities": { + "CanvasEventRequest": { "type": "object", "properties": { - "steerable": { - "type": "boolean" + "event": { + "$ref": "#/$defs/CanvasEvent" }, - "multiTurn": { - "type": "boolean" + "params": { + "type": [ + "object", + "null" + ], + "additionalProperties": true }, - "structuredStream": { - "type": "boolean" + "context": { + "$ref": "#/$defs/ViewContext", + "default": {} } }, + "additionalProperties": false, "required": [ - "steerable", - "multiTurn", - "structuredStream" + "event", + "context" ] }, - "ExecutorResultCapabilities": { - "type": "object", - "properties": { - "usageInResult": { - "type": "boolean" + "CanvasEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "selected" + }, + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] }, - "sessionIdCapture": { - "type": "boolean" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "moved" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasPosition" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "connected" + }, + "from": { + "$ref": "#/$defs/CanvasEnd" + }, + "to": { + "$ref": "#/$defs/CanvasEnd" + } + }, + "additionalProperties": false, + "required": [ + "type", + "from", + "to" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "deleted" + }, + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "items" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "activated" + }, + "item": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "item" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "menu" + }, + "item": { + "type": [ + "string", + "null" + ] + }, + "choice": { + "type": "string" + }, + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "type", + "choice", + "x", + "y" + ] } - }, - "required": [ - "usageInResult", - "sessionIdCapture" ] }, - "ExecutorInteractionCapabilities": { + "CanvasPosition": { "type": "object", "properties": { - "slashCommands": { - "type": "boolean" + "id": { + "type": "string" }, - "effortSelection": { - "type": "boolean" + "x": { + "type": "number", + "format": "double" + }, + "y": { + "type": "number", + "format": "double" } }, + "additionalProperties": false, "required": [ - "slashCommands", - "effortSelection" + "id", + "x", + "y" ] }, - "TaskApprovalRequest": { + "CanvasResponse": { "type": "object", "properties": { - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true + "ops": { + "type": "array", + "items": { + "$ref": "#/$defs/CanvasOp" + }, + "default": [] }, - "toolCallId": { - "type": [ - "string", - "null" - ] + "actions": { + "type": "array", + "items": { + "$ref": "#/$defs/ViewAction" + }, + "default": [] } }, + "additionalProperties": false, "required": [ - "taskId", - "requestId", - "name", - "input" + "ops", + "actions" ] }, - "TaskEvent": { + "CanvasOp": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "den" + "const": "upsert" }, - "ts": { - "type": "integer", - "format": "int64" - }, - "event": { - "$ref": "#/$defs/AgentEvent" + "item": { + "$ref": "#/$defs/CanvasItem" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "event" + "item" ] }, { @@ -11314,86 +17303,169 @@ "properties": { "type": { "type": "string", - "const": "turn.start" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "remove" }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "ids": { + "type": "array", + "items": { + "type": "string" + } } }, + "additionalProperties": false, "required": [ "type", - "ts", - "turn" + "ids" ] + } + ] + }, + "PanelTheme": { + "type": "object", + "properties": { + "scheme": { + "$ref": "#/$defs/PanelScheme" }, - { + "colors": { "type": "object", "properties": { - "type": { - "type": "string", - "const": "turn.end" + "category1": { + "type": "string" }, - "ts": { - "type": "integer", - "format": "int64" + "category2": { + "type": "string" }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "category3": { + "type": "string" }, - "usage": { - "$ref": "#/$defs/TaskUsage" + "category4": { + "type": "string" }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] + "category5": { + "type": "string" + }, + "category6": { + "type": "string" + }, + "danger": { + "type": "string" + }, + "info": { + "type": "string" + }, + "onPrimary": { + "type": "string" + }, + "onPrimaryContainer": { + "type": "string" + }, + "onSurface": { + "type": "string" + }, + "onSurfaceVariant": { + "type": "string" + }, + "outline": { + "type": "string" + }, + "outlineVariant": { + "type": "string" + }, + "primary": { + "type": "string" + }, + "primaryContainer": { + "type": "string" + }, + "secondaryContainer": { + "type": "string" + }, + "success": { + "type": "string" + }, + "surface": { + "type": "string" + }, + "surfaceContainer": { + "type": "string" + }, + "surfaceContainerHigh": { + "type": "string" + }, + "warning": { + "type": "string" } }, - "required": [ - "type", - "ts", - "turn", - "usage" - ] + "additionalProperties": false }, + "fontFamily": { + "type": "string" + }, + "fontMono": { + "type": "string" + }, + "fontSize": { + "type": "number", + "format": "double" + }, + "radius": { + "type": "number", + "format": "double" + } + }, + "additionalProperties": false, + "required": [ + "scheme", + "colors", + "fontFamily", + "fontMono", + "fontSize", + "radius" + ] + }, + "PanelScheme": { + "type": "string", + "enum": [ + "light", + "dark" + ] + }, + "PanelHostMessage": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "session.spawned" - }, - "ts": { - "type": "integer", - "format": "int64" + "const": "init" }, - "nativeSessionId": { - "type": "string" + "theme": { + "$ref": "#/$defs/PanelTheme" }, - "model": { + "params": { "type": [ - "string", + "object", "null" - ] + ], + "additionalProperties": true + }, + "context": { + "$ref": "#/$defs/ViewContext" + }, + "plugin": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "nativeSessionId" + "theme", + "context", + "plugin", + "node" ] }, { @@ -11401,91 +17473,52 @@ "properties": { "type": { "type": "string", - "const": "cost" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "deltaUsd": { - "type": "number", - "format": "double" + "const": "theme" }, - "totalUsd": { - "type": "number", - "format": "double" + "theme": { + "$ref": "#/$defs/PanelTheme" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "deltaUsd", - "totalUsd" + "theme" ] - }, + } + ] + }, + "PanelMessage": { + "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", - "const": "log" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "level": { - "$ref": "#/$defs/LogLevel" - }, - "message": { - "type": "string" + "const": "ready" } }, "required": [ - "type", - "ts", - "level", - "message" - ] + "type" + ], + "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", - "const": "approval-request" + "const": "resize" }, - "ts": { + "height": { "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] + "format": "uint32", + "minimum": 0 } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "name", - "input" + "height" ] }, { @@ -11493,393 +17526,636 @@ "properties": { "type": { "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" + "const": "action" }, - "requestId": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" + "action": { + "$ref": "#/$defs/ViewAction" } }, + "additionalProperties": false, "required": [ "type", - "ts", - "taskId", - "requestId", - "decision" + "action" ] } ] }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" + "PluginList": { + "type": "object", + "properties": { + "node": { + "type": "string" + }, + "plugins": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginRecord" + } + } + }, + "additionalProperties": false, + "required": [ + "node", + "plugins" ] }, - "TaskWire": { + "PluginRecord": { "type": "object", "properties": { "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { "type": "string" }, - "goal": { + "path": { "type": "string" }, - "contextRefs": { + "manifest": { + "$ref": "#/$defs/PluginManifest" + }, + "enabled": { + "type": "boolean" + }, + "state": { + "$ref": "#/$defs/PluginState" + }, + "granted": { "type": "array", "items": { - "$ref": "#/$defs/ContextRef" + "$ref": "#/$defs/Permission" } }, - "acceptanceCriteria": { + "pending": { "type": "array", "items": { - "$ref": "#/$defs/AcceptanceCriterion" + "$ref": "#/$defs/Permission" } }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { + "error": { "type": [ "string", "null" ] }, - "agentId": { - "type": "string" - }, - "requestedBy": { - "type": [ - "string", - "null" + "lastExit": { + "anyOf": [ + { + "$ref": "#/$defs/PluginExit" + }, + { + "type": "null" + } ] }, - "origin": { - "type": "string" + "restarts": { + "type": "integer", + "format": "uint32", + "minimum": 0 }, - "parentTaskId": { + "startedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "chainDepth": { + "installedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 + "format": "int64" }, - "nodeAffinity": { + "jobs": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginJobStatus" + } + } + }, + "additionalProperties": false, + "required": [ + "id", + "node", + "path", + "manifest", + "enabled", + "state", + "granted", + "pending", + "restarts", + "installedAt", + "jobs" + ] + }, + "PluginState": { + "type": "string", + "enum": [ + "disabled", + "awaitingApproval", + "starting", + "running", + "backoff", + "invalid" + ] + }, + "PluginExit": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" + }, + "code": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int32" }, - "claimedBy": { + "signal": { "type": [ "string", "null" ] + } + }, + "additionalProperties": false, + "required": [ + "at" + ] + }, + "PluginJobStatus": { + "type": "object", + "properties": { + "id": { + "$ref": "#/$defs/RouteName" }, - "budget": { - "$ref": "#/$defs/TaskBudget" - }, - "usage": { + "lastRun": { "anyOf": [ { - "$ref": "#/$defs/TaskUsage" + "$ref": "#/$defs/PluginJobRun" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "id" + ] + }, + "PluginJobRun": { + "type": "object", + "properties": { + "runId": { + "type": "string" }, - "status": { - "$ref": "#/$defs/TaskStatus" - }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" }, - "maxAttempts": { + "startedAt": { "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "pendingMessage": { - "type": [ - "string", - "null" - ] + "format": "int64" }, - "error": { + "finishedAt": { "type": [ - "string", + "integer", "null" - ] + ], + "format": "int64" }, - "result": { + "outcome": { "anyOf": [ { - "$ref": "#/$defs/TaskResult" + "$ref": "#/$defs/PluginJobOutcome" }, { "type": "null" } ] }, - "conversationId": { - "type": [ - "string", - "null" - ] - }, - "sessionKey": { + "message": { "type": [ "string", "null" ] - }, - "harnessSessionIds": { + } + }, + "additionalProperties": false, + "required": [ + "runId", + "trigger", + "startedAt" + ] + }, + "PluginJobTrigger": { + "type": "string", + "enum": [ + "schedule", + "manual" + ] + }, + "PluginJobOutcome": { + "type": "string", + "enum": [ + "succeeded", + "failed" + ] + }, + "PluginInstallRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "path" + ] + }, + "PluginEnableRequest": { + "type": "object", + "properties": { + "approve": { "type": "array", "items": { - "type": "string" + "$ref": "#/$defs/Permission" + } + } + }, + "additionalProperties": false + }, + "PluginLogs": { + "type": "object", + "properties": { + "lines": { + "type": "array", + "items": { + "$ref": "#/$defs/PluginLogLine" } + } + }, + "additionalProperties": false, + "required": [ + "lines" + ] + }, + "PluginLogLine": { + "type": "object", + "properties": { + "at": { + "type": "integer", + "format": "int64" }, - "eval": { - "anyOf": [ - { - "$ref": "#/$defs/EvalOutcome" - }, - { - "type": "null" - } - ] + "stream": { + "$ref": "#/$defs/PluginLogStream" }, - "evalAttempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "at", + "stream", + "text" + ] + }, + "PluginLogStream": { + "type": "string", + "enum": [ + "stdout", + "stderr", + "host" + ] + }, + "PluginSettings": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } }, - "createdAt": { + "secretsSet": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginSettingsUpdate": { + "type": "object", + "properties": { + "values": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/ViewValue" + }, + { + "type": "null" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "values" + ] + }, + "PluginToolList": { + "type": "object", + "properties": { + "version": { "type": "integer", - "format": "int64" - }, - "startedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "lastHeartbeatAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "completedAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, - "durationMs": { - "type": [ - "integer", - "null" - ], "format": "uint64", "minimum": 0 }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], + "tools": { + "type": "array", "items": { - "$ref": "#/$defs/TaskApprovalRequest" + "$ref": "#/$defs/PluginToolEntry" } } }, + "additionalProperties": false, "required": [ - "id", - "goal", - "contextRefs", - "acceptanceCriteria", - "spec", - "executor", - "agentId", - "origin", - "chainDepth", - "budget", - "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", - "createdAt" + "version", + "tools" ] }, - "TaskCreateRequest": { + "PluginToolEntry": { "type": "object", "properties": { - "goal": { - "type": "string" + "plugin": { + "$ref": "#/$defs/PluginId" }, - "agentId": { - "type": "string" + "tool": { + "$ref": "#/$defs/PluginTool" + } + }, + "additionalProperties": false, + "required": [ + "plugin", + "tool" + ] + }, + "PluginEventDelivery": { + "type": "object", + "properties": { + "seq": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" - }, - { - "type": "null" - } - ] + "at": { + "type": "integer", + "format": "int64" }, - "executorTarget": { - "type": [ - "string", - "null" - ] + "missed": { + "type": "integer", + "format": "uint64", + "minimum": 0 }, - "requestedBy": { - "type": [ - "string", - "null" + "event": { + "$ref": "#/$defs/PluginEvent" + } + }, + "additionalProperties": false, + "required": [ + "seq", + "at", + "missed", + "event" + ] + }, + "PluginEvent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.started" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "parentTaskId": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.idle" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "chainDepth": { - "type": [ - "integer", - "null" - ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.ended" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId" ] }, - "spec": { - "anyOf": [ - { - "$ref": "#/$defs/TaskSpec" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.placed" }, - { - "type": "null" + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "topicId": { + "type": "string" + }, + "by": { + "$ref": "#/$defs/PlacedBy" } + }, + "additionalProperties": false, + "required": [ + "type", + "sessionId", + "topicId", + "by" ] }, - "budget": { - "anyOf": [ - { - "$ref": "#/$defs/TaskBudget" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "summary.written" }, - { - "type": "null" + "summaryId": { + "type": "string" + }, + "sessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "kind": { + "$ref": "#/$defs/SummaryKind" + }, + "level": { + "type": "integer", + "format": "uint32", + "minimum": 0 } + }, + "additionalProperties": false, + "required": [ + "type", + "summaryId", + "kind", + "level" ] }, - "contextRefs": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - } - }, - "required": [ - "goal", - "agentId" - ] - }, - "TaskResponse": { - "type": "object", - "properties": { - "task": { - "$ref": "#/$defs/TaskWire" + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "task.done" + }, + "taskId": { + "type": "string" + }, + "status": { + "$ref": "#/$defs/TaskStatus" + } + }, + "additionalProperties": false, + "required": [ + "type", + "taskId", + "status" + ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "settings.changed" + }, + "values": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + } + }, + "additionalProperties": false, + "required": [ + "type", + "values" + ] } - }, - "required": [ - "task" ] }, - "TasksListResponse": { + "PluginJobRequest": { "type": "object", "properties": { - "tasks": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskWire" - } + "runId": { + "type": "string" + }, + "trigger": { + "$ref": "#/$defs/PluginJobTrigger" + }, + "scheduledAt": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, + "additionalProperties": false, "required": [ - "tasks" + "runId", + "trigger" ] }, - "TaskSteerAccepted": { + "PluginJobResult": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "outcome": { + "$ref": "#/$defs/PluginJobOutcome" + }, + "message": { + "type": [ + "string", + "null" + ] } }, + "additionalProperties": false, "required": [ - "ok" + "outcome" ] }, - "TaskKillResponse": { + "PluginToolCall": { "type": "object", "properties": { - "ok": { - "type": "boolean" + "arguments": { + "type": "object", + "additionalProperties": true }, - "prior": { + "sessionId": { "anyOf": [ { - "$ref": "#/$defs/TaskStatus" + "$ref": "#/$defs/SessionId" }, { "type": "null" @@ -11887,216 +18163,165 @@ ] } }, + "additionalProperties": false, "required": [ - "ok" + "arguments" ] }, - "TaskApprovalAccepted": { + "PluginToolResult": { "type": "object", "properties": { - "ok": { + "text": { + "type": "string" + }, + "isError": { "type": "boolean" } }, + "additionalProperties": false, "required": [ - "ok" + "text" ] }, - "TaskApprovalWaitResponse": { + "PluginSelf": { "type": "object", "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" + "id": { + "$ref": "#/$defs/PluginId" + }, + "node": { + "type": "string" + }, + "version": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/$defs/Permission" + } + }, + "settings": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ViewValue" + } + }, + "dataDir": { + "type": "string" } }, + "additionalProperties": false, "required": [ - "approval" + "id", + "node", + "version", + "permissions", + "settings", + "dataDir" ] }, - "TaskWaitTimeoutResponse": { + "PluginViewsChanged": { "type": "object", "properties": { - "error": { - "type": "string" - }, - "task": { - "anyOf": [ - { - "$ref": "#/$defs/TaskWire" - }, - { - "type": "null" - } - ] + "views": { + "type": "array", + "items": { + "$ref": "#/$defs/RouteName" + } } }, + "additionalProperties": false, "required": [ - "error" + "views" ] }, - "TaskOverrides": { + "PluginNotify": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] + "title": { + "type": "string" }, - "model": { + "text": { "type": [ "string", "null" ] }, - "effort": { + "tone": { "anyOf": [ { - "$ref": "#/$defs/Effort" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { + "action": { "anyOf": [ { - "$ref": "#/$defs/TaskIsolation" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] + } + }, + "additionalProperties": false, + "required": [ + "title" + ] + }, + "plugin.notification": { + "type": "object", + "properties": { + "plugin": { + "$ref": "#/$defs/PluginId" }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } + "title": { + "type": "string" }, - "resumeMessage": { + "text": { "type": [ "string", "null" ] - } - }, - "additionalProperties": true - }, - "MemorySearchResult": { - "type": "object", - "properties": { - "chunk": { + }, + "tone": { "anyOf": [ { - "$ref": "#/$defs/MemoryChunkMatch" + "$ref": "#/$defs/ViewTone" }, { "type": "null" } ] }, - "id": { - "type": "string" - }, - "source": { - "$ref": "#/$defs/MemoryHitSource" - }, - "content": { - "type": "string" - }, - "role": { + "action": { "anyOf": [ { - "$ref": "#/$defs/Role" + "$ref": "#/$defs/ViewAction" }, { "type": "null" } ] }, - "agent": { - "type": [ - "string", - "null" - ] - }, - "relevanceScore": { - "type": "number", - "format": "double" - }, - "createdAt": { - "type": "string", - "format": "date-time" + "ts": { + "type": "integer", + "format": "int64" } }, "required": [ - "id", - "source", - "content", - "role", - "agent", - "relevanceScore", - "createdAt" + "plugin", + "node", + "title", + "ts" ] } } diff --git a/packages/contract/src/accepted.ts b/packages/contract/src/accepted.ts index 7053204..67751dd 100644 --- a/packages/contract/src/accepted.ts +++ b/packages/contract/src/accepted.ts @@ -1,20 +1,11 @@ -// Generated from philbert440/rivethub-runtime@ba386c48eca72acb93d9a26bafb9abd30a48253f contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/accepted.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessId". */ export type HarnessId = - | "claude-code" - | "grok-build" - | "kimi-code" - | "hermes" - | "codex" - | "opencode" - | "pi" - | "qwen-code" - | "cursor" - | "cowork"; + "claude-code" | "grok-build" | "kimi-code" | "hermes" | "codex" | "opencode" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "KnownHarness". @@ -25,6 +16,21 @@ export type KnownHarness = string; * via the `definition` "AgentStoreBackend". */ export type AgentStoreBackend = "postgres" | "file"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ThinkingLevel". + */ +export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubSessionMode". + */ +export type HubSessionMode = "chat" | "terminal"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ProtocolVersion". + */ +export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "SessionId". @@ -137,11 +143,6 @@ export type AudioMicClientFrame = | { type: "stop"; }; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ProtocolVersion". - */ -export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "FileEntryKind". @@ -179,14 +180,14 @@ export type BrowseWindow = "today" | "yesterday" | "this_morning" | "this_week" export type MemoryScope = "messages" | "summaries" | "both"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHitSource". + * via the `definition` "Role". */ -export type MemoryHitSource = "message" | "summary"; +export type Role = "system" | "user" | "assistant" | "tool"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Role". + * via the `definition` "MemoryHitSource". */ -export type Role = "system" | "user" | "assistant" | "tool"; +export type MemoryHitSource = "message" | "summary"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MemoryFallback". @@ -235,6 +236,11 @@ export type ContentPart = } | MediaFields | MediaFields1; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VectorState". + */ +export type VectorState = "embedded" | "pending" | "failed" | "skipped"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MemoryHealthStatus". @@ -277,9 +283,9 @@ export type ContextSource = "spawn" | "default" | "observed"; export type SessionMessageRole = "user" | "assistant"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ThinkingLevel". + * via the `definition` "SteerOutcome". */ -export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +export type SteerOutcome = "steered" | "startedNewTurn" | "promptRequired"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "SessionClientKind". @@ -328,6 +334,11 @@ export type TranscriptToolStatus = "running" | "done" | "error"; * via the `definition` "TranscriptBlock". */ export type TranscriptBlock = "thinking" | "text" | "tool_use" | "tool_result"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPreviewKind". + */ +export type SessionPreviewKind = "running" | "asking" | "approval" | "said"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "Millis". @@ -343,6 +354,32 @@ export type HarnessSessionStatus = "active" | "idle" | "ended" | "error"; * via the `definition` "Transport". */ export type Transport = "protocol"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StartupKind". + */ +export type StartupKind = "topic" | "recent" | "relevant"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StartupSource". + */ +export type StartupSource = + | { + session: SessionId; + } + | { + wiki: WikiSlug; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "WikiSlug". + */ +export type WikiSlug = string; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeliveredVia". + */ +export type DeliveredVia = "metaAppend" | "cliFlag" | "none"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessSocketRefusalCode". @@ -443,14 +480,106 @@ export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter"; export type ErrorKind = "invalid_request_error" | "server_error"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSlug". + * via the `definition` "WikiSourceKind". */ -export type WikiSlug = string; +export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki" | "user"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceKind". + * via the `definition` "ProposalState". + */ +export type ProposalState = "pending" | "approved" | "rejected"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "Proposer". + */ +export type Proposer = "categorizer" | "backfill"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TidyChange". + */ +export type TidyChange = + | { + kind: "merge"; + source: string; + into: string; + } + | { + kind: "move"; + topic: string; + parent?: string | null; + } + | { + kind: "rename"; + topic: string; + name: string; + } + | { + kind: "close"; + topic: string; + } + | { + kind: "delete"; + topic: string; + } + | { + kind: "createTopic"; + topic: string; + name: string; + parent?: string | null; + aliases?: string[]; + sessions?: SessionId[]; + conversations?: string[]; + } + | { + kind: "fileInto"; + topic: string; + sessions?: SessionId[]; + conversations?: string[]; + } + | { + kind: "mergePage"; + page: string; + into: string; + } + | { + kind: "removePage"; + page: string; + } + | { + kind: "addType"; + topic: string; + name: string; + parent?: string | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicDirectory". + */ +export type TopicDirectory = + | { + kind: "local"; + node: string; + path: string; + } + | { + kind: "shared"; + path: string; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicKind". + */ +export type TopicKind = "work" | "type" | "entity"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PlacedBy". + */ +export type PlacedBy = "you" | "categorizer"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DecisionStatus". */ -export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki"; +export type DecisionStatus = "active" | "superseded"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "AgentEvent". @@ -582,11 +711,6 @@ export type AgentEventKind = type: "turn.end"; ts?: number | null; }; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionBroadcast". - */ -export type SessionBroadcast = Snapshot | SessionRemoved | AgentEvent; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HookEventName". @@ -904,17 +1028,17 @@ export type HookConfigKind = "shell" | "http" | "internal"; * via the `definition` "RosterCommand". */ export type RosterCommand = - "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "pi" | "qwen" | "cursor" | "cowork"; + "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalDecision". */ -export type ApprovalDecision = "allow" | "deny" | "allowSession"; +export type ApprovalDecision = "allow" | "deny" | "allow-session"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalOutcome". */ -export type ApprovalOutcome = "allow" | "deny" | "allowSession" | "external"; +export type ApprovalOutcome = "allow" | "deny" | "allow-session" | "external"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HarnessStatus". @@ -957,6 +1081,15 @@ export type HarnessEvent = }; turnId?: string | null; } + | { + type: "tool-update"; + sessionId: SessionId; + toolCallId: string; + input: { + [k: string]: unknown; + }; + turnId?: string | null; + } | { type: "tool-result"; sessionId: SessionId; @@ -990,11 +1123,17 @@ export type HarnessEvent = summary: HarnessSessionSummary; supersedes?: SessionId | null; } + | { + type: "plan"; + sessionId: SessionId; + entries: PlanEntry[]; + } | { type: "turn-complete"; sessionId: SessionId; turnId?: string | null; stopReason?: string | null; + usage?: LlmUsage | null; } | { type: "error"; @@ -1036,6 +1175,11 @@ export type HarnessEvent = resolved?: PromptResolution | null; screen?: PromptScreen | null; }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PlanStatus". + */ +export type PlanStatus = "pending" | "in_progress" | "completed"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "PromptKind". @@ -1057,7 +1201,8 @@ export type HarnessCode = | "turn_in_flight" | "capability_unsupported" | "unknown_approval" - | "unknown_prompt"; + | "unknown_prompt" + | "turn_failed"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskExecutorKind". @@ -1171,1471 +1316,3383 @@ export type TaskEvent = * via the `definition` "LogLevel". */ export type LogLevel = "debug" | "info" | "warn" | "error"; - -export interface RivetHubContractAcceptedByTheRuntime { - [k: string]: unknown; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPreset". + * via the `definition` "PluginId". */ -export interface AgentPreset { - id: string; - name: string; - color: string; - harnessId?: HarnessId | null; - model: string; - effort: string; - systemPrompt: string; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; - createdAt: number; - updatedAt: number; - [k: string]: unknown; -} +export type PluginId = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentsFile". + * via the `definition` "ToolName". */ -export interface AgentsFile { - agents: AgentPreset[]; -} +export type ToolName = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetCreateRequest". + * via the `definition` "RouteName". */ -export interface AgentPresetCreateRequest { - name?: string; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type RouteName = string; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetUpdate". + * via the `definition` "Permission". */ -export interface AgentPresetUpdate { - name?: string | null; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type Permission = + | "memory.read" + | "memory.write" + | "sessions.read" + | "sessions.control" + | "topics.read" + | "topics.write" + | "tasks.read" + | "tasks.delegate" + | "agents.read" + | "notifications.send" + | "host.files.read" + | "host.files.write" + | "host.network" + | "host.exec"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentListResponse". + * via the `definition` "ViewInput". */ -export interface AgentListResponse { - agents: AgentPreset[]; - node: string; - directoryRoot?: string | null; - sharedDir?: string | null; - backend?: AgentStoreBackend | null; -} +export type ViewInput = + | { + type: "text"; + multiline?: boolean; + } + | { + type: "secret"; + } + | { + type: "number"; + min?: number | null; + max?: number | null; + step?: number | null; + } + | { + type: "toggle"; + } + | { + type: "select"; + options: ViewOption[]; + multiple?: boolean; + } + | { + type: "file"; + multiple?: boolean; + accept?: string[]; + }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentResponse". + * via the `definition` "ViewValue". */ -export interface AgentResponse { - agent: AgentPreset; -} +export type ViewValue = boolean | number | string | string[] | ViewFile[]; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDescriptor". + * via the `definition` "PluginToolHint". */ -export interface HarnessDescriptor { - installed?: boolean | null; -} +export type PluginToolHint = "readOnly" | "destructive" | "idempotent" | "openWorld"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DelegatedSessionLink". + * via the `definition` "ViewAction". */ -export interface DelegatedSessionLink { - taskId: string; - parentTaskId?: string | null; - spawnedSessionId: SessionId; - parentSessionId: SessionId; - agentName?: string | null; - model?: string | null; - owner?: string | null; - harnessId?: HarnessId | null; -} +export type ViewAction = + | { + type: "call"; + action: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "navigate"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + replace?: boolean; + } + | { + type: "dialog"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "back"; + } + | { + type: "refresh"; + } + | { + type: "toast"; + text: string; + tone?: ViewTone | null; + } + | { + type: "copy"; + text: string; + } + | { + type: "openSession"; + sessionId: SessionId; + } + | { + type: "openTopic"; + topicId: string; + } + | { + type: "openUrl"; + url: string; + } + | { + type: "download"; + path: string; + filename?: string | null; + }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurnAttachment". + * via the `definition` "ViewTone". */ -export interface UserTurnAttachment { - mime: string; - pathOrUri: string; - name?: string | null; -} +export type ViewTone = "neutral" | "info" | "success" | "warning" | "danger"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurn". + * via the `definition` "PluginEventKind". */ -export interface UserTurn { - deliveryId?: string | null; - model?: string | null; - effort?: string | null; - text: string; +export type PluginEventKind = + "session.started" | "session.idle" | "session.ended" | "session.placed" | "summary.written" | "task.done"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewButtonStyle". + */ +export type ViewButtonStyle = "primary" | "secondary" | "danger"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewBlock". + */ +export type ViewBlock = + | { + type: "section"; + title?: string | null; + subtitle?: string | null; + actions?: ViewButton[]; + blocks: ViewBlock[]; + collapsed?: boolean | null; + } + | { + type: "split"; + primary: ViewBlock[]; + secondary: ViewBlock[]; + ratio?: number | null; + } + | { + type: "tabs"; + tabs: ViewTab[]; + selected?: RouteName | null; + } + | { + type: "text"; + text: string; + tone?: ViewTone | null; + monospace?: boolean; + } + | { + type: "markdown"; + text: string; + } + | { + type: "code"; + text: string; + language?: string | null; + follow?: boolean; + } + | { + type: "image"; + path: string; + alt: string; + } + | { + type: "properties"; + items: ViewProperty[]; + } + | { + type: "progress"; + value?: number | null; + label?: string | null; + } + | { + type: "notice"; + tone: ViewTone; + title?: string | null; + text: string; + actions?: ViewButton[]; + } + | { + type: "list"; + items: ViewListItem[]; + empty?: ViewEmpty | null; + } + | { + type: "table"; + columns: ViewColumn[]; + rows: ViewRow[]; + empty?: ViewEmpty | null; + } + | { + type: "breadcrumbs"; + items: ViewCrumb[]; + } + | { + type: "actions"; + buttons: ViewButton[]; + } + | { + type: "form"; + id: RouteName; + fields: ViewField[]; + buttons: ViewButton[]; + } + | { + type: "canvas"; + id: RouteName; + scene: CanvasScene; + height?: number | null; + readOnly?: boolean; + menu?: CanvasMenuItem[]; + } + | { + type: "webPanel"; + id: RouteName; + entry: string; + height?: number | null; + params?: { + [k: string]: unknown; + } | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewInline". + */ +export type ViewInline = + | { + type: "text"; + text: string; + tone?: ViewTone | null; + icon?: string | null; + monospace?: boolean; + } + | { + type: "badge"; + text: string; + tone: ViewTone; + } + | { + type: "time"; + at: number; + style?: ViewTimeStyle | null; + } + | { + type: "duration"; + ms: number; + } + | { + type: "bytes"; + value: number; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewTimeStyle". + */ +export type ViewTimeStyle = "relative" | "absolute"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ViewAlign". + */ +export type ViewAlign = "start" | "center" | "end"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasItem". + */ +export type CanvasItem = + | { + type: "node"; + id: string; + x: number; + y: number; + width: number; + height: number; + shapes: CanvasShape[]; + anchors?: CanvasAnchor[]; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + locked?: boolean; + decorative?: boolean; + } + | { + type: "connector"; + id: string; + from: CanvasEnd; + to: CanvasEnd; + route: CanvasRoute; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + arrow: CanvasArrow; + label?: string | null; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + decorative?: boolean; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasShape". + */ +export type CanvasShape = + | { + type: "rect"; + x: number; + y: number; + width: number; + height: number; + radius?: number | null; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "ellipse"; + x: number; + y: number; + width: number; + height: number; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "text"; + x: number; + y: number; + text: string; + size?: number | null; + weight?: CanvasWeight | null; + color?: ColorRole | null; + align?: ViewAlign | null; + maxWidth?: number | null; + monospace?: boolean; + } + | { + type: "path"; + d: string; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + } + | { + type: "icon"; + x: number; + y: number; + name: string; + size?: number | null; + color?: ColorRole | null; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ColorRole". + */ +export type ColorRole = + | "surface" + | "surfaceContainer" + | "surfaceContainerHigh" + | "primary" + | "primaryContainer" + | "onPrimary" + | "onPrimaryContainer" + | "secondaryContainer" + | "onSurface" + | "onSurfaceVariant" + | "outline" + | "outlineVariant" + | "info" + | "success" + | "warning" + | "danger" + | "category1" + | "category2" + | "category3" + | "category4" + | "category5" + | "category6"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasWeight". + */ +export type CanvasWeight = "regular" | "medium" | "bold"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasSide". + */ +export type CanvasSide = "top" | "right" | "bottom" | "left"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasDirection". + */ +export type CanvasDirection = "in" | "out" | "both"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasRoute". + */ +export type CanvasRoute = "straight" | "curved" | "orthogonal"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasArrow". + */ +export type CanvasArrow = "none" | "end" | "start" | "both"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasEvent". + */ +export type CanvasEvent = + | { + type: "selected"; + items: string[]; + } + | { + type: "moved"; + items: CanvasPosition[]; + } + | { + type: "connected"; + from: CanvasEnd; + to: CanvasEnd; + } + | { + type: "deleted"; + items: string[]; + } + | { + type: "activated"; + item: string; + } + | { + type: "menu"; + item?: string | null; + choice: string; + x: number; + y: number; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasOp". + */ +export type CanvasOp = + | { + type: "upsert"; + item: CanvasItem; + } + | { + type: "remove"; + ids: string[]; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelScheme". + */ +export type PanelScheme = "light" | "dark"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelHostMessage". + */ +export type PanelHostMessage = + | { + type: "init"; + theme: PanelTheme; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext1; + plugin: PluginId; + node: string; + } + | { + type: "theme"; + theme: PanelTheme; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelMessage". + */ +export type PanelMessage = + | { + type: "ready"; + } + | { + type: "resize"; + height: number; + } + | { + type: "action"; + action: ViewAction; + }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginState". + */ +export type PluginState = "disabled" | "awaitingApproval" | "starting" | "running" | "backoff" | "invalid"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobTrigger". + */ +export type PluginJobTrigger = "schedule" | "manual"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobOutcome". + */ +export type PluginJobOutcome = "succeeded" | "failed"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginLogStream". + */ +export type PluginLogStream = "stdout" | "stderr" | "host"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PluginEvent". + */ +export type PluginEvent = + | { + type: "session.started"; + sessionId: SessionId; + topicId?: string | null; + } + | { + type: "session.idle"; + sessionId: SessionId; + } + | { + type: "session.ended"; + sessionId: SessionId; + } + | { + type: "session.placed"; + sessionId: SessionId; + topicId: string; + by: PlacedBy; + } + | { + type: "summary.written"; + summaryId: string; + sessionId?: SessionId | null; + kind: SummaryKind; + level: number; + } + | { + type: "task.done"; + taskId: string; + status: TaskStatus; + } + | { + type: "settings.changed"; + values: { + [k: string]: ViewValue; + }; + }; + +export interface RivetHubContractAcceptedByTheRuntime { + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPreset". + */ +export interface AgentPreset { + id: string; + name: string; + color: string; + harnessId?: HarnessId | null; + model: string; + effort: string; + systemPrompt: string; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; + createdAt: number; + updatedAt: number; + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentsFile". + */ +export interface AgentsFile { + agents: AgentPreset[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetCreateRequest". + */ +export interface AgentPresetCreateRequest { + name?: string; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetUpdate". + */ +export interface AgentPresetUpdate { + name?: string | null; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentListResponse". + */ +export interface AgentListResponse { + agents: AgentPreset[]; + node: string; + directoryRoot?: string | null; + sharedDir?: string | null; + backend?: AgentStoreBackend | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AgentResponse". + */ +export interface AgentResponse { + agent: AgentPreset; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubProjectDefaults". + */ +export interface HubProjectDefaults { + agentId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + harnessId?: HarnessId | null; + node?: string | null; + directory?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubProject". + */ +export interface HubProject { + id: string; + name: string; + order?: number; + createdAt?: number; + defaults?: HubProjectDefaults | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubLastSession". + */ +export interface HubLastSession { + key: string; + at: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubState". + */ +export interface HubState { + projects?: HubProject[]; + defaultProjectId?: string | null; + membership?: { + [k: string]: string; + }; + names?: { + [k: string]: string; + }; + archived?: string[]; + pinned?: string[]; + hidden?: string[]; + modes?: { + [k: string]: HubSessionMode; + }; + lastSession?: HubLastSession | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubStateResponse". + */ +export interface HubStateResponse { + version: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HubStatePutRequest". + */ +export interface HubStatePutRequest { + baseVersion: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "hub.state". + */ +export interface HubState1 { + v: ProtocolVersion; + version: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDescriptor". + */ +export interface HarnessDescriptor { + installed?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DelegatedSessionLink". + */ +export interface DelegatedSessionLink { + taskId: string; + parentTaskId?: string | null; + spawnedSessionId: SessionId; + parentSessionId: SessionId; + agentName?: string | null; + model?: string | null; + owner?: string | null; + harnessId?: HarnessId | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurnAttachment". + */ +export interface UserTurnAttachment { + mime: string; + pathOrUri: string; + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurn". + */ +export interface UserTurn { + deliveryId?: string | null; + model?: string | null; + effort?: string | null; + text: string; attachments?: UserTurnAttachment[] | null; systemPrompt?: string | null; - bypassDialogGate?: boolean | null; + bypassDialogGate?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SendUserTurnResult". + */ +export interface SendUserTurnResult { + dismissedDialog?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "preset". + */ +export interface Preset { + id: string; + name: string; + node: string; + local: boolean; + harnessId?: HarnessId | null; + model?: string | null; + effort?: string | null; + directory?: string | null; + implemented?: boolean | null; + gap?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogNode". + */ +export interface CatalogNode { + id: string; + node: string; + local: boolean; + provider?: string | null; + model?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogCommand". + */ +export interface CatalogCommand { + name: string; + description: string; + argHint?: string | null; + source: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogExecutorEntry". + */ +export interface CatalogExecutorEntry { + key: string; + capabilities: HarnessExecutorCapabilities; + commands: CatalogCommand[]; + harnessId?: HarnessId | null; + implemented?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessExecutorCapabilities". + */ +export interface HarnessExecutorCapabilities { + steerable: boolean; + multiTurn: boolean; + structuredStream: boolean; + usageInResult: boolean; + sessionIdCapture: boolean; + slashCommands: boolean; + effortSelection: boolean; + mcpInjection: McpInjection; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogSkillEntry". + */ +export interface CatalogSkillEntry { + name: string; + description: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogSheet". + */ +export interface CatalogSheet { + node: string; + agents: CatalogAgent[]; + executors: CatalogExecutorEntry[]; + tools: string[]; + skills: CatalogSkillEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogAgentsResponse". + */ +export interface CatalogAgentsResponse { + agents: CatalogAgent[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomeBucket". + */ +export interface OutcomeBucket { + tasks: number; + completed: number; + failed: number; + verified: number; + refuted: number; + escalated: number; + diverged: number; + divergenceRate: number; + totalCostUsd?: number | null; + avgDurationMs?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomesFilter". + */ +export interface OutcomesFilter { + since?: string | null; + until?: string | null; + agentId?: string | null; + origin?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomesResponse". + */ +export interface OutcomesResponse { + filter: OutcomesFilter; + totals: OutcomeBucket; + byAgent: { + [k: string]: OutcomeBucket; + }; + byExecutor: { + [k: string]: OutcomeBucket; + }; + byDay: { + [k: string]: OutcomeBucket; + }; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverview". + */ +export interface MeshOverview { + updatedAt: number; + nodes: MeshOverviewNode[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverviewNode". + */ +export interface MeshOverviewNode { + id: string; + name: string; + denUrl: string; + online: boolean; + sessions?: number | null; + latest?: MeshLatest | null; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshLatest". + */ +export interface MeshLatest { + activity: Activity; + title: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "NodeCapabilities". + */ +export interface NodeCapabilities { + subsystems: Subsystems; + harnesses: HarnessCapability[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "Subsystems". + */ +export interface Subsystems { + den: boolean; + devices: boolean; + mesh: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessCapability". + */ +export interface HarnessCapability { + harnessId: HarnessId; + list: boolean; + read: boolean; + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessInspectCapability". + */ +export interface HarnessInspectCapability { + list: boolean; + read: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDriveCapability". + */ +export interface HarnessDriveCapability { + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MeshDevice". + */ +export interface MeshDevice { + id: string; + name: string; + publicKey: string; + address: string; + createdAt: number; + enrolledAt?: number | null; + lastHandshake?: number | null; + pgRole?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceListResponse". + */ +export interface DeviceListResponse { + devices: MeshDevice[]; + pending: PendingEnrollment[]; + relayConfigured: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PendingEnrollment". + */ +export interface PendingEnrollment { + id: string; + name: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StoredPending". + */ +export interface StoredPending { + id: string; + name: string; + token: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceRosterFile". + */ +export interface DeviceRosterFile { + v: number; + devices: MeshDevice[]; + pending: StoredPending[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateRequest". + */ +export interface DeviceCreateRequest { + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "rivet-mesh-enroll". + */ +export interface RivetMeshEnroll { + v: number; + gateway: string; + token: string; + config: DeviceEnrollConfig; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollConfig". + */ +export interface DeviceEnrollConfig { + sharedHost: string; + sharedExport: string; + pgUrl: string; + embedUrl: string; + wgEndpoint: string; + wgPeerPublicKey: string; + wgAddress: string; + wgAllowedIps: string; + homeSubnet: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateResponse". + */ +export interface DeviceCreateResponse { + pending: PendingEnrollment; + qr: RivetMeshEnroll; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EnrolledDevice". + */ +export interface EnrolledDevice { + id: string; + name: string; + address: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SignedCertificate". + */ +export interface SignedCertificate { + leaf: string; + chain: string[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollResponse". + */ +export interface DeviceEnrollResponse { + ok: boolean; + device: EnrolledDevice; + config: DeviceEnrollConfig; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemResponse". + */ +export interface PairRedeemResponse { + deviceId: string; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairingRecord". + */ +export interface PairingRecord { + v: number; + deviceId: string; + name: string; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollRequest". + */ +export interface DeviceEnrollRequest { + token?: string | null; + publicKey?: string | null; + name?: string | null; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingCode". + */ +export interface PhonePairingCode { + deviceId: string; + gateway: string; + expiresAt: number; + qrText: string; + reshown: number; + addedToUsers: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingStatus". + */ +export interface PhonePairingStatus { + state: PhonePairingState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingAvailability". + */ +export interface PhonePairingAvailability { + available: boolean; + reason?: string | null; + gateway?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingRequest". + */ +export interface PhonePairingRequest { + name: string; + host?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AudioStatus". + */ +export interface AudioStatus { + enabled: boolean; + backend: AudioBackend; + device: string; + sampleRate: number; + channels: number; + format: AudioFormat; + fifoPath: string; + armed: boolean; + publisherId?: string | null; + armedAt?: number | null; + bytesWritten: number; + runtimeReady: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "AudioHealth". + */ +export interface AudioHealth { + ok: boolean; + runtimeReady: boolean; + fifoPath: string; + message?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceSpeakRequest". + */ +export interface VoiceSpeakRequest { + input: string; + instructions?: string | null; + voice?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceTranscribeResponse". + */ +export interface VoiceTranscribeResponse { + text: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceFileEntry". + */ +export interface DeviceFileEntry { + name: string; + type: FileEntryKind; + size: number; + mtime: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FilesListResponse". + */ +export interface FilesListResponse { + path: string; + root: string; + entries: DeviceFileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StagedUploadResponse". + */ +export interface StagedUploadResponse { + uri: string; + name: string; + mime: string; + size: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileEntry". + */ +export interface FileEntry { + name: string; + type: FileKind; + size: number; + mtime: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileList". + */ +export interface FileList { + path: string; + root: string; + entries: FileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "FileChanged". + */ +export interface FileChanged { + ok: boolean; + path: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchToolArgs". + */ +export interface MemorySearchToolArgs { + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + expand?: boolean | null; + synthesize?: boolean | null; + query: string; + mode?: SearchMode | null; + scope?: MemoryScope | null; + limit?: number | null; + agent?: string | null; + role?: Role | null; + tool_name?: string | null; + tag?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchHit". + */ +export interface MemorySearchHit { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + createdAt: string; + score: number; + role?: Role | null; + agent?: string | null; + kind?: SummaryKind | null; + toolName?: string | null; + conversationId?: string | null; + sessionId?: string | null; + fallback?: MemoryFallback | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryChunkMatch". + */ +export interface MemoryChunkMatch { + index: number; + total: number; + charStart: number; + charEnd: number; + content: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagWire". + */ +export interface TagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryDegraded". + */ +export interface MemoryDegraded { + reason: string; + effect: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchResponse". + */ +export interface MemorySearchResponse { + query: string; + scope: MemoryScope; + degraded?: MemoryDegraded | null; + fallback?: MemoryFallback | null; + results: MemorySearchHit[]; + expanded?: MemoryEntry[]; + synthesis?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryEntry". + */ +export interface MemoryEntry { + id?: string | null; + sessionId: string; + agent: string; + channel: string; + role: Role; + content: string; + toolName?: string | null; + toolArgs?: { + [k: string]: unknown; + } | null; + toolResult?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseToolArgs". + */ +export interface MemoryBrowseToolArgs { + conversation_id?: string | null; + include_tools?: boolean | null; + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + agent?: string | null; + tag?: string | null; + limit?: number | null; + order?: MemoryBrowseOrder | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryAppendToolArgs". + */ +export interface MemoryAppendToolArgs { + session_id: string; + content: string; + role: Role; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + event_id?: string | null; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestMessage". + */ +export interface MemoryIngestMessage { + role: Role; + content: string; + created_at?: string | null; + tool_calls?: MemoryIngestToolCall[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestToolCall". + */ +export interface MemoryIngestToolCall { + id?: string | null; + name: string; + input?: { + [k: string]: unknown; + } | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestSessionToolArgs". + */ +export interface MemoryIngestSessionToolArgs { + session_id: string; + messages: MemoryIngestMessage[]; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryGetFullToolArgs". + */ +export interface MemoryGetFullToolArgs { + id?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsToolArgs". + */ +export interface MemoryTagsToolArgs { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + key?: string | null; + value?: string | null; + tag?: string | null; + display?: string | null; + state?: TagState | null; + ids?: string[] | null; + session_keys?: string[] | null; + entries?: TagEntryPair[] | null; + parent_value?: string | null; + aliases?: string[] | null; + from?: string | null; + into?: string | null; + reason?: string | null; + decided_by?: string | null; + limit?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagEntryPair". + */ +export interface TagEntryPair { + key: string; + value: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryToolResponse". + */ +export interface MemoryToolResponse { + ok: boolean; + result: ToolResult; +} +export interface MediaFields { + type: "image"; +} +export interface MediaFields1 { + type: "video"; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MediaFields". + */ +export interface MediaFields2 { + data?: string | null; + url?: string | null; + mimeType?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseMessage". + */ +export interface MemoryBrowseMessage { + id: string; + role: Role; + agent?: string | null; + content: string; + createdAt: string; + conversationId?: string | null; + sessionId?: string | null; + toolName?: string | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseResponse". + */ +export interface MemoryBrowseResponse { + messages: MemoryBrowseMessage[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryNode". + */ +export interface MemorySummaryNode { + id: string; + parentId?: string | null; + level: number; + kind: SummaryKind; + content: string; + messageCount: number; + earliestAt?: string | null; + latestAt?: string | null; + createdAt: string; + sourceMessageIds: string[]; + vector: VectorState; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryMessageTally". + */ +export interface MemoryMessageTally { + total: number; + user: number; + assistant: number; + system: number; + tool: number; + embedded: number; + pending: number; + failed: number; + skipped: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryDagResponse". + */ +export interface MemorySummaryDagResponse { + sessionId: string; + summaries: MemorySummaryNode[]; + messages: MemoryMessageTally; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopTool". + */ +export interface TopTool { + tool: string; + count: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "RecentSession". + */ +export interface RecentSession { + sessionId: string; + title?: string | null; + agent: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryStatsResponse". + */ +export interface MemoryStatsResponse { + conversations: number; + messages: number; + toolCalls: number; + summaries: number; + embedQueueDepth: number; + embeddedMessages: number; + failedEmbeddings: number; + topTools: TopTool[]; + recentSessions: RecentSession[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EmbedHealth". + */ +export interface EmbedHealth { + status: EmbedStatus; + error?: string | null; + impact?: string | null; + checkedAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryHealthResponse". + */ +export interface MemoryHealthResponse { + observedAt?: string | null; + queueStatus?: QueueStatus | null; + queues?: QueueHealth | null; + compaction?: SummarizerHealth | null; + failedEmbeddings?: number | null; + skippedEmbeddings?: number | null; + capture?: CaptureHealth | null; + status: MemoryHealthStatus; + embeddings: EmbedHealth; + embedQueueDepth: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "QueueHealth". + */ +export interface QueueHealth { + task: string; + pending: number; + running: number; + scheduled: number; + dead: number; + oldestPendingMinutes?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SummarizerHealth". + */ +export interface SummarizerHealth { + eligible: boolean; + activeTail: boolean; + belowFloor: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CaptureHealth". + */ +export interface CaptureHealth { + status: CaptureStatus; + impact: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagWire". + */ +export interface PendingTagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; + action?: PendingTagAction | null; + sessionKey?: string | null; + title?: string | null; + agent?: string | null; + conversationId?: string | null; + excerpt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsDecideRequest". + */ +export interface MemoryTagsDecideRequest { + ids?: string[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsAddRequest". + */ +export interface MemoryTagsAddRequest { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + tag?: string | null; + key?: string | null; + value?: string | null; + display?: string | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsLookupRequest". + */ +export interface MemoryTagsLookupRequest { + session_keys?: string[] | null; + states?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyEntry". + */ +export interface TagTaxonomyEntry { + key: string; + value: string; + display: string; + parentValue?: string | null; + aliases: string[]; + state: TagState; + source: string; + reason: string; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyWire". + */ +export interface TagTaxonomyWire { + key: string; + entries: TagTaxonomyEntry[]; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertRequest". + */ +export interface TagTaxonomyUpsertRequest { + key?: string | null; + value?: string | null; + display?: string | null; + parent_value?: string | null; + aliases?: string[] | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyDecideRequest". + */ +export interface TagTaxonomyDecideRequest { + entries?: TagEntryPair[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMerge". + */ +export interface TagTaxonomyMerge { + key: string; + from: string; + into: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMergeRequest". + */ +export interface TagTaxonomyMergeRequest { + key?: string | null; + from?: string | null; + into?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMergeResult". + */ +export interface TagTaxonomyMergeResult { + moved: number; + dropped: number; + into: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagCount". + */ +export interface TagCount { + key: string; + value: string; + display: string; + conversations: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagListResult". + */ +export interface TagListResult { + tags: TagWire[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagListResult". + */ +export interface PendingTagListResult { + tags: PendingTagWire[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagCountsResult". + */ +export interface TagCountsResult { + counts: TagCount[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyListResult". + */ +export interface TagTaxonomyListResult { + entries: TagTaxonomyEntry[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagDecisionResult". + */ +export interface TagDecisionResult { + changed: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagAddResult". + */ +export interface TagAddResult { + tag: TagWire; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagLookupResult". + */ +export interface TagLookupResult { + sessions: { + [k: string]: TagWire[]; + }; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertResult". + */ +export interface TagTaxonomyUpsertResult { + entry: TagTaxonomyEntry; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ProjectRuleResult". + */ +export interface ProjectRuleResult { + key: string; + rule: ProjectRule; + gitRoot?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "HealthzResponse". + */ +export interface HealthzResponse { + ok: boolean; + sessions: number; + name: string; + node: string; + degraded?: string | null; + degradedProviders?: DegradedProvider[]; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "DegradedProvider". + */ +export interface DegradedProvider { + id: string; + recovery: ProviderRecovery; + reason: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "GatewayError". + */ +export interface GatewayError { + error: string; + detail?: string | null; + hint?: string | null; + code?: string | null; + harnessId?: HarnessId | null; + node?: string | null; + retryable?: boolean | null; + reason?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "OkReply". + */ +export interface OkReply { + ok: boolean; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "EventsIngested". + */ +export interface EventsIngested { + ok: boolean; + ingested: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemRequest". + */ +export interface PairRedeemRequest { + token: string; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "RosterFile". + */ +export interface RosterFile { + default: string; + cwd?: string | null; + env?: { + [k: string]: string; + }; + commands: { + [k: string]: RosterEntry; + }; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "RosterEntry". + */ +export interface RosterEntry { + label: string; + cmd: string[]; + room?: boolean | null; + cwd?: string | null; + env?: { + [k: string]: string; + }; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptTurn". + */ +export interface TranscriptTurn { + role: Role; + text: string; + ts?: number | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptResponse". + */ +export interface TranscriptResponse { + id: string; + command: string; + turns: TranscriptTurn[]; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSummary". + */ +export interface SessionSummary { + id: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionList". + */ +export interface SessionList { + sessions: SessionSummary[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MessageList". + */ +export interface MessageList { + messages: SessionMessage[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionMessage". + */ +export interface SessionMessage { + id: string; + sessionId: string; + role: SessionMessageRole; + text: string; + ts: number; + usage?: MessageUsage | null; + model?: string | null; + durationMs?: number | null; + thinking?: boolean | null; + tools?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "MessageUsage". + */ +export interface MessageUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostRequest". + */ +export interface SessionPostRequest { + excludeTools?: string[] | null; + text: string; + userId?: string | null; + agent?: string | null; + thinking?: ThinkingLevel | null; + systemPrompt?: string | null; + attachments?: UserTurnAttachment[] | null; + harness?: HarnessId | null; + model?: string | null; + workingDir?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostAccepted". + */ +export interface SessionPostAccepted { + accepted: boolean; + session: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostReply". + */ +export interface SessionPostReply { + message: SessionMessage; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSteerRequest". + */ +export interface SessionSteerRequest { + text: string; + attachments?: UserTurnAttachment[] | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSteerResponse". + */ +export interface SessionSteerResponse { + outcome: SteerOutcome; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionWsClientMessage". + */ +export interface SessionWsClientMessage { + type: SessionClientKind; + session: string; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "StreamEvent". + */ +export interface StreamEvent { + type: StreamEventKind; + content: string; + metadata?: { + [k: string]: unknown; + } | null; +} +export interface TranscriptWsFrame { + kind: "transcript"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SendUserTurnResult". + * via the `definition` "HarnessTranscriptTurn". */ -export interface SendUserTurnResult { - dismissedDialog?: boolean | null; +export interface HarnessTranscriptTurn { + role: SessionMessageRole; + text: string; + thinking?: string | null; + tools?: HarnessTranscriptTool[] | null; + usage?: MessageUsage | null; + model?: string | null; + stopReason?: string | null; + lastBlock?: TranscriptBlock | null; + attachments?: TranscriptAttachment[] | null; + complete?: boolean; + compact?: boolean; + startedAtMs?: number | null; + endedAtMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "preset". + * via the `definition` "HarnessTranscriptTool". */ -export interface Preset { - id: string; +export interface HarnessTranscriptTool { name: string; - node: string; - local: boolean; - harnessId?: HarnessId | null; - model?: string | null; - directory?: string | null; - implemented?: boolean | null; - gap?: string | null; + status: TranscriptToolStatus; + args?: { + [k: string]: unknown; + } | null; + id?: string | null; + input?: { + [k: string]: unknown; + } | null; + resultText?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogNode". + * via the `definition` "TranscriptAttachment". */ -export interface CatalogNode { - id: string; - node: string; - local: boolean; - provider?: string | null; - model?: string | null; +export interface TranscriptAttachment { + mediaType: string; + name?: string | null; + uri?: string | null; + uploadId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". + * via the `definition` "TranscriptWsFrame". */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; +export interface TranscriptWsFrame1 { + session: string; + rev: number; + from: number; + turns: HarnessTranscriptTurn[]; + total: number; + command: string; + truncatedBefore?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". + * via the `definition` "HarnessSessionTranscriptResponse". */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; +export interface HarnessSessionTranscriptResponse { + sessionId: SessionId; + harnessId: HarnessId; + turns: HarnessTranscriptTurn[]; + contextWindow: number; + compactAt: number; + contextSource: ContextSource; + redirectedTo?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". + * via the `definition` "SessionPreview". */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; +export interface SessionPreview { + sessionId: SessionId; + kind: SessionPreviewKind; + text: string; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". + * via the `definition` "SessionPreviewList". */ -export interface CatalogSkillEntry { - name: string; - description: string; +export interface SessionPreviewList { + previews: SessionPreview[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". + * via the `definition` "HarnessTurnAccepted". */ -export interface CatalogSheet { - node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; +export interface HarnessTurnAccepted { + ok: boolean; + sessionId: SessionId; + redirectedTo?: SessionId | null; + dismissedDialog?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogAgentsResponse". + * via the `definition` "HarnessSessionResponse". */ -export interface CatalogAgentsResponse { - agents: CatalogAgent[]; +export interface HarnessSessionResponse { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + redirectedTo?: SessionId | null; + switches?: SessionSwitches | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". + * via the `definition` "StartupContext". */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; +export interface StartupContext { + topicId: string; + sections: StartupSection[]; + tokens: number; + deliveredVia: DeliveredVia; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". + * via the `definition` "StartupSection". */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; +export interface StartupSection { + kind: StartupKind; + title: string; + text: string; + sources: StartupSource[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". + * via the `definition` "SessionSwitches". */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; - }; - byExecutor: { - [k: string]: OutcomeBucket; - }; - byDay: { - [k: string]: OutcomeBucket; - }; +export interface SessionSwitches { + model: boolean; + effort: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverview". + * via the `definition` "HarnessSessionTitleRequest". */ -export interface MeshOverview { - updatedAt: number; - nodes: MeshOverviewNode[]; +export interface HarnessSessionTitleRequest { + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverviewNode". + * via the `definition` "HarnessSessionForkRequest". */ -export interface MeshOverviewNode { - id: string; - name: string; - denUrl: string; - online: boolean; - sessions?: number | null; - latest?: MeshLatest | null; +export interface HarnessSessionForkRequest { + prompts: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshLatest". + * via the `definition` "HarnessToolOutput". */ -export interface MeshLatest { - activity: Activity; - title: string; +export interface HarnessToolOutput { + text: string; + isError: boolean; + truncated: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "NodeCapabilities". + * via the `definition` "TermSpawnRequest". */ -export interface NodeCapabilities { - subsystems: Subsystems; - harnesses: HarnessCapability[]; +export interface TermSpawnRequest { + command?: string | null; + model?: string | null; + effort?: string | null; + session?: string | null; + resume?: string | null; + agentId?: string | null; + force?: boolean | null; + cols?: number | null; + rows?: number | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Subsystems". + * via the `definition` "TermAttachInfo". */ -export interface Subsystems { - den: boolean; - devices: boolean; - mesh: boolean; +export interface TermAttachInfo { + socket: string; + session: string; + host: string; + sshUser: string; + local: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapability". + * via the `definition` "TermSpawnResponse". */ -export interface HarnessCapability { - harnessId: HarnessId; - list: boolean; - read: boolean; - drive: boolean; - resume: boolean; +export interface TermSpawnResponse { + harnessSessionId?: SessionId | null; + id: string; + denSession: string; + command: string; + cwd?: string | null; + pid: number; + createdAt: number; + mux?: Mux | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessInspectCapability". + * via the `definition` "PtyInfo". */ -export interface HarnessInspectCapability { - list: boolean; - read: boolean; +export interface PtyInfo { + id: string; + denSession: string; + command: string; + state: PtyState; + pid?: number | null; + attached: number; + exitCode?: number | null; + createdAt: number; + lastOutputTs?: number | null; + cols?: number | null; + rows?: number | null; + mux?: Mux | null; + persisted?: boolean | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDriveCapability". + * via the `definition` "PtyList". */ -export interface HarnessDriveCapability { - drive: boolean; - resume: boolean; +export interface PtyList { + ptys: PtyInfo[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MeshDevice". + * via the `definition` "TermCommand". */ -export interface MeshDevice { +export interface TermCommand { id: string; - name: string; - publicKey: string; - address: string; - createdAt: number; - enrolledAt?: number | null; - lastHandshake?: number | null; - pgRole?: string | null; + label: string; + room: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceListResponse". + * via the `definition` "TermConfig". */ -export interface DeviceListResponse { - devices: MeshDevice[]; - pending: PendingEnrollment[]; - relayConfigured: boolean; +export interface TermConfig { + enabled: boolean; + default: string; + maxPtys: number; + active: number; + commands: TermCommand[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingEnrollment". + * via the `definition` "TermInjectRequest". */ -export interface PendingEnrollment { - id: string; - name: string; - address: string; - createdAt: number; - expiresAt: number; +export interface TermInjectRequest { + session: string; + text: string; + submit?: boolean | null; + interrupt?: boolean | null; + bypassDialogGate?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StoredPending". + * via the `definition` "TermInjectResponse". */ -export interface StoredPending { - id: string; - name: string; - token: string; - address: string; - createdAt: number; - expiresAt: number; +export interface TermInjectResponse { + ok: boolean; + ptyId: string; + dismissedDialog?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceRosterFile". + * via the `definition` "DeviceOwner". */ -export interface DeviceRosterFile { - v: number; - devices: MeshDevice[]; - pending: StoredPending[]; +export interface DeviceOwner { + device?: string | null; + self: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateRequest". + * via the `definition` "UploadCreated". */ -export interface DeviceCreateRequest { - name?: string | null; +export interface UploadCreated { + id: string; + uri: string; + name: string; + bytes: number; + mediaType: string; + expiresAt: string; + session?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "rivet-mesh-enroll". + * via the `definition` "UploadList". */ -export interface RivetMeshEnroll { - v: number; - gateway: string; - token: string; - config: DeviceEnrollConfig; +export interface UploadList { + uploads: UploadCreated[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollConfig". + * via the `definition` "UsersRegistry". */ -export interface DeviceEnrollConfig { - sharedHost: string; - sharedExport: string; - pgUrl: string; - embedUrl: string; - wgEndpoint: string; - wgPeerPublicKey: string; - wgAddress: string; - wgAllowedIps: string; - homeSubnet: string; +export interface UsersRegistry { + ownerUserId: string; + unmappedIsOwner: boolean; + localStores?: boolean | null; + users: { + [k: string]: UserRecord; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateResponse". + * via the `definition` "UserRecord". */ -export interface DeviceCreateResponse { - pending: PendingEnrollment; - qr: RivetMeshEnroll; +export interface UserRecord { + id?: string | null; + devices?: string[] | null; + pgUrl?: string | null; + envFile?: string | null; + persona?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EnrolledDevice". + * via the `definition` "ChatRequest". */ -export interface EnrolledDevice { - id: string; - name: string; - address: string; +export interface ChatRequest { + model: string; + messages: OpenAiMessage[]; + stream?: boolean | null; + max_tokens?: number | null; + stream_options?: StreamOptions | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SignedCertificate". + * via the `definition` "OpenAiMessage". */ -export interface SignedCertificate { - leaf: string; - chain: string[]; +export interface OpenAiMessage { + role: Role; + content?: string | null; + reasoning_content?: string | null; + tool_calls?: MessageToolCall[] | null; + tool_call_id?: string | null; +} +export interface StreamedPlainToolCall { + type: "function"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollResponse". + * via the `definition` "StreamOptions". */ -export interface DeviceEnrollResponse { - ok: boolean; - device: EnrolledDevice; - config: DeviceEnrollConfig; - certificate: SignedCertificate; +export interface StreamOptions { + include_usage: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemResponse". + * via the `definition` "FunctionDelta". */ -export interface PairRedeemResponse { - deviceId: string; - certificate: SignedCertificate; +export interface FunctionDelta { + name?: string | null; + arguments?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairingRecord". + * via the `definition` "StreamedPlainToolCall". */ -export interface PairingRecord { - v: number; - deviceId: string; - name: string; - expiresAt: number; +export interface StreamedPlainToolCall1 { + index?: number | null; + id?: string | null; + function: FunctionDelta; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollRequest". + * via the `definition` "chat.completion". */ -export interface DeviceEnrollRequest { - token?: string | null; - publicKey?: string | null; - name?: string | null; - csr?: string | null; +export interface ChatCompletion { + id: string; + created: number; + model: string; + choices: CompletionChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingCode". + * via the `definition` "CompletionChoice". */ -export interface PhonePairingCode { - deviceId: string; - gateway: string; - expiresAt: number; - qrText: string; - reshown: number; - addedToUsers: boolean; +export interface CompletionChoice { + index: number; + message: OpenAiMessage; + finish_reason: FinishReason; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingStatus". + * via the `definition` "Usage". */ -export interface PhonePairingStatus { - state: PhonePairingState; +export interface Usage { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; + prompt_tokens_details?: PromptTokensDetails | null; + completion_tokens_details?: CompletionTokensDetails | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingAvailability". + * via the `definition` "PromptTokensDetails". */ -export interface PhonePairingAvailability { - available: boolean; - reason?: string | null; - gateway?: string | null; +export interface PromptTokensDetails { + cached_tokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingRequest". + * via the `definition` "CompletionTokensDetails". */ -export interface PhonePairingRequest { - name: string; - host?: string | null; +export interface CompletionTokensDetails { + reasoning_tokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AudioStatus". + * via the `definition` "chat.completion.chunk". */ -export interface AudioStatus { - enabled: boolean; - backend: AudioBackend; - device: string; - sampleRate: number; - channels: number; - format: AudioFormat; - fifoPath: string; - armed: boolean; - publisherId?: string | null; - armedAt?: number | null; - bytesWritten: number; - runtimeReady: boolean; +export interface ChatCompletionChunk { + id: string; + created: number; + model: string; + choices: ChunkChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AudioHealth". + * via the `definition` "ChunkChoice". */ -export interface AudioHealth { - ok: boolean; - runtimeReady: boolean; - fifoPath: string; - message?: string | null; +export interface ChunkChoice { + index: number; + delta: CompletionDelta; + finish_reason?: FinishReason | null; } /** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceSpeakRequest". - */ -export interface VoiceSpeakRequest { - input: string; - instructions?: string | null; - voice?: string | null; + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CompletionDelta". + */ +export interface CompletionDelta { + role?: Role | null; + content?: string | null; + reasoning_content?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceTranscribeResponse". + * via the `definition` "list". */ -export interface VoiceTranscribeResponse { - text: string; +export interface List { + data: Model[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceFileEntry". + * via the `definition` "model". */ -export interface DeviceFileEntry { - name: string; - type: FileEntryKind; - size: number; - mtime: string; +export interface Model { + id: string; + created: number; + owned_by: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FilesListResponse". + * via the `definition` "ErrorDetail". */ -export interface FilesListResponse { - path: string; - root: string; - entries: DeviceFileEntry[]; +export interface ErrorDetail { + message: string; + type: ErrorKind; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StagedUploadResponse". + * via the `definition` "ErrorResponse". */ -export interface StagedUploadResponse { - uri: string; - name: string; - mime: string; - size: number; - expiresAt: number; +export interface ErrorResponse { + error: ErrorDetail; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileEntry". + * via the `definition` "Conversation". */ -export interface FileEntry { - name: string; - type: FileKind; - size: number; - mtime: number; +export interface Conversation { + id: string; + title: string; + createdAt: number; + updatedAt: number; + messages: OpenAiMessage[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileList". + * via the `definition` "Conversations". */ -export interface FileList { - path: string; - root: string; - entries: FileEntry[]; +export interface Conversations { + conversations: Conversation[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FileChanged". + * via the `definition` "ConversationTitle". */ -export interface FileChanged { - ok: boolean; - path: string; +export interface ConversationTitle { + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchToolArgs". + * via the `definition` "WikiQuery". */ -export interface MemorySearchToolArgs { - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - expand?: boolean | null; - synthesize?: boolean | null; - query: string; - mode?: SearchMode | null; - scope?: MemoryScope | null; - limit?: number | null; - agent?: string | null; +export interface WikiQuery { + q?: string | null; tag?: string | null; + limit?: number | null; + offset?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchHit". + * via the `definition` "WikiPageQuery". */ -export interface MemorySearchHit { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - createdAt: string; - score: number; - role?: Role | null; - agent?: string | null; - kind?: SummaryKind | null; - toolName?: string | null; - conversationId?: string | null; - sessionId?: string | null; - fallback?: MemoryFallback | null; - tags?: TagWire[] | null; +export interface WikiPageQuery { + slug: WikiSlug; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryChunkMatch". + * via the `definition` "WikiHistoryEntry". */ -export interface MemoryChunkMatch { - index: number; - total: number; - charStart: number; - charEnd: number; - content: string; +export interface WikiHistoryEntry { + date: string; + title: string; + body: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagWire". + * via the `definition` "WikiCitation". */ -export interface TagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiCitation { + summaryId: string; + date?: Millis | null; + kind?: string | null; + note?: string | null; + conversationId?: string | null; + sessionId?: SessionId | null; + title?: string | null; + channel?: string | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryDegraded". + * via the `definition` "WikiSource". */ -export interface MemoryDegraded { - reason: string; - effect: string; +export interface WikiSource { + kind: WikiSourceKind; + ids: string[]; + conversationId?: string | null; + span?: WikiSourceSpan | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResponse". + * via the `definition` "WikiSourceSpan". */ -export interface MemorySearchResponse { - query: string; - scope: MemoryScope; - degraded?: MemoryDegraded | null; - fallback?: MemoryFallback | null; - results: MemorySearchHit[]; - expanded?: MemoryEntry[]; - synthesis?: string | null; +export interface WikiSourceSpan { + earliest: Millis; + latest: Millis; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryEntry". + * via the `definition` "WikiPageResponse". */ -export interface MemoryEntry { - id?: string | null; - sessionId: string; - agent: string; - channel: string; - role: Role; - content: string; - toolName?: string | null; - toolArgs?: { - [k: string]: unknown; - } | null; - toolResult?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - createdAt?: string | null; +export interface WikiPageResponse { + slug: string; + title: string; + aliases: string[]; + tags: string[]; + entities: string[]; + currentState: string; + article?: string | null; + seeAlso?: string[] | null; + history: WikiHistoryEntry[]; + citations: WikiCitation[]; + markdown: string; + sources: WikiSource[]; + gitSha?: string | null; + lastVerified?: Millis | null; + updatedAt: Millis; + related?: string[] | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseToolArgs". + * via the `definition` "WikiMissSuggestion". */ -export interface MemoryBrowseToolArgs { - conversation_id?: string | null; - include_tools?: boolean | null; - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - agent?: string | null; - tag?: string | null; - limit?: number | null; - order?: MemoryBrowseOrder | null; +export interface WikiMissSuggestion { + slug: string; + title: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryAppendToolArgs". + * via the `definition` "WikiMissBody". */ -export interface MemoryAppendToolArgs { - session_id: string; - content: string; - role: Role; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - event_id?: string | null; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface WikiMissBody { + error: string; + suggestions: WikiMissSuggestion[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestMessage". + * via the `definition` "WikiRedLink". */ -export interface MemoryIngestMessage { - role: Role; - content: string; - created_at?: string | null; - tool_calls?: MemoryIngestToolCall[] | null; +export interface WikiRedLink { + entity: string; + referencedBy: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestToolCall". - */ -export interface MemoryIngestToolCall { - id?: string | null; - name: string; - input?: { - [k: string]: unknown; - } | null; + * via the `definition` "WikiGapsResponse". + */ +export interface WikiGapsResponse { + redLinks: WikiRedLink[]; + stalest: WikiTopic[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestSessionToolArgs". + * via the `definition` "WikiTopic". */ -export interface MemoryIngestSessionToolArgs { - session_id: string; - messages: MemoryIngestMessage[]; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface WikiTopic { + slug: string; + title: string; + tags: string[]; + entities: string[]; + updatedAt: Millis; + excerpt: string; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryGetFullToolArgs". + * via the `definition` "WikiTopicList". */ -export interface MemoryGetFullToolArgs { - id?: string | null; +export interface WikiTopicList { + topics: WikiTopic[]; + total: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsToolArgs". + * via the `definition` "TidySample". */ -export interface MemoryTagsToolArgs { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - key?: string | null; - value?: string | null; - tag?: string | null; - display?: string | null; - state?: TagState | null; - ids?: string[] | null; - session_keys?: string[] | null; - entries?: TagEntryPair[] | null; - parent_value?: string | null; - aliases?: string[] | null; - from?: string | null; - into?: string | null; - reason?: string | null; - decided_by?: string | null; - limit?: number | null; +export interface TidySample { + id: string; + title?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagEntryPair". + * via the `definition` "TidyEvidence". */ -export interface TagEntryPair { - key: string; - value: string; +export interface TidyEvidence { + sessions: number; + samples?: TidySample[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryToolResponse". + * via the `definition` "TidyProposal". */ -export interface MemoryToolResponse { - ok: boolean; - result: ToolResult; -} -export interface MediaFields { - type: "image"; -} -export interface MediaFields1 { - type: "video"; +export interface TidyProposal { + id: string; + batchId: string; + change: TidyChange; + reason: string; + evidence: TidyEvidence; + proposedBy: Proposer; + proposedAt: number; + state: ProposalState; + decidedAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MediaFields". + * via the `definition` "TidyBatch". */ -export interface MediaFields2 { - data?: string | null; - url?: string | null; - mimeType?: string | null; +export interface TidyBatch { + batchId: string; + proposedBy: Proposer; + proposedAt: number; + proposals: TidyProposal[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseMessage". + * via the `definition` "TidyPending". */ -export interface MemoryBrowseMessage { - id: string; - role: Role; - agent?: string | null; - content: string; - createdAt: string; - conversationId?: string | null; - sessionId?: string | null; - toolName?: string | null; - tags?: TagWire[] | null; +export interface TidyPending { + batches: TidyBatch[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseResponse". + * via the `definition` "TidyFailure". */ -export interface MemoryBrowseResponse { - messages: MemoryBrowseMessage[]; +export interface TidyFailure { + proposalId: string; + error: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TopTool". + * via the `definition` "TidyBatchDecision". */ -export interface TopTool { - tool: string; - count: number; +export interface TidyBatchDecision { + decided: TidyProposal[]; + failed?: TidyFailure[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RecentSession". + * via the `definition` "FilingUpkeep". */ -export interface RecentSession { - sessionId: string; - title?: string | null; - agent: string; - lastActive: number; - messages: number; +export interface FilingUpkeep { + categorizer: number; + you: number; + uncategorized: number; + leftOut: number; + correctionsLastWeek: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryStatsResponse". + * via the `definition` "EntityTypeCount". */ -export interface MemoryStatsResponse { - conversations: number; - messages: number; - toolCalls: number; - summaries: number; - embedQueueDepth: number; - embeddedMessages: number; - failedEmbeddings: number; - topTools: TopTool[]; - recentSessions: RecentSession[]; +export interface EntityTypeCount { + typeId: string; + name: string; + entities: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EmbedHealth". + * via the `definition` "WikiUpkeep". */ -export interface EmbedHealth { - status: EmbedStatus; - error?: string | null; - impact?: string | null; - checkedAt?: string | null; +export interface WikiUpkeep { + topicPages: number; + entityTypes: EntityTypeCount[]; + loosePages: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHealthResponse". + * via the `definition` "WorkerActivity". */ -export interface MemoryHealthResponse { - observedAt?: string | null; - queueStatus?: QueueStatus | null; - queues?: QueueHealth | null; - compaction?: SummarizerHealth | null; - failedEmbeddings?: number | null; - skippedEmbeddings?: number | null; - capture?: CaptureHealth | null; - status: MemoryHealthStatus; - embeddings: EmbedHealth; - embedQueueDepth: number; +export interface WorkerActivity { + lastFinishedAt?: number | null; + failing: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "QueueHealth". + * via the `definition` "WorkerUpkeep". */ -export interface QueueHealth { - task: string; - pending: number; - running: number; - scheduled: number; - dead: number; - oldestPendingMinutes?: number | null; +export interface WorkerUpkeep { + embedder: WorkerActivity; + summarizer: WorkerActivity; + categorizer: WorkerActivity; + wikiBuilder: WorkerActivity; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SummarizerHealth". + * via the `definition` "MemoryUpkeep". */ -export interface SummarizerHealth { - eligible: boolean; - activeTail: boolean; - belowFloor: boolean; +export interface MemoryUpkeep { + filing: FilingUpkeep; + wiki: WikiUpkeep; + workers: WorkerUpkeep; + pendingProposals: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureHealth". + * via the `definition` "TopicRecord". */ -export interface CaptureHealth { - status: CaptureStatus; - impact: string; +export interface TopicRecord { + id: string; + kind?: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagWire". + * via the `definition` "TopicSummary". */ -export interface PendingTagWire { +export interface TopicSummary { id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; - action?: PendingTagAction | null; - sessionKey?: string | null; - title?: string | null; - agent?: string | null; - conversationId?: string | null; - excerpt?: string | null; + kind?: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; + sessionCount: number; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsDecideRequest". + * via the `definition` "TopicList". */ -export interface MemoryTagsDecideRequest { - ids?: string[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface TopicList { + topics: TopicSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsAddRequest". + * via the `definition` "TopicCreateRequest". */ -export interface MemoryTagsAddRequest { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - tag?: string | null; - key?: string | null; - value?: string | null; - display?: string | null; - reason?: string | null; - decided_by?: string | null; +export interface TopicCreateRequest { + kind?: "work" | "type" | "entity"; + name: string; + aliases?: string[]; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsLookupRequest". + * via the `definition` "WikiPageEdit". */ -export interface MemoryTagsLookupRequest { - session_keys?: string[] | null; - states?: string[] | null; +export interface WikiPageEdit { + currentState?: string | null; + article?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyEntry". + * via the `definition` "TopicUpdate". */ -export interface TagTaxonomyEntry { - key: string; - value: string; - display: string; - parentValue?: string | null; - aliases: string[]; - state: TagState; - source: string; - reason: string; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface TopicUpdate { + name?: string | null; + aliases?: string[] | null; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyWire". + * via the `definition` "TopicMergeRequest". */ -export interface TagTaxonomyWire { - key: string; - entries: TagTaxonomyEntry[]; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface TopicMergeRequest { + into: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertRequest". + * via the `definition` "TopicPlacement". */ -export interface TagTaxonomyUpsertRequest { - key?: string | null; - value?: string | null; - display?: string | null; - parent_value?: string | null; - aliases?: string[] | null; - reason?: string | null; - decided_by?: string | null; +export interface TopicPlacement { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyDecideRequest". + * via the `definition` "TopicSuggestion". */ -export interface TagTaxonomyDecideRequest { - entries?: TagEntryPair[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface TopicSuggestion { + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMerge". + * via the `definition` "PlacementReply". */ -export interface TagTaxonomyMerge { - key: string; - from: string; - into: string; +export interface PlacementReply { + placement?: TopicPlacement | null; + suggestion?: TopicSuggestion | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeRequest". + * via the `definition` "PlacementRequest". */ -export interface TagTaxonomyMergeRequest { - key?: string | null; - from?: string | null; - into?: string | null; +export interface PlacementRequest { + topicId: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeResult". + * via the `definition` "SessionHistoryMark". + */ +export interface SessionHistoryMark { + sessionId: SessionId; + markedAt: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionHistoryList". */ -export interface TagTaxonomyMergeResult { - moved: number; - dropped: number; - into: string; +export interface SessionHistoryList { + sessions: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagCount". + * via the `definition` "TopicSession". */ -export interface TagCount { - key: string; - value: string; - display: string; - conversations: number; +export interface TopicSession { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagListResult". + * via the `definition` "TopicSessionList". */ -export interface TagListResult { - tags: TagWire[]; +export interface TopicSessionList { + sessions: TopicSession[]; + conversations?: TopicConversation[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagListResult". + * via the `definition` "TopicConversation". */ -export interface PendingTagListResult { - tags: PendingTagWire[]; +export interface TopicConversation { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; + channel: string; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagCountsResult". + * via the `definition` "ConversationPlacement". */ -export interface TagCountsResult { - counts: TagCount[]; +export interface ConversationPlacement { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyListResult". + * via the `definition` "ConversationPlacementReply". */ -export interface TagTaxonomyListResult { - entries: TagTaxonomyEntry[]; +export interface ConversationPlacementReply { + placement?: ConversationPlacement | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagDecisionResult". + * via the `definition` "TopicPage". */ -export interface TagDecisionResult { - changed: number; +export interface TopicPage { + topic: TopicRecord; + page?: WikiPageResponse | null; + mentions?: TopicMention[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagAddResult". + * via the `definition` "TopicMention". */ -export interface TagAddResult { - tag: TagWire; +export interface TopicMention { + topicId: string; + name: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagLookupResult". + * via the `definition` "TopicDecision". */ -export interface TagLookupResult { - sessions: { - [k: string]: TagWire[]; - }; +export interface TopicDecision { + id: string; + topicId: string; + text: string; + status: DecisionStatus; + supersededBy?: string | null; + by: string; + sessionId?: SessionId | null; + createdAt: number; + updatedAt: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertResult". + * via the `definition` "TopicDecisionList". */ -export interface TagTaxonomyUpsertResult { - entry: TagTaxonomyEntry; +export interface TopicDecisionList { + decisions: TopicDecision[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ProjectRuleResult". + * via the `definition` "DecisionCreateRequest". */ -export interface ProjectRuleResult { - key: string; - rule: ProjectRule; - gitRoot?: string | null; +export interface DecisionCreateRequest { + text: string; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HealthzResponse". + * via the `definition` "DecisionUpdate". */ -export interface HealthzResponse { - ok: boolean; - sessions: number; - name: string; - node: string; - degraded?: string | null; - degradedProviders?: DegradedProvider[]; +export interface DecisionUpdate { + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DegradedProvider". + * via the `definition` "DecisionSupersedeRequest". */ -export interface DegradedProvider { - id: string; - recovery: ProviderRecovery; - reason: string; +export interface DecisionSupersedeRequest { + text?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "GatewayError". + * via the `definition` "DecisionSuperseded". */ -export interface GatewayError { - error: string; - detail?: string | null; - hint?: string | null; - code?: string | null; - harnessId?: HarnessId | null; - node?: string | null; - retryable?: boolean | null; - reason?: string | null; +export interface DecisionSuperseded { + superseded: TopicDecision; + replacement?: TopicDecision | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OkReply". + * via the `definition` "AgentUsage". */ -export interface OkReply { - ok: boolean; +export interface AgentUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EventsIngested". + * via the `definition` "LiveSessionSummary". */ -export interface EventsIngested { - ok: boolean; - ingested: number; +export interface LiveSessionSummary { + id: string; + name: string; + harness?: SessionHarness | null; + lastEventTs?: number | null; + pty?: string | null; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemRequest". + * via the `definition` "SessionLogLine". */ -export interface PairRedeemRequest { - token: string; - csr?: string | null; +export interface SessionLogLine { + who: string; + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RosterFile". + * via the `definition` "SessionView". */ -export interface RosterFile { - default: string; - cwd?: string | null; - env?: { - [k: string]: string; - }; - commands: { - [k: string]: RosterEntry; - }; +export interface SessionView { + title: string; + activity: Activity; + tool?: string | null; + tasks: string[]; + thought: string; + lastMessage: string; + log: SessionLogLine[]; + term: string[]; + ended: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "RosterEntry". + * via the `definition` "LiveSessionList". */ -export interface RosterEntry { - label: string; - cmd: string[]; - room?: boolean | null; - cwd?: string | null; - env?: { - [k: string]: string; - }; +export interface LiveSessionList { + sessions: LiveSessionSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptTurn". + * via the `definition` "StateResponse". */ -export interface TranscriptTurn { - role: Role; - text: string; - ts?: number | null; +export interface StateResponse { + session: string; + state: SessionView; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptResponse". + * via the `definition` "snapshot". */ -export interface TranscriptResponse { - id: string; - command: string; - turns: TranscriptTurn[]; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface Snapshot { + v: ProtocolVersion; + sessions: LiveSessionSummary[]; + rooms: { + [k: string]: SessionView; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionSummary". + * via the `definition` "session.removed". */ -export interface SessionSummary { - id: string; - lastActive: number; - messages: number; +export interface SessionRemoved { + v: ProtocolVersion; + session: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionList". + * via the `definition` "SessionBroadcast". */ -export interface SessionList { - sessions: SessionSummary[]; +export interface SessionBroadcast { + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MessageList". + * via the `definition` "CaptureBatchRequest". */ -export interface MessageList { - messages: SessionMessage[]; +export interface CaptureBatchRequest { + session_key: string; + agent: string; + channel?: string | null; + title?: string | null; + settings?: { + [k: string]: unknown; + } | null; + task_id?: string | null; + finalize?: boolean | null; + created_at?: Millis | null; + updated_at?: Millis | null; + messages: CaptureMessage[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionMessage". + * via the `definition` "CaptureMessage". */ -export interface SessionMessage { - id: string; - sessionId: string; - role: SessionMessageRole; - text: string; - ts: number; - usage?: MessageUsage | null; - model?: string | null; - durationMs?: number | null; - thinking?: boolean | null; - tools?: string[] | null; +export interface CaptureMessage { + event_id: string; + role: Role; + content: string; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + created_at?: Millis | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MessageUsage". + * via the `definition` "CaptureResult". */ -export interface MessageUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface CaptureResult { + ok: boolean; + conversation_id: string; + inserted: number; + skipped: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostRequest". + * via the `definition` "HookContextBase". */ -export interface SessionPostRequest { - excludeTools?: string[] | null; - text: string; - userId?: string | null; - agent?: string | null; - thinking?: ThinkingLevel | null; - systemPrompt?: string | null; +export interface HookContextBase { + agentId?: string | null; + sessionId?: string | null; + timestamp: number; + metadata: { + [k: string]: unknown; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostAccepted". + * via the `definition` "HookUsage". */ -export interface SessionPostAccepted { - accepted: boolean; - session: string; +export interface HookUsage { + promptTokens: number; + completionTokens: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostReply". + * via the `definition` "SessionTokens". */ -export interface SessionPostReply { - message: SessionMessage; +export interface SessionTokens { + prompt: number; + completion: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionWsClientMessage". + * via the `definition` "TurnComplexity". */ -export interface SessionWsClientMessage { - type: SessionClientKind; - session: string; +export interface TurnComplexity { + toolCallCount: number; + hadErrorRecovery: boolean; + hadUserCorrection: boolean; + uniqueTools: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamEvent". + * via the `definition` "Message". */ -export interface StreamEvent { - type: StreamEventKind; - content: string; - metadata?: { - [k: string]: unknown; - } | null; -} -export interface TranscriptWsFrame { - kind: "transcript"; +export interface Message { + role: Role; + content: MessageContent; + reasoning?: string | null; + toolCalls?: ToolCall[] | null; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTurn". + * via the `definition` "ToolCall". */ -export interface HarnessTranscriptTurn { - role: SessionMessageRole; - text: string; - thinking?: string | null; - tools?: HarnessTranscriptTool[] | null; - usage?: MessageUsage | null; - model?: string | null; - stopReason?: string | null; - lastBlock?: TranscriptBlock | null; - complete?: boolean; - compact?: boolean; +export interface ToolCall { + id: string; + name: string; + arguments: { + [k: string]: unknown; + }; + thoughtSignature?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTool". + * via the `definition` "HookPipelineError". */ -export interface HarnessTranscriptTool { - name: string; - status: TranscriptToolStatus; - args?: { - [k: string]: unknown; - } | null; - id?: string | null; - input?: { - [k: string]: unknown; - } | null; - resultText?: string | null; +export interface HookPipelineError { + hookId: string; + error: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptWsFrame". + * via the `definition` "HookPipelineResult". */ -export interface TranscriptWsFrame1 { - session: string; - rev: number; - from: number; - turns: HarnessTranscriptTurn[]; - total: number; - command: string; - truncatedBefore?: boolean | null; +export interface HookPipelineResult { + context: HookContext; + aborted: boolean; + skipped: boolean; + errors: HookPipelineError[]; + ran: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionTranscriptResponse". + * via the `definition` "HookConfig". */ -export interface HarnessSessionTranscriptResponse { - sessionId: SessionId; - harnessId: HarnessId; - turns: HarnessTranscriptTurn[]; - contextWindow: number; - compactAt: number; - contextSource: ContextSource; - redirectedTo?: SessionId | null; +export interface HookConfig { + id: string; + event: HookEventName; + type: HookConfigKind; + target: string; + priority?: number | null; + onError?: HookErrorMode | null; + agentFilter?: string[] | null; + toolFilter?: string[] | null; + description?: string | null; + enabled?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTurnAccepted". + * via the `definition` "ApprovalOption". */ -export interface HarnessTurnAccepted { - ok: boolean; - sessionId: SessionId; - redirectedTo?: SessionId | null; - dismissedDialog?: boolean; +export interface ApprovalOption { + key: string; + label: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionResponse". + * via the `definition` "HarnessSessionSummary". */ -export interface HarnessSessionResponse { +export interface HarnessSessionSummary { sessionId: SessionId; harnessId: HarnessId; title?: string | null; @@ -2651,1197 +4708,1153 @@ export interface HarnessSessionResponse { taskId?: string | null; effort?: string | null; transport?: Transport | null; - redirectedTo?: SessionId | null; + startupContext?: StartupContext | null; [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnRequest". - */ -export interface TermSpawnRequest { - command?: string | null; - model?: string | null; - effort?: string | null; - session?: string | null; - resume?: string | null; - agentId?: string | null; - force?: boolean | null; - cols?: number | null; - rows?: number | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermAttachInfo". + * via the `definition` "PlanEntry". */ -export interface TermAttachInfo { - socket: string; - session: string; - host: string; - sshUser: string; - local: boolean; +export interface PlanEntry { + content: string; + status: PlanStatus; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnResponse". + * via the `definition` "LlmUsage". */ -export interface TermSpawnResponse { - harnessSessionId?: SessionId | null; - id: string; - denSession: string; - command: string; - cwd?: string | null; - pid: number; - createdAt: number; - mux?: Mux | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; +export interface LlmUsage { + promptTokens: number; + completionTokens: number; + reasoningTokens?: number | null; + cachedTokens?: number | null; + cacheCreationTokens?: number | null; + cacheReadTokens?: number | null; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PtyInfo". - */ -export interface PtyInfo { - id: string; - denSession: string; - command: string; - state: PtyState; - pid?: number | null; - attached: number; - exitCode?: number | null; - createdAt: number; - lastOutputTs?: number | null; - cols?: number | null; - rows?: number | null; - mux?: Mux | null; - persisted?: boolean | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; +export interface HarnessStatusFrame { + type: "status"; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PtyList". + * via the `definition` "PromptQuestion". */ -export interface PtyList { - ptys: PtyInfo[]; +export interface PromptQuestion { + question?: string | null; + header?: string | null; + multiSelect: boolean; + freeText?: boolean | null; + options: PromptOption[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermCommand". + * via the `definition` "PromptOption". */ -export interface TermCommand { - id: string; +export interface PromptOption { label: string; - room: boolean; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermConfig". - */ -export interface TermConfig { - enabled: boolean; - default: string; - maxPtys: number; - active: number; - commands: TermCommand[]; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectRequest". - */ -export interface TermInjectRequest { - session: string; - text: string; - submit?: boolean | null; - interrupt?: boolean | null; - bypassDialogGate?: boolean | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectResponse". - */ -export interface TermInjectResponse { - ok: boolean; - ptyId: string; - dismissedDialog?: boolean | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceOwner". - */ -export interface DeviceOwner { - device?: string | null; - self: boolean; + description?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UploadCreated". + * via the `definition` "PromptResolution". */ -export interface UploadCreated { - id: string; - name: string; - bytes: number; - mediaType: string; - expiresAt: string; - session?: string | null; +export interface PromptResolution { + at: number; + answerText?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UploadList". + * via the `definition` "PromptScreen". */ -export interface UploadList { - uploads: UploadCreated[]; +export interface PromptScreen { + current: number; + total: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UsersRegistry". + * via the `definition` "StatusTool". */ -export interface UsersRegistry { - ownerUserId: string; - unmappedIsOwner: boolean; - localStores?: boolean | null; - users: { - [k: string]: UserRecord; - }; +export interface StatusTool { + name: string; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "UserRecord". + * via the `definition` "HarnessStatusFrame". */ -export interface UserRecord { - id?: string | null; - devices?: string[] | null; - pgUrl?: string | null; - envFile?: string | null; - persona?: string | null; +export interface HarnessStatusFrame1 { + sessionId: SessionId; + status: HarnessStatus; + since: number; + source?: StatusSource | null; + phase?: StatusPhase | null; + tool?: StatusTool | null; + promptId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ChatRequest". + * via the `definition` "HarnessCapabilities". */ -export interface ChatRequest { - model: string; - messages: OpenAiMessage[]; - stream?: boolean | null; - max_tokens?: number | null; - stream_options?: StreamOptions | null; +export interface HarnessCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; + turnOptions?: boolean | null; + launchModel?: boolean | null; + imageAttachments?: boolean | null; + models?: HarnessModelOption[] | null; + modelsSource?: HarnessModelsSource | null; + efforts?: EffortOption[] | null; + modelFlag?: string | null; + effortFlag?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OpenAiMessage". + * via the `definition` "HarnessModelOption". */ -export interface OpenAiMessage { - role: Role; - content?: string | null; - reasoning_content?: string | null; - tool_calls?: MessageToolCall[] | null; - tool_call_id?: string | null; -} -export interface StreamedPlainToolCall { - type: "function"; +export interface HarnessModelOption { + inputModalities?: string[] | null; + id: string; + label: string; + isDefault?: boolean | null; + efforts?: EffortOption[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamOptions". + * via the `definition` "EffortOption". */ -export interface StreamOptions { - include_usage: boolean; +export interface EffortOption { + id: string; + label: string; + isDefault?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "FunctionDelta". + * via the `definition` "HarnessControlCapabilities". */ -export interface FunctionDelta { - name?: string | null; - arguments?: string | null; +export interface HarnessControlCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StreamedPlainToolCall". + * via the `definition` "HarnessObservationCapabilities". */ -export interface StreamedPlainToolCall1 { - index?: number | null; - id?: string | null; - function: FunctionDelta; +export interface HarnessObservationCapabilities { + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion". + * via the `definition` "HarnessSessionCreateRequest". */ -export interface ChatCompletion { - id: string; - created: number; - model: string; - choices: CompletionChoice[]; - usage?: Usage | null; +export interface HarnessSessionCreateRequest { + harness?: HarnessId | null; + model?: string | null; + cwd?: string | null; + agentId?: string | null; + topicId?: string | null; + prompt?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionChoice". + * via the `definition` "HarnessSessionList". */ -export interface CompletionChoice { - index: number; - message: OpenAiMessage; - finish_reason: FinishReason; +export interface HarnessSessionList { + sessions: HarnessSessionSummary[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Usage". + * via the `definition` "HarnessOffering". */ -export interface Usage { - prompt_tokens: number; - completion_tokens: number; - total_tokens: number; - prompt_tokens_details?: PromptTokensDetails | null; - completion_tokens_details?: CompletionTokensDetails | null; +export interface HarnessOffering { + harnessId: HarnessId; + chat: boolean; + capabilities: HarnessCapabilities; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptTokensDetails". + * via the `definition` "HarnessOfferingList". */ -export interface PromptTokensDetails { - cached_tokens: number; +export interface HarnessOfferingList { + harnesses: HarnessOffering[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionTokensDetails". + * via the `definition` "HarnessStoreSession". */ -export interface CompletionTokensDetails { - reasoning_tokens: number; +export interface HarnessStoreSession { + id: string; + command: RosterCommand; + title: string; + updatedAt: number; + parentSessionId?: string | null; + agentName?: string | null; + model?: string | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion.chunk". + * via the `definition` "HarnessStoreSessionList". */ -export interface ChatCompletionChunk { - id: string; - created: number; - model: string; - choices: ChunkChoice[]; - usage?: Usage | null; +export interface HarnessStoreSessionList { + sessions: HarnessStoreSession[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ChunkChoice". + * via the `definition` "task.done". */ -export interface ChunkChoice { - index: number; - delta: CompletionDelta; - finish_reason?: FinishReason | null; +export interface TaskDone { + taskId: string; + status: TaskStatus; + ts: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionDelta". + * via the `definition` "ContextRef". */ -export interface CompletionDelta { - role?: Role | null; - content?: string | null; - reasoning_content?: string | null; +export interface ContextRef { + kind: ContextRefKind; + ref: string; + note?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "list". + * via the `definition` "AcceptanceCriterion". */ -export interface List { - data: Model[]; +export interface AcceptanceCriterion { + id: string; + description: string; + kind: CriterionKind; + check?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "model". + * via the `definition` "TaskBudget". */ -export interface Model { - id: string; - created: number; - owned_by: string; +export interface TaskBudget { + maxUsd?: number | null; + maxTokens?: number | null; + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorDetail". + * via the `definition` "TaskUsage". */ -export interface ErrorDetail { - message: string; - type: ErrorKind; +export interface TaskUsage { + inputTokens?: number | null; + outputTokens?: number | null; + totalTokens?: number | null; + costUsd?: number | null; + turns: number; + wallClockMs: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorResponse". + * via the `definition` "TaskSpec". */ -export interface ErrorResponse { - error: ErrorDetail; +export interface TaskSpec { + delegation?: boolean | null; + meshFrom?: string | null; + taskId: string; + agentId: string; + goal: string; + resolvedContext: ContextRef[]; + acceptanceCriteria: AcceptanceCriterion[]; + budget?: TaskBudget1; + tools?: string[] | null; + workingDir?: string | null; + model?: string | null; + effort?: Effort | null; + systemPromptAppend?: string | null; + isolation?: TaskIsolation | null; + promptMode?: TaskPromptMode | null; + excludeTools?: string[] | null; + resumeMessage?: string | null; + session: string; + permissionDecisions?: TaskPermissionDecision[] | null; + presetId?: string | null; + presetName?: string | null; + auditOnly?: boolean | null; + [k: string]: unknown; +} +export interface TaskBudget1 { + maxUsd?: number | null; + maxTokens?: number | null; + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Conversation". + * via the `definition` "TaskPermissionDecision". */ -export interface Conversation { - id: string; - title: string; - createdAt: number; - updatedAt: number; - messages: OpenAiMessage[]; +export interface TaskPermissionDecision { + requestId: string; + tool: string; + decision: TaskPermissionOutcome; + at: number; + message?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Conversations". + * via the `definition` "TaskArtifact". */ -export interface Conversations { - conversations: Conversation[]; +export interface TaskArtifact { + kind: ArtifactKind; + ref: string; + note?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ConversationTitle". + * via the `definition` "CriterionReport". */ -export interface ConversationTitle { - title: string; +export interface CriterionReport { + id: string; + met: boolean; + evidence?: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiQuery". + * via the `definition` "TaskResult". */ -export interface WikiQuery { - q?: string | null; - tag?: string | null; - limit?: number | null; - offset?: number | null; +export interface TaskResult { + verdict: TaskVerdict; + summary: string; + output?: string | null; + artifacts: TaskArtifact[]; + criteriaSelfReport?: CriterionReport[] | null; + usage: TaskUsage; + error?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageQuery". + * via the `definition` "EvalOutcome". */ -export interface WikiPageQuery { - slug: WikiSlug; +export interface EvalOutcome { + verdict: EvalVerdict; + attempts: number; + verifierTaskIds: string[]; + criteriaReport: CriterionReport[]; + diverged: boolean; + escalatedAt?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiHistoryEntry". + * via the `definition` "ExecutorTurnCapabilities". */ -export interface WikiHistoryEntry { - date: string; - title: string; - body: string; +export interface ExecutorTurnCapabilities { + steerable: boolean; + multiTurn: boolean; + structuredStream: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiCitation". + * via the `definition` "ExecutorResultCapabilities". */ -export interface WikiCitation { - summaryId: string; - date?: Millis | null; - kind?: string | null; - note?: string | null; +export interface ExecutorResultCapabilities { + usageInResult: boolean; + sessionIdCapture: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSource". + * via the `definition` "ExecutorInteractionCapabilities". */ -export interface WikiSource { - kind: WikiSourceKind; - ids: string[]; - conversationId?: string | null; - span?: WikiSourceSpan | null; +export interface ExecutorInteractionCapabilities { + slashCommands: boolean; + effortSelection: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceSpan". + * via the `definition` "TaskApprovalRequest". */ -export interface WikiSourceSpan { - earliest: Millis; - latest: Millis; +export interface TaskApprovalRequest { + taskId: string; + requestId: string; + name: string; + input: { + [k: string]: unknown; + }; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageResponse". + * via the `definition` "TaskWire". */ -export interface WikiPageResponse { - slug: string; - title: string; - aliases: string[]; - tags: string[]; - entities: string[]; - currentState: string; - article?: string | null; - seeAlso?: string[] | null; - history: WikiHistoryEntry[]; - citations: WikiCitation[]; - markdown: string; - sources: WikiSource[]; - gitSha?: string | null; - lastVerified?: Millis | null; - updatedAt: Millis; - related?: string[] | null; +export interface TaskWire { + id: string; + goal: string; + contextRefs: ContextRef[]; + acceptanceCriteria: AcceptanceCriterion[]; + spec: TaskSpec; + executor: TaskExecutorKind; + executorTarget?: string | null; + agentId: string; + requestedBy?: string | null; + origin: string; + parentTaskId?: string | null; + chainDepth: number; + nodeAffinity?: string | null; + claimedBy?: string | null; + budget: TaskBudget; + usage?: TaskUsage | null; + status: TaskStatus; + attempt: number; + maxAttempts: number; + pendingMessage?: string | null; + error?: string | null; + result?: TaskResult | null; + conversationId?: string | null; + sessionKey?: string | null; + harnessSessionIds: string[]; + eval?: EvalOutcome | null; + evalAttempt: number; + createdAt: number; + startedAt?: number | null; + lastHeartbeatAt?: number | null; + completedAt?: number | null; + durationMs?: number | null; + pendingApprovals?: TaskApprovalRequest[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissSuggestion". + * via the `definition` "TaskCreateRequest". */ -export interface WikiMissSuggestion { - slug: string; - title: string; +export interface TaskCreateRequest { + goal: string; + agentId: string; + executor?: TaskExecutorKind | null; + executorTarget?: string | null; + requestedBy?: string | null; + parentTaskId?: string | null; + chainDepth?: number | null; + nodeAffinity?: string | null; + spec?: TaskSpec | null; + budget?: TaskBudget | null; + contextRefs?: ContextRef[] | null; + acceptanceCriteria?: AcceptanceCriterion[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissBody". + * via the `definition` "TaskResponse". */ -export interface WikiMissBody { - error: string; - suggestions: WikiMissSuggestion[]; +export interface TaskResponse { + task: TaskWire; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiRedLink". + * via the `definition` "TasksListResponse". */ -export interface WikiRedLink { - entity: string; - referencedBy: string[]; +export interface TasksListResponse { + tasks: TaskWire[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiGapsResponse". + * via the `definition` "TaskSteerAccepted". */ -export interface WikiGapsResponse { - redLinks: WikiRedLink[]; - stalest: string[]; +export interface TaskSteerAccepted { + ok: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopic". + * via the `definition` "TaskKillResponse". */ -export interface WikiTopic { - slug: string; - title: string; - tags: string[]; - entities: string[]; - updatedAt: Millis; - excerpt: string; +export interface TaskKillResponse { + ok: boolean; + prior?: TaskStatus | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopicList". + * via the `definition` "TaskApprovalAccepted". */ -export interface WikiTopicList { - topics: WikiTopic[]; - total: number; +export interface TaskApprovalAccepted { + ok: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentUsage". + * via the `definition` "TaskApprovalWaitResponse". */ -export interface AgentUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface TaskApprovalWaitResponse { + approval: TaskApprovalRequest; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionSummary". + * via the `definition` "TaskWaitTimeoutResponse". */ -export interface LiveSessionSummary { - id: string; - name: string; - harness?: SessionHarness | null; - lastEventTs?: number | null; - pty?: string | null; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface TaskWaitTimeoutResponse { + error: string; + task?: TaskWire | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionLogLine". + * via the `definition` "TaskOverrides". */ -export interface SessionLogLine { - who: string; - text: string; +export interface TaskOverrides { + delegation?: boolean | null; + meshFrom?: string | null; + presetId?: string | null; + presetName?: string | null; + permissionDecisions?: TaskPermissionDecision[] | null; + auditOnly?: boolean | null; + workingDir?: string | null; + model?: string | null; + effort?: Effort | null; + systemPromptAppend?: string | null; + isolation?: TaskIsolation | null; + promptMode?: TaskPromptMode | null; + excludeTools?: string[] | null; + resumeMessage?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionView". + * via the `definition` "MemorySearchResult". */ -export interface SessionView { - title: string; - activity: Activity; - tool?: string | null; - tasks: string[]; - thought: string; - lastMessage: string; - log: SessionLogLine[]; - term: string[]; - ended: boolean; +export interface MemorySearchResult { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + role?: Role | null; + agent?: string | null; + relevanceScore: number; + createdAt: string; + sessionId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionList". + * via the `definition` "PluginManifest". */ -export interface LiveSessionList { - sessions: LiveSessionSummary[]; +export interface PluginManifest { + $schema?: string | null; + manifest: ProtocolVersion; + id: PluginId; + name: string; + version: string; + description: string; + icon?: string | null; + run: PluginRun; + permissions?: Permission[]; + settings?: ViewField[]; + tools?: PluginTool[]; + contributes?: PluginContributions; + jobs?: PluginJob[]; + events?: PluginEventKind[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StateResponse". + * via the `definition` "PluginRun". */ -export interface StateResponse { - session: string; - state: SessionView; +export interface PluginRun { + command: string[]; + env?: { + [k: string]: string; + }; + readyTimeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "snapshot". + * via the `definition` "ViewField". */ -export interface Snapshot { - v: ProtocolVersion; - sessions: LiveSessionSummary[]; - rooms: { - [k: string]: SessionView; - }; +export interface ViewField { + key: string; + label: string; + input: ViewInput; + value?: ViewValue | null; + required?: boolean; + help?: string | null; + placeholder?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "session.removed". + * via the `definition` "ViewOption". */ -export interface SessionRemoved { - v: ProtocolVersion; - session: string; +export interface ViewOption { + value: string; + label: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureBatchRequest". + * via the `definition` "ViewFile". */ -export interface CaptureBatchRequest { - session_key: string; - agent: string; - channel?: string | null; - title?: string | null; - settings?: { - [k: string]: unknown; - } | null; - task_id?: string | null; - finalize?: boolean | null; - created_at?: Millis | null; - updated_at?: Millis | null; - messages: CaptureMessage[]; +export interface ViewFile { + name: string; + mimeType: string; + data: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureMessage". + * via the `definition` "PluginTool". */ -export interface CaptureMessage { - event_id: string; - role: Role; - content: string; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - metadata?: { +export interface PluginTool { + name: ToolName; + title?: string | null; + description: string; + inputSchema: { [k: string]: unknown; - } | null; - created_at?: Millis | null; + }; + hints?: PluginToolHint[]; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureResult". - */ -export interface CaptureResult { - ok: boolean; - conversation_id: string; - inserted: number; - skipped: number; +export interface PluginContributions { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookContextBase". + * via the `definition` "PluginPage". */ -export interface HookContextBase { - agentId?: string | null; - sessionId?: string | null; - timestamp: number; - metadata: { - [k: string]: unknown; - }; +export interface PluginPage { + id: RouteName; + title: string; + icon?: string | null; + view: RouteName; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookUsage". + * via the `definition` "PluginTopicCard". */ -export interface HookUsage { - promptTokens: number; - completionTokens: number; +export interface PluginTopicCard { + id: RouteName; + title: string; + view: RouteName; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "SessionTokens". + * via the `definition` "PluginSessionAction". */ -export interface SessionTokens { - prompt: number; - completion: number; +export interface PluginSessionAction { + id: RouteName; + title: string; + icon?: string | null; + action: ViewAction; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TurnComplexity". + * via the `definition` "PluginJob". */ -export interface TurnComplexity { - toolCallCount: number; - hadErrorRecovery: boolean; - hadUserCorrection: boolean; - uniqueTools: number; +export interface PluginJob { + id: RouteName; + title: string; + schedule?: string | null; + timeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "Message". + * via the `definition` "PluginContributions". */ -export interface Message { - role: Role; - content: MessageContent; - reasoning?: string | null; - toolCalls?: ToolCall[] | null; - toolCallId?: string | null; +export interface PluginContributions1 { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ToolCall". + * via the `definition` "View". */ -export interface ToolCall { - id: string; - name: string; - arguments: { - [k: string]: unknown; - }; - thoughtSignature?: string | null; +export interface View { + title: string; + subtitle?: string | null; + toolbar?: ViewButton[]; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineError". + * via the `definition` "ViewButton". */ -export interface HookPipelineError { - hookId: string; - error: string; +export interface ViewButton { + label: string; + icon?: string | null; + style?: ViewButtonStyle | null; + action: ViewAction; + confirm?: ViewConfirm | null; + disabled?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineResult". + * via the `definition` "ViewConfirm". */ -export interface HookPipelineResult { - context: HookContext; - aborted: boolean; - skipped: boolean; - errors: HookPipelineError[]; - ran: string[]; +export interface ViewConfirm { + title: string; + text: string; + confirmLabel?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HookConfig". + * via the `definition` "ViewTab". */ -export interface HookConfig { - id: string; - event: HookEventName; - type: HookConfigKind; - target: string; - priority?: number | null; - onError?: HookErrorMode | null; - agentFilter?: string[] | null; - toolFilter?: string[] | null; - description?: string | null; - enabled?: boolean | null; +export interface ViewTab { + id: RouteName; + title: string; + badge?: string | null; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ApprovalOption". + * via the `definition` "ViewProperty". */ -export interface ApprovalOption { - key: string; +export interface ViewProperty { label: string; + value: ViewInline; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionSummary". + * via the `definition` "ViewListItem". */ -export interface HarnessSessionSummary { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - [k: string]: unknown; -} -export interface HarnessStatusFrame { - type: "status"; +export interface ViewListItem { + id: string; + title: string; + subtitle?: string | null; + icon?: string | null; + trailing?: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptQuestion". + * via the `definition` "ViewEmpty". */ -export interface PromptQuestion { - question?: string | null; - header?: string | null; - multiSelect: boolean; - freeText?: boolean | null; - options: PromptOption[]; +export interface ViewEmpty { + title: string; + text?: string | null; + button?: ViewButton | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptOption". + * via the `definition` "ViewColumn". */ -export interface PromptOption { - label: string; - description?: string | null; +export interface ViewColumn { + title: string; + align?: ViewAlign | null; + sortable?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptResolution". + * via the `definition` "ViewRow". */ -export interface PromptResolution { - at: number; - answerText?: string | null; +export interface ViewRow { + id: string; + cells: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "PromptScreen". + * via the `definition` "ViewCrumb". */ -export interface PromptScreen { - current: number; - total: number; +export interface ViewCrumb { + label: string; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "StatusTool". + * via the `definition` "CanvasScene". */ -export interface StatusTool { - name: string; - toolCallId?: string | null; +export interface CanvasScene { + items: CanvasItem[]; + grid?: CanvasGrid | null; + viewport?: CanvasViewport | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStatusFrame". + * via the `definition` "CanvasAnchor". */ -export interface HarnessStatusFrame1 { - sessionId: SessionId; - status: HarnessStatus; - since: number; - source?: StatusSource | null; - phase?: StatusPhase | null; - tool?: StatusTool | null; - promptId?: string | null; +export interface CanvasAnchor { + id: string; + x: number; + y: number; + side: CanvasSide; + direction: CanvasDirection; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapabilities". + * via the `definition` "CanvasMenuItem". */ -export interface HarnessCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; - turnOptions?: boolean | null; - launchModel?: boolean | null; - imageAttachments?: boolean | null; - models?: HarnessModelOption[] | null; - modelsSource?: HarnessModelsSource | null; - efforts?: EffortOption[] | null; - modelFlag?: string | null; - effortFlag?: string | null; +export interface CanvasMenuItem { + id: string; + label: string; + icon?: string | null; + danger?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessModelOption". + * via the `definition` "CanvasEnd". */ -export interface HarnessModelOption { - inputModalities?: string[] | null; - id: string; - label: string; - isDefault?: boolean | null; - efforts?: EffortOption[] | null; +export interface CanvasEnd { + node: string; + anchor?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EffortOption". + * via the `definition` "CanvasGrid". */ -export interface EffortOption { - id: string; - label: string; - isDefault?: boolean | null; +export interface CanvasGrid { + size: number; + snap?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessControlCapabilities". + * via the `definition` "CanvasViewport". */ -export interface HarnessControlCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; +export interface CanvasViewport { + x: number; + y: number; + zoom: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessObservationCapabilities". + * via the `definition` "ViewRequest". */ -export interface HarnessObservationCapabilities { - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; +export interface ViewRequest { + params?: { + [k: string]: unknown; + } | null; + context?: ViewContext; +} +export interface ViewContext { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionList". + * via the `definition` "ViewContext". */ -export interface HarnessSessionList { - sessions: HarnessSessionSummary[]; +export interface ViewContext1 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOffering". + * via the `definition` "ViewActionRequest". */ -export interface HarnessOffering { - harnessId: HarnessId; - chat: boolean; - capabilities: HarnessCapabilities; +export interface ViewActionRequest { + params?: { + [k: string]: unknown; + } | null; + values?: { + [k: string]: ViewValue; + }; + context?: ViewContext2; +} +export interface ViewContext2 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOfferingList". + * via the `definition` "ViewActionResult". */ -export interface HarnessOfferingList { - harnesses: HarnessOffering[]; +export interface ViewActionResult { + actions?: ViewAction[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSession". + * via the `definition` "ViewActionRefusal". */ -export interface HarnessStoreSession { - id: string; - command: RosterCommand; - title: string; - updatedAt: number; - parentSessionId?: string | null; - agentName?: string | null; - model?: string | null; - taskId?: string | null; +export interface ViewActionRefusal { + message: string; + fields?: { + [k: string]: string; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSessionList". + * via the `definition` "CanvasEventRequest". */ -export interface HarnessStoreSessionList { - sessions: HarnessStoreSession[]; +export interface CanvasEventRequest { + event: CanvasEvent; + params?: { + [k: string]: unknown; + } | null; + context?: ViewContext3; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". + * via the `definition` "CanvasPosition". */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; +export interface CanvasPosition { + id: string; + x: number; + y: number; +} +export interface ViewContext3 { + topicId?: string | null; + sessionId?: SessionId | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasResponse". + */ +export interface CanvasResponse { + ops?: CanvasOp[]; + actions?: ViewAction[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "PanelTheme". + */ +export interface PanelTheme { + scheme: PanelScheme; + colors: { + category1?: string; + category2?: string; + category3?: string; + category4?: string; + category5?: string; + category6?: string; + danger?: string; + info?: string; + onPrimary?: string; + onPrimaryContainer?: string; + onSurface?: string; + onSurfaceVariant?: string; + outline?: string; + outlineVariant?: string; + primary?: string; + primaryContainer?: string; + secondaryContainer?: string; + success?: string; + surface?: string; + surfaceContainer?: string; + surfaceContainerHigh?: string; + warning?: string; + }; + fontFamily: string; + fontMono: string; + fontSize: number; + radius: number; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AcceptanceCriterion". + * via the `definition` "PluginList". */ -export interface AcceptanceCriterion { - id: string; - description: string; - kind: CriterionKind; - check?: string | null; +export interface PluginList { + node: string; + plugins: PluginRecord[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskBudget". + * via the `definition` "PluginRecord". */ -export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface PluginRecord { + id: PluginId; + node: string; + path: string; + manifest: PluginManifest; + enabled: boolean; + state: PluginState; + granted: Permission[]; + pending: Permission[]; + error?: string | null; + lastExit?: PluginExit | null; + restarts: number; + startedAt?: number | null; + installedAt: number; + jobs: PluginJobStatus[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskUsage". + * via the `definition` "PluginExit". */ -export interface TaskUsage { - inputTokens: number; - outputTokens: number; - totalTokens: number; - costUsd?: number | null; - turns: number; - wallClockMs: number; +export interface PluginExit { + at: number; + code?: number | null; + signal?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". + * via the `definition` "PluginJobStatus". */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget?: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; -} -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface PluginJobStatus { + id: RouteName; + lastRun?: PluginJobRun | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". + * via the `definition` "PluginJobRun". */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; - at: number; +export interface PluginJobRun { + runId: string; + trigger: PluginJobTrigger; + startedAt: number; + finishedAt?: number | null; + outcome?: PluginJobOutcome | null; message?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". + * via the `definition` "PluginInstallRequest". */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; +export interface PluginInstallRequest { + path: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". + * via the `definition` "PluginEnableRequest". */ -export interface CriterionReport { - id: string; - met: boolean; - evidence?: string; +export interface PluginEnableRequest { + approve?: Permission[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResult". + * via the `definition` "PluginLogs". */ -export interface TaskResult { - verdict: TaskVerdict; - summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; - usage: TaskUsage; - error?: string | null; +export interface PluginLogs { + lines: PluginLogLine[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". + * via the `definition` "PluginLogLine". */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; +export interface PluginLogLine { + at: number; + stream: PluginLogStream; + text: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". + * via the `definition` "PluginSettings". */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; +export interface PluginSettings { + values: { + [k: string]: ViewValue; + }; + secretsSet?: string[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". + * via the `definition` "PluginSettingsUpdate". */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; +export interface PluginSettingsUpdate { + values: { + [k: string]: ViewValue | null; + }; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". + * via the `definition` "plugin.changed". */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; +export interface PluginChanged { + v: ProtocolVersion; + plugin: PluginId; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". + * via the `definition` "plugin.views". */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; +export interface PluginViews { + v: ProtocolVersion; + plugin: PluginId; + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWire". + * via the `definition` "PluginToolList". */ -export interface TaskWire { - id: string; - goal: string; - contextRefs: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; - agentId: string; - requestedBy?: string | null; - origin: string; - parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; - budget: TaskBudget; - usage?: TaskUsage | null; - status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; - error?: string | null; - result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; - createdAt: number; - startedAt?: number | null; - lastHeartbeatAt?: number | null; - completedAt?: number | null; - durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; +export interface PluginToolList { + version: number; + tools: PluginToolEntry[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskCreateRequest". + * via the `definition` "PluginToolEntry". */ -export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; - nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; - acceptanceCriteria?: AcceptanceCriterion[] | null; +export interface PluginToolEntry { + plugin: PluginId; + tool: PluginTool; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResponse". + * via the `definition` "PluginEventDelivery". */ -export interface TaskResponse { - task: TaskWire; +export interface PluginEventDelivery { + seq: number; + at: number; + missed: number; + event: PluginEvent; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TasksListResponse". + * via the `definition` "PluginJobRequest". */ -export interface TasksListResponse { - tasks: TaskWire[]; +export interface PluginJobRequest { + runId: string; + trigger: PluginJobTrigger; + scheduledAt?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". + * via the `definition` "PluginJobResult". */ -export interface TaskSteerAccepted { - ok: boolean; +export interface PluginJobResult { + outcome: PluginJobOutcome; + message?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskKillResponse". + * via the `definition` "PluginToolCall". */ -export interface TaskKillResponse { - ok: boolean; - prior?: TaskStatus | null; +export interface PluginToolCall { + arguments: { + [k: string]: unknown; + }; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". + * via the `definition` "PluginToolResult". */ -export interface TaskApprovalAccepted { - ok: boolean; +export interface PluginToolResult { + text: string; + isError?: boolean; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". + * via the `definition` "PluginSelf". */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; +export interface PluginSelf { + id: PluginId; + node: string; + version: string; + permissions: Permission[]; + settings: { + [k: string]: ViewValue; + }; + dataDir: string; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWaitTimeoutResponse". + * via the `definition` "PluginViewsChanged". */ -export interface TaskWaitTimeoutResponse { - error: string; - task?: TaskWire | null; +export interface PluginViewsChanged { + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". + * via the `definition` "PluginNotify". */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; +export interface PluginNotify { + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResult". + * via the `definition` "plugin.notification". */ -export interface MemorySearchResult { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - role?: Role | null; - agent?: string | null; - relevanceScore: number; - createdAt: string; +export interface PluginNotification { + plugin: PluginId; + node: string; + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; + ts: number; } diff --git a/packages/contract/src/sent.ts b/packages/contract/src/sent.ts index 9bf50d9..d6f051f 100644 --- a/packages/contract/src/sent.ts +++ b/packages/contract/src/sent.ts @@ -1,20 +1,11 @@ -// Generated from philbert440/rivethub-runtime@ba386c48eca72acb93d9a26bafb9abd30a48253f contract/sent.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/sent.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessId". */ export type HarnessId = - | "claude-code" - | "grok-build" - | "kimi-code" - | "hermes" - | "codex" - | "opencode" - | "pi" - | "qwen-code" - | "cursor" - | "cowork"; + "claude-code" | "grok-build" | "kimi-code" | "hermes" | "codex" | "opencode" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "KnownHarness". @@ -25,6 +16,21 @@ export type KnownHarness = string; * via the `definition` "AgentStoreBackend". */ export type AgentStoreBackend = "postgres" | "file"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ThinkingLevel". + */ +export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubSessionMode". + */ +export type HubSessionMode = "chat" | "terminal"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ProtocolVersion". + */ +export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionId". @@ -137,11 +143,6 @@ export type AudioMicClientFrame = | { type: "stop"; }; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ProtocolVersion". - */ -export type ProtocolVersion = number; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "FileEntryKind". @@ -179,14 +180,14 @@ export type BrowseWindow = "today" | "yesterday" | "this_morning" | "this_week" export type MemoryScope = "messages" | "summaries" | "both"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHitSource". + * via the `definition` "Role". */ -export type MemoryHitSource = "message" | "summary"; +export type Role = "system" | "user" | "assistant" | "tool"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Role". + * via the `definition` "MemoryHitSource". */ -export type Role = "system" | "user" | "assistant" | "tool"; +export type MemoryHitSource = "message" | "summary"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MemoryFallback". @@ -235,6 +236,11 @@ export type ContentPart = } | MediaFields | MediaFields1; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VectorState". + */ +export type VectorState = "embedded" | "pending" | "failed" | "skipped"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MemoryHealthStatus". @@ -277,9 +283,9 @@ export type ContextSource = "spawn" | "default" | "observed"; export type SessionMessageRole = "user" | "assistant"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ThinkingLevel". + * via the `definition` "SteerOutcome". */ -export type ThinkingLevel = "off" | "low" | "medium" | "high" | "xhigh"; +export type SteerOutcome = "steered" | "startedNewTurn" | "promptRequired"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionClientKind". @@ -328,6 +334,11 @@ export type TranscriptToolStatus = "running" | "done" | "error"; * via the `definition` "TranscriptBlock". */ export type TranscriptBlock = "thinking" | "text" | "tool_use" | "tool_result"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPreviewKind". + */ +export type SessionPreviewKind = "running" | "asking" | "approval" | "said"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "Millis". @@ -343,6 +354,32 @@ export type HarnessSessionStatus = "active" | "idle" | "ended" | "error"; * via the `definition` "Transport". */ export type Transport = "protocol"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StartupKind". + */ +export type StartupKind = "topic" | "recent" | "relevant"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StartupSource". + */ +export type StartupSource = + | { + session: SessionId; + } + | { + wiki: WikiSlug; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "WikiSlug". + */ +export type WikiSlug = string; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeliveredVia". + */ +export type DeliveredVia = "metaAppend" | "cliFlag" | "none"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessSocketRefusalCode". @@ -443,14 +480,106 @@ export type FinishReason = "stop" | "length" | "tool_calls" | "content_filter"; export type ErrorKind = "invalid_request_error" | "server_error"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSlug". + * via the `definition` "WikiSourceKind". */ -export type WikiSlug = string; +export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki" | "user"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceKind". + * via the `definition` "ProposalState". + */ +export type ProposalState = "pending" | "approved" | "rejected"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "Proposer". + */ +export type Proposer = "categorizer" | "backfill"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TidyChange". + */ +export type TidyChange = + | { + kind: "merge"; + source: string; + into: string; + } + | { + kind: "move"; + topic: string; + parent?: string | null; + } + | { + kind: "rename"; + topic: string; + name: string; + } + | { + kind: "close"; + topic: string; + } + | { + kind: "delete"; + topic: string; + } + | { + kind: "createTopic"; + topic: string; + name: string; + parent?: string | null; + aliases?: string[]; + sessions: SessionId[]; + conversations: string[]; + } + | { + kind: "fileInto"; + topic: string; + sessions: SessionId[]; + conversations: string[]; + } + | { + kind: "mergePage"; + page: string; + into: string; + } + | { + kind: "removePage"; + page: string; + } + | { + kind: "addType"; + topic: string; + name: string; + parent?: string | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopicDirectory". + */ +export type TopicDirectory = + | { + kind: "local"; + node: string; + path: string; + } + | { + kind: "shared"; + path: string; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopicKind". + */ +export type TopicKind = "work" | "type" | "entity"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PlacedBy". + */ +export type PlacedBy = "you" | "categorizer"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DecisionStatus". */ -export type WikiSourceKind = "summary" | "message" | "conversation" | "task" | "leaf" | "extract-wiki"; +export type DecisionStatus = "active" | "superseded"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "AgentEvent". @@ -586,7 +715,17 @@ export type AgentEventKind = * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionBroadcast". */ -export type SessionBroadcast = Snapshot | SessionRemoved | AgentEvent; +export type SessionBroadcast = Snapshot | SessionRemoved | HubState1 | PluginChanged | PluginViews | AgentEvent; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginId". + */ +export type PluginId = string; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RouteName". + */ +export type RouteName = string; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HookEventName". @@ -904,17 +1043,17 @@ export type HookConfigKind = "shell" | "http" | "internal"; * via the `definition` "RosterCommand". */ export type RosterCommand = - "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "pi" | "qwen" | "cursor" | "cowork"; + "claude" | "grok" | "kimi" | "opencode" | "hermes" | "codex" | "omp" | "dsh" | "cursor" | "cowork"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalDecision". */ -export type ApprovalDecision = "allow" | "deny" | "allowSession"; +export type ApprovalDecision = "allow" | "deny" | "allow-session"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ApprovalOutcome". */ -export type ApprovalOutcome = "allow" | "deny" | "allowSession" | "external"; +export type ApprovalOutcome = "allow" | "deny" | "allow-session" | "external"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "HarnessStatus". @@ -957,6 +1096,15 @@ export type HarnessEvent = }; turnId?: string | null; } + | { + type: "tool-update"; + sessionId: SessionId; + toolCallId: string; + input: { + [k: string]: unknown; + }; + turnId?: string | null; + } | { type: "tool-result"; sessionId: SessionId; @@ -990,11 +1138,17 @@ export type HarnessEvent = summary: HarnessSessionSummary; supersedes?: SessionId | null; } + | { + type: "plan"; + sessionId: SessionId; + entries: PlanEntry[]; + } | { type: "turn-complete"; sessionId: SessionId; turnId?: string | null; stopReason?: string | null; + usage?: LlmUsage | null; } | { type: "error"; @@ -1036,6 +1190,11 @@ export type HarnessEvent = resolved?: PromptResolution | null; screen?: PromptScreen | null; }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PlanStatus". + */ +export type PlanStatus = "pending" | "in_progress" | "completed"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "PromptKind". @@ -1057,7 +1216,8 @@ export type HarnessCode = | "turn_in_flight" | "capability_unsupported" | "unknown_approval" - | "unknown_prompt"; + | "unknown_prompt" + | "turn_failed"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskExecutorKind". @@ -1171,1471 +1331,3383 @@ export type TaskEvent = * via the `definition` "LogLevel". */ export type LogLevel = "debug" | "info" | "warn" | "error"; - -export interface RivetHubContractSentByTheRuntime { - [k: string]: unknown; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPreset". + * via the `definition` "ToolName". */ -export interface AgentPreset { - id: string; - name: string; - color: string; - harnessId?: HarnessId | null; - model: string; - effort: string; - systemPrompt: string; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; - createdAt: number; - updatedAt: number; - [k: string]: unknown; -} +export type ToolName = string; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentsFile". + * via the `definition` "Permission". */ -export interface AgentsFile { - agents: AgentPreset[]; -} +export type Permission = + | "memory.read" + | "memory.write" + | "sessions.read" + | "sessions.control" + | "topics.read" + | "topics.write" + | "tasks.read" + | "tasks.delegate" + | "agents.read" + | "notifications.send" + | "host.files.read" + | "host.files.write" + | "host.network" + | "host.exec"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetCreateRequest". + * via the `definition` "ViewInput". */ -export interface AgentPresetCreateRequest { - name: string; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type ViewInput = + | { + type: "text"; + multiline?: boolean; + } + | { + type: "secret"; + } + | { + type: "number"; + min?: number | null; + max?: number | null; + step?: number | null; + } + | { + type: "toggle"; + } + | { + type: "select"; + options: ViewOption[]; + multiple?: boolean; + } + | { + type: "file"; + multiple?: boolean; + accept?: string[]; + }; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentPresetUpdate". + * via the `definition` "ViewValue". */ -export interface AgentPresetUpdate { - name?: string | null; - color?: string | null; - harnessId?: KnownHarness | null; - model?: string | null; - effort?: string | null; - systemPrompt?: string | null; - node?: string | null; - directory?: string | null; - sharedLink?: boolean | null; - nodeBaseUrl?: string | null; - sortOrder?: number | null; -} +export type ViewValue = boolean | number | string | string[] | ViewFile[]; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentListResponse". + * via the `definition` "PluginToolHint". */ -export interface AgentListResponse { - agents: AgentPreset[]; - node: string; - directoryRoot?: string | null; - sharedDir?: string | null; - backend?: AgentStoreBackend | null; -} +export type PluginToolHint = "readOnly" | "destructive" | "idempotent" | "openWorld"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentResponse". + * via the `definition` "ViewAction". */ -export interface AgentResponse { - agent: AgentPreset; -} +export type ViewAction = + | { + type: "call"; + action: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "navigate"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + replace?: boolean; + } + | { + type: "dialog"; + view: RouteName; + params?: { + [k: string]: unknown; + } | null; + } + | { + type: "back"; + } + | { + type: "refresh"; + } + | { + type: "toast"; + text: string; + tone?: ViewTone | null; + } + | { + type: "copy"; + text: string; + } + | { + type: "openSession"; + sessionId: SessionId; + } + | { + type: "openTopic"; + topicId: string; + } + | { + type: "openUrl"; + url: string; + } + | { + type: "download"; + path: string; + filename?: string | null; + }; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDescriptor". + * via the `definition` "ViewTone". */ -export interface HarnessDescriptor { - installed?: boolean | null; -} +export type ViewTone = "neutral" | "info" | "success" | "warning" | "danger"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DelegatedSessionLink". + * via the `definition` "PluginEventKind". */ -export interface DelegatedSessionLink { - taskId: string; - parentTaskId?: string | null; - spawnedSessionId: SessionId; - parentSessionId: SessionId; - agentName?: string | null; - model?: string | null; - owner?: string | null; - harnessId?: HarnessId | null; -} +export type PluginEventKind = + "session.started" | "session.idle" | "session.ended" | "session.placed" | "summary.written" | "task.done"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurnAttachment". + * via the `definition` "ViewButtonStyle". */ -export interface UserTurnAttachment { - mime: string; - pathOrUri: string; - name?: string | null; -} +export type ViewButtonStyle = "primary" | "secondary" | "danger"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserTurn". + * via the `definition` "ViewBlock". */ -export interface UserTurn { - deliveryId?: string | null; - model?: string | null; +export type ViewBlock = + | { + type: "section"; + title?: string | null; + subtitle?: string | null; + actions?: ViewButton[]; + blocks: ViewBlock[]; + collapsed?: boolean | null; + } + | { + type: "split"; + primary: ViewBlock[]; + secondary: ViewBlock[]; + ratio?: number | null; + } + | { + type: "tabs"; + tabs: ViewTab[]; + selected?: RouteName | null; + } + | { + type: "text"; + text: string; + tone?: ViewTone | null; + monospace?: boolean; + } + | { + type: "markdown"; + text: string; + } + | { + type: "code"; + text: string; + language?: string | null; + follow?: boolean; + } + | { + type: "image"; + path: string; + alt: string; + } + | { + type: "properties"; + items: ViewProperty[]; + } + | { + type: "progress"; + value?: number | null; + label?: string | null; + } + | { + type: "notice"; + tone: ViewTone; + title?: string | null; + text: string; + actions?: ViewButton[]; + } + | { + type: "list"; + items: ViewListItem[]; + empty?: ViewEmpty | null; + } + | { + type: "table"; + columns: ViewColumn[]; + rows: ViewRow[]; + empty?: ViewEmpty | null; + } + | { + type: "breadcrumbs"; + items: ViewCrumb[]; + } + | { + type: "actions"; + buttons: ViewButton[]; + } + | { + type: "form"; + id: RouteName; + fields: ViewField[]; + buttons: ViewButton[]; + } + | { + type: "canvas"; + id: RouteName; + scene: CanvasScene; + height?: number | null; + readOnly?: boolean; + menu?: CanvasMenuItem[]; + } + | { + type: "webPanel"; + id: RouteName; + entry: string; + height?: number | null; + params?: { + [k: string]: unknown; + } | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewInline". + */ +export type ViewInline = + | { + type: "text"; + text: string; + tone?: ViewTone | null; + icon?: string | null; + monospace?: boolean; + } + | { + type: "badge"; + text: string; + tone: ViewTone; + } + | { + type: "time"; + at: number; + style?: ViewTimeStyle | null; + } + | { + type: "duration"; + ms: number; + } + | { + type: "bytes"; + value: number; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewTimeStyle". + */ +export type ViewTimeStyle = "relative" | "absolute"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ViewAlign". + */ +export type ViewAlign = "start" | "center" | "end"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasItem". + */ +export type CanvasItem = + | { + type: "node"; + id: string; + x: number; + y: number; + width: number; + height: number; + shapes: CanvasShape[]; + anchors?: CanvasAnchor[]; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + locked?: boolean; + decorative?: boolean; + } + | { + type: "connector"; + id: string; + from: CanvasEnd; + to: CanvasEnd; + route: CanvasRoute; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + arrow: CanvasArrow; + label?: string | null; + tooltip?: string | null; + menu?: CanvasMenuItem[]; + decorative?: boolean; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasShape". + */ +export type CanvasShape = + | { + type: "rect"; + x: number; + y: number; + width: number; + height: number; + radius?: number | null; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "ellipse"; + x: number; + y: number; + width: number; + height: number; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + } + | { + type: "text"; + x: number; + y: number; + text: string; + size?: number | null; + weight?: CanvasWeight | null; + color?: ColorRole | null; + align?: ViewAlign | null; + maxWidth?: number | null; + monospace?: boolean; + } + | { + type: "path"; + d: string; + fill?: ColorRole | null; + stroke?: ColorRole | null; + strokeWidth?: number | null; + dashed?: boolean; + } + | { + type: "icon"; + x: number; + y: number; + name: string; + size?: number | null; + color?: ColorRole | null; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ColorRole". + */ +export type ColorRole = + | "surface" + | "surfaceContainer" + | "surfaceContainerHigh" + | "primary" + | "primaryContainer" + | "onPrimary" + | "onPrimaryContainer" + | "secondaryContainer" + | "onSurface" + | "onSurfaceVariant" + | "outline" + | "outlineVariant" + | "info" + | "success" + | "warning" + | "danger" + | "category1" + | "category2" + | "category3" + | "category4" + | "category5" + | "category6"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasWeight". + */ +export type CanvasWeight = "regular" | "medium" | "bold"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasSide". + */ +export type CanvasSide = "top" | "right" | "bottom" | "left"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasDirection". + */ +export type CanvasDirection = "in" | "out" | "both"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasRoute". + */ +export type CanvasRoute = "straight" | "curved" | "orthogonal"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasArrow". + */ +export type CanvasArrow = "none" | "end" | "start" | "both"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasEvent". + */ +export type CanvasEvent = + | { + type: "selected"; + items: string[]; + } + | { + type: "moved"; + items: CanvasPosition[]; + } + | { + type: "connected"; + from: CanvasEnd; + to: CanvasEnd; + } + | { + type: "deleted"; + items: string[]; + } + | { + type: "activated"; + item: string; + } + | { + type: "menu"; + item?: string | null; + choice: string; + x: number; + y: number; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasOp". + */ +export type CanvasOp = + | { + type: "upsert"; + item: CanvasItem; + } + | { + type: "remove"; + ids: string[]; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelScheme". + */ +export type PanelScheme = "light" | "dark"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelHostMessage". + */ +export type PanelHostMessage = + | { + type: "init"; + theme: PanelTheme; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext1; + plugin: PluginId; + node: string; + } + | { + type: "theme"; + theme: PanelTheme; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelMessage". + */ +export type PanelMessage = + | { + type: "ready"; + } + | { + type: "resize"; + height: number; + } + | { + type: "action"; + action: ViewAction; + }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginState". + */ +export type PluginState = "disabled" | "awaitingApproval" | "starting" | "running" | "backoff" | "invalid"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobTrigger". + */ +export type PluginJobTrigger = "schedule" | "manual"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginJobOutcome". + */ +export type PluginJobOutcome = "succeeded" | "failed"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginLogStream". + */ +export type PluginLogStream = "stdout" | "stderr" | "host"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PluginEvent". + */ +export type PluginEvent = + | { + type: "session.started"; + sessionId: SessionId; + topicId?: string | null; + } + | { + type: "session.idle"; + sessionId: SessionId; + } + | { + type: "session.ended"; + sessionId: SessionId; + } + | { + type: "session.placed"; + sessionId: SessionId; + topicId: string; + by: PlacedBy; + } + | { + type: "summary.written"; + summaryId: string; + sessionId?: SessionId | null; + kind: SummaryKind; + level: number; + } + | { + type: "task.done"; + taskId: string; + status: TaskStatus; + } + | { + type: "settings.changed"; + values: { + [k: string]: ViewValue; + }; + }; + +export interface RivetHubContractSentByTheRuntime { + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPreset". + */ +export interface AgentPreset { + id: string; + name: string; + color: string; + harnessId?: HarnessId | null; + model: string; + effort: string; + systemPrompt: string; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; + createdAt: number; + updatedAt: number; + [k: string]: unknown; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentsFile". + */ +export interface AgentsFile { + agents: AgentPreset[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetCreateRequest". + */ +export interface AgentPresetCreateRequest { + name: string; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; + effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentPresetUpdate". + */ +export interface AgentPresetUpdate { + name?: string | null; + color?: string | null; + harnessId?: KnownHarness | null; + model?: string | null; effort?: string | null; + systemPrompt?: string | null; + node?: string | null; + directory?: string | null; + sharedLink?: boolean | null; + nodeBaseUrl?: string | null; + sortOrder?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentListResponse". + */ +export interface AgentListResponse { + agents: AgentPreset[]; + node: string; + directoryRoot?: string | null; + sharedDir?: string | null; + backend?: AgentStoreBackend | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AgentResponse". + */ +export interface AgentResponse { + agent: AgentPreset; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubProjectDefaults". + */ +export interface HubProjectDefaults { + agentId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + harnessId?: HarnessId | null; + node?: string | null; + directory?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubProject". + */ +export interface HubProject { + id: string; + name: string; + order: number; + createdAt: number; + defaults?: HubProjectDefaults | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubLastSession". + */ +export interface HubLastSession { + key: string; + at: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubState". + */ +export interface HubState { + projects: HubProject[]; + defaultProjectId?: string | null; + membership: { + [k: string]: string; + }; + names: { + [k: string]: string; + }; + archived: string[]; + pinned: string[]; + hidden: string[]; + modes: { + [k: string]: HubSessionMode; + }; + lastSession?: HubLastSession | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubStateResponse". + */ +export interface HubStateResponse { + version: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HubStatePutRequest". + */ +export interface HubStatePutRequest { + baseVersion: number; + state: HubState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "hub.state". + */ +export interface HubState1 { + v: ProtocolVersion; + version: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDescriptor". + */ +export interface HarnessDescriptor { + installed?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DelegatedSessionLink". + */ +export interface DelegatedSessionLink { + taskId: string; + parentTaskId?: string | null; + spawnedSessionId: SessionId; + parentSessionId: SessionId; + agentName?: string | null; + model?: string | null; + owner?: string | null; + harnessId?: HarnessId | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurnAttachment". + */ +export interface UserTurnAttachment { + mime: string; + pathOrUri: string; + name?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "UserTurn". + */ +export interface UserTurn { + deliveryId?: string | null; + model?: string | null; + effort?: string | null; + text: string; + attachments?: UserTurnAttachment[] | null; + systemPrompt?: string | null; + bypassDialogGate?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SendUserTurnResult". + */ +export interface SendUserTurnResult { + dismissedDialog?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "preset". + */ +export interface Preset { + id: string; + name: string; + node: string; + local: boolean; + harnessId?: HarnessId | null; + model?: string | null; + effort?: string | null; + directory?: string | null; + implemented?: boolean | null; + gap?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogNode". + */ +export interface CatalogNode { + id: string; + node: string; + local: boolean; + provider?: string | null; + model?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogCommand". + */ +export interface CatalogCommand { + name: string; + description: string; + argHint?: string | null; + source: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogExecutorEntry". + */ +export interface CatalogExecutorEntry { + key: string; + capabilities: HarnessExecutorCapabilities; + commands: CatalogCommand[]; + harnessId?: HarnessId | null; + implemented?: boolean | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessExecutorCapabilities". + */ +export interface HarnessExecutorCapabilities { + steerable: boolean; + multiTurn: boolean; + structuredStream: boolean; + usageInResult: boolean; + sessionIdCapture: boolean; + slashCommands: boolean; + effortSelection: boolean; + mcpInjection: McpInjection; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogSkillEntry". + */ +export interface CatalogSkillEntry { + name: string; + description: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogSheet". + */ +export interface CatalogSheet { + node: string; + agents: CatalogAgent[]; + executors: CatalogExecutorEntry[]; + tools: string[]; + skills: CatalogSkillEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CatalogAgentsResponse". + */ +export interface CatalogAgentsResponse { + agents: CatalogAgent[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomeBucket". + */ +export interface OutcomeBucket { + tasks: number; + completed: number; + failed: number; + verified: number; + refuted: number; + escalated: number; + diverged: number; + divergenceRate: number; + totalCostUsd?: number | null; + avgDurationMs?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomesFilter". + */ +export interface OutcomesFilter { + since?: string | null; + until?: string | null; + agentId?: string | null; + origin?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "OutcomesResponse". + */ +export interface OutcomesResponse { + filter: OutcomesFilter; + totals: OutcomeBucket; + byAgent: { + [k: string]: OutcomeBucket; + }; + byExecutor: { + [k: string]: OutcomeBucket; + }; + byDay: { + [k: string]: OutcomeBucket; + }; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverview". + */ +export interface MeshOverview { + updatedAt: number; + nodes: MeshOverviewNode[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshOverviewNode". + */ +export interface MeshOverviewNode { + id: string; + name: string; + denUrl: string; + online: boolean; + sessions?: number | null; + latest?: MeshLatest | null; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshLatest". + */ +export interface MeshLatest { + activity: Activity; + title: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "NodeCapabilities". + */ +export interface NodeCapabilities { + subsystems: Subsystems; + harnesses: HarnessCapability[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "Subsystems". + */ +export interface Subsystems { + den: boolean; + devices: boolean; + mesh: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessCapability". + */ +export interface HarnessCapability { + harnessId: HarnessId; + list: boolean; + read: boolean; + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessInspectCapability". + */ +export interface HarnessInspectCapability { + list: boolean; + read: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HarnessDriveCapability". + */ +export interface HarnessDriveCapability { + drive: boolean; + resume: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MeshDevice". + */ +export interface MeshDevice { + id: string; + name: string; + publicKey: string; + address: string; + createdAt: number; + enrolledAt?: number | null; + lastHandshake?: number | null; + pgRole?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceListResponse". + */ +export interface DeviceListResponse { + devices: MeshDevice[]; + pending: PendingEnrollment[]; + relayConfigured: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PendingEnrollment". + */ +export interface PendingEnrollment { + id: string; + name: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StoredPending". + */ +export interface StoredPending { + id: string; + name: string; + token: string; + address: string; + createdAt: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceRosterFile". + */ +export interface DeviceRosterFile { + v: number; + devices: MeshDevice[]; + pending: StoredPending[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateRequest". + */ +export interface DeviceCreateRequest { + name: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "rivet-mesh-enroll". + */ +export interface RivetMeshEnroll { + v: number; + gateway: string; + token: string; + config: DeviceEnrollConfig; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollConfig". + */ +export interface DeviceEnrollConfig { + sharedHost: string; + sharedExport: string; + pgUrl: string; + embedUrl: string; + wgEndpoint: string; + wgPeerPublicKey: string; + wgAddress: string; + wgAllowedIps: string; + homeSubnet: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceCreateResponse". + */ +export interface DeviceCreateResponse { + pending: PendingEnrollment; + qr: RivetMeshEnroll; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EnrolledDevice". + */ +export interface EnrolledDevice { + id: string; + name: string; + address: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SignedCertificate". + */ +export interface SignedCertificate { + leaf: string; + chain: string[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollResponse". + */ +export interface DeviceEnrollResponse { + ok: boolean; + device: EnrolledDevice; + config: DeviceEnrollConfig; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemResponse". + */ +export interface PairRedeemResponse { + deviceId: string; + certificate: SignedCertificate; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairingRecord". + */ +export interface PairingRecord { + v: number; + deviceId: string; + name: string; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceEnrollRequest". + */ +export interface DeviceEnrollRequest { + token?: string | null; + publicKey?: string | null; + name?: string | null; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingCode". + */ +export interface PhonePairingCode { + deviceId: string; + gateway: string; + expiresAt: number; + qrText: string; + reshown: number; + addedToUsers: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingStatus". + */ +export interface PhonePairingStatus { + state: PhonePairingState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingAvailability". + */ +export interface PhonePairingAvailability { + available: boolean; + reason?: string | null; + gateway?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PhonePairingRequest". + */ +export interface PhonePairingRequest { + name: string; + host?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AudioStatus". + */ +export interface AudioStatus { + enabled: boolean; + backend: AudioBackend; + device: string; + sampleRate: number; + channels: number; + format: AudioFormat; + fifoPath: string; + armed: boolean; + publisherId?: string | null; + armedAt?: number | null; + bytesWritten: number; + runtimeReady: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "AudioHealth". + */ +export interface AudioHealth { + ok: boolean; + runtimeReady: boolean; + fifoPath: string; + message?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceSpeakRequest". + */ +export interface VoiceSpeakRequest { + input: string; + instructions?: string | null; + voice?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "VoiceTranscribeResponse". + */ +export interface VoiceTranscribeResponse { + text: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DeviceFileEntry". + */ +export interface DeviceFileEntry { + name: string; + type: FileEntryKind; + size: number; + mtime: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FilesListResponse". + */ +export interface FilesListResponse { + path: string; + root: string; + entries: DeviceFileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StagedUploadResponse". + */ +export interface StagedUploadResponse { + uri: string; + name: string; + mime: string; + size: number; + expiresAt: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileEntry". + */ +export interface FileEntry { + name: string; + type: FileKind; + size: number; + mtime: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileList". + */ +export interface FileList { + path: string; + root: string; + entries: FileEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "FileChanged". + */ +export interface FileChanged { + ok: boolean; + path: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchToolArgs". + */ +export interface MemorySearchToolArgs { + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + expand?: boolean | null; + synthesize?: boolean | null; + query: string; + mode?: SearchMode | null; + scope?: MemoryScope | null; + limit?: number | null; + agent?: string | null; + role?: Role | null; + tool_name?: string | null; + tag?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchHit". + */ +export interface MemorySearchHit { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + createdAt: string; + score: number; + role?: Role | null; + agent?: string | null; + kind?: SummaryKind | null; + toolName?: string | null; + conversationId?: string | null; + sessionId?: string | null; + fallback?: MemoryFallback | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryChunkMatch". + */ +export interface MemoryChunkMatch { + index: number; + total: number; + charStart: number; + charEnd: number; + content: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagWire". + */ +export interface TagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryDegraded". + */ +export interface MemoryDegraded { + reason: string; + effect: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySearchResponse". + */ +export interface MemorySearchResponse { + query: string; + scope: MemoryScope; + degraded?: MemoryDegraded | null; + fallback?: MemoryFallback | null; + results: MemorySearchHit[]; + expanded?: MemoryEntry[]; + synthesis?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryEntry". + */ +export interface MemoryEntry { + id?: string | null; + sessionId: string; + agent: string; + channel: string; + role: Role; + content: string; + toolName?: string | null; + toolArgs?: { + [k: string]: unknown; + } | null; + toolResult?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseToolArgs". + */ +export interface MemoryBrowseToolArgs { + conversation_id?: string | null; + include_tools?: boolean | null; + since?: string | null; + before?: string | null; + window?: BrowseWindow | null; + agent?: string | null; + tag?: string | null; + limit?: number | null; + order?: MemoryBrowseOrder | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryAppendToolArgs". + */ +export interface MemoryAppendToolArgs { + session_id: string; + content: string; + role: Role; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + event_id?: string | null; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestMessage". + */ +export interface MemoryIngestMessage { + role: Role; + content: string; + created_at?: string | null; + tool_calls?: MemoryIngestToolCall[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestToolCall". + */ +export interface MemoryIngestToolCall { + id?: string | null; + name: string; + input?: { + [k: string]: unknown; + } | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryIngestSessionToolArgs". + */ +export interface MemoryIngestSessionToolArgs { + session_id: string; + messages: MemoryIngestMessage[]; + agent?: string | null; + persona?: string | null; + source?: string | null; + channel?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryGetFullToolArgs". + */ +export interface MemoryGetFullToolArgs { + id?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsToolArgs". + */ +export interface MemoryTagsToolArgs { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + key?: string | null; + value?: string | null; + tag?: string | null; + display?: string | null; + state?: TagState | null; + ids?: string[] | null; + session_keys?: string[] | null; + entries?: TagEntryPair[] | null; + parent_value?: string | null; + aliases?: string[] | null; + from?: string | null; + into?: string | null; + reason?: string | null; + decided_by?: string | null; + limit?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagEntryPair". + */ +export interface TagEntryPair { + key: string; + value: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryToolResponse". + */ +export interface MemoryToolResponse { + ok: boolean; + result: ToolResult; +} +export interface MediaFields { + type: "image"; +} +export interface MediaFields1 { + type: "video"; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MediaFields". + */ +export interface MediaFields2 { + data?: string | null; + url?: string | null; + mimeType?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseMessage". + */ +export interface MemoryBrowseMessage { + id: string; + role: Role; + agent?: string | null; + content: string; + createdAt: string; + conversationId?: string | null; + sessionId?: string | null; + toolName?: string | null; + tags?: TagWire[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryBrowseResponse". + */ +export interface MemoryBrowseResponse { + messages: MemoryBrowseMessage[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryNode". + */ +export interface MemorySummaryNode { + id: string; + parentId?: string | null; + level: number; + kind: SummaryKind; + content: string; + messageCount: number; + earliestAt?: string | null; + latestAt?: string | null; + createdAt: string; + sourceMessageIds: string[]; + vector: VectorState; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryMessageTally". + */ +export interface MemoryMessageTally { + total: number; + user: number; + assistant: number; + system: number; + tool: number; + embedded: number; + pending: number; + failed: number; + skipped: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemorySummaryDagResponse". + */ +export interface MemorySummaryDagResponse { + sessionId: string; + summaries: MemorySummaryNode[]; + messages: MemoryMessageTally; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopTool". + */ +export interface TopTool { + tool: string; + count: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RecentSession". + */ +export interface RecentSession { + sessionId: string; + title?: string | null; + agent: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryStatsResponse". + */ +export interface MemoryStatsResponse { + conversations: number; + messages: number; + toolCalls: number; + summaries: number; + embedQueueDepth: number; + embeddedMessages: number; + failedEmbeddings: number; + topTools: TopTool[]; + recentSessions: RecentSession[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EmbedHealth". + */ +export interface EmbedHealth { + status: EmbedStatus; + error?: string | null; + impact?: string | null; + checkedAt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryHealthResponse". + */ +export interface MemoryHealthResponse { + observedAt?: string | null; + queueStatus?: QueueStatus | null; + queues?: QueueHealth | null; + compaction?: SummarizerHealth | null; + failedEmbeddings?: number | null; + skippedEmbeddings?: number | null; + capture?: CaptureHealth | null; + status: MemoryHealthStatus; + embeddings: EmbedHealth; + embedQueueDepth: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "QueueHealth". + */ +export interface QueueHealth { + task: string; + pending: number; + running: number; + scheduled: number; + dead: number; + oldestPendingMinutes?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SummarizerHealth". + */ +export interface SummarizerHealth { + eligible: boolean; + activeTail: boolean; + belowFloor: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CaptureHealth". + */ +export interface CaptureHealth { + status: CaptureStatus; + impact: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagWire". + */ +export interface PendingTagWire { + id: string; + entityType: TagEntityType; + entityId: string; + key: string; + value: string; + display: string; + source: string; + state: TagState; + confidence?: number | null; + proposedBy: string; + reason: string; + decidedBy?: string | null; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; + action?: PendingTagAction | null; + sessionKey?: string | null; + title?: string | null; + agent?: string | null; + conversationId?: string | null; + excerpt?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsDecideRequest". + */ +export interface MemoryTagsDecideRequest { + ids?: string[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsAddRequest". + */ +export interface MemoryTagsAddRequest { + entity_type?: string | null; + entity_id?: string | null; + session_key?: string | null; + agent?: string | null; + tag?: string | null; + key?: string | null; + value?: string | null; + display?: string | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MemoryTagsLookupRequest". + */ +export interface MemoryTagsLookupRequest { + session_keys?: string[] | null; + states?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyEntry". + */ +export interface TagTaxonomyEntry { + key: string; + value: string; + display: string; + parentValue?: string | null; + aliases: string[]; + state: TagState; + source: string; + reason: string; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyWire". + */ +export interface TagTaxonomyWire { + key: string; + entries: TagTaxonomyEntry[]; + decidedAt?: string | null; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertRequest". + */ +export interface TagTaxonomyUpsertRequest { + key?: string | null; + value?: string | null; + display?: string | null; + parent_value?: string | null; + aliases?: string[] | null; + reason?: string | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyDecideRequest". + */ +export interface TagTaxonomyDecideRequest { + entries?: TagEntryPair[] | null; + state?: TagState | null; + decided_by?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMerge". + */ +export interface TagTaxonomyMerge { + key: string; + from: string; + into: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMergeRequest". + */ +export interface TagTaxonomyMergeRequest { + key?: string | null; + from?: string | null; + into?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyMergeResult". + */ +export interface TagTaxonomyMergeResult { + moved: number; + dropped: number; + into: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagCount". + */ +export interface TagCount { + key: string; + value: string; + display: string; + conversations: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagListResult". + */ +export interface TagListResult { + tags: TagWire[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PendingTagListResult". + */ +export interface PendingTagListResult { + tags: PendingTagWire[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagCountsResult". + */ +export interface TagCountsResult { + counts: TagCount[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyListResult". + */ +export interface TagTaxonomyListResult { + entries: TagTaxonomyEntry[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagDecisionResult". + */ +export interface TagDecisionResult { + changed: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagAddResult". + */ +export interface TagAddResult { + tag: TagWire; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagLookupResult". + */ +export interface TagLookupResult { + sessions: { + [k: string]: TagWire[]; + }; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TagTaxonomyUpsertResult". + */ +export interface TagTaxonomyUpsertResult { + entry: TagTaxonomyEntry; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ProjectRuleResult". + */ +export interface ProjectRuleResult { + key: string; + rule: ProjectRule; + gitRoot?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "HealthzResponse". + */ +export interface HealthzResponse { + ok: boolean; + sessions: number; + name: string; + node: string; + degraded?: string | null; + degradedProviders?: DegradedProvider[]; + version?: string | null; + revision?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "DegradedProvider". + */ +export interface DegradedProvider { + id: string; + recovery: ProviderRecovery; + reason: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "GatewayError". + */ +export interface GatewayError { + error: string; + detail?: string | null; + hint?: string | null; + code?: string | null; + harnessId?: HarnessId | null; + node?: string | null; + retryable?: boolean | null; + reason?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "OkReply". + */ +export interface OkReply { + ok: boolean; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "EventsIngested". + */ +export interface EventsIngested { + ok: boolean; + ingested: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PairRedeemRequest". + */ +export interface PairRedeemRequest { + token: string; + csr?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RosterFile". + */ +export interface RosterFile { + default: string; + cwd: string | null; + env: { + [k: string]: string; + }; + commands: { + [k: string]: RosterEntry; + }; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "RosterEntry". + */ +export interface RosterEntry { + label: string; + cmd: string[]; + room: boolean | null; + cwd: string | null; + env: { + [k: string]: string; + }; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptTurn". + */ +export interface TranscriptTurn { + role: Role; text: string; - attachments?: UserTurnAttachment[] | null; + ts?: number | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TranscriptResponse". + */ +export interface TranscriptResponse { + id: string; + command: string; + turns: TranscriptTurn[]; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSummary". + */ +export interface SessionSummary { + id: string; + lastActive: number; + messages: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionList". + */ +export interface SessionList { + sessions: SessionSummary[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MessageList". + */ +export interface MessageList { + messages: SessionMessage[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionMessage". + */ +export interface SessionMessage { + id: string; + sessionId: string; + role: SessionMessageRole; + text: string; + ts: number; + usage?: MessageUsage | null; + model?: string | null; + durationMs?: number | null; + thinking?: boolean | null; + tools?: string[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "MessageUsage". + */ +export interface MessageUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostRequest". + */ +export interface SessionPostRequest { + excludeTools?: string[] | null; + text: string; + userId?: string | null; + agent?: string | null; + thinking?: ThinkingLevel | null; systemPrompt?: string | null; - bypassDialogGate?: boolean | null; + attachments?: UserTurnAttachment[] | null; + harness?: HarnessId | null; + model?: string | null; + workingDir?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostAccepted". + */ +export interface SessionPostAccepted { + accepted: boolean; + session: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionPostReply". + */ +export interface SessionPostReply { + message: SessionMessage; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSteerRequest". + */ +export interface SessionSteerRequest { + text: string; + attachments?: UserTurnAttachment[] | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSteerResponse". + */ +export interface SessionSteerResponse { + outcome: SteerOutcome; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionWsClientMessage". + */ +export interface SessionWsClientMessage { + type: SessionClientKind; + session: string; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "StreamEvent". + */ +export interface StreamEvent { + type: StreamEventKind; + content: string; + metadata?: { + [k: string]: unknown; + } | null; +} +export interface TranscriptWsFrame { + kind: "transcript"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SendUserTurnResult". + * via the `definition` "HarnessTranscriptTurn". */ -export interface SendUserTurnResult { - dismissedDialog?: boolean | null; +export interface HarnessTranscriptTurn { + role: SessionMessageRole; + text: string; + thinking?: string | null; + tools?: HarnessTranscriptTool[] | null; + usage?: MessageUsage | null; + model?: string | null; + stopReason?: string | null; + lastBlock?: TranscriptBlock | null; + attachments?: TranscriptAttachment[] | null; + complete?: boolean; + compact?: boolean; + startedAtMs?: number | null; + endedAtMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "preset". + * via the `definition` "HarnessTranscriptTool". */ -export interface Preset { - id: string; +export interface HarnessTranscriptTool { name: string; - node: string; - local: boolean; - harnessId?: HarnessId | null; - model?: string | null; - directory?: string | null; - implemented?: boolean | null; - gap?: string | null; + status: TranscriptToolStatus; + args?: { + [k: string]: unknown; + } | null; + id?: string | null; + input?: { + [k: string]: unknown; + } | null; + resultText?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogNode". + * via the `definition` "TranscriptAttachment". */ -export interface CatalogNode { - id: string; - node: string; - local: boolean; - provider?: string | null; - model?: string | null; +export interface TranscriptAttachment { + mediaType: string; + name?: string | null; + uri?: string | null; + uploadId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". + * via the `definition` "TranscriptWsFrame". */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; +export interface TranscriptWsFrame1 { + session: string; + rev: number; + from: number; + turns: HarnessTranscriptTurn[]; + total: number; + command: string; + truncatedBefore?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". + * via the `definition` "HarnessSessionTranscriptResponse". */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; +export interface HarnessSessionTranscriptResponse { + sessionId: SessionId; + harnessId: HarnessId; + turns: HarnessTranscriptTurn[]; + contextWindow: number; + compactAt: number; + contextSource: ContextSource; + redirectedTo?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". + * via the `definition` "SessionPreview". */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; +export interface SessionPreview { + sessionId: SessionId; + kind: SessionPreviewKind; + text: string; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". + * via the `definition` "SessionPreviewList". */ -export interface CatalogSkillEntry { - name: string; - description: string; +export interface SessionPreviewList { + previews: SessionPreview[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". + * via the `definition` "HarnessTurnAccepted". */ -export interface CatalogSheet { - node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; +export interface HarnessTurnAccepted { + ok: boolean; + sessionId: SessionId; + redirectedTo?: SessionId | null; + dismissedDialog?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogAgentsResponse". + * via the `definition` "HarnessSessionResponse". */ -export interface CatalogAgentsResponse { - agents: CatalogAgent[]; +export interface HarnessSessionResponse { + sessionId: SessionId; + harnessId: HarnessId; + title?: string | null; + cwd?: string | null; + createdAt: Millis; + updatedAt: Millis; + status: HarnessSessionStatus; + blocked?: boolean | null; + supersedes?: SessionId | null; + model?: string | null; + parentSessionId?: SessionId | null; + agentName?: string | null; + taskId?: string | null; + effort?: string | null; + transport?: Transport | null; + startupContext?: StartupContext | null; + redirectedTo?: SessionId | null; + switches?: SessionSwitches | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". + * via the `definition` "StartupContext". */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; +export interface StartupContext { + topicId: string; + sections: StartupSection[]; + tokens: number; + deliveredVia: DeliveredVia; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". + * via the `definition` "StartupSection". */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; +export interface StartupSection { + kind: StartupKind; + title: string; + text: string; + sources: StartupSource[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". + * via the `definition` "SessionSwitches". */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; - }; - byExecutor: { - [k: string]: OutcomeBucket; - }; - byDay: { - [k: string]: OutcomeBucket; - }; +export interface SessionSwitches { + model: boolean; + effort: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverview". + * via the `definition` "HarnessSessionTitleRequest". */ -export interface MeshOverview { - updatedAt: number; - nodes: MeshOverviewNode[]; +export interface HarnessSessionTitleRequest { + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshOverviewNode". + * via the `definition` "HarnessSessionForkRequest". */ -export interface MeshOverviewNode { - id: string; - name: string; - denUrl: string; - online: boolean; - sessions?: number | null; - latest?: MeshLatest | null; +export interface HarnessSessionForkRequest { + prompts: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshLatest". + * via the `definition` "HarnessToolOutput". */ -export interface MeshLatest { - activity: Activity; - title: string; +export interface HarnessToolOutput { + text: string; + isError: boolean; + truncated: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "NodeCapabilities". + * via the `definition` "TermSpawnRequest". */ -export interface NodeCapabilities { - subsystems: Subsystems; - harnesses: HarnessCapability[]; +export interface TermSpawnRequest { + command?: string | null; + model?: string | null; + effort?: string | null; + session?: string | null; + resume?: string | null; + agentId?: string | null; + force?: boolean | null; + cols?: number | null; + rows?: number | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Subsystems". + * via the `definition` "TermAttachInfo". */ -export interface Subsystems { - den: boolean; - devices: boolean; - mesh: boolean; +export interface TermAttachInfo { + socket: string; + session: string; + host: string; + sshUser: string; + local: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapability". + * via the `definition` "TermSpawnResponse". */ -export interface HarnessCapability { - harnessId: HarnessId; - list: boolean; - read: boolean; - drive: boolean; - resume: boolean; +export interface TermSpawnResponse { + harnessSessionId?: SessionId | null; + id: string; + denSession: string; + command: string; + cwd?: string | null; + pid: number; + createdAt: number; + mux?: Mux | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessInspectCapability". + * via the `definition` "PtyInfo". */ -export interface HarnessInspectCapability { - list: boolean; - read: boolean; +export interface PtyInfo { + id: string; + denSession: string; + command: string; + state: PtyState; + pid?: number | null; + attached: number; + exitCode?: number | null; + createdAt: number; + lastOutputTs?: number | null; + cols?: number | null; + rows?: number | null; + mux?: Mux | null; + persisted?: boolean | null; + reattached?: boolean | null; + attach?: TermAttachInfo | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PtyList". + */ +export interface PtyList { + ptys: PtyInfo[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessDriveCapability". + * via the `definition` "TermCommand". */ -export interface HarnessDriveCapability { - drive: boolean; - resume: boolean; +export interface TermCommand { + id: string; + label: string; + room: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MeshDevice". + * via the `definition` "TermConfig". */ -export interface MeshDevice { - id: string; - name: string; - publicKey: string; - address: string; - createdAt: number; - enrolledAt?: number | null; - lastHandshake?: number | null; - pgRole?: string | null; +export interface TermConfig { + enabled: boolean; + default: string; + maxPtys: number; + active: number; + commands: TermCommand[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceListResponse". + * via the `definition` "TermInjectRequest". */ -export interface DeviceListResponse { - devices: MeshDevice[]; - pending: PendingEnrollment[]; - relayConfigured: boolean; +export interface TermInjectRequest { + session: string; + text: string; + submit?: boolean | null; + interrupt?: boolean | null; + bypassDialogGate?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingEnrollment". + * via the `definition` "TermInjectResponse". */ -export interface PendingEnrollment { - id: string; - name: string; - address: string; - createdAt: number; - expiresAt: number; +export interface TermInjectResponse { + ok: boolean; + ptyId: string; + dismissedDialog?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StoredPending". + * via the `definition` "DeviceOwner". */ -export interface StoredPending { - id: string; - name: string; - token: string; - address: string; - createdAt: number; - expiresAt: number; +export interface DeviceOwner { + device?: string | null; + self: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceRosterFile". + * via the `definition` "UploadCreated". */ -export interface DeviceRosterFile { - v: number; - devices: MeshDevice[]; - pending: StoredPending[]; +export interface UploadCreated { + id: string; + uri: string; + name: string; + bytes: number; + mediaType: string; + expiresAt: string; + session?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateRequest". + * via the `definition` "UploadList". */ -export interface DeviceCreateRequest { - name: string | null; +export interface UploadList { + uploads: UploadCreated[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "rivet-mesh-enroll". + * via the `definition` "UsersRegistry". */ -export interface RivetMeshEnroll { - v: number; - gateway: string; - token: string; - config: DeviceEnrollConfig; +export interface UsersRegistry { + ownerUserId: string; + unmappedIsOwner: boolean; + localStores?: boolean | null; + users: { + [k: string]: UserRecord; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollConfig". + * via the `definition` "UserRecord". */ -export interface DeviceEnrollConfig { - sharedHost: string; - sharedExport: string; - pgUrl: string; - embedUrl: string; - wgEndpoint: string; - wgPeerPublicKey: string; - wgAddress: string; - wgAllowedIps: string; - homeSubnet: string; +export interface UserRecord { + id?: string | null; + devices?: string[] | null; + pgUrl?: string | null; + envFile?: string | null; + persona?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceCreateResponse". + * via the `definition` "ChatRequest". */ -export interface DeviceCreateResponse { - pending: PendingEnrollment; - qr: RivetMeshEnroll; +export interface ChatRequest { + model: string; + messages: OpenAiMessage[]; + stream: boolean | null; + max_tokens: number | null; + stream_options: StreamOptions | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EnrolledDevice". + * via the `definition` "OpenAiMessage". */ -export interface EnrolledDevice { - id: string; - name: string; - address: string; +export interface OpenAiMessage { + role: Role; + content: string | null; + reasoning_content?: string | null; + tool_calls?: MessageToolCall[] | null; + tool_call_id?: string | null; +} +export interface StreamedPlainToolCall { + type: "function"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SignedCertificate". + * via the `definition` "StreamOptions". */ -export interface SignedCertificate { - leaf: string; - chain: string[]; +export interface StreamOptions { + include_usage: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollResponse". + * via the `definition` "FunctionDelta". */ -export interface DeviceEnrollResponse { - ok: boolean; - device: EnrolledDevice; - config: DeviceEnrollConfig; - certificate: SignedCertificate; +export interface FunctionDelta { + name?: string | null; + arguments?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemResponse". + * via the `definition` "StreamedPlainToolCall". */ -export interface PairRedeemResponse { - deviceId: string; - certificate: SignedCertificate; +export interface StreamedPlainToolCall1 { + index?: number | null; + id?: string | null; + function: FunctionDelta; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairingRecord". + * via the `definition` "chat.completion". */ -export interface PairingRecord { - v: number; - deviceId: string; - name: string; - expiresAt: number; +export interface ChatCompletion { + id: string; + created: number; + model: string; + choices: CompletionChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceEnrollRequest". + * via the `definition` "CompletionChoice". */ -export interface DeviceEnrollRequest { - token?: string | null; - publicKey?: string | null; - name?: string | null; - csr?: string | null; +export interface CompletionChoice { + index: number; + message: OpenAiMessage; + finish_reason: FinishReason; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingCode". + * via the `definition` "Usage". */ -export interface PhonePairingCode { - deviceId: string; - gateway: string; - expiresAt: number; - qrText: string; - reshown: number; - addedToUsers: boolean; +export interface Usage { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; + prompt_tokens_details?: PromptTokensDetails | null; + completion_tokens_details?: CompletionTokensDetails | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingStatus". + * via the `definition` "PromptTokensDetails". */ -export interface PhonePairingStatus { - state: PhonePairingState; +export interface PromptTokensDetails { + cached_tokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingAvailability". + * via the `definition` "CompletionTokensDetails". */ -export interface PhonePairingAvailability { - available: boolean; - reason?: string | null; - gateway?: string | null; +export interface CompletionTokensDetails { + reasoning_tokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PhonePairingRequest". + * via the `definition` "chat.completion.chunk". */ -export interface PhonePairingRequest { - name: string; - host?: string | null; +export interface ChatCompletionChunk { + id: string; + created: number; + model: string; + choices: ChunkChoice[]; + usage?: Usage | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AudioStatus". + * via the `definition` "ChunkChoice". */ -export interface AudioStatus { - enabled: boolean; - backend: AudioBackend; - device: string; - sampleRate: number; - channels: number; - format: AudioFormat; - fifoPath: string; - armed: boolean; - publisherId?: string | null; - armedAt?: number | null; - bytesWritten: number; - runtimeReady: boolean; +export interface ChunkChoice { + index: number; + delta: CompletionDelta; + finish_reason: FinishReason | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AudioHealth". - */ -export interface AudioHealth { - ok: boolean; - runtimeReady: boolean; - fifoPath: string; - message?: string | null; + * via the `definition` "CompletionDelta". + */ +export interface CompletionDelta { + role?: Role | null; + content?: string | null; + reasoning_content?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceSpeakRequest". + * via the `definition` "list". */ -export interface VoiceSpeakRequest { - input: string; - instructions?: string | null; - voice?: string | null; +export interface List { + data: Model[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "VoiceTranscribeResponse". + * via the `definition` "model". */ -export interface VoiceTranscribeResponse { - text: string; +export interface Model { + id: string; + created: number; + owned_by: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceFileEntry". + * via the `definition` "ErrorDetail". */ -export interface DeviceFileEntry { - name: string; - type: FileEntryKind; - size: number; - mtime: string; +export interface ErrorDetail { + message: string; + type: ErrorKind; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FilesListResponse". + * via the `definition` "ErrorResponse". */ -export interface FilesListResponse { - path: string; - root: string; - entries: DeviceFileEntry[]; +export interface ErrorResponse { + error: ErrorDetail; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StagedUploadResponse". + * via the `definition` "Conversation". */ -export interface StagedUploadResponse { - uri: string; - name: string; - mime: string; - size: number; - expiresAt: number; +export interface Conversation { + id: string; + title: string; + createdAt: number; + updatedAt: number; + messages: OpenAiMessage[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileEntry". + * via the `definition` "Conversations". */ -export interface FileEntry { - name: string; - type: FileKind; - size: number; - mtime: number; +export interface Conversations { + conversations: Conversation[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileList". + * via the `definition` "ConversationTitle". */ -export interface FileList { - path: string; - root: string; - entries: FileEntry[]; +export interface ConversationTitle { + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FileChanged". + * via the `definition` "WikiQuery". */ -export interface FileChanged { - ok: boolean; - path: string; +export interface WikiQuery { + q: string | null; + tag: string | null; + limit: number | null; + offset: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchToolArgs". + * via the `definition` "WikiPageQuery". */ -export interface MemorySearchToolArgs { - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - expand?: boolean | null; - synthesize?: boolean | null; - query: string; - mode?: SearchMode | null; - scope?: MemoryScope | null; - limit?: number | null; - agent?: string | null; - tag?: string | null; +export interface WikiPageQuery { + slug: WikiSlug; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchHit". + * via the `definition` "WikiHistoryEntry". */ -export interface MemorySearchHit { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - createdAt: string; - score: number; - role?: Role | null; - agent?: string | null; - kind?: SummaryKind | null; - toolName?: string | null; - conversationId?: string | null; - sessionId?: string | null; - fallback?: MemoryFallback | null; - tags?: TagWire[] | null; +export interface WikiHistoryEntry { + date: string; + title: string; + body: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryChunkMatch". + * via the `definition` "WikiCitation". */ -export interface MemoryChunkMatch { - index: number; - total: number; - charStart: number; - charEnd: number; - content: string; +export interface WikiCitation { + summaryId: string; + date?: Millis | null; + kind?: string | null; + note?: string | null; + conversationId?: string | null; + sessionId?: SessionId | null; + title?: string | null; + channel?: string | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagWire". + * via the `definition` "WikiSource". */ -export interface TagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface WikiSource { + kind: WikiSourceKind; + ids: string[]; + conversationId?: string | null; + span?: WikiSourceSpan | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryDegraded". + * via the `definition` "WikiSourceSpan". */ -export interface MemoryDegraded { - reason: string; - effect: string; +export interface WikiSourceSpan { + earliest: Millis; + latest: Millis; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResponse". + * via the `definition` "WikiPageResponse". */ -export interface MemorySearchResponse { - query: string; - scope: MemoryScope; - degraded?: MemoryDegraded | null; - fallback?: MemoryFallback | null; - results: MemorySearchHit[]; - expanded?: MemoryEntry[]; - synthesis?: string | null; +export interface WikiPageResponse { + slug: string; + title: string; + aliases: string[]; + tags: string[]; + entities: string[]; + currentState: string; + article?: string | null; + seeAlso?: string[] | null; + history: WikiHistoryEntry[]; + citations: WikiCitation[]; + markdown: string; + sources: WikiSource[]; + gitSha?: string | null; + lastVerified?: Millis | null; + updatedAt: Millis; + related?: string[] | null; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryEntry". + * via the `definition` "WikiMissSuggestion". */ -export interface MemoryEntry { - id?: string | null; - sessionId: string; - agent: string; - channel: string; - role: Role; - content: string; - toolName?: string | null; - toolArgs?: { - [k: string]: unknown; - } | null; - toolResult?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - createdAt?: string | null; +export interface WikiMissSuggestion { + slug: string; + title: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseToolArgs". + * via the `definition` "WikiMissBody". */ -export interface MemoryBrowseToolArgs { - conversation_id?: string | null; - include_tools?: boolean | null; - since?: string | null; - before?: string | null; - window?: BrowseWindow | null; - agent?: string | null; - tag?: string | null; - limit?: number | null; - order?: MemoryBrowseOrder | null; +export interface WikiMissBody { + error: string; + suggestions: WikiMissSuggestion[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryAppendToolArgs". + * via the `definition` "WikiRedLink". */ -export interface MemoryAppendToolArgs { - session_id: string; - content: string; - role: Role; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - event_id?: string | null; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface WikiRedLink { + entity: string; + referencedBy: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestMessage". + * via the `definition` "WikiGapsResponse". */ -export interface MemoryIngestMessage { - role: Role; - content: string; - created_at?: string | null; - tool_calls?: MemoryIngestToolCall[] | null; +export interface WikiGapsResponse { + redLinks: WikiRedLink[]; + stalest: WikiTopic[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestToolCall". + * via the `definition` "WikiTopic". */ -export interface MemoryIngestToolCall { - id?: string | null; - name: string; - input?: { - [k: string]: unknown; - } | null; +export interface WikiTopic { + slug: string; + title: string; + tags: string[]; + entities: string[]; + updatedAt: Millis; + excerpt: string; + topicId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryIngestSessionToolArgs". + * via the `definition` "WikiTopicList". */ -export interface MemoryIngestSessionToolArgs { - session_id: string; - messages: MemoryIngestMessage[]; - agent?: string | null; - persona?: string | null; - source?: string | null; - channel?: string | null; +export interface WikiTopicList { + topics: WikiTopic[]; + total: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryGetFullToolArgs". + * via the `definition` "TidySample". */ -export interface MemoryGetFullToolArgs { - id?: string | null; +export interface TidySample { + id: string; + title?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsToolArgs". + * via the `definition` "TidyEvidence". */ -export interface MemoryTagsToolArgs { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - key?: string | null; - value?: string | null; - tag?: string | null; - display?: string | null; - state?: TagState | null; - ids?: string[] | null; - session_keys?: string[] | null; - entries?: TagEntryPair[] | null; - parent_value?: string | null; - aliases?: string[] | null; - from?: string | null; - into?: string | null; - reason?: string | null; - decided_by?: string | null; - limit?: number | null; +export interface TidyEvidence { + sessions: number; + samples: TidySample[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagEntryPair". + * via the `definition` "TidyProposal". */ -export interface TagEntryPair { - key: string; - value: string; +export interface TidyProposal { + id: string; + batchId: string; + change: TidyChange; + reason: string; + evidence: TidyEvidence; + proposedBy: Proposer; + proposedAt: number; + state: ProposalState; + decidedAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryToolResponse". + * via the `definition` "TidyBatch". */ -export interface MemoryToolResponse { - ok: boolean; - result: ToolResult; +export interface TidyBatch { + batchId: string; + proposedBy: Proposer; + proposedAt: number; + proposals: TidyProposal[]; } -export interface MediaFields { - type: "image"; -} -export interface MediaFields1 { - type: "video"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TidyPending". + */ +export interface TidyPending { + batches: TidyBatch[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MediaFields". + * via the `definition` "TidyFailure". */ -export interface MediaFields2 { - data?: string | null; - url?: string | null; - mimeType?: string | null; +export interface TidyFailure { + proposalId: string; + error: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseMessage". + * via the `definition` "TidyBatchDecision". */ -export interface MemoryBrowseMessage { - id: string; - role: Role; - agent?: string | null; - content: string; - createdAt: string; - conversationId?: string | null; - sessionId?: string | null; - toolName?: string | null; - tags?: TagWire[] | null; +export interface TidyBatchDecision { + decided: TidyProposal[]; + failed: TidyFailure[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryBrowseResponse". + * via the `definition` "FilingUpkeep". */ -export interface MemoryBrowseResponse { - messages: MemoryBrowseMessage[]; +export interface FilingUpkeep { + categorizer: number; + you: number; + uncategorized: number; + leftOut: number; + correctionsLastWeek: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TopTool". + * via the `definition` "EntityTypeCount". */ -export interface TopTool { - tool: string; - count: number; +export interface EntityTypeCount { + typeId: string; + name: string; + entities: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RecentSession". + * via the `definition` "WikiUpkeep". */ -export interface RecentSession { - sessionId: string; - title?: string | null; - agent: string; - lastActive: number; - messages: number; +export interface WikiUpkeep { + topicPages: number; + entityTypes: EntityTypeCount[]; + loosePages: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryStatsResponse". + * via the `definition` "WorkerActivity". */ -export interface MemoryStatsResponse { - conversations: number; - messages: number; - toolCalls: number; - summaries: number; - embedQueueDepth: number; - embeddedMessages: number; - failedEmbeddings: number; - topTools: TopTool[]; - recentSessions: RecentSession[]; +export interface WorkerActivity { + lastFinishedAt?: number | null; + failing: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EmbedHealth". + * via the `definition` "WorkerUpkeep". */ -export interface EmbedHealth { - status: EmbedStatus; - error?: string | null; - impact?: string | null; - checkedAt?: string | null; +export interface WorkerUpkeep { + embedder: WorkerActivity; + summarizer: WorkerActivity; + categorizer: WorkerActivity; + wikiBuilder: WorkerActivity; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryHealthResponse". + * via the `definition` "MemoryUpkeep". */ -export interface MemoryHealthResponse { - observedAt?: string | null; - queueStatus?: QueueStatus | null; - queues?: QueueHealth | null; - compaction?: SummarizerHealth | null; - failedEmbeddings?: number | null; - skippedEmbeddings?: number | null; - capture?: CaptureHealth | null; - status: MemoryHealthStatus; - embeddings: EmbedHealth; - embedQueueDepth: number; +export interface MemoryUpkeep { + filing: FilingUpkeep; + wiki: WikiUpkeep; + workers: WorkerUpkeep; + pendingProposals: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "QueueHealth". + * via the `definition` "TopicRecord". */ -export interface QueueHealth { - task: string; - pending: number; - running: number; - scheduled: number; - dead: number; - oldestPendingMinutes?: number | null; +export interface TopicRecord { + id: string; + kind: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SummarizerHealth". + * via the `definition` "TopicSummary". */ -export interface SummarizerHealth { - eligible: boolean; - activeTail: boolean; - belowFloor: boolean; +export interface TopicSummary { + id: string; + kind: "work" | "type" | "entity"; + slug: string; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; + createdAt: number; + updatedAt: number; + closedAt?: number | null; + sessionCount: number; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureHealth". + * via the `definition` "TopicList". */ -export interface CaptureHealth { - status: CaptureStatus; - impact: string; +export interface TopicList { + topics: TopicSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagWire". + * via the `definition` "TopicCreateRequest". */ -export interface PendingTagWire { - id: string; - entityType: TagEntityType; - entityId: string; - key: string; - value: string; - display: string; - source: string; - state: TagState; - confidence?: number | null; - proposedBy: string; - reason: string; - decidedBy?: string | null; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; - action?: PendingTagAction | null; - sessionKey?: string | null; - title?: string | null; - agent?: string | null; - conversationId?: string | null; - excerpt?: string | null; +export interface TopicCreateRequest { + kind: "work" | "type" | "entity"; + name: string; + aliases: string[]; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsDecideRequest". + * via the `definition` "WikiPageEdit". */ -export interface MemoryTagsDecideRequest { - ids?: string[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface WikiPageEdit { + currentState?: string | null; + article?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsAddRequest". + * via the `definition` "TopicUpdate". */ -export interface MemoryTagsAddRequest { - entity_type?: string | null; - entity_id?: string | null; - session_key?: string | null; - agent?: string | null; - tag?: string | null; - key?: string | null; - value?: string | null; - display?: string | null; - reason?: string | null; - decided_by?: string | null; +export interface TopicUpdate { + name?: string | null; + aliases?: string[] | null; + parent?: string | null; + directory?: TopicDirectory | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemoryTagsLookupRequest". + * via the `definition` "TopicMergeRequest". */ -export interface MemoryTagsLookupRequest { - session_keys?: string[] | null; - states?: string[] | null; +export interface TopicMergeRequest { + into: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyEntry". + * via the `definition` "TopicPlacement". */ -export interface TagTaxonomyEntry { - key: string; - value: string; - display: string; - parentValue?: string | null; - aliases: string[]; - state: TagState; - source: string; - reason: string; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface TopicPlacement { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyWire". + * via the `definition` "TopicSuggestion". */ -export interface TagTaxonomyWire { - key: string; - entries: TagTaxonomyEntry[]; - decidedAt?: string | null; - createdAt: string; - updatedAt: string; +export interface TopicSuggestion { + name: string; + topicId?: string | null; + parentId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertRequest". + * via the `definition` "PlacementReply". */ -export interface TagTaxonomyUpsertRequest { - key?: string | null; - value?: string | null; - display?: string | null; - parent_value?: string | null; - aliases?: string[] | null; - reason?: string | null; - decided_by?: string | null; +export interface PlacementReply { + placement?: TopicPlacement | null; + suggestion?: TopicSuggestion | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyDecideRequest". + * via the `definition` "PlacementRequest". */ -export interface TagTaxonomyDecideRequest { - entries?: TagEntryPair[] | null; - state?: TagState | null; - decided_by?: string | null; +export interface PlacementRequest { + topicId: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMerge". + * via the `definition` "SessionHistoryMark". */ -export interface TagTaxonomyMerge { - key: string; - from: string; - into: string; +export interface SessionHistoryMark { + sessionId: SessionId; + markedAt: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeRequest". + * via the `definition` "SessionHistoryList". */ -export interface TagTaxonomyMergeRequest { - key?: string | null; - from?: string | null; - into?: string | null; +export interface SessionHistoryList { + sessions: SessionHistoryMark[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyMergeResult". + * via the `definition` "TopicSession". */ -export interface TagTaxonomyMergeResult { - moved: number; - dropped: number; - into: string; +export interface TopicSession { + sessionId: SessionId; + topicId: string; + by: PlacedBy; + at: number; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagCount". + * via the `definition` "TopicSessionList". */ -export interface TagCount { - key: string; - value: string; - display: string; - conversations: number; +export interface TopicSessionList { + sessions: TopicSession[]; + conversations: TopicConversation[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagListResult". + * via the `definition` "TopicConversation". */ -export interface TagListResult { - tags: TagWire[]; +export interface TopicConversation { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; + channel: string; + title?: string | null; + lastActive?: number | null; + node?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PendingTagListResult". + * via the `definition` "ConversationPlacement". */ -export interface PendingTagListResult { - tags: PendingTagWire[]; +export interface ConversationPlacement { + conversationId: string; + topicId: string; + by: PlacedBy; + at: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagCountsResult". + * via the `definition` "ConversationPlacementReply". */ -export interface TagCountsResult { - counts: TagCount[]; +export interface ConversationPlacementReply { + placement?: ConversationPlacement | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyListResult". + * via the `definition` "TopicPage". */ -export interface TagTaxonomyListResult { - entries: TagTaxonomyEntry[]; +export interface TopicPage { + topic: TopicRecord; + page?: WikiPageResponse | null; + mentions: TopicMention[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagDecisionResult". + * via the `definition` "TopicMention". */ -export interface TagDecisionResult { - changed: number; +export interface TopicMention { + topicId: string; + name: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagAddResult". + * via the `definition` "TopicDecision". */ -export interface TagAddResult { - tag: TagWire; +export interface TopicDecision { + id: string; + topicId: string; + text: string; + status: DecisionStatus; + supersededBy?: string | null; + by: string; + sessionId?: SessionId | null; + createdAt: number; + updatedAt: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagLookupResult". + * via the `definition` "TopicDecisionList". */ -export interface TagLookupResult { - sessions: { - [k: string]: TagWire[]; - }; +export interface TopicDecisionList { + decisions: TopicDecision[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TagTaxonomyUpsertResult". + * via the `definition` "DecisionCreateRequest". */ -export interface TagTaxonomyUpsertResult { - entry: TagTaxonomyEntry; +export interface DecisionCreateRequest { + text: string; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ProjectRuleResult". + * via the `definition` "DecisionUpdate". */ -export interface ProjectRuleResult { - key: string; - rule: ProjectRule; - gitRoot?: string | null; +export interface DecisionUpdate { + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HealthzResponse". + * via the `definition` "DecisionSupersedeRequest". */ -export interface HealthzResponse { - ok: boolean; - sessions: number; - name: string; - node: string; - degraded?: string | null; - degradedProviders?: DegradedProvider[]; +export interface DecisionSupersedeRequest { + text?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DegradedProvider". + * via the `definition` "DecisionSuperseded". */ -export interface DegradedProvider { - id: string; - recovery: ProviderRecovery; - reason: string; +export interface DecisionSuperseded { + superseded: TopicDecision; + replacement?: TopicDecision | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "GatewayError". + * via the `definition` "AgentUsage". */ -export interface GatewayError { - error: string; - detail?: string | null; - hint?: string | null; - code?: string | null; - harnessId?: HarnessId | null; - node?: string | null; - retryable?: boolean | null; - reason?: string | null; +export interface AgentUsage { + promptTokens: number; + completionTokens: number; + cachedTokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OkReply". + * via the `definition` "LiveSessionSummary". */ -export interface OkReply { - ok: boolean; +export interface LiveSessionSummary { + id: string; + name: string; + harness?: SessionHarness | null; + lastEventTs?: number | null; + pty?: string | null; + contextWindow?: number | null; + compactAt?: number | null; + contextSource?: ContextSource | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EventsIngested". + * via the `definition` "SessionLogLine". */ -export interface EventsIngested { - ok: boolean; - ingested: number; +export interface SessionLogLine { + who: string; + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PairRedeemRequest". + * via the `definition` "SessionView". */ -export interface PairRedeemRequest { - token: string; - csr?: string | null; +export interface SessionView { + title: string; + activity: Activity; + tool?: string | null; + tasks: string[]; + thought: string; + lastMessage: string; + log: SessionLogLine[]; + term: string[]; + ended: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RosterFile". + * via the `definition` "LiveSessionList". */ -export interface RosterFile { - default: string; - cwd: string | null; - env: { - [k: string]: string; - }; - commands: { - [k: string]: RosterEntry; - }; +export interface LiveSessionList { + sessions: LiveSessionSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "RosterEntry". + * via the `definition` "StateResponse". */ -export interface RosterEntry { - label: string; - cmd: string[]; - room: boolean | null; - cwd: string | null; - env: { - [k: string]: string; - }; +export interface StateResponse { + session: string; + state: SessionView; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptTurn". + * via the `definition` "snapshot". */ -export interface TranscriptTurn { - role: Role; - text: string; - ts?: number | null; +export interface Snapshot { + v: ProtocolVersion; + sessions: LiveSessionSummary[]; + rooms: { + [k: string]: SessionView; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptResponse". + * via the `definition` "session.removed". */ -export interface TranscriptResponse { - id: string; - command: string; - turns: TranscriptTurn[]; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface SessionRemoved { + v: ProtocolVersion; + session: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionSummary". + * via the `definition` "plugin.changed". */ -export interface SessionSummary { - id: string; - lastActive: number; - messages: number; +export interface PluginChanged { + v: ProtocolVersion; + plugin: PluginId; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionList". + * via the `definition` "plugin.views". */ -export interface SessionList { - sessions: SessionSummary[]; +export interface PluginViews { + v: ProtocolVersion; + plugin: PluginId; + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MessageList". + * via the `definition` "CaptureBatchRequest". */ -export interface MessageList { - messages: SessionMessage[]; +export interface CaptureBatchRequest { + session_key: string; + agent: string; + channel?: string | null; + title?: string | null; + settings?: { + [k: string]: unknown; + } | null; + task_id?: string | null; + finalize?: boolean | null; + created_at?: Millis | null; + updated_at?: Millis | null; + messages: CaptureMessage[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionMessage". + * via the `definition` "CaptureMessage". */ -export interface SessionMessage { - id: string; - sessionId: string; - role: SessionMessageRole; - text: string; - ts: number; - usage?: MessageUsage | null; - model?: string | null; - durationMs?: number | null; - thinking?: boolean | null; - tools?: string[] | null; +export interface CaptureMessage { + event_id: string; + role: Role; + content: string; + tool_name?: string | null; + tool_args?: { + [k: string]: unknown; + } | null; + tool_result?: string | null; + metadata?: { + [k: string]: unknown; + } | null; + created_at?: Millis | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MessageUsage". + * via the `definition` "CaptureResult". */ -export interface MessageUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface CaptureResult { + ok: boolean; + conversation_id: string; + inserted: number; + skipped: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostRequest". + * via the `definition` "HookContextBase". */ -export interface SessionPostRequest { - excludeTools?: string[] | null; - text: string; - userId?: string | null; - agent?: string | null; - thinking?: ThinkingLevel | null; - systemPrompt?: string | null; +export interface HookContextBase { + agentId?: string | null; + sessionId?: string | null; + timestamp: number; + metadata: { + [k: string]: unknown; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostAccepted". + * via the `definition` "HookUsage". */ -export interface SessionPostAccepted { - accepted: boolean; - session: string; +export interface HookUsage { + promptTokens: number; + completionTokens: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionPostReply". + * via the `definition` "SessionTokens". */ -export interface SessionPostReply { - message: SessionMessage; +export interface SessionTokens { + prompt: number; + completion: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionWsClientMessage". + * via the `definition` "TurnComplexity". */ -export interface SessionWsClientMessage { - type: SessionClientKind; - session: string; +export interface TurnComplexity { + toolCallCount: number; + hadErrorRecovery: boolean; + hadUserCorrection: boolean; + uniqueTools: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamEvent". + * via the `definition` "Message". */ -export interface StreamEvent { - type: StreamEventKind; - content: string; - metadata?: { - [k: string]: unknown; - } | null; -} -export interface TranscriptWsFrame { - kind: "transcript"; +export interface Message { + role: Role; + content: MessageContent; + reasoning?: string | null; + toolCalls?: ToolCall[] | null; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTurn". + * via the `definition` "ToolCall". */ -export interface HarnessTranscriptTurn { - role: SessionMessageRole; - text: string; - thinking?: string | null; - tools?: HarnessTranscriptTool[] | null; - usage?: MessageUsage | null; - model?: string | null; - stopReason?: string | null; - lastBlock?: TranscriptBlock | null; - complete?: boolean; - compact?: boolean; +export interface ToolCall { + id: string; + name: string; + arguments: { + [k: string]: unknown; + }; + thoughtSignature?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTranscriptTool". + * via the `definition` "HookPipelineError". */ -export interface HarnessTranscriptTool { - name: string; - status: TranscriptToolStatus; - args?: { - [k: string]: unknown; - } | null; - id?: string | null; - input?: { - [k: string]: unknown; - } | null; - resultText?: string | null; +export interface HookPipelineError { + hookId: string; + error: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TranscriptWsFrame". + * via the `definition` "HookPipelineResult". */ -export interface TranscriptWsFrame1 { - session: string; - rev: number; - from: number; - turns: HarnessTranscriptTurn[]; - total: number; - command: string; - truncatedBefore?: boolean | null; +export interface HookPipelineResult { + context: HookContext; + aborted: boolean; + skipped: boolean; + errors: HookPipelineError[]; + ran: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionTranscriptResponse". + * via the `definition` "HookConfig". */ -export interface HarnessSessionTranscriptResponse { - sessionId: SessionId; - harnessId: HarnessId; - turns: HarnessTranscriptTurn[]; - contextWindow: number; - compactAt: number; - contextSource: ContextSource; - redirectedTo?: SessionId | null; +export interface HookConfig { + id: string; + event: HookEventName; + type: HookConfigKind; + target: string; + priority?: number | null; + onError?: HookErrorMode | null; + agentFilter?: string[] | null; + toolFilter?: string[] | null; + description?: string | null; + enabled?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessTurnAccepted". + * via the `definition` "ApprovalOption". */ -export interface HarnessTurnAccepted { - ok: boolean; - sessionId: SessionId; - redirectedTo?: SessionId | null; - dismissedDialog?: boolean; +export interface ApprovalOption { + key: string; + label: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionResponse". + * via the `definition` "HarnessSessionSummary". */ -export interface HarnessSessionResponse { +export interface HarnessSessionSummary { sessionId: SessionId; harnessId: HarnessId; title?: string | null; @@ -2651,1197 +4723,1136 @@ export interface HarnessSessionResponse { taskId?: string | null; effort?: string | null; transport?: Transport | null; - redirectedTo?: SessionId | null; + startupContext?: StartupContext | null; [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnRequest". - */ -export interface TermSpawnRequest { - command?: string | null; - model?: string | null; - effort?: string | null; - session?: string | null; - resume?: string | null; - agentId?: string | null; - force?: boolean | null; - cols?: number | null; - rows?: number | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermAttachInfo". - */ -export interface TermAttachInfo { - socket: string; - session: string; - host: string; - sshUser: string; - local: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermSpawnResponse". - */ -export interface TermSpawnResponse { - harnessSessionId?: SessionId | null; - id: string; - denSession: string; - command: string; - cwd?: string | null; - pid: number; - createdAt: number; - mux?: Mux | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PtyInfo". - */ -export interface PtyInfo { - id: string; - denSession: string; - command: string; - state: PtyState; - pid?: number | null; - attached: number; - exitCode?: number | null; - createdAt: number; - lastOutputTs?: number | null; - cols?: number | null; - rows?: number | null; - mux?: Mux | null; - persisted?: boolean | null; - reattached?: boolean | null; - attach?: TermAttachInfo | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PtyList". - */ -export interface PtyList { - ptys: PtyInfo[]; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermCommand". - */ -export interface TermCommand { - id: string; - label: string; - room: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermConfig". + * via the `definition` "PlanEntry". */ -export interface TermConfig { - enabled: boolean; - default: string; - maxPtys: number; - active: number; - commands: TermCommand[]; +export interface PlanEntry { + content: string; + status: PlanStatus; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectRequest". + * via the `definition` "LlmUsage". */ -export interface TermInjectRequest { - session: string; - text: string; - submit?: boolean | null; - interrupt?: boolean | null; - bypassDialogGate?: boolean | null; +export interface LlmUsage { + promptTokens: number; + completionTokens: number; + reasoningTokens?: number | null; + cachedTokens?: number | null; + cacheCreationTokens?: number | null; + cacheReadTokens?: number | null; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TermInjectResponse". - */ -export interface TermInjectResponse { - ok: boolean; - ptyId: string; - dismissedDialog?: boolean | null; +export interface HarnessStatusFrame { + type: "status"; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "DeviceOwner". + * via the `definition` "PromptQuestion". */ -export interface DeviceOwner { - device?: string | null; - self: boolean; +export interface PromptQuestion { + question?: string | null; + header?: string | null; + multiSelect: boolean; + freeText?: boolean | null; + options: PromptOption[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UploadCreated". - */ -export interface UploadCreated { - id: string; - name: string; - bytes: number; - mediaType: string; - expiresAt: string; - session?: string | null; + * via the `definition` "PromptOption". + */ +export interface PromptOption { + label: string; + description?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UploadList". + * via the `definition` "PromptResolution". */ -export interface UploadList { - uploads: UploadCreated[]; +export interface PromptResolution { + at: number; + answerText?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UsersRegistry". + * via the `definition` "PromptScreen". */ -export interface UsersRegistry { - ownerUserId: string; - unmappedIsOwner: boolean; - localStores?: boolean | null; - users: { - [k: string]: UserRecord; - }; +export interface PromptScreen { + current: number; + total: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "UserRecord". + * via the `definition` "StatusTool". */ -export interface UserRecord { - id?: string | null; - devices?: string[] | null; - pgUrl?: string | null; - envFile?: string | null; - persona?: string | null; +export interface StatusTool { + name: string; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ChatRequest". + * via the `definition` "HarnessStatusFrame". */ -export interface ChatRequest { - model: string; - messages: OpenAiMessage[]; - stream: boolean | null; - max_tokens: number | null; - stream_options: StreamOptions | null; +export interface HarnessStatusFrame1 { + sessionId: SessionId; + status: HarnessStatus; + since: number; + source?: StatusSource | null; + phase?: StatusPhase | null; + tool?: StatusTool | null; + promptId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OpenAiMessage". + * via the `definition` "HarnessCapabilities". */ -export interface OpenAiMessage { - role: Role; - content: string | null; - reasoning_content?: string | null; - tool_calls?: MessageToolCall[] | null; - tool_call_id?: string | null; -} -export interface StreamedPlainToolCall { - type: "function"; +export interface HarnessCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; + turnOptions?: boolean | null; + launchModel?: boolean | null; + imageAttachments?: boolean | null; + models?: HarnessModelOption[] | null; + modelsSource?: HarnessModelsSource | null; + efforts?: EffortOption[] | null; + modelFlag?: string | null; + effortFlag?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamOptions". + * via the `definition` "HarnessModelOption". */ -export interface StreamOptions { - include_usage: boolean; +export interface HarnessModelOption { + inputModalities?: string[] | null; + id: string; + label: string; + isDefault?: boolean | null; + efforts?: EffortOption[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "FunctionDelta". + * via the `definition` "EffortOption". */ -export interface FunctionDelta { - name?: string | null; - arguments?: string | null; +export interface EffortOption { + id: string; + label: string; + isDefault?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StreamedPlainToolCall". + * via the `definition` "HarnessControlCapabilities". */ -export interface StreamedPlainToolCall1 { - index?: number | null; - id?: string | null; - function: FunctionDelta; +export interface HarnessControlCapabilities { + interrupt: boolean; + resume: boolean; + approvals: boolean; + steering?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion". + * via the `definition` "HarnessObservationCapabilities". */ -export interface ChatCompletion { - id: string; - created: number; - model: string; - choices: CompletionChoice[]; - usage?: Usage | null; +export interface HarnessObservationCapabilities { + liveStream: boolean; + listSessions: boolean; + drive?: boolean | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionChoice". + * via the `definition` "HarnessSessionCreateRequest". */ -export interface CompletionChoice { - index: number; - message: OpenAiMessage; - finish_reason: FinishReason; +export interface HarnessSessionCreateRequest { + harness?: HarnessId | null; + model?: string | null; + cwd?: string | null; + agentId?: string | null; + topicId?: string | null; + prompt?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Usage". + * via the `definition` "HarnessSessionList". */ -export interface Usage { - prompt_tokens: number; - completion_tokens: number; - total_tokens: number; - prompt_tokens_details?: PromptTokensDetails | null; - completion_tokens_details?: CompletionTokensDetails | null; +export interface HarnessSessionList { + sessions: HarnessSessionSummary[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptTokensDetails". + * via the `definition` "HarnessOffering". */ -export interface PromptTokensDetails { - cached_tokens: number; +export interface HarnessOffering { + harnessId: HarnessId; + chat: boolean; + capabilities: HarnessCapabilities; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionTokensDetails". + * via the `definition` "HarnessOfferingList". */ -export interface CompletionTokensDetails { - reasoning_tokens: number; +export interface HarnessOfferingList { + harnesses: HarnessOffering[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "chat.completion.chunk". + * via the `definition` "HarnessStoreSession". */ -export interface ChatCompletionChunk { +export interface HarnessStoreSession { id: string; - created: number; - model: string; - choices: ChunkChoice[]; - usage?: Usage | null; + command: RosterCommand; + title: string; + updatedAt: number; + parentSessionId?: string | null; + agentName?: string | null; + model?: string | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ChunkChoice". + * via the `definition` "HarnessStoreSessionList". */ -export interface ChunkChoice { - index: number; - delta: CompletionDelta; - finish_reason: FinishReason | null; +export interface HarnessStoreSessionList { + sessions: HarnessStoreSession[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CompletionDelta". + * via the `definition` "task.done". */ -export interface CompletionDelta { - role?: Role | null; - content?: string | null; - reasoning_content?: string | null; +export interface TaskDone { + taskId: string; + status: TaskStatus; + ts: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "list". + * via the `definition` "ContextRef". */ -export interface List { - data: Model[]; +export interface ContextRef { + kind: ContextRefKind; + ref: string; + note?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "model". + * via the `definition` "AcceptanceCriterion". */ -export interface Model { +export interface AcceptanceCriterion { id: string; - created: number; - owned_by: string; + description: string; + kind: CriterionKind; + check?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorDetail". + * via the `definition` "TaskBudget". */ -export interface ErrorDetail { - message: string; - type: ErrorKind; +export interface TaskBudget { + maxUsd?: number | null; + maxTokens?: number | null; + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ErrorResponse". + * via the `definition` "TaskUsage". */ -export interface ErrorResponse { - error: ErrorDetail; +export interface TaskUsage { + inputTokens?: number | null; + outputTokens?: number | null; + totalTokens?: number | null; + costUsd?: number | null; + turns: number; + wallClockMs: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Conversation". + * via the `definition` "TaskSpec". */ -export interface Conversation { - id: string; - title: string; - createdAt: number; - updatedAt: number; - messages: OpenAiMessage[]; +export interface TaskSpec { + delegation?: boolean | null; + meshFrom?: string | null; + taskId: string; + agentId: string; + goal: string; + resolvedContext: ContextRef[]; + acceptanceCriteria: AcceptanceCriterion[]; + budget: TaskBudget1; + tools?: string[] | null; + workingDir?: string | null; + model?: string | null; + effort?: Effort | null; + systemPromptAppend?: string | null; + isolation?: TaskIsolation | null; + promptMode?: TaskPromptMode | null; + excludeTools?: string[] | null; + resumeMessage?: string | null; + session: string; + permissionDecisions?: TaskPermissionDecision[] | null; + presetId?: string | null; + presetName?: string | null; + auditOnly?: boolean | null; + [k: string]: unknown; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Conversations". - */ -export interface Conversations { - conversations: Conversation[]; +export interface TaskBudget1 { + maxUsd?: number | null; + maxTokens?: number | null; + maxTurns?: number | null; + maxWallClockMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ConversationTitle". + * via the `definition` "TaskPermissionDecision". */ -export interface ConversationTitle { - title: string; +export interface TaskPermissionDecision { + requestId: string; + tool: string; + decision: TaskPermissionOutcome; + at: number; + message?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiQuery". + * via the `definition` "TaskArtifact". */ -export interface WikiQuery { - q: string | null; - tag: string | null; - limit: number | null; - offset: number | null; +export interface TaskArtifact { + kind: ArtifactKind; + ref: string; + note?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageQuery". + * via the `definition` "CriterionReport". */ -export interface WikiPageQuery { - slug: WikiSlug; +export interface CriterionReport { + id: string; + met: boolean; + evidence: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiHistoryEntry". + * via the `definition` "TaskResult". */ -export interface WikiHistoryEntry { - date: string; - title: string; - body: string; +export interface TaskResult { + verdict: TaskVerdict; + summary: string; + output?: string | null; + artifacts: TaskArtifact[]; + criteriaSelfReport?: CriterionReport[] | null; + usage: TaskUsage; + error?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiCitation". + * via the `definition` "EvalOutcome". */ -export interface WikiCitation { - summaryId: string; - date?: Millis | null; - kind?: string | null; - note?: string | null; +export interface EvalOutcome { + verdict: EvalVerdict; + attempts: number; + verifierTaskIds: string[]; + criteriaReport: CriterionReport[]; + diverged: boolean; + escalatedAt?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSource". + * via the `definition` "ExecutorTurnCapabilities". */ -export interface WikiSource { - kind: WikiSourceKind; - ids: string[]; - conversationId?: string | null; - span?: WikiSourceSpan | null; +export interface ExecutorTurnCapabilities { + steerable: boolean; + multiTurn: boolean; + structuredStream: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiSourceSpan". + * via the `definition` "ExecutorResultCapabilities". */ -export interface WikiSourceSpan { - earliest: Millis; - latest: Millis; +export interface ExecutorResultCapabilities { + usageInResult: boolean; + sessionIdCapture: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiPageResponse". + * via the `definition` "ExecutorInteractionCapabilities". */ -export interface WikiPageResponse { - slug: string; - title: string; - aliases: string[]; - tags: string[]; - entities: string[]; - currentState: string; - article?: string | null; - seeAlso?: string[] | null; - history: WikiHistoryEntry[]; - citations: WikiCitation[]; - markdown: string; - sources: WikiSource[]; - gitSha?: string | null; - lastVerified?: Millis | null; - updatedAt: Millis; - related?: string[] | null; +export interface ExecutorInteractionCapabilities { + slashCommands: boolean; + effortSelection: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissSuggestion". + * via the `definition` "TaskApprovalRequest". */ -export interface WikiMissSuggestion { - slug: string; - title: string; +export interface TaskApprovalRequest { + taskId: string; + requestId: string; + name: string; + input: { + [k: string]: unknown; + }; + toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiMissBody". + * via the `definition` "TaskWire". */ -export interface WikiMissBody { - error: string; - suggestions: WikiMissSuggestion[]; +export interface TaskWire { + id: string; + goal: string; + contextRefs: ContextRef[]; + acceptanceCriteria: AcceptanceCriterion[]; + spec: TaskSpec; + executor: TaskExecutorKind; + executorTarget?: string | null; + agentId: string; + requestedBy?: string | null; + origin: string; + parentTaskId?: string | null; + chainDepth: number; + nodeAffinity?: string | null; + claimedBy?: string | null; + budget: TaskBudget; + usage?: TaskUsage | null; + status: TaskStatus; + attempt: number; + maxAttempts: number; + pendingMessage?: string | null; + error?: string | null; + result?: TaskResult | null; + conversationId?: string | null; + sessionKey?: string | null; + harnessSessionIds: string[]; + eval?: EvalOutcome | null; + evalAttempt: number; + createdAt: number; + startedAt?: number | null; + lastHeartbeatAt?: number | null; + completedAt?: number | null; + durationMs?: number | null; + pendingApprovals?: TaskApprovalRequest[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiRedLink". + * via the `definition` "TaskCreateRequest". */ -export interface WikiRedLink { - entity: string; - referencedBy: string[]; +export interface TaskCreateRequest { + goal: string; + agentId: string; + executor?: TaskExecutorKind | null; + executorTarget?: string | null; + requestedBy?: string | null; + parentTaskId?: string | null; + chainDepth?: number | null; + nodeAffinity?: string | null; + spec?: TaskSpec | null; + budget?: TaskBudget | null; + contextRefs?: ContextRef[] | null; + acceptanceCriteria?: AcceptanceCriterion[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiGapsResponse". + * via the `definition` "TaskResponse". */ -export interface WikiGapsResponse { - redLinks: WikiRedLink[]; - stalest: string[]; +export interface TaskResponse { + task: TaskWire; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopic". + * via the `definition` "TasksListResponse". */ -export interface WikiTopic { - slug: string; - title: string; - tags: string[]; - entities: string[]; - updatedAt: Millis; - excerpt: string; +export interface TasksListResponse { + tasks: TaskWire[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "WikiTopicList". + * via the `definition` "TaskSteerAccepted". */ -export interface WikiTopicList { - topics: WikiTopic[]; - total: number; +export interface TaskSteerAccepted { + ok: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AgentUsage". + * via the `definition` "TaskKillResponse". */ -export interface AgentUsage { - promptTokens: number; - completionTokens: number; - cachedTokens: number; +export interface TaskKillResponse { + ok: boolean; + prior?: TaskStatus | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionSummary". + * via the `definition` "TaskApprovalAccepted". */ -export interface LiveSessionSummary { - id: string; - name: string; - harness?: SessionHarness | null; - lastEventTs?: number | null; - pty?: string | null; - contextWindow?: number | null; - compactAt?: number | null; - contextSource?: ContextSource | null; +export interface TaskApprovalAccepted { + ok: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionLogLine". + * via the `definition` "TaskApprovalWaitResponse". */ -export interface SessionLogLine { - who: string; - text: string; +export interface TaskApprovalWaitResponse { + approval: TaskApprovalRequest; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionView". + * via the `definition` "TaskWaitTimeoutResponse". */ -export interface SessionView { - title: string; - activity: Activity; - tool?: string | null; - tasks: string[]; - thought: string; - lastMessage: string; - log: SessionLogLine[]; - term: string[]; - ended: boolean; +export interface TaskWaitTimeoutResponse { + error: string; + task?: TaskWire | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "LiveSessionList". + * via the `definition` "TaskOverrides". */ -export interface LiveSessionList { - sessions: LiveSessionSummary[]; +export interface TaskOverrides { + delegation?: boolean | null; + meshFrom?: string | null; + presetId?: string | null; + presetName?: string | null; + permissionDecisions?: TaskPermissionDecision[] | null; + auditOnly?: boolean | null; + workingDir?: string | null; + model?: string | null; + effort?: Effort | null; + systemPromptAppend?: string | null; + isolation?: TaskIsolation | null; + promptMode?: TaskPromptMode | null; + excludeTools?: string[] | null; + resumeMessage?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StateResponse". + * via the `definition` "MemorySearchResult". */ -export interface StateResponse { - session: string; - state: SessionView; +export interface MemorySearchResult { + chunk?: MemoryChunkMatch | null; + id: string; + source: MemoryHitSource; + content: string; + role: Role | null; + agent: string | null; + relevanceScore: number; + createdAt: string; + sessionId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "snapshot". + * via the `definition` "PluginManifest". */ -export interface Snapshot { - v: ProtocolVersion; - sessions: LiveSessionSummary[]; - rooms: { - [k: string]: SessionView; - }; +export interface PluginManifest { + $schema?: string | null; + manifest: ProtocolVersion; + id: PluginId; + name: string; + version: string; + description: string; + icon?: string | null; + run: PluginRun; + permissions?: Permission[]; + settings?: ViewField[]; + tools?: PluginTool[]; + contributes: PluginContributions; + jobs?: PluginJob[]; + events?: PluginEventKind[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "session.removed". + * via the `definition` "PluginRun". */ -export interface SessionRemoved { - v: ProtocolVersion; - session: string; +export interface PluginRun { + command: string[]; + env?: { + [k: string]: string; + }; + readyTimeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureBatchRequest". + * via the `definition` "ViewField". */ -export interface CaptureBatchRequest { - session_key: string; - agent: string; - channel?: string | null; - title?: string | null; - settings?: { - [k: string]: unknown; - } | null; - task_id?: string | null; - finalize?: boolean | null; - created_at?: Millis | null; - updated_at?: Millis | null; - messages: CaptureMessage[]; +export interface ViewField { + key: string; + label: string; + input: ViewInput; + value?: ViewValue | null; + required?: boolean; + help?: string | null; + placeholder?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureMessage". + * via the `definition` "ViewOption". */ -export interface CaptureMessage { - event_id: string; - role: Role; - content: string; - tool_name?: string | null; - tool_args?: { - [k: string]: unknown; - } | null; - tool_result?: string | null; - metadata?: { - [k: string]: unknown; - } | null; - created_at?: Millis | null; +export interface ViewOption { + value: string; + label: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CaptureResult". + * via the `definition` "ViewFile". */ -export interface CaptureResult { - ok: boolean; - conversation_id: string; - inserted: number; - skipped: number; +export interface ViewFile { + name: string; + mimeType: string; + data: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookContextBase". + * via the `definition` "PluginTool". */ -export interface HookContextBase { - agentId?: string | null; - sessionId?: string | null; - timestamp: number; - metadata: { +export interface PluginTool { + name: ToolName; + title?: string | null; + description: string; + inputSchema: { [k: string]: unknown; }; + hints?: PluginToolHint[]; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookUsage". - */ -export interface HookUsage { - promptTokens: number; - completionTokens: number; +export interface PluginContributions { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "SessionTokens". + * via the `definition` "PluginPage". */ -export interface SessionTokens { - prompt: number; - completion: number; +export interface PluginPage { + id: RouteName; + title: string; + icon?: string | null; + view: RouteName; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TurnComplexity". + * via the `definition` "PluginTopicCard". */ -export interface TurnComplexity { - toolCallCount: number; - hadErrorRecovery: boolean; - hadUserCorrection: boolean; - uniqueTools: number; +export interface PluginTopicCard { + id: RouteName; + title: string; + view: RouteName; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "Message". + * via the `definition` "PluginSessionAction". */ -export interface Message { - role: Role; - content: MessageContent; - reasoning?: string | null; - toolCalls?: ToolCall[] | null; - toolCallId?: string | null; +export interface PluginSessionAction { + id: RouteName; + title: string; + icon?: string | null; + action: ViewAction; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ToolCall". + * via the `definition` "PluginJob". */ -export interface ToolCall { - id: string; - name: string; - arguments: { - [k: string]: unknown; - }; - thoughtSignature?: string | null; +export interface PluginJob { + id: RouteName; + title: string; + schedule?: string | null; + timeoutMs?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineError". + * via the `definition` "PluginContributions". */ -export interface HookPipelineError { - hookId: string; - error: string; +export interface PluginContributions1 { + pages?: PluginPage[]; + topicCards?: PluginTopicCard[]; + sessionActions?: PluginSessionAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookPipelineResult". + * via the `definition` "View". */ -export interface HookPipelineResult { - context: HookContext; - aborted: boolean; - skipped: boolean; - errors: HookPipelineError[]; - ran: string[]; +export interface View { + title: string; + subtitle?: string | null; + toolbar?: ViewButton[]; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HookConfig". + * via the `definition` "ViewButton". */ -export interface HookConfig { - id: string; - event: HookEventName; - type: HookConfigKind; - target: string; - priority?: number | null; - onError?: HookErrorMode | null; - agentFilter?: string[] | null; - toolFilter?: string[] | null; - description?: string | null; - enabled?: boolean | null; +export interface ViewButton { + label: string; + icon?: string | null; + style?: ViewButtonStyle | null; + action: ViewAction; + confirm?: ViewConfirm | null; + disabled?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ApprovalOption". + * via the `definition` "ViewConfirm". */ -export interface ApprovalOption { - key: string; - label: string; +export interface ViewConfirm { + title: string; + text: string; + confirmLabel?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionSummary". + * via the `definition` "ViewTab". */ -export interface HarnessSessionSummary { - sessionId: SessionId; - harnessId: HarnessId; - title?: string | null; - cwd?: string | null; - createdAt: Millis; - updatedAt: Millis; - status: HarnessSessionStatus; - blocked?: boolean | null; - supersedes?: SessionId | null; - model?: string | null; - parentSessionId?: SessionId | null; - agentName?: string | null; - taskId?: string | null; - effort?: string | null; - transport?: Transport | null; - [k: string]: unknown; -} -export interface HarnessStatusFrame { - type: "status"; +export interface ViewTab { + id: RouteName; + title: string; + badge?: string | null; + blocks: ViewBlock[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptQuestion". + * via the `definition` "ViewProperty". */ -export interface PromptQuestion { - question?: string | null; - header?: string | null; - multiSelect: boolean; - freeText?: boolean | null; - options: PromptOption[]; +export interface ViewProperty { + label: string; + value: ViewInline; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptOption". + * via the `definition` "ViewListItem". */ -export interface PromptOption { - label: string; - description?: string | null; +export interface ViewListItem { + id: string; + title: string; + subtitle?: string | null; + icon?: string | null; + trailing?: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptResolution". + * via the `definition` "ViewEmpty". */ -export interface PromptResolution { - at: number; - answerText?: string | null; +export interface ViewEmpty { + title: string; + text?: string | null; + button?: ViewButton | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "PromptScreen". + * via the `definition` "ViewColumn". */ -export interface PromptScreen { - current: number; - total: number; +export interface ViewColumn { + title: string; + align?: ViewAlign | null; + sortable?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "StatusTool". + * via the `definition` "ViewRow". */ -export interface StatusTool { - name: string; - toolCallId?: string | null; +export interface ViewRow { + id: string; + cells: ViewInline[]; + action?: ViewAction | null; + menu?: ViewButton[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStatusFrame". + * via the `definition` "ViewCrumb". */ -export interface HarnessStatusFrame1 { - sessionId: SessionId; - status: HarnessStatus; - since: number; - source?: StatusSource | null; - phase?: StatusPhase | null; - tool?: StatusTool | null; - promptId?: string | null; +export interface ViewCrumb { + label: string; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessCapabilities". + * via the `definition` "CanvasScene". */ -export interface HarnessCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; - turnOptions?: boolean | null; - launchModel?: boolean | null; - imageAttachments?: boolean | null; - models?: HarnessModelOption[] | null; - modelsSource?: HarnessModelsSource | null; - efforts?: EffortOption[] | null; - modelFlag?: string | null; - effortFlag?: string | null; +export interface CanvasScene { + items: CanvasItem[]; + grid?: CanvasGrid | null; + viewport?: CanvasViewport | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessModelOption". + * via the `definition` "CanvasAnchor". */ -export interface HarnessModelOption { - inputModalities?: string[] | null; +export interface CanvasAnchor { id: string; - label: string; - isDefault?: boolean | null; - efforts?: EffortOption[] | null; + x: number; + y: number; + side: CanvasSide; + direction: CanvasDirection; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EffortOption". + * via the `definition` "CanvasMenuItem". */ -export interface EffortOption { +export interface CanvasMenuItem { id: string; label: string; - isDefault?: boolean | null; + icon?: string | null; + danger?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessControlCapabilities". + * via the `definition` "CanvasEnd". */ -export interface HarnessControlCapabilities { - interrupt: boolean; - resume: boolean; - approvals: boolean; +export interface CanvasEnd { + node: string; + anchor?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessObservationCapabilities". + * via the `definition` "CanvasGrid". */ -export interface HarnessObservationCapabilities { - liveStream: boolean; - listSessions: boolean; - drive?: boolean | null; +export interface CanvasGrid { + size: number; + snap?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessSessionList". + * via the `definition` "CanvasViewport". */ -export interface HarnessSessionList { - sessions: HarnessSessionSummary[]; +export interface CanvasViewport { + x: number; + y: number; + zoom: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOffering". + * via the `definition` "ViewRequest". */ -export interface HarnessOffering { - harnessId: HarnessId; - chat: boolean; - capabilities: HarnessCapabilities; +export interface ViewRequest { + params?: { + [k: string]: unknown; + } | null; + context: ViewContext; +} +export interface ViewContext { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessOfferingList". + * via the `definition` "ViewContext". */ -export interface HarnessOfferingList { - harnesses: HarnessOffering[]; +export interface ViewContext1 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSession". + * via the `definition` "ViewActionRequest". */ -export interface HarnessStoreSession { - id: string; - command: RosterCommand; - title: string; - updatedAt: number; - parentSessionId?: string | null; - agentName?: string | null; - model?: string | null; - taskId?: string | null; +export interface ViewActionRequest { + params?: { + [k: string]: unknown; + } | null; + values?: { + [k: string]: ViewValue; + }; + context: ViewContext2; +} +export interface ViewContext2 { + topicId?: string | null; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessStoreSessionList". + * via the `definition` "ViewActionResult". */ -export interface HarnessStoreSessionList { - sessions: HarnessStoreSession[]; +export interface ViewActionResult { + actions: ViewAction[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". + * via the `definition` "ViewActionRefusal". */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; +export interface ViewActionRefusal { + message: string; + fields?: { + [k: string]: string; + }; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "AcceptanceCriterion". + * via the `definition` "CanvasEventRequest". */ -export interface AcceptanceCriterion { - id: string; - description: string; - kind: CriterionKind; - check?: string | null; +export interface CanvasEventRequest { + event: CanvasEvent; + params?: { + [k: string]: unknown; + } | null; + context: ViewContext3; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskBudget". + * via the `definition` "CanvasPosition". */ -export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface CanvasPosition { + id: string; + x: number; + y: number; +} +export interface ViewContext3 { + topicId?: string | null; + sessionId?: SessionId | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "CanvasResponse". + */ +export interface CanvasResponse { + ops: CanvasOp[]; + actions: ViewAction[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "PanelTheme". + */ +export interface PanelTheme { + scheme: PanelScheme; + colors: { + category1?: string; + category2?: string; + category3?: string; + category4?: string; + category5?: string; + category6?: string; + danger?: string; + info?: string; + onPrimary?: string; + onPrimaryContainer?: string; + onSurface?: string; + onSurfaceVariant?: string; + outline?: string; + outlineVariant?: string; + primary?: string; + primaryContainer?: string; + secondaryContainer?: string; + success?: string; + surface?: string; + surfaceContainer?: string; + surfaceContainerHigh?: string; + warning?: string; + }; + fontFamily: string; + fontMono: string; + fontSize: number; + radius: number; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskUsage". + * via the `definition` "PluginList". */ -export interface TaskUsage { - inputTokens: number; - outputTokens: number; - totalTokens: number; - costUsd?: number | null; - turns: number; - wallClockMs: number; +export interface PluginList { + node: string; + plugins: PluginRecord[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". + * via the `definition` "PluginRecord". */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; -} -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; +export interface PluginRecord { + id: PluginId; + node: string; + path: string; + manifest: PluginManifest; + enabled: boolean; + state: PluginState; + granted: Permission[]; + pending: Permission[]; + error?: string | null; + lastExit?: PluginExit | null; + restarts: number; + startedAt?: number | null; + installedAt: number; + jobs: PluginJobStatus[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". + * via the `definition` "PluginExit". */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; +export interface PluginExit { at: number; - message?: string | null; + code?: number | null; + signal?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". + * via the `definition` "PluginJobStatus". */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; +export interface PluginJobStatus { + id: RouteName; + lastRun?: PluginJobRun | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". + * via the `definition` "PluginJobRun". */ -export interface CriterionReport { - id: string; - met: boolean; - evidence: string; +export interface PluginJobRun { + runId: string; + trigger: PluginJobTrigger; + startedAt: number; + finishedAt?: number | null; + outcome?: PluginJobOutcome | null; + message?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResult". + * via the `definition` "PluginInstallRequest". */ -export interface TaskResult { - verdict: TaskVerdict; - summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; - usage: TaskUsage; - error?: string | null; +export interface PluginInstallRequest { + path: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". + * via the `definition` "PluginEnableRequest". */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; +export interface PluginEnableRequest { + approve?: Permission[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". + * via the `definition` "PluginLogs". */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; +export interface PluginLogs { + lines: PluginLogLine[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". + * via the `definition` "PluginLogLine". */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; +export interface PluginLogLine { + at: number; + stream: PluginLogStream; + text: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". + * via the `definition` "PluginSettings". */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; +export interface PluginSettings { + values: { + [k: string]: ViewValue; + }; + secretsSet?: string[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". + * via the `definition` "PluginSettingsUpdate". */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; +export interface PluginSettingsUpdate { + values: { + [k: string]: ViewValue | null; }; - toolCallId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWire". + * via the `definition` "PluginToolList". */ -export interface TaskWire { - id: string; - goal: string; - contextRefs: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; - agentId: string; - requestedBy?: string | null; - origin: string; - parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; - budget: TaskBudget; - usage?: TaskUsage | null; - status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; - error?: string | null; - result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; - createdAt: number; - startedAt?: number | null; - lastHeartbeatAt?: number | null; - completedAt?: number | null; - durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; +export interface PluginToolList { + version: number; + tools: PluginToolEntry[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskCreateRequest". + * via the `definition` "PluginToolEntry". */ -export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; - nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; - acceptanceCriteria?: AcceptanceCriterion[] | null; +export interface PluginToolEntry { + plugin: PluginId; + tool: PluginTool; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskResponse". + * via the `definition` "PluginEventDelivery". */ -export interface TaskResponse { - task: TaskWire; +export interface PluginEventDelivery { + seq: number; + at: number; + missed: number; + event: PluginEvent; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TasksListResponse". + * via the `definition` "PluginJobRequest". */ -export interface TasksListResponse { - tasks: TaskWire[]; +export interface PluginJobRequest { + runId: string; + trigger: PluginJobTrigger; + scheduledAt?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". + * via the `definition` "PluginJobResult". */ -export interface TaskSteerAccepted { - ok: boolean; +export interface PluginJobResult { + outcome: PluginJobOutcome; + message?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskKillResponse". + * via the `definition` "PluginToolCall". */ -export interface TaskKillResponse { - ok: boolean; - prior?: TaskStatus | null; +export interface PluginToolCall { + arguments: { + [k: string]: unknown; + }; + sessionId?: SessionId | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". + * via the `definition` "PluginToolResult". */ -export interface TaskApprovalAccepted { - ok: boolean; +export interface PluginToolResult { + text: string; + isError?: boolean; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". + * via the `definition` "PluginSelf". */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; +export interface PluginSelf { + id: PluginId; + node: string; + version: string; + permissions: Permission[]; + settings: { + [k: string]: ViewValue; + }; + dataDir: string; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskWaitTimeoutResponse". + * via the `definition` "PluginViewsChanged". */ -export interface TaskWaitTimeoutResponse { - error: string; - task?: TaskWire | null; +export interface PluginViewsChanged { + views: RouteName[]; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". + * via the `definition` "PluginNotify". */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; +export interface PluginNotify { + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "MemorySearchResult". + * via the `definition` "plugin.notification". */ -export interface MemorySearchResult { - chunk?: MemoryChunkMatch | null; - id: string; - source: MemoryHitSource; - content: string; - role: Role | null; - agent: string | null; - relevanceScore: number; - createdAt: string; +export interface PluginNotification { + plugin: PluginId; + node: string; + title: string; + text?: string | null; + tone?: ViewTone | null; + action?: ViewAction | null; + ts: number; } From 68a719af57fab34953b0254167b79f12078c3142 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 00:23:34 -0400 Subject: [PATCH 02/11] feat(sdk): add @rivethub/plugin-sdk for TypeScript plug-ins serve() answers what rh asks on RIVETHUB_PLUGIN_SOCKET: GET /health, views, actions (a thrown Refusal answers 422 naming its fields), canvas events, tools (a thrown error answers isError), events and jobs. It drops an event delivery it has already handled by seq, and gives the settings handler the starting settings from GET /api/plugin/self and every settings.changed. connect() calls rh on RIVETHUB_API_SOCKET with the per-start token: self(), viewsChanged(), notify() and request() for any route the plug-in's permissions name, with rh's refusals as RivetHubError. The manifest, view, canvas and event types are the @rivethub/contract ones under their contract names, Accepted for what a plug-in answers and Sent for what it receives. rivethub-plugin-dev starts any plug-in the way rh does, standing in for its own /api/plugin routes, and reads view, action, canvas, tool, event and job commands from stdin. --- package-lock.json | 14 +++ packages/plugin-sdk/package.json | 15 +++ packages/plugin-sdk/src/dev.ts | 162 ++++++++++++++++++++++++++++ packages/plugin-sdk/src/index.ts | 4 + packages/plugin-sdk/src/plugin.ts | 142 ++++++++++++++++++++++++ packages/plugin-sdk/src/rivethub.ts | 98 +++++++++++++++++ packages/plugin-sdk/src/serve.ts | 29 +++++ packages/plugin-sdk/src/types.ts | 32 ++++++ tests/plugin-sdk.test.ts | 76 +++++++++++++ 9 files changed, 572 insertions(+) create mode 100644 packages/plugin-sdk/package.json create mode 100755 packages/plugin-sdk/src/dev.ts create mode 100644 packages/plugin-sdk/src/index.ts create mode 100644 packages/plugin-sdk/src/plugin.ts create mode 100644 packages/plugin-sdk/src/rivethub.ts create mode 100644 packages/plugin-sdk/src/serve.ts create mode 100644 packages/plugin-sdk/src/types.ts create mode 100644 tests/plugin-sdk.test.ts diff --git a/package-lock.json b/package-lock.json index 4b65fc5..5fef210 100644 --- a/package-lock.json +++ b/package-lock.json @@ -240,6 +240,10 @@ "resolved": "packages/contract", "link": true }, + "node_modules/@rivethub/plugin-sdk": { + "resolved": "packages/plugin-sdk", + "link": true + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -793,6 +797,16 @@ "packages/contract": { "name": "@rivethub/contract", "version": "0.0.0" + }, + "packages/plugin-sdk": { + "name": "@rivethub/plugin-sdk", + "version": "0.0.0", + "dependencies": { + "@rivethub/contract": "0.0.0" + }, + "bin": { + "rivethub-plugin-dev": "src/dev.ts" + } } } } diff --git a/packages/plugin-sdk/package.json b/packages/plugin-sdk/package.json new file mode 100644 index 0000000..b326a0f --- /dev/null +++ b/packages/plugin-sdk/package.json @@ -0,0 +1,15 @@ +{ + "name": "@rivethub/plugin-sdk", + "version": "0.0.0", + "private": true, + "type": "module", + "exports": { + ".": "./src/index.ts" + }, + "bin": { + "rivethub-plugin-dev": "./src/dev.ts" + }, + "dependencies": { + "@rivethub/contract": "0.0.0" + } +} diff --git a/packages/plugin-sdk/src/dev.ts b/packages/plugin-sdk/src/dev.ts new file mode 100755 index 0000000..20eea8e --- /dev/null +++ b/packages/plugin-sdk/src/dev.ts @@ -0,0 +1,162 @@ +#!/usr/bin/env node +import { spawn } from 'node:child_process' +import { randomBytes } from 'node:crypto' +import { mkdirSync, mkdtempSync, readFileSync, rmSync } from 'node:fs' +import { createServer, request, type ServerResponse } from 'node:http' +import { tmpdir } from 'node:os' +import { join, resolve } from 'node:path' +import { createInterface } from 'node:readline' +import type { GatewayError, PluginEventDelivery, PluginManifest, PluginSelf } from './types.ts' + +const USAGE = `rivethub-plugin-dev [dir]: starts the plug-in in dir like rh does, then reads commands from stdin: + view [{"params":{},"context":{}}] + action [{"values":{},"params":{}}] + canvas {"event":{"type":"activated","item":""}} + tool [arguments] + event [fields] + job ` + +const dir = resolve(process.argv[2] ?? '.') +const manifest = JSON.parse(readFileSync(join(dir, 'rivethub-plugin.json'), 'utf8')) as PluginManifest +const root = mkdtempSync(join(tmpdir(), 'rhp-')) +const data = join(root, 'data') +const run = join(root, 'run') +const socket = join(run, 'plugin.sock') +const api = join(root, 'api.sock') +const token = randomBytes(32).toString('hex') +mkdirSync(data) +mkdirSync(run, { mode: 0o700 }) + +const own: PluginSelf = { + id: manifest.id, + node: 'dev', + version: manifest.version, + permissions: manifest.permissions ?? [], + settings: Object.fromEntries( + (manifest.settings ?? []).flatMap((field) => + field.value === undefined || field.value === null ? [] : [[field.key, field.value]], + ), + ), + dataDir: data, +} + +function reply(response: ServerResponse, status: number, body?: unknown): void { + response.writeHead(status, body === undefined ? {} : { 'content-type': 'application/json' }) + response.end(body === undefined ? undefined : JSON.stringify(body)) +} + +const stand = createServer(async (incoming, response) => { + const chunks: Buffer[] = [] + for await (const chunk of incoming) chunks.push(chunk as Buffer) + const text = Buffer.concat(chunks).toString('utf8') + if (incoming.headers.authorization !== `Bearer ${token}`) return reply(response, 401, { error: 'unauthorized' }) + if (incoming.method === 'GET' && incoming.url === '/api/plugin/self') return reply(response, 200, own) + if (incoming.method === 'POST' && incoming.url?.startsWith('/api/plugin/')) { + console.log(`rh ← ${incoming.url.slice('/api/plugin/'.length)} ${text}`) + return reply(response, 204) + } + const refused: GatewayError = { + error: 'the dev harness answers only the /api/plugin routes; use a throwaway rh node for the rest', + code: 'not_in_dev_harness', + } + return reply(response, 501, refused) +}) +await new Promise((done) => stand.listen(api, done)) + +const [program, ...args] = manifest.run.command +if (program === undefined) throw new Error('run.command is empty') +const inherited = ['PATH', 'HOME', 'USER', 'LANG', 'LC_ALL', 'TZ'].flatMap((name) => { + const value = process.env[name] + return value === undefined ? [] : [[name, value]] +}) +const child = spawn(program.includes('/') ? resolve(dir, program) : program, args, { + cwd: dir, + stdio: ['ignore', 'inherit', 'inherit'], + env: { + ...Object.fromEntries(inherited), + ...manifest.run.env, + RIVETHUB_PLUGIN_ID: manifest.id, + RIVETHUB_PLUGIN_NODE: 'dev', + RIVETHUB_PLUGIN_DATA: data, + RIVETHUB_PLUGIN_SOCKET: socket, + RIVETHUB_API_SOCKET: api, + RIVETHUB_PLUGIN_TOKEN: token, + TMPDIR: run, + }, +}) + +function call(method: string, path: string, body?: unknown): Promise<{ status: number; text: string }> { + return new Promise((done, fail) => { + const headers = { 'content-type': 'application/json', 'x-rivethub-user': 'owner', 'x-rivethub-node': 'dev' } + const outgoing = request({ socketPath: socket, method, path, headers }, (response) => { + const chunks: Buffer[] = [] + response.on('data', (chunk: Buffer) => chunks.push(chunk)) + response.on('end', () => done({ status: response.statusCode ?? 0, text: Buffer.concat(chunks).toString('utf8') })) + }) + outgoing.on('error', fail) + outgoing.end(body === undefined ? undefined : JSON.stringify(body)) + }) +} + +function stop(code: number): never { + child.removeAllListeners('exit') + child.kill('SIGTERM') + stand.close() + rmSync(root, { recursive: true, force: true }) + process.exit(code) +} + +child.on('exit', (code, signal) => { + console.error(`the plug-in exited (${signal ?? code})`) + stop(1) +}) + +const deadline = Date.now() + (manifest.run.readyTimeoutMs ?? 10_000) +for (;;) { + const healthy = await call('GET', '/health').then( + (answer) => answer.status >= 200 && answer.status < 300, + () => false, + ) + if (healthy) break + if (Date.now() > deadline) { + console.error(`the plug-in did not answer GET /health within ${manifest.run.readyTimeoutMs ?? 10_000} ms`) + stop(1) + } + await new Promise((done) => setTimeout(done, 100)) +} +console.log(`${manifest.id} is ready; its data folder is ${data}\n${USAGE}`) + +let seq = 0 +const routes: Record) => [string, unknown]> = { + view: (name, body) => [`/views/${name}`, { context: {}, ...body }], + action: (name, body) => [`/actions/${name}`, { context: {}, ...body }], + canvas: (name, body) => [`/canvas/${name}/events`, { context: {}, ...body }], + tool: (name, body) => [`/tools/${name}`, { arguments: body }], + job: (name) => [`/jobs/${name}`, { runId: `dev-${Date.now()}`, trigger: 'manual' }], + event: (name, body) => { + seq += 1 + const delivery = { seq, at: Date.now(), missed: 0, event: { type: name, ...body } } + return ['/events', delivery as PluginEventDelivery] + }, +} + +for await (const line of createInterface({ input: process.stdin })) { + const match = /^(\w+)\s+(\S+)\s*(.*)$/.exec(line.trim()) + const route = match?.[1] === undefined ? undefined : routes[match[1]] + if (match === null || route === undefined) { + if (line.trim() !== '') console.log(USAGE) + continue + } + try { + const [path, body] = route(match[2] ?? '', match[3] ? (JSON.parse(match[3]) as Record) : {}) + const answer = await call('POST', path, body) + let shown = answer.text + try { + shown = JSON.stringify(JSON.parse(answer.text), null, 2) + } catch {} + console.log(`${answer.status} ${shown}`) + } catch (error) { + console.error(error instanceof Error ? error.message : String(error)) + } +} +stop(0) diff --git a/packages/plugin-sdk/src/index.ts b/packages/plugin-sdk/src/index.ts new file mode 100644 index 0000000..a379926 --- /dev/null +++ b/packages/plugin-sdk/src/index.ts @@ -0,0 +1,4 @@ +export { type EventHandlers, type EventKind, type EventOf, type Plugin, Refusal, type Reply, router } from './plugin.ts' +export { connect, type PluginEnv, pluginEnv, RivetHub, RivetHubError } from './rivethub.ts' +export { serve } from './serve.ts' +export type * from './types.ts' diff --git a/packages/plugin-sdk/src/plugin.ts b/packages/plugin-sdk/src/plugin.ts new file mode 100644 index 0000000..0f41c56 --- /dev/null +++ b/packages/plugin-sdk/src/plugin.ts @@ -0,0 +1,142 @@ +import type { + CanvasEventRequest, + CanvasResponse, + PluginEvent, + PluginEventDelivery, + PluginJobRequest, + PluginJobResult, + PluginToolCall, + PluginToolResult, + Settings, + View, + ViewAction, + ViewActionRequest, + ViewRequest, +} from './types.ts' + +type Awaitable = T | Promise + +export type EventKind = Exclude +export type EventOf = Extract +export type EventHandlers = { + [K in EventKind]?: (event: EventOf, delivery: PluginEventDelivery) => Awaitable +} + +export interface Plugin { + views?: Record Awaitable> + actions?: Record Awaitable> + canvas?: Record Awaitable> + tools?: Record< + string, + (args: PluginToolCall['arguments'], call: PluginToolCall) => Awaitable + > + events?: EventHandlers + jobs?: Record Awaitable> + settings?: (values: Settings) => Awaitable +} + +export class Refusal extends Error { + readonly fields: Record + + constructor(message: string, fields: Record = {}) { + super(message) + this.fields = fields + } +} + +export type Reply = { status: number; body?: unknown } + +const named = (table: Record | undefined, name: string | undefined): T | undefined => + table !== undefined && name !== undefined && Object.hasOwn(table, name) ? table[name] : undefined + +const failure = (error: unknown): string => (error instanceof Error ? error.message : String(error)) + +const missing: Reply = { status: 404, body: 'not found' } + +export function router(plugin: Plugin): (method: string, path: string, text: string) => Promise { + let seen = 0 + + async function event(delivery: PluginEventDelivery): Promise { + if (delivery.seq <= seen) return { status: 204 } + const { event } = delivery + if (event.type === 'settings.changed') { + await plugin.settings?.(event.values) + } else { + const handler = plugin.events?.[event.type] as + | ((event: PluginEvent, delivery: PluginEventDelivery) => Awaitable) + | undefined + await handler?.(event, delivery) + } + seen = delivery.seq + return { status: 204 } + } + + async function action(name: string | undefined, request: ViewActionRequest): Promise { + const handler = named(plugin.actions, name) + if (handler === undefined) return missing + try { + return { status: 200, body: { actions: await handler(request) } } + } catch (error) { + if (error instanceof Refusal) return { status: 422, body: { message: error.message, fields: error.fields } } + throw error + } + } + + async function tool(name: string | undefined, call: PluginToolCall): Promise { + const handler = named(plugin.tools, name) + if (handler === undefined) return missing + try { + const result = await handler(call.arguments, call) + return { status: 200, body: typeof result === 'string' ? { text: result } : result } + } catch (error) { + return { status: 200, body: { text: failure(error), isError: true } satisfies PluginToolResult } + } + } + + async function job(name: string | undefined, request: PluginJobRequest): Promise { + const handler = named(plugin.jobs, name) + if (handler === undefined) return missing + let result: PluginJobResult + try { + const message = await handler(request) + result = message === undefined ? { outcome: 'succeeded' } : { outcome: 'succeeded', message } + } catch (error) { + result = { outcome: 'failed', message: failure(error) } + } + return { status: 200, body: result } + } + + async function answer(segments: string[], body: unknown): Promise { + const [kind, name, tail] = segments + if (kind === 'views' && segments.length === 2) { + const handler = named(plugin.views, name) + return handler === undefined ? missing : { status: 200, body: await handler(body as ViewRequest) } + } + if (kind === 'canvas' && tail === 'events' && segments.length === 3) { + const handler = named(plugin.canvas, name) + return handler === undefined ? missing : { status: 200, body: await handler(body as CanvasEventRequest) } + } + if (kind === 'actions' && segments.length === 2) return action(name, body as ViewActionRequest) + if (kind === 'tools' && segments.length === 2) return tool(name, body as PluginToolCall) + if (kind === 'jobs' && segments.length === 2) return job(name, body as PluginJobRequest) + if (kind === 'events' && segments.length === 1) return event(body as PluginEventDelivery) + return missing + } + + return async (method, path, text) => { + const segments = new URL(path, 'http://plugin').pathname.split('/').filter(Boolean) + if (method === 'GET' && segments.length === 1 && segments[0] === 'health') return { status: 200, body: 'ok' } + if (method !== 'POST') return missing + let body: unknown + try { + body = JSON.parse(text) + } catch (error) { + return { status: 400, body: failure(error) } + } + try { + return await answer(segments, body) + } catch (error) { + return { status: 500, body: failure(error) } + } + } +} diff --git a/packages/plugin-sdk/src/rivethub.ts b/packages/plugin-sdk/src/rivethub.ts new file mode 100644 index 0000000..38f39b0 --- /dev/null +++ b/packages/plugin-sdk/src/rivethub.ts @@ -0,0 +1,98 @@ +import { request as send } from 'node:http' +import type { Accepted, GatewayError, PluginNotify, PluginSelf } from './types.ts' + +export type PluginEnv = { + id: string + node: string + dataDir: string + socket: string + apiSocket: string + token: string +} + +export function pluginEnv(env: NodeJS.ProcessEnv = process.env): PluginEnv { + const read = (name: string): string => { + const value = env[name] + if (value === undefined || value === '') { + throw new Error(`${name} is not set: run the plug-in from rh or rivethub-plugin-dev`) + } + return value + } + return { + id: read('RIVETHUB_PLUGIN_ID'), + node: read('RIVETHUB_PLUGIN_NODE'), + dataDir: read('RIVETHUB_PLUGIN_DATA'), + socket: read('RIVETHUB_PLUGIN_SOCKET'), + apiSocket: read('RIVETHUB_API_SOCKET'), + token: read('RIVETHUB_PLUGIN_TOKEN'), + } +} + +export class RivetHubError extends Error { + readonly status: number + readonly code: string | undefined + readonly detail: string | undefined + + constructor(status: number, body: GatewayError) { + super(body.detail ? `${body.error}: ${body.detail}` : body.error) + this.status = status + this.code = body.code ?? undefined + this.detail = body.detail ?? undefined + } +} + +function gatewayError(status: number, text: string): GatewayError { + try { + const body = JSON.parse(text) as Partial + if (typeof body.error === 'string') return body as GatewayError + } catch {} + return { error: text || `rh answered ${status}` } +} + +export class RivetHub { + readonly #socket: string + readonly #token: string + + constructor(socket: string, token: string) { + this.#socket = socket + this.#token = token + } + + self(): Promise { + return this.request('GET', '/api/plugin/self') + } + + async viewsChanged(views: string[]): Promise { + await this.request('POST', '/api/plugin/views/changed', { views } satisfies Accepted.PluginViewsChanged) + } + + async notify(notice: PluginNotify): Promise { + await this.request('POST', '/api/plugin/notify', notice) + } + + request(method: string, path: string, body?: unknown): Promise { + const payload = body === undefined ? undefined : JSON.stringify(body) + const headers: Record = { authorization: `Bearer ${this.#token}` } + if (payload !== undefined) headers['content-type'] = 'application/json' + return new Promise((resolve, reject) => { + const outgoing = send({ socketPath: this.#socket, path, method, headers }, (response) => { + const chunks: Buffer[] = [] + response.on('data', (chunk: Buffer) => chunks.push(chunk)) + response.on('error', reject) + response.on('end', () => { + const status = response.statusCode ?? 0 + const text = Buffer.concat(chunks).toString('utf8') + if (status < 200 || status > 299) reject(new RivetHubError(status, gatewayError(status, text))) + else resolve((text === '' ? undefined : JSON.parse(text)) as T) + }) + }) + outgoing.on('error', reject) + outgoing.end(payload) + }) + } +} + +export function connect(env: NodeJS.ProcessEnv = process.env): RivetHub { + const { apiSocket, token } = pluginEnv(env) + return new RivetHub(apiSocket, token) +} diff --git a/packages/plugin-sdk/src/serve.ts b/packages/plugin-sdk/src/serve.ts new file mode 100644 index 0000000..4993208 --- /dev/null +++ b/packages/plugin-sdk/src/serve.ts @@ -0,0 +1,29 @@ +import { createServer, type Server, type ServerResponse } from 'node:http' +import { type Plugin, type Reply, router } from './plugin.ts' +import { connect, pluginEnv } from './rivethub.ts' + +function write(response: ServerResponse, reply: Reply): void { + if (reply.body === undefined) { + response.writeHead(reply.status).end() + } else if (typeof reply.body === 'string') { + response.writeHead(reply.status, { 'content-type': 'text/plain; charset=utf-8' }).end(reply.body) + } else { + response.writeHead(reply.status, { 'content-type': 'application/json' }).end(JSON.stringify(reply.body)) + } +} + +export async function serve(plugin: Plugin, env: NodeJS.ProcessEnv = process.env): Promise { + const { socket } = pluginEnv(env) + if (plugin.settings !== undefined) await plugin.settings((await connect(env).self()).settings) + const route = router(plugin) + const server = createServer(async (request, response) => { + const chunks: Buffer[] = [] + for await (const chunk of request) chunks.push(chunk as Buffer) + write(response, await route(request.method ?? 'GET', request.url ?? '/', Buffer.concat(chunks).toString('utf8'))) + }) + await new Promise((resolve, reject) => { + server.once('error', reject) + server.listen(socket, resolve) + }) + return server +} diff --git a/packages/plugin-sdk/src/types.ts b/packages/plugin-sdk/src/types.ts new file mode 100644 index 0000000..b8fa3df --- /dev/null +++ b/packages/plugin-sdk/src/types.ts @@ -0,0 +1,32 @@ +import type { Accepted, Sent } from '@rivethub/contract' + +export type { Accepted, Sent } + +export type PluginManifest = Accepted.PluginManifest +export type View = Accepted.View +export type ViewBlock = Accepted.ViewBlock +export type ViewInline = Accepted.ViewInline +export type ViewButton = Accepted.ViewButton +export type ViewField = Accepted.ViewField +export type ViewAction = Accepted.ViewAction +export type ViewValue = Accepted.ViewValue +export type CanvasScene = Accepted.CanvasScene +export type CanvasItem = Accepted.CanvasItem +export type CanvasShape = Accepted.CanvasShape +export type CanvasOp = Accepted.CanvasOp +export type CanvasResponse = Accepted.CanvasResponse +export type PluginToolResult = Accepted.PluginToolResult +export type PluginJobResult = Accepted.PluginJobResult +export type PluginNotify = Accepted.PluginNotify + +export type ViewRequest = Sent.ViewRequest +export type ViewActionRequest = Sent.ViewActionRequest +export type CanvasEventRequest = Sent.CanvasEventRequest +export type CanvasEvent = Sent.CanvasEvent +export type PluginToolCall = Sent.PluginToolCall +export type PluginEventDelivery = Sent.PluginEventDelivery +export type PluginEvent = Sent.PluginEvent +export type PluginJobRequest = Sent.PluginJobRequest +export type PluginSelf = Sent.PluginSelf +export type GatewayError = Sent.GatewayError +export type Settings = PluginSelf['settings'] diff --git a/tests/plugin-sdk.test.ts b/tests/plugin-sdk.test.ts new file mode 100644 index 0000000..b21964b --- /dev/null +++ b/tests/plugin-sdk.test.ts @@ -0,0 +1,76 @@ +import assert from 'node:assert/strict' +import { test } from 'node:test' +import { Refusal, router } from '@rivethub/plugin-sdk' + +const deliver = (seq: number, event: object): string => JSON.stringify({ seq, at: 0, missed: 0, event }) + +test('an action refusal answers 422 naming its fields, and an accepted action answers its actions', async () => { + const route = router({ + actions: { + add: ({ values }) => { + if (values?.title === undefined) throw new Refusal('Give it a title', { title: 'Required' }) + return [{ type: 'refresh' }] + }, + }, + }) + assert.deepEqual(await route('POST', '/actions/add', JSON.stringify({ context: {} })), { + status: 422, + body: { message: 'Give it a title', fields: { title: 'Required' } }, + }) + assert.deepEqual(await route('POST', '/actions/add', JSON.stringify({ values: { title: 'x' }, context: {} })), { + status: 200, + body: { actions: [{ type: 'refresh' }] }, + }) +}) + +test('a tool that throws answers its message as an error result', async () => { + const route = router({ + tools: { + add_item: ({ title }) => { + if (typeof title !== 'string') throw new Error('title must be a string') + return `added ${title}` + }, + }, + }) + assert.deepEqual(await route('POST', '/tools/add_item', JSON.stringify({ arguments: { title: 'x' } })), { + status: 200, + body: { text: 'added x' }, + }) + assert.deepEqual(await route('POST', '/tools/add_item', JSON.stringify({ arguments: {} })), { + status: 200, + body: { text: 'title must be a string', isError: true }, + }) +}) + +test('a repeated delivery is handled once, a failed one is retried, settings go to the settings handler', async () => { + const seen: string[] = [] + let failing = true + const route = router({ + events: { + 'session.idle': ({ sessionId }) => { + if (sessionId === 'b' && failing) { + failing = false + throw new Error('not yet') + } + seen.push(sessionId) + }, + }, + settings: (values) => { + seen.push(JSON.stringify(values)) + }, + }) + const idle = (sessionId: string) => ({ type: 'session.idle', sessionId }) + const status = async (seq: number, event: object) => (await route('POST', '/events', deliver(seq, event))).status + assert.equal(await status(1, idle('a')), 204) + assert.equal(await status(1, idle('a')), 204) + assert.equal(await status(2, { type: 'settings.changed', values: { on: true } }), 204) + assert.equal(await status(3, idle('b')), 500) + assert.equal(await status(3, idle('b')), 204) + assert.deepEqual(seen, ['a', '{"on":true}', 'b']) +}) + +test('health answers and an unknown route is the plug-in’s own 404', async () => { + const route = router({}) + assert.equal((await route('GET', '/health', '')).status, 200) + assert.equal((await route('POST', '/views/main', '{}')).status, 404) +}) From 491103711e27e7f056e2482182b8770424952924 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 00:23:53 -0400 Subject: [PATCH 03/11] feat(sdk): add the rivethub-plugin crate for Rust plug-ins npm run contract now also writes rust/rivethub-plugin/src/contract.rs: the plug-in types reachable from the manifest, the plug-in socket and API bodies and GatewayError, generated from the vendored accepted schema, so the crate has no hand-written DTOs and contract:check keeps it fresh. For these types the two schema directions differ only in what is required, so one set of types reads what rh sends and writes what it accepts. Flags default to false, lists and maps to empty, and ViewValue is an untagged enum (Bool, Number, Text, List, Files) as in the runtime. Plugin::new(state) registers view, action, canvas, tool, job, events and settings handlers and serve() answers on RIVETHUB_PLUGIN_SOCKET with the same behaviour as the TypeScript SDK: a ViewActionRefusal error answers 422, a failing tool answers isError, a repeated delivery is acknowledged once and a failed one is retried. RivetHub calls the plug-in API socket with the per-start token: own(), views_changed(), notify(), get(), post() and request(). npm run rust runs rustfmt, Clippy with warnings as errors and the crate's tests, and npm run check now includes it. --- .gitignore | 1 + package.json | 5 +- rust/rivethub-plugin/Cargo.lock | 308 +++++++ rust/rivethub-plugin/Cargo.toml | 29 + rust/rivethub-plugin/src/contract.rs | 1231 ++++++++++++++++++++++++++ rust/rivethub-plugin/src/error.rs | 78 ++ rust/rivethub-plugin/src/lib.rs | 11 + rust/rivethub-plugin/src/plugin.rs | 466 ++++++++++ rust/rivethub-plugin/src/rivethub.rs | 131 +++ rust/rivethub-plugin/src/socket.rs | 23 + scripts/contract.ts | 5 + scripts/rust.ts | 313 +++++++ 12 files changed, 2599 insertions(+), 2 deletions(-) create mode 100644 rust/rivethub-plugin/Cargo.lock create mode 100644 rust/rivethub-plugin/Cargo.toml create mode 100644 rust/rivethub-plugin/src/contract.rs create mode 100644 rust/rivethub-plugin/src/error.rs create mode 100644 rust/rivethub-plugin/src/lib.rs create mode 100644 rust/rivethub-plugin/src/plugin.rs create mode 100644 rust/rivethub-plugin/src/rivethub.rs create mode 100644 rust/rivethub-plugin/src/socket.rs create mode 100644 scripts/rust.ts diff --git a/.gitignore b/.gitignore index a8fdd94..a2fbacd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ *.tsbuildinfo .env .env.* +target diff --git a/package.json b/package.json index ee71e43..25e0b02 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,15 @@ "packages/*" ], "scripts": { - "check": "npm run lint && npm run typecheck && npm test && npm run contract:check && npm run privacy", + "check": "npm run lint && npm run typecheck && npm test && npm run contract:check && npm run privacy && npm run rust", "lint": "biome check .", "format": "biome check --write .", "typecheck": "tsc", "test": "node --test 'tests/**/*.test.ts'", "contract": "node scripts/contract.ts", "contract:check": "node scripts/contract.ts --check", - "privacy": "node scripts/privacy.ts --tracked" + "privacy": "node scripts/privacy.ts --tracked", + "rust": "cargo fmt --check --manifest-path rust/rivethub-plugin/Cargo.toml && cargo clippy --locked --all-targets --manifest-path rust/rivethub-plugin/Cargo.toml -- -D warnings && cargo test --locked --manifest-path rust/rivethub-plugin/Cargo.toml" }, "devDependencies": { "@biomejs/biome": "2.5.15", diff --git a/rust/rivethub-plugin/Cargo.lock b/rust/rivethub-plugin/Cargo.lock new file mode 100644 index 0000000..3d9b8aa --- /dev/null +++ b/rust/rivethub-plugin/Cargo.lock @@ -0,0 +1,308 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rivethub-plugin" +version = "0.1.0" +dependencies = [ + "http-body-util", + "hyper", + "hyper-util", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/rust/rivethub-plugin/Cargo.toml b/rust/rivethub-plugin/Cargo.toml new file mode 100644 index 0000000..1d1aecf --- /dev/null +++ b/rust/rivethub-plugin/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "rivethub-plugin" +version = "0.1.0" +edition = "2024" +rust-version = "1.88" +description = "Write RivetHub plug-ins in Rust: serve views, actions, canvases, tools, events and settings, and call rh" +license = "Apache-2.0" +repository = "https://github.com/philbert440/rivethub-plugins" +publish = false + +[workspace] + +[dependencies] +http-body-util = "0.1.3" +hyper = { version = "1.7", features = ["client", "http1", "server"] } +hyper-util = { version = "0.1.17", features = ["tokio"] } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" +tokio = { version = "1.48", features = ["net", "rt"] } + +[dev-dependencies] +tokio = { version = "1.48", features = ["macros", "rt"] } + +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +pedantic = { level = "warn", priority = -1 } +missing_errors_doc = "allow" diff --git a/rust/rivethub-plugin/src/contract.rs b/rust/rivethub-plugin/src/contract.rs new file mode 100644 index 0000000..f5e1b1f --- /dev/null +++ b/rust/rivethub-plugin/src/contract.rs @@ -0,0 +1,1231 @@ +// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/accepted.schema.json by npm run contract. Do not edit. + +use std::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; + +pub type JsonObject = serde_json::Map; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasAnchor { + pub id: String, + pub x: f64, + pub y: f64, + pub side: CanvasSide, + pub direction: CanvasDirection, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasArrow { + #[serde(rename = "none")] + None, + #[serde(rename = "end")] + End, + #[serde(rename = "start")] + Start, + #[serde(rename = "both")] + Both, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasDirection { + #[serde(rename = "in")] + In, + #[serde(rename = "out")] + Out, + #[serde(rename = "both")] + Both, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasEnd { + pub node: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub anchor: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasEvent { + #[serde(rename = "selected")] + Selected { + items: Vec, + }, + #[serde(rename = "moved")] + Moved { + items: Vec, + }, + #[serde(rename = "connected")] + Connected { + from: CanvasEnd, + to: CanvasEnd, + }, + #[serde(rename = "deleted")] + Deleted { + items: Vec, + }, + #[serde(rename = "activated")] + Activated { + item: String, + }, + #[serde(rename = "menu")] + Menu { + #[serde(skip_serializing_if = "Option::is_none")] + item: Option, + choice: String, + x: f64, + y: f64, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasEventRequest { + pub event: CanvasEvent, + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasGrid { + pub size: f64, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub snap: bool, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasItem { + #[serde(rename = "node")] + Node { + id: String, + x: f64, + y: f64, + width: f64, + height: f64, + shapes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + anchors: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + tooltip: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + locked: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + decorative: bool, + }, + #[serde(rename = "connector")] + Connector { + id: String, + from: CanvasEnd, + to: CanvasEnd, + route: CanvasRoute, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + dashed: bool, + arrow: CanvasArrow, + #[serde(skip_serializing_if = "Option::is_none")] + label: Option, + #[serde(skip_serializing_if = "Option::is_none")] + tooltip: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + decorative: bool, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasMenuItem { + pub id: String, + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub danger: bool, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasOp { + #[serde(rename = "upsert")] + Upsert { + item: CanvasItem, + }, + #[serde(rename = "remove")] + Remove { + ids: Vec, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasPosition { + pub id: String, + pub x: f64, + pub y: f64, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasResponse { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ops: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasRoute { + #[serde(rename = "straight")] + Straight, + #[serde(rename = "curved")] + Curved, + #[serde(rename = "orthogonal")] + Orthogonal, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasScene { + pub items: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub grid: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub viewport: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum CanvasShape { + #[serde(rename = "rect")] + Rect { + x: f64, + y: f64, + width: f64, + height: f64, + #[serde(skip_serializing_if = "Option::is_none")] + radius: Option, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + }, + #[serde(rename = "ellipse")] + Ellipse { + x: f64, + y: f64, + width: f64, + height: f64, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + }, + #[serde(rename = "text")] + Text { + x: f64, + y: f64, + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + size: Option, + #[serde(skip_serializing_if = "Option::is_none")] + weight: Option, + #[serde(skip_serializing_if = "Option::is_none")] + color: Option, + #[serde(skip_serializing_if = "Option::is_none")] + align: Option, + #[serde(rename = "maxWidth", skip_serializing_if = "Option::is_none")] + max_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "path")] + Path { + d: String, + #[serde(skip_serializing_if = "Option::is_none")] + fill: Option, + #[serde(skip_serializing_if = "Option::is_none")] + stroke: Option, + #[serde(rename = "strokeWidth", skip_serializing_if = "Option::is_none")] + stroke_width: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + dashed: bool, + }, + #[serde(rename = "icon")] + Icon { + x: f64, + y: f64, + name: String, + #[serde(skip_serializing_if = "Option::is_none")] + size: Option, + #[serde(skip_serializing_if = "Option::is_none")] + color: Option, + }, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasSide { + #[serde(rename = "top")] + Top, + #[serde(rename = "right")] + Right, + #[serde(rename = "bottom")] + Bottom, + #[serde(rename = "left")] + Left, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct CanvasViewport { + pub x: f64, + pub y: f64, + pub zoom: f64, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum CanvasWeight { + #[serde(rename = "regular")] + Regular, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "bold")] + Bold, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ColorRole { + #[serde(rename = "surface")] + Surface, + #[serde(rename = "surfaceContainer")] + SurfaceContainer, + #[serde(rename = "surfaceContainerHigh")] + SurfaceContainerHigh, + #[serde(rename = "primary")] + Primary, + #[serde(rename = "primaryContainer")] + PrimaryContainer, + #[serde(rename = "onPrimary")] + OnPrimary, + #[serde(rename = "onPrimaryContainer")] + OnPrimaryContainer, + #[serde(rename = "secondaryContainer")] + SecondaryContainer, + #[serde(rename = "onSurface")] + OnSurface, + #[serde(rename = "onSurfaceVariant")] + OnSurfaceVariant, + #[serde(rename = "outline")] + Outline, + #[serde(rename = "outlineVariant")] + OutlineVariant, + #[serde(rename = "info")] + Info, + #[serde(rename = "success")] + Success, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "danger")] + Danger, + #[serde(rename = "category1")] + Category1, + #[serde(rename = "category2")] + Category2, + #[serde(rename = "category3")] + Category3, + #[serde(rename = "category4")] + Category4, + #[serde(rename = "category5")] + Category5, + #[serde(rename = "category6")] + Category6, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +pub struct GatewayError { + pub error: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub detail: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub hint: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(rename = "harnessId", skip_serializing_if = "Option::is_none")] + pub harness_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub node: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub retryable: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum HarnessId { + #[serde(rename = "claude-code")] + ClaudeCode, + #[serde(rename = "grok-build")] + GrokBuild, + #[serde(rename = "kimi-code")] + KimiCode, + #[serde(rename = "hermes")] + Hermes, + #[serde(rename = "codex")] + Codex, + #[serde(rename = "opencode")] + Opencode, + #[serde(rename = "omp")] + Omp, + #[serde(rename = "dsh")] + Dsh, + #[serde(rename = "cursor")] + Cursor, + #[serde(rename = "cowork")] + Cowork, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Permission { + #[serde(rename = "memory.read")] + MemoryRead, + #[serde(rename = "memory.write")] + MemoryWrite, + #[serde(rename = "sessions.read")] + SessionsRead, + #[serde(rename = "sessions.control")] + SessionsControl, + #[serde(rename = "topics.read")] + TopicsRead, + #[serde(rename = "topics.write")] + TopicsWrite, + #[serde(rename = "tasks.read")] + TasksRead, + #[serde(rename = "tasks.delegate")] + TasksDelegate, + #[serde(rename = "agents.read")] + AgentsRead, + #[serde(rename = "notifications.send")] + NotificationsSend, + #[serde(rename = "host.files.read")] + HostFilesRead, + #[serde(rename = "host.files.write")] + HostFilesWrite, + #[serde(rename = "host.network")] + HostNetwork, + #[serde(rename = "host.exec")] + HostExec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PlacedBy { + #[serde(rename = "you")] + You, + #[serde(rename = "categorizer")] + Categorizer, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginContributions { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pages: Vec, + #[serde(rename = "topicCards", default, skip_serializing_if = "Vec::is_empty")] + pub topic_cards: Vec, + #[serde(rename = "sessionActions", default, skip_serializing_if = "Vec::is_empty")] + pub session_actions: Vec, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum PluginEvent { + #[serde(rename = "session.started")] + SessionStarted { + #[serde(rename = "sessionId")] + session_id: SessionId, + #[serde(rename = "topicId", skip_serializing_if = "Option::is_none")] + topic_id: Option, + }, + #[serde(rename = "session.idle")] + SessionIdle { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "session.ended")] + SessionEnded { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "session.placed")] + SessionPlaced { + #[serde(rename = "sessionId")] + session_id: SessionId, + #[serde(rename = "topicId")] + topic_id: String, + by: PlacedBy, + }, + #[serde(rename = "summary.written")] + SummaryWritten { + #[serde(rename = "summaryId")] + summary_id: String, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + session_id: Option, + kind: SummaryKind, + level: u32, + }, + #[serde(rename = "task.done")] + TaskDone { + #[serde(rename = "taskId")] + task_id: String, + status: TaskStatus, + }, + #[serde(rename = "settings.changed")] + SettingsChanged { + values: BTreeMap, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginEventDelivery { + pub seq: u64, + pub at: i64, + pub missed: u64, + pub event: PluginEvent, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginEventKind { + #[serde(rename = "session.started")] + SessionStarted, + #[serde(rename = "session.idle")] + SessionIdle, + #[serde(rename = "session.ended")] + SessionEnded, + #[serde(rename = "session.placed")] + SessionPlaced, + #[serde(rename = "summary.written")] + SummaryWritten, + #[serde(rename = "task.done")] + TaskDone, +} + +pub type PluginId = String; + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJob { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub schedule: Option, + #[serde(rename = "timeoutMs", skip_serializing_if = "Option::is_none")] + pub timeout_ms: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginJobOutcome { + #[serde(rename = "succeeded")] + Succeeded, + #[serde(rename = "failed")] + Failed, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJobRequest { + #[serde(rename = "runId")] + pub run_id: String, + pub trigger: PluginJobTrigger, + #[serde(rename = "scheduledAt", skip_serializing_if = "Option::is_none")] + pub scheduled_at: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginJobResult { + pub outcome: PluginJobOutcome, + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginJobTrigger { + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "manual")] + Manual, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginManifest { + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + pub manifest: ProtocolVersion, + pub id: PluginId, + pub name: String, + pub version: String, + pub description: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub run: PluginRun, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub permissions: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub settings: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub tools: Vec, + #[serde(default)] + pub contributes: PluginContributions, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub jobs: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub events: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginNotify { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tone: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginPage { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub view: RouteName, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginRun { + pub command: Vec, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub env: BTreeMap, + #[serde(rename = "readyTimeoutMs", skip_serializing_if = "Option::is_none")] + pub ready_timeout_ms: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginSelf { + pub id: PluginId, + pub node: String, + pub version: String, + pub permissions: Vec, + pub settings: BTreeMap, + #[serde(rename = "dataDir")] + pub data_dir: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginSessionAction { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + pub action: ViewAction, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginTool { + pub name: ToolName, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + pub description: String, + #[serde(rename = "inputSchema")] + pub input_schema: JsonObject, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hints: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginToolCall { + pub arguments: JsonObject, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum PluginToolHint { + #[serde(rename = "readOnly")] + ReadOnly, + #[serde(rename = "destructive")] + Destructive, + #[serde(rename = "idempotent")] + Idempotent, + #[serde(rename = "openWorld")] + OpenWorld, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginToolResult { + pub text: String, + #[serde(rename = "isError", default, skip_serializing_if = "std::ops::Not::not")] + pub is_error: bool, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginTopicCard { + pub id: RouteName, + pub title: String, + pub view: RouteName, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct PluginViewsChanged { + pub views: Vec, +} + +pub type ProtocolVersion = u8; + +pub type RouteName = String; + +pub type SessionId = String; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum SummaryKind { + #[serde(rename = "leaf")] + Leaf, + #[serde(rename = "branch")] + Branch, + #[serde(rename = "root")] + Root, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum TaskStatus { + #[serde(rename = "queued")] + Queued, + #[serde(rename = "running")] + Running, + #[serde(rename = "awaiting-input")] + AwaitingInput, + #[serde(rename = "completed")] + Completed, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "killed")] + Killed, + #[serde(rename = "timeout")] + Timeout, +} + +pub type ToolName = String; + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct View { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub toolbar: Vec, + pub blocks: Vec, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewAction { + #[serde(rename = "call")] + Call { + action: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, + #[serde(rename = "navigate")] + Navigate { + view: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + replace: bool, + }, + #[serde(rename = "dialog")] + Dialog { + view: RouteName, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, + #[serde(rename = "back")] + Back, + #[serde(rename = "refresh")] + Refresh, + #[serde(rename = "toast")] + Toast { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + }, + #[serde(rename = "copy")] + Copy { + text: String, + }, + #[serde(rename = "openSession")] + OpenSession { + #[serde(rename = "sessionId")] + session_id: SessionId, + }, + #[serde(rename = "openTopic")] + OpenTopic { + #[serde(rename = "topicId")] + topic_id: String, + }, + #[serde(rename = "openUrl")] + OpenUrl { + url: String, + }, + #[serde(rename = "download")] + Download { + path: String, + #[serde(skip_serializing_if = "Option::is_none")] + filename: Option, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionRefusal { + pub message: String, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub fields: BTreeMap, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionRequest { + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub values: BTreeMap, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewActionResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub actions: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewAlign { + #[serde(rename = "start")] + Start, + #[serde(rename = "center")] + Center, + #[serde(rename = "end")] + End, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewBlock { + #[serde(rename = "section")] + Section { + #[serde(skip_serializing_if = "Option::is_none")] + title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + subtitle: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + actions: Vec, + blocks: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + collapsed: Option, + }, + #[serde(rename = "split")] + Split { + primary: Vec, + secondary: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + ratio: Option, + }, + #[serde(rename = "tabs")] + Tabs { + tabs: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + selected: Option, + }, + #[serde(rename = "text")] + Text { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "markdown")] + Markdown { + text: String, + }, + #[serde(rename = "code")] + Code { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + language: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + follow: bool, + }, + #[serde(rename = "image")] + Image { + path: String, + alt: String, + }, + #[serde(rename = "properties")] + Properties { + items: Vec, + }, + #[serde(rename = "progress")] + Progress { + #[serde(skip_serializing_if = "Option::is_none")] + value: Option, + #[serde(skip_serializing_if = "Option::is_none")] + label: Option, + }, + #[serde(rename = "notice")] + Notice { + tone: ViewTone, + #[serde(skip_serializing_if = "Option::is_none")] + title: Option, + text: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + actions: Vec, + }, + #[serde(rename = "list")] + List { + items: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + empty: Option, + }, + #[serde(rename = "table")] + Table { + columns: Vec, + rows: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + empty: Option, + }, + #[serde(rename = "breadcrumbs")] + Breadcrumbs { + items: Vec, + }, + #[serde(rename = "actions")] + Actions { + buttons: Vec, + }, + #[serde(rename = "form")] + Form { + id: RouteName, + fields: Vec, + buttons: Vec, + }, + #[serde(rename = "canvas")] + Canvas { + id: RouteName, + scene: CanvasScene, + #[serde(skip_serializing_if = "Option::is_none")] + height: Option, + #[serde(rename = "readOnly", default, skip_serializing_if = "std::ops::Not::not")] + read_only: bool, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + menu: Vec, + }, + #[serde(rename = "webPanel")] + WebPanel { + id: RouteName, + entry: String, + #[serde(skip_serializing_if = "Option::is_none")] + height: Option, + #[serde(skip_serializing_if = "Option::is_none")] + params: Option, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewButton { + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub style: Option, + pub action: ViewAction, + #[serde(skip_serializing_if = "Option::is_none")] + pub confirm: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub disabled: bool, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewButtonStyle { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + #[serde(rename = "danger")] + Danger, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewColumn { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub align: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub sortable: bool, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewConfirm { + pub title: String, + pub text: String, + #[serde(rename = "confirmLabel", skip_serializing_if = "Option::is_none")] + pub confirm_label: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewContext { + #[serde(rename = "topicId", skip_serializing_if = "Option::is_none")] + pub topic_id: Option, + #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewCrumb { + pub label: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewEmpty { + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub button: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewField { + pub key: String, + pub label: String, + pub input: ViewInput, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub required: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub help: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub placeholder: Option, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewFile { + pub name: String, + #[serde(rename = "mimeType")] + pub mime_type: String, + pub data: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewInline { + #[serde(rename = "text")] + Text { + text: String, + #[serde(skip_serializing_if = "Option::is_none")] + tone: Option, + #[serde(skip_serializing_if = "Option::is_none")] + icon: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + monospace: bool, + }, + #[serde(rename = "badge")] + Badge { + text: String, + tone: ViewTone, + }, + #[serde(rename = "time")] + Time { + at: i64, + #[serde(skip_serializing_if = "Option::is_none")] + style: Option, + }, + #[serde(rename = "duration")] + Duration { + ms: u64, + }, + #[serde(rename = "bytes")] + Bytes { + value: u64, + }, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", deny_unknown_fields)] +pub enum ViewInput { + #[serde(rename = "text")] + Text { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiline: bool, + }, + #[serde(rename = "secret")] + Secret, + #[serde(rename = "number")] + Number { + #[serde(skip_serializing_if = "Option::is_none")] + min: Option, + #[serde(skip_serializing_if = "Option::is_none")] + max: Option, + #[serde(skip_serializing_if = "Option::is_none")] + step: Option, + }, + #[serde(rename = "toggle")] + Toggle, + #[serde(rename = "select")] + Select { + options: Vec, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiple: bool, + }, + #[serde(rename = "file")] + File { + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + multiple: bool, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + accept: Vec, + }, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewListItem { + pub id: String, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub subtitle: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub trailing: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub menu: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewOption { + pub value: String, + pub label: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewProperty { + pub label: String, + pub value: ViewInline, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewRequest { + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option, + #[serde(default)] + pub context: ViewContext, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewRow { + pub id: String, + pub cells: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub menu: Vec, +} + +#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ViewTab { + pub id: RouteName, + pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub badge: Option, + pub blocks: Vec, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewTimeStyle { + #[serde(rename = "relative")] + Relative, + #[serde(rename = "absolute")] + Absolute, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ViewTone { + #[serde(rename = "neutral")] + Neutral, + #[serde(rename = "info")] + Info, + #[serde(rename = "success")] + Success, + #[serde(rename = "warning")] + Warning, + #[serde(rename = "danger")] + Danger, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ViewValue { + Bool(bool), + Number(f64), + Text(String), + List(Vec), + Files(Vec), +} diff --git a/rust/rivethub-plugin/src/error.rs b/rust/rivethub-plugin/src/error.rs new file mode 100644 index 0000000..3b971fb --- /dev/null +++ b/rust/rivethub-plugin/src/error.rs @@ -0,0 +1,78 @@ +use std::fmt; + +use crate::contract::{GatewayError, ViewActionRefusal}; + +#[derive(Debug)] +pub enum Error { + Refused(ViewActionRefusal), + Failed(String), + Missing(&'static str), + RivetHub { + status: u16, + error: Box, + }, + Io(std::io::Error), + Json(serde_json::Error), + Http(hyper::Error), +} + +impl Error { + pub fn failed(message: impl Into) -> Self { + Self::Failed(message.into()) + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Refused(refusal) => f.write_str(&refusal.message), + Self::Failed(message) => f.write_str(message), + Self::Missing(name) => write!( + f, + "{name} is not set: run the plug-in from rh or rivethub-plugin-dev" + ), + Self::RivetHub { status, error } => match &error.detail { + Some(detail) => write!(f, "rh answered {status}: {}: {detail}", error.error), + None => write!(f, "rh answered {status}: {}", error.error), + }, + Self::Io(error) => error.fmt(f), + Self::Json(error) => error.fmt(f), + Self::Http(error) => error.fmt(f), + } + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Io(error) => Some(error), + Self::Json(error) => Some(error), + Self::Http(error) => Some(error), + Self::Refused(_) | Self::Failed(_) | Self::Missing(_) | Self::RivetHub { .. } => None, + } + } +} + +impl From for Error { + fn from(error: std::io::Error) -> Self { + Self::Io(error) + } +} + +impl From for Error { + fn from(error: serde_json::Error) -> Self { + Self::Json(error) + } +} + +impl From for Error { + fn from(error: hyper::Error) -> Self { + Self::Http(error) + } +} + +impl From for Error { + fn from(refusal: ViewActionRefusal) -> Self { + Self::Refused(refusal) + } +} diff --git a/rust/rivethub-plugin/src/lib.rs b/rust/rivethub-plugin/src/lib.rs new file mode 100644 index 0000000..a970a47 --- /dev/null +++ b/rust/rivethub-plugin/src/lib.rs @@ -0,0 +1,11 @@ +#[rustfmt::skip] +pub mod contract; +mod error; +mod plugin; +mod rivethub; +mod socket; + +pub use error::Error; +pub use hyper::{Method, StatusCode}; +pub use plugin::{Plugin, Reply}; +pub use rivethub::{Env, RivetHub}; diff --git a/rust/rivethub-plugin/src/plugin.rs b/rust/rivethub-plugin/src/plugin.rs new file mode 100644 index 0000000..e31e937 --- /dev/null +++ b/rust/rivethub-plugin/src/plugin.rs @@ -0,0 +1,466 @@ +use std::collections::{BTreeMap, HashMap}; +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; + +use http_body_util::{BodyExt, Full}; +use hyper::body::{Bytes, Incoming}; +use hyper::header::CONTENT_TYPE; +use hyper::server::conn::http1; +use hyper::service::service_fn; +use hyper::{Method, Request, Response, StatusCode}; +use hyper_util::rt::TokioIo; +use serde::Serialize; +use serde::de::DeserializeOwned; +use tokio::net::UnixListener; + +use crate::contract::{ + CanvasEventRequest, CanvasResponse, PluginEvent, PluginEventDelivery, PluginJobOutcome, + PluginJobRequest, PluginJobResult, PluginToolCall, PluginToolResult, View, ViewAction, + ViewActionRefusal, ViewActionRequest, ViewActionResult, ViewRequest, ViewValue, +}; +use crate::{Env, Error}; + +type Answer = Pin> + Send>>; +type Handler = Box, A) -> Answer + Send + Sync>; +type Routes = HashMap>; + +fn boxed(handler: F) -> Handler +where + F: Fn(Arc, A) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, +{ + Box::new(move |state, input| Box::pin(handler(state, input))) +} + +pub struct Plugin { + state: Arc, + views: Routes, + actions: Routes>, + canvases: Routes, + tools: Routes, + jobs: Routes>, + events: Option>, + settings: Option, ()>>, + seen: AtomicU64, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Reply { + pub status: StatusCode, + pub json: bool, + pub body: Vec, +} + +impl Reply { + fn json(status: StatusCode, value: &T) -> Self { + match serde_json::to_vec(value) { + Ok(body) => Self { + status, + json: true, + body, + }, + Err(error) => Self::text(StatusCode::INTERNAL_SERVER_ERROR, &error.to_string()), + } + } + + fn text(status: StatusCode, text: &str) -> Self { + Self { + status, + json: false, + body: text.as_bytes().to_vec(), + } + } + + fn empty() -> Self { + Self { + status: StatusCode::NO_CONTENT, + json: false, + body: Vec::new(), + } + } + + fn missing() -> Self { + Self::text(StatusCode::NOT_FOUND, "not found") + } + + fn failed(error: &Error) -> Self { + Self::text(StatusCode::INTERNAL_SERVER_ERROR, &error.to_string()) + } + + fn into_response(self) -> Response> { + let kind = if self.json { + "application/json" + } else { + "text/plain; charset=utf-8" + }; + let mut response = Response::new(Full::new(Bytes::from(self.body))); + *response.status_mut() = self.status; + if let Ok(value) = kind.parse() { + response.headers_mut().insert(CONTENT_TYPE, value); + } + response + } +} + +impl PluginToolCall { + pub fn parse(&self) -> Result { + Ok(serde_json::from_value(serde_json::Value::Object( + self.arguments.clone(), + ))?) + } +} + +impl ViewActionRefusal { + pub fn new(message: impl Into) -> Self { + Self { + message: message.into(), + fields: BTreeMap::new(), + } + } + + #[must_use] + pub fn field(mut self, key: impl Into, message: impl Into) -> Self { + self.fields.insert(key.into(), message.into()); + self + } +} + +impl Plugin { + pub fn new(state: S) -> Self { + Self { + state: Arc::new(state), + views: HashMap::new(), + actions: HashMap::new(), + canvases: HashMap::new(), + tools: HashMap::new(), + jobs: HashMap::new(), + events: None, + settings: None, + seen: AtomicU64::new(0), + } + } + + #[must_use] + pub fn view(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, ViewRequest) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.views.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn action(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, ViewActionRequest) -> Fut + Send + Sync + 'static, + Fut: Future, Error>> + Send + 'static, + { + self.actions.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn canvas(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, CanvasEventRequest) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.canvases.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn tool(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, PluginToolCall) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.tools.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn job(mut self, name: &str, handler: F) -> Self + where + F: Fn(Arc, PluginJobRequest) -> Fut + Send + Sync + 'static, + Fut: Future, Error>> + Send + 'static, + { + self.jobs.insert(name.to_owned(), boxed(handler)); + self + } + + #[must_use] + pub fn events(mut self, handler: F) -> Self + where + F: Fn(Arc, PluginEventDelivery) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.events = Some(boxed(handler)); + self + } + + #[must_use] + pub fn settings(mut self, handler: F) -> Self + where + F: Fn(Arc, BTreeMap) -> Fut + Send + Sync + 'static, + Fut: Future> + Send + 'static, + { + self.settings = Some(boxed(handler)); + self + } + + pub async fn serve(self) -> Result<(), Error> { + let env = Env::from_env()?; + if let Some(settings) = &self.settings { + let own = env.rivethub().own().await?; + settings(Arc::clone(&self.state), own.settings).await?; + } + let listener = UnixListener::bind(&env.socket)?; + let plugin = Arc::new(self); + loop { + let (stream, _) = listener.accept().await?; + let plugin = Arc::clone(&plugin); + tokio::spawn(async move { + let service = service_fn(move |request| { + let plugin = Arc::clone(&plugin); + async move { plugin.respond(request).await } + }); + if let Err(error) = http1::Builder::new() + .serve_connection(TokioIo::new(stream), service) + .await + { + eprintln!("rivethub-plugin: {error}"); + } + }); + } + } + + async fn respond(&self, request: Request) -> Result>, Error> { + let (parts, body) = request.into_parts(); + let body = body.collect().await?.to_bytes(); + Ok(self + .handle(&parts.method, parts.uri.path(), &body) + .await + .into_response()) + } + + pub async fn handle(&self, method: &Method, path: &str, body: &[u8]) -> Reply { + let segments: Vec<&str> = path.split('/').filter(|part| !part.is_empty()).collect(); + if method == Method::GET && segments == ["health"] { + return Reply::text(StatusCode::OK, "ok"); + } + if method != Method::POST { + return Reply::missing(); + } + match segments.as_slice() { + ["views", name] => match self.call(self.views.get(*name), body).await { + Ok(Ok(view)) => Reply::json(StatusCode::OK, &view), + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["actions", name] => match self.call(self.actions.get(*name), body).await { + Ok(Ok(actions)) => Reply::json(StatusCode::OK, &ViewActionResult { actions }), + Ok(Err(Error::Refused(refusal))) => { + Reply::json(StatusCode::UNPROCESSABLE_ENTITY, &refusal) + } + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["canvas", name, "events"] => match self.call(self.canvases.get(*name), body).await { + Ok(Ok(answer)) => Reply::json(StatusCode::OK, &answer), + Ok(Err(error)) => Reply::failed(&error), + Err(reply) => reply, + }, + ["tools", name] => match self.call(self.tools.get(*name), body).await { + Ok(outcome) => { + let is_error = outcome.is_err(); + let text = outcome.unwrap_or_else(|error| error.to_string()); + Reply::json(StatusCode::OK, &PluginToolResult { text, is_error }) + } + Err(reply) => reply, + }, + ["jobs", name] => match self.call(self.jobs.get(*name), body).await { + Ok(outcome) => { + let result = match outcome { + Ok(message) => PluginJobResult { + outcome: PluginJobOutcome::Succeeded, + message, + }, + Err(error) => PluginJobResult { + outcome: PluginJobOutcome::Failed, + message: Some(error.to_string()), + }, + }; + Reply::json(StatusCode::OK, &result) + } + Err(reply) => reply, + }, + ["events"] => self.event(body).await, + _ => Reply::missing(), + } + } + + async fn call( + &self, + handler: Option<&Handler>, + body: &[u8], + ) -> Result, Reply> + where + A: DeserializeOwned, + { + let handler = handler.ok_or_else(Reply::missing)?; + let input = serde_json::from_slice(body) + .map_err(|error| Reply::text(StatusCode::BAD_REQUEST, &error.to_string()))?; + Ok(handler(Arc::clone(&self.state), input).await) + } + + async fn event(&self, body: &[u8]) -> Reply { + let delivery: PluginEventDelivery = match serde_json::from_slice(body) { + Ok(delivery) => delivery, + Err(error) => return Reply::text(StatusCode::BAD_REQUEST, &error.to_string()), + }; + let seq = delivery.seq; + if seq <= self.seen.load(Ordering::Acquire) { + return Reply::empty(); + } + let handled = match (delivery.event, &self.settings) { + (PluginEvent::SettingsChanged { values }, Some(settings)) => { + settings(Arc::clone(&self.state), values).await + } + (event, _) => match &self.events { + Some(events) => { + let delivery = PluginEventDelivery { event, ..delivery }; + events(Arc::clone(&self.state), delivery).await + } + None => Ok(()), + }, + }; + match handled { + Ok(()) => { + self.seen.store(seq, Ordering::Release); + Reply::empty() + } + Err(error) => Reply::failed(&error), + } + } +} + +#[cfg(test)] +mod tests { + use std::sync::Mutex; + + use serde_json::{Value, json}; + + use super::*; + + async fn post(plugin: &Plugin>>, path: &str, body: &Value) -> Reply { + plugin + .handle(&Method::POST, path, body.to_string().as_bytes()) + .await + } + + fn parsed(reply: &Reply) -> Value { + serde_json::from_slice(&reply.body).unwrap_or(Value::Null) + } + + #[tokio::test] + async fn an_action_refusal_answers_422_naming_its_fields() { + let plugin = Plugin::new(Mutex::new(Vec::new())).action("add", |_, request| async move { + if request.values.contains_key("title") { + Ok(vec![ViewAction::Refresh]) + } else { + Err(ViewActionRefusal::new("Give it a title") + .field("title", "Required") + .into()) + } + }); + let refused = post(&plugin, "/actions/add", &json!({"context": {}})).await; + assert_eq!(refused.status, StatusCode::UNPROCESSABLE_ENTITY); + assert_eq!( + parsed(&refused), + json!({"message": "Give it a title", "fields": {"title": "Required"}}) + ); + let accepted = post(&plugin, "/actions/add", &json!({"values": {"title": "x"}})).await; + assert_eq!(parsed(&accepted), json!({"actions": [{"type": "refresh"}]})); + } + + #[tokio::test] + async fn a_failing_tool_answers_its_message_as_an_error_result() { + let plugin = Plugin::new(Mutex::new(Vec::new())).tool("add_item", |_, call| async move { + let title: String = call.parse::()?["title"] + .as_str() + .ok_or_else(|| Error::failed("title must be a string"))? + .to_owned(); + Ok(format!("added {title}")) + }); + let added = post( + &plugin, + "/tools/add_item", + &json!({"arguments": {"title": "x"}}), + ) + .await; + assert_eq!(parsed(&added), json!({"text": "added x"})); + let failed = post(&plugin, "/tools/add_item", &json!({"arguments": {}})).await; + assert_eq!( + parsed(&failed), + json!({"text": "title must be a string", "isError": true}) + ); + } + + #[tokio::test] + async fn a_repeated_delivery_is_handled_once_and_a_failed_one_is_retried() { + let plugin = Plugin::new(Mutex::new(Vec::new())) + .events(|seen, delivery| async move { + if let PluginEvent::SessionIdle { session_id } = delivery.event { + let mut seen = seen + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + if session_id == "b" && !seen.contains(&"failed".to_owned()) { + seen.push("failed".to_owned()); + return Err(Error::failed("not yet")); + } + seen.push(session_id); + } + Ok(()) + }) + .settings(|seen, values| async move { + let text = serde_json::to_string(&values)?; + seen.lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .push(text); + Ok(()) + }); + let deliver = + |seq: u64, event: Value| json!({"seq": seq, "at": 0, "missed": 0, "event": event}); + let idle = |session: &str| json!({"type": "session.idle", "sessionId": session}); + let settings = json!({"type": "settings.changed", "values": {"on": true}}); + let statuses = [ + post(&plugin, "/events", &deliver(1, idle("a"))) + .await + .status, + post(&plugin, "/events", &deliver(1, idle("a"))) + .await + .status, + post(&plugin, "/events", &deliver(2, settings)).await.status, + post(&plugin, "/events", &deliver(3, idle("b"))) + .await + .status, + post(&plugin, "/events", &deliver(3, idle("b"))) + .await + .status, + ]; + assert_eq!( + statuses.map(|status| status.as_u16()), + [204, 204, 204, 500, 204] + ); + let seen = plugin + .state + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .clone(); + assert_eq!(seen, ["a", r#"{"on":true}"#, "failed", "b"]); + } +} diff --git a/rust/rivethub-plugin/src/rivethub.rs b/rust/rivethub-plugin/src/rivethub.rs new file mode 100644 index 0000000..caf2a19 --- /dev/null +++ b/rust/rivethub-plugin/src/rivethub.rs @@ -0,0 +1,131 @@ +use std::path::PathBuf; + +use http_body_util::Full; +use hyper::body::Bytes; +use hyper::header::{AUTHORIZATION, CONTENT_TYPE, HOST}; +use hyper::{Method, Request}; +use serde::Serialize; +use serde::de::DeserializeOwned; + +use crate::Error; +use crate::contract::{GatewayError, PluginNotify, PluginSelf, PluginViewsChanged}; + +#[derive(Debug, Clone)] +pub struct Env { + pub id: String, + pub node: String, + pub data_dir: PathBuf, + pub socket: PathBuf, + pub api_socket: PathBuf, + pub token: String, +} + +impl Env { + pub fn from_env() -> Result { + let read = |name: &'static str| { + std::env::var(name) + .ok() + .filter(|value| !value.is_empty()) + .ok_or(Error::Missing(name)) + }; + Ok(Self { + id: read("RIVETHUB_PLUGIN_ID")?, + node: read("RIVETHUB_PLUGIN_NODE")?, + data_dir: read("RIVETHUB_PLUGIN_DATA")?.into(), + socket: read("RIVETHUB_PLUGIN_SOCKET")?.into(), + api_socket: read("RIVETHUB_API_SOCKET")?.into(), + token: read("RIVETHUB_PLUGIN_TOKEN")?, + }) + } + + #[must_use] + pub fn rivethub(&self) -> RivetHub { + RivetHub::new(&self.api_socket, &self.token) + } +} + +#[derive(Debug, Clone)] +pub struct RivetHub { + socket: PathBuf, + token: String, +} + +impl RivetHub { + pub fn new(socket: impl Into, token: impl Into) -> Self { + Self { + socket: socket.into(), + token: token.into(), + } + } + + pub async fn own(&self) -> Result { + self.get("/api/plugin/self").await + } + + pub async fn views_changed(&self, views: I) -> Result<(), Error> + where + I: IntoIterator, + I::Item: Into, + { + let changed = PluginViewsChanged { + views: views.into_iter().map(Into::into).collect(), + }; + self.post("/api/plugin/views/changed", &changed).await + } + + pub async fn notify(&self, notice: &PluginNotify) -> Result<(), Error> { + self.post("/api/plugin/notify", notice).await + } + + pub async fn get(&self, path: &str) -> Result { + self.request(Method::GET, path, None::<&()>).await + } + + pub async fn post(&self, path: &str, body: &B) -> Result + where + B: Serialize + ?Sized, + T: DeserializeOwned, + { + self.request(Method::POST, path, Some(body)).await + } + + pub async fn request( + &self, + method: Method, + path: &str, + body: Option<&B>, + ) -> Result + where + B: Serialize + ?Sized, + T: DeserializeOwned, + { + let mut builder = Request::builder() + .method(method) + .uri(path) + .header(HOST, "rivethub") + .header(AUTHORIZATION, format!("Bearer {}", self.token)); + let payload = match body { + Some(body) => { + builder = builder.header(CONTENT_TYPE, "application/json"); + serde_json::to_vec(body)? + } + None => Vec::new(), + }; + let request = builder + .body(Full::new(Bytes::from(payload))) + .map_err(|error| Error::failed(error.to_string()))?; + let (status, bytes) = crate::socket::send(&self.socket, request).await?; + if !status.is_success() { + let error = serde_json::from_slice(&bytes).unwrap_or_else(|_| GatewayError { + error: String::from_utf8_lossy(&bytes).into_owned(), + ..GatewayError::default() + }); + return Err(Error::RivetHub { + status: status.as_u16(), + error: Box::new(error), + }); + } + let bytes: &[u8] = if bytes.is_empty() { b"null" } else { &bytes }; + Ok(serde_json::from_slice(bytes)?) + } +} diff --git a/rust/rivethub-plugin/src/socket.rs b/rust/rivethub-plugin/src/socket.rs new file mode 100644 index 0000000..5b5aef8 --- /dev/null +++ b/rust/rivethub-plugin/src/socket.rs @@ -0,0 +1,23 @@ +use std::path::Path; + +use http_body_util::{BodyExt, Full}; +use hyper::body::Bytes; +use hyper::{Request, StatusCode}; +use hyper_util::rt::TokioIo; +use tokio::net::UnixStream; + +use crate::Error; + +pub(crate) async fn send( + socket: &Path, + request: Request>, +) -> Result<(StatusCode, Bytes), Error> { + let stream = UnixStream::connect(socket).await?; + let (mut sender, connection) = + hyper::client::conn::http1::handshake(TokioIo::new(stream)).await?; + tokio::spawn(connection); + let response = sender.send_request(request).await?; + let status = response.status(); + let body = response.into_body().collect().await?.to_bytes(); + Ok((status, body)) +} diff --git a/scripts/contract.ts b/scripts/contract.ts index df6b82f..e4dec19 100644 --- a/scripts/contract.ts +++ b/scripts/contract.ts @@ -1,6 +1,7 @@ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { compile } from 'json-schema-to-typescript' +import { rustContract } from './rust.ts' type Pin = { repository: string; ref: string } @@ -50,6 +51,10 @@ for (const [direction, name] of Object.entries(DIRECTIONS)) { bannerComment: `// Generated from ${pin.repository}@${pin.ref} contract/${direction}.schema.json by npm run contract. Do not edit.`, }) emit(join(PACKAGE, 'src', `${direction}.ts`), types) + if (direction === 'accepted') { + const banner = `Generated from ${pin.repository}@${pin.ref} contract/accepted.schema.json by npm run contract. Do not edit.` + emit(join(ROOT, 'rust', 'rivethub-plugin', 'src', 'contract.rs'), rustContract(JSON.parse(schema), banner)) + } } if (stale.length > 0) { diff --git a/scripts/rust.ts b/scripts/rust.ts new file mode 100644 index 0000000..e5b0a71 --- /dev/null +++ b/scripts/rust.ts @@ -0,0 +1,313 @@ +type Json = null | boolean | number | string | Json[] | { [key: string]: Json } +type Node = { [key: string]: Json } + +type Field = { json: string; rust: string; type: string; attrs: string[] } +type Variant = { value: string; name: string; fields: Field[] } +type Item = + | { kind: 'alias'; name: string; target: string } + | { kind: 'struct'; name: string; fields: Field[]; deny: boolean } + | { kind: 'enum'; name: string; values: string[] } + | { kind: 'tagged'; name: string; tag: string; variants: Variant[]; deny: boolean } + | { kind: 'untagged'; name: string; variants: { name: string; type: string }[] } +type Shape = { rust: string; nullable: boolean; kind: 'bool' | 'vec' | 'map' | 'other' } + +export const RUST_ROOTS = [ + 'PluginManifest', + 'View', + 'ViewRequest', + 'ViewActionRequest', + 'ViewActionResult', + 'ViewActionRefusal', + 'CanvasEventRequest', + 'CanvasResponse', + 'PluginToolCall', + 'PluginToolResult', + 'PluginEventDelivery', + 'PluginJobRequest', + 'PluginJobResult', + 'PluginSelf', + 'PluginViewsChanged', + 'PluginNotify', + 'GatewayError', +] + +const KEYWORDS = new Set( + 'as async await break const continue crate dyn else enum extern false fn for gen if impl in let loop match mod move mut pub ref return self static struct super trait true try type unsafe use where while yield'.split( + ' ', + ), +) +const INTEGERS: Record = { + int8: 'i8', + int16: 'i16', + int32: 'i32', + int64: 'i64', + uint8: 'u8', + uint16: 'u16', + uint32: 'u32', + uint64: 'u64', +} +const DEFAULTABLE = new Set(['String', 'bool', 'f64', 'JsonObject', ...Object.values(INTEGERS)]) + +const isNode = (value: Json | undefined): value is Node => + typeof value === 'object' && value !== null && !Array.isArray(value) + +function unsupported(at: string, schema: Json | undefined): never { + throw new Error(`${at}: no Rust mapping for ${JSON.stringify(schema)}`) +} + +function refName(ref: Json | undefined, at: string): string { + if (typeof ref !== 'string' || !ref.startsWith('#/$defs/')) unsupported(at, ref) + return ref.slice('#/$defs/'.length) +} + +const pascal = (value: string): string => { + const name = value + .split(/[^A-Za-z0-9]+/) + .filter(Boolean) + .map((part) => part.charAt(0).toUpperCase() + part.slice(1)) + .join('') + return /^[0-9]/.test(name) ? `V${name}` : name +} + +const snake = (json: string): string => { + const name = json + .replace(/^\$/, '') + .replace(/([a-z0-9])([A-Z])/g, '$1_$2') + .toLowerCase() + return KEYWORDS.has(name) ? `r#${name}` : name +} + +function references(schema: Json, found: string[]): void { + if (Array.isArray(schema)) { + for (const item of schema) references(item, found) + } else if (isNode(schema)) { + for (const [key, value] of Object.entries(schema)) { + if (key === '$ref') found.push(refName(value, key)) + else references(value, found) + } + } +} + +function reachable(defs: Node, roots: string[]): string[] { + const kept = new Set() + const pending = [...roots] + for (let name = pending.pop(); name !== undefined; name = pending.pop()) { + if (kept.has(name)) continue + const schema = defs[name] + if (schema === undefined) throw new Error(`the contract has no definition ${name}`) + kept.add(name) + references(schema, pending) + } + return [...kept].sort() +} + +function shape(schema: Json | undefined, at: string): Shape { + if (!isNode(schema)) unsupported(at, schema) + const plain = (rust: string): Shape => ({ rust, nullable: false, kind: 'other' }) + if (schema.$ref !== undefined) return plain(refName(schema.$ref, at)) + if (Array.isArray(schema.anyOf)) { + const present = schema.anyOf.filter((branch) => !(isNode(branch) && branch.type === 'null')) + if (present.length !== 1 || schema.anyOf.length !== 2) unsupported(at, schema) + return { ...shape(present[0], at), nullable: true } + } + if (Array.isArray(schema.type)) { + const present = schema.type.filter((type) => type !== 'null') + if (present.length !== 1 || schema.type.length !== 2) unsupported(at, schema) + return { ...shape({ ...schema, type: present[0] ?? null }, at), nullable: true } + } + switch (schema.type) { + case 'string': + return plain('String') + case 'boolean': + return { rust: 'bool', nullable: false, kind: 'bool' } + case 'number': + return plain('f64') + case 'integer': { + const rust = INTEGERS[typeof schema.format === 'string' ? schema.format : 'int64'] + if (rust === undefined) unsupported(at, schema) + return plain(rust) + } + case 'array': { + const item = shape(schema.items, `${at}[]`) + return { rust: `Vec<${item.nullable ? `Option<${item.rust}>` : item.rust}>`, nullable: false, kind: 'vec' } + } + case 'object': { + if (schema.properties !== undefined) unsupported(at, schema) + if (schema.additionalProperties === true) return plain('JsonObject') + const value = shape(schema.additionalProperties, `${at}{}`) + const rust = value.nullable ? `Option<${value.rust}>` : value.rust + return { rust: `BTreeMap`, nullable: false, kind: 'map' } + } + default: + return unsupported(at, schema) + } +} + +function fields(schema: Node, at: string, skip?: string): Field[] { + const properties = isNode(schema.properties) ? schema.properties : {} + const required = new Set(Array.isArray(schema.required) ? schema.required : []) + return Object.entries(properties) + .filter(([json]) => json !== skip) + .map(([json, property]) => { + const where = `${at}.${json}` + const found = shape(property, where) + const rust = snake(json) + const attrs = rust.replace(/^r#/, '') === json ? [] : [`rename = "${json}"`] + let type = found.rust + if (found.nullable) { + type = `Option<${found.rust}>` + if (!required.has(json)) attrs.push('skip_serializing_if = "Option::is_none"') + } else if (!required.has(json)) { + if (found.kind === 'bool') attrs.push('default', 'skip_serializing_if = "std::ops::Not::not"') + else if (found.kind === 'vec') attrs.push('default', 'skip_serializing_if = "Vec::is_empty"') + else if (found.kind === 'map') attrs.push('default', 'skip_serializing_if = "BTreeMap::is_empty"') + else if (isNode(property) && property.default !== undefined) attrs.push('default') + else { + type = `Option<${found.rust}>` + attrs.push('skip_serializing_if = "Option::is_none"') + } + } + return { json, rust, type, attrs } + }) +} + +function untaggedName(branch: Json, at: string): string { + if (!isNode(branch)) unsupported(at, branch) + if (branch.$ref !== undefined) return refName(branch.$ref, at) + if (branch.type === 'boolean') return 'Bool' + if (branch.type === 'number') return 'Number' + if (branch.type === 'integer') return 'Integer' + if (branch.type === 'string') return 'Text' + if (branch.type === 'array' && isNode(branch.items)) { + if (branch.items.type === 'string') return 'List' + const words = refName(branch.items.$ref, at).match(/[A-Z][a-z0-9]*/g) ?? [] + return `${words.at(-1) ?? ''}s` + } + return unsupported(at, branch) +} + +function item(name: string, schema: Json | undefined): Item { + if (!isNode(schema)) unsupported(name, schema) + if (Array.isArray(schema.oneOf)) { + const branches = schema.oneOf.map((branch) => (isNode(branch) ? branch : unsupported(name, branch))) + const tags = branches.map((branch) => + Object.entries(isNode(branch.properties) ? branch.properties : {}).find( + ([, property]) => isNode(property) && typeof property.const === 'string', + ), + ) + const tag = tags[0]?.[0] + if (tag === undefined || tags.some((found) => found?.[0] !== tag)) unsupported(name, schema) + const variants = branches.map((branch, index) => { + const found = tags[index]?.[1] + const value = isNode(found) && typeof found.const === 'string' ? found.const : unsupported(name, branch) + return { value, name: pascal(value), fields: fields(branch, `${name}.${value}`, tag) } + }) + return { kind: 'tagged', name, tag, variants, deny: branches.every((b) => b.additionalProperties === false) } + } + if (Array.isArray(schema.anyOf)) { + const variants = schema.anyOf.map((branch, index) => ({ + name: untaggedName(branch, `${name}.anyOf[${index}]`), + type: shape(branch, `${name}.anyOf[${index}]`).rust, + })) + if (new Set(variants.map((variant) => variant.name)).size !== variants.length) unsupported(name, schema) + return { kind: 'untagged', name, variants } + } + if (schema.type === 'string' && Array.isArray(schema.enum)) { + return { kind: 'enum', name, values: schema.enum.map((value) => String(value)) } + } + if (schema.type === 'object' && isNode(schema.properties)) { + return { kind: 'struct', name, fields: fields(schema, name), deny: schema.additionalProperties === false } + } + return { kind: 'alias', name, target: shape(schema, name).rust } +} + +function defaults(items: Map): Set { + const known = new Map() + const defaultable = (type: string): boolean => { + if (DEFAULTABLE.has(type) || /^(Option|Vec|BTreeMap) defaultable(field.type)) + known.set(type, result) + return result + } + return new Set([...items.keys()].filter((name) => items.get(name)?.kind === 'struct' && defaultable(name))) +} + +function fieldLines(field: Field, indent: string, visibility: string): string[] { + const attrs = field.attrs.length > 0 ? [`${indent}#[serde(${field.attrs.join(', ')})]`] : [] + return [...attrs, `${indent}${visibility}${field.rust}: ${field.type},`] +} + +function render(item: Item, defaultable: Set): string[] { + const derive = (extra: string[]) => + `#[derive(${['Debug', 'Clone', ...extra, 'Serialize', 'Deserialize'].join(', ')})]` + switch (item.kind) { + case 'alias': + return [`pub type ${item.name} = ${item.target};`] + case 'struct': + return [ + derive(defaultable.has(item.name) ? ['Default', 'PartialEq'] : ['PartialEq']), + ...(item.deny ? ['#[serde(deny_unknown_fields)]'] : []), + `pub struct ${item.name} {`, + ...item.fields.flatMap((field) => fieldLines(field, ' ', 'pub ')), + '}', + ] + case 'enum': + return [ + derive(['Copy', 'PartialEq', 'Eq', 'Hash']), + `pub enum ${item.name} {`, + ...item.values.flatMap((value) => [` #[serde(rename = "${value}")]`, ` ${pascal(value)},`]), + '}', + ] + case 'tagged': + return [ + derive(['PartialEq']), + `#[serde(tag = "${item.tag}"${item.deny ? ', deny_unknown_fields' : ''})]`, + `pub enum ${item.name} {`, + ...item.variants.flatMap((variant) => [ + ` #[serde(rename = "${variant.value}")]`, + ...(variant.fields.length === 0 + ? [` ${variant.name},`] + : [ + ` ${variant.name} {`, + ...variant.fields.flatMap((field) => fieldLines(field, ' ', '')), + ' },', + ]), + ]), + '}', + ] + case 'untagged': + return [ + derive(['PartialEq']), + '#[serde(untagged)]', + `pub enum ${item.name} {`, + ...item.variants.map((variant) => ` ${variant.name}(${variant.type}),`), + '}', + ] + } +} + +export function rustContract(schema: Json, banner: string): string { + const defs = isNode(schema) && isNode(schema.$defs) ? schema.$defs : unsupported('$defs', schema) + const items = new Map(reachable(defs, RUST_ROOTS).map((name) => [name, item(name, defs[name])])) + const defaultable = defaults(items) + const body = [...items.values()].map((found) => render(found, defaultable).join('\n')) + const usesMap = body.some((text) => text.includes('BTreeMap<')) + return [ + `// ${banner}`, + '', + ...(usesMap ? ['use std::collections::BTreeMap;', ''] : []), + 'use serde::{Deserialize, Serialize};', + '', + 'pub type JsonObject = serde_json::Map;', + '', + body.join('\n\n'), + '', + ].join('\n') +} From 89288bcb10ef33b65a0d8f6e2f6cbccfbb21e4b9 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 00:24:11 -0400 Subject: [PATCH 04/11] feat(templates): add checklist plug-in templates in TypeScript and Rust Each template is a plug-in to start from: a page whose view has a form and a list (add, toggle and remove are actions, and a missing title is refused beside the field), an add_item agent tool that also tells open clients the page changed, and a session.placed subscription that lists the sessions filed lately. The TypeScript one adds a canvas board: items are nodes, a drag keeps their place, a double-click marks one done with an upsert, and Delete removes it with a remove op. Both keep their state in the plug-in's data folder and ask only for sessions.read. Under Landlock a plug-in reads only its own directory and the program it runs, so the TypeScript template runs dist/plugin.js, bundled with esbuild by npm run build, and the Rust one its release binary. Icons are names the desktop bundles. npm run rust now checks the Rust template too. --- package-lock.json | 501 +++++++++++++++++++++- package.json | 5 +- templates/rust/Cargo.lock | 318 ++++++++++++++ templates/rust/Cargo.toml | 22 + templates/rust/rivethub-plugin.json | 26 ++ templates/rust/src/checklist.rs | 104 +++++ templates/rust/src/main.rs | 237 ++++++++++ templates/typescript/package.json | 16 + templates/typescript/rivethub-plugin.json | 26 ++ templates/typescript/src/checklist.ts | 75 ++++ templates/typescript/src/plugin.ts | 187 ++++++++ tsconfig.json | 2 +- 12 files changed, 1515 insertions(+), 4 deletions(-) create mode 100644 templates/rust/Cargo.lock create mode 100644 templates/rust/Cargo.toml create mode 100644 templates/rust/rivethub-plugin.json create mode 100644 templates/rust/src/checklist.rs create mode 100644 templates/rust/src/main.rs create mode 100644 templates/typescript/package.json create mode 100644 templates/typescript/rivethub-plugin.json create mode 100644 templates/typescript/src/checklist.ts create mode 100644 templates/typescript/src/plugin.ts diff --git a/package-lock.json b/package-lock.json index 5fef210..3a53a85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,8 @@ "": { "name": "rivethub-workflows", "workspaces": [ - "packages/*" + "packages/*", + "templates/typescript" ], "devDependencies": { "@biomejs/biome": "2.5.15", @@ -229,6 +230,448 @@ "node": ">=14.21.3" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@jsdevtools/ono": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", @@ -625,6 +1068,52 @@ ], "license": "PSF-2.0" }, + "node_modules/checklist-ts": { + "resolved": "templates/typescript", + "link": true + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -807,6 +1296,16 @@ "bin": { "rivethub-plugin-dev": "src/dev.ts" } + }, + "templates/typescript": { + "name": "checklist-ts", + "version": "0.1.0", + "dependencies": { + "@rivethub/plugin-sdk": "0.0.0" + }, + "devDependencies": { + "esbuild": "0.28.2" + } } } } diff --git a/package.json b/package.json index 25e0b02..c1cd77f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "node": ">=22.19.0" }, "workspaces": [ - "packages/*" + "packages/*", + "templates/typescript" ], "scripts": { "check": "npm run lint && npm run typecheck && npm test && npm run contract:check && npm run privacy && npm run rust", @@ -17,7 +18,7 @@ "contract": "node scripts/contract.ts", "contract:check": "node scripts/contract.ts --check", "privacy": "node scripts/privacy.ts --tracked", - "rust": "cargo fmt --check --manifest-path rust/rivethub-plugin/Cargo.toml && cargo clippy --locked --all-targets --manifest-path rust/rivethub-plugin/Cargo.toml -- -D warnings && cargo test --locked --manifest-path rust/rivethub-plugin/Cargo.toml" + "rust": "cargo fmt --check --manifest-path rust/rivethub-plugin/Cargo.toml && cargo clippy --locked --all-targets --manifest-path rust/rivethub-plugin/Cargo.toml -- -D warnings && cargo test --locked --manifest-path rust/rivethub-plugin/Cargo.toml && cargo fmt --check --manifest-path templates/rust/Cargo.toml && cargo clippy --locked --all-targets --manifest-path templates/rust/Cargo.toml -- -D warnings" }, "devDependencies": { "@biomejs/biome": "2.5.15", diff --git a/templates/rust/Cargo.lock b/templates/rust/Cargo.lock new file mode 100644 index 0000000..13c3eec --- /dev/null +++ b/templates/rust/Cargo.lock @@ -0,0 +1,318 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "checklist-rust" +version = "0.1.0" +dependencies = [ + "rivethub-plugin", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rivethub-plugin" +version = "0.1.0" +dependencies = [ + "http-body-util", + "hyper", + "hyper-util", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml new file mode 100644 index 0000000..283d0e2 --- /dev/null +++ b/templates/rust/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "checklist-rust" +version = "0.1.0" +edition = "2024" +rust-version = "1.88" +license = "Apache-2.0" +publish = false + +[workspace] + +[dependencies] +rivethub-plugin = { path = "../../rust/rivethub-plugin" } +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.145" +tokio = { version = "1.48", features = ["macros", "rt-multi-thread"] } + +[lints.rust] +unsafe_code = "forbid" + +[lints.clippy] +pedantic = { level = "warn", priority = -1 } +missing_errors_doc = "allow" diff --git a/templates/rust/rivethub-plugin.json b/templates/rust/rivethub-plugin.json new file mode 100644 index 0000000..6def433 --- /dev/null +++ b/templates/rust/rivethub-plugin.json @@ -0,0 +1,26 @@ +{ + "manifest": 1, + "id": "checklist-rust", + "name": "Checklist (Rust)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with the sessions filed lately.", + "icon": "checklist", + "run": { "command": ["target/release/checklist-rust"] }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { "title": { "type": "string", "description": "What needs doing" } }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [{ "id": "checklist", "title": "Checklist", "icon": "checklist", "view": "main" }] + }, + "events": ["session.placed"] +} diff --git a/templates/rust/src/checklist.rs b/templates/rust/src/checklist.rs new file mode 100644 index 0000000..b25218e --- /dev/null +++ b/templates/rust/src/checklist.rs @@ -0,0 +1,104 @@ +use std::path::{Path, PathBuf}; +use std::sync::{Mutex, MutexGuard, PoisonError}; + +use rivethub_plugin::Error; +use rivethub_plugin::contract::PlacedBy; +use serde::{Deserialize, Serialize}; + +const KEPT_FILINGS: usize = 5; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Item { + pub id: String, + pub title: String, + pub done: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Filing { + pub session_id: String, + pub topic_id: String, + pub by: PlacedBy, + pub at: i64, +} + +#[derive(Debug, Serialize, Deserialize)] +struct State { + next: u64, + items: Vec, + filings: Vec, +} + +pub struct Checklist { + file: PathBuf, + state: Mutex, +} + +impl Checklist { + pub fn open(data_dir: &Path) -> Self { + let file = data_dir.join("checklist.json"); + let state = std::fs::read(&file) + .ok() + .and_then(|bytes| serde_json::from_slice(&bytes).ok()) + .unwrap_or(State { + next: 1, + items: Vec::new(), + filings: Vec::new(), + }); + Self { + file, + state: Mutex::new(state), + } + } + + pub fn items(&self) -> Vec { + self.lock().items.clone() + } + + pub fn filings(&self) -> Vec { + self.lock().filings.clone() + } + + pub fn add(&self, title: &str) -> Result { + self.change(|state| { + state.items.push(Item { + id: state.next.to_string(), + title: title.to_owned(), + done: false, + }); + state.next += 1; + }) + } + + pub fn toggle(&self, id: &str) -> Result { + self.change(|state| { + if let Some(item) = state.items.iter_mut().find(|item| item.id == id) { + item.done = !item.done; + } + }) + } + + pub fn remove(&self, id: &str) -> Result { + self.change(|state| state.items.retain(|item| item.id != id)) + } + + pub fn filed(&self, filing: Filing) -> Result { + self.change(|state| { + state.filings.insert(0, filing); + state.filings.truncate(KEPT_FILINGS); + }) + } + + fn lock(&self) -> MutexGuard<'_, State> { + self.state.lock().unwrap_or_else(PoisonError::into_inner) + } + + fn change(&self, edit: impl FnOnce(&mut State)) -> Result { + let mut state = self.lock(); + edit(&mut state); + let saving = self.file.with_extension("json.tmp"); + std::fs::write(&saving, serde_json::to_vec(&*state)?)?; + std::fs::rename(&saving, &self.file)?; + Ok(state.items.iter().filter(|item| !item.done).count()) + } +} diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs new file mode 100644 index 0000000..9d8cbb8 --- /dev/null +++ b/templates/rust/src/main.rs @@ -0,0 +1,237 @@ +mod checklist; + +use rivethub_plugin::contract::{ + JsonObject, PlacedBy, PluginEvent, PluginEventDelivery, PluginToolCall, View, ViewAction, + ViewActionRefusal, ViewActionRequest, ViewBlock, ViewButton, ViewButtonStyle, ViewEmpty, + ViewField, ViewInline, ViewInput, ViewListItem, ViewTimeStyle, ViewTone, ViewValue, +}; +use rivethub_plugin::{Env, Error, Plugin, RivetHub}; +use serde::Deserialize; + +use crate::checklist::{Checklist, Filing, Item}; + +struct App { + checklist: Checklist, + rh: RivetHub, +} + +#[derive(Deserialize)] +struct AddItem { + title: String, +} + +#[tokio::main] +async fn main() -> Result<(), Error> { + let env = Env::from_env()?; + let app = App { + checklist: Checklist::open(&env.data_dir), + rh: env.rivethub(), + }; + Plugin::new(app) + .view( + "main", + |app, _| async move { Ok(main_view(&app.checklist)) }, + ) + .action("add", |app, request| async move { add(&app, &request) }) + .action("toggle", |app, request| async move { + app.checklist.toggle(id(&request))?; + Ok(vec![ViewAction::Refresh]) + }) + .action("remove", |app, request| async move { + app.checklist.remove(id(&request))?; + Ok(vec![ViewAction::Refresh]) + }) + .tool("add_item", |app, call| async move { + add_item(&app, &call).await + }) + .events(|app, delivery| async move { filed(&app, delivery).await }) + .serve() + .await +} + +fn id(request: &ViewActionRequest) -> &str { + request + .params + .as_ref() + .and_then(|params| params.get("id")) + .and_then(serde_json::Value::as_str) + .unwrap_or_default() +} + +fn call(action: &str, id: &str) -> ViewAction { + ViewAction::Call { + action: action.to_owned(), + params: Some(JsonObject::from_iter([("id".to_owned(), id.into())])), + } +} + +fn add(app: &App, request: &ViewActionRequest) -> Result, Error> { + let title = match request.values.get("title") { + Some(ViewValue::Text(title)) => title.trim(), + _ => "", + }; + if title.is_empty() { + return Err(ViewActionRefusal::new("Give the item a title") + .field("title", "Required") + .into()); + } + app.checklist.add(title)?; + Ok(vec![ + ViewAction::Refresh, + ViewAction::Toast { + text: format!("Added {title}"), + tone: Some(ViewTone::Success), + }, + ]) +} + +async fn add_item(app: &App, call: &PluginToolCall) -> Result { + let AddItem { title } = call.parse()?; + let title = title.trim(); + if title.is_empty() { + return Err(Error::failed("title must be a non-empty string")); + } + let open = app.checklist.add(title)?; + app.rh.views_changed(["main"]).await?; + Ok(format!("Added \"{title}\" to the checklist; {open} open.")) +} + +async fn filed(app: &App, delivery: PluginEventDelivery) -> Result<(), Error> { + if let PluginEvent::SessionPlaced { + session_id, + topic_id, + by, + } = delivery.event + { + app.checklist.filed(Filing { + session_id, + topic_id, + by, + at: delivery.at, + })?; + app.rh.views_changed(["main"]).await?; + } + Ok(()) +} + +fn main_view(checklist: &Checklist) -> View { + let items = checklist.items(); + let open = items.iter().filter(|item| !item.done).count(); + View { + title: "Checklist".to_owned(), + subtitle: Some(format!("{open} open, {} done", items.len() - open)), + toolbar: Vec::new(), + blocks: vec![ + add_form(), + ViewBlock::List { + items: items.iter().map(item_row).collect(), + empty: Some(ViewEmpty { + title: "Nothing on the list".to_owned(), + text: Some( + "Add an item above, or ask an agent to use the add_item tool.".to_owned(), + ), + button: None, + }), + }, + ViewBlock::Section { + title: Some("Recently filed sessions".to_owned()), + subtitle: None, + actions: Vec::new(), + collapsed: None, + blocks: vec![ViewBlock::List { + items: checklist.filings().iter().map(filing_row).collect(), + empty: Some(ViewEmpty { + title: "No sessions filed yet".to_owned(), + text: Some("Sessions filed into a topic show here.".to_owned()), + button: None, + }), + }], + }, + ], + } +} + +fn add_form() -> ViewBlock { + ViewBlock::Form { + id: "add".to_owned(), + fields: vec![ViewField { + key: "title".to_owned(), + label: "New item".to_owned(), + input: ViewInput::Text { multiline: false }, + value: None, + required: true, + help: None, + placeholder: Some("What needs doing?".to_owned()), + }], + buttons: vec![ViewButton { + label: "Add".to_owned(), + icon: Some("add".to_owned()), + style: Some(ViewButtonStyle::Primary), + action: ViewAction::Call { + action: "add".to_owned(), + params: None, + }, + confirm: None, + disabled: false, + }], + } +} + +fn item_row(item: &Item) -> ViewListItem { + let icon = if item.done { "check_circle" } else { "pending" }; + ViewListItem { + id: item.id.clone(), + title: item.title.clone(), + icon: Some(icon.to_owned()), + action: Some(call("toggle", &item.id)), + menu: vec![ViewButton { + label: "Delete".to_owned(), + icon: Some("delete".to_owned()), + style: Some(ViewButtonStyle::Danger), + action: call("remove", &item.id), + confirm: None, + disabled: false, + }], + ..ViewListItem::default() + } +} + +fn filing_row(filing: &Filing) -> ViewListItem { + let by = match filing.by { + PlacedBy::You => "by you", + PlacedBy::Categorizer => "by the categorizer", + }; + let (harness, native) = filing + .session_id + .split_once(':') + .unwrap_or(("", &filing.session_id)); + ViewListItem { + id: format!("{}-{}", filing.session_id, filing.at), + title: format!("Session {}", native.get(..8).unwrap_or(native)), + subtitle: Some(harness.to_owned()), + icon: Some("folder".to_owned()), + trailing: vec![ + ViewInline::Badge { + text: by.to_owned(), + tone: ViewTone::Neutral, + }, + ViewInline::Time { + at: filing.at, + style: Some(ViewTimeStyle::Relative), + }, + ], + action: Some(ViewAction::OpenSession { + session_id: filing.session_id.clone(), + }), + menu: vec![ViewButton { + label: "Open topic".to_owned(), + icon: Some("folder_open".to_owned()), + style: None, + action: ViewAction::OpenTopic { + topic_id: filing.topic_id.clone(), + }, + confirm: None, + disabled: false, + }], + } +} diff --git a/templates/typescript/package.json b/templates/typescript/package.json new file mode 100644 index 0000000..a36151b --- /dev/null +++ b/templates/typescript/package.json @@ -0,0 +1,16 @@ +{ + "name": "checklist-ts", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "build": "esbuild src/plugin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/plugin.js", + "dev": "npm run build && rivethub-plugin-dev ." + }, + "dependencies": { + "@rivethub/plugin-sdk": "0.0.0" + }, + "devDependencies": { + "esbuild": "0.28.2" + } +} diff --git a/templates/typescript/rivethub-plugin.json b/templates/typescript/rivethub-plugin.json new file mode 100644 index 0000000..c921503 --- /dev/null +++ b/templates/typescript/rivethub-plugin.json @@ -0,0 +1,26 @@ +{ + "manifest": 1, + "id": "checklist-ts", + "name": "Checklist (TypeScript)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with a board to arrange it and the sessions filed lately.", + "icon": "checklist", + "run": { "command": ["node", "dist/plugin.js"] }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { "title": { "type": "string", "description": "What needs doing" } }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [{ "id": "checklist", "title": "Checklist", "icon": "checklist", "view": "main" }] + }, + "events": ["session.placed"] +} diff --git a/templates/typescript/src/checklist.ts b/templates/typescript/src/checklist.ts new file mode 100644 index 0000000..4d1e311 --- /dev/null +++ b/templates/typescript/src/checklist.ts @@ -0,0 +1,75 @@ +import { readFileSync, renameSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' +import type { EventOf } from '@rivethub/plugin-sdk' + +export type Item = { id: string; title: string; done: boolean; x?: number; y?: number } +export type Filing = Omit, 'type'> & { at: number } +type State = { next: number; items: Item[]; filings: Filing[] } + +const KEPT_FILINGS = 5 + +export class Checklist { + readonly #file: string + #state: State + + constructor(dataDir: string) { + this.#file = join(dataDir, 'checklist.json') + try { + this.#state = JSON.parse(readFileSync(this.#file, 'utf8')) as State + } catch { + this.#state = { next: 1, items: [], filings: [] } + } + } + + get items(): readonly Item[] { + return this.#state.items + } + + get filings(): readonly Filing[] { + return this.#state.filings + } + + get open(): number { + return this.#state.items.filter((item) => !item.done).length + } + + add(title: string): Item { + const item = { id: String(this.#state.next), title, done: false } + this.#state.next += 1 + this.#state.items.push(item) + this.#save() + return item + } + + toggle(id: string): Item | undefined { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) { + item.done = !item.done + this.#save() + } + return item + } + + remove(ids: readonly string[]): void { + this.#state.items = this.#state.items.filter((item) => !ids.includes(item.id)) + this.#save() + } + + place(positions: readonly { id: string; x: number; y: number }[]): void { + for (const { id, x, y } of positions) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) Object.assign(item, { x, y }) + } + this.#save() + } + + filed(filing: Filing): void { + this.#state.filings = [filing, ...this.#state.filings].slice(0, KEPT_FILINGS) + this.#save() + } + + #save(): void { + writeFileSync(`${this.#file}.tmp`, JSON.stringify(this.#state)) + renameSync(`${this.#file}.tmp`, this.#file) + } +} diff --git a/templates/typescript/src/plugin.ts b/templates/typescript/src/plugin.ts new file mode 100644 index 0000000..c6c1a49 --- /dev/null +++ b/templates/typescript/src/plugin.ts @@ -0,0 +1,187 @@ +import { + type CanvasItem, + connect, + pluginEnv, + Refusal, + serve, + type View, + type ViewBlock, + type ViewInline, +} from '@rivethub/plugin-sdk' +import { Checklist, type Filing, type Item } from './checklist.ts' + +const NODE = { width: 180, height: 56, columns: 4, gap: 24 } + +const checklist = new Checklist(pluginEnv().dataDir) +const rh = connect() + +function node(item: Item, index: number): CanvasItem { + return { + type: 'node', + id: item.id, + x: item.x ?? NODE.gap + (index % NODE.columns) * (NODE.width + NODE.gap), + y: item.y ?? NODE.gap + Math.floor(index / NODE.columns) * (NODE.height + NODE.gap), + width: NODE.width, + height: NODE.height, + shapes: [ + { + type: 'rect', + x: 0, + y: 0, + width: NODE.width, + height: NODE.height, + radius: 12, + fill: item.done ? 'secondaryContainer' : 'surfaceContainerHigh', + stroke: item.done ? 'success' : 'outlineVariant', + }, + { + type: 'icon', + x: 12, + y: 16, + name: item.done ? 'check_circle' : 'pending', + size: 24, + color: item.done ? 'success' : 'onSurfaceVariant', + }, + { type: 'text', x: 44, y: 19, text: item.title, weight: 'medium', maxWidth: NODE.width - 56 }, + ], + tooltip: item.done ? 'Done: double-click to reopen' : 'Double-click to mark done', + } +} + +function filed(filing: Filing): ViewInline[] { + return [ + { type: 'badge', text: filing.by === 'you' ? 'by you' : 'by the categorizer', tone: 'neutral' }, + { type: 'time', at: filing.at, style: 'relative' }, + ] +} + +function main(): View { + const blocks: ViewBlock[] = [ + { + type: 'form', + id: 'add', + fields: [ + { key: 'title', label: 'New item', input: { type: 'text' }, required: true, placeholder: 'What needs doing?' }, + ], + buttons: [{ label: 'Add', icon: 'add', style: 'primary', action: { type: 'call', action: 'add' } }], + }, + { + type: 'list', + items: checklist.items.map((item) => ({ + id: item.id, + title: item.title, + icon: item.done ? 'check_circle' : 'pending', + action: { type: 'call', action: 'toggle', params: { id: item.id } }, + menu: [ + { + label: 'Delete', + icon: 'delete', + style: 'danger', + action: { type: 'call', action: 'remove', params: { id: item.id } }, + }, + ], + })), + empty: { title: 'Nothing on the list', text: 'Add an item above, or ask an agent to use the add_item tool.' }, + }, + { + type: 'section', + title: 'Board', + subtitle: 'Drag items to arrange them, double-click one to mark it done.', + blocks: [ + { + type: 'canvas', + id: 'board', + scene: { items: checklist.items.map(node), grid: { size: 8, snap: true } }, + height: 280, + }, + ], + }, + { + type: 'section', + title: 'Recently filed sessions', + blocks: [ + { + type: 'list', + items: checklist.filings.map((filing) => { + const [harness, native] = filing.sessionId.split(':', 2) + return { + id: `${filing.sessionId}-${filing.at}`, + title: `Session ${(native ?? filing.sessionId).slice(0, 8)}`, + subtitle: harness ?? '', + icon: 'folder', + trailing: filed(filing), + action: { type: 'openSession', sessionId: filing.sessionId }, + menu: [ + { label: 'Open topic', icon: 'folder_open', action: { type: 'openTopic', topicId: filing.topicId } }, + ], + } + }), + empty: { title: 'No sessions filed yet', text: 'Sessions filed into a topic show here.' }, + }, + ], + }, + ] + return { + title: 'Checklist', + subtitle: `${checklist.open} open, ${checklist.items.length - checklist.open} done`, + blocks, + } +} + +const idOf = (params: Record | null | undefined): string => String(params?.id ?? '') + +await serve({ + views: { main }, + actions: { + add: ({ values }) => { + const title = typeof values?.title === 'string' ? values.title.trim() : '' + if (title === '') throw new Refusal('Give the item a title', { title: 'Required' }) + checklist.add(title) + return [{ type: 'refresh' }, { type: 'toast', text: `Added ${title}`, tone: 'success' }] + }, + toggle: ({ params }) => { + checklist.toggle(idOf(params)) + return [{ type: 'refresh' }] + }, + remove: ({ params }) => { + checklist.remove([idOf(params)]) + return [{ type: 'refresh' }] + }, + }, + canvas: { + board: ({ event }) => { + switch (event.type) { + case 'moved': + checklist.place(event.items) + return {} + case 'activated': { + const item = checklist.toggle(event.item) + const index = checklist.items.findIndex((found) => found.id === event.item) + return { + ops: item === undefined ? [] : [{ type: 'upsert', item: node(item, index) }], + actions: [{ type: 'refresh' }], + } + } + case 'deleted': + checklist.remove(event.items) + return { ops: [{ type: 'remove', ids: event.items }], actions: [{ type: 'refresh' }] } + default: + return {} + } + }, + }, + tools: { + add_item: async ({ title }) => { + if (typeof title !== 'string' || title.trim() === '') throw new Error('title must be a non-empty string') + const item = checklist.add(title.trim()) + await rh.viewsChanged(['main']) + return `Added "${item.title}" to the checklist; ${checklist.open} open.` + }, + }, + events: { + 'session.placed': async ({ sessionId, topicId, by }, delivery) => { + checklist.filed({ sessionId, topicId, by, at: delivery.at }) + await rh.viewsChanged(['main']) + }, + }, +}) diff --git a/tsconfig.json b/tsconfig.json index b2df04d..e858d8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,5 +17,5 @@ "noEmit": true, "skipLibCheck": true }, - "include": ["scripts", "tests", "packages/*/src"] + "include": ["scripts", "tests", "packages/*/src", "templates/typescript/src"] } From bed74d274902c06716764a10868831a3af781a34 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 00:24:16 -0400 Subject: [PATCH 05/11] chore: name the workspace rivethub-plugins after the repository --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a53a85..5e59597 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,10 @@ { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "workspaces": [ "packages/*", "templates/typescript" diff --git a/package.json b/package.json index c1cd77f..f03335d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rivethub-workflows", + "name": "rivethub-plugins", "private": true, "type": "module", "engines": { From 4ae35256e76abdfe4a89413c57bf59d59ebe501c Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 00:24:16 -0400 Subject: [PATCH 06/11] docs: describe rivethub-plugins, its SDKs, templates and dev harness The README now names the repository rivethub-plugins and says what a plug-in is, where the SDKs and templates live, what npm run contract generates for each language, how a plug-in is written, confined, tried with rivethub-plugin-dev and installed on a node, and that npm run check covers the Rust code. --- README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9472d0a..e4d7117 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,77 @@ -# rivethub-workflows +# rivethub-plugins -Workflows for RivetHub, and the start of its plugin system: custom parts of RivetHub that anyone can add. A plugin that -proves valuable for everyone gets promoted into the platform, with its domain moving into a -[rivethub-runtime](https://github.com/philbert440/rivethub-runtime) context and its payloads into the contract. +Plug-ins for RivetHub, and the SDKs and templates for writing them. A plug-in is a program that runs in its own process on +one node and reaches the runtime only over its published contract (row B17 and notes 50 to 60 of the +[rivethub-runtime](https://github.com/philbert440/rivethub-runtime) CONTRACT): rh starts it, proxies clients to its +views, delivers its events and offers its tools to agents through `rh mcp`. A plug-in that proves valuable for everyone +gets promoted into the platform, with its domain moving into a runtime context and its payloads into the contract. -Workflows run outside the runtime and talk to it only through its published contract, the same way every client does. +## Layout + +- `packages/contract`: `@rivethub/contract`, the runtime's schemas and the types generated from them. +- `packages/plugin-sdk`: `@rivethub/plugin-sdk`, for plug-ins in TypeScript, with the `rivethub-plugin-dev` harness. +- `rust/rivethub-plugin`: the `rivethub-plugin` crate, for plug-ins in Rust, in a Cargo workspace of its own. +- `templates/typescript`, `templates/rust`: a checklist plug-in in each language to start from: a page with a form and + a list (and a canvas board in TypeScript), an `add_item` agent tool and a `session.placed` subscription. ## The contract `contract.json` pins a runtime commit. `npm run contract` fetches that commit's `contract/sent.schema.json` and -`contract/accepted.schema.json`, vendors them under `packages/contract/schema/`, and generates the -`@rivethub/contract` types: +`contract/accepted.schema.json`, vendors them under `packages/contract/schema/`, and generates: -- `Sent`: what the runtime sends (responses, events). -- `Accepted`: what the runtime accepts (requests, capture batches). +- the `@rivethub/contract` types: `Sent`, what the runtime sends (responses, events), and `Accepted`, what it accepts + (requests, and a plug-in's answers); +- `rust/rivethub-plugin/src/contract.rs`, the plug-in types (the manifest, views, canvas, events, jobs, tools, the + plug-in API and `GatewayError`) as Rust, from the accepted schema. To move to a newer runtime, set `ref` in `contract.json` to a commit on the runtime's `main`, run `npm run contract`, and -commit the schema and type diff in its own PR. If a workflow needs something the contract doesn't offer, propose the +commit the schema and type diff in its own PR. If a plug-in needs something the contract doesn't offer, propose the change to the runtime first. +## Writing a plug-in + +A plug-in is a directory holding `rivethub-plugin.json` and the program its `run.command` starts. Both SDKs answer what rh +asks on the plug-in socket (`GET /health`, views, actions, canvas events, tools, events and jobs), drop an event +delivery they have already handled (by `seq`), pass `settings.changed` and the starting settings to the settings +handler, and call rh on the plug-in API socket with the per-start token: the plug-in's own record, `viewsChanged`, +`notify`, and any route its permissions name. + +```ts +await serve({ + views: { main: () => ({ title: 'Checklist', blocks: [] }) }, + actions: { add: ({ values }) => [{ type: 'refresh' }] }, + tools: { add_item: ({ title }) => `Added ${String(title)}` }, + events: { 'session.placed': ({ sessionId }) => {} }, +}) +``` + +```rust +Plugin::new(state) + .view("main", |state, request| async move { Ok(view(&state)) }) + .tool("add_item", |state, call| async move { add(&state, call.parse()?) }) + .events(|state, delivery| async move { record(&state, delivery.event) }) + .serve() + .await +``` + +On Linux rh confines a plug-in with Landlock to its own directory, its data and run folders and the program it runs, so +a TypeScript plug-in runs a bundle (`npm run build` writes `dist/plugin.js` with esbuild) rather than sources that +import from outside its directory, and a Rust plug-in runs its release binary. + +`rivethub-plugin-dev ` starts a plug-in the way rh does, standing in for its own `/api/plugin` routes, and reads +commands from stdin (`view main`, `action add {"values":{"title":"x"}}`, `tool add_item {"title":"x"}`, +`event session.placed {...}`, `job `), printing each answer. To run one on a node, `POST /api/plugins` with +`{"path": ""}` and enable it from a paired device. + ## Rules -- Talk to the runtime only over its HTTP and WebSocket API. Never read its database or files. -- Types come from `@rivethub/contract`. Never hand-write a DTO. +- Talk to the runtime only over its HTTP and WebSocket API and the plug-in sockets. Never read its database or files. +- Types come from `@rivethub/contract` and the generated `contract` module. Never hand-write a DTO. - No code comments: names and types carry the meaning. - Conventional Commits, authored by people, with no AI attribution trailers or text. ## Checks -`npm run check` runs what CI runs: Biome lint and format, `tsc` in strict mode, the tests, the contract freshness check -and the privacy scan. Run it before every push. +`npm run check` runs what CI runs: Biome lint and format, `tsc` in strict mode, the tests, the contract freshness check, +the privacy scan, and `npm run rust` (rustfmt, Clippy with warnings as errors, and the tests, for the crate and the Rust +template). Run it before every push. From f7199223f85234f5fe8cdbad7b9ceee01ea705c2 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 06:49:57 -0400 Subject: [PATCH 07/11] feat(templates): add a JavaScript template and install it on a node for rh's plug-in creator templates/javascript is the checklist with its canvas board in JavaScript that Node runs as it is, plus a GUIDE.md that teaches an agent the build loop and what plug-ins can draw and do. npm run templates:install copies it into the node's /plugin-templates/ with the SDK's TypeScript sources in sdk/, which Node 22.18 and later runs without a build, so the runtime's creator tools scaffold from it without fetching anything. --- README.md | 12 ++ package.json | 1 + scripts/templates.ts | 19 +++ templates/javascript/GUIDE.md | 110 +++++++++++++ templates/javascript/checklist.js | 70 +++++++++ templates/javascript/plugin.js | 179 ++++++++++++++++++++++ templates/javascript/rivethub-plugin.json | 40 +++++ 7 files changed, 431 insertions(+) create mode 100644 scripts/templates.ts create mode 100644 templates/javascript/GUIDE.md create mode 100644 templates/javascript/checklist.js create mode 100644 templates/javascript/plugin.js create mode 100644 templates/javascript/rivethub-plugin.json diff --git a/README.md b/README.md index e4d7117..97e7527 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ gets promoted into the platform, with its domain moving into a runtime context a - `rust/rivethub-plugin`: the `rivethub-plugin` crate, for plug-ins in Rust, in a Cargo workspace of its own. - `templates/typescript`, `templates/rust`: a checklist plug-in in each language to start from: a page with a form and a list (and a canvas board in TypeScript), an `add_item` agent tool and a `session.placed` subscription. +- `templates/javascript`: the same checklist with its canvas board, in JavaScript that Node runs as it is, and a + `GUIDE.md` for an agent building from it. It is the template rh's plug-in creator scaffolds from. ## The contract @@ -63,6 +65,16 @@ commands from stdin (`view main`, `action add {"values":{"title":"x"}}`, `tool a `event session.placed {...}`, `job `), printing each answer. To run one on a node, `POST /api/plugins` with `{"path": ""}` and enable it from a paired device. +## Templates on a node + +rh's plug-in creator (note 70 of the runtime's CONTRACT) lets an agent on a node scaffold a plug-in from a template, +edit it, install it and read its log through `rh mcp`. rh carries no templates; it reads them from the node's +`/plugin-templates/` (`~/.rivethub/plugin-templates/` unless the state folder moved), one folder each, and never +fetches one. `npm run templates:install` writes the templates that need no build there: the `javascript` folder with +`sdk/`, the SDK's own TypeScript sources, which Node 22.18 and later runs without a build. Pass another state folder as +`npm run templates:install -- `. Run it again after pulling a newer SDK; plug-ins already scaffolded keep the +SDK they were made with. + ## Rules - Talk to the runtime only over its HTTP and WebSocket API and the plug-in sockets. Never read its database or files. diff --git a/package.json b/package.json index f03335d..3811e67 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test": "node --test 'tests/**/*.test.ts'", "contract": "node scripts/contract.ts", "contract:check": "node scripts/contract.ts --check", + "templates:install": "node scripts/templates.ts", "privacy": "node scripts/privacy.ts --tracked", "rust": "cargo fmt --check --manifest-path rust/rivethub-plugin/Cargo.toml && cargo clippy --locked --all-targets --manifest-path rust/rivethub-plugin/Cargo.toml -- -D warnings && cargo test --locked --manifest-path rust/rivethub-plugin/Cargo.toml && cargo fmt --check --manifest-path templates/rust/Cargo.toml && cargo clippy --locked --all-targets --manifest-path templates/rust/Cargo.toml -- -D warnings" }, diff --git a/scripts/templates.ts b/scripts/templates.ts new file mode 100644 index 0000000..7f50a18 --- /dev/null +++ b/scripts/templates.ts @@ -0,0 +1,19 @@ +import { cpSync, mkdirSync, rmSync } from 'node:fs' +import { homedir } from 'node:os' +import { join } from 'node:path' + +const ROOT = join(import.meta.dirname, '..') +const TEMPLATES = ['javascript'] +const SDK = ['index.ts', 'plugin.ts', 'rivethub.ts', 'serve.ts', 'types.ts'] + +const state = process.argv[2] ?? process.env.RIVETHUB_STATE_DIR ?? join(homedir(), '.rivethub') +const target = join(state, 'plugin-templates') + +for (const name of TEMPLATES) { + const into = join(target, name) + rmSync(into, { recursive: true, force: true }) + cpSync(join(ROOT, 'templates', name), into, { recursive: true }) + mkdirSync(join(into, 'sdk')) + for (const file of SDK) cpSync(join(ROOT, 'packages', 'plugin-sdk', 'src', file), join(into, 'sdk', file)) + console.log(`installed the ${name} template in ${into}`) +} diff --git a/templates/javascript/GUIDE.md b/templates/javascript/GUIDE.md new file mode 100644 index 0000000..6546543 --- /dev/null +++ b/templates/javascript/GUIDE.md @@ -0,0 +1,110 @@ +# Building this plug-in + +This folder is a RivetHub plug-in: a small program rh starts on this node, reaches over a unix socket and draws in +the RivetHub apps with their own widgets. It starts as a working example (a checklist page with a form, a list and a +canvas board, an `add_item` agent tool and a `session.placed` subscription). Rewrite it into what the person asked for. + +## The loop + +1. Edit the files here: `rivethub-plugin.json` (the manifest), `plugin.js` (the program) and any modules you add. +2. Call `plugins__install` with this plug-in's id. It checks the manifest (an invalid one changes nothing and the answer + names the field), installs the folder or reloads it, waits for the process to start and asks each page for its view + the way the apps do. Read the whole answer: it says whether the plug-in runs, why not, and what to do next. +3. Call `plugins__status` to read its state and its last log lines: your `console.log` and `console.error` output, a + crash's stack trace, and rh's own lines, marked `host` (start, exit status, and every answer rh refused or that + failed, with the field it refused). +4. Fix what the answer or the log names and go back to 2. Repeat until it runs and its pages answer valid views. + +You can install and reload. You cannot turn a plug-in on or grant it permissions: a person does that in the RivetHub +app (Settings › Plug-ins › the plug-in › Turn on, or Approve and turn on when it asks for permissions), from a device +paired with this node. A new plug-in stays off until they do. Once it is on, every reload restarts it with your changes, +unless the manifest asks for a permission it does not hold yet: then it waits, off, for the person to approve again. +When an answer says a person has to act, tell them exactly that. + +## Files + +- `sdk/` is `@rivethub/plugin-sdk`, as TypeScript sources that Node runs directly. Import from `./sdk/index.ts`, read + `sdk/plugin.ts` and `sdk/rivethub.ts` for its API, and do not edit it. +- `plugin.js` calls `serve({ views, actions, canvas, tools, events, jobs, settings })`; every key is optional. +- Keep state in `pluginEnv().dataDir` (a folder rh keeps across reloads), as `checklist.js` does with one JSON file. +- The process runs as `node plugin.js` (Node 22.18 or later) with this folder as its working directory. Use Node's + built-in modules. Anything else must live inside this folder: on Linux rh confines the process to it, its data folder + and the program it runs. + +## The manifest + +`manifest` 1; `id` (2 to 24 of `a-z`, `0-9` and single hyphens; it must stay the folder's name); `name`; `version`; +`description`; `icon` (a Material Symbols name, as every icon here); `run.command` (`["node", "plugin.js"]`); +`permissions`; `settings` (fields as in a form, drawn in Settings, read with `rh.self()` and the `settings` handler); +`tools` (`{name, title?, description, inputSchema, hints?}`, offered to agents as `__`; `name` uses `a-z`, +`0-9` and single underscores); `contributes.pages` (`{id, title, icon?, view}`: a sidebar entry opening that view), +`contributes.topicCards` (`{id, title, view}`: a card in a topic, its view gets `context.topicId`) and +`contributes.sessionActions` (`{id, title, icon?, action}`: a session menu entry, `context.sessionId`); `jobs` (`{id, +title, schedule?, timeoutMs?}`, `schedule` a five-field cron in the node's time); `events` (`session.started`, +`session.idle`, `session.ended`, `session.placed` need `sessions.read`; `summary.written` needs `memory.read`; +`task.done` needs `tasks.read`). Unknown fields are refused. Remove what you do not use, the example's `sessions.read` +and `session.placed` among them, so the person is not asked to approve it. + +## Views + +A view handler gets `{params, context}` and returns `{title, subtitle?, toolbar?, blocks}`. rh checks every answer: +an unknown field, a missing one or a wrong type is refused and logged, and the app shows an error instead of the view. + +Blocks (`type`): `section` `{title?, subtitle?, actions?, blocks, collapsed?}`; `split` `{primary, secondary, +ratio?}`; `tabs` `{tabs: [{id, title, badge?, blocks}], selected?}`; `text` `{text, tone?, monospace?}`; `markdown` +`{text}`; `code` `{text, language?, follow?}`; `properties` `{items: [{label, value: inline}]}`; `progress` `{value? +(0 to 1), label?}`; `notice` `{tone, title?, text, actions?}`; `list` `{items: [{id, title, subtitle?, icon?, trailing?: +[inline], action?, menu?: [button]}], empty?}`; `table` `{columns: [{title, align?, sortable?}], rows: [{id, cells: +[inline], action?, menu?}], empty?}`; `breadcrumbs` `{items: [{label, action?}]}`; `actions` `{buttons}`; `form` `{id, +fields, buttons}`; `canvas` (below). `empty` is `{title, text?, button?}`. Do not use `image`, `webPanel` or the +`download` action: they need routes this SDK does not serve. + +Inlines (`type`): `text` `{text, tone?, icon?, monospace?}`, `badge` `{text, tone}`, `time` `{at: epoch ms, style?: +relative|absolute}`, `duration` `{ms}`, `bytes` `{value}`. Tones: `neutral`, `info`, `success`, `warning`, `danger`. + +A button is `{label, icon?, style?: primary|secondary|danger, action, confirm?: {title, text, confirmLabel?}, +disabled?}`. A field is `{key, label, input, value?, required?, help?, placeholder?}`, `input` one of `{type: 'text', +multiline?}`, `{type: 'secret'}`, `{type: 'number', min?, max?, step?}`, `{type: 'toggle'}` and `{type: 'select', +options: [{value, label}], multiple?}`. + +Actions (`type`): `call` `{action, params?}` runs your action handler with `{params, values, context}` (`values` are +the form's when the button is in a form) and shows the actions it returns; throw `new Refusal(message, {field: +message})` to show errors beside fields. `navigate` `{view, params?, replace?}`, `dialog` `{view, params?}`, `back`, +`refresh`, `toast` `{text, tone?}`, `copy` `{text}`, `openSession` `{sessionId}`, `openTopic` `{topicId}`, `openUrl` +`{url}`. An action handler cannot answer with another `call`. + +Apps never poll. A page shows what its view answered when it was opened; when your state changes on its own (a timer, +an event, an agent's tool call), call `await rh.viewsChanged(['main'])` (with `const rh = connect()`) and every app +showing that view fetches it again. A `time` inline with `style: 'relative'` or a `progress` block is drawn as of the +last fetch. + +## Canvas + +`{type: 'canvas', id, scene: {items, grid?: {size, snap}, viewport?}, height?, readOnly?, menu?}`, at most 5000 items. +An item is a `node` `{id, x, y, width, height, shapes, anchors?, tooltip?, menu?, locked?, decorative?}` or a +`connector` `{id, from: {node, anchor?}, to, route?: straight|curved|orthogonal, dashed?, arrow?: none|end|start|both, +label?}`. Shapes, relative to their node: `rect` `{x, y, width, height, radius?, fill?, stroke?, strokeWidth?}`, +`ellipse`, `text` `{x, y, text, size?, weight?: regular|medium|bold, color?, align?, maxWidth?, monospace?}`, `path` `{d, +fill?, stroke?}` and `icon` `{x, y, name, size?, color?}`. Colours are theme roles, never literal values: `surface`, +`surfaceContainer`, `surfaceContainerHigh`, `primary`, `primaryContainer`, `onPrimary`, `onPrimaryContainer`, +`secondaryContainer`, `onSurface`, `onSurfaceVariant`, `outline`, `outlineVariant`, the tones and `category1` to +`category6`. The app pans, zooms, selects and drags itself and sends your `canvas.` handler `{event, params, +context}`, `event.type` one of `selected`, `moved` `{items: [{id, x, y}]}`, `connected`, `deleted` `{items}`, +`activated` `{item}` and `menu`. Answer `{ops?: [{type: 'upsert', item} | {type: 'remove', ids}], actions?}`. + +## Tools, events, jobs and settings + +`tools.(arguments, call)` returns text (or `{text, isError}`); a thrown error becomes an error result. `events` +handlers get `(event, delivery)`, at least once and in order. `jobs.(request)` returns an optional message; a thrown +error fails the run. `settings(values)` gets the starting values and every change. + +## Permissions + +Ask only for what the plug-in uses; each is shown to the person when they approve. `rh.request(method, path, body)` +reaches the routes a permission opens, as the node's owner: `memory.read` (`GET /api/memory/*`, `GET /api/wiki*`), +`memory.write` (`POST /api/capture`), `sessions.read` (`GET /api/harness-sessions*`), `sessions.control`, +`topics.read` (`GET /api/topics*`), `topics.write`, `tasks.read` (`GET /api/tasks*`), `tasks.delegate` (`POST +/api/tasks`), `agents.read` (`GET /api/agents*`) and `notifications.send` (`rh.notify({title, text?, tone?, +action?})`, a notification in every app). Without a host permission the process opens no network connection, reads +and writes only its folders and runs no other program; `host.network`, `host.files.read`, `host.files.write` and +`host.exec` widen that and need the person's approval like the rest. Any other route answers 403. diff --git a/templates/javascript/checklist.js b/templates/javascript/checklist.js new file mode 100644 index 0000000..e65cbad --- /dev/null +++ b/templates/javascript/checklist.js @@ -0,0 +1,70 @@ +import { readFileSync, renameSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' + +const KEPT_FILINGS = 5 + +export class Checklist { + #file + #state + + constructor(dataDir) { + this.#file = join(dataDir, 'checklist.json') + try { + this.#state = JSON.parse(readFileSync(this.#file, 'utf8')) + } catch { + this.#state = { next: 1, items: [], filings: [] } + } + } + + get items() { + return this.#state.items + } + + get filings() { + return this.#state.filings + } + + get open() { + return this.#state.items.filter((item) => !item.done).length + } + + add(title) { + const item = { id: String(this.#state.next), title, done: false } + this.#state.next += 1 + this.#state.items.push(item) + this.#save() + return item + } + + toggle(id) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) { + item.done = !item.done + this.#save() + } + return item + } + + remove(ids) { + this.#state.items = this.#state.items.filter((item) => !ids.includes(item.id)) + this.#save() + } + + place(positions) { + for (const { id, x, y } of positions) { + const item = this.#state.items.find((found) => found.id === id) + if (item !== undefined) Object.assign(item, { x, y }) + } + this.#save() + } + + filed(filing) { + this.#state.filings = [filing, ...this.#state.filings].slice(0, KEPT_FILINGS) + this.#save() + } + + #save() { + writeFileSync(`${this.#file}.tmp`, JSON.stringify(this.#state)) + renameSync(`${this.#file}.tmp`, this.#file) + } +} diff --git a/templates/javascript/plugin.js b/templates/javascript/plugin.js new file mode 100644 index 0000000..ea05b33 --- /dev/null +++ b/templates/javascript/plugin.js @@ -0,0 +1,179 @@ +import { Checklist } from './checklist.js' +import { connect, pluginEnv, Refusal, serve } from './sdk/index.ts' + +const NODE = { width: 180, height: 56, columns: 4, gap: 24 } + +const checklist = new Checklist(pluginEnv().dataDir) +const rh = connect() + +function node(item, index) { + return { + type: 'node', + id: item.id, + x: item.x ?? NODE.gap + (index % NODE.columns) * (NODE.width + NODE.gap), + y: item.y ?? NODE.gap + Math.floor(index / NODE.columns) * (NODE.height + NODE.gap), + width: NODE.width, + height: NODE.height, + shapes: [ + { + type: 'rect', + x: 0, + y: 0, + width: NODE.width, + height: NODE.height, + radius: 12, + fill: item.done ? 'secondaryContainer' : 'surfaceContainerHigh', + stroke: item.done ? 'success' : 'outlineVariant', + }, + { + type: 'icon', + x: 12, + y: 16, + name: item.done ? 'check_circle' : 'pending', + size: 24, + color: item.done ? 'success' : 'onSurfaceVariant', + }, + { type: 'text', x: 44, y: 19, text: item.title, weight: 'medium', maxWidth: NODE.width - 56 }, + ], + tooltip: item.done ? 'Done: double-click to reopen' : 'Double-click to mark done', + } +} + +function filed(filing) { + return [ + { type: 'badge', text: filing.by === 'you' ? 'by you' : 'by the categorizer', tone: 'neutral' }, + { type: 'time', at: filing.at, style: 'relative' }, + ] +} + +function main() { + return { + title: 'Checklist', + subtitle: `${checklist.open} open, ${checklist.items.length - checklist.open} done`, + blocks: [ + { + type: 'form', + id: 'add', + fields: [ + { + key: 'title', + label: 'New item', + input: { type: 'text' }, + required: true, + placeholder: 'What needs doing?', + }, + ], + buttons: [{ label: 'Add', icon: 'add', style: 'primary', action: { type: 'call', action: 'add' } }], + }, + { + type: 'list', + items: checklist.items.map((item) => ({ + id: item.id, + title: item.title, + icon: item.done ? 'check_circle' : 'pending', + action: { type: 'call', action: 'toggle', params: { id: item.id } }, + menu: [ + { + label: 'Delete', + icon: 'delete', + style: 'danger', + action: { type: 'call', action: 'remove', params: { id: item.id } }, + }, + ], + })), + empty: { title: 'Nothing on the list', text: 'Add an item above, or ask an agent to use the add_item tool.' }, + }, + { + type: 'section', + title: 'Board', + subtitle: 'Drag items to arrange them, double-click one to mark it done.', + blocks: [ + { + type: 'canvas', + id: 'board', + scene: { items: checklist.items.map(node), grid: { size: 8, snap: true } }, + height: 280, + }, + ], + }, + { + type: 'section', + title: 'Recently filed sessions', + blocks: [ + { + type: 'list', + items: checklist.filings.map((filing) => ({ + id: `${filing.sessionId}-${filing.at}`, + title: `Session ${filing.sessionId.split(':').pop().slice(0, 8)}`, + icon: 'folder', + trailing: filed(filing), + action: { type: 'openSession', sessionId: filing.sessionId }, + menu: [ + { label: 'Open topic', icon: 'folder_open', action: { type: 'openTopic', topicId: filing.topicId } }, + ], + })), + empty: { title: 'No sessions filed yet', text: 'Sessions filed into a topic show here.' }, + }, + ], + }, + ], + } +} + +const idOf = (params) => String(params?.id ?? '') + +await serve({ + views: { main }, + actions: { + add: ({ values }) => { + const title = typeof values?.title === 'string' ? values.title.trim() : '' + if (title === '') throw new Refusal('Give the item a title', { title: 'Required' }) + checklist.add(title) + return [{ type: 'refresh' }, { type: 'toast', text: `Added ${title}`, tone: 'success' }] + }, + toggle: ({ params }) => { + checklist.toggle(idOf(params)) + return [{ type: 'refresh' }] + }, + remove: ({ params }) => { + checklist.remove([idOf(params)]) + return [{ type: 'refresh' }] + }, + }, + canvas: { + board: ({ event }) => { + switch (event.type) { + case 'moved': + checklist.place(event.items) + return {} + case 'activated': { + const item = checklist.toggle(event.item) + const index = checklist.items.findIndex((found) => found.id === event.item) + return { + ops: item === undefined ? [] : [{ type: 'upsert', item: node(item, index) }], + actions: [{ type: 'refresh' }], + } + } + case 'deleted': + checklist.remove(event.items) + return { ops: [{ type: 'remove', ids: event.items }], actions: [{ type: 'refresh' }] } + default: + return {} + } + }, + }, + tools: { + add_item: async ({ title }) => { + if (typeof title !== 'string' || title.trim() === '') throw new Error('title must be a non-empty string') + const item = checklist.add(title.trim()) + await rh.viewsChanged(['main']) + return `Added "${item.title}" to the checklist; ${checklist.open} open.` + }, + }, + events: { + 'session.placed': async ({ sessionId, topicId, by }, delivery) => { + checklist.filed({ sessionId, topicId, by, at: delivery.at }) + await rh.viewsChanged(['main']) + }, + }, +}) diff --git a/templates/javascript/rivethub-plugin.json b/templates/javascript/rivethub-plugin.json new file mode 100644 index 0000000..f091f83 --- /dev/null +++ b/templates/javascript/rivethub-plugin.json @@ -0,0 +1,40 @@ +{ + "manifest": 1, + "id": "checklist-js", + "name": "Checklist (JavaScript)", + "version": "0.1.0", + "description": "A checklist you and your agents add to, with a board to arrange it and the sessions filed lately.", + "icon": "checklist", + "run": { + "command": ["node", "plugin.js"] + }, + "permissions": ["sessions.read"], + "tools": [ + { + "name": "add_item", + "title": "Add a checklist item", + "description": "Add an item to the checklist and return how many items are open.", + "inputSchema": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "What needs doing" + } + }, + "required": ["title"] + } + } + ], + "contributes": { + "pages": [ + { + "id": "checklist", + "title": "Checklist", + "icon": "checklist", + "view": "main" + } + ] + }, + "events": ["session.placed"] +} From f1889672188ca334db9c501c344f59c43d37246d Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 10:53:26 -0400 Subject: [PATCH 08/11] build: pin the contract to rh v0.7.0 --- contract.json | 2 +- packages/contract/schema/accepted.schema.json | 1694 ++++------------ packages/contract/schema/sent.schema.json | 1696 ++++------------- packages/contract/src/accepted.ts | 526 ++--- packages/contract/src/sent.ts | 512 ++--- rust/rivethub-plugin/src/contract.rs | 2 +- 6 files changed, 974 insertions(+), 3458 deletions(-) diff --git a/contract.json b/contract.json index 6b761c9..f2e53b9 100644 --- a/contract.json +++ b/contract.json @@ -1,4 +1,4 @@ { "repository": "philbert440/rivethub-runtime", - "ref": "542f8efdef0080940149a275fbfd883e4e63a6ab" + "ref": "36aa33c98fb8ef9e6ec7113cc70807954edbd933" } diff --git a/packages/contract/schema/accepted.schema.json b/packages/contract/schema/accepted.schema.json index 1e7fc92..3adb94d 100644 --- a/packages/contract/schema/accepted.schema.json +++ b/packages/contract/schema/accepted.schema.json @@ -830,171 +830,6 @@ } ] }, - "CatalogCommand": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "argHint": { - "type": [ - "string", - "null" - ] - }, - "source": { - "type": "string" - } - }, - "required": [ - "name", - "description", - "source" - ] - }, - "CatalogExecutorEntry": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "capabilities": { - "$ref": "#/$defs/HarnessExecutorCapabilities" - }, - "commands": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogCommand" - } - }, - "harnessId": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessId" - }, - { - "type": "null" - } - ] - }, - "implemented": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "key", - "capabilities", - "commands" - ] - }, - "HarnessExecutorCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - }, - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - }, - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - }, - "mcpInjection": { - "$ref": "#/$defs/McpInjection" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream", - "usageInResult", - "sessionIdCapture", - "slashCommands", - "effortSelection", - "mcpInjection" - ] - }, - "McpInjection": { - "type": "string", - "enum": [ - "flag", - "cwdFile", - "persistentConfig", - "none" - ] - }, - "CatalogSkillEntry": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "required": [ - "name", - "description" - ] - }, - "CatalogSheet": { - "type": "object", - "properties": { - "node": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - }, - "executors": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogExecutorEntry" - } - }, - "tools": { - "type": "array", - "items": { - "type": "string" - } - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogSkillEntry" - } - } - }, - "required": [ - "node", - "agents", - "executors", - "tools", - "skills" - ] - }, "CatalogAgentsResponse": { "type": "object", "properties": { @@ -1009,142 +844,6 @@ "agents" ] }, - "OutcomeBucket": { - "type": "object", - "properties": { - "tasks": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "failed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "verified": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "refuted": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "escalated": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "diverged": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "divergenceRate": { - "type": "number", - "format": "double" - }, - "totalCostUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "avgDurationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "tasks", - "completed", - "failed", - "verified", - "refuted", - "escalated", - "diverged", - "divergenceRate" - ] - }, - "OutcomesFilter": { - "type": "object", - "properties": { - "since": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "until": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "agentId": { - "type": [ - "string", - "null" - ] - }, - "origin": { - "type": [ - "string", - "null" - ] - } - } - }, - "OutcomesResponse": { - "type": "object", - "properties": { - "filter": { - "$ref": "#/$defs/OutcomesFilter" - }, - "totals": { - "$ref": "#/$defs/OutcomeBucket" - }, - "byAgent": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byExecutor": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byDay": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - } - }, - "required": [ - "filter", - "totals", - "byAgent", - "byExecutor", - "byDay" - ] - }, "MeshOverview": { "type": "object", "properties": { @@ -4869,33 +4568,194 @@ "cmd" ] }, - "TranscriptTurn": { + "SessionDeleted": { "type": "object", "properties": { - "role": { - "$ref": "#/$defs/Role" + "ok": { + "type": "boolean" }, - "text": { - "type": "string" + "session": { + "$ref": "#/$defs/SessionId" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "role", - "text" - ] - }, - "TranscriptResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "conversations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "messages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summaries": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "session", + "conversations", + "messages", + "summaries" + ] + }, + "SessionDeleteRequest": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + } + } + }, + "required": [ + "sessions" + ] + }, + "SessionDeleteError": { + "type": "string", + "enum": [ + "session is live", + "not found", + "delete failed" + ] + }, + "SessionDeleteRefused": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "ok": { + "type": "boolean" + }, + "error": { + "$ref": "#/$defs/SessionDeleteError" + } + }, + "required": [ + "session", + "ok", + "error" + ] + }, + "SessionDeleteResult": { + "anyOf": [ + { + "$ref": "#/$defs/SessionDeleted" + }, + { + "$ref": "#/$defs/SessionDeleteRefused" + } + ] + }, + "SessionDeleteResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionDeleteResult" + } + } + }, + "required": [ + "results" + ] + }, + "SessionTrashReason": { + "type": "string", + "enum": [ + "empty", + "one-word-reply" + ] + }, + "SessionTrashCandidate": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "harness": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "reason": { + "$ref": "#/$defs/SessionTrashReason" + }, + "userTurns": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reply": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "session", + "harness", + "updatedAt", + "reason", + "userTurns" + ] + }, + "SessionTrashList": { + "type": "object", + "properties": { + "candidates": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionTrashCandidate" + } + } + }, + "required": [ + "candidates" + ] + }, + "TranscriptTurn": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "text": { + "type": "string" + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "role", + "text" + ] + }, + "TranscriptResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" }, "command": { "type": "string" @@ -8088,6 +7948,13 @@ "string", "null" ] + }, + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -8852,6 +8719,22 @@ "string", "null" ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -8929,6 +8812,75 @@ "channel" ] }, + "TopicFiling": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } + }, + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + } + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } + } + }, + "required": [ + "sessions", + "conversations", + "history" + ] + }, + "SessionSuggestion": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "name": { + "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "parentId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "name" + ] + }, + "SessionSuggestionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionSuggestion" + } + } + }, + "required": [ + "sessions" + ] + }, "ConversationPlacement": { "type": "object", "properties": { @@ -13030,14 +12982,6 @@ "sessions" ] }, - "TaskExecutorKind": { - "type": "string", - "enum": [ - "chat-loop", - "harness-session", - "mesh" - ] - }, "task.done": { "type": "object", "properties": { @@ -13047,6 +12991,18 @@ "status": { "$ref": "#/$defs/TaskStatus" }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "childSessionId": { + "type": [ + "string", + "null" + ] + }, "ts": { "type": "integer", "format": "int64" @@ -13068,39 +13024,7 @@ "budget-exceeded" ] }, - "ContextRefKind": { - "type": "string", - "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" - ] - }, - "ContextRef": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" - }, - "ref": { - "type": "string" - }, - "note": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionKind": { + "CriterionKind": { "type": "string", "enum": [ "manual", @@ -13135,21 +13059,6 @@ "TaskBudget": { "type": "object", "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, "maxTurns": { "type": [ "integer", @@ -13195,13 +13104,6 @@ "format": "uint64", "minimum": 0 }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, "turns": { "type": "integer", "format": "uint32", @@ -13226,741 +13128,108 @@ "high" ] }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "usage" ] }, - "TaskPromptMode": { + "LogLevel": { "type": "string", "enum": [ - "task", - "heartbeat" + "debug", + "info", + "warn", + "error" ] }, - "TaskSpec": { + "TaskWire": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "taskId": { - "type": "string" - }, - "agentId": { + "id": { "type": "string" }, "goal": { "type": "string" }, - "resolvedContext": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, "acceptanceCriteria": { "type": "array", "items": { "$ref": "#/$defs/AcceptanceCriterion" } }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} - }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "workingDir": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" - }, - { - "type": "null" - } - ] - }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] + "agentId": { + "type": "string" }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "promptMode": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/TaskPromptMode" + "$ref": "#/$defs/HarnessId" }, { "type": "null" } ] }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - }, - "session": { - "type": "string" - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { + "model": { "type": [ "string", "null" ] }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "session" - ], - "additionalProperties": true - }, - "TaskPermissionDecision": { - "type": "object", - "properties": { - "requestId": { - "type": "string" - }, - "tool": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - }, - "at": { - "type": "integer", - "format": "int64" - }, - "message": { + "effort": { "type": [ "string", "null" ] - } - }, - "required": [ - "requestId", - "tool", - "decision", - "at" - ] - }, - "TaskPermissionOutcome": { - "type": "string", - "enum": [ - "allow", - "deny", - "timeout" - ] - }, - "ArtifactKind": { - "type": "string", - "enum": [ - "file", - "url", - "commit", - "message" - ] - }, - "TaskArtifact": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" - }, - "ref": { - "type": "string" }, - "note": { + "requestedBy": { "type": [ "string", "null" ] - } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionReport": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "met": { - "type": "boolean" - }, - "evidence": { - "type": "string", - "default": "" - } - }, - "required": [ - "id", - "met" - ] - }, - "TaskResult": { - "type": "object", - "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { - "type": "string" - }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "error": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "verdict", - "summary", - "artifacts", - "usage" - ] - }, - "EvalVerdict": { - "type": "string", - "enum": [ - "verified", - "refuted", - "escalated" - ] - }, - "EvalOutcome": { - "type": "object", - "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "verifierTaskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "diverged": { - "type": "boolean" - }, - "escalatedAt": { - "type": [ - "string", - "null" - ], - "format": "date-time" - } - }, - "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" - ] - }, - "ExecutorTurnCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream" - ] - }, - "ExecutorResultCapabilities": { - "type": "object", - "properties": { - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - } - }, - "required": [ - "usageInResult", - "sessionIdCapture" - ] - }, - "ExecutorInteractionCapabilities": { - "type": "object", - "properties": { - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - } - }, - "required": [ - "slashCommands", - "effortSelection" - ] - }, - "TaskApprovalRequest": { - "type": "object", - "properties": { - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "taskId", - "requestId", - "name", - "input" - ] - }, - "TaskEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "den" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "event": { - "$ref": "#/$defs/AgentEvent" - } - }, - "required": [ - "type", - "ts", - "event" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.start" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "type", - "ts", - "turn" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "type", - "ts", - "turn", - "usage" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.spawned" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "nativeSessionId": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "ts", - "nativeSessionId" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "cost" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "deltaUsd": { - "type": "number", - "format": "double" - }, - "totalUsd": { - "type": "number", - "format": "double" - } - }, - "required": [ - "type", - "ts", - "deltaUsd", - "totalUsd" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "log" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "level": { - "$ref": "#/$defs/LogLevel" - }, - "message": { - "type": "string" - } - }, - "required": [ - "type", - "ts", - "level", - "message" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-request" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "ts", - "taskId", - "requestId", - "name", - "input" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - } - }, - "required": [ - "type", - "ts", - "taskId", - "requestId", - "decision" - ] - } - ] - }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" - ] - }, - "TaskWire": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "goal": { - "type": "string" - }, - "contextRefs": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": "array", - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { - "type": [ - "string", - "null" - ] - }, - "agentId": { - "type": "string" - }, - "requestedBy": { + "parentSessionId": { "type": [ "string", "null" ] }, - "origin": { - "type": "string" - }, "parentTaskId": { "type": [ "string", "null" ] }, - "chainDepth": { + "depth": { "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" - ] + "format": "uint8", + "minimum": 0, + "maximum": 255 }, - "claimedBy": { + "childSessionId": { "type": [ "string", "null" @@ -13982,22 +13251,6 @@ "status": { "$ref": "#/$defs/TaskStatus" }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "maxAttempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "pendingMessage": { - "type": [ - "string", - "null" - ] - }, "error": { "type": [ "string", @@ -14014,39 +13267,6 @@ } ] }, - "conversationId": { - "type": [ - "string", - "null" - ] - }, - "sessionKey": { - "type": [ - "string", - "null" - ] - }, - "harnessSessionIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "eval": { - "anyOf": [ - { - "$ref": "#/$defs/EvalOutcome" - }, - { - "type": "null" - } - ] - }, - "evalAttempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, "createdAt": { "type": "integer", "format": "int64" @@ -14058,13 +13278,6 @@ ], "format": "int64" }, - "lastHeartbeatAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, "completedAt": { "type": [ "integer", @@ -14079,33 +13292,17 @@ ], "format": "uint64", "minimum": 0 - }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskApprovalRequest" - } } }, "required": [ "id", "goal", - "contextRefs", "acceptanceCriteria", - "spec", - "executor", "agentId", - "origin", - "chainDepth", + "node", + "depth", "budget", "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", "createdAt" ] }, @@ -14113,96 +13310,78 @@ "type": "object", "properties": { "goal": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" - }, - { - "type": "null" - } - ] - }, - "executorTarget": { "type": [ "string", "null" ] }, - "requestedBy": { + "agentId": { "type": [ "string", "null" ] }, - "parentTaskId": { + "nodeAffinity": { "type": [ "string", "null" ] }, - "chainDepth": { + "acceptanceCriteria": { "type": [ - "integer", + "array", "null" ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" - ] + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } }, - "spec": { + "budget": { "anyOf": [ { - "$ref": "#/$defs/TaskSpec" + "$ref": "#/$defs/TaskBudget" }, { "type": "null" } ] }, - "budget": { + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { "anyOf": [ { - "$ref": "#/$defs/TaskBudget" + "$ref": "#/$defs/ThinkingLevel" }, { "type": "null" } ] }, - "contextRefs": { + "workingDir": { "type": [ - "array", + "string", "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } + ] }, - "acceptanceCriteria": { + "requestedBy": { "type": [ - "array", + "string", "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } + ] } }, - "required": [ - "goal", - "agentId" - ] + "additionalProperties": true }, "TaskResponse": { "type": "object", @@ -14229,17 +13408,6 @@ "tasks" ] }, - "TaskSteerAccepted": { - "type": "object", - "properties": { - "ok": { - "type": "boolean" - } - }, - "required": [ - "ok" - ] - }, "TaskKillResponse": { "type": "object", "properties": { @@ -14261,28 +13429,6 @@ "ok" ] }, - "TaskApprovalAccepted": { - "type": "object", - "properties": { - "ok": { - "type": "boolean" - } - }, - "required": [ - "ok" - ] - }, - "TaskApprovalWaitResponse": { - "type": "object", - "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" - } - }, - "required": [ - "approval" - ] - }, "TaskWaitTimeoutResponse": { "type": "object", "properties": { @@ -14304,114 +13450,6 @@ "error" ] }, - "TaskOverrides": { - "type": "object", - "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" - }, - { - "type": "null" - } - ] - }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" - }, - { - "type": "null" - } - ] - }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] - }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": true - }, "MemorySearchResult": { "type": "object", "properties": { diff --git a/packages/contract/schema/sent.schema.json b/packages/contract/schema/sent.schema.json index 2deaea8..823eb4f 100644 --- a/packages/contract/schema/sent.schema.json +++ b/packages/contract/schema/sent.schema.json @@ -844,171 +844,6 @@ } ] }, - "CatalogCommand": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "argHint": { - "type": [ - "string", - "null" - ] - }, - "source": { - "type": "string" - } - }, - "required": [ - "name", - "description", - "source" - ] - }, - "CatalogExecutorEntry": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "capabilities": { - "$ref": "#/$defs/HarnessExecutorCapabilities" - }, - "commands": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogCommand" - } - }, - "harnessId": { - "anyOf": [ - { - "$ref": "#/$defs/HarnessId" - }, - { - "type": "null" - } - ] - }, - "implemented": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "key", - "capabilities", - "commands" - ] - }, - "HarnessExecutorCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - }, - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - }, - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - }, - "mcpInjection": { - "$ref": "#/$defs/McpInjection" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream", - "usageInResult", - "sessionIdCapture", - "slashCommands", - "effortSelection", - "mcpInjection" - ] - }, - "McpInjection": { - "type": "string", - "enum": [ - "flag", - "cwdFile", - "persistentConfig", - "none" - ] - }, - "CatalogSkillEntry": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "required": [ - "name", - "description" - ] - }, - "CatalogSheet": { - "type": "object", - "properties": { - "node": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogAgent" - } - }, - "executors": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogExecutorEntry" - } - }, - "tools": { - "type": "array", - "items": { - "type": "string" - } - }, - "skills": { - "type": "array", - "items": { - "$ref": "#/$defs/CatalogSkillEntry" - } - } - }, - "required": [ - "node", - "agents", - "executors", - "tools", - "skills" - ] - }, "CatalogAgentsResponse": { "type": "object", "properties": { @@ -1023,142 +858,6 @@ "agents" ] }, - "OutcomeBucket": { - "type": "object", - "properties": { - "tasks": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "completed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "failed": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "verified": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "refuted": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "escalated": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "diverged": { - "type": "integer", - "format": "uint64", - "minimum": 0 - }, - "divergenceRate": { - "type": "number", - "format": "double" - }, - "totalCostUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "avgDurationMs": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - } - }, - "required": [ - "tasks", - "completed", - "failed", - "verified", - "refuted", - "escalated", - "diverged", - "divergenceRate" - ] - }, - "OutcomesFilter": { - "type": "object", - "properties": { - "since": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "until": { - "type": [ - "string", - "null" - ], - "format": "date-time" - }, - "agentId": { - "type": [ - "string", - "null" - ] - }, - "origin": { - "type": [ - "string", - "null" - ] - } - } - }, - "OutcomesResponse": { - "type": "object", - "properties": { - "filter": { - "$ref": "#/$defs/OutcomesFilter" - }, - "totals": { - "$ref": "#/$defs/OutcomeBucket" - }, - "byAgent": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byExecutor": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - }, - "byDay": { - "type": "object", - "additionalProperties": { - "$ref": "#/$defs/OutcomeBucket" - } - } - }, - "required": [ - "filter", - "totals", - "byAgent", - "byExecutor", - "byDay" - ] - }, "MeshOverview": { "type": "object", "properties": { @@ -4891,33 +4590,196 @@ "env" ] }, - "TranscriptTurn": { + "SessionDeleted": { "type": "object", "properties": { - "role": { - "$ref": "#/$defs/Role" + "ok": { + "type": "boolean" }, - "text": { - "type": "string" + "session": { + "$ref": "#/$defs/SessionId" }, - "ts": { - "type": [ - "integer", - "null" - ], - "format": "int64" - } - }, - "required": [ - "role", - "text" - ] - }, - "TranscriptResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "conversations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "messages": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "summaries": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "required": [ + "ok", + "session", + "conversations", + "messages", + "summaries" + ] + }, + "SessionDeleteRequest": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionId" + } + } + }, + "required": [ + "sessions" + ] + }, + "SessionDeleteError": { + "type": "string", + "enum": [ + "session is live", + "not found", + "delete failed" + ] + }, + "SessionDeleteRefused": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "ok": { + "type": "boolean" + }, + "error": { + "$ref": "#/$defs/SessionDeleteError" + } + }, + "required": [ + "session", + "ok", + "error" + ] + }, + "SessionDeleteResult": { + "anyOf": [ + { + "$ref": "#/$defs/SessionDeleted" + }, + { + "$ref": "#/$defs/SessionDeleteRefused" + } + ] + }, + "SessionDeleteResults": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionDeleteResult" + } + } + }, + "required": [ + "results" + ] + }, + "SessionTrashReason": { + "type": "string", + "enum": [ + "empty", + "one-word-reply" + ] + }, + "SessionTrashCandidate": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/SessionId" + }, + "harness": { + "$ref": "#/$defs/HarnessId" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "reason": { + "$ref": "#/$defs/SessionTrashReason" + }, + "userTurns": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "reply": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "session", + "harness", + "title", + "updatedAt", + "reason", + "userTurns", + "reply" + ] + }, + "SessionTrashList": { + "type": "object", + "properties": { + "candidates": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionTrashCandidate" + } + } + }, + "required": [ + "candidates" + ] + }, + "TranscriptTurn": { + "type": "object", + "properties": { + "role": { + "$ref": "#/$defs/Role" + }, + "text": { + "type": "string" + }, + "ts": { + "type": [ + "integer", + "null" + ], + "format": "int64" + } + }, + "required": [ + "role", + "text" + ] + }, + "TranscriptResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" }, "command": { "type": "string" @@ -8125,6 +7987,13 @@ "string", "null" ] + }, + "lastActive": { + "type": [ + "integer", + "null" + ], + "format": "int64" } }, "required": [ @@ -8895,6 +8764,22 @@ "string", "null" ] + }, + "parentSessionId": { + "anyOf": [ + { + "$ref": "#/$defs/SessionId" + }, + { + "type": "null" + } + ] + }, + "taskId": { + "type": [ + "string", + "null" + ] } }, "required": [ @@ -8973,6 +8858,75 @@ "channel" ] }, + "TopicFiling": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicSession" + } + }, + "conversations": { + "type": "array", + "items": { + "$ref": "#/$defs/TopicConversation" + } + }, + "history": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionHistoryMark" + } + } + }, + "required": [ + "sessions", + "conversations", + "history" + ] + }, + "SessionSuggestion": { + "type": "object", + "properties": { + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "name": { + "type": "string" + }, + "topicId": { + "type": [ + "string", + "null" + ] + }, + "parentId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "sessionId", + "name" + ] + }, + "SessionSuggestionList": { + "type": "object", + "properties": { + "sessions": { + "type": "array", + "items": { + "$ref": "#/$defs/SessionSuggestion" + } + } + }, + "required": [ + "sessions" + ] + }, "ConversationPlacement": { "type": "object", "properties": { @@ -13140,14 +13094,6 @@ "sessions" ] }, - "TaskExecutorKind": { - "type": "string", - "enum": [ - "chat-loop", - "harness-session", - "mesh" - ] - }, "task.done": { "type": "object", "properties": { @@ -13157,6 +13103,18 @@ "status": { "$ref": "#/$defs/TaskStatus" }, + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "childSessionId": { + "type": [ + "string", + "null" + ] + }, "ts": { "type": "integer", "format": "int64" @@ -13178,38 +13136,6 @@ "budget-exceeded" ] }, - "ContextRefKind": { - "type": "string", - "enum": [ - "conversation", - "message", - "task", - "file", - "url", - "wiki" - ] - }, - "ContextRef": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ContextRefKind" - }, - "ref": { - "type": "string" - }, - "note": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "kind", - "ref" - ] - }, "CriterionKind": { "type": "string", "enum": [ @@ -13245,21 +13171,6 @@ "TaskBudget": { "type": "object", "properties": { - "maxUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, - "maxTokens": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0 - }, "maxTurns": { "type": [ "integer", @@ -13305,13 +13216,6 @@ "format": "uint64", "minimum": 0 }, - "costUsd": { - "type": [ - "number", - "null" - ], - "format": "double" - }, "turns": { "type": "integer", "format": "uint32", @@ -13336,743 +13240,108 @@ "high" ] }, - "TaskIsolation": { - "type": "string", - "enum": [ - "inherit", - "isolated" + "TaskResult": { + "type": "object", + "properties": { + "verdict": { + "$ref": "#/$defs/TaskVerdict" + }, + "summary": { + "type": "string" + }, + "usage": { + "$ref": "#/$defs/TaskUsage" + }, + "error": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "verdict", + "summary", + "usage" ] }, - "TaskPromptMode": { + "LogLevel": { "type": "string", "enum": [ - "task", - "heartbeat" + "debug", + "info", + "warn", + "error" ] }, - "TaskSpec": { + "TaskWire": { "type": "object", "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "taskId": { - "type": "string" - }, - "agentId": { + "id": { "type": "string" }, "goal": { "type": "string" }, - "resolvedContext": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, "acceptanceCriteria": { "type": "array", "items": { "$ref": "#/$defs/AcceptanceCriterion" } }, - "budget": { - "$ref": "#/$defs/TaskBudget", - "default": {} - }, - "tools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "workingDir": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" - }, - { - "type": "null" - } - ] - }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] + "agentId": { + "type": "string" }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" - }, - { - "type": "null" - } - ] + "node": { + "type": "string" }, - "promptMode": { + "harness": { "anyOf": [ { - "$ref": "#/$defs/TaskPromptMode" + "$ref": "#/$defs/HarnessId" }, { "type": "null" } ] }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - }, - "session": { - "type": "string" - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { + "model": { "type": [ "string", "null" ] }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - } - }, - "required": [ - "taskId", - "agentId", - "goal", - "resolvedContext", - "acceptanceCriteria", - "budget", - "session" - ], - "additionalProperties": true - }, - "TaskPermissionDecision": { - "type": "object", - "properties": { - "requestId": { - "type": "string" - }, - "tool": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - }, - "at": { - "type": "integer", - "format": "int64" - }, - "message": { + "effort": { "type": [ "string", "null" ] - } - }, - "required": [ - "requestId", - "tool", - "decision", - "at" - ] - }, - "TaskPermissionOutcome": { - "type": "string", - "enum": [ - "allow", - "deny", - "timeout" - ] - }, - "ArtifactKind": { - "type": "string", - "enum": [ - "file", - "url", - "commit", - "message" - ] - }, - "TaskArtifact": { - "type": "object", - "properties": { - "kind": { - "$ref": "#/$defs/ArtifactKind" - }, - "ref": { - "type": "string" }, - "note": { + "requestedBy": { "type": [ "string", "null" ] - } - }, - "required": [ - "kind", - "ref" - ] - }, - "CriterionReport": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "met": { - "type": "boolean" - }, - "evidence": { - "type": "string", - "default": "" - } - }, - "required": [ - "id", - "met", - "evidence" - ] - }, - "TaskResult": { - "type": "object", - "properties": { - "verdict": { - "$ref": "#/$defs/TaskVerdict" - }, - "summary": { - "type": "string" - }, - "output": { - "type": [ - "string", - "null" - ] - }, - "artifacts": { - "type": "array", - "items": { - "$ref": "#/$defs/TaskArtifact" - } - }, - "criteriaSelfReport": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "error": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "verdict", - "summary", - "artifacts", - "usage" - ] - }, - "EvalVerdict": { - "type": "string", - "enum": [ - "verified", - "refuted", - "escalated" - ] - }, - "EvalOutcome": { - "type": "object", - "properties": { - "verdict": { - "$ref": "#/$defs/EvalVerdict" - }, - "attempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "verifierTaskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "criteriaReport": { - "type": "array", - "items": { - "$ref": "#/$defs/CriterionReport" - } - }, - "diverged": { - "type": "boolean" - }, - "escalatedAt": { - "type": [ - "string", - "null" - ], - "format": "date-time" - } - }, - "required": [ - "verdict", - "attempts", - "verifierTaskIds", - "criteriaReport", - "diverged" - ] - }, - "ExecutorTurnCapabilities": { - "type": "object", - "properties": { - "steerable": { - "type": "boolean" - }, - "multiTurn": { - "type": "boolean" - }, - "structuredStream": { - "type": "boolean" - } - }, - "required": [ - "steerable", - "multiTurn", - "structuredStream" - ] - }, - "ExecutorResultCapabilities": { - "type": "object", - "properties": { - "usageInResult": { - "type": "boolean" - }, - "sessionIdCapture": { - "type": "boolean" - } - }, - "required": [ - "usageInResult", - "sessionIdCapture" - ] - }, - "ExecutorInteractionCapabilities": { - "type": "object", - "properties": { - "slashCommands": { - "type": "boolean" - }, - "effortSelection": { - "type": "boolean" - } - }, - "required": [ - "slashCommands", - "effortSelection" - ] - }, - "TaskApprovalRequest": { - "type": "object", - "properties": { - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "taskId", - "requestId", - "name", - "input" - ] - }, - "TaskEvent": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "den" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "event": { - "$ref": "#/$defs/AgentEvent" - } - }, - "required": [ - "type", - "ts", - "event" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.start" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 - } - }, - "required": [ - "type", - "ts", - "turn" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "turn.end" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "turn": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "usage": { - "$ref": "#/$defs/TaskUsage" - }, - "harnessSessionId": { - "anyOf": [ - { - "$ref": "#/$defs/SessionId" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "type", - "ts", - "turn", - "usage" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "session.spawned" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "nativeSessionId": { - "type": "string" - }, - "model": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "ts", - "nativeSessionId" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "cost" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "deltaUsd": { - "type": "number", - "format": "double" - }, - "totalUsd": { - "type": "number", - "format": "double" - } - }, - "required": [ - "type", - "ts", - "deltaUsd", - "totalUsd" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "log" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "level": { - "$ref": "#/$defs/LogLevel" - }, - "message": { - "type": "string" - } - }, - "required": [ - "type", - "ts", - "level", - "message" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-request" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "input": { - "type": "object", - "additionalProperties": true - }, - "toolCallId": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "type", - "ts", - "taskId", - "requestId", - "name", - "input" - ] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "const": "approval-resolved" - }, - "ts": { - "type": "integer", - "format": "int64" - }, - "taskId": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "decision": { - "$ref": "#/$defs/TaskPermissionOutcome" - } - }, - "required": [ - "type", - "ts", - "taskId", - "requestId", - "decision" - ] - } - ] - }, - "LogLevel": { - "type": "string", - "enum": [ - "debug", - "info", - "warn", - "error" - ] - }, - "TaskWire": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "goal": { - "type": "string" - }, - "contextRefs": { - "type": "array", - "items": { - "$ref": "#/$defs/ContextRef" - } - }, - "acceptanceCriteria": { - "type": "array", - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } - }, - "spec": { - "$ref": "#/$defs/TaskSpec" - }, - "executor": { - "$ref": "#/$defs/TaskExecutorKind" - }, - "executorTarget": { - "type": [ - "string", - "null" - ] - }, - "agentId": { - "type": "string" - }, - "requestedBy": { + "parentSessionId": { "type": [ "string", "null" ] }, - "origin": { - "type": "string" - }, "parentTaskId": { "type": [ "string", "null" ] }, - "chainDepth": { + "depth": { "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" - ] + "format": "uint8", + "minimum": 0, + "maximum": 255 }, - "claimedBy": { + "childSessionId": { "type": [ "string", "null" @@ -14094,22 +13363,6 @@ "status": { "$ref": "#/$defs/TaskStatus" }, - "attempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "maxAttempts": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, - "pendingMessage": { - "type": [ - "string", - "null" - ] - }, "error": { "type": [ "string", @@ -14126,39 +13379,6 @@ } ] }, - "conversationId": { - "type": [ - "string", - "null" - ] - }, - "sessionKey": { - "type": [ - "string", - "null" - ] - }, - "harnessSessionIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "eval": { - "anyOf": [ - { - "$ref": "#/$defs/EvalOutcome" - }, - { - "type": "null" - } - ] - }, - "evalAttempt": { - "type": "integer", - "format": "uint32", - "minimum": 0 - }, "createdAt": { "type": "integer", "format": "int64" @@ -14170,13 +13390,6 @@ ], "format": "int64" }, - "lastHeartbeatAt": { - "type": [ - "integer", - "null" - ], - "format": "int64" - }, "completedAt": { "type": [ "integer", @@ -14191,33 +13404,17 @@ ], "format": "uint64", "minimum": 0 - }, - "pendingApprovals": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskApprovalRequest" - } } }, "required": [ "id", "goal", - "contextRefs", "acceptanceCriteria", - "spec", - "executor", "agentId", - "origin", - "chainDepth", + "node", + "depth", "budget", "status", - "attempt", - "maxAttempts", - "harnessSessionIds", - "evalAttempt", "createdAt" ] }, @@ -14225,96 +13422,78 @@ "type": "object", "properties": { "goal": { - "type": "string" - }, - "agentId": { - "type": "string" - }, - "executor": { - "anyOf": [ - { - "$ref": "#/$defs/TaskExecutorKind" - }, - { - "type": "null" - } - ] - }, - "executorTarget": { "type": [ "string", "null" ] }, - "requestedBy": { + "agentId": { "type": [ "string", "null" ] }, - "parentTaskId": { + "nodeAffinity": { "type": [ "string", "null" ] }, - "chainDepth": { + "acceptanceCriteria": { "type": [ - "integer", + "array", "null" ], - "format": "uint32", - "minimum": 0 - }, - "nodeAffinity": { - "type": [ - "string", - "null" - ] + "items": { + "$ref": "#/$defs/AcceptanceCriterion" + } }, - "spec": { + "budget": { "anyOf": [ { - "$ref": "#/$defs/TaskSpec" + "$ref": "#/$defs/TaskBudget" }, { "type": "null" } ] }, - "budget": { + "parentSessionId": { + "type": [ + "string", + "null" + ] + }, + "model": { + "type": [ + "string", + "null" + ] + }, + "effort": { "anyOf": [ { - "$ref": "#/$defs/TaskBudget" + "$ref": "#/$defs/ThinkingLevel" }, { "type": "null" } ] }, - "contextRefs": { + "workingDir": { "type": [ - "array", + "string", "null" - ], - "items": { - "$ref": "#/$defs/ContextRef" - } + ] }, - "acceptanceCriteria": { + "requestedBy": { "type": [ - "array", + "string", "null" - ], - "items": { - "$ref": "#/$defs/AcceptanceCriterion" - } + ] } }, - "required": [ - "goal", - "agentId" - ] + "additionalProperties": true }, "TaskResponse": { "type": "object", @@ -14341,17 +13520,6 @@ "tasks" ] }, - "TaskSteerAccepted": { - "type": "object", - "properties": { - "ok": { - "type": "boolean" - } - }, - "required": [ - "ok" - ] - }, "TaskKillResponse": { "type": "object", "properties": { @@ -14373,28 +13541,6 @@ "ok" ] }, - "TaskApprovalAccepted": { - "type": "object", - "properties": { - "ok": { - "type": "boolean" - } - }, - "required": [ - "ok" - ] - }, - "TaskApprovalWaitResponse": { - "type": "object", - "properties": { - "approval": { - "$ref": "#/$defs/TaskApprovalRequest" - } - }, - "required": [ - "approval" - ] - }, "TaskWaitTimeoutResponse": { "type": "object", "properties": { @@ -14416,114 +13562,6 @@ "error" ] }, - "TaskOverrides": { - "type": "object", - "properties": { - "delegation": { - "type": [ - "boolean", - "null" - ] - }, - "meshFrom": { - "type": [ - "string", - "null" - ] - }, - "presetId": { - "type": [ - "string", - "null" - ] - }, - "presetName": { - "type": [ - "string", - "null" - ] - }, - "permissionDecisions": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/$defs/TaskPermissionDecision" - } - }, - "auditOnly": { - "type": [ - "boolean", - "null" - ] - }, - "workingDir": { - "type": [ - "string", - "null" - ] - }, - "model": { - "type": [ - "string", - "null" - ] - }, - "effort": { - "anyOf": [ - { - "$ref": "#/$defs/Effort" - }, - { - "type": "null" - } - ] - }, - "systemPromptAppend": { - "type": [ - "string", - "null" - ] - }, - "isolation": { - "anyOf": [ - { - "$ref": "#/$defs/TaskIsolation" - }, - { - "type": "null" - } - ] - }, - "promptMode": { - "anyOf": [ - { - "$ref": "#/$defs/TaskPromptMode" - }, - { - "type": "null" - } - ] - }, - "excludeTools": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string" - } - }, - "resumeMessage": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": true - }, "MemorySearchResult": { "type": "object", "properties": { diff --git a/packages/contract/src/accepted.ts b/packages/contract/src/accepted.ts index 67751dd..fd528e4 100644 --- a/packages/contract/src/accepted.ts +++ b/packages/contract/src/accepted.ts @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/accepted.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema @@ -41,11 +41,6 @@ export type SessionId = string; * via the `definition` "CatalogAgent". */ export type CatalogAgent = Preset | CatalogNode; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "McpInjection". - */ -export type McpInjection = "flag" | "cwdFile" | "persistentConfig" | "none"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "Activity". @@ -271,6 +266,21 @@ export type ProjectRule = "git-remote" | "git-root" | "cwd-basename"; * via the `definition` "ProviderRecovery". */ export type ProviderRecovery = "retrying" | "permanent"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteError". + */ +export type SessionDeleteError = "session is live" | "not found" | "delete failed"; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResult". + */ +export type SessionDeleteResult = SessionDeleted | SessionDeleteRefused; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashReason". + */ +export type SessionTrashReason = "empty" | "one-word-reply"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ContextSource". @@ -580,15 +590,7 @@ export type PlacedBy = "you" | "categorizer"; * via the `definition` "DecisionStatus". */ export type DecisionStatus = "active" | "superseded"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "AgentEvent". - */ -export type AgentEvent = { - v: ProtocolVersion; - session: string; -} & AgentEvent1; -export type AgentEvent1 = +export type AgentEvent = | { type: "session.start"; title?: string | null; @@ -1203,21 +1205,11 @@ export type HarnessCode = | "unknown_approval" | "unknown_prompt" | "turn_failed"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskExecutorKind". - */ -export type TaskExecutorKind = "chat-loop" | "harness-session" | "mesh"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskVerdict". */ export type TaskVerdict = "completed" | "failed" | "killed" | "timeout" | "budget-exceeded"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRefKind". - */ -export type ContextRefKind = "conversation" | "message" | "task" | "file" | "url" | "wiki"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "CriterionKind". @@ -1228,89 +1220,6 @@ export type CriterionKind = "manual" | "automated"; * via the `definition` "Effort". */ export type Effort = "low" | "medium" | "high"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskIsolation". - */ -export type TaskIsolation = "inherit" | "isolated"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPromptMode". - */ -export type TaskPromptMode = "task" | "heartbeat"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionOutcome". - */ -export type TaskPermissionOutcome = "allow" | "deny" | "timeout"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ArtifactKind". - */ -export type ArtifactKind = "file" | "url" | "commit" | "message"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EvalVerdict". - */ -export type EvalVerdict = "verified" | "refuted" | "escalated"; -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskEvent". - */ -export type TaskEvent = - | { - type: "den"; - ts: number; - event: AgentEvent; - } - | { - type: "turn.start"; - ts: number; - turn: number; - } - | { - type: "turn.end"; - ts: number; - turn: number; - usage: TaskUsage; - harnessSessionId?: SessionId | null; - } - | { - type: "session.spawned"; - ts: number; - nativeSessionId: string; - model?: string | null; - } - | { - type: "cost"; - ts: number; - deltaUsd: number; - totalUsd: number; - } - | { - type: "log"; - ts: number; - level: LogLevel; - message: string; - } - | { - type: "approval-request"; - ts: number; - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; - } - | { - type: "approval-resolved"; - ts: number; - taskId: string; - requestId: string; - decision: TaskPermissionOutcome; - }; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "LogLevel". @@ -2134,60 +2043,6 @@ export interface CatalogNode { provider?: string | null; model?: string | null; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". - */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". - */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". - */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". - */ -export interface CatalogSkillEntry { - name: string; - description: string; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". - */ -export interface CatalogSheet { - node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "CatalogAgentsResponse". @@ -2195,49 +2050,6 @@ export interface CatalogSheet { export interface CatalogAgentsResponse { agents: CatalogAgent[]; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". - */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". - */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". - */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; - }; - byExecutor: { - [k: string]: OutcomeBucket; - }; - byDay: { - [k: string]: OutcomeBucket; - }; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MeshOverview". @@ -3295,6 +3107,60 @@ export interface RosterEntry { [k: string]: string; }; } +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleted". + */ +export interface SessionDeleted { + ok: boolean; + session: SessionId; + conversations: number; + messages: number; + summaries: number; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteRequest". + */ +export interface SessionDeleteRequest { + sessions: SessionId[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteRefused". + */ +export interface SessionDeleteRefused { + session: SessionId; + ok: boolean; + error: SessionDeleteError; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResults". + */ +export interface SessionDeleteResults { + results: SessionDeleteResult[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashCandidate". + */ +export interface SessionTrashCandidate { + session: SessionId; + harness: HarnessId; + title?: string | null; + updatedAt: string; + reason: SessionTrashReason; + userTurns: number; + reply?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashList". + */ +export interface SessionTrashList { + candidates: SessionTrashCandidate[]; +} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TranscriptTurn". @@ -4089,6 +3955,7 @@ export interface WikiTopicList { export interface TidySample { id: string; title?: string | null; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema @@ -4341,6 +4208,8 @@ export interface TopicSession { title?: string | null; lastActive?: number | null; node?: string | null; + parentSessionId?: SessionId | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema @@ -4364,6 +4233,32 @@ export interface TopicConversation { lastActive?: number | null; node?: string | null; } +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "TopicFiling". + */ +export interface TopicFiling { + sessions: TopicSession[]; + conversations: TopicConversation[]; + history: SessionHistoryMark[]; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSuggestion". + */ +export interface SessionSuggestion { + sessionId: SessionId; + name: string; + topicId?: string | null; + parentId?: string | null; +} +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSuggestionList". + */ +export interface SessionSuggestionList { + sessions: SessionSuggestion[]; +} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "ConversationPlacement". @@ -4460,6 +4355,10 @@ export interface AgentUsage { completionTokens: number; cachedTokens: number; } +export interface AgentEvent1 { + v: ProtocolVersion; + session: string; +} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "LiveSessionSummary". @@ -4913,17 +4812,10 @@ export interface HarnessStoreSessionList { export interface TaskDone { taskId: string; status: TaskStatus; + parentSessionId?: string | null; + childSessionId?: string | null; ts: number; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". - */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "AcceptanceCriterion". @@ -4939,8 +4831,6 @@ export interface AcceptanceCriterion { * via the `definition` "TaskBudget". */ export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; maxTurns?: number | null; maxWallClockMs?: number | null; } @@ -4952,74 +4842,9 @@ export interface TaskUsage { inputTokens?: number | null; outputTokens?: number | null; totalTokens?: number | null; - costUsd?: number | null; turns: number; wallClockMs: number; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". - */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget?: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; -} -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". - */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; - at: number; - message?: string | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". - */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". - */ -export interface CriterionReport { - id: string; - met: boolean; - evidence?: string; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskResult". @@ -5027,62 +4852,9 @@ export interface CriterionReport { export interface TaskResult { verdict: TaskVerdict; summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; usage: TaskUsage; error?: string | null; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". - */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". - */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". - */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". - */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". - */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskWire". @@ -5090,55 +4862,43 @@ export interface TaskApprovalRequest { export interface TaskWire { id: string; goal: string; - contextRefs: ContextRef[]; acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; agentId: string; + node: string; + harness?: HarnessId | null; + model?: string | null; + effort?: string | null; requestedBy?: string | null; - origin: string; + parentSessionId?: string | null; parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; + depth: number; + childSessionId?: string | null; budget: TaskBudget; usage?: TaskUsage | null; status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; error?: string | null; result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; createdAt: number; startedAt?: number | null; - lastHeartbeatAt?: number | null; completedAt?: number | null; durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskCreateRequest". */ export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; + goal?: string | null; + agentId?: string | null; nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; acceptanceCriteria?: AcceptanceCriterion[] | null; + budget?: TaskBudget | null; + parentSessionId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + workingDir?: string | null; + requestedBy?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema @@ -5154,13 +4914,6 @@ export interface TaskResponse { export interface TasksListResponse { tasks: TaskWire[]; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". - */ -export interface TaskSteerAccepted { - ok: boolean; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskKillResponse". @@ -5169,20 +4922,6 @@ export interface TaskKillResponse { ok: boolean; prior?: TaskStatus | null; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". - */ -export interface TaskApprovalAccepted { - ok: boolean; -} -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". - */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "TaskWaitTimeoutResponse". @@ -5191,27 +4930,6 @@ export interface TaskWaitTimeoutResponse { error: string; task?: TaskWire | null; } -/** - * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". - */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; -} /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "MemorySearchResult". diff --git a/packages/contract/src/sent.ts b/packages/contract/src/sent.ts index d6f051f..cbadf7c 100644 --- a/packages/contract/src/sent.ts +++ b/packages/contract/src/sent.ts @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/sent.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/sent.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema @@ -41,11 +41,6 @@ export type SessionId = string; * via the `definition` "CatalogAgent". */ export type CatalogAgent = Preset | CatalogNode; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "McpInjection". - */ -export type McpInjection = "flag" | "cwdFile" | "persistentConfig" | "none"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "Activity". @@ -271,6 +266,21 @@ export type ProjectRule = "git-remote" | "git-root" | "cwd-basename"; * via the `definition` "ProviderRecovery". */ export type ProviderRecovery = "retrying" | "permanent"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteError". + */ +export type SessionDeleteError = "session is live" | "not found" | "delete failed"; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResult". + */ +export type SessionDeleteResult = SessionDeleted | SessionDeleteRefused; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashReason". + */ +export type SessionTrashReason = "empty" | "one-word-reply"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ContextSource". @@ -1218,21 +1228,11 @@ export type HarnessCode = | "unknown_approval" | "unknown_prompt" | "turn_failed"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskExecutorKind". - */ -export type TaskExecutorKind = "chat-loop" | "harness-session" | "mesh"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskVerdict". */ export type TaskVerdict = "completed" | "failed" | "killed" | "timeout" | "budget-exceeded"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRefKind". - */ -export type ContextRefKind = "conversation" | "message" | "task" | "file" | "url" | "wiki"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "CriterionKind". @@ -1243,89 +1243,6 @@ export type CriterionKind = "manual" | "automated"; * via the `definition` "Effort". */ export type Effort = "low" | "medium" | "high"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskIsolation". - */ -export type TaskIsolation = "inherit" | "isolated"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPromptMode". - */ -export type TaskPromptMode = "task" | "heartbeat"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionOutcome". - */ -export type TaskPermissionOutcome = "allow" | "deny" | "timeout"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ArtifactKind". - */ -export type ArtifactKind = "file" | "url" | "commit" | "message"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EvalVerdict". - */ -export type EvalVerdict = "verified" | "refuted" | "escalated"; -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskEvent". - */ -export type TaskEvent = - | { - type: "den"; - ts: number; - event: AgentEvent; - } - | { - type: "turn.start"; - ts: number; - turn: number; - } - | { - type: "turn.end"; - ts: number; - turn: number; - usage: TaskUsage; - harnessSessionId?: SessionId | null; - } - | { - type: "session.spawned"; - ts: number; - nativeSessionId: string; - model?: string | null; - } - | { - type: "cost"; - ts: number; - deltaUsd: number; - totalUsd: number; - } - | { - type: "log"; - ts: number; - level: LogLevel; - message: string; - } - | { - type: "approval-request"; - ts: number; - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; - } - | { - type: "approval-resolved"; - ts: number; - taskId: string; - requestId: string; - decision: TaskPermissionOutcome; - }; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "LogLevel". @@ -2139,60 +2056,6 @@ export interface CatalogNode { provider?: string | null; model?: string | null; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogCommand". - */ -export interface CatalogCommand { - name: string; - description: string; - argHint?: string | null; - source: string; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogExecutorEntry". - */ -export interface CatalogExecutorEntry { - key: string; - capabilities: HarnessExecutorCapabilities; - commands: CatalogCommand[]; - harnessId?: HarnessId | null; - implemented?: boolean | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "HarnessExecutorCapabilities". - */ -export interface HarnessExecutorCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; - usageInResult: boolean; - sessionIdCapture: boolean; - slashCommands: boolean; - effortSelection: boolean; - mcpInjection: McpInjection; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSkillEntry". - */ -export interface CatalogSkillEntry { - name: string; - description: string; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CatalogSheet". - */ -export interface CatalogSheet { - node: string; - agents: CatalogAgent[]; - executors: CatalogExecutorEntry[]; - tools: string[]; - skills: CatalogSkillEntry[]; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "CatalogAgentsResponse". @@ -2200,49 +2063,6 @@ export interface CatalogSheet { export interface CatalogAgentsResponse { agents: CatalogAgent[]; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomeBucket". - */ -export interface OutcomeBucket { - tasks: number; - completed: number; - failed: number; - verified: number; - refuted: number; - escalated: number; - diverged: number; - divergenceRate: number; - totalCostUsd?: number | null; - avgDurationMs?: number | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesFilter". - */ -export interface OutcomesFilter { - since?: string | null; - until?: string | null; - agentId?: string | null; - origin?: string | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "OutcomesResponse". - */ -export interface OutcomesResponse { - filter: OutcomesFilter; - totals: OutcomeBucket; - byAgent: { - [k: string]: OutcomeBucket; - }; - byExecutor: { - [k: string]: OutcomeBucket; - }; - byDay: { - [k: string]: OutcomeBucket; - }; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MeshOverview". @@ -3300,6 +3120,60 @@ export interface RosterEntry { [k: string]: string; }; } +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleted". + */ +export interface SessionDeleted { + ok: boolean; + session: SessionId; + conversations: number; + messages: number; + summaries: number; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteRequest". + */ +export interface SessionDeleteRequest { + sessions: SessionId[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteRefused". + */ +export interface SessionDeleteRefused { + session: SessionId; + ok: boolean; + error: SessionDeleteError; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionDeleteResults". + */ +export interface SessionDeleteResults { + results: SessionDeleteResult[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashCandidate". + */ +export interface SessionTrashCandidate { + session: SessionId; + harness: HarnessId; + title: string | null; + updatedAt: string; + reason: SessionTrashReason; + userTurns: number; + reply: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionTrashList". + */ +export interface SessionTrashList { + candidates: SessionTrashCandidate[]; +} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TranscriptTurn". @@ -4094,6 +3968,7 @@ export interface WikiTopicList { export interface TidySample { id: string; title?: string | null; + lastActive?: number | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema @@ -4346,6 +4221,8 @@ export interface TopicSession { title?: string | null; lastActive?: number | null; node?: string | null; + parentSessionId?: SessionId | null; + taskId?: string | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema @@ -4369,6 +4246,32 @@ export interface TopicConversation { lastActive?: number | null; node?: string | null; } +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "TopicFiling". + */ +export interface TopicFiling { + sessions: TopicSession[]; + conversations: TopicConversation[]; + history: SessionHistoryMark[]; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSuggestion". + */ +export interface SessionSuggestion { + sessionId: SessionId; + name: string; + topicId?: string | null; + parentId?: string | null; +} +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "SessionSuggestionList". + */ +export interface SessionSuggestionList { + sessions: SessionSuggestion[]; +} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "ConversationPlacement". @@ -4928,17 +4831,10 @@ export interface HarnessStoreSessionList { export interface TaskDone { taskId: string; status: TaskStatus; + parentSessionId?: string | null; + childSessionId?: string | null; ts: number; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ContextRef". - */ -export interface ContextRef { - kind: ContextRefKind; - ref: string; - note?: string | null; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "AcceptanceCriterion". @@ -4954,8 +4850,6 @@ export interface AcceptanceCriterion { * via the `definition` "TaskBudget". */ export interface TaskBudget { - maxUsd?: number | null; - maxTokens?: number | null; maxTurns?: number | null; maxWallClockMs?: number | null; } @@ -4967,74 +4861,9 @@ export interface TaskUsage { inputTokens?: number | null; outputTokens?: number | null; totalTokens?: number | null; - costUsd?: number | null; turns: number; wallClockMs: number; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSpec". - */ -export interface TaskSpec { - delegation?: boolean | null; - meshFrom?: string | null; - taskId: string; - agentId: string; - goal: string; - resolvedContext: ContextRef[]; - acceptanceCriteria: AcceptanceCriterion[]; - budget: TaskBudget1; - tools?: string[] | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - session: string; - permissionDecisions?: TaskPermissionDecision[] | null; - presetId?: string | null; - presetName?: string | null; - auditOnly?: boolean | null; - [k: string]: unknown; -} -export interface TaskBudget1 { - maxUsd?: number | null; - maxTokens?: number | null; - maxTurns?: number | null; - maxWallClockMs?: number | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskPermissionDecision". - */ -export interface TaskPermissionDecision { - requestId: string; - tool: string; - decision: TaskPermissionOutcome; - at: number; - message?: string | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskArtifact". - */ -export interface TaskArtifact { - kind: ArtifactKind; - ref: string; - note?: string | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "CriterionReport". - */ -export interface CriterionReport { - id: string; - met: boolean; - evidence: string; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskResult". @@ -5042,62 +4871,9 @@ export interface CriterionReport { export interface TaskResult { verdict: TaskVerdict; summary: string; - output?: string | null; - artifacts: TaskArtifact[]; - criteriaSelfReport?: CriterionReport[] | null; usage: TaskUsage; error?: string | null; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "EvalOutcome". - */ -export interface EvalOutcome { - verdict: EvalVerdict; - attempts: number; - verifierTaskIds: string[]; - criteriaReport: CriterionReport[]; - diverged: boolean; - escalatedAt?: string | null; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorTurnCapabilities". - */ -export interface ExecutorTurnCapabilities { - steerable: boolean; - multiTurn: boolean; - structuredStream: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorResultCapabilities". - */ -export interface ExecutorResultCapabilities { - usageInResult: boolean; - sessionIdCapture: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "ExecutorInteractionCapabilities". - */ -export interface ExecutorInteractionCapabilities { - slashCommands: boolean; - effortSelection: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalRequest". - */ -export interface TaskApprovalRequest { - taskId: string; - requestId: string; - name: string; - input: { - [k: string]: unknown; - }; - toolCallId?: string | null; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskWire". @@ -5105,55 +4881,43 @@ export interface TaskApprovalRequest { export interface TaskWire { id: string; goal: string; - contextRefs: ContextRef[]; acceptanceCriteria: AcceptanceCriterion[]; - spec: TaskSpec; - executor: TaskExecutorKind; - executorTarget?: string | null; agentId: string; + node: string; + harness?: HarnessId | null; + model?: string | null; + effort?: string | null; requestedBy?: string | null; - origin: string; + parentSessionId?: string | null; parentTaskId?: string | null; - chainDepth: number; - nodeAffinity?: string | null; - claimedBy?: string | null; + depth: number; + childSessionId?: string | null; budget: TaskBudget; usage?: TaskUsage | null; status: TaskStatus; - attempt: number; - maxAttempts: number; - pendingMessage?: string | null; error?: string | null; result?: TaskResult | null; - conversationId?: string | null; - sessionKey?: string | null; - harnessSessionIds: string[]; - eval?: EvalOutcome | null; - evalAttempt: number; createdAt: number; startedAt?: number | null; - lastHeartbeatAt?: number | null; completedAt?: number | null; durationMs?: number | null; - pendingApprovals?: TaskApprovalRequest[] | null; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskCreateRequest". */ export interface TaskCreateRequest { - goal: string; - agentId: string; - executor?: TaskExecutorKind | null; - executorTarget?: string | null; - requestedBy?: string | null; - parentTaskId?: string | null; - chainDepth?: number | null; + goal?: string | null; + agentId?: string | null; nodeAffinity?: string | null; - spec?: TaskSpec | null; - budget?: TaskBudget | null; - contextRefs?: ContextRef[] | null; acceptanceCriteria?: AcceptanceCriterion[] | null; + budget?: TaskBudget | null; + parentSessionId?: string | null; + model?: string | null; + effort?: ThinkingLevel | null; + workingDir?: string | null; + requestedBy?: string | null; + [k: string]: unknown; } /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema @@ -5169,13 +4933,6 @@ export interface TaskResponse { export interface TasksListResponse { tasks: TaskWire[]; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskSteerAccepted". - */ -export interface TaskSteerAccepted { - ok: boolean; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskKillResponse". @@ -5184,20 +4941,6 @@ export interface TaskKillResponse { ok: boolean; prior?: TaskStatus | null; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalAccepted". - */ -export interface TaskApprovalAccepted { - ok: boolean; -} -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskApprovalWaitResponse". - */ -export interface TaskApprovalWaitResponse { - approval: TaskApprovalRequest; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "TaskWaitTimeoutResponse". @@ -5206,27 +4949,6 @@ export interface TaskWaitTimeoutResponse { error: string; task?: TaskWire | null; } -/** - * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema - * via the `definition` "TaskOverrides". - */ -export interface TaskOverrides { - delegation?: boolean | null; - meshFrom?: string | null; - presetId?: string | null; - presetName?: string | null; - permissionDecisions?: TaskPermissionDecision[] | null; - auditOnly?: boolean | null; - workingDir?: string | null; - model?: string | null; - effort?: Effort | null; - systemPromptAppend?: string | null; - isolation?: TaskIsolation | null; - promptMode?: TaskPromptMode | null; - excludeTools?: string[] | null; - resumeMessage?: string | null; - [k: string]: unknown; -} /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "MemorySearchResult". diff --git a/rust/rivethub-plugin/src/contract.rs b/rust/rivethub-plugin/src/contract.rs index f5e1b1f..2d0b797 100644 --- a/rust/rivethub-plugin/src/contract.rs +++ b/rust/rivethub-plugin/src/contract.rs @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@542f8efdef0080940149a275fbfd883e4e63a6ab contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/accepted.schema.json by npm run contract. Do not edit. use std::collections::BTreeMap; From f83aa1ea08f89bdff034018cf3bc311bb303955b Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 10:53:26 -0400 Subject: [PATCH 09/11] chore(release): v0.7.0 --- package-lock.json | 8 ++++---- packages/contract/package.json | 2 +- packages/plugin-sdk/package.json | 4 ++-- rust/rivethub-plugin/Cargo.lock | 2 +- rust/rivethub-plugin/Cargo.toml | 2 +- templates/rust/Cargo.lock | 2 +- templates/typescript/package.json | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5e59597..adedb40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1285,13 +1285,13 @@ }, "packages/contract": { "name": "@rivethub/contract", - "version": "0.0.0" + "version": "0.7.0" }, "packages/plugin-sdk": { "name": "@rivethub/plugin-sdk", - "version": "0.0.0", + "version": "0.7.0", "dependencies": { - "@rivethub/contract": "0.0.0" + "@rivethub/contract": "0.7.0" }, "bin": { "rivethub-plugin-dev": "src/dev.ts" @@ -1301,7 +1301,7 @@ "name": "checklist-ts", "version": "0.1.0", "dependencies": { - "@rivethub/plugin-sdk": "0.0.0" + "@rivethub/plugin-sdk": "0.7.0" }, "devDependencies": { "esbuild": "0.28.2" diff --git a/packages/contract/package.json b/packages/contract/package.json index 96d3a11..d249d0a 100644 --- a/packages/contract/package.json +++ b/packages/contract/package.json @@ -1,6 +1,6 @@ { "name": "@rivethub/contract", - "version": "0.0.0", + "version": "0.7.0", "private": true, "type": "module", "exports": { diff --git a/packages/plugin-sdk/package.json b/packages/plugin-sdk/package.json index b326a0f..652c154 100644 --- a/packages/plugin-sdk/package.json +++ b/packages/plugin-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@rivethub/plugin-sdk", - "version": "0.0.0", + "version": "0.7.0", "private": true, "type": "module", "exports": { @@ -10,6 +10,6 @@ "rivethub-plugin-dev": "./src/dev.ts" }, "dependencies": { - "@rivethub/contract": "0.0.0" + "@rivethub/contract": "0.7.0" } } diff --git a/rust/rivethub-plugin/Cargo.lock b/rust/rivethub-plugin/Cargo.lock index 3d9b8aa..033e01a 100644 --- a/rust/rivethub-plugin/Cargo.lock +++ b/rust/rivethub-plugin/Cargo.lock @@ -154,7 +154,7 @@ dependencies = [ [[package]] name = "rivethub-plugin" -version = "0.1.0" +version = "0.7.0" dependencies = [ "http-body-util", "hyper", diff --git a/rust/rivethub-plugin/Cargo.toml b/rust/rivethub-plugin/Cargo.toml index 1d1aecf..6132d6c 100644 --- a/rust/rivethub-plugin/Cargo.toml +++ b/rust/rivethub-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rivethub-plugin" -version = "0.1.0" +version = "0.7.0" edition = "2024" rust-version = "1.88" description = "Write RivetHub plug-ins in Rust: serve views, actions, canvases, tools, events and settings, and call rh" diff --git a/templates/rust/Cargo.lock b/templates/rust/Cargo.lock index 13c3eec..7cc4a9f 100644 --- a/templates/rust/Cargo.lock +++ b/templates/rust/Cargo.lock @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "rivethub-plugin" -version = "0.1.0" +version = "0.7.0" dependencies = [ "http-body-util", "hyper", diff --git a/templates/typescript/package.json b/templates/typescript/package.json index a36151b..f64b3ed 100644 --- a/templates/typescript/package.json +++ b/templates/typescript/package.json @@ -8,7 +8,7 @@ "dev": "npm run build && rivethub-plugin-dev ." }, "dependencies": { - "@rivethub/plugin-sdk": "0.0.0" + "@rivethub/plugin-sdk": "0.7.0" }, "devDependencies": { "esbuild": "0.28.2" From f0f8e7861cc598583649e0ca91d0faaae68e28f2 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 14:13:38 -0400 Subject: [PATCH 10/11] build: pin the contract to rh feat/plugin-tool-names --- contract.json | 2 +- packages/contract/schema/accepted.schema.json | 53 ++++++++++++++++++- packages/contract/schema/sent.schema.json | 53 ++++++++++++++++++- packages/contract/src/accepted.ts | 15 +++++- packages/contract/src/sent.ts | 15 +++++- rust/rivethub-plugin/src/contract.rs | 2 +- 6 files changed, 132 insertions(+), 8 deletions(-) diff --git a/contract.json b/contract.json index f2e53b9..55ed360 100644 --- a/contract.json +++ b/contract.json @@ -1,4 +1,4 @@ { "repository": "philbert440/rivethub-runtime", - "ref": "36aa33c98fb8ef9e6ec7113cc70807954edbd933" + "ref": "5d5cc2744c01cb9f991b65b74b9a859b1d35f517" } diff --git a/packages/contract/schema/accepted.schema.json b/packages/contract/schema/accepted.schema.json index 3adb94d..6ccc381 100644 --- a/packages/contract/schema/accepted.schema.json +++ b/packages/contract/schema/accepted.schema.json @@ -1,8 +1,8 @@ { - "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.1.0/accepted.schema.json", + "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.7.0/accepted.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "RivetHub contract (accepted by the runtime)", - "version": "0.1.0", + "version": "0.7.0", "$defs": { "AgentPreset": { "type": "object", @@ -9716,6 +9716,13 @@ } ] }, + "ContextUsageSource": { + "type": "string", + "enum": [ + "harness", + "last-call" + ] + }, "LiveSessionSummary": { "type": "object", "properties": { @@ -11999,6 +12006,14 @@ "type": "null" } ] + }, + "modelMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 } }, "required": [ @@ -12006,6 +12021,40 @@ "sessionId" ] }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "context" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "window": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "source": { + "$ref": "#/$defs/ContextUsageSource" + } + }, + "required": [ + "type", + "sessionId", + "used", + "source" + ] + }, { "type": "object", "properties": { diff --git a/packages/contract/schema/sent.schema.json b/packages/contract/schema/sent.schema.json index 823eb4f..d063648 100644 --- a/packages/contract/schema/sent.schema.json +++ b/packages/contract/schema/sent.schema.json @@ -1,8 +1,8 @@ { - "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.1.0/sent.schema.json", + "$id": "https://github.com/philbert440/rivethub-runtime/contract/0.7.0/sent.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "RivetHub contract (sent by the runtime)", - "version": "0.1.0", + "version": "0.7.0", "$defs": { "AgentPreset": { "type": "object", @@ -9763,6 +9763,13 @@ } ] }, + "ContextUsageSource": { + "type": "string", + "enum": [ + "harness", + "last-call" + ] + }, "LiveSessionSummary": { "type": "object", "properties": { @@ -12111,6 +12118,14 @@ "type": "null" } ] + }, + "modelMs": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 } }, "required": [ @@ -12118,6 +12133,40 @@ "sessionId" ] }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "context" + }, + "sessionId": { + "$ref": "#/$defs/SessionId" + }, + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "window": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0 + }, + "source": { + "$ref": "#/$defs/ContextUsageSource" + } + }, + "required": [ + "type", + "sessionId", + "used", + "source" + ] + }, { "type": "object", "properties": { diff --git a/packages/contract/src/accepted.ts b/packages/contract/src/accepted.ts index fd528e4..f2409a0 100644 --- a/packages/contract/src/accepted.ts +++ b/packages/contract/src/accepted.ts @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/accepted.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema @@ -713,6 +713,11 @@ export type AgentEventKind = type: "turn.end"; ts?: number | null; }; +/** + * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema + * via the `definition` "ContextUsageSource". + */ +export type ContextUsageSource = "harness" | "last-call"; /** * This interface was referenced by `RivetHubContractAcceptedByTheRuntime`'s JSON-Schema * via the `definition` "HookEventName". @@ -1136,6 +1141,14 @@ export type HarnessEvent = turnId?: string | null; stopReason?: string | null; usage?: LlmUsage | null; + modelMs?: number | null; + } + | { + type: "context"; + sessionId: SessionId; + used: number; + window?: number | null; + source: ContextUsageSource; } | { type: "error"; diff --git a/packages/contract/src/sent.ts b/packages/contract/src/sent.ts index cbadf7c..ddf9c74 100644 --- a/packages/contract/src/sent.ts +++ b/packages/contract/src/sent.ts @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/sent.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/sent.schema.json by npm run contract. Do not edit. /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema @@ -721,6 +721,11 @@ export type AgentEventKind = type: "turn.end"; ts?: number | null; }; +/** + * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema + * via the `definition` "ContextUsageSource". + */ +export type ContextUsageSource = "harness" | "last-call"; /** * This interface was referenced by `RivetHubContractSentByTheRuntime`'s JSON-Schema * via the `definition` "SessionBroadcast". @@ -1159,6 +1164,14 @@ export type HarnessEvent = turnId?: string | null; stopReason?: string | null; usage?: LlmUsage | null; + modelMs?: number | null; + } + | { + type: "context"; + sessionId: SessionId; + used: number; + window?: number | null; + source: ContextUsageSource; } | { type: "error"; diff --git a/rust/rivethub-plugin/src/contract.rs b/rust/rivethub-plugin/src/contract.rs index 2d0b797..0514a9c 100644 --- a/rust/rivethub-plugin/src/contract.rs +++ b/rust/rivethub-plugin/src/contract.rs @@ -1,4 +1,4 @@ -// Generated from philbert440/rivethub-runtime@36aa33c98fb8ef9e6ec7113cc70807954edbd933 contract/accepted.schema.json by npm run contract. Do not edit. +// Generated from philbert440/rivethub-runtime@5d5cc2744c01cb9f991b65b74b9a859b1d35f517 contract/accepted.schema.json by npm run contract. Do not edit. use std::collections::BTreeMap; From 13299173b8e06b5b8aafe8d72c08a3345014dce1 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 30 Oct 2026 14:13:38 -0400 Subject: [PATCH 11/11] docs(templates): name plug-in tools - with a single hyphen rh now offers a plug-in's tools to agents as - and the creator's as plugins-install, plugins-status and the rest, because Grok skips any tool whose name holds a double underscore. --- templates/javascript/GUIDE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/javascript/GUIDE.md b/templates/javascript/GUIDE.md index 6546543..b881403 100644 --- a/templates/javascript/GUIDE.md +++ b/templates/javascript/GUIDE.md @@ -7,10 +7,10 @@ canvas board, an `add_item` agent tool and a `session.placed` subscription). Rew ## The loop 1. Edit the files here: `rivethub-plugin.json` (the manifest), `plugin.js` (the program) and any modules you add. -2. Call `plugins__install` with this plug-in's id. It checks the manifest (an invalid one changes nothing and the answer +2. Call `plugins-install` with this plug-in's id. It checks the manifest (an invalid one changes nothing and the answer names the field), installs the folder or reloads it, waits for the process to start and asks each page for its view the way the apps do. Read the whole answer: it says whether the plug-in runs, why not, and what to do next. -3. Call `plugins__status` to read its state and its last log lines: your `console.log` and `console.error` output, a +3. Call `plugins-status` to read its state and its last log lines: your `console.log` and `console.error` output, a crash's stack trace, and rh's own lines, marked `host` (start, exit status, and every answer rh refused or that failed, with the field it refused). 4. Fix what the answer or the log names and go back to 2. Repeat until it runs and its pages answer valid views. @@ -36,7 +36,7 @@ When an answer says a person has to act, tell them exactly that. `manifest` 1; `id` (2 to 24 of `a-z`, `0-9` and single hyphens; it must stay the folder's name); `name`; `version`; `description`; `icon` (a Material Symbols name, as every icon here); `run.command` (`["node", "plugin.js"]`); `permissions`; `settings` (fields as in a form, drawn in Settings, read with `rh.self()` and the `settings` handler); -`tools` (`{name, title?, description, inputSchema, hints?}`, offered to agents as `__`; `name` uses `a-z`, +`tools` (`{name, title?, description, inputSchema, hints?}`, offered to agents as `-`; `name` uses `a-z`, `0-9` and single underscores); `contributes.pages` (`{id, title, icon?, view}`: a sidebar entry opening that view), `contributes.topicCards` (`{id, title, view}`: a card in a topic, its view gets `context.topicId`) and `contributes.sessionActions` (`{id, title, icon?, action}`: a session menu entry, `context.sessionId`); `jobs` (`{id,