From 37a973ecf9ef6f78e76f18418359afb68eede80d Mon Sep 17 00:00:00 2001 From: Andrei Eternal Date: Tue, 3 Mar 2026 14:05:28 -0800 Subject: [PATCH] protocol: add hook lifecycle types and turn hookRuns --- .../schema/json/EventMsg.json | 240 +++++++++++++++ .../schema/json/ServerNotification.json | 225 ++++++++++++++ .../codex_app_server_protocol.schemas.json | 281 ++++++++++++++++++ .../codex_app_server_protocol.v2.schemas.json | 281 ++++++++++++++++++ .../json/v2/HookCompletedNotification.json | 161 ++++++++++ .../json/v2/HookStartedNotification.json | 161 ++++++++++ .../schema/json/v2/ReviewStartResponse.json | 143 +++++++++ .../schema/json/v2/ThreadForkResponse.json | 143 +++++++++ .../schema/json/v2/ThreadListResponse.json | 143 +++++++++ .../schema/json/v2/ThreadReadResponse.json | 143 +++++++++ .../schema/json/v2/ThreadResumeResponse.json | 143 +++++++++ .../json/v2/ThreadRollbackResponse.json | 143 +++++++++ .../schema/json/v2/ThreadStartResponse.json | 143 +++++++++ .../json/v2/ThreadStartedNotification.json | 143 +++++++++ .../json/v2/ThreadUnarchiveResponse.json | 143 +++++++++ .../json/v2/TurnCompletedNotification.json | 143 +++++++++ .../schema/json/v2/TurnStartResponse.json | 143 +++++++++ .../json/v2/TurnStartedNotification.json | 143 +++++++++ .../schema/typescript/EventMsg.ts | 4 +- .../schema/typescript/HookCompletedEvent.ts | 6 + .../schema/typescript/HookEventName.ts | 5 + .../schema/typescript/HookExecutionMode.ts | 5 + .../schema/typescript/HookHandlerType.ts | 5 + .../schema/typescript/HookOutputEntry.ts | 6 + .../schema/typescript/HookOutputEntryKind.ts | 5 + .../schema/typescript/HookRunStatus.ts | 5 + .../schema/typescript/HookRunSummary.ts | 11 + .../schema/typescript/HookScope.ts | 5 + .../schema/typescript/HookStartedEvent.ts | 6 + .../schema/typescript/ServerNotification.ts | 4 +- .../schema/typescript/index.ts | 10 + .../v2/HookCompletedNotification.ts | 6 + .../schema/typescript/v2/HookEventName.ts | 5 + .../schema/typescript/v2/HookExecutionMode.ts | 5 + .../schema/typescript/v2/HookHandlerType.ts | 5 + .../schema/typescript/v2/HookOutputEntry.ts | 6 + .../typescript/v2/HookOutputEntryKind.ts | 5 + .../schema/typescript/v2/HookRunStatus.ts | 5 + .../schema/typescript/v2/HookRunSummary.ts | 11 + .../schema/typescript/v2/HookScope.ts | 5 + .../typescript/v2/HookStartedNotification.ts | 6 + .../schema/typescript/v2/Turn.ts | 3 +- .../schema/typescript/v2/index.ts | 10 + .../src/protocol/common.rs | 2 + .../src/protocol/thread_history.rs | 37 ++- .../app-server-protocol/src/protocol/v2.rs | 119 ++++++++ codex-rs/protocol/src/protocol.rs | 93 ++++++ 47 files changed, 3461 insertions(+), 4 deletions(-) create mode 100644 codex-rs/app-server-protocol/schema/json/v2/HookCompletedNotification.json create mode 100644 codex-rs/app-server-protocol/schema/json/v2/HookStartedNotification.json create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookCompletedEvent.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookEventName.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookExecutionMode.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookHandlerType.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookOutputEntry.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookOutputEntryKind.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookRunStatus.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookRunSummary.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookScope.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/HookStartedEvent.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookCompletedNotification.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookEventName.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookExecutionMode.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookHandlerType.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntry.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookRunStatus.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookRunSummary.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookScope.ts create mode 100644 codex-rs/app-server-protocol/schema/typescript/v2/HookStartedNotification.ts diff --git a/codex-rs/app-server-protocol/schema/json/EventMsg.json b/codex-rs/app-server-protocol/schema/json/EventMsg.json index 4258bf7c2c..67f5d4cb20 100644 --- a/codex-rs/app-server-protocol/schema/json/EventMsg.json +++ b/codex-rs/app-server-protocol/schema/json/EventMsg.json @@ -2652,6 +2652,58 @@ "title": "ItemCompletedEventMsg", "type": "object" }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_started" + ], + "title": "HookStartedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookStartedEventMsg", + "type": "object" + }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_completed" + ], + "title": "HookCompletedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookCompletedEventMsg", + "type": "object" + }, { "properties": { "delta": { @@ -3569,6 +3621,142 @@ ], "type": "object" }, + "HookEventName": { + "enum": [ + "session_start", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completed_at": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "display_order": { + "format": "int64", + "type": "integer" + }, + "duration_ms": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "event_name": { + "$ref": "#/definitions/HookEventName" + }, + "execution_mode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handler_type": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "source_path": { + "type": "string" + }, + "started_at": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "status_message": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "display_order", + "entries", + "event_name", + "execution_mode", + "handler_type", + "id", + "scope", + "source_path", + "started_at", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "LocalShellAction": { "oneOf": [ { @@ -8284,6 +8472,58 @@ "title": "ItemCompletedEventMsg", "type": "object" }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_started" + ], + "title": "HookStartedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookStartedEventMsg", + "type": "object" + }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_completed" + ], + "title": "HookCompletedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookCompletedEventMsg", + "type": "object" + }, { "properties": { "delta": { diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 28df2574b2..d3384278bd 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -998,6 +998,184 @@ }, "type": "object" }, + "HookCompletedNotification": { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "type": "object" + }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, + "HookStartedNotification": { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "type": "object" + }, "ItemCompletedNotification": { "properties": { "item": { @@ -2646,6 +2824,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -2661,6 +2845,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" @@ -3262,6 +3447,26 @@ "title": "Turn/startedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/started" + ], + "title": "Hook/startedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/HookStartedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/startedNotification", + "type": "object" + }, { "properties": { "method": { @@ -3282,6 +3487,26 @@ "title": "Turn/completedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/completed" + ], + "title": "Hook/completedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/HookCompletedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/completedNotification", + "type": "object" + }, { "properties": { "method": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index ddeee0ce73..5e5bf7fcc5 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -3820,6 +3820,58 @@ "title": "ItemCompletedEventMsg", "type": "object" }, + { + "properties": { + "run": { + "$ref": "#/definitions/v2/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_started" + ], + "title": "HookStartedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookStartedEventMsg", + "type": "object" + }, + { + "properties": { + "run": { + "$ref": "#/definitions/v2/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_completed" + ], + "title": "HookCompletedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookCompletedEventMsg", + "type": "object" + }, { "properties": { "delta": { @@ -6075,6 +6127,26 @@ "title": "Turn/startedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/started" + ], + "title": "Hook/startedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/HookStartedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/startedNotification", + "type": "object" + }, { "properties": { "method": { @@ -6095,6 +6167,26 @@ "title": "Turn/completedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/completed" + ], + "title": "Hook/completedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/HookCompletedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/completedNotification", + "type": "object" + }, { "properties": { "method": { @@ -9841,6 +9933,188 @@ ], "type": "string" }, + "HookCompletedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "run": { + "$ref": "#/definitions/v2/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookCompletedNotification", + "type": "object" + }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/v2/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/v2/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/v2/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/v2/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/v2/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/v2/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/v2/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, + "HookStartedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "run": { + "$ref": "#/definitions/v2/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookStartedNotification", + "type": "object" + }, "InputModality": { "description": "Canonical user-input modality tags advertised by a model.", "oneOf": [ @@ -14494,6 +14768,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/v2/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -14509,6 +14789,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 1bd5733364..fc9d9ab760 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -5363,6 +5363,58 @@ "title": "ItemCompletedEventMsg", "type": "object" }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_started" + ], + "title": "HookStartedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookStartedEventMsg", + "type": "object" + }, + { + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "turn_id": { + "type": [ + "string", + "null" + ] + }, + "type": { + "enum": [ + "hook_completed" + ], + "title": "HookCompletedEventMsgType", + "type": "string" + } + }, + "required": [ + "run", + "type" + ], + "title": "HookCompletedEventMsg", + "type": "object" + }, { "properties": { "delta": { @@ -6804,6 +6856,188 @@ ], "type": "object" }, + "HookCompletedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookCompletedNotification", + "type": "object" + }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, + "HookStartedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookStartedNotification", + "type": "object" + }, "InitializeCapabilities": { "description": "Client-declared capabilities negotiated during initialize.", "properties": { @@ -9994,6 +10228,26 @@ "title": "Turn/startedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/started" + ], + "title": "Hook/startedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/HookStartedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/startedNotification", + "type": "object" + }, { "properties": { "method": { @@ -10014,6 +10268,26 @@ "title": "Turn/completedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "hook/completed" + ], + "title": "Hook/completedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/HookCompletedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "Hook/completedNotification", + "type": "object" + }, { "properties": { "method": { @@ -13226,6 +13500,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -13241,6 +13521,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/HookCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/HookCompletedNotification.json new file mode 100644 index 0000000000..e00ba5a002 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/HookCompletedNotification.json @@ -0,0 +1,161 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + } + }, + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookCompletedNotification", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/HookStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/HookStartedNotification.json new file mode 100644 index 0000000000..49d94c7c1d --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/HookStartedNotification.json @@ -0,0 +1,161 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + } + }, + "properties": { + "run": { + "$ref": "#/definitions/HookRunSummary" + }, + "threadId": { + "type": "string" + }, + "turnId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "run", + "threadId" + ], + "title": "HookStartedNotification", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json index 61449aa785..69c0bc3c69 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json @@ -370,6 +370,142 @@ ], "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1060,6 +1196,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1075,6 +1217,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json index 3e4dca5b1c..7fb298096f 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -439,6 +439,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1606,6 +1742,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1621,6 +1763,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json index 2cf3b940f3..f53f55140b 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -393,6 +393,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1373,6 +1509,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1388,6 +1530,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json index b2398692fd..572e2cf6a5 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -393,6 +393,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1373,6 +1509,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1388,6 +1530,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json index d9fbc0d02c..a80725bb7e 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -439,6 +439,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1606,6 +1742,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1621,6 +1763,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json index 4ac54973de..2816c0e5ba 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -393,6 +393,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1373,6 +1509,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1388,6 +1530,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json index ee8b384998..5153ddc1ab 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -439,6 +439,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1606,6 +1742,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1621,6 +1763,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json index c46d4d7bb0..c1030ffa66 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -393,6 +393,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1373,6 +1509,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1388,6 +1530,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json index eabd614028..2c5706c955 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -393,6 +393,142 @@ }, "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1373,6 +1509,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1388,6 +1530,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json index 84bb60c8e8..c0e3e175c5 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json @@ -370,6 +370,142 @@ ], "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1060,6 +1196,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1075,6 +1217,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json index 863814e1b4..b3ac85ac92 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json @@ -370,6 +370,142 @@ ], "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1060,6 +1196,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1075,6 +1217,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json index aba5d973ab..97b001ea34 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json @@ -370,6 +370,142 @@ ], "type": "object" }, + "HookEventName": { + "enum": [ + "sessionStart", + "stop" + ], + "type": "string" + }, + "HookExecutionMode": { + "enum": [ + "sync", + "async" + ], + "type": "string" + }, + "HookHandlerType": { + "enum": [ + "command", + "prompt", + "agent" + ], + "type": "string" + }, + "HookOutputEntry": { + "properties": { + "kind": { + "$ref": "#/definitions/HookOutputEntryKind" + }, + "text": { + "type": "string" + } + }, + "required": [ + "kind", + "text" + ], + "type": "object" + }, + "HookOutputEntryKind": { + "enum": [ + "warning", + "stop", + "feedback", + "context", + "error" + ], + "type": "string" + }, + "HookRunStatus": { + "enum": [ + "running", + "completed", + "failed", + "blocked", + "stopped" + ], + "type": "string" + }, + "HookRunSummary": { + "properties": { + "completedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "displayOrder": { + "format": "int64", + "type": "integer" + }, + "durationMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "entries": { + "items": { + "$ref": "#/definitions/HookOutputEntry" + }, + "type": "array" + }, + "eventName": { + "$ref": "#/definitions/HookEventName" + }, + "executionMode": { + "$ref": "#/definitions/HookExecutionMode" + }, + "handlerType": { + "$ref": "#/definitions/HookHandlerType" + }, + "id": { + "type": "string" + }, + "scope": { + "$ref": "#/definitions/HookScope" + }, + "sourcePath": { + "type": "string" + }, + "startedAt": { + "format": "int64", + "type": "integer" + }, + "status": { + "$ref": "#/definitions/HookRunStatus" + }, + "statusMessage": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "displayOrder", + "entries", + "eventName", + "executionMode", + "handlerType", + "id", + "scope", + "sourcePath", + "startedAt", + "status" + ], + "type": "object" + }, + "HookScope": { + "enum": [ + "thread", + "turn" + ], + "type": "string" + }, "McpToolCallError": { "properties": { "message": { @@ -1060,6 +1196,12 @@ ], "description": "Only populated when the Turn's status is failed." }, + "hookRuns": { + "items": { + "$ref": "#/definitions/HookRunSummary" + }, + "type": "array" + }, "id": { "type": "string" }, @@ -1075,6 +1217,7 @@ } }, "required": [ + "hookRuns", "id", "items", "status" diff --git a/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts b/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts index 5ccbe1e697..8d3800a309 100644 --- a/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts +++ b/codex-rs/app-server-protocol/schema/typescript/EventMsg.ts @@ -33,6 +33,8 @@ import type { ExecCommandEndEvent } from "./ExecCommandEndEvent"; import type { ExecCommandOutputDeltaEvent } from "./ExecCommandOutputDeltaEvent"; import type { ExitedReviewModeEvent } from "./ExitedReviewModeEvent"; import type { GetHistoryEntryResponseEvent } from "./GetHistoryEntryResponseEvent"; +import type { HookCompletedEvent } from "./HookCompletedEvent"; +import type { HookStartedEvent } from "./HookStartedEvent"; import type { ItemCompletedEvent } from "./ItemCompletedEvent"; import type { ItemStartedEvent } from "./ItemStartedEvent"; import type { ListCustomPromptsResponseEvent } from "./ListCustomPromptsResponseEvent"; @@ -79,4 +81,4 @@ import type { WebSearchEndEvent } from "./WebSearchEndEvent"; * Response event from the agent * NOTE: Make sure none of these values have optional types, as it will mess up the extension code-gen. */ -export type EventMsg = { "type": "error" } & ErrorEvent | { "type": "warning" } & WarningEvent | { "type": "realtime_conversation_started" } & RealtimeConversationStartedEvent | { "type": "realtime_conversation_realtime" } & RealtimeConversationRealtimeEvent | { "type": "realtime_conversation_closed" } & RealtimeConversationClosedEvent | { "type": "model_reroute" } & ModelRerouteEvent | { "type": "context_compacted" } & ContextCompactedEvent | { "type": "thread_rolled_back" } & ThreadRolledBackEvent | { "type": "task_started" } & TurnStartedEvent | { "type": "task_complete" } & TurnCompleteEvent | { "type": "token_count" } & TokenCountEvent | { "type": "agent_message" } & AgentMessageEvent | { "type": "user_message" } & UserMessageEvent | { "type": "agent_message_delta" } & AgentMessageDeltaEvent | { "type": "agent_reasoning" } & AgentReasoningEvent | { "type": "agent_reasoning_delta" } & AgentReasoningDeltaEvent | { "type": "agent_reasoning_raw_content" } & AgentReasoningRawContentEvent | { "type": "agent_reasoning_raw_content_delta" } & AgentReasoningRawContentDeltaEvent | { "type": "agent_reasoning_section_break" } & AgentReasoningSectionBreakEvent | { "type": "session_configured" } & SessionConfiguredEvent | { "type": "thread_name_updated" } & ThreadNameUpdatedEvent | { "type": "mcp_startup_update" } & McpStartupUpdateEvent | { "type": "mcp_startup_complete" } & McpStartupCompleteEvent | { "type": "mcp_tool_call_begin" } & McpToolCallBeginEvent | { "type": "mcp_tool_call_end" } & McpToolCallEndEvent | { "type": "web_search_begin" } & WebSearchBeginEvent | { "type": "web_search_end" } & WebSearchEndEvent | { "type": "exec_command_begin" } & ExecCommandBeginEvent | { "type": "exec_command_output_delta" } & ExecCommandOutputDeltaEvent | { "type": "terminal_interaction" } & TerminalInteractionEvent | { "type": "exec_command_end" } & ExecCommandEndEvent | { "type": "view_image_tool_call" } & ViewImageToolCallEvent | { "type": "exec_approval_request" } & ExecApprovalRequestEvent | { "type": "request_user_input" } & RequestUserInputEvent | { "type": "dynamic_tool_call_request" } & DynamicToolCallRequest | { "type": "dynamic_tool_call_response" } & DynamicToolCallResponseEvent | { "type": "elicitation_request" } & ElicitationRequestEvent | { "type": "apply_patch_approval_request" } & ApplyPatchApprovalRequestEvent | { "type": "deprecation_notice" } & DeprecationNoticeEvent | { "type": "background_event" } & BackgroundEventEvent | { "type": "undo_started" } & UndoStartedEvent | { "type": "undo_completed" } & UndoCompletedEvent | { "type": "stream_error" } & StreamErrorEvent | { "type": "patch_apply_begin" } & PatchApplyBeginEvent | { "type": "patch_apply_end" } & PatchApplyEndEvent | { "type": "turn_diff" } & TurnDiffEvent | { "type": "get_history_entry_response" } & GetHistoryEntryResponseEvent | { "type": "mcp_list_tools_response" } & McpListToolsResponseEvent | { "type": "list_custom_prompts_response" } & ListCustomPromptsResponseEvent | { "type": "list_skills_response" } & ListSkillsResponseEvent | { "type": "list_remote_skills_response" } & ListRemoteSkillsResponseEvent | { "type": "remote_skill_downloaded" } & RemoteSkillDownloadedEvent | { "type": "skills_update_available" } | { "type": "plan_update" } & UpdatePlanArgs | { "type": "turn_aborted" } & TurnAbortedEvent | { "type": "shutdown_complete" } | { "type": "entered_review_mode" } & ReviewRequest | { "type": "exited_review_mode" } & ExitedReviewModeEvent | { "type": "raw_response_item" } & RawResponseItemEvent | { "type": "item_started" } & ItemStartedEvent | { "type": "item_completed" } & ItemCompletedEvent | { "type": "agent_message_content_delta" } & AgentMessageContentDeltaEvent | { "type": "plan_delta" } & PlanDeltaEvent | { "type": "reasoning_content_delta" } & ReasoningContentDeltaEvent | { "type": "reasoning_raw_content_delta" } & ReasoningRawContentDeltaEvent | { "type": "collab_agent_spawn_begin" } & CollabAgentSpawnBeginEvent | { "type": "collab_agent_spawn_end" } & CollabAgentSpawnEndEvent | { "type": "collab_agent_interaction_begin" } & CollabAgentInteractionBeginEvent | { "type": "collab_agent_interaction_end" } & CollabAgentInteractionEndEvent | { "type": "collab_waiting_begin" } & CollabWaitingBeginEvent | { "type": "collab_waiting_end" } & CollabWaitingEndEvent | { "type": "collab_close_begin" } & CollabCloseBeginEvent | { "type": "collab_close_end" } & CollabCloseEndEvent | { "type": "collab_resume_begin" } & CollabResumeBeginEvent | { "type": "collab_resume_end" } & CollabResumeEndEvent; +export type EventMsg = { "type": "error" } & ErrorEvent | { "type": "warning" } & WarningEvent | { "type": "realtime_conversation_started" } & RealtimeConversationStartedEvent | { "type": "realtime_conversation_realtime" } & RealtimeConversationRealtimeEvent | { "type": "realtime_conversation_closed" } & RealtimeConversationClosedEvent | { "type": "model_reroute" } & ModelRerouteEvent | { "type": "context_compacted" } & ContextCompactedEvent | { "type": "thread_rolled_back" } & ThreadRolledBackEvent | { "type": "task_started" } & TurnStartedEvent | { "type": "task_complete" } & TurnCompleteEvent | { "type": "token_count" } & TokenCountEvent | { "type": "agent_message" } & AgentMessageEvent | { "type": "user_message" } & UserMessageEvent | { "type": "agent_message_delta" } & AgentMessageDeltaEvent | { "type": "agent_reasoning" } & AgentReasoningEvent | { "type": "agent_reasoning_delta" } & AgentReasoningDeltaEvent | { "type": "agent_reasoning_raw_content" } & AgentReasoningRawContentEvent | { "type": "agent_reasoning_raw_content_delta" } & AgentReasoningRawContentDeltaEvent | { "type": "agent_reasoning_section_break" } & AgentReasoningSectionBreakEvent | { "type": "session_configured" } & SessionConfiguredEvent | { "type": "thread_name_updated" } & ThreadNameUpdatedEvent | { "type": "mcp_startup_update" } & McpStartupUpdateEvent | { "type": "mcp_startup_complete" } & McpStartupCompleteEvent | { "type": "mcp_tool_call_begin" } & McpToolCallBeginEvent | { "type": "mcp_tool_call_end" } & McpToolCallEndEvent | { "type": "web_search_begin" } & WebSearchBeginEvent | { "type": "web_search_end" } & WebSearchEndEvent | { "type": "exec_command_begin" } & ExecCommandBeginEvent | { "type": "exec_command_output_delta" } & ExecCommandOutputDeltaEvent | { "type": "terminal_interaction" } & TerminalInteractionEvent | { "type": "exec_command_end" } & ExecCommandEndEvent | { "type": "view_image_tool_call" } & ViewImageToolCallEvent | { "type": "exec_approval_request" } & ExecApprovalRequestEvent | { "type": "request_user_input" } & RequestUserInputEvent | { "type": "dynamic_tool_call_request" } & DynamicToolCallRequest | { "type": "dynamic_tool_call_response" } & DynamicToolCallResponseEvent | { "type": "elicitation_request" } & ElicitationRequestEvent | { "type": "apply_patch_approval_request" } & ApplyPatchApprovalRequestEvent | { "type": "deprecation_notice" } & DeprecationNoticeEvent | { "type": "background_event" } & BackgroundEventEvent | { "type": "undo_started" } & UndoStartedEvent | { "type": "undo_completed" } & UndoCompletedEvent | { "type": "stream_error" } & StreamErrorEvent | { "type": "patch_apply_begin" } & PatchApplyBeginEvent | { "type": "patch_apply_end" } & PatchApplyEndEvent | { "type": "turn_diff" } & TurnDiffEvent | { "type": "get_history_entry_response" } & GetHistoryEntryResponseEvent | { "type": "mcp_list_tools_response" } & McpListToolsResponseEvent | { "type": "list_custom_prompts_response" } & ListCustomPromptsResponseEvent | { "type": "list_skills_response" } & ListSkillsResponseEvent | { "type": "list_remote_skills_response" } & ListRemoteSkillsResponseEvent | { "type": "remote_skill_downloaded" } & RemoteSkillDownloadedEvent | { "type": "skills_update_available" } | { "type": "plan_update" } & UpdatePlanArgs | { "type": "turn_aborted" } & TurnAbortedEvent | { "type": "shutdown_complete" } | { "type": "entered_review_mode" } & ReviewRequest | { "type": "exited_review_mode" } & ExitedReviewModeEvent | { "type": "raw_response_item" } & RawResponseItemEvent | { "type": "item_started" } & ItemStartedEvent | { "type": "item_completed" } & ItemCompletedEvent | { "type": "hook_started" } & HookStartedEvent | { "type": "hook_completed" } & HookCompletedEvent | { "type": "agent_message_content_delta" } & AgentMessageContentDeltaEvent | { "type": "plan_delta" } & PlanDeltaEvent | { "type": "reasoning_content_delta" } & ReasoningContentDeltaEvent | { "type": "reasoning_raw_content_delta" } & ReasoningRawContentDeltaEvent | { "type": "collab_agent_spawn_begin" } & CollabAgentSpawnBeginEvent | { "type": "collab_agent_spawn_end" } & CollabAgentSpawnEndEvent | { "type": "collab_agent_interaction_begin" } & CollabAgentInteractionBeginEvent | { "type": "collab_agent_interaction_end" } & CollabAgentInteractionEndEvent | { "type": "collab_waiting_begin" } & CollabWaitingBeginEvent | { "type": "collab_waiting_end" } & CollabWaitingEndEvent | { "type": "collab_close_begin" } & CollabCloseBeginEvent | { "type": "collab_close_end" } & CollabCloseEndEvent | { "type": "collab_resume_begin" } & CollabResumeBeginEvent | { "type": "collab_resume_end" } & CollabResumeEndEvent; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookCompletedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/HookCompletedEvent.ts new file mode 100644 index 0000000000..af439c5126 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookCompletedEvent.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookRunSummary } from "./HookRunSummary"; + +export type HookCompletedEvent = { turn_id: string | null, run: HookRunSummary, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookEventName.ts b/codex-rs/app-server-protocol/schema/typescript/HookEventName.ts new file mode 100644 index 0000000000..45e6489d12 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookEventName.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookEventName = "session_start" | "stop"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookExecutionMode.ts b/codex-rs/app-server-protocol/schema/typescript/HookExecutionMode.ts new file mode 100644 index 0000000000..61f98564ca --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookExecutionMode.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookExecutionMode = "sync" | "async"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookHandlerType.ts b/codex-rs/app-server-protocol/schema/typescript/HookHandlerType.ts new file mode 100644 index 0000000000..dc3f087bff --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookHandlerType.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookHandlerType = "command" | "prompt" | "agent"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookOutputEntry.ts b/codex-rs/app-server-protocol/schema/typescript/HookOutputEntry.ts new file mode 100644 index 0000000000..834f0c4e0c --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookOutputEntry.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookOutputEntryKind } from "./HookOutputEntryKind"; + +export type HookOutputEntry = { kind: HookOutputEntryKind, text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookOutputEntryKind.ts b/codex-rs/app-server-protocol/schema/typescript/HookOutputEntryKind.ts new file mode 100644 index 0000000000..090dfe3874 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookOutputEntryKind.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookOutputEntryKind = "warning" | "stop" | "feedback" | "context" | "error"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookRunStatus.ts b/codex-rs/app-server-protocol/schema/typescript/HookRunStatus.ts new file mode 100644 index 0000000000..ffca7e0e2c --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookRunStatus.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookRunStatus = "running" | "completed" | "failed" | "blocked" | "stopped"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookRunSummary.ts b/codex-rs/app-server-protocol/schema/typescript/HookRunSummary.ts new file mode 100644 index 0000000000..3725ff81d6 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookRunSummary.ts @@ -0,0 +1,11 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookEventName } from "./HookEventName"; +import type { HookExecutionMode } from "./HookExecutionMode"; +import type { HookHandlerType } from "./HookHandlerType"; +import type { HookOutputEntry } from "./HookOutputEntry"; +import type { HookRunStatus } from "./HookRunStatus"; +import type { HookScope } from "./HookScope"; + +export type HookRunSummary = { id: string, event_name: HookEventName, handler_type: HookHandlerType, execution_mode: HookExecutionMode, scope: HookScope, source_path: string, display_order: bigint, status: HookRunStatus, status_message: string | null, started_at: number, completed_at: number | null, duration_ms: number | null, entries: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookScope.ts b/codex-rs/app-server-protocol/schema/typescript/HookScope.ts new file mode 100644 index 0000000000..ff6f8bfee4 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookScope.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookScope = "thread" | "turn"; diff --git a/codex-rs/app-server-protocol/schema/typescript/HookStartedEvent.ts b/codex-rs/app-server-protocol/schema/typescript/HookStartedEvent.ts new file mode 100644 index 0000000000..e6387f5166 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/HookStartedEvent.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookRunSummary } from "./HookRunSummary"; + +export type HookStartedEvent = { turn_id: string | null, run: HookRunSummary, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts index d7f70d3558..b7631bcaaa 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts @@ -14,6 +14,8 @@ import type { ContextCompactedNotification } from "./v2/ContextCompactedNotifica import type { DeprecationNoticeNotification } from "./v2/DeprecationNoticeNotification"; import type { ErrorNotification } from "./v2/ErrorNotification"; import type { FileChangeOutputDeltaNotification } from "./v2/FileChangeOutputDeltaNotification"; +import type { HookCompletedNotification } from "./v2/HookCompletedNotification"; +import type { HookStartedNotification } from "./v2/HookStartedNotification"; import type { ItemCompletedNotification } from "./v2/ItemCompletedNotification"; import type { ItemStartedNotification } from "./v2/ItemStartedNotification"; import type { McpServerOauthLoginCompletedNotification } from "./v2/McpServerOauthLoginCompletedNotification"; @@ -48,4 +50,4 @@ import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldW /** * Notification sent from the server to the client. */ -export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification }; +export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "hook/started", "params": HookStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "hook/completed", "params": HookCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification }; diff --git a/codex-rs/app-server-protocol/schema/typescript/index.ts b/codex-rs/app-server-protocol/schema/typescript/index.ts index adaeb4c26c..b9bbf619e6 100644 --- a/codex-rs/app-server-protocol/schema/typescript/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/index.ts @@ -83,6 +83,16 @@ export type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams"; export type { GitDiffToRemoteResponse } from "./GitDiffToRemoteResponse"; export type { GitSha } from "./GitSha"; export type { HistoryEntry } from "./HistoryEntry"; +export type { HookCompletedEvent } from "./HookCompletedEvent"; +export type { HookEventName } from "./HookEventName"; +export type { HookExecutionMode } from "./HookExecutionMode"; +export type { HookHandlerType } from "./HookHandlerType"; +export type { HookOutputEntry } from "./HookOutputEntry"; +export type { HookOutputEntryKind } from "./HookOutputEntryKind"; +export type { HookRunStatus } from "./HookRunStatus"; +export type { HookRunSummary } from "./HookRunSummary"; +export type { HookScope } from "./HookScope"; +export type { HookStartedEvent } from "./HookStartedEvent"; export type { InitializeCapabilities } from "./InitializeCapabilities"; export type { InitializeParams } from "./InitializeParams"; export type { InitializeResponse } from "./InitializeResponse"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookCompletedNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookCompletedNotification.ts new file mode 100644 index 0000000000..fe4dbfb513 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookCompletedNotification.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookRunSummary } from "./HookRunSummary"; + +export type HookCompletedNotification = { threadId: string, turnId: string | null, run: HookRunSummary, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookEventName.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookEventName.ts new file mode 100644 index 0000000000..d07429a926 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookEventName.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookEventName = "sessionStart" | "stop"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookExecutionMode.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookExecutionMode.ts new file mode 100644 index 0000000000..61f98564ca --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookExecutionMode.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookExecutionMode = "sync" | "async"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookHandlerType.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookHandlerType.ts new file mode 100644 index 0000000000..dc3f087bff --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookHandlerType.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookHandlerType = "command" | "prompt" | "agent"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntry.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntry.ts new file mode 100644 index 0000000000..834f0c4e0c --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntry.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookOutputEntryKind } from "./HookOutputEntryKind"; + +export type HookOutputEntry = { kind: HookOutputEntryKind, text: string, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.ts new file mode 100644 index 0000000000..090dfe3874 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookOutputEntryKind = "warning" | "stop" | "feedback" | "context" | "error"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookRunStatus.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookRunStatus.ts new file mode 100644 index 0000000000..ffca7e0e2c --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookRunStatus.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookRunStatus = "running" | "completed" | "failed" | "blocked" | "stopped"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookRunSummary.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookRunSummary.ts new file mode 100644 index 0000000000..68fb4e10af --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookRunSummary.ts @@ -0,0 +1,11 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookEventName } from "./HookEventName"; +import type { HookExecutionMode } from "./HookExecutionMode"; +import type { HookHandlerType } from "./HookHandlerType"; +import type { HookOutputEntry } from "./HookOutputEntry"; +import type { HookRunStatus } from "./HookRunStatus"; +import type { HookScope } from "./HookScope"; + +export type HookRunSummary = { id: string, eventName: HookEventName, handlerType: HookHandlerType, executionMode: HookExecutionMode, scope: HookScope, sourcePath: string, displayOrder: bigint, status: HookRunStatus, statusMessage: string | null, startedAt: bigint, completedAt: bigint | null, durationMs: bigint | null, entries: Array, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookScope.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookScope.ts new file mode 100644 index 0000000000..ff6f8bfee4 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookScope.ts @@ -0,0 +1,5 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type HookScope = "thread" | "turn"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/HookStartedNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/HookStartedNotification.ts new file mode 100644 index 0000000000..1f781ed639 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/HookStartedNotification.ts @@ -0,0 +1,6 @@ +// GENERATED CODE! DO NOT MODIFY BY HAND! + +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookRunSummary } from "./HookRunSummary"; + +export type HookStartedNotification = { threadId: string, turnId: string | null, run: HookRunSummary, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/Turn.ts b/codex-rs/app-server-protocol/schema/typescript/v2/Turn.ts index 709ed5ccbe..f4948ef3d7 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/Turn.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/Turn.ts @@ -1,6 +1,7 @@ // GENERATED CODE! DO NOT MODIFY BY HAND! // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { HookRunSummary } from "./HookRunSummary"; import type { ThreadItem } from "./ThreadItem"; import type { TurnError } from "./TurnError"; import type { TurnStatus } from "./TurnStatus"; @@ -11,7 +12,7 @@ export type Turn = { id: string, * For all other responses and notifications returning a Turn, * the items field will be an empty list. */ -items: Array, status: TurnStatus, +items: Array, hookRuns: Array, status: TurnStatus, /** * Only populated when the Turn's status is failed. */ diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index 757eb72893..67bb5c2193 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -88,6 +88,16 @@ export type { GetAccountRateLimitsResponse } from "./GetAccountRateLimitsRespons export type { GetAccountResponse } from "./GetAccountResponse"; export type { GitInfo } from "./GitInfo"; export type { HazelnutScope } from "./HazelnutScope"; +export type { HookCompletedNotification } from "./HookCompletedNotification"; +export type { HookEventName } from "./HookEventName"; +export type { HookExecutionMode } from "./HookExecutionMode"; +export type { HookHandlerType } from "./HookHandlerType"; +export type { HookOutputEntry } from "./HookOutputEntry"; +export type { HookOutputEntryKind } from "./HookOutputEntryKind"; +export type { HookRunStatus } from "./HookRunStatus"; +export type { HookRunSummary } from "./HookRunSummary"; +export type { HookScope } from "./HookScope"; +export type { HookStartedNotification } from "./HookStartedNotification"; export type { ItemCompletedNotification } from "./ItemCompletedNotification"; export type { ItemStartedNotification } from "./ItemStartedNotification"; export type { ListMcpServerStatusParams } from "./ListMcpServerStatusParams"; diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index 98efcdd290..90d62414aa 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -752,7 +752,9 @@ server_notification_definitions! { ThreadNameUpdated => "thread/name/updated" (v2::ThreadNameUpdatedNotification), ThreadTokenUsageUpdated => "thread/tokenUsage/updated" (v2::ThreadTokenUsageUpdatedNotification), TurnStarted => "turn/started" (v2::TurnStartedNotification), + HookStarted => "hook/started" (v2::HookStartedNotification), TurnCompleted => "turn/completed" (v2::TurnCompletedNotification), + HookCompleted => "hook/completed" (v2::HookCompletedNotification), TurnDiffUpdated => "turn/diff/updated" (v2::TurnDiffUpdatedNotification), TurnPlanUpdated => "turn/plan/updated" (v2::TurnPlanUpdatedNotification), ItemStarted => "item/started" (v2::ItemStartedNotification), diff --git a/codex-rs/app-server-protocol/src/protocol/thread_history.rs b/codex-rs/app-server-protocol/src/protocol/thread_history.rs index 111bab84ce..170601e249 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -6,6 +6,7 @@ use crate::protocol::v2::CommandExecutionStatus; use crate::protocol::v2::DynamicToolCallOutputContentItem; use crate::protocol::v2::DynamicToolCallStatus; use crate::protocol::v2::FileUpdateChange; +use crate::protocol::v2::HookRunSummary; use crate::protocol::v2::McpToolCallError; use crate::protocol::v2::McpToolCallResult; use crate::protocol::v2::McpToolCallStatus; @@ -162,6 +163,8 @@ impl ThreadHistoryBuilder { EventMsg::ExitedReviewMode(payload) => self.handle_exited_review_mode(payload), EventMsg::ItemStarted(payload) => self.handle_item_started(payload), EventMsg::ItemCompleted(payload) => self.handle_item_completed(payload), + EventMsg::HookStarted(_) => {} + EventMsg::HookCompleted(payload) => self.handle_hook_completed(payload), EventMsg::Error(payload) => self.handle_error(payload), EventMsg::TokenCount(_) => {} EventMsg::ThreadRolledBack(payload) => self.handle_thread_rollback(payload), @@ -868,9 +871,35 @@ impl ThreadHistoryBuilder { self.next_item_index = i64::try_from(item_count.saturating_add(1)).unwrap_or(i64::MAX); } + fn handle_hook_completed(&mut self, payload: &codex_protocol::protocol::HookCompletedEvent) { + let run = HookRunSummary::from(payload.run.clone()); + if let Some(turn_id) = payload.turn_id.as_deref() { + if let Some(turn) = self.current_turn.as_mut() + && turn.id == turn_id + { + turn.hook_runs.push(run); + return; + } + + if let Some(turn) = self.turns.iter_mut().find(|turn| turn.id == turn_id) { + turn.hook_runs.push(run); + return; + } + + warn!("dropping hook run for unknown turn id `{turn_id}`"); + return; + } + + self.ensure_turn().hook_runs.push(run); + } + fn finish_current_turn(&mut self) { if let Some(turn) = self.current_turn.take() { - if turn.items.is_empty() && !turn.opened_explicitly && !turn.saw_compaction { + if turn.items.is_empty() + && turn.hook_runs.is_empty() + && !turn.opened_explicitly + && !turn.saw_compaction + { return; } self.turns.push(turn.into()); @@ -881,6 +910,7 @@ impl ThreadHistoryBuilder { PendingTurn { id: id.unwrap_or_else(|| Uuid::now_v7().to_string()), items: Vec::new(), + hook_runs: Vec::new(), error: None, status: TurnStatus::Completed, opened_explicitly: false, @@ -1040,6 +1070,7 @@ fn upsert_turn_item(items: &mut Vec, item: ThreadItem) { struct PendingTurn { id: String, items: Vec, + hook_runs: Vec, error: Option, status: TurnStatus, /// True when this turn originated from an explicit `turn_started`/`turn_complete` @@ -1067,6 +1098,7 @@ impl From for Turn { Self { id: value.id, items: value.items, + hook_runs: value.hook_runs, error: value.error, status: value.status, } @@ -1078,6 +1110,7 @@ impl From<&PendingTurn> for Turn { Self { id: value.id.clone(), items: value.items.clone(), + hook_runs: value.hook_runs.clone(), error: value.error.clone(), status: value.status.clone(), } @@ -2257,6 +2290,7 @@ mod tests { status: TurnStatus::Completed, error: None, items: Vec::new(), + hook_runs: Vec::new(), }] ); } @@ -2383,6 +2417,7 @@ mod tests { text_elements: Vec::new(), }], }], + hook_runs: Vec::new(), } ); } diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index 8f0b37beef..56d95c14d3 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -44,6 +44,14 @@ use codex_protocol::protocol::AskForApproval as CoreAskForApproval; use codex_protocol::protocol::CodexErrorInfo as CoreCodexErrorInfo; use codex_protocol::protocol::CreditsSnapshot as CoreCreditsSnapshot; use codex_protocol::protocol::ExecCommandStatus as CoreExecCommandStatus; +use codex_protocol::protocol::HookEventName as CoreHookEventName; +use codex_protocol::protocol::HookExecutionMode as CoreHookExecutionMode; +use codex_protocol::protocol::HookHandlerType as CoreHookHandlerType; +use codex_protocol::protocol::HookOutputEntry as CoreHookOutputEntry; +use codex_protocol::protocol::HookOutputEntryKind as CoreHookOutputEntryKind; +use codex_protocol::protocol::HookRunStatus as CoreHookRunStatus; +use codex_protocol::protocol::HookRunSummary as CoreHookRunSummary; +use codex_protocol::protocol::HookScope as CoreHookScope; use codex_protocol::protocol::ModelRerouteReason as CoreModelRerouteReason; use codex_protocol::protocol::NetworkAccess as CoreNetworkAccess; use codex_protocol::protocol::PatchApplyStatus as CorePatchApplyStatus; @@ -272,6 +280,98 @@ v2_enum_from_core!( } ); +v2_enum_from_core!( + pub enum HookEventName from CoreHookEventName { + SessionStart, Stop + } +); + +v2_enum_from_core!( + pub enum HookHandlerType from CoreHookHandlerType { + Command, Prompt, Agent + } +); + +v2_enum_from_core!( + pub enum HookExecutionMode from CoreHookExecutionMode { + Sync, Async + } +); + +v2_enum_from_core!( + pub enum HookScope from CoreHookScope { + Thread, Turn + } +); + +v2_enum_from_core!( + pub enum HookRunStatus from CoreHookRunStatus { + Running, Completed, Failed, Blocked, Stopped + } +); + +v2_enum_from_core!( + pub enum HookOutputEntryKind from CoreHookOutputEntryKind { + Warning, Stop, Feedback, Context, Error + } +); + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct HookOutputEntry { + pub kind: HookOutputEntryKind, + pub text: String, +} + +impl From for HookOutputEntry { + fn from(value: CoreHookOutputEntry) -> Self { + Self { + kind: value.kind.into(), + text: value.text, + } + } +} + +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct HookRunSummary { + pub id: String, + pub event_name: HookEventName, + pub handler_type: HookHandlerType, + pub execution_mode: HookExecutionMode, + pub scope: HookScope, + pub source_path: PathBuf, + pub display_order: i64, + pub status: HookRunStatus, + pub status_message: Option, + pub started_at: i64, + pub completed_at: Option, + pub duration_ms: Option, + pub entries: Vec, +} + +impl From for HookRunSummary { + fn from(value: CoreHookRunSummary) -> Self { + Self { + id: value.id, + event_name: value.event_name.into(), + handler_type: value.handler_type.into(), + execution_mode: value.execution_mode.into(), + scope: value.scope.into(), + source_path: value.source_path, + display_order: value.display_order, + status: value.status.into(), + status_message: value.status_message, + started_at: value.started_at, + completed_at: value.completed_at, + duration_ms: value.duration_ms, + entries: value.entries.into_iter().map(Into::into).collect(), + } + } +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] #[serde(tag = "type", rename_all = "camelCase")] #[ts(tag = "type")] @@ -2657,6 +2757,7 @@ pub struct Turn { /// For all other responses and notifications returning a Turn, /// the items field will be an empty list. pub items: Vec, + pub hook_runs: Vec, pub status: TurnStatus, /// Only populated when the Turn's status is failed. pub error: Option, @@ -3598,6 +3699,15 @@ pub struct TurnStartedNotification { pub turn: Turn, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct HookStartedNotification { + pub thread_id: String, + pub turn_id: Option, + pub run: HookRunSummary, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] @@ -3615,6 +3725,15 @@ pub struct TurnCompletedNotification { pub turn: Turn, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct HookCompletedNotification { + pub thread_id: String, + pub turn_id: Option, + pub run: HookRunSummary, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 3f1c392719..1f6368fe74 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -1164,6 +1164,8 @@ pub enum EventMsg { ItemStarted(ItemStartedEvent), ItemCompleted(ItemCompletedEvent), + HookStarted(HookStartedEvent), + HookCompleted(HookCompletedEvent), AgentMessageContentDelta(AgentMessageContentDeltaEvent), PlanDelta(PlanDeltaEvent), @@ -1192,6 +1194,97 @@ pub enum EventMsg { CollabResumeEnd(CollabResumeEndEvent), } +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookEventName { + SessionStart, + Stop, +} + +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookHandlerType { + Command, + Prompt, + Agent, +} + +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookExecutionMode { + Sync, + Async, +} + +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookScope { + Thread, + Turn, +} + +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookRunStatus { + Running, + Completed, + Failed, + Blocked, + Stopped, +} + +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub enum HookOutputEntryKind { + Warning, + Stop, + Feedback, + Context, + Error, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub struct HookOutputEntry { + pub kind: HookOutputEntryKind, + pub text: String, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub struct HookRunSummary { + pub id: String, + pub event_name: HookEventName, + pub handler_type: HookHandlerType, + pub execution_mode: HookExecutionMode, + pub scope: HookScope, + pub source_path: PathBuf, + pub display_order: i64, + pub status: HookRunStatus, + pub status_message: Option, + #[ts(type = "number")] + pub started_at: i64, + #[ts(type = "number | null")] + pub completed_at: Option, + #[ts(type = "number | null")] + pub duration_ms: Option, + pub entries: Vec, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub struct HookStartedEvent { + pub turn_id: Option, + pub run: HookRunSummary, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] +#[serde(rename_all = "snake_case")] +pub struct HookCompletedEvent { + pub turn_id: Option, + pub run: HookRunSummary, +} + #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] pub struct RealtimeConversationStartedEvent { pub session_id: Option,