diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index d391cac165..28ad545065 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -5268,6 +5268,29 @@ "title": "Thread/listRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "threadCatalog/subscribe" + ], + "title": "ThreadCatalog/subscribeRequestMethod", + "type": "string" + }, + "params": { + "type": "null" + } + }, + "required": [ + "id", + "method" + ], + "title": "ThreadCatalog/subscribeRequest", + "type": "object" + }, { "properties": { "id": { diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index e025a61a33..b799812160 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -3825,6 +3825,66 @@ ], "type": "object" }, + "ThreadCatalogChangedNotification": { + "oneOf": [ + { + "properties": { + "thread": { + "$ref": "#/definitions/ThreadSummary" + }, + "type": { + "enum": [ + "upsert" + ], + "title": "UpsertThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "thread", + "type" + ], + "title": "UpsertThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "threadId": { + "type": "string" + }, + "type": { + "enum": [ + "delete" + ], + "title": "DeleteThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "threadId", + "type" + ], + "title": "DeleteThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "invalidate" + ], + "title": "InvalidateThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "InvalidateThreadCatalogChangedNotification", + "type": "object" + } + ] + }, "ThreadClosedNotification": { "properties": { "threadId": { @@ -5090,6 +5150,125 @@ ], "type": "object" }, + "ThreadSummary": { + "description": "Persisted metadata needed to render and order a thread catalog row.", + "properties": { + "agentNickname": { + "type": [ + "string", + "null" + ] + }, + "agentRole": { + "type": [ + "string", + "null" + ] + }, + "archivedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "createdAt": { + "format": "int64", + "type": "integer" + }, + "createdAtMs": { + "format": "int64", + "type": "integer" + }, + "cwd": { + "$ref": "#/definitions/AbsolutePathBuf" + }, + "forkedFromId": { + "type": [ + "string", + "null" + ] + }, + "gitInfo": { + "anyOf": [ + { + "$ref": "#/definitions/GitInfo" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "modelProvider": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "parentThreadId": { + "type": [ + "string", + "null" + ] + }, + "preview": { + "type": "string" + }, + "recencyAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "recencyAtMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "source": { + "$ref": "#/definitions/SessionSource" + }, + "threadSource": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadSource" + }, + { + "type": "null" + } + ] + }, + "updatedAt": { + "format": "int64", + "type": "integer" + }, + "updatedAtMs": { + "format": "int64", + "type": "integer" + } + }, + "required": [ + "createdAt", + "createdAtMs", + "cwd", + "id", + "modelProvider", + "preview", + "source", + "updatedAt", + "updatedAtMs" + ], + "type": "object" + }, "ThreadTokenUsage": { "properties": { "last": { @@ -5860,6 +6039,26 @@ "title": "Thread/unarchivedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "threadCatalog/changed" + ], + "title": "ThreadCatalog/changedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ThreadCatalogChangedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "ThreadCatalog/changedNotification", + "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 b7526b080d..9004b38463 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 @@ -636,6 +636,29 @@ "title": "Thread/listRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/v2/RequestId" + }, + "method": { + "enum": [ + "threadCatalog/subscribe" + ], + "title": "ThreadCatalog/subscribeRequestMethod", + "type": "string" + }, + "params": { + "type": "null" + } + }, + "required": [ + "id", + "method" + ], + "title": "ThreadCatalog/subscribeRequest", + "type": "object" + }, { "properties": { "id": { @@ -4228,6 +4251,26 @@ "title": "Thread/unarchivedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "threadCatalog/changed" + ], + "title": "ThreadCatalog/changedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/v2/ThreadCatalogChangedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "ThreadCatalog/changedNotification", + "type": "object" + }, { "properties": { "method": { @@ -17317,6 +17360,73 @@ "title": "ThreadArchivedNotification", "type": "object" }, + "ThreadCatalogChangedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "oneOf": [ + { + "properties": { + "thread": { + "$ref": "#/definitions/v2/ThreadSummary" + }, + "type": { + "enum": [ + "upsert" + ], + "title": "Upsertv2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "thread", + "type" + ], + "title": "Upsertv2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "threadId": { + "type": "string" + }, + "type": { + "enum": [ + "delete" + ], + "title": "Deletev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "threadId", + "type" + ], + "title": "Deletev2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "invalidate" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotification", + "type": "object" + } + ], + "title": "ThreadCatalogChangedNotification" + }, + "ThreadCatalogSubscribeResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThreadCatalogSubscribeResponse", + "type": "object" + }, "ThreadClosedNotification": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { @@ -19816,6 +19926,125 @@ "title": "ThreadStatusChangedNotification", "type": "object" }, + "ThreadSummary": { + "description": "Persisted metadata needed to render and order a thread catalog row.", + "properties": { + "agentNickname": { + "type": [ + "string", + "null" + ] + }, + "agentRole": { + "type": [ + "string", + "null" + ] + }, + "archivedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "createdAt": { + "format": "int64", + "type": "integer" + }, + "createdAtMs": { + "format": "int64", + "type": "integer" + }, + "cwd": { + "$ref": "#/definitions/v2/AbsolutePathBuf" + }, + "forkedFromId": { + "type": [ + "string", + "null" + ] + }, + "gitInfo": { + "anyOf": [ + { + "$ref": "#/definitions/v2/GitInfo" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "modelProvider": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "parentThreadId": { + "type": [ + "string", + "null" + ] + }, + "preview": { + "type": "string" + }, + "recencyAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "recencyAtMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "source": { + "$ref": "#/definitions/v2/SessionSource" + }, + "threadSource": { + "anyOf": [ + { + "$ref": "#/definitions/v2/ThreadSource" + }, + { + "type": "null" + } + ] + }, + "updatedAt": { + "format": "int64", + "type": "integer" + }, + "updatedAtMs": { + "format": "int64", + "type": "integer" + } + }, + "required": [ + "createdAt", + "createdAtMs", + "cwd", + "id", + "modelProvider", + "preview", + "source", + "updatedAt", + "updatedAtMs" + ], + "type": "object" + }, "ThreadTokenUsage": { "properties": { "last": { 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 e1afc7883a..10dd2b70c0 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 @@ -1674,6 +1674,29 @@ "title": "Thread/listRequest", "type": "object" }, + { + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "method": { + "enum": [ + "threadCatalog/subscribe" + ], + "title": "ThreadCatalog/subscribeRequestMethod", + "type": "string" + }, + "params": { + "type": "null" + } + }, + "required": [ + "id", + "method" + ], + "title": "ThreadCatalog/subscribeRequest", + "type": "object" + }, { "properties": { "id": { @@ -12943,6 +12966,26 @@ "title": "Thread/unarchivedNotification", "type": "object" }, + { + "properties": { + "method": { + "enum": [ + "threadCatalog/changed" + ], + "title": "ThreadCatalog/changedNotificationMethod", + "type": "string" + }, + "params": { + "$ref": "#/definitions/ThreadCatalogChangedNotification" + } + }, + "required": [ + "method", + "params" + ], + "title": "ThreadCatalog/changedNotification", + "type": "object" + }, { "properties": { "method": { @@ -15096,6 +15139,73 @@ "title": "ThreadArchivedNotification", "type": "object" }, + "ThreadCatalogChangedNotification": { + "$schema": "http://json-schema.org/draft-07/schema#", + "oneOf": [ + { + "properties": { + "thread": { + "$ref": "#/definitions/ThreadSummary" + }, + "type": { + "enum": [ + "upsert" + ], + "title": "Upsertv2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "thread", + "type" + ], + "title": "Upsertv2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "threadId": { + "type": "string" + }, + "type": { + "enum": [ + "delete" + ], + "title": "Deletev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "threadId", + "type" + ], + "title": "Deletev2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "invalidate" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotification", + "type": "object" + } + ], + "title": "ThreadCatalogChangedNotification" + }, + "ThreadCatalogSubscribeResponse": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThreadCatalogSubscribeResponse", + "type": "object" + }, "ThreadClosedNotification": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { @@ -17595,6 +17705,125 @@ "title": "ThreadStatusChangedNotification", "type": "object" }, + "ThreadSummary": { + "description": "Persisted metadata needed to render and order a thread catalog row.", + "properties": { + "agentNickname": { + "type": [ + "string", + "null" + ] + }, + "agentRole": { + "type": [ + "string", + "null" + ] + }, + "archivedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "createdAt": { + "format": "int64", + "type": "integer" + }, + "createdAtMs": { + "format": "int64", + "type": "integer" + }, + "cwd": { + "$ref": "#/definitions/AbsolutePathBuf" + }, + "forkedFromId": { + "type": [ + "string", + "null" + ] + }, + "gitInfo": { + "anyOf": [ + { + "$ref": "#/definitions/GitInfo" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "modelProvider": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "parentThreadId": { + "type": [ + "string", + "null" + ] + }, + "preview": { + "type": "string" + }, + "recencyAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "recencyAtMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "source": { + "$ref": "#/definitions/SessionSource" + }, + "threadSource": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadSource" + }, + { + "type": "null" + } + ] + }, + "updatedAt": { + "format": "int64", + "type": "integer" + }, + "updatedAtMs": { + "format": "int64", + "type": "integer" + } + }, + "required": [ + "createdAt", + "createdAtMs", + "cwd", + "id", + "modelProvider", + "preview", + "source", + "updatedAt", + "updatedAtMs" + ], + "type": "object" + }, "ThreadTokenUsage": { "properties": { "last": { diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogChangedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogChangedNotification.json new file mode 100644 index 0000000000..7320c15eca --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogChangedNotification.json @@ -0,0 +1,335 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "AbsolutePathBuf": { + "description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.", + "type": "string" + }, + "AgentPath": { + "type": "string" + }, + "GitInfo": { + "properties": { + "branch": { + "type": [ + "string", + "null" + ] + }, + "originUrl": { + "type": [ + "string", + "null" + ] + }, + "sha": { + "type": [ + "string", + "null" + ] + } + }, + "type": "object" + }, + "SessionSource": { + "oneOf": [ + { + "enum": [ + "cli", + "vscode", + "exec", + "appServer", + "unknown" + ], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "custom": { + "type": "string" + } + }, + "required": [ + "custom" + ], + "title": "CustomSessionSource", + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "subAgent": { + "$ref": "#/definitions/SubAgentSource" + } + }, + "required": [ + "subAgent" + ], + "title": "SubAgentSessionSource", + "type": "object" + } + ] + }, + "SubAgentSource": { + "oneOf": [ + { + "enum": [ + "review", + "compact", + "memory_consolidation" + ], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "thread_spawn": { + "properties": { + "agent_nickname": { + "default": null, + "type": [ + "string", + "null" + ] + }, + "agent_path": { + "anyOf": [ + { + "$ref": "#/definitions/AgentPath" + }, + { + "type": "null" + } + ], + "default": null + }, + "agent_role": { + "default": null, + "type": [ + "string", + "null" + ] + }, + "depth": { + "format": "int32", + "type": "integer" + }, + "parent_thread_id": { + "$ref": "#/definitions/ThreadId" + } + }, + "required": [ + "depth", + "parent_thread_id" + ], + "type": "object" + } + }, + "required": [ + "thread_spawn" + ], + "title": "ThreadSpawnSubAgentSource", + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "other": { + "type": "string" + } + }, + "required": [ + "other" + ], + "title": "OtherSubAgentSource", + "type": "object" + } + ] + }, + "ThreadId": { + "type": "string" + }, + "ThreadSource": { + "type": "string" + }, + "ThreadSummary": { + "description": "Persisted metadata needed to render and order a thread catalog row.", + "properties": { + "agentNickname": { + "type": [ + "string", + "null" + ] + }, + "agentRole": { + "type": [ + "string", + "null" + ] + }, + "archivedAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "createdAt": { + "format": "int64", + "type": "integer" + }, + "createdAtMs": { + "format": "int64", + "type": "integer" + }, + "cwd": { + "$ref": "#/definitions/AbsolutePathBuf" + }, + "forkedFromId": { + "type": [ + "string", + "null" + ] + }, + "gitInfo": { + "anyOf": [ + { + "$ref": "#/definitions/GitInfo" + }, + { + "type": "null" + } + ] + }, + "id": { + "type": "string" + }, + "modelProvider": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "parentThreadId": { + "type": [ + "string", + "null" + ] + }, + "preview": { + "type": "string" + }, + "recencyAt": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "recencyAtMs": { + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "source": { + "$ref": "#/definitions/SessionSource" + }, + "threadSource": { + "anyOf": [ + { + "$ref": "#/definitions/ThreadSource" + }, + { + "type": "null" + } + ] + }, + "updatedAt": { + "format": "int64", + "type": "integer" + }, + "updatedAtMs": { + "format": "int64", + "type": "integer" + } + }, + "required": [ + "createdAt", + "createdAtMs", + "cwd", + "id", + "modelProvider", + "preview", + "source", + "updatedAt", + "updatedAtMs" + ], + "type": "object" + } + }, + "oneOf": [ + { + "properties": { + "thread": { + "$ref": "#/definitions/ThreadSummary" + }, + "type": { + "enum": [ + "upsert" + ], + "title": "Upsertv2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "thread", + "type" + ], + "title": "Upsertv2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "threadId": { + "type": "string" + }, + "type": { + "enum": [ + "delete" + ], + "title": "Deletev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "threadId", + "type" + ], + "title": "Deletev2::ThreadCatalogChangedNotification", + "type": "object" + }, + { + "properties": { + "type": { + "enum": [ + "invalidate" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotificationType", + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "Invalidatev2::ThreadCatalogChangedNotification", + "type": "object" + } + ], + "title": "ThreadCatalogChangedNotification" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogSubscribeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogSubscribeResponse.json new file mode 100644 index 0000000000..35205001bd --- /dev/null +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadCatalogSubscribeResponse.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThreadCatalogSubscribeResponse", + "type": "object" +} \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts index 6af04ef401..6b751a9181 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts @@ -88,4 +88,4 @@ import type { WindowsSandboxSetupStartParams } from "./v2/WindowsSandboxSetupSta /** * Request from the client to the server. */ -export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/delete", id: RequestId, params: ThreadDeleteParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/goal/set", id: RequestId, params: ThreadGoalSetParams, } | { "method": "thread/goal/get", id: RequestId, params: ThreadGoalGetParams, } | { "method": "thread/goal/clear", id: RequestId, params: ThreadGoalClearParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/approveGuardianDeniedAction", id: RequestId, params: ThreadApproveGuardianDeniedActionParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "thread/inject_items", id: RequestId, params: ThreadInjectItemsParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/extraRoots/set", id: RequestId, params: SkillsExtraRootsSetParams, } | { "method": "hooks/list", id: RequestId, params: HooksListParams, } | { "method": "marketplace/add", id: RequestId, params: MarketplaceAddParams, } | { "method": "marketplace/remove", id: RequestId, params: MarketplaceRemoveParams, } | { "method": "marketplace/upgrade", id: RequestId, params: MarketplaceUpgradeParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/installed", id: RequestId, params: PluginInstalledParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "plugin/skill/read", id: RequestId, params: PluginSkillReadParams, } | { "method": "plugin/share/save", id: RequestId, params: PluginShareSaveParams, } | { "method": "plugin/share/updateTargets", id: RequestId, params: PluginShareUpdateTargetsParams, } | { "method": "plugin/share/list", id: RequestId, params: PluginShareListParams, } | { "method": "plugin/share/checkout", id: RequestId, params: PluginShareCheckoutParams, } | { "method": "plugin/share/delete", id: RequestId, params: PluginShareDeleteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "modelProvider/capabilities/read", id: RequestId, params: ModelProviderCapabilitiesReadParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "permissionProfile/list", id: RequestId, params: PermissionProfileListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "mcpServer/resource/read", id: RequestId, params: McpResourceReadParams, } | { "method": "mcpServer/tool/call", id: RequestId, params: McpServerToolCallParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "windowsSandbox/readiness", id: RequestId, params: undefined, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "account/rateLimitResetCredit/consume", id: RequestId, params: ConsumeAccountRateLimitResetCreditParams, } | { "method": "account/usage/read", id: RequestId, params: undefined, } | { "method": "account/workspaceMessages/read", id: RequestId, params: undefined, } | { "method": "account/sendAddCreditsNudgeEmail", id: RequestId, params: SendAddCreditsNudgeEmailParams, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "externalAgentConfig/import/readHistories", id: RequestId, params: undefined, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, }; +export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/delete", id: RequestId, params: ThreadDeleteParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/goal/set", id: RequestId, params: ThreadGoalSetParams, } | { "method": "thread/goal/get", id: RequestId, params: ThreadGoalGetParams, } | { "method": "thread/goal/clear", id: RequestId, params: ThreadGoalClearParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/approveGuardianDeniedAction", id: RequestId, params: ThreadApproveGuardianDeniedActionParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "threadCatalog/subscribe", id: RequestId, params: undefined, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "thread/inject_items", id: RequestId, params: ThreadInjectItemsParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/extraRoots/set", id: RequestId, params: SkillsExtraRootsSetParams, } | { "method": "hooks/list", id: RequestId, params: HooksListParams, } | { "method": "marketplace/add", id: RequestId, params: MarketplaceAddParams, } | { "method": "marketplace/remove", id: RequestId, params: MarketplaceRemoveParams, } | { "method": "marketplace/upgrade", id: RequestId, params: MarketplaceUpgradeParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/installed", id: RequestId, params: PluginInstalledParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "plugin/skill/read", id: RequestId, params: PluginSkillReadParams, } | { "method": "plugin/share/save", id: RequestId, params: PluginShareSaveParams, } | { "method": "plugin/share/updateTargets", id: RequestId, params: PluginShareUpdateTargetsParams, } | { "method": "plugin/share/list", id: RequestId, params: PluginShareListParams, } | { "method": "plugin/share/checkout", id: RequestId, params: PluginShareCheckoutParams, } | { "method": "plugin/share/delete", id: RequestId, params: PluginShareDeleteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "modelProvider/capabilities/read", id: RequestId, params: ModelProviderCapabilitiesReadParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "permissionProfile/list", id: RequestId, params: PermissionProfileListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "mcpServer/resource/read", id: RequestId, params: McpResourceReadParams, } | { "method": "mcpServer/tool/call", id: RequestId, params: McpServerToolCallParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "windowsSandbox/readiness", id: RequestId, params: undefined, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params: undefined, } | { "method": "account/rateLimitResetCredit/consume", id: RequestId, params: ConsumeAccountRateLimitResetCreditParams, } | { "method": "account/usage/read", id: RequestId, params: undefined, } | { "method": "account/workspaceMessages/read", id: RequestId, params: undefined, } | { "method": "account/sendAddCreditsNudgeEmail", id: RequestId, params: SendAddCreditsNudgeEmailParams, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "externalAgentConfig/import/readHistories", id: RequestId, params: undefined, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, }; diff --git a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts index f3f828b8ac..3683a903ca 100644 --- a/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts +++ b/codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts @@ -44,6 +44,7 @@ import type { ServerRequestResolvedNotification } from "./v2/ServerRequestResolv import type { SkillsChangedNotification } from "./v2/SkillsChangedNotification"; import type { TerminalInteractionNotification } from "./v2/TerminalInteractionNotification"; import type { ThreadArchivedNotification } from "./v2/ThreadArchivedNotification"; +import type { ThreadCatalogChangedNotification } from "./v2/ThreadCatalogChangedNotification"; import type { ThreadClosedNotification } from "./v2/ThreadClosedNotification"; import type { ThreadDeletedNotification } from "./v2/ThreadDeletedNotification"; import type { ThreadGoalClearedNotification } from "./v2/ThreadGoalClearedNotification"; @@ -74,4 +75,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/deleted", "params": ThreadDeletedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "skills/changed", "params": SkillsChangedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/goal/updated", "params": ThreadGoalUpdatedNotification } | { "method": "thread/goal/cleared", "params": ThreadGoalClearedNotification } | { "method": "thread/settings/updated", "params": ThreadSettingsUpdatedNotification } | { "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/autoApprovalReview/started", "params": ItemGuardianApprovalReviewStartedNotification } | { "method": "item/autoApprovalReview/completed", "params": ItemGuardianApprovalReviewCompletedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "command/exec/outputDelta", "params": CommandExecOutputDeltaNotification } | { "method": "process/outputDelta", "params": ProcessOutputDeltaNotification } | { "method": "process/exited", "params": ProcessExitedNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/fileChange/patchUpdated", "params": FileChangePatchUpdatedNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "mcpServer/startupStatus/updated", "params": McpServerStatusUpdatedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "remoteControl/status/changed", "params": RemoteControlStatusChangedNotification } | { "method": "externalAgentConfig/import/progress", "params": ExternalAgentConfigImportProgressNotification } | { "method": "externalAgentConfig/import/completed", "params": ExternalAgentConfigImportCompletedNotification } | { "method": "fs/changed", "params": FsChangedNotification } | { "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": "model/verification", "params": ModelVerificationNotification } | { "method": "turn/moderationMetadata", "params": TurnModerationMetadataNotification } | { "method": "model/safetyBuffering/updated", "params": ModelSafetyBufferingUpdatedNotification } | { "method": "warning", "params": WarningNotification } | { "method": "guardianWarning", "params": GuardianWarningNotification } | { "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/transcript/delta", "params": ThreadRealtimeTranscriptDeltaNotification } | { "method": "thread/realtime/transcript/done", "params": ThreadRealtimeTranscriptDoneNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/sdp", "params": ThreadRealtimeSdpNotification } | { "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/deleted", "params": ThreadDeletedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "threadCatalog/changed", "params": ThreadCatalogChangedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "skills/changed", "params": SkillsChangedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/goal/updated", "params": ThreadGoalUpdatedNotification } | { "method": "thread/goal/cleared", "params": ThreadGoalClearedNotification } | { "method": "thread/settings/updated", "params": ThreadSettingsUpdatedNotification } | { "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/autoApprovalReview/started", "params": ItemGuardianApprovalReviewStartedNotification } | { "method": "item/autoApprovalReview/completed", "params": ItemGuardianApprovalReviewCompletedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "command/exec/outputDelta", "params": CommandExecOutputDeltaNotification } | { "method": "process/outputDelta", "params": ProcessOutputDeltaNotification } | { "method": "process/exited", "params": ProcessExitedNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/fileChange/patchUpdated", "params": FileChangePatchUpdatedNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "mcpServer/startupStatus/updated", "params": McpServerStatusUpdatedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "remoteControl/status/changed", "params": RemoteControlStatusChangedNotification } | { "method": "externalAgentConfig/import/progress", "params": ExternalAgentConfigImportProgressNotification } | { "method": "externalAgentConfig/import/completed", "params": ExternalAgentConfigImportCompletedNotification } | { "method": "fs/changed", "params": FsChangedNotification } | { "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": "model/verification", "params": ModelVerificationNotification } | { "method": "turn/moderationMetadata", "params": TurnModerationMetadataNotification } | { "method": "model/safetyBuffering/updated", "params": ModelSafetyBufferingUpdatedNotification } | { "method": "warning", "params": WarningNotification } | { "method": "guardianWarning", "params": GuardianWarningNotification } | { "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/transcript/delta", "params": ThreadRealtimeTranscriptDeltaNotification } | { "method": "thread/realtime/transcript/done", "params": ThreadRealtimeTranscriptDoneNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/sdp", "params": ThreadRealtimeSdpNotification } | { "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/v2/ThreadCatalogChangedNotification.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadCatalogChangedNotification.ts new file mode 100644 index 0000000000..6427e5f03e --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadCatalogChangedNotification.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 { ThreadSummary } from "./ThreadSummary"; + +export type ThreadCatalogChangedNotification = { "type": "upsert", thread: ThreadSummary, } | { "type": "delete", threadId: string, } | { "type": "invalidate" }; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadCatalogSubscribeResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadCatalogSubscribeResponse.ts new file mode 100644 index 0000000000..3050a2dad0 --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadCatalogSubscribeResponse.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 ThreadCatalogSubscribeResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadSummary.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadSummary.ts new file mode 100644 index 0000000000..165f0752bb --- /dev/null +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadSummary.ts @@ -0,0 +1,12 @@ +// 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 { AbsolutePathBuf } from "../AbsolutePathBuf"; +import type { GitInfo } from "./GitInfo"; +import type { SessionSource } from "./SessionSource"; +import type { ThreadSource } from "./ThreadSource"; + +/** + * Persisted metadata needed to render and order a thread catalog row. + */ +export type ThreadSummary = { id: string, forkedFromId: string | null, parentThreadId: string | null, preview: string, modelProvider: string, createdAt: number, createdAtMs: number, updatedAt: number, updatedAtMs: number, recencyAt: number | null, recencyAtMs: number | null, archivedAt: number | null, cwd: AbsolutePathBuf, source: SessionSource, threadSource: ThreadSource | null, agentNickname: string | null, agentRole: string | null, gitInfo: GitInfo | null, name: string | null, }; 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 070d21eab8..50a3f16d24 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -398,6 +398,8 @@ export type { ThreadApproveGuardianDeniedActionResponse } from "./ThreadApproveG export type { ThreadArchiveParams } from "./ThreadArchiveParams"; export type { ThreadArchiveResponse } from "./ThreadArchiveResponse"; export type { ThreadArchivedNotification } from "./ThreadArchivedNotification"; +export type { ThreadCatalogChangedNotification } from "./ThreadCatalogChangedNotification"; +export type { ThreadCatalogSubscribeResponse } from "./ThreadCatalogSubscribeResponse"; export type { ThreadClosedNotification } from "./ThreadClosedNotification"; export type { ThreadCompactStartParams } from "./ThreadCompactStartParams"; export type { ThreadCompactStartResponse } from "./ThreadCompactStartResponse"; @@ -462,6 +464,7 @@ export type { ThreadStartSource } from "./ThreadStartSource"; export type { ThreadStartedNotification } from "./ThreadStartedNotification"; export type { ThreadStatus } from "./ThreadStatus"; export type { ThreadStatusChangedNotification } from "./ThreadStatusChangedNotification"; +export type { ThreadSummary } from "./ThreadSummary"; export type { ThreadTokenUsage } from "./ThreadTokenUsage"; export type { ThreadTokenUsageUpdatedNotification } from "./ThreadTokenUsageUpdatedNotification"; export type { ThreadUnarchiveParams } from "./ThreadUnarchiveParams"; diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index 27a8b0205d..0360f227ff 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -624,6 +624,11 @@ client_request_definitions! { serialization: None, response: v2::ThreadListResponse, }, + ThreadCatalogSubscribe => "threadCatalog/subscribe" { + params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, + serialization: None, + response: v2::ThreadCatalogSubscribeResponse, + }, #[experimental("thread/search")] ThreadSearch => "thread/search" { params: v2::ThreadSearchParams, @@ -1618,6 +1623,7 @@ server_notification_definitions! { ThreadArchived => "thread/archived" (v2::ThreadArchivedNotification), ThreadDeleted => "thread/deleted" (v2::ThreadDeletedNotification), ThreadUnarchived => "thread/unarchived" (v2::ThreadUnarchivedNotification), + ThreadCatalogChanged => "threadCatalog/changed" (v2::ThreadCatalogChangedNotification), ThreadClosed => "thread/closed" (v2::ThreadClosedNotification), SkillsChanged => "skills/changed" (v2::SkillsChangedNotification), ThreadNameUpdated => "thread/name/updated" (v2::ThreadNameUpdatedNotification), diff --git a/codex-rs/app-server-protocol/src/protocol/v2/thread.rs b/codex-rs/app-server-protocol/src/protocol/v2/thread.rs index 367a4a64c8..8f5972ec68 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/thread.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/thread.rs @@ -7,6 +7,7 @@ use super::Thread; use super::ThreadHistoryMode; use super::ThreadItem; use super::ThreadSource; +use super::ThreadSummary; use super::Turn; use super::TurnEnvironmentParams; use super::TurnItemsView; @@ -1200,6 +1201,11 @@ pub struct ThreadListResponse { pub backwards_cursor: Option, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ThreadCatalogSubscribeResponse {} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] @@ -1461,6 +1467,22 @@ pub struct ThreadUnarchivedNotification { pub thread_id: String, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(tag = "type", rename_all = "camelCase")] +#[ts(tag = "type", rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub enum ThreadCatalogChangedNotification { + Upsert { + thread: Box, + }, + #[serde(rename_all = "camelCase")] + #[ts(rename_all = "camelCase")] + Delete { + thread_id: String, + }, + Invalidate, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs b/codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs index 2393efb25c..f4dd38214d 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs @@ -225,6 +225,39 @@ pub struct Thread { pub turns: Vec, } +/// Persisted metadata needed to render and order a thread catalog row. +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +#[ts(export_to = "v2/")] +pub struct ThreadSummary { + pub id: String, + pub forked_from_id: Option, + pub parent_thread_id: Option, + pub preview: String, + pub model_provider: String, + #[ts(type = "number")] + pub created_at: i64, + #[ts(type = "number")] + pub created_at_ms: i64, + #[ts(type = "number")] + pub updated_at: i64, + #[ts(type = "number")] + pub updated_at_ms: i64, + #[ts(type = "number | null")] + pub recency_at: Option, + #[ts(type = "number | null")] + pub recency_at_ms: Option, + #[ts(type = "number | null")] + pub archived_at: Option, + pub cwd: AbsolutePathBuf, + pub source: SessionSource, + pub thread_source: Option, + pub agent_nickname: Option, + pub agent_role: Option, + pub git_info: Option, + pub name: Option, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] diff --git a/codex-rs/app-server/README.md b/codex-rs/app-server/README.md index 6ee6baf2dc..33617ad14a 100644 --- a/codex-rs/app-server/README.md +++ b/codex-rs/app-server/README.md @@ -404,6 +404,17 @@ Example: When `nextCursor` is `null`, you’ve reached the final page. +To keep a paginated catalog current, call `threadCatalog/subscribe` before the initial +`thread/list`. The response only acknowledges future notifications; it does not replay existing +threads. Registration completes before the response is sent, so clients should buffer catalog +notifications until their list request completes and apply `threadCatalog/changed` summaries +idempotently. Its `upsert` variant contains the complete row, `delete` removes a row, and +`invalidate` means the client fell behind and must refetch its catalog view. Reconnects require +another subscribe and list sequence. + +`threadCatalog/changed` contains persisted sidebar metadata only. It never contains turns, items, +messages, deltas, tool state, or loaded runtime status. + ### Example: List descendant threads Enable `capabilities.experimentalApi` during initialization, then use `thread/list` with `ancestorThreadId` to page through every spawned descendant of a thread from persisted spawn-edge state. The ancestor itself is excluded, and each result's `parentThreadId` remains its immediate parent. Use `parentThreadId` instead when only direct children are wanted; sending both filters is invalid. Review and Guardian threads are not included because they do not participate in the spawn-edge lifecycle. When `modelProviders` or `sourceKinds` is omitted, relationship-filtered requests include every provider or source kind, respectively. Explicit filters retain the ordinary `thread/list` behavior, including the interactive-only default for an empty `sourceKinds` list. diff --git a/codex-rs/app-server/src/in_process.rs b/codex-rs/app-server/src/in_process.rs index d8a2bc2276..b6dd700d13 100644 --- a/codex-rs/app-server/src/in_process.rs +++ b/codex-rs/app-server/src/in_process.rs @@ -107,6 +107,7 @@ fn server_notification_requires_delivery(notification: &ServerNotification) -> b notification, ServerNotification::TurnCompleted(_) | ServerNotification::ThreadSettingsUpdated(_) + | ServerNotification::ThreadCatalogChanged(_) | ServerNotification::ExternalAgentConfigImportCompleted(_) ) } @@ -743,6 +744,7 @@ mod tests { use codex_app_server_protocol::ConfigRequirementsReadResponse; use codex_app_server_protocol::ExternalAgentConfigImportCompletedNotification; use codex_app_server_protocol::SessionSource as ApiSessionSource; + use codex_app_server_protocol::ThreadCatalogChangedNotification; use codex_app_server_protocol::ThreadStartParams; use codex_app_server_protocol::ThreadStartResponse; use codex_app_server_protocol::Turn; @@ -914,5 +916,8 @@ mod tests { }, ) )); + assert!(server_notification_requires_delivery( + &ServerNotification::ThreadCatalogChanged(ThreadCatalogChangedNotification::Invalidate,) + )); } } diff --git a/codex-rs/app-server/src/lib.rs b/codex-rs/app-server/src/lib.rs index 91da0c1645..30e34c277b 100644 --- a/codex-rs/app-server/src/lib.rs +++ b/codex-rs/app-server/src/lib.rs @@ -111,6 +111,7 @@ mod request_processors; mod request_serialization; mod server_request_error; mod skills_watcher; +mod thread_catalog; mod thread_state; mod thread_status; mod transport; diff --git a/codex-rs/app-server/src/message_processor.rs b/codex-rs/app-server/src/message_processor.rs index ca122920bd..b3da322971 100644 --- a/codex-rs/app-server/src/message_processor.rs +++ b/codex-rs/app-server/src/message_processor.rs @@ -44,6 +44,7 @@ use crate::request_serialization::QueuedInitializedRequest; use crate::request_serialization::RequestSerializationQueueKey; use crate::request_serialization::RequestSerializationQueues; use crate::skills_watcher::SkillsWatcher; +use crate::thread_catalog::ThreadCatalogSubscriptions; use crate::thread_state::ConnectionCapabilities; use crate::thread_state::ThreadStateManager; use crate::transport::AppServerTransport; @@ -60,6 +61,7 @@ use codex_app_server_protocol::JSONRPCErrorError; use codex_app_server_protocol::JSONRPCNotification; use codex_app_server_protocol::JSONRPCRequest; use codex_app_server_protocol::JSONRPCResponse; +use codex_app_server_protocol::ThreadCatalogSubscribeResponse; use codex_app_server_protocol::experimental_required_message; use codex_arg0::Arg0DispatchPaths; use codex_chatgpt::workspace_settings; @@ -121,6 +123,7 @@ pub(crate) struct MessageProcessor { remote_control_processor: RemoteControlRequestProcessor, search_processor: SearchRequestProcessor, thread_goal_processor: ThreadGoalRequestProcessor, + thread_catalog_subscriptions: ThreadCatalogSubscriptions, thread_processor: ThreadRequestProcessor, turn_processor: TurnRequestProcessor, windows_sandbox_processor: WindowsSandboxRequestProcessor, @@ -248,6 +251,12 @@ impl MessageProcessor { // affect per-thread behavior, but they must not move newly started, // resumed, or forked threads to a different persistence backend/root. let thread_store = codex_core::thread_store_from_config(config.as_ref(), state_db.clone()); + let thread_catalog_subscriptions = ThreadCatalogSubscriptions::new( + outgoing.clone(), + Arc::clone(&thread_store), + config.model_provider_id.clone(), + config.cwd.clone(), + ); let environment_manager_for_requests = Arc::clone(&environment_manager); let environment_manager_for_extensions = Arc::clone(&environment_manager); let restriction_product = session_source.restriction_product(); @@ -488,6 +497,7 @@ impl MessageProcessor { remote_control_processor, search_processor, thread_goal_processor, + thread_catalog_subscriptions, thread_processor, turn_processor, windows_sandbox_processor, @@ -718,6 +728,9 @@ impl MessageProcessor { .connection_closed(connection_id) .await; self.thread_processor.connection_closed(connection_id).await; + self.thread_catalog_subscriptions + .connection_closed(connection_id) + .await; } pub(crate) fn subscribe_running_assistant_turn_count(&self) -> watch::Receiver { @@ -1128,6 +1141,12 @@ impl MessageProcessor { ClientRequest::ThreadList { params, .. } => { self.thread_processor.thread_list(params).await } + ClientRequest::ThreadCatalogSubscribe { .. } => { + self.thread_catalog_subscriptions + .subscribe(connection_id) + .await; + Ok(Some(ThreadCatalogSubscribeResponse {}.into())) + } ClientRequest::ThreadSearch { params, .. } => { self.thread_processor.thread_search(params).await } diff --git a/codex-rs/app-server/src/thread_catalog.rs b/codex-rs/app-server/src/thread_catalog.rs new file mode 100644 index 0000000000..54d29e36ca --- /dev/null +++ b/codex-rs/app-server/src/thread_catalog.rs @@ -0,0 +1,157 @@ +use std::collections::HashSet; +use std::sync::Arc; +use std::sync::Weak; + +use codex_app_server_protocol::ServerNotification; +use codex_app_server_protocol::ThreadCatalogChangedNotification; +use codex_app_server_protocol::ThreadSummary; +use codex_thread_store::ReadThreadParams; +use codex_thread_store::ThreadCatalogChange; +use codex_thread_store::ThreadStore; +use codex_utils_absolute_path::AbsolutePathBuf; +use tokio::sync::Mutex; +use tokio::sync::broadcast::error::RecvError; +use tracing::warn; + +use crate::outgoing_message::ConnectionId; +use crate::outgoing_message::OutgoingMessageSender; +use crate::request_processors::thread_from_stored_thread; + +#[derive(Clone)] +pub(crate) struct ThreadCatalogSubscriptions { + connection_ids: Arc>>, +} + +impl ThreadCatalogSubscriptions { + pub(crate) fn new( + outgoing: Arc, + thread_store: Arc, + fallback_provider: String, + fallback_cwd: AbsolutePathBuf, + ) -> Self { + let connection_ids = Arc::new(Mutex::new(HashSet::new())); + let changes = thread_store.subscribe_catalog_changes(); + tokio::spawn(run_catalog_listener( + changes, + Arc::downgrade(&thread_store), + Arc::clone(&outgoing), + Arc::clone(&connection_ids), + fallback_provider, + fallback_cwd, + )); + Self { connection_ids } + } + + pub(crate) async fn subscribe(&self, connection_id: ConnectionId) { + self.connection_ids.lock().await.insert(connection_id); + } + + pub(crate) async fn connection_closed(&self, connection_id: ConnectionId) { + self.connection_ids.lock().await.remove(&connection_id); + } +} + +async fn run_catalog_listener( + mut changes: tokio::sync::broadcast::Receiver, + thread_store: Weak, + outgoing: Arc, + connection_ids: Arc>>, + fallback_provider: String, + fallback_cwd: AbsolutePathBuf, +) { + loop { + let change = match changes.recv().await { + Ok(change) => Some(change), + Err(RecvError::Lagged(skipped)) => { + warn!("thread catalog listener lagged by {skipped} changes"); + None + } + Err(RecvError::Closed) => break, + }; + let connection_ids = connection_ids + .lock() + .await + .iter() + .copied() + .collect::>(); + if connection_ids.is_empty() { + continue; + } + + let notification = match change { + Some(ThreadCatalogChange::Upsert { thread_id }) => { + let Some(thread_store) = thread_store.upgrade() else { + break; + }; + match thread_store + .read_thread(ReadThreadParams { + thread_id, + include_archived: true, + include_history: false, + }) + .await + { + Ok(thread) => ServerNotification::ThreadCatalogChanged( + ThreadCatalogChangedNotification::Upsert { + thread: Box::new(thread_summary_from_stored_thread( + thread, + &fallback_provider, + &fallback_cwd, + )), + }, + ), + Err(err) => { + warn!("failed to read thread {thread_id} after catalog change: {err}"); + ServerNotification::ThreadCatalogChanged( + ThreadCatalogChangedNotification::Invalidate, + ) + } + } + } + Some(ThreadCatalogChange::Delete { thread_id }) => { + ServerNotification::ThreadCatalogChanged(ThreadCatalogChangedNotification::Delete { + thread_id: thread_id.to_string(), + }) + } + None => ServerNotification::ThreadCatalogChanged( + ThreadCatalogChangedNotification::Invalidate, + ), + }; + outgoing + .send_server_notification_to_connections(&connection_ids, notification) + .await; + } +} + +fn thread_summary_from_stored_thread( + thread: codex_thread_store::StoredThread, + fallback_provider: &str, + fallback_cwd: &AbsolutePathBuf, +) -> ThreadSummary { + let created_at_ms = thread.created_at.timestamp_millis(); + let updated_at_ms = thread.updated_at.timestamp_millis(); + let recency_at_ms = thread.recency_at.timestamp_millis(); + let archived_at = thread.archived_at.as_ref().map(chrono::DateTime::timestamp); + let (thread, _) = thread_from_stored_thread(thread, fallback_provider, fallback_cwd); + ThreadSummary { + id: thread.id, + forked_from_id: thread.forked_from_id, + parent_thread_id: thread.parent_thread_id, + preview: thread.preview, + model_provider: thread.model_provider, + created_at: thread.created_at, + created_at_ms, + updated_at: thread.updated_at, + updated_at_ms, + recency_at: thread.recency_at, + recency_at_ms: Some(recency_at_ms), + archived_at, + cwd: thread.cwd, + source: thread.source, + thread_source: thread.thread_source, + agent_nickname: thread.agent_nickname, + agent_role: thread.agent_role, + git_info: thread.git_info, + name: thread.name, + } +} diff --git a/codex-rs/app-server/tests/suite/v2/mod.rs b/codex-rs/app-server/tests/suite/v2/mod.rs index 3d55079dc6..71a41358ab 100644 --- a/codex-rs/app-server/tests/suite/v2/mod.rs +++ b/codex-rs/app-server/tests/suite/v2/mod.rs @@ -64,6 +64,7 @@ mod selected_environment; mod skills_list; mod sleep; mod thread_archive; +mod thread_catalog_subscription; mod thread_delete; mod thread_fork; mod thread_inject_items; diff --git a/codex-rs/app-server/tests/suite/v2/thread_catalog_subscription.rs b/codex-rs/app-server/tests/suite/v2/thread_catalog_subscription.rs new file mode 100644 index 0000000000..b9d8515c8b --- /dev/null +++ b/codex-rs/app-server/tests/suite/v2/thread_catalog_subscription.rs @@ -0,0 +1,111 @@ +use anyhow::Result; +use app_test_support::TestAppServer; +use app_test_support::create_fake_rollout; +use app_test_support::to_response; +use app_test_support::write_mock_responses_config_toml; +use codex_app_server_protocol::JSONRPCNotification; +use codex_app_server_protocol::JSONRPCResponse; +use codex_app_server_protocol::RequestId; +use codex_app_server_protocol::ThreadCatalogChangedNotification; +use codex_app_server_protocol::ThreadCatalogSubscribeResponse; +use codex_app_server_protocol::ThreadDeleteParams; +use codex_app_server_protocol::ThreadDeleteResponse; +use codex_app_server_protocol::ThreadSetNameParams; +use codex_app_server_protocol::ThreadSetNameResponse; +use pretty_assertions::assert_eq; +use serde::de::DeserializeOwned; +use tempfile::TempDir; +use tokio::time::Duration; +use tokio::time::timeout; + +const READ_TIMEOUT: Duration = Duration::from_secs(10); + +#[tokio::test] +async fn catalog_subscription_tracks_threads_the_client_never_listed() -> Result<()> { + let codex_home = TempDir::new()?; + let thread_id = create_fake_rollout( + codex_home.path(), + "2025-01-05T12-00-00", + "2025-01-05T12:00:00Z", + "Unlisted thread", + Some("mock_provider"), + /*git_info*/ None, + )?; + let mut app = start_app(&codex_home).await?; + + let subscribe_id = app + .send_raw_request("threadCatalog/subscribe", /*params*/ None) + .await?; + let _: ThreadCatalogSubscribeResponse = read_response(&mut app, subscribe_id).await?; + + let rename_id = app + .send_thread_set_name_request(ThreadSetNameParams { + thread_id: thread_id.clone(), + name: "Renamed without listing".to_string(), + }) + .await?; + let _: ThreadSetNameResponse = read_response(&mut app, rename_id).await?; + let changed_raw: JSONRPCNotification = timeout( + READ_TIMEOUT, + app.read_stream_until_notification_message("threadCatalog/changed"), + ) + .await??; + let changed_params = changed_raw.params.expect("catalog change params"); + assert_eq!(changed_params["thread"].get("turns"), None); + assert_eq!(changed_params["thread"].get("status"), None); + let ThreadCatalogChangedNotification::Upsert { thread } = + serde_json::from_value(changed_params)? + else { + panic!("expected catalog upsert"); + }; + assert_eq!(thread.id, thread_id); + assert_eq!(thread.name.as_deref(), Some("Renamed without listing")); + assert_eq!( + thread.recency_at_ms.map(|value| value / 1_000), + thread.recency_at + ); + + let delete_id = app + .send_thread_delete_request(ThreadDeleteParams { + thread_id: thread_id.clone(), + }) + .await?; + let _: ThreadDeleteResponse = read_response(&mut app, delete_id).await?; + let deleted_raw: JSONRPCNotification = timeout( + READ_TIMEOUT, + app.read_stream_until_notification_message("threadCatalog/changed"), + ) + .await??; + let deleted: ThreadCatalogChangedNotification = + serde_json::from_value(deleted_raw.params.expect("catalog deletion params"))?; + assert_eq!( + deleted, + ThreadCatalogChangedNotification::Delete { thread_id } + ); + + Ok(()) +} + +async fn start_app(codex_home: &TempDir) -> Result { + write_mock_responses_config_toml( + codex_home.path(), + "http://localhost:1", + &Default::default(), + i64::MAX, + /*requires_openai_auth*/ None, + "mock_provider", + "", + )?; + let mut app = TestAppServer::new_with_auto_env(codex_home.path()).await?; + timeout(READ_TIMEOUT, app.initialize()).await??; + Ok(app) +} + +async fn read_response(app: &mut TestAppServer, id: i64) -> Result { + let response: JSONRPCResponse = timeout( + READ_TIMEOUT, + app.read_stream_until_response_message(RequestId::Integer(id)), + ) + .await??; + to_response(response) +}