Add command summary metadata for exec command lifecycle

This commit is contained in:
Francis Chalissery
2026-04-09 17:30:16 -07:00
parent a44645129a
commit be22c4072c
40 changed files with 696 additions and 30 deletions
@@ -792,6 +792,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"ConfigWarningNotification": {
"properties": {
"details": {
@@ -2739,6 +2756,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -6273,6 +6273,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"Config": {
"additionalProperties": true,
"properties": {
@@ -12921,6 +12938,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/v2/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -2921,6 +2921,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"Config": {
"additionalProperties": true,
"properties": {
@@ -10776,6 +10793,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -195,6 +195,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -664,6 +681,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -195,6 +195,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -664,6 +681,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -331,6 +331,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -807,6 +824,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -396,6 +396,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1321,6 +1338,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -396,6 +396,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1321,6 +1338,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -396,6 +396,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1321,6 +1338,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -334,6 +334,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -1079,6 +1096,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -331,6 +331,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -807,6 +824,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -331,6 +331,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -807,6 +824,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -331,6 +331,23 @@
],
"type": "string"
},
"CommandSummary": {
"properties": {
"past": {
"description": "Past-tense prose summary, for example \"Pulled most recent code\".",
"type": "string"
},
"present": {
"description": "Present-tense prose summary, for example \"Pulling most recent code\".",
"type": "string"
}
},
"required": [
"past",
"present"
],
"type": "object"
},
"DynamicToolCallOutputContentItem": {
"oneOf": [
{
@@ -807,6 +824,17 @@
},
"type": "array"
},
"commandSummary": {
"anyOf": [
{
"$ref": "#/definitions/CommandSummary"
},
{
"type": "null"
}
],
"description": "Optional short prose summaries for non-technical surfaces."
},
"cwd": {
"description": "The command's working directory.",
"type": "string"
@@ -0,0 +1,13 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type CommandSummary = {
/**
* Present-tense prose summary, for example "Pulling most recent code".
*/
present: string,
/**
* Past-tense prose summary, for example "Pulled most recent code".
*/
past: string, };
@@ -10,6 +10,7 @@ import type { CollabAgentToolCallStatus } from "./CollabAgentToolCallStatus";
import type { CommandAction } from "./CommandAction";
import type { CommandExecutionSource } from "./CommandExecutionSource";
import type { CommandExecutionStatus } from "./CommandExecutionStatus";
import type { CommandSummary } from "./CommandSummary";
import type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputContentItem";
import type { DynamicToolCallStatus } from "./DynamicToolCallStatus";
import type { FileUpdateChange } from "./FileUpdateChange";
@@ -44,15 +45,19 @@ commandActions: Array<CommandAction>,
/**
* The command's output, aggregated from stdout and stderr.
*/
aggregatedOutput: string | null,
aggregatedOutput: string | null,
/**
* The command's exit code.
*/
exitCode: number | null,
exitCode: number | null,
/**
* The duration of the command execution in milliseconds.
*/
durationMs: number | null, } | { "type": "fileChange", id: string, changes: Array<FileUpdateChange>, status: PatchApplyStatus, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, result: McpToolCallResult | null, error: McpToolCallError | null,
durationMs: number | null,
/**
* Optional short prose summaries for non-technical surfaces.
*/
commandSummary: CommandSummary | null, } | { "type": "fileChange", id: string, changes: Array<FileUpdateChange>, status: PatchApplyStatus, } | { "type": "mcpToolCall", id: string, server: string, tool: string, status: McpToolCallStatus, arguments: JsonValue, result: McpToolCallResult | null, error: McpToolCallError | null,
/**
* The duration of the MCP tool call in milliseconds.
*/
@@ -55,6 +55,7 @@ export type { CommandExecutionRequestApprovalParams } from "./CommandExecutionRe
export type { CommandExecutionRequestApprovalResponse } from "./CommandExecutionRequestApprovalResponse";
export type { CommandExecutionSource } from "./CommandExecutionSource";
export type { CommandExecutionStatus } from "./CommandExecutionStatus";
export type { CommandSummary } from "./CommandSummary";
export type { Config } from "./Config";
export type { ConfigBatchWriteParams } from "./ConfigBatchWriteParams";
export type { ConfigEdit } from "./ConfigEdit";
@@ -82,6 +82,7 @@ pub fn build_command_execution_approval_request_item(
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: None,
}
}
@@ -102,6 +103,7 @@ pub fn build_command_execution_begin_item(payload: &ExecCommandBeginEvent) -> Th
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: payload.command_summary.clone().map(Into::into),
}
}
@@ -129,6 +131,7 @@ pub fn build_command_execution_end_item(payload: &ExecCommandEndEvent) -> Thread
aggregated_output,
exit_code: Some(payload.exit_code),
duration_ms: Some(duration_ms),
command_summary: payload.command_summary.clone().map(Into::into),
}
}
@@ -157,6 +160,7 @@ pub fn build_item_from_guardian_event(
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: None,
})
}
GuardianAssessmentAction::Execve {
@@ -189,6 +193,7 @@ pub fn build_item_from_guardian_event(
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: None,
})
}
GuardianAssessmentAction::ApplyPatch { .. }
@@ -1791,6 +1791,7 @@ mod tests {
}],
source: ExecCommandSource::Agent,
interaction_input: None,
command_summary: None,
stdout: String::new(),
stderr: String::new(),
aggregated_output: "hello world\n".into(),
@@ -1844,6 +1845,7 @@ mod tests {
aggregated_output: Some("hello world\n".into()),
exit_code: Some(0),
duration_ms: Some(12),
command_summary: None,
}
);
assert_eq!(
@@ -2008,6 +2010,7 @@ mod tests {
parsed_cmd: vec![ParsedCommand::Unknown { cmd: "ls".into() }],
source: ExecCommandSource::Agent,
interaction_input: None,
command_summary: None,
stdout: String::new(),
stderr: "exec command rejected by user".into(),
aggregated_output: "exec command rejected by user".into(),
@@ -2056,6 +2059,7 @@ mod tests {
aggregated_output: Some("exec command rejected by user".into()),
exit_code: Some(-1),
duration_ms: Some(0),
command_summary: None,
}
);
assert_eq!(
@@ -2141,6 +2145,7 @@ mod tests {
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: None,
}
);
}
@@ -2200,6 +2205,7 @@ mod tests {
aggregated_output: None,
exit_code: None,
duration_ms: None,
command_summary: None,
}
);
}
@@ -2248,6 +2254,7 @@ mod tests {
}],
source: ExecCommandSource::Agent,
interaction_input: None,
command_summary: None,
stdout: "done\n".into(),
stderr: String::new(),
aggregated_output: "done\n".into(),
@@ -2289,6 +2296,7 @@ mod tests {
aggregated_output: Some("done\n".into()),
exit_code: Some(0),
duration_ms: Some(5),
command_summary: None,
}
);
}
@@ -2337,6 +2345,7 @@ mod tests {
}],
source: ExecCommandSource::Agent,
interaction_input: None,
command_summary: None,
stdout: "done\n".into(),
stderr: String::new(),
aggregated_output: "done\n".into(),
@@ -4392,6 +4392,8 @@ pub enum ThreadItem {
/// The duration of the command execution in milliseconds.
#[ts(type = "number | null")]
duration_ms: Option<i64>,
/// Optional short prose summaries for non-technical surfaces.
command_summary: Option<CommandSummary>,
},
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
@@ -4920,6 +4922,25 @@ pub enum CommandExecutionStatus {
Declined,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct CommandSummary {
/// Present-tense prose summary, for example "Pulling most recent code".
pub present: String,
/// Past-tense prose summary, for example "Pulled most recent code".
pub past: String,
}
impl From<codex_protocol::protocol::CommandSummary> for CommandSummary {
fn from(value: codex_protocol::protocol::CommandSummary) -> Self {
Self {
present: value.present,
past: value.past,
}
}
}
impl From<CoreExecCommandStatus> for CommandExecutionStatus {
fn from(value: CoreExecCommandStatus) -> Self {
Self::from(&value)