The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): canonical RPCs are declared in the generated wire contract
Tekniuma03c71c31adf
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex 87954c3c4c8..05acaa31053 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -4425,6 +4425,261 @@ export interface OnboardingCatalogPlugin {app_state: CatalogAppStatesentence: string}+export interface PromptReceiptParams {+ session_id: string+ admission_id: string+ include_result?: boolean | null+}+/** ``result`` / ``usage``: the structured turn result committed at settlement, only with ``include_result`` on a terminal admission that saved one. */+export interface PromptReceiptResult {+ admission_id: string+ ref: CanonicalSessionRef+ sequence: number+ status: 'queued' | 'started' | 'unknown' | 'terminal'+ outcome: string | null+ authority_epoch: number+ execution_generation: number | null+ result?: unknown | null+ usage?: Record<string, unknown> | null+}+export interface CanonicalSessionRef {+ profile_id: string+ session_id: string+}+export interface PromptCancelParams {+ session_id: string+ admission_id: string+}+/** ``gateway/session_contract.py::AdmissionReceipt`` as ``dataclasses.asdict`` sends it. */+export interface AdmissionStatus {+ admission_id: string+ ref: CanonicalSessionRef+ sequence: number+ status: 'queued' | 'started' | 'unknown' | 'terminal'+ outcome: string | null+ authority_epoch: number+ execution_generation: number | null+}+export interface PromptResolveUnknownParams {+ session_id: string+ admission_id: string+ execution_generation: number+}+/** ``operation`` + ``payload`` are validated by ``hermes_state_mutations.validate_action``; ``expected_generation`` is required for delete/rewind/reset/branch/model/compress. */+export interface SessionMutateParams {+ session_id: string+ request_id: string+ expected_revision: number+ operation: string+ payload: Record<string, unknown>+ expected_generation?: number | null+}+/** The committed mutation receipt plus the operation's projection (``title``, ``archived``, ``branched_session_id``, compress ``status``/``lines``, …). ``revision`` is absent only on a read-only compress preview. */+export interface SessionMutateResult {+ session_id: string+ operation: string+ revision?: number | null+ [key: string]: unknown+}+export interface CanonicalSessionInfoParams {+ session_id: string+}+/** ``gateway/session_local.py::local_session_info``. */+export interface CanonicalSessionInfo {+ source: string+ model?: string | null+ lazy: boolean+ profile_id: string+ desktop_protocol: string+ profile_name: string+ cwd?: string | null+ launch_request?: Record<string, unknown> | null+ [key: string]: unknown+}+export interface SessionDetachParams {+ session_id: string+ subscription_id: string+}+export interface SessionDetachResult {+ session_id: string+ subscription_id: string+ detached: boolean+}+export type RuntimeDescribeParams = Record<string, never>+export interface RuntimeDescribeResult {+ instance_id: string+ profile_id: string+ authority_epoch: number+ capabilities: string[]+ session_create: SessionCreateDescriptor+}+export interface SessionCreateDescriptor {+ sources: string[]+ parameters: string[]+}+export interface ClarifyRespondParams {+ session_id: string+ execution_generation: number+ prompt_id: string+ answer: string+}+export interface PromptResponseResult {+ status: 'resolved' | 'already_resolved'+ prompt_id: string+}+export interface CronRunParams {+ job_id: string+ request_id: string+ extra_prompt: string | null+}+export interface CronSubmitResult {+ session_id: string+ admission_id: string+}+/** ``result`` is the ``run_job`` tuple once terminal; ``recover`` adds the frozen ``job`` and answers ``status='missing'`` for a firing that was never admitted. */+export interface CronStatusResult {+ status: string+ result: unknown[] | null+ job_flags?: Record<string, unknown> | null+ job?: Record<string, unknown> | null+ [key: string]: unknown+}+export interface CronAdmissionParams {+ session_id: string+ admission_id: string+}+export interface CronCancelResult {+ ok: boolean+}+export interface KanbanRunParams {+ board: string+ task_id: string+ run_id: number+ claim_lock: string+ db?: string | null+}+export interface KanbanRunResult {+ session_id: string+ receipt: AdmissionStatus+}+export interface A2aForwardParams {+ agent: string+ tenant: string+ peer: string+ context_id: string+ input_id: string+ text: string+}+export interface A2aForwardResult {+ admission_id: string+ ref: CanonicalSessionRef+ sequence: number+ status: 'queued' | 'started' | 'unknown' | 'terminal'+ outcome: string | null+ authority_epoch: number+ execution_generation: number | null+ session_id: string+ result: unknown | null+}+export interface WorkerRegisterParams {+ profile_id: string+ session_id: string+ execution_id: string+ generation: number+ pid: number+ birth: number+ secret: string+ kind: string+}+/** A ``worker_executions`` row without its adoption digest. */+export interface WorkerExecution {+ execution_id: string+ session_id: string+ kind: string+ owner_epoch: number+ generation: number+ status: string+ last_sequence: number+ [key: string]: unknown+}+/** The producer claim every worker verb proves (``gateway/session_worker.py::_SCOPE``). */+export interface WorkerScopeParams {+ profile_id: string+ session_id: string+ execution_id: string+ generation: number+ pid: number+ birth: number+ secret: string+}+export interface WorkerPersistParams {+ profile_id: string+ session_id: string+ execution_id: string+ generation: number+ pid: number+ birth: number+ secret: string+ epoch: number+ sequence: number+ operation: string+ payload: Record<string, unknown>+}+/** The operation's durable receipt (``message_id`` for an append, delegation results, …). */+export type WorkerPersistResult = Record<string, unknown>+export interface GroupsAttachmentUploadParams {+ profile?: string | null+ room_id: string+ upload_id: string+ kind: string+ name: string+ mime: string+ data_base64: string+}+export interface RoomAttachment {+ attachment_id: string+ kind: string+ name: string+ size: number+ mime: string+ sha256: string+ state: string+ created_at: number+ idempotent: boolean+ event_id?: string | null+ [key: string]: unknown+}+export interface GroupsAttachmentDownloadParams {+ profile?: string | null+ room_id: string+ event_id: string+ attachment_id: string+}+export interface RoomAttachmentBytes {+ attachment_id: string+ kind: string+ name: string+ size: number+ mime: string+ sha256: string+ state: string+ created_at: number+ idempotent: boolean+ event_id?: string | null+ data_base64: string+ [key: string]: unknown+}+export interface GroupsDiscardParams {+ profile?: string | null+ room_id: string+ member_id: string+ task_id: string+ execution_generation: number+}+export interface GroupsDiscardResult {+ discarded?: boolean+ task: RoomTaskReceipt+}/** ``answers`` rides only on a reconnect replay (locks the server already accepted; null = skipped). */export interface ClarifyRequestParams {session_id: string@@ -5773,6 +6028,73 @@ export const RPC_METHODS = ['wake.stop'] as const satisfies readonly RpcMethod[]+// ── Canonical (hermes-gateway-v1) methods only the session authority serves ──+export interface CanonicalRpcMethods {+ /** Forward one A2A input into the conversation its identity tuple names. */+ 'a2a.forward': { params: A2aForwardParams; result: A2aForwardResult }+ /** Generation-fenced answer to a pending clarify prompt (empty answer = skipped). */+ 'clarify.respond': { params: ClarifyRespondParams; result: PromptResponseResult }+ /** Cancel a queued cron admission or latch cancellation on a started one. */+ 'cron.cancel': { params: CronAdmissionParams; result: CronCancelResult }+ /** Re-observe a firing after a scheduler restart (same request identity). */+ 'cron.recover': { params: CronRunParams; result: CronStatusResult }+ /** Status and, once terminal, the result of one cron admission. */+ 'cron.status': { params: CronAdmissionParams; result: CronStatusResult }+ /** Admit one cron firing into the owning profile's durable FIFO. */+ 'cron.submit': { params: CronRunParams; result: CronSubmitResult }+ /** Read one committed attachment for a live room viewer. */+ 'groups.attachment.download': { params: GroupsAttachmentDownloadParams; result: RoomAttachmentBytes }+ /** Store one attachment for a later groups.send manifest (idempotent per upload_id). */+ 'groups.attachment.upload': { params: GroupsAttachmentUploadParams; result: RoomAttachment }+ /** Discard one indeterminate room task after explicit user confirmation. */+ 'groups.discard': { params: GroupsDiscardParams; result: GroupsDiscardResult }+ /** Native-owner only: admit the dispatcher's current claim on a kanban task. */+ 'kanban.run': { params: KanbanRunParams; result: KanbanRunResult }+ /** Retire a still-queued admission; a started one is unaffected. */+ 'prompt.cancel': { params: PromptCancelParams; result: AdmissionStatus }+ /** Current receipt of one admission the caller submitted (or controls). */+ 'prompt.receipt': { params: PromptReceiptParams; result: PromptReceiptResult }+ /** Acknowledge a turn lost across an owner restart; the FIFO behind it resumes. Never requeues the lost input. */+ 'prompt.resolve_unknown': { params: PromptResolveUnknownParams; result: AdmissionStatus }+ /** Owner identity and the canonical capabilities a client may rely on. */+ 'runtime.describe': { params: RuntimeDescribeParams; result: RuntimeDescribeResult }+ /** Drop this connection's subscription; a stale subscription id answers detached=false. */+ 'session.detach': { params: SessionDetachParams; result: SessionDetachResult }+ /** Frozen launch policy projection of one local session. */+ 'session.info': { params: CanonicalSessionInfoParams; result: CanonicalSessionInfo }+ /** Revision-fenced, retry-idempotent session edit (rename, archive, sidebar, branch, delete, rewind, reset, model, compress, import). */+ 'session.mutate': { params: SessionMutateParams; result: SessionMutateResult }+ /** Adopt a registered execution after verifying the live producer claim. */+ 'worker.adopt': { params: WorkerScopeParams; result: WorkerExecution }+ /** Sequence-fenced typed persistence write from an adopted worker. */+ 'worker.persist': { params: WorkerPersistParams; result: WorkerPersistResult }+ /** Register a compute worker execution on an idle session. */+ 'worker.register': { params: WorkerRegisterParams; result: WorkerExecution }+}+export type CanonicalRpcMethod = keyof CanonicalRpcMethods+export const CANONICAL_RPC_METHODS = [+ 'a2a.forward',+ 'clarify.respond',+ 'cron.cancel',+ 'cron.recover',+ 'cron.status',+ 'cron.submit',+ 'groups.attachment.download',+ 'groups.attachment.upload',+ 'groups.discard',+ 'kanban.run',+ 'prompt.cancel',+ 'prompt.receipt',+ 'prompt.resolve_unknown',+ 'runtime.describe',+ 'session.detach',+ 'session.info',+ 'session.mutate',+ 'worker.adopt',+ 'worker.persist',+ 'worker.register'+] as const satisfies readonly CanonicalRpcMethod[]+// ── Server→client requests ──export interface ServerRequestMap {/** A dangerous command awaits the user's decision. */diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex d05f227dd39..d77efc3848a 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -4635,6 +4635,123 @@],"components": {"schemas": {+ "A2aForwardParams": {+ "additionalProperties": false,+ "properties": {+ "agent": {+ "title": "Agent",+ "type": "string"+ },+ "tenant": {+ "title": "Tenant",+ "type": "string"+ },+ "peer": {+ "title": "Peer",+ "type": "string"+ },+ "context_id": {+ "title": "Context Id",+ "type": "string"+ },+ "input_id": {+ "title": "Input Id",+ "type": "string"+ },+ "text": {+ "title": "Text",+ "type": "string"+ }+ },+ "required": [+ "agent",+ "tenant",+ "peer",+ "context_id",+ "input_id",+ "text"+ ],+ "title": "A2aForwardParams",+ "type": "object"+ },+ "A2aForwardResult": {+ "additionalProperties": false,+ "properties": {+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ },+ "ref": {+ "$ref": "#/components/schemas/CanonicalSessionRef"+ },+ "sequence": {+ "title": "Sequence",+ "type": "integer"+ },+ "status": {+ "enum": [+ "queued",+ "started",+ "unknown",+ "terminal"+ ],+ "title": "Status",+ "type": "string"+ },+ "outcome": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Outcome"+ },+ "authority_epoch": {+ "title": "Authority Epoch",+ "type": "integer"+ },+ "execution_generation": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Execution Generation"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "result": {+ "anyOf": [+ {},+ {+ "type": "null"+ }+ ],+ "title": "Result"+ }+ },+ "required": [+ "admission_id",+ "ref",+ "sequence",+ "status",+ "outcome",+ "authority_epoch",+ "execution_generation",+ "session_id",+ "result"+ ],+ "title": "A2aForwardResult",+ "type": "object"+ },"AccountOwner": {"additionalProperties": false,"properties": {@@ -4792,6 +4909,70 @@"title": "ActiveSubagent","type": "object"},+ "AdmissionStatus": {+ "additionalProperties": false,+ "description": "``gateway/session_contract.py::AdmissionReceipt`` as ``dataclasses.asdict`` sends it.",+ "properties": {+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ },+ "ref": {+ "$ref": "#/components/schemas/CanonicalSessionRef"+ },+ "sequence": {+ "title": "Sequence",+ "type": "integer"+ },+ "status": {+ "enum": [+ "queued",+ "started",+ "unknown",+ "terminal"+ ],+ "title": "Status",+ "type": "string"+ },+ "outcome": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Outcome"+ },+ "authority_epoch": {+ "title": "Authority Epoch",+ "type": "integer"+ },+ "execution_generation": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Execution Generation"+ }+ },+ "required": [+ "admission_id",+ "ref",+ "sequence",+ "status",+ "outcome",+ "authority_epoch",+ "execution_generation"+ ],+ "title": "AdmissionStatus",+ "type": "object"+ },"AgentPluginRow": {"additionalProperties": false,"description": "``methods_tools._plugin_rows`` + ``plugins_cmd_catalog.catalog_row_fields`` provenance.",@@ -7619,6 +7800,111 @@"title": "BrowserProgressPayload","type": "object"},+ "CanonicalSessionInfo": {+ "additionalProperties": true,+ "description": "``gateway/session_local.py::local_session_info``.",+ "properties": {+ "source": {+ "title": "Source",+ "type": "string"+ },+ "model": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Model"+ },+ "lazy": {+ "title": "Lazy",+ "type": "boolean"+ },+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "desktop_protocol": {+ "title": "Desktop Protocol",+ "type": "string"+ },+ "profile_name": {+ "title": "Profile Name",+ "type": "string"+ },+ "cwd": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Cwd"+ },+ "launch_request": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Launch Request"+ }+ },+ "required": [+ "source",+ "lazy",+ "profile_id",+ "desktop_protocol",+ "profile_name"+ ],+ "title": "CanonicalSessionInfo",+ "type": "object"+ },+ "CanonicalSessionInfoParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ }+ },+ "required": [+ "session_id"+ ],+ "title": "CanonicalSessionInfoParams",+ "type": "object"+ },+ "CanonicalSessionRef": {+ "additionalProperties": false,+ "properties": {+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ }+ },+ "required": [+ "profile_id",+ "session_id"+ ],+ "title": "CanonicalSessionRef",+ "type": "object"+ },"CapabilityEntry": {"additionalProperties": false,"properties": {@@ -7900,6 +8186,35 @@"title": "ClarifyRequestParams","type": "object"},+ "ClarifyRespondParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "execution_generation": {+ "title": "Execution Generation",+ "type": "integer"+ },+ "prompt_id": {+ "title": "Prompt Id",+ "type": "string"+ },+ "answer": {+ "title": "Answer",+ "type": "string"+ }+ },+ "required": [+ "session_id",+ "execution_generation",+ "prompt_id",+ "answer"+ ],+ "title": "ClarifyRespondParams",+ "type": "object"+ },"ClarifyResult": {"additionalProperties": false,"description": "``{answers}`` for the whole set (early locks go through the ``clarify.lock`` RPC); a response\nwithout ``answers`` is cancel-all.",@@ -11480,6 +11795,39 @@"title": "CronAction","type": "string"},+ "CronAdmissionParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ }+ },+ "required": [+ "session_id",+ "admission_id"+ ],+ "title": "CronAdmissionParams",+ "type": "object"+ },+ "CronCancelResult": {+ "additionalProperties": false,+ "properties": {+ "ok": {+ "title": "Ok",+ "type": "boolean"+ }+ },+ "required": [+ "ok"+ ],+ "title": "CronCancelResult",+ "type": "object"+ },"CronJobRow": {"additionalProperties": true,"description": "``tools/cronjob_job_args.py::_format_job``.",@@ -12244,6 +12592,110 @@"title": "CronRemovedJob","type": "object"},+ "CronRunParams": {+ "additionalProperties": false,+ "properties": {+ "job_id": {+ "title": "Job Id",+ "type": "string"+ },+ "request_id": {+ "title": "Request Id",+ "type": "string"+ },+ "extra_prompt": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Extra Prompt"+ }+ },+ "required": [+ "job_id",+ "request_id",+ "extra_prompt"+ ],+ "title": "CronRunParams",+ "type": "object"+ },+ "CronStatusResult": {+ "additionalProperties": true,+ "description": "``result`` is the ``run_job`` tuple once terminal; ``recover`` adds the frozen ``job`` and\nanswers ``status='missing'`` for a firing that was never admitted.",+ "properties": {+ "status": {+ "title": "Status",+ "type": "string"+ },+ "result": {+ "anyOf": [+ {+ "items": {},+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "title": "Result"+ },+ "job_flags": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Job Flags"+ },+ "job": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Job"+ }+ },+ "required": [+ "status",+ "result"+ ],+ "title": "CronStatusResult",+ "type": "object"+ },+ "CronSubmitResult": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ }+ },+ "required": [+ "session_id",+ "admission_id"+ ],+ "title": "CronSubmitResult",+ "type": "object"+ },"CurrentSubscription": {"additionalProperties": false,"properties": {@@ -14813,6 +15265,93 @@"title": "GroupsApproveResult","type": "object"},+ "GroupsAttachmentDownloadParams": {+ "additionalProperties": false,+ "properties": {+ "profile": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Profile"+ },+ "room_id": {+ "title": "Room Id",+ "type": "string"+ },+ "event_id": {+ "title": "Event Id",+ "type": "string"+ },+ "attachment_id": {+ "title": "Attachment Id",+ "type": "string"+ }+ },+ "required": [+ "room_id",+ "event_id",+ "attachment_id"+ ],+ "title": "GroupsAttachmentDownloadParams",+ "type": "object"+ },+ "GroupsAttachmentUploadParams": {+ "additionalProperties": false,+ "properties": {+ "profile": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Profile"+ },+ "room_id": {+ "title": "Room Id",+ "type": "string"+ },+ "upload_id": {+ "title": "Upload Id",+ "type": "string"+ },+ "kind": {+ "title": "Kind",+ "type": "string"+ },+ "name": {+ "title": "Name",+ "type": "string"+ },+ "mime": {+ "title": "Mime",+ "type": "string"+ },+ "data_base64": {+ "title": "Data Base64",+ "type": "string"+ }+ },+ "required": [+ "room_id",+ "upload_id",+ "kind",+ "name",+ "mime",+ "data_base64"+ ],+ "title": "GroupsAttachmentUploadParams",+ "type": "object"+ },"GroupsCapabilitiesParams": {"additionalProperties": false,"properties": {@@ -15066,6 +15605,65 @@"title": "GroupsDisbandResult","type": "object"},+ "GroupsDiscardParams": {+ "additionalProperties": false,+ "properties": {+ "profile": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Profile"+ },+ "room_id": {+ "title": "Room Id",+ "type": "string"+ },+ "member_id": {+ "title": "Member Id",+ "type": "string"+ },+ "task_id": {+ "title": "Task Id",+ "type": "string"+ },+ "execution_generation": {+ "title": "Execution Generation",+ "type": "integer"+ }+ },+ "required": [+ "room_id",+ "member_id",+ "task_id",+ "execution_generation"+ ],+ "title": "GroupsDiscardParams",+ "type": "object"+ },+ "GroupsDiscardResult": {+ "additionalProperties": false,+ "properties": {+ "discarded": {+ "default": true,+ "title": "Discarded",+ "type": "boolean"+ },+ "task": {+ "$ref": "#/components/schemas/RoomTaskReceipt"+ }+ },+ "required": [+ "task"+ ],+ "title": "GroupsDiscardResult",+ "type": "object"+ },"GroupsListParams": {"additionalProperties": false,"properties": {@@ -16949,6 +17547,65 @@"title": "InterruptStatus","type": "string"},+ "KanbanRunParams": {+ "additionalProperties": false,+ "properties": {+ "board": {+ "title": "Board",+ "type": "string"+ },+ "task_id": {+ "title": "Task Id",+ "type": "string"+ },+ "run_id": {+ "title": "Run Id",+ "type": "integer"+ },+ "claim_lock": {+ "title": "Claim Lock",+ "type": "string"+ },+ "db": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Db"+ }+ },+ "required": [+ "board",+ "task_id",+ "run_id",+ "claim_lock"+ ],+ "title": "KanbanRunParams",+ "type": "object"+ },+ "KanbanRunResult": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "receipt": {+ "$ref": "#/components/schemas/AdmissionStatus"+ }+ },+ "required": [+ "session_id",+ "receipt"+ ],+ "title": "KanbanRunResult",+ "type": "object"+ },"LanguageOption": {"additionalProperties": false,"description": "``agent.i18n_languages.language_options`` row. ``source`` is ``bundled``, ``overlay`` or\n``plugin:<name>`` \u2014 the highest layer that supplies the language.",@@ -26541,6 +27198,190 @@"title": "ProjectsUpdateParams","type": "object"},+ "PromptCancelParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ }+ },+ "required": [+ "session_id",+ "admission_id"+ ],+ "title": "PromptCancelParams",+ "type": "object"+ },+ "PromptReceiptParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ },+ "include_result": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Include Result"+ }+ },+ "required": [+ "session_id",+ "admission_id"+ ],+ "title": "PromptReceiptParams",+ "type": "object"+ },+ "PromptReceiptResult": {+ "additionalProperties": false,+ "description": "``result`` / ``usage``: the structured turn result committed at settlement, only with\n``include_result`` on a terminal admission that saved one.",+ "properties": {+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ },+ "ref": {+ "$ref": "#/components/schemas/CanonicalSessionRef"+ },+ "sequence": {+ "title": "Sequence",+ "type": "integer"+ },+ "status": {+ "enum": [+ "queued",+ "started",+ "unknown",+ "terminal"+ ],+ "title": "Status",+ "type": "string"+ },+ "outcome": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "title": "Outcome"+ },+ "authority_epoch": {+ "title": "Authority Epoch",+ "type": "integer"+ },+ "execution_generation": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "title": "Execution Generation"+ },+ "result": {+ "anyOf": [+ {},+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Result"+ },+ "usage": {+ "anyOf": [+ {+ "additionalProperties": true,+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Usage"+ }+ },+ "required": [+ "admission_id",+ "ref",+ "sequence",+ "status",+ "outcome",+ "authority_epoch",+ "execution_generation"+ ],+ "title": "PromptReceiptResult",+ "type": "object"+ },+ "PromptResolveUnknownParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "admission_id": {+ "title": "Admission Id",+ "type": "string"+ },+ "execution_generation": {+ "title": "Execution Generation",+ "type": "integer"+ }+ },+ "required": [+ "session_id",+ "admission_id",+ "execution_generation"+ ],+ "title": "PromptResolveUnknownParams",+ "type": "object"+ },+ "PromptResponseResult": {+ "additionalProperties": false,+ "properties": {+ "status": {+ "enum": [+ "resolved",+ "already_resolved"+ ],+ "title": "Status",+ "type": "string"+ },+ "prompt_id": {+ "title": "Prompt Id",+ "type": "string"+ }+ },+ "required": [+ "status",+ "prompt_id"+ ],+ "title": "PromptResponseResult",+ "type": "object"+ },"PromptSubmitParams": {"additionalProperties": false,"description": "``text`` is normally a string; the relay / hosted paths may hand a structured (parts list)\npayload, and the busy path renders it. Truncation (rewind / edit / regenerate) needs explicit\nconsent: ``confirm_truncate`` plus one durable target (``truncate_before_row_id`` preferred,\n``truncate_before_message_id``, or the legacy ``truncate_before_user_ordinal``).",@@ -28089,6 +28930,143 @@"title": "RoomActor","type": "object"},+ "RoomAttachment": {+ "additionalProperties": true,+ "properties": {+ "attachment_id": {+ "title": "Attachment Id",+ "type": "string"+ },+ "kind": {+ "title": "Kind",+ "type": "string"+ },+ "name": {+ "title": "Name",+ "type": "string"+ },+ "size": {+ "title": "Size",+ "type": "integer"+ },+ "mime": {+ "title": "Mime",+ "type": "string"+ },+ "sha256": {+ "title": "Sha256",+ "type": "string"+ },+ "state": {+ "title": "State",+ "type": "string"+ },+ "created_at": {+ "title": "Created At",+ "type": "number"+ },+ "idempotent": {+ "title": "Idempotent",+ "type": "boolean"+ },+ "event_id": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Event Id"+ }+ },+ "required": [+ "attachment_id",+ "kind",+ "name",+ "size",+ "mime",+ "sha256",+ "state",+ "created_at",+ "idempotent"+ ],+ "title": "RoomAttachment",+ "type": "object"+ },+ "RoomAttachmentBytes": {+ "additionalProperties": true,+ "properties": {+ "attachment_id": {+ "title": "Attachment Id",+ "type": "string"+ },+ "kind": {+ "title": "Kind",+ "type": "string"+ },+ "name": {+ "title": "Name",+ "type": "string"+ },+ "size": {+ "title": "Size",+ "type": "integer"+ },+ "mime": {+ "title": "Mime",+ "type": "string"+ },+ "sha256": {+ "title": "Sha256",+ "type": "string"+ },+ "state": {+ "title": "State",+ "type": "string"+ },+ "created_at": {+ "title": "Created At",+ "type": "number"+ },+ "idempotent": {+ "title": "Idempotent",+ "type": "boolean"+ },+ "event_id": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Event Id"+ },+ "data_base64": {+ "title": "Data Base64",+ "type": "string"+ }+ },+ "required": [+ "attachment_id",+ "kind",+ "name",+ "size",+ "mime",+ "sha256",+ "state",+ "created_at",+ "idempotent",+ "data_base64"+ ],+ "title": "RoomAttachmentBytes",+ "type": "object"+ },"RoomAuthority": {"additionalProperties": false,"properties": {@@ -28670,6 +29648,48 @@"title": "RoomTombstone","type": "object"},+ "RuntimeDescribeParams": {+ "additionalProperties": false,+ "properties": {},+ "title": "RuntimeDescribeParams",+ "type": "object"+ },+ "RuntimeDescribeResult": {+ "additionalProperties": false,+ "properties": {+ "instance_id": {+ "title": "Instance Id",+ "type": "string"+ },+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "authority_epoch": {+ "title": "Authority Epoch",+ "type": "integer"+ },+ "capabilities": {+ "items": {+ "type": "string"+ },+ "title": "Capabilities",+ "type": "array"+ },+ "session_create": {+ "$ref": "#/components/schemas/SessionCreateDescriptor"+ }+ },+ "required": [+ "instance_id",+ "profile_id",+ "authority_epoch",+ "capabilities",+ "session_create"+ ],+ "title": "RuntimeDescribeResult",+ "type": "object"+ },"SecretRequestParams": {"additionalProperties": false,"properties": {@@ -30175,6 +31195,31 @@"title": "SessionCorrectionResult","type": "object"},+ "SessionCreateDescriptor": {+ "additionalProperties": false,+ "properties": {+ "sources": {+ "items": {+ "type": "string"+ },+ "title": "Sources",+ "type": "array"+ },+ "parameters": {+ "items": {+ "type": "string"+ },+ "title": "Parameters",+ "type": "array"+ }+ },+ "required": [+ "sources",+ "parameters"+ ],+ "title": "SessionCreateDescriptor",+ "type": "object"+ },"SessionCreateParams": {"additionalProperties": false,"properties": {@@ -30720,6 +31765,49 @@"title": "SessionDeleteResult","type": "object"},+ "SessionDetachParams": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "subscription_id": {+ "title": "Subscription Id",+ "type": "string"+ }+ },+ "required": [+ "session_id",+ "subscription_id"+ ],+ "title": "SessionDetachParams",+ "type": "object"+ },+ "SessionDetachResult": {+ "additionalProperties": false,+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "subscription_id": {+ "title": "Subscription Id",+ "type": "string"+ },+ "detached": {+ "title": "Detached",+ "type": "boolean"+ }+ },+ "required": [+ "session_id",+ "subscription_id",+ "detached"+ ],+ "title": "SessionDetachResult",+ "type": "object"+ },"SessionEventsSinceParams": {"additionalProperties": false,"properties": {@@ -31634,6 +32722,86 @@"title": "SessionMostRecentResult","type": "object"},+ "SessionMutateParams": {+ "additionalProperties": false,+ "description": "``operation`` + ``payload`` are validated by ``hermes_state_mutations.validate_action``;\n``expected_generation`` is required for delete/rewind/reset/branch/model/compress.",+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "request_id": {+ "title": "Request Id",+ "type": "string"+ },+ "expected_revision": {+ "title": "Expected Revision",+ "type": "integer"+ },+ "operation": {+ "title": "Operation",+ "type": "string"+ },+ "payload": {+ "additionalProperties": true,+ "title": "Payload",+ "type": "object"+ },+ "expected_generation": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Expected Generation"+ }+ },+ "required": [+ "session_id",+ "request_id",+ "expected_revision",+ "operation",+ "payload"+ ],+ "title": "SessionMutateParams",+ "type": "object"+ },+ "SessionMutateResult": {+ "additionalProperties": true,+ "description": "The committed mutation receipt plus the operation's projection (``title``, ``archived``,\n``branched_session_id``, compress ``status``/``lines``, \u2026). ``revision`` is absent only on a\nread-only compress preview.",+ "properties": {+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "operation": {+ "title": "Operation",+ "type": "string"+ },+ "revision": {+ "anyOf": [+ {+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Revision"+ }+ },+ "required": [+ "session_id",+ "operation"+ ],+ "title": "SessionMutateResult",+ "type": "object"+ },"SessionOwner": {"additionalProperties": false,"properties": {@@ -40006,6 +41174,217 @@"title": "WakeStopResult","type": "object"},+ "WorkerExecution": {+ "additionalProperties": true,+ "description": "A ``worker_executions`` row without its adoption digest.",+ "properties": {+ "execution_id": {+ "title": "Execution Id",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "kind": {+ "title": "Kind",+ "type": "string"+ },+ "owner_epoch": {+ "title": "Owner Epoch",+ "type": "integer"+ },+ "generation": {+ "title": "Generation",+ "type": "integer"+ },+ "status": {+ "title": "Status",+ "type": "string"+ },+ "last_sequence": {+ "title": "Last Sequence",+ "type": "integer"+ }+ },+ "required": [+ "execution_id",+ "session_id",+ "kind",+ "owner_epoch",+ "generation",+ "status",+ "last_sequence"+ ],+ "title": "WorkerExecution",+ "type": "object"+ },+ "WorkerPersistParams": {+ "additionalProperties": false,+ "properties": {+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "execution_id": {+ "title": "Execution Id",+ "type": "string"+ },+ "generation": {+ "title": "Generation",+ "type": "integer"+ },+ "pid": {+ "title": "Pid",+ "type": "integer"+ },+ "birth": {+ "title": "Birth",+ "type": "number"+ },+ "secret": {+ "title": "Secret",+ "type": "string"+ },+ "epoch": {+ "title": "Epoch",+ "type": "integer"+ },+ "sequence": {+ "title": "Sequence",+ "type": "integer"+ },+ "operation": {+ "title": "Operation",+ "type": "string"+ },+ "payload": {+ "additionalProperties": true,+ "title": "Payload",+ "type": "object"+ }+ },+ "required": [+ "profile_id",+ "session_id",+ "execution_id",+ "generation",+ "pid",+ "birth",+ "secret",+ "epoch",+ "sequence",+ "operation",+ "payload"+ ],+ "title": "WorkerPersistParams",+ "type": "object"+ },+ "WorkerPersistResult": {+ "additionalProperties": true,+ "description": "The operation's durable receipt (``message_id`` for an append, delegation results, \u2026).",+ "properties": {},+ "title": "WorkerPersistResult",+ "type": "object"+ },+ "WorkerRegisterParams": {+ "additionalProperties": false,+ "properties": {+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "execution_id": {+ "title": "Execution Id",+ "type": "string"+ },+ "generation": {+ "title": "Generation",+ "type": "integer"+ },+ "pid": {+ "title": "Pid",+ "type": "integer"+ },+ "birth": {+ "title": "Birth",+ "type": "number"+ },+ "secret": {+ "title": "Secret",+ "type": "string"+ },+ "kind": {+ "title": "Kind",+ "type": "string"+ }+ },+ "required": [+ "profile_id",+ "session_id",+ "execution_id",+ "generation",+ "pid",+ "birth",+ "secret",+ "kind"+ ],+ "title": "WorkerRegisterParams",+ "type": "object"+ },+ "WorkerScopeParams": {+ "additionalProperties": false,+ "description": "The producer claim every worker verb proves (``gateway/session_worker.py::_SCOPE``).",+ "properties": {+ "profile_id": {+ "title": "Profile Id",+ "type": "string"+ },+ "session_id": {+ "title": "Session Id",+ "type": "string"+ },+ "execution_id": {+ "title": "Execution Id",+ "type": "string"+ },+ "generation": {+ "title": "Generation",+ "type": "integer"+ },+ "pid": {+ "title": "Pid",+ "type": "integer"+ },+ "birth": {+ "title": "Birth",+ "type": "number"+ },+ "secret": {+ "title": "Secret",+ "type": "string"+ }+ },+ "required": [+ "profile_id",+ "session_id",+ "execution_id",+ "generation",+ "pid",+ "birth",+ "secret"+ ],+ "title": "WorkerScopeParams",+ "type": "object"+ },"_SessionScoped": {"additionalProperties": false,"description": "Handlers that look a live session up with ``_sessions.get(params.get(\"session_id\"))``: an\nabsent / unknown id falls back to the launch profile's config, so it is never required.",@@ -40056,6 +41435,368 @@}}},+ "x-canonical-methods": [+ {+ "name": "a2a.forward",+ "summary": "Forward one A2A input into the conversation its identity tuple names.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/A2aForwardParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/A2aForwardResult"+ }+ }+ },+ {+ "name": "clarify.respond",+ "summary": "Generation-fenced answer to a pending clarify prompt (empty answer = skipped).",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/ClarifyRespondParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/PromptResponseResult"+ }+ }+ },+ {+ "name": "cron.cancel",+ "summary": "Cancel a queued cron admission or latch cancellation on a started one.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/CronAdmissionParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/CronCancelResult"+ }+ }+ },+ {+ "name": "cron.recover",+ "summary": "Re-observe a firing after a scheduler restart (same request identity).",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/CronRunParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/CronStatusResult"+ }+ }+ },+ {+ "name": "cron.status",+ "summary": "Status and, once terminal, the result of one cron admission.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/CronAdmissionParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/CronStatusResult"+ }+ }+ },+ {+ "name": "cron.submit",+ "summary": "Admit one cron firing into the owning profile's durable FIFO.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/CronRunParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/CronSubmitResult"+ }+ }+ },+ {+ "name": "groups.attachment.download",+ "summary": "Read one committed attachment for a live room viewer.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/GroupsAttachmentDownloadParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/RoomAttachmentBytes"+ }+ }+ },+ {+ "name": "groups.attachment.upload",+ "summary": "Store one attachment for a later groups.send manifest (idempotent per upload_id).",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/GroupsAttachmentUploadParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/RoomAttachment"+ }+ }+ },+ {+ "name": "groups.discard",+ "summary": "Discard one indeterminate room task after explicit user confirmation.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/GroupsDiscardParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/GroupsDiscardResult"+ }+ }+ },+ {+ "name": "kanban.run",+ "summary": "Native-owner only: admit the dispatcher's current claim on a kanban task.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/KanbanRunParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/KanbanRunResult"+ }+ }+ },+ {+ "name": "prompt.cancel",+ "summary": "Retire a still-queued admission; a started one is unaffected.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/PromptCancelParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/AdmissionStatus"+ }+ }+ },+ {+ "name": "prompt.receipt",+ "summary": "Current receipt of one admission the caller submitted (or controls).",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/PromptReceiptParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/PromptReceiptResult"+ }+ }+ },+ {+ "name": "prompt.resolve_unknown",+ "summary": "Acknowledge a turn lost across an owner restart; the FIFO behind it resumes. Never requeues the lost input.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/PromptResolveUnknownParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/AdmissionStatus"+ }+ }+ },+ {+ "name": "runtime.describe",+ "summary": "Owner identity and the canonical capabilities a client may rely on.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/RuntimeDescribeParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/RuntimeDescribeResult"+ }+ }+ },+ {+ "name": "session.detach",+ "summary": "Drop this connection's subscription; a stale subscription id answers detached=false.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/SessionDetachParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/SessionDetachResult"+ }+ }+ },+ {+ "name": "session.info",+ "summary": "Frozen launch policy projection of one local session.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/CanonicalSessionInfoParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/CanonicalSessionInfo"+ }+ }+ },+ {+ "name": "session.mutate",+ "summary": "Revision-fenced, retry-idempotent session edit (rename, archive, sidebar, branch, delete, rewind, reset, model, compress, import).",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/SessionMutateParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/SessionMutateResult"+ }+ }+ },+ {+ "name": "worker.adopt",+ "summary": "Adopt a registered execution after verifying the live producer claim.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/WorkerScopeParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/WorkerExecution"+ }+ }+ },+ {+ "name": "worker.persist",+ "summary": "Sequence-fenced typed persistence write from an adopted worker.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/WorkerPersistParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/WorkerPersistResult"+ }+ }+ },+ {+ "name": "worker.register",+ "summary": "Register a compute worker execution on an idle session.",+ "params": [+ {+ "name": "params",+ "schema": {+ "$ref": "#/components/schemas/WorkerRegisterParams"+ }+ }+ ],+ "result": {+ "name": "result",+ "schema": {+ "$ref": "#/components/schemas/WorkerExecution"+ }+ }+ }+ ],"x-server-requests": [{"name": "approval",diff --git a/gateway/session_controls.py b/gateway/session_controls.pyindex e3b5e903af8..aaf2ee09aa6 100644--- a/gateway/session_controls.py+++ b/gateway/session_controls.py@@ -62,28 +62,9 @@ class AuthorityConnection:return connectionraise RuntimeStoreError('profile_mismatch')- async def dispatch(self, request):- rid = request.get('id')- method = request.get('method')- params = request.get('params') or {}- if not isinstance(params, dict):- # Every handler indexes params as a mapping; refuse the frame before ``.get``.- return {'jsonrpc': '2.0', 'id': rid, 'error': {- 'code': 4001, 'message': 'invalid_params', 'data': {'reason': 'invalid_params'}}}- profile = params.get('profile')- if isinstance(profile, str) and profile:- try:- routed = self._sibling_for(profile)- except RuntimeStoreError as exc:- return {'jsonrpc': '2.0', 'id': rid, 'error': {- 'code': 4001, 'message': exc.reason, 'data': {'reason': exc.reason}}}- if routed is not None:- return await routed.dispatch(request)- # Our own home: the scope is implicit for the strict session verbs, which refuse- # unknown keys; every other handler validates ``profile`` itself.- if method in _PROFILE_IMPLICIT:- params = {key: value for key, value in params.items() if key != 'profile'}- ref = SessionRef(self.actor.profile_id, params.get('session_id', ''))+ def handlers(self):+ """Method → handler for every verb ``dispatch`` serves outside the group controls; each+ name is declared in ``tui_gateway/contracts`` (``METHODS`` or ``CANONICAL_METHODS``)."""handlers = {'session.create': self.create, 'ping': self.ping, 'runtime.describe': self.describe,'commands.catalog': self.command_catalog, 'complete.slash': self.slash_completions,'slash.exec': self.slash_exec, 'command.dispatch': self.command_dispatch,@@ -112,6 +93,38 @@ class AuthorityConnection:from gateway.session_images import attach_bytesfrom functools import partialhandlers['image.attach_bytes'] = partial(attach_bytes, self)+ return handlers++ async def dispatch(self, request):+ rid = request.get('id')+ method = request.get('method')+ params = request.get('params') or {}+ if not isinstance(params, dict):+ # Every handler indexes params as a mapping; refuse the frame before ``.get``.+ return {'jsonrpc': '2.0', 'id': rid, 'error': {+ 'code': 4001, 'message': 'invalid_params', 'data': {'reason': 'invalid_params'}}}+ profile = params.get('profile')+ if isinstance(profile, str) and profile:+ try:+ routed = self._sibling_for(profile)+ except RuntimeStoreError as exc:+ return {'jsonrpc': '2.0', 'id': rid, 'error': {+ 'code': 4001, 'message': exc.reason, 'data': {'reason': exc.reason}}}+ if routed is not None:+ return await routed.dispatch(request)+ # Our own home: the scope is implicit for the strict session verbs, which refuse+ # unknown keys; every other handler validates ``profile`` itself.+ if method in _PROFILE_IMPLICIT:+ params = {key: value for key, value in params.items() if key != 'profile'}+ ref = SessionRef(self.actor.profile_id, params.get('session_id', ''))+ from tui_gateway.contracts.registry import CANONICAL_METHODS, canonical_param_problems+ contract = CANONICAL_METHODS.get(method)+ if contract is not None and (problems := canonical_param_problems(contract, params)):+ # The declared wire contract (``tui_gateway/contracts/canonical.py``) is the closed+ # key set: an unknown or missing key never reaches the handler.+ return {'jsonrpc': '2.0', 'id': rid, 'error': {+ 'code': 4001, 'message': 'invalid_params', 'data': {'reason': 'invalid_params', 'fields': problems}}}+ handlers = self.handlers()try:from gateway.session_group_controls import GROUP_METHODS, dispatch_group_control# Every handler reads config/jobs/policy for the OWNING profile: enter its home sodiff --git a/scripts/gen_gateway_contracts.py b/scripts/gen_gateway_contracts.pyindex 61fecf93868..8e32d496212 100755--- a/scripts/gen_gateway_contracts.py+++ b/scripts/gen_gateway_contracts.py@@ -34,7 +34,7 @@ from tui_gateway.contracts.connectors import ( # noqa: E402ConnectorToolsSource,)from tui_gateway.contracts.connectors_operation import ConnectionSettleReason, ConnectionTargetState # noqa: E402-from tui_gateway.contracts.registry import EVENTS, METHODS, SERVER_REQUESTS # noqa: E402+from tui_gateway.contracts.registry import CANONICAL_METHODS, EVENTS, METHODS, SERVER_REQUESTS # noqa: E402from tools.connectors.contract import SettleReason, TargetState # noqa: E402from tools.connectors.gateway.wire import ConnectionStatus # noqa: E402from tools.connectors.portal.tools_cache import ToolsRead # noqa: E402@@ -211,7 +211,7 @@ def _check_enum_parity() -> None:def render_ts() -> str:_check_enum_parity()models: list[type] = []- for m in METHODS.values():+ for m in (*METHODS.values(), *CANONICAL_METHODS.values()):models += [m.params, m.result]for r in SERVER_REQUESTS.values():models += [r.params, r.result]@@ -246,6 +246,16 @@ def render_ts() -> str:out.append("export type RpcMethod = keyof RpcMethods\n")out.append("export const RPC_METHODS = [\n" + _const_items(sorted(METHODS)) + "] as const satisfies readonly RpcMethod[]\n")+ out.append("\n// ── Canonical (hermes-gateway-v1) methods only the session authority serves ──\n")+ out.append("export interface CanonicalRpcMethods {\n")+ for m in sorted(CANONICAL_METHODS.values(), key=lambda x: x.name):+ out.append(_doc(m.doc, " "))+ out.append(f" {_prop(m.name)}: {{ params: {name_of[m.params]}; result: {name_of[m.result]} }}\n")+ out.append("}\n")+ out.append("export type CanonicalRpcMethod = keyof CanonicalRpcMethods\n")+ out.append("export const CANONICAL_RPC_METHODS = [\n" + _const_items(sorted(CANONICAL_METHODS))+ + "] as const satisfies readonly CanonicalRpcMethod[]\n")+out.append("\n// ── Server→client requests ──\n")out.append("export interface ServerRequestMap {\n")for s in sorted(SERVER_REQUESTS.values(), key=lambda x: x.name):@@ -287,7 +297,7 @@ def render_openrpc() -> str:_check_enum_parity()components: dict[str, dict] = {}all_models: list[type] = []- for m in METHODS.values():+ for m in (*METHODS.values(), *CANONICAL_METHODS.values()):all_models += [m.params, m.result]for r in SERVER_REQUESTS.values():all_models += [r.params, r.result]@@ -323,6 +333,12 @@ def render_openrpc() -> str:for m in sorted(METHODS.values(), key=lambda x: x.name)],"components": {"schemas": components},+ "x-canonical-methods": [+ {"name": m.name, "summary": " ".join(m.doc.split()),+ "params": [{"name": "params", "schema": ref(m.params)}],+ "result": {"name": "result", "schema": ref(m.result)}}+ for m in sorted(CANONICAL_METHODS.values(), key=lambda x: x.name)+ ],"x-server-requests": [{"name": s.name, "summary": " ".join(s.doc.split()),"params": [{"name": "params", "schema": ref(s.params)}],diff --git a/tests/gateway/test_canonical_wire_contract.py b/tests/gateway/test_canonical_wire_contract.pynew file mode 100644index 00000000000..3b1d6900b5a--- /dev/null+++ b/tests/gateway/test_canonical_wire_contract.py@@ -0,0 +1,56 @@+"""The canonical dispatcher speaks only the declared wire contract (``tui_gateway/contracts``)."""+from types import SimpleNamespace++import pytest++from gateway.session_authority import LiveSession, SessionAuthority+from gateway.session_controls import AuthorityConnection+from gateway.session_group_controls import GROUP_METHODS+from hermes_state import SessionDB+from hermes_state_runtime import begin_runtime_epoch+from tui_gateway.contracts.registry import CANONICAL_METHODS, METHODS+++def owner(tmp_path):+ with SessionDB(db_path=tmp_path / 'state.db') as db:+ db.create_session('s', source='test')+ epoch = begin_runtime_epoch(db, instance_id='current')+ authority = SessionAuthority(SimpleNamespace(_draining=False), profile_id='owned',+ instance_id='current', db=db, epoch=epoch)+ authority.sessions['s'] = LiveSession(None, 'route')+ yield AuthorityConnection(authority, object(), {'user_id': 'owner'}), db+++def test_every_canonical_verb_has_a_declared_contract(owner):+ """Each name the authority answers is a ``METHODS`` (shared with the sidecar) or+ ``CANONICAL_METHODS`` declaration, so it is rendered into the generated TypeScript and+ OpenRPC; and no canonical declaration outlives its handler."""+ connection, _ = owner+ served = set(connection.handlers()) | set(GROUP_METHODS) | {'profiles.list'}+ assert sorted(served - set(METHODS) - set(CANONICAL_METHODS)) == []+ assert sorted(set(CANONICAL_METHODS) - served) == []+++async def test_declared_params_gate_canonical_verbs_before_their_handlers(owner):+ """An unknown or missing key is ``4001 invalid_params`` naming the field, including verbs+ whose handlers only ``.get`` their keys; a well-formed call is unaffected."""+ connection, db = owner+ revision = db.get_session('s')['runtime_revision']+ mutate = {'session_id': 's', 'request_id': 'r1', 'expected_revision': revision,+ 'operation': 'rename', 'payload': {'title': 'Declared'}}+ try:+ for method, params, field in (+ ('prompt.receipt', {'session_id': 's', 'admission_id': 'a', 'bogus': 1}, 'bogus'),+ ('prompt.cancel', {'session_id': 's'}, 'admission_id'),+ ('session.mutate', {**mutate, 'expected_revison': revision}, 'expected_revison')):+ response = await connection.dispatch({'id': 1, 'method': method, 'params': params})+ assert response['error']['code'] == 4001, (method, response)+ assert response['error']['data']['reason'] == 'invalid_params'+ assert field in response['error']['data']['fields'], (method, response)+ applied = await connection.dispatch({'id': 2, 'method': 'session.mutate', 'params': mutate})+ CANONICAL_METHODS['session.mutate'].result.model_validate(applied['result'])+ assert db.get_session('s')['title'] == 'Declared'+ finally:+ await connection.close()diff --git a/tui_gateway/AGENTS.md b/tui_gateway/AGENTS.mdindex 26b443a1475..1643babfa31 100644--- a/tui_gateway/AGENTS.md+++ b/tui_gateway/AGENTS.md@@ -44,6 +44,10 @@ shape) and `gateway-contract.openrpc.json` are rendered by `scripts/gen_gateway_`tests/tui_gateway/contracts/test_generated.py` fails when they are stale, so the loop is: change the model →regenerate → `tsc` shows every consumer the field moved. `apps/shared/src/gateway-events.ts` only addsthe client-local synthetic events and the `GatewayEvent` envelope on top.+Verbs only the session authority serves (`hermes-gateway-v1`, `gateway/session_controls.py::+AuthorityConnection`) are `canonical_method(...)` in `contracts/canonical.py` (`CANONICAL_METHODS` →+TS `CanonicalRpcMethods`); `dispatch` refuses an unknown/missing key with `4001 invalid_params`, and+`tests/gateway/test_canonical_wire_contract.py` fails when a handler name has no declaration.New question for the user = `_ask("<method>", sid, params, timeout)` in the emitter, a handler in`apps/desktop/.../gateway-event/server-requests.ts` and `ui-tui/src/app/createServerRequestHandler.ts`,and a `server_request(...)` in `contracts/server_requests.py`.diff --git a/tui_gateway/contracts/__init__.py b/tui_gateway/contracts/__init__.pyindex 270739cc845..77a08b19cd2 100644--- a/tui_gateway/contracts/__init__.py+++ b/tui_gateway/contracts/__init__.py@@ -20,7 +20,8 @@ from . import ( # noqa: F401tools_commands,tools_mcp_plugins,)+from . import canonical # noqa: F401,E402 (last: authority-only verbs reuse the topic models above)from .base import JsonValue, Params, Payload, Result, WireEnum-from .registry import EVENTS, METHODS, SERVER_REQUESTS+from .registry import CANONICAL_METHODS, EVENTS, METHODS, SERVER_REQUESTS-__all__ = ["EVENTS", "METHODS", "SERVER_REQUESTS", "JsonValue", "Params", "Payload", "Result", "WireEnum"]+__all__ = ["CANONICAL_METHODS", "EVENTS", "METHODS", "SERVER_REQUESTS", "JsonValue", "Params", "Payload", "Result", "WireEnum"]diff --git a/tui_gateway/contracts/canonical.py b/tui_gateway/contracts/canonical.pynew file mode 100644index 00000000000..9510cc6fe0e--- /dev/null+++ b/tui_gateway/contracts/canonical.py@@ -0,0 +1,369 @@+"""Canonical ``hermes-gateway-v1`` methods that only the session authority serves.++``gateway/session_controls.py::AuthorityConnection.dispatch`` answers these on the authenticated+native socket; the TUI sidecar (``server._methods``) never registers them, so they live in+``CANONICAL_METHODS`` rather than ``METHODS``. Names both dispatchers serve keep their ``METHODS``+contract. The dispatcher refuses an unknown or missing key with ``4001 invalid_params`` before the+handler runs; value checks stay in the handlers, which own their domain reasons.+"""++from __future__ import annotations++from typing import Literal++from .base import JsonValue, Params, Result+from .common import OpenModel+from .groups_bot_relay import RoomParams, RoomTaskReceipt+from .registry import canonical_method++# ── admissions ────────────────────────────────────────────────────────────────────────────────+++class CanonicalSessionRef(Result):+ profile_id: str+ session_id: str+++class AdmissionStatus(Result):+ """``gateway/session_contract.py::AdmissionReceipt`` as ``dataclasses.asdict`` sends it."""++ admission_id: str+ ref: CanonicalSessionRef+ sequence: int+ status: Literal["queued", "started", "unknown", "terminal"]+ outcome: str | None+ authority_epoch: int+ execution_generation: int | None+++class PromptReceiptParams(Params):+ session_id: str+ admission_id: str+ include_result: bool | None = None+++class PromptReceiptResult(AdmissionStatus):+ """``result`` / ``usage``: the structured turn result committed at settlement, only with+ ``include_result`` on a terminal admission that saved one."""++ result: JsonValue | None = None+ usage: dict[str, JsonValue] | None = None+++canonical_method("prompt.receipt", params=PromptReceiptParams, result=PromptReceiptResult,+ doc="Current receipt of one admission the caller submitted (or controls).")+++class PromptCancelParams(Params):+ session_id: str+ admission_id: str+++canonical_method("prompt.cancel", params=PromptCancelParams, result=AdmissionStatus,+ doc="Retire a still-queued admission; a started one is unaffected.")+++class PromptResolveUnknownParams(Params):+ session_id: str+ admission_id: str+ execution_generation: int+++canonical_method("prompt.resolve_unknown", params=PromptResolveUnknownParams, result=AdmissionStatus,+ doc="Acknowledge a turn lost across an owner restart; the FIFO behind it resumes. "+ "Never requeues the lost input.")+++# ── session ───────────────────────────────────────────────────────────────────────────────────+++class SessionMutateParams(Params):+ """``operation`` + ``payload`` are validated by ``hermes_state_mutations.validate_action``;+ ``expected_generation`` is required for delete/rewind/reset/branch/model/compress."""++ session_id: str+ request_id: str+ expected_revision: int+ operation: str+ payload: dict[str, JsonValue]+ expected_generation: int | None = None+++class SessionMutateResult(OpenModel):+ """The committed mutation receipt plus the operation's projection (``title``, ``archived``,+ ``branched_session_id``, compress ``status``/``lines``, …). ``revision`` is absent only on a+ read-only compress preview."""++ session_id: str+ operation: str+ revision: int | None = None+++canonical_method("session.mutate", params=SessionMutateParams, result=SessionMutateResult,+ doc="Revision-fenced, retry-idempotent session edit (rename, archive, sidebar, branch, "+ "delete, rewind, reset, model, compress, import).")+++class CanonicalSessionInfoParams(Params):+ session_id: str+++class CanonicalSessionInfo(OpenModel):+ """``gateway/session_local.py::local_session_info``."""++ source: str+ model: str | None = None+ lazy: bool+ profile_id: str+ desktop_protocol: str+ profile_name: str+ cwd: str | None = None+ launch_request: dict[str, JsonValue] | None = None+++canonical_method("session.info", params=CanonicalSessionInfoParams, result=CanonicalSessionInfo,+ doc="Frozen launch policy projection of one local session.")+++class SessionDetachParams(Params):+ session_id: str+ subscription_id: str+++class SessionDetachResult(Result):+ session_id: str+ subscription_id: str+ detached: bool+++canonical_method("session.detach", params=SessionDetachParams, result=SessionDetachResult,+ doc="Drop this connection's subscription; a stale subscription id answers detached=false.")+++class RuntimeDescribeParams(Params):+ pass+++class SessionCreateDescriptor(Result):+ sources: list[str]+ parameters: list[str]+++class RuntimeDescribeResult(Result):+ instance_id: str+ profile_id: str+ authority_epoch: int+ capabilities: list[str]+ session_create: SessionCreateDescriptor+++canonical_method("runtime.describe", params=RuntimeDescribeParams, result=RuntimeDescribeResult,+ doc="Owner identity and the canonical capabilities a client may rely on.")+++class ClarifyRespondParams(Params):+ session_id: str+ execution_generation: int+ prompt_id: str+ answer: str+++class PromptResponseResult(Result):+ status: Literal["resolved", "already_resolved"]+ prompt_id: str+++canonical_method("clarify.respond", params=ClarifyRespondParams, result=PromptResponseResult,+ doc="Generation-fenced answer to a pending clarify prompt (empty answer = skipped).")+++# ── cron / kanban / a2a producers ─────────────────────────────────────────────────────────────+++class CronRunParams(Params):+ job_id: str+ request_id: str+ extra_prompt: str | None+++class CronSubmitResult(Result):+ session_id: str+ admission_id: str+++canonical_method("cron.submit", params=CronRunParams, result=CronSubmitResult,+ doc="Admit one cron firing into the owning profile's durable FIFO.")+++class CronStatusResult(OpenModel):+ """``result`` is the ``run_job`` tuple once terminal; ``recover`` adds the frozen ``job`` and+ answers ``status='missing'`` for a firing that was never admitted."""++ status: str+ result: list[JsonValue] | None+ job_flags: dict[str, JsonValue] | None = None+ job: dict[str, JsonValue] | None = None+++canonical_method("cron.recover", params=CronRunParams, result=CronStatusResult,+ doc="Re-observe a firing after a scheduler restart (same request identity).")+++class CronAdmissionParams(Params):+ session_id: str+ admission_id: str+++canonical_method("cron.status", params=CronAdmissionParams, result=CronStatusResult,+ doc="Status and, once terminal, the result of one cron admission.")+++class CronCancelResult(Result):+ ok: bool+++canonical_method("cron.cancel", params=CronAdmissionParams, result=CronCancelResult,+ doc="Cancel a queued cron admission or latch cancellation on a started one.")+++class KanbanRunParams(Params):+ board: str+ task_id: str+ run_id: int+ claim_lock: str+ db: str | None = None+++class KanbanRunResult(Result):+ session_id: str+ receipt: AdmissionStatus+++canonical_method("kanban.run", params=KanbanRunParams, result=KanbanRunResult,+ doc="Native-owner only: admit the dispatcher's current claim on a kanban task.")+++class A2aForwardParams(Params):+ agent: str+ tenant: str+ peer: str+ context_id: str+ input_id: str+ text: str+++class A2aForwardResult(AdmissionStatus):+ session_id: str+ result: JsonValue | None+++canonical_method("a2a.forward", params=A2aForwardParams, result=A2aForwardResult,+ doc="Forward one A2A input into the conversation its identity tuple names.")+++# ── managed workers ───────────────────────────────────────────────────────────────────────────+++class WorkerScopeParams(Params):+ """The producer claim every worker verb proves (``gateway/session_worker.py::_SCOPE``)."""++ profile_id: str+ session_id: str+ execution_id: str+ generation: int+ pid: int+ birth: float+ secret: str+++class WorkerRegisterParams(WorkerScopeParams):+ kind: str+++class WorkerExecution(OpenModel):+ """A ``worker_executions`` row without its adoption digest."""++ execution_id: str+ session_id: str+ kind: str+ owner_epoch: int+ generation: int+ status: str+ last_sequence: int+++canonical_method("worker.register", params=WorkerRegisterParams, result=WorkerExecution,+ doc="Register a compute worker execution on an idle session.")+canonical_method("worker.adopt", params=WorkerScopeParams, result=WorkerExecution,+ doc="Adopt a registered execution after verifying the live producer claim.")+++class WorkerPersistParams(WorkerScopeParams):+ epoch: int+ sequence: int+ operation: str+ payload: dict[str, JsonValue]+++class WorkerPersistResult(OpenModel):+ """The operation's durable receipt (``message_id`` for an append, delegation results, …)."""+++canonical_method("worker.persist", params=WorkerPersistParams, result=WorkerPersistResult,+ doc="Sequence-fenced typed persistence write from an adopted worker.")+++# ── hosted rooms (canonical-only verbs) ───────────────────────────────────────────────────────+++class GroupsAttachmentUploadParams(RoomParams):+ upload_id: str+ kind: str+ name: str+ mime: str+ data_base64: str+++class RoomAttachment(OpenModel):+ attachment_id: str+ kind: str+ name: str+ size: int+ mime: str+ sha256: str+ state: str+ created_at: float+ idempotent: bool+ event_id: str | None = None+++canonical_method("groups.attachment.upload", params=GroupsAttachmentUploadParams, result=RoomAttachment,+ doc="Store one attachment for a later groups.send manifest (idempotent per upload_id).")+++class GroupsAttachmentDownloadParams(RoomParams):+ event_id: str+ attachment_id: str+++class RoomAttachmentBytes(RoomAttachment):+ data_base64: str+++canonical_method("groups.attachment.download", params=GroupsAttachmentDownloadParams,+ result=RoomAttachmentBytes, doc="Read one committed attachment for a live room viewer.")+++class GroupsDiscardParams(RoomParams):+ member_id: str+ task_id: str+ execution_generation: int+++class GroupsDiscardResult(Result):+ discarded: bool = True+ task: RoomTaskReceipt+++canonical_method("groups.discard", params=GroupsDiscardParams, result=GroupsDiscardResult,+ doc="Discard one indeterminate room task after explicit user confirmation.")diff --git a/tui_gateway/contracts/registry.py b/tui_gateway/contracts/registry.pyindex 75f218fe7e1..0ee28a01435 100644--- a/tui_gateway/contracts/registry.py+++ b/tui_gateway/contracts/registry.py@@ -45,12 +45,16 @@ class EventContract:METHODS: dict[str, MethodContract] = {}+# ``hermes-gateway-v1`` verbs only ``gateway/session_controls.py::AuthorityConnection`` serves+# (``contracts/canonical.py``); a name both dispatchers serve keeps its one ``METHODS`` entry.+CANONICAL_METHODS: dict[str, MethodContract] = {}SERVER_REQUESTS: dict[str, ServerRequestContract] = {}EVENTS: dict[str, EventContract] = {}def _declare(table: dict, entry) -> None:- if entry.name in table:+ if entry.name in table or (table in (METHODS, CANONICAL_METHODS)+ and entry.name in (METHODS.keys() | CANONICAL_METHODS.keys())):raise RuntimeError(f"contract declared twice: {entry.name}")table[entry.name] = entry@@ -61,6 +65,12 @@ def method(name: str, *, params: type[Params], result: type[Result], doc: str =return entry+def canonical_method(name: str, *, params: type[Params], result: type[Result], doc: str = "") -> MethodContract:+ entry = MethodContract(name, params, result, doc)+ _declare(CANONICAL_METHODS, entry)+ return entry++def server_request(name: str, *, params: type[Params], result: type[Result], doc: str = "") -> ServerRequestContract:entry = ServerRequestContract(name, params, result, doc)_declare(SERVER_REQUESTS, entry)@@ -109,6 +119,18 @@ def validate_params(contract: MethodContract | ServerRequestContract, params: direturn params, None+def canonical_param_problems(contract: MethodContract, params: dict) -> list[str]:+ """Key paths the canonical dispatcher refuses (``4001 invalid_params``): unknown and missing+ keys — the closed set its handlers enforced by hand. Value/type checks stay in the handlers,+ which own their domain reasons (``stale_generation``, ``not_found``, …)."""+ try:+ contract.params.model_validate(params)+ except ValidationError as exc:+ return [".".join(str(p) for p in err.get("loc", ())) or "params" for err in exc.errors()+ if err.get("type") in ("extra_forbidden", "missing")]+ return []++def check_params_accepted(contract: MethodContract | ServerRequestContract, params: dict) -> None:"""The handler answered with a result: the params it accepted must be valid under thecontract, else the contract is narrower than the wire (a required field that is optional in