diff --git a/mise.toml b/mise.toml index d5ccaba..89528a2 100644 --- a/mise.toml +++ b/mise.toml @@ -5,6 +5,8 @@ jq = "1.8.1" node = "24.16.0" "npm:ajv-cli" = "5.0.0" +"npm:json-schema-to-typescript" = "15.0.4" +"npm:typescript" = "6.0.3" [tasks.setup] description = "Install tools and configure Git hooks" @@ -24,7 +26,7 @@ run = "hk check" [tasks.test] description = "Run tests for this repository" -depends = ["check:json", "check:schema", "check:conformance"] +depends = ["check:json", "check:schema", "check:conformance", "check:typescript-generation"] [tasks."check:json"] description = "Validate JSON and JSONL syntax" @@ -47,6 +49,10 @@ node scripts/check-schema-descriptions.mjs description = "Validate conformance manifest documentation and diagnostic registry" run = "node scripts/check-conformance.mjs" +[tasks."check:typescript-generation"] +description = "Validate release schema TypeScript generation and smoke contracts" +run = "node scripts/check-typescript-generation.mjs" + [tasks."check:actions"] description = "Validate GitHub Actions workflows" run = "if [ -d .github/workflows ]; then actionlint && zizmor .github/workflows; else echo 'No GitHub Actions workflows configured.'; fi" diff --git a/schema/draft.json b/schema/draft.json index 63db1af..048df90 100644 --- a/schema/draft.json +++ b/schema/draft.json @@ -1174,1385 +1174,307 @@ "properties": { "type": { "const": "tool_call", "description": "Tool call event discriminator." }, "payload": { - "oneOf": [ - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_read", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileReadArgs", - "description": "Arguments for a file read tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file read tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_read", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileReadArgs", - "description": "Arguments for a file read tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file read tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_write", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileWriteArgs", - "description": "Arguments for a file write tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file write tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_write", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileWriteArgs", - "description": "Arguments for a file write tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file write tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileEditArgs", - "description": "Arguments for a file edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileEditArgs", - "description": "Arguments for a file edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_patch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFilePatchArgs", - "description": "Arguments for an atomic multi-file patch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file patch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_patch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFilePatchArgs", - "description": "Arguments for an atomic multi-file patch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file patch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_list", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileListArgs", - "description": "Arguments for a file listing tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file list tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_list", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileListArgs", - "description": "Arguments for a file listing tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file list tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileSearchArgs", - "description": "Arguments for a file search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileSearchArgs", - "description": "Arguments for a file search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_command", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellCommandArgs", - "description": "Arguments for a shell command tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell command tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_command", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellCommandArgs", - "description": "Arguments for a shell command tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell command tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_output", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellOutputArgs", - "description": "Arguments for polling shell command output." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell output tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_output", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellOutputArgs", - "description": "Arguments for polling shell command output." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell output tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_input", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellInputArgs", - "description": "Arguments for sending input to a running shell command." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell input tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_input", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellInputArgs", - "description": "Arguments for sending input to a running shell command." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell input tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "mcp_call", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallMcpCallArgs", - "description": "Arguments for an MCP tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated mcp call tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "mcp_call", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallMcpCallArgs", - "description": "Arguments for an MCP tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated mcp call tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "web_fetch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebFetchArgs", - "description": "Arguments for a web fetch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated web fetch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "web_fetch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebFetchArgs", - "description": "Arguments for a web fetch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated web fetch tool call payload." - }, + "allOf": [ { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "web_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebSearchArgs", - "description": "Arguments for a web search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } + "oneOf": [ + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated web search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "web_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebSearchArgs", - "description": "Arguments for a web search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + "properties": { + "tool": { + "const": "file_read", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileReadArgs", + "description": "Arguments for a file read tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated web search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "tool_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallToolSearchArgs", - "description": "Arguments for a tool discovery search." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file read." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_write", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileWriteArgs", + "description": "Arguments for a file write tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated tool search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "tool_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallToolSearchArgs", - "description": "Arguments for a tool discovery search." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file write." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_edit", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileEditArgs", + "description": "Arguments for a file edit tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated tool search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "notebook_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallNotebookEditArgs", - "description": "Arguments for a notebook edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file edit." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_patch", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFilePatchArgs", + "description": "Arguments for an atomic multi-file patch tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated notebook edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "notebook_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallNotebookEditArgs", - "description": "Arguments for a notebook edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file patch." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_list", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileListArgs", + "description": "Arguments for a file listing tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated notebook edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "subagent_invoke", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallSubagentInvokeArgs", - "description": "Arguments for invoking a subagent." + }, + "description": "Tool call payload for file list." }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallFileSearchArgs", + "description": "Arguments for a file search tool call." + } + }, + "description": "Tool call payload for file search." }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_command", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallShellCommandArgs", + "description": "Arguments for a shell command tool call." + } + }, + "description": "Tool call payload for shell command." }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_output", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallShellOutputArgs", + "description": "Arguments for polling shell command output." + } + }, + "description": "Tool call payload for shell output." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_input", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallShellInputArgs", + "description": "Arguments for sending input to a running shell command." } + }, + "description": "Tool call payload for shell input." + }, + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated subagent invoke tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "subagent_invoke", - "description": "Canonical kind of tool requested by the agent." + "properties": { + "tool": { + "const": "mcp_call", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallMcpCallArgs", + "description": "Arguments for an MCP tool call." + } + }, + "description": "Tool call payload for mcp call." }, - "args": { - "$ref": "#/$defs/toolCallSubagentInvokeArgs", - "description": "Arguments for invoking a subagent." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "web_fetch", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallWebFetchArgs", + "description": "Arguments for a web fetch tool call." + } + }, + "description": "Tool call payload for web fetch." }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "web_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallWebSearchArgs", + "description": "Arguments for a web search tool call." + } + }, + "description": "Tool call payload for web search." }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "tool_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallToolSearchArgs", + "description": "Arguments for a tool discovery search." + } + }, + "description": "Tool call payload for tool search." }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "notebook_edit", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallNotebookEditArgs", + "description": "Arguments for a notebook edit tool call." + } + }, + "description": "Tool call payload for notebook edit." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "subagent_invoke", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallSubagentInvokeArgs", + "description": "Arguments for invoking a subagent." } + }, + "description": "Tool call payload for subagent invoke." + }, + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." + "properties": { + "tool": { + "const": "other", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallOtherArgs", + "description": "Opaque arguments for the unclassified tool call." + } + }, + "description": "Tool call payload for other." } - }, - "additionalProperties": false, - "description": "Truncated subagent invoke tool call payload." + ], + "description": "Registered tool call discriminator and arguments." }, { "type": "object", - "required": [ - "tool", - "args" - ], "properties": { - "tool": { - "const": "other", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallOtherArgs", - "description": "Opaque arguments for the unclassified tool call." - }, "usage": { "$ref": "#/$defs/agentMessageUsage", "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, "overflow_ref": { "oneOf": [ { @@ -2566,56 +1488,49 @@ "description": "Content-addressed reference to full arguments when arguments are truncated." } }, - "additionalProperties": false, - "description": "Non-truncated other tool call payload." + "description": "Optional fields shared by all tool call payloads." }, { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "other", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallOtherArgs", - "description": "Opaque arguments for the unclassified tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + "oneOf": [ + { + "type": "object", + "required": [ + "truncated", + "args_size" + ], + "properties": { + "truncated": { + "const": true, + "description": "Whether tool-call arguments were truncated before emission." + }, + "args_size": { + "type": "integer", + "minimum": 0, + "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + } + }, + "description": "Truncated tool call arguments marker." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "properties": { + "truncated": { + "const": false, + "description": "Whether tool-call arguments were truncated before emission." }, - { - "type": "null" + "args_size": { + "type": "integer", + "minimum": 0, + "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." + }, + "description": "Non-truncated tool call arguments marker." } - }, - "additionalProperties": false, - "description": "Truncated other tool call payload." + ], + "description": "Tool call argument truncation state." } ], + "unevaluatedProperties": false, "description": "Tool call event payload." } } diff --git a/schema/v0.1.0.json b/schema/v0.1.0.json index 63db1af..048df90 100644 --- a/schema/v0.1.0.json +++ b/schema/v0.1.0.json @@ -1174,1385 +1174,307 @@ "properties": { "type": { "const": "tool_call", "description": "Tool call event discriminator." }, "payload": { - "oneOf": [ - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_read", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileReadArgs", - "description": "Arguments for a file read tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file read tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_read", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileReadArgs", - "description": "Arguments for a file read tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file read tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_write", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileWriteArgs", - "description": "Arguments for a file write tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file write tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_write", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileWriteArgs", - "description": "Arguments for a file write tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file write tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileEditArgs", - "description": "Arguments for a file edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileEditArgs", - "description": "Arguments for a file edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_patch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFilePatchArgs", - "description": "Arguments for an atomic multi-file patch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file patch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_patch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFilePatchArgs", - "description": "Arguments for an atomic multi-file patch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file patch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_list", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileListArgs", - "description": "Arguments for a file listing tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file list tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_list", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileListArgs", - "description": "Arguments for a file listing tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file list tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "file_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileSearchArgs", - "description": "Arguments for a file search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated file search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "file_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallFileSearchArgs", - "description": "Arguments for a file search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated file search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_command", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellCommandArgs", - "description": "Arguments for a shell command tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell command tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_command", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellCommandArgs", - "description": "Arguments for a shell command tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell command tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_output", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellOutputArgs", - "description": "Arguments for polling shell command output." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell output tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_output", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellOutputArgs", - "description": "Arguments for polling shell command output." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell output tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "shell_input", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellInputArgs", - "description": "Arguments for sending input to a running shell command." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated shell input tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "shell_input", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallShellInputArgs", - "description": "Arguments for sending input to a running shell command." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated shell input tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "mcp_call", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallMcpCallArgs", - "description": "Arguments for an MCP tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated mcp call tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "mcp_call", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallMcpCallArgs", - "description": "Arguments for an MCP tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated mcp call tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "web_fetch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebFetchArgs", - "description": "Arguments for a web fetch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated web fetch tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "web_fetch", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebFetchArgs", - "description": "Arguments for a web fetch tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated web fetch tool call payload." - }, + "allOf": [ { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "web_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebSearchArgs", - "description": "Arguments for a web search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" - }, - { - "type": "null" - } + "oneOf": [ + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated web search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "web_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallWebSearchArgs", - "description": "Arguments for a web search tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + "properties": { + "tool": { + "const": "file_read", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileReadArgs", + "description": "Arguments for a file read tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated web search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "tool_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallToolSearchArgs", - "description": "Arguments for a tool discovery search." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file read." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_write", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileWriteArgs", + "description": "Arguments for a file write tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated tool search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "tool_search", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallToolSearchArgs", - "description": "Arguments for a tool discovery search." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file write." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_edit", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileEditArgs", + "description": "Arguments for a file edit tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated tool search tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "notebook_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallNotebookEditArgs", - "description": "Arguments for a notebook edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file edit." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_patch", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFilePatchArgs", + "description": "Arguments for an atomic multi-file patch tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated notebook edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "notebook_edit", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallNotebookEditArgs", - "description": "Arguments for a notebook edit tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + }, + "description": "Tool call payload for file patch." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_list", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallFileListArgs", + "description": "Arguments for a file listing tool call." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Truncated notebook edit tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args" - ], - "properties": { - "tool": { - "const": "subagent_invoke", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallSubagentInvokeArgs", - "description": "Arguments for invoking a subagent." + }, + "description": "Tool call payload for file list." }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "file_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallFileSearchArgs", + "description": "Arguments for a file search tool call." + } + }, + "description": "Tool call payload for file search." }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_command", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallShellCommandArgs", + "description": "Arguments for a shell command tool call." + } + }, + "description": "Tool call payload for shell command." }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_output", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallShellOutputArgs", + "description": "Arguments for polling shell command output." + } + }, + "description": "Tool call payload for shell output." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "shell_input", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallShellInputArgs", + "description": "Arguments for sending input to a running shell command." } + }, + "description": "Tool call payload for shell input." + }, + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." - } - }, - "additionalProperties": false, - "description": "Non-truncated subagent invoke tool call payload." - }, - { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "subagent_invoke", - "description": "Canonical kind of tool requested by the agent." + "properties": { + "tool": { + "const": "mcp_call", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallMcpCallArgs", + "description": "Arguments for an MCP tool call." + } + }, + "description": "Tool call payload for mcp call." }, - "args": { - "$ref": "#/$defs/toolCallSubagentInvokeArgs", - "description": "Arguments for invoking a subagent." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "web_fetch", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallWebFetchArgs", + "description": "Arguments for a web fetch tool call." + } + }, + "description": "Tool call payload for web fetch." }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "web_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallWebSearchArgs", + "description": "Arguments for a web search tool call." + } + }, + "description": "Tool call payload for web search." }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "tool_search", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallToolSearchArgs", + "description": "Arguments for a tool discovery search." + } + }, + "description": "Tool call payload for tool search." }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "notebook_edit", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallNotebookEditArgs", + "description": "Arguments for a notebook edit tool call." + } + }, + "description": "Tool call payload for notebook edit." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "required": [ + "tool", + "args" + ], + "properties": { + "tool": { + "const": "subagent_invoke", + "description": "Canonical kind of tool requested by the agent." }, - { - "type": "null" + "args": { + "$ref": "#/$defs/toolCallSubagentInvokeArgs", + "description": "Arguments for invoking a subagent." } + }, + "description": "Tool call payload for subagent invoke." + }, + { + "type": "object", + "required": [ + "tool", + "args" ], - "description": "Content-addressed reference to full arguments when arguments are truncated." + "properties": { + "tool": { + "const": "other", + "description": "Canonical kind of tool requested by the agent." + }, + "args": { + "$ref": "#/$defs/toolCallOtherArgs", + "description": "Opaque arguments for the unclassified tool call." + } + }, + "description": "Tool call payload for other." } - }, - "additionalProperties": false, - "description": "Truncated subagent invoke tool call payload." + ], + "description": "Registered tool call discriminator and arguments." }, { "type": "object", - "required": [ - "tool", - "args" - ], "properties": { - "tool": { - "const": "other", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallOtherArgs", - "description": "Opaque arguments for the unclassified tool call." - }, "usage": { "$ref": "#/$defs/agentMessageUsage", "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." }, - "truncated": { - "const": false, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." - }, "overflow_ref": { "oneOf": [ { @@ -2566,56 +1488,49 @@ "description": "Content-addressed reference to full arguments when arguments are truncated." } }, - "additionalProperties": false, - "description": "Non-truncated other tool call payload." + "description": "Optional fields shared by all tool call payloads." }, { - "type": "object", - "required": [ - "tool", - "args", - "truncated", - "args_size" - ], - "properties": { - "tool": { - "const": "other", - "description": "Canonical kind of tool requested by the agent." - }, - "args": { - "$ref": "#/$defs/toolCallOtherArgs", - "description": "Opaque arguments for the unclassified tool call." - }, - "usage": { - "$ref": "#/$defs/agentMessageUsage", - "description": "Token usage attached to this tool call when it is the first usage-capable derived entry." - }, - "truncated": { - "const": true, - "description": "Whether tool-call arguments were truncated before emission." - }, - "args_size": { - "type": "integer", - "minimum": 0, - "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + "oneOf": [ + { + "type": "object", + "required": [ + "truncated", + "args_size" + ], + "properties": { + "truncated": { + "const": true, + "description": "Whether tool-call arguments were truncated before emission." + }, + "args_size": { + "type": "integer", + "minimum": 0, + "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." + } + }, + "description": "Truncated tool call arguments marker." }, - "overflow_ref": { - "oneOf": [ - { - "type": "string", - "pattern": "^sha256:[a-f0-9]{64}$" + { + "type": "object", + "properties": { + "truncated": { + "const": false, + "description": "Whether tool-call arguments were truncated before emission." }, - { - "type": "null" + "args_size": { + "type": "integer", + "minimum": 0, + "description": "UTF-8 byte length of the original args object before truncation. Required when truncated is true." } - ], - "description": "Content-addressed reference to full arguments when arguments are truncated." + }, + "description": "Non-truncated tool call arguments marker." } - }, - "additionalProperties": false, - "description": "Truncated other tool call payload." + ], + "description": "Tool call argument truncation state." } ], + "unevaluatedProperties": false, "description": "Tool call event payload." } } diff --git a/scripts/check-typescript-generation.mjs b/scripts/check-typescript-generation.mjs new file mode 100644 index 0000000..07f2081 --- /dev/null +++ b/scripts/check-typescript-generation.mjs @@ -0,0 +1,219 @@ +import { execFile } from "node:child_process"; +import { mkdtemp, readFile, realpath, writeFile } from "node:fs/promises"; +import { createRequire } from "node:module"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { tmpdir } from "node:os"; + +const repoRoot = new URL("../", import.meta.url); +const schemaUrl = new URL("schema/v0.1.0.json", repoRoot); +const scriptPath = fileURLToPath(import.meta.url); +const generationTimeoutMs = Number(process.env.AGENT_TRAIL_TS_GENERATION_TIMEOUT_MS ?? 10_000); +const commandTimeoutMs = 10_000; + +function fail(message) { + console.error(message); + process.exit(1); +} + +function execFilePromise(command, args, options = {}) { + return new Promise((resolve, reject) => { + execFile(command, args, options, (error, stdout, stderr) => { + if (error !== null) { + error.stdout = stdout; + error.stderr = stderr; + reject(error); + return; + } + resolve({ stdout, stderr }); + }); + }); +} + +async function run(command, args, options = {}) { + try { + return await execFilePromise(command, args, { + cwd: fileURLToPath(repoRoot), + encoding: "utf8", + maxBuffer: 20 * 1024 * 1024, + timeout: commandTimeoutMs, + ...options, + }); + } catch (error) { + const details = [error.message, error.stdout, error.stderr].filter(Boolean).join("\n"); + throw new Error(`${command} ${args.join(" ")} failed:\n${details}`); + } +} + +async function findPackageRoot(binName, packageName) { + const { stdout } = await run("mise", ["which", binName]); + let current = dirname(await realpath(stdout.trim())); + + while (current !== dirname(current)) { + try { + const packageJson = JSON.parse(await readFile(join(current, "package.json"), "utf8")); + if (packageJson.name === packageName) return current; + } catch { + // Keep walking to the package root. + } + current = dirname(current); + } + + throw new Error(`Unable to resolve ${packageName} from ${binName}.`); +} + +async function loadJsonSchemaToTypescript() { + const require = createRequire(import.meta.url); + try { + return require("json-schema-to-typescript"); + } catch { + const packageRoot = await findPackageRoot("json2ts", "json-schema-to-typescript"); + return require(packageRoot); + } +} + +async function runGenerateChild() { + const { compile } = await loadJsonSchemaToTypescript(); + const schema = JSON.parse(await readFile(schemaUrl, "utf8")); + const generated = await compile(schema, "AgentTrail", { + bannerComment: "", + cwd: fileURLToPath(repoRoot), + format: false, + strictIndexSignatures: true, + unreachableDefinitions: true, + unknownAny: true, + }); + + process.stdout.write(generated); +} + +async function generateTypes() { + const start = performance.now(); + try { + const { stdout } = await execFilePromise(process.execPath, [scriptPath], { + cwd: fileURLToPath(repoRoot), + encoding: "utf8", + env: { ...process.env, AGENT_TRAIL_TS_GENERATE_CHILD: "1" }, + maxBuffer: 20 * 1024 * 1024, + timeout: generationTimeoutMs, + }); + const elapsedMs = performance.now() - start; + return { source: stdout, elapsedMs }; + } catch (error) { + if (error.killed || error.signal === "SIGTERM") { + throw new Error( + `json-schema-to-typescript exceeded ${generationTimeoutMs}ms for schema/v0.1.0.json.`, + ); + } + const details = [error.message, error.stdout, error.stderr].filter(Boolean).join("\n"); + throw new Error(`json-schema-to-typescript failed:\n${details}`); + } +} + +function smokeSource() { + return `import type { AgentTrailV010 } from "./agent-trail.generated"; + +const id = "00000000-0000-4000-8000-000000000001"; +const ts = "2026-05-17T14:00:00.000Z"; + +const validShellTruncated: AgentTrailV010 = { type: "tool_call", id, ts, payload: { tool: "shell_command", args: { command: "printf ok" }, truncated: true, args_size: 9 } }; +// @ts-expect-error truncated shell_command calls require args_size. +const invalidShellMissingArgsSize: AgentTrailV010 = { type: "tool_call", id, ts, payload: { tool: "shell_command", args: { command: "printf ok" }, truncated: true } }; +// @ts-expect-error file_read args require path. +const invalidFileReadMissingPath: AgentTrailV010 = { type: "tool_call", id, ts, payload: { tool: "file_read", args: {} } }; +const capabilityChangeJsonValues: AgentTrailV010 = { type: "capability_change", id, ts, payload: { scope: "tool", reason: "registered", changed: [{ name: "ToolSearch", field: "config", from: false, to: [1, "two", null] }] } }; +const vendorMetadataPrimitive: AgentTrailV010 = { type: "session_metadata_update", id, ts, payload: { field: "x-codex/value", value: 1, reason: "external" } }; +const vendorMetadataArray: AgentTrailV010 = { type: "session_metadata_update", id, ts, payload: { field: "x-codex/value", value: [1, "two", null], reason: "external" } }; +const vendorMetadataObject: AgentTrailV010 = { type: "session_metadata_update", id, ts, payload: { field: "x-codex/value", value: { nested: true, items: [1, null] }, reason: "external" } }; +const vendorMetadataNull: AgentTrailV010 = { type: "session_metadata_update", id, ts, payload: { field: "x-codex/value", value: null, reason: "external" } }; + +void validShellTruncated; +void invalidShellMissingArgsSize; +void invalidFileReadMissingPath; +void capabilityChangeJsonValues; +void vendorMetadataPrimitive; +void vendorMetadataArray; +void vendorMetadataObject; +void vendorMetadataNull; +`; +} + +async function assertSchemaRejectsUnknownToolPayloadField(tempDir) { + const samplePath = join(tempDir, "tool-call-extra-field.json"); + await writeFile( + samplePath, + `${JSON.stringify({ + type: "tool_call", + id: "00000000-0000-4000-8000-000000000002", + ts: "2026-05-17T14:00:00.000Z", + payload: { + tool: "shell_command", + args: { command: "printf ok" }, + future_field: true, + }, + })}\n`, + ); + + try { + await execFilePromise( + "ajv", + [ + "validate", + "--spec=draft2020", + "--strict=false", + "--validate-formats=false", + "-s", + fileURLToPath(schemaUrl), + "-d", + samplePath, + ], + { + cwd: fileURLToPath(repoRoot), + encoding: "utf8", + maxBuffer: 1024 * 1024, + timeout: commandTimeoutMs, + }, + ); + } catch (error) { + if (error.code === 1) return; + throw error; + } + + throw new Error("schema/v0.1.0.json allowed an unknown tool_call.payload field."); +} + +async function runMain() { + const tempDir = await mkdtemp(join(tmpdir(), "agent-trail-tsgen-")); + const generatedPath = join(tempDir, "agent-trail.generated.d.ts"); + const smokePath = join(tempDir, "agent-trail-smoke.ts"); + + const { source, elapsedMs } = await generateTypes(); + await writeFile(generatedPath, source); + await writeFile(smokePath, smokeSource()); + + await run("tsc", [ + "--noEmit", + "--strict", + "--skipLibCheck", + "--pretty", + "false", + "--target", + "ES2022", + "--module", + "NodeNext", + "--moduleResolution", + "NodeNext", + smokePath, + ]); + + await assertSchemaRejectsUnknownToolPayloadField(tempDir); + + console.log(`json-schema-to-typescript completed in ${Math.round(elapsedMs)}ms`); + console.log("TypeScript generation smoke checks passed"); +} + +if (process.env.AGENT_TRAIL_TS_GENERATE_CHILD === "1") { + await runGenerateChild(); +} else { + await runMain().catch((error) => fail(error.message)); +}