diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.json index 5bbd51bb9ef2..f19d38d02ae8 100644 --- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json +++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json @@ -3312,6 +3312,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -3354,6 +3362,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -3384,9 +3400,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -3410,6 +3450,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -3450,6 +3498,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -3478,6 +3534,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -3504,6 +3568,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -3543,6 +3615,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -3583,6 +3671,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -3631,12 +3727,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -3679,6 +3799,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -3701,6 +3837,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 35c9dc86be77..5014c17a3d39 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 @@ -15045,6 +15045,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -15087,6 +15095,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/CommandExecutionStatus" }, @@ -15117,9 +15133,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/PatchApplyStatus" }, @@ -15143,6 +15183,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -15183,6 +15231,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/McpToolCallStatus" }, @@ -15211,6 +15267,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/v2/DynamicToolCallOutputContentItem" @@ -15237,6 +15301,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/v2/DynamicToolCallStatus" }, @@ -15276,6 +15348,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -15316,6 +15404,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -15364,12 +15460,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -15412,6 +15532,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -15434,6 +15570,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 03ac3475e14a..e2fe9a02bec2 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 @@ -12931,6 +12931,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -12973,6 +12981,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -13003,9 +13019,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -13029,6 +13069,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -13069,6 +13117,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -13097,6 +13153,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -13123,6 +13187,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -13162,6 +13234,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -13202,6 +13290,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -13250,12 +13346,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -13298,6 +13418,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -13320,6 +13456,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json index 0831483a327f..df86d4d4f2f3 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemCompletedNotification.json @@ -668,6 +668,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -710,6 +718,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -740,9 +756,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -766,6 +806,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -806,6 +854,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -834,6 +890,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -860,6 +924,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -899,6 +971,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -939,6 +1027,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -987,12 +1083,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1035,6 +1155,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1057,6 +1193,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json index 16bfeece144a..c9742a09b636 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ItemStartedNotification.json @@ -668,6 +668,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -710,6 +718,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -740,9 +756,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -766,6 +806,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -806,6 +854,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -834,6 +890,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -860,6 +924,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -899,6 +971,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -939,6 +1027,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -987,12 +1083,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1035,6 +1155,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1057,6 +1193,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 16abcd7806a5..75995b7e4df2 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 b5d6b139b2c0..5d5e01b3aef4 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json @@ -1585,6 +1585,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1627,6 +1635,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1657,9 +1673,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1683,6 +1723,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1723,6 +1771,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1751,6 +1807,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1777,6 +1841,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1816,6 +1888,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1856,6 +1944,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1904,12 +2000,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1952,6 +2072,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1974,6 +2110,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 2f5cbb95002d..07c1b149e580 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json index b9ae59708aa6..e608cf06be8d 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 cda474c2947b..6ac2584e96a2 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 7135a5317439..b3c22ee4875f 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json @@ -1585,6 +1585,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1627,6 +1635,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1657,9 +1673,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1683,6 +1723,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1723,6 +1771,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1751,6 +1807,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1777,6 +1841,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1816,6 +1888,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1856,6 +1944,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1904,12 +2000,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1952,6 +2072,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1974,6 +2110,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 e5339f4e996f..09793ab1b1e5 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRollbackResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 5deca9f6990a..9c14c062f07d 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json @@ -1585,6 +1585,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1627,6 +1635,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1657,9 +1673,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1683,6 +1723,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1723,6 +1771,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1751,6 +1807,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1777,6 +1841,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1816,6 +1888,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1856,6 +1944,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1904,12 +2000,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1952,6 +2072,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1974,6 +2110,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 774686e46ae2..ffdc4de1e884 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json index eaa3becdea85..920c7c68acb0 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 64179af7e1f0..0ee4af9c752d 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json @@ -1088,6 +1088,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -1130,6 +1138,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -1160,9 +1176,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -1186,6 +1226,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -1226,6 +1274,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -1254,6 +1310,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1280,6 +1344,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1319,6 +1391,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1359,6 +1447,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1407,12 +1503,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1455,6 +1575,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1477,6 +1613,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 0739fa31bc48..c91aedce9efa 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 bc5917ef15a7..12e5340ef551 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, 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 22ad85d906dc..01d3a232d810 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json @@ -812,6 +812,14 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "cwd": { "allOf": [ { @@ -854,6 +862,14 @@ ], "default": "agent" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when command execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/CommandExecutionStatus" }, @@ -884,9 +900,33 @@ }, "type": "array" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of patch application in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when patch application started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/PatchApplyStatus" }, @@ -910,6 +950,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "durationMs": { "description": "The duration of the MCP tool call in milliseconds.", "format": "int64", @@ -950,6 +998,14 @@ "server": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when MCP tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/McpToolCallStatus" }, @@ -978,6 +1034,14 @@ { "properties": { "arguments": true, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "contentItems": { "items": { "$ref": "#/definitions/DynamicToolCallOutputContentItem" @@ -1004,6 +1068,14 @@ "null" ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when dynamic tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "$ref": "#/definitions/DynamicToolCallStatus" }, @@ -1043,6 +1115,22 @@ "description": "Last known status of the target agents, when available.", "type": "object" }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the collab tool execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "description": "Unique identifier for this collab tool call.", "type": "string" @@ -1083,6 +1171,14 @@ "description": "Thread ID of the agent issuing the collab request.", "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when collab tool execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "allOf": [ { @@ -1131,12 +1227,36 @@ } ] }, + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of the web search execution in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, "query": { "type": "string" }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when web search execution started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "type": { "enum": [ "webSearch" @@ -1179,6 +1299,22 @@ }, { "properties": { + "completedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation completed, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, + "durationMs": { + "description": "The duration of image generation in milliseconds.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "id": { "type": "string" }, @@ -1201,6 +1337,14 @@ } ] }, + "startedAtMs": { + "description": "Unix timestamp (in milliseconds) when image generation started, if known.", + "format": "int64", + "type": [ + "integer", + "null" + ] + }, "status": { "type": "string" }, diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts index f7880c9d32ca..cd45b4b34a69 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadItem.ts @@ -50,14 +50,50 @@ aggregatedOutput: string | null, * The command's exit code. */ exitCode: number | null, +/** + * Unix timestamp (in milliseconds) when command execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when command execution completed, if known. + */ +completedAtMs: number | null, /** * The duration of the command execution in milliseconds. */ -durationMs: number | null, } | { "type": "fileChange", id: string, changes: Array, status: PatchApplyStatus, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, mcpAppResourceUri?: string, result: McpToolCallResult | null, error: McpToolCallError | null, +durationMs: number | null, } | { "type": "fileChange", id: string, changes: Array, status: PatchApplyStatus, +/** + * Unix timestamp (in milliseconds) when patch application started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when patch application completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of patch application in milliseconds. + */ +durationMs: number | null, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, mcpAppResourceUri?: string, result: McpToolCallResult | null, error: McpToolCallError | null, +/** + * Unix timestamp (in milliseconds) when MCP tool execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when MCP tool execution completed, if known. + */ +completedAtMs: number | null, /** * The duration of the MCP tool call in milliseconds. */ durationMs: number | null, } | { "type": "dynamicToolCall", id: string, namespace: string | null, tool: string, arguments: JsonValue, status: DynamicToolCallStatus, contentItems: Array | null, success: boolean | null, +/** + * Unix timestamp (in milliseconds) when dynamic tool execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when dynamic tool execution completed, if known. + */ +completedAtMs: number | null, /** * The duration of the dynamic tool call in milliseconds. */ @@ -98,4 +134,40 @@ reasoningEffort: ReasoningEffort | null, /** * Last known status of the target agents, when available. */ -agentsStates: { [key in string]?: CollabAgentState }, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, result: string, savedPath?: AbsolutePathBuf, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; +agentsStates: { [key in string]?: CollabAgentState }, +/** + * Unix timestamp (in milliseconds) when collab tool execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when collab tool execution completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of the collab tool execution in milliseconds. + */ +durationMs: number | null, } | { "type": "webSearch", id: string, query: string, action: WebSearchAction | null, +/** + * Unix timestamp (in milliseconds) when web search execution started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when web search execution completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of the web search execution in milliseconds. + */ +durationMs: number | null, } | { "type": "imageView", id: string, path: AbsolutePathBuf, } | { "type": "imageGeneration", id: string, status: string, revisedPrompt: string | null, result: string, savedPath?: AbsolutePathBuf, +/** + * Unix timestamp (in milliseconds) when image generation started, if known. + */ +startedAtMs: number | null, +/** + * Unix timestamp (in milliseconds) when image generation completed, if known. + */ +completedAtMs: number | null, +/** + * The duration of image generation in milliseconds. + */ +durationMs: number | null, } | { "type": "enteredReviewMode", id: string, review: string, } | { "type": "exitedReviewMode", id: string, review: string, } | { "type": "contextCompaction", id: string, }; diff --git a/codex-rs/app-server-protocol/src/protocol/item_builders.rs b/codex-rs/app-server-protocol/src/protocol/item_builders.rs index 546fb1b6796a..461e315b7315 100644 --- a/codex-rs/app-server-protocol/src/protocol/item_builders.rs +++ b/codex-rs/app-server-protocol/src/protocol/item_builders.rs @@ -45,6 +45,9 @@ pub fn build_file_change_approval_request_item( id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } } @@ -53,6 +56,9 @@ pub fn build_file_change_begin_item(payload: &PatchApplyBeginEvent) -> ThreadIte id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: PatchApplyStatus::InProgress, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, } } @@ -61,6 +67,9 @@ pub fn build_file_change_end_item(payload: &PatchApplyEndEvent) -> ThreadItem { id: payload.call_id.clone(), changes: convert_patch_changes(&payload.changes), status: (&payload.status).into(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, } } @@ -82,6 +91,8 @@ pub fn build_command_execution_approval_request_item( .collect(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } } @@ -102,6 +113,8 @@ pub fn build_command_execution_begin_item(payload: &ExecCommandBeginEvent) -> Th .collect(), aggregated_output: None, exit_code: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, } } @@ -129,6 +142,8 @@ pub fn build_command_execution_end_item(payload: &ExecCommandEndEvent) -> Thread .collect(), aggregated_output, exit_code: Some(payload.exit_code), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms: Some(duration_ms), } } @@ -158,6 +173,8 @@ pub fn build_item_from_guardian_event( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }) } @@ -194,6 +211,8 @@ pub fn build_item_from_guardian_event( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }) } 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 019c9fa83e32..2814101fb0a7 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -388,6 +388,9 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), query: String::new(), action: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -397,6 +400,9 @@ impl ThreadHistoryBuilder { id: payload.call_id.clone(), query: payload.query.clone(), action: Some(WebSearchAction::from(payload.action.clone())), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }; self.upsert_item_in_current_turn(item); } @@ -474,6 +480,8 @@ impl ThreadHistoryBuilder { status: DynamicToolCallStatus::InProgress, content_items: None, success: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, }; if payload.turn_id.is_empty() { @@ -498,6 +506,8 @@ impl ThreadHistoryBuilder { status, content_items: Some(convert_dynamic_tool_content_items(&payload.content_items)), success: Some(payload.success), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms, }; if payload.turn_id.is_empty() { @@ -521,6 +531,8 @@ impl ThreadHistoryBuilder { mcp_app_resource_uri: payload.mcp_app_resource_uri.clone(), result: None, error: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, duration_ms: None, }; self.upsert_item_in_current_turn(item); @@ -562,6 +574,8 @@ impl ThreadHistoryBuilder { mcp_app_resource_uri: payload.mcp_app_resource_uri.clone(), result, error, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, duration_ms, }; self.upsert_item_in_current_turn(item); @@ -582,6 +596,9 @@ impl ThreadHistoryBuilder { revised_prompt: None, result: String::new(), saved_path: None, + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -593,6 +610,9 @@ impl ThreadHistoryBuilder { revised_prompt: payload.revised_prompt.clone(), result: payload.result.clone(), saved_path: payload.saved_path.clone(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }; self.upsert_item_in_current_turn(item); } @@ -611,6 +631,9 @@ impl ThreadHistoryBuilder { model: Some(payload.model.clone()), reasoning_effort: Some(payload.reasoning_effort), agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -646,6 +669,9 @@ impl ThreadHistoryBuilder { model: Some(payload.model.clone()), reasoning_effort: Some(payload.reasoning_effort), agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -663,6 +689,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -687,6 +716,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: [(receiver_id, received_status)].into_iter().collect(), + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -708,6 +740,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -743,6 +778,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -760,6 +798,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -786,6 +827,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -803,6 +847,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: payload.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; self.upsert_item_in_current_turn(item); } @@ -832,6 +879,9 @@ impl ThreadHistoryBuilder { model: None, reasoning_effort: None, agents_states, + started_at_ms: payload.started_at_ms, + completed_at_ms: payload.completed_at_ms, + duration_ms: payload.duration_ms, }); } @@ -1426,6 +1476,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, })), RolloutItem::EventMsg(EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-image".into(), @@ -1461,6 +1514,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ], } @@ -1810,6 +1866,9 @@ mod tests { query: Some("codex".into()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), EventMsg::ExecCommandEnd(ExecCommandEndEvent { call_id: "exec-1".into(), @@ -1829,6 +1888,8 @@ mod tests { duration: Duration::from_millis(12), formatted_output: String::new(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::McpToolCallEnd(McpToolCallEndEvent { call_id: "mcp-1".into(), @@ -1840,6 +1901,8 @@ mod tests { mcp_app_resource_uri: None, duration: Duration::from_millis(8), result: Err("boom".into()), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -1859,6 +1922,9 @@ mod tests { query: Some("codex".into()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); assert_eq!( @@ -1875,6 +1941,8 @@ mod tests { }], aggregated_output: Some("hello world\n".into()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(12), } ); @@ -1891,6 +1959,8 @@ mod tests { error: Some(McpToolCallError { message: "boom".into(), }), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(8), } ); @@ -1925,6 +1995,8 @@ mod tests { "ui/resourceUri": "ui://widget/lookup.html" })), }), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -1954,6 +2026,8 @@ mod tests { })), })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(8), } ); @@ -1981,6 +2055,7 @@ mod tests { namespace: Some("codex_app".into()), tool: "lookup_ticket".into(), arguments: serde_json::json!({"id":"ABC-123"}), + started_at_ms: None, }, ), EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { @@ -1995,6 +2070,8 @@ mod tests { success: true, error: None, duration: Duration::from_millis(42), + started_at_ms: None, + completed_at_ms: None, }), ]; @@ -2017,6 +2094,8 @@ mod tests { text: "Ticket is open".into(), }]), success: Some(true), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(42), } ); @@ -2053,6 +2132,8 @@ mod tests { duration: Duration::ZERO, formatted_output: String::new(), status: CoreExecCommandStatus::Declined, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::PatchApplyEnd(PatchApplyEndEvent { call_id: "patch-declined".into(), @@ -2069,6 +2150,9 @@ mod tests { .into_iter() .collect(), status: CorePatchApplyStatus::Declined, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2093,6 +2177,8 @@ mod tests { }], aggregated_output: Some("exec command rejected by user".into()), exit_code: Some(-1), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(0), } ); @@ -2106,6 +2192,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::Declined, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2184,6 +2273,8 @@ mod tests { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -2245,6 +2336,8 @@ mod tests { }], aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -2302,6 +2395,8 @@ mod tests { duration: Duration::from_millis(5), formatted_output: "done\n".into(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-b".into(), @@ -2336,6 +2431,8 @@ mod tests { }], aggregated_output: Some("done\n".into()), exit_code: Some(0), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(5), } ); @@ -2393,6 +2490,8 @@ mod tests { duration: Duration::from_millis(5), formatted_output: "done\n".into(), status: CoreExecCommandStatus::Completed, + started_at_ms: None, + completed_at_ms: None, }), EventMsg::TurnComplete(TurnCompleteEvent { turn_id: "turn-b".into(), @@ -2454,6 +2553,7 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, }), ]; @@ -2484,6 +2584,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ] ); @@ -2549,6 +2652,9 @@ mod tests { diff: "hello\n".into(), }], status: PatchApplyStatus::InProgress, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ] ); @@ -2734,6 +2840,9 @@ mod tests { receiver_agent_nickname: None, receiver_agent_role: None, status: AgentStatus::Completed(None), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2764,6 +2873,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2791,6 +2903,9 @@ mod tests { model: "gpt-5.4-mini".into(), reasoning_effort: codex_protocol::openai_models::ReasoningEffort::Medium, status: AgentStatus::Running, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), ]; @@ -2821,6 +2936,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } @@ -2847,6 +2965,7 @@ mod tests { sender_thread_id: sender, receiver_thread_id: receiver, prompt: "new task".into(), + started_at_ms: None, }, ), EventMsg::CollabAgentInteractionEnd( @@ -2858,6 +2977,9 @@ mod tests { receiver_agent_role: None, prompt: "new task".into(), status: AgentStatus::Interrupted, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, ), ]; @@ -2889,6 +3011,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index 4669ec6cc9b0..7b38118c652c 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -5641,6 +5641,12 @@ pub enum ThreadItem { aggregated_output: Option, /// The command's exit code. exit_code: Option, + /// Unix timestamp (in milliseconds) when command execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when command execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the command execution in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5651,6 +5657,15 @@ pub enum ThreadItem { id: String, changes: Vec, status: PatchApplyStatus, + /// Unix timestamp (in milliseconds) when patch application started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when patch application completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of patch application in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5665,6 +5680,12 @@ pub enum ThreadItem { mcp_app_resource_uri: Option, result: Option>, error: Option, + /// Unix timestamp (in milliseconds) when MCP tool execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when MCP tool execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the MCP tool call in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5679,6 +5700,12 @@ pub enum ThreadItem { status: DynamicToolCallStatus, content_items: Option>, success: Option, + /// Unix timestamp (in milliseconds) when dynamic tool execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when dynamic tool execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, /// The duration of the dynamic tool call in milliseconds. #[ts(type = "number | null")] duration_ms: Option, @@ -5705,6 +5732,15 @@ pub enum ThreadItem { reasoning_effort: Option, /// Last known status of the target agents, when available. agents_states: HashMap, + /// Unix timestamp (in milliseconds) when collab tool execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when collab tool execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of the collab tool execution in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5712,6 +5748,15 @@ pub enum ThreadItem { id: String, query: String, action: Option, + /// Unix timestamp (in milliseconds) when web search execution started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when web search execution completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of the web search execution in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -5726,6 +5771,15 @@ pub enum ThreadItem { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] saved_path: Option, + /// Unix timestamp (in milliseconds) when image generation started, if known. + #[ts(type = "number | null")] + started_at_ms: Option, + /// Unix timestamp (in milliseconds) when image generation completed, if known. + #[ts(type = "number | null")] + completed_at_ms: Option, + /// The duration of image generation in milliseconds. + #[ts(type = "number | null")] + duration_ms: Option, }, #[serde(rename_all = "camelCase")] #[ts(rename_all = "camelCase")] @@ -6190,6 +6244,9 @@ impl From for ThreadItem { id: search.id, query: search.query, action: Some(WebSearchAction::from(search.action)), + started_at_ms: search.started_at_ms, + completed_at_ms: search.completed_at_ms, + duration_ms: search.duration_ms, }, CoreTurnItem::ImageGeneration(image) => ThreadItem::ImageGeneration { id: image.id, @@ -6197,6 +6254,9 @@ impl From for ThreadItem { revised_prompt: image.revised_prompt, result: image.result, saved_path: image.saved_path, + started_at_ms: image.started_at_ms, + completed_at_ms: image.completed_at_ms, + duration_ms: image.duration_ms, }, CoreTurnItem::ContextCompaction(compaction) => { ThreadItem::ContextCompaction { id: compaction.id } @@ -10071,6 +10131,9 @@ mod tests { query: Some("docs".to_string()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); assert_eq!( @@ -10082,6 +10145,9 @@ mod tests { query: Some("docs".to_string()), queries: None, }), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ); } diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index ed13b346aa6a..6294b40776cd 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -1004,6 +1004,8 @@ pub(crate) async fn apply_bespoke_event_handling( status: DynamicToolCallStatus::InProgress, content_items: None, success: None, + started_at_ms: request.started_at_ms, + completed_at_ms: None, duration_ms: None, }; let notification = ItemStartedNotification { @@ -1076,6 +1078,8 @@ pub(crate) async fn apply_bespoke_event_handling( .collect(), ), success: Some(response.success), + started_at_ms: response.started_at_ms, + completed_at_ms: response.completed_at_ms, duration_ms, }; let notification = ItemCompletedNotification { @@ -1122,6 +1126,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: Some(begin_event.model), reasoning_effort: Some(begin_event.reasoning_effort), agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1161,6 +1168,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: Some(end_event.model), reasoning_effort: Some(end_event.reasoning_effort), agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1183,6 +1193,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1211,6 +1224,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: [(receiver_id, received_status)].into_iter().collect(), + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1237,6 +1253,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1275,6 +1294,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1296,6 +1318,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, }; let notification = ItemStartedNotification { thread_id: conversation_id.to_string(), @@ -1338,6 +1363,9 @@ pub(crate) async fn apply_bespoke_event_handling( model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, }; let notification = ItemCompletedNotification { thread_id: conversation_id.to_string(), @@ -1745,6 +1773,8 @@ pub(crate) async fn apply_bespoke_event_handling( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: exec_command_begin_event.started_at_ms, + completed_at_ms: None, duration_ms: None, }; let notification = ItemStartedNotification { @@ -2151,6 +2181,8 @@ async fn start_command_execution_item( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -2195,6 +2227,8 @@ async fn complete_command_execution_item( command_actions, aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }; let notification = ItemCompletedNotification { @@ -2856,6 +2890,9 @@ async fn on_file_change_request_approval_response( id: item_id.clone(), changes, status, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, event_turn_id.clone(), &outgoing, @@ -3013,6 +3050,9 @@ fn collab_resume_begin_item( model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, + duration_ms: None, } } @@ -3039,6 +3079,9 @@ fn collab_resume_end_item(end_event: codex_protocol::protocol::CollabResumeEndEv model: None, reasoning_effort: None, agents_states, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, + duration_ms: end_event.duration_ms, } } @@ -3057,6 +3100,8 @@ async fn construct_mcp_tool_call_notification( mcp_app_resource_uri: begin_event.mcp_app_resource_uri, result: None, error: None, + started_at_ms: begin_event.started_at_ms, + completed_at_ms: None, duration_ms: None, }; ItemStartedNotification { @@ -3105,6 +3150,8 @@ async fn construct_mcp_tool_call_end_notification( mcp_app_resource_uri: end_event.mcp_app_resource_uri, result, error, + started_at_ms: end_event.started_at_ms, + completed_at_ms: end_event.completed_at_ms, duration_ms, }; ItemCompletedNotification { @@ -3478,6 +3525,8 @@ mod tests { command_actions: completion_item.command_actions.clone(), aggregated_output: None, exit_code: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, } ); @@ -4153,6 +4202,7 @@ mod tests { receiver_thread_id: ThreadId::new(), receiver_agent_nickname: None, receiver_agent_role: None, + started_at_ms: None, }; let item = collab_resume_begin_item(event.clone()); @@ -4166,6 +4216,9 @@ mod tests { model: None, reasoning_effort: None, agents_states: HashMap::new(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; assert_eq!(item, expected); } @@ -4179,6 +4232,9 @@ mod tests { receiver_agent_nickname: None, receiver_agent_role: None, status: codex_protocol::protocol::AgentStatus::NotFound, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; let item = collab_resume_end_item(event.clone()); @@ -4198,6 +4254,9 @@ mod tests { )] .into_iter() .collect(), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }; assert_eq!(item, expected); } @@ -4587,6 +4646,7 @@ mod tests { arguments: Some(serde_json::json!({"server": ""})), }, mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), + started_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4610,6 +4670,8 @@ mod tests { mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -4752,6 +4814,7 @@ mod tests { arguments: None, }, mcp_app_resource_uri: None, + started_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4775,6 +4838,8 @@ mod tests { mcp_app_resource_uri: None, result: None, error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: None, }, }; @@ -4807,6 +4872,8 @@ mod tests { mcp_app_resource_uri: Some("ui://widget/list-resources.html".to_string()), duration: Duration::from_nanos(92708), result: Ok(result), + started_at_ms: None, + completed_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4836,6 +4903,8 @@ mod tests { })), })), error: None, + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(0), }, }; @@ -4855,6 +4924,8 @@ mod tests { mcp_app_resource_uri: None, duration: Duration::from_millis(1), result: Err("boom".to_string()), + started_at_ms: None, + completed_at_ms: None, }; let thread_id = ThreadId::new().to_string(); @@ -4880,6 +4951,8 @@ mod tests { error: Some(McpToolCallError { message: "boom".to_string(), }), + started_at_ms: None, + completed_at_ms: None, duration_ms: Some(1), }, }; diff --git a/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs b/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs index 7ee21a2068f1..7b8344e822bd 100644 --- a/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs +++ b/codex-rs/app-server/tests/suite/v2/dynamic_tools.rs @@ -333,6 +333,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res status, content_items, success, + started_at_ms, + completed_at_ms, duration_ms, } = started.item else { @@ -345,6 +347,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res assert_eq!(status, DynamicToolCallStatus::InProgress); assert_eq!(content_items, None); assert_eq!(success, None); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); assert_eq!(duration_ms, None); // Read the tool call request from the app server. @@ -389,6 +393,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res status, content_items, success, + started_at_ms, + completed_at_ms, duration_ms, } = completed.item else { @@ -406,6 +412,8 @@ async fn dynamic_tool_call_round_trip_sends_text_content_items_to_model() -> Res }]) ); assert_eq!(success, Some(true)); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); assert!(duration_ms.is_some()); timeout( diff --git a/codex-rs/app-server/tests/suite/v2/thread_resume.rs b/codex-rs/app-server/tests/suite/v2/thread_resume.rs index d9f5f039de78..7d2b295d33b3 100644 --- a/codex-rs/app-server/tests/suite/v2/thread_resume.rs +++ b/codex-rs/app-server/tests/suite/v2/thread_resume.rs @@ -2193,16 +2193,30 @@ async fn thread_resume_replays_pending_file_change_request_approval() -> Result< }) .await??; let expected_readme_path = workspace.join("README.md"); - let expected_file_change = ThreadItem::FileChange { - id: "patch-call".to_string(), - changes: vec![codex_app_server_protocol::FileUpdateChange { + let ThreadItem::FileChange { + id, + changes, + status, + started_at_ms, + completed_at_ms, + duration_ms, + } = original_started + else { + unreachable!("loop ensures we break on file change items"); + }; + assert_eq!(id, "patch-call"); + assert_eq!( + changes, + vec![codex_app_server_protocol::FileUpdateChange { path: expected_readme_path.to_string_lossy().into_owned(), kind: PatchChangeKind::Add, diff: "new line\n".to_string(), - }], - status: PatchApplyStatus::InProgress, - }; - assert_eq!(original_started, expected_file_change); + }] + ); + assert_eq!(status, PatchApplyStatus::InProgress); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); + assert_eq!(duration_ms, None); let original_request = timeout( DEFAULT_READ_TIMEOUT, diff --git a/codex-rs/app-server/tests/suite/v2/turn_start.rs b/codex-rs/app-server/tests/suite/v2/turn_start.rs index 3ff04d50227a..700b636ae55c 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_start.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_start.rs @@ -2175,6 +2175,7 @@ async fn turn_start_file_change_approval_v2() -> Result<()> { ref id, status, ref changes, + .. } = started_file_change else { unreachable!("loop ensures we break on file change items"); @@ -2632,20 +2633,35 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() } }) .await??; - assert_eq!( - spawn_started, - ThreadItem::CollabAgentToolCall { - id: SPAWN_CALL_ID.to_string(), - tool: CollabAgentTool::SpawnAgent, - status: CollabAgentToolCallStatus::InProgress, - sender_thread_id: thread.id.clone(), - receiver_thread_ids: Vec::new(), - prompt: Some(CHILD_PROMPT.to_string()), - model: Some(REQUESTED_MODEL.to_string()), - reasoning_effort: Some(REQUESTED_REASONING_EFFORT), - agents_states: HashMap::new(), - } - ); + let ThreadItem::CollabAgentToolCall { + id, + tool, + status, + sender_thread_id, + receiver_thread_ids, + prompt, + model, + reasoning_effort, + agents_states, + started_at_ms, + completed_at_ms, + duration_ms, + } = spawn_started + else { + panic!("expected collab agent tool call item"); + }; + assert_eq!(id, SPAWN_CALL_ID); + assert_eq!(tool, CollabAgentTool::SpawnAgent); + assert_eq!(status, CollabAgentToolCallStatus::InProgress); + assert_eq!(sender_thread_id, thread.id); + assert_eq!(receiver_thread_ids, Vec::::new()); + assert_eq!(prompt.as_deref(), Some(CHILD_PROMPT)); + assert_eq!(model.as_deref(), Some(REQUESTED_MODEL)); + assert_eq!(reasoning_effort, Some(REQUESTED_REASONING_EFFORT)); + assert_eq!(agents_states, HashMap::new()); + assert!(started_at_ms.is_some()); + assert_eq!(completed_at_ms, None); + assert_eq!(duration_ms, None); let spawn_completed = timeout(DEFAULT_READ_TIMEOUT, async { loop { @@ -2672,6 +2688,9 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = spawn_completed else { unreachable!("loop ensures we break on collab agent tool call items"); @@ -2683,6 +2702,9 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<() assert_eq!(id, SPAWN_CALL_ID); assert_eq!(tool, CollabAgentTool::SpawnAgent); assert_eq!(status, CollabAgentToolCallStatus::Completed); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); + assert!(duration_ms.is_some()); assert_eq!(sender_thread_id, thread.id); assert_eq!(receiver_thread_ids, vec![receiver_thread_id.clone()]); assert_eq!(prompt, Some(CHILD_PROMPT.to_string())); @@ -2856,6 +2878,9 @@ config_file = "./custom-role.toml" model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = spawn_completed else { unreachable!("loop ensures we break on collab agent tool call items"); @@ -2867,6 +2892,9 @@ config_file = "./custom-role.toml" assert_eq!(id, SPAWN_CALL_ID); assert_eq!(tool, CollabAgentTool::SpawnAgent); assert_eq!(status, CollabAgentToolCallStatus::Completed); + assert!(started_at_ms.is_some()); + assert!(completed_at_ms.is_some()); + assert!(duration_ms.is_some()); assert_eq!(sender_thread_id, thread.id); assert_eq!(receiver_thread_ids, vec![receiver_thread_id.clone()]); assert_eq!(prompt, Some(CHILD_PROMPT.to_string())); @@ -3174,6 +3202,7 @@ async fn turn_start_file_change_approval_decline_v2() -> Result<()> { ref id, status, ref changes, + .. } = started_file_change else { unreachable!("loop ensures we break on file change items"); diff --git a/codex-rs/core/src/event_mapping.rs b/codex-rs/core/src/event_mapping.rs index e7c79e6dd2a6..0af0aec0ea0c 100644 --- a/codex-rs/core/src/event_mapping.rs +++ b/codex-rs/core/src/event_mapping.rs @@ -188,6 +188,9 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option { id: id.clone().unwrap_or_default(), query, action, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, })) } ResponseItem::ImageGenerationCall { @@ -202,6 +205,9 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option { revised_prompt: revised_prompt.clone(), result: result.clone(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }, )), _ => None, diff --git a/codex-rs/core/src/event_mapping_tests.rs b/codex-rs/core/src/event_mapping_tests.rs index 85e7034405a4..cac92ad60a7d 100644 --- a/codex-rs/core/src/event_mapping_tests.rs +++ b/codex-rs/core/src/event_mapping_tests.rs @@ -413,6 +413,9 @@ fn parses_web_search_call() { query: Some("weather".to_string()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -440,6 +443,9 @@ fn parses_web_search_open_page_call() { action: WebSearchAction::OpenPage { url: Some("https://example.com".to_string()), }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -469,6 +475,9 @@ fn parses_web_search_find_in_page_call() { url: Some("https://example.com".to_string()), pattern: Some("needle".to_string()), }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), @@ -491,6 +500,9 @@ fn parses_partial_web_search_call_without_action_as_other() { id: "ws_partial".to_string(), query: String::new(), action: WebSearchAction::Other, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, } ), other => panic!("expected TurnItem::WebSearch, got {other:?}"), diff --git a/codex-rs/core/src/mcp_tool_call.rs b/codex-rs/core/src/mcp_tool_call.rs index c93ab296b15b..c60ef1c9ec17 100644 --- a/codex-rs/core/src/mcp_tool_call.rs +++ b/codex-rs/core/src/mcp_tool_call.rs @@ -33,6 +33,7 @@ use crate::session::session::Session; use crate::session::turn_context::TurnContext; use crate::tools::hook_names::HookToolName; use crate::tools::sandboxing::PermissionRequestPayload; +use crate::turn_timing::now_unix_timestamp_ms; use codex_analytics::AppInvocation; use codex_analytics::InvocationType; use codex_analytics::build_track_events_context; @@ -144,13 +145,17 @@ pub(crate) async fn handle_mcp_tool_call( custom_mcp_tool_approval_mode(turn_context.as_ref(), &server, &tool_name) }; + let lifecycle = McpToolCallLifecycle { + mcp_app_resource_uri: mcp_app_resource_uri.clone(), + started_at_ms: now_unix_timestamp_ms(), + }; if server == CODEX_APPS_MCP_SERVER_NAME && !app_tool_policy.enabled { let result = notify_mcp_tool_call_skip( sess.as_ref(), turn_context.as_ref(), &call_id, invocation, - mcp_app_resource_uri.clone(), + lifecycle.clone(), "MCP tool call blocked by app configuration".to_string(), /*already_started*/ false, ) @@ -183,7 +188,8 @@ pub(crate) async fn handle_mcp_tool_call( let tool_call_begin_event = EventMsg::McpToolCallBegin(McpToolCallBeginEvent { call_id: call_id.clone(), invocation: invocation.clone(), - mcp_app_resource_uri: mcp_app_resource_uri.clone(), + mcp_app_resource_uri: lifecycle.mcp_app_resource_uri.clone(), + started_at_ms: Some(lifecycle.started_at_ms), }); notify_mcp_tool_call_event(sess.as_ref(), turn_context.as_ref(), tool_call_begin_event).await; @@ -209,7 +215,7 @@ pub(crate) async fn handle_mcp_tool_call( invocation, metadata.as_ref(), request_meta, - mcp_app_resource_uri, + lifecycle, ) .await; } @@ -220,7 +226,7 @@ pub(crate) async fn handle_mcp_tool_call( turn_context.as_ref(), &call_id, invocation, - mcp_app_resource_uri.clone(), + lifecycle.clone(), message, /*already_started*/ true, ) @@ -233,7 +239,7 @@ pub(crate) async fn handle_mcp_tool_call( turn_context.as_ref(), &call_id, invocation, - mcp_app_resource_uri.clone(), + lifecycle.clone(), message, /*already_started*/ true, ) @@ -245,7 +251,7 @@ pub(crate) async fn handle_mcp_tool_call( turn_context.as_ref(), &call_id, invocation, - mcp_app_resource_uri.clone(), + lifecycle.clone(), message, /*already_started*/ true, ) @@ -277,7 +283,7 @@ pub(crate) async fn handle_mcp_tool_call( invocation, metadata.as_ref(), request_meta, - mcp_app_resource_uri, + lifecycle, ) .await } @@ -287,6 +293,12 @@ pub(crate) struct HandledMcpToolCall { pub(crate) tool_input: JsonValue, } +#[derive(Clone)] +struct McpToolCallLifecycle { + mcp_app_resource_uri: Option, + started_at_ms: i64, +} + async fn handle_approved_mcp_tool_call( sess: &Session, turn_context: &TurnContext, @@ -294,7 +306,7 @@ async fn handle_approved_mcp_tool_call( invocation: McpInvocation, metadata: Option<&McpToolApprovalMetadata>, request_meta: Option, - mcp_app_resource_uri: Option, + lifecycle: McpToolCallLifecycle, ) -> HandledMcpToolCall { maybe_mark_thread_memory_mode_polluted(sess, turn_context).await; @@ -356,10 +368,13 @@ async fn handle_approved_mcp_tool_call( tracing::warn!("MCP tool call error: {error:?}"); } let duration = start.elapsed(); + let completed_at_ms = now_unix_timestamp_ms(); let tool_call_end_event = EventMsg::McpToolCallEnd(McpToolCallEndEvent { call_id: call_id.to_string(), invocation, - mcp_app_resource_uri, + mcp_app_resource_uri: lifecycle.mcp_app_resource_uri, + started_at_ms: Some(lifecycle.started_at_ms), + completed_at_ms: Some(completed_at_ms), duration, result: result.clone(), }); @@ -1840,7 +1855,7 @@ async fn notify_mcp_tool_call_skip( turn_context: &TurnContext, call_id: &str, invocation: McpInvocation, - mcp_app_resource_uri: Option, + lifecycle: McpToolCallLifecycle, message: String, already_started: bool, ) -> Result { @@ -1848,7 +1863,8 @@ async fn notify_mcp_tool_call_skip( let tool_call_begin_event = EventMsg::McpToolCallBegin(McpToolCallBeginEvent { call_id: call_id.to_string(), invocation: invocation.clone(), - mcp_app_resource_uri: mcp_app_resource_uri.clone(), + mcp_app_resource_uri: lifecycle.mcp_app_resource_uri.clone(), + started_at_ms: Some(lifecycle.started_at_ms), }); notify_mcp_tool_call_event(sess, turn_context, tool_call_begin_event).await; } @@ -1856,9 +1872,11 @@ async fn notify_mcp_tool_call_skip( let tool_call_end_event = EventMsg::McpToolCallEnd(McpToolCallEndEvent { call_id: call_id.to_string(), invocation, - mcp_app_resource_uri, + mcp_app_resource_uri: lifecycle.mcp_app_resource_uri, duration: Duration::ZERO, result: Err(message.clone()), + started_at_ms: Some(lifecycle.started_at_ms), + completed_at_ms: Some(now_unix_timestamp_ms()), }); notify_mcp_tool_call_event(sess, turn_context, tool_call_end_event).await; Err(message) diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index 0c5af3fc5eed..adb8972a1477 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -297,6 +297,7 @@ use crate::tools::network_approval::build_network_policy_decider; use crate::tools::parallel::ToolCallRuntime; use crate::tools::sandboxing::ApprovalStore; use crate::turn_timing::TurnTimingState; +use crate::turn_timing::now_unix_timestamp_ms; use crate::turn_timing::record_turn_ttfm_metric; use crate::unified_exec::UnifiedExecProcessManager; use crate::windows_sandbox::WindowsSandboxLevelExt; @@ -1611,12 +1612,19 @@ impl Session { } pub(crate) async fn emit_turn_item_started(&self, turn_context: &TurnContext, item: &TurnItem) { + let started_at_ms = now_unix_timestamp_ms(); + self.turn_item_started_at_ms + .lock() + .await + .insert(item.id(), started_at_ms); + let mut item = item.clone(); + item.set_started_at_ms(started_at_ms); self.send_event( turn_context, EventMsg::ItemStarted(ItemStartedEvent { thread_id: self.conversation_id, turn_id: turn_context.sub_id.clone(), - item: item.clone(), + item, }), ) .await; @@ -1625,9 +1633,12 @@ impl Session { pub(crate) async fn emit_turn_item_completed( &self, turn_context: &TurnContext, - item: TurnItem, + mut item: TurnItem, ) { record_turn_ttfm_metric(turn_context, &item).await; + let started_at_ms = self.turn_item_started_at_ms.lock().await.remove(&item.id()); + let completed_at_ms = now_unix_timestamp_ms(); + item.set_completed_timing_ms(started_at_ms, completed_at_ms); self.send_event( turn_context, EventMsg::ItemCompleted(ItemCompletedEvent { diff --git a/codex-rs/core/src/session/session.rs b/codex-rs/core/src/session/session.rs index 03849f7e0738..a16bc9cdcf0e 100644 --- a/codex-rs/core/src/session/session.rs +++ b/codex-rs/core/src/session/session.rs @@ -22,6 +22,8 @@ pub(crate) struct Session { pub(super) pending_mcp_server_refresh_config: Mutex>, pub(crate) conversation: Arc, pub(crate) active_turn: Mutex>, + /// Native start timestamps for turn items that have started but not completed yet. + pub(super) turn_item_started_at_ms: Mutex>, pub(super) mailbox: Mailbox, pub(super) mailbox_rx: Mutex, pub(super) idle_pending_input: Mutex>, // TODO (jif) merge with mailbox! @@ -860,6 +862,7 @@ impl Session { pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), diff --git a/codex-rs/core/src/session/tests.rs b/codex-rs/core/src/session/tests.rs index e7484e43b7f0..65e267798ea8 100644 --- a/codex-rs/core/src/session/tests.rs +++ b/codex-rs/core/src/session/tests.rs @@ -3562,6 +3562,7 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) { pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), @@ -4988,6 +4989,7 @@ where pending_mcp_server_refresh_config: Mutex::new(None), conversation: Arc::new(RealtimeConversationManager::new()), active_turn: Mutex::new(None), + turn_item_started_at_ms: Mutex::new(HashMap::new()), mailbox, mailbox_rx: Mutex::new(mailbox_rx), idle_pending_input: Mutex::new(Vec::new()), diff --git a/codex-rs/core/src/tasks/user_shell.rs b/codex-rs/core/src/tasks/user_shell.rs index 23cd076404df..78ec2facfef6 100644 --- a/codex-rs/core/src/tasks/user_shell.rs +++ b/codex-rs/core/src/tasks/user_shell.rs @@ -21,6 +21,7 @@ use crate::session::turn_context::TurnContext; use crate::state::TaskKind; use crate::tools::format_exec_output_str; use crate::tools::runtimes::maybe_wrap_shell_lc_with_snapshot; +use crate::turn_timing::now_unix_timestamp_ms; use crate::user_shell_command::user_shell_command_record_item; use codex_protocol::exec_output::ExecToolCallOutput; use codex_protocol::exec_output::StreamOutput; @@ -157,6 +158,7 @@ pub(crate) async fn execute_user_shell_command( let cwd = turn_context.cwd.clone(); let parsed_cmd = parse_command(&display_command); + let started_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -169,6 +171,7 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), }), ) .await; @@ -212,6 +215,7 @@ pub(crate) async fn execute_user_shell_command( match exec_result { Err(CancelErr::Cancelled) => { + let completed_at_ms = now_unix_timestamp_ms(); let aborted_message = "command aborted by user".to_string(); let exec_output = ExecToolCallOutput { exit_code: -1, @@ -241,6 +245,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: String::new(), stderr: aborted_message.clone(), aggregated_output: aborted_message.clone(), @@ -253,6 +259,7 @@ pub(crate) async fn execute_user_shell_command( .await; } Ok(Ok(output)) => { + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -265,6 +272,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd: parsed_cmd.clone(), source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: output.stdout.text.clone(), stderr: output.stderr.text.clone(), aggregated_output: output.aggregated_output.text.clone(), @@ -297,6 +306,7 @@ pub(crate) async fn execute_user_shell_command( duration: Duration::ZERO, timed_out: false, }; + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn_context.as_ref(), @@ -309,6 +319,8 @@ pub(crate) async fn execute_user_shell_command( parsed_cmd, source: ExecCommandSource::UserShell, interaction_input: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), stdout: exec_output.stdout.text.clone(), stderr: exec_output.stderr.text.clone(), aggregated_output: exec_output.aggregated_output.text.clone(), diff --git a/codex-rs/core/src/tools/events.rs b/codex-rs/core/src/tools/events.rs index 2b215a043d2e..11e851a69f2a 100644 --- a/codex-rs/core/src/tools/events.rs +++ b/codex-rs/core/src/tools/events.rs @@ -3,6 +3,7 @@ use crate::session::session::Session; use crate::session::turn_context::TurnContext; use crate::tools::context::SharedTurnDiffTracker; use crate::tools::sandboxing::ToolError; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::error::CodexErr; use codex_protocol::error::SandboxErr; use codex_protocol::exec_output::ExecToolCallOutput; @@ -82,6 +83,7 @@ pub(crate) async fn emit_exec_command_begin( parsed_cmd: parsed_cmd.to_vec(), source, interaction_input, + started_at_ms: Some(now_unix_timestamp_ms()), }), ) .await; @@ -190,6 +192,7 @@ impl ToolEmitter { turn_id: ctx.turn.sub_id.clone(), auto_approved: *auto_approved, changes: changes.clone(), + started_at_ms: Some(now_unix_timestamp_ms()), }), ) .await; @@ -206,6 +209,7 @@ impl ToolEmitter { } else { PatchApplyStatus::Failed }, + output.duration, ) .await; } @@ -224,6 +228,7 @@ impl ToolEmitter { } else { PatchApplyStatus::Failed }, + output.duration, ) .await; } @@ -238,6 +243,7 @@ impl ToolEmitter { (*message).to_string(), /*success*/ false, PatchApplyStatus::Failed, + Duration::ZERO, ) .await; } @@ -252,6 +258,7 @@ impl ToolEmitter { (*message).to_string(), /*success*/ false, PatchApplyStatus::Declined, + Duration::ZERO, ) .await; } @@ -467,6 +474,9 @@ async fn emit_exec_end( exec_input: ExecCommandInput<'_>, exec_result: ExecCommandResult, ) { + let completed_at_ms = now_unix_timestamp_ms(); + let duration_ms = i64::try_from(exec_result.duration.as_millis()).unwrap_or(i64::MAX); + let started_at_ms = completed_at_ms.checked_sub(duration_ms); ctx.session .send_event( ctx.turn, @@ -479,6 +489,8 @@ async fn emit_exec_end( parsed_cmd: exec_input.parsed_cmd.to_vec(), source: exec_input.source, interaction_input: exec_input.interaction_input.map(str::to_owned), + started_at_ms, + completed_at_ms: Some(completed_at_ms), stdout: exec_result.stdout, stderr: exec_result.stderr, aggregated_output: exec_result.aggregated_output, @@ -498,7 +510,12 @@ async fn emit_patch_end( stderr: String, success: bool, status: PatchApplyStatus, + duration: Duration, ) { + let completed_at_ms = now_unix_timestamp_ms(); + let duration_ms = i64::try_from(duration.as_millis()).ok(); + let started_at_ms = + duration_ms.and_then(|duration_ms| completed_at_ms.checked_sub(duration_ms)); ctx.session .send_event( ctx.turn, @@ -510,6 +527,9 @@ async fn emit_patch_end( success, changes, status, + started_at_ms, + completed_at_ms: Some(completed_at_ms), + duration_ms, }), ) .await; diff --git a/codex-rs/core/src/tools/handlers/dynamic.rs b/codex-rs/core/src/tools/handlers/dynamic.rs index b7e07090dc78..f6e665a71f33 100644 --- a/codex-rs/core/src/tools/handlers/dynamic.rs +++ b/codex-rs/core/src/tools/handlers/dynamic.rs @@ -7,6 +7,7 @@ use crate::tools::context::ToolPayload; use crate::tools::handlers::parse_arguments; use crate::tools::registry::ToolHandler; use crate::tools::registry::ToolKind; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::dynamic_tools::DynamicToolCallRequest; use codex_protocol::dynamic_tools::DynamicToolResponse; use codex_protocol::models::FunctionCallOutputContentItem; @@ -102,16 +103,19 @@ async fn request_dynamic_tool( } let started_at = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); let event = EventMsg::DynamicToolCallRequest(DynamicToolCallRequest { call_id: call_id.clone(), turn_id: turn_id.clone(), namespace: namespace.clone(), tool: tool.clone(), arguments: arguments.clone(), + started_at_ms: Some(started_at_ms), }); session.send_event(turn_context, event).await; let response = rx_response.await.ok(); + let completed_at_ms = now_unix_timestamp_ms(); let response_event = match &response { Some(response) => EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { call_id, @@ -122,6 +126,8 @@ async fn request_dynamic_tool( content_items: response.content_items.clone(), success: response.success, error: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration: started_at.elapsed(), }), None => EventMsg::DynamicToolCallResponse(DynamicToolCallResponseEvent { @@ -133,6 +139,8 @@ async fn request_dynamic_tool( content_items: Vec::new(), success: false, error: Some("dynamic tool call was cancelled before receiving a response".to_string()), + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration: started_at.elapsed(), }), }; diff --git a/codex-rs/core/src/tools/handlers/mcp_resource.rs b/codex-rs/core/src/tools/handlers/mcp_resource.rs index fa4a066741e7..06db72af381a 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource.rs @@ -25,6 +25,7 @@ use crate::tools::context::ToolInvocation; use crate::tools::context::ToolPayload; use crate::tools::registry::ToolHandler; use crate::tools::registry::ToolKind; +use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::protocol::EventMsg; use codex_protocol::protocol::McpInvocation; use codex_protocol::protocol::McpToolCallBeginEvent; @@ -261,8 +262,16 @@ async fn handle_list_resources( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { if let Some(server_name) = server.clone() { @@ -310,6 +319,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -324,6 +334,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -339,6 +350,7 @@ async fn handle_list_resources( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -369,8 +381,16 @@ async fn handle_list_resource_templates( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { if let Some(server_name) = server.clone() { @@ -420,6 +440,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -434,6 +455,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -449,6 +471,7 @@ async fn handle_list_resource_templates( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -475,8 +498,16 @@ async fn handle_read_resource( arguments: arguments.clone(), }; - emit_tool_call_begin(&session, turn.as_ref(), &call_id, invocation.clone()).await; let start = Instant::now(); + let started_at_ms = now_unix_timestamp_ms(); + emit_tool_call_begin( + &session, + turn.as_ref(), + &call_id, + invocation.clone(), + started_at_ms, + ) + .await; let payload_result: Result = async { let result = session @@ -511,6 +542,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Ok(call_tool_result_from_content(&content, output.success)), ) @@ -525,6 +557,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -540,6 +573,7 @@ async fn handle_read_resource( turn.as_ref(), &call_id, invocation, + started_at_ms, duration, Err(message.clone()), ) @@ -563,6 +597,7 @@ async fn emit_tool_call_begin( turn: &TurnContext, call_id: &str, invocation: McpInvocation, + started_at_ms: i64, ) { session .send_event( @@ -571,6 +606,7 @@ async fn emit_tool_call_begin( call_id: call_id.to_string(), invocation, mcp_app_resource_uri: None, + started_at_ms: Some(started_at_ms), }), ) .await; @@ -581,9 +617,11 @@ async fn emit_tool_call_end( turn: &TurnContext, call_id: &str, invocation: McpInvocation, + started_at_ms: i64, duration: Duration, result: Result, ) { + let completed_at_ms = now_unix_timestamp_ms(); session .send_event( turn, @@ -591,6 +629,8 @@ async fn emit_tool_call_end( call_id: call_id.to_string(), invocation, mcp_app_resource_uri: None, + started_at_ms: Some(started_at_ms), + completed_at_ms: Some(completed_at_ms), duration, result, }), diff --git a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs index 8c00b0a13cb7..5b07670176e3 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs @@ -29,6 +29,7 @@ impl ToolHandler for Handler { .agent_control .get_agent_metadata(agent_id) .unwrap_or_default(); + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -36,6 +37,7 @@ impl ToolHandler for Handler { call_id: call_id.clone(), sender_thread_id: session.conversation_id, receiver_thread_id: agent_id, + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -49,6 +51,7 @@ impl ToolHandler for Handler { Ok(mut status_rx) => status_rx.borrow_and_update().clone(), Err(err) => { let status = session.services.agent_control.get_status(agent_id).await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -59,6 +62,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -70,6 +76,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(agent_id, err)) .map(|_| ()); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -80,6 +87,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs index 2d4f2c3f47e8..579e7a6aa0a6 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs @@ -41,6 +41,7 @@ impl ToolHandler for Handler { )); } + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -50,6 +51,7 @@ impl ToolHandler for Handler { receiver_thread_id, receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -96,6 +98,7 @@ impl ToolHandler for Handler { } else { (receiver_agent, None) }; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -106,6 +109,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs index 4ae3240cb384..962557b65706 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs @@ -40,6 +40,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(receiver_thread_id, err))?; } + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -48,6 +49,7 @@ impl ToolHandler for Handler { sender_thread_id: session.conversation_id, receiver_thread_id, prompt: prompt.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -62,6 +64,7 @@ impl ToolHandler for Handler { .agent_control .get_status(receiver_thread_id) .await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -73,6 +76,9 @@ impl ToolHandler for Handler { receiver_agent_role: receiver_agent.agent_role, prompt, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs index 777cb9be1c86..347ca8868edd 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs @@ -46,6 +46,7 @@ impl ToolHandler for Handler { "Agent depth limit reached. Solve the task yourself.".to_string(), )); } + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -55,6 +56,7 @@ impl ToolHandler for Handler { prompt: prompt.clone(), model: args.model.clone().unwrap_or_default(), reasoning_effort: args.reasoning_effort.unwrap_or_default(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -149,6 +151,7 @@ impl ToolHandler for Handler { .and_then(|snapshot| snapshot.reasoning_effort) .unwrap_or(args.reasoning_effort.unwrap_or_default()); let nickname = new_agent_nickname.clone(); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -162,6 +165,9 @@ impl ToolHandler for Handler { model: effective_model, reasoning_effort: effective_reasoning_effort, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs index 77fa5f83a240..be908fa4313b 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs @@ -69,6 +69,7 @@ impl ToolHandler for Handler { ms => ms.clamp(MIN_WAIT_TIMEOUT_MS, MAX_WAIT_TIMEOUT_MS), }; + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -77,6 +78,7 @@ impl ToolHandler for Handler { receiver_thread_ids: receiver_thread_ids.clone(), receiver_agents: receiver_agents.clone(), call_id: call_id.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -99,6 +101,7 @@ impl ToolHandler for Handler { Err(err) => { let mut statuses = HashMap::with_capacity(1); statuses.insert(*id, session.services.agent_control.get_status(*id).await); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -110,6 +113,9 @@ impl ToolHandler for Handler { &receiver_agents, ), statuses, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -167,6 +173,7 @@ impl ToolHandler for Handler { timed_out, }; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -175,6 +182,9 @@ impl ToolHandler for Handler { call_id, agent_statuses, statuses: statuses_by_id, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_common.rs b/codex-rs/core/src/tools/handlers/multi_agents_common.rs index c01755cb2b2c..ede49ff5cb86 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_common.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_common.rs @@ -8,6 +8,7 @@ use crate::session::turn_context::TurnContext; use crate::tools::context::FunctionToolOutput; use crate::tools::context::ToolOutput; use crate::tools::context::ToolPayload; +use crate::turn_timing::now_unix_timestamp_ms; use codex_features::Feature; use codex_models_manager::manager::RefreshStrategy; use codex_protocol::AgentPath; @@ -32,6 +33,32 @@ pub(crate) const MIN_WAIT_TIMEOUT_MS: i64 = DEFAULT_MULTI_AGENT_V2_MIN_WAIT_TIME pub(crate) const DEFAULT_WAIT_TIMEOUT_MS: i64 = 30_000; pub(crate) const MAX_WAIT_TIMEOUT_MS: i64 = MAX_MULTI_AGENT_V2_WAIT_TIMEOUT_MS; +#[derive(Clone, Copy)] +pub(crate) struct CollabToolExecutionTiming { + started_at_ms: i64, +} + +impl CollabToolExecutionTiming { + pub(crate) fn start() -> Self { + Self { + started_at_ms: now_unix_timestamp_ms(), + } + } + + pub(crate) fn started_at_ms(self) -> Option { + Some(self.started_at_ms) + } + + pub(crate) fn finish(self) -> (Option, Option, Option) { + let completed_at_ms = now_unix_timestamp_ms(); + ( + Some(self.started_at_ms), + Some(completed_at_ms), + completed_at_ms.checked_sub(self.started_at_ms), + ) + } +} + pub(crate) fn function_arguments(payload: ToolPayload) -> Result { match payload { ToolPayload::Function { arguments } => Ok(arguments), diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs index 8074f7fe04a7..89bfc3057958 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/close_agent.rs @@ -38,6 +38,7 @@ impl ToolHandler for Handler { "root is not a spawned agent".to_string(), )); } + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -45,6 +46,7 @@ impl ToolHandler for Handler { call_id: call_id.clone(), sender_thread_id: session.conversation_id, receiver_thread_id: agent_id, + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -58,6 +60,7 @@ impl ToolHandler for Handler { Ok(mut status_rx) => status_rx.borrow_and_update().clone(), Err(err) => { let status = session.services.agent_control.get_status(agent_id).await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -68,6 +71,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname.clone(), receiver_agent_role: receiver_agent.agent_role.clone(), status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) @@ -82,6 +88,7 @@ impl ToolHandler for Handler { .await .map_err(|err| collab_agent_error(agent_id, err)) .map(|_| ()); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -92,6 +99,9 @@ impl ToolHandler for Handler { receiver_agent_nickname: receiver_agent.agent_nickname, receiver_agent_role: receiver_agent.agent_role, status: status.clone(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs index a42cde8f62fe..c9719b9c5169 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs @@ -92,6 +92,7 @@ async fn handle_message_submission( "Tasks can't be assigned to the root agent".to_string(), )); } + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -100,6 +101,7 @@ async fn handle_message_submission( sender_thread_id: session.conversation_id, receiver_thread_id, prompt: prompt.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -127,6 +129,7 @@ async fn handle_message_submission( .agent_control .get_status(receiver_thread_id) .await; + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -138,6 +141,9 @@ async fn handle_message_submission( receiver_agent_role: receiver_agent.agent_role, prompt, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs index 26b6750c46f5..3170a157b7e7 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs @@ -45,6 +45,7 @@ impl ToolHandler for Handler { let session_source = turn.session_source.clone(); let child_depth = next_thread_spawn_depth(&session_source); + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -54,6 +55,7 @@ impl ToolHandler for Handler { prompt: prompt.clone(), model: args.model.clone().unwrap_or_default(), reasoning_effort: args.reasoning_effort.unwrap_or_default(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -169,6 +171,7 @@ impl ToolHandler for Handler { .and_then(|snapshot| snapshot.reasoning_effort) .unwrap_or(args.reasoning_effort.unwrap_or_default()); let nickname = new_agent_nickname.clone(); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -182,6 +185,9 @@ impl ToolHandler for Handler { model: effective_model, reasoning_effort: effective_reasoning_effort, status, + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs index 778c57be2136..dfcb6edf3bc6 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs @@ -44,6 +44,7 @@ impl ToolHandler for Handler { let mut mailbox_seq_rx = session.subscribe_mailbox_seq(); + let timing = CollabToolExecutionTiming::start(); session .send_event( &turn, @@ -52,6 +53,7 @@ impl ToolHandler for Handler { receiver_thread_ids: Vec::new(), receiver_agents: Vec::new(), call_id: call_id.clone(), + started_at_ms: timing.started_at_ms(), } .into(), ) @@ -65,6 +67,7 @@ impl ToolHandler for Handler { }; let result = WaitAgentResult::from_timed_out(timed_out); + let (started_at_ms, completed_at_ms, duration_ms) = timing.finish(); session .send_event( &turn, @@ -73,6 +76,9 @@ impl ToolHandler for Handler { call_id, agent_statuses: Vec::new(), statuses: HashMap::new(), + started_at_ms, + completed_at_ms, + duration_ms, } .into(), ) diff --git a/codex-rs/core/src/turn_timing.rs b/codex-rs/core/src/turn_timing.rs index d6bf37253f6e..1d0232cde7ac 100644 --- a/codex-rs/core/src/turn_timing.rs +++ b/codex-rs/core/src/turn_timing.rs @@ -107,7 +107,7 @@ fn now_unix_timestamp_secs() -> i64 { now_unix_timestamp_ms() / 1000 } -fn now_unix_timestamp_ms() -> i64 { +pub(crate) fn now_unix_timestamp_ms() -> i64 { let duration = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap_or_default(); diff --git a/codex-rs/core/tests/suite/items.rs b/codex-rs/core/tests/suite/items.rs index 053f03ca90c7..bf984bc264f4 100644 --- a/codex-rs/core/tests/suite/items.rs +++ b/codex-rs/core/tests/suite/items.rs @@ -303,6 +303,14 @@ async fn web_search_item_is_emitted() -> anyhow::Result<()> { }) .await?; + let started = wait_for_event_match(&codex, |ev| match ev { + EventMsg::ItemStarted(ItemStartedEvent { + item: TurnItem::WebSearch(item), + .. + }) => Some(item.clone()), + _ => None, + }) + .await; let begin = wait_for_event_match(&codex, |ev| match ev { EventMsg::WebSearchBegin(event) => Some(event.clone()), _ => None, @@ -317,8 +325,21 @@ async fn web_search_item_is_emitted() -> anyhow::Result<()> { }) .await; + assert_eq!(started.id, "web-search-1"); + assert!(started.started_at_ms.is_some()); + assert_eq!(started.completed_at_ms, None); + assert_eq!(started.duration_ms, None); assert_eq!(begin.call_id, "web-search-1"); assert_eq!(completed.id, begin.call_id); + assert_eq!(completed.started_at_ms, started.started_at_ms); + assert!(completed.completed_at_ms.is_some()); + assert_eq!( + completed.duration_ms, + completed + .started_at_ms + .zip(completed.completed_at_ms) + .and_then(|(started_at_ms, completed_at_ms)| completed_at_ms.checked_sub(started_at_ms)) + ); assert_eq!( completed.action, WebSearchAction::Search { diff --git a/codex-rs/core/tests/suite/rmcp_client.rs b/codex-rs/core/tests/suite/rmcp_client.rs index 0947f4fba76e..98404e515ed1 100644 --- a/codex-rs/core/tests/suite/rmcp_client.rs +++ b/codex-rs/core/tests/suite/rmcp_client.rs @@ -1101,6 +1101,8 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> { let EventMsg::McpToolCallBegin(begin) = begin_event else { unreachable!("begin"); }; + let started_at_ms = begin.started_at_ms; + assert!(started_at_ms.is_some()); assert_eq!( begin, McpToolCallBeginEvent { @@ -1111,6 +1113,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> { arguments: Some(json!({})), }, mcp_app_resource_uri: None, + started_at_ms, }, ); diff --git a/codex-rs/core/tests/suite/user_shell_cmd.rs b/codex-rs/core/tests/suite/user_shell_cmd.rs index 1285b9f9251e..8fee9037795c 100644 --- a/codex-rs/core/tests/suite/user_shell_cmd.rs +++ b/codex-rs/core/tests/suite/user_shell_cmd.rs @@ -117,7 +117,7 @@ async fn user_shell_cmd_can_be_interrupted() { .unwrap(); // Wait until it has started (ExecCommandBegin), then interrupt. - let _begin = wait_for_event_match(codex, |ev| match ev { + let begin = wait_for_event_match(codex, |ev| match ev { EventMsg::ExecCommandBegin(event) if event.source == ExecCommandSource::UserShell => { Some(event.clone()) } @@ -126,6 +126,16 @@ async fn user_shell_cmd_can_be_interrupted() { .await; codex.submit(Op::Interrupt).await.unwrap(); + let end = wait_for_event_match(codex, |ev| match ev { + EventMsg::ExecCommandEnd(event) if event.source == ExecCommandSource::UserShell => { + Some(event.clone()) + } + _ => None, + }) + .await; + assert_eq!(end.started_at_ms, begin.started_at_ms); + assert!(end.completed_at_ms.is_some()); + // Expect a TurnAborted(Interrupted) notification. let msg = wait_for_event_with_timeout( codex, diff --git a/codex-rs/protocol/src/dynamic_tools.rs b/codex-rs/protocol/src/dynamic_tools.rs index 2bee24972b2a..e756c14ce0cc 100644 --- a/codex-rs/protocol/src/dynamic_tools.rs +++ b/codex-rs/protocol/src/dynamic_tools.rs @@ -26,6 +26,9 @@ pub struct DynamicToolCallRequest { pub namespace: Option, pub tool: String, pub arguments: JsonValue, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema, TS)] diff --git a/codex-rs/protocol/src/items.rs b/codex-rs/protocol/src/items.rs index 687958857990..df3ad3ebedd3 100644 --- a/codex-rs/protocol/src/items.rs +++ b/codex-rs/protocol/src/items.rs @@ -112,6 +112,15 @@ pub struct WebSearchItem { pub id: String, pub query: String, pub action: WebSearchAction, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)] @@ -125,6 +134,15 @@ pub struct ImageGenerationItem { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub saved_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)] @@ -365,6 +383,9 @@ impl WebSearchItem { call_id: self.id.clone(), query: self.query.clone(), action: self.action.clone(), + started_at_ms: self.started_at_ms, + completed_at_ms: self.completed_at_ms, + duration_ms: self.duration_ms, }) } } @@ -377,11 +398,40 @@ impl ImageGenerationItem { revised_prompt: self.revised_prompt.clone(), result: self.result.clone(), saved_path: self.saved_path.clone(), + started_at_ms: self.started_at_ms, + completed_at_ms: self.completed_at_ms, + duration_ms: self.duration_ms, }) } } impl TurnItem { + pub fn set_started_at_ms(&mut self, started_at_ms: i64) { + match self { + TurnItem::WebSearch(item) => item.started_at_ms = Some(started_at_ms), + TurnItem::ImageGeneration(item) => item.started_at_ms = Some(started_at_ms), + _ => {} + } + } + + pub fn set_completed_timing_ms(&mut self, started_at_ms: Option, completed_at_ms: i64) { + match self { + TurnItem::WebSearch(item) => { + item.started_at_ms = started_at_ms; + item.completed_at_ms = Some(completed_at_ms); + item.duration_ms = started_at_ms + .and_then(|started_at_ms| completed_at_ms.checked_sub(started_at_ms)); + } + TurnItem::ImageGeneration(item) => { + item.started_at_ms = started_at_ms; + item.completed_at_ms = Some(completed_at_ms); + item.duration_ms = started_at_ms + .and_then(|started_at_ms| completed_at_ms.checked_sub(started_at_ms)); + } + _ => {} + } + } + pub fn id(&self) -> String { match self { TurnItem::UserMessage(item) => item.id.clone(), diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index f8c830184c41..258b8bee3b6a 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -1831,10 +1831,12 @@ impl HasLegacyEvent for ItemStartedEvent { match &self.item { TurnItem::WebSearch(item) => vec![EventMsg::WebSearchBegin(WebSearchBeginEvent { call_id: item.id.clone(), + started_at_ms: item.started_at_ms, })], TurnItem::ImageGeneration(item) => { vec![EventMsg::ImageGenerationBegin(ImageGenerationBeginEvent { call_id: item.id.clone(), + started_at_ms: item.started_at_ms, })] } _ => Vec::new(), @@ -2336,6 +2338,9 @@ pub struct McpToolCallBeginEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub mcp_app_resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS, PartialEq)] @@ -2346,6 +2351,12 @@ pub struct McpToolCallEndEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub mcp_app_resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, #[ts(type = "string")] pub duration: Duration, /// Result of the tool call. Note this could be an error. @@ -2371,6 +2382,14 @@ pub struct DynamicToolCallResponseEvent { pub success: bool, /// Optional error text when the tool call failed before producing a response. pub error: Option, + /// Unix timestamp (in milliseconds) when dynamic tool execution started, if known. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + /// Unix timestamp (in milliseconds) when dynamic tool execution completed, if known. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, /// The duration of the dynamic tool call. #[ts(type = "string")] pub duration: Duration, @@ -2388,6 +2407,9 @@ impl McpToolCallEndEvent { #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] pub struct WebSearchBeginEvent { pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -2395,11 +2417,23 @@ pub struct WebSearchEndEvent { pub call_id: String, pub query: String, pub action: WebSearchAction, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] pub struct ImageGenerationBeginEvent { pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -2413,6 +2447,15 @@ pub struct ImageGenerationEndEvent { #[serde(skip_serializing_if = "Option::is_none")] #[ts(optional)] pub saved_path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } // Conversation kept for backward compatibility. @@ -3080,6 +3123,9 @@ pub struct ExecCommandBeginEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub interaction_input: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -3104,6 +3150,12 @@ pub struct ExecCommandEndEvent { #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub interaction_input: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, /// Captured stdout pub stdout: String, @@ -3225,6 +3277,9 @@ pub struct PatchApplyBeginEvent { pub auto_approved: bool, /// The changes to be applied. pub changes: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)] @@ -3254,6 +3309,15 @@ pub struct PatchApplyEndEvent { pub changes: HashMap, /// Completion status for this patch application. pub status: PatchApplyStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] @@ -3776,6 +3840,9 @@ pub struct CollabAgentSpawnBeginEvent { pub prompt: String, pub model: String, pub reasoning_effort: ReasoningEffortConfig, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, JsonSchema, TS)] @@ -3827,6 +3894,15 @@ pub struct CollabAgentSpawnEndEvent { pub reasoning_effort: ReasoningEffortConfig, /// Last known status of the new agent reported to the sender agent. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3840,6 +3916,9 @@ pub struct CollabAgentInteractionBeginEvent { /// Prompt sent from the sender to the receiver. Can be empty to prevent CoT /// leaking at the beginning. pub prompt: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3861,6 +3940,15 @@ pub struct CollabAgentInteractionEndEvent { pub prompt: String, /// Last known status of the receiver agent reported to the sender agent. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3874,6 +3962,9 @@ pub struct CollabWaitingBeginEvent { pub receiver_agents: Vec, /// ID of the waiting call. pub call_id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3887,6 +3978,15 @@ pub struct CollabWaitingEndEvent { pub agent_statuses: Vec, /// Last known status of the receiver agents reported to the sender agent. pub statuses: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3897,6 +3997,9 @@ pub struct CollabCloseBeginEvent { pub sender_thread_id: ThreadId, /// Thread ID of the receiver. pub receiver_thread_id: ThreadId, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3916,6 +4019,15 @@ pub struct CollabCloseEndEvent { /// Last known status of the receiver agent reported to the sender agent before /// the close. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3932,6 +4044,9 @@ pub struct CollabResumeBeginEvent { /// Optional role assigned to the receiver agent. #[serde(default, skip_serializing_if = "Option::is_none")] pub receiver_agent_role: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)] @@ -3951,6 +4066,15 @@ pub struct CollabResumeEndEvent { /// Last known status of the receiver agent reported to the sender agent after /// resume. pub status: AgentStatus, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub started_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub completed_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub duration_ms: Option, } #[cfg(test)] @@ -4596,6 +4720,9 @@ mod tests { query: Some("find docs".into()), queries: None, }, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; @@ -4633,6 +4760,9 @@ mod tests { revised_prompt: None, result: String::new(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; @@ -4655,6 +4785,9 @@ mod tests { revised_prompt: Some("A tiny blue square".into()), result: "Zm9v".into(), saved_path: Some(test_path_buf("/tmp/ig-1.png").abs()), + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }), }; diff --git a/codex-rs/rollout/src/policy.rs b/codex-rs/rollout/src/policy.rs index 22615623f3c9..1b4591870bae 100644 --- a/codex-rs/rollout/src/policy.rs +++ b/codex-rs/rollout/src/policy.rs @@ -203,6 +203,9 @@ mod tests { revised_prompt: Some("final prompt".into()), result: "Zm9v".into(), saved_path: None, + started_at_ms: None, + completed_at_ms: None, + duration_ms: None, }); assert!(should_persist_event_msg( diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 5099c7eae447..cbb49069f400 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -4246,6 +4246,7 @@ impl ChatWidget { call_id, query, action, + .. } = ev; let mut handled = false; if let Some(cell) = self @@ -4284,6 +4285,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } = item else { return; @@ -4342,6 +4346,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent spawn failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, spawn_request.as_ref(), )); @@ -4370,6 +4377,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent interaction failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4388,6 +4398,7 @@ impl ChatWidget { receiver_agent_role: first_receiver_metadata .as_ref() .and_then(|metadata| metadata.agent_role.clone()), + started_at_ms, }, )); } else { @@ -4409,6 +4420,9 @@ impl ChatWidget { .unwrap_or_else(|| { AgentStatus::Errored("Agent resume failed".into()) }), + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4430,6 +4444,7 @@ impl ChatWidget { &self.collab_agent_metadata, ), call_id: id, + started_at_ms, }, )); } else { @@ -4444,6 +4459,9 @@ impl ChatWidget { call_id: id, agent_statuses, statuses, + started_at_ms, + completed_at_ms, + duration_ms, }, )); } @@ -4463,6 +4481,9 @@ impl ChatWidget { receiver_agent_role: first_receiver_metadata .as_ref() .and_then(|metadata| metadata.agent_role.clone()), + started_at_ms, + completed_at_ms, + duration_ms, status: receiver_thread_ids .iter() .find_map(|thread_id| agents_states.get(thread_id)) @@ -6508,6 +6529,8 @@ impl ChatWidget { command_actions, aggregated_output, exit_code, + started_at_ms, + completed_at_ms, duration_ms, } => { if matches!( @@ -6526,6 +6549,7 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, }); } else { let aggregated_output = aggregated_output.unwrap_or_default(); @@ -6541,6 +6565,8 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, + completed_at_ms, stdout: String::new(), stderr: String::new(), aggregated_output: aggregated_output.clone(), @@ -6570,6 +6596,9 @@ impl ChatWidget { id, changes, status, + started_at_ms, + completed_at_ms, + duration_ms, } => { if !matches!( status, @@ -6599,6 +6628,9 @@ impl ChatWidget { codex_protocol::protocol::PatchApplyStatus::Failed } }, + started_at_ms, + completed_at_ms, + duration_ms, }); } } @@ -6610,6 +6642,8 @@ impl ChatWidget { mcp_app_resource_uri, result, error, + started_at_ms, + completed_at_ms, duration_ms, .. } => { @@ -6621,6 +6655,8 @@ impl ChatWidget { arguments: Some(arguments), }, mcp_app_resource_uri, + started_at_ms, + completed_at_ms, duration: Duration::from_millis(duration_ms.unwrap_or_default().max(0) as u64), result: match (result, error) { (_, Some(error)) => Err(error.message), @@ -6637,9 +6673,17 @@ impl ChatWidget { }, }); } - ThreadItem::WebSearch { id, query, action } => { + ThreadItem::WebSearch { + id, + query, + action, + started_at_ms, + completed_at_ms, + duration_ms, + } => { self.on_web_search_begin(WebSearchBeginEvent { call_id: id.clone(), + started_at_ms, }); self.on_web_search_end(WebSearchEndEvent { call_id: id, @@ -6647,6 +6691,9 @@ impl ChatWidget { action: action .map(web_search_action_to_core) .unwrap_or(codex_protocol::models::WebSearchAction::Other), + started_at_ms, + completed_at_ms, + duration_ms, }); } ThreadItem::ImageView { id, path } => { @@ -6658,6 +6705,9 @@ impl ChatWidget { revised_prompt, result, saved_path, + started_at_ms, + completed_at_ms, + duration_ms, } => { self.on_image_generation_end(ImageGenerationEndEvent { call_id: id, @@ -6665,6 +6715,9 @@ impl ChatWidget { revised_prompt, status, saved_path, + started_at_ms, + completed_at_ms, + duration_ms, }); } ThreadItem::EnteredReviewMode { review, .. } => { @@ -6689,6 +6742,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } => self.on_collab_agent_tool_call(ThreadItem::CollabAgentToolCall { id, tool, @@ -6699,6 +6755,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, }), ThreadItem::DynamicToolCall { .. } => {} } @@ -7127,6 +7186,7 @@ impl ChatWidget { process_id, source, command_actions, + started_at_ms, .. } => { self.on_exec_command_begin(ExecCommandBeginEvent { @@ -7141,14 +7201,21 @@ impl ChatWidget { .collect(), source: source.to_core(), interaction_input: None, + started_at_ms, }); } - ThreadItem::FileChange { id, changes, .. } => { + ThreadItem::FileChange { + id, + changes, + started_at_ms, + .. + } => { self.on_patch_apply_begin(PatchApplyBeginEvent { call_id: id, turn_id: notification.turn_id, auto_approved: false, changes: file_update_changes_to_core(changes), + started_at_ms, }); } ThreadItem::McpToolCall { @@ -7157,6 +7224,7 @@ impl ChatWidget { tool, arguments, mcp_app_resource_uri, + started_at_ms, .. } => { self.on_mcp_tool_call_begin(McpToolCallBeginEvent { @@ -7167,13 +7235,24 @@ impl ChatWidget { arguments: Some(arguments), }, mcp_app_resource_uri, + started_at_ms, }); } - ThreadItem::WebSearch { id, .. } => { - self.on_web_search_begin(WebSearchBeginEvent { call_id: id }); + ThreadItem::WebSearch { + id, started_at_ms, .. + } => { + self.on_web_search_begin(WebSearchBeginEvent { + call_id: id, + started_at_ms, + }); } - ThreadItem::ImageGeneration { id, .. } => { - self.on_image_generation_begin(ImageGenerationBeginEvent { call_id: id }); + ThreadItem::ImageGeneration { + id, started_at_ms, .. + } => { + self.on_image_generation_begin(ImageGenerationBeginEvent { + call_id: id, + started_at_ms, + }); } ThreadItem::CollabAgentToolCall { id, @@ -7185,6 +7264,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, } => self.on_collab_agent_tool_call(ThreadItem::CollabAgentToolCall { id, tool, @@ -7195,6 +7277,9 @@ impl ChatWidget { model, reasoning_effort, agents_states, + started_at_ms, + completed_at_ms, + duration_ms, }), ThreadItem::EnteredReviewMode { review, .. } => { if !from_replay { diff --git a/codex-rs/tui/src/multi_agents.rs b/codex-rs/tui/src/multi_agents.rs index 293c80fcf0c4..e9267c782113 100644 --- a/codex-rs/tui/src/multi_agents.rs +++ b/codex-rs/tui/src/multi_agents.rs @@ -215,6 +215,7 @@ pub(crate) fn interaction_end(ev: CollabAgentInteractionEndEvent) -> PlainHistor receiver_agent_role, prompt, status: _, + .. } = ev; let title = title_with_agent( @@ -240,6 +241,7 @@ pub(crate) fn waiting_begin(ev: CollabWaitingBeginEvent) -> PlainHistoryCell { receiver_thread_ids, receiver_agents, call_id: _, + .. } = ev; let receiver_agents = merge_wait_receivers(&receiver_thread_ids, receiver_agents); @@ -271,6 +273,7 @@ pub(crate) fn waiting_end(ev: CollabWaitingEndEvent) -> PlainHistoryCell { sender_thread_id: _, agent_statuses, statuses, + .. } = ev; let details = wait_complete_lines(&statuses, &agent_statuses); collab_event(title_text("Finished waiting"), details) @@ -284,6 +287,7 @@ pub(crate) fn close_end(ev: CollabCloseEndEvent) -> PlainHistoryCell { receiver_agent_nickname, receiver_agent_role, status: _, + .. } = ev; collab_event( @@ -307,6 +311,7 @@ pub(crate) fn resume_begin(ev: CollabResumeBeginEvent) -> PlainHistoryCell { receiver_thread_id, receiver_agent_nickname, receiver_agent_role, + .. } = ev; collab_event( @@ -331,6 +336,7 @@ pub(crate) fn resume_end(ev: CollabResumeEndEvent) -> PlainHistoryCell { receiver_agent_nickname, receiver_agent_role, status, + .. } = ev; collab_event(