diff --git a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.i18n.yaml b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.i18n.yaml index 98850aed4c..b62c09f26c 100644 --- a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.md -2026-06-11-content-block-vocabulary.md: d7d3f6b43a3f65d1421f026e5b6c2cc1ba1eadd2 -2026-06-11-content-block-vocabulary.zh.md: ed4f915dff6dcb6dbc91400f9bfa5384253aea7b +2026-06-11-content-block-vocabulary.md: 917dd5225fdc4ab391e9e4629769abbb68095731 +2026-06-11-content-block-vocabulary.zh.md: 9d228eb34dafbdebab44b45dc3b290c9327d3b2b diff --git a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.md b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.md index d7d3f6b43a..917dd5225f 100644 --- a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.md +++ b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.md @@ -10,7 +10,7 @@ The harness needs one internal language for messages that the loop, session log, ## Decision -Own the vocabulary: messages are arrays of typed content blocks (`text`, `reasoning`, `tool-call`, `tool-result`), with the union derived from the merge-extensible `ContentBlockMap` so plugins add block types via declaration merging. The same merge-extensible-map pattern types every "stringly" field (`MessageSource`, `FinishReason`, `TurnTrigger`, `TurnEndReason`). Streaming is a raw chunk protocol; `BlockAssembler` is the single shared assembly implementation. Adapters translate to provider wire formats — mapping cost lives in adapters, where it belongs. +Own the vocabulary: user, assistant, and system messages are arrays of typed content blocks (`text`, `reasoning`, `tool-call`), with the union derived from the merge-extensible `ContentBlockMap` so plugins add block types via declaration merging. Tool results are first-class tool-role messages whose own content holds result blocks; released Session format v3 retains the historical `tool-result` content block inside a user-role wrapper, and the adjacent V3-to-V4 edge lifts that wrapper into the first-class role. The same merge-extensible-map pattern types every "stringly" field (`MessageSource`, `FinishReason`, `TurnTrigger`, `TurnEndReason`). Streaming is a raw chunk protocol; `BlockAssembler` is the single shared assembly implementation. Adapters translate to provider wire formats — mapping cost lives in adapters, where it belongs. In-session context injection (`context/message`) and mid-turn steering originally rendered as tagged user-role envelopes (the system-reminder pattern) rather than a new role, so adapters carry zero burden. Both now project as plain user content with no wrapper; see [the injected-content-envelope Agent Note](../simplification/2026-07-20-unwrap-injected-content-envelopes.md). Live-adapter validation confirms this rendering for current DeepSeek behavior; a future provider-specific mismatch belongs in that adapter rather than a new canonical role. diff --git a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.zh.md b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.zh.md index ed4f915dff..9d228eb34d 100644 --- a/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.zh.md +++ b/.agents/notes/implemented/architecture/2026-06-11-content-block-vocabulary.zh.md @@ -10,7 +10,7 @@ harness 需要一套统一的内部消息语言,供 agent loop(智能体循 ## 决策 -自主拥有词汇:消息是类型化内容块的数组(`text`、`reasoning`、`tool-call`、`tool-result`),其联合类型派生自可合并扩展的 `ContentBlockMap`,插件通过声明合并添加新的块类型。同一可合并扩展映射模式为所有「字符串化」字段提供类型(`MessageSource`、`FinishReason`、`TurnTrigger`、`TurnEndReason`)。流式输出采用原始分片协议;`BlockAssembler` 是唯一的共享组装实现。适配器负责转换为提供方的协议格式(wire format)——映射成本留在适配器中,正是它该在的地方。 +自主拥有词汇:user、assistant 与 system 消息是类型化内容块的数组(`text`、`reasoning`、`tool-call`),其联合类型派生自可合并扩展的 `ContentBlockMap`,插件通过声明合并添加新的块类型。Tool result 是一等 tool-role message,结果块属于该 message 自己的 content;已发布的 Session format v3 仍将历史 `tool-result` content block 保存在 user-role 包装中,邻接的 V3 到 V4 边会将该包装提升为一等角色。同一可合并扩展映射模式为所有「字符串化」字段提供类型(`MessageSource`、`FinishReason`、`TurnTrigger`、`TurnEndReason`)。流式输出采用原始分片协议;`BlockAssembler` 是唯一的共享组装实现。适配器负责转换为提供方的协议格式(wire format)——映射成本留在适配器中,正是它该在的地方。 会话内上下文注入(`context/message`)和轮次中途 steering(中途引导)最初渲染为带标签的 user-role 信封(system-reminder 模式),而非引入新角色,因此适配器无需承担额外负担。如今两者都投影为无包装的普通用户内容;见[注入内容信封 Agent Note](../simplification/2026-07-20-unwrap-injected-content-envelopes.zh.md)。实际适配器验证已确认此渲染方式符合当前 DeepSeek 的行为;如果未来某提供方出现不兼容,应在该适配器内处理,而非引入新的规范角色。 diff --git a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.i18n.yaml b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.i18n.yaml index 1b91468214..56d5cea939 100644 --- a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.md -2026-07-28-identified-immutable-message-values.md: 9d2b22a5a1fc87ea7b0ff8eb24b2e8c4b86543e1 -2026-07-28-identified-immutable-message-values.zh.md: 6b36cfec0a24196ca526b0ffb21180967aa640eb +2026-07-28-identified-immutable-message-values.md: 73c9c14479117cf654d10b3da23d155cca77054d +2026-07-28-identified-immutable-message-values.zh.md: 7a5b9d6524beff01ac8a9e2020f75093271b7ab3 diff --git a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.md b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.md index 9d2b22a5a1..73c9c14479 100644 --- a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.md +++ b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.md @@ -16,7 +16,7 @@ This made identity a routing side effect rather than a message invariant. Produc `createMessage(input)` is the canonical role-generic creation boundary. It mints a `MessageId`, detaches the supplied role, content, and source, and deep-freezes the complete value before returning it. `createUserMessage({ content, source })` fixes the user role for prompt and context producers. `createAssistantMessage({ content, source })` fixes both the assistant role and the model source kind, so model-output producers supply only content plus provider, model, and optional replay state. All creation helpers exclude an input id so callers cannot accidentally present creation as import. `freezeMessage(message)` is the separate import or transformation boundary: it detaches and deep-freezes a message whose identity already exists, without minting a replacement. -The message helpers live in `dsh-llm` beside the base message vocabulary because their complete contracts depend only on that vocabulary. They use `dsh-brand`'s stateless `brandString()` constructor for `MessageId` and `dsh-util-values`'s shared `deepFreeze()` implementation after detaching input with `structuredClone()`. `createToolResultMessage()` belongs with the other creation helpers: it couples a tool call id to the exact user-role tool-result block and source without depending on session state or events. `dsh-session` consumes complete messages rather than owning their construction. +The message helpers live in `dsh-llm` beside the base message vocabulary because their complete contracts depend only on that vocabulary. They use `dsh-brand`'s stateless `brandString()` constructor for `MessageId` and `dsh-util-values`'s shared `deepFreeze()` implementation after detaching input with `structuredClone()`. `createToolResultMessage()` belongs with the other creation helpers: it couples a tool call id to a tool-role message carrying the result content, error state, and source without depending on session state or events. `dsh-session` consumes complete messages rather than owning their construction. The `Agent` interface accepts a complete `UserMessage` through `followup`, `steer`, and `inject`. These operations never allocate or return identity; they freeze an imported value whose id the caller already holds. Inbox claims and `agent/pre-step` receive that message directly. A content rewrite creates a frozen replacement with the same id, while an additional context is a separately created `UserMessage` with its own id. diff --git a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.zh.md b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.zh.md index 6b36cfec0a..7a5b9d6524 100644 --- a/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.zh.md +++ b/.agents/notes/implemented/architecture/2026-07-28-identified-immutable-message-values.zh.md @@ -16,7 +16,7 @@ harness 曾存在多种形似消息的表示,各自采用不同的标识规则 `createMessage(input)` 是角色通用的规范创建边界。它会生成 `MessageId`,将传入的角色、内容和来源与调用方对象解除引用关系,并在返回完整值前将其深度冻结。`createUserMessage({ content, source })` 为提示词和上下文生产方固定 user 角色。`createAssistantMessage({ content, source })` 同时固定 assistant 角色与模型来源类别,因此模型输出生产方只需提供内容,以及提供方、模型和可选的回放状态。所有创建辅助函数的输入都不包含 id,因此调用方不会意外地把新消息的创建伪装成已有消息的导入。`freezeMessage(message)` 是独立的导入或转换边界:它会将已有标识的消息与调用方对象解除引用关系并深度冻结,不会生成替代标识。 -消息辅助函数位于基础消息词汇旁的 `dsh-llm` 中,因为它们的完整约定只依赖该词汇。它们使用 `dsh-brand` 的无状态 `brandString()` 构造函数生成 `MessageId`,并在通过 `structuredClone()` 分离输入后使用 `dsh-util-values` 的共享 `deepFreeze()` 实现。`createToolResultMessage()` 与其他创建辅助函数同属此处:它将工具调用 id 与确切的 user-role 工具结果块及来源耦合起来,不依赖会话状态或事件。`dsh-session` 只消费完整消息,不负责构造它们。 +消息辅助函数位于基础消息词汇旁的 `dsh-llm` 中,因为它们的完整约定只依赖该词汇。它们使用 `dsh-brand` 的无状态 `brandString()` 构造函数生成 `MessageId`,并在通过 `structuredClone()` 分离输入后使用 `dsh-util-values` 的共享 `deepFreeze()` 实现。`createToolResultMessage()` 与其他创建辅助函数同属此处:它将工具调用 id 与携带结果内容、错误状态及来源的 tool-role 消息耦合起来,不依赖会话状态或事件。`dsh-session` 只消费完整消息,不负责构造它们。 `Agent` 接口通过 `followup`、`steer` 和 `inject` 接收完整的 `UserMessage`。这些操作绝不会分配或返回标识;它们会冻结导入的值,而调用方已经持有该值的 id。inbox 领取和 `agent/pre-step` 会直接接收该消息。改写内容时会创建具有相同 id 的冻结替代值,而每个附加上下文都是单独创建的 `UserMessage`,拥有自己的 id。 diff --git a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.i18n.yaml index a3a50d38ef..e834c8bf6f 100644 --- a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.md -2026-09-06-v3-canonical-session-envelopes.md: 17ec331cc1ea21f31d0b51eab86d22725b6deef8 -2026-09-06-v3-canonical-session-envelopes.zh.md: a18bb3b4d71c164e3fba7288cc686a1cb7c7b4df +2026-09-06-v3-canonical-session-envelopes.md: 68d4386b9e06025fd44d6d9054a95fb51ec8bc3e +2026-09-06-v3-canonical-session-envelopes.zh.md: d3bfc17fa263f8edb0b6f73ce59c626d772dbc1e diff --git a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.md b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.md index 17ec331cc1..68d4386b9e 100644 --- a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.md +++ b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.md @@ -14,7 +14,7 @@ Session format V3 uses one canonical event envelope. Every `system/message`, `us `SurfaceOp` is exactly `'append'` or `{ op: 'replace', startSeq, endSeq }`, with `SessionSeq` endpoints and no aliases or extra keys. Both endpoints precede the replacing event and identify an inclusive span in current surface order, not numeric sequence order. Session acceptance additionally verifies current membership, ordered endpoints, complete cited coverage, and content-only single-node tool-result replacement. Compaction payload fields such as `shadowedRange.start/end` and fold-result fields retain their own names; this is not a recursive payload rename. -Current acceptance rejects every `request/header.header.system` and exactly empty `tools: []` or `adapterDefaults: {}`. System prompts belong to `system/message`; `request/header` remains the non-history request snapshot. Writers omit the two empty optionals. Whitespace-only system content, `config.stop: []`, nested header/source/data extras, and nested tool schema values remain intact. A `tool/result` with `data.error` requires `message.content[0].isError === true`; a failed result need not carry error identity. Neither current reads nor migration infer an error outcome from contradictory metadata. +Current acceptance rejects every `request/header.header.system` and exactly empty `tools: []` or `adapterDefaults: {}`. System prompts belong to `system/message`; `request/header` remains the non-history request snapshot. Writers omit the two empty optionals. Whitespace-only system content, `config.stop: []`, nested header/source/data extras, and nested tool schema values remain intact. A `tool/result` with `data.error` requires `message.isError === true`; a failed result need not carry error identity. Neither current reads nor migration infer an error outcome from contradictory metadata. ### Validation ownership diff --git a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.zh.md b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.zh.md index a18bb3b4d7..d3bfc17fa2 100644 --- a/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.zh.md @@ -14,7 +14,7 @@ Session 格式 V3 使用一种规范事件信封。每个 `system/message`、`us `SurfaceOp` 恰好为 `'append'` 或 `{ op: 'replace', startSeq, endSeq }`,端点使用 `SessionSeq`,不接受别名或额外键。两个端点都早于替换事件,并按当前 surface 顺序而非数值序号顺序标识闭区间。Session 接纳还验证当前成员关系、端点顺序、完整引用覆盖与仅修改内容的单节点工具结果替换。`shadowedRange.start/end` 等压缩(compaction)载荷字段与折叠结果字段保留各自名称;这不是对载荷进行递归重命名。 -当前接纳拒绝任何 `request/header.header.system` 以及恰好为空的 `tools: []` 或 `adapterDefaults: {}`。系统提示词属于 `system/message`;`request/header` 仍是请求非历史状态的快照。写入方省略两个空可选字段。仅含空白的系统内容、`config.stop: []`、嵌套 header/source/data 扩展与嵌套工具 schema 值保持原样。带有 `data.error` 的 `tool/result` 要求 `message.content[0].isError === true`;失败结果不必携带错误身份。当前读取与迁移均不会根据矛盾元数据推断错误结果。 +当前接纳拒绝任何 `request/header.header.system` 以及恰好为空的 `tools: []` 或 `adapterDefaults: {}`。系统提示词属于 `system/message`;`request/header` 仍是请求非历史状态的快照。写入方省略两个空可选字段。仅含空白的系统内容、`config.stop: []`、嵌套 header/source/data 扩展与嵌套工具 schema 值保持原样。带有 `data.error` 的 `tool/result` 要求 `message.isError === true`;失败结果不必携带错误身份。当前读取与迁移均不会根据矛盾元数据推断错误结果。 ### 校验所有权 diff --git a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.i18n.yaml index 3a9f8ed124..6953db3edf 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-10-image-offload-events.md -2026-09-10-image-offload-events.md: f540dc98cee8daf3e360b14234a2ac21d0f53aab -2026-09-10-image-offload-events.zh.md: 868fca59ba5fc1941de752127f61b091aedb234f +2026-09-10-image-offload-events.md: e80c4ae17b148d9eb46517b92111a8d768160def +2026-09-10-image-offload-events.zh.md: 2aa2b8b1fbffd117b5d716aba28755a02a155bb8 diff --git a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.md b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.md index f540dc98ce..e80c4ae17b 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.md +++ b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.md @@ -14,7 +14,7 @@ A request can exceed an image-capable route's byte or image-count budget. Recomp Summary requests bypass the agent error waterfall. `dsh-compaction-basic` preserves the full `LlmFailure`, checks cancellation and selection stability, and dispatches synchronous `compaction/summary-error` with the selected event seqs. The same image-offload plugin records omissions only within that selection. Synchronous recovery keeps the stability check and decision adjacent. The backend then re-derives input and pricing, including the shrink baseline. Each retry requires additional omitted occurrences; exhaustion delegates the failure. A later summary failure or cancellation preserves any recorded omissions, so command errors do not claim the conversation is unchanged. -The event payload is `{ targets: [{ seq, imageIndexes }] }`. Each target identifies a current `user/message` or `tool/result` node. Its strictly increasing, zero-based indexes enumerate every image in depth-first content order, including nested tool results and previously omitted images. Equal attachment ids remain distinct occurrences. Exact selections remain unambiguous after positional replacements reorder the surface; an attachment id or a raw-log prefix cannot identify the selected set. +The event payload is `{ targets: [{ seq, imageIndexes }] }`. Each target identifies a current `user/message` or `tool/result` node. Its strictly increasing, zero-based indexes enumerate every image in depth-first content order, including tool-role result content and previously omitted images. Equal attachment ids remain distinct occurrences. Exact selections remain unambiguous after positional replacements reorder the surface; an attachment id or a raw-log prefix cannot identify the selected set. The event has no `surfaceOp`. It neither creates a message nor replaces a message node. The plugin's pure projection validates all targets before Session commits the event and rejects missing or shadowed nodes, output images, duplicate targets, invalid indexes, and already omitted occurrences. Reconstruction derives immutable message copies with `ImageBlock.offloaded: true` at the recorded positions. Original events, message ids, sources, and unaffected blocks remain unchanged. Resume, fork, and replay apply the same selections from the log. diff --git a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.zh.md b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.zh.md index 868fca59ba..2aa2b8b1fb 100644 --- a/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-10-image-offload-events.zh.md @@ -14,7 +14,7 @@ Status: implemented 摘要请求不经过 agent 错误 waterfall。`dsh-compaction-basic` 保留完整的 `LlmFailure`,检查取消和选区稳定性,再携带所选事件序号触发同步的 `compaction/summary-error`。同一个图片省略插件只在选区内记录省略。同步恢复使稳定性检查与决策相邻执行。后端随后重新派生输入并计价,包括判断摘要是否缩短输入的基准。每次重试都必须继续省略图片,无图可省略时委派失败。后续摘要失败或取消仍保留已经记录的省略,因此命令错误不声称会话未变。 -事件载荷为 `{ targets: [{ seq, imageIndexes }] }`。每个目标指向当前的 `user/message` 或 `tool/result` 节点。索引从零开始且严格递增,按内容深度优先顺序枚举所有图片,包括嵌套工具结果和先前省略的图片。相同附件 ID 的多次出现分别计数。位置替换改变 surface 顺序后,明确选择仍没有歧义,附件 ID 或原始日志前缀无法标识这个集合。 +事件载荷为 `{ targets: [{ seq, imageIndexes }] }`。每个目标指向当前的 `user/message` 或 `tool/result` 节点。索引从零开始且严格递增,按内容深度优先顺序枚举所有图片,包括 tool-role 结果内容和先前省略的图片。相同附件 ID 的多次出现分别计数。位置替换改变 surface 顺序后,明确选择仍没有歧义,附件 ID 或原始日志前缀无法标识这个集合。 事件不带 `surfaceOp`,不创建消息,也不替换消息节点。插件的纯投影在 Session 提交事件前校验全部目标,拒绝缺失或已被遮蔽的节点、输出图片、重复目标、无效索引和已被省略的位置。重建过程派生不可变消息副本,将记录的位置标为 `ImageBlock.offloaded: true`。原始事件、消息 ID、来源和未受影响的内容块保持不变。恢复、分叉和回放从日志应用相同的选择。 diff --git a/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.i18n.yaml new file mode 100644 index 0000000000..e1c74c8525 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.i18n.yaml @@ -0,0 +1,6 @@ +# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each +# side as of the last confirmed-consistent state. Both languages carry equal authority; +# after editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.md +2026-09-15-first-class-tool-role-messages.md: c16bc44116b1b2c20c988db4b6977ee31bea4ab4 +2026-09-15-first-class-tool-role-messages.zh.md: f9eb581f6c080655145b3c9ab1c55d052fe871b8 diff --git a/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.md b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.md new file mode 100644 index 0000000000..c16bc44116 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.md @@ -0,0 +1,28 @@ +# Agent Note: First-class tool-role messages + +Status: implemented + +English | [中文](2026-09-15-first-class-tool-role-messages.zh.md) + +## Problem + +The released Session format stores tool results inside a user-role `tool-result` content block, while the model conversation and provider protocols treat a tool result as a separate role. Keeping both descriptions active makes validation, replay, and adapter projections disagree. + +## Decision + +Session format V4 stores one tool result as a first-class `role: 'tool'` message. Its `toolCallId`, tool source call id, result content, and optional error flag are validated together. The V3-to-V4 edge lifts exactly one released wrapper and refuses nested wrappers before publication, retaining the source generation. Current V4 decoding is native-only; wrapper rows are accepted only by the adjacent migration edge. + +Outer message JSON extensions retain their own properties during lifting, including `__proto__` and `constructor`. An existing `toolCallId` must match the source call; an existing boolean `isError` must match the wrapper's error state, with omission meaning non-error. Unknown wrapper fields and conflicting outer fields refuse migration because the new representation provides no safe interpretation for them. Rebuilding only known message fields would silently delete admitted V3 data; copying wrapper extensions onto the message would invent their scope. + +The conversation role map is closed. A model-visible role must have a persisted Session event and an adapter projection, so adapters do not silently turn an unlogged extension role into user text. Provider-specific source kinds remain merge-extensible and are owned by their producers. + +## Alternatives considered + +- **Keep wrapper-shaped V4 rows** — this preserves the released payload but leaves the canonical role and provider wire formats inconsistent. +- **Accept both wrapper and native V4 rows** — dual current representations make encoding, decoding, recovery, and replay depend on which path produced the artifact. +- **Flatten historical nested results** — leaf text does not retain nested call IDs or error status, and providers did not interpret nested content uniformly. Unsupported migration preserves the original data until a lossless conversion is available. +- **Keep role extensions open** — an extension could reach a model request without a Session event and could not be reconstructed on replay. + +## Consequences + +The adjacent migration changes the logical message role without changing message identity, tool-call identity, or result content. Native V4 semantic failures are hard admission failures; recoverable decoding still applies to released V3 canonical tails. Adapters map the first-class role to their provider-specific tool-result representation. The duplicated message `toolCallId` and source `callId` remain as an explicit equality-checked provider field and source-identity field pair. diff --git a/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.zh.md b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.zh.md new file mode 100644 index 0000000000..f9eb581f6c --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-15-first-class-tool-role-messages.zh.md @@ -0,0 +1,28 @@ +# Agent Note:一等 tool-role 消息 + +Status: implemented + +[English](2026-09-15-first-class-tool-role-messages.md) | 中文 + +## 问题 + +已发布的 Session 格式把工具结果存储在 user-role 的 `tool-result` 内容块中,而模型对话与提供方协议把工具结果视为独立角色。两种描述同时存在会使校验、回放和适配器投影互相不一致。 + +## 决策 + +Session format V4 将一次工具结果存储为一等 `role: 'tool'` 消息。它的 `toolCallId`、工具来源调用标识、结果内容和可选错误标记一起校验。V3 到 V4 的边缘迁移只提升一个已发布的包装,并在发布前拒绝嵌套包装,保留源代际。当前 V4 解码仅接受原生形式;包装行只由相邻迁移边缘接受。 + +外层消息的 JSON 扩展在提升时保留为自有属性,包括 `__proto__` 和 `constructor`。已有 `toolCallId` 必须与 source call 一致;已有布尔 `isError` 必须与 wrapper 的错误状态一致,省略表示非错误。未知 wrapper 字段和冲突的外层字段会拒绝迁移,因为新表示没有安全的解释方式。只重建已知消息字段会静默删除 V3 已接受的数据;将 wrapper 扩展复制到消息上则会凭空改变其作用范围。 + +对话角色 map 是封闭的。模型可见角色必须有持久 Session 事件和适配器投影,因此适配器不会把未记录的扩展角色静默转换为 user 文本。提供方特有的来源 kind 仍然可合并扩展,并由各生产方拥有。 + +## 曾考虑的替代方案 + +- **保留包装形式的 V4 行**——保留已发布载荷,但规范角色与提供方 wire 格式仍不一致。 +- **同时接受包装和原生 V4 行**——两种当前表示会让编码、解码、恢复和回放依赖于产出 artifact 的路径。 +- **展平历史嵌套结果**——叶子文本无法保留嵌套调用 ID 或错误状态,而且提供方对嵌套内容的解释并不一致。拒绝不支持的迁移会保留原始数据,等待能够保留全部信息的转换。 +- **保持角色扩展开放**——扩展角色可能在没有 Session 事件的情况下到达模型请求,也无法在回放时重建。 + +## 后果 + +相邻迁移会改变逻辑消息角色,但不改变消息身份、工具调用身份或结果内容。原生 V4 语义失败属于硬准入失败;可恢复解码仍适用于已发布 V3 的规范尾部。适配器把一等角色映射为各提供方自己的工具结果表示。消息 `toolCallId` 与来源 `callId` 的重复仍作为一对显式且经过相等性校验的提供方字段与来源字段保留。 diff --git a/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.i18n.yaml new file mode 100644 index 0000000000..d696d55a86 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.i18n.yaml @@ -0,0 +1,6 @@ +# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each +# side as of the last confirmed-consistent state. Both languages carry equal authority; +# after editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md +2026-09-17-native-v4-read-validation.md: ab4adc44cda551af91e1690397dd5c0c8a361b9f +2026-09-17-native-v4-read-validation.zh.md: 815bf4de979ec0f5f2d86ee9806c8dec4d4d2f61 diff --git a/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md new file mode 100644 index 0000000000..ab4adc44cd --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md @@ -0,0 +1,29 @@ +# Agent Note: Mandatory native V4 relationship validation + +Status: implemented + +English | [中文](2026-09-17-native-v4-read-validation.zh.md) + +## Problem + +Tool-role results cannot be checked through the released V3 user-role representation without projecting away current fields. Replacing that validation view requires a native reader to retain the earlier lifecycle, retired-syntax, and system-message checks. The representation change and its mandatory admission therefore belong together. + +An event can satisfy its TypeScript declaration and message rules while contradicting earlier durable events. A tool result without an advertised call and a checkpoint naming another compaction both contain locally valid fields. Accepting either as a current Session makes later readers depend on damaged relationships, and tightening admission after release can strand already-written histories. + +## Decision + +The V4 format restorer and current JSONL scanner share one mandatory cross-event relationship pass before exposing a restored artifact or storage handle. It checks turn and step order, advertised tool calls and settlements, PTC parentage and settlement identity, retry chains and request providers, human-message title citations, command completion references, compaction ownership and current spans, and the protected system head. The installed event set controls semantic interpretation, including compaction prepasses and title references. Unknown ignorable records retain their payloads and original positions; known records remain validated even when marked ignorable. The check reads native event fields without altering artifacts or projecting them into a historical format. JSON argument comparisons inspect own properties in both Node and the worker; inherited prototype members cannot satisfy recorded fields. The [tool-role decision](2026-09-15-first-class-tool-role-messages.md) owns result representation. + +An unfinished tail may retain an open turn, step, tool call, or compaction. A closing event must settle the relationships it closes. An inherited unfinished compaction ends at its `session/end-seed` marker; it does not constrain the child's lifecycle. Repair message identities retain their historical numeric suffix after earlier migrations change sequence coordinates. Fork repairs retain their separately validated native identities. + +Installed Session adoption continues to own event envelopes, message roles and metadata, canonical request headers, and surface replacement reference coverage. Optional runtime invariants provide diagnostics; their installation is not required for durable admission. Native system-message admission also validates coordinates, identity, content blocks, and known image/tool-call fields before physical recovery can discard rows. Additional JSON fields and unknown nonempty content tags remain intact; retired tool-result wrappers are refused. Retired `request/header.header.system` and required `tool/code-dispatch*` tags remain hard refusals before recovery; obsolete ignorable PTC records remain opaque. Physical framing alone does not establish semantic validity. + +## Alternatives considered + +**Project V4 back into a frozen V3 validation view.** This couples current acceptance to retired representations and invites new fields to disappear in the projection. Frozen generations remain independently readable, while the current restorer interprets its own fields. + +**Rely on optional runtime invariants.** Detached readers and restoration paths may not install diagnostic companions. A required relationship must be checked before publication or consumption of the restored Session. + +## Consequences + +The native restorer maintains one bounded state machine per read and rejects contradictions before successor publication. Frozen V0–V3 validators and committed Session generations remain unchanged. Public catalog regressions cover invalid relationships alongside partial tails, inherited cuts, immutable unknown attribution, and complete tool exchanges; these checks do not require a new Session version because V4 is unreleased. diff --git a/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.zh.md b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.zh.md new file mode 100644 index 0000000000..815bf4de97 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.zh.md @@ -0,0 +1,29 @@ +# Agent Note: 原生 V4 关系的强制校验 + +Status: implemented + +[English](2026-09-17-native-v4-read-validation.md) | 中文 + +## Problem + +tool 角色结果不能通过已发布的 V3 user 角色表示进行校验,否则投影会丢弃当前字段。替代该校验视图后,原生读取方必须保留原有的生命周期、退役语法和 system 消息检查。因此,表示变更与必需的接纳校验需要一同完成。 + +事件即使符合 TypeScript 声明和消息规则,也可能与较早的持久化事件矛盾。没有声明调用的工具结果、指向另一压缩事务的检查点,都可以拥有局部有效字段。将它们接纳为当前 Session 会让后续读取器依赖损坏的关系;发布后再收紧准入则可能让已写入的历史无法读取。 + +## Decision + +V4 格式恢复器与当前 JSONL 扫描器共用同一强制跨事件关系校验,在公开恢复产物或存储句柄之前执行。它检查 turn 与 step 顺序、声明的工具调用及其结算、PTC 父子关系与结算身份、重试链与请求 provider、标题的人类消息引用、命令完成引用、压缩归属与当前区间,以及受保护的 system 首节点。已安装事件集合控制语义解释,包括压缩预扫描和标题引用。未知的可忽略记录保留其载荷与原始位置;已知记录即使标记为可忽略仍会接受校验。校验直接读取原生事件字段,不修改产物,也不将其投影为历史格式。Node 和 Worker 中的 JSON 参数比较都检查自有属性,继承的原型成员不能代替记录字段。[工具角色决策](2026-09-15-first-class-tool-role-messages.zh.md)负责结果表示。 + +未完成的尾部可以保留打开的 turn、step、工具调用或压缩事务。关闭事件必须结清它关闭的关系。继承的未完成压缩事务在其 `session/end-seed` 标记处结束,不约束子 Session 的生命周期。较早迁移改变序号坐标后,修复消息身份仍保留历史数字后缀。fork 修复保留经过独立校验的原生身份。 + +已安装的 Session 接纳器继续负责事件封装、消息角色与元数据、规范请求头,以及 surface 替换的引用覆盖。可选运行时不变式提供诊断;持久化准入不要求安装它们。原生 system 消息准入还会在物理恢复可能丢弃行之前,校验坐标、身份、内容块及已知 image/tool-call 字段。额外 JSON 字段和非空的未知内容标签保持不变,退役的 tool-result 包装会被拒绝。退役的 `request/header.header.system` 和必需的 `tool/code-dispatch*` 标签仍在恢复前强制拒绝;标记为可忽略的过时 PTC 记录保持不透明。仅通过物理分帧不能证明语义有效。 + +## Alternatives considered + +**将 V4 投影回冻结的 V3 校验视图。** 这会将当前准入与退役表示绑定,并容易让新增字段在投影中消失。冻结代际仍可独立读取,当前恢复器解释自己的字段。 + +**依赖可选运行时不变式。** 分离读取器和恢复路径可能不安装诊断组件。必需关系必须在发布或消费恢复后的 Session 之前完成校验。 + +## Consequences + +原生恢复器为每次读取维护独立状态机,在发布后继文件之前拒绝矛盾。冻结的 V0–V3 校验器及已提交的 Session 代际保持不变。公开目录回归覆盖无效关系、部分尾部、继承切分点、未知归属的不可变保存,以及完整工具交互;这些检查无需新增 Session 版本,因为 V4 尚未发布。 diff --git a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.i18n.yaml b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.i18n.yaml index 264c685eb9..e5ab7e62d9 100644 --- a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.i18n.yaml +++ b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/simplification/2026-09-07-file-content-scan.md -2026-09-07-file-content-scan.md: bf4f03ee5a7134b11c7cbec322b0a37a3f2a6304 -2026-09-07-file-content-scan.zh.md: 5efb1589b036f80b46752a80103c080952c82396 +2026-09-07-file-content-scan.md: 1ec46e7d685394f5165624f1e7b68622ba9f89d3 +2026-09-07-file-content-scan.zh.md: b4ebd835ca8adaf3a7b7fa09150cd5a2bec9f401 diff --git a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md index bf4f03ee5a..1ec46e7d68 100644 --- a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md +++ b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md @@ -6,11 +6,11 @@ English | [中文](2026-09-07-file-content-scan.zh.md) ## Problem -Every model dispatch checks complete message content for files, including nested tool results. A request-history CPU profile attributes 23.540 ms of self time to `contentHasFile` and 5.584 ms to its callback. This traversal remains necessary even after [loop-owned freeze evidence](2026-09-06-agent-request-freeze-evidence.md) removes repeated request freezing. The hot LLM source is identical at both sampled master revisions and the measured V3 integration revision; these observations do not establish PR causality. +Every model dispatch checks complete message content for files, including tool-role result content. A request-history CPU profile attributes 23.540 ms of self time to `contentHasFile` and 5.584 ms to its callback. This traversal remains necessary even after [loop-owned freeze evidence](2026-09-06-agent-request-freeze-evidence.md) removes repeated request freezing. The hot LLM source is identical at both sampled master revisions and the measured V3 integration revision; these observations do not establish PR causality. ## Decision -[`contentHasFile`](../../../../packages/llm/llm/src/content.ts) uses direct iteration instead of recursive `Array.some` callbacks. It preserves early exit, nested tool-result traversal, and false results for other block kinds. It stores no identities, validation results, or freeze proofs. Image detection, file projection, and request construction keep their existing behavior. The [request-freeze evidence](2026-09-06-agent-request-freeze-evidence.md) owns the request-history budget. +[`contentHasFile`](../../../../packages/llm/llm/src/content.ts) uses direct iteration instead of recursive `Array.some` callbacks. It preserves early exit, tool-role result traversal, and false results for other block kinds. It stores no identities, validation results, or freeze proofs. Image detection, file projection, and request construction keep their existing behavior. The [request-freeze evidence](2026-09-06-agent-request-freeze-evidence.md) owns the request-history budget. ## Measurement evidence diff --git a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md index 5efb1589b0..b4ebd835ca 100644 --- a/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md +++ b/.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md @@ -6,11 +6,11 @@ Status: implemented ## Problem -每次模型分发都检查完整消息内容中的文件,包括嵌套工具结果。请求历史 CPU profile 将 23.540 ms 自身时间归于 `contentHasFile`,将 5.584 ms 归于其回调。即使[循环自有冻结证据](2026-09-06-agent-request-freeze-evidence.zh.md)消除了重复请求冻结,这次遍历仍然必需。两次抽样的 master 修订与实测的 V3 集成修订 的 LLM 热点源码完全相同;这些观察不能证明 PR 因果关系。 +每次模型分发都检查完整消息内容中的文件,包括 tool-role 结果内容。请求历史 CPU profile 将 23.540 ms 自身时间归于 `contentHasFile`,将 5.584 ms 归于其回调。即使[循环自有冻结证据](2026-09-06-agent-request-freeze-evidence.zh.md)消除了重复请求冻结,这次遍历仍然必需。两次抽样的 master 修订与实测的 V3 集成修订 的 LLM 热点源码完全相同;这些观察不能证明 PR 因果关系。 ## Decision -[`contentHasFile`](../../../../packages/llm/llm/src/content.ts) 使用直接迭代,替代递归的 `Array.some` 回调。它保留提前退出、嵌套工具结果遍历,以及其他块类型返回 false 的行为。它不存储身份、校验结果或冻结证明。图片检测、文件投影和请求构建保持既有行为。[请求冻结证据](2026-09-06-agent-request-freeze-evidence.zh.md)拥有请求历史预算。 +[`contentHasFile`](../../../../packages/llm/llm/src/content.ts) 使用直接迭代,替代递归的 `Array.some` 回调。它保留提前退出、tool-role 结果遍历,以及其他块类型返回 false 的行为。它不存储身份、校验结果或冻结证明。图片检测、文件投影和请求构建保持既有行为。[请求冻结证据](2026-09-06-agent-request-freeze-evidence.zh.md)拥有请求历史预算。 ## Measurement evidence diff --git a/apps/cli/tests/profiles/acp/tests/fixtures/control-surface/control-surface-llm.ts b/apps/cli/tests/profiles/acp/tests/fixtures/control-surface/control-surface-llm.ts index b438799e38..d3418cfc28 100644 --- a/apps/cli/tests/profiles/acp/tests/fixtures/control-surface/control-surface-llm.ts +++ b/apps/cli/tests/profiles/acp/tests/fixtures/control-surface/control-surface-llm.ts @@ -48,7 +48,7 @@ class ControlSurfaceAdapter extends LlmAdapter { const userText = current.flatMap(message => message.content) .flatMap(block => block.type === 'text' ? [block.text] : []) .join('') - const hasToolResult = current.some(message => message.content.some(block => block.type === 'tool-result')) + const hasToolResult = current.some(message => message.role === 'tool') if (!hasToolResult) { const callId = ToolCallId(userText.includes('cancel') ? 'control-cancel-add' : 'control-add') yield { type: 'block-start', index: 0, blockType: 'reasoning' } diff --git a/apps/cli/tests/profiles/headless/tests/compaction.e2e.ts b/apps/cli/tests/profiles/headless/tests/compaction.e2e.ts index 545d57577c..b2f470e3be 100644 --- a/apps/cli/tests/profiles/headless/tests/compaction.e2e.ts +++ b/apps/cli/tests/profiles/headless/tests/compaction.e2e.ts @@ -89,7 +89,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('compaction: a long session compa expect(summaryData.shadowedSeqs.length).toBeGreaterThan(0) expect(events.some(event => event.type === 'tool/result' && summaryData.shadowedSeqs.includes(event.seq) - && event.data.message.content[0].content.some(block => block.type === 'text' + && event.data.message.content.some(block => block.type === 'text' && block.text.includes('This is file number')))).toBe(true) // The conversation survived compaction: the agent produced a final answer diff --git a/apps/cli/tests/profiles/headless/tests/expected/goal-tools/stream-json.expected.jsonl b/apps/cli/tests/profiles/headless/tests/expected/goal-tools/stream-json.expected.jsonl index 8d8ea28581..8e4e3485a0 100644 --- a/apps/cli/tests/profiles/headless/tests/expected/goal-tools/stream-json.expected.jsonl +++ b/apps/cli/tests/profiles/headless/tests/expected/goal-tools/stream-json.expected.jsonl @@ -12,18 +12,18 @@ {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":14,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_goal_probe","name":"update_goal","arguments":"{\"goal_id\":\"missing-goal\",\"revision\":1,\"action\":\"pause\",\"objective\":\"\",\"max_goal_rounds\":0,\"blocked_reason\":\"\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":15,"outputTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_goal_probe","name":"update_goal","args":["{\"goal_id\":\"missing-goal\",\"revision\":1,\"action\":\"pause\",\"objective\":\"\",\"max_goal_rounds\":0,\"blocked_reason\":\"\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_goal_probe","name":"update_goal","arguments":"{\"goal_id\":\"missing-goal\",\"revision\":1,\"action\":\"pause\",\"objective\":\"\",\"max_goal_rounds\":0,\"blocked_reason\":\"\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":15,"outputTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":15,"time":0,"data":{"turn":1,"step":1,"callId":"call_goal_probe","name":"update_goal","arguments":"{\"goal_id\":\"missing-goal\",\"revision\":1,\"action\":\"pause\",\"objective\":\"\",\"max_goal_rounds\":0,\"blocked_reason\":\"\"}"}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"session/title","seq":16,"time":0,"data":{"title":"Goal tool snapshot","messageSeqs":[8],"source":{"kind":"provider","provider":"session-title-first-prompt-llm","model":{"provider":"deepseek-official","model":"deepseek-v4-flash"}}}}} -{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":17,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_goal_probe"},"content":[{"type":"tool-result","toolCallId":"call_goal_probe","content":[{"type":"text","text":"Error: no current goal"}],"isError":true}],"role":"user","id":"{{sessionId}}"},"error":{"name":"GoalError","code":"GOAL_NOT_FOUND"}},"sourceEventSeqs":[15],"surfaceOp":"append"}} +{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":17,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_goal_probe"},"toolCallId":"call_goal_probe","content":[{"type":"text","text":"Error: no current goal"}],"isError":true,"id":"{{sessionId}}"},"error":{"name":"GoalError","code":"GOAL_NOT_FOUND"}},"sourceEventSeqs":[15],"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/end","seq":18,"time":0,"data":{"turn":1,"step":1}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/start","seq":19,"time":0,"data":{"turn":1,"step":2}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":20,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_goal_create","name":"create_goal","arguments":"{\"objective\":\"Finish the headless goal-tool snapshot proof\",\"max_goal_rounds\":7}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":20,"outputTokens":8},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_goal_create","name":"create_goal","args":["{\"objective\":\"Finish the headless goal-tool snapshot proof\",\"max_goal_rounds\":7}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_goal_create","name":"create_goal","arguments":"{\"objective\":\"Finish the headless goal-tool snapshot proof\",\"max_goal_rounds\":7}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":20,"outputTokens":8}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":21,"time":0,"data":{"turn":1,"step":2,"callId":"call_goal_create","name":"create_goal","arguments":"{\"objective\":\"Finish the headless goal-tool snapshot proof\",\"max_goal_rounds\":7}"}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"goal/change","seq":22,"time":0,"data":{"kind":"goal/change","version":1,"operation":"create","goal":{"id":"goal-{{sessionId}}","revision":1,"objective":"Finish the headless goal-tool snapshot proof","phase":"active","maxGoalRounds":7},"roundsStarted":0,"createdAt":0,"updatedAt":0}}} -{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":23,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"call_goal_create"},"content":[{"type":"tool-result","toolCallId":"call_goal_create","content":[{"type":"text","text":"{\"goal\":{\"id\":\"goal-{{sessionId}}\",\"revision\":1,\"objective\":\"Finish the headless goal-tool snapshot proof\",\"phase\":\"active\",\"roundsStarted\":0,\"maxGoalRounds\":7},\"activation\":\"armed\"}"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}} +{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":23,"time":0,"data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"call_goal_create"},"toolCallId":"call_goal_create","content":[{"type":"text","text":"{\"goal\":{\"id\":\"goal-{{sessionId}}\",\"revision\":1,\"objective\":\"Finish the headless goal-tool snapshot proof\",\"phase\":\"active\",\"roundsStarted\":0,\"maxGoalRounds\":7},\"activation\":\"armed\"}"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/end","seq":24,"time":0,"data":{"turn":1,"step":2}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/start","seq":25,"time":0,"data":{"turn":1,"step":3}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":26,"time":0,"data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_goal_get","name":"get_goal","arguments":"{}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":30,"outputTokens":4},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_goal_get","name":"get_goal","args":["{}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_goal_get","name":"get_goal","arguments":"{}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":30,"outputTokens":4}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":27,"time":0,"data":{"turn":1,"step":3,"callId":"call_goal_get","name":"get_goal","arguments":"{}"}}} -{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":28,"time":0,"data":{"turn":1,"step":3,"message":{"source":{"kind":"tool","callId":"call_goal_get"},"content":[{"type":"tool-result","toolCallId":"call_goal_get","content":[{"type":"text","text":"{\"goal\":{\"id\":\"goal-{{sessionId}}\",\"revision\":1,\"objective\":\"Finish the headless goal-tool snapshot proof\",\"phase\":\"active\",\"roundsStarted\":0,\"maxGoalRounds\":7},\"activation\":\"armed\"}"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[27],"surfaceOp":"append"}} +{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":28,"time":0,"data":{"turn":1,"step":3,"message":{"role":"tool","source":{"kind":"tool","callId":"call_goal_get"},"toolCallId":"call_goal_get","content":[{"type":"text","text":"{\"goal\":{\"id\":\"goal-{{sessionId}}\",\"revision\":1,\"objective\":\"Finish the headless goal-tool snapshot proof\",\"phase\":\"active\",\"roundsStarted\":0,\"maxGoalRounds\":7},\"activation\":\"armed\"}"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[27],"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/end","seq":29,"time":0,"data":{"turn":1,"step":3}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/start","seq":30,"time":0,"data":{"turn":1,"step":4}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":31,"time":0,"data":{"turn":1,"step":4,"message":{"role":"assistant","content":[{"type":"text","text":"GOAL READY"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":35,"outputTokens":2},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["GOAL READY"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"GOAL READY"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":35,"outputTokens":2}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}} diff --git a/apps/cli/tests/profiles/headless/tests/expected/subagent-settlement/stream-json.expected.jsonl b/apps/cli/tests/profiles/headless/tests/expected/subagent-settlement/stream-json.expected.jsonl index b027378207..48affa5389 100644 --- a/apps/cli/tests/profiles/headless/tests/expected/subagent-settlement/stream-json.expected.jsonl +++ b/apps/cli/tests/profiles/headless/tests/expected/subagent-settlement/stream-json.expected.jsonl @@ -13,7 +13,7 @@ {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":15,"time":0,"data":{"turn":1,"step":1,"callId":"start-child","name":"subagent","arguments":"{\"description\":\"Return child result\",\"prompt\":\"Reply with exactly CHILD_RESULT and nothing else. Do not call send_message.\"}"}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"session/title","seq":16,"time":0,"data":{"title":"Subagent settlement","messageSeqs":[8],"source":{"kind":"provider","provider":"session-title-first-prompt-llm","model":{"provider":"deepseek-official","model":"deepseek-v4-flash"}}}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"subagent/catalog","seq":17,"time":0,"data":{"version":0,"childId":"{{sessionId}}","childCreatedAt":0,"mode":"continuable","label":"Return child result"}}} -{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":18,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"start-child"},"content":[{"type":"tool-result","toolCallId":"start-child","content":[{"type":"text","text":"started subagent {{sessionId}}"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}} +{"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":18,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"start-child"},"content":[{"type":"text","text":"started subagent {{sessionId}}"}],"role":"tool","toolCallId":"start-child","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/end","seq":19,"time":0,"data":{"turn":1,"step":1}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"agent/inbox/spliced","seq":20,"time":0,"data":{"target":"next-step","start":0,"inserted":[{"content":[{"type":"text","text":"Background subagent {{sessionId}} finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"CHILD_RESULT"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent {{sessionId}} finished and will do no further work unless you send it more.","senderSessionId":"{{sessionId}}"},"role":"user","id":"{{sessionId}}"}]}}} {"type":"session_event","sessionId":"{{sessionId}}","event":{"type":"step/start","seq":21,"time":0,"data":{"turn":1,"step":2}}} diff --git a/apps/cli/tests/profiles/headless/tests/fixtures/team-llm.mjs b/apps/cli/tests/profiles/headless/tests/fixtures/team-llm.mjs index 8319ed9539..3e2da6553f 100644 --- a/apps/cli/tests/profiles/headless/tests/fixtures/team-llm.mjs +++ b/apps/cli/tests/profiles/headless/tests/fixtures/team-llm.mjs @@ -28,11 +28,9 @@ function hasTaskAction(messages, action) { } function latestToolText(messages) { - const message = messages.findLast(candidate => candidate.content.some(block => block.type === 'tool-result')) + const message = messages.findLast(candidate => candidate.role === 'tool') if (message === undefined) return '' - return message.content.flatMap(block => block.type === 'tool-result' - ? block.content.filter(item => item.type === 'text').map(item => item.text) - : []).join('\n') + return message.content.flatMap(block => block.type === 'text' ? [block.text] : []).join('\n') } function toolChunks(specs) { diff --git a/apps/cli/tests/profiles/headless/tests/full-loop.e2e.ts b/apps/cli/tests/profiles/headless/tests/full-loop.e2e.ts index 6816c60f61..bbacf9dc15 100644 --- a/apps/cli/tests/profiles/headless/tests/full-loop.e2e.ts +++ b/apps/cli/tests/profiles/headless/tests/full-loop.e2e.ts @@ -41,7 +41,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('full loop: real model + real bas const results = events.filter(event => event.type === 'tool/result') const resultTexts = results.flatMap(event => - event.data.message.content[0].content.filter(block => block.type === 'text').map(block => block.text)) + event.data.message.content.filter(block => block.type === 'text').map(block => block.text)) expect(resultTexts.some(text => text.includes('e2e-ok'))).toBe(true) expect(finalText(events)).toContain('e2e-ok') diff --git a/apps/cli/tests/profiles/headless/tests/headless.expected.e2e.ts b/apps/cli/tests/profiles/headless/tests/headless.expected.e2e.ts index d2e1939be2..4724981169 100644 --- a/apps/cli/tests/profiles/headless/tests/headless.expected.e2e.ts +++ b/apps/cli/tests/profiles/headless/tests/headless.expected.e2e.ts @@ -927,8 +927,7 @@ describe('headless stream-json snapshots', () => { }) const probeData = probeResult?.data as JsonObject | undefined const probeMessage = probeData?.message as JsonObject | undefined - const probeContent = probeMessage?.content as JsonObject[] | undefined - expect(probeContent?.[0]?.isError).toBe(true) + expect(probeMessage?.isError).toBe(true) expect((probeData?.error as JsonObject | undefined)?.code).toBe('GOAL_NOT_FOUND') const goalChanges = records.filter(record => record.type === 'goal/change') expect(goalChanges).toHaveLength(1) diff --git a/apps/web/tests/chat-continuous-conversation.e2e.ts b/apps/web/tests/chat-continuous-conversation.e2e.ts index c539a96601..810336de88 100644 --- a/apps/web/tests/chat-continuous-conversation.e2e.ts +++ b/apps/web/tests/chat-continuous-conversation.e2e.ts @@ -156,10 +156,11 @@ function assistantText(event: Extract): string { - return event.data.message.content[0].content - .filter(block => block.type === 'text') - .map(block => block.text) - .join('') + let text = '' + for (const block of event.data.message.content) { + if (block.type === 'text') text += block.text + } + return text } function messageKey(event: SessionEvent<'user/message'>): string { @@ -315,7 +316,7 @@ describe('web e2e: continuous conversation grown through the composer', () => { }) expect(results[0]?.data.turn).toBe(spec.index) expect(results[0]?.data.message.source.callId).toBe(spec.callId) - expect(results[0]?.data.message.content[0].isError).toBe(false) + expect(results[0]?.data.message.isError).toBe(false) expect(toolResultText(results[0]!)).toBe(`${spec.toolResultMarker}\n`) const toolRow = page.locator(`[data-chat-call-id="${spec.callId}"]`) diff --git a/apps/web/tests/complex-history.perf.ts b/apps/web/tests/complex-history.perf.ts index faa0146134..3740698e15 100644 --- a/apps/web/tests/complex-history.perf.ts +++ b/apps/web/tests/complex-history.perf.ts @@ -1012,9 +1012,9 @@ async function continueConversation( if (toolResult?.type !== 'tool/result') { throw new Error(`continued turn ${String(index)} did not log its tool result`) } - const resultBlock = toolResult.data.message.content.find(block => block.type === 'tool-result') - expect(resultBlock?.isError).toBe(false) - expect(resultBlock?.content + const message = toolResult.data.message + expect(message.isError).toBe(false) + expect(message.content .filter(block => block.type === 'text') .map(block => block.text) .join('')).toContain(spec.toolResultMarker) diff --git a/apps/web/tests/file-upload-round.e2e.ts b/apps/web/tests/file-upload-round.e2e.ts index c25211dd13..7ff564de92 100644 --- a/apps/web/tests/file-upload-round.e2e.ts +++ b/apps/web/tests/file-upload-round.e2e.ts @@ -318,9 +318,9 @@ describe('web e2e: generic file upload through the real assembly', () => { event.type === 'tool/result' && event.data.message.source.callId === readCall.data.callId, ) if (readResult === undefined) throw new Error('the read call produced no durable result') - const content = readResult.data.message.content[0] - expect(content.isError).toBe(false) - expect(content.content.filter(block => block.type === 'text').map(block => block.text).join('')) + const message = readResult.data.message + expect(message.isError).toBe(false) + expect(message.content.filter(block => block.type === 'text').map(block => block.text).join('')) .toContain('UPLOAD_ROUND_OK') const turnEnds = sessionEvents.filter(event => event.type === 'turn/end') diff --git a/apps/web/tests/fixtures/assembled-remote.fixture.json b/apps/web/tests/fixtures/assembled-remote.fixture.json index 34d3112dfe..296ec22a08 100644 --- a/apps/web/tests/fixtures/assembled-remote.fixture.json +++ b/apps/web/tests/fixtures/assembled-remote.fixture.json @@ -939,25 +939,20 @@ "turn": 52, "step": 0, "message": { + "id": "e9bbfe6c-96f3-44b6-b65c-89997783be1e", + "role": "tool", + "toolCallId": "fx-call-52", "source": { "kind": "tool", "callId": "fx-call-52" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-52", - "content": [ - { - "type": "text", - "text": "ECHO: TURN 52" - } - ], - "isError": false + "type": "text", + "text": "ECHO: TURN 52" } ], - "role": "user", - "id": "e9bbfe6c-96f3-44b6-b65c-89997783be1e" + "isError": false } } } @@ -1901,25 +1896,20 @@ "turn": 57, "step": 0, "message": { + "id": "652931ce-6eb0-4400-8173-9735b82fdf8e", + "role": "tool", + "toolCallId": "fx-call-57", "source": { "kind": "tool", "callId": "fx-call-57" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-57", - "content": [ - { - "type": "text", - "text": "ECHO: TURN 57" - } - ], - "isError": false + "type": "text", + "text": "ECHO: TURN 57" } ], - "role": "user", - "id": "652931ce-6eb0-4400-8173-9735b82fdf8e" + "isError": false } } } @@ -2559,25 +2549,20 @@ "turn": 60, "step": 0, "message": { + "id": "aa4c1898-7bec-4831-8ba1-0700f4ae897e", + "role": "tool", + "toolCallId": "fx-call-60", "source": { "kind": "tool", "callId": "fx-call-60" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-60", - "content": [ - { - "type": "text", - "text": "total 2\ndrwxr-xr-x fixture\n-rw-r--r-- demo.txt" - } - ], - "isError": false + "type": "text", + "text": "total 2\ndrwxr-xr-x fixture\n-rw-r--r-- demo.txt" } ], - "role": "user", - "id": "aa4c1898-7bec-4831-8ba1-0700f4ae897e" + "isError": false } } } @@ -2763,25 +2748,20 @@ "turn": 61, "step": 0, "message": { + "id": "4eedd943-773b-43d3-a104-e13550015670", + "role": "tool", + "toolCallId": "fx-call-61", "source": { "kind": "tool", "callId": "fx-call-61" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-61", - "content": [ - { - "type": "text", - "text": "wrote notes/demo.txt" - } - ], - "isError": false + "type": "text", + "text": "wrote notes/demo.txt" } ], - "role": "user", - "id": "4eedd943-773b-43d3-a104-e13550015670" + "isError": false }, "meta": { "diffs": [ @@ -2976,25 +2956,20 @@ "turn": 62, "step": 0, "message": { + "id": "37d72542-2cbc-4821-8897-329da97fe462", + "role": "tool", + "toolCallId": "fx-call-62", "source": { "kind": "tool", "callId": "fx-call-62" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-62", - "content": [ - { - "type": "text", - "text": "已编辑" - } - ], - "isError": false + "type": "text", + "text": "已编辑" } ], - "role": "user", - "id": "37d72542-2cbc-4821-8897-329da97fe462" + "isError": false }, "meta": { "diffs": [ @@ -3189,25 +3164,20 @@ "turn": 63, "step": 0, "message": { + "id": "0d0c76cf-f5b2-4f77-97cb-b0b66a67d135", + "role": "tool", + "toolCallId": "fx-call-63", "source": { "kind": "tool", "callId": "fx-call-63" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-63", - "content": [ - { - "type": "text", - "text": "已写入" - } - ], - "isError": false + "type": "text", + "text": "已写入" } ], - "role": "user", - "id": "0d0c76cf-f5b2-4f77-97cb-b0b66a67d135" + "isError": false }, "meta": { "diffs": [ @@ -3402,25 +3372,20 @@ "turn": 64, "step": 0, "message": { + "id": "11a489c7-466c-45ba-a5de-228fecd455f2", + "role": "tool", + "toolCallId": "fx-call-64", "source": { "kind": "tool", "callId": "fx-call-64" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-64", - "content": [ - { - "type": "text", - "text": "已编辑" - } - ], - "isError": false + "type": "text", + "text": "已编辑" } ], - "role": "user", - "id": "11a489c7-466c-45ba-a5de-228fecd455f2" + "isError": false }, "meta": { "diffs": [ @@ -3745,25 +3710,20 @@ "turn": 65, "step": 0, "message": { + "id": "ca689e1a-ebfb-4465-b187-43c3490abb9b", + "role": "tool", + "toolCallId": "fx-call-65", "source": { "kind": "tool", "callId": "fx-call-65" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-65", - "content": [ - { - "type": "text", - "text": "{\"listing\":\"demo.txt\\nnew-demo.txt\",\"demo\":\"hello fixture\\n\"}" - } - ], - "isError": false + "type": "text", + "text": "{\"listing\":\"demo.txt\\nnew-demo.txt\",\"demo\":\"hello fixture\\n\"}" } ], - "role": "user", - "id": "ca689e1a-ebfb-4465-b187-43c3490abb9b" + "isError": false } } } @@ -3949,25 +3909,20 @@ "turn": 66, "step": 0, "message": { + "id": "0da2afe6-5036-4d36-b9f3-ff562585507f", + "role": "tool", + "toolCallId": "fx-call-66", "source": { "kind": "tool", "callId": "fx-call-66" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-66", - "content": [ - { - "type": "text", - "text": "\u001b[1mRunning 4 checks\u001b[0m\n\u001b[32m✓\u001b[0m typecheck 1.82s\n\u001b[32m✓\u001b[0m lint 0.94s\n\u001b[32m✓\u001b[0m duplication 2.10s\n\u001b[31m✗\u001b[0m unit 8.41s\n\n\u001b[90mpackages/client/ui-primitives/tests/terminal-block.client.spec.tsx\u001b[0m\n \u001b[31mFAIL\u001b[0m caps output at the configured line budget\n expected 16 lines, received 24\n\nNAME LINES BRANCHES FUNCTIONS UNCOVERED\nTerminalBlock.tsx 100% 100% 100% -\nansi.ts 100% 100% 100% -\nclipboard.ts 100% 100% 100% -\nCodeBlock.tsx 98.4% 96.2% 100% 41-43\nhighlight.ts 100% 100% 100% -\nPill.tsx 100% 100% 100% -\nStateDot.tsx 100% 100% 100% -\nmarkdown/Markdown.tsx 100% 100% 100% -\n\n\u001b[31m1 of 4 checks failed\u001b[0m\n[exit code: 1]" - } - ], - "isError": false + "type": "text", + "text": "\u001b[1mRunning 4 checks\u001b[0m\n\u001b[32m✓\u001b[0m typecheck 1.82s\n\u001b[32m✓\u001b[0m lint 0.94s\n\u001b[32m✓\u001b[0m duplication 2.10s\n\u001b[31m✗\u001b[0m unit 8.41s\n\n\u001b[90mpackages/client/ui-primitives/tests/terminal-block.client.spec.tsx\u001b[0m\n \u001b[31mFAIL\u001b[0m caps output at the configured line budget\n expected 16 lines, received 24\n\nNAME LINES BRANCHES FUNCTIONS UNCOVERED\nTerminalBlock.tsx 100% 100% 100% -\nansi.ts 100% 100% 100% -\nclipboard.ts 100% 100% 100% -\nCodeBlock.tsx 98.4% 96.2% 100% 41-43\nhighlight.ts 100% 100% 100% -\nPill.tsx 100% 100% 100% -\nStateDot.tsx 100% 100% 100% -\nmarkdown/Markdown.tsx 100% 100% 100% -\n\n\u001b[31m1 of 4 checks failed\u001b[0m\n[exit code: 1]" } ], - "role": "user", - "id": "0da2afe6-5036-4d36-b9f3-ff562585507f" + "isError": false } } } @@ -4153,25 +4108,20 @@ "turn": 67, "step": 0, "message": { + "id": "9a3df388-356c-4440-b0bf-b09e0dda0387", + "role": "tool", + "toolCallId": "fx-call-67", "source": { "kind": "tool", "callId": "fx-call-67" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-67", - "content": [ - { - "type": "text", - "text": "Found 9 of 42 matches\n\npackages/client/ui-primitives/src/SearchBlock.tsx\nLine 16: export const DEFAULT_SEARCH_MAX_LINES = 16\nLine 138: export function SearchBlock(props: SearchBlockProps) {\nLine 141: const [collapsed, setCollapsed] = useState>(() => new Set())\npackages/client/ui-tool/src/client/tool/models/search-card-model.ts\nLine 45: export const CHAT_SEARCH_MAX_LINES = 8\nLine 130: export function searchCardModel(block: ToolCallBlock): SearchCardModel | null {\npackages/client/ui-tool/src/client/tool/toolviews/search-row.tsx\nLine 34: export function SearchRow({ toolName, block, inspect, t }: SearchRowProps) {\nLine 36: const search = searchCardModel(block)\nLine 56: search={search}\nLine 78: yield ctx.slots.register({ name: 'tool.call.toolview', key: 'grep', locale: NS }, SearchRow)\n\n(Full grep result stored at: fixture://spill/grep-66. Read it to see every match.)" - } - ], - "isError": false + "type": "text", + "text": "Found 9 of 42 matches\n\npackages/client/ui-primitives/src/SearchBlock.tsx\nLine 16: export const DEFAULT_SEARCH_MAX_LINES = 16\nLine 138: export function SearchBlock(props: SearchBlockProps) {\nLine 141: const [collapsed, setCollapsed] = useState>(() => new Set())\npackages/client/ui-tool/src/client/tool/models/search-card-model.ts\nLine 45: export const CHAT_SEARCH_MAX_LINES = 8\nLine 130: export function searchCardModel(block: ToolCallBlock): SearchCardModel | null {\npackages/client/ui-tool/src/client/tool/toolviews/search-row.tsx\nLine 34: export function SearchRow({ toolName, block, inspect, t }: SearchRowProps) {\nLine 36: const search = searchCardModel(block)\nLine 56: search={search}\nLine 78: yield ctx.slots.register({ name: 'tool.call.toolview', key: 'grep', locale: NS }, SearchRow)\n\n(Full grep result stored at: fixture://spill/grep-66. Read it to see every match.)" } ], - "role": "user", - "id": "9a3df388-356c-4440-b0bf-b09e0dda0387" + "isError": false }, "meta": { "shape": "matches", @@ -4415,25 +4365,20 @@ "turn": 68, "step": 0, "message": { + "id": "e6d88943-d180-472b-9c1b-d59a21a50ab9", + "role": "tool", + "toolCallId": "fx-call-68", "source": { "kind": "tool", "callId": "fx-call-68" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-68", - "content": [ - { - "type": "text", - "text": "packages/client/ui-primitives/src/SearchBlock.tsx\npackages/client/ui-primitives/src/SearchBlock.module.css\npackages/client/ui-tool/src/client/tool/models/search-card-model.ts\npackages/client/ui-tool/src/client/tool/toolviews/search-row.tsx\npackages/client/ui-tool/tests/search-card.client.spec.tsx\n\n(Showing 5 of 23 paths. Full sorted result stored at: fixture://spill/glob-67. Read it to see every path.)" - } - ], - "isError": false + "type": "text", + "text": "packages/client/ui-primitives/src/SearchBlock.tsx\npackages/client/ui-primitives/src/SearchBlock.module.css\npackages/client/ui-tool/src/client/tool/models/search-card-model.ts\npackages/client/ui-tool/src/client/tool/toolviews/search-row.tsx\npackages/client/ui-tool/tests/search-card.client.spec.tsx\n\n(Showing 5 of 23 paths. Full sorted result stored at: fixture://spill/glob-67. Read it to see every path.)" } ], - "role": "user", - "id": "e6d88943-d180-472b-9c1b-d59a21a50ab9" + "isError": false }, "meta": { "shape": "paths", @@ -4631,25 +4576,20 @@ "turn": 69, "step": 0, "message": { + "id": "937c02dd-63d8-4106-9310-a9df2055f0e9", + "role": "tool", + "toolCallId": "fx-call-69", "source": { "kind": "tool", "callId": "fx-call-69" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-69", - "content": [ - { - "type": "text", - "text": "packages/client/ui-primitives/src/ReadBlock.tsx\nfile\n\n41: export interface ReadBlockProps {\n42: label?: string | undefined\n43: lines: readonly ReadBlockLine[]\n44: totalLines: number\n45: lang?: string | undefined\n46: maxLines?: number | undefined\n47: className?: string | undefined\n48: }\n49: \n50: // A windowed read keeps the file line numbers in the gutter.\n51: const marker = \"fixture read sample\"\n\n(Showing lines 41-51 of 180. Use offset=52 to continue.)\n" - } - ], - "isError": false + "type": "text", + "text": "packages/client/ui-primitives/src/ReadBlock.tsx\nfile\n\n41: export interface ReadBlockProps {\n42: label?: string | undefined\n43: lines: readonly ReadBlockLine[]\n44: totalLines: number\n45: lang?: string | undefined\n46: maxLines?: number | undefined\n47: className?: string | undefined\n48: }\n49: \n50: // A windowed read keeps the file line numbers in the gutter.\n51: const marker = \"fixture read sample\"\n\n(Showing lines 41-51 of 180. Use offset=52 to continue.)\n" } ], - "role": "user", - "id": "937c02dd-63d8-4106-9310-a9df2055f0e9" + "isError": false }, "meta": { "path": "packages/client/ui-primitives/src/ReadBlock.tsx", @@ -4887,25 +4827,20 @@ "turn": 70, "step": 0, "message": { + "id": "c2ddb04d-74c9-4a2f-83f6-47a48fc6fbc2", + "role": "tool", + "toolCallId": "fx-call-70", "source": { "kind": "tool", "callId": "fx-call-70" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-70", - "content": [ - { - "type": "text", - "text": "Search results for deepseek harness architecture." - } - ], - "isError": false + "type": "text", + "text": "Search results for deepseek harness architecture." } ], - "role": "user", - "id": "c2ddb04d-74c9-4a2f-83f6-47a48fc6fbc2" + "isError": false }, "meta": { "answer": "DeepSeek Harness is a plugin-based agent harness on vendored Cordis where **every capability is a plugin**.", @@ -5112,25 +5047,20 @@ "turn": 71, "step": 0, "message": { + "id": "57cf5cd3-3daf-4e2c-bb16-f8695bc2ab8c", + "role": "tool", + "toolCallId": "fx-call-71", "source": { "kind": "tool", "callId": "fx-call-71" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-71", - "content": [ - { - "type": "text", - "text": "# Harness architecture\n\nEverything is a plugin." - } - ], - "isError": false + "type": "text", + "text": "# Harness architecture\n\nEverything is a plugin." } ], - "role": "user", - "id": "57cf5cd3-3daf-4e2c-bb16-f8695bc2ab8c" + "isError": false }, "meta": { "url": "https://www.deepseek.com/blog/harness-architecture", @@ -5701,25 +5631,20 @@ "turn": 74, "step": 0, "message": { + "id": "499968fd-a83f-45ad-80fe-b1d73651ff13", + "role": "tool", + "toolCallId": "fx-call-74", "source": { "kind": "tool", "callId": "fx-call-74" }, "content": [ { - "type": "tool-result", - "toolCallId": "fx-call-74", - "content": [ - { - "type": "text", - "text": "Updated todo list: 1 pending, 2 in progress, 1 completed." - } - ], - "isError": false + "type": "text", + "text": "Updated todo list: 1 pending, 2 in progress, 1 completed." } ], - "role": "user", - "id": "499968fd-a83f-45ad-80fe-b1d73651ff13" + "isError": false } } } diff --git a/apps/web/tests/fork-mid-turn.e2e.ts b/apps/web/tests/fork-mid-turn.e2e.ts index 5718043c8a..2ffa330007 100644 --- a/apps/web/tests/fork-mid-turn.e2e.ts +++ b/apps/web/tests/fork-mid-turn.e2e.ts @@ -49,7 +49,7 @@ function continuationScript(): ReplayEntry[] { } function toolResultText(event: SessionEvent<'tool/result'>): string { - return event.data.message.content[0].content + return event.data.message.content .filter(block => block.type === 'text') .map(block => block.text) .join('') diff --git a/apps/web/tests/plan-review.e2e.ts b/apps/web/tests/plan-review.e2e.ts index 1e1a94c1f4..5362264b42 100644 --- a/apps/web/tests/plan-review.e2e.ts +++ b/apps/web/tests/plan-review.e2e.ts @@ -248,7 +248,7 @@ describe('web e2e: dismissed plan history', () => { expect(call).toBeDefined() const results = events.filter(event => event.type === 'tool/result') const result = results.find(event => event.data.message.source.callId === call?.data.callId) - expect(result?.data.message.content[0]).toMatchObject({ type: 'tool-result', isError: true }) + expect(result?.data.message).toMatchObject({ role: 'tool', toolCallId: call?.data.callId, isError: true }) expect(JSON.stringify(result)).toContain('dismissed the plan review') expect(results.some(event => JSON.stringify(event).includes('Plan approved'))).toBe(false) const modes = events.filter(event => event.type === 'plan/mode') diff --git a/apps/web/tests/present.e2e.ts b/apps/web/tests/present.e2e.ts index bf8eb5e1e8..1c4c5fe44f 100644 --- a/apps/web/tests/present.e2e.ts +++ b/apps/web/tests/present.e2e.ts @@ -106,7 +106,7 @@ fs.appendFileSync(${JSON.stringify(openLog)}, JSON.stringify({ path, action, con } } expect(events.some(event => event.type === 'tool/ptc-dispatch' && event.data.name === 'present' && event.data.isError)).toBe(true) - expect(events.some(event => event.type === 'tool/result' && event.data.message.content[0].isError)).toBe(true) + expect(events.some(event => event.type === 'tool/result' && event.data.message.isError)).toBe(true) }, 200_000) it('opens current source files after edits and reload, and reports deletion without downloading', async () => { diff --git a/apps/web/tests/question-composer.e2e.ts b/apps/web/tests/question-composer.e2e.ts index 260792f545..1f10a588b5 100644 --- a/apps/web/tests/question-composer.e2e.ts +++ b/apps/web/tests/question-composer.e2e.ts @@ -280,11 +280,10 @@ describe('web e2e: resident question composer round trip', () => { answeredSession = sessionId // World state: the tool result carries the chosen answer, and DONE lands. const results = sessionEvents.filter(e => e.type === 'tool/result') - const answerText = results.flatMap(event => event.data.message.content.flatMap(block => - block.type === 'tool-result' - ? block.content.filter(item => item.type === 'text').map(item => item.text) - : [], - )).at(-1) + const answerText = results.flatMap(event => event.data.message.content + .filter(item => item.type === 'text') + .map(item => item.text), + ).at(-1) expect(JSON.parse(answerText ?? '')).toEqual({ answers: [{ id: 'color', selected: ['Blue'], custom: 'Include accessibility notes' }], }) diff --git a/apps/web/tests/replay-round-trip.e2e.ts b/apps/web/tests/replay-round-trip.e2e.ts index b4e78ec07e..8bddaee2d7 100644 --- a/apps/web/tests/replay-round-trip.e2e.ts +++ b/apps/web/tests/replay-round-trip.e2e.ts @@ -171,8 +171,8 @@ describe('web e2e: fresh round trip through the real assembly', () => { const bashResult = sessionEvents.find(event => event.type === 'tool/result' && event.data.message.source.callId === bashCall.data.callId) if (bashResult?.type !== 'tool/result') throw new Error('the bash tool call produced no durable result') - expect(bashResult.data.message.content[0].isError).toBe(false) - expect(bashResult.data.message.content[0].content.filter(block => block.type === 'text').map(block => block.text).join('')) + expect(bashResult.data.message.isError).toBe(false) + expect(bashResult.data.message.content.filter(block => block.type === 'text').map(block => block.text).join('')) .toBe('WEB_E2E_OK\n') const turnEnds = sessionEvents.filter(e => e.type === 'turn/end') expect(turnEnds.length).toBe(1) diff --git a/apps/web/tests/shipped-composition.e2e.ts b/apps/web/tests/shipped-composition.e2e.ts index ac7ec67d49..c278bd1e3c 100644 --- a/apps/web/tests/shipped-composition.e2e.ts +++ b/apps/web/tests/shipped-composition.e2e.ts @@ -101,7 +101,7 @@ class ShippedAutoAdapter extends LlmAdapter { })) return } - if (options.messages.some(message => message.content.some(block => block.type === 'tool-result'))) { + if (options.messages.some(message => message.role === 'tool')) { yield* textChunks(AUTO_FINAL_TEXT) return } @@ -429,10 +429,9 @@ function toolOutcomes(events: readonly SessionEvent[]): Array<{ name: string; co } return events.flatMap((event) => { if (event.type !== 'tool/result') return [] - const block = event.data.message.content.find(item => item.type === 'tool-result') - if (block === undefined) return [] - const name = names.get(block.toolCallId) - if (name === undefined) throw new Error(`tool result ${block.toolCallId} has no matching call`) + const { toolCallId } = event.data.message + const name = names.get(toolCallId) + if (name === undefined) throw new Error(`tool result ${toolCallId} has no matching call`) return [{ name, ...event.data.error === undefined ? {} : { code: event.data.error.code } }] }) } @@ -794,7 +793,7 @@ it('routes one browser-authored Auto request through the same model before a rea expect(prompt).toBeDefined() const result = events.find((event): event is Extract => ( event.type === 'tool/result' - && event.data.message.content.some(block => block.toolCallId === AUTO_CALL_ID) + && event.data.message.toolCallId === AUTO_CALL_ID )) expect(result?.data.error).toEqual({ name: 'AutoReviewDeniedError', diff --git a/apps/web/tests/sidebar-right.e2e.ts b/apps/web/tests/sidebar-right.e2e.ts index 85b878c7a3..ffcc3c42a7 100644 --- a/apps/web/tests/sidebar-right.e2e.ts +++ b/apps/web/tests/sidebar-right.e2e.ts @@ -297,9 +297,11 @@ describe('web e2e: shipped right Sidebar', () => { step: 1, message: { id: 'result-call-write-1', - role: 'user', + role: 'tool', source: { kind: 'tool', callId: 'call-write-1' }, - content: [{ type: 'tool-result', toolCallId: 'call-write-1', content: [{ type: 'text', text: 'ok' }] }], + toolCallId: 'call-write-1', + content: [{ type: 'text', text: 'ok' }], + isError: false, }, } as never, { surfaceOp: 'append' }) agent.session.append('assistant/message', { diff --git a/apps/web/tests/web-search-round.e2e.ts b/apps/web/tests/web-search-round.e2e.ts index 4128d0d46e..506c8abe34 100644 --- a/apps/web/tests/web-search-round.e2e.ts +++ b/apps/web/tests/web-search-round.e2e.ts @@ -239,9 +239,9 @@ describe('web e2e: shipped default web search', () => { event.type === 'tool/result' && event.data.message.source.callId === searchCall.data.callId, ) if (searchResult === undefined) throw new Error('web_search produced no durable result') - const content = searchResult.data.message.content[0] - expect(content.isError).toBe(false) - const rendered = content.content.filter(block => block.type === 'text').map(block => block.text).join('') + const message = searchResult.data.message + expect(message.isError).toBe(false) + const rendered = message.content.filter(block => block.type === 'text').map(block => block.text).join('') // The tool interleaves sources from both seam results before applying the // combined cap, so each query remains represented in model-visible output. for (const source of KEPT_SOURCES) { diff --git a/benchmarks/agent-continuation/profile-continuation.worker.ts b/benchmarks/agent-continuation/profile-continuation.worker.ts index 531fc2f50d..f744add964 100644 --- a/benchmarks/agent-continuation/profile-continuation.worker.ts +++ b/benchmarks/agent-continuation/profile-continuation.worker.ts @@ -62,8 +62,8 @@ async function run(root: string): Promise { requests += result.events.filter(event => event.type === 'assistant/message').length for (const event of result.events) { if (event.type !== 'tool/result') continue - const result = event.data.message.content[0] - if (result.isError || !result.content.some(block => block.type === 'text' && block.text.includes('export const synthetic = 42;'))) { + const message = event.data.message + if (message.isError || !message.content.some(block => block.type === 'text' && block.text.includes('export const synthetic = 42;'))) { throw new Error('profile benchmark did not read the synthetic file') } toolCalls++ diff --git a/benchmarks/agent-continuation/workload.ts b/benchmarks/agent-continuation/workload.ts index 20eae5d5ca..b2909e7c2c 100644 --- a/benchmarks/agent-continuation/workload.ts +++ b/benchmarks/agent-continuation/workload.ts @@ -91,8 +91,9 @@ export function syntheticHistory(turns: number): SessionEvent[] { session.append('tool/result', { turn, step, message: { - id: MessageId('result-' + block.id), role: 'user', source: { kind: 'tool', callId: block.id }, - content: [{ type: 'tool-result', toolCallId: block.id, content: [{ type: 'text', text: resultText(turn) }], isError: false }], + id: MessageId('result-' + block.id), role: 'tool', toolCallId: block.id, isError: false, + source: { kind: 'tool', callId: block.id }, + content: [{ type: 'text', text: resultText(turn) }], }, }, { surfaceOp: 'append', sourceEventSeqs: [call.seq] }) } diff --git a/docs/persistence-catalog.i18n.yaml b/docs/persistence-catalog.i18n.yaml index f735c9b997..1c0a7947ca 100644 --- a/docs/persistence-catalog.i18n.yaml +++ b/docs/persistence-catalog.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/persistence-catalog.md -persistence-catalog.md: ba70d5713012d09708882fe6dbd1fa9356099327 -persistence-catalog.zh.md: aa6cc3fe44753dff0408e5271f1e068e2de92ad1 +persistence-catalog.md: d17fa6c74408367fa35fd5f251d3168780792cd9 +persistence-catalog.zh.md: e1e83dd5f7e5e04b1f975696f2099a53500f3cca diff --git a/docs/persistence-catalog.md b/docs/persistence-catalog.md index ba70d57130..d17fa6c744 100644 --- a/docs/persistence-catalog.md +++ b/docs/persistence-catalog.md @@ -21,18 +21,18 @@ The [format references](persistence-changes/historical-formats/README.md) cover | `JsonlHeaderLine` | header | `18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f` | [`HeaderLine`](#persistence-type-sha256-18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f) | | `SessionEventEnvelope` | envelope | `5776e5553ff2dfe3f5bc202dbb1e7c9f93e35a531aebb7764c23b2b6153b2ccc` | [`union (3 variants)`](#persistence-type-sha256-5776e5553ff2dfe3f5bc202dbb1e7c9f93e35a531aebb7764c23b2b6153b2ccc) | | `event:agent-preset/selected` | event | `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | [`{ type: "agent-preset/selected" }`](#persistence-type-sha256-a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b) | -| `event:agent/inbox/spliced` | event | `646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f) | +| `event:agent/inbox/spliced` | event | `cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a) | | `event:approval/asked` | event | `3bfeb47b58606f4661904bc723da612782214c463d01e6d61cd6d6193d7374e1` | [`{ type: "approval/asked" }`](#persistence-type-sha256-3bfeb47b58606f4661904bc723da612782214c463d01e6d61cd6d6193d7374e1) | | `event:approval/decided` | event | `bb1ab3d08f49a9f3b265f844cd78d5c49813062a7b34b54904b426f85d0ff6e3` | [`{ type: "approval/decided" }`](#persistence-type-sha256-bb1ab3d08f49a9f3b265f844cd78d5c49813062a7b34b54904b426f85d0ff6e3) | | `event:approval/policy` | event | `26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78` | [`{ type: "approval/policy" }`](#persistence-type-sha256-26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78) | -| `event:assistant/attempt` | event | `c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e` | [`{ type: "assistant/attempt" }`](#persistence-type-sha256-c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e) | -| `event:assistant/message` | event | `1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d` | [`{ type: "assistant/message" }`](#persistence-type-sha256-1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d) | +| `event:assistant/attempt` | event | `2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2` | [`{ type: "assistant/attempt" }`](#persistence-type-sha256-2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2) | +| `event:assistant/message` | event | `f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58` | [`{ type: "assistant/message" }`](#persistence-type-sha256-f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58) | | `event:command/done` | event | `15196447222782e773eb943c92b18316ce96b9af0f0cfddb6e57ba8274ecc5ff` | [`{ type: "command/done" }`](#persistence-type-sha256-15196447222782e773eb943c92b18316ce96b9af0f0cfddb6e57ba8274ecc5ff) | | `event:command/run` | event | `37184378c6439257d105c4e2022d80fc9c3a3f7c7f6ac661b00bc9f18d871006` | [`{ type: "command/run" }`](#persistence-type-sha256-37184378c6439257d105c4e2022d80fc9c3a3f7c7f6ac661b00bc9f18d871006) | | `event:compaction/end` | event | `b0127044ab31a702bddfd785d345f5abd7a70876746e895ce443afa3e60ddf2d` | [`{ type: "compaction/end" }`](#persistence-type-sha256-b0127044ab31a702bddfd785d345f5abd7a70876746e895ce443afa3e60ddf2d) | | `event:compaction/prune` | event | `7f7fd5a6b0064f597534b29ff62ef26e786dffccf5e14f654a7d4fcea2c35f04` | [`{ type: "compaction/prune" }`](#persistence-type-sha256-7f7fd5a6b0064f597534b29ff62ef26e786dffccf5e14f654a7d4fcea2c35f04) | | `event:compaction/start` | event | `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | [`{ type: "compaction/start" }`](#persistence-type-sha256-db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965) | -| `event:compaction/summary` | event | `f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59) | +| `event:compaction/summary` | event | `86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559) | | `event:deliverables/presented` | event | `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | [`{ type: "deliverables/presented" }`](#persistence-type-sha256-13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176) | | `event:feedback/message-delete` | event | `3ee93b06f3a125850337602bcdf155d2538c43a5c944ec55b1b3c365152d6796` | [`{ type: "feedback/message-delete" }`](#persistence-type-sha256-3ee93b06f3a125850337602bcdf155d2538c43a5c944ec55b1b3c365152d6796) | | `event:feedback/message-put` | event | `b5086d249e8502e9ead1d39156bb8d559bde7951cac0f14ce150345b4e42a2bf` | [`{ type: "feedback/message-put" }`](#persistence-type-sha256-b5086d249e8502e9ead1d39156bb8d559bde7951cac0f14ce150345b4e42a2bf) | @@ -53,16 +53,16 @@ The [format references](persistence-changes/historical-formats/README.md) cover | `event:session-log-deepseek/delivery-accepted` | event | `d63b8b8ffad9c02fd80c43a17df4f240c1fe8118ecca9de34f9d5871838ab5b9` | [`{ type: "session-log-deepseek/delivery-accepted" }`](#persistence-type-sha256-d63b8b8ffad9c02fd80c43a17df4f240c1fe8118ecca9de34f9d5871838ab5b9) | | `event:session/end-seed` | event | `5e6db6e24948d4a853c71cb9fabd252ad051ce93d4672c1266cf837c1c17b84e` | [`{ type: "session/end-seed" }`](#persistence-type-sha256-5e6db6e24948d4a853c71cb9fabd252ad051ce93d4672c1266cf837c1c17b84e) | | `event:session/title` | event | `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | [`{ type: "session/title" }`](#persistence-type-sha256-1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5) | -| `event:session/title-llm-request` | event | `e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d) | +| `event:session/title-llm-request` | event | `2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0) | | `event:step/end` | event | `e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05` | [`{ type: "step/end" }`](#persistence-type-sha256-e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05) | | `event:step/start` | event | `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986` | [`{ type: "step/start" }`](#persistence-type-sha256-4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986) | | `event:subagent/catalog` | event | `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871) | | `event:subagent/descriptor` | event | `b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5` | [`{ type: "subagent/descriptor" }`](#persistence-type-sha256-b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5) | | `event:subagent/model-selection-policy` | event | `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | [`{ type: "subagent/model-selection-policy" }`](#persistence-type-sha256-a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc) | -| `event:system/message` | event | `69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae` | [`{ type: "system/message" }`](#persistence-type-sha256-69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae) | +| `event:system/message` | event | `1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300` | [`{ type: "system/message" }`](#persistence-type-sha256-1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300) | | `event:team/member` | event | `4fb59762612c3e3ac3a3bd4f84c9c148d3c3893bd422ba2b201cc039fabd49bc` | [`{ type: "team/member" }`](#persistence-type-sha256-4fb59762612c3e3ac3a3bd4f84c9c148d3c3893bd422ba2b201cc039fabd49bc) | | `event:team/message/delivered` | event | `48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb` | [`{ type: "team/message/delivered" }`](#persistence-type-sha256-48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb) | -| `event:team/message/queued` | event | `443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4` | [`{ type: "team/message/queued" }`](#persistence-type-sha256-443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4) | +| `event:team/message/queued` | event | `9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240` | [`{ type: "team/message/queued" }`](#persistence-type-sha256-9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240) | | `event:team/task` | event | `d595ec73b32b016a6055333c67a5d646032b22e672da1d4a09c5b1ae398a093a` | [`{ type: "team/task" }`](#persistence-type-sha256-d595ec73b32b016a6055333c67a5d646032b22e672da1d4a09c5b1ae398a093a) | | `event:todo/write` | event | `b978cff734e62143eb56c9125423ec275405eda969802d42aaf73ecb987d3b26` | [`{ type: "todo/write" }`](#persistence-type-sha256-b978cff734e62143eb56c9125423ec275405eda969802d42aaf73ecb987d3b26) | | `event:tool-workflow/agent-end` | event | `babf9ee4d1af62bf6c3a8103737f7a5e4e78ce179be835ce05a38803e15884b7` | [`{ type: "tool-workflow/agent-end" }`](#persistence-type-sha256-babf9ee4d1af62bf6c3a8103737f7a5e4e78ce179be835ce05a38803e15884b7) | @@ -70,12 +70,12 @@ The [format references](persistence-changes/historical-formats/README.md) cover | `event:tool-workflow/run-end` | event | `42e0916e0dda5f6d1e7bb05d8514717147c036a79c9f36085683469516c1fd3f` | [`{ type: "tool-workflow/run-end" }`](#persistence-type-sha256-42e0916e0dda5f6d1e7bb05d8514717147c036a79c9f36085683469516c1fd3f) | | `event:tool-workflow/run-start` | event | `c1f9e0405de6d18cabb9ee70782a027f9bbdc57e5abec9dcccdd56119e2e9058` | [`{ type: "tool-workflow/run-start" }`](#persistence-type-sha256-c1f9e0405de6d18cabb9ee70782a027f9bbdc57e5abec9dcccdd56119e2e9058) | | `event:tool/call` | event | `3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48` | [`{ type: "tool/call" }`](#persistence-type-sha256-3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48) | -| `event:tool/ptc-dispatch` | event | `b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c` | [`{ type: "tool/ptc-dispatch" }`](#persistence-type-sha256-b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c) | +| `event:tool/ptc-dispatch` | event | `75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185` | [`{ type: "tool/ptc-dispatch" }`](#persistence-type-sha256-75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185) | | `event:tool/ptc-dispatch-start` | event | `ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93` | [`{ type: "tool/ptc-dispatch-start" }`](#persistence-type-sha256-ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93) | -| `event:tool/result` | event | `29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2` | [`{ type: "tool/result" }`](#persistence-type-sha256-29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2) | +| `event:tool/result` | event | `f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c` | [`{ type: "tool/result" }`](#persistence-type-sha256-f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c) | | `event:turn/end` | event | `0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce` | [`{ type: "turn/end" }`](#persistence-type-sha256-0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce) | | `event:turn/start` | event | `aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8` | [`{ type: "turn/start" }`](#persistence-type-sha256-aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8) | -| `event:user/message` | event | `314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578` | [`{ type: "user/message" }`](#persistence-type-sha256-314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578) | +| `event:user/message` | event | `5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6` | [`{ type: "user/message" }`](#persistence-type-sha256-5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6) | | `event:web/deepseek-search-llm-request` | event | `cf6e3aaf1e2de6480aa0157730a41b9a492108a55304100b0f7e112711dd4331` | [`{ type: "web/deepseek-search-llm-request" }`](#persistence-type-sha256-cf6e3aaf1e2de6480aa0157730a41b9a492108a55304100b0f7e112711dd4331) | | `event:workspace/changes` | event | `e308ccf867a5398e316e0af8cb6ce238a8d33a63b9b384c8250a686786285f72` | [`{ type: "workspace/changes" }`](#persistence-type-sha256-e308ccf867a5398e316e0af8cb6ce238a8d33a63b9b384c8250a686786285f72) | @@ -1106,7 +1106,7 @@ Source: [`packages/core/tools/src/types.ts:42`](../packages/core/tools/src/types message: ToolResultMessage /** * Optional failure identity and raw user-facing reason, outside model content; - * allowed only when the tool-result block has `isError: true`. + * allowed only when the message has `isError: true`. */ error?: { name: string; code: string; reason?: string } meta?: JsonValue @@ -1842,7 +1842,7 @@ SHA-256: `ebb768d85ec87fb68e42fc14fd7d8535b5ac11791b14d04c6770180f0a719bf8` SHA-256: `f311671e07bc7fa645a0b6597de9966b97147956565296ba76a36543801b66c5` -Sources: [`packages/llm/llm/src/types.ts:383`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:374`](../packages/llm/llm/src/types.ts) `"in-history"` @@ -2518,14 +2518,6 @@ SHA-256: `6c1cccb433ddc153facb380c7dda956237ba5c31f8a532a69142dc277890cc9b` `"tool-calls"` - - -### `"tool-result"` - -SHA-256: `e5244812c495a80c2e78ba2c2690dca5f6b58ea8d3fe5531ff94a6f9ac5e5d66` - -`"tool-result"` - ### `"tool-workflow/agent-end"` @@ -2839,7 +2831,7 @@ One of: - `"ask"` - `"never"` - + @@ -2847,18 +2839,18 @@ One of: ### `AssistantMessage` -SHA-256: `e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83` +SHA-256: `fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05` -Sources: [`packages/llm/llm/src/message.ts:148`](../packages/llm/llm/src/message.ts) +Sources: [`packages/llm/llm/src/message.ts:152`](../packages/llm/llm/src/message.ts) | Property | Presence | Type | |---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | required | `string` | | `role` | required | `"assistant"` | | `source` | required | [`ModelMessageSource`](#persistence-type-sha256-719c51f67074f97034a6c94297fe1f4b5d3c8d392c57586dab732aa5398c7a91) | - + @@ -2866,24 +2858,24 @@ Sources: [`packages/llm/llm/src/message.ts:148`](../packages/llm/llm/src/message ### `AssistantStreamRecord` -SHA-256: `86cf1e44038cb8b11659863dd0efafe682e41b9c782265c1d50e0a687debfc60` +SHA-256: `050e0338b08a9712f3454b1e93bd7f5bb2f426ebfaf828688dd9102fc6089b70` Sources: [`packages/llm/llm/src/assistant-stream.ts:20`](../packages/llm/llm/src/assistant-stream.ts) One of: - [`{ type: "tool-call-chunks" }`](#persistence-type-sha256-3860b4757d512a2869be833acb0faf834335b1b056bf3f83df5474dce95f8fa6) -- [`{ type: "chunk" }`](#persistence-type-sha256-c93b6f51b399607349b4bcc66b58e848a44250ffc1e2537207bd092dfff94192) +- [`{ type: "chunk" }`](#persistence-type-sha256-71a18f8c73d2082125528e0b546fdd914d310f93a4e5f48586cb9ee668574de3) - [`{ type: "reasoning-chunks" }`](#persistence-type-sha256-71bb3254ec8f1e491ce63b762a7b5f18709de23aa4e8abcc8b886f4b6ce051dd) - [`{ type: "text-chunks" }`](#persistence-type-sha256-e72269f931559e901e5e8fe1cfcbd0669fb795f43cc038ff39fba62f60403c33) - + ### `AssistantStreamRecord[]` -SHA-256: `26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346` +SHA-256: `d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878` -Array of [`AssistantStreamRecord`](#persistence-type-sha256-86cf1e44038cb8b11659863dd0efafe682e41b9c782265c1d50e0a687debfc60). +Array of [`AssistantStreamRecord`](#persistence-type-sha256-050e0338b08a9712f3454b1e93bd7f5bb2f426ebfaf828688dd9102fc6089b70). @@ -2920,7 +2912,7 @@ Sources: [`packages/core/session/src/types.ts:189`](../packages/core/session/src |---|---|---| | `kind` | required | `"user"` | - + @@ -2928,20 +2920,19 @@ Sources: [`packages/core/session/src/types.ts:189`](../packages/core/session/src ### `ContentBlock` -SHA-256: `c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56` +SHA-256: `3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e` -Sources: [`packages/llm/llm/src/types.ts:137`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:128`](../packages/llm/llm/src/types.ts) One of: -- [`ReasoningBlock`](#persistence-type-sha256-814d9434e1ddf9078612b3b34322f26e9363b469213335007f7e9ba7fee9464e) -- [`TextBlock`](#persistence-type-sha256-4e887768586528565381dadbddee6cef555874148089f4579e0b4b1ad096fc9c) - [`ToolCallBlock`](#persistence-type-sha256-c1f0f17b6493b85db6453bb30e01b208d703731b25bc1e68e5d4fc72eea9cdea) - [`ImageBlock`](#persistence-type-sha256-12d5808fac1996b9b3c2afa806e03022252ba2d7b88f835862ae1896591f60c7) - [`FileBlock`](#persistence-type-sha256-f2da0f27c1e6add59982c37b15e4a4912c5b33466859cce3b13d503600e24aef) -- [`ToolResultBlock`](#persistence-type-sha256-d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127) +- [`ReasoningBlock`](#persistence-type-sha256-814d9434e1ddf9078612b3b34322f26e9363b469213335007f7e9ba7fee9464e) +- [`TextBlock`](#persistence-type-sha256-4e887768586528565381dadbddee6cef555874148089f4579e0b4b1ad096fc9c) - + @@ -2949,9 +2940,9 @@ One of: ### `ContentBlockType` -SHA-256: `757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61` +SHA-256: `ccca7d237e176afec87877c379035a69e715ae0fb4e859015d29f14cc4376588` -Sources: [`packages/llm/llm/src/types.ts:135`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:126`](../packages/llm/llm/src/types.ts) One of: @@ -2960,15 +2951,14 @@ One of: - `"reasoning"` - `"text"` - `"tool-call"` -- `"tool-result"` - + ### `ContentBlock[]` -SHA-256: `bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75` +SHA-256: `a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6` -Array of [`ContentBlock`](#persistence-type-sha256-c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56). +Array of [`ContentBlock`](#persistence-type-sha256-3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e). @@ -3156,7 +3146,7 @@ Sources: [`packages/llm/llm/src/types.ts:97`](../packages/llm/llm/src/types.ts) SHA-256: `5808e36c95355f0e745201b5db1b6bcec4ebf5adb75d3e82d7d59cc89635ab80` -Sources: [`packages/llm/llm/src/types.ts:152`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:143`](../packages/llm/llm/src/types.ts) | kind | Form property | Other required fields | Full definition | |---|---|---|---| @@ -3330,7 +3320,7 @@ Sources: [`packages/goal/goal/src/domain.ts:24`](../packages/goal/goal/src/domai SHA-256: `18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f` -Sources: [`packages/session/session-persistence-jsonl/src/format.ts:82`](../packages/session/session-persistence-jsonl/src/format.ts) +Sources: [`packages/session/session-persistence-jsonl/src/format.ts:83`](../packages/session/session-persistence-jsonl/src/format.ts) | Property | Presence | Type | |---|---|---| @@ -3587,7 +3577,7 @@ Sources: [`packages/llm/llm-retry/src/types.ts:43`](../packages/llm/llm-retry/sr | `step` | required | `number` | | `turn` | required | `number` | - + @@ -3595,16 +3585,16 @@ Sources: [`packages/llm/llm-retry/src/types.ts:43`](../packages/llm/llm-retry/sr ### `Message` -SHA-256: `23c7cce57d20589897f4e2bd5898affc6fc611b87cd0cc8b95be1cfdd8b3a7eb` +SHA-256: `01bc74417fd4ff36c2840b266a5b3b51bf0e3b71eb43960a2c4aee7b7441a2aa` -Sources: [`packages/llm/llm/src/message.ts:131`](../packages/llm/llm/src/message.ts) +Sources: [`packages/llm/llm/src/message.ts:180`](../packages/llm/llm/src/message.ts) -| Property | Presence | Type | -|---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | -| `id` | required | `string` | -| `role` | required | [`union (3 variants)`](#persistence-type-sha256-acd36e1717d2b4ef9e98a8e6fac17ca1203f3f448e5bca51677f129a8f4999e2) | -| `source` | required | [`MessageSource`](#persistence-type-sha256-4c965666d5b42116945bc356087cd5e1fd549e6dece560785ed60511059a8283) | +One of: + +- [`ToolResultMessage`](#persistence-type-sha256-8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c) +- [`SystemMessage`](#persistence-type-sha256-abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94) +- [`AssistantMessage`](#persistence-type-sha256-fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05) +- [`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966) @@ -3714,13 +3704,13 @@ Sources: [`packages/llm/llm/src/message.ts:128`](../packages/llm/llm/src/message | `user` | not declared | none | [`CommandSource`](#persistence-type-sha256-ada310bf0bdb8fed51f3b56ea63f6ea6b18bbd587f04fccb63a14ab0b2a24e05) | | `webhook` | `"notice"` | `deliveryId`: `string`; `provider`: `string`; `ruleId`: `string`; `source`: `string`; `summary`: `string` | [`{ kind: "webhook", form: "notice" }`](#persistence-type-sha256-9edc162949abf93bd5ff049191b345454ba104f583937ce5580fb50f067d2b94) | - + ### `Message[]` -SHA-256: `478738df7e7d2b103b09fb937817a9302c81076809f2b341169e00a9419c5665` +SHA-256: `ff5bcfe90a83f6e773ae72b3ec775c5af8339df8a1dbe561e8147b56bc994fdc` -Array of [`Message`](#persistence-type-sha256-23c7cce57d20589897f4e2bd5898affc6fc611b87cd0cc8b95be1cfdd8b3a7eb). +Array of [`Message`](#persistence-type-sha256-01bc74417fd4ff36c2840b266a5b3b51bf0e3b71eb43960a2c4aee7b7441a2aa). @@ -3838,7 +3828,7 @@ SHA-256: `1d9cb3caa96100b18b1911fa3ff8c751ef6992971a03c5f4d9aefc1a0004a345` Array of [`PresentedFile`](#persistence-type-sha256-b8fc636a2121df9d8423c242e03c9d23b7ab7c6fdce00e45746932c60b730f97). - + @@ -3846,14 +3836,14 @@ Array of [`PresentedFile`](#persistence-type-sha256-b8fc636a2121df9d8423c242e03c ### `PtcDispatchEventData` -SHA-256: `8d2e5a3c4230e6ea6c0b5151f02241d0db02cd2551f2df1b6b9700cddcc0dca3` +SHA-256: `a8c678be0d060c63d44bd6026de343efe0d150d335c10e0d27e04a84c82cb1e3` Sources: [`packages/core/tools/src/types.ts:20`](../packages/core/tools/src/types.ts) | Property | Presence | Type | |---|---|---| | `arguments` | required | `unknown` (opaque) | -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `error` | optional | [`{ code, name, reason? }`](#persistence-type-sha256-a81059ca06999da1e712414520c2c65e491d052fcf9640fae20aa38f0a5dc735) | | `isError` | required | `boolean` | | `name` | required | `string` | @@ -3908,7 +3898,7 @@ Sources: [`packages/llm/llm/src/types.ts:67`](../packages/llm/llm/src/types.ts) SHA-256: `0acd94fe8794574c9ae72c7855ee16d29c546096d4af760d16d1225385764555` -Sources: [`packages/llm/llm/src/types.ts:404`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:395`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -4105,7 +4095,7 @@ Sources: [`packages/session/session-title/src/types.ts:41`](../packages/session/ | `source` | required | [`SessionTitleSource`](#persistence-type-sha256-30d5a537b296685770b1241c4b4bbde19d5a31ff81aa23df73fab5e90b8fc65f) | | `title` | required | `string` | - + @@ -4113,7 +4103,7 @@ Sources: [`packages/session/session-title/src/types.ts:41`](../packages/session/ ### `SessionTitleLlmRequestEventData` -SHA-256: `9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6` +SHA-256: `1b78e3a578a7e6d29d9564a9f5d236c2ebdcf682dbeb7b50400d8850e313b518` Sources: [`packages/session/session-title-llm/src/index.ts:27`](../packages/session/session-title-llm/src/index.ts) @@ -4121,7 +4111,7 @@ Sources: [`packages/session/session-title-llm/src/index.ts:27`](../packages/sess |---|---|---| | `maxTokens` | required | `number` | | `messageSeqs` | required | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | -| `messages` | required | [`Message[]`](#persistence-type-sha256-478738df7e7d2b103b09fb937817a9302c81076809f2b341169e00a9419c5665) | +| `messages` | required | [`Message[]`](#persistence-type-sha256-ff5bcfe90a83f6e773ae72b3ec775c5af8339df8a1dbe561e8147b56bc994fdc) | | `route` | required | [`SessionTitleModelIdentity`](#persistence-type-sha256-07e1a58c58b593f507b8e7f25723bb0aa42baae6e00f5ecfddf28cb1e64d3235) | | `system` | required | `string` | | `titleProvider` | required | `string` | @@ -4210,7 +4200,7 @@ Sources: [`packages/skill/skill/src/index.ts:146`](../packages/skill/skill/src/i | `kind` | required | `"skill-invocation"` | | `name` | required | `string` | - + @@ -4218,15 +4208,15 @@ Sources: [`packages/skill/skill/src/index.ts:146`](../packages/skill/skill/src/i ### `StreamChunk` -SHA-256: `071d92b9dac661fcc826c678cf64d188f26fb93aab79c627b11a03acdd34dfca` +SHA-256: `c9b25ae820453f466ccb40c7c2b62ed81dc9579f142e14615b4c8596b264565c` -Sources: [`packages/llm/llm/src/types.ts:426`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:417`](../packages/llm/llm/src/types.ts) One of: - [`{ type: "tool-call-delta" }`](#persistence-type-sha256-88a610b831be6d92612a464be5c7d0b88ec24d97bd299837bf74bf7672183c9a) -- [`{ type: "block-end" }`](#persistence-type-sha256-90c811b8c2668898515e69a24e82caffeb08517f9c7aa193867ff0380f3b535d) -- [`{ type: "block-start" }`](#persistence-type-sha256-647cb2e3aeb58e27d1d4d60011f208bb66dce257e8654193c533b47c4c22c253) +- [`{ type: "block-end" }`](#persistence-type-sha256-61c16da5dfff82fba0aaf446f0bed211ef0c9bfb2130788e27b41c4244e8686f) +- [`{ type: "block-start" }`](#persistence-type-sha256-e829e4d334f3b1b3d64ab4be6a4778c79b98de8abfc2ec136d0ff4b971042cd7) - [`{ type: "reasoning-delta" }`](#persistence-type-sha256-2abb711460e6238d851c30f3e4bdd87a2aa1887ee70575b3d3b7b25610673095) - [`{ type: "text-delta" }`](#persistence-type-sha256-95080295115fbd83544520ba247b68a03790131f6a2eac323d388758cb542f65) - [`{ type: "finish" }`](#persistence-type-sha256-a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1) @@ -4302,7 +4292,7 @@ One of: - `"append"` - [`{ endSeq, op, startSeq }`](#persistence-type-sha256-bcf0caf62d964b2fcf5404bd5c909cfa9a21c3f3c96e6b7e36d9e33565223825) - + @@ -4310,13 +4300,13 @@ One of: ### `SystemMessage` -SHA-256: `302b01ddddcbb3b16cfa3fba2a5d99f5082a55fbd9dc5c83a179a228b8a6a0ca` +SHA-256: `abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94` -Sources: [`packages/llm/llm/src/message.ts:158`](../packages/llm/llm/src/message.ts) +Sources: [`packages/llm/llm/src/message.ts:141`](../packages/llm/llm/src/message.ts) | Property | Presence | Type | |---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | required | `string` | | `role` | required | `"system"` | | `source` | required | [`union (7 variants)`](#persistence-type-sha256-23cf7e0cf3fec1283b60fa15713506169bc9c079a08e124d1cb9733baca80b40) | @@ -4361,7 +4351,7 @@ Sources: [`packages/experimental/agent-team/src/types.ts:47`](../packages/experi | `phase` | required | [`TeamMemberPhase`](#persistence-type-sha256-dfce5db4aa42b7ebe0bb79eca92553587287e18c06b9eba85cbfb9d332e26acd) | | `provider` | required | `string` | - + @@ -4369,13 +4359,13 @@ Sources: [`packages/experimental/agent-team/src/types.ts:47`](../packages/experi ### `TeamMessageSnapshot` -SHA-256: `5b694f394d5e11609887a3ccfa82844935d49806c37e336b30be2186d649ab94` +SHA-256: `9f5460b34f5daa2bdc225e47feb46cbd666de00277e907b514f0932fdcf409ab` Sources: [`packages/experimental/agent-team/src/types.ts:106`](../packages/experimental/agent-team/src/types.ts) | Property | Presence | Type | |---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | required | `string` | | `senderId` | required | `string` | | `senderName` | required | `string` | @@ -4495,7 +4485,7 @@ Array of [`TodoItem`](#persistence-type-sha256-a99f76fd149051c363f960bfeeb5b9509 SHA-256: `fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394` -Sources: [`packages/llm/llm/src/types.ts:162`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:153`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -4559,26 +4549,7 @@ Sources: [`packages/core/tools/src/index.ts:682`](../packages/core/tools/src/ind | `allow` | optional | [`string[]`](#persistence-type-sha256-93c33d9687613293f8c95d46c4d922fe9ceae83b84c384beff5c3315abe005f2) | | `deny` | optional | [`string[]`](#persistence-type-sha256-93c33d9687613293f8c95d46c4d922fe9ceae83b84c384beff5c3315abe005f2) | - - - - - - -### `ToolResultBlock` - -SHA-256: `d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127` - -Sources: [`packages/llm/llm/src/types.ts:114`](../packages/llm/llm/src/types.ts) - -| Property | Presence | Type | -|---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | -| `isError` | optional | `boolean` | -| `toolCallId` | required | `string` | -| `type` | required | `"tool-result"` | - - + @@ -4586,16 +4557,18 @@ Sources: [`packages/llm/llm/src/types.ts:114`](../packages/llm/llm/src/types.ts) ### `ToolResultMessage` -SHA-256: `1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c` +SHA-256: `8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c` -Sources: [`packages/llm/llm/src/message.ts:164`](../packages/llm/llm/src/message.ts) +Sources: [`packages/llm/llm/src/message.ts:158`](../packages/llm/llm/src/message.ts) | Property | Presence | Type | |---|---|---| -| `content` | required | [`tuple (1 positions)`](#persistence-type-sha256-8d6a011f3ef7096a4a922ef420458419ff6b20e1eaeece5d331db7585d2f08d6) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | required | `string` | -| `role` | required | `"user"` | +| `isError` | optional | `boolean` | +| `role` | required | `"tool"` | | `source` | required | [`ToolMessageSource`](#persistence-type-sha256-d9c462b9f62fdd3efc76a44b9524dc8781f6b91cd9c7e584b17d971defafebab) | +| `toolCallId` | required | `string` | @@ -4607,7 +4580,7 @@ Sources: [`packages/llm/llm/src/message.ts:164`](../packages/llm/llm/src/message SHA-256: `7f5f2a8618c2ece530a18b1358b890fb57fb8c35705e47b66bff2296f8c6e889` -Sources: [`packages/llm/llm/src/types.ts:447`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:438`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -4737,7 +4710,7 @@ Sources: [`packages/core/session/src/types.ts:231`](../packages/core/session/src | `interrupted` | not declared | none | [`{ kind: "interrupted" }`](#persistence-type-sha256-56b7c047694875a843ba020dfea3c8380d54ae4ff88ab349e72004dc21e07c23) | | `max-tokens` | not declared | none | [`{ kind: "max-tokens" }`](#persistence-type-sha256-ab7ec5f9eb2c6dfacca5da4c37cf7ba85d04172053ee6b1ebf1709ffcd99c1a7) | - + @@ -4745,24 +4718,24 @@ Sources: [`packages/core/session/src/types.ts:231`](../packages/core/session/src ### `UserMessage` -SHA-256: `4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7` +SHA-256: `a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966` -Sources: [`packages/llm/llm/src/message.ts:143`](../packages/llm/llm/src/message.ts) +Sources: [`packages/llm/llm/src/message.ts:147`](../packages/llm/llm/src/message.ts) | Property | Presence | Type | |---|---|---| -| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | required | `string` | | `role` | required | `"user"` | | `source` | required | [`MessageSource`](#persistence-type-sha256-4c965666d5b42116945bc356087cd5e1fd549e6dece560785ed60511059a8283) | - + ### `UserMessage[]` -SHA-256: `300341f890f7b9506a1749fff4fa5239d16ea1c63ff6b15851acb03c20f3b48d` +SHA-256: `71225015514ed0439df95fc6e55719e1fa30bd205b99a7eefb7e18152be835ea` -Array of [`UserMessage`](#persistence-type-sha256-4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7). +Array of [`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966). @@ -4972,16 +4945,6 @@ SHA-256: `4aed17ec726b5397c29f6cb4bcd7905dc1a12bb6140f1657f073cd24380f2af8` |---|---|---| | 0 | required | [`{ type: "web_search_20250305" }`](#persistence-type-sha256-2d11ca7b0d4493e244b74eba093227866b33249841e59a1e9bf56afed38604c3) | - - -### `tuple (1 positions)` - -SHA-256: `8d6a011f3ef7096a4a922ef420458419ff6b20e1eaeece5d331db7585d2f08d6` - -| Position | Presence | Type | -|---|---|---| -| 0 | required | [`ToolResultBlock`](#persistence-type-sha256-d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127) | - ### `tuple (1 positions)` @@ -5013,6 +4976,17 @@ One of: - `"error"` - `"success"` + + +### `union (2 variants)` + +SHA-256: `243a2287c54514f9b819d7d9c93cc2d1313c54401c7630ef03a2d2380606637a` + +One of: + +- [`{ compactionId, llmStreamCall, maxTokens?, model, … }`](#persistence-type-sha256-e1e89e5a614b3090837728fa6e314fe019c99f07b6319f9d4a7d5a52cba396e4) +- [`{ compactionId, maxTokens?, model, provider, … }`](#persistence-type-sha256-0c3c69461d71c0aafb10acd70672f86cd2cf7592cbb71c2f9ac1c2f3eeba0734) + ### `union (2 variants)` @@ -5024,17 +4998,6 @@ One of: - `"fork"` - `"fresh"` - - -### `union (2 variants)` - -SHA-256: `feb329074f0206ecc06d8a1aa0a0b3e2f47fd27524ba020fbc849ba63e938896` - -One of: - -- [`{ compactionId, llmStreamCall, maxTokens?, model, … }`](#persistence-type-sha256-9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c) -- [`{ compactionId, maxTokens?, model, provider, … }`](#persistence-type-sha256-3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca) - @@ -5061,18 +5024,6 @@ One of: - `"replace"` - `"set"` - - -### `union (3 variants)` - -SHA-256: `acd36e1717d2b4ef9e98a8e6fac17ca1203f3f448e5bca51677f129a8f4999e2` - -One of: - -- `"assistant"` -- `"system"` -- `"user"` - ### `union (3 variants)` @@ -5346,11 +5297,11 @@ Sources: [`packages/compaction/compaction/src/types.ts:72`](../packages/compacti | `sourceCommandId` | optional | `string` | | `turn` | required | [`OptionalSessionSeq`](#persistence-type-sha256-3bd652ebfa8726b3ce3937a4f1bd2759e02f86b3a08a20f9e41a8513656fbc5f) | - + ### `{ compactionId, llmStreamCall, maxTokens?, model, … }` -SHA-256: `9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c` +SHA-256: `e1e89e5a614b3090837728fa6e314fe019c99f07b6319f9d4a7d5a52cba396e4` | Property | Presence | Type | |---|---|---| @@ -5359,19 +5310,19 @@ SHA-256: `9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c` | `maxTokens` | optional | `number` | | `model` | required | `string` | | `provider` | required | `string` | -| `rawOutput` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `rawOutput` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `shadowedRange` | required | [`{ end, start }`](#persistence-type-sha256-9e41386b3a0c9572b0d63078492ebb3997da7d3a830d44e0259418bd02f4bcb2) | | `shadowedSeqs` | required | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | required | `number` | | `sourceCommandId` | optional | `string` | -| `summary` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `summary` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `usage` | optional | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ compactionId, maxTokens?, model, provider, … }` -SHA-256: `3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca` +SHA-256: `0c3c69461d71c0aafb10acd70672f86cd2cf7592cbb71c2f9ac1c2f3eeba0734` | Property | Presence | Type | |---|---|---| @@ -5379,12 +5330,12 @@ SHA-256: `3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca` | `maxTokens` | optional | `number` | | `model` | required | `string` | | `provider` | required | `string` | -| `rawOutput` | optional | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `rawOutput` | optional | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `shadowedRange` | required | [`{ end, start }`](#persistence-type-sha256-9e41386b3a0c9572b0d63078492ebb3997da7d3a830d44e0259418bd02f4bcb2) | | `shadowedSeqs` | required | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | required | `number` | | `sourceCommandId` | optional | `string` | -| `summary` | required | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `summary` | required | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `usage` | optional | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | @@ -5537,18 +5488,18 @@ Sources: [`packages/core/session/src/types.ts:211`](../packages/core/session/src | `error` | required | [`LlmFailure`](#persistence-type-sha256-5f2117d1856a5ab43c28371faa978ebfaa48f8c7d734ea3fc94842210df83dca) | | `kind` | required | `"error"` | - + ### `{ error?, message, meta?, step, … }` -SHA-256: `356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5` +SHA-256: `fb1777a19335be3c5c717e23a1800817fc36fb99277d9a0487e924401210e219` Sources: [`packages/core/session/src/types.ts:362`](../packages/core/session/src/types.ts) | Property | Presence | Type | |---|---|---| | `error` | optional | [`{ code, name, reason? }`](#persistence-type-sha256-a81059ca06999da1e712414520c2c65e491d052fcf9640fae20aa38f0a5dc735) | -| `message` | required | [`ToolResultMessage`](#persistence-type-sha256-1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c) | +| `message` | required | [`ToolResultMessage`](#persistence-type-sha256-8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c) | | `meta` | optional | [`JsonValue`](#persistence-type-sha256-c592ce75aab73fcab19c1d7845684c72cf402b78d2e1f2833a58ecf9f3598ed6) | | `step` | required | `number` | | `turn` | required | `number` | @@ -5559,7 +5510,7 @@ Sources: [`packages/core/session/src/types.ts:362`](../packages/core/session/src SHA-256: `8e31bb958e9b015e6f8407eaade32217068159e816f3cc99c3ad76eb889732e0` -Sources: [`packages/llm/llm/src/types.ts:147`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:138`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -5572,7 +5523,7 @@ Sources: [`packages/llm/llm/src/types.ts:147`](../packages/llm/llm/src/types.ts) SHA-256: `693f4952fb5565da96c06bace8924b098ac2fbc915fde0ff8019701183abc057` -Sources: [`packages/llm/llm/src/types.ts:148`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:139`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -5673,36 +5624,36 @@ Sources: [`packages/core/session/src/types.ts:414`](../packages/core/session/src |---|---|---| | `inherited` | optional | `true` | - + ### `{ inserted, outcome?, removedCount?, start, … }` -SHA-256: `a6a195c1b4a906d953d24ab5864c9f1881d545460e080a51144adfc9cb058cfe` +SHA-256: `6f87000576a13d73867248c97e55c4ebe3cb3ee55ee3bd1282f26e7f40dd81c8` Sources: [`packages/core/agent/src/types.ts:87`](../packages/core/agent/src/types.ts) | Property | Presence | Type | |---|---|---| -| `inserted` | required | [`UserMessage[]`](#persistence-type-sha256-300341f890f7b9506a1749fff4fa5239d16ea1c63ff6b15851acb03c20f3b48d) | +| `inserted` | required | [`UserMessage[]`](#persistence-type-sha256-71225015514ed0439df95fc6e55719e1fa30bd205b99a7eefb7e18152be835ea) | | `outcome` | optional | `"canceled"` | | `removedCount` | optional | `number` | | `start` | required | `number` | | `target` | required | [`InboxTarget`](#persistence-type-sha256-96f4a9c81fc0f940ef71528a8cc66731ae4cf1f40d79680c5fe3c39f96d7723c) | - + ### `{ interrupted?, message, step, stream, … }` -SHA-256: `77b8491f946edfc8cc77ebae3ba49183759da31ba2dfa83d4c9e9e618c4b91d2` +SHA-256: `544d9f25d6224883513a9d6c0d0a185764d5fa8aebb24e20f87710b6f284a540` Sources: [`packages/core/session/src/types.ts:328`](../packages/core/session/src/types.ts) | Property | Presence | Type | |---|---|---| | `interrupted` | optional | `true` | -| `message` | required | [`AssistantMessage`](#persistence-type-sha256-e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83) | +| `message` | required | [`AssistantMessage`](#persistence-type-sha256-fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05) | | `step` | required | `number` | -| `stream` | required | [`AssistantStreamRecord[]`](#persistence-type-sha256-26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346) | +| `stream` | required | [`AssistantStreamRecord[]`](#persistence-type-sha256-d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878) | | `turn` | required | `number` | | `usage` | optional | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | @@ -5822,7 +5773,7 @@ Sources: [`packages/core/session/src/types.ts:195`](../packages/core/session/src SHA-256: `ab7ec5f9eb2c6dfacca5da4c37cf7ba85d04172053ee6b1ebf1709ffcd99c1a7` -Sources: [`packages/core/session/src/types.ts:213`](../packages/core/session/src/types.ts) · [`packages/llm/llm/src/types.ts:146`](../packages/llm/llm/src/types.ts) +Sources: [`packages/core/session/src/types.ts:213`](../packages/core/session/src/types.ts) · [`packages/llm/llm/src/types.ts:137`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -5945,7 +5896,7 @@ Sources: [`packages/session/session-title/src/types.ts:30`](../packages/session/ SHA-256: `1d76406cbb2ddadb0dbbb51e9d8bc6cf678fed455cf8eb512f36f7c86d37a62f` -Sources: [`packages/llm/llm/src/types.ts:144`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:135`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -5957,7 +5908,7 @@ Sources: [`packages/llm/llm/src/types.ts:144`](../packages/llm/llm/src/types.ts) SHA-256: `287211846beea1eccb5f9acee00d20388a38fcb2e95858fa2332d6f58529379a` -Sources: [`packages/llm/llm/src/types.ts:145`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:136`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -6024,31 +5975,31 @@ Sources: [`packages/experimental/agent-team/src/types.ts:221`](../packages/exper | `teamId` | required | `string` | | `version` | required | `2` | - + ### `{ message, step, turn }` -SHA-256: `2074f40221b76c75fd314246db558965dc3477dfb440bcc952b1eedc9778e366` +SHA-256: `04e1cae61e7654890444877cb802e3b6c8c607fa8a9b4380323939951a1be9d2` Sources: [`packages/core/session/src/types.ts:317`](../packages/core/session/src/types.ts) | Property | Presence | Type | |---|---|---| -| `message` | required | [`SystemMessage`](#persistence-type-sha256-302b01ddddcbb3b16cfa3fba2a5d99f5082a55fbd9dc5c83a179a228b8a6a0ca) | +| `message` | required | [`SystemMessage`](#persistence-type-sha256-abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94) | | `step` | required | `number` | | `turn` | required | `number` | - + ### `{ message, teamId, version }` -SHA-256: `0c3f4d2248d9bc9700e2d7253fa71aa9935f5c39af6f11de5727f08cccaf8383` +SHA-256: `394cf42541bf794f465314cf0c7b86ad4bc32e34cac111ebbe592a21c72d8c52` Sources: [`packages/experimental/agent-team/src/types.ts:225`](../packages/experimental/agent-team/src/types.ts) | Property | Presence | Type | |---|---|---| -| `message` | required | [`TeamMessageSnapshot`](#persistence-type-sha256-5b694f394d5e11609887a3ccfa82844935d49806c37e336b30be2186d649ab94) | +| `message` | required | [`TeamMessageSnapshot`](#persistence-type-sha256-9f5460b34f5daa2bdc225e47feb46cbd666de00277e907b514f0932fdcf409ab) | | `teamId` | required | `string` | | `version` | required | `2` | @@ -6159,18 +6110,18 @@ Sources: [`packages/compaction/compaction/src/types.ts:82`](../packages/compacti | `shadowedSeqs` | required | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | required | `number` | - + ### `{ step, stream, turn }` -SHA-256: `0c6412d3ba5e41adfaa6929c7d4093f2d52d8598c03f35844fc0d55e3070a3b1` +SHA-256: `2efae120e250c2f5ac1777c67dc76255f06608a138b2446e8a0489bb25b9b35c` Sources: [`packages/core/session/src/types.ts:342`](../packages/core/session/src/types.ts) | Property | Presence | Type | |---|---|---| | `step` | required | `number` | -| `stream` | required | [`AssistantStreamRecord[]`](#persistence-type-sha256-26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346) | +| `stream` | required | [`AssistantStreamRecord[]`](#persistence-type-sha256-d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878) | | `turn` | required | `number` | @@ -6252,17 +6203,17 @@ SHA-256: `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | `time` | required | `number` | | `type` | required | `"agent-preset/selected"` | - + ### `{ type: "agent/inbox/spliced" }` -SHA-256: `646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f` +SHA-256: `cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-a6a195c1b4a906d953d24ab5864c9f1881d545460e080a51144adfc9cb058cfe) | +| `data` | required | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-6f87000576a13d73867248c97e55c4ebe3cb3ee55ee3bd1282f26e7f40dd81c8) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -6316,78 +6267,78 @@ SHA-256: `26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78` | `time` | required | `number` | | `type` | required | `"approval/policy"` | - + ### `{ type: "assistant/attempt" }` -SHA-256: `c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e` +SHA-256: `2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ step, stream, turn }`](#persistence-type-sha256-0c6412d3ba5e41adfaa6929c7d4093f2d52d8598c03f35844fc0d55e3070a3b1) | +| `data` | required | [`{ step, stream, turn }`](#persistence-type-sha256-2efae120e250c2f5ac1777c67dc76255f06608a138b2446e8a0489bb25b9b35c) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | | `type` | required | `"assistant/attempt"` | - + ### `{ type: "assistant/message" }` -SHA-256: `1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d` +SHA-256: `f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ interrupted?, message, step, stream, … }`](#persistence-type-sha256-77b8491f946edfc8cc77ebae3ba49183759da31ba2dfa83d4c9e9e618c4b91d2) | +| `data` | required | [`{ interrupted?, message, step, stream, … }`](#persistence-type-sha256-544d9f25d6224883513a9d6c0d0a185764d5fa8aebb24e20f87710b6f284a540) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `surfaceOp` | required | [`SurfaceOp`](#persistence-type-sha256-335e242de1fcc17b6ca920fc420d71bec2d76e53e37955c00948b65ab77f05c5) | | `time` | required | `number` | | `type` | required | `"assistant/message"` | - + ### `{ type: "block-end" }` -SHA-256: `90c811b8c2668898515e69a24e82caffeb08517f9c7aa193867ff0380f3b535d` +SHA-256: `61c16da5dfff82fba0aaf446f0bed211ef0c9bfb2130788e27b41c4244e8686f` -Sources: [`packages/llm/llm/src/types.ts:431`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:422`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| -| `block` | required | [`ContentBlock`](#persistence-type-sha256-c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56) | +| `block` | required | [`ContentBlock`](#persistence-type-sha256-3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e) | | `index` | required | `number` | | `type` | required | `"block-end"` | - + ### `{ type: "block-start" }` -SHA-256: `647cb2e3aeb58e27d1d4d60011f208bb66dce257e8654193c533b47c4c22c253` +SHA-256: `e829e4d334f3b1b3d64ab4be6a4778c79b98de8abfc2ec136d0ff4b971042cd7` -Sources: [`packages/llm/llm/src/types.ts:427`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:418`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| -| `blockType` | required | [`ContentBlockType`](#persistence-type-sha256-757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61) | +| `blockType` | required | [`ContentBlockType`](#persistence-type-sha256-ccca7d237e176afec87877c379035a69e715ae0fb4e859015d29f14cc4376588) | | `index` | required | `number` | | `type` | required | `"block-start"` | - + ### `{ type: "chunk" }` -SHA-256: `c93b6f51b399607349b4bcc66b58e848a44250ffc1e2537207bd092dfff94192` +SHA-256: `71a18f8c73d2082125528e0b546fdd914d310f93a4e5f48586cb9ee668574de3` Sources: [`packages/llm/llm/src/assistant-stream.ts:44`](../packages/llm/llm/src/assistant-stream.ts) | Property | Presence | Type | |---|---|---| -| `chunk` | required | [`StreamChunk`](#persistence-type-sha256-071d92b9dac661fcc826c678cf64d188f26fb93aab79c627b11a03acdd34dfca) | +| `chunk` | required | [`StreamChunk`](#persistence-type-sha256-c9b25ae820453f466ccb40c7c2b62ed81dc9579f142e14615b4c8596b264565c) | | `time` | required | `number` | | `type` | required | `"chunk"` | @@ -6471,17 +6422,17 @@ SHA-256: `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | `time` | required | `number` | | `type` | required | `"compaction/start"` | - + ### `{ type: "compaction/summary" }` -SHA-256: `f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59` +SHA-256: `86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559` | Property | Presence | Type | |---|---|---| -| `data` | required | [`union (2 variants)`](#persistence-type-sha256-feb329074f0206ecc06d8a1aa0a0b3e2f47fd27524ba020fbc849ba63e938896) | +| `data` | required | [`union (2 variants)`](#persistence-type-sha256-243a2287c54514f9b819d7d9c93cc2d1313c54401c7630ef03a2d2380606637a) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -6557,7 +6508,7 @@ SHA-256: `b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8` SHA-256: `a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1` -Sources: [`packages/llm/llm/src/types.ts:433`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:424`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -6731,7 +6682,7 @@ Sources: [`packages/llm/llm/src/assistant-stream.ts:28`](../packages/llm/llm/src SHA-256: `2abb711460e6238d851c30f3e4bdd87a2aa1887ee70575b3d3b7b25610673095` -Sources: [`packages/llm/llm/src/types.ts:429`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:420`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -6851,17 +6802,17 @@ SHA-256: `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | `time` | required | `number` | | `type` | required | `"session/title"` | - + ### `{ type: "session/title-llm-request" }` -SHA-256: `e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d` +SHA-256: `2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0` | Property | Presence | Type | |---|---|---| -| `data` | required | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6) | +| `data` | required | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-1b78e3a578a7e6d29d9564a9f5d236c2ebdcf682dbeb7b50400d8850e313b518) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -6947,17 +6898,17 @@ SHA-256: `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | `time` | required | `number` | | `type` | required | `"subagent/model-selection-policy"` | - + ### `{ type: "system/message" }` -SHA-256: `69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae` +SHA-256: `1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ message, step, turn }`](#persistence-type-sha256-2074f40221b76c75fd314246db558965dc3477dfb440bcc952b1eedc9778e366) | +| `data` | required | [`{ message, step, turn }`](#persistence-type-sha256-04e1cae61e7654890444877cb802e3b6c8c607fa8a9b4380323939951a1be9d2) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `sourceEventSeqs` | optional | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -6997,17 +6948,17 @@ SHA-256: `48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb` | `time` | required | `number` | | `type` | required | `"team/message/delivered"` | - + ### `{ type: "team/message/queued" }` -SHA-256: `443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4` +SHA-256: `9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ message, teamId, version }`](#persistence-type-sha256-0c3f4d2248d9bc9700e2d7253fa71aa9935f5c39af6f11de5727f08cccaf8383) | +| `data` | required | [`{ message, teamId, version }`](#persistence-type-sha256-394cf42541bf794f465314cf0c7b86ad4bc32e34cac111ebbe592a21c72d8c52) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -7051,7 +7002,7 @@ Sources: [`packages/llm/llm/src/assistant-stream.ts:21`](../packages/llm/llm/src SHA-256: `95080295115fbd83544520ba247b68a03790131f6a2eac323d388758cb542f65` -Sources: [`packages/llm/llm/src/types.ts:428`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:419`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -7099,7 +7050,7 @@ Sources: [`packages/llm/llm/src/assistant-stream.ts:35`](../packages/llm/llm/src SHA-256: `88a610b831be6d92612a464be5c7d0b88ec24d97bd299837bf74bf7672183c9a` -Sources: [`packages/llm/llm/src/types.ts:430`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:421`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| @@ -7189,17 +7140,17 @@ SHA-256: `3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48` | `time` | required | `number` | | `type` | required | `"tool/call"` | - + ### `{ type: "tool/ptc-dispatch" }` -SHA-256: `b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c` +SHA-256: `75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185` | Property | Presence | Type | |---|---|---| -| `data` | required | [`PtcDispatchEventData`](#persistence-type-sha256-8d2e5a3c4230e6ea6c0b5151f02241d0db02cd2551f2df1b6b9700cddcc0dca3) | +| `data` | required | [`PtcDispatchEventData`](#persistence-type-sha256-a8c678be0d060c63d44bd6026de343efe0d150d335c10e0d27e04a84c82cb1e3) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -7221,17 +7172,17 @@ SHA-256: `ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93` | `time` | required | `number` | | `type` | required | `"tool/ptc-dispatch-start"` | - + ### `{ type: "tool/result" }` -SHA-256: `29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2` +SHA-256: `f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ error?, message, meta?, step, … }`](#persistence-type-sha256-356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5) | +| `data` | required | [`{ error?, message, meta?, step, … }`](#persistence-type-sha256-fb1777a19335be3c5c717e23a1800817fc36fb99277d9a0487e924401210e219) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `sourceEventSeqs` | optional | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -7277,24 +7228,24 @@ SHA-256: `aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8` SHA-256: `f1a96afe7503ac1817de769cd0ba13d9b80111c7034c50106b3344ecc14cc515` -Sources: [`packages/llm/llm/src/types.ts:432`](../packages/llm/llm/src/types.ts) +Sources: [`packages/llm/llm/src/types.ts:423`](../packages/llm/llm/src/types.ts) | Property | Presence | Type | |---|---|---| | `type` | required | `"usage"` | | `usage` | required | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ type: "user/message" }` -SHA-256: `314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578` +SHA-256: `5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6` | Property | Presence | Type | |---|---|---| -| `data` | required | [`UserMessage`](#persistence-type-sha256-4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7) | +| `data` | required | [`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `sourceEventSeqs` | optional | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | diff --git a/docs/persistence-catalog.zh.md b/docs/persistence-catalog.zh.md index aa6cc3fe44..e1e83dd5f7 100644 --- a/docs/persistence-catalog.zh.md +++ b/docs/persistence-catalog.zh.md @@ -23,18 +23,18 @@ | `JsonlHeaderLine` | header | `18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f` | [`HeaderLine`](#persistence-type-sha256-18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f) | | `SessionEventEnvelope` | envelope | `5776e5553ff2dfe3f5bc202dbb1e7c9f93e35a531aebb7764c23b2b6153b2ccc` | [`union (3 variants)`](#persistence-type-sha256-5776e5553ff2dfe3f5bc202dbb1e7c9f93e35a531aebb7764c23b2b6153b2ccc) | | `event:agent-preset/selected` | event | `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | [`{ type: "agent-preset/selected" }`](#persistence-type-sha256-a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b) | -| `event:agent/inbox/spliced` | event | `646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f) | +| `event:agent/inbox/spliced` | event | `cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a) | | `event:approval/asked` | event | `3bfeb47b58606f4661904bc723da612782214c463d01e6d61cd6d6193d7374e1` | [`{ type: "approval/asked" }`](#persistence-type-sha256-3bfeb47b58606f4661904bc723da612782214c463d01e6d61cd6d6193d7374e1) | | `event:approval/decided` | event | `bb1ab3d08f49a9f3b265f844cd78d5c49813062a7b34b54904b426f85d0ff6e3` | [`{ type: "approval/decided" }`](#persistence-type-sha256-bb1ab3d08f49a9f3b265f844cd78d5c49813062a7b34b54904b426f85d0ff6e3) | | `event:approval/policy` | event | `26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78` | [`{ type: "approval/policy" }`](#persistence-type-sha256-26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78) | -| `event:assistant/attempt` | event | `c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e` | [`{ type: "assistant/attempt" }`](#persistence-type-sha256-c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e) | -| `event:assistant/message` | event | `1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d` | [`{ type: "assistant/message" }`](#persistence-type-sha256-1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d) | +| `event:assistant/attempt` | event | `2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2` | [`{ type: "assistant/attempt" }`](#persistence-type-sha256-2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2) | +| `event:assistant/message` | event | `f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58` | [`{ type: "assistant/message" }`](#persistence-type-sha256-f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58) | | `event:command/done` | event | `15196447222782e773eb943c92b18316ce96b9af0f0cfddb6e57ba8274ecc5ff` | [`{ type: "command/done" }`](#persistence-type-sha256-15196447222782e773eb943c92b18316ce96b9af0f0cfddb6e57ba8274ecc5ff) | | `event:command/run` | event | `37184378c6439257d105c4e2022d80fc9c3a3f7c7f6ac661b00bc9f18d871006` | [`{ type: "command/run" }`](#persistence-type-sha256-37184378c6439257d105c4e2022d80fc9c3a3f7c7f6ac661b00bc9f18d871006) | | `event:compaction/end` | event | `b0127044ab31a702bddfd785d345f5abd7a70876746e895ce443afa3e60ddf2d` | [`{ type: "compaction/end" }`](#persistence-type-sha256-b0127044ab31a702bddfd785d345f5abd7a70876746e895ce443afa3e60ddf2d) | | `event:compaction/prune` | event | `7f7fd5a6b0064f597534b29ff62ef26e786dffccf5e14f654a7d4fcea2c35f04` | [`{ type: "compaction/prune" }`](#persistence-type-sha256-7f7fd5a6b0064f597534b29ff62ef26e786dffccf5e14f654a7d4fcea2c35f04) | | `event:compaction/start` | event | `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | [`{ type: "compaction/start" }`](#persistence-type-sha256-db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965) | -| `event:compaction/summary` | event | `f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59) | +| `event:compaction/summary` | event | `86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559) | | `event:deliverables/presented` | event | `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | [`{ type: "deliverables/presented" }`](#persistence-type-sha256-13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176) | | `event:feedback/message-delete` | event | `3ee93b06f3a125850337602bcdf155d2538c43a5c944ec55b1b3c365152d6796` | [`{ type: "feedback/message-delete" }`](#persistence-type-sha256-3ee93b06f3a125850337602bcdf155d2538c43a5c944ec55b1b3c365152d6796) | | `event:feedback/message-put` | event | `b5086d249e8502e9ead1d39156bb8d559bde7951cac0f14ce150345b4e42a2bf` | [`{ type: "feedback/message-put" }`](#persistence-type-sha256-b5086d249e8502e9ead1d39156bb8d559bde7951cac0f14ce150345b4e42a2bf) | @@ -55,16 +55,16 @@ | `event:session-log-deepseek/delivery-accepted` | event | `d63b8b8ffad9c02fd80c43a17df4f240c1fe8118ecca9de34f9d5871838ab5b9` | [`{ type: "session-log-deepseek/delivery-accepted" }`](#persistence-type-sha256-d63b8b8ffad9c02fd80c43a17df4f240c1fe8118ecca9de34f9d5871838ab5b9) | | `event:session/end-seed` | event | `5e6db6e24948d4a853c71cb9fabd252ad051ce93d4672c1266cf837c1c17b84e` | [`{ type: "session/end-seed" }`](#persistence-type-sha256-5e6db6e24948d4a853c71cb9fabd252ad051ce93d4672c1266cf837c1c17b84e) | | `event:session/title` | event | `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | [`{ type: "session/title" }`](#persistence-type-sha256-1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5) | -| `event:session/title-llm-request` | event | `e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d) | +| `event:session/title-llm-request` | event | `2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0) | | `event:step/end` | event | `e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05` | [`{ type: "step/end" }`](#persistence-type-sha256-e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05) | | `event:step/start` | event | `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986` | [`{ type: "step/start" }`](#persistence-type-sha256-4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986) | | `event:subagent/catalog` | event | `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871) | | `event:subagent/descriptor` | event | `b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5` | [`{ type: "subagent/descriptor" }`](#persistence-type-sha256-b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5) | | `event:subagent/model-selection-policy` | event | `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | [`{ type: "subagent/model-selection-policy" }`](#persistence-type-sha256-a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc) | -| `event:system/message` | event | `69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae` | [`{ type: "system/message" }`](#persistence-type-sha256-69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae) | +| `event:system/message` | event | `1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300` | [`{ type: "system/message" }`](#persistence-type-sha256-1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300) | | `event:team/member` | event | `4fb59762612c3e3ac3a3bd4f84c9c148d3c3893bd422ba2b201cc039fabd49bc` | [`{ type: "team/member" }`](#persistence-type-sha256-4fb59762612c3e3ac3a3bd4f84c9c148d3c3893bd422ba2b201cc039fabd49bc) | | `event:team/message/delivered` | event | `48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb` | [`{ type: "team/message/delivered" }`](#persistence-type-sha256-48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb) | -| `event:team/message/queued` | event | `443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4` | [`{ type: "team/message/queued" }`](#persistence-type-sha256-443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4) | +| `event:team/message/queued` | event | `9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240` | [`{ type: "team/message/queued" }`](#persistence-type-sha256-9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240) | | `event:team/task` | event | `d595ec73b32b016a6055333c67a5d646032b22e672da1d4a09c5b1ae398a093a` | [`{ type: "team/task" }`](#persistence-type-sha256-d595ec73b32b016a6055333c67a5d646032b22e672da1d4a09c5b1ae398a093a) | | `event:todo/write` | event | `b978cff734e62143eb56c9125423ec275405eda969802d42aaf73ecb987d3b26` | [`{ type: "todo/write" }`](#persistence-type-sha256-b978cff734e62143eb56c9125423ec275405eda969802d42aaf73ecb987d3b26) | | `event:tool-workflow/agent-end` | event | `babf9ee4d1af62bf6c3a8103737f7a5e4e78ce179be835ce05a38803e15884b7` | [`{ type: "tool-workflow/agent-end" }`](#persistence-type-sha256-babf9ee4d1af62bf6c3a8103737f7a5e4e78ce179be835ce05a38803e15884b7) | @@ -72,12 +72,12 @@ | `event:tool-workflow/run-end` | event | `42e0916e0dda5f6d1e7bb05d8514717147c036a79c9f36085683469516c1fd3f` | [`{ type: "tool-workflow/run-end" }`](#persistence-type-sha256-42e0916e0dda5f6d1e7bb05d8514717147c036a79c9f36085683469516c1fd3f) | | `event:tool-workflow/run-start` | event | `c1f9e0405de6d18cabb9ee70782a027f9bbdc57e5abec9dcccdd56119e2e9058` | [`{ type: "tool-workflow/run-start" }`](#persistence-type-sha256-c1f9e0405de6d18cabb9ee70782a027f9bbdc57e5abec9dcccdd56119e2e9058) | | `event:tool/call` | event | `3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48` | [`{ type: "tool/call" }`](#persistence-type-sha256-3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48) | -| `event:tool/ptc-dispatch` | event | `b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c` | [`{ type: "tool/ptc-dispatch" }`](#persistence-type-sha256-b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c) | +| `event:tool/ptc-dispatch` | event | `75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185` | [`{ type: "tool/ptc-dispatch" }`](#persistence-type-sha256-75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185) | | `event:tool/ptc-dispatch-start` | event | `ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93` | [`{ type: "tool/ptc-dispatch-start" }`](#persistence-type-sha256-ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93) | -| `event:tool/result` | event | `29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2` | [`{ type: "tool/result" }`](#persistence-type-sha256-29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2) | +| `event:tool/result` | event | `f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c` | [`{ type: "tool/result" }`](#persistence-type-sha256-f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c) | | `event:turn/end` | event | `0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce` | [`{ type: "turn/end" }`](#persistence-type-sha256-0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce) | | `event:turn/start` | event | `aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8` | [`{ type: "turn/start" }`](#persistence-type-sha256-aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8) | -| `event:user/message` | event | `314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578` | [`{ type: "user/message" }`](#persistence-type-sha256-314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578) | +| `event:user/message` | event | `5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6` | [`{ type: "user/message" }`](#persistence-type-sha256-5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6) | | `event:web/deepseek-search-llm-request` | event | `cf6e3aaf1e2de6480aa0157730a41b9a492108a55304100b0f7e112711dd4331` | [`{ type: "web/deepseek-search-llm-request" }`](#persistence-type-sha256-cf6e3aaf1e2de6480aa0157730a41b9a492108a55304100b0f7e112711dd4331) | | `event:workspace/changes` | event | `e308ccf867a5398e316e0af8cb6ce238a8d33a63b9b384c8250a686786285f72` | [`{ type: "workspace/changes" }`](#persistence-type-sha256-e308ccf867a5398e316e0af8cb6ce238a8d33a63b9b384c8250a686786285f72) | @@ -1108,7 +1108,7 @@ export type SessionEvent = { message: ToolResultMessage /** * Optional failure identity and raw user-facing reason, outside model content; - * allowed only when the tool-result block has `isError: true`. + * allowed only when the message has `isError: true`. */ error?: { name: string; code: string; reason?: string } meta?: JsonValue @@ -1844,7 +1844,7 @@ SHA-256: `ebb768d85ec87fb68e42fc14fd7d8535b5ac11791b14d04c6770180f0a719bf8` SHA-256: `f311671e07bc7fa645a0b6597de9966b97147956565296ba76a36543801b66c5` -来源:[`packages/llm/llm/src/types.ts:383`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:374`](../packages/llm/llm/src/types.ts) `"in-history"` @@ -2520,14 +2520,6 @@ SHA-256: `6c1cccb433ddc153facb380c7dda956237ba5c31f8a532a69142dc277890cc9b` `"tool-calls"` - - -### `"tool-result"` - -SHA-256: `e5244812c495a80c2e78ba2c2690dca5f6b58ea8d3fe5531ff94a6f9ac5e5d66` - -`"tool-result"` - ### `"tool-workflow/agent-end"` @@ -2841,7 +2833,7 @@ SHA-256: `05d2ae1e0c7f8770f83f9a09047afb39a335d8ac986df3193659aa1e581472cf` - `"ask"` - `"never"` - + @@ -2849,18 +2841,18 @@ SHA-256: `05d2ae1e0c7f8770f83f9a09047afb39a335d8ac986df3193659aa1e581472cf` ### `AssistantMessage` -SHA-256: `e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83` +SHA-256: `fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05` -来源:[`packages/llm/llm/src/message.ts:148`](../packages/llm/llm/src/message.ts) +来源:[`packages/llm/llm/src/message.ts:152`](../packages/llm/llm/src/message.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | 必需 | `string` | | `role` | 必需 | `"assistant"` | | `source` | 必需 | [`ModelMessageSource`](#persistence-type-sha256-719c51f67074f97034a6c94297fe1f4b5d3c8d392c57586dab732aa5398c7a91) | - + @@ -2868,24 +2860,24 @@ SHA-256: `e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83` ### `AssistantStreamRecord` -SHA-256: `86cf1e44038cb8b11659863dd0efafe682e41b9c782265c1d50e0a687debfc60` +SHA-256: `050e0338b08a9712f3454b1e93bd7f5bb2f426ebfaf828688dd9102fc6089b70` 来源:[`packages/llm/llm/src/assistant-stream.ts:20`](../packages/llm/llm/src/assistant-stream.ts) 以下类型之一: - [`{ type: "tool-call-chunks" }`](#persistence-type-sha256-3860b4757d512a2869be833acb0faf834335b1b056bf3f83df5474dce95f8fa6) -- [`{ type: "chunk" }`](#persistence-type-sha256-c93b6f51b399607349b4bcc66b58e848a44250ffc1e2537207bd092dfff94192) +- [`{ type: "chunk" }`](#persistence-type-sha256-71a18f8c73d2082125528e0b546fdd914d310f93a4e5f48586cb9ee668574de3) - [`{ type: "reasoning-chunks" }`](#persistence-type-sha256-71bb3254ec8f1e491ce63b762a7b5f18709de23aa4e8abcc8b886f4b6ce051dd) - [`{ type: "text-chunks" }`](#persistence-type-sha256-e72269f931559e901e5e8fe1cfcbd0669fb795f43cc038ff39fba62f60403c33) - + ### `AssistantStreamRecord[]` -SHA-256: `26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346` +SHA-256: `d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878` -[`AssistantStreamRecord`](#persistence-type-sha256-86cf1e44038cb8b11659863dd0efafe682e41b9c782265c1d50e0a687debfc60) 的数组。 +[`AssistantStreamRecord`](#persistence-type-sha256-050e0338b08a9712f3454b1e93bd7f5bb2f426ebfaf828688dd9102fc6089b70) 的数组。 @@ -2922,7 +2914,7 @@ SHA-256: `ada310bf0bdb8fed51f3b56ea63f6ea6b18bbd587f04fccb63a14ab0b2a24e05` |---|---|---| | `kind` | 必需 | `"user"` | - + @@ -2930,20 +2922,19 @@ SHA-256: `ada310bf0bdb8fed51f3b56ea63f6ea6b18bbd587f04fccb63a14ab0b2a24e05` ### `ContentBlock` -SHA-256: `c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56` +SHA-256: `3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e` -来源:[`packages/llm/llm/src/types.ts:137`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:128`](../packages/llm/llm/src/types.ts) 以下类型之一: -- [`ReasoningBlock`](#persistence-type-sha256-814d9434e1ddf9078612b3b34322f26e9363b469213335007f7e9ba7fee9464e) -- [`TextBlock`](#persistence-type-sha256-4e887768586528565381dadbddee6cef555874148089f4579e0b4b1ad096fc9c) - [`ToolCallBlock`](#persistence-type-sha256-c1f0f17b6493b85db6453bb30e01b208d703731b25bc1e68e5d4fc72eea9cdea) - [`ImageBlock`](#persistence-type-sha256-12d5808fac1996b9b3c2afa806e03022252ba2d7b88f835862ae1896591f60c7) - [`FileBlock`](#persistence-type-sha256-f2da0f27c1e6add59982c37b15e4a4912c5b33466859cce3b13d503600e24aef) -- [`ToolResultBlock`](#persistence-type-sha256-d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127) +- [`ReasoningBlock`](#persistence-type-sha256-814d9434e1ddf9078612b3b34322f26e9363b469213335007f7e9ba7fee9464e) +- [`TextBlock`](#persistence-type-sha256-4e887768586528565381dadbddee6cef555874148089f4579e0b4b1ad096fc9c) - + @@ -2951,9 +2942,9 @@ SHA-256: `c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56` ### `ContentBlockType` -SHA-256: `757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61` +SHA-256: `ccca7d237e176afec87877c379035a69e715ae0fb4e859015d29f14cc4376588` -来源:[`packages/llm/llm/src/types.ts:135`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:126`](../packages/llm/llm/src/types.ts) 以下类型之一: @@ -2962,15 +2953,14 @@ SHA-256: `757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61` - `"reasoning"` - `"text"` - `"tool-call"` -- `"tool-result"` - + ### `ContentBlock[]` -SHA-256: `bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75` +SHA-256: `a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6` -[`ContentBlock`](#persistence-type-sha256-c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56) 的数组。 +[`ContentBlock`](#persistence-type-sha256-3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e) 的数组。 @@ -3158,7 +3148,7 @@ SHA-256: `f2da0f27c1e6add59982c37b15e4a4912c5b33466859cce3b13d503600e24aef` SHA-256: `5808e36c95355f0e745201b5db1b6bcec4ebf5adb75d3e82d7d59cc89635ab80` -来源:[`packages/llm/llm/src/types.ts:152`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:143`](../packages/llm/llm/src/types.ts) | kind | form 属性 | 其他必需字段 | 完整定义 | |---|---|---|---| @@ -3332,7 +3322,7 @@ SHA-256: `1df34a6c086866ffdc2dd9e8e5c581c3751a010cdf6b8538a7327f7a3237f0b4` SHA-256: `18ee62b8900a4c3d046700f05d7a4d49d6cab2a660a020c87481d1603dd8bd4f` -来源:[`packages/session/session-persistence-jsonl/src/format.ts:82`](../packages/session/session-persistence-jsonl/src/format.ts) +来源:[`packages/session/session-persistence-jsonl/src/format.ts:83`](../packages/session/session-persistence-jsonl/src/format.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -3589,7 +3579,7 @@ SHA-256: `6f72ece8f317cd080c4f20a93f1bf709965f5b81ac4669528f5a023191cfcf20` | `step` | 必需 | `number` | | `turn` | 必需 | `number` | - + @@ -3597,16 +3587,16 @@ SHA-256: `6f72ece8f317cd080c4f20a93f1bf709965f5b81ac4669528f5a023191cfcf20` ### `Message` -SHA-256: `23c7cce57d20589897f4e2bd5898affc6fc611b87cd0cc8b95be1cfdd8b3a7eb` +SHA-256: `01bc74417fd4ff36c2840b266a5b3b51bf0e3b71eb43960a2c4aee7b7441a2aa` -来源:[`packages/llm/llm/src/message.ts:131`](../packages/llm/llm/src/message.ts) +来源:[`packages/llm/llm/src/message.ts:180`](../packages/llm/llm/src/message.ts) -| 属性 | 存在性 | 类型 | -|---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | -| `id` | 必需 | `string` | -| `role` | 必需 | [`union (3 variants)`](#persistence-type-sha256-acd36e1717d2b4ef9e98a8e6fac17ca1203f3f448e5bca51677f129a8f4999e2) | -| `source` | 必需 | [`MessageSource`](#persistence-type-sha256-4c965666d5b42116945bc356087cd5e1fd549e6dece560785ed60511059a8283) | +以下类型之一: + +- [`ToolResultMessage`](#persistence-type-sha256-8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c) +- [`SystemMessage`](#persistence-type-sha256-abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94) +- [`AssistantMessage`](#persistence-type-sha256-fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05) +- [`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966) @@ -3716,13 +3706,13 @@ SHA-256: `4c965666d5b42116945bc356087cd5e1fd549e6dece560785ed60511059a8283` | `user` | 未声明 | 无 | [`CommandSource`](#persistence-type-sha256-ada310bf0bdb8fed51f3b56ea63f6ea6b18bbd587f04fccb63a14ab0b2a24e05) | | `webhook` | `"notice"` | `deliveryId`: `string`; `provider`: `string`; `ruleId`: `string`; `source`: `string`; `summary`: `string` | [`{ kind: "webhook", form: "notice" }`](#persistence-type-sha256-9edc162949abf93bd5ff049191b345454ba104f583937ce5580fb50f067d2b94) | - + ### `Message[]` -SHA-256: `478738df7e7d2b103b09fb937817a9302c81076809f2b341169e00a9419c5665` +SHA-256: `ff5bcfe90a83f6e773ae72b3ec775c5af8339df8a1dbe561e8147b56bc994fdc` -[`Message`](#persistence-type-sha256-23c7cce57d20589897f4e2bd5898affc6fc611b87cd0cc8b95be1cfdd8b3a7eb) 的数组。 +[`Message`](#persistence-type-sha256-01bc74417fd4ff36c2840b266a5b3b51bf0e3b71eb43960a2c4aee7b7441a2aa) 的数组。 @@ -3840,7 +3830,7 @@ SHA-256: `1d9cb3caa96100b18b1911fa3ff8c751ef6992971a03c5f4d9aefc1a0004a345` [`PresentedFile`](#persistence-type-sha256-b8fc636a2121df9d8423c242e03c9d23b7ab7c6fdce00e45746932c60b730f97) 的数组。 - + @@ -3848,14 +3838,14 @@ SHA-256: `1d9cb3caa96100b18b1911fa3ff8c751ef6992971a03c5f4d9aefc1a0004a345` ### `PtcDispatchEventData` -SHA-256: `8d2e5a3c4230e6ea6c0b5151f02241d0db02cd2551f2df1b6b9700cddcc0dca3` +SHA-256: `a8c678be0d060c63d44bd6026de343efe0d150d335c10e0d27e04a84c82cb1e3` 来源:[`packages/core/tools/src/types.ts:20`](../packages/core/tools/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `arguments` | 必需 | `unknown`(不透明) | -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `error` | 可选 | [`{ code, name, reason? }`](#persistence-type-sha256-a81059ca06999da1e712414520c2c65e491d052fcf9640fae20aa38f0a5dc735) | | `isError` | 必需 | `boolean` | | `name` | 必需 | `string` | @@ -3910,7 +3900,7 @@ SHA-256: `814d9434e1ddf9078612b3b34322f26e9363b469213335007f7e9ba7fee9464e` SHA-256: `0acd94fe8794574c9ae72c7855ee16d29c546096d4af760d16d1225385764555` -来源:[`packages/llm/llm/src/types.ts:404`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:395`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -4107,7 +4097,7 @@ SHA-256: `b56f6a885da3dc394c69a3e3cc5c0cfc4da15601b63fda4989eee8f40efc5be4` | `source` | 必需 | [`SessionTitleSource`](#persistence-type-sha256-30d5a537b296685770b1241c4b4bbde19d5a31ff81aa23df73fab5e90b8fc65f) | | `title` | 必需 | `string` | - + @@ -4115,7 +4105,7 @@ SHA-256: `b56f6a885da3dc394c69a3e3cc5c0cfc4da15601b63fda4989eee8f40efc5be4` ### `SessionTitleLlmRequestEventData` -SHA-256: `9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6` +SHA-256: `1b78e3a578a7e6d29d9564a9f5d236c2ebdcf682dbeb7b50400d8850e313b518` 来源:[`packages/session/session-title-llm/src/index.ts:27`](../packages/session/session-title-llm/src/index.ts) @@ -4123,7 +4113,7 @@ SHA-256: `9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6` |---|---|---| | `maxTokens` | 必需 | `number` | | `messageSeqs` | 必需 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | -| `messages` | 必需 | [`Message[]`](#persistence-type-sha256-478738df7e7d2b103b09fb937817a9302c81076809f2b341169e00a9419c5665) | +| `messages` | 必需 | [`Message[]`](#persistence-type-sha256-ff5bcfe90a83f6e773ae72b3ec775c5af8339df8a1dbe561e8147b56bc994fdc) | | `route` | 必需 | [`SessionTitleModelIdentity`](#persistence-type-sha256-07e1a58c58b593f507b8e7f25723bb0aa42baae6e00f5ecfddf28cb1e64d3235) | | `system` | 必需 | `string` | | `titleProvider` | 必需 | `string` | @@ -4212,7 +4202,7 @@ SHA-256: `672c4aa2a9b736e3d6e5da6346d2e2ed5e3573f2d0baafa18e7407c9f3fee3db` | `kind` | 必需 | `"skill-invocation"` | | `name` | 必需 | `string` | - + @@ -4220,15 +4210,15 @@ SHA-256: `672c4aa2a9b736e3d6e5da6346d2e2ed5e3573f2d0baafa18e7407c9f3fee3db` ### `StreamChunk` -SHA-256: `071d92b9dac661fcc826c678cf64d188f26fb93aab79c627b11a03acdd34dfca` +SHA-256: `c9b25ae820453f466ccb40c7c2b62ed81dc9579f142e14615b4c8596b264565c` -来源:[`packages/llm/llm/src/types.ts:426`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:417`](../packages/llm/llm/src/types.ts) 以下类型之一: - [`{ type: "tool-call-delta" }`](#persistence-type-sha256-88a610b831be6d92612a464be5c7d0b88ec24d97bd299837bf74bf7672183c9a) -- [`{ type: "block-end" }`](#persistence-type-sha256-90c811b8c2668898515e69a24e82caffeb08517f9c7aa193867ff0380f3b535d) -- [`{ type: "block-start" }`](#persistence-type-sha256-647cb2e3aeb58e27d1d4d60011f208bb66dce257e8654193c533b47c4c22c253) +- [`{ type: "block-end" }`](#persistence-type-sha256-61c16da5dfff82fba0aaf446f0bed211ef0c9bfb2130788e27b41c4244e8686f) +- [`{ type: "block-start" }`](#persistence-type-sha256-e829e4d334f3b1b3d64ab4be6a4778c79b98de8abfc2ec136d0ff4b971042cd7) - [`{ type: "reasoning-delta" }`](#persistence-type-sha256-2abb711460e6238d851c30f3e4bdd87a2aa1887ee70575b3d3b7b25610673095) - [`{ type: "text-delta" }`](#persistence-type-sha256-95080295115fbd83544520ba247b68a03790131f6a2eac323d388758cb542f65) - [`{ type: "finish" }`](#persistence-type-sha256-a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1) @@ -4304,7 +4294,7 @@ SHA-256: `335e242de1fcc17b6ca920fc420d71bec2d76e53e37955c00948b65ab77f05c5` - `"append"` - [`{ endSeq, op, startSeq }`](#persistence-type-sha256-bcf0caf62d964b2fcf5404bd5c909cfa9a21c3f3c96e6b7e36d9e33565223825) - + @@ -4312,13 +4302,13 @@ SHA-256: `335e242de1fcc17b6ca920fc420d71bec2d76e53e37955c00948b65ab77f05c5` ### `SystemMessage` -SHA-256: `302b01ddddcbb3b16cfa3fba2a5d99f5082a55fbd9dc5c83a179a228b8a6a0ca` +SHA-256: `abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94` -来源:[`packages/llm/llm/src/message.ts:158`](../packages/llm/llm/src/message.ts) +来源:[`packages/llm/llm/src/message.ts:141`](../packages/llm/llm/src/message.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | 必需 | `string` | | `role` | 必需 | `"system"` | | `source` | 必需 | [`union (7 variants)`](#persistence-type-sha256-23cf7e0cf3fec1283b60fa15713506169bc9c079a08e124d1cb9733baca80b40) | @@ -4363,7 +4353,7 @@ SHA-256: `6598cd6da253948d6b207c6374a45335804c79b576866d6215649c2d1bc85e25` | `phase` | 必需 | [`TeamMemberPhase`](#persistence-type-sha256-dfce5db4aa42b7ebe0bb79eca92553587287e18c06b9eba85cbfb9d332e26acd) | | `provider` | 必需 | `string` | - + @@ -4371,13 +4361,13 @@ SHA-256: `6598cd6da253948d6b207c6374a45335804c79b576866d6215649c2d1bc85e25` ### `TeamMessageSnapshot` -SHA-256: `5b694f394d5e11609887a3ccfa82844935d49806c37e336b30be2186d649ab94` +SHA-256: `9f5460b34f5daa2bdc225e47feb46cbd666de00277e907b514f0932fdcf409ab` 来源:[`packages/experimental/agent-team/src/types.ts:106`](../packages/experimental/agent-team/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | 必需 | `string` | | `senderId` | 必需 | `string` | | `senderName` | 必需 | `string` | @@ -4497,7 +4487,7 @@ SHA-256: `4b7ddaf3710b88ff9b8df66304f5f97bf03688fd19730eedc2e9535203c820ea` SHA-256: `fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394` -来源:[`packages/llm/llm/src/types.ts:162`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:153`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -4561,26 +4551,7 @@ SHA-256: `3cfc3a56502da1f8c6153c2c56657bab4b749056968634dd0991d325ec1c919f` | `allow` | 可选 | [`string[]`](#persistence-type-sha256-93c33d9687613293f8c95d46c4d922fe9ceae83b84c384beff5c3315abe005f2) | | `deny` | 可选 | [`string[]`](#persistence-type-sha256-93c33d9687613293f8c95d46c4d922fe9ceae83b84c384beff5c3315abe005f2) | - - - - - - -### `ToolResultBlock` - -SHA-256: `d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127` - -来源:[`packages/llm/llm/src/types.ts:114`](../packages/llm/llm/src/types.ts) - -| 属性 | 存在性 | 类型 | -|---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | -| `isError` | 可选 | `boolean` | -| `toolCallId` | 必需 | `string` | -| `type` | 必需 | `"tool-result"` | - - + @@ -4588,16 +4559,18 @@ SHA-256: `d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127` ### `ToolResultMessage` -SHA-256: `1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c` +SHA-256: `8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c` -来源:[`packages/llm/llm/src/message.ts:164`](../packages/llm/llm/src/message.ts) +来源:[`packages/llm/llm/src/message.ts:158`](../packages/llm/llm/src/message.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `content` | 必需 | [`tuple (1 positions)`](#persistence-type-sha256-8d6a011f3ef7096a4a922ef420458419ff6b20e1eaeece5d331db7585d2f08d6) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | 必需 | `string` | -| `role` | 必需 | `"user"` | +| `isError` | 可选 | `boolean` | +| `role` | 必需 | `"tool"` | | `source` | 必需 | [`ToolMessageSource`](#persistence-type-sha256-d9c462b9f62fdd3efc76a44b9524dc8781f6b91cd9c7e584b17d971defafebab) | +| `toolCallId` | 必需 | `string` | @@ -4609,7 +4582,7 @@ SHA-256: `1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c` SHA-256: `7f5f2a8618c2ece530a18b1358b890fb57fb8c35705e47b66bff2296f8c6e889` -来源:[`packages/llm/llm/src/types.ts:447`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:438`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -4739,7 +4712,7 @@ SHA-256: `f1687f982fa3d41ef29e159feed154ecd13af4dd209acaee16038f223f2e9402` | `interrupted` | 未声明 | 无 | [`{ kind: "interrupted" }`](#persistence-type-sha256-56b7c047694875a843ba020dfea3c8380d54ae4ff88ab349e72004dc21e07c23) | | `max-tokens` | 未声明 | 无 | [`{ kind: "max-tokens" }`](#persistence-type-sha256-ab7ec5f9eb2c6dfacca5da4c37cf7ba85d04172053ee6b1ebf1709ffcd99c1a7) | - + @@ -4747,24 +4720,24 @@ SHA-256: `f1687f982fa3d41ef29e159feed154ecd13af4dd209acaee16038f223f2e9402` ### `UserMessage` -SHA-256: `4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7` +SHA-256: `a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966` -来源:[`packages/llm/llm/src/message.ts:143`](../packages/llm/llm/src/message.ts) +来源:[`packages/llm/llm/src/message.ts:147`](../packages/llm/llm/src/message.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `id` | 必需 | `string` | | `role` | 必需 | `"user"` | | `source` | 必需 | [`MessageSource`](#persistence-type-sha256-4c965666d5b42116945bc356087cd5e1fd549e6dece560785ed60511059a8283) | - + ### `UserMessage[]` -SHA-256: `300341f890f7b9506a1749fff4fa5239d16ea1c63ff6b15851acb03c20f3b48d` +SHA-256: `71225015514ed0439df95fc6e55719e1fa30bd205b99a7eefb7e18152be835ea` -[`UserMessage`](#persistence-type-sha256-4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7) 的数组。 +[`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966) 的数组。 @@ -4974,16 +4947,6 @@ SHA-256: `4aed17ec726b5397c29f6cb4bcd7905dc1a12bb6140f1657f073cd24380f2af8` |---|---|---| | 0 | 必需 | [`{ type: "web_search_20250305" }`](#persistence-type-sha256-2d11ca7b0d4493e244b74eba093227866b33249841e59a1e9bf56afed38604c3) | - - -### `tuple (1 positions)` - -SHA-256: `8d6a011f3ef7096a4a922ef420458419ff6b20e1eaeece5d331db7585d2f08d6` - -| 位置 | 存在性 | 类型 | -|---|---|---| -| 0 | 必需 | [`ToolResultBlock`](#persistence-type-sha256-d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127) | - ### `tuple (1 positions)` @@ -5015,6 +4978,17 @@ SHA-256: `1ab2ef1296f157ba96998f179bb5daa9d21a82480da2901127aeab2730797c92` - `"error"` - `"success"` + + +### `union (2 variants)` + +SHA-256: `243a2287c54514f9b819d7d9c93cc2d1313c54401c7630ef03a2d2380606637a` + +以下类型之一: + +- [`{ compactionId, llmStreamCall, maxTokens?, model, … }`](#persistence-type-sha256-e1e89e5a614b3090837728fa6e314fe019c99f07b6319f9d4a7d5a52cba396e4) +- [`{ compactionId, maxTokens?, model, provider, … }`](#persistence-type-sha256-0c3c69461d71c0aafb10acd70672f86cd2cf7592cbb71c2f9ac1c2f3eeba0734) + ### `union (2 variants)` @@ -5026,17 +5000,6 @@ SHA-256: `50cf02d875f8a1f1411f4a6fbcffab9120ccef5f74a47331fbf29480e5f68f48` - `"fork"` - `"fresh"` - - -### `union (2 variants)` - -SHA-256: `feb329074f0206ecc06d8a1aa0a0b3e2f47fd27524ba020fbc849ba63e938896` - -以下类型之一: - -- [`{ compactionId, llmStreamCall, maxTokens?, model, … }`](#persistence-type-sha256-9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c) -- [`{ compactionId, maxTokens?, model, provider, … }`](#persistence-type-sha256-3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca) - @@ -5063,18 +5026,6 @@ SHA-256: `904bf499d98be4a3a5f836fcac533b6c4899569b018071e6604e1d32657d00fd` - `"replace"` - `"set"` - - -### `union (3 variants)` - -SHA-256: `acd36e1717d2b4ef9e98a8e6fac17ca1203f3f448e5bca51677f129a8f4999e2` - -以下类型之一: - -- `"assistant"` -- `"system"` -- `"user"` - ### `union (3 variants)` @@ -5348,11 +5299,11 @@ SHA-256: `ca59530d1a4f3e191b4032bc4a20eded0d827db8b5a7efb27b3af9e9b456c6f2` | `sourceCommandId` | 可选 | `string` | | `turn` | 必需 | [`OptionalSessionSeq`](#persistence-type-sha256-3bd652ebfa8726b3ce3937a4f1bd2759e02f86b3a08a20f9e41a8513656fbc5f) | - + ### `{ compactionId, llmStreamCall, maxTokens?, model, … }` -SHA-256: `9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c` +SHA-256: `e1e89e5a614b3090837728fa6e314fe019c99f07b6319f9d4a7d5a52cba396e4` | 属性 | 存在性 | 类型 | |---|---|---| @@ -5361,19 +5312,19 @@ SHA-256: `9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c` | `maxTokens` | 可选 | `number` | | `model` | 必需 | `string` | | `provider` | 必需 | `string` | -| `rawOutput` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `rawOutput` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `shadowedRange` | 必需 | [`{ end, start }`](#persistence-type-sha256-9e41386b3a0c9572b0d63078492ebb3997da7d3a830d44e0259418bd02f4bcb2) | | `shadowedSeqs` | 必需 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | 必需 | `number` | | `sourceCommandId` | 可选 | `string` | -| `summary` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `summary` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `usage` | 可选 | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ compactionId, maxTokens?, model, provider, … }` -SHA-256: `3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca` +SHA-256: `0c3c69461d71c0aafb10acd70672f86cd2cf7592cbb71c2f9ac1c2f3eeba0734` | 属性 | 存在性 | 类型 | |---|---|---| @@ -5381,12 +5332,12 @@ SHA-256: `3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca` | `maxTokens` | 可选 | `number` | | `model` | 必需 | `string` | | `provider` | 必需 | `string` | -| `rawOutput` | 可选 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `rawOutput` | 可选 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `shadowedRange` | 必需 | [`{ end, start }`](#persistence-type-sha256-9e41386b3a0c9572b0d63078492ebb3997da7d3a830d44e0259418bd02f4bcb2) | | `shadowedSeqs` | 必需 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | 必需 | `number` | | `sourceCommandId` | 可选 | `string` | -| `summary` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75) | +| `summary` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6) | | `usage` | 可选 | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | @@ -5539,18 +5490,18 @@ SHA-256: `79650cfa10aa3c52440328d85e8a25f0ffadc8d7efd784e3c0819d8bb74a1985` | `error` | 必需 | [`LlmFailure`](#persistence-type-sha256-5f2117d1856a5ab43c28371faa978ebfaa48f8c7d734ea3fc94842210df83dca) | | `kind` | 必需 | `"error"` | - + ### `{ error?, message, meta?, step, … }` -SHA-256: `356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5` +SHA-256: `fb1777a19335be3c5c717e23a1800817fc36fb99277d9a0487e924401210e219` 来源:[`packages/core/session/src/types.ts:362`](../packages/core/session/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `error` | 可选 | [`{ code, name, reason? }`](#persistence-type-sha256-a81059ca06999da1e712414520c2c65e491d052fcf9640fae20aa38f0a5dc735) | -| `message` | 必需 | [`ToolResultMessage`](#persistence-type-sha256-1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c) | +| `message` | 必需 | [`ToolResultMessage`](#persistence-type-sha256-8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c) | | `meta` | 可选 | [`JsonValue`](#persistence-type-sha256-c592ce75aab73fcab19c1d7845684c72cf402b78d2e1f2833a58ecf9f3598ed6) | | `step` | 必需 | `number` | | `turn` | 必需 | `number` | @@ -5561,7 +5512,7 @@ SHA-256: `356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5` SHA-256: `8e31bb958e9b015e6f8407eaade32217068159e816f3cc99c3ad76eb889732e0` -来源:[`packages/llm/llm/src/types.ts:147`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:138`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -5574,7 +5525,7 @@ SHA-256: `8e31bb958e9b015e6f8407eaade32217068159e816f3cc99c3ad76eb889732e0` SHA-256: `693f4952fb5565da96c06bace8924b098ac2fbc915fde0ff8019701183abc057` -来源:[`packages/llm/llm/src/types.ts:148`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:139`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -5675,36 +5626,36 @@ SHA-256: `17d1afb770d9941936130996da00dc86782cfef731d8d6526162c301256a4ac3` |---|---|---| | `inherited` | 可选 | `true` | - + ### `{ inserted, outcome?, removedCount?, start, … }` -SHA-256: `a6a195c1b4a906d953d24ab5864c9f1881d545460e080a51144adfc9cb058cfe` +SHA-256: `6f87000576a13d73867248c97e55c4ebe3cb3ee55ee3bd1282f26e7f40dd81c8` 来源:[`packages/core/agent/src/types.ts:87`](../packages/core/agent/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `inserted` | 必需 | [`UserMessage[]`](#persistence-type-sha256-300341f890f7b9506a1749fff4fa5239d16ea1c63ff6b15851acb03c20f3b48d) | +| `inserted` | 必需 | [`UserMessage[]`](#persistence-type-sha256-71225015514ed0439df95fc6e55719e1fa30bd205b99a7eefb7e18152be835ea) | | `outcome` | 可选 | `"canceled"` | | `removedCount` | 可选 | `number` | | `start` | 必需 | `number` | | `target` | 必需 | [`InboxTarget`](#persistence-type-sha256-96f4a9c81fc0f940ef71528a8cc66731ae4cf1f40d79680c5fe3c39f96d7723c) | - + ### `{ interrupted?, message, step, stream, … }` -SHA-256: `77b8491f946edfc8cc77ebae3ba49183759da31ba2dfa83d4c9e9e618c4b91d2` +SHA-256: `544d9f25d6224883513a9d6c0d0a185764d5fa8aebb24e20f87710b6f284a540` 来源:[`packages/core/session/src/types.ts:328`](../packages/core/session/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `interrupted` | 可选 | `true` | -| `message` | 必需 | [`AssistantMessage`](#persistence-type-sha256-e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83) | +| `message` | 必需 | [`AssistantMessage`](#persistence-type-sha256-fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05) | | `step` | 必需 | `number` | -| `stream` | 必需 | [`AssistantStreamRecord[]`](#persistence-type-sha256-26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346) | +| `stream` | 必需 | [`AssistantStreamRecord[]`](#persistence-type-sha256-d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878) | | `turn` | 必需 | `number` | | `usage` | 可选 | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | @@ -5824,7 +5775,7 @@ SHA-256: `eaa71be0fbf0f702df8ea6c11d0aa2f9782263d45a10d0fb14eda662f4bfe04c` SHA-256: `ab7ec5f9eb2c6dfacca5da4c37cf7ba85d04172053ee6b1ebf1709ffcd99c1a7` -来源:[`packages/core/session/src/types.ts:213`](../packages/core/session/src/types.ts) · [`packages/llm/llm/src/types.ts:146`](../packages/llm/llm/src/types.ts) +来源:[`packages/core/session/src/types.ts:213`](../packages/core/session/src/types.ts) · [`packages/llm/llm/src/types.ts:137`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -5947,7 +5898,7 @@ SHA-256: `b81e9de81a481b24e1e1f9adf038bfc59e57b4f35ce62f8f1e45284186f4f812` SHA-256: `1d76406cbb2ddadb0dbbb51e9d8bc6cf678fed455cf8eb512f36f7c86d37a62f` -来源:[`packages/llm/llm/src/types.ts:144`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:135`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -5959,7 +5910,7 @@ SHA-256: `1d76406cbb2ddadb0dbbb51e9d8bc6cf678fed455cf8eb512f36f7c86d37a62f` SHA-256: `287211846beea1eccb5f9acee00d20388a38fcb2e95858fa2332d6f58529379a` -来源:[`packages/llm/llm/src/types.ts:145`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:136`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -6026,31 +5977,31 @@ SHA-256: `b1ebd5cda47d90d980bb05bffc3f970c51537b9aff15b3bc3d639811727741b1` | `teamId` | 必需 | `string` | | `version` | 必需 | `2` | - + ### `{ message, step, turn }` -SHA-256: `2074f40221b76c75fd314246db558965dc3477dfb440bcc952b1eedc9778e366` +SHA-256: `04e1cae61e7654890444877cb802e3b6c8c607fa8a9b4380323939951a1be9d2` 来源:[`packages/core/session/src/types.ts:317`](../packages/core/session/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `message` | 必需 | [`SystemMessage`](#persistence-type-sha256-302b01ddddcbb3b16cfa3fba2a5d99f5082a55fbd9dc5c83a179a228b8a6a0ca) | +| `message` | 必需 | [`SystemMessage`](#persistence-type-sha256-abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94) | | `step` | 必需 | `number` | | `turn` | 必需 | `number` | - + ### `{ message, teamId, version }` -SHA-256: `0c3f4d2248d9bc9700e2d7253fa71aa9935f5c39af6f11de5727f08cccaf8383` +SHA-256: `394cf42541bf794f465314cf0c7b86ad4bc32e34cac111ebbe592a21c72d8c52` 来源:[`packages/experimental/agent-team/src/types.ts:225`](../packages/experimental/agent-team/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `message` | 必需 | [`TeamMessageSnapshot`](#persistence-type-sha256-5b694f394d5e11609887a3ccfa82844935d49806c37e336b30be2186d649ab94) | +| `message` | 必需 | [`TeamMessageSnapshot`](#persistence-type-sha256-9f5460b34f5daa2bdc225e47feb46cbd666de00277e907b514f0932fdcf409ab) | | `teamId` | 必需 | `string` | | `version` | 必需 | `2` | @@ -6161,18 +6112,18 @@ SHA-256: `5dd766ccd1702a1142ad8b4bd44f2242f8e8a6752669ad3de0a5d224329b1438` | `shadowedSeqs` | 必需 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | | `shadowedTokenCount` | 必需 | `number` | - + ### `{ step, stream, turn }` -SHA-256: `0c6412d3ba5e41adfaa6929c7d4093f2d52d8598c03f35844fc0d55e3070a3b1` +SHA-256: `2efae120e250c2f5ac1777c67dc76255f06608a138b2446e8a0489bb25b9b35c` 来源:[`packages/core/session/src/types.ts:342`](../packages/core/session/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `step` | 必需 | `number` | -| `stream` | 必需 | [`AssistantStreamRecord[]`](#persistence-type-sha256-26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346) | +| `stream` | 必需 | [`AssistantStreamRecord[]`](#persistence-type-sha256-d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878) | | `turn` | 必需 | `number` | @@ -6254,17 +6205,17 @@ SHA-256: `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | `time` | 必需 | `number` | | `type` | 必需 | `"agent-preset/selected"` | - + ### `{ type: "agent/inbox/spliced" }` -SHA-256: `646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f` +SHA-256: `cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-a6a195c1b4a906d953d24ab5864c9f1881d545460e080a51144adfc9cb058cfe) | +| `data` | 必需 | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-6f87000576a13d73867248c97e55c4ebe3cb3ee55ee3bd1282f26e7f40dd81c8) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -6318,78 +6269,78 @@ SHA-256: `26718e15e7e395bce9642dba5bbe09b3b1a4ce2213d20d566cd9207d7fc5fb78` | `time` | 必需 | `number` | | `type` | 必需 | `"approval/policy"` | - + ### `{ type: "assistant/attempt" }` -SHA-256: `c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e` +SHA-256: `2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ step, stream, turn }`](#persistence-type-sha256-0c6412d3ba5e41adfaa6929c7d4093f2d52d8598c03f35844fc0d55e3070a3b1) | +| `data` | 必需 | [`{ step, stream, turn }`](#persistence-type-sha256-2efae120e250c2f5ac1777c67dc76255f06608a138b2446e8a0489bb25b9b35c) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | | `type` | 必需 | `"assistant/attempt"` | - + ### `{ type: "assistant/message" }` -SHA-256: `1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d` +SHA-256: `f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ interrupted?, message, step, stream, … }`](#persistence-type-sha256-77b8491f946edfc8cc77ebae3ba49183759da31ba2dfa83d4c9e9e618c4b91d2) | +| `data` | 必需 | [`{ interrupted?, message, step, stream, … }`](#persistence-type-sha256-544d9f25d6224883513a9d6c0d0a185764d5fa8aebb24e20f87710b6f284a540) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `surfaceOp` | 必需 | [`SurfaceOp`](#persistence-type-sha256-335e242de1fcc17b6ca920fc420d71bec2d76e53e37955c00948b65ab77f05c5) | | `time` | 必需 | `number` | | `type` | 必需 | `"assistant/message"` | - + ### `{ type: "block-end" }` -SHA-256: `90c811b8c2668898515e69a24e82caffeb08517f9c7aa193867ff0380f3b535d` +SHA-256: `61c16da5dfff82fba0aaf446f0bed211ef0c9bfb2130788e27b41c4244e8686f` -来源:[`packages/llm/llm/src/types.ts:431`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:422`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `block` | 必需 | [`ContentBlock`](#persistence-type-sha256-c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56) | +| `block` | 必需 | [`ContentBlock`](#persistence-type-sha256-3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e) | | `index` | 必需 | `number` | | `type` | 必需 | `"block-end"` | - + ### `{ type: "block-start" }` -SHA-256: `647cb2e3aeb58e27d1d4d60011f208bb66dce257e8654193c533b47c4c22c253` +SHA-256: `e829e4d334f3b1b3d64ab4be6a4778c79b98de8abfc2ec136d0ff4b971042cd7` -来源:[`packages/llm/llm/src/types.ts:427`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:418`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `blockType` | 必需 | [`ContentBlockType`](#persistence-type-sha256-757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61) | +| `blockType` | 必需 | [`ContentBlockType`](#persistence-type-sha256-ccca7d237e176afec87877c379035a69e715ae0fb4e859015d29f14cc4376588) | | `index` | 必需 | `number` | | `type` | 必需 | `"block-start"` | - + ### `{ type: "chunk" }` -SHA-256: `c93b6f51b399607349b4bcc66b58e848a44250ffc1e2537207bd092dfff94192` +SHA-256: `71a18f8c73d2082125528e0b546fdd914d310f93a4e5f48586cb9ee668574de3` 来源:[`packages/llm/llm/src/assistant-stream.ts:44`](../packages/llm/llm/src/assistant-stream.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `chunk` | 必需 | [`StreamChunk`](#persistence-type-sha256-071d92b9dac661fcc826c678cf64d188f26fb93aab79c627b11a03acdd34dfca) | +| `chunk` | 必需 | [`StreamChunk`](#persistence-type-sha256-c9b25ae820453f466ccb40c7c2b62ed81dc9579f142e14615b4c8596b264565c) | | `time` | 必需 | `number` | | `type` | 必需 | `"chunk"` | @@ -6473,17 +6424,17 @@ SHA-256: `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | `time` | 必需 | `number` | | `type` | 必需 | `"compaction/start"` | - + ### `{ type: "compaction/summary" }` -SHA-256: `f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59` +SHA-256: `86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`union (2 variants)`](#persistence-type-sha256-feb329074f0206ecc06d8a1aa0a0b3e2f47fd27524ba020fbc849ba63e938896) | +| `data` | 必需 | [`union (2 variants)`](#persistence-type-sha256-243a2287c54514f9b819d7d9c93cc2d1313c54401c7630ef03a2d2380606637a) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -6559,7 +6510,7 @@ SHA-256: `b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8` SHA-256: `a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1` -来源:[`packages/llm/llm/src/types.ts:433`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:424`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -6733,7 +6684,7 @@ SHA-256: `71bb3254ec8f1e491ce63b762a7b5f18709de23aa4e8abcc8b886f4b6ce051dd` SHA-256: `2abb711460e6238d851c30f3e4bdd87a2aa1887ee70575b3d3b7b25610673095` -来源:[`packages/llm/llm/src/types.ts:429`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:420`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -6853,17 +6804,17 @@ SHA-256: `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | `time` | 必需 | `number` | | `type` | 必需 | `"session/title"` | - + ### `{ type: "session/title-llm-request" }` -SHA-256: `e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d` +SHA-256: `2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6) | +| `data` | 必需 | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-1b78e3a578a7e6d29d9564a9f5d236c2ebdcf682dbeb7b50400d8850e313b518) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -6949,17 +6900,17 @@ SHA-256: `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | `time` | 必需 | `number` | | `type` | 必需 | `"subagent/model-selection-policy"` | - + ### `{ type: "system/message" }` -SHA-256: `69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae` +SHA-256: `1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ message, step, turn }`](#persistence-type-sha256-2074f40221b76c75fd314246db558965dc3477dfb440bcc952b1eedc9778e366) | +| `data` | 必需 | [`{ message, step, turn }`](#persistence-type-sha256-04e1cae61e7654890444877cb802e3b6c8c607fa8a9b4380323939951a1be9d2) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `sourceEventSeqs` | 可选 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -6999,17 +6950,17 @@ SHA-256: `48f9c19417a1abbedfa59f4667bba36b93ac2db407adf5e84cb3ba0de30942cb` | `time` | 必需 | `number` | | `type` | 必需 | `"team/message/delivered"` | - + ### `{ type: "team/message/queued" }` -SHA-256: `443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4` +SHA-256: `9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ message, teamId, version }`](#persistence-type-sha256-0c3f4d2248d9bc9700e2d7253fa71aa9935f5c39af6f11de5727f08cccaf8383) | +| `data` | 必需 | [`{ message, teamId, version }`](#persistence-type-sha256-394cf42541bf794f465314cf0c7b86ad4bc32e34cac111ebbe592a21c72d8c52) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -7053,7 +7004,7 @@ SHA-256: `e72269f931559e901e5e8fe1cfcbd0669fb795f43cc038ff39fba62f60403c33` SHA-256: `95080295115fbd83544520ba247b68a03790131f6a2eac323d388758cb542f65` -来源:[`packages/llm/llm/src/types.ts:428`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:419`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -7101,7 +7052,7 @@ SHA-256: `3860b4757d512a2869be833acb0faf834335b1b056bf3f83df5474dce95f8fa6` SHA-256: `88a610b831be6d92612a464be5c7d0b88ec24d97bd299837bf74bf7672183c9a` -来源:[`packages/llm/llm/src/types.ts:430`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:421`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| @@ -7191,17 +7142,17 @@ SHA-256: `3b1be838223869fe0a08210db85bf773796ed3f2373ac16555dff227cade0c48` | `time` | 必需 | `number` | | `type` | 必需 | `"tool/call"` | - + ### `{ type: "tool/ptc-dispatch" }` -SHA-256: `b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c` +SHA-256: `75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`PtcDispatchEventData`](#persistence-type-sha256-8d2e5a3c4230e6ea6c0b5151f02241d0db02cd2551f2df1b6b9700cddcc0dca3) | +| `data` | 必需 | [`PtcDispatchEventData`](#persistence-type-sha256-a8c678be0d060c63d44bd6026de343efe0d150d335c10e0d27e04a84c82cb1e3) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -7223,17 +7174,17 @@ SHA-256: `ec38b5949af8eacaf00df002f4acbe344f934f8a061e9cdc65a52a48e5f6dd93` | `time` | 必需 | `number` | | `type` | 必需 | `"tool/ptc-dispatch-start"` | - + ### `{ type: "tool/result" }` -SHA-256: `29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2` +SHA-256: `f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ error?, message, meta?, step, … }`](#persistence-type-sha256-356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5) | +| `data` | 必需 | [`{ error?, message, meta?, step, … }`](#persistence-type-sha256-fb1777a19335be3c5c717e23a1800817fc36fb99277d9a0487e924401210e219) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `sourceEventSeqs` | 可选 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -7279,24 +7230,24 @@ SHA-256: `aa0957eca50aeb28bcd2e6930b95809926edacb550c8c340ba526ba6b861b3d8` SHA-256: `f1a96afe7503ac1817de769cd0ba13d9b80111c7034c50106b3344ecc14cc515` -来源:[`packages/llm/llm/src/types.ts:432`](../packages/llm/llm/src/types.ts) +来源:[`packages/llm/llm/src/types.ts:423`](../packages/llm/llm/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `type` | 必需 | `"usage"` | | `usage` | 必需 | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ type: "user/message" }` -SHA-256: `314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578` +SHA-256: `5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`UserMessage`](#persistence-type-sha256-4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7) | +| `data` | 必需 | [`UserMessage`](#persistence-type-sha256-a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `sourceEventSeqs` | 可选 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | diff --git a/docs/persistence-changes/2026-09-16-session-format-v4.i18n.yaml b/docs/persistence-changes/2026-09-16-session-format-v4.i18n.yaml index a0330e1ee5..0e9ba1c38b 100644 --- a/docs/persistence-changes/2026-09-16-session-format-v4.i18n.yaml +++ b/docs/persistence-changes/2026-09-16-session-format-v4.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/persistence-changes/2026-09-16-session-format-v4.md -2026-09-16-session-format-v4.md: 83dbb637b19ee52163852220448f6593fa22fb47 -2026-09-16-session-format-v4.zh.md: 82956ba5363b111fc946dc010aa691d189331098 +2026-09-16-session-format-v4.md: a7eb33734a174b1fc7d753edd4ff2f9ca8dcd2d5 +2026-09-16-session-format-v4.zh.md: b5eebdf48261b8492bc30d20036766f8419060bb diff --git a/docs/persistence-changes/2026-09-16-session-format-v4.md b/docs/persistence-changes/2026-09-16-session-format-v4.md index 83dbb637b1..a7eb33734a 100644 --- a/docs/persistence-changes/2026-09-16-session-format-v4.md +++ b/docs/persistence-changes/2026-09-16-session-format-v4.md @@ -9,7 +9,7 @@ English | [中文](2026-09-16-session-format-v4.zh.md) ## Summary -Advances the declared SessionHeader.version from 3 to 4 for the V4 integration writer and adds the forked variant to turn/end.reason. +Advances the declared SessionHeader.version from 3 to 4 for the V4 integration writer, records first-class tool-role results, and adds the forked variant to turn/end.reason. ## Table of Contents @@ -30,29 +30,65 @@ changes: previous: "2026-09-11-initial" after: "1a3440e3577382704d42a6263aa463504eb74c566734a55e9503a63efcd02445" decision: version-bump + - root: "event:agent/inbox/spliced" + previous: "2026-09-14-image-offload" + after: "cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a" + decision: version-bump + - root: "event:assistant/attempt" + previous: "2026-09-14-image-offload" + after: "2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2" + decision: version-bump + - root: "event:assistant/message" + previous: "2026-09-14-image-offload" + after: "f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58" + decision: version-bump + - root: "event:compaction/summary" + previous: "2026-09-14-image-offload" + after: "86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559" + decision: version-bump + - root: "event:session/title-llm-request" + previous: "2026-09-14-image-offload" + after: "2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0" + decision: version-bump + - root: "event:system/message" + previous: "2026-09-14-image-offload" + after: "1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300" + decision: version-bump + - root: "event:team/message/queued" + previous: "2026-09-14-image-offload" + after: "9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240" + decision: version-bump + - root: "event:tool/ptc-dispatch" + previous: "2026-09-14-image-offload" + after: "75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185" + decision: version-bump + - root: "event:tool/result" + previous: "2026-09-14-image-offload" + after: "f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c" + decision: version-bump - root: "event:turn/end" previous: "2026-09-14-image-offload" after: "0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce" decision: version-bump + - root: "event:user/message" + previous: "2026-09-14-image-offload" + after: "5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6" + decision: version-bump ``` ## Compatibility -The [V3-to-V4 migration](../../packages/session/session-format-v3-to-v4/README.md#v3-to-v4-specification) advances the header, preserves every admitted source event and inherited cut, and appends missing parent `subagent/catalog` records from retained direct-child logs in the same persistence root. Historical body restoration requires an explicit child-evidence set, including an empty set when no children are available to backfill. Missing required descriptors or conflicting identities refuse migration without publication; existing catalog facts remain. The linked specification owns descriptor admission and deterministic append order. +The tool-role declaration changes ten event roots because inbox entries, message events, compaction summaries, title requests, team messages, and PTC dispatches embed the shared `Message` or `ContentBlock` declarations. Removing `tool-result` from that union and specializing message roles changes those reachable schemas without adding ten independent event protocols. The `turn/end` change separately records the forked reason; `SessionHeader` records the version increase. -Historical read opens prepare the result in memory. Write opens revalidate child membership and revisions before publishing the current successor beside unchanged predecessor files. Already-written V4 files do not rerun this incoming edge, so unreleased integration uses disposable homes. Delivery-generation checks keep historical acknowledgements from becoming active V4 watermarks. V3 readers refuse the newer generation; the [V3 schema reference](historical-formats/v3.md) preserves the outgoing declarations. +The [native V4 validation decision](../../.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md) owns the reader admission required by these current fields. -The same unreleased transition adds `forked` to `turn/end.reason`. Exact-cut forks append child-owned error results and closers after the inherited marker. V4 admits checked not-started fork results with deterministic branch-specific IDs and wording; released V0–V3 validators and recorded predecessor generations remain unchanged. +The V3-to-V4 migration lifts released user-role tool results into tool-role messages with a required toolCallId and optional isError. Tool-result wrappers leave the content-block union. The migration preserves every admitted source event and inherited cut, and appends missing parent subagent/catalog records from retained direct-child logs in the same persistence root. Historical body restoration requires an explicit child-evidence set, including an empty set when no children are available to backfill. Missing required descriptors or conflicting identities refuse migration without publication; existing catalog facts remain. Historical read opens prepare the result in memory. Write opens revalidate child membership and revisions before publishing the current successor beside unchanged predecessor files. Delivery-generation checks keep historical acknowledgements from becoming active V4 watermarks. V3 readers refuse the newer generation. The same unreleased transition adds forked to turn/end.reason; exact-cut forks append child-owned error results and closers after the inherited marker. V4 admits checked not-started fork results with deterministic branch-specific IDs and wording; released V0–V3 validators and recorded predecessor generations remain unchanged. ## Verification -`pnpm exec vitest run packages/session/session-format-v3-to-v4/tests packages/session/session-format-catalog/tests packages/session/session-persistence-jsonl/tests/catalog-migration.spec.ts` passed 140 tests across nine files, with one skipped test. The suites cover catalog completion, inherited cuts, child-evidence refusal, and JSONL preparation/publication. - -Before the writer change, `pnpm run verify-persistence-catalog` passed and `pnpm run verify-persistence-formats --archive 3` captured the V3 schema. The V4 header schema digest remains unchanged. - -The focused Session, agent-loop, Session Controller, V4, chat-view, and compaction suites passed 1,523 tests across 63 files after integration of exact-cut forks. V4 fork tests retain original IDs and text across encoding, decoding, and restoration, reject malformed results, and validate nested inherited cuts. +The focused Session, agent-loop, Session Controller, V4, chat-view, and compaction suites passed 1,523 tests across 63 files after integration of exact-cut forks. V4 fork tests retain original IDs and text across encoding, decoding, and restoration, reject malformed results, and validate nested inherited cuts. The tool-role migration tests and SDK snapshot refresh also passed in the originating change; the built Python runtime sdk-snapshot scenario passed, and focused pi-ai and auto-review coverage passed 351 tests with 100% coverage of the three affected modules. ## Dev Note diff --git a/docs/persistence-changes/2026-09-16-session-format-v4.schema.json b/docs/persistence-changes/2026-09-16-session-format-v4.schema.json index 0d2e99ff3a..4ea8e3c31e 100644 --- a/docs/persistence-changes/2026-09-16-session-format-v4.schema.json +++ b/docs/persistence-changes/2026-09-16-session-format-v4.schema.json @@ -82,6 +82,6503 @@ ] } }, + { + "key": "event:agent/inbox/spliced", + "kind": "event", + "event": "agent/inbox/spliced", + "surface": false, + "digest": "cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 18, + "optional": true + }, + { + "name": "seq", + "type": 11, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 88, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "inserted", + "type": 2, + "optional": false + }, + { + "name": "outcome", + "type": 84, + "optional": true + }, + { + "name": "removedCount", + "type": 11, + "optional": true + }, + { + "name": "start", + "type": 11, + "optional": false + }, + { + "name": "target", + "type": 85, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "role", + "type": 27, + "optional": false + }, + { + "name": "source", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 20, + 23, + 25 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 10, + "optional": false + }, + { + "name": "offloaded", + "type": 18, + "optional": true + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 21, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 29, + 38, + 40, + 41, + 44, + 49, + 51, + 56, + 57, + 58, + 60, + 62, + 63, + 71, + 73, + 75, + 77, + 79, + 82, + 83 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 18, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 7, + "optional": true + }, + { + "name": "changes", + "type": 30, + "optional": false + }, + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 31 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 32, + "optional": false + }, + { + "name": "digest", + "type": 7, + "optional": true + }, + { + "name": "path", + "type": 7, + "optional": false + }, + { + "name": "scope", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 33, + 34, + 35 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 7, + "optional": true + }, + { + "name": "kind", + "type": 27, + "optional": false + }, + { + "name": "rpcId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 7, + "optional": false + }, + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "ruleId", + "type": 7, + "optional": false + }, + { + "name": "source", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 45, + "optional": false + }, + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "update", + "type": 18, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 46 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + }, + { + "name": "sections", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 55 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 61, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 64, + "optional": false + }, + { + "name": "references", + "type": 65, + "optional": false + }, + { + "name": "version", + "type": 70, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 66 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 11, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 67, + "optional": false + }, + { + "name": "compacted", + "type": 69, + "optional": false + }, + { + "name": "inputIndex", + "type": 11, + "optional": false + }, + { + "name": "label", + "type": 7, + "optional": false + }, + { + "name": "omittedBytes", + "type": 11, + "optional": false + }, + { + "name": "omittedMessages", + "type": 11, + "optional": false + }, + { + "name": "originalMessages", + "type": 11, + "optional": false + }, + { + "name": "retainedMessages", + "type": 11, + "optional": false + }, + { + "name": "sessionId", + "type": 7, + "optional": false + }, + { + "name": "truncated", + "type": 69, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 11, + 68 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 61, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "revision", + "type": 11, + "optional": false + }, + { + "name": "round", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "messageId", + "type": 7, + "optional": false + }, + { + "name": "senderId", + "type": 7, + "optional": false + }, + { + "name": "senderName", + "type": 7, + "optional": false + }, + { + "name": "teamId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 80, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 81, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "canceled" + }, + { + "kind": "union", + "types": [ + 86, + 87 + ] + }, + { + "kind": "literal", + "value": "next-step" + }, + { + "kind": "literal", + "value": "next-turn" + }, + { + "kind": "literal", + "value": "agent/inbox/spliced" + } + ] + } + }, + { + "key": "event:assistant/attempt", + "kind": "event", + "event": "assistant/attempt", + "surface": false, + "digest": "2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 26, + "optional": true + }, + { + "name": "seq", + "type": 2, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "step", + "type": 2, + "optional": false + }, + { + "name": "stream", + "type": 3, + "optional": false + }, + { + "name": "turn", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 10, + 64, + 66 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 6, + "optional": false + }, + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 11, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 12, + 14, + 36, + 39, + 41, + 43, + 60 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 15, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 16, + 18, + 28, + 31, + 33 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "offloaded", + "type": 26, + "optional": true + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "mediaType", + "type": 20, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 25, + "optional": true + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 21, + 22, + 23, + 24 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 29, + "optional": false + }, + { + "name": "type", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 37, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 17, + 27, + 30, + 32, + 34 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 44, + "optional": false + }, + { + "name": "replayState", + "type": 56, + "optional": true + }, + { + "name": "type", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 45, + 48, + 50, + 52, + 54 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 7, + "optional": false + }, + { + "name": "message", + "type": 7, + "optional": false + }, + { + "name": "offloadImages", + "type": 2, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 2, + "optional": true + }, + { + "name": "requestId", + "type": 7, + "optional": true + }, + { + "name": "status", + "type": 2, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 57, + "optional": true + }, + { + "name": "response", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 58 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 61, + "optional": false + }, + { + "name": "usage", + "type": 62, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 2, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 2, + "optional": true + }, + { + "name": "inputTokens", + "type": 2, + "optional": false + }, + { + "name": "outputTokens", + "type": 2, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 2, + "optional": true + }, + { + "name": "totalTokens", + "type": 2, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "texts", + "type": 6, + "optional": false + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 65, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "texts", + "type": 6, + "optional": false + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + }, + { + "kind": "literal", + "value": "assistant/attempt" + } + ] + } + }, + { + "key": "event:assistant/message", + "kind": "event", + "event": "assistant/message", + "surface": true, + "digest": "f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 2, + "optional": true + }, + { + "name": "seq", + "type": 11, + "optional": false + }, + { + "name": "surfaceOp", + "type": 73, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 77, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "interrupted", + "type": 2, + "optional": true + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "step", + "type": 11, + "optional": false + }, + { + "name": "stream", + "type": 30, + "optional": false + }, + { + "name": "turn", + "type": 11, + "optional": false + }, + { + "name": "usage", + "type": 67, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 10, + "optional": false + }, + { + "name": "offloaded", + "type": 2, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 29, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 31 + }, + { + "kind": "union", + "types": [ + 32, + 36, + 69, + 71 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 33, + "optional": false + }, + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "array", + "element": 11 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 37, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 38, + 40, + 42, + 45, + 47, + 49, + 65 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 5, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 43, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 8, + 18, + 21, + 23, + 25 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 50, + "optional": false + }, + { + "name": "replayState", + "type": 62, + "optional": true + }, + { + "name": "type", + "type": 64, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 51, + 54, + 56, + 58, + 60 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 7, + "optional": false + }, + { + "name": "message", + "type": 7, + "optional": false + }, + { + "name": "offloadImages", + "type": 11, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 11, + "optional": true + }, + { + "name": "requestId", + "type": 7, + "optional": true + }, + { + "name": "status", + "type": 11, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 63, + "optional": true + }, + { + "name": "response", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 66, + "optional": false + }, + { + "name": "usage", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 11, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 11, + "optional": true + }, + { + "name": "inputTokens", + "type": 11, + "optional": false + }, + { + "name": "outputTokens", + "type": 11, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 11, + "optional": true + }, + { + "name": "totalTokens", + "type": 11, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "texts", + "type": 33, + "optional": false + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 70, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "texts", + "type": 33, + "optional": false + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + }, + { + "kind": "union", + "types": [ + 74, + 76 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 11, + "optional": false + }, + { + "name": "op", + "type": 75, + "optional": false + }, + { + "name": "startSeq", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "assistant/message" + } + ] + } + }, + { + "key": "event:compaction/summary", + "kind": "event", + "event": "compaction/summary", + "surface": false, + "digest": "86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 4, + "optional": true + }, + { + "name": "seq", + "type": 5, + "optional": false + }, + { + "name": "time", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 29 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 3, + "optional": false + }, + { + "name": "llmStreamCall", + "type": 4, + "optional": false + }, + { + "name": "maxTokens", + "type": 5, + "optional": true + }, + { + "name": "model", + "type": 3, + "optional": false + }, + { + "name": "provider", + "type": 3, + "optional": false + }, + { + "name": "rawOutput", + "type": 6, + "optional": false + }, + { + "name": "shadowedRange", + "type": 26, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 27, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 5, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 3, + "optional": true + }, + { + "name": "summary", + "type": 6, + "optional": false + }, + { + "name": "usage", + "type": 28, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "union", + "types": [ + 8, + 10, + 12, + 14, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 15, + "optional": false + }, + { + "name": "offloaded", + "type": 4, + "optional": true + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 5, + "optional": false + }, + { + "name": "height", + "type": 5, + "optional": false + }, + { + "name": "mediaType", + "type": 16, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 21, + "optional": true + }, + { + "name": "width", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 17, + 18, + 19, + 20 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 5, + "optional": false + }, + { + "name": "width", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 24, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "end", + "type": 5, + "optional": false + }, + { + "name": "start", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 5, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 5, + "optional": true + }, + { + "name": "inputTokens", + "type": 5, + "optional": false + }, + { + "name": "outputTokens", + "type": 5, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 5, + "optional": true + }, + { + "name": "totalTokens", + "type": 5, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 3, + "optional": false + }, + { + "name": "maxTokens", + "type": 5, + "optional": true + }, + { + "name": "model", + "type": 3, + "optional": false + }, + { + "name": "provider", + "type": 3, + "optional": false + }, + { + "name": "rawOutput", + "type": 6, + "optional": true + }, + { + "name": "shadowedRange", + "type": 26, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 27, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 5, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 3, + "optional": true + }, + { + "name": "summary", + "type": 6, + "optional": false + }, + { + "name": "usage", + "type": 28, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "compaction/summary" + } + ] + } + }, + { + "key": "event:session/title-llm-request", + "kind": "event", + "event": "session/title-llm-request", + "surface": false, + "digest": "2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 20, + "optional": true + }, + { + "name": "seq", + "type": 2, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "maxTokens", + "type": 2, + "optional": false + }, + { + "name": "messageSeqs", + "type": 3, + "optional": false + }, + { + "name": "messages", + "type": 4, + "optional": false + }, + { + "name": "route", + "type": 92, + "optional": false + }, + { + "name": "system", + "type": 10, + "optional": false + }, + { + "name": "titleProvider", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 32, + 51, + 56 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "isError", + "type": 29, + "optional": true + }, + { + "name": "role", + "type": 30, + "optional": false + }, + { + "name": "source", + "type": 31, + "optional": false + }, + { + "name": "toolCallId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 8 + }, + { + "kind": "union", + "types": [ + 9, + 12, + 22, + 25, + 27 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 10, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 20, + "optional": true + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 10, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "mediaType", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": true + }, + { + "name": "originalDimensions", + "type": 19, + "optional": true + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 15, + 16, + 17, + 18 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 23, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 10, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 33, + "optional": false + }, + { + "name": "source", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 35, + 40, + 42, + 44, + 46, + 48, + 50 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + }, + { + "name": "sections", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 39 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 52, + "optional": false + }, + { + "name": "source", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "replayState", + "type": 55, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 57, + "optional": false + }, + { + "name": "source", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 31, + 35, + 40, + 42, + 44, + 46, + 48, + 50, + 53, + 59, + 67, + 68, + 70, + 74, + 76, + 83, + 85, + 87, + 89, + 91 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 20, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 10, + "optional": true + }, + { + "name": "changes", + "type": 60, + "optional": false + }, + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 61 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 62, + "optional": false + }, + { + "name": "digest", + "type": 10, + "optional": true + }, + { + "name": "path", + "type": 10, + "optional": false + }, + { + "name": "scope", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 63, + 64, + 65 + ] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 10, + "optional": true + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "rpcId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 10, + "optional": false + }, + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 69, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "ruleId", + "type": 10, + "optional": false + }, + { + "name": "source", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 71, + "optional": false + }, + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "update", + "type": 20, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 72 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 75, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 77, + "optional": false + }, + { + "name": "references", + "type": 78, + "optional": false + }, + { + "name": "version", + "type": 82, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 79 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 2, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 80, + "optional": false + }, + { + "name": "compacted", + "type": 29, + "optional": false + }, + { + "name": "inputIndex", + "type": 2, + "optional": false + }, + { + "name": "label", + "type": 10, + "optional": false + }, + { + "name": "omittedBytes", + "type": 2, + "optional": false + }, + { + "name": "omittedMessages", + "type": 2, + "optional": false + }, + { + "name": "originalMessages", + "type": 2, + "optional": false + }, + { + "name": "retainedMessages", + "type": 2, + "optional": false + }, + { + "name": "sessionId", + "type": 10, + "optional": false + }, + { + "name": "truncated", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 81 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 84, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 86, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 88, + "optional": false + }, + { + "name": "revision", + "type": 2, + "optional": false + }, + { + "name": "round", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 90, + "optional": false + }, + { + "name": "messageId", + "type": 10, + "optional": false + }, + { + "name": "senderId", + "type": 10, + "optional": false + }, + { + "name": "senderName", + "type": 10, + "optional": false + }, + { + "name": "teamId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session/title-llm-request" + } + ] + } + }, + { + "key": "event:system/message", + "kind": "event", + "event": "system/message", + "surface": true, + "digest": "1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 17, + "optional": true + }, + { + "name": "seq", + "type": 10, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 44, + "optional": true + }, + { + "name": "surfaceOp", + "type": 45, + "optional": false + }, + { + "name": "time", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "message", + "type": 2, + "optional": false + }, + { + "name": "step", + "type": 10, + "optional": false + }, + { + "name": "turn", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 9, + "optional": false + }, + { + "name": "offloaded", + "type": 17, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "mediaType", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 16, + "optional": true + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 12, + 13, + 14, + 15 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 28, + 33, + 35, + 37, + 39, + 41, + 43 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 29, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "sections", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 32 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 10 + }, + { + "kind": "union", + "types": [ + 46, + 48 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 10, + "optional": false + }, + { + "name": "op", + "type": 47, + "optional": false + }, + { + "name": "startSeq", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "system/message" + } + ] + } + }, + { + "key": "event:team/message/queued", + "kind": "event", + "event": "team/message/queued", + "surface": false, + "digest": "9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 21, + "optional": true + }, + { + "name": "seq", + "type": 14, + "optional": false + }, + { + "name": "time", + "type": 14, + "optional": false + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "message", + "type": 2, + "optional": false + }, + { + "name": "teamId", + "type": 6, + "optional": false + }, + { + "name": "version", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "senderId", + "type": 6, + "optional": false + }, + { + "name": "senderName", + "type": 6, + "optional": false + }, + { + "name": "targetId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 10, + 12, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 21, + "optional": true + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "mediaType", + "type": 15, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 20, + "optional": true + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 16, + 17, + 18, + 19 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 24, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": 2 + }, + { + "kind": "literal", + "value": "team/message/queued" + } + ] + } + }, + { + "key": "event:tool/ptc-dispatch", + "kind": "event", + "event": "tool/ptc-dispatch", + "surface": false, + "digest": "75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 21, + "optional": true + }, + { + "name": "seq", + "type": 14, + "optional": false + }, + { + "name": "time", + "type": 14, + "optional": false + }, + { + "name": "type", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 2, + "optional": false + }, + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "error", + "type": 26, + "optional": true + }, + { + "name": "isError", + "type": 27, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "parentCallId", + "type": 6, + "optional": false + }, + { + "name": "rootCallId", + "type": 6, + "optional": false + }, + { + "name": "subCallId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 10, + 12, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 21, + "optional": true + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "mediaType", + "type": 15, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 20, + "optional": true + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 16, + 17, + 18, + 19 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 24, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "reason", + "type": 6, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool/ptc-dispatch" + } + ] + } + }, + { + "key": "event:tool/result", + "kind": "event", + "event": "tool/result", + "surface": true, + "digest": "f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 20, + "optional": true + }, + { + "name": "seq", + "type": 13, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 34, + "optional": true + }, + { + "name": "surfaceOp", + "type": 35, + "optional": false + }, + { + "name": "time", + "type": 13, + "optional": false + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "error", + "type": 2, + "optional": true + }, + { + "name": "message", + "type": 4, + "optional": false + }, + { + "name": "meta", + "type": 30, + "optional": true + }, + { + "name": "step", + "type": 13, + "optional": false + }, + { + "name": "turn", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "reason", + "type": 3, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "isError", + "type": 27, + "optional": true + }, + { + "name": "role", + "type": 28, + "optional": false + }, + { + "name": "source", + "type": 29, + "optional": false + }, + { + "name": "toolCallId", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "union", + "types": [ + 7, + 9, + 11, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 12, + "optional": false + }, + { + "name": "offloaded", + "type": 20, + "optional": true + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "mediaType", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 19, + "optional": true + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 15, + 16, + 17, + 18 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 25, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 3, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 3, + 13, + 27, + 31, + 32, + 33 + ] + }, + { + "kind": "array", + "element": 30 + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "object", + "properties": [], + "indices": [ + { + "key": 3, + "value": 30 + } + ] + }, + { + "kind": "array", + "element": 13 + }, + { + "kind": "union", + "types": [ + 36, + 38 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 13, + "optional": false + }, + { + "name": "op", + "type": 37, + "optional": false + }, + { + "name": "startSeq", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "tool/result" + } + ] + } + }, { "key": "event:turn/end", "kind": "event", @@ -409,6 +6906,1123 @@ } ] } + }, + { + "key": "event:user/message", + "kind": "event", + "event": "user/message", + "surface": true, + "digest": "5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 16, + "optional": true + }, + { + "name": "seq", + "type": 9, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 82, + "optional": true + }, + { + "name": "surfaceOp", + "type": 83, + "optional": false + }, + { + "name": "time", + "type": 9, + "optional": false + }, + { + "name": "type", + "type": 86, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 27, + 36, + 38, + 39, + 42, + 47, + 49, + 54, + 55, + 56, + 58, + 60, + 61, + 69, + 71, + 73, + 75, + 77, + 80, + 81 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 16, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 5, + "optional": true + }, + { + "name": "changes", + "type": 28, + "optional": false + }, + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 30, + "optional": false + }, + { + "name": "digest", + "type": 5, + "optional": true + }, + { + "name": "path", + "type": 5, + "optional": false + }, + { + "name": "scope", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 31, + 32, + 33 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 5, + "optional": true + }, + { + "name": "kind", + "type": 25, + "optional": false + }, + { + "name": "rpcId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 5, + "optional": false + }, + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "ruleId", + "type": 5, + "optional": false + }, + { + "name": "source", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 43, + "optional": false + }, + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "update", + "type": 16, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 44 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 50, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "sections", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 53 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 62, + "optional": false + }, + { + "name": "references", + "type": 63, + "optional": false + }, + { + "name": "version", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 64 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 9, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 65, + "optional": false + }, + { + "name": "compacted", + "type": 67, + "optional": false + }, + { + "name": "inputIndex", + "type": 9, + "optional": false + }, + { + "name": "label", + "type": 5, + "optional": false + }, + { + "name": "omittedBytes", + "type": 9, + "optional": false + }, + { + "name": "omittedMessages", + "type": 9, + "optional": false + }, + { + "name": "originalMessages", + "type": 9, + "optional": false + }, + { + "name": "retainedMessages", + "type": 9, + "optional": false + }, + { + "name": "sessionId", + "type": 5, + "optional": false + }, + { + "name": "truncated", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 66 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "revision", + "type": 9, + "optional": false + }, + { + "name": "round", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "messageId", + "type": 5, + "optional": false + }, + { + "name": "senderId", + "type": 5, + "optional": false + }, + { + "name": "senderName", + "type": 5, + "optional": false + }, + { + "name": "teamId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "model", + "type": 5, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "replayState", + "type": 79, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 9 + }, + { + "kind": "union", + "types": [ + 84, + 85 + ] + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 9, + "optional": false + }, + { + "name": "op", + "type": 32, + "optional": false + }, + { + "name": "startSeq", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user/message" + } + ] + } } ], "types": [] diff --git a/docs/persistence-changes/2026-09-16-session-format-v4.zh.md b/docs/persistence-changes/2026-09-16-session-format-v4.zh.md index 82956ba536..b5eebdf482 100644 --- a/docs/persistence-changes/2026-09-16-session-format-v4.zh.md +++ b/docs/persistence-changes/2026-09-16-session-format-v4.zh.md @@ -9,7 +9,7 @@ kind: persistence-change ## 概述 -将 V4 集成写入方声明的 SessionHeader.version 从 3 推进到 4,并向 turn/end.reason 添加 forked 变体。 +将 V4 集成写入方声明的 SessionHeader.version 从 3 推进到 4,记录一等 tool 角色结果,并向 turn/end.reason 添加 forked 变体。 ## 目录 @@ -30,29 +30,65 @@ changes: previous: "2026-09-11-initial" after: "1a3440e3577382704d42a6263aa463504eb74c566734a55e9503a63efcd02445" decision: version-bump + - root: "event:agent/inbox/spliced" + previous: "2026-09-14-image-offload" + after: "cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a" + decision: version-bump + - root: "event:assistant/attempt" + previous: "2026-09-14-image-offload" + after: "2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2" + decision: version-bump + - root: "event:assistant/message" + previous: "2026-09-14-image-offload" + after: "f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58" + decision: version-bump + - root: "event:compaction/summary" + previous: "2026-09-14-image-offload" + after: "86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559" + decision: version-bump + - root: "event:session/title-llm-request" + previous: "2026-09-14-image-offload" + after: "2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0" + decision: version-bump + - root: "event:system/message" + previous: "2026-09-14-image-offload" + after: "1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300" + decision: version-bump + - root: "event:team/message/queued" + previous: "2026-09-14-image-offload" + after: "9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240" + decision: version-bump + - root: "event:tool/ptc-dispatch" + previous: "2026-09-14-image-offload" + after: "75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185" + decision: version-bump + - root: "event:tool/result" + previous: "2026-09-14-image-offload" + after: "f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c" + decision: version-bump - root: "event:turn/end" previous: "2026-09-14-image-offload" after: "0f8512903d94f57a4748fa1a2092e64342856796684e6b8343db685b192745ce" decision: version-bump + - root: "event:user/message" + previous: "2026-09-14-image-offload" + after: "5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6" + decision: version-bump ``` ## 兼容性 -[V3 到 V4 迁移](../../packages/session/session-format-v3-to-v4/README.zh.md#v3-to-v4-specification)推进 header,保留每个已接纳源事件与继承切点,并根据同一持久化根目录中保留的直接子 Session 日志追加缺失的父级 `subagent/catalog` 记录。历史正文恢复要求显式提供子日志证据集合;没有可供补全的子日志时也须传入空集合。缺少必需的 descriptor 或身份冲突会拒绝迁移,且不发布后继;已有 catalog 事实保持不变。链接中的规范负责 descriptor 准入与确定性追加顺序。 +工具角色声明会改变十个事件根,因为 inbox 条目、消息事件、compaction 摘要、标题请求、团队消息和 PTC dispatch 嵌入了共享的 `Message` 或 `ContentBlock` 声明。从联合中移除 `tool-result` 并按角色细化消息,会改变这些可达 schema,并非新增十套独立事件协议。`turn/end` 的变更单独记录 forked reason;`SessionHeader` 记录版本递增。 -历史读取打开在内存中准备结果。写入打开在重新校验子项成员与修订后,将当前后继发布到未修改的前代文件旁。已写入的 V4 文件不会重新运行该迁入边,因此未发布集成使用可丢弃的 home。Delivery generation 校验防止历史确认成为有效的 V4 水位。V3 读取方拒绝更新的 generation;[V3 schema 参考](historical-formats/v3.zh.md)保留原声明。 +[原生 V4 校验决策](../../.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.zh.md) 负责说明这些当前字段所需的读取接纳规则。 -同一个未发布迁移向 `turn/end.reason` 添加 `forked`。精确切点的 fork 在继承标记之后追加子会话自有的错误结果和结束事件。V4 接纳经过校验、使用确定性分支 ID 和文案的未启动 fork 结果;已发布的 V0–V3 校验器和已记录的前驱代际保持不变。 +V3-to-V4 迁移将已发布的 user 角色工具结果提升为 tool 角色消息,包含必需的 toolCallId 和可选的 isError。工具结果包装不再属于内容块联合。迁移保留每个已接纳源事件和继承切分点,并根据同一持久化根目录中保留的直属子 Session 日志追加缺失的父级 subagent/catalog 记录。历史正文恢复要求显式提供子日志证据集合;没有可供补全的子日志时也须传入空集合。缺少必需的 descriptor 或身份冲突会拒绝迁移且不发布后继;已有 catalog 事实保持不变。历史读取打开在内存中准备结果。写入打开在重新校验子项成员与修订后,将当前后继发布到未修改的前代文件旁。Delivery generation 校验防止历史确认成为有效的 V4 水位。V3 读取方拒绝更新的 generation。同一个未发布迁移向 turn/end.reason 添加 forked。精确切点的 fork 在继承标记之后追加子会话自有的错误结果和结束事件。V4 接纳经过校验、使用确定性分支 ID 和文案的未启动 fork 结果;已发布的 V0–V3 校验器和已记录的前驱代际保持不变。 ## 验证 -`pnpm exec vitest run packages/session/session-format-v3-to-v4/tests packages/session/session-format-catalog/tests packages/session/session-persistence-jsonl/tests/catalog-migration.spec.ts` 的九个文件共 140 个测试通过,一个测试跳过。这些测试覆盖 catalog 补全、继承切点、子日志证据拒绝,以及 JSONL 准备与发布。 - -写入器变更前,`pnpm run verify-persistence-catalog` 通过,且 `pnpm run verify-persistence-formats --archive 3` 已捕获 V3 schema。V4 header schema digest 保持不变。 - -精确切点 fork 集成后,聚焦的 Session、agent-loop、Session Controller、V4、chat-view 和 compaction 测试共 63 个文件、1,523 个测试通过。V4 fork 测试确认编码、解码和恢复保留原始 ID 与文本,拒绝格式错误的结果,并验证嵌套继承切点。 +精确切点 fork 集成后,聚焦的 Session、agent-loop、Session Controller、V4、chat-view 和 compaction 测试共 63 个文件、1,523 个测试通过。V4 fork 测试确认编码、解码和恢复保留原始 ID 与文本,拒绝格式错误的结果,并验证嵌套继承切点。工具角色迁移测试和 SDK 快照刷新也在原始变更中通过;构建后的 Python runtime sdk-snapshot 场景通过,定向 pi-ai 与 auto-review 覆盖率检查通过 351 个测试,三个受影响模块覆盖率均为 100%。 ## 开发备注 diff --git a/docs/persistence-changes/historical-formats/README.i18n.yaml b/docs/persistence-changes/historical-formats/README.i18n.yaml index 1c87b479bd..5a9af7ece4 100644 --- a/docs/persistence-changes/historical-formats/README.i18n.yaml +++ b/docs/persistence-changes/historical-formats/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/persistence-changes/historical-formats/README.md -README.md: 16ed3d6110315d476dd6075fd2a75973f5971095 -README.zh.md: f6b715ffc52e1635daa7488316d34b5608ae9f25 +README.md: 89f9a70ea00c6ef5adc61ba57806aa7ed7be6265 +README.zh.md: 5b87b61b5a801e349591bdb1b1ca0d263c3c57b6 diff --git a/docs/persistence-changes/historical-formats/README.md b/docs/persistence-changes/historical-formats/README.md index 16ed3d6110..89f9a70ea0 100644 --- a/docs/persistence-changes/historical-formats/README.md +++ b/docs/persistence-changes/historical-formats/README.md @@ -32,7 +32,7 @@ The index is generated from validated snapshots and the current writer constant. | 1 | PR #3349 | [V1](v1.md) | [JSON](v1.schema.json) | 54 / 415 | | 2 | `dsh-v0.1.3-alpha.2` | [V2](v2.md) | [JSON](v2.schema.json) | 56 / 435 | | 3 | PR #4320 | [V3](v3.md) | [JSON](v3.schema.json) | 60 / 467 | -| 4 | Current checkout | [Current catalog](../../persistence-catalog.md) | [JSON](../../persistence-schema.json) | 61 / 472 | +| 4 | Current checkout | [Current catalog](../../persistence-catalog.md) | [JSON](../../persistence-schema.json) | 61 / 468 | diff --git a/docs/persistence-changes/historical-formats/README.zh.md b/docs/persistence-changes/historical-formats/README.zh.md index f6b715ffc5..5b87b61b5a 100644 --- a/docs/persistence-changes/historical-formats/README.zh.md +++ b/docs/persistence-changes/historical-formats/README.zh.md @@ -32,7 +32,7 @@ description: "查找从 V0 到工作区写入器版本的每个 Session 格式 | 1 | PR #3349 | [V1](v1.zh.md) | [JSON](v1.schema.json) | 54 / 415 | | 2 | `dsh-v0.1.3-alpha.2` | [V2](v2.zh.md) | [JSON](v2.schema.json) | 56 / 435 | | 3 | PR #4320 | [V3](v3.zh.md) | [JSON](v3.schema.json) | 60 / 467 | -| 4 | 当前工作树 | [当前目录](../../persistence-catalog.zh.md) | [JSON](../../persistence-schema.json) | 61 / 472 | +| 4 | 当前工作树 | [当前目录](../../persistence-catalog.zh.md) | [JSON](../../persistence-schema.json) | 61 / 468 | diff --git a/docs/persistence-schema.json b/docs/persistence-schema.json index dd34ff78c7..df908a9927 100644 --- a/docs/persistence-schema.json +++ b/docs/persistence-schema.json @@ -406,7 +406,7 @@ "kind": "event", "event": "agent/inbox/spliced", "surface": false, - "digest": "646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f", + "digest": "cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a", "schema": { "root": 0, "nodes": [ @@ -435,7 +435,7 @@ }, { "name": "type", - "type": 90, + "type": 88, "optional": false } ], @@ -451,7 +451,7 @@ }, { "name": "outcome", - "type": 86, + "type": 84, "optional": true }, { @@ -466,7 +466,7 @@ }, { "name": "target", - "type": 87, + "type": 85, "optional": false } ], @@ -491,12 +491,12 @@ }, { "name": "role", - "type": 30, + "type": 27, "optional": false }, { "name": "source", - "type": 31, + "type": 28, "optional": false } ], @@ -513,8 +513,7 @@ 9, 20, 23, - 26, - 28 + 25 ] }, { @@ -636,11 +635,11 @@ }, { "kind": "literal", - "value": "image/webp" + "value": "image/gif" }, { "kind": "literal", - "value": "image/gif" + "value": "image/webp" }, { "kind": "object", @@ -707,40 +706,6 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -751,7 +716,7 @@ }, { "name": "type", - "type": 27, + "type": 24, "optional": false } ], @@ -771,7 +736,7 @@ }, { "name": "type", - "type": 29, + "type": 26, "optional": false } ], @@ -788,26 +753,26 @@ { "kind": "union", "types": [ - 32, + 29, + 38, + 40, 41, - 43, 44, - 47, - 52, - 54, - 59, + 49, + 51, + 56, + 57, + 58, 60, - 61, + 62, 63, - 65, - 66, + 71, 73, 75, 77, 79, - 81, - 84, - 85 + 82, + 83 ] }, { @@ -825,17 +790,17 @@ }, { "name": "changes", - "type": 33, + "type": 30, "optional": false }, { "name": "form", - "type": 39, + "type": 36, "optional": false }, { "name": "kind", - "type": 40, + "type": 37, "optional": false } ], @@ -843,14 +808,14 @@ }, { "kind": "array", - "element": 34 + "element": 31 }, { "kind": "object", "properties": [ { "name": "action", - "type": 35, + "type": 32, "optional": false }, { @@ -874,9 +839,9 @@ { "kind": "union", "types": [ - 36, - 37, - 38 + 33, + 34, + 35 ] }, { @@ -909,7 +874,7 @@ }, { "name": "kind", - "type": 42, + "type": 39, "optional": false } ], @@ -929,7 +894,7 @@ }, { "name": "kind", - "type": 30, + "type": 27, "optional": false }, { @@ -950,12 +915,12 @@ }, { "name": "form", - "type": 45, + "type": 42, "optional": false }, { "name": "kind", - "type": 46, + "type": 43, "optional": false }, { @@ -994,17 +959,17 @@ "properties": [ { "name": "entries", - "type": 48, + "type": 45, "optional": false }, { "name": "form", - "type": 50, + "type": 47, "optional": false }, { "name": "kind", - "type": 51, + "type": 48, "optional": false }, { @@ -1017,7 +982,7 @@ }, { "kind": "array", - "element": 49 + "element": 46 }, { "kind": "object", @@ -1048,12 +1013,12 @@ "properties": [ { "name": "form", - "type": 39, + "type": 36, "optional": false }, { "name": "kind", - "type": 53, + "type": 50, "optional": false }, { @@ -1073,12 +1038,12 @@ "properties": [ { "name": "form", - "type": 55, + "type": 52, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1088,7 +1053,7 @@ }, { "name": "sections", - "type": 57, + "type": 54, "optional": false } ], @@ -1104,7 +1069,7 @@ }, { "kind": "array", - "element": 58 + "element": 55 }, { "kind": "object", @@ -1127,12 +1092,12 @@ "properties": [ { "name": "form", - "type": 45, + "type": 42, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1153,12 +1118,12 @@ "properties": [ { "name": "form", - "type": 39, + "type": 36, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1174,12 +1139,12 @@ "properties": [ { "name": "form", - "type": 62, + "type": 59, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1199,12 +1164,12 @@ "properties": [ { "name": "form", - "type": 64, + "type": 61, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1224,12 +1189,12 @@ "properties": [ { "name": "form", - "type": 50, + "type": 47, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1245,22 +1210,22 @@ "properties": [ { "name": "form", - "type": 62, + "type": 59, "optional": false }, { "name": "kind", - "type": 67, + "type": 64, "optional": false }, { "name": "references", - "type": 68, + "type": 65, "optional": false }, { "name": "version", - "type": 72, + "type": 70, "optional": false } ], @@ -1272,7 +1237,7 @@ }, { "kind": "array", - "element": 69 + "element": 66 }, { "kind": "object", @@ -1284,12 +1249,12 @@ }, { "name": "capturedThroughSeq", - "type": 70, + "type": 67, "optional": false }, { "name": "compacted", - "type": 24, + "type": 69, "optional": false }, { @@ -1329,7 +1294,7 @@ }, { "name": "truncated", - "type": 24, + "type": 69, "optional": false } ], @@ -1339,13 +1304,17 @@ "kind": "union", "types": [ 11, - 71 + 68 ] }, { "kind": "primitive", "type": "null" }, + { + "kind": "primitive", + "type": "boolean" + }, { "kind": "literal", "value": 1 @@ -1355,12 +1324,12 @@ "properties": [ { "name": "form", - "type": 45, + "type": 42, "optional": false }, { "name": "kind", - "type": 74, + "type": 72, "optional": false }, { @@ -1385,12 +1354,12 @@ "properties": [ { "name": "form", - "type": 64, + "type": 61, "optional": false }, { "name": "kind", - "type": 76, + "type": 74, "optional": false }, { @@ -1415,7 +1384,7 @@ }, { "name": "kind", - "type": 78, + "type": 76, "optional": false }, { @@ -1440,7 +1409,7 @@ "properties": [ { "name": "kind", - "type": 80, + "type": 78, "optional": false }, { @@ -1475,7 +1444,7 @@ "properties": [ { "name": "kind", - "type": 82, + "type": 80, "optional": false }, { @@ -1490,7 +1459,7 @@ }, { "name": "replayState", - "type": 83, + "type": 81, "optional": true } ], @@ -1509,7 +1478,7 @@ "properties": [ { "name": "kind", - "type": 56, + "type": 53, "optional": false }, { @@ -1525,7 +1494,7 @@ "properties": [ { "name": "kind", - "type": 30, + "type": 27, "optional": false } ], @@ -1538,8 +1507,8 @@ { "kind": "union", "types": [ - 88, - 89 + 86, + 87 ] }, { @@ -1837,7 +1806,7 @@ "kind": "event", "event": "assistant/attempt", "surface": false, - "digest": "c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e", + "digest": "2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2", "schema": { "root": 0, "nodes": [ @@ -1866,7 +1835,7 @@ }, { "name": "type", - "type": 72, + "type": 68, "optional": false } ], @@ -1906,8 +1875,8 @@ "types": [ 5, 10, - 68, - 70 + 64, + 66 ] }, { @@ -1982,7 +1951,7 @@ }, { "name": "type", - "type": 67, + "type": 63, "optional": false } ], @@ -1993,11 +1962,11 @@ "types": [ 12, 14, - 40, + 36, + 39, + 41, 43, - 45, - 47, - 64 + 60 ] }, { @@ -2050,7 +2019,7 @@ }, { "name": "type", - "type": 39, + "type": 35, "optional": false } ], @@ -2063,8 +2032,7 @@ 18, 28, 31, - 35, - 37 + 33 ] }, { @@ -2249,44 +2217,6 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 32, - "optional": false - }, - { - "name": "isError", - "type": 33, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 15 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -2297,7 +2227,7 @@ }, { "name": "type", - "type": 36, + "type": 32, "optional": false } ], @@ -2317,7 +2247,7 @@ }, { "name": "type", - "type": 38, + "type": 34, "optional": false } ], @@ -2336,7 +2266,7 @@ "properties": [ { "name": "blockType", - "type": 41, + "type": 37, "optional": false }, { @@ -2346,7 +2276,7 @@ }, { "name": "type", - "type": 42, + "type": 38, "optional": false } ], @@ -2358,9 +2288,8 @@ 17, 27, 30, - 34, - 36, - 38 + 32, + 34 ] }, { @@ -2382,7 +2311,7 @@ }, { "name": "type", - "type": 44, + "type": 40, "optional": false } ], @@ -2407,7 +2336,7 @@ }, { "name": "type", - "type": 46, + "type": 42, "optional": false } ], @@ -2422,17 +2351,17 @@ "properties": [ { "name": "reason", - "type": 48, + "type": 44, "optional": false }, { "name": "replayState", - "type": 60, + "type": 56, "optional": true }, { "name": "type", - "type": 63, + "type": 59, "optional": false } ], @@ -2441,11 +2370,11 @@ { "kind": "union", "types": [ - 49, + 45, + 48, + 50, 52, - 54, - 56, - 58 + 54 ] }, { @@ -2453,12 +2382,12 @@ "properties": [ { "name": "failure", - "type": 50, + "type": 46, "optional": false }, { "name": "kind", - "type": 51, + "type": 47, "optional": false } ], @@ -2509,12 +2438,12 @@ "properties": [ { "name": "failure", - "type": 50, + "type": 46, "optional": false }, { "name": "kind", - "type": 53, + "type": 49, "optional": false } ], @@ -2529,7 +2458,7 @@ "properties": [ { "name": "kind", - "type": 55, + "type": 51, "optional": false } ], @@ -2544,7 +2473,7 @@ "properties": [ { "name": "kind", - "type": 57, + "type": 53, "optional": false } ], @@ -2559,7 +2488,7 @@ "properties": [ { "name": "kind", - "type": 59, + "type": 55, "optional": false } ], @@ -2574,12 +2503,12 @@ "properties": [ { "name": "blocks", - "type": 61, + "type": 57, "optional": true }, { "name": "response", - "type": 62, + "type": 58, "optional": false } ], @@ -2587,7 +2516,7 @@ }, { "kind": "array", - "element": 62 + "element": 58 }, { "kind": "opaque", @@ -2602,12 +2531,12 @@ "properties": [ { "name": "type", - "type": 65, + "type": 61, "optional": false }, { "name": "usage", - "type": 66, + "type": 62, "optional": false } ], @@ -2682,7 +2611,7 @@ }, { "name": "type", - "type": 69, + "type": 65, "optional": false } ], @@ -2717,7 +2646,7 @@ }, { "name": "type", - "type": 71, + "type": 67, "optional": false } ], @@ -2739,7 +2668,7 @@ "kind": "event", "event": "assistant/message", "surface": true, - "digest": "1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d", + "digest": "f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58", "schema": { "root": 0, "nodes": [ @@ -2763,7 +2692,7 @@ }, { "name": "surfaceOp", - "type": 76, + "type": 73, "optional": false }, { @@ -2773,7 +2702,7 @@ }, { "name": "type", - "type": 80, + "type": 77, "optional": false } ], @@ -2799,7 +2728,7 @@ }, { "name": "stream", - "type": 33, + "type": 30, "optional": false }, { @@ -2809,7 +2738,7 @@ }, { "name": "usage", - "type": 70, + "type": 67, "optional": true } ], @@ -2834,12 +2763,12 @@ }, { "name": "role", - "type": 29, + "type": 26, "optional": false }, { "name": "source", - "type": 30, + "type": 27, "optional": false } ], @@ -2856,8 +2785,7 @@ 9, 19, 22, - 25, - 27 + 24 ] }, { @@ -3046,40 +2974,6 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "isError", - "type": 23, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -3090,7 +2984,7 @@ }, { "name": "type", - "type": 26, + "type": 23, "optional": false } ], @@ -3110,7 +3004,7 @@ }, { "name": "type", - "type": 28, + "type": 25, "optional": false } ], @@ -3129,7 +3023,7 @@ "properties": [ { "name": "kind", - "type": 31, + "type": 28, "optional": false }, { @@ -3144,7 +3038,7 @@ }, { "name": "replayState", - "type": 32, + "type": 29, "optional": true } ], @@ -3160,15 +3054,15 @@ }, { "kind": "array", - "element": 34 + "element": 31 }, { "kind": "union", "types": [ - 35, - 39, - 72, - 74 + 32, + 36, + 69, + 71 ] }, { @@ -3176,12 +3070,12 @@ "properties": [ { "name": "args", - "type": 36, + "type": 33, "optional": false }, { "name": "dt", - "type": 37, + "type": 34, "optional": false }, { @@ -3206,7 +3100,7 @@ }, { "name": "type", - "type": 38, + "type": 35, "optional": false } ], @@ -3229,7 +3123,7 @@ "properties": [ { "name": "chunk", - "type": 40, + "type": 37, "optional": false }, { @@ -3239,7 +3133,7 @@ }, { "name": "type", - "type": 71, + "type": 68, "optional": false } ], @@ -3248,13 +3142,13 @@ { "kind": "union", "types": [ - 41, - 43, + 38, + 40, + 42, 45, - 48, - 50, - 52, - 68 + 47, + 49, + 65 ] }, { @@ -3282,7 +3176,7 @@ }, { "name": "type", - "type": 42, + "type": 39, "optional": false } ], @@ -3307,7 +3201,7 @@ }, { "name": "type", - "type": 44, + "type": 41, "optional": false } ], @@ -3322,7 +3216,7 @@ "properties": [ { "name": "blockType", - "type": 46, + "type": 43, "optional": false }, { @@ -3332,7 +3226,7 @@ }, { "name": "type", - "type": 47, + "type": 44, "optional": false } ], @@ -3344,9 +3238,8 @@ 8, 18, 21, - 24, - 26, - 28 + 23, + 25 ] }, { @@ -3368,7 +3261,7 @@ }, { "name": "type", - "type": 49, + "type": 46, "optional": false } ], @@ -3393,7 +3286,7 @@ }, { "name": "type", - "type": 51, + "type": 48, "optional": false } ], @@ -3408,17 +3301,17 @@ "properties": [ { "name": "reason", - "type": 53, + "type": 50, "optional": false }, { "name": "replayState", - "type": 65, + "type": 62, "optional": true }, { "name": "type", - "type": 67, + "type": 64, "optional": false } ], @@ -3427,11 +3320,11 @@ { "kind": "union", "types": [ + 51, 54, - 57, - 59, - 61, - 63 + 56, + 58, + 60 ] }, { @@ -3439,12 +3332,12 @@ "properties": [ { "name": "failure", - "type": 55, + "type": 52, "optional": false }, { "name": "kind", - "type": 56, + "type": 53, "optional": false } ], @@ -3495,12 +3388,12 @@ "properties": [ { "name": "failure", - "type": 55, + "type": 52, "optional": false }, { "name": "kind", - "type": 58, + "type": 55, "optional": false } ], @@ -3515,7 +3408,7 @@ "properties": [ { "name": "kind", - "type": 60, + "type": 57, "optional": false } ], @@ -3530,7 +3423,7 @@ "properties": [ { "name": "kind", - "type": 62, + "type": 59, "optional": false } ], @@ -3545,7 +3438,7 @@ "properties": [ { "name": "kind", - "type": 64, + "type": 61, "optional": false } ], @@ -3560,12 +3453,12 @@ "properties": [ { "name": "blocks", - "type": 66, + "type": 63, "optional": true }, { "name": "response", - "type": 32, + "type": 29, "optional": false } ], @@ -3573,7 +3466,7 @@ }, { "kind": "array", - "element": 32 + "element": 29 }, { "kind": "literal", @@ -3584,12 +3477,12 @@ "properties": [ { "name": "type", - "type": 69, + "type": 66, "optional": false }, { "name": "usage", - "type": 70, + "type": 67, "optional": false } ], @@ -3644,7 +3537,7 @@ "properties": [ { "name": "dt", - "type": 37, + "type": 34, "optional": false }, { @@ -3654,7 +3547,7 @@ }, { "name": "texts", - "type": 36, + "type": 33, "optional": false }, { @@ -3664,7 +3557,7 @@ }, { "name": "type", - "type": 73, + "type": 70, "optional": false } ], @@ -3679,7 +3572,7 @@ "properties": [ { "name": "dt", - "type": 37, + "type": 34, "optional": false }, { @@ -3689,7 +3582,7 @@ }, { "name": "texts", - "type": 36, + "type": 33, "optional": false }, { @@ -3699,7 +3592,7 @@ }, { "name": "type", - "type": 75, + "type": 72, "optional": false } ], @@ -3712,8 +3605,8 @@ { "kind": "union", "types": [ - 77, - 79 + 74, + 76 ] }, { @@ -3726,7 +3619,7 @@ }, { "name": "op", - "type": 78, + "type": 75, "optional": false }, { @@ -4240,7 +4133,7 @@ "kind": "event", "event": "compaction/summary", "surface": false, - "digest": "f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59", + "digest": "86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559", "schema": { "root": 0, "nodes": [ @@ -4269,7 +4162,7 @@ }, { "name": "type", - "type": 33, + "type": 30, "optional": false } ], @@ -4279,7 +4172,7 @@ "kind": "union", "types": [ 2, - 32 + 29 ] }, { @@ -4317,12 +4210,12 @@ }, { "name": "shadowedRange", - "type": 29, + "type": 26, "optional": false }, { "name": "shadowedSeqs", - "type": 30, + "type": 27, "optional": false }, { @@ -4342,7 +4235,7 @@ }, { "name": "usage", - "type": 31, + "type": 28, "optional": true } ], @@ -4368,47 +4261,12 @@ "kind": "union", "types": [ 8, - 11, - 13, - 15, - 17, - 26 + 10, + 12, + 14, + 23 ] }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "isError", - "type": 9, - "optional": true - }, - { - "name": "toolCallId", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -4419,7 +4277,7 @@ }, { "name": "type", - "type": 12, + "type": 9, "optional": false } ], @@ -4439,7 +4297,7 @@ }, { "name": "type", - "type": 14, + "type": 11, "optional": false } ], @@ -4469,7 +4327,7 @@ }, { "name": "type", - "type": 16, + "type": 13, "optional": false } ], @@ -4484,7 +4342,7 @@ "properties": [ { "name": "attachment", - "type": 18, + "type": 15, "optional": false }, { @@ -4494,7 +4352,7 @@ }, { "name": "type", - "type": 25, + "type": 22, "optional": false } ], @@ -4520,7 +4378,7 @@ }, { "name": "mediaType", - "type": 19, + "type": 16, "optional": false }, { @@ -4530,7 +4388,7 @@ }, { "name": "originalDimensions", - "type": 24, + "type": 21, "optional": true }, { @@ -4544,10 +4402,10 @@ { "kind": "union", "types": [ - 20, - 21, - 22, - 23 + 17, + 18, + 19, + 20 ] }, { @@ -4591,12 +4449,12 @@ "properties": [ { "name": "attachment", - "type": 27, + "type": 24, "optional": false }, { "name": "type", - "type": 28, + "type": 25, "optional": false } ], @@ -4713,12 +4571,12 @@ }, { "name": "shadowedRange", - "type": 29, + "type": 26, "optional": false }, { "name": "shadowedSeqs", - "type": 30, + "type": 27, "optional": false }, { @@ -4738,7 +4596,7 @@ }, { "name": "usage", - "type": 31, + "type": 28, "optional": true } ], @@ -7299,7 +7157,7 @@ "kind": "event", "event": "session/title-llm-request", "surface": false, - "digest": "e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d", + "digest": "2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0", "schema": { "root": 0, "nodes": [ @@ -7313,7 +7171,7 @@ }, { "name": "ignorable", - "type": 19, + "type": 20, "optional": true }, { @@ -7328,7 +7186,7 @@ }, { "name": "type", - "type": 91, + "type": 93, "optional": false } ], @@ -7354,17 +7212,17 @@ }, { "name": "route", - "type": 90, + "type": 92, "optional": false }, { "name": "system", - "type": 9, + "type": 10, "optional": false }, { "name": "titleProvider", - "type": 9, + "type": 10, "optional": false } ], @@ -7382,27 +7240,46 @@ "kind": "array", "element": 5 }, + { + "kind": "union", + "types": [ + 6, + 32, + 51, + 56 + ] + }, { "kind": "object", "properties": [ { "name": "content", - "type": 6, + "type": 7, "optional": false }, { "name": "id", - "type": 9, + "type": 10, "optional": false }, + { + "name": "isError", + "type": 29, + "optional": true + }, { "name": "role", - "type": 31, + "type": 30, "optional": false }, { "name": "source", - "type": 35, + "type": 31, + "optional": false + }, + { + "name": "toolCallId", + "type": 10, "optional": false } ], @@ -7410,17 +7287,16 @@ }, { "kind": "array", - "element": 7 + "element": 8 }, { "kind": "union", "types": [ - 8, - 11, - 21, - 24, - 27, - 29 + 9, + 12, + 22, + 25, + 27 ] }, { @@ -7428,22 +7304,22 @@ "properties": [ { "name": "arguments", - "type": 9, + "type": 10, "optional": false }, { "name": "id", - "type": 9, + "type": 10, "optional": false }, { "name": "name", - "type": 9, + "type": 10, "optional": false }, { "name": "type", - "type": 10, + "type": 11, "optional": false } ], @@ -7462,17 +7338,17 @@ "properties": [ { "name": "attachment", - "type": 12, + "type": 13, "optional": false }, { "name": "offloaded", - "type": 19, + "type": 20, "optional": true }, { "name": "type", - "type": 20, + "type": 21, "optional": false } ], @@ -7483,7 +7359,7 @@ "properties": [ { "name": "attachmentId", - "type": 9, + "type": 10, "optional": false }, { @@ -7498,17 +7374,17 @@ }, { "name": "mediaType", - "type": 13, + "type": 14, "optional": false }, { "name": "name", - "type": 9, + "type": 10, "optional": true }, { "name": "originalDimensions", - "type": 18, + "type": 19, "optional": true }, { @@ -7522,10 +7398,10 @@ { "kind": "union", "types": [ - 14, 15, 16, - 17 + 17, + 18 ] }, { @@ -7573,12 +7449,12 @@ "properties": [ { "name": "attachment", - "type": 22, + "type": 23, "optional": false }, { "name": "type", - "type": 23, + "type": 24, "optional": false } ], @@ -7589,7 +7465,7 @@ "properties": [ { "name": "attachmentId", - "type": 9, + "type": 10, "optional": false }, { @@ -7599,7 +7475,7 @@ }, { "name": "name", - "type": 9, + "type": 10, "optional": false } ], @@ -7613,18 +7489,8 @@ "kind": "object", "properties": [ { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "isError", - "type": 25, - "optional": true - }, - { - "name": "toolCallId", - "type": 9, + "name": "text", + "type": 10, "optional": false }, { @@ -7635,30 +7501,6 @@ ], "indices": [] }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "reasoning" @@ -7668,12 +7510,12 @@ "properties": [ { "name": "text", - "type": 9, + "type": 10, "optional": false }, { "name": "type", - "type": 30, + "type": 28, "optional": false } ], @@ -7684,154 +7526,8 @@ "value": "text" }, { - "kind": "union", - "types": [ - 32, - 33, - 34 - ] - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 36, - 45, - 47, - 48, - 51, - 56, - 58, - 63, - 64, - 65, - 67, - 69, - 70, - 77, - 79, - 81, - 83, - 85, - 88, - 89 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 19, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 9, - "optional": true - }, - { - "name": "changes", - "type": 37, - "optional": false - }, - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 38 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 39, - "optional": false - }, - { - "name": "digest", - "type": 9, - "optional": true - }, - { - "name": "path", - "type": 9, - "optional": false - }, - { - "name": "scope", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 40, - 41, - 42 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 9, - "optional": false - }, - { - "name": "kind", - "type": 46, - "optional": false - } - ], - "indices": [] + "kind": "primitive", + "type": "boolean" }, { "kind": "literal", @@ -7841,18 +7537,13 @@ "kind": "object", "properties": [ { - "name": "clientTimeZone", - "type": 9, - "optional": true - }, - { - "name": "kind", - "type": 34, + "name": "callId", + "type": 10, "optional": false }, { - "name": "rpcId", - "type": 9, + "name": "kind", + "type": 30, "optional": false } ], @@ -7862,38 +7553,23 @@ "kind": "object", "properties": [ { - "name": "deliveryId", - "type": 9, + "name": "content", + "type": 7, "optional": false }, { - "name": "form", - "type": 49, + "name": "id", + "type": 10, "optional": false }, { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "provider", - "type": 9, - "optional": false - }, - { - "name": "ruleId", - "type": 9, + "name": "role", + "type": 33, "optional": false }, { "name": "source", - "type": 9, - "optional": false - }, - { - "name": "summary", - "type": 9, + "type": 34, "optional": false } ], @@ -7901,112 +7577,41 @@ }, { "kind": "literal", - "value": "notice" + "value": "system" }, { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 52, - "optional": false - }, - { - "name": "form", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "update", - "type": 19, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 53 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" + "kind": "union", + "types": [ + 35, + 40, + 42, + 44, + 46, + 48, + 50 + ] }, { "kind": "object", "properties": [ { "name": "form", - "type": 43, + "type": 36, "optional": false }, { "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 59, - "optional": false - }, - { - "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, "optional": false }, { "name": "sections", - "type": 61, + "type": 38, "optional": false } ], @@ -8022,19 +7627,19 @@ }, { "kind": "array", - "element": 62 + "element": 39 }, { "kind": "object", "properties": [ { "name": "name", - "type": 9, + "type": 10, "optional": false }, { "name": "text", - "type": 9, + "type": 10, "optional": false } ], @@ -8045,27 +7650,31 @@ "properties": [ { "name": "form", - "type": 49, + "type": 41, "optional": false }, { "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, "optional": false }, { "name": "summary", - "type": 9, + "type": 10, "optional": false } ], "indices": [] }, + { + "kind": "literal", + "value": "notice" + }, { "kind": "object", "properties": [ @@ -8076,33 +7685,37 @@ }, { "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, "optional": false } ], "indices": [] }, + { + "kind": "literal", + "value": "instructions" + }, { "kind": "object", "properties": [ { "name": "form", - "type": 66, + "type": 45, "optional": false }, { "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, "optional": false } ], @@ -8117,17 +7730,17 @@ "properties": [ { "name": "form", - "type": 68, + "type": 47, "optional": false }, { "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, "optional": false } ], @@ -8142,17 +7755,37 @@ "properties": [ { "name": "form", - "type": 54, + "type": 49, "optional": false }, { "name": "kind", - "type": 60, + "type": 37, "optional": false }, { "name": "plugin", - "type": 9, + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, "optional": false } ], @@ -8161,24 +7794,369 @@ { "kind": "object", "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 52, + "optional": false + }, + { + "name": "source", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "replayState", + "type": 55, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 57, + "optional": false + }, + { + "name": "source", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 31, + 35, + 40, + 42, + 44, + 46, + 48, + 50, + 53, + 59, + 67, + 68, + 70, + 74, + 76, + 83, + 85, + 87, + 89, + 91 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 20, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 10, + "optional": true + }, + { + "name": "changes", + "type": 60, + "optional": false + }, { "name": "form", - "type": 66, + "type": 43, "optional": false }, { "name": "kind", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 61 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 62, + "optional": false + }, + { + "name": "digest", + "type": 10, + "optional": true + }, + { + "name": "path", + "type": 10, + "optional": false + }, + { + "name": "scope", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 63, + 64, + 65 + ] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 10, + "optional": true + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "rpcId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 10, + "optional": false + }, + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 69, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "ruleId", + "type": 10, + "optional": false + }, + { + "name": "source", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", "type": 71, "optional": false }, + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "update", + "type": 20, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 72 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 75, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 77, + "optional": false + }, { "name": "references", - "type": 72, + "type": 78, "optional": false }, { "name": "version", - "type": 76, + "type": 82, "optional": false } ], @@ -8190,7 +8168,7 @@ }, { "kind": "array", - "element": 73 + "element": 79 }, { "kind": "object", @@ -8202,12 +8180,12 @@ }, { "name": "capturedThroughSeq", - "type": 74, + "type": 80, "optional": false }, { "name": "compacted", - "type": 25, + "type": 29, "optional": false }, { @@ -8217,7 +8195,7 @@ }, { "name": "label", - "type": 9, + "type": 10, "optional": false }, { @@ -8242,12 +8220,12 @@ }, { "name": "sessionId", - "type": 9, + "type": 10, "optional": false }, { "name": "truncated", - "type": 25, + "type": 29, "optional": false } ], @@ -8257,7 +8235,7 @@ "kind": "union", "types": [ 2, - 75 + 81 ] }, { @@ -8273,22 +8251,22 @@ "properties": [ { "name": "form", - "type": 49, + "type": 41, "optional": false }, { "name": "kind", - "type": 78, + "type": 84, "optional": false }, { "name": "senderSessionId", - "type": 9, + "type": 10, "optional": false }, { "name": "summary", - "type": 9, + "type": 10, "optional": false } ], @@ -8303,17 +8281,17 @@ "properties": [ { "name": "form", - "type": 68, + "type": 47, "optional": false }, { "name": "kind", - "type": 80, + "type": 86, "optional": false }, { "name": "senderSessionId", - "type": 9, + "type": 10, "optional": false } ], @@ -8328,12 +8306,12 @@ "properties": [ { "name": "goalId", - "type": 9, + "type": 10, "optional": false }, { "name": "kind", - "type": 82, + "type": 88, "optional": false }, { @@ -8358,27 +8336,27 @@ "properties": [ { "name": "kind", - "type": 84, + "type": 90, "optional": false }, { "name": "messageId", - "type": 9, + "type": 10, "optional": false }, { "name": "senderId", - "type": 9, + "type": 10, "optional": false }, { "name": "senderName", - "type": 9, + "type": 10, "optional": false }, { "name": "teamId", - "type": 9, + "type": 10, "optional": false } ], @@ -8393,57 +8371,7 @@ "properties": [ { "name": "kind", - "type": 86, - "optional": false - }, - { - "name": "model", - "type": 9, - "optional": false - }, - { - "name": "provider", - "type": 9, - "optional": false - }, - { - "name": "replayState", - "type": 87, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 34, + "type": 57, "optional": false } ], @@ -8454,12 +8382,12 @@ "properties": [ { "name": "model", - "type": 9, + "type": 10, "optional": false }, { "name": "provider", - "type": 9, + "type": 10, "optional": false } ], @@ -9020,7 +8948,7 @@ "kind": "event", "event": "system/message", "surface": true, - "digest": "69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae", + "digest": "1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300", "schema": { "root": 0, "nodes": [ @@ -9044,12 +8972,12 @@ }, { "name": "sourceEventSeqs", - "type": 47, + "type": 44, "optional": true }, { "name": "surfaceOp", - "type": 48, + "type": 45, "optional": false }, { @@ -9059,7 +8987,7 @@ }, { "name": "type", - "type": 52, + "type": 49, "optional": false } ], @@ -9101,12 +9029,12 @@ }, { "name": "role", - "type": 29, + "type": 26, "optional": false }, { "name": "source", - "type": 30, + "type": 27, "optional": false } ], @@ -9123,8 +9051,7 @@ 8, 19, 22, - 25, - 27 + 24 ] }, { @@ -9317,40 +9244,6 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 23, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -9361,7 +9254,7 @@ }, { "name": "type", - "type": 26, + "type": 23, "optional": false } ], @@ -9381,7 +9274,7 @@ }, { "name": "type", - "type": 28, + "type": 25, "optional": false } ], @@ -9398,13 +9291,13 @@ { "kind": "union", "types": [ - 31, - 36, - 38, - 40, - 42, - 44, - 46 + 28, + 33, + 35, + 37, + 39, + 41, + 43 ] }, { @@ -9412,12 +9305,12 @@ "properties": [ { "name": "form", - "type": 32, + "type": 29, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9427,7 +9320,7 @@ }, { "name": "sections", - "type": 34, + "type": 31, "optional": false } ], @@ -9443,7 +9336,7 @@ }, { "kind": "array", - "element": 35 + "element": 32 }, { "kind": "object", @@ -9466,12 +9359,12 @@ "properties": [ { "name": "form", - "type": 37, + "type": 34, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9496,12 +9389,12 @@ "properties": [ { "name": "form", - "type": 39, + "type": 36, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9521,12 +9414,12 @@ "properties": [ { "name": "form", - "type": 41, + "type": 38, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9546,12 +9439,12 @@ "properties": [ { "name": "form", - "type": 43, + "type": 40, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9571,12 +9464,12 @@ "properties": [ { "name": "form", - "type": 45, + "type": 42, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9596,7 +9489,7 @@ "properties": [ { "name": "kind", - "type": 33, + "type": 30, "optional": false }, { @@ -9614,8 +9507,8 @@ { "kind": "union", "types": [ - 49, - 51 + 46, + 48 ] }, { @@ -9628,7 +9521,7 @@ }, { "name": "op", - "type": 50, + "type": 47, "optional": false }, { @@ -9908,7 +9801,7 @@ "kind": "event", "event": "team/message/queued", "surface": false, - "digest": "443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4", + "digest": "9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240", "schema": { "root": 0, "nodes": [ @@ -9922,22 +9815,22 @@ }, { "name": "ignorable", - "type": 24, + "type": 21, "optional": true }, { "name": "seq", - "type": 17, + "type": 14, "optional": false }, { "name": "time", - "type": 17, + "type": 14, "optional": false }, { "name": "type", - "type": 30, + "type": 27, "optional": false } ], @@ -9953,12 +9846,12 @@ }, { "name": "teamId", - "type": 7, + "type": 6, "optional": false }, { "name": "version", - "type": 29, + "type": 26, "optional": false } ], @@ -9974,22 +9867,22 @@ }, { "name": "id", - "type": 7, + "type": 6, "optional": false }, { "name": "senderId", - "type": 7, + "type": 6, "optional": false }, { "name": "senderName", - "type": 7, + "type": 6, "optional": false }, { "name": "targetId", - "type": 7, + "type": 6, "optional": false } ], @@ -10003,67 +9896,32 @@ "kind": "union", "types": [ 5, - 9, - 11, - 13, - 15, - 26 + 8, + 10, + 12, + 23 ] }, { "kind": "object", "properties": [ { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", + "name": "text", "type": 6, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, "optional": false }, { "name": "type", - "type": 8, + "type": 7, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "boolean" - }, { "kind": "primitive", "type": "string" }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "reasoning" @@ -10073,12 +9931,12 @@ "properties": [ { "name": "text", - "type": 7, + "type": 6, "optional": false }, { "name": "type", - "type": 12, + "type": 9, "optional": false } ], @@ -10093,22 +9951,22 @@ "properties": [ { "name": "arguments", - "type": 7, + "type": 6, "optional": false }, { "name": "id", - "type": 7, + "type": 6, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false }, { "name": "type", - "type": 14, + "type": 11, "optional": false } ], @@ -10123,17 +9981,17 @@ "properties": [ { "name": "attachment", - "type": 16, + "type": 13, "optional": false }, { "name": "offloaded", - "type": 24, + "type": 21, "optional": true }, { "name": "type", - "type": 25, + "type": 22, "optional": false } ], @@ -10144,37 +10002,37 @@ "properties": [ { "name": "attachmentId", - "type": 7, + "type": 6, "optional": false }, { "name": "bytes", - "type": 17, + "type": 14, "optional": false }, { "name": "height", - "type": 17, + "type": 14, "optional": false }, { "name": "mediaType", - "type": 18, + "type": 15, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": true }, { "name": "originalDimensions", - "type": 23, + "type": 20, "optional": true }, { "name": "width", - "type": 17, + "type": 14, "optional": false } ], @@ -10187,10 +10045,10 @@ { "kind": "union", "types": [ - 19, - 20, - 21, - 22 + 16, + 17, + 18, + 19 ] }, { @@ -10214,12 +10072,12 @@ "properties": [ { "name": "height", - "type": 17, + "type": 14, "optional": false }, { "name": "width", - "type": 17, + "type": 14, "optional": false } ], @@ -10238,12 +10096,12 @@ "properties": [ { "name": "attachment", - "type": 27, + "type": 24, "optional": false }, { "name": "type", - "type": 28, + "type": 25, "optional": false } ], @@ -10254,17 +10112,17 @@ "properties": [ { "name": "attachmentId", - "type": 7, + "type": 6, "optional": false }, { "name": "bytes", - "type": 17, + "type": 14, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false } ], @@ -11009,7 +10867,7 @@ "kind": "event", "event": "tool/ptc-dispatch", "surface": false, - "digest": "b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c", + "digest": "75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185", "schema": { "root": 0, "nodes": [ @@ -11023,22 +10881,22 @@ }, { "name": "ignorable", - "type": 24, + "type": 21, "optional": true }, { "name": "seq", - "type": 17, + "type": 14, "optional": false }, { "name": "time", - "type": 17, + "type": 14, "optional": false }, { "name": "type", - "type": 30, + "type": 28, "optional": false } ], @@ -11059,32 +10917,32 @@ }, { "name": "error", - "type": 29, + "type": 26, "optional": true }, { "name": "isError", - "type": 6, + "type": 27, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false }, { "name": "parentCallId", - "type": 7, + "type": 6, "optional": false }, { "name": "rootCallId", - "type": 7, + "type": 6, "optional": false }, { "name": "subCallId", - "type": 7, + "type": 6, "optional": false } ], @@ -11102,67 +10960,32 @@ "kind": "union", "types": [ 5, - 9, - 11, - 13, - 15, - 26 + 8, + 10, + 12, + 23 ] }, { "kind": "object", "properties": [ { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", + "name": "text", "type": 6, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, "optional": false }, { "name": "type", - "type": 8, + "type": 7, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "boolean" - }, { "kind": "primitive", "type": "string" }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "reasoning" @@ -11172,12 +10995,12 @@ "properties": [ { "name": "text", - "type": 7, + "type": 6, "optional": false }, { "name": "type", - "type": 12, + "type": 9, "optional": false } ], @@ -11192,22 +11015,22 @@ "properties": [ { "name": "arguments", - "type": 7, + "type": 6, "optional": false }, { "name": "id", - "type": 7, + "type": 6, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false }, { "name": "type", - "type": 14, + "type": 11, "optional": false } ], @@ -11222,17 +11045,17 @@ "properties": [ { "name": "attachment", - "type": 16, + "type": 13, "optional": false }, { "name": "offloaded", - "type": 24, + "type": 21, "optional": true }, { "name": "type", - "type": 25, + "type": 22, "optional": false } ], @@ -11243,37 +11066,37 @@ "properties": [ { "name": "attachmentId", - "type": 7, + "type": 6, "optional": false }, { "name": "bytes", - "type": 17, + "type": 14, "optional": false }, { "name": "height", - "type": 17, + "type": 14, "optional": false }, { "name": "mediaType", - "type": 18, + "type": 15, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": true }, { "name": "originalDimensions", - "type": 23, + "type": 20, "optional": true }, { "name": "width", - "type": 17, + "type": 14, "optional": false } ], @@ -11286,10 +11109,10 @@ { "kind": "union", "types": [ - 19, - 20, - 21, - 22 + 16, + 17, + 18, + 19 ] }, { @@ -11313,12 +11136,12 @@ "properties": [ { "name": "height", - "type": 17, + "type": 14, "optional": false }, { "name": "width", - "type": 17, + "type": 14, "optional": false } ], @@ -11337,12 +11160,12 @@ "properties": [ { "name": "attachment", - "type": 27, + "type": 24, "optional": false }, { "name": "type", - "type": 28, + "type": 25, "optional": false } ], @@ -11353,17 +11176,17 @@ "properties": [ { "name": "attachmentId", - "type": 7, + "type": 6, "optional": false }, { "name": "bytes", - "type": 17, + "type": 14, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false } ], @@ -11378,22 +11201,26 @@ "properties": [ { "name": "code", - "type": 7, + "type": 6, "optional": false }, { "name": "name", - "type": 7, + "type": 6, "optional": false }, { "name": "reason", - "type": 7, + "type": 6, "optional": true } ], "indices": [] }, + { + "kind": "primitive", + "type": "boolean" + }, { "kind": "literal", "value": "tool/ptc-dispatch" @@ -11500,7 +11327,7 @@ "kind": "event", "event": "tool/result", "surface": true, - "digest": "29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2", + "digest": "f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c", "schema": { "root": 0, "nodes": [ @@ -11514,32 +11341,32 @@ }, { "name": "ignorable", - "type": 24, + "type": 20, "optional": true }, { "name": "seq", - "type": 17, + "type": 13, "optional": false }, { "name": "sourceEventSeqs", - "type": 38, + "type": 34, "optional": true }, { "name": "surfaceOp", - "type": 39, + "type": 35, "optional": false }, { "name": "time", - "type": 17, + "type": 13, "optional": false }, { "name": "type", - "type": 43, + "type": 39, "optional": false } ], @@ -11560,17 +11387,17 @@ }, { "name": "meta", - "type": 34, + "type": 30, "optional": true }, { "name": "step", - "type": 17, + "type": 13, "optional": false }, { "name": "turn", - "type": 17, + "type": 13, "optional": false } ], @@ -11614,68 +11441,41 @@ "type": 3, "optional": false }, + { + "name": "isError", + "type": 27, + "optional": true + }, { "name": "role", - "type": 31, + "type": 28, "optional": false }, { "name": "source", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "tuple", - "elements": [ - { - "type": 6, - "optional": false, - "rest": false - } - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 7, - "optional": false - }, - { - "name": "isError", "type": 29, - "optional": true + "optional": false }, { "name": "toolCallId", "type": 3, "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false } ], "indices": [] }, { "kind": "array", - "element": 8 + "element": 6 }, { "kind": "union", "types": [ - 6, + 7, 9, 11, - 13, - 15, - 26 + 22, + 24 ] }, { @@ -11688,7 +11488,7 @@ }, { "name": "type", - "type": 10, + "type": 8, "optional": false } ], @@ -11708,7 +11508,7 @@ }, { "name": "type", - "type": 12, + "type": 10, "optional": false } ], @@ -11718,52 +11518,22 @@ "kind": "literal", "value": "reasoning" }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 14, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, { "kind": "object", "properties": [ { "name": "attachment", - "type": 16, + "type": 12, "optional": false }, { "name": "offloaded", - "type": 24, + "type": 20, "optional": true }, { "name": "type", - "type": 25, + "type": 21, "optional": false } ], @@ -11779,17 +11549,17 @@ }, { "name": "bytes", - "type": 17, + "type": 13, "optional": false }, { "name": "height", - "type": 17, + "type": 13, "optional": false }, { "name": "mediaType", - "type": 18, + "type": 14, "optional": false }, { @@ -11799,12 +11569,12 @@ }, { "name": "originalDimensions", - "type": 23, + "type": 19, "optional": true }, { "name": "width", - "type": 17, + "type": 13, "optional": false } ], @@ -11817,10 +11587,10 @@ { "kind": "union", "types": [ - 19, - 20, - 21, - 22 + 15, + 16, + 17, + 18 ] }, { @@ -11844,12 +11614,12 @@ "properties": [ { "name": "height", - "type": 17, + "type": 13, "optional": false }, { "name": "width", - "type": 17, + "type": 13, "optional": false } ], @@ -11867,13 +11637,43 @@ "kind": "object", "properties": [ { - "name": "attachment", - "type": 27, + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, "optional": false }, { "name": "type", - "type": 28, + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 25, + "optional": false + }, + { + "name": "type", + "type": 26, "optional": false } ], @@ -11889,7 +11689,7 @@ }, { "name": "bytes", - "type": 17, + "type": 13, "optional": false }, { @@ -11910,11 +11710,7 @@ }, { "kind": "literal", - "value": "tool-result" - }, - { - "kind": "literal", - "value": "user" + "value": "tool" }, { "kind": "object", @@ -11926,30 +11722,26 @@ }, { "name": "kind", - "type": 33, + "type": 28, "optional": false } ], "indices": [] }, - { - "kind": "literal", - "value": "tool" - }, { "kind": "union", "types": [ 3, - 17, - 29, - 35, - 36, - 37 + 13, + 27, + 31, + 32, + 33 ] }, { "kind": "array", - "element": 34 + "element": 30 }, { "kind": "primitive", @@ -11961,41 +11753,37 @@ "indices": [ { "key": 3, - "value": 34 + "value": 30 } ] }, { "kind": "array", - "element": 17 + "element": 13 }, { "kind": "union", "types": [ - 40, - 41 + 36, + 38 ] }, - { - "kind": "literal", - "value": "append" - }, { "kind": "object", "properties": [ { "name": "endSeq", - "type": 17, + "type": 13, "optional": false }, { "name": "op", - "type": 42, + "type": 37, "optional": false }, { "name": "startSeq", - "type": 17, + "type": 13, "optional": false } ], @@ -12005,6 +11793,10 @@ "kind": "literal", "value": "replace" }, + { + "kind": "literal", + "value": "append" + }, { "kind": "literal", "value": "tool/result" @@ -12411,7 +12203,7 @@ "kind": "event", "event": "user/message", "surface": true, - "digest": "314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578", + "digest": "5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6", "schema": { "root": 0, "nodes": [ @@ -12435,12 +12227,12 @@ }, { "name": "sourceEventSeqs", - "type": 84, + "type": 82, "optional": true }, { "name": "surfaceOp", - "type": 85, + "type": 83, "optional": false }, { @@ -12450,7 +12242,7 @@ }, { "name": "type", - "type": 88, + "type": 86, "optional": false } ], @@ -12471,12 +12263,12 @@ }, { "name": "role", - "type": 28, + "type": 25, "optional": false }, { "name": "source", - "type": 29, + "type": 26, "optional": false } ], @@ -12493,8 +12285,7 @@ 7, 18, 21, - 24, - 26 + 23 ] }, { @@ -12687,40 +12478,6 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ @@ -12731,7 +12488,7 @@ }, { "name": "type", - "type": 25, + "type": 22, "optional": false } ], @@ -12751,7 +12508,7 @@ }, { "name": "type", - "type": 27, + "type": 24, "optional": false } ], @@ -12768,26 +12525,26 @@ { "kind": "union", "types": [ - 30, + 27, + 36, + 38, 39, - 41, 42, - 45, - 50, - 52, - 57, + 47, + 49, + 54, + 55, + 56, 58, - 59, + 60, 61, - 63, - 64, + 69, 71, 73, 75, 77, - 79, - 82, - 83 + 80, + 81 ] }, { @@ -12805,17 +12562,17 @@ }, { "name": "changes", - "type": 31, + "type": 28, "optional": false }, { "name": "form", - "type": 37, + "type": 34, "optional": false }, { "name": "kind", - "type": 38, + "type": 35, "optional": false } ], @@ -12823,14 +12580,14 @@ }, { "kind": "array", - "element": 32 + "element": 29 }, { "kind": "object", "properties": [ { "name": "action", - "type": 33, + "type": 30, "optional": false }, { @@ -12854,9 +12611,9 @@ { "kind": "union", "types": [ - 34, - 35, - 36 + 31, + 32, + 33 ] }, { @@ -12889,7 +12646,7 @@ }, { "name": "kind", - "type": 40, + "type": 37, "optional": false } ], @@ -12909,7 +12666,7 @@ }, { "name": "kind", - "type": 28, + "type": 25, "optional": false }, { @@ -12930,12 +12687,12 @@ }, { "name": "form", - "type": 43, + "type": 40, "optional": false }, { "name": "kind", - "type": 44, + "type": 41, "optional": false }, { @@ -12974,17 +12731,17 @@ "properties": [ { "name": "entries", - "type": 46, + "type": 43, "optional": false }, { "name": "form", - "type": 48, + "type": 45, "optional": false }, { "name": "kind", - "type": 49, + "type": 46, "optional": false }, { @@ -12997,7 +12754,7 @@ }, { "kind": "array", - "element": 47 + "element": 44 }, { "kind": "object", @@ -13028,12 +12785,12 @@ "properties": [ { "name": "form", - "type": 37, + "type": 34, "optional": false }, { "name": "kind", - "type": 51, + "type": 48, "optional": false }, { @@ -13053,12 +12810,12 @@ "properties": [ { "name": "form", - "type": 53, + "type": 50, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13068,7 +12825,7 @@ }, { "name": "sections", - "type": 55, + "type": 52, "optional": false } ], @@ -13084,7 +12841,7 @@ }, { "kind": "array", - "element": 56 + "element": 53 }, { "kind": "object", @@ -13107,12 +12864,12 @@ "properties": [ { "name": "form", - "type": 43, + "type": 40, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13133,12 +12890,12 @@ "properties": [ { "name": "form", - "type": 37, + "type": 34, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13154,12 +12911,12 @@ "properties": [ { "name": "form", - "type": 60, + "type": 57, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13179,12 +12936,12 @@ "properties": [ { "name": "form", - "type": 62, + "type": 59, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13204,12 +12961,12 @@ "properties": [ { "name": "form", - "type": 48, + "type": 45, "optional": false }, { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13225,22 +12982,22 @@ "properties": [ { "name": "form", - "type": 60, + "type": 57, "optional": false }, { "name": "kind", - "type": 65, + "type": 62, "optional": false }, { "name": "references", - "type": 66, + "type": 63, "optional": false }, { "name": "version", - "type": 70, + "type": 68, "optional": false } ], @@ -13252,7 +13009,7 @@ }, { "kind": "array", - "element": 67 + "element": 64 }, { "kind": "object", @@ -13264,12 +13021,12 @@ }, { "name": "capturedThroughSeq", - "type": 68, + "type": 65, "optional": false }, { "name": "compacted", - "type": 22, + "type": 67, "optional": false }, { @@ -13309,7 +13066,7 @@ }, { "name": "truncated", - "type": 22, + "type": 67, "optional": false } ], @@ -13319,13 +13076,17 @@ "kind": "union", "types": [ 9, - 69 + 66 ] }, { "kind": "primitive", "type": "null" }, + { + "kind": "primitive", + "type": "boolean" + }, { "kind": "literal", "value": 1 @@ -13335,12 +13096,12 @@ "properties": [ { "name": "form", - "type": 43, + "type": 40, "optional": false }, { "name": "kind", - "type": 72, + "type": 70, "optional": false }, { @@ -13365,12 +13126,12 @@ "properties": [ { "name": "form", - "type": 62, + "type": 59, "optional": false }, { "name": "kind", - "type": 74, + "type": 72, "optional": false }, { @@ -13395,7 +13156,7 @@ }, { "name": "kind", - "type": 76, + "type": 74, "optional": false }, { @@ -13420,7 +13181,7 @@ "properties": [ { "name": "kind", - "type": 78, + "type": 76, "optional": false }, { @@ -13455,7 +13216,7 @@ "properties": [ { "name": "kind", - "type": 80, + "type": 78, "optional": false }, { @@ -13470,7 +13231,7 @@ }, { "name": "replayState", - "type": 81, + "type": 79, "optional": true } ], @@ -13489,7 +13250,7 @@ "properties": [ { "name": "kind", - "type": 54, + "type": 51, "optional": false }, { @@ -13505,7 +13266,7 @@ "properties": [ { "name": "kind", - "type": 28, + "type": 25, "optional": false } ], @@ -13518,8 +13279,8 @@ { "kind": "union", "types": [ - 86, - 87 + 84, + 85 ] }, { @@ -13536,7 +13297,7 @@ }, { "name": "op", - "type": 35, + "type": 32, "optional": false }, { @@ -13841,6 +13602,1161 @@ "names": [], "sources": [] }, + { + "digest": "01bc74417fd4ff36c2840b266a5b3b51bf0e3b71eb43960a2c4aee7b7441a2aa", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "union", + "types": [ + 1, + 28, + 47, + 52 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "isError", + "type": 25, + "optional": true + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + }, + { + "name": "toolCallId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 29, + "optional": false + }, + { + "name": "source", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 31, + 36, + 38, + 40, + 42, + 44, + 46 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 32, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "sections", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 35 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 37, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 33, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 48, + "optional": false + }, + { + "name": "source", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "model", + "type": 5, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "replayState", + "type": 51, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 53, + "optional": false + }, + { + "name": "source", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 27, + 31, + 36, + 38, + 40, + 42, + 44, + 46, + 49, + 55, + 63, + 64, + 66, + 70, + 72, + 79, + 81, + 83, + 85, + 87 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 16, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 5, + "optional": true + }, + { + "name": "changes", + "type": 56, + "optional": false + }, + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 62, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 57 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 58, + "optional": false + }, + { + "name": "digest", + "type": 5, + "optional": true + }, + { + "name": "path", + "type": 5, + "optional": false + }, + { + "name": "scope", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 59, + 60, + 61 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 5, + "optional": true + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "rpcId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 5, + "optional": false + }, + { + "name": "form", + "type": 37, + "optional": false + }, + { + "name": "kind", + "type": 65, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "ruleId", + "type": 5, + "optional": false + }, + { + "name": "source", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 67, + "optional": false + }, + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 69, + "optional": false + }, + { + "name": "update", + "type": 16, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 68 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 71, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "references", + "type": 74, + "optional": false + }, + { + "name": "version", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 75 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 9, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 76, + "optional": false + }, + { + "name": "compacted", + "type": 25, + "optional": false + }, + { + "name": "inputIndex", + "type": 9, + "optional": false + }, + { + "name": "label", + "type": 5, + "optional": false + }, + { + "name": "omittedBytes", + "type": 9, + "optional": false + }, + { + "name": "omittedMessages", + "type": 9, + "optional": false + }, + { + "name": "originalMessages", + "type": 9, + "optional": false + }, + { + "name": "retainedMessages", + "type": 9, + "optional": false + }, + { + "name": "sessionId", + "type": 5, + "optional": false + }, + { + "name": "truncated", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 77 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 37, + "optional": false + }, + { + "name": "kind", + "type": 80, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 82, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 84, + "optional": false + }, + { + "name": "revision", + "type": 9, + "optional": false + }, + { + "name": "round", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 86, + "optional": false + }, + { + "name": "messageId", + "type": 5, + "optional": false + }, + { + "name": "senderId", + "type": 5, + "optional": false + }, + { + "name": "senderName", + "type": 5, + "optional": false + }, + { + "name": "teamId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [ + "packages/llm/llm/src/message.ts#Message" + ], + "sources": [ + "packages/llm/llm/src/message.ts:180" + ] + }, { "digest": "023a355b2be0d688fb6e4df8388dadb942761d46cfe96d0f499aae9631a159d4", "schema": { @@ -13882,6 +14798,1329 @@ "names": [], "sources": [] }, + { + "digest": "04e1cae61e7654890444877cb802e3b6c8c607fa8a9b4380323939951a1be9d2", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "message", + "type": 1, + "optional": false + }, + { + "name": "step", + "type": 9, + "optional": false + }, + { + "name": "turn", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 27, + 32, + 34, + 36, + 38, + 40, + 42 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 28, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "sections", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 31 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 37, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 29, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [], + "sources": [ + "packages/core/session/src/types.ts:317" + ] + }, + { + "digest": "050e0338b08a9712f3454b1e93bd7f5bb2f426ebfaf828688dd9102fc6089b70", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "union", + "types": [ + 1, + 7, + 61, + 63 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 2, + "optional": false + }, + { + "name": "dt", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "time0", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 8, + "optional": false + }, + { + "name": "time", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 11, + 33, + 36, + 38, + 40, + 57 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 12, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 13, + 15, + 25, + 28, + 30 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 16, + "optional": false + }, + { + "name": "offloaded", + "type": 23, + "optional": true + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 5, + "optional": false + }, + { + "name": "height", + "type": 5, + "optional": false + }, + { + "name": "mediaType", + "type": 17, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 22, + "optional": true + }, + { + "name": "width", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 18, + 19, + 20, + 21 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 5, + "optional": false + }, + { + "name": "width", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 26, + "optional": false + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 34, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 14, + 24, + 27, + 29, + 31 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 41, + "optional": false + }, + { + "name": "replayState", + "type": 53, + "optional": true + }, + { + "name": "type", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 42, + 45, + 47, + 49, + 51 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 3, + "optional": false + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "offloadImages", + "type": 5, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 5, + "optional": true + }, + { + "name": "requestId", + "type": 3, + "optional": true + }, + { + "name": "status", + "type": 5, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 54, + "optional": true + }, + { + "name": "response", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 55 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 58, + "optional": false + }, + { + "name": "usage", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 5, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 5, + "optional": true + }, + { + "name": "inputTokens", + "type": 5, + "optional": false + }, + { + "name": "outputTokens", + "type": 5, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 5, + "optional": true + }, + { + "name": "totalTokens", + "type": 5, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 4, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "texts", + "type": 2, + "optional": false + }, + { + "name": "time0", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 62, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 4, + "optional": false + }, + { + "name": "index", + "type": 5, + "optional": false + }, + { + "name": "texts", + "type": 2, + "optional": false + }, + { + "name": "time0", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 64, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + } + ] + }, + "names": [ + "packages/llm/llm/src/assistant-stream.ts#AssistantStreamRecord" + ], + "sources": [ + "packages/llm/llm/src/assistant-stream.ts:20" + ] + }, { "digest": "05d2ae1e0c7f8770f83f9a09047afb39a335d8ac986df3193659aa1e581472cf", "schema": { @@ -13929,693 +16168,6 @@ "packages/core/session/src/types.ts:31" ] }, - { - "digest": "071d92b9dac661fcc826c678cf64d188f26fb93aab79c627b11a03acdd34dfca", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "union", - "types": [ - 1, - 5, - 31, - 34, - 36, - 38, - 55 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 2, - "optional": false - }, - { - "name": "index", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": true - }, - { - "name": "type", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 6, - "optional": false - }, - { - "name": "index", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 7, - 9, - 19, - 22, - 26, - 28 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 10, - "optional": false - }, - { - "name": "offloaded", - "type": 17, - "optional": true - }, - { - "name": "type", - "type": 18, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 2, - "optional": false - }, - { - "name": "bytes", - "type": 3, - "optional": false - }, - { - "name": "height", - "type": 3, - "optional": false - }, - { - "name": "mediaType", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": true - }, - { - "name": "originalDimensions", - "type": 16, - "optional": true - }, - { - "name": "width", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 12, - 13, - 14, - 15 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 3, - "optional": false - }, - { - "name": "width", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 20, - "optional": false - }, - { - "name": "type", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 2, - "optional": false - }, - { - "name": "bytes", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 23, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 6 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 32, - "optional": false - }, - { - "name": "index", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 8, - 18, - 21, - 25, - 27, - 29 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 3, - "optional": false - }, - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 35, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 3, - "optional": false - }, - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 37, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 39, - "optional": false - }, - { - "name": "replayState", - "type": 51, - "optional": true - }, - { - "name": "type", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 40, - 43, - 45, - 47, - 49 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 2, - "optional": false - }, - { - "name": "message", - "type": 2, - "optional": false - }, - { - "name": "offloadImages", - "type": 3, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 3, - "optional": true - }, - { - "name": "requestId", - "type": 2, - "optional": true - }, - { - "name": "status", - "type": 3, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 46, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 48, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 52, - "optional": true - }, - { - "name": "response", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 53 - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 56, - "optional": false - }, - { - "name": "usage", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 3, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 3, - "optional": true - }, - { - "name": "inputTokens", - "type": 3, - "optional": false - }, - { - "name": "outputTokens", - "type": 3, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 3, - "optional": true - }, - { - "name": "totalTokens", - "type": 3, - "optional": true - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/llm/llm/src/types.ts#StreamChunk" - ], - "sources": [ - "packages/llm/llm/src/types.ts:426" - ] - }, { "digest": "07e1a58c58b593f507b8e7f25723bb0aa42baae6e00f5ecfddf28cb1e64d3235", "schema": { @@ -14869,7 +16421,7 @@ "packages/llm/llm/src/types.ts#ReplayEnvelope" ], "sources": [ - "packages/llm/llm/src/types.ts:404" + "packages/llm/llm/src/types.ts:395" ] }, { @@ -14985,7 +16537,7 @@ "sources": [] }, { - "digest": "0c3f4d2248d9bc9700e2d7253fa71aa9935f5c39af6f11de5727f08cccaf8383", + "digest": "0c3c69461d71c0aafb10acd70672f86cd2cf7592cbb71c2f9ac1c2f3eeba0734", "schema": { "root": 0, "nodes": [ @@ -14993,118 +16545,96 @@ "kind": "object", "properties": [ { - "name": "message", + "name": "compactionId", "type": 1, "optional": false }, { - "name": "teamId", - "type": 6, - "optional": false - }, - { - "name": "version", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", + "name": "maxTokens", "type": 2, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "senderId", - "type": 6, - "optional": false - }, - { - "name": "senderName", - "type": 6, - "optional": false - }, - { - "name": "targetId", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 8, - 10, - 12, - 14, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 5, "optional": true }, { - "name": "toolCallId", - "type": 6, + "name": "model", + "type": 1, "optional": false }, { - "name": "type", - "type": 7, + "name": "provider", + "type": 1, "optional": false + }, + { + "name": "rawOutput", + "type": 3, + "optional": true + }, + { + "name": "shadowedRange", + "type": 24, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 25, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 2, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 1, + "optional": true + }, + { + "name": "summary", + "type": 3, + "optional": false + }, + { + "name": "usage", + "type": 26, + "optional": true } ], "indices": [] }, - { - "kind": "primitive", - "type": "boolean" - }, { "kind": "primitive", "type": "string" }, { - "kind": "literal", - "value": "tool-result" + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 7, + 9, + 11, + 21 + ] }, { "kind": "object", "properties": [ { "name": "text", - "type": 6, + "type": 1, "optional": false }, { "name": "type", - "type": 9, + "type": 6, "optional": false } ], @@ -15119,12 +16649,12 @@ "properties": [ { "name": "text", - "type": 6, + "type": 1, "optional": false }, { "name": "type", - "type": 11, + "type": 8, "optional": false } ], @@ -15139,22 +16669,22 @@ "properties": [ { "name": "arguments", - "type": 6, + "type": 1, "optional": false }, { "name": "id", - "type": 6, + "type": 1, "optional": false }, { "name": "name", - "type": 6, + "type": 1, "optional": false }, { "name": "type", - "type": 13, + "type": 10, "optional": false } ], @@ -15169,17 +16699,17 @@ "properties": [ { "name": "attachment", - "type": 15, + "type": 12, "optional": false }, { "name": "offloaded", - "type": 23, + "type": 19, "optional": true }, { "name": "type", - "type": 24, + "type": 20, "optional": false } ], @@ -15190,53 +16720,49 @@ "properties": [ { "name": "attachmentId", - "type": 6, + "type": 1, "optional": false }, { "name": "bytes", - "type": 16, + "type": 2, "optional": false }, { "name": "height", - "type": 16, + "type": 2, "optional": false }, { "name": "mediaType", - "type": 17, + "type": 13, "optional": false }, { "name": "name", - "type": 6, + "type": 1, "optional": true }, { "name": "originalDimensions", - "type": 22, + "type": 18, "optional": true }, { "name": "width", - "type": 16, + "type": 2, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "number" - }, { "kind": "union", "types": [ - 18, - 19, - 20, - 21 + 14, + 15, + 16, + 17 ] }, { @@ -15260,12 +16786,12 @@ "properties": [ { "name": "height", - "type": 16, + "type": 2, "optional": false }, { "name": "width", - "type": 16, + "type": 2, "optional": false } ], @@ -15284,12 +16810,12 @@ "properties": [ { "name": "attachment", - "type": 26, + "type": 22, "optional": false }, { "name": "type", - "type": 27, + "type": 23, "optional": false } ], @@ -15300,17 +16826,17 @@ "properties": [ { "name": "attachmentId", - "type": 6, + "type": 1, "optional": false }, { "name": "bytes", - "type": 16, + "type": 2, "optional": false }, { "name": "name", - "type": 6, + "type": 1, "optional": false } ], @@ -15321,15 +16847,65 @@ "value": "file" }, { - "kind": "literal", - "value": 2 + "kind": "object", + "properties": [ + { + "name": "end", + "type": 2, + "optional": false + }, + { + "name": "start", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 2, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 2, + "optional": true + }, + { + "name": "inputTokens", + "type": 2, + "optional": false + }, + { + "name": "outputTokens", + "type": 2, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 2, + "optional": true + }, + { + "name": "totalTokens", + "type": 2, + "optional": true + } + ], + "indices": [] } ] }, "names": [], - "sources": [ - "packages/experimental/agent-team/src/types.ts:225" - ] + "sources": [] }, { "digest": "0c4205180f75b9ee1e0d878bd9a9851628b5dc18448486389d9c5fdc3f1ccda3", @@ -15345,873 +16921,6 @@ "names": [], "sources": [] }, - { - "digest": "0c6412d3ba5e41adfaa6929c7d4093f2d52d8598c03f35844fc0d55e3070a3b1", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "step", - "type": 1, - "optional": false - }, - { - "name": "stream", - "type": 2, - "optional": false - }, - { - "name": "turn", - "type": 1, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 9, - 67, - 69 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "args", - "type": 5, - "optional": false - }, - { - "name": "dt", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "time0", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 6 - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "array", - "element": 1 - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 10, - "optional": false - }, - { - "name": "time", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 66, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 11, - 13, - 39, - 42, - 44, - 46, - 63 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 14, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 38, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 15, - 17, - 27, - 30, - 34, - 36 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 18, - "optional": false - }, - { - "name": "offloaded", - "type": 25, - "optional": true - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 1, - "optional": false - }, - { - "name": "height", - "type": 1, - "optional": false - }, - { - "name": "mediaType", - "type": 19, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "originalDimensions", - "type": 24, - "optional": true - }, - { - "name": "width", - "type": 1, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 20, - 21, - 22, - 23 - ] - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 1, - "optional": false - }, - { - "name": "width", - "type": 1, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 28, - "optional": false - }, - { - "name": "type", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 1, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 31, - "optional": false - }, - { - "name": "isError", - "type": 32, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 14 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 35, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 37, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 40, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 41, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 16, - 26, - 29, - 33, - 35, - 37 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 43, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 45, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 47, - "optional": false - }, - { - "name": "replayState", - "type": 59, - "optional": true - }, - { - "name": "type", - "type": 62, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 48, - 51, - 53, - 55, - 57 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 6, - "optional": false - }, - { - "name": "message", - "type": 6, - "optional": false - }, - { - "name": "offloadImages", - "type": 1, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 1, - "optional": true - }, - { - "name": "requestId", - "type": 6, - "optional": true - }, - { - "name": "status", - "type": 1, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 60, - "optional": true - }, - { - "name": "response", - "type": 61, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 61 - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 64, - "optional": false - }, - { - "name": "usage", - "type": 65, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 1, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 1, - "optional": true - }, - { - "name": "inputTokens", - "type": 1, - "optional": false - }, - { - "name": "outputTokens", - "type": 1, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 1, - "optional": true - }, - { - "name": "totalTokens", - "type": 1, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "chunk" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "texts", - "type": 5, - "optional": false - }, - { - "name": "time0", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 68, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 1, - "optional": false - }, - { - "name": "texts", - "type": 5, - "optional": false - }, - { - "name": "time0", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 70, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" - } - ] - }, - "names": [], - "sources": [ - "packages/core/session/src/types.ts:342" - ] - }, { "digest": "0d47a8f3d847243c4488e755ad4cab7a04ac5d4621b9c81865524cf3f4d8536f", "schema": { @@ -16736,1022 +17445,6 @@ "names": [], "sources": [] }, - { - "digest": "1169b301aaabcd992657b93ec93750c43175dda81ada5cac086f14f2eaaeed6d", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 2, - "optional": true - }, - { - "name": "seq", - "type": 11, - "optional": false - }, - { - "name": "surfaceOp", - "type": 76, - "optional": false - }, - { - "name": "time", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 80, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "interrupted", - "type": 2, - "optional": true - }, - { - "name": "message", - "type": 3, - "optional": false - }, - { - "name": "step", - "type": 11, - "optional": false - }, - { - "name": "stream", - "type": 33, - "optional": false - }, - { - "name": "turn", - "type": 11, - "optional": false - }, - { - "name": "usage", - "type": 70, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "role", - "type": 29, - "optional": false - }, - { - "name": "source", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "union", - "types": [ - 6, - 9, - 19, - 22, - 25, - 27 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 10, - "optional": false - }, - { - "name": "offloaded", - "type": 2, - "optional": true - }, - { - "name": "type", - "type": 18, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "mediaType", - "type": 12, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "originalDimensions", - "type": 17, - "optional": true - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 13, - 14, - 15, - 16 - ] - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 20, - "optional": false - }, - { - "name": "type", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "isError", - "type": 23, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "model", - "type": 7, - "optional": false - }, - { - "name": "provider", - "type": 7, - "optional": false - }, - { - "name": "replayState", - "type": 32, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "array", - "element": 34 - }, - { - "kind": "union", - "types": [ - 35, - 39, - 72, - 74 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "args", - "type": 36, - "optional": false - }, - { - "name": "dt", - "type": 37, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "time0", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 38, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "array", - "element": 11 - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 40, - "optional": false - }, - { - "name": "time", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 71, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 41, - 43, - 45, - 48, - 50, - 52, - 68 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "type", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 5, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 46, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 47, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 8, - 18, - 21, - 24, - 26, - 28 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 53, - "optional": false - }, - { - "name": "replayState", - "type": 65, - "optional": true - }, - { - "name": "type", - "type": 67, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 54, - 57, - 59, - 61, - 63 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 55, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 7, - "optional": false - }, - { - "name": "message", - "type": 7, - "optional": false - }, - { - "name": "offloadImages", - "type": 11, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 11, - "optional": true - }, - { - "name": "requestId", - "type": 7, - "optional": true - }, - { - "name": "status", - "type": 11, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 55, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 62, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 64, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 66, - "optional": true - }, - { - "name": "response", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 32 - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 69, - "optional": false - }, - { - "name": "usage", - "type": 70, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 11, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 11, - "optional": true - }, - { - "name": "inputTokens", - "type": 11, - "optional": false - }, - { - "name": "outputTokens", - "type": 11, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 11, - "optional": true - }, - { - "name": "totalTokens", - "type": 11, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "chunk" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 37, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "texts", - "type": 36, - "optional": false - }, - { - "name": "time0", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 73, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 37, - "optional": false - }, - { - "name": "index", - "type": 11, - "optional": false - }, - { - "name": "texts", - "type": 36, - "optional": false - }, - { - "name": "time0", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 75, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" - }, - { - "kind": "union", - "types": [ - 77, - 79 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "endSeq", - "type": 11, - "optional": false - }, - { - "name": "op", - "type": 78, - "optional": false - }, - { - "name": "startSeq", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "append" - }, - { - "kind": "literal", - "value": "assistant/message" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "119abe2b9c0b2f46ecb31d82b9acba4d4b30e049f655e2475e8b4ae12d5a9e25", "schema": { @@ -18339,6 +18032,608 @@ "names": [], "sources": [] }, + { + "digest": "1772581b17e1fab970fda49f04ffae2a181b7992ca4efa63bffe5f8b2bd62300", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 17, + "optional": true + }, + { + "name": "seq", + "type": 10, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 44, + "optional": true + }, + { + "name": "surfaceOp", + "type": 45, + "optional": false + }, + { + "name": "time", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "message", + "type": 2, + "optional": false + }, + { + "name": "step", + "type": 10, + "optional": false + }, + { + "name": "turn", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 9, + "optional": false + }, + { + "name": "offloaded", + "type": 17, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "mediaType", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 16, + "optional": true + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 12, + 13, + 14, + 15 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 28, + 33, + 35, + 37, + 39, + 41, + 43 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 29, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "sections", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 32 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 10 + }, + { + "kind": "union", + "types": [ + 46, + 48 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 10, + "optional": false + }, + { + "name": "op", + "type": 47, + "optional": false + }, + { + "name": "startSeq", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "system/message" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "17aae616ef020b8b9f011ec398ec935450fb06d3e2a0722c456f63aeaf5ff728", "schema": { @@ -18514,7 +18809,7 @@ "packages/session/session-persistence-jsonl/src/format.ts#HeaderLine" ], "sources": [ - "packages/session/session-persistence-jsonl/src/format.ts:82" + "packages/session/session-persistence-jsonl/src/format.ts:83" ] }, { @@ -18725,7 +19020,7 @@ ] }, { - "digest": "1b573e2d5c094fa87e2a8bf409ddd4ac5ba92a123085e168de44b9ccdbd5244c", + "digest": "1b78e3a578a7e6d29d9564a9f5d236c2ebdcf682dbeb7b50400d8850e313b518", "schema": { "root": 0, "nodes": [ @@ -18733,64 +19028,46 @@ "kind": "object", "properties": [ { - "name": "content", + "name": "maxTokens", "type": 1, "optional": false }, { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "tuple", - "elements": [ - { + "name": "messageSeqs", "type": 2, - "optional": false, - "rest": false - } - ] - }, - { - "kind": "object", - "properties": [ + "optional": false + }, { - "name": "content", + "name": "messages", "type": 3, "optional": false }, { - "name": "isError", - "type": 26, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, + "name": "route", + "type": 91, "optional": false }, { - "name": "type", - "type": 27, + "name": "system", + "type": 9, + "optional": false + }, + { + "name": "titleProvider", + "type": 9, "optional": false } ], "indices": [] }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 1 + }, { "kind": "array", "element": 4 @@ -18798,25 +19075,83 @@ { "kind": "union", "types": [ - 2, 5, - 8, - 10, - 12, - 23 + 31, + 50, + 55 ] }, { "kind": "object", "properties": [ { - "name": "text", + "name": "content", "type": 6, "optional": false }, + { + "name": "id", + "type": 9, + "optional": false + }, + { + "name": "isError", + "type": 28, + "optional": true + }, + { + "name": "role", + "type": 29, + "optional": false + }, + { + "name": "source", + "type": 30, + "optional": false + }, + { + "name": "toolCallId", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "union", + "types": [ + 8, + 11, + 21, + 24, + 26 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 9, + "optional": false + }, + { + "name": "id", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 9, + "optional": false + }, { "name": "type", - "type": 7, + "type": 10, "optional": false } ], @@ -18826,56 +19161,6 @@ "kind": "primitive", "type": "string" }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 11, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "tool-call" @@ -18885,17 +19170,17 @@ "properties": [ { "name": "attachment", - "type": 13, + "type": 12, "optional": false }, { "name": "offloaded", - "type": 21, + "type": 19, "optional": true }, { "name": "type", - "type": 22, + "type": 20, "optional": false } ], @@ -18906,63 +19191,51 @@ "properties": [ { "name": "attachmentId", - "type": 6, + "type": 9, "optional": false }, { "name": "bytes", - "type": 14, + "type": 1, "optional": false }, { "name": "height", - "type": 14, + "type": 1, "optional": false }, { "name": "mediaType", - "type": 15, + "type": 13, "optional": false }, { "name": "name", - "type": 6, + "type": 9, "optional": true }, { "name": "originalDimensions", - "type": 20, + "type": 18, "optional": true }, { "name": "width", - "type": 14, + "type": 1, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "number" - }, { "kind": "union", "types": [ + 14, + 15, 16, - 17, - 18, - 19 + 17 ] }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, { "kind": "literal", "value": "image/png" @@ -18971,17 +19244,25 @@ "kind": "literal", "value": "image/webp" }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, { "kind": "object", "properties": [ { "name": "height", - "type": 14, + "type": 1, "optional": false }, { "name": "width", - "type": 14, + "type": 1, "optional": false } ], @@ -19000,7 +19281,48 @@ "properties": [ { "name": "attachment", - "type": 24, + "type": 22, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 9, + "optional": false + }, + { + "name": "bytes", + "type": 1, + "optional": false + }, + { + "name": "name", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 9, "optional": false }, { @@ -19011,22 +19333,21 @@ ], "indices": [] }, + { + "kind": "literal", + "value": "reasoning" + }, { "kind": "object", "properties": [ { - "name": "attachmentId", - "type": 6, + "name": "text", + "type": 9, "optional": false }, { - "name": "bytes", - "type": 14, - "optional": false - }, - { - "name": "name", - "type": 6, + "name": "type", + "type": 27, "optional": false } ], @@ -19034,7 +19355,7 @@ }, { "kind": "literal", - "value": "file" + "value": "text" }, { "kind": "primitive", @@ -19042,23 +19363,45 @@ }, { "kind": "literal", - "value": "tool-result" - }, - { - "kind": "literal", - "value": "user" + "value": "tool" }, { "kind": "object", "properties": [ { "name": "callId", - "type": 6, + "type": 9, "optional": false }, { "name": "kind", - "type": 30, + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 9, + "optional": false + }, + { + "name": "role", + "type": 32, + "optional": false + }, + { + "name": "source", + "type": 33, "optional": false } ], @@ -19066,15 +19409,829 @@ }, { "kind": "literal", - "value": "tool" + "value": "system" + }, + { + "kind": "union", + "types": [ + 34, + 39, + 41, + 43, + 45, + 47, + 49 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + }, + { + "name": "sections", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 38 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 9, + "optional": false + }, + { + "name": "text", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + }, + { + "name": "summary", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 48, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "plugin", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 9, + "optional": false + }, + { + "name": "role", + "type": 51, + "optional": false + }, + { + "name": "source", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "model", + "type": 9, + "optional": false + }, + { + "name": "provider", + "type": 9, + "optional": false + }, + { + "name": "replayState", + "type": 54, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 9, + "optional": false + }, + { + "name": "role", + "type": 56, + "optional": false + }, + { + "name": "source", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 30, + 34, + 39, + 41, + 43, + 45, + 47, + 49, + 52, + 58, + 66, + 67, + 69, + 73, + 75, + 82, + 84, + 86, + 88, + 90 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 19, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 9, + "optional": true + }, + { + "name": "changes", + "type": 59, + "optional": false + }, + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 65, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 60 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 61, + "optional": false + }, + { + "name": "digest", + "type": 9, + "optional": true + }, + { + "name": "path", + "type": 9, + "optional": false + }, + { + "name": "scope", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 62, + 63, + 64 + ] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 9, + "optional": true + }, + { + "name": "kind", + "type": 56, + "optional": false + }, + { + "name": "rpcId", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 9, + "optional": false + }, + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 68, + "optional": false + }, + { + "name": "provider", + "type": 9, + "optional": false + }, + { + "name": "ruleId", + "type": 9, + "optional": false + }, + { + "name": "source", + "type": 9, + "optional": false + }, + { + "name": "summary", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 70, + "optional": false + }, + { + "name": "form", + "type": 48, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "update", + "type": 19, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 71 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "name", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "references", + "type": 77, + "optional": false + }, + { + "name": "version", + "type": 81, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 78 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 1, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 79, + "optional": false + }, + { + "name": "compacted", + "type": 28, + "optional": false + }, + { + "name": "inputIndex", + "type": 1, + "optional": false + }, + { + "name": "label", + "type": 9, + "optional": false + }, + { + "name": "omittedBytes", + "type": 1, + "optional": false + }, + { + "name": "omittedMessages", + "type": 1, + "optional": false + }, + { + "name": "originalMessages", + "type": 1, + "optional": false + }, + { + "name": "retainedMessages", + "type": 1, + "optional": false + }, + { + "name": "sessionId", + "type": 9, + "optional": false + }, + { + "name": "truncated", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 1, + 80 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 83, + "optional": false + }, + { + "name": "senderSessionId", + "type": 9, + "optional": false + }, + { + "name": "summary", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 85, + "optional": false + }, + { + "name": "senderSessionId", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 9, + "optional": false + }, + { + "name": "kind", + "type": 87, + "optional": false + }, + { + "name": "revision", + "type": 1, + "optional": false + }, + { + "name": "round", + "type": 1, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 89, + "optional": false + }, + { + "name": "messageId", + "type": 9, + "optional": false + }, + { + "name": "senderId", + "type": 9, + "optional": false + }, + { + "name": "senderName", + "type": 9, + "optional": false + }, + { + "name": "teamId", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "model", + "type": 9, + "optional": false + }, + { + "name": "provider", + "type": 9, + "optional": false + } + ], + "indices": [] } ] }, "names": [ - "packages/llm/llm/src/message.ts#ToolResultMessage" + "packages/session/session-title-llm/src/index.ts#SessionTitleLlmRequestEventData" ], "sources": [ - "packages/llm/llm/src/message.ts:164" + "packages/session/session-title-llm/src/index.ts:27" ] }, { @@ -19342,7 +20499,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:144" + "packages/llm/llm/src/types.ts:135" ] }, { @@ -19736,560 +20893,6 @@ "packages/core/session/src/types.ts:195" ] }, - { - "digest": "2074f40221b76c75fd314246db558965dc3477dfb440bcc952b1eedc9778e366", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "message", - "type": 1, - "optional": false - }, - { - "name": "step", - "type": 9, - "optional": false - }, - { - "name": "turn", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 7, - 18, - 21, - 24, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 8, - "optional": false - }, - { - "name": "offloaded", - "type": 16, - "optional": true - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "mediaType", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 15, - "optional": true - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 11, - 12, - 13, - 14 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "union", - "types": [ - 30, - 35, - 37, - 39, - 41, - 43, - 45 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 31, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "sections", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 34 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 36, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 38, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 40, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 32, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [], - "sources": [ - "packages/core/session/src/types.ts:317" - ] - }, { "digest": "20a57544bbf204dacd1ae6beb2ab29444365c3c869f2afdf489dcdcbc3d9c8c5", "schema": { @@ -20412,1091 +21015,6 @@ "names": [], "sources": [] }, - { - "digest": "23c7cce57d20589897f4e2bd5898affc6fc611b87cd0cc8b95be1cfdd8b3a7eb", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "role", - "type": 27, - "optional": false - }, - { - "name": "source", - "type": 31, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 3, - 6, - 17, - 20, - 23, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 7, - "optional": false - }, - { - "name": "offloaded", - "type": 15, - "optional": true - }, - { - "name": "type", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "mediaType", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "originalDimensions", - "type": 14, - "optional": true - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 10, - 11, - 12, - 13 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 18, - "optional": false - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 21, - "optional": true - }, - { - "name": "toolCallId", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "union", - "types": [ - 28, - 29, - 30 - ] - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 32, - 41, - 43, - 44, - 47, - 52, - 54, - 59, - 60, - 61, - 63, - 65, - 66, - 73, - 75, - 77, - 79, - 81, - 84, - 85 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 15, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 4, - "optional": true - }, - { - "name": "changes", - "type": 33, - "optional": false - }, - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 40, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 34 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 35, - "optional": false - }, - { - "name": "digest", - "type": 4, - "optional": true - }, - { - "name": "path", - "type": 4, - "optional": false - }, - { - "name": "scope", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 36, - 37, - 38 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 4, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 4, - "optional": true - }, - { - "name": "kind", - "type": 30, - "optional": false - }, - { - "name": "rpcId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 4, - "optional": false - }, - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 46, - "optional": false - }, - { - "name": "provider", - "type": 4, - "optional": false - }, - { - "name": "ruleId", - "type": 4, - "optional": false - }, - { - "name": "source", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 48, - "optional": false - }, - { - "name": "form", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "update", - "type": 15, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 49 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 55, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "sections", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 58 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "text", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 64, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 67, - "optional": false - }, - { - "name": "references", - "type": 68, - "optional": false - }, - { - "name": "version", - "type": 72, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 69 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 8, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 70, - "optional": false - }, - { - "name": "compacted", - "type": 21, - "optional": false - }, - { - "name": "inputIndex", - "type": 8, - "optional": false - }, - { - "name": "label", - "type": 4, - "optional": false - }, - { - "name": "omittedBytes", - "type": 8, - "optional": false - }, - { - "name": "omittedMessages", - "type": 8, - "optional": false - }, - { - "name": "originalMessages", - "type": 8, - "optional": false - }, - { - "name": "retainedMessages", - "type": 8, - "optional": false - }, - { - "name": "sessionId", - "type": 4, - "optional": false - }, - { - "name": "truncated", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 8, - 71 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 74, - "optional": false - }, - { - "name": "senderSessionId", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 64, - "optional": false - }, - { - "name": "kind", - "type": 76, - "optional": false - }, - { - "name": "senderSessionId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 4, - "optional": false - }, - { - "name": "kind", - "type": 78, - "optional": false - }, - { - "name": "revision", - "type": 8, - "optional": false - }, - { - "name": "round", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 80, - "optional": false - }, - { - "name": "messageId", - "type": 4, - "optional": false - }, - { - "name": "senderId", - "type": 4, - "optional": false - }, - { - "name": "senderName", - "type": 4, - "optional": false - }, - { - "name": "teamId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 82, - "optional": false - }, - { - "name": "model", - "type": 4, - "optional": false - }, - { - "name": "provider", - "type": 4, - "optional": false - }, - { - "name": "replayState", - "type": 83, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 30, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/llm/llm/src/message.ts#Message" - ], - "sources": [ - "packages/llm/llm/src/message.ts:131" - ] - }, { "digest": "23cf7e0cf3fec1283b60fa15713506169bc9c079a08e124d1cb9733baca80b40", "schema": { @@ -21723,6 +21241,450 @@ "names": [], "sources": [] }, + { + "digest": "243a2287c54514f9b819d7d9c93cc2d1313c54401c7630ef03a2d2380606637a", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "union", + "types": [ + 1, + 28 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 2, + "optional": false + }, + { + "name": "llmStreamCall", + "type": 3, + "optional": false + }, + { + "name": "maxTokens", + "type": 4, + "optional": true + }, + { + "name": "model", + "type": 2, + "optional": false + }, + { + "name": "provider", + "type": 2, + "optional": false + }, + { + "name": "rawOutput", + "type": 5, + "optional": false + }, + { + "name": "shadowedRange", + "type": 25, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 26, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 4, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 2, + "optional": true + }, + { + "name": "summary", + "type": 5, + "optional": false + }, + { + "name": "usage", + "type": 27, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "union", + "types": [ + 7, + 9, + 11, + 13, + 22 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 14, + "optional": false + }, + { + "name": "offloaded", + "type": 3, + "optional": true + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 4, + "optional": false + }, + { + "name": "height", + "type": 4, + "optional": false + }, + { + "name": "mediaType", + "type": 15, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": true + }, + { + "name": "originalDimensions", + "type": 20, + "optional": true + }, + { + "name": "width", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 16, + 17, + 18, + 19 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 4, + "optional": false + }, + { + "name": "width", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 23, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "end", + "type": 4, + "optional": false + }, + { + "name": "start", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 4, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 4, + "optional": true + }, + { + "name": "inputTokens", + "type": 4, + "optional": false + }, + { + "name": "outputTokens", + "type": 4, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 4, + "optional": true + }, + { + "name": "totalTokens", + "type": 4, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 2, + "optional": false + }, + { + "name": "maxTokens", + "type": 4, + "optional": true + }, + { + "name": "model", + "type": 2, + "optional": false + }, + { + "name": "provider", + "type": 2, + "optional": false + }, + { + "name": "rawOutput", + "type": 5, + "optional": true + }, + { + "name": "shadowedRange", + "type": 25, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 26, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 4, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 2, + "optional": true + }, + { + "name": "summary", + "type": 5, + "optional": false + }, + { + "name": "usage", + "type": 27, + "optional": true + } + ], + "indices": [] + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "2517ba143a271508d3ca35126d5aca8f7f1facf5aaddce4adf011832042fa2b9", "schema": { @@ -22007,850 +21969,6 @@ "names": [], "sources": [] }, - { - "digest": "26f3bb7529cfce1e3a0f1ededa365d8b426758ca0feeb0beabeee805f8bb8346", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "array", - "element": 1 - }, - { - "kind": "union", - "types": [ - 2, - 8, - 66, - 68 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "args", - "type": 3, - "optional": false - }, - { - "name": "dt", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "time0", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "array", - "element": 6 - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 9, - "optional": false - }, - { - "name": "time", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 65, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 10, - 12, - 38, - 41, - 43, - 45, - 62 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "type", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 13, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 37, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 14, - 16, - 26, - 29, - 33, - 35 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 17, - "optional": false - }, - { - "name": "offloaded", - "type": 24, - "optional": true - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 6, - "optional": false - }, - { - "name": "height", - "type": 6, - "optional": false - }, - { - "name": "mediaType", - "type": 18, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "originalDimensions", - "type": 23, - "optional": true - }, - { - "name": "width", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 19, - 20, - 21, - 22 - ] - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 6, - "optional": false - }, - { - "name": "width", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 27, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 30, - "optional": false - }, - { - "name": "isError", - "type": 31, - "optional": true - }, - { - "name": "toolCallId", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 13 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 36, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 39, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 40, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 15, - 25, - 28, - 32, - 34, - 36 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 46, - "optional": false - }, - { - "name": "replayState", - "type": 58, - "optional": true - }, - { - "name": "type", - "type": 61, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 47, - 50, - 52, - 54, - 56 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 4, - "optional": false - }, - { - "name": "message", - "type": 4, - "optional": false - }, - { - "name": "offloadImages", - "type": 6, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 6, - "optional": true - }, - { - "name": "requestId", - "type": 4, - "optional": true - }, - { - "name": "status", - "type": 6, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 59, - "optional": true - }, - { - "name": "response", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 60 - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 63, - "optional": false - }, - { - "name": "usage", - "type": 64, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 6, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 6, - "optional": true - }, - { - "name": "inputTokens", - "type": 6, - "optional": false - }, - { - "name": "outputTokens", - "type": 6, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 6, - "optional": true - }, - { - "name": "totalTokens", - "type": 6, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "chunk" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 5, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "texts", - "type": 3, - "optional": false - }, - { - "name": "time0", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 67, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 5, - "optional": false - }, - { - "name": "index", - "type": 6, - "optional": false - }, - { - "name": "texts", - "type": 3, - "optional": false - }, - { - "name": "time0", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 69, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "2765e9119edf5816ac1ab4c95c5ee32c90403f3742962eff11544f7752d59d2e", "schema": { @@ -22960,11 +22078,11 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:145" + "packages/llm/llm/src/types.ts:136" ] }, { - "digest": "29af48b840d0cd9e48b6f50bf3b354f8f6340607c5b99220a48e74f60beac9e2", + "digest": "2a47ef7025d7dcf7e9977aadd738e7408a210b101a7dbbd37f4d87f22166eff0", "schema": { "root": 0, "nodes": [ @@ -22978,32 +22096,22 @@ }, { "name": "ignorable", - "type": 24, + "type": 20, "optional": true }, { "name": "seq", - "type": 17, - "optional": false - }, - { - "name": "sourceEventSeqs", - "type": 38, - "optional": true - }, - { - "name": "surfaceOp", - "type": 39, + "type": 2, "optional": false }, { "name": "time", - "type": 17, + "type": 2, "optional": false }, { "name": "type", - "type": 43, + "type": 93, "optional": false } ], @@ -23013,92 +22121,57 @@ "kind": "object", "properties": [ { - "name": "error", + "name": "maxTokens", "type": 2, - "optional": true + "optional": false }, { - "name": "message", + "name": "messageSeqs", + "type": 3, + "optional": false + }, + { + "name": "messages", "type": 4, "optional": false }, { - "name": "meta", - "type": 34, - "optional": true - }, - { - "name": "step", - "type": 17, + "name": "route", + "type": 92, "optional": false }, { - "name": "turn", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 3, + "name": "system", + "type": 10, "optional": false }, { - "name": "name", - "type": 3, + "name": "titleProvider", + "type": 10, "optional": false - }, - { - "name": "reason", - "type": 3, - "optional": true } ], "indices": [] }, { "kind": "primitive", - "type": "string" + "type": "number" }, { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "role", - "type": 31, - "optional": false - }, - { - "name": "source", - "type": 32, - "optional": false - } - ], - "indices": [] + "kind": "array", + "element": 2 }, { - "kind": "tuple", - "elements": [ - { - "type": 6, - "optional": false, - "rest": false - } + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 32, + 51, + 56 ] }, { @@ -23109,19 +22182,29 @@ "type": 7, "optional": false }, + { + "name": "id", + "type": 10, + "optional": false + }, { "name": "isError", "type": 29, "optional": true }, { - "name": "toolCallId", - "type": 3, + "name": "role", + "type": 30, "optional": false }, { - "name": "type", - "type": 30, + "name": "source", + "type": 31, + "optional": false + }, + { + "name": "toolCallId", + "type": 10, "optional": false } ], @@ -23134,80 +22217,43 @@ { "kind": "union", "types": [ - 6, 9, - 11, - 13, - 15, - 26 + 12, + 22, + 25, + 27 ] }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, { "kind": "object", "properties": [ { "name": "arguments", - "type": 3, + "type": 10, "optional": false }, { "name": "id", - "type": 3, + "type": 10, "optional": false }, { "name": "name", - "type": 3, + "type": 10, "optional": false }, { "name": "type", - "type": 14, + "type": 11, "optional": false } ], "indices": [] }, + { + "kind": "primitive", + "type": "string" + }, { "kind": "literal", "value": "tool-call" @@ -23217,17 +22263,17 @@ "properties": [ { "name": "attachment", - "type": 16, + "type": 13, "optional": false }, { "name": "offloaded", - "type": 24, + "type": 20, "optional": true }, { "name": "type", - "type": 25, + "type": 21, "optional": false } ], @@ -23238,63 +22284,51 @@ "properties": [ { "name": "attachmentId", - "type": 3, + "type": 10, "optional": false }, { "name": "bytes", - "type": 17, + "type": 2, "optional": false }, { "name": "height", - "type": 17, + "type": 2, "optional": false }, { "name": "mediaType", - "type": 18, + "type": 14, "optional": false }, { "name": "name", - "type": 3, + "type": 10, "optional": true }, { "name": "originalDimensions", - "type": 23, + "type": 19, "optional": true }, { "name": "width", - "type": 17, + "type": 2, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "number" - }, { "kind": "union", "types": [ - 19, - 20, - 21, - 22 + 15, + 16, + 17, + 18 ] }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, { "kind": "literal", "value": "image/png" @@ -23303,17 +22337,25 @@ "kind": "literal", "value": "image/webp" }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, { "kind": "object", "properties": [ { "name": "height", - "type": 17, + "type": 2, "optional": false }, { "name": "width", - "type": 17, + "type": 2, "optional": false } ], @@ -23332,7 +22374,68 @@ "properties": [ { "name": "attachment", - "type": 27, + "type": 23, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 10, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, "optional": false }, { @@ -23343,30 +22446,9 @@ ], "indices": [] }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 17, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", - "value": "file" + "value": "text" }, { "kind": "primitive", @@ -23374,104 +22456,871 @@ }, { "kind": "literal", - "value": "tool-result" - }, - { - "kind": "literal", - "value": "user" + "value": "tool" }, { "kind": "object", "properties": [ { "name": "callId", - "type": 3, + "type": 10, "optional": false }, { "name": "kind", - "type": 33, + "type": 30, "optional": false } ], "indices": [] }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "union", - "types": [ - 3, - 17, - 29, - 35, - 36, - 37 - ] - }, - { - "kind": "array", - "element": 34 - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "object", - "properties": [], - "indices": [ - { - "key": 3, - "value": 34 - } - ] - }, - { - "kind": "array", - "element": 17 - }, - { - "kind": "union", - "types": [ - 40, - 41 - ] - }, - { - "kind": "literal", - "value": "append" - }, { "kind": "object", "properties": [ { - "name": "endSeq", - "type": 17, + "name": "content", + "type": 7, "optional": false }, { - "name": "op", - "type": 42, + "name": "id", + "type": 10, "optional": false }, { - "name": "startSeq", - "type": 17, + "name": "role", + "type": 33, + "optional": false + }, + { + "name": "source", + "type": 34, "optional": false } ], "indices": [] }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 35, + 40, + 42, + 44, + 46, + 48, + 50 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + }, + { + "name": "sections", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 39 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "plugin", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 52, + "optional": false + }, + { + "name": "source", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "replayState", + "type": 55, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 57, + "optional": false + }, + { + "name": "source", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 31, + 35, + 40, + 42, + 44, + 46, + 48, + 50, + 53, + 59, + 67, + 68, + 70, + 74, + 76, + 83, + 85, + 87, + 89, + 91 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 20, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 10, + "optional": true + }, + { + "name": "changes", + "type": 60, + "optional": false + }, + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 61 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 62, + "optional": false + }, + { + "name": "digest", + "type": 10, + "optional": true + }, + { + "name": "path", + "type": 10, + "optional": false + }, + { + "name": "scope", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 63, + 64, + 65 + ] + }, { "kind": "literal", "value": "replace" }, { "kind": "literal", - "value": "tool/result" + "value": "set" + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 10, + "optional": true + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "rpcId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 10, + "optional": false + }, + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 69, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "ruleId", + "type": 10, + "optional": false + }, + { + "name": "source", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 71, + "optional": false + }, + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "update", + "type": 20, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 72 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 43, + "optional": false + }, + { + "name": "kind", + "type": 75, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 77, + "optional": false + }, + { + "name": "references", + "type": 78, + "optional": false + }, + { + "name": "version", + "type": 82, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 79 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 2, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 80, + "optional": false + }, + { + "name": "compacted", + "type": 29, + "optional": false + }, + { + "name": "inputIndex", + "type": 2, + "optional": false + }, + { + "name": "label", + "type": 10, + "optional": false + }, + { + "name": "omittedBytes", + "type": 2, + "optional": false + }, + { + "name": "omittedMessages", + "type": 2, + "optional": false + }, + { + "name": "originalMessages", + "type": 2, + "optional": false + }, + { + "name": "retainedMessages", + "type": 2, + "optional": false + }, + { + "name": "sessionId", + "type": 10, + "optional": false + }, + { + "name": "truncated", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 81 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 84, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 86, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 88, + "optional": false + }, + { + "name": "revision", + "type": 2, + "optional": false + }, + { + "name": "round", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 90, + "optional": false + }, + { + "name": "messageId", + "type": 10, + "optional": false + }, + { + "name": "senderId", + "type": 10, + "optional": false + }, + { + "name": "senderName", + "type": 10, + "optional": false + }, + { + "name": "teamId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session/title-llm-request" } ] }, @@ -23863,7 +23712,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:429" + "packages/llm/llm/src/types.ts:420" ] }, { @@ -24024,6 +23873,833 @@ "names": [], "sources": [] }, + { + "digest": "2efae120e250c2f5ac1777c67dc76255f06608a138b2446e8a0489bb25b9b35c", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "step", + "type": 1, + "optional": false + }, + { + "name": "stream", + "type": 2, + "optional": false + }, + { + "name": "turn", + "type": 1, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 9, + 63, + 65 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 5, + "optional": false + }, + { + "name": "dt", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "time0", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "array", + "element": 1 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 10, + "optional": false + }, + { + "name": "time", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 62, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 11, + 13, + 35, + 38, + 40, + 42, + 59 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "type", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 14, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 15, + 17, + 27, + 30, + 32 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 16, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 18, + "optional": false + }, + { + "name": "offloaded", + "type": 25, + "optional": true + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 1, + "optional": false + }, + { + "name": "height", + "type": 1, + "optional": false + }, + { + "name": "mediaType", + "type": 19, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 24, + "optional": true + }, + { + "name": "width", + "type": 1, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 20, + 21, + 22, + 23 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 1, + "optional": false + }, + { + "name": "width", + "type": 1, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 28, + "optional": false + }, + { + "name": "type", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 1, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 33, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 36, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 16, + 26, + 29, + 31, + 33 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 43, + "optional": false + }, + { + "name": "replayState", + "type": 55, + "optional": true + }, + { + "name": "type", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 44, + 47, + 49, + 51, + 53 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 6, + "optional": false + }, + { + "name": "message", + "type": 6, + "optional": false + }, + { + "name": "offloadImages", + "type": 1, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 1, + "optional": true + }, + { + "name": "requestId", + "type": 6, + "optional": true + }, + { + "name": "status", + "type": 1, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 56, + "optional": true + }, + { + "name": "response", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 57 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 60, + "optional": false + }, + { + "name": "usage", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 1, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 1, + "optional": true + }, + { + "name": "inputTokens", + "type": 1, + "optional": false + }, + { + "name": "outputTokens", + "type": 1, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 1, + "optional": true + }, + { + "name": "totalTokens", + "type": 1, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "texts", + "type": 5, + "optional": false + }, + { + "name": "time0", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 64, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 1, + "optional": false + }, + { + "name": "texts", + "type": 5, + "optional": false + }, + { + "name": "time0", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + } + ] + }, + "names": [], + "sources": [ + "packages/core/session/src/types.ts:342" + ] + }, { "digest": "2f0aefb72ab453c4bf21a6687f436775d359dc6f8f10410fd4c0615b20bd9d76", "schema": { @@ -24210,6 +24886,866 @@ "packages/core/session/src/types.ts:377" ] }, + { + "digest": "2f1565d92801f4334f8dc34fbb980890eef621e81a7c90ed0fd8d0a6db2ec3b2", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 26, + "optional": true + }, + { + "name": "seq", + "type": 2, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "step", + "type": 2, + "optional": false + }, + { + "name": "stream", + "type": 3, + "optional": false + }, + { + "name": "turn", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 10, + 64, + 66 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 6, + "optional": false + }, + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 11, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 12, + 14, + 36, + 39, + 41, + 43, + 60 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 15, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 16, + 18, + 28, + 31, + 33 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "offloaded", + "type": 26, + "optional": true + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "mediaType", + "type": 20, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 25, + "optional": true + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 21, + 22, + 23, + 24 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 2, + "optional": false + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 29, + "optional": false + }, + { + "name": "type", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 37, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 17, + 27, + 30, + 32, + 34 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 44, + "optional": false + }, + { + "name": "replayState", + "type": 56, + "optional": true + }, + { + "name": "type", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 45, + 48, + 50, + 52, + 54 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 7, + "optional": false + }, + { + "name": "message", + "type": 7, + "optional": false + }, + { + "name": "offloadImages", + "type": 2, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 2, + "optional": true + }, + { + "name": "requestId", + "type": 7, + "optional": true + }, + { + "name": "status", + "type": 2, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 57, + "optional": true + }, + { + "name": "response", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 58 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 61, + "optional": false + }, + { + "name": "usage", + "type": 62, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 2, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 2, + "optional": true + }, + { + "name": "inputTokens", + "type": 2, + "optional": false + }, + { + "name": "outputTokens", + "type": 2, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 2, + "optional": true + }, + { + "name": "totalTokens", + "type": 2, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "texts", + "type": 6, + "optional": false + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 65, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 8, + "optional": false + }, + { + "name": "index", + "type": 2, + "optional": false + }, + { + "name": "texts", + "type": 6, + "optional": false + }, + { + "name": "time0", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + }, + { + "kind": "literal", + "value": "assistant/attempt" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "2f1e6a7ebace43d727ae138ddcd352eb3813960009e5805b8c5ac84300c97716", "schema": { @@ -24345,1610 +25881,6 @@ "packages/core/tools/src/types.ts:11" ] }, - { - "digest": "300341f890f7b9506a1749fff4fa5239d16ea1c63ff6b15851acb03c20f3b48d", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "array", - "element": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 7, - 18, - 21, - 24, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 8, - "optional": false - }, - { - "name": "offloaded", - "type": 16, - "optional": true - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "mediaType", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 15, - "optional": true - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 11, - 12, - 13, - 14 - ] - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 30, - 39, - 41, - 42, - 45, - 50, - 52, - 57, - 58, - 59, - 61, - 63, - 64, - 71, - 73, - 75, - 77, - 79, - 82, - 83 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 16, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 5, - "optional": true - }, - { - "name": "changes", - "type": 31, - "optional": false - }, - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 38, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 32 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 33, - "optional": false - }, - { - "name": "digest", - "type": 5, - "optional": true - }, - { - "name": "path", - "type": 5, - "optional": false - }, - { - "name": "scope", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 34, - 35, - 36 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 40, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 5, - "optional": true - }, - { - "name": "kind", - "type": 28, - "optional": false - }, - { - "name": "rpcId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 5, - "optional": false - }, - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "ruleId", - "type": 5, - "optional": false - }, - { - "name": "source", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 46, - "optional": false - }, - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "update", - "type": 16, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 47 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 53, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "sections", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 56 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 60, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 60, - "optional": false - }, - { - "name": "kind", - "type": 65, - "optional": false - }, - { - "name": "references", - "type": 66, - "optional": false - }, - { - "name": "version", - "type": 70, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 67 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 9, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 68, - "optional": false - }, - { - "name": "compacted", - "type": 22, - "optional": false - }, - { - "name": "inputIndex", - "type": 9, - "optional": false - }, - { - "name": "label", - "type": 5, - "optional": false - }, - { - "name": "omittedBytes", - "type": 9, - "optional": false - }, - { - "name": "omittedMessages", - "type": 9, - "optional": false - }, - { - "name": "originalMessages", - "type": 9, - "optional": false - }, - { - "name": "retainedMessages", - "type": 9, - "optional": false - }, - { - "name": "sessionId", - "type": 5, - "optional": false - }, - { - "name": "truncated", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 9, - 69 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 72, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 74, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 76, - "optional": false - }, - { - "name": "revision", - "type": 9, - "optional": false - }, - { - "name": "round", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 78, - "optional": false - }, - { - "name": "messageId", - "type": 5, - "optional": false - }, - { - "name": "senderId", - "type": 5, - "optional": false - }, - { - "name": "senderName", - "type": 5, - "optional": false - }, - { - "name": "teamId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 80, - "optional": false - }, - { - "name": "model", - "type": 5, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "replayState", - "type": 81, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 28, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [], - "sources": [] - }, - { - "digest": "302b01ddddcbb3b16cfa3fba2a5d99f5082a55fbd9dc5c83a179a228b8a6a0ca", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "role", - "type": 27, - "optional": false - }, - { - "name": "source", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 3, - 6, - 17, - 20, - 23, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 7, - "optional": false - }, - { - "name": "offloaded", - "type": 15, - "optional": true - }, - { - "name": "type", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "mediaType", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "originalDimensions", - "type": 14, - "optional": true - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 10, - 11, - 12, - 13 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 18, - "optional": false - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 21, - "optional": true - }, - { - "name": "toolCallId", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "union", - "types": [ - 29, - 34, - 36, - 38, - 40, - 42, - 44 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 30, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "sections", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 33 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "text", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 35, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/llm/llm/src/message.ts#SystemMessage" - ], - "sources": [ - "packages/llm/llm/src/message.ts:158" - ] - }, { "digest": "30d5a537b296685770b1241c4b4bbde19d5a31ff81aa23df73fab5e90b8fc65f", "schema": { @@ -26046,1152 +25978,6 @@ "packages/session/session-title/src/types.ts:28" ] }, - { - "digest": "314765bdff29c7862fb6ce820f1773563ba3094a680d163ea21180a2591b8578", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 16, - "optional": true - }, - { - "name": "seq", - "type": 9, - "optional": false - }, - { - "name": "sourceEventSeqs", - "type": 84, - "optional": true - }, - { - "name": "surfaceOp", - "type": 85, - "optional": false - }, - { - "name": "time", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 88, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 7, - 18, - 21, - 24, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 8, - "optional": false - }, - { - "name": "offloaded", - "type": 16, - "optional": true - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "mediaType", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 15, - "optional": true - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 11, - 12, - 13, - 14 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 30, - 39, - 41, - 42, - 45, - 50, - 52, - 57, - 58, - 59, - 61, - 63, - 64, - 71, - 73, - 75, - 77, - 79, - 82, - 83 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 16, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 5, - "optional": true - }, - { - "name": "changes", - "type": 31, - "optional": false - }, - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 38, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 32 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 33, - "optional": false - }, - { - "name": "digest", - "type": 5, - "optional": true - }, - { - "name": "path", - "type": 5, - "optional": false - }, - { - "name": "scope", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 34, - 35, - 36 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 40, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 5, - "optional": true - }, - { - "name": "kind", - "type": 28, - "optional": false - }, - { - "name": "rpcId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 5, - "optional": false - }, - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "ruleId", - "type": 5, - "optional": false - }, - { - "name": "source", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 46, - "optional": false - }, - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "update", - "type": 16, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 47 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 53, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "sections", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 56 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 60, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 60, - "optional": false - }, - { - "name": "kind", - "type": 65, - "optional": false - }, - { - "name": "references", - "type": 66, - "optional": false - }, - { - "name": "version", - "type": 70, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 67 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 9, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 68, - "optional": false - }, - { - "name": "compacted", - "type": 22, - "optional": false - }, - { - "name": "inputIndex", - "type": 9, - "optional": false - }, - { - "name": "label", - "type": 5, - "optional": false - }, - { - "name": "omittedBytes", - "type": 9, - "optional": false - }, - { - "name": "omittedMessages", - "type": 9, - "optional": false - }, - { - "name": "originalMessages", - "type": 9, - "optional": false - }, - { - "name": "retainedMessages", - "type": 9, - "optional": false - }, - { - "name": "sessionId", - "type": 5, - "optional": false - }, - { - "name": "truncated", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 9, - 69 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 72, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 74, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 76, - "optional": false - }, - { - "name": "revision", - "type": 9, - "optional": false - }, - { - "name": "round", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 78, - "optional": false - }, - { - "name": "messageId", - "type": 5, - "optional": false - }, - { - "name": "senderId", - "type": 5, - "optional": false - }, - { - "name": "senderName", - "type": 5, - "optional": false - }, - { - "name": "teamId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 80, - "optional": false - }, - { - "name": "model", - "type": 5, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "replayState", - "type": 81, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 9 - }, - { - "kind": "union", - "types": [ - 86, - 87 - ] - }, - { - "kind": "literal", - "value": "append" - }, - { - "kind": "object", - "properties": [ - { - "name": "endSeq", - "type": 9, - "optional": false - }, - { - "name": "op", - "type": 35, - "optional": false - }, - { - "name": "startSeq", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "user/message" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "326a9bfda27dda5882fb3cbe6e715df41dae2298fdae3d66437457268a665693", "schema": { @@ -27422,438 +26208,6 @@ "names": [], "sources": [] }, - { - "digest": "356aad27134a0e31af67c994ff8b9e4b91acfb6c4917b3bc1f7a62bbf82794d5", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "error", - "type": 1, - "optional": true - }, - { - "name": "message", - "type": 3, - "optional": false - }, - { - "name": "meta", - "type": 33, - "optional": true - }, - { - "name": "step", - "type": 16, - "optional": false - }, - { - "name": "turn", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - }, - { - "name": "reason", - "type": 2, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 2, - "optional": false - }, - { - "name": "role", - "type": 30, - "optional": false - }, - { - "name": "source", - "type": 31, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "tuple", - "elements": [ - { - "type": 5, - "optional": false, - "rest": false - } - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "isError", - "type": 28, - "optional": true - }, - { - "name": "toolCallId", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "union", - "types": [ - 5, - 8, - 10, - 12, - 14, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 15, - "optional": false - }, - { - "name": "offloaded", - "type": 23, - "optional": true - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 2, - "optional": false - }, - { - "name": "bytes", - "type": 16, - "optional": false - }, - { - "name": "height", - "type": 16, - "optional": false - }, - { - "name": "mediaType", - "type": 17, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": true - }, - { - "name": "originalDimensions", - "type": 22, - "optional": true - }, - { - "name": "width", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 18, - 19, - 20, - 21 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 16, - "optional": false - }, - { - "name": "width", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 26, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 2, - "optional": false - }, - { - "name": "bytes", - "type": 16, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 2, - "optional": false - }, - { - "name": "kind", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "union", - "types": [ - 2, - 16, - 28, - 34, - 35, - 36 - ] - }, - { - "kind": "array", - "element": 33 - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "object", - "properties": [], - "indices": [ - { - "key": 2, - "value": 33 - } - ] - } - ] - }, - "names": [], - "sources": [ - "packages/core/session/src/types.ts:362" - ] - }, { "digest": "36d6a9a871d949ea4f3edd919d81d66aa69218bebef38899d2a1282c39420a1f", "schema": { @@ -28295,7 +26649,7 @@ ] }, { - "digest": "3aa261c8516b5c955ed12080e6257a56cbe513f6c9f0ac9274c12e96c196ebca", + "digest": "394cf42541bf794f465314cf0c7b86ad4bc32e34cac111ebbe592a21c72d8c52", "schema": { "root": 0, "nodes": [ @@ -28303,59 +26657,80 @@ "kind": "object", "properties": [ { - "name": "compactionId", + "name": "message", "type": 1, "optional": false }, { - "name": "maxTokens", - "type": 2, - "optional": true - }, - { - "name": "model", - "type": 1, + "name": "teamId", + "type": 5, "optional": false }, { - "name": "provider", - "type": 1, + "name": "version", + "type": 25, "optional": false - }, + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ { - "name": "rawOutput", - "type": 3, - "optional": true - }, - { - "name": "shadowedRange", - "type": 27, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 28, - "optional": false - }, - { - "name": "shadowedTokenCount", + "name": "content", "type": 2, "optional": false }, { - "name": "sourceCommandId", - "type": 1, - "optional": true - }, - { - "name": "summary", - "type": 3, + "name": "id", + "type": 5, "optional": false }, { - "name": "usage", - "type": 29, - "optional": true + "name": "senderId", + "type": 5, + "optional": false + }, + { + "name": "senderName", + "type": 5, + "optional": false + }, + { + "name": "targetId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 9, + 11, + 22 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false } ], "indices": [] @@ -28364,75 +26739,6 @@ "kind": "primitive", "type": "string" }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 8, - 10, - 12, - 14, - 24 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 6, - "optional": true - }, - { - "name": "toolCallId", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "reasoning" @@ -28442,12 +26748,12 @@ "properties": [ { "name": "text", - "type": 1, + "type": 5, "optional": false }, { "name": "type", - "type": 11, + "type": 8, "optional": false } ], @@ -28462,22 +26768,22 @@ "properties": [ { "name": "arguments", - "type": 1, + "type": 5, "optional": false }, { "name": "id", - "type": 1, + "type": 5, "optional": false }, { "name": "name", - "type": 1, + "type": 5, "optional": false }, { "name": "type", - "type": 13, + "type": 10, "optional": false } ], @@ -28492,17 +26798,17 @@ "properties": [ { "name": "attachment", - "type": 15, + "type": 12, "optional": false }, { "name": "offloaded", - "type": 22, + "type": 20, "optional": true }, { "name": "type", - "type": 23, + "type": 21, "optional": false } ], @@ -28513,49 +26819,53 @@ "properties": [ { "name": "attachmentId", - "type": 1, + "type": 5, "optional": false }, { "name": "bytes", - "type": 2, + "type": 13, "optional": false }, { "name": "height", - "type": 2, + "type": 13, "optional": false }, { "name": "mediaType", - "type": 16, + "type": 14, "optional": false }, { "name": "name", - "type": 1, + "type": 5, "optional": true }, { "name": "originalDimensions", - "type": 21, + "type": 19, "optional": true }, { "name": "width", - "type": 2, + "type": 13, "optional": false } ], "indices": [] }, + { + "kind": "primitive", + "type": "number" + }, { "kind": "union", "types": [ + 15, + 16, 17, - 18, - 19, - 20 + 18 ] }, { @@ -28579,12 +26889,12 @@ "properties": [ { "name": "height", - "type": 2, + "type": 13, "optional": false }, { "name": "width", - "type": 2, + "type": 13, "optional": false } ], @@ -28603,12 +26913,12 @@ "properties": [ { "name": "attachment", - "type": 25, + "type": 23, "optional": false }, { "name": "type", - "type": 26, + "type": 24, "optional": false } ], @@ -28619,17 +26929,17 @@ "properties": [ { "name": "attachmentId", - "type": 1, + "type": 5, "optional": false }, { "name": "bytes", - "type": 2, + "type": 13, "optional": false }, { "name": "name", - "type": 1, + "type": 5, "optional": false } ], @@ -28640,65 +26950,15 @@ "value": "file" }, { - "kind": "object", - "properties": [ - { - "name": "end", - "type": 2, - "optional": false - }, - { - "name": "start", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 2, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 2, - "optional": true - }, - { - "name": "inputTokens", - "type": 2, - "optional": false - }, - { - "name": "outputTokens", - "type": 2, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 2, - "optional": true - }, - { - "name": "totalTokens", - "type": 2, - "optional": true - } - ], - "indices": [] + "kind": "literal", + "value": 2 } ] }, "names": [], - "sources": [] + "sources": [ + "packages/experimental/agent-team/src/types.ts:225" + ] }, { "digest": "3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e", @@ -29354,6 +27614,260 @@ "names": [], "sources": [] }, + { + "digest": "3fb78de1c2ec9391966fe41554296f85eb56eb92bd480c9bcbbc7697febcf92e", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "union", + "types": [ + 1, + 4, + 15, + 18, + 20 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 5, + "optional": false + }, + { + "name": "offloaded", + "type": 13, + "optional": true + }, + { + "name": "type", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 6, + "optional": false + }, + { + "name": "height", + "type": 6, + "optional": false + }, + { + "name": "mediaType", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": true + }, + { + "name": "originalDimensions", + "type": 12, + "optional": true + }, + { + "name": "width", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 8, + 9, + 10, + 11 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 6, + "optional": false + }, + { + "name": "width", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 16, + "optional": false + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + } + ] + }, + "names": [ + "packages/llm/llm/src/types.ts#ContentBlock" + ], + "sources": [ + "packages/llm/llm/src/types.ts:128" + ] + }, { "digest": "42e0916e0dda5f6d1e7bb05d8514717147c036a79c9f36085683469516c1fd3f", "schema": { @@ -29461,386 +27975,6 @@ "names": [], "sources": [] }, - { - "digest": "443371ec07a03a82a0e93d93abca3e70b03bca55ba5b01d507030fcb66e8fbb4", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 24, - "optional": true - }, - { - "name": "seq", - "type": 17, - "optional": false - }, - { - "name": "time", - "type": 17, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "message", - "type": 2, - "optional": false - }, - { - "name": "teamId", - "type": 7, - "optional": false - }, - { - "name": "version", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "senderId", - "type": 7, - "optional": false - }, - { - "name": "senderName", - "type": 7, - "optional": false - }, - { - "name": "targetId", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 9, - 11, - 13, - 15, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 6, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 14, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 16, - "optional": false - }, - { - "name": "offloaded", - "type": 24, - "optional": true - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 17, - "optional": false - }, - { - "name": "height", - "type": 17, - "optional": false - }, - { - "name": "mediaType", - "type": 18, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "originalDimensions", - "type": 23, - "optional": true - }, - { - "name": "width", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 19, - 20, - 21, - 22 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 17, - "optional": false - }, - { - "name": "width", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 27, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 17, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "literal", - "value": 2 - }, - { - "kind": "literal", - "value": "team/message/queued" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "44818000e56acb97afdb5045ce235eb55e3fb1ccabc9fc7d0750bb38f36a7f8e", "schema": { @@ -30031,1091 +28165,6 @@ "packages/compaction/compaction-image-offload/src/projection.ts:25" ] }, - { - "digest": "478738df7e7d2b103b09fb937817a9302c81076809f2b341169e00a9419c5665", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "array", - "element": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 32, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 7, - 18, - 21, - 24, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 8, - "optional": false - }, - { - "name": "offloaded", - "type": 16, - "optional": true - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "mediaType", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 15, - "optional": true - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 11, - 12, - 13, - 14 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 9, - "optional": false - }, - { - "name": "width", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "union", - "types": [ - 29, - 30, - 31 - ] - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 33, - 42, - 44, - 45, - 48, - 53, - 55, - 60, - 61, - 62, - 64, - 66, - 67, - 74, - 76, - 78, - 80, - 82, - 85, - 86 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 16, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 5, - "optional": true - }, - { - "name": "changes", - "type": 34, - "optional": false - }, - { - "name": "form", - "type": 40, - "optional": false - }, - { - "name": "kind", - "type": 41, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 35 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 36, - "optional": false - }, - { - "name": "digest", - "type": 5, - "optional": true - }, - { - "name": "path", - "type": 5, - "optional": false - }, - { - "name": "scope", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 37, - 38, - 39 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 43, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 5, - "optional": true - }, - { - "name": "kind", - "type": 31, - "optional": false - }, - { - "name": "rpcId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 5, - "optional": false - }, - { - "name": "form", - "type": 46, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "ruleId", - "type": 5, - "optional": false - }, - { - "name": "source", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 49, - "optional": false - }, - { - "name": "form", - "type": 51, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "update", - "type": 16, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 50 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 40, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 56, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "sections", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 59 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 46, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 40, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 63, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 65, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 51, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 63, - "optional": false - }, - { - "name": "kind", - "type": 68, - "optional": false - }, - { - "name": "references", - "type": 69, - "optional": false - }, - { - "name": "version", - "type": 73, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 70 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 9, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 71, - "optional": false - }, - { - "name": "compacted", - "type": 22, - "optional": false - }, - { - "name": "inputIndex", - "type": 9, - "optional": false - }, - { - "name": "label", - "type": 5, - "optional": false - }, - { - "name": "omittedBytes", - "type": 9, - "optional": false - }, - { - "name": "omittedMessages", - "type": 9, - "optional": false - }, - { - "name": "originalMessages", - "type": 9, - "optional": false - }, - { - "name": "retainedMessages", - "type": 9, - "optional": false - }, - { - "name": "sessionId", - "type": 5, - "optional": false - }, - { - "name": "truncated", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 9, - 72 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 46, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 65, - "optional": false - }, - { - "name": "kind", - "type": 77, - "optional": false - }, - { - "name": "senderSessionId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 5, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - }, - { - "name": "revision", - "type": 9, - "optional": false - }, - { - "name": "round", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 81, - "optional": false - }, - { - "name": "messageId", - "type": 5, - "optional": false - }, - { - "name": "senderId", - "type": 5, - "optional": false - }, - { - "name": "senderName", - "type": 5, - "optional": false - }, - { - "name": "teamId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 83, - "optional": false - }, - { - "name": "model", - "type": 5, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "replayState", - "type": 84, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "plugin", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 31, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "47e5d84f1a93450a78c7f3954b43990d0f629af7c034a56313e5deb63e772c1b", "schema": { @@ -32337,1075 +29386,6 @@ "packages/workflow/workflow/src/types.ts:13" ] }, - { - "digest": "4de5e7644130ed715ef6b5a4d86a87b30dca4096d1a6683c66acf6f7809379c7", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "role", - "type": 27, - "optional": false - }, - { - "name": "source", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 3, - 6, - 17, - 20, - 23, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 7, - "optional": false - }, - { - "name": "offloaded", - "type": 15, - "optional": true - }, - { - "name": "type", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "mediaType", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "originalDimensions", - "type": 14, - "optional": true - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 10, - 11, - 12, - 13 - ] - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 8, - "optional": false - }, - { - "name": "width", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 18, - "optional": false - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 8, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 21, - "optional": true - }, - { - "name": "toolCallId", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 29, - 38, - 40, - 41, - 44, - 49, - 51, - 56, - 57, - 58, - 60, - 62, - 63, - 70, - 72, - 74, - 76, - 78, - 81, - 82 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 15, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 4, - "optional": true - }, - { - "name": "changes", - "type": 30, - "optional": false - }, - { - "name": "form", - "type": 36, - "optional": false - }, - { - "name": "kind", - "type": 37, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 31 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 32, - "optional": false - }, - { - "name": "digest", - "type": 4, - "optional": true - }, - { - "name": "path", - "type": 4, - "optional": false - }, - { - "name": "scope", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 33, - 34, - 35 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 4, - "optional": false - }, - { - "name": "kind", - "type": 39, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 4, - "optional": true - }, - { - "name": "kind", - "type": 27, - "optional": false - }, - { - "name": "rpcId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 4, - "optional": false - }, - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 43, - "optional": false - }, - { - "name": "provider", - "type": 4, - "optional": false - }, - { - "name": "ruleId", - "type": 4, - "optional": false - }, - { - "name": "source", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 45, - "optional": false - }, - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 48, - "optional": false - }, - { - "name": "update", - "type": 15, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 46 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 36, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 52, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "sections", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 55 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "text", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 36, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 59, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 61, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 59, - "optional": false - }, - { - "name": "kind", - "type": 64, - "optional": false - }, - { - "name": "references", - "type": 65, - "optional": false - }, - { - "name": "version", - "type": 69, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 66 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 8, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 67, - "optional": false - }, - { - "name": "compacted", - "type": 21, - "optional": false - }, - { - "name": "inputIndex", - "type": 8, - "optional": false - }, - { - "name": "label", - "type": 4, - "optional": false - }, - { - "name": "omittedBytes", - "type": 8, - "optional": false - }, - { - "name": "omittedMessages", - "type": 8, - "optional": false - }, - { - "name": "originalMessages", - "type": 8, - "optional": false - }, - { - "name": "retainedMessages", - "type": 8, - "optional": false - }, - { - "name": "sessionId", - "type": 4, - "optional": false - }, - { - "name": "truncated", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 8, - 68 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 71, - "optional": false - }, - { - "name": "senderSessionId", - "type": 4, - "optional": false - }, - { - "name": "summary", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 61, - "optional": false - }, - { - "name": "kind", - "type": 73, - "optional": false - }, - { - "name": "senderSessionId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 4, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - }, - { - "name": "revision", - "type": 8, - "optional": false - }, - { - "name": "round", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 77, - "optional": false - }, - { - "name": "messageId", - "type": 4, - "optional": false - }, - { - "name": "senderId", - "type": 4, - "optional": false - }, - { - "name": "senderName", - "type": 4, - "optional": false - }, - { - "name": "teamId", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 79, - "optional": false - }, - { - "name": "model", - "type": 4, - "optional": false - }, - { - "name": "provider", - "type": 4, - "optional": false - }, - { - "name": "replayState", - "type": 80, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "plugin", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 27, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/llm/llm/src/message.ts#UserMessage" - ], - "sources": [ - "packages/llm/llm/src/message.ts:143" - ] - }, { "digest": "4e011753f8263f436efaabfbb3b4db53a98fc55342c5ded2daf7208b217be159", "schema": { @@ -34237,6 +30217,1121 @@ "names": [], "sources": [] }, + { + "digest": "5274b395e7bf6660d020fba7e29a1e20ef2e77097fd7597e9debb13e45c540d6", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 16, + "optional": true + }, + { + "name": "seq", + "type": 9, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 82, + "optional": true + }, + { + "name": "surfaceOp", + "type": 83, + "optional": false + }, + { + "name": "time", + "type": 9, + "optional": false + }, + { + "name": "type", + "type": 86, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 27, + 36, + 38, + 39, + 42, + 47, + 49, + 54, + 55, + 56, + 58, + 60, + 61, + 69, + 71, + 73, + 75, + 77, + 80, + 81 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 16, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 5, + "optional": true + }, + { + "name": "changes", + "type": 28, + "optional": false + }, + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 30, + "optional": false + }, + { + "name": "digest", + "type": 5, + "optional": true + }, + { + "name": "path", + "type": 5, + "optional": false + }, + { + "name": "scope", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 31, + 32, + 33 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 5, + "optional": true + }, + { + "name": "kind", + "type": 25, + "optional": false + }, + { + "name": "rpcId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 5, + "optional": false + }, + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "ruleId", + "type": 5, + "optional": false + }, + { + "name": "source", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 43, + "optional": false + }, + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "update", + "type": 16, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 44 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 50, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "sections", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 53 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 62, + "optional": false + }, + { + "name": "references", + "type": 63, + "optional": false + }, + { + "name": "version", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 64 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 9, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 65, + "optional": false + }, + { + "name": "compacted", + "type": 67, + "optional": false + }, + { + "name": "inputIndex", + "type": 9, + "optional": false + }, + { + "name": "label", + "type": 5, + "optional": false + }, + { + "name": "omittedBytes", + "type": 9, + "optional": false + }, + { + "name": "omittedMessages", + "type": 9, + "optional": false + }, + { + "name": "originalMessages", + "type": 9, + "optional": false + }, + { + "name": "retainedMessages", + "type": 9, + "optional": false + }, + { + "name": "sessionId", + "type": 5, + "optional": false + }, + { + "name": "truncated", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 66 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "revision", + "type": 9, + "optional": false + }, + { + "name": "round", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "messageId", + "type": 5, + "optional": false + }, + { + "name": "senderId", + "type": 5, + "optional": false + }, + { + "name": "senderName", + "type": 5, + "optional": false + }, + { + "name": "teamId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "model", + "type": 5, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "replayState", + "type": 79, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 9 + }, + { + "kind": "union", + "types": [ + 84, + 85 + ] + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 9, + "optional": false + }, + { + "name": "op", + "type": 32, + "optional": false + }, + { + "name": "startSeq", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user/message" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "529e0ccd0e34079ab4ff21ed87f810cee0388246263bf22e8aba5986b56fae05", "schema": { @@ -34329,6 +31424,912 @@ "packages/core/session/src/types.ts:268" ] }, + { + "digest": "544d9f25d6224883513a9d6c0d0a185764d5fa8aebb24e20f87710b6f284a540", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "interrupted", + "type": 1, + "optional": true + }, + { + "name": "message", + "type": 2, + "optional": false + }, + { + "name": "step", + "type": 10, + "optional": false + }, + { + "name": "stream", + "type": 29, + "optional": false + }, + { + "name": "turn", + "type": 10, + "optional": false + }, + { + "name": "usage", + "type": 66, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 9, + "optional": false + }, + { + "name": "offloaded", + "type": 1, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "mediaType", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 16, + "optional": true + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 12, + 13, + 14, + 15 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 27, + "optional": false + }, + { + "name": "model", + "type": 6, + "optional": false + }, + { + "name": "provider", + "type": 6, + "optional": false + }, + { + "name": "replayState", + "type": 28, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 30 + }, + { + "kind": "union", + "types": [ + 31, + 35, + 68, + 70 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 32, + "optional": false + }, + { + "name": "dt", + "type": 33, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "time0", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "array", + "element": 10 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 36, + "optional": false + }, + { + "name": "time", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 37, + 39, + 41, + 44, + 46, + 48, + 64 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "type", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 4, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 42, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 7, + 17, + 20, + 22, + 24 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 49, + "optional": false + }, + { + "name": "replayState", + "type": 61, + "optional": true + }, + { + "name": "type", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 50, + 53, + 55, + 57, + 59 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 51, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 6, + "optional": false + }, + { + "name": "message", + "type": 6, + "optional": false + }, + { + "name": "offloadImages", + "type": 10, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 10, + "optional": true + }, + { + "name": "requestId", + "type": 6, + "optional": true + }, + { + "name": "status", + "type": 10, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 51, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 62, + "optional": true + }, + { + "name": "response", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 28 + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 65, + "optional": false + }, + { + "name": "usage", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 10, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 10, + "optional": true + }, + { + "name": "inputTokens", + "type": 10, + "optional": false + }, + { + "name": "outputTokens", + "type": 10, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 10, + "optional": true + }, + { + "name": "totalTokens", + "type": 10, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 33, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "texts", + "type": 32, + "optional": false + }, + { + "name": "time0", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 69, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 33, + "optional": false + }, + { + "name": "index", + "type": 10, + "optional": false + }, + { + "name": "texts", + "type": 32, + "optional": false + }, + { + "name": "time0", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 71, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + } + ] + }, + "names": [], + "sources": [ + "packages/core/session/src/types.ts:328" + ] + }, { "digest": "557e148d30b79ee48645850832b30c717d7c3b64641deb5d6133b8b4e91ee0b8", "schema": { @@ -34711,7 +32712,7 @@ "packages/llm/llm/src/types.ts#FinishReason" ], "sources": [ - "packages/llm/llm/src/types.ts:152" + "packages/llm/llm/src/types.ts:143" ] }, { @@ -34770,330 +32771,6 @@ "names": [], "sources": [] }, - { - "digest": "5b694f394d5e11609887a3ccfa82844935d49806c37e336b30be2186d649ab94", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "senderId", - "type": 5, - "optional": false - }, - { - "name": "senderName", - "type": 5, - "optional": false - }, - { - "name": "targetId", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 3, - 7, - 9, - 11, - 13, - 24 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 4, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 14, - "optional": false - }, - { - "name": "offloaded", - "type": 22, - "optional": true - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "mediaType", - "type": 16, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 21, - "optional": true - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 17, - 18, - 19, - 20 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 25, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - } - ] - }, - "names": [ - "packages/experimental/agent-team/src/types.ts#TeamMessageSnapshot" - ], - "sources": [ - "packages/experimental/agent-team/src/types.ts:106" - ] - }, { "digest": "5b6fb1f226ff56402db08a6aae82af76100b14056271875f69ec526a1ae05d51", "schema": { @@ -35687,6 +33364,283 @@ "names": [], "sources": [] }, + { + "digest": "61c16da5dfff82fba0aaf446f0bed211ef0c9bfb2130788e27b41c4244e8686f", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 1, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 5, + 7, + 9, + 20 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 10, + "optional": false + }, + { + "name": "offloaded", + "type": 18, + "optional": true + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 21, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": "block-end" + } + ] + }, + "names": [], + "sources": [ + "packages/llm/llm/src/types.ts:422" + ] + }, { "digest": "62e6a429ff3f390a46ac39fb468692032f42936ca0db19b53454184189401379", "schema": { @@ -35746,1236 +33700,6 @@ "names": [], "sources": [] }, - { - "digest": "646c2f1d243d3a78c5bc9305786fb340f5209c48a97e65f2a186cc5195491f3f", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 18, - "optional": true - }, - { - "name": "seq", - "type": 11, - "optional": false - }, - { - "name": "time", - "type": 11, - "optional": false - }, - { - "name": "type", - "type": 90, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "inserted", - "type": 2, - "optional": false - }, - { - "name": "outcome", - "type": 86, - "optional": true - }, - { - "name": "removedCount", - "type": 11, - "optional": true - }, - { - "name": "start", - "type": 11, - "optional": false - }, - { - "name": "target", - "type": 87, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "role", - "type": 30, - "optional": false - }, - { - "name": "source", - "type": 31, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "union", - "types": [ - 6, - 9, - 20, - 23, - 26, - 28 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 10, - "optional": false - }, - { - "name": "offloaded", - "type": 18, - "optional": true - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "mediaType", - "type": 12, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "originalDimensions", - "type": 17, - "optional": true - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 13, - 14, - 15, - 16 - ] - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 21, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 32, - 41, - 43, - 44, - 47, - 52, - 54, - 59, - 60, - 61, - 63, - 65, - 66, - 73, - 75, - 77, - 79, - 81, - 84, - 85 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 18, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 7, - "optional": true - }, - { - "name": "changes", - "type": 33, - "optional": false - }, - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 40, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 34 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 35, - "optional": false - }, - { - "name": "digest", - "type": 7, - "optional": true - }, - { - "name": "path", - "type": 7, - "optional": false - }, - { - "name": "scope", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 36, - 37, - 38 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 7, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 7, - "optional": true - }, - { - "name": "kind", - "type": 30, - "optional": false - }, - { - "name": "rpcId", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 7, - "optional": false - }, - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 46, - "optional": false - }, - { - "name": "provider", - "type": 7, - "optional": false - }, - { - "name": "ruleId", - "type": 7, - "optional": false - }, - { - "name": "source", - "type": 7, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 48, - "optional": false - }, - { - "name": "form", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "update", - "type": 18, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 49 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 55, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - }, - { - "name": "sections", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 58 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "text", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 64, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 62, - "optional": false - }, - { - "name": "kind", - "type": 67, - "optional": false - }, - { - "name": "references", - "type": 68, - "optional": false - }, - { - "name": "version", - "type": 72, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 69 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 11, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 70, - "optional": false - }, - { - "name": "compacted", - "type": 24, - "optional": false - }, - { - "name": "inputIndex", - "type": 11, - "optional": false - }, - { - "name": "label", - "type": 7, - "optional": false - }, - { - "name": "omittedBytes", - "type": 11, - "optional": false - }, - { - "name": "omittedMessages", - "type": 11, - "optional": false - }, - { - "name": "originalMessages", - "type": 11, - "optional": false - }, - { - "name": "retainedMessages", - "type": 11, - "optional": false - }, - { - "name": "sessionId", - "type": 7, - "optional": false - }, - { - "name": "truncated", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 11, - 71 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 74, - "optional": false - }, - { - "name": "senderSessionId", - "type": 7, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 64, - "optional": false - }, - { - "name": "kind", - "type": 76, - "optional": false - }, - { - "name": "senderSessionId", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 7, - "optional": false - }, - { - "name": "kind", - "type": 78, - "optional": false - }, - { - "name": "revision", - "type": 11, - "optional": false - }, - { - "name": "round", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 80, - "optional": false - }, - { - "name": "messageId", - "type": 7, - "optional": false - }, - { - "name": "senderId", - "type": 7, - "optional": false - }, - { - "name": "senderName", - "type": 7, - "optional": false - }, - { - "name": "teamId", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 82, - "optional": false - }, - { - "name": "model", - "type": 7, - "optional": false - }, - { - "name": "provider", - "type": 7, - "optional": false - }, - { - "name": "replayState", - "type": 83, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "plugin", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "canceled" - }, - { - "kind": "union", - "types": [ - 88, - 89 - ] - }, - { - "kind": "literal", - "value": "next-step" - }, - { - "kind": "literal", - "value": "next-turn" - }, - { - "kind": "literal", - "value": "agent/inbox/spliced" - } - ] - }, - "names": [], - "sources": [] - }, - { - "digest": "647cb2e3aeb58e27d1d4d60011f208bb66dce257e8654193c533b47c4c22c253", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 1, - "optional": false - }, - { - "name": "index", - "type": 8, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 2, - 3, - 4, - 5, - 6, - 7 - ] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "literal", - "value": "block-start" - } - ] - }, - "names": [], - "sources": [ - "packages/llm/llm/src/types.ts:427" - ] - }, { "digest": "6487b10ba7542f3c447b1e41a1c6a590b7bfafe0b9b66b49f34028da85bb970f", "schema": { @@ -37496,646 +34220,9 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:148" + "packages/llm/llm/src/types.ts:139" ] }, - { - "digest": "69becfb6b2d3fd5da91518089454cae8ef33f1835637ec44dde35dd077fd4bae", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 17, - "optional": true - }, - { - "name": "seq", - "type": 10, - "optional": false - }, - { - "name": "sourceEventSeqs", - "type": 47, - "optional": true - }, - { - "name": "surfaceOp", - "type": 48, - "optional": false - }, - { - "name": "time", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "message", - "type": 2, - "optional": false - }, - { - "name": "step", - "type": 10, - "optional": false - }, - { - "name": "turn", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "role", - "type": 29, - "optional": false - }, - { - "name": "source", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 8, - 19, - 22, - 25, - 27 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 9, - "optional": false - }, - { - "name": "offloaded", - "type": 17, - "optional": true - }, - { - "name": "type", - "type": 18, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "mediaType", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "originalDimensions", - "type": 16, - "optional": true - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 12, - 13, - 14, - 15 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 20, - "optional": false - }, - { - "name": "type", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 23, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "union", - "types": [ - 31, - 36, - 38, - 40, - 42, - 44, - 46 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 32, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - }, - { - "name": "sections", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 35 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 37, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - }, - { - "name": "summary", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 39, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 45, - "optional": false - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 10 - }, - { - "kind": "union", - "types": [ - 49, - 51 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "endSeq", - "type": 10, - "optional": false - }, - { - "name": "op", - "type": 50, - "optional": false - }, - { - "name": "startSeq", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "append" - }, - { - "kind": "literal", - "value": "system/message" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "69d238a6e9b08d67f601b1825962963d8d3523cb69ebf6208c697dc5d058c199", "schema": { @@ -38676,6 +34763,1096 @@ "packages/llm/llm-retry/src/types.ts:43" ] }, + { + "digest": "6f87000576a13d73867248c97e55c4ebe3cb3ee55ee3bd1282f26e7f40dd81c8", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "inserted", + "type": 1, + "optional": false + }, + { + "name": "outcome", + "type": 83, + "optional": true + }, + { + "name": "removedCount", + "type": 10, + "optional": true + }, + { + "name": "start", + "type": 10, + "optional": false + }, + { + "name": "target", + "type": 84, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 9, + "optional": false + }, + { + "name": "offloaded", + "type": 17, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "mediaType", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 16, + "optional": true + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 12, + 13, + 14, + 15 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 28, + 37, + 39, + 40, + 43, + 48, + 50, + 55, + 56, + 57, + 59, + 61, + 62, + 70, + 72, + 74, + 76, + 78, + 81, + 82 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 17, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 6, + "optional": true + }, + { + "name": "changes", + "type": 29, + "optional": false + }, + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 30 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 31, + "optional": false + }, + { + "name": "digest", + "type": 6, + "optional": true + }, + { + "name": "path", + "type": 6, + "optional": false + }, + { + "name": "scope", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 32, + 33, + 34 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 6, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 6, + "optional": true + }, + { + "name": "kind", + "type": 26, + "optional": false + }, + { + "name": "rpcId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 6, + "optional": false + }, + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "provider", + "type": 6, + "optional": false + }, + { + "name": "ruleId", + "type": 6, + "optional": false + }, + { + "name": "source", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 44, + "optional": false + }, + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "update", + "type": 17, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 45 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 51, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "sections", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 54 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 58, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 60, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 58, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + }, + { + "name": "references", + "type": 64, + "optional": false + }, + { + "name": "version", + "type": 69, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 65 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 10, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 66, + "optional": false + }, + { + "name": "compacted", + "type": 68, + "optional": false + }, + { + "name": "inputIndex", + "type": 10, + "optional": false + }, + { + "name": "label", + "type": 6, + "optional": false + }, + { + "name": "omittedBytes", + "type": 10, + "optional": false + }, + { + "name": "omittedMessages", + "type": 10, + "optional": false + }, + { + "name": "originalMessages", + "type": 10, + "optional": false + }, + { + "name": "retainedMessages", + "type": 10, + "optional": false + }, + { + "name": "sessionId", + "type": 6, + "optional": false + }, + { + "name": "truncated", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 10, + 67 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 71, + "optional": false + }, + { + "name": "senderSessionId", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 60, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "senderSessionId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 6, + "optional": false + }, + { + "name": "kind", + "type": 75, + "optional": false + }, + { + "name": "revision", + "type": 10, + "optional": false + }, + { + "name": "round", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 77, + "optional": false + }, + { + "name": "messageId", + "type": 6, + "optional": false + }, + { + "name": "senderId", + "type": 6, + "optional": false + }, + { + "name": "senderName", + "type": 6, + "optional": false + }, + { + "name": "teamId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 79, + "optional": false + }, + { + "name": "model", + "type": 6, + "optional": false + }, + { + "name": "provider", + "type": 6, + "optional": false + }, + { + "name": "replayState", + "type": 80, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "canceled" + }, + { + "kind": "union", + "types": [ + 85, + 86 + ] + }, + { + "kind": "literal", + "value": "next-step" + }, + { + "kind": "literal", + "value": "next-turn" + } + ] + }, + "names": [], + "sources": [ + "packages/core/agent/src/types.ts:87" + ] + }, { "digest": "6f9e00383836275e46c0a9915767f9bb561be5fc30aae490174908a93e99a912", "schema": { @@ -38704,6 +35881,1044 @@ "names": [], "sources": [] }, + { + "digest": "71225015514ed0439df95fc6e55719e1fa30bd205b99a7eefb7e18152be835ea", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "array", + "element": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 18, + 21, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 27, + 36, + 38, + 39, + 42, + 47, + 49, + 54, + 55, + 56, + 58, + 60, + 61, + 69, + 71, + 73, + 75, + 77, + 80, + 81 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 16, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 5, + "optional": true + }, + { + "name": "changes", + "type": 28, + "optional": false + }, + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 30, + "optional": false + }, + { + "name": "digest", + "type": 5, + "optional": true + }, + { + "name": "path", + "type": 5, + "optional": false + }, + { + "name": "scope", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 31, + 32, + 33 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 5, + "optional": true + }, + { + "name": "kind", + "type": 25, + "optional": false + }, + { + "name": "rpcId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 5, + "optional": false + }, + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "ruleId", + "type": 5, + "optional": false + }, + { + "name": "source", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 43, + "optional": false + }, + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "update", + "type": 16, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 44 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 50, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "sections", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 53 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 45, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 57, + "optional": false + }, + { + "name": "kind", + "type": 62, + "optional": false + }, + { + "name": "references", + "type": 63, + "optional": false + }, + { + "name": "version", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 64 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 9, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 65, + "optional": false + }, + { + "name": "compacted", + "type": 67, + "optional": false + }, + { + "name": "inputIndex", + "type": 9, + "optional": false + }, + { + "name": "label", + "type": 5, + "optional": false + }, + { + "name": "omittedBytes", + "type": 9, + "optional": false + }, + { + "name": "omittedMessages", + "type": 9, + "optional": false + }, + { + "name": "originalMessages", + "type": 9, + "optional": false + }, + { + "name": "retainedMessages", + "type": 9, + "optional": false + }, + { + "name": "sessionId", + "type": 5, + "optional": false + }, + { + "name": "truncated", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 66 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "revision", + "type": 9, + "optional": false + }, + { + "name": "round", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "messageId", + "type": 5, + "optional": false + }, + { + "name": "senderId", + "type": 5, + "optional": false + }, + { + "name": "senderName", + "type": 5, + "optional": false + }, + { + "name": "teamId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "model", + "type": 5, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "replayState", + "type": 79, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "plugin", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 25, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "7180844e1066230c5e891f1b9ccd942423b0fe48aac6ded7eef2a285b288a732", "schema": { @@ -38770,6 +36985,676 @@ "packages/llm/llm/src/message.ts:24" ] }, + { + "digest": "71a18f8c73d2082125528e0b546fdd914d310f93a4e5f48586cb9ee668574de3", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 1, + "optional": false + }, + { + "name": "time", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 6, + 28, + 31, + 33, + 35, + 52 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "index", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "type", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 8, + 10, + 20, + 23, + 25 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 11, + "optional": false + }, + { + "name": "offloaded", + "type": 18, + "optional": true + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 4, + "optional": false + }, + { + "name": "height", + "type": 4, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 4, + "optional": false + }, + { + "name": "width", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 21, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 29, + "optional": false + }, + { + "name": "index", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 9, + 19, + 22, + 24, + 26 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 4, + "optional": false + }, + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 4, + "optional": false + }, + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 36, + "optional": false + }, + { + "name": "replayState", + "type": 48, + "optional": true + }, + { + "name": "type", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 37, + 40, + 42, + 44, + 46 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 3, + "optional": false + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "offloadImages", + "type": 4, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 4, + "optional": true + }, + { + "name": "requestId", + "type": 3, + "optional": true + }, + { + "name": "status", + "type": 4, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 49, + "optional": true + }, + { + "name": "response", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 50 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 53, + "optional": false + }, + { + "name": "usage", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 4, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 4, + "optional": true + }, + { + "name": "inputTokens", + "type": 4, + "optional": false + }, + { + "name": "outputTokens", + "type": 4, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 4, + "optional": true + }, + { + "name": "totalTokens", + "type": 4, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + } + ] + }, + "names": [], + "sources": [ + "packages/llm/llm/src/assistant-stream.ts:44" + ] + }, { "digest": "71bb3254ec8f1e491ce63b762a7b5f18709de23aa4e8abcc8b886f4b6ce051dd", "schema": { @@ -38899,53 +37784,368 @@ "sources": [] }, { - "digest": "757013fff5879d73d5753d8d1120faab56110e88ac3932485ab7e034d9e9ce61", + "digest": "75f1d59512dd2e6468bed27c6203a721b116ef7869e291e3fee34c977d013185", "schema": { "root": 0, "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 21, + "optional": true + }, + { + "name": "seq", + "type": 14, + "optional": false + }, + { + "name": "time", + "type": 14, + "optional": false + }, + { + "name": "type", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 2, + "optional": false + }, + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "error", + "type": 26, + "optional": true + }, + { + "name": "isError", + "type": 27, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "parentCallId", + "type": 6, + "optional": false + }, + { + "name": "rootCallId", + "type": 6, + "optional": false + }, + { + "name": "subCallId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 4 + }, { "kind": "union", "types": [ - 1, - 2, - 3, - 4, 5, - 6 + 8, + 10, + 12, + 23 ] }, { - "kind": "literal", - "value": "file" + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] }, { - "kind": "literal", - "value": "image" + "kind": "primitive", + "type": "string" }, { "kind": "literal", "value": "reasoning" }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "text" }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "tool-call" }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 21, + "optional": true + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "mediaType", + "type": 15, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 20, + "optional": true + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 16, + 17, + 18, + 19 + ] + }, { "kind": "literal", - "value": "tool-result" + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 24, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "reason", + "type": 6, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool/ptc-dispatch" } ] }, - "names": [ - "packages/llm/llm/src/types.ts#ContentBlockType" - ], - "sources": [ - "packages/llm/llm/src/types.ts:135" - ] + "names": [], + "sources": [] }, { "digest": "7624ca28c61ca0eaa4f015140f3cea6e0c16cce2f2960fab5f531203d253903e", @@ -39243,948 +38443,6 @@ "names": [], "sources": [] }, - { - "digest": "77b8491f946edfc8cc77ebae3ba49183759da31ba2dfa83d4c9e9e618c4b91d2", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "interrupted", - "type": 1, - "optional": true - }, - { - "name": "message", - "type": 2, - "optional": false - }, - { - "name": "step", - "type": 10, - "optional": false - }, - { - "name": "stream", - "type": 32, - "optional": false - }, - { - "name": "turn", - "type": 10, - "optional": false - }, - { - "name": "usage", - "type": 69, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "role", - "type": 28, - "optional": false - }, - { - "name": "source", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 8, - 18, - 21, - 24, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 9, - "optional": false - }, - { - "name": "offloaded", - "type": 1, - "optional": true - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "mediaType", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "originalDimensions", - "type": 16, - "optional": true - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 12, - 13, - 14, - 15 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 22, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 30, - "optional": false - }, - { - "name": "model", - "type": 6, - "optional": false - }, - { - "name": "provider", - "type": 6, - "optional": false - }, - { - "name": "replayState", - "type": 31, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "array", - "element": 33 - }, - { - "kind": "union", - "types": [ - 34, - 38, - 71, - 73 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "args", - "type": 35, - "optional": false - }, - { - "name": "dt", - "type": 36, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "time0", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 37, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 6 - }, - { - "kind": "array", - "element": 10 - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 39, - "optional": false - }, - { - "name": "time", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 70, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 40, - 42, - 44, - 47, - 49, - 51, - 67 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "type", - "type": 41, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 4, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 43, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 45, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 46, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 7, - 17, - 20, - 23, - 25, - 27 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 48, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 52, - "optional": false - }, - { - "name": "replayState", - "type": 64, - "optional": true - }, - { - "name": "type", - "type": 66, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 53, - 56, - 58, - 60, - 62 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 6, - "optional": false - }, - { - "name": "message", - "type": 6, - "optional": false - }, - { - "name": "offloadImages", - "type": 10, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 10, - "optional": true - }, - { - "name": "requestId", - "type": 6, - "optional": true - }, - { - "name": "status", - "type": 10, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 61, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 63, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 65, - "optional": true - }, - { - "name": "response", - "type": 31, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 31 - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 68, - "optional": false - }, - { - "name": "usage", - "type": 69, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 10, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 10, - "optional": true - }, - { - "name": "inputTokens", - "type": 10, - "optional": false - }, - { - "name": "outputTokens", - "type": 10, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 10, - "optional": true - }, - { - "name": "totalTokens", - "type": 10, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "chunk" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 36, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "texts", - "type": 35, - "optional": false - }, - { - "name": "time0", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 72, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 36, - "optional": false - }, - { - "name": "index", - "type": 10, - "optional": false - }, - { - "name": "texts", - "type": 35, - "optional": false - }, - { - "name": "time0", - "type": 10, - "optional": false - }, - { - "name": "type", - "type": 74, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" - } - ] - }, - "names": [], - "sources": [ - "packages/core/session/src/types.ts:328" - ] - }, { "digest": "79650cfa10aa3c52440328d85e8a25f0ffadc8d7efd784e3c0819d8bb74a1985", "schema": { @@ -40840,7 +39098,7 @@ "packages/llm/llm/src/types.ts#ToolSchema" ], "sources": [ - "packages/llm/llm/src/types.ts:447" + "packages/llm/llm/src/types.ts:438" ] }, { @@ -41331,88 +39589,28 @@ "sources": [] }, { - "digest": "86cf1e44038cb8b11659863dd0efafe682e41b9c782265c1d50e0a687debfc60", + "digest": "86c1ee9c8ab6c6e160d4ccc00b3d9ad5a6c687938b552d55eec528279baa1559", "schema": { "root": 0, "nodes": [ - { - "kind": "union", - "types": [ - 1, - 7, - 65, - 67 - ] - }, { "kind": "object", "properties": [ { - "name": "args", - "type": 2, + "name": "data", + "type": 1, "optional": false }, { - "name": "dt", + "name": "ignorable", "type": 4, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "index", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 3, "optional": true }, { - "name": "time0", + "name": "seq", "type": 5, "optional": false }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 8, - "optional": false - }, { "name": "time", "type": 5, @@ -41420,7 +39618,7 @@ }, { "name": "type", - "type": 64, + "type": 30, "optional": false } ], @@ -41429,41 +39627,113 @@ { "kind": "union", "types": [ - 9, - 11, - 37, - 40, - 42, - 44, - 61 + 2, + 29 ] }, { "kind": "object", "properties": [ { - "name": "argumentsDelta", + "name": "compactionId", "type": 3, "optional": false }, { - "name": "id", + "name": "llmStreamCall", + "type": 4, + "optional": false + }, + { + "name": "maxTokens", + "type": 5, + "optional": true + }, + { + "name": "model", "type": 3, "optional": false }, { - "name": "index", + "name": "provider", + "type": 3, + "optional": false + }, + { + "name": "rawOutput", + "type": 6, + "optional": false + }, + { + "name": "shadowedRange", + "type": 26, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 27, + "optional": false + }, + { + "name": "shadowedTokenCount", "type": 5, "optional": false }, { - "name": "name", + "name": "sourceCommandId", "type": 3, "optional": true }, + { + "name": "summary", + "type": 6, + "optional": false + }, + { + "name": "usage", + "type": 28, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "union", + "types": [ + 8, + 10, + 12, + 14, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, { "name": "type", - "type": 10, + "type": 9, "optional": false } ], @@ -41471,39 +39741,27 @@ }, { "kind": "literal", - "value": "tool-call-delta" + "value": "reasoning" }, { "kind": "object", "properties": [ { - "name": "block", - "type": 12, - "optional": false - }, - { - "name": "index", - "type": 5, + "name": "text", + "type": 3, "optional": false }, { "name": "type", - "type": 36, + "type": 11, "optional": false } ], "indices": [] }, { - "kind": "union", - "types": [ - 13, - 15, - 25, - 28, - 32, - 34 - ] + "kind": "literal", + "value": "text" }, { "kind": "object", @@ -41525,7 +39783,7 @@ }, { "name": "type", - "type": 14, + "type": 13, "optional": false } ], @@ -41540,17 +39798,17 @@ "properties": [ { "name": "attachment", - "type": 16, + "type": 15, "optional": false }, { "name": "offloaded", - "type": 23, + "type": 4, "optional": true }, { "name": "type", - "type": 24, + "type": 22, "optional": false } ], @@ -41576,7 +39834,7 @@ }, { "name": "mediaType", - "type": 17, + "type": 16, "optional": false }, { @@ -41586,7 +39844,7 @@ }, { "name": "originalDimensions", - "type": 22, + "type": 21, "optional": true }, { @@ -41600,12 +39858,16 @@ { "kind": "union", "types": [ + 17, 18, 19, - 20, - 21 + 20 ] }, + { + "kind": "literal", + "value": "image/gif" + }, { "kind": "literal", "value": "image/jpeg" @@ -41614,10 +39876,6 @@ "kind": "literal", "value": "image/png" }, - { - "kind": "literal", - "value": "image/gif" - }, { "kind": "literal", "value": "image/webp" @@ -41638,10 +39896,6 @@ ], "indices": [] }, - { - "kind": "literal", - "value": true - }, { "kind": "literal", "value": "image" @@ -41651,12 +39905,12 @@ "properties": [ { "name": "attachment", - "type": 26, + "type": 24, "optional": false }, { "name": "type", - "type": 27, + "type": 25, "optional": false } ], @@ -41691,23 +39945,13 @@ "kind": "object", "properties": [ { - "name": "content", - "type": 29, + "name": "end", + "type": 5, "optional": false }, { - "name": "isError", - "type": 30, - "optional": true - }, - { - "name": "toolCallId", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 31, + "name": "start", + "type": 5, "optional": false } ], @@ -41715,345 +39959,7 @@ }, { "kind": "array", - "element": 12 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 35, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 38, - "optional": false - }, - { - "name": "index", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 39, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 14, - 24, - 27, - 31, - 33, - 35 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 41, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 5, - "optional": false - }, - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 43, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 45, - "optional": false - }, - { - "name": "replayState", - "type": 57, - "optional": true - }, - { - "name": "type", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 46, - 49, - 51, - 53, - 55 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 48, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 3, - "optional": false - }, - { - "name": "message", - "type": 3, - "optional": false - }, - { - "name": "offloadImages", - "type": 5, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 5, - "optional": true - }, - { - "name": "requestId", - "type": 3, - "optional": true - }, - { - "name": "status", - "type": 5, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 58, - "optional": true - }, - { - "name": "response", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 59 - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 62, - "optional": false - }, - { - "name": "usage", - "type": 63, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" + "element": 5 }, { "kind": "object", @@ -42091,88 +39997,75 @@ ], "indices": [] }, - { - "kind": "literal", - "value": "chunk" - }, { "kind": "object", "properties": [ { - "name": "dt", - "type": 4, + "name": "compactionId", + "type": 3, "optional": false }, { - "name": "index", + "name": "maxTokens", + "type": 5, + "optional": true + }, + { + "name": "model", + "type": 3, + "optional": false + }, + { + "name": "provider", + "type": 3, + "optional": false + }, + { + "name": "rawOutput", + "type": 6, + "optional": true + }, + { + "name": "shadowedRange", + "type": 26, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 27, + "optional": false + }, + { + "name": "shadowedTokenCount", "type": 5, "optional": false }, { - "name": "texts", - "type": 2, + "name": "sourceCommandId", + "type": 3, + "optional": true + }, + { + "name": "summary", + "type": 6, "optional": false }, { - "name": "time0", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 66, - "optional": false + "name": "usage", + "type": 28, + "optional": true } ], "indices": [] }, { "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 4, - "optional": false - }, - { - "name": "index", - "type": 5, - "optional": false - }, - { - "name": "texts", - "type": 2, - "optional": false - }, - { - "name": "time0", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 68, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" + "value": "compaction/summary" } ] }, - "names": [ - "packages/llm/llm/src/assistant-stream.ts#AssistantStreamRecord" - ], - "sources": [ - "packages/llm/llm/src/assistant-stream.ts:20" - ] + "names": [], + "sources": [] }, { "digest": "86d1d0e9cfebb240421187e3dc37fb71cc38a1501885cf32f8f9adef7b0a2bde", @@ -42408,7 +40301,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:430" + "packages/llm/llm/src/types.ts:421" ] }, { @@ -42514,6 +40407,324 @@ "names": [], "sources": [] }, + { + "digest": "8a8b1c3cf223fe58bbe45ea57f0b80eb262a653066dfe5683a648390ed91c13c", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 1, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "isError", + "type": 24, + "optional": true + }, + { + "name": "role", + "type": 25, + "optional": false + }, + { + "name": "source", + "type": 26, + "optional": false + }, + { + "name": "toolCallId", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "union", + "types": [ + 3, + 6, + 8, + 10, + 21 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 11, + "optional": false + }, + { + "name": "offloaded", + "type": 19, + "optional": true + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 12, + "optional": false + }, + { + "name": "height", + "type": 12, + "optional": false + }, + { + "name": "mediaType", + "type": 13, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "originalDimensions", + "type": 18, + "optional": true + }, + { + "name": "width", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 14, + 15, + 16, + 17 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 12, + "optional": false + }, + { + "name": "width", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 22, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 4, + "optional": false + }, + { + "name": "kind", + "type": 25, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [ + "packages/llm/llm/src/message.ts#ToolResultMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:158" + ] + }, { "digest": "8a9c990773f798eac10ca8878e6bcc531ee080bc589cac956730e462cc6a09ad", "schema": { @@ -42671,669 +40882,6 @@ "names": [], "sources": [] }, - { - "digest": "8d2e5a3c4230e6ea6c0b5151f02241d0db02cd2551f2df1b6b9700cddcc0dca3", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 1, - "optional": false - }, - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "error", - "type": 28, - "optional": true - }, - { - "name": "isError", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "parentCallId", - "type": 6, - "optional": false - }, - { - "name": "rootCallId", - "type": 6, - "optional": false - }, - { - "name": "subCallId", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 4, - 8, - 10, - 12, - 14, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 5, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 15, - "optional": false - }, - { - "name": "offloaded", - "type": 23, - "optional": true - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 16, - "optional": false - }, - { - "name": "height", - "type": 16, - "optional": false - }, - { - "name": "mediaType", - "type": 17, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "originalDimensions", - "type": 22, - "optional": true - }, - { - "name": "width", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 18, - 19, - 20, - 21 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 16, - "optional": false - }, - { - "name": "width", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 26, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 16, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "reason", - "type": 6, - "optional": true - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/core/tools/src/types.ts#PtcDispatchEventData" - ], - "sources": [ - "packages/core/tools/src/types.ts:20" - ] - }, - { - "digest": "8d6a011f3ef7096a4a922ef420458419ff6b20e1eaeece5d331db7585d2f08d6", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "tuple", - "elements": [ - { - "type": 1, - "optional": false, - "rest": false - } - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 2, - "optional": false - }, - { - "name": "isError", - "type": 25, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "union", - "types": [ - 1, - 4, - 7, - 9, - 11, - 22 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 12, - "optional": false - }, - { - "name": "offloaded", - "type": 20, - "optional": true - }, - { - "name": "type", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 13, - "optional": false - }, - { - "name": "height", - "type": 13, - "optional": false - }, - { - "name": "mediaType", - "type": 14, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 19, - "optional": true - }, - { - "name": "width", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 15, - 16, - 17, - 18 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 13, - "optional": false - }, - { - "name": "width", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 23, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 13, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "8e31bb958e9b015e6f8407eaade32217068159e816f3cc99c3ad76eb889732e0", "schema": { @@ -43407,7 +40955,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:147" + "packages/llm/llm/src/types.ts:138" ] }, { @@ -43764,322 +41312,6 @@ "names": [], "sources": [] }, - { - "digest": "90c811b8c2668898515e69a24e82caffeb08517f9c7aa193867ff0380f3b535d", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 1, - "optional": false - }, - { - "name": "index", - "type": 15, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 2, - 7, - 9, - 11, - 13, - 24 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 4, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 1 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 14, - "optional": false - }, - { - "name": "offloaded", - "type": 22, - "optional": true - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "mediaType", - "type": 16, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 21, - "optional": true - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 17, - 18, - 19, - 20 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 25, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "literal", - "value": "block-end" - } - ] - }, - "names": [], - "sources": [ - "packages/llm/llm/src/types.ts:431" - ] - }, { "digest": "930a6567a10bb62ddd157bd8abdf4b182810c8c3b49d91309b3b009a5fed9731", "schema": { @@ -44437,7 +41669,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:428" + "packages/llm/llm/src/types.ts:419" ] }, { @@ -44633,6 +41865,351 @@ "names": [], "sources": [] }, + { + "digest": "9a25c2e889855516a531dc906905ec1d88157f7c2651aed27ac4f754bb128240", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 21, + "optional": true + }, + { + "name": "seq", + "type": 14, + "optional": false + }, + { + "name": "time", + "type": 14, + "optional": false + }, + { + "name": "type", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "message", + "type": 2, + "optional": false + }, + { + "name": "teamId", + "type": 6, + "optional": false + }, + { + "name": "version", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "senderId", + "type": 6, + "optional": false + }, + { + "name": "senderName", + "type": 6, + "optional": false + }, + { + "name": "targetId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 10, + 12, + 23 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 21, + "optional": true + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "mediaType", + "type": 15, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 20, + "optional": true + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 16, + 17, + 18, + 19 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 14, + "optional": false + }, + { + "name": "width", + "type": 14, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 24, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": 2 + }, + { + "kind": "literal", + "value": "team/message/queued" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "9a2a9029f8d7ede05336980d8342737557f487b913bfd28853d0ab5214600ab5", "schema": { @@ -44945,7 +42522,7 @@ ] }, { - "digest": "9fe0e77a7816b7fdb4b953ec0e2f0cd7bbd22c5de5c3567e612d1b20eb0992e6", + "digest": "9f5460b34f5daa2bdc225e47feb46cbd666de00277e907b514f0932fdcf409ab", "schema": { "root": 0, "nodes": [ @@ -44953,33 +42530,58 @@ "kind": "object", "properties": [ { - "name": "maxTokens", + "name": "content", "type": 1, "optional": false }, { - "name": "messageSeqs", - "type": 2, + "name": "id", + "type": 4, "optional": false }, { - "name": "messages", - "type": 3, + "name": "senderId", + "type": 4, "optional": false }, { - "name": "route", - "type": 89, + "name": "senderName", + "type": 4, "optional": false }, { - "name": "system", - "type": 8, + "name": "targetId", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "union", + "types": [ + 3, + 6, + 8, + 10, + 21 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, "optional": false }, { - "name": "titleProvider", - "type": 8, + "name": "type", + "type": 5, "optional": false } ], @@ -44987,73 +42589,48 @@ }, { "kind": "primitive", - "type": "number" + "type": "string" }, { - "kind": "array", - "element": 1 - }, - { - "kind": "array", - "element": 4 + "kind": "literal", + "value": "reasoning" }, { "kind": "object", "properties": [ { - "name": "content", - "type": 5, + "name": "text", + "type": 4, "optional": false }, { - "name": "id", - "type": 8, - "optional": false - }, - { - "name": "role", - "type": 30, - "optional": false - }, - { - "name": "source", - "type": 34, + "name": "type", + "type": 7, "optional": false } ], "indices": [] }, { - "kind": "array", - "element": 6 - }, - { - "kind": "union", - "types": [ - 7, - 10, - 20, - 23, - 26, - 28 - ] + "kind": "literal", + "value": "text" }, { "kind": "object", "properties": [ { "name": "arguments", - "type": 8, + "type": 4, "optional": false }, { "name": "id", - "type": 8, + "type": 4, "optional": false }, { "name": "name", - "type": 8, + "type": 4, "optional": false }, { @@ -45064,10 +42641,6 @@ ], "indices": [] }, - { - "kind": "primitive", - "type": "string" - }, { "kind": "literal", "value": "tool-call" @@ -45082,12 +42655,12 @@ }, { "name": "offloaded", - "type": 18, + "type": 19, "optional": true }, { "name": "type", - "type": 19, + "type": 20, "optional": false } ], @@ -45098,54 +42671,54 @@ "properties": [ { "name": "attachmentId", - "type": 8, + "type": 4, "optional": false }, { "name": "bytes", - "type": 1, - "optional": false - }, - { - "name": "height", - "type": 1, - "optional": false - }, - { - "name": "mediaType", "type": 12, "optional": false }, + { + "name": "height", + "type": 12, + "optional": false + }, + { + "name": "mediaType", + "type": 13, + "optional": false + }, { "name": "name", - "type": 8, + "type": 4, "optional": true }, { "name": "originalDimensions", - "type": 17, + "type": 18, "optional": true }, { "name": "width", - "type": 1, + "type": 12, "optional": false } ], "indices": [] }, { - "kind": "union", - "types": [ - 13, - 14, - 15, - 16 - ] + "kind": "primitive", + "type": "number" }, { - "kind": "literal", - "value": "image/png" + "kind": "union", + "types": [ + 14, + 15, + 16, + 17 + ] }, { "kind": "literal", @@ -45155,6 +42728,10 @@ "kind": "literal", "value": "image/jpeg" }, + { + "kind": "literal", + "value": "image/png" + }, { "kind": "literal", "value": "image/webp" @@ -45164,12 +42741,12 @@ "properties": [ { "name": "height", - "type": 1, + "type": 12, "optional": false }, { "name": "width", - "type": 1, + "type": 12, "optional": false } ], @@ -45188,1121 +42765,8 @@ "properties": [ { "name": "attachment", - "type": 21, - "optional": false - }, - { - "name": "type", "type": 22, "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 8, - "optional": false - }, - { - "name": "bytes", - "type": 1, - "optional": false - }, - { - "name": "name", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 5, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 8, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 8, - "optional": false - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 8, - "optional": false - }, - { - "name": "type", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "union", - "types": [ - 31, - 32, - 33 - ] - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 35, - 44, - 46, - 47, - 50, - 55, - 57, - 62, - 63, - 64, - 66, - 68, - 69, - 76, - 78, - 80, - 82, - 84, - 87, - 88 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 18, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 8, - "optional": true - }, - { - "name": "changes", - "type": 36, - "optional": false - }, - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 43, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 37 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 38, - "optional": false - }, - { - "name": "digest", - "type": 8, - "optional": true - }, - { - "name": "path", - "type": 8, - "optional": false - }, - { - "name": "scope", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 39, - 40, - 41 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 8, - "optional": false - }, - { - "name": "kind", - "type": 45, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 8, - "optional": true - }, - { - "name": "kind", - "type": 33, - "optional": false - }, - { - "name": "rpcId", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 8, - "optional": false - }, - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "provider", - "type": 8, - "optional": false - }, - { - "name": "ruleId", - "type": 8, - "optional": false - }, - { - "name": "source", - "type": 8, - "optional": false - }, - { - "name": "summary", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 51, - "optional": false - }, - { - "name": "form", - "type": 53, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "update", - "type": 18, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 52 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 8, - "optional": false - }, - { - "name": "name", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "name", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 58, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - }, - { - "name": "sections", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 61 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 8, - "optional": false - }, - { - "name": "text", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - }, - { - "name": "summary", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 42, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 65, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 67, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 53, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 65, - "optional": false - }, - { - "name": "kind", - "type": 70, - "optional": false - }, - { - "name": "references", - "type": 71, - "optional": false - }, - { - "name": "version", - "type": 75, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 72 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 1, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 73, - "optional": false - }, - { - "name": "compacted", - "type": 24, - "optional": false - }, - { - "name": "inputIndex", - "type": 1, - "optional": false - }, - { - "name": "label", - "type": 8, - "optional": false - }, - { - "name": "omittedBytes", - "type": 1, - "optional": false - }, - { - "name": "omittedMessages", - "type": 1, - "optional": false - }, - { - "name": "originalMessages", - "type": 1, - "optional": false - }, - { - "name": "retainedMessages", - "type": 1, - "optional": false - }, - { - "name": "sessionId", - "type": 8, - "optional": false - }, - { - "name": "truncated", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 1, - 74 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 77, - "optional": false - }, - { - "name": "senderSessionId", - "type": 8, - "optional": false - }, - { - "name": "summary", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 67, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - }, - { - "name": "senderSessionId", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 8, - "optional": false - }, - { - "name": "kind", - "type": 81, - "optional": false - }, - { - "name": "revision", - "type": 1, - "optional": false - }, - { - "name": "round", - "type": 1, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 83, - "optional": false - }, - { - "name": "messageId", - "type": 8, - "optional": false - }, - { - "name": "senderId", - "type": 8, - "optional": false - }, - { - "name": "senderName", - "type": 8, - "optional": false - }, - { - "name": "teamId", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 85, - "optional": false - }, - { - "name": "model", - "type": 8, - "optional": false - }, - { - "name": "provider", - "type": 8, - "optional": false - }, - { - "name": "replayState", - "type": 86, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 59, - "optional": false - }, - { - "name": "plugin", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "model", - "type": 8, - "optional": false - }, - { - "name": "provider", - "type": 8, - "optional": false - } - ], - "indices": [] - } - ] - }, - "names": [ - "packages/session/session-title-llm/src/index.ts#SessionTitleLlmRequestEventData" - ], - "sources": [ - "packages/session/session-title-llm/src/index.ts:27" - ] - }, - { - "digest": "9ff2ad8dddb836f75e8f6197fff2371323dfc396c3c6fb667e6e0b42fda79a5c", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "compactionId", - "type": 1, - "optional": false - }, - { - "name": "llmStreamCall", - "type": 2, - "optional": false - }, - { - "name": "maxTokens", - "type": 3, - "optional": true - }, - { - "name": "model", - "type": 1, - "optional": false - }, - { - "name": "provider", - "type": 1, - "optional": false - }, - { - "name": "rawOutput", - "type": 4, - "optional": false - }, - { - "name": "shadowedRange", - "type": 27, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 28, - "optional": false - }, - { - "name": "shadowedTokenCount", - "type": 3, - "optional": false - }, - { - "name": "sourceCommandId", - "type": 1, - "optional": true - }, - { - "name": "summary", - "type": 4, - "optional": false - }, - { - "name": "usage", - "type": 29, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "union", - "types": [ - 6, - 9, - 11, - 13, - 15, - 24 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 4, - "optional": false - }, - { - "name": "isError", - "type": 7, - "optional": true - }, - { - "name": "toolCallId", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 1, - "optional": false - }, - { - "name": "name", - "type": 1, - "optional": false - }, - { - "name": "type", - "type": 14, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 16, - "optional": false - }, - { - "name": "offloaded", - "type": 2, - "optional": true }, { "name": "type", @@ -46317,119 +42781,17 @@ "properties": [ { "name": "attachmentId", - "type": 1, + "type": 4, "optional": false }, { "name": "bytes", - "type": 3, - "optional": false - }, - { - "name": "height", - "type": 3, - "optional": false - }, - { - "name": "mediaType", - "type": 17, + "type": 12, "optional": false }, { "name": "name", - "type": 1, - "optional": true - }, - { - "name": "originalDimensions", - "type": 22, - "optional": true - }, - { - "name": "width", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 18, - 19, - 20, - 21 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 3, - "optional": false - }, - { - "name": "width", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 25, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 1, - "optional": false - }, - { - "name": "bytes", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 1, + "type": 4, "optional": false } ], @@ -46438,67 +42800,15 @@ { "kind": "literal", "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "end", - "type": 3, - "optional": false - }, - { - "name": "start", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 3 - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 3, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 3, - "optional": true - }, - { - "name": "inputTokens", - "type": 3, - "optional": false - }, - { - "name": "outputTokens", - "type": 3, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 3, - "optional": true - }, - { - "name": "totalTokens", - "type": 3, - "optional": true - } - ], - "indices": [] } ] }, - "names": [], - "sources": [] + "names": [ + "packages/experimental/agent-team/src/types.ts#TeamMessageSnapshot" + ], + "sources": [ + "packages/experimental/agent-team/src/types.ts:106" + ] }, { "digest": "a0f906856fc06f1c6f2083eb970e5a657a82b1a84c06c095445e5d6d161cda80", @@ -46793,7 +43103,7 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:433" + "packages/llm/llm/src/types.ts:424" ] }, { @@ -46958,6 +43268,1044 @@ "packages/experimental/agent-team/src/types.ts:223" ] }, + { + "digest": "a48b761be36821fcf456c862e321284bdd879dd796d29d20b1766e0417f7c966", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 1, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "role", + "type": 24, + "optional": false + }, + { + "name": "source", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "union", + "types": [ + 3, + 6, + 17, + 20, + 22 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 7, + "optional": false + }, + { + "name": "offloaded", + "type": 15, + "optional": true + }, + { + "name": "type", + "type": 16, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 8, + "optional": false + }, + { + "name": "height", + "type": 8, + "optional": false + }, + { + "name": "mediaType", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "originalDimensions", + "type": 14, + "optional": true + }, + { + "name": "width", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 10, + 11, + 12, + 13 + ] + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 8, + "optional": false + }, + { + "name": "width", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 18, + "optional": false + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 8, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 26, + 35, + 37, + 38, + 41, + 46, + 48, + 53, + 54, + 55, + 57, + 59, + 60, + 68, + 70, + 72, + 74, + 76, + 79, + 80 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 15, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 4, + "optional": true + }, + { + "name": "changes", + "type": 27, + "optional": false + }, + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 28 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 29, + "optional": false + }, + { + "name": "digest", + "type": 4, + "optional": true + }, + { + "name": "path", + "type": 4, + "optional": false + }, + { + "name": "scope", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 30, + 31, + 32 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 4, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 4, + "optional": true + }, + { + "name": "kind", + "type": 24, + "optional": false + }, + { + "name": "rpcId", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 4, + "optional": false + }, + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "provider", + "type": 4, + "optional": false + }, + { + "name": "ruleId", + "type": 4, + "optional": false + }, + { + "name": "source", + "type": 4, + "optional": false + }, + { + "name": "summary", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 42, + "optional": false + }, + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + }, + { + "name": "update", + "type": 15, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 43 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 49, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + }, + { + "name": "sections", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 52 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "text", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + }, + { + "name": "summary", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 58, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + }, + { + "name": "references", + "type": 62, + "optional": false + }, + { + "name": "version", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 63 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 8, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 64, + "optional": false + }, + { + "name": "compacted", + "type": 66, + "optional": false + }, + { + "name": "inputIndex", + "type": 8, + "optional": false + }, + { + "name": "label", + "type": 4, + "optional": false + }, + { + "name": "omittedBytes", + "type": 8, + "optional": false + }, + { + "name": "omittedMessages", + "type": 8, + "optional": false + }, + { + "name": "originalMessages", + "type": 8, + "optional": false + }, + { + "name": "retainedMessages", + "type": 8, + "optional": false + }, + { + "name": "sessionId", + "type": 4, + "optional": false + }, + { + "name": "truncated", + "type": 66, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 8, + 65 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 39, + "optional": false + }, + { + "name": "kind", + "type": 69, + "optional": false + }, + { + "name": "senderSessionId", + "type": 4, + "optional": false + }, + { + "name": "summary", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 58, + "optional": false + }, + { + "name": "kind", + "type": 71, + "optional": false + }, + { + "name": "senderSessionId", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 4, + "optional": false + }, + { + "name": "kind", + "type": 73, + "optional": false + }, + { + "name": "revision", + "type": 8, + "optional": false + }, + { + "name": "round", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 75, + "optional": false + }, + { + "name": "messageId", + "type": 4, + "optional": false + }, + { + "name": "senderId", + "type": 4, + "optional": false + }, + { + "name": "senderName", + "type": 4, + "optional": false + }, + { + "name": "teamId", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 77, + "optional": false + }, + { + "name": "model", + "type": 4, + "optional": false + }, + { + "name": "provider", + "type": 4, + "optional": false + }, + { + "name": "replayState", + "type": 78, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 24, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [ + "packages/llm/llm/src/message.ts#UserMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:147" + ] + }, { "digest": "a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc", "schema": { @@ -47046,1127 +44394,6 @@ "names": [], "sources": [] }, - { - "digest": "a6a195c1b4a906d953d24ab5864c9f1881d545460e080a51144adfc9cb058cfe", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "inserted", - "type": 1, - "optional": false - }, - { - "name": "outcome", - "type": 85, - "optional": true - }, - { - "name": "removedCount", - "type": 10, - "optional": true - }, - { - "name": "start", - "type": 10, - "optional": false - }, - { - "name": "target", - "type": 86, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "role", - "type": 29, - "optional": false - }, - { - "name": "source", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 8, - 19, - 22, - 25, - 27 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 9, - "optional": false - }, - { - "name": "offloaded", - "type": 17, - "optional": true - }, - { - "name": "type", - "type": 18, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "mediaType", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": true - }, - { - "name": "originalDimensions", - "type": 16, - "optional": true - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 12, - 13, - 14, - 15 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 10, - "optional": false - }, - { - "name": "width", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 20, - "optional": false - }, - { - "name": "type", - "type": 21, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 6, - "optional": false - }, - { - "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 23, - "optional": true - }, - { - "name": "toolCallId", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 24, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 6, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 31, - 40, - 42, - 43, - 46, - 51, - 53, - 58, - 59, - 60, - 62, - 64, - 65, - 72, - 74, - 76, - 78, - 80, - 83, - 84 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 17, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 6, - "optional": true - }, - { - "name": "changes", - "type": 32, - "optional": false - }, - { - "name": "form", - "type": 38, - "optional": false - }, - { - "name": "kind", - "type": 39, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 33 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 34, - "optional": false - }, - { - "name": "digest", - "type": 6, - "optional": true - }, - { - "name": "path", - "type": 6, - "optional": false - }, - { - "name": "scope", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 35, - 36, - 37 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 6, - "optional": false - }, - { - "name": "kind", - "type": 41, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 6, - "optional": true - }, - { - "name": "kind", - "type": 29, - "optional": false - }, - { - "name": "rpcId", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 6, - "optional": false - }, - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 45, - "optional": false - }, - { - "name": "provider", - "type": 6, - "optional": false - }, - { - "name": "ruleId", - "type": 6, - "optional": false - }, - { - "name": "source", - "type": 6, - "optional": false - }, - { - "name": "summary", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 47, - "optional": false - }, - { - "name": "form", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "update", - "type": 17, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 48 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 38, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "name", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - }, - { - "name": "sections", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 57 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 6, - "optional": false - }, - { - "name": "text", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - }, - { - "name": "summary", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 38, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 61, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 63, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 61, - "optional": false - }, - { - "name": "kind", - "type": 66, - "optional": false - }, - { - "name": "references", - "type": 67, - "optional": false - }, - { - "name": "version", - "type": 71, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 68 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 10, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 69, - "optional": false - }, - { - "name": "compacted", - "type": 23, - "optional": false - }, - { - "name": "inputIndex", - "type": 10, - "optional": false - }, - { - "name": "label", - "type": 6, - "optional": false - }, - { - "name": "omittedBytes", - "type": 10, - "optional": false - }, - { - "name": "omittedMessages", - "type": 10, - "optional": false - }, - { - "name": "originalMessages", - "type": 10, - "optional": false - }, - { - "name": "retainedMessages", - "type": 10, - "optional": false - }, - { - "name": "sessionId", - "type": 6, - "optional": false - }, - { - "name": "truncated", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 10, - 70 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 73, - "optional": false - }, - { - "name": "senderSessionId", - "type": 6, - "optional": false - }, - { - "name": "summary", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 63, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - }, - { - "name": "senderSessionId", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 6, - "optional": false - }, - { - "name": "kind", - "type": 77, - "optional": false - }, - { - "name": "revision", - "type": 10, - "optional": false - }, - { - "name": "round", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 79, - "optional": false - }, - { - "name": "messageId", - "type": 6, - "optional": false - }, - { - "name": "senderId", - "type": 6, - "optional": false - }, - { - "name": "senderName", - "type": 6, - "optional": false - }, - { - "name": "teamId", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 81, - "optional": false - }, - { - "name": "model", - "type": 6, - "optional": false - }, - { - "name": "provider", - "type": 6, - "optional": false - }, - { - "name": "replayState", - "type": 82, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "plugin", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 29, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "canceled" - }, - { - "kind": "union", - "types": [ - 87, - 88 - ] - }, - { - "kind": "literal", - "value": "next-step" - }, - { - "kind": "literal", - "value": "next-turn" - } - ] - }, - "names": [], - "sources": [ - "packages/core/agent/src/types.ts:87" - ] - }, { "digest": "a6b41f5bede8094d7bf635be5d69b1bd7a25e006ca9cf9415bceb9322f1a7feb", "schema": { @@ -48407,6 +44634,593 @@ "names": [], "sources": [] }, + { + "digest": "a8c678be0d060c63d44bd6026de343efe0d150d335c10e0d27e04a84c82cb1e3", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 1, + "optional": false + }, + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "error", + "type": 25, + "optional": true + }, + { + "name": "isError", + "type": 26, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "parentCallId", + "type": 5, + "optional": false + }, + { + "name": "rootCallId", + "type": 5, + "optional": false + }, + { + "name": "subCallId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 9, + 11, + 22 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 12, + "optional": false + }, + { + "name": "offloaded", + "type": 20, + "optional": true + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "mediaType", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 19, + "optional": true + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 15, + 16, + 17, + 18 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 23, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "reason", + "type": 5, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "boolean" + } + ] + }, + "names": [ + "packages/core/tools/src/types.ts#PtcDispatchEventData" + ], + "sources": [ + "packages/core/tools/src/types.ts:20" + ] + }, + { + "digest": "a951a47d0ebf7d7ac401d1ec2fe4e138a43288c5ad2b0cf029a90b97d718f1e6", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "array", + "element": 1 + }, + { + "kind": "union", + "types": [ + 2, + 5, + 7, + 18, + 21 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 8, + "optional": false + }, + { + "name": "offloaded", + "type": 16, + "optional": true + }, + { + "name": "type", + "type": 17, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "mediaType", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 15, + "optional": true + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 11, + 12, + 13, + 14 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 9, + "optional": false + }, + { + "name": "width", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 19, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "a99f76fd149051c363f960bfeeb5b9509587ecaf7591a42797e4bfe810d8987a", "schema": { @@ -48712,7 +45526,7 @@ "names": [], "sources": [ "packages/core/session/src/types.ts:213", - "packages/llm/llm/src/types.ts:146" + "packages/llm/llm/src/types.ts:137" ] }, { @@ -48750,34 +45564,504 @@ "sources": [] }, { - "digest": "acd36e1717d2b4ef9e98a8e6fac17ca1203f3f448e5bca51677f129a8f4999e2", + "digest": "abb8be1a8972c5531c513de95c678bac414263fb5e4bf6dcf871ca913f47bd94", "schema": { "root": 0, "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 1, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "role", + "type": 24, + "optional": false + }, + { + "name": "source", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, { "kind": "union", "types": [ - 1, - 2, - 3 + 3, + 6, + 17, + 20, + 22 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 7, + "optional": false + }, + { + "name": "offloaded", + "type": 15, + "optional": true + }, + { + "name": "type", + "type": 16, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 8, + "optional": false + }, + { + "name": "height", + "type": 8, + "optional": false + }, + { + "name": "mediaType", + "type": 9, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "originalDimensions", + "type": 14, + "optional": true + }, + { + "name": "width", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 10, + 11, + 12, + 13 ] }, { "kind": "literal", - "value": "assistant" + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 8, + "optional": false + }, + { + "name": "width", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 18, + "optional": false + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 8, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" }, { "kind": "literal", "value": "system" }, + { + "kind": "union", + "types": [ + 26, + 31, + 33, + 35, + 37, + 39, + 41 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 27, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + }, + { + "name": "sections", + "type": 29, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", - "value": "user" + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 30 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "text", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 32, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + }, + { + "name": "summary", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "plugin", + "type": 4, + "optional": false + } + ], + "indices": [] } ] }, - "names": [], - "sources": [] + "names": [ + "packages/llm/llm/src/message.ts#SystemMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:141" + ] }, { "digest": "ad22a5ca5bbaab2e1440779cd3648e85ddfc6f73b5207394eda699555cf31430", @@ -49602,401 +46886,6 @@ "packages/experimental/agent-team/src/types.ts:71" ] }, - { - "digest": "b33142af8176323ffbb20762541be81c1d51b60a60887803836e0b146e5bef0c", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 24, - "optional": true - }, - { - "name": "seq", - "type": 17, - "optional": false - }, - { - "name": "time", - "type": 17, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 2, - "optional": false - }, - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "error", - "type": 29, - "optional": true - }, - { - "name": "isError", - "type": 6, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "parentCallId", - "type": 7, - "optional": false - }, - { - "name": "rootCallId", - "type": 7, - "optional": false - }, - { - "name": "subCallId", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 9, - 11, - 13, - 15, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 3, - "optional": false - }, - { - "name": "isError", - "type": 6, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 14, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 16, - "optional": false - }, - { - "name": "offloaded", - "type": 24, - "optional": true - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 17, - "optional": false - }, - { - "name": "height", - "type": 17, - "optional": false - }, - { - "name": "mediaType", - "type": 18, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "originalDimensions", - "type": 23, - "optional": true - }, - { - "name": "width", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 19, - 20, - 21, - 22 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 17, - "optional": false - }, - { - "name": "width", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 27, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 17, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "reason", - "type": 7, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool/ptc-dispatch" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "b38f206d59bad891fa58c89f97a0036987b3defe7685acbd318fa55eb85f9751", "schema": { @@ -51275,295 +48164,6 @@ "names": [], "sources": [] }, - { - "digest": "bb72d86bc9ef0b3908bfa57ef98ccccae24d67d945c9f6869ca3cb8577889e75", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "array", - "element": 1 - }, - { - "kind": "union", - "types": [ - 2, - 5, - 7, - 9, - 20, - 23 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 10, - "optional": false - }, - { - "name": "offloaded", - "type": 18, - "optional": true - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "mediaType", - "type": 12, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": true - }, - { - "name": "originalDimensions", - "type": 17, - "optional": true - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 13, - 14, - 15, - 16 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 11, - "optional": false - }, - { - "name": "width", - "type": 11, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 21, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 11, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 0, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "bbc5696e3f13c758237b316e3cf08cda0b9fd51ffe672539883457769faa185d", "schema": { @@ -52319,7 +48919,35 @@ "sources": [] }, { - "digest": "c7b24be059d34d08929593049a1a81eaa3855166aacfe9d7603c0bc8bb728d56", + "digest": "c8e6f48878cc2a2f0dc59682280d81f407943fb503f32c64bf9ff3d9393c3eff", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "literal", + "value": "active" + } + ] + }, + "names": [], + "sources": [] + }, + { + "digest": "c99e20441bf15341e9db54385e558e5c03d21dff2eb1ac08ccbf47c2d8747954", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "literal", + "value": "feedback/record" + } + ] + }, + "names": [], + "sources": [] + }, + { + "digest": "c9b25ae820453f466ccb40c7c2b62ed81dc9579f142e14615b4c8596b264565c", "schema": { "root": 0, "nodes": [ @@ -52327,25 +48955,41 @@ "kind": "union", "types": [ 1, - 4, - 6, - 8, - 19, - 22 + 5, + 27, + 30, + 32, + 34, + 51 ] }, { "kind": "object", "properties": [ { - "name": "text", + "name": "argumentsDelta", "type": 2, "optional": false }, { - "name": "type", + "name": "id", + "type": 2, + "optional": false + }, + { + "name": "index", "type": 3, "optional": false + }, + { + "name": "name", + "type": 2, + "optional": true + }, + { + "name": "type", + "type": 4, + "optional": false } ], "indices": [] @@ -52354,29 +48998,44 @@ "kind": "primitive", "type": "string" }, + { + "kind": "primitive", + "type": "number" + }, { "kind": "literal", - "value": "reasoning" + "value": "tool-call-delta" }, { "kind": "object", "properties": [ { - "name": "text", - "type": 2, + "name": "block", + "type": 6, + "optional": false + }, + { + "name": "index", + "type": 3, "optional": false }, { "name": "type", - "type": 5, + "type": 26, "optional": false } ], "indices": [] }, { - "kind": "literal", - "value": "text" + "kind": "union", + "types": [ + 7, + 9, + 19, + 22, + 24 + ] }, { "kind": "object", @@ -52398,7 +49057,7 @@ }, { "name": "type", - "type": 7, + "type": 8, "optional": false } ], @@ -52413,7 +49072,7 @@ "properties": [ { "name": "attachment", - "type": 9, + "type": 10, "optional": false }, { @@ -52439,12 +49098,12 @@ }, { "name": "bytes", - "type": 10, + "type": 3, "optional": false }, { "name": "height", - "type": 10, + "type": 3, "optional": false }, { @@ -52464,16 +49123,12 @@ }, { "name": "width", - "type": 10, + "type": 3, "optional": false } ], "indices": [] }, - { - "kind": "primitive", - "type": "number" - }, { "kind": "union", "types": [ @@ -52483,14 +49138,6 @@ 15 ] }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, { "kind": "literal", "value": "image/png" @@ -52499,17 +49146,25 @@ "kind": "literal", "value": "image/webp" }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, { "kind": "object", "properties": [ { "name": "height", - "type": 10, + "type": 3, "optional": false }, { "name": "width", - "type": 10, + "type": 3, "optional": false } ], @@ -52549,473 +49204,13 @@ }, { "name": "bytes", - "type": 10, - "optional": false - }, - { - "name": "name", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 23, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 0 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - } - ] - }, - "names": [ - "packages/llm/llm/src/types.ts#ContentBlock" - ], - "sources": [ - "packages/llm/llm/src/types.ts:137" - ] - }, - { - "digest": "c80c89da83c46db7a454f034c10f969e03cfb574859c7316e5bff683f5a14b0e", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 26, - "optional": true - }, - { - "name": "seq", - "type": 2, - "optional": false - }, - { - "name": "time", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 72, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "step", - "type": 2, - "optional": false - }, - { - "name": "stream", "type": 3, "optional": false }, - { - "name": "turn", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 4 - }, - { - "kind": "union", - "types": [ - 5, - 10, - 68, - 70 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "args", - "type": 6, - "optional": false - }, - { - "name": "dt", - "type": 8, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 2, - "optional": false - }, { "name": "name", - "type": 7, - "optional": true - }, - { - "name": "time0", "type": 2, "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "literal", - "value": "tool-call-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 11, - "optional": false - }, - { - "name": "time", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 67, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 12, - 14, - 40, - 43, - 45, - 47, - 64 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "type", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 15, - "optional": false - }, - { - "name": "index", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 39, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 16, - 18, - 28, - 31, - 35, - 37 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 7, - "optional": false - }, - { - "name": "id", - "type": 7, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 17, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 19, - "optional": false - }, - { - "name": "offloaded", - "type": 26, - "optional": true - }, - { - "name": "type", - "type": 27, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 2, - "optional": false - }, - { - "name": "height", - "type": 2, - "optional": false - }, - { - "name": "mediaType", - "type": 20, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": true - }, - { - "name": "originalDimensions", - "type": 25, - "optional": true - }, - { - "name": "width", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 21, - 22, - 23, - 24 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 2, - "optional": false - }, - { - "name": "width", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 29, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 7, - "optional": false - }, - { - "name": "bytes", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 7, - "optional": false } ], "indices": [] @@ -53024,55 +49219,17 @@ "kind": "literal", "value": "file" }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 32, - "optional": false - }, - { - "name": "isError", - "type": 33, - "optional": true - }, - { - "name": "toolCallId", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 15 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, { "kind": "object", "properties": [ { "name": "text", - "type": 7, + "type": 2, "optional": false }, { "name": "type", - "type": 36, + "type": 23, "optional": false } ], @@ -53087,12 +49244,12 @@ "properties": [ { "name": "text", - "type": 7, + "type": 2, "optional": false }, { "name": "type", - "type": 38, + "type": 25, "optional": false } ], @@ -53111,17 +49268,17 @@ "properties": [ { "name": "blockType", - "type": 41, + "type": 28, "optional": false }, { "name": "index", - "type": 2, + "type": 3, "optional": false }, { "name": "type", - "type": 42, + "type": 29, "optional": false } ], @@ -53130,12 +49287,11 @@ { "kind": "union", "types": [ - 17, - 27, - 30, - 34, - 36, - 38 + 8, + 18, + 21, + 23, + 25 ] }, { @@ -53147,478 +49303,14 @@ "properties": [ { "name": "index", - "type": 2, + "type": 3, "optional": false }, { "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", "type": 2, "optional": false }, - { - "name": "text", - "type": 7, - "optional": false - }, - { - "name": "type", - "type": 46, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "reason", - "type": 48, - "optional": false - }, - { - "name": "replayState", - "type": 60, - "optional": true - }, - { - "name": "type", - "type": 63, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 49, - 52, - 54, - 56, - 58 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "code", - "type": 7, - "optional": false - }, - { - "name": "message", - "type": 7, - "optional": false - }, - { - "name": "offloadImages", - "type": 2, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 2, - "optional": true - }, - { - "name": "requestId", - "type": 7, - "optional": true - }, - { - "name": "status", - "type": 2, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "aborted" - }, - { - "kind": "object", - "properties": [ - { - "name": "failure", - "type": 50, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "error" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "max-tokens" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "stop" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-calls" - }, - { - "kind": "object", - "properties": [ - { - "name": "blocks", - "type": 61, - "optional": true - }, - { - "name": "response", - "type": 62, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 62 - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "literal", - "value": "finish" - }, - { - "kind": "object", - "properties": [ - { - "name": "type", - "type": 65, - "optional": false - }, - { - "name": "usage", - "type": 66, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "usage" - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 2, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 2, - "optional": true - }, - { - "name": "inputTokens", - "type": 2, - "optional": false - }, - { - "name": "outputTokens", - "type": 2, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 2, - "optional": true - }, - { - "name": "totalTokens", - "type": 2, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "chunk" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 8, - "optional": false - }, - { - "name": "index", - "type": 2, - "optional": false - }, - { - "name": "texts", - "type": 6, - "optional": false - }, - { - "name": "time0", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 69, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning-chunks" - }, - { - "kind": "object", - "properties": [ - { - "name": "dt", - "type": 8, - "optional": false - }, - { - "name": "index", - "type": 2, - "optional": false - }, - { - "name": "texts", - "type": 6, - "optional": false - }, - { - "name": "time0", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 71, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text-chunks" - }, - { - "kind": "literal", - "value": "assistant/attempt" - } - ] - }, - "names": [], - "sources": [] - }, - { - "digest": "c8e6f48878cc2a2f0dc59682280d81f407943fb503f32c64bf9ff3d9393c3eff", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "literal", - "value": "active" - } - ] - }, - "names": [], - "sources": [] - }, - { - "digest": "c93b6f51b399607349b4bcc66b58e848a44250ffc1e2537207bd092dfff94192", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "chunk", - "type": 1, - "optional": false - }, - { - "name": "time", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 2, - 6, - 32, - 35, - 37, - 39, - 56 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "argumentsDelta", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "index", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": true - }, - { - "name": "type", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "literal", - "value": "tool-call-delta" - }, - { - "kind": "object", - "properties": [ - { - "name": "block", - "type": 7, - "optional": false - }, - { - "name": "index", - "type": 4, - "optional": false - }, { "name": "type", "type": 31, @@ -53627,338 +49319,6 @@ ], "indices": [] }, - { - "kind": "union", - "types": [ - 8, - 10, - 20, - 23, - 27, - 29 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 11, - "optional": false - }, - { - "name": "offloaded", - "type": 18, - "optional": true - }, - { - "name": "type", - "type": 19, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 4, - "optional": false - }, - { - "name": "height", - "type": 4, - "optional": false - }, - { - "name": "mediaType", - "type": 12, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": true - }, - { - "name": "originalDimensions", - "type": 17, - "optional": true - }, - { - "name": "width", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 13, - 14, - 15, - 16 - ] - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 4, - "optional": false - }, - { - "name": "width", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 21, - "optional": false - }, - { - "name": "type", - "type": 22, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 24, - "optional": false - }, - { - "name": "isError", - "type": 25, - "optional": true - }, - { - "name": "toolCallId", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "literal", - "value": "block-end" - }, - { - "kind": "object", - "properties": [ - { - "name": "blockType", - "type": 33, - "optional": false - }, - { - "name": "index", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 9, - 19, - 22, - 26, - 28, - 30 - ] - }, - { - "kind": "literal", - "value": "block-start" - }, - { - "kind": "object", - "properties": [ - { - "name": "index", - "type": 4, - "optional": false - }, - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 36, - "optional": false - } - ], - "indices": [] - }, { "kind": "literal", "value": "reasoning-delta" @@ -53968,17 +49328,17 @@ "properties": [ { "name": "index", - "type": 4, - "optional": false - }, - { - "name": "text", "type": 3, "optional": false }, + { + "name": "text", + "type": 2, + "optional": false + }, { "name": "type", - "type": 38, + "type": 33, "optional": false } ], @@ -53993,17 +49353,17 @@ "properties": [ { "name": "reason", - "type": 40, + "type": 35, "optional": false }, { "name": "replayState", - "type": 52, + "type": 47, "optional": true }, { "name": "type", - "type": 55, + "type": 50, "optional": false } ], @@ -54012,11 +49372,11 @@ { "kind": "union", "types": [ + 36, + 39, 41, - 44, - 46, - 48, - 50 + 43, + 45 ] }, { @@ -54024,12 +49384,12 @@ "properties": [ { "name": "failure", - "type": 42, + "type": 37, "optional": false }, { "name": "kind", - "type": 43, + "type": 38, "optional": false } ], @@ -54040,32 +49400,32 @@ "properties": [ { "name": "code", - "type": 3, + "type": 2, "optional": false }, { "name": "message", - "type": 3, + "type": 2, "optional": false }, { "name": "offloadImages", - "type": 4, - "optional": true - }, - { - "name": "providerRetryAfterMs", - "type": 4, - "optional": true - }, - { - "name": "requestId", "type": 3, "optional": true }, + { + "name": "providerRetryAfterMs", + "type": 3, + "optional": true + }, + { + "name": "requestId", + "type": 2, + "optional": true + }, { "name": "status", - "type": 4, + "type": 3, "optional": true } ], @@ -54080,12 +49440,12 @@ "properties": [ { "name": "failure", - "type": 42, + "type": 37, "optional": false }, { "name": "kind", - "type": 45, + "type": 40, "optional": false } ], @@ -54100,7 +49460,7 @@ "properties": [ { "name": "kind", - "type": 47, + "type": 42, "optional": false } ], @@ -54115,7 +49475,7 @@ "properties": [ { "name": "kind", - "type": 49, + "type": 44, "optional": false } ], @@ -54130,7 +49490,7 @@ "properties": [ { "name": "kind", - "type": 51, + "type": 46, "optional": false } ], @@ -54145,12 +49505,12 @@ "properties": [ { "name": "blocks", - "type": 53, + "type": 48, "optional": true }, { "name": "response", - "type": 54, + "type": 49, "optional": false } ], @@ -54158,7 +49518,7 @@ }, { "kind": "array", - "element": 54 + "element": 49 }, { "kind": "opaque", @@ -54173,12 +49533,12 @@ "properties": [ { "name": "type", - "type": 57, + "type": 52, "optional": false }, { "name": "usage", - "type": 58, + "type": 53, "optional": false } ], @@ -54193,62 +49553,46 @@ "properties": [ { "name": "cacheReadTokens", - "type": 4, + "type": 3, "optional": true }, { "name": "cacheWriteTokens", - "type": 4, + "type": 3, "optional": true }, { "name": "inputTokens", - "type": 4, + "type": 3, "optional": false }, { "name": "outputTokens", - "type": 4, + "type": 3, "optional": false }, { "name": "reasoningTokens", - "type": 4, + "type": 3, "optional": true }, { "name": "totalTokens", - "type": 4, + "type": 3, "optional": true } ], "indices": [] - }, - { - "kind": "literal", - "value": "chunk" } ] }, - "names": [], + "names": [ + "packages/llm/llm/src/types.ts#StreamChunk" + ], "sources": [ - "packages/llm/llm/src/assistant-stream.ts:44" + "packages/llm/llm/src/types.ts:417" ] }, - { - "digest": "c99e20441bf15341e9db54385e558e5c03d21dff2eb1ac08ccbf47c2d8747954", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "literal", - "value": "feedback/record" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "ca085dba2c877feceebf3c62f9d39c6c2a4d2314d97b94b3927a780fe8fe2bb2", "schema": { @@ -54493,6 +49837,1173 @@ "names": [], "sources": [] }, + { + "digest": "cbe418d5a3727fbd3599f90101680dae254ac1d6163b1b8b2ca30f28afb5212a", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 18, + "optional": true + }, + { + "name": "seq", + "type": 11, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 88, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "inserted", + "type": 2, + "optional": false + }, + { + "name": "outcome", + "type": 84, + "optional": true + }, + { + "name": "removedCount", + "type": 11, + "optional": true + }, + { + "name": "start", + "type": 11, + "optional": false + }, + { + "name": "target", + "type": 85, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "role", + "type": 27, + "optional": false + }, + { + "name": "source", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 20, + 23, + 25 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 10, + "optional": false + }, + { + "name": "offloaded", + "type": 18, + "optional": true + }, + { + "name": "type", + "type": 19, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 21, + "optional": false + }, + { + "name": "type", + "type": 22, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 24, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 29, + 38, + 40, + 41, + 44, + 49, + 51, + 56, + 57, + 58, + 60, + 62, + 63, + 71, + 73, + 75, + 77, + 79, + 82, + 83 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 18, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 7, + "optional": true + }, + { + "name": "changes", + "type": 30, + "optional": false + }, + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 31 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 32, + "optional": false + }, + { + "name": "digest", + "type": 7, + "optional": true + }, + { + "name": "path", + "type": 7, + "optional": false + }, + { + "name": "scope", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 33, + 34, + 35 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 7, + "optional": true + }, + { + "name": "kind", + "type": 27, + "optional": false + }, + { + "name": "rpcId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 7, + "optional": false + }, + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "ruleId", + "type": 7, + "optional": false + }, + { + "name": "source", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 45, + "optional": false + }, + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "update", + "type": 18, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 46 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + }, + { + "name": "sections", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 55 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 36, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 61, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 47, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 59, + "optional": false + }, + { + "name": "kind", + "type": 64, + "optional": false + }, + { + "name": "references", + "type": 65, + "optional": false + }, + { + "name": "version", + "type": 70, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 66 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 11, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 67, + "optional": false + }, + { + "name": "compacted", + "type": 69, + "optional": false + }, + { + "name": "inputIndex", + "type": 11, + "optional": false + }, + { + "name": "label", + "type": 7, + "optional": false + }, + { + "name": "omittedBytes", + "type": 11, + "optional": false + }, + { + "name": "omittedMessages", + "type": 11, + "optional": false + }, + { + "name": "originalMessages", + "type": 11, + "optional": false + }, + { + "name": "retainedMessages", + "type": 11, + "optional": false + }, + { + "name": "sessionId", + "type": 7, + "optional": false + }, + { + "name": "truncated", + "type": 69, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 11, + 68 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 61, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "revision", + "type": 11, + "optional": false + }, + { + "name": "round", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "messageId", + "type": 7, + "optional": false + }, + { + "name": "senderId", + "type": 7, + "optional": false + }, + { + "name": "senderName", + "type": 7, + "optional": false + }, + { + "name": "teamId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 80, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 81, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "plugin", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "canceled" + }, + { + "kind": "union", + "types": [ + 86, + 87 + ] + }, + { + "kind": "literal", + "value": "next-step" + }, + { + "kind": "literal", + "value": "next-turn" + }, + { + "kind": "literal", + "value": "agent/inbox/spliced" + } + ] + }, + "names": [], + "sources": [] + }, + { + "digest": "ccca7d237e176afec87877c379035a69e715ae0fb4e859015d29f14cc4376588", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "union", + "types": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "tool-call" + } + ] + }, + "names": [ + "packages/llm/llm/src/types.ts#ContentBlockType" + ], + "sources": [ + "packages/llm/llm/src/types.ts:126" + ] + }, { "digest": "cd186c309e2bef305705e1d324139240f5e681f4f6a957d6a25b0225f65560df", "schema": { @@ -55120,299 +51631,6 @@ "names": [], "sources": [] }, - { - "digest": "d61574d68558c5a184429e70b04da393dd5460bf5cc3ddef814546e659bd5127", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 24, - "optional": true - }, - { - "name": "toolCallId", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 0, - 3, - 6, - 8, - 10, - 21 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 4, - "optional": false - }, - { - "name": "id", - "type": 4, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 11, - "optional": false - }, - { - "name": "offloaded", - "type": 19, - "optional": true - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 12, - "optional": false - }, - { - "name": "height", - "type": 12, - "optional": false - }, - { - "name": "mediaType", - "type": 13, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": true - }, - { - "name": "originalDimensions", - "type": 18, - "optional": true - }, - { - "name": "width", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 14, - 15, - 16, - 17 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 12, - "optional": false - }, - { - "name": "width", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 22, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 4, - "optional": false - }, - { - "name": "bytes", - "type": 12, - "optional": false - }, - { - "name": "name", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - } - ] - }, - "names": [ - "packages/llm/llm/src/types.ts#ToolResultBlock" - ], - "sources": [ - "packages/llm/llm/src/types.ts:114" - ] - }, { "digest": "d63b8b8ffad9c02fd80c43a17df4f240c1fe8118ecca9de34f9d5871838ab5b9", "schema": { @@ -55505,6 +51723,810 @@ "names": [], "sources": [] }, + { + "digest": "d8704810efe22c47f7062870e0d30ef1e9a1a9cc34edd10f71461b944d34e878", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "array", + "element": 1 + }, + { + "kind": "union", + "types": [ + 2, + 8, + 62, + 64 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 3, + "optional": false + }, + { + "name": "dt", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "time0", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 9, + "optional": false + }, + { + "name": "time", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 10, + 12, + 34, + 37, + 39, + 41, + 58 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 13, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 33, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 14, + 16, + 26, + 29, + 31 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 15, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 17, + "optional": false + }, + { + "name": "offloaded", + "type": 24, + "optional": true + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 6, + "optional": false + }, + { + "name": "height", + "type": 6, + "optional": false + }, + { + "name": "mediaType", + "type": 18, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": true + }, + { + "name": "originalDimensions", + "type": 23, + "optional": true + }, + { + "name": "width", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 19, + 20, + 21, + 22 + ] + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 6, + "optional": false + }, + { + "name": "width", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 27, + "optional": false + }, + { + "name": "type", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 4, + "optional": false + }, + { + "name": "bytes", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 4, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 35, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 15, + 25, + 28, + 30, + 32 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 4, + "optional": false + }, + { + "name": "type", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 42, + "optional": false + }, + { + "name": "replayState", + "type": 54, + "optional": true + }, + { + "name": "type", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 43, + 46, + 48, + 50, + 52 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 4, + "optional": false + }, + { + "name": "message", + "type": 4, + "optional": false + }, + { + "name": "offloadImages", + "type": 6, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 6, + "optional": true + }, + { + "name": "requestId", + "type": 4, + "optional": true + }, + { + "name": "status", + "type": 6, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 55, + "optional": true + }, + { + "name": "response", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 56 + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 59, + "optional": false + }, + { + "name": "usage", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 6, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 6, + "optional": true + }, + { + "name": "inputTokens", + "type": 6, + "optional": false + }, + { + "name": "outputTokens", + "type": 6, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 6, + "optional": true + }, + { + "name": "totalTokens", + "type": 6, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 5, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "texts", + "type": 3, + "optional": false + }, + { + "name": "time0", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 5, + "optional": false + }, + { + "name": "index", + "type": 6, + "optional": false + }, + { + "name": "texts", + "type": 3, + "optional": false + }, + { + "name": "time0", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 65, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "d8f868c6b3e7189de6c1ffe2ea04794ea2aa31315b6347d12536e46020afac87", "schema": { @@ -56118,1182 +53140,6 @@ "names": [], "sources": [] }, - { - "digest": "e0b5bf44c27bbfc6ab144239e3e4169c4d21146645e0e3121bbb359c3bc8591d", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 19, - "optional": true - }, - { - "name": "seq", - "type": 2, - "optional": false - }, - { - "name": "time", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 91, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "maxTokens", - "type": 2, - "optional": false - }, - { - "name": "messageSeqs", - "type": 3, - "optional": false - }, - { - "name": "messages", - "type": 4, - "optional": false - }, - { - "name": "route", - "type": 90, - "optional": false - }, - { - "name": "system", - "type": 9, - "optional": false - }, - { - "name": "titleProvider", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "id", - "type": 9, - "optional": false - }, - { - "name": "role", - "type": 31, - "optional": false - }, - { - "name": "source", - "type": 35, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "union", - "types": [ - 8, - 11, - 21, - 24, - 27, - 29 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 9, - "optional": false - }, - { - "name": "id", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 12, - "optional": false - }, - { - "name": "offloaded", - "type": 19, - "optional": true - }, - { - "name": "type", - "type": 20, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 9, - "optional": false - }, - { - "name": "bytes", - "type": 2, - "optional": false - }, - { - "name": "height", - "type": 2, - "optional": false - }, - { - "name": "mediaType", - "type": 13, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": true - }, - { - "name": "originalDimensions", - "type": 18, - "optional": true - }, - { - "name": "width", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 14, - 15, - 16, - 17 - ] - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 2, - "optional": false - }, - { - "name": "width", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 22, - "optional": false - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 9, - "optional": false - }, - { - "name": "bytes", - "type": 2, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "isError", - "type": 25, - "optional": true - }, - { - "name": "toolCallId", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 9, - "optional": false - }, - { - "name": "type", - "type": 30, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "union", - "types": [ - 32, - 33, - 34 - ] - }, - { - "kind": "literal", - "value": "system" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "literal", - "value": "user" - }, - { - "kind": "union", - "types": [ - 36, - 45, - 47, - 48, - 51, - 56, - 58, - 63, - 64, - 65, - 67, - 69, - 70, - 77, - 79, - 81, - 83, - 85, - 88, - 89 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "baseline", - "type": 19, - "optional": true - }, - { - "name": "baselineIdentity", - "type": 9, - "optional": true - }, - { - "name": "changes", - "type": 37, - "optional": false - }, - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 38 - }, - { - "kind": "object", - "properties": [ - { - "name": "action", - "type": 39, - "optional": false - }, - { - "name": "digest", - "type": 9, - "optional": true - }, - { - "name": "path", - "type": 9, - "optional": false - }, - { - "name": "scope", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 40, - 41, - 42 - ] - }, - { - "kind": "literal", - "value": "remove" - }, - { - "kind": "literal", - "value": "replace" - }, - { - "kind": "literal", - "value": "set" - }, - { - "kind": "literal", - "value": "instructions" - }, - { - "kind": "literal", - "value": "agent-instructions" - }, - { - "kind": "object", - "properties": [ - { - "name": "callId", - "type": 9, - "optional": false - }, - { - "name": "kind", - "type": 46, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool" - }, - { - "kind": "object", - "properties": [ - { - "name": "clientTimeZone", - "type": 9, - "optional": true - }, - { - "name": "kind", - "type": 34, - "optional": false - }, - { - "name": "rpcId", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "deliveryId", - "type": 9, - "optional": false - }, - { - "name": "form", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "provider", - "type": 9, - "optional": false - }, - { - "name": "ruleId", - "type": 9, - "optional": false - }, - { - "name": "source", - "type": 9, - "optional": false - }, - { - "name": "summary", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "notice" - }, - { - "kind": "literal", - "value": "webhook" - }, - { - "kind": "object", - "properties": [ - { - "name": "entries", - "type": 52, - "optional": false - }, - { - "name": "form", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "update", - "type": 19, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 53 - }, - { - "kind": "object", - "properties": [ - { - "name": "description", - "type": 9, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "catalog" - }, - { - "kind": "literal", - "value": "skill-catalog" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "name", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "skill-invocation" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 59, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - }, - { - "name": "sections", - "type": 61, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "plugin" - }, - { - "kind": "array", - "element": 62 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 9, - "optional": false - }, - { - "name": "text", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - }, - { - "name": "summary", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 43, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "recall" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 54, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 71, - "optional": false - }, - { - "name": "references", - "type": 72, - "optional": false - }, - { - "name": "version", - "type": 76, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session-reference" - }, - { - "kind": "array", - "element": 73 - }, - { - "kind": "object", - "properties": [ - { - "name": "capturedFormatVersion", - "type": 2, - "optional": true - }, - { - "name": "capturedThroughSeq", - "type": 74, - "optional": false - }, - { - "name": "compacted", - "type": 25, - "optional": false - }, - { - "name": "inputIndex", - "type": 2, - "optional": false - }, - { - "name": "label", - "type": 9, - "optional": false - }, - { - "name": "omittedBytes", - "type": 2, - "optional": false - }, - { - "name": "omittedMessages", - "type": 2, - "optional": false - }, - { - "name": "originalMessages", - "type": 2, - "optional": false - }, - { - "name": "retainedMessages", - "type": 2, - "optional": false - }, - { - "name": "sessionId", - "type": 9, - "optional": false - }, - { - "name": "truncated", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 2, - 75 - ] - }, - { - "kind": "primitive", - "type": "null" - }, - { - "kind": "literal", - "value": 1 - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 49, - "optional": false - }, - { - "name": "kind", - "type": 78, - "optional": false - }, - { - "name": "senderSessionId", - "type": 9, - "optional": false - }, - { - "name": "summary", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "subagent-settled" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 80, - "optional": false - }, - { - "name": "senderSessionId", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "goalId", - "type": 9, - "optional": false - }, - { - "name": "kind", - "type": 82, - "optional": false - }, - { - "name": "revision", - "type": 2, - "optional": false - }, - { - "name": "round", - "type": 2, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "goal" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 84, - "optional": false - }, - { - "name": "messageId", - "type": 9, - "optional": false - }, - { - "name": "senderId", - "type": 9, - "optional": false - }, - { - "name": "senderName", - "type": 9, - "optional": false - }, - { - "name": "teamId", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "team-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 86, - "optional": false - }, - { - "name": "model", - "type": 9, - "optional": false - }, - { - "name": "provider", - "type": 9, - "optional": false - }, - { - "name": "replayState", - "type": 87, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "plugin", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 34, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "model", - "type": 9, - "optional": false - }, - { - "name": "provider", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "session/title-llm-request" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "e1d0e52dcd1855ffb803efc18f8f7b776c48d1c25757e8a75c0281fa298c02e1", "schema": { @@ -57538,6 +53384,382 @@ "packages/schedule/schedule/src/types.ts:105" ] }, + { + "digest": "e1e89e5a614b3090837728fa6e314fe019c99f07b6319f9d4a7d5a52cba396e4", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 1, + "optional": false + }, + { + "name": "llmStreamCall", + "type": 2, + "optional": false + }, + { + "name": "maxTokens", + "type": 3, + "optional": true + }, + { + "name": "model", + "type": 1, + "optional": false + }, + { + "name": "provider", + "type": 1, + "optional": false + }, + { + "name": "rawOutput", + "type": 4, + "optional": false + }, + { + "name": "shadowedRange", + "type": 24, + "optional": false + }, + { + "name": "shadowedSeqs", + "type": 25, + "optional": false + }, + { + "name": "shadowedTokenCount", + "type": 3, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 1, + "optional": true + }, + { + "name": "summary", + "type": 4, + "optional": false + }, + { + "name": "usage", + "type": 26, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 8, + 10, + 12, + 21 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 1, + "optional": false + }, + { + "name": "id", + "type": 1, + "optional": false + }, + { + "name": "name", + "type": 1, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 13, + "optional": false + }, + { + "name": "offloaded", + "type": 2, + "optional": true + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 1, + "optional": false + }, + { + "name": "bytes", + "type": 3, + "optional": false + }, + { + "name": "height", + "type": 3, + "optional": false + }, + { + "name": "mediaType", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 1, + "optional": true + }, + { + "name": "originalDimensions", + "type": 19, + "optional": true + }, + { + "name": "width", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 15, + 16, + 17, + 18 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 3, + "optional": false + }, + { + "name": "width", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 22, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 1, + "optional": false + }, + { + "name": "bytes", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 1, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "end", + "type": 3, + "optional": false + }, + { + "name": "start", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 3, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 3, + "optional": true + }, + { + "name": "inputTokens", + "type": 3, + "optional": false + }, + { + "name": "outputTokens", + "type": 3, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 3, + "optional": true + }, + { + "name": "totalTokens", + "type": 3, + "optional": true + } + ], + "indices": [] + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "e2d0367e5716bc188435e51718ebff8ce873190625fa93b1c5331102d98758fa", "schema": { @@ -58074,377 +54296,6 @@ "names": [], "sources": [] }, - { - "digest": "e50b0a3ed8e6c80b672e4f855c91984f03b5c3fdd5d475bf171171f391a86c83", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "role", - "type": 27, - "optional": false - }, - { - "name": "source", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 2 - }, - { - "kind": "union", - "types": [ - 3, - 7, - 9, - 11, - 13, - 24 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 1, - "optional": false - }, - { - "name": "isError", - "type": 4, - "optional": true - }, - { - "name": "toolCallId", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 6, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 8, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 5, - "optional": false - }, - { - "name": "id", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 14, - "optional": false - }, - { - "name": "offloaded", - "type": 22, - "optional": true - }, - { - "name": "type", - "type": 23, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "mediaType", - "type": 16, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": true - }, - { - "name": "originalDimensions", - "type": 21, - "optional": true - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "union", - "types": [ - 17, - 18, - 19, - 20 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 15, - "optional": false - }, - { - "name": "width", - "type": 15, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 25, - "optional": false - }, - { - "name": "type", - "type": 26, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 5, - "optional": false - }, - { - "name": "bytes", - "type": 15, - "optional": false - }, - { - "name": "name", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "literal", - "value": "assistant" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 29, - "optional": false - }, - { - "name": "model", - "type": 5, - "optional": false - }, - { - "name": "provider", - "type": 5, - "optional": false - }, - { - "name": "replayState", - "type": 30, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model" - }, - { - "kind": "opaque", - "reason": "unknown" - } - ] - }, - "names": [ - "packages/llm/llm/src/message.ts#AssistantMessage" - ], - "sources": [ - "packages/llm/llm/src/message.ts:148" - ] - }, - { - "digest": "e5244812c495a80c2e78ba2c2690dca5f6b58ea8d3fe5531ff94a6f9ac5e5d66", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "literal", - "value": "tool-result" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "e5d3828df1ec3e2a66879de0659e0f4866d9cfffc00825ee731a66f8a0c03d98", "schema": { @@ -58742,6 +54593,77 @@ "names": [], "sources": [] }, + { + "digest": "e829e4d334f3b1b3d64ab4be6a4778c79b98de8abfc2ec136d0ff4b971042cd7", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 1, + "optional": false + }, + { + "name": "index", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 3, + 4, + 5, + 6 + ] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "literal", + "value": "block-start" + } + ] + }, + "names": [], + "sources": [ + "packages/llm/llm/src/types.ts:418" + ] + }, { "digest": "e8d26e6993445743e6c4342c31b284c7d8f5574369abdd6021183af1a6b3538f", "schema": { @@ -59513,9 +55435,989 @@ }, "names": [], "sources": [ - "packages/llm/llm/src/types.ts:432" + "packages/llm/llm/src/types.ts:423" ] }, + { + "digest": "f219a9f66fcc92ffec27bbd96fa21ffc2cffbaf2ad1de05757ec37205b1a0b58", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 2, + "optional": true + }, + { + "name": "seq", + "type": 11, + "optional": false + }, + { + "name": "surfaceOp", + "type": 73, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 77, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "interrupted", + "type": 2, + "optional": true + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "step", + "type": 11, + "optional": false + }, + { + "name": "stream", + "type": 30, + "optional": false + }, + { + "name": "turn", + "type": 11, + "optional": false + }, + { + "name": "usage", + "type": 67, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "role", + "type": 26, + "optional": false + }, + { + "name": "source", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 10, + "optional": false + }, + { + "name": "offloaded", + "type": 2, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "mediaType", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 17, + "optional": true + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 13, + 14, + 15, + 16 + ] + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 11, + "optional": false + }, + { + "name": "width", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 28, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 29, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "array", + "element": 31 + }, + { + "kind": "union", + "types": [ + 32, + 36, + 69, + 71 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "args", + "type": 33, + "optional": false + }, + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 7 + }, + { + "kind": "array", + "element": 11 + }, + { + "kind": "literal", + "value": "tool-call-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "chunk", + "type": 37, + "optional": false + }, + { + "name": "time", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 68, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 38, + 40, + 42, + 45, + 47, + 49, + 65 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "argumentsDelta", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "block", + "type": 5, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "block-end" + }, + { + "kind": "object", + "properties": [ + { + "name": "blockType", + "type": 43, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 8, + 18, + 21, + 23, + 25 + ] + }, + { + "kind": "literal", + "value": "block-start" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-delta" + }, + { + "kind": "object", + "properties": [ + { + "name": "reason", + "type": 50, + "optional": false + }, + { + "name": "replayState", + "type": 62, + "optional": true + }, + { + "name": "type", + "type": 64, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 51, + 54, + 56, + 58, + 60 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 7, + "optional": false + }, + { + "name": "message", + "type": 7, + "optional": false + }, + { + "name": "offloadImages", + "type": 11, + "optional": true + }, + { + "name": "providerRetryAfterMs", + "type": 11, + "optional": true + }, + { + "name": "requestId", + "type": 7, + "optional": true + }, + { + "name": "status", + "type": 11, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "aborted" + }, + { + "kind": "object", + "properties": [ + { + "name": "failure", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "error" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "max-tokens" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "stop" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-calls" + }, + { + "kind": "object", + "properties": [ + { + "name": "blocks", + "type": 63, + "optional": true + }, + { + "name": "response", + "type": 29, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "literal", + "value": "finish" + }, + { + "kind": "object", + "properties": [ + { + "name": "type", + "type": 66, + "optional": false + }, + { + "name": "usage", + "type": 67, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "usage" + }, + { + "kind": "object", + "properties": [ + { + "name": "cacheReadTokens", + "type": 11, + "optional": true + }, + { + "name": "cacheWriteTokens", + "type": 11, + "optional": true + }, + { + "name": "inputTokens", + "type": 11, + "optional": false + }, + { + "name": "outputTokens", + "type": 11, + "optional": false + }, + { + "name": "reasoningTokens", + "type": 11, + "optional": true + }, + { + "name": "totalTokens", + "type": 11, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "chunk" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "texts", + "type": 33, + "optional": false + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 70, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning-chunks" + }, + { + "kind": "object", + "properties": [ + { + "name": "dt", + "type": 34, + "optional": false + }, + { + "name": "index", + "type": 11, + "optional": false + }, + { + "name": "texts", + "type": 33, + "optional": false + }, + { + "name": "time0", + "type": 11, + "optional": false + }, + { + "name": "type", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text-chunks" + }, + { + "kind": "union", + "types": [ + 74, + 76 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 11, + "optional": false + }, + { + "name": "op", + "type": 75, + "optional": false + }, + { + "name": "startSeq", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "assistant/message" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "f2da0f27c1e6add59982c37b15e4a4912c5b33466859cce3b13d503600e24aef", "schema": { @@ -59594,9 +56496,489 @@ "packages/llm/llm/src/types.ts#SystemPromptUpdate" ], "sources": [ - "packages/llm/llm/src/types.ts:383" + "packages/llm/llm/src/types.ts:374" ] }, + { + "digest": "f4c6f3eae6607f412a9023406c8c3bd351a02451848bb78c2436f409447dd60c", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 20, + "optional": true + }, + { + "name": "seq", + "type": 13, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 34, + "optional": true + }, + { + "name": "surfaceOp", + "type": 35, + "optional": false + }, + { + "name": "time", + "type": 13, + "optional": false + }, + { + "name": "type", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "error", + "type": 2, + "optional": true + }, + { + "name": "message", + "type": 4, + "optional": false + }, + { + "name": "meta", + "type": 30, + "optional": true + }, + { + "name": "step", + "type": 13, + "optional": false + }, + { + "name": "turn", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "reason", + "type": 3, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "isError", + "type": 27, + "optional": true + }, + { + "name": "role", + "type": 28, + "optional": false + }, + { + "name": "source", + "type": 29, + "optional": false + }, + { + "name": "toolCallId", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 6 + }, + { + "kind": "union", + "types": [ + 7, + 9, + 11, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 12, + "optional": false + }, + { + "name": "offloaded", + "type": 20, + "optional": true + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "mediaType", + "type": 14, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": true + }, + { + "name": "originalDimensions", + "type": 19, + "optional": true + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 15, + 16, + 17, + 18 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 13, + "optional": false + }, + { + "name": "width", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 3, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 25, + "optional": false + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 3, + "optional": false + }, + { + "name": "bytes", + "type": 13, + "optional": false + }, + { + "name": "name", + "type": 3, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 3, + "optional": false + }, + { + "name": "kind", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 3, + 13, + 27, + 31, + 32, + 33 + ] + }, + { + "kind": "array", + "element": 30 + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "object", + "properties": [], + "indices": [ + { + "key": 3, + "value": 30 + } + ] + }, + { + "kind": "array", + "element": 13 + }, + { + "kind": "union", + "types": [ + 36, + 38 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 13, + "optional": false + }, + { + "name": "op", + "type": 37, + "optional": false + }, + { + "name": "startSeq", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "literal", + "value": "tool/result" + } + ] + }, + "names": [], + "sources": [] + }, { "digest": "f56c5b59ca0161310c338d31dd16cf14287ccd602ff4181058df178c1c286d7f", "schema": { @@ -59765,520 +57147,6 @@ "names": [], "sources": [] }, - { - "digest": "f6f3f30109e9008fccf7da2a3268a63da8646b59dd7cf7b75bcd9cf08ac08a59", - "schema": { - "root": 0, - "nodes": [ - { - "kind": "object", - "properties": [ - { - "name": "data", - "type": 1, - "optional": false - }, - { - "name": "ignorable", - "type": 4, - "optional": true - }, - { - "name": "seq", - "type": 5, - "optional": false - }, - { - "name": "time", - "type": 5, - "optional": false - }, - { - "name": "type", - "type": 33, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 2, - 32 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "compactionId", - "type": 3, - "optional": false - }, - { - "name": "llmStreamCall", - "type": 4, - "optional": false - }, - { - "name": "maxTokens", - "type": 5, - "optional": true - }, - { - "name": "model", - "type": 3, - "optional": false - }, - { - "name": "provider", - "type": 3, - "optional": false - }, - { - "name": "rawOutput", - "type": 6, - "optional": false - }, - { - "name": "shadowedRange", - "type": 29, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 30, - "optional": false - }, - { - "name": "shadowedTokenCount", - "type": 5, - "optional": false - }, - { - "name": "sourceCommandId", - "type": 3, - "optional": true - }, - { - "name": "summary", - "type": 6, - "optional": false - }, - { - "name": "usage", - "type": 31, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "string" - }, - { - "kind": "literal", - "value": true - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 7 - }, - { - "kind": "union", - "types": [ - 8, - 11, - 13, - 15, - 17, - 26 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 6, - "optional": false - }, - { - "name": "isError", - "type": 9, - "optional": true - }, - { - "name": "toolCallId", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 12, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "reasoning" - }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 14, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, - { - "kind": "object", - "properties": [ - { - "name": "arguments", - "type": 3, - "optional": false - }, - { - "name": "id", - "type": 3, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - }, - { - "name": "type", - "type": 16, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-call" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 18, - "optional": false - }, - { - "name": "offloaded", - "type": 4, - "optional": true - }, - { - "name": "type", - "type": 25, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 5, - "optional": false - }, - { - "name": "height", - "type": 5, - "optional": false - }, - { - "name": "mediaType", - "type": 19, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": true - }, - { - "name": "originalDimensions", - "type": 24, - "optional": true - }, - { - "name": "width", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "union", - "types": [ - 20, - 21, - 22, - 23 - ] - }, - { - "kind": "literal", - "value": "image/gif" - }, - { - "kind": "literal", - "value": "image/jpeg" - }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, - { - "kind": "object", - "properties": [ - { - "name": "height", - "type": 5, - "optional": false - }, - { - "name": "width", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "image" - }, - { - "kind": "object", - "properties": [ - { - "name": "attachment", - "type": 27, - "optional": false - }, - { - "name": "type", - "type": 28, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "attachmentId", - "type": 3, - "optional": false - }, - { - "name": "bytes", - "type": 5, - "optional": false - }, - { - "name": "name", - "type": 3, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "file" - }, - { - "kind": "object", - "properties": [ - { - "name": "end", - "type": 5, - "optional": false - }, - { - "name": "start", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 5 - }, - { - "kind": "object", - "properties": [ - { - "name": "cacheReadTokens", - "type": 5, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 5, - "optional": true - }, - { - "name": "inputTokens", - "type": 5, - "optional": false - }, - { - "name": "outputTokens", - "type": 5, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 5, - "optional": true - }, - { - "name": "totalTokens", - "type": 5, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "compactionId", - "type": 3, - "optional": false - }, - { - "name": "maxTokens", - "type": 5, - "optional": true - }, - { - "name": "model", - "type": 3, - "optional": false - }, - { - "name": "provider", - "type": 3, - "optional": false - }, - { - "name": "rawOutput", - "type": 6, - "optional": true - }, - { - "name": "shadowedRange", - "type": 29, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 30, - "optional": false - }, - { - "name": "shadowedTokenCount", - "type": 5, - "optional": false - }, - { - "name": "sourceCommandId", - "type": 3, - "optional": true - }, - { - "name": "summary", - "type": 6, - "optional": false - }, - { - "name": "usage", - "type": 31, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "compaction/summary" - } - ] - }, - "names": [], - "sources": [] - }, { "digest": "f789af5ab844827eb5a4f357c0afae1eeed108c6c22d8ca1a56e586b349a7c85", "schema": { @@ -60397,6 +57265,403 @@ "names": [], "sources": [] }, + { + "digest": "fb1777a19335be3c5c717e23a1800817fc36fb99277d9a0487e924401210e219", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "error", + "type": 1, + "optional": true + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "meta", + "type": 29, + "optional": true + }, + { + "name": "step", + "type": 12, + "optional": false + }, + { + "name": "turn", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "code", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + }, + { + "name": "reason", + "type": 2, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 2, + "optional": false + }, + { + "name": "isError", + "type": 26, + "optional": true + }, + { + "name": "role", + "type": 27, + "optional": false + }, + { + "name": "source", + "type": 28, + "optional": false + }, + { + "name": "toolCallId", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 8, + 10, + 21, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 2, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 9, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 11, + "optional": false + }, + { + "name": "offloaded", + "type": 19, + "optional": true + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 12, + "optional": false + }, + { + "name": "height", + "type": 12, + "optional": false + }, + { + "name": "mediaType", + "type": 13, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": true + }, + { + "name": "originalDimensions", + "type": 18, + "optional": true + }, + { + "name": "width", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 14, + 15, + 16, + 17 + ] + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 12, + "optional": false + }, + { + "name": "width", + "type": 12, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 22, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 2, + "optional": false + }, + { + "name": "bytes", + "type": 12, + "optional": false + }, + { + "name": "name", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 2, + "optional": false + }, + { + "name": "kind", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 12, + 26, + 30, + 31, + 32 + ] + }, + { + "kind": "array", + "element": 29 + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "object", + "properties": [], + "indices": [ + { + "key": 2, + "value": 29 + } + ] + } + ] + }, + "names": [], + "sources": [ + "packages/core/session/src/types.ts:362" + ] + }, { "digest": "fb5e0517050d2c6d40e5b8145db1f7c5ca7044d5d50fada6ff80e0b22c6ca973", "schema": { @@ -60546,93 +57811,62 @@ "sources": [] }, { - "digest": "fe792a6cd430494503837e21e79f91677704ccdd9e870c679aabd7d43ed47ddd", + "digest": "fd796823ba99092846b017e4a9c2d8ea5a1c8e15a3125662cadba1860ceb1b05", "schema": { "root": 0, "nodes": [ { - "kind": "literal", - "value": "tool-workflow/run-end" - } - ] - }, - "names": [], - "sources": [] - }, - { - "digest": "feb329074f0206ecc06d8a1aa0a0b3e2f47fd27524ba020fbc849ba63e938896", - "schema": { - "root": 0, - "nodes": [ + "kind": "object", + "properties": [ + { + "name": "content", + "type": 1, + "optional": false + }, + { + "name": "id", + "type": 4, + "optional": false + }, + { + "name": "role", + "type": 24, + "optional": false + }, + { + "name": "source", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, { "kind": "union", "types": [ - 1, - 31 + 3, + 6, + 8, + 10, + 21 ] }, { "kind": "object", "properties": [ { - "name": "compactionId", - "type": 2, - "optional": false - }, - { - "name": "llmStreamCall", - "type": 3, - "optional": false - }, - { - "name": "maxTokens", - "type": 4, - "optional": true - }, - { - "name": "model", - "type": 2, - "optional": false - }, - { - "name": "provider", - "type": 2, - "optional": false - }, - { - "name": "rawOutput", - "type": 5, - "optional": false - }, - { - "name": "shadowedRange", - "type": 28, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 29, - "optional": false - }, - { - "name": "shadowedTokenCount", + "name": "text", "type": 4, "optional": false }, { - "name": "sourceCommandId", - "type": 2, - "optional": true - }, - { - "name": "summary", + "name": "type", "type": 5, "optional": false - }, - { - "name": "usage", - "type": 30, - "optional": true } ], "indices": [] @@ -60643,72 +57877,19 @@ }, { "kind": "literal", - "value": true - }, - { - "kind": "primitive", - "type": "number" - }, - { - "kind": "array", - "element": 6 - }, - { - "kind": "union", - "types": [ - 7, - 10, - 12, - 14, - 16, - 25 - ] - }, - { - "kind": "object", - "properties": [ - { - "name": "content", - "type": 5, - "optional": false - }, - { - "name": "isError", - "type": 8, - "optional": true - }, - { - "name": "toolCallId", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 9, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "primitive", - "type": "boolean" - }, - { - "kind": "literal", - "value": "tool-result" + "value": "text" }, { "kind": "object", "properties": [ { "name": "text", - "type": 2, + "type": 4, "optional": false }, { "name": "type", - "type": 11, + "type": 7, "optional": false } ], @@ -60718,47 +57899,27 @@ "kind": "literal", "value": "reasoning" }, - { - "kind": "object", - "properties": [ - { - "name": "text", - "type": 2, - "optional": false - }, - { - "name": "type", - "type": 13, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "text" - }, { "kind": "object", "properties": [ { "name": "arguments", - "type": 2, + "type": 4, "optional": false }, { "name": "id", - "type": 2, + "type": 4, "optional": false }, { "name": "name", - "type": 2, + "type": 4, "optional": false }, { "name": "type", - "type": 15, + "type": 9, "optional": false } ], @@ -60773,17 +57934,17 @@ "properties": [ { "name": "attachment", - "type": 17, + "type": 11, "optional": false }, { "name": "offloaded", - "type": 3, + "type": 19, "optional": true }, { "name": "type", - "type": 24, + "type": 20, "optional": false } ], @@ -60794,49 +57955,53 @@ "properties": [ { "name": "attachmentId", - "type": 2, + "type": 4, "optional": false }, { "name": "bytes", - "type": 4, + "type": 12, "optional": false }, { "name": "height", - "type": 4, + "type": 12, "optional": false }, { "name": "mediaType", - "type": 18, + "type": 13, "optional": false }, { "name": "name", - "type": 2, + "type": 4, "optional": true }, { "name": "originalDimensions", - "type": 23, + "type": 18, "optional": true }, { "name": "width", - "type": 4, + "type": 12, "optional": false } ], "indices": [] }, + { + "kind": "primitive", + "type": "number" + }, { "kind": "union", "types": [ - 19, - 20, - 21, - 22 + 14, + 15, + 16, + 17 ] }, { @@ -60860,17 +58025,21 @@ "properties": [ { "name": "height", - "type": 4, + "type": 12, "optional": false }, { "name": "width", - "type": 4, + "type": 12, "optional": false } ], "indices": [] }, + { + "kind": "literal", + "value": true + }, { "kind": "literal", "value": "image" @@ -60880,12 +58049,12 @@ "properties": [ { "name": "attachment", - "type": 26, + "type": 22, "optional": false }, { "name": "type", - "type": 27, + "type": 23, "optional": false } ], @@ -60896,17 +58065,17 @@ "properties": [ { "name": "attachmentId", - "type": 2, - "optional": false - }, - { - "name": "bytes", "type": 4, "optional": false }, + { + "name": "bytes", + "type": 12, + "optional": false + }, { "name": "name", - "type": 2, + "type": 4, "optional": false } ], @@ -60917,121 +58086,60 @@ "value": "file" }, { - "kind": "object", - "properties": [ - { - "name": "end", - "type": 4, - "optional": false - }, - { - "name": "start", - "type": 4, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "array", - "element": 4 + "kind": "literal", + "value": "assistant" }, { "kind": "object", "properties": [ { - "name": "cacheReadTokens", - "type": 4, - "optional": true - }, - { - "name": "cacheWriteTokens", - "type": 4, - "optional": true - }, - { - "name": "inputTokens", - "type": 4, + "name": "kind", + "type": 26, "optional": false }, - { - "name": "outputTokens", - "type": 4, - "optional": false - }, - { - "name": "reasoningTokens", - "type": 4, - "optional": true - }, - { - "name": "totalTokens", - "type": 4, - "optional": true - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "compactionId", - "type": 2, - "optional": false - }, - { - "name": "maxTokens", - "type": 4, - "optional": true - }, { "name": "model", - "type": 2, + "type": 4, "optional": false }, { "name": "provider", - "type": 2, - "optional": false - }, - { - "name": "rawOutput", - "type": 5, - "optional": true - }, - { - "name": "shadowedRange", - "type": 28, - "optional": false - }, - { - "name": "shadowedSeqs", - "type": 29, - "optional": false - }, - { - "name": "shadowedTokenCount", "type": 4, "optional": false }, { - "name": "sourceCommandId", - "type": 2, - "optional": true - }, - { - "name": "summary", - "type": 5, - "optional": false - }, - { - "name": "usage", - "type": 30, + "name": "replayState", + "type": 27, "optional": true } ], "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + } + ] + }, + "names": [ + "packages/llm/llm/src/message.ts#AssistantMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:152" + ] + }, + { + "digest": "fe792a6cd430494503837e21e79f91677704ccdd9e870c679aabd7d43ed47ddd", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "literal", + "value": "tool-workflow/run-end" } ] }, @@ -61089,7 +58197,7 @@ "packages/llm/llm/src/types.ts#TokenUsage" ], "sources": [ - "packages/llm/llm/src/types.ts:162" + "packages/llm/llm/src/types.ts:153" ] }, { @@ -61105,6 +58213,1161 @@ }, "names": [], "sources": [] + }, + { + "digest": "ff5bcfe90a83f6e773ae72b3ec775c5af8339df8a1dbe561e8147b56bc994fdc", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "array", + "element": 1 + }, + { + "kind": "union", + "types": [ + 2, + 29, + 48, + 53 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "isError", + "type": 26, + "optional": true + }, + { + "name": "role", + "type": 27, + "optional": false + }, + { + "name": "source", + "type": 28, + "optional": false + }, + { + "name": "toolCallId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 4 + }, + { + "kind": "union", + "types": [ + 5, + 8, + 19, + 22, + 24 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 6, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 9, + "optional": false + }, + { + "name": "offloaded", + "type": 17, + "optional": true + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "mediaType", + "type": 11, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": true + }, + { + "name": "originalDimensions", + "type": 16, + "optional": true + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 12, + 13, + 14, + 15 + ] + }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, + { + "kind": "literal", + "value": "image/gif" + }, + { + "kind": "literal", + "value": "image/jpeg" + }, + { + "kind": "object", + "properties": [ + { + "name": "height", + "type": 10, + "optional": false + }, + { + "name": "width", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 21, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 6, + "optional": false + }, + { + "name": "bytes", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 23, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 6, + "optional": false + }, + { + "name": "type", + "type": 25, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 6, + "optional": false + }, + { + "name": "kind", + "type": 27, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 30, + "optional": false + }, + { + "name": "source", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system" + }, + { + "kind": "union", + "types": [ + 32, + 37, + 39, + 41, + 43, + 45, + 47 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "sections", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "plugin" + }, + { + "kind": "array", + "element": 36 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 6, + "optional": false + }, + { + "name": "text", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "plugin", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 49, + "optional": false + }, + { + "name": "source", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "model", + "type": 6, + "optional": false + }, + { + "name": "provider", + "type": 6, + "optional": false + }, + { + "name": "replayState", + "type": 52, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 3, + "optional": false + }, + { + "name": "id", + "type": 6, + "optional": false + }, + { + "name": "role", + "type": 54, + "optional": false + }, + { + "name": "source", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 28, + 32, + 37, + 39, + 41, + 43, + 45, + 47, + 50, + 56, + 64, + 65, + 67, + 71, + 73, + 80, + 82, + 84, + 86, + 88 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 17, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 6, + "optional": true + }, + { + "name": "changes", + "type": 57, + "optional": false + }, + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 58 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 59, + "optional": false + }, + { + "name": "digest", + "type": 6, + "optional": true + }, + { + "name": "path", + "type": 6, + "optional": false + }, + { + "name": "scope", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 60, + 61, + 62 + ] + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 6, + "optional": true + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "rpcId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 6, + "optional": false + }, + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 66, + "optional": false + }, + { + "name": "provider", + "type": 6, + "optional": false + }, + { + "name": "ruleId", + "type": 6, + "optional": false + }, + { + "name": "source", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 68, + "optional": false + }, + { + "name": "form", + "type": 46, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "update", + "type": 17, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 69 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 6, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 40, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "name", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 42, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "references", + "type": 75, + "optional": false + }, + { + "name": "version", + "type": 79, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 76 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 10, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 77, + "optional": false + }, + { + "name": "compacted", + "type": 26, + "optional": false + }, + { + "name": "inputIndex", + "type": 10, + "optional": false + }, + { + "name": "label", + "type": 6, + "optional": false + }, + { + "name": "omittedBytes", + "type": 10, + "optional": false + }, + { + "name": "omittedMessages", + "type": 10, + "optional": false + }, + { + "name": "originalMessages", + "type": 10, + "optional": false + }, + { + "name": "retainedMessages", + "type": 10, + "optional": false + }, + { + "name": "sessionId", + "type": 6, + "optional": false + }, + { + "name": "truncated", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 10, + 78 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 38, + "optional": false + }, + { + "name": "kind", + "type": 81, + "optional": false + }, + { + "name": "senderSessionId", + "type": 6, + "optional": false + }, + { + "name": "summary", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 44, + "optional": false + }, + { + "name": "kind", + "type": 83, + "optional": false + }, + { + "name": "senderSessionId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 6, + "optional": false + }, + { + "name": "kind", + "type": 85, + "optional": false + }, + { + "name": "revision", + "type": 10, + "optional": false + }, + { + "name": "round", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 87, + "optional": false + }, + { + "name": "messageId", + "type": 6, + "optional": false + }, + { + "name": "senderId", + "type": 6, + "optional": false + }, + { + "name": "senderName", + "type": 6, + "optional": false + }, + { + "name": "teamId", + "type": 6, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "team-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + } + ] + }, + "names": [], + "sources": [] } ] } diff --git a/docs/subsystems/llm-streaming.i18n.yaml b/docs/subsystems/llm-streaming.i18n.yaml index 9741b0084c..e5d61a2fd3 100644 --- a/docs/subsystems/llm-streaming.i18n.yaml +++ b/docs/subsystems/llm-streaming.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/llm-streaming.md -llm-streaming.md: 30dd26042b4894b294a67918006d9b607eadc6b2 -llm-streaming.zh.md: 6e5f1ff268e0c22a37c64a8f954c134bf71b3b73 +llm-streaming.md: a5a42ef50dccebbc40b0c35e0dd4e76f7a8f764b +llm-streaming.zh.md: 653a216de81fd2a11f45d8bbcb04231f7dd3f7fb diff --git a/docs/subsystems/llm-streaming.md b/docs/subsystems/llm-streaming.md index 30dd26042b..a5a42ef50d 100644 --- a/docs/subsystems/llm-streaming.md +++ b/docs/subsystems/llm-streaming.md @@ -25,11 +25,10 @@ interface ContentBlockMap { 'image': ImageBlock 'file': FileBlock 'tool-call': ToolCallBlock - 'tool-result': ToolResultBlock } ``` -The block interfaces (full fields in source): `TextBlock` (`text`), `ReasoningBlock` (thinking, distinct from visible text), `ImageBlock` (a durable [image attachment](attachment.md)), `FileBlock` (a durable verbatim [file attachment](attachment.md) that request assembly projects to handle text for every route), `ToolCallBlock` (`id: ToolCallId`, `name`, raw-JSON `arguments`), and `ToolResultBlock` (`toolCallId`, nested `content: ContentBlock[]`, `isError?`). `ContentBlock = ContentBlockMap[ContentBlockType]`. A new modality belongs in the merge-extensible map only when its adapter, UI, compaction, and durable replay paths honor it. +The block interfaces (full fields in source): `TextBlock` (`text`), `ReasoningBlock` (thinking, distinct from visible text), `ImageBlock` (a durable [image attachment](attachment.md)), `FileBlock` (a durable verbatim [file attachment](attachment.md) that request assembly projects to handle text for every route), and `ToolCallBlock` (`id: ToolCallId`, `name`, raw-JSON `arguments`). Tool results are first-class `ToolResultMessage` values with `toolCallId`, result `content`, and optional `isError`; they are not content blocks. `ContentBlock = ContentBlockMap[ContentBlockType]`. A new modality belongs in the merge-extensible map only when its adapter, UI, compaction, and durable replay paths honor it. Image access belongs to request serialization rather than the durable attachment or deterministic request-image version. `resolveImageAttachmentAccess()` combines the attachment provider's optional host object path with a mapping supplied by the consumer for the current tool execution filesystem. The result is available only for that request and does not participate in `variantId`. @@ -64,17 +63,8 @@ interface AssistantProviderMetadata { ``` ```ts type-equiv -/** One immutable message representation shared by delivery, durable history, and model requests. */ -interface Message { - /** Stable identity preserved across every representation boundary. */ - readonly id: MessageId - /** Provider-neutral conversation role. */ - readonly role: 'system' | 'user' | 'assistant' - /** Exact model-facing blocks. */ - readonly content: ContentBlock[] - /** Required source fields supplied by the producer. */ - readonly source: MessageSource -} +/** Any persisted conversation message, discriminated by its `role`. */ +type Message = MessageRoleMap[keyof MessageRoleMap] ``` Where a message came from is itself a merge-extensible sum type: @@ -415,10 +405,10 @@ declare class BlockAssembler { get replayState(): ReplayEnvelope | undefined; /** * The assembled assistant message. - * @param source - producer attribution for the assembled message. + * @param source - provider/model attribution (without the `kind` tag) for the assembled message. * @returns a frozen assistant-role message over `blocks()` (same open-block assembly rules). */ - message(source: MessageSource = { kind: 'plugin', plugin: 'dsh-llm/assembler' }): Message; + message(source: Omit): AssistantMessage; } ``` diff --git a/docs/subsystems/llm-streaming.zh.md b/docs/subsystems/llm-streaming.zh.md index 6e5f1ff268..653a216de8 100644 --- a/docs/subsystems/llm-streaming.zh.md +++ b/docs/subsystems/llm-streaming.zh.md @@ -25,11 +25,10 @@ interface ContentBlockMap { 'image': ImageBlock 'file': FileBlock 'tool-call': ToolCallBlock - 'tool-result': ToolResultBlock } ``` -各块接口(完整字段见源码):`TextBlock`(`text`)、`ReasoningBlock`(thinking,区别于可见文本)、`ImageBlock`(一个持久的[图片附件](attachment.zh.md))、`FileBlock`(一个持久的原样[文件附件](attachment.zh.md),请求组装对每条路由都把它投影为 handle 文本)、`ToolCallBlock`(`id: ToolCallId`、`name`、原始 JSON `arguments`),以及 `ToolResultBlock`(`toolCallId`、嵌套 `content: ContentBlock[]`、`isError?`)。`ContentBlock = ContentBlockMap[ContentBlockType]`。仅当适配器、UI、压缩(compaction)和持久回放路径均支持某种新模态时,才将其纳入可合并扩展的 map。 +各块接口(完整字段见源码):`TextBlock`(`text`)、`ReasoningBlock`(thinking,区别于可见文本)、`ImageBlock`(一个持久的[图片附件](attachment.zh.md))、`FileBlock`(一个持久的原样[文件附件](attachment.zh.md),请求组装对每条路由都把它投影为 handle 文本)和 `ToolCallBlock`(`id: ToolCallId`、`name`、原始 JSON `arguments`)。工具结果是一等 `ToolResultMessage`,含有 `toolCallId`、结果 `content` 与可选的 `isError`;它不是内容块。`ContentBlock = ContentBlockMap[ContentBlockType]`。仅当适配器、UI、压缩(compaction)和持久回放路径均支持某种新模态时,才将其纳入可合并扩展的 map。 图片访问方式属于请求序列化,不属于持久附件或确定性请求图片版本。`resolveImageAttachmentAccess()` 把附件提供方可选的宿主对象路径,与消费方为当前工具执行文件系统提供的映射组合起来。结果只适用于本次请求,不参与 `variantId`。 @@ -64,17 +63,8 @@ interface AssistantProviderMetadata { ``` ```ts type-equiv -/** One immutable message representation shared by delivery, durable history, and model requests. */ -interface Message { - /** Stable identity preserved across every representation boundary. */ - readonly id: MessageId - /** Provider-neutral conversation role. */ - readonly role: 'system' | 'user' | 'assistant' - /** Exact model-facing blocks. */ - readonly content: ContentBlock[] - /** Required source fields supplied by the producer. */ - readonly source: MessageSource -} +/** Any persisted conversation message, discriminated by its `role`. */ +type Message = MessageRoleMap[keyof MessageRoleMap] ``` 消息来源本身也是一个可合并扩展的和类型: @@ -421,10 +411,10 @@ declare class BlockAssembler { get replayState(): ReplayEnvelope | undefined; /** * The assembled assistant message. - * @param source - producer attribution for the assembled message. + * @param source - provider/model attribution (without the `kind` tag) for the assembled message. * @returns a frozen assistant-role message over `blocks()` (same open-block assembly rules). */ - message(source: MessageSource = { kind: 'plugin', plugin: 'dsh-llm/assembler' }): Message; + message(source: Omit): AssistantMessage; } ``` diff --git a/docs/subsystems/session-telemetry.i18n.yaml b/docs/subsystems/session-telemetry.i18n.yaml index 65534571f3..c8b935f67b 100644 --- a/docs/subsystems/session-telemetry.i18n.yaml +++ b/docs/subsystems/session-telemetry.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/session-telemetry.md -session-telemetry.md: a76eee81ef018cbd2c230debc6e2105e6e727c43 -session-telemetry.zh.md: 90b09f4a2394822c9b738430f5c8e0e54cbce508 +session-telemetry.md: 18fe935e5e02b7fb26bb9120b031a4685ca603aa +session-telemetry.zh.md: 1b3807d2e38bea141953faba990a6fee460b40b9 diff --git a/docs/subsystems/session-telemetry.md b/docs/subsystems/session-telemetry.md index a76eee81ef..18fe935e5e 100644 --- a/docs/subsystems/session-telemetry.md +++ b/docs/subsystems/session-telemetry.md @@ -12,7 +12,7 @@ Source: [`packages/session/session-telemetry/src/index.ts`](../../packages/sessi /** * Severity of a telemetry record, pre-mapped at capture so a receiver can * alert with zero configuration: `error` for events whose own outcome flag - * says so (the tool-result block's `isError`, `turn/end` error reasons) and for + * says so (the tool message's `isError`, `turn/end` error reasons) and for * `agent-error` operational records. Captured events otherwise default to * `info`; `warn` remains available to `session-telemetry/record` policies and * backends. diff --git a/docs/subsystems/session-telemetry.zh.md b/docs/subsystems/session-telemetry.zh.md index 90b09f4a23..1b3807d2e3 100644 --- a/docs/subsystems/session-telemetry.zh.md +++ b/docs/subsystems/session-telemetry.zh.md @@ -12,7 +12,7 @@ /** * Severity of a telemetry record, pre-mapped at capture so a receiver can * alert with zero configuration: `error` for events whose own outcome flag - * says so (the tool-result block's `isError`, `turn/end` error reasons) and for + * says so (the tool message's `isError`, `turn/end` error reasons) and for * `agent-error` operational records. Captured events otherwise default to * `info`; `warn` remains available to `session-telemetry/record` policies and * backends. diff --git a/docs/subsystems/session.i18n.yaml b/docs/subsystems/session.i18n.yaml index 3209f75aea..1137501723 100644 --- a/docs/subsystems/session.i18n.yaml +++ b/docs/subsystems/session.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/session.md -session.md: a527939295954e0fa1c77dd28a0c6a27bdefc611 -session.zh.md: 411914fe7ea4aa9c08cf60471b4074dadb171bbe +session.md: 15bc46fb20820ecdb1b2263027e5daf061ca5664 +session.zh.md: 063d018cc249fa7a631a360d26f95556a0ba286c diff --git a/docs/subsystems/session.md b/docs/subsystems/session.md index a527939295..15bc46fb20 100644 --- a/docs/subsystems/session.md +++ b/docs/subsystems/session.md @@ -11,8 +11,8 @@ Source: [`packages/core/session/src/types.ts`](../../packages/core/session/src/t The append-only event types. Merge-extensible: a plugin declares extra event types via declaration merging — e.g. the [compaction seam](compaction.md) adds `compaction/start` / `compaction/summary` / `compaction/end`, and `@deepseek-ai/dsh-hook-protocol` adds log-only `hook/invoked` / `hook/result` records for a hook bridge. Like `compaction/*`, these are NOT `SurfaceEventType`s (no `surfaceOp`). The generated [persistence log event catalog](../persistence-catalog.md) enumerates every member — core and merged — with its payload, surface badge, and declaration site. ```ts type-equiv -/** A user-role specialization of the one shared message representation. */ -interface UserMessage extends Message { +/** A user-role specialization of the shared message representation. */ +interface UserMessage extends MessageBase { readonly role: 'user' } ``` @@ -116,7 +116,7 @@ interface SessionEventMap { message: ToolResultMessage /** * Optional failure identity and raw user-facing reason, outside model content; - * allowed only when the tool-result block has `isError: true`. + * allowed only when the message has `isError: true`. */ error?: { name: string; code: string; reason?: string } meta?: JsonValue @@ -279,7 +279,7 @@ type SessionEvent = { `SessionEventType = keyof SessionEventMap`. Because `SessionEventMap` is merge-extensible, switches over `SessionEvent` must NOT use `assertNever` — a plugin-added variant is a valid unknown value; handle the known cases and fall through `default`. -Every surface event requires `surfaceOp`; known log-only events forbid both surface metadata fields. Native unknown or obsolete ignorable envelopes remain opaque. `assistant/message` embeds its provider stream and forbids `sourceEventSeqs`. System, user, and tool surface events may cite a complete non-empty set of unique earlier events when source attribution or replacement coverage requires it. A `tool/result` may carry `data.error` only when its tool-result block has `isError: true`; failure identity remains optional for failed results. +Every surface event requires `surfaceOp`; known log-only events forbid both surface metadata fields. Native unknown or obsolete ignorable envelopes remain opaque. `assistant/message` embeds its provider stream and forbids `sourceEventSeqs`. System, user, and tool surface events may cite a complete non-empty set of unique earlier events when source attribution or replacement coverage requires it. A `tool/result` may carry `data.error` only when its message has `isError: true`; failure identity remains optional for failed results. ## Surface types @@ -650,7 +650,7 @@ declare class Session { - `user/message` → a user message carrying exact `content`; an optional envelope remains log-only display metadata. - `assistant/message` → an assistant message with the provider and model that produced it plus optional adapter-private replay state. Its embedded compact stream is replay, usage, and UI evidence rather than a second message. An **empty-content** `assistant/message` is also skipped — a max-tokens step cut off with no content still records an `assistant/message` to hold its stream, usage, provider, and model, but a content-less assistant turn must not enter the provider transcript. -- `tool/result` → a user message carrying a `tool-result` block. +- `tool/result` → a first-class tool-role message carrying its result content and tool-call identity. - `user/message` (injected context, i.e. non-`user` source) → a user-role message carrying its `content` verbatim at its chronological position; its typed source names the producer and carries any producer-specific data. Everything else (`turn/*`, `step/*`, `assistant/attempt`, plugin-owned `llm/retry`) is structural and does not project into a message. Token accounting expands the embedded stream on each `assistant/message` or `assistant/attempt`, while the message's top-level `usage` remains the committed-message authority when present. A failed model-request attempt therefore retains its provider usage without fabricating an assistant message. Current logical validation rejects request headers and assistant messages that omit provider/model instead of guessing a route; supported historical representations are normalized and validated by their adjacent format edge before a current Session exists. diff --git a/docs/subsystems/session.zh.md b/docs/subsystems/session.zh.md index 411914fe7e..063d018cc2 100644 --- a/docs/subsystems/session.zh.md +++ b/docs/subsystems/session.zh.md @@ -11,8 +11,8 @@ 仅追加的事件类型。可通过声明合并扩展:插件通过 declaration merging 声明额外的事件类型。例如[压缩(compaction) seam](compaction.zh.md) 添加了 `compaction/start` / `compaction/summary` / `compaction/end`,`@deepseek-ai/dsh-hook-protocol` 为钩子桥接添加了仅记录日志的 `hook/invoked` / `hook/result` 记录。与 `compaction/*` 一样,这些都不是 `SurfaceEventType`(没有 `surfaceOp`)。生成的[持久化日志事件目录](../persistence-catalog.zh.md)列举了所有成员(核心与合并扩展的),包含其 payload、surface 标记与声明位置。 ```ts type-equiv -/** A user-role specialization of the one shared message representation. */ -interface UserMessage extends Message { +/** A user-role specialization of the shared message representation. */ +interface UserMessage extends MessageBase { readonly role: 'user' } ``` @@ -116,7 +116,7 @@ interface SessionEventMap { message: ToolResultMessage /** * Optional failure identity and raw user-facing reason, outside model content; - * allowed only when the tool-result block has `isError: true`. + * allowed only when the message has `isError: true`. */ error?: { name: string; code: string; reason?: string } meta?: JsonValue @@ -279,7 +279,7 @@ type SessionEvent = { `SessionEventType = keyof SessionEventMap`。由于 `SessionEventMap` 可通过合并扩展,对 `SessionEvent` 的 switch 语句禁止使用 `assertNever`:插件添加的变体是合法的未知值;处理已知 case 后在 `default` 中放行。 -每个 surface 事件都要求 `surfaceOp`;已知仅日志事件禁止两个 surface 元数据字段。原生未知或已退役的可忽略信封保持不透明。`assistant/message` 嵌入其提供方 stream,并禁止 `sourceEventSeqs`。System、user 与 tool surface 事件可以在来源归属或替换覆盖需要时引用完整、非空且唯一的较早事件集合。`tool/result` 仅在工具结果块带有 `isError: true` 时可以携带 `data.error`;失败结果的失败身份仍可省略。 +每个 surface 事件都要求 `surfaceOp`;已知仅日志事件禁止两个 surface 元数据字段。原生未知或已退役的可忽略信封保持不透明。`assistant/message` 嵌入其提供方 stream,并禁止 `sourceEventSeqs`。System、user 与 tool surface 事件可以在来源归属或替换覆盖需要时引用完整、非空且唯一的较早事件集合。`tool/result` 仅在消息带有 `isError: true` 时可以携带 `data.error`;失败结果的失败身份仍可省略。 @@ -652,7 +652,7 @@ declare class Session { - `user/message` → 一条携带确切 `content` 的 user 消息;可选 envelope 仅作为日志中的展示元数据保留。 - `assistant/message` → 一条 assistant 消息,包含生成它的提供方和模型,以及可选的适配器私有回放状态。其嵌入式紧凑 stream 是回放、usage 与 UI 证据,而不是第二条 message。**内容为空的** `assistant/message` 也会跳过:因 max-tokens 而截断且无内容的步骤仍会记录一条 `assistant/message` 来保存 stream、usage、提供方和模型,但无内容的 assistant 轮次不得进入提供方 transcript(文本记录)。 -- `tool/result` → 一条携带 `tool-result` 块的 user 消息。 +- `tool/result` → 一条一等 tool-role 消息,携带结果内容与工具调用标识。 - `user/message`(注入上下文,即非 `user` 来源)→ 按时间顺序在相应位置生成一条 user-role 消息,并原样承载其 `content`;其类型化 source 标明生产方,并携带所有生产方专用数据。 其余所有事件(`turn/*`、`step/*`、`assistant/attempt`、插件所属的 `llm/retry`)均为结构信息,不会投影为消息。token 记账会展开每个 `assistant/message` 或 `assistant/attempt` 的嵌入式 stream,message 顶层 `usage` 存在时仍是已提交 message 的权威。失败的模型请求 attempt 因此可以保留提供方 usage,而无需虚构 assistant message。当前逻辑校验会拒绝没有提供方/模型的 request header 和 assistant 消息,而不会猜测路由;受支持的历史表示会在当前 Session 存在前,由其相邻格式迁移边归一化并校验。 diff --git a/docs/subsystems/subagent.i18n.yaml b/docs/subsystems/subagent.i18n.yaml index b4d2e147ae..034d835426 100644 --- a/docs/subsystems/subagent.i18n.yaml +++ b/docs/subsystems/subagent.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/subagent.md -subagent.md: 7a8bafdb5acbd51f19f42ab6906ccf99f1ee715b -subagent.zh.md: b43a9f9fcefcbef0841e2b01a84eb8e4d2846e9c +subagent.md: d642fe1658926b17cb29f280803f12e61228be60 +subagent.zh.md: ff153c7861b4ac46bb058efd00a2f5a50181b6f2 diff --git a/docs/subsystems/subagent.md b/docs/subsystems/subagent.md index 7a8bafdb5a..d642fe1658 100644 --- a/docs/subsystems/subagent.md +++ b/docs/subsystems/subagent.md @@ -302,7 +302,7 @@ interface SubagentResult { * are skipped. Without a non-empty message, the output is its accumulated * assistant text stream, or `[]` when the child produced neither. */ - readonly output: ContentBlock[] + readonly output: readonly ContentBlock[] /** * The structured result after a requested `outputSchema` was successfully * satisfied. Requesting a schema does not guarantee presence: a provider can diff --git a/docs/subsystems/subagent.zh.md b/docs/subsystems/subagent.zh.md index b43a9f9fce..ff153c7861 100644 --- a/docs/subsystems/subagent.zh.md +++ b/docs/subsystems/subagent.zh.md @@ -304,7 +304,7 @@ interface SubagentResult { * are skipped. Without a non-empty message, the output is its accumulated * assistant text stream, or `[]` when the child produced neither. */ - readonly output: ContentBlock[] + readonly output: readonly ContentBlock[] /** * The structured result after a requested `outputSchema` was successfully * satisfied. Requesting a schema does not guarantee presence: a provider can diff --git a/packages/acp/acp/src/updates.ts b/packages/acp/acp/src/updates.ts index 09687078f1..71ac4f0e42 100644 --- a/packages/acp/acp/src/updates.ts +++ b/packages/acp/acp/src/updates.ts @@ -70,16 +70,16 @@ export async function toolResultUpdate( ctx: Context, event: SessionEvent<'tool/result'>, ): Promise { - const result = event.data.message.content[0] + const message = event.data.message const content: ToolCallContent[] = [] - for (const block of result.content) { + for (const block of message.content) { const converted = await assistantBlockToAcp(ctx, block) if (converted !== undefined) content.push({ type: 'content' as const, content: converted }) } return { sessionUpdate: 'tool_call_update', - toolCallId: result.toolCallId, - status: result.isError === true ? 'failed' : 'completed', + toolCallId: message.toolCallId, + status: message.isError === true ? 'failed' : 'completed', content, } } diff --git a/packages/acp/acp/tests/bridge.spec.ts b/packages/acp/acp/tests/bridge.spec.ts index ad1fa30fac..cd9ede1641 100644 --- a/packages/acp/acp/tests/bridge.spec.ts +++ b/packages/acp/acp/tests/bridge.spec.ts @@ -304,7 +304,7 @@ describe('automation-only ACP bridge', () => { await harness.client.initialize({ protocolVersion: PROTOCOL_VERSION, clientCapabilities: {} }) const created = await harness.client.newSession({ cwd: process.cwd(), mcpServers: [] }) const agent = harness.ctx.agents.get(SessionId(created.sessionId))! - agent.session.append('session/title', { title: 'materialized', messageSeqs: [], source: { kind: 'fallback' } }) + agent.session.append('session/title', { title: 'materialized', messageSeqs: [], source: { kind: 'user' } }) await harness.client.closeSession({ sessionId: created.sessionId }) const resumed = await harness.client.resumeSession({ sessionId: created.sessionId, cwd: process.cwd() }) diff --git a/packages/acp/acp/tests/updates.spec.ts b/packages/acp/acp/tests/updates.spec.ts index 4260afc711..d031770ee1 100644 --- a/packages/acp/acp/tests/updates.spec.ts +++ b/packages/acp/acp/tests/updates.spec.ts @@ -73,14 +73,11 @@ describe('standard ACP update projection', () => { step: 1, message: { id: MessageId('tool-message'), - role: 'user', + role: 'tool', + toolCallId: ToolCallId('call-bad'), + isError: true, source: { kind: 'tool', callId: ToolCallId('call-bad') }, - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('call-bad'), - isError: true, - content: [{ type: 'reasoning', text: 'hidden' }], - }], + content: [{ type: 'reasoning', text: 'hidden' }], }, }, }) diff --git a/packages/api/session-controller/tests/session-cold.host.spec.ts b/packages/api/session-controller/tests/session-cold.host.spec.ts index c89ae1f97a..c8be6f2252 100644 --- a/packages/api/session-controller/tests/session-cold.host.spec.ts +++ b/packages/api/session-controller/tests/session-cold.host.spec.ts @@ -282,12 +282,12 @@ describe('Remote Agent and Session lookup policy', () => { content: [{ type: 'text', text: 'survives restart' }], source: { kind: 'user' }, }) - const events = [{ + const events: SessionEvent[] = [{ type: 'agent/inbox/spliced', - seq: 0, + seq: SessionSeq(0), time: 1001, data: { target: 'next-turn', start: 0, inserted: [message] }, - }] as SessionEvent[] + }] providePersistence(ctx, { list: () => Promise.resolve([meta]), inspect: () => Promise.resolve({ meta, events }), diff --git a/packages/api/session-controller/tests/transport.client.spec.ts b/packages/api/session-controller/tests/transport.client.spec.ts index 5038601759..ece1a9ff99 100644 --- a/packages/api/session-controller/tests/transport.client.spec.ts +++ b/packages/api/session-controller/tests/transport.client.spec.ts @@ -194,7 +194,7 @@ const invalidWireEvents: [string, unknown][] = [ ...[false, undefined].map((isError): [string, unknown] => [ `contradictory tool error ${String(isError)}`, { ...surfaceEvent('tool/result'), data: { - message: { content: [{ type: 'tool-result', content: [], ...(isError === undefined ? {} : { isError }) }] }, + message: { role: 'tool', content: [], ...(isError === undefined ? {} : { isError }) }, error: { name: 'Error', code: 'FAILURE' }, } }, ]), @@ -242,11 +242,11 @@ describe('Session Client stream adapters', () => { { ...surfaceEvent(), surfaceOp: { op: 'replace', startSeq: 2, endSeq: 0 }, sourceEventSeqs: [2, 0] }, { ...surfaceEvent('assistant/message'), data: { turn: 1, step: 1, message: {}, stream: [] } }, { ...surfaceEvent('tool/result'), data: { - message: { content: [{ type: 'tool-result', content: [], isError: true }] }, + message: { role: 'tool', content: [], isError: true }, error: { name: 'Error', code: 'FAILURE' }, meta: { extension: ['retained'] }, } }, { ...surfaceEvent('tool/result'), sourceEventSeqs: [0], data: { - message: { content: [{ type: 'tool-result', content: [], isError: true }] }, + message: { role: 'tool', content: [], isError: true }, } }, { type: 'request/header', seq: 10, time: 10, data: { reason: 'initial', header: { config: { provider: 'mock', model: 'mock' } }, diff --git a/packages/bundle/headless/src/json-stream.ts b/packages/bundle/headless/src/json-stream.ts index f02583f2ad..2fa8cbc449 100644 --- a/packages/bundle/headless/src/json-stream.ts +++ b/packages/bundle/headless/src/json-stream.ts @@ -301,12 +301,12 @@ export function projectJsonRun( // Compaction replaces older results in the surface; those are history, // not this run's output, and would otherwise duplicate a callId. if (event.surfaceOp !== 'append') return - const block = event.data.message.content[0] + const message = event.data.message write({ type: 'tool_result', - callId: block.toolCallId, - status: block.isError === true ? 'error' : 'completed', - result: resultText(block.content), + callId: message.toolCallId, + status: message.isError === true ? 'error' : 'completed', + result: resultText(message.content), }) return } diff --git a/packages/bundle/headless/tests/headless.spec.ts b/packages/bundle/headless/tests/headless.spec.ts index 96f646d264..4a92ad0991 100644 --- a/packages/bundle/headless/tests/headless.spec.ts +++ b/packages/bundle/headless/tests/headless.spec.ts @@ -13,7 +13,7 @@ import type { ResumeAgentOptions, } from '@deepseek-ai/dsh-agent' import AgentDefaultModelConfig from '@deepseek-ai/dsh-agent-default-model' -import { LlmAttemptId, ToolCallId, createAssistantMessage, createToolResultMessage, type StreamChunk } from '@deepseek-ai/dsh-llm' +import { LlmAttemptId, ToolCallId, createAssistantMessage, createToolResultMessage, type MessageId, type StreamChunk } from '@deepseek-ai/dsh-llm' import SessionStore from '@deepseek-ai/dsh-session' import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection' import type { Session, SessionId, UserMessage } from '@deepseek-ai/dsh-session' @@ -263,8 +263,8 @@ describe('headless runner', () => { const test = await bench({ before(session) { const setupMessage = { - role: 'user', content: [{ type: 'text', text: 'setup' }], source: { kind: 'user' }, id: 'setup', - } as UserMessage + role: 'user', content: [{ type: 'text', text: 'setup' }], source: { kind: 'user' }, id: brandString('setup'), + } satisfies UserMessage appendTurn(session, 0, setupMessage, 'pre-task noise', true) }, async afterPrompt(session, message) { @@ -607,8 +607,8 @@ describe('headless runner', () => { }) const session = test.ctx.sessions.create(brandString('session-exact'), { meta: { cwd: process.cwd() } }) const history = { - role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: 'history', - } as UserMessage + role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: brandString('history'), + } satisfies UserMessage appendTurn(session, 0, history, 'earlier answer', true) const before = session.seq expect(await test.run()).toMatchObject({ code: 0, out: 'resumed answer\n', err: '' }) @@ -789,8 +789,8 @@ describe('headless runner', () => { const test = await bench({ before(session) { const history = { - role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: 'history', - } as UserMessage + role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: brandString('history'), + } satisfies UserMessage appendTurn(session, 0, history, 'earlier answer', true) selectPreset(session, 'minimal') }, @@ -845,8 +845,8 @@ describe('headless runner', () => { const test = await bench({ before(session) { const history = { - role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: 'history', - } as UserMessage + role: 'user', content: [{ type: 'text', text: 'earlier' }], source: { kind: 'user' }, id: brandString('history'), + } satisfies UserMessage appendTurn(session, 0, history, 'earlier answer', true) capturedLength = session.seq Object.defineProperty(session, 'eventAt', { value: () => undefined }) diff --git a/packages/bundle/headless/tests/json-stream.spec.ts b/packages/bundle/headless/tests/json-stream.spec.ts index a9332ee894..3e49a70dd5 100644 --- a/packages/bundle/headless/tests/json-stream.spec.ts +++ b/packages/bundle/headless/tests/json-stream.spec.ts @@ -59,7 +59,7 @@ function toolResult( data: { turn: 1, step: 1, - message: { content: [{ type: 'tool-result', toolCallId: callId, content, isError: false }] }, + message: { role: 'tool', toolCallId: callId, isError: false, content }, }, } as unknown as SessionEvent } @@ -169,12 +169,10 @@ describe('--json projection', () => { turn: 1, step: 1, message: { - content: [{ - type: 'tool-result', - toolCallId: 'c2', - content: [{ type: 'image' }, { type: 'text' }, { type: 'text', text: 'boom' }], - isError: true, - }], + role: 'tool', + toolCallId: 'c2', + isError: true, + content: [{ type: 'image' }, { type: 'text' }, { type: 'text', text: 'boom' }], }, }, } as unknown as SessionEvent) diff --git a/packages/client/ui-chat/src/client/conversation-nodes/tool.ts b/packages/client/ui-chat/src/client/conversation-nodes/tool.ts index f6653b92bd..2e914e5072 100644 --- a/packages/client/ui-chat/src/client/conversation-nodes/tool.ts +++ b/packages/client/ui-chat/src/client/conversation-nodes/tool.ts @@ -51,16 +51,16 @@ function rootCall(match: ConversationMatch): RunningToolCall { function rootResult(match: ConversationMatch, previous?: RunningToolCall): ToolResultNode | undefined { if (match.event.type !== 'tool/result') return undefined - const result = match.event.data.message.content[0] + const message = match.event.data.message return { kind: 'tool-result', seq: match.event.seq, time: match.event.time, - callId: String(match.event.data.message.source.callId), + callId: String(message.source.callId), call: previous === undefined ? null : { name: previous.name, argsRaw: previous.argsRaw }, callTime: previous?.time ?? null, - content: result.content, - isError: result.isError === true, + content: message.content, + isError: message.isError === true, ...match.event.data.error === undefined ? {} : { error: match.event.data.error }, meta: match.event.data.meta, subCalls: [], diff --git a/packages/client/ui-chat/tests/conversation-node-definitions.client.spec.ts b/packages/client/ui-chat/tests/conversation-node-definitions.client.spec.ts index f393a952bf..f5fc5c0d88 100644 --- a/packages/client/ui-chat/tests/conversation-node-definitions.client.spec.ts +++ b/packages/client/ui-chat/tests/conversation-node-definitions.client.spec.ts @@ -208,14 +208,11 @@ function assistantMessage(id: string, text: string) { function toolResult(callId: string, text: string, isError = false) { return { id: `result-${callId}`, - role: 'user', + role: 'tool', + toolCallId: callId, source: { kind: 'tool', callId }, - content: [{ - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text }], - isError, - }], + content: [{ type: 'text', text }], + isError, } } diff --git a/packages/client/ui-conversation/tests/system-prompt.client.spec.ts b/packages/client/ui-conversation/tests/system-prompt.client.spec.ts index 4604de6f4b..4411cfb9c7 100644 --- a/packages/client/ui-conversation/tests/system-prompt.client.spec.ts +++ b/packages/client/ui-conversation/tests/system-prompt.client.spec.ts @@ -7,7 +7,7 @@ function system(seq: number, text: string, replaces?: number): SessionEvent { seq, time: seq, type: 'system/message', data: { turn: 1, step: seq, message: { role: 'system', content: [{ type: 'text', text }] } }, surfaceOp: replaces === undefined ? 'append' : { op: 'replace', startSeq: replaces, endSeq: replaces }, - } as SessionEvent + } as unknown as SessionEvent } function replace(seq: number, start: number, end: number): SessionEvent { diff --git a/packages/client/ui-deliverables/src/client/turn-deliverables.ts b/packages/client/ui-deliverables/src/client/turn-deliverables.ts index 87d13e5e41..7eb765ec2b 100644 --- a/packages/client/ui-deliverables/src/client/turn-deliverables.ts +++ b/packages/client/ui-deliverables/src/client/turn-deliverables.ts @@ -200,8 +200,7 @@ export const deliverablesDefinition: ConversationNodeDefinition ({ ...block })), - isError: node.isError, - }], + toolCallId: node.callId, + content: node.content.map(block => ({ ...block })), + isError: node.isError, }, ...(node.error === undefined ? {} : { error: node.error }), ...(node.meta === undefined ? {} : { meta: node.meta }), diff --git a/packages/client/ui-trajectory/src/client/trajectory-tool-definition.ts b/packages/client/ui-trajectory/src/client/trajectory-tool-definition.ts index 684688e86c..3d3c5d608a 100644 --- a/packages/client/ui-trajectory/src/client/trajectory-tool-definition.ts +++ b/packages/client/ui-trajectory/src/client/trajectory-tool-definition.ts @@ -48,16 +48,16 @@ function rootResult( previous?: RunningToolCall, ): ToolResultNode | undefined { if (match.event.type !== 'tool/result') return undefined - const result = match.event.data.message.content[0] + const message = match.event.data.message return { kind: 'tool-result', seq: match.event.seq, time: match.event.time, - callId: String(match.event.data.message.source.callId), + callId: String(message.source.callId), call: previous === undefined ? null : { name: previous.name, argsRaw: previous.argsRaw }, callTime: previous?.time ?? null, - content: result.content, - isError: result.isError === true, + content: message.content, + isError: message.isError === true, ...(match.event.data.error === undefined ? {} : { error: match.event.data.error }), meta: match.event.data.meta, subCalls: [], diff --git a/packages/client/ui-trajectory/tests/conversation-definitions.client.spec.ts b/packages/client/ui-trajectory/tests/conversation-definitions.client.spec.ts index 0a4db8aeb9..f30c8048d8 100644 --- a/packages/client/ui-trajectory/tests/conversation-definitions.client.spec.ts +++ b/packages/client/ui-trajectory/tests/conversation-definitions.client.spec.ts @@ -456,14 +456,11 @@ describe('Trajectory conversation Definitions', () => { step: 1, message: { id: 'result-root-a', - role: 'user', + role: 'tool', + toolCallId: 'root-a', source: { kind: 'tool', callId: 'root-a' }, - content: [{ - type: 'tool-result', - toolCallId: 'root-a', - content: [{ type: 'text', text: 'root failed' }], - isError: true, - }], + content: [{ type: 'text', text: 'root failed' }], + isError: true, }, error: { name: 'ToolError', code: 'failed' }, meta: { presentation: 'raw' }, diff --git a/packages/compaction/compaction-basic/tests/compaction-basic.spec.ts b/packages/compaction/compaction-basic/tests/compaction-basic.spec.ts index bd6a48af66..90c6c21b01 100644 --- a/packages/compaction/compaction-basic/tests/compaction-basic.spec.ts +++ b/packages/compaction/compaction-basic/tests/compaction-basic.spec.ts @@ -89,14 +89,11 @@ function agent(session: Session, model?: string): Agent { } as Agent } -/** Flatten every text fragment the summarizer received, recursing tool-result blocks. */ +/** Flatten every text fragment the summarizer received across all messages. */ function summarizedText(input: SummarizationInput): string { - const collect = (blocks: readonly ContentBlock[]): string => - blocks.map(block => - block.type === 'text' ? block.text - : block.type === 'tool-result' ? collect(block.content) - : '').join('\n') - return input.messages.map(message => collect(message.content)).join('\n') + return input.messages.flatMap(message => message.content) + .map(block => block.type === 'text' ? block.text : '') + .join('\n') } /** A minimal replayed prefix carrying one user message of the given text. */ @@ -774,8 +771,8 @@ describe('pressure measurement and retention', () => { for (const message of messages) { for (const block of message.content) { if (block.type === 'tool-call') calls.add(block.id) - if (block.type === 'tool-result') expect(calls.has(block.toolCallId)).toBe(true) } + if (message.role === 'tool') expect(calls.has(message.toolCallId)).toBe(true) } }) @@ -890,7 +887,7 @@ describe('optional model-free tool-result pruning', () => { expect(await compactIfNeeded(compact, session)).not.toBeNull() expect(compact.calls).toHaveLength(1) const original = session.snapshotEvents().find(event => event.type === 'tool/result') - expect(original?.type === 'tool/result' && original.data.message.content[0].content[0]) + expect(original?.type === 'tool/result' && original.data.message.content[0]) .toEqual({ type: 'text', text: 'X'.repeat(3_000) }) expect(session.snapshotEvents().filter(event => event.type === 'tool/result' && event.surfaceOp !== 'append')).toHaveLength(0) @@ -1525,20 +1522,16 @@ describe('default one-shot summarizer', () => { .rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) }) - it('rejects image summary output nested in a tool result', async () => { + it('rejects image summary output', async () => { const { compact } = await summarizerHarness([{ - type: 'tool-result', - toolCallId: ToolCallId('summary-tool'), - content: [{ - type: 'image', - attachment: { - attachmentId: AttachmentId(`sha256:${'c'.repeat(64)}`), - mediaType: 'image/png', - bytes: 1, - width: 1, - height: 1, - }, - }], + type: 'image', + attachment: { + attachmentId: AttachmentId(`sha256:${'c'.repeat(64)}`), + mediaType: 'image/png', + bytes: 1, + width: 1, + height: 1, + }, }]) await expect(compact.runSummarize(promptInput('history'), agent(conversation(1), MODEL))) .rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) diff --git a/packages/compaction/compaction-image-offload/src/image-offload.ts b/packages/compaction/compaction-image-offload/src/image-offload.ts index 5c686ba4c8..cc8dbfeae0 100644 --- a/packages/compaction/compaction-image-offload/src/image-offload.ts +++ b/packages/compaction/compaction-image-offload/src/image-offload.ts @@ -34,8 +34,6 @@ export function offloadOldestImages(session: Session, sourceEventSeqs: readonly count -= 1 } imageIndex += 1 - } else if (block.type === 'tool-result') { - visit(block.content) } } } diff --git a/packages/compaction/compaction-image-offload/src/project-message.ts b/packages/compaction/compaction-image-offload/src/project-message.ts index 8d5754e2ee..17116ffbfe 100644 --- a/packages/compaction/compaction-image-offload/src/project-message.ts +++ b/packages/compaction/compaction-image-offload/src/project-message.ts @@ -24,9 +24,6 @@ export function offloadMessageImages(message: Message, indexes: readonly number[ selected += 1 } imageIndex += 1 - } else if (block.type === 'tool-result') { - const content = visit(block.content) - if (content !== block.content) projected = { ...block, content } } if (projected !== block) next ??= blocks.slice(0, index) next?.push(projected) diff --git a/packages/compaction/compaction-image-offload/tests/image-offload.spec.ts b/packages/compaction/compaction-image-offload/tests/image-offload.spec.ts index 59ecd36568..2123638197 100644 --- a/packages/compaction/compaction-image-offload/tests/image-offload.spec.ts +++ b/packages/compaction/compaction-image-offload/tests/image-offload.spec.ts @@ -87,13 +87,11 @@ function image(name: string): Extract { function offloadedNames(options: GenerateOptions): string[] { const names: string[] = [] - const visit = (blocks: readonly ContentBlock[]): void => { - for (const block of blocks) { + for (const message of options.messages) { + for (const block of message.content) { if (block.type === 'image' && block.offloaded === true) names.push(block.attachment.name ?? '') - if (block.type === 'tool-result') visit(block.content) } } - for (const message of options.messages) visit(message.content) return names } @@ -235,7 +233,7 @@ describe('compaction-image-offload', () => { }) agent.followup(createUserMessage({ - content: [image('a'), { type: 'tool-result', toolCallId: ToolCallId('shot'), content: [image('b')] }, image('c')], + content: [image('a'), image('b'), image('c')], source: { kind: 'user' }, })) await agent.whenIdle() @@ -297,32 +295,54 @@ describe('compaction-image-offload', () => { ]]) }) - it('offloads a nested tool-result occurrence and leaves later images untouched', async () => { + it('offloads a tool-result image and leaves later images untouched', async () => { const adapter = new ScriptedAdapter([offloadRequired(1), textResponse('sent')]) const ctx = await harness(adapter) const agent = await ctx.agentLoop.create(SessionId('offload-tool-result'), { provider: 'mock', model: 'mock' }) + const emptyCallId = ToolCallId('empty') const callId = ToolCallId('shot') + const innerCallId = ToolCallId('inner') agent.session.append('turn/start', { turn: 0 }) agent.session.append('assistant/message', { turn: 0, step: 1, message: createAssistantMessage({ - content: [{ type: 'tool-call', id: callId, name: 'read_image', arguments: '{}' }], + content: [ + { type: 'tool-call', id: emptyCallId, name: 'read_image', arguments: '{}' }, + { type: 'tool-call', id: callId, name: 'read_image', arguments: '{}' }, + { type: 'tool-call', id: innerCallId, name: 'read_image', arguments: '{}' }, + ], source: { provider: 'mock', model: 'mock' }, }), stream: [], }, { surfaceOp: 'append' }) + agent.session.append('tool/call', { turn: 0, step: 1, callId: emptyCallId, name: 'read_image', arguments: '{}' }) + agent.session.append('tool/result', { + turn: 0, + step: 1, + message: createToolResultMessage({ + callId: emptyCallId, + content: [{ type: 'text', text: 'no image' }], + isError: false, + }), + }, { surfaceOp: 'append' }) agent.session.append('tool/call', { turn: 0, step: 1, callId, name: 'read_image', arguments: '{}' }) const result = agent.session.append('tool/result', { turn: 0, step: 1, message: createToolResultMessage({ callId, - content: [ - { type: 'tool-result', toolCallId: ToolCallId('empty'), content: [{ type: 'text', text: 'no image' }] }, - image('first'), - { type: 'tool-result', toolCallId: ToolCallId('inner'), content: [image('second')] }, - ], + content: [image('first')], + isError: false, + }), + }, { surfaceOp: 'append' }) + agent.session.append('tool/call', { turn: 0, step: 1, callId: innerCallId, name: 'read_image', arguments: '{}' }) + agent.session.append('tool/result', { + turn: 0, + step: 1, + message: createToolResultMessage({ + callId: innerCallId, + content: [image('second')], isError: false, }), }, { surfaceOp: 'append' }) diff --git a/packages/compaction/compaction-image-offload/tests/projection.spec.ts b/packages/compaction/compaction-image-offload/tests/projection.spec.ts index 36d0ec00df..0c82575dab 100644 --- a/packages/compaction/compaction-image-offload/tests/projection.spec.ts +++ b/packages/compaction/compaction-image-offload/tests/projection.spec.ts @@ -21,13 +21,11 @@ function input(session: Session, content: ContentBlock[] = [image, image]) { function marked(session: Session): boolean[] { const result: boolean[] = [] - const visit = (content: readonly ContentBlock[]): void => { - for (const block of content) { + for (const message of session.deriveMessages()) { + for (const block of message.content) { if (block.type === 'image') result.push(block.offloaded === true) - if (block.type === 'tool-result') visit(block.content) } } - for (const message of session.deriveMessages()) visit(message.content) return result } @@ -36,8 +34,8 @@ describe('durable image selections', () => { const session = createSession(SessionId('images')) const source = input(session, [ { type: 'text', text: 'before' }, image, - { type: 'tool-result', toolCallId: ToolCallId('nested'), content: [image, { type: 'text', text: 'after' }] }, - { type: 'tool-result', toolCallId: ToolCallId('text'), content: [{ type: 'text', text: 'unchanged' }] }, + image, { type: 'text', text: 'after' }, + { type: 'text', text: 'unchanged' }, image, ]) const before = session.deriveMessages() diff --git a/packages/compaction/compaction-tool-result-pruner/src/index.ts b/packages/compaction/compaction-tool-result-pruner/src/index.ts index 333f560d75..5f536bfc9b 100644 --- a/packages/compaction/compaction-tool-result-pruner/src/index.ts +++ b/packages/compaction/compaction-tool-result-pruner/src/index.ts @@ -146,17 +146,13 @@ export class ToolResultPruner extends Service { let charsRemoved = 0 for (const { seq, event } of candidates) { const original = session.deriveEventMessage(event) as ToolResultMessage - const result = original.content[0] - const content = this.pruneContent(result.content) + const content = this.pruneContent(original.content) if (content === null) continue - const charsBefore = this.measureContent(result.content) + const charsBefore = this.measureContent(original.content) const charsAfter = this.measureContent(content) const message = freezeMessage({ ...original, - content: [{ - ...result, - content, - }] as [typeof result], + content, }) // Shadow-price protocol: the metering event and its replacement are // appended synchronously adjacent, so pure consumers subtract the diff --git a/packages/compaction/compaction-tool-result-pruner/tests/tool-result-pruner.spec.ts b/packages/compaction/compaction-tool-result-pruner/tests/tool-result-pruner.spec.ts index dc94a7c682..d7bbbae5c9 100644 --- a/packages/compaction/compaction-tool-result-pruner/tests/tool-result-pruner.spec.ts +++ b/packages/compaction/compaction-tool-result-pruner/tests/tool-result-pruner.spec.ts @@ -212,10 +212,7 @@ describe('ToolResultPruner session transaction', () => { type: 'tool/result', data: { message: { - content: [{ - type: 'tool-result', - content: [{ type: 'text', text: 'x'.repeat(100) }], - }], + content: [{ type: 'text', text: 'x'.repeat(100) }], }, }, }) @@ -227,7 +224,9 @@ describe('ToolResultPruner session transaction', () => { isError: true, message: { source: { kind: 'tool', callId: ToolCallId('one') }, - content: [{ type: 'tool-result', isError: true }], + role: 'tool', + toolCallId: ToolCallId('one'), + isError: true, }, error: { name: 'ExitError', code: 'EXIT_1' }, meta: { diff: ['a', 'b'] }, diff --git a/packages/context/agent-instructions/tests/agent-instructions.spec.ts b/packages/context/agent-instructions/tests/agent-instructions.spec.ts index e40b6f317b..af41ed006f 100644 --- a/packages/context/agent-instructions/tests/agent-instructions.spec.ts +++ b/packages/context/agent-instructions/tests/agent-instructions.spec.ts @@ -251,7 +251,7 @@ function stubToolExecution( } } -function blocksText(blocks: { type: string; text?: string }[] | undefined): string { +function blocksText(blocks: readonly { type: string; text?: string }[] | undefined): string { return blocks?.map(block => block.type === 'text' ? block.text ?? '' : '').join('\n') ?? '' } diff --git a/packages/core/agent-loop/tests/cancel.spec.ts b/packages/core/agent-loop/tests/cancel.spec.ts index 2b1781083c..872e983639 100644 --- a/packages/core/agent-loop/tests/cancel.spec.ts +++ b/packages/core/agent-loop/tests/cancel.spec.ts @@ -441,17 +441,17 @@ describe('Agent.cancel()', () => { expect(call?.type === 'tool/call' ? call.data.callId : undefined).toBe('c1') expect(result?.type === 'tool/result' ? result.data : undefined).toMatchObject({ message: { + role: 'tool', source: { kind: 'tool', callId: 'c1' }, - content: [{ type: 'tool-result', toolCallId: 'c1', isError: true }], + content: [{ type: 'text' }], + isError: true, }, error: { name: 'AbortError', code: TOOL_ABORTED_BEFORE_DISPATCH }, }) send(agent, 'continue safely') await waitForIdle(ctx, agent) - const replayedResult = adapter.requests[1]!.messages - .flatMap(message => message.content) - .find(block => block.type === 'tool-result') + const replayedResult = adapter.requests[1]!.messages.find(message => message.role === 'tool') expect(replayedResult).toMatchObject({ toolCallId: 'c1', isError: true }) expect(reasons).toEqual([ { kind: 'aborted', reason: { kind: 'user' } }, diff --git a/packages/core/agent-loop/tests/contract-regressions.spec.ts b/packages/core/agent-loop/tests/contract-regressions.spec.ts index 2bf253554f..5611a93a0c 100644 --- a/packages/core/agent-loop/tests/contract-regressions.spec.ts +++ b/packages/core/agent-loop/tests/contract-regressions.spec.ts @@ -659,12 +659,14 @@ function expectPairedTools(messages: readonly Message[]): void { const pending = new Set() for (const message of messages) { if (pending.size > 0) expect(message.source.kind).toBe('tool') + if (message.role === 'tool') { + expect(pending.delete(message.toolCallId)).toBe(true) + continue + } for (const block of message.content) { if (block.type === 'tool-call') { expect(pending.has(block.id)).toBe(false) pending.add(block.id) - } else if (block.type === 'tool-result') { - expect(pending.delete(block.toolCallId)).toBe(true) } } } @@ -716,7 +718,7 @@ describe('forked tool history reaches the next model request', () => { expect(closers.filter(event => event.type === 'step/end')).toHaveLength(type === 'step/end' ? 0 : 1) expect(closers.at(-1)).toMatchObject({ type: 'turn/end', data: { reason: { kind: 'forked' } } }) for (const result of results) { - const text = result.data.message.content[0].content[0] + const text = result.data.message.content[0] if (text?.type !== 'text') throw new Error('fork result has no text') expect(text.text).toContain('The parent session may have') } @@ -1287,12 +1289,10 @@ describe('tool result call identity', () => { // And deriveMessages pairs the tool-result with the assistant tool-call: // the derived tool-result block's toolCallId equals the original call.id. const messages = agent.session.deriveMessages() - const toolResultBlock = messages - .flatMap(m => m.content) - .find(b => b.type === 'tool-result') - expect(toolResultBlock?.type).toBe('tool-result') - if (toolResultBlock?.type === 'tool-result') { - expect(toolResultBlock.toolCallId).toBe(ToolCallId('c1')) + const toolResultMessage = messages.find(m => m.role === 'tool') + expect(toolResultMessage?.role).toBe('tool') + if (toolResultMessage?.role === 'tool') { + expect(toolResultMessage.toolCallId).toBe(ToolCallId('c1')) } }) }) diff --git a/packages/core/agent-loop/tests/coverage-edges.spec.ts b/packages/core/agent-loop/tests/coverage-edges.spec.ts index 1fa24977b2..319f396c07 100644 --- a/packages/core/agent-loop/tests/coverage-edges.spec.ts +++ b/packages/core/agent-loop/tests/coverage-edges.spec.ts @@ -237,7 +237,7 @@ describe('structured tool error propagation (the runtime-validation Agent Note, await waitForIdle(ctx, agent) const toolResult = agent.session.snapshotEvents().find(e => e.type === 'tool/result') - expect(toolResult?.type === 'tool/result' && toolResult.data.message.content[0].isError).toBe(true) + expect(toolResult?.type === 'tool/result' && toolResult.data.message.isError).toBe(true) expect(toolResult?.type === 'tool/result' && toolResult.data.error) .toEqual({ name: 'HarnessError', code: 'BOOM' }) }) diff --git a/packages/core/agent-loop/tests/interception.spec.ts b/packages/core/agent-loop/tests/interception.spec.ts index 27302c53d8..b052fd2783 100644 --- a/packages/core/agent-loop/tests/interception.spec.ts +++ b/packages/core/agent-loop/tests/interception.spec.ts @@ -709,9 +709,9 @@ describe('tools/pre-execute gate (native-plugin permission pattern, end-to-end t expect(ran).toBe(false) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) expect(result?.type === 'tool/result' - && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('blocked dangerous tool'))).toBe(true) + && result.data.message.content.some(b => b.type === 'text' && b.text.includes('blocked dangerous tool'))).toBe(true) }) }) @@ -773,7 +773,7 @@ describe('worked example: a native hook plugin is just a cordis plugin on the se // prompt allowed → user-sourced user/message recorded expect(log.some(e => e.type === 'user/message' && e.data.source.kind === 'user')).toBe(true) // tool ran (echo allowed) and post-execute attached "audited" context - expect(log.some(e => e.type === 'tool/result' && !e.data.message.content[0].isError)).toBe(true) + expect(log.some(e => e.type === 'tool/result' && !e.data.message.isError)).toBe(true) expect(log.some(e => e.type === 'user/message' && e.data.source.kind === 'plugin' && e.data.content.some(b => b.type === 'text' && b.text === 'audited'))).toBe(true) // NO hook/* events — a native plugin needs none diff --git a/packages/core/agent-loop/tests/loop.spec.ts b/packages/core/agent-loop/tests/loop.spec.ts index fb98a37e31..e8e0d7f116 100644 --- a/packages/core/agent-loop/tests/loop.spec.ts +++ b/packages/core/agent-loop/tests/loop.spec.ts @@ -496,12 +496,11 @@ describe('agent loop', () => { // the second request's derived history contains the tool result const secondMessages = adapter.requests[1]!.messages - const toolResultMessage = secondMessages.find(m => - m.content.some(b => b.type === 'tool-result')) + const toolResultMessage = secondMessages.find(m => m.role === 'tool') expect(toolResultMessage).toBeDefined() - const block = toolResultMessage!.content.find(b => b.type === 'tool-result')! - expect(block).toMatchObject({ toolCallId: 'c1', isError: false }) - expect((block).content).toEqual([{ type: 'text', text: 'echo: ping' }]) + const message = toolResultMessage! + expect(message).toMatchObject({ toolCallId: 'c1', isError: false }) + expect(message.content).toEqual([{ type: 'text', text: 'echo: ping' }]) // session log records call + result const types = agent.session.snapshotEvents().map(e => e.type) @@ -1045,8 +1044,7 @@ describe('agent loop', () => { ]) const secondRequest = adapter.requests[1]!.messages - const resultIndex = secondRequest.findIndex(message => - message.content.some(block => block.type === 'tool-result')) + const resultIndex = secondRequest.findIndex(message => message.role === 'tool') const contextIndexes = secondRequest.flatMap((message, index) => message.content.some(block => block.type === 'text' && (block.text.includes('mid-turn notice') || block.text.includes('second notice'))) diff --git a/packages/core/agent-loop/tests/properties.spec.ts b/packages/core/agent-loop/tests/properties.spec.ts index 68e170f27e..daea36f629 100644 --- a/packages/core/agent-loop/tests/properties.spec.ts +++ b/packages/core/agent-loop/tests/properties.spec.ts @@ -74,7 +74,7 @@ function recordStatus(ctx: Context, agent: Agent): { seen: string[]; dispose: () function userMessageTexts(agent: Agent): string[] { return agent.session.snapshotEvents() .filter(e => e.type === 'user/message') - .map(e => (e.data as { content: { type: string; text?: string }[] }).content.map(b => b.text ?? '').join('')) + .map(e => e.data.content.flatMap(block => block.type === 'text' ? [block.text] : []).join('')) } function turnNumbers(agent: Agent): number[] { diff --git a/packages/core/agent-loop/tests/tool-calls.spec.ts b/packages/core/agent-loop/tests/tool-calls.spec.ts index 27118dacb1..6aba2b409e 100644 --- a/packages/core/agent-loop/tests/tool-calls.spec.ts +++ b/packages/core/agent-loop/tests/tool-calls.spec.ts @@ -258,7 +258,7 @@ describe('tool-call scheduler: model-order results despite out-of-order settleme await waitForIdle(ctx, agent) const messages = agent.session.deriveMessages() - const toolResults = messages.flatMap(m => m.content.filter(b => b.type === 'tool-result')) + const toolResults = messages.filter(m => m.role === 'tool') expect(toolResults.map(b => b.toolCallId)).toEqual([ToolCallId('c1'), ToolCallId('c2')]) }) }) @@ -463,11 +463,11 @@ describe('tool-call scheduler: ordered middleware and additional contexts', () = expect(post).toEqual(['c1', 'c2']) const results = events(agent).filter(e => e.type === 'tool/result') expect(results.map(e => e.data.message.source.callId)).toEqual([ToolCallId('c1'), ToolCallId('c2'), ToolCallId('c3')]) - expect((results[1]!.data.message.content[0].content[0] as { text: string }).text).toContain('blocked by policy') + expect((results[1]!.data.message.content[0] as { text: string }).text).toContain('blocked by policy') expect(results[1]!.data.error).toEqual({ name: 'AutoReviewDeniedError', code: 'AUTO_REVIEW_DENIED', reason: 'exact scope was not authorized', }) - expect((results[2]!.data.message.content[0].content[0] as { text: string }).text).toContain('pre exploded') + expect((results[2]!.data.message.content[0] as { text: string }).text).toContain('pre exploded') }) }) @@ -495,7 +495,7 @@ describe('tool-call scheduler: abort handling', () => { .toEqual([ToolCallId('c1'), ToolCallId('c2')]) expect(events(agent).filter(e => e.type === 'tool/result').map(e => ({ callId: e.data.message.source.callId, - isError: e.data.message.content[0].isError, + isError: e.data.message.isError, error: e.data.error, }))).toEqual([ { callId: ToolCallId('c1'), isError: true, error: { name: 'AbortError', code: TOOL_ABORTED_BEFORE_DISPATCH } }, @@ -527,7 +527,7 @@ describe('tool-call scheduler: abort handling', () => { .toEqual([ToolCallId('c1'), ToolCallId('c2')]) expect(events(agent).filter(e => e.type === 'tool/result').map(e => ({ callId: e.data.message.source.callId, - isError: e.data.message.content[0].isError, + isError: e.data.message.isError, error: e.data.error, }))).toEqual([ { callId: ToolCallId('c1'), isError: true, error: { name: 'AbortError', code: TOOL_ABORTED_BEFORE_DISPATCH } }, @@ -565,7 +565,7 @@ describe('tool-call scheduler: abort handling', () => { .toEqual([ToolCallId('c1'), ToolCallId('c2'), ToolCallId('c3'), ToolCallId('c4')]) expect(events(agent).filter(e => e.type === 'tool/result').slice(-2).map(e => ({ callId: e.data.message.source.callId, - isError: e.data.message.content[0].isError, + isError: e.data.message.isError, error: e.data.error, }))) .toEqual([ @@ -638,7 +638,8 @@ describe('tool-call scheduler: abort handling', () => { .toMatchObject({ message: { source: { kind: 'tool', callId: ToolCallId('c3') }, - content: [{ isError: true }], + content: [{ type: 'text', text: 'Error: tool call aborted before dispatch' }], + isError: true, }, error: { name: 'AbortError', code: TOOL_ABORTED_BEFORE_DISPATCH }, }) diff --git a/packages/core/session/README.i18n.yaml b/packages/core/session/README.i18n.yaml index 9436e8b052..92ac4d249b 100644 --- a/packages/core/session/README.i18n.yaml +++ b/packages/core/session/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/core/session/README.md -README.md: b853dfd6e0d4617cad7f1a635f3b69a19e24e162 -README.zh.md: 6347aa5f346f148d0f077d7c8d8a263b9c7bc8b1 +README.md: 7be5f00e55dd71477c81833ad391569fac4e132d +README.zh.md: 3f82a30123d516f8b8e6e6ac5660ccee4789edee diff --git a/packages/core/session/README.md b/packages/core/session/README.md index b853dfd6e0..7be5f00e55 100644 --- a/packages/core/session/README.md +++ b/packages/core/session/README.md @@ -51,7 +51,7 @@ Surface events (`system/message`, `user/message`, `assistant/message`, `tool/res Plugins declare content-changing events with `@messageProjection` and register a pure definition through `ctx.sessions.registerMessageProjection()`. Session calls the definition before accepting an event and caches its immutable message updates. Missing definitions reject append and restore; unloading a used definition also blocks cached reads. Detached constructors and `foldSurface(events, projections)` require explicit definitions. Reconstructors pass the fold's `projectedMessages` to `deriveEventMessage()`; live instance methods apply the same projections automatically. [Plugin-owned message projections](../../../.agents/notes/implemented/architecture/2026-09-11-plugin-owned-message-projections.md) defines ownership and offline assembly. -Append, seed/restore, and event adoption/snapshot reject any `header.system` and exactly empty optional request-header fields (`tools: []`, `adapterDefaults: {}`) instead of normalizing input. Tool-result `data.error` is allowed only when `message.content[0].isError === true`; failure identity remains optional. Rejected appends do not change the log, derived state, or event feed. Adoption validates event-local metadata but not referenced history or replacement membership. +Append, seed/restore, and event adoption/snapshot reject any `header.system` and exactly empty optional request-header fields (`tools: []`, `adapterDefaults: {}`) instead of normalizing input. Tool-result `data.error` is allowed only when the first-class message has `isError === true`; failure identity remains optional. Rejected appends do not change the log, derived state, or event feed. Adoption validates event-local metadata but not referenced history or replacement membership. `system/message` holds the rendered system prompt: the first one is surface node 0, the prepared call capability governs admission, with a non-empty rendering consolidated at the first system node on an incapable route or appended after cached history inside a continuing `in-history` series; empty system nodes project to no message, so clearing the prompt requires logged empty replacements of all active system nodes, not just the latest; the surface fold rejects a replacement covering node 0 while it is a `system/message` unless the replacing event is itself a `system/message` over exactly that node, while later system nodes carry no protection and a compaction range may shadow them ([decision](../../../.agents/notes/implemented/architecture/2026-09-02-system-prompt-as-surface-node.md)). diff --git a/packages/core/session/README.zh.md b/packages/core/session/README.zh.md index 6347aa5f34..3f82a30123 100644 --- a/packages/core/session/README.zh.md +++ b/packages/core/session/README.zh.md @@ -51,7 +51,7 @@ session.deriveMessages() // the derived model history 插件用 `@messageProjection` 声明修改内容的事件,并通过 `ctx.sessions.registerMessageProjection()` 注册纯处理器。Session 在接受事件前调用处理器,并缓存其不可变消息更新。缺少处理器时拒绝追加和恢复,卸载已经使用的处理器后也会拒绝读取缓存。独立构造函数和 `foldSurface(events, projections)` 必须显式接收处理器。重建函数将折叠结果的 `projectedMessages` 传给 `deriveEventMessage()`,实时实例方法自动应用相同的投影。[插件拥有消息投影](../../../.agents/notes/implemented/architecture/2026-09-11-plugin-owned-message-projections.zh.md)说明职责划分和离线装配。 -追加、seed/restore 与事件 adoption/snapshot 会拒绝任何 `header.system` 及恰好为空的可选请求头字段(`tools: []`、`adapterDefaults: {}`),而不规范化输入。工具结果的 `data.error` 仅在 `message.content[0].isError === true` 时允许存在;失败标识仍是可选的。被拒绝的追加不会改变日志、派生状态或事件流。Adoption 校验事件局部元数据,但不校验所引用的历史或替换端点是否属于 surface。 +追加、seed/restore 与事件 adoption/snapshot 会拒绝任何 `header.system` 及恰好为空的可选请求头字段(`tools: []`、`adapterDefaults: {}`),而不规范化输入。工具结果的 `data.error` 仅在一等消息的 `isError === true` 时允许存在;失败标识仍是可选的。被拒绝的追加不会改变日志、派生状态或事件流。Adoption 校验事件局部元数据,但不校验所引用的历史或替换端点是否属于 surface。 `system/message` 承载渲染后的系统提示词:第一条是 surface 第 0 号节点,准入依据已准备调用的能力,不具备能力的路由将非空渲染文本归并到首个系统节点,延续中的 `in-history` 序列则在缓存历史之后追加;空系统节点不投影为消息,因此清除提示词必须为所有生效的系统节点记录空内容替换,而非仅替换最新节点;当第 0 号节点是 `system/message` 时,surface 折叠拒绝覆盖它的替换,除非替换事件本身是恰好覆盖该节点的 `system/message`,而后续系统节点不受保护,压缩范围可以遮蔽它们([决策](../../../.agents/notes/implemented/architecture/2026-09-02-system-prompt-as-surface-node.zh.md))。 diff --git a/packages/core/session/src/index.ts b/packages/core/session/src/index.ts index a6401d1b0d..536e686bb9 100644 --- a/packages/core/session/src/index.ts +++ b/packages/core/session/src/index.ts @@ -324,7 +324,7 @@ const MESSAGE_ROLE_BY_TYPE: Record = { 'system/message': 'system', 'user/message': 'user', 'assistant/message': 'assistant', - 'tool/result': 'user', + 'tool/result': 'tool', } /** Validate only the event-specific invariants needed to safely replay a message. */ @@ -375,14 +375,7 @@ function assertMessageEventShape(event: Record, subject: string || sourceRecord['callId'] === '') { throw new Error(`${subject} message must have tool source`) } - const content = messageRecord['content'] as unknown[] - const block = content[0] - if (content.length !== 1 || typeof block !== 'object' || block === null - || (block as Record)['type'] !== 'tool-result' - || !Array.isArray((block as Record)['content'])) { - throw new Error(`${subject} message must contain one tool-result block`) - } - if ((block as Record)['toolCallId'] !== sourceRecord['callId']) { + if (messageRecord['toolCallId'] !== sourceRecord['callId']) { throw new Error(`${subject} message has mismatched tool call ids`) } } diff --git a/packages/core/session/src/invariant.ts b/packages/core/session/src/invariant.ts index be4b214c86..b36db384c2 100644 --- a/packages/core/session/src/invariant.ts +++ b/packages/core/session/src/invariant.ts @@ -135,7 +135,7 @@ function validateEvent( } requireOpenStep(trace, 'tool/result', event.data.turn, event.data.step, fail) const callId = event.data.message.source.callId - const syntheticNotStarted = event.data.message.content[0].isError === true && event.data.error?.code === TOOL_NOT_STARTED + const syntheticNotStarted = event.data.message.isError === true && event.data.error?.code === TOOL_NOT_STARTED if (!trace.pendingCalls.has(callId) && !syntheticNotStarted) { fail(`tool/result for ${callId} with no prior tool/call in this step`) } diff --git a/packages/core/session/src/repair.ts b/packages/core/session/src/repair.ts index 8c5328d672..b87a69c351 100644 --- a/packages/core/session/src/repair.ts +++ b/packages/core/session/src/repair.ts @@ -128,16 +128,13 @@ export function openTurnClosers(events: readonly SessionEvent[], cause: OpenTurn const started = callSeq !== undefined const message: ToolResultMessage = deepFreeze({ id: brandString(`${cause.kind}-tool-result-${callId}-${seq}`), - role: 'user', + role: 'tool', + toolCallId: callId, + isError: true, source: { kind: 'tool', callId }, content: [{ - type: 'tool-result', - toolCallId: callId, - isError: true, - content: [{ - type: 'text', - text: started ? text.started : text.notStarted, - }], + type: 'text', + text: started ? text.started : text.notStarted, }], }) closers.push({ diff --git a/packages/core/session/src/surface.ts b/packages/core/session/src/surface.ts index 9bc3d32a8c..b6a6abc5d6 100644 --- a/packages/core/session/src/surface.ts +++ b/packages/core/session/src/surface.ts @@ -190,10 +190,8 @@ export function validateSessionEventData( if (!isRecord(data)) throw new Error(`${subject} data must be an object`) if (data['error'] === undefined) return const message = data['message'] - const content = isRecord(message) ? message['content'] : undefined - const block: unknown = Array.isArray(content) ? content[0] : undefined - if (!isRecord(block) || block['isError'] !== true) { - throw new Error(`${subject} error requires message content[0].isError === true`) + if (!isRecord(message) || message['isError'] !== true) { + throw new Error(`${subject} error requires message.isError === true`) } } } @@ -419,15 +417,13 @@ function assertToolResultRewrite( } const originalRest = { ...original.data } as Record const replacementRest = { ...event.data } as Record - const originalResult = original.data.message.content[0] - const replacementResult = event.data.message.content[0] originalRest['message'] = { ...original.data.message, - content: [{ ...originalResult, content: null }], + content: null, } replacementRest['message'] = { ...event.data.message, - content: [{ ...replacementResult, content: null }], + content: null, } if (!isDeepEqualJson(originalRest, replacementRest)) { throw new Error('tool/result surface replacement may change only content') diff --git a/packages/core/session/src/types.ts b/packages/core/session/src/types.ts index baf3fb4056..7db16ee34b 100644 --- a/packages/core/session/src/types.ts +++ b/packages/core/session/src/types.ts @@ -365,7 +365,7 @@ export interface SessionEventMap { message: ToolResultMessage /** * Optional failure identity and raw user-facing reason, outside model content; - * allowed only when the tool-result block has `isError: true`. + * allowed only when the message has `isError: true`. */ error?: { name: string; code: string; reason?: string } meta?: JsonValue diff --git a/packages/core/session/tests/canonical-envelopes.spec.ts b/packages/core/session/tests/canonical-envelopes.spec.ts index ec78041a8b..c9e6fa8d84 100644 --- a/packages/core/session/tests/canonical-envelopes.spec.ts +++ b/packages/core/session/tests/canonical-envelopes.spec.ts @@ -72,7 +72,7 @@ const invalidData = [ rule: /must omit header.system/, })), { name: 'successful tool has failure metadata', event: toolEvent({ ...toolData(false), error: failure }), rule: /error requires/ }, - ...[undefined, null, [], {}, { content: null }, { content: [] }, { content: [null] }, { content: [{ isError: 'true' }] }].map(message => ({ + ...[undefined, null, [], {}, { isError: 'true' }, { content: [{ isError: true }] }].map(message => ({ name: 'malformed tool message with failure metadata', event: toolEvent({ turn: 1, step: 1, ...message === undefined ? {} : { message }, error: failure }), rule: /error requires/, diff --git a/packages/core/session/tests/fork.spec.ts b/packages/core/session/tests/fork.spec.ts index a4478809e1..feeda44e90 100644 --- a/packages/core/session/tests/fork.spec.ts +++ b/packages/core/session/tests/fork.spec.ts @@ -85,7 +85,8 @@ describe('SessionStore.fork', () => { expect(child.snapshotEvents()).not.toBe(source.snapshotEvents()) expect(child.snapshotEvents()[1]).not.toBe(source.snapshotEvents()[1]) expect(() => { - firstUserMessage(child.snapshotEvents()).data.content[0] = { type: 'text', text: 'child mutation' } + (firstUserMessage(child.snapshotEvents()).data as unknown as { content: { type: string; text?: string }[] }).content[0] + = { type: 'text', text: 'child mutation' } }).toThrow(TypeError) expect(firstUserMessage(source.snapshotEvents()).data.content).toEqual([{ type: 'text', text: 'hello' }]) expect(firstUserMessage(child.snapshotEvents()).data.content).toEqual([{ type: 'text', text: 'hello' }]) @@ -339,9 +340,11 @@ describe('fork boundaries inside an open turn', () => { // request-time patch: the derived messages end with the error tool result. const derived = child.deriveMessages() expect(derived.at(-1)).toMatchObject({ - role: 'user', + role: 'tool', source: { kind: 'tool', callId: ToolCallId('call-ns') }, - content: [{ type: 'tool-result', isError: true }], + toolCallId: ToolCallId('call-ns'), + isError: true, + content: [{ type: 'text' }], }) }) diff --git a/packages/core/session/tests/invariant.spec.ts b/packages/core/session/tests/invariant.spec.ts index 9b8b281cf5..df34fdc3d7 100644 --- a/packages/core/session/tests/invariant.spec.ts +++ b/packages/core/session/tests/invariant.spec.ts @@ -288,10 +288,7 @@ describe('session-log invariants', () => { ...original.data, message: freezeMessage({ ...original.data.message, - content: [{ - ...original.data.message.content[0], - content: [{ type: 'text', text: 'pruned' }], - }] satisfies typeof original.data.message.content, + content: [{ type: 'text', text: 'pruned' }], }), }, { surfaceOp: { op: 'replace', startSeq: original.seq, endSeq: original.seq }, @@ -327,10 +324,7 @@ describe('session-log invariants', () => { ...original.data, message: freezeMessage({ ...original.data.message, - content: [{ - ...original.data.message.content[0], - content: [{ type: 'text', text: 'pruned' }], - }] satisfies typeof original.data.message.content, + content: [{ type: 'text', text: 'pruned' }], }), }, { surfaceOp: { op: 'replace', startSeq: original.seq, endSeq: original.seq }, diff --git a/packages/core/session/tests/properties.spec.ts b/packages/core/session/tests/properties.spec.ts index 07bf37ac02..cbdcbc8148 100644 --- a/packages/core/session/tests/properties.spec.ts +++ b/packages/core/session/tests/properties.spec.ts @@ -164,11 +164,11 @@ describe('Session properties', () => { const messages = session.deriveMessages() const before = structuredClone(session.snapshotEvents()) for (const m of messages) { - expect(['user', 'assistant', 'system']).toContain(m.role) + expect(['user', 'assistant', 'system', 'tool']).toContain(m.role) // Derived messages are frozen shared projections: mutation THROWS // (strict mode) instead of relying on per-call clones for isolation. expect(Object.isFrozen(m)).toBe(true) - expect(() => { m.content.push({ type: 'text', text: 'mutation' }) }).toThrow(TypeError) + expect(() => { (m.content as unknown as { type: string; text?: string }[]).push({ type: 'text', text: 'mutation' }) }).toThrow(TypeError) } expect(session.snapshotEvents()).toEqual(before) })) diff --git a/packages/core/session/tests/repair.spec.ts b/packages/core/session/tests/repair.spec.ts index 7692e42026..6be64dffe6 100644 --- a/packages/core/session/tests/repair.spec.ts +++ b/packages/core/session/tests/repair.spec.ts @@ -98,10 +98,17 @@ describe.each(causes)('openTurnClosers (cause %o)', (cause) => { message: { id: `${cause.kind}-tool-result-call-1-3`, source: { callId: ToolCallId('call-1') }, - content: [{ isError: true }], + role: 'tool', + toolCallId: ToolCallId('call-1'), + isError: true, }, error: { code: TOOL_NOT_STARTED }, }) + expect(result.type === 'tool/result' && result.data.message.content).toEqual([{ + type: 'text', text: cause.kind === 'forked' + ? 'The history inherited by this branch has no record of this tool call starting. The parent session may have executed it after the fork point. Decide whether to retry from the tool semantics: retry only if the operation is read-only or idempotent; if it may have side effects, first verify external state or ask the user. Do not retry blindly.' + : 'The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed.', + }]) }) it('does NOT synthesize a result for a tool-call that already has one', () => { @@ -273,6 +280,11 @@ describe.each(causes)('openTurnClosers (cause %o)', (cause) => { expect(result.type === 'tool/result' && result.data.error).toEqual({ name: 'ToolOutcomeUnknownError', code: TOOL_OUTCOME_UNKNOWN, }) + if (result.type !== 'tool/result' || result.data.message.content[0]?.type !== 'text') { + throw new Error('expected a text tool result') + } + expect(result.data.message.content[0].text).toContain('retry only if the operation is read-only or idempotent') + expect(result.data.message.content[0].text).toContain('first verify external state or ask the user') }) it('handles tool/call without a matching assistant/message entry gracefully', () => { @@ -317,10 +329,10 @@ describe('openTurnClosers model-visible wording', () => { function resultText(closers: LogicalSessionEvent[]): string { const result = closers[0] - if (result?.type !== 'tool/result' || result.data.message.content[0].content[0]?.type !== 'text') { + if (result?.type !== 'tool/result' || result.data.message.content[0]?.type !== 'text') { throw new Error('expected a text tool result') } - return result.data.message.content[0].content[0].text + return result.data.message.content[0].text } // The exact wording is model-visible: pinned verbatim per cause and lifecycle. diff --git a/packages/core/session/tests/session.spec.ts b/packages/core/session/tests/session.spec.ts index d6762ba147..6ed648f7d0 100644 --- a/packages/core/session/tests/session.spec.ts +++ b/packages/core/session/tests/session.spec.ts @@ -1,6 +1,7 @@ import { describe, expect, expectTypeOf, it, vi } from 'vitest' import { Context } from '@deepseek-ai/cordis' import { createSystemMessage, createUserMessage, ToolCallId, createMessage, createToolResultMessage, MessageId, ReasoningEffortId } from '@deepseek-ai/dsh-llm' +import type { ContentBlock } from '@deepseek-ai/dsh-llm' import SessionStore, { adoptSessionEvent, SESSION_FORMAT_VERSION, @@ -58,10 +59,10 @@ describe('Session', () => { session.append('turn/end', { turn: 1, reason: { kind: 'completed' } }) const messages = session.deriveMessages() - expect(messages.map(m => m.role)).toEqual(['user', 'assistant', 'user']) + expect(messages.map(m => m.role)).toEqual(['user', 'assistant', 'tool']) // raw chunks must NOT appear in derived history expect(messages[1]!.content).toHaveLength(2) - expect(messages[2]!.content[0]).toMatchObject({ type: 'tool-result', toolCallId: ToolCallId('c1') }) + expect(messages[2]).toMatchObject({ role: 'tool', content: [{ type: 'text', text: 'ok' }] }) }) it('accepts and round-trips a max-tokens turn/end reason', () => { @@ -290,12 +291,9 @@ describe('Session', () => { } const tool = { id: 'tool', - role: 'user', - content: [{ - type: 'tool-result', - toolCallId: 'call', - content: [{ type: 'text', text: 'result' }], - }], + role: 'tool', + toolCallId: 'call', + content: [{ type: 'text', text: 'result' }], source: { kind: 'tool', callId: 'call' }, } const invalid = [ @@ -380,16 +378,16 @@ describe('Session', () => { message: 'message must have plugin source', }, { - name: 'tool tuple', + name: 'tool role', event: { type: 'tool/result', seq: 0, time: 1, surfaceOp: 'append', data: { turn: 1, step: 1, - message: { ...tool, content: [{ type: 'text', text: 'not a result' }] }, + message: { ...tool, role: 'user' }, }, }, - message: 'message must contain one tool-result block', + message: 'message must have role "tool"', }, { name: 'tool correlation', @@ -458,7 +456,7 @@ describe('Session', () => { content: [{ type: 'text', text: 'owned' }], source: { kind: 'user' }, }, - } as SessionEvent<'user/message'> + } as unknown as SessionEvent<'user/message'> expect(adoptSessionEvent(owned)).toBe(owned) expect(Object.isFrozen(owned.data)).toBe(true) expect(Object.isFrozen(owned.data.content)).toBe(true) @@ -585,11 +583,11 @@ describe('Session', () => { const messages = session.deriveMessages() const userBlock = messages[0]!.content[0]! expect(() => { if (userBlock.type === 'text') userBlock.text = 'HACKED' }).toThrow(TypeError) - const toolBlock = messages[1]!.content[0]! + const toolMessage = messages[1]! expect(() => { - if (toolBlock.type === 'tool-result') toolBlock.content.push({ type: 'text', text: 'injected' }) + if (toolMessage.role === 'tool') (toolMessage.content as ContentBlock[]).push({ type: 'text', text: 'injected' }) }).toThrow(TypeError) - expect(() => { messages[0]!.content.push({ type: 'text', text: 'extra' }) }).toThrow(TypeError) + expect(() => { (messages[0]!.content as ContentBlock[]).push({ type: 'text', text: 'extra' }) }).toThrow(TypeError) // The returned ARRAY is the caller's own snapshot, though — reordering it // is the caller's business and never reaches the cache or the log. messages.reverse() diff --git a/packages/core/session/tests/surface.spec.ts b/packages/core/session/tests/surface.spec.ts index c861e17b3b..bf95a59c17 100644 --- a/packages/core/session/tests/surface.spec.ts +++ b/packages/core/session/tests/surface.spec.ts @@ -204,7 +204,6 @@ describe('foldSurface tool-result rewrites', () => { ] as const)('rejects a replacement that changes the result block %s', (_field, patch) => { const original = toolResultEvent(SessionSeq(0), 'original') const data = original.data as Extract['data'] - const result = data.message.content[0] const replacement = { ...original, seq: SessionSeq(1), @@ -213,7 +212,7 @@ describe('foldSurface tool-result rewrites', () => { ...data, message: freezeMessage({ ...data.message, - content: [{ ...result, ...patch }] as [typeof result], + ...patch, }), }, surfaceOp: surfaceOp({ op: 'replace', startSeq: 0, endSeq: 0 }), diff --git a/packages/experimental/auto-review/src/index.ts b/packages/experimental/auto-review/src/index.ts index 402695b933..ff90ff61f2 100644 --- a/packages/experimental/auto-review/src/index.ts +++ b/packages/experimental/auto-review/src/index.ts @@ -242,8 +242,7 @@ function filteredUserEntries( initialPromptSeq: SessionEvent['seq'] | undefined, parentSession: string | undefined, ): HistoricalUserMessage[] { - const retained = content.filter(block => block.type !== 'tool-result') - return retained.map(block => ({ + return content.map(block => ({ kind: 'user-message', role: block.type === 'text' ? textRole(source, seq, initialPromptSeq, parentSession) @@ -424,7 +423,7 @@ function snapshotAutoReview(agent: Agent, exec: ToolExecution): ReviewSnapshot { if (event.type === 'user/message') { if (event.data.source.kind === 'tool') continue if (isProjectInstruction(event.data.source)) { - const content = event.data.content.filter(block => block.type !== 'tool-result') + const content = event.data.content if (content.length > 0) { projectInstructions.push({ kind: 'user-message', diff --git a/packages/experimental/auto-review/tests/auto-review.e2e.ts b/packages/experimental/auto-review/tests/auto-review.e2e.ts index b730bd7c05..dfd32a85a4 100644 --- a/packages/experimental/auto-review/tests/auto-review.e2e.ts +++ b/packages/experimental/auto-review/tests/auto-review.e2e.ts @@ -227,7 +227,7 @@ function outcome(events: readonly SessionEvent[], path: Path): { denied: boolean const starts = events.filter(event => event.type === 'tool/ptc-dispatch-start') expect(starts).toHaveLength(inner.length) const result = path === 'native' ? native[0]?.data : inner[0]?.data - const isError = path === 'native' ? native[0]?.data.message.content[0]?.isError : inner[0]?.data.isError + const isError = path === 'native' ? native[0]?.data.message.isError : inner[0]?.data.isError return { denied: result?.error?.code === DENIED && isError === true, success: isError === false } } diff --git a/packages/experimental/auto-review/tests/auto-review.spec.ts b/packages/experimental/auto-review/tests/auto-review.spec.ts index 6816d192e4..af64fcdc91 100644 --- a/packages/experimental/auto-review/tests/auto-review.spec.ts +++ b/packages/experimental/auto-review/tests/auto-review.spec.ts @@ -297,37 +297,15 @@ describe('native review request', () => { } as never) appendUser(session, 'parent-authored evidence', { kind: 'user' }) session.append('user/message', createUserMessage({ - content: [ - { type: 'text', text: 'plugin evidence' }, - { - type: 'tool-result', - toolCallId: ToolCallId('result-source'), - content: [{ type: 'text', text: 'tool result secret' }], - isError: false, - }, - ], + content: [{ type: 'text', text: 'plugin evidence' }], source: { kind: 'plugin', plugin: 'evidence' }, }), { surfaceOp: 'append' }) - session.append('user/message', createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('result-only-source'), - content: [{ type: 'text', text: 'tool-result-only secret' }], - isError: false, - }], - source: { kind: 'plugin', plugin: 'tool-result-only' }, - }), { surfaceOp: 'append' }) appendUser(session, 'checkpoint authority', compactCheckpointSource(CompactionId('checkpoint-1'))) appendUser(session, 'project authority', { kind: 'agent-instructions', form: 'instructions', changes: [], }) session.append('user/message', createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('project-result-only'), - content: [{ type: 'text', text: 'project-tool-result-only secret' }], - isError: false, - }], + content: [], source: { kind: 'agent-instructions', form: 'instructions', changes: [] }, }), { surfaceOp: 'append' }) appendUser(session, 'tool-source secret', { kind: 'tool', callId: ToolCallId('result-source') }) @@ -342,6 +320,22 @@ describe('native review request', () => { appendNativeCall(session, oldCallId, 'old_probe', '{ "old": true }') appendNativeCall(session, outerCallId, RUN_CODE_NAME, '{"code":"call probe"}') appendNativeCall(session, currentCallId, 'probe', '{"path":"target"}') + for (const [callId, text] of [ + ['result-source', 'tool result secret'], + ['result-only-source', 'tool-result-only secret'], + ['project-result-only', 'project-tool-result-only secret'], + ] as const) { + appendNativeCall(session, ToolCallId(callId), 'probe', '{"path":"target"}') + session.append('tool/result', { + turn: 1, + step: 1, + message: createToolResultMessage({ + callId: ToolCallId(callId), + content: [{ type: 'text', text }], + isError: false, + }), + }, { surfaceOp: 'append' }) + } session.append('tool/result', { turn: 1, step: 1, diff --git a/packages/experimental/browser-use-runtime/tests/mcp.spec.ts b/packages/experimental/browser-use-runtime/tests/mcp.spec.ts index ff9426d0aa..18f3cb733b 100644 --- a/packages/experimental/browser-use-runtime/tests/mcp.spec.ts +++ b/packages/experimental/browser-use-runtime/tests/mcp.spec.ts @@ -39,7 +39,7 @@ class FixtureModel extends LlmAdapter { } async * stream(options: GenerateOptions): AsyncIterable { this.requests.push(options) - if (options.tools?.some(tool => tool.name === TOOL) && options.messages.at(-1)?.content[0]?.type === 'text') { + if (options.tools?.some(tool => tool.name === TOOL) && options.messages.at(-1)?.role === 'user') { const call = { type: 'tool-call' as const, id: ToolCallId('visit'), name: TOOL, arguments: '{"label":"fixture"}' } yield { type: 'block-start', index: 0, blockType: 'tool-call' } yield { type: 'tool-call-delta', index: 0, id: call.id, name: call.name, argumentsDelta: call.arguments } diff --git a/packages/experimental/browser-use-stagehand-native/tests/loader-composition.spec.ts b/packages/experimental/browser-use-stagehand-native/tests/loader-composition.spec.ts index 6891a50d47..253f2dd6a9 100644 --- a/packages/experimental/browser-use-stagehand-native/tests/loader-composition.spec.ts +++ b/packages/experimental/browser-use-stagehand-native/tests/loader-composition.spec.ts @@ -119,9 +119,7 @@ it('loads browser tools from cordis.yml, logs browser results, and admits the sc expect(JSON.stringify(extraction)).toContain('Fixture heading') const result = events.find(event => event.type === 'tool/result' && event.data.message.source.callId === 'screenshot') if (result?.type !== 'tool/result') throw new Error('Missing screenshot result') - const tool = result.data.message.content[0] - if (tool?.type !== 'tool-result') throw new Error('Missing tool result content') - const image = tool.content.find(block => block.type === 'image') + const image = result.data.message.content.find(block => block.type === 'image') if (image?.type !== 'image') throw new Error('Missing durable screenshot') const stored = await context.attachments.readImage(image.attachment) expect(Buffer.from(stored.data).toString('base64')).toBe(screenshotBase64) diff --git a/packages/experimental/computer-use-cua-driver-mcp/tests/composition.spec.ts b/packages/experimental/computer-use-cua-driver-mcp/tests/composition.spec.ts index 1d23e0417b..b904d88429 100644 --- a/packages/experimental/computer-use-cua-driver-mcp/tests/composition.spec.ts +++ b/packages/experimental/computer-use-cua-driver-mcp/tests/composition.spec.ts @@ -145,11 +145,9 @@ describe('installed Cua Driver Loader composition', () => { parameters: { type: 'object', properties: { display: { type: 'integer', minimum: 0 } }, required: ['display'], additionalProperties: false }, }) const result = agent.session.snapshotEvents().find(event => event.type === 'tool/result') - expect(result?.data).toMatchObject({ message: { content: [{ type: 'tool-result', content: [{ type: 'text', text: 'Display 0' }, { type: 'image' }] }] } }) + expect(result?.data).toMatchObject({ message: { content: [{ type: 'text', text: 'Display 0' }, { type: 'image' }] } }) if (result?.type !== 'tool/result') throw new Error('Missing durable screenshot result') - const toolResult = result.data.message.content[0] - if (toolResult?.type !== 'tool-result') throw new Error('Missing tool result block') - const image = toolResult.content.find(block => block.type === 'image') + const image = result.data.message.content.find(block => block.type === 'image') if (image?.type !== 'image') throw new Error('Missing durable screenshot image') expect(await ctx.attachments.readImage(image.attachment)).toMatchObject({ ref: { width: 1, height: 1, mediaType: 'image/png' } }) expect(JSON.stringify(agent.session.snapshotEvents())).not.toContain('iVBORw0KGgo') diff --git a/packages/experimental/computer-use-cua-driver-native/tests/loader-composition.spec.ts b/packages/experimental/computer-use-cua-driver-native/tests/loader-composition.spec.ts index ead7993a6a..e78af90f9a 100644 --- a/packages/experimental/computer-use-cua-driver-native/tests/loader-composition.spec.ts +++ b/packages/experimental/computer-use-cua-driver-native/tests/loader-composition.spec.ts @@ -106,15 +106,16 @@ it('loads from cordis.yml and logs the native screenshot before the next model r expect(JSON.stringify(model.requests[0])).toContain('Cua Driver native computer-use tools operate the host desktop.') const toolEvent = agent.session.snapshotEvents().find(event => event.type === 'tool/result') expect(toolEvent?.data.message.source.callId).toBe('native-window') - const toolResult = agent.session.deriveMessages().flatMap(message => message.content).find(block => block.type === 'tool-result') - const image = toolResult?.type === 'tool-result' ? toolResult.content.find(block => block.type === 'image') : undefined + const toolResult = agent.session.deriveMessages().find(message => message.role === 'tool') + if (toolResult?.role !== 'tool') throw new Error('Native screenshot result was not admitted') + const image = toolResult.content.find(block => block.type === 'image') expect(image?.type).toBe('image') if (image?.type !== 'image') throw new Error('Native screenshot was not admitted') expect(image.attachment).toMatchObject({ mediaType: 'image/png', width: 1, height: 1 }) const stored = await context.attachments.readImage(image.attachment) expect(Buffer.from(stored.data).toString('base64')).toBe(screenshotBase64) expect(JSON.stringify(model.requests[1]?.messages)).toContain(JSON.stringify(image.attachment)) - expect(JSON.stringify(toolResult?.content)).not.toContain(screenshotBase64) + expect(JSON.stringify(toolResult.content)).not.toContain(screenshotBase64) const direct = await context.tools.execute({ agent, signal: new AbortController().signal, callId: ToolCallId('programmatic-window'), name: 'cua_driver_native__get_window_state', arguments: { pid: 9, window_id: 7 }, diff --git a/packages/experimental/webworker-runtime/README.i18n.yaml b/packages/experimental/webworker-runtime/README.i18n.yaml index 51eb74880d..d6fa266c66 100644 --- a/packages/experimental/webworker-runtime/README.i18n.yaml +++ b/packages/experimental/webworker-runtime/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/experimental/webworker-runtime/README.md -README.md: f0eb12cc41b0624fc24e4b1aea3dabd2a8549022 -README.zh.md: 712bfb9d56a881221180ab2b2474ab70b75257b3 +README.md: ce98accac7abb2241f79b16e596e68e1d1fbdd95 +README.zh.md: cc3cf583bb77ed0d3e9611f8d8543f39b9ea9d18 diff --git a/packages/experimental/webworker-runtime/README.md b/packages/experimental/webworker-runtime/README.md index f0eb12cc41..ce98accac7 100644 --- a/packages/experimental/webworker-runtime/README.md +++ b/packages/experimental/webworker-runtime/README.md @@ -28,7 +28,7 @@ The public npm package exposes the runtime library at its root, the self-contain Three build artifacts and one source-owned process layer: - **`lib/index.js` (assembly library)** — `createWorkerHost`/`startWorkerHost` mount the base image and any ordered data overlays (`storage/`), install the module loader (`module-system/`) and the `process` shim, boot the tree through the image's own `dsh-app-boot`, and hand the tunnel its serving seams. Overlays may replace files only under `home/` and `workspace/`; they cannot replace the base manifest, configuration, or modules. The image layout contract (`image-layout.ts`: virtual root, config/manifest paths, empty directories, the `lowered` wrapper-contract gate) is shared with the packer. Boot patches force the deployment-shaped rows: frontend serving off, JSONL session logs on the plaintext path, preset roots onto the image's `config/agent-presets`. -- **`lib/worker.js` (worker bundle)** — the assembly plus this package's Node-compatibility layer as one self-contained ES module. The module proxy table (`module-proxies.ts`) is the only platform fork: `node:*` builtins over VFS/tunnel/browser primitives, structural stubs that fail loud on the console for what a browser cannot do, and native/binary package replacements. `node:module` supplies `createRequire().resolve` and `.resolve.paths()` over the image package root, so unchanged packages can discover manifests without evaluating their modules. The global `process` shim carries Node detection fields including `title`, preventing Worker execution from entering DOM-only branches. The pack-time parser reports statically named module requests, including module-scope direct calls of the form `createRequire(import.meta.url)('pkg')` through a named `node:module` or `module` import, to the packer's reachability walk. Stored, CommonJS-obtained, and rebased `createRequire` calls require image entry seeds. VFS mutations drive `node:fs` callback, polling, and promise watchers; open descriptors retain file identity and access mode across rename, replacement, and unlink, `FileHandle.stat({ bigint: true })` reports the same device and inode identity as a path stat while the name still refers to that file, and `FileHandle.chmod()` updates the opened file identity; `readable-stream` supplies the stream state machine used by file streams and unchanged image packages such as Chokidar and readdirp. AsyncLocalStorage carries sync-stack causality across `await` through the snapshot/restore faces the pack-time lowering injects. The worker holds no compiler: an image the packer did not lower is refused at mount. The callback `fs.realpath.native` alias resolves within the mounted VFS and supports `util.promisify`. +- **`lib/worker.js` (worker bundle)** — the assembly plus this package's Node-compatibility layer as one self-contained ES module. The module proxy table (`module-proxies.ts`) is the only platform fork: `node:*` builtins over VFS/tunnel/browser primitives, structural stubs that fail loud on the console for what a browser cannot do, and native/binary package replacements. `node:module` supplies `createRequire().resolve` and `.resolve.paths()` over the image package root, so unchanged packages can discover manifests without evaluating their modules. The `node:util` JSON-data comparator compares own enumerable properties, preserving Node admission decisions for recorded fields such as `__proto__`. The global `process` shim carries Node detection fields including `title`, preventing Worker execution from entering DOM-only branches. The pack-time parser reports statically named module requests, including module-scope direct calls of the form `createRequire(import.meta.url)('pkg')` through a named `node:module` or `module` import, to the packer's reachability walk. Stored, CommonJS-obtained, and rebased `createRequire` calls require image entry seeds. VFS mutations drive `node:fs` callback, polling, and promise watchers; open descriptors retain file identity and access mode across rename, replacement, and unlink, `FileHandle.stat({ bigint: true })` reports the same device and inode identity as a path stat while the name still refers to that file, and `FileHandle.chmod()` updates the opened file identity; `readable-stream` supplies the stream state machine used by file streams and unchanged image packages such as Chokidar and readdirp. AsyncLocalStorage carries sync-stack causality across `await` through the snapshot/restore faces the pack-time lowering injects. The worker holds no compiler: an image the packer did not lower is refused at mount. The callback `fs.realpath.native` alias resolves within the mounted VFS and supports `util.promisify`. - **`src/shell/` (the worker's own process layer)** — a browser worker cannot fork, so `node:child_process` is not a stub but an implementation: `spawn` starts the command in its own Web Worker — this same bundle, told by its first frame to be a shell process — and reports it through the `ChildProcess` surface the subprocess service consumes. The command runs off the host's thread, `SIGKILL` terminates it whatever it is doing, and it reaches the VFS only by message (the host serves those frames). Worker platform executables preserve native-package protocols such as Landlock without replacing their JavaScript packages or coupling their implementations to `node:child_process`; ordinary commands use the package's evaluator and coreutils command table. The grammar is `@yarnpkg/parsers`' `parseShell`, while `execSync`/`fork` still refuse because they need a real process. - **`lib/client.js` (page half)** — startup has two independent stages. `chooseWorkerHostSource({ image?, fixtureManifest? })` optionally owns the boot barrier and fixture manifest: without `preview-fixture` it waits at the source chooser, while a valid query selects directly; either path returns ordered overlays. `connectWorkerHost(worker, { image?, overlays? })` remains the public base-runtime connector; callers that skip the chooser get an empty overlay list. `apps/web` invokes both and supplies its statically bundled Worker. The opening `init` frame carries the base and ordered overlay URLs, the boot payload delivers the structured index-injection table, and `applyIndexInjections` executes it before the shell entry runs. Script preload rows are advisory and skipped because `/plugins` resources resolve only through the tunnel; `loadBundle` fetches each combo on first demand, embeds its tunnel-only source map as a Base64 data URL, and executes the script as a Blob. The tunnel also exposes fetch-shaped transport, the independent file-upload carrier, and the API client. Request frames preserve Blob bodies through structured clone and transfer `ReadableStream` ownership. The Host Worker streams both forms into the route, so neither browser thread creates a complete byte array for a generic-file upload. diff --git a/packages/experimental/webworker-runtime/README.zh.md b/packages/experimental/webworker-runtime/README.zh.md index 712bfb9d56..cc3cf583bb 100644 --- a/packages/experimental/webworker-runtime/README.zh.md +++ b/packages/experimental/webworker-runtime/README.zh.md @@ -28,7 +28,7 @@ kind: "package-library" 一条 tsdown 管线产出三个构建产物;另有一层由源码维护的进程实现: - **`lib/index.js`(装配库)**——`createWorkerHost`/`startWorkerHost` 挂载基础镜像和按序排列的数据 overlays(`storage/`)、安装模块加载器(`module-system/`)与 `process` shim、经镜像自带的 `dsh-app-boot` 启动插件树,并把服务 seam 交给隧道。Overlay 只能替换 `home/` 与 `workspace/` 下的文件,不能替换基础 manifest、配置或模块。镜像布局契约(`image-layout.ts`:虚拟根、config/manifest 路径、空目录、`lowered` 包装契约门)与 packer 共享。boot patch 强制部署形态行:关前端静态服务、JSONL 会话日志走明文、preset 根指向镜像内 `config/agent-presets`。 -- **`lib/worker.js`(worker 束)**——装配库加本包的 Node 兼容层,合成一个自含 ES module。模块代理表(`module-proxies.ts`)是唯一平台叉口:`node:*` 内建走 VFS、隧道和浏览器原语,浏览器做不到的走结构化 stub(调用即在 console 报错并抛出),native/binary 包则替换执行后端。`node:module` 在镜像 package 根之上提供 `createRequire().resolve` 与 `.resolve.paths()`,使未修改的包无需执行目标模块即可发现 manifest。全局 `process` shim 带有包括 `title` 在内的 Node 环境识别字段,避免 Worker 执行误入仅适用于 DOM 的分支。pack 期解析器会把名称静态可知的模块请求报告给 packer 的可达性遍历,其中包括通过 `node:module` 或 `module` 具名导入在模块作用域直接发起的 `createRequire(import.meta.url)('pkg')` 调用。保存、经 CommonJS 获取或另设基准的 `createRequire` 调用需要镜像入口种子。VFS mutation 驱动 `node:fs` 的 callback、polling 和 promise watcher;打开的 descriptor 在 rename、replacement 和 unlink 后仍保留文件身份与访问模式,只要文件名仍指向该文件,`FileHandle.stat({ bigint: true })` 报告的 device 与 inode 身份就与路径 stat 相同,`FileHandle.chmod()` 则更新打开文件身份的权限;`readable-stream` 提供文件流以及 Chokidar、readdirp 等未修改镜像包所用的流状态机。AsyncLocalStorage 经 pack 时降低注入的 snapshot/restore 面在 `await` 间携带同步栈因果。worker 不带编译器:packer 未降低的镜像在挂载时被拒。回调式 `fs.realpath.native` 别名在已挂载的 VFS 内解析路径,并支持 `util.promisify`。 +- **`lib/worker.js`(worker 束)**——装配库加本包的 Node 兼容层,合成一个自含 ES module。模块代理表(`module-proxies.ts`)是唯一平台叉口:`node:*` 内建走 VFS、隧道和浏览器原语,浏览器做不到的走结构化 stub(调用即在 console 报错并抛出),native/binary 包则替换执行后端。`node:module` 在镜像 package 根之上提供 `createRequire().resolve` 与 `.resolve.paths()`,使未修改的包无需执行目标模块即可发现 manifest。`node:util` 的 JSON 数据比较器检查可枚举的自有属性,使 `__proto__` 等记录字段的准入判定与 Node 一致。全局 `process` shim 带有包括 `title` 在内的 Node 环境识别字段,避免 Worker 执行误入仅适用于 DOM 的分支。pack 期解析器会把名称静态可知的模块请求报告给 packer 的可达性遍历,其中包括通过 `node:module` 或 `module` 具名导入在模块作用域直接发起的 `createRequire(import.meta.url)('pkg')` 调用。保存、经 CommonJS 获取或另设基准的 `createRequire` 调用需要镜像入口种子。VFS mutation 驱动 `node:fs` 的 callback、polling 和 promise watcher;打开的 descriptor 在 rename、replacement 和 unlink 后仍保留文件身份与访问模式,只要文件名仍指向该文件,`FileHandle.stat({ bigint: true })` 报告的 device 与 inode 身份就与路径 stat 相同,`FileHandle.chmod()` 则更新打开文件身份的权限;`readable-stream` 提供文件流以及 Chokidar、readdirp 等未修改镜像包所用的流状态机。AsyncLocalStorage 经 pack 时降低注入的 snapshot/restore 面在 `await` 间携带同步栈因果。worker 不带编译器:packer 未降低的镜像在挂载时被拒。回调式 `fs.realpath.native` 别名在已挂载的 VFS 内解析路径,并支持 `util.promisify`。 - **`src/shell/`(worker 自己的进程层)**——浏览器 worker 无法 fork,所以 `node:child_process` 不是 stub 而是实现:`spawn` 把命令放进它自己的 Web Worker——就是这同一个束,由首帧告诉它「你是 shell 进程」——并以 subprocess 服务消费的 `ChildProcess` 面报告结果。命令不占宿主线程,`SIGKILL` 不管它在干什么都能终止它,而它只能靠消息触达 VFS(由宿主应答这些帧)。Worker 平台 executable 在不替换 JavaScript 包、也不把具体实现耦合进 `node:child_process` 的情况下保持 Landlock 等 native 包协议;普通命令使用本包的求值器与 coreutils 命令表。语法来自 `@yarnpkg/parsers` 的 `parseShell`,而 `execSync`/`fork` 依然拒绝,因为它们需要真进程。 - **`lib/client.js`(页面半)**——启动分为相互独立的两段。`chooseWorkerHostSource({ image?, fixtureManifest? })` 可选地拥有 boot barrier 与 fixture manifest:没有 `preview-fixture` 时停在来源选择面板,合法 query 则直接选择;两条路径都返回按序排列的 overlays。`connectWorkerHost(worker, { image?, overlays? })` 仍是公开的基础运行态连接器;调用方跳过选择器时 overlay 列表为空。`apps/web` 调用这两段并提供静态打包的 Worker。开局 `init` 帧携带基础镜像与按序排列的 overlay URL,boot 载荷送达结构化 index 注入表,`applyIndexInjections` 在壳入口运行前逐行执行。脚本 preload 行只是提示,因此会被跳过:`/plugins` 资源只能经 tunnel 解析,`loadBundle` 会在首次需要时获取 combo、把仅 tunnel 可达的 sourcemap 内嵌为 Base64 data URL,再以 Blob 执行脚本。Tunnel 还暴露 fetch 形式的传输、独立文件上传载体和 API 客户端。请求帧通过结构化克隆保留 Blob 请求体,并转移 `ReadableStream` 的所有权。Host Worker 将两种请求体都逐块送入路由,因此通用文件上传不会在任何浏览器线程创建完整字节数组。 diff --git a/packages/experimental/webworker-runtime/src/node/builtin_modules/implemented/util.ts b/packages/experimental/webworker-runtime/src/node/builtin_modules/implemented/util.ts index b18d52f20e..7fc20b8b58 100644 --- a/packages/experimental/webworker-runtime/src/node/builtin_modules/implemented/util.ts +++ b/packages/experimental/webworker-runtime/src/node/builtin_modules/implemented/util.ts @@ -79,7 +79,7 @@ export function format(template: unknown, ...args: unknown[]): string { } /** - * Structural deep equality, as `isDeepStrictEqual` defines it for plain data. + * Structural deep equality over own enumerable properties, as `isDeepStrictEqual` defines it for plain data. * @param left - first value. * @param right - second value. * @returns true when both sides are structurally identical. @@ -95,7 +95,7 @@ export function isDeepStrictEqual(left: unknown, right: unknown): boolean { const leftKeys = Object.keys(left) const rightKeys = Object.keys(right) if (leftKeys.length !== rightKeys.length) return false - return leftKeys.every(key => key in right + return leftKeys.every(key => Object.hasOwn(right, key) && isDeepStrictEqual((left as Record)[key], (right as Record)[key])) /* jscpd:ignore-end */ } diff --git a/packages/experimental/webworker-runtime/tests/node/shim-diff.spec.ts b/packages/experimental/webworker-runtime/tests/node/shim-diff.spec.ts index c6f28163af..4be6aff419 100644 Binary files a/packages/experimental/webworker-runtime/tests/node/shim-diff.spec.ts and b/packages/experimental/webworker-runtime/tests/node/shim-diff.spec.ts differ diff --git a/packages/experimental/webworker-runtime/tests/vfs-example-fixture.spec.ts b/packages/experimental/webworker-runtime/tests/vfs-example-fixture.spec.ts index aaa2448d0f..b3d0c106eb 100644 --- a/packages/experimental/webworker-runtime/tests/vfs-example-fixture.spec.ts +++ b/packages/experimental/webworker-runtime/tests/vfs-example-fixture.spec.ts @@ -157,7 +157,7 @@ describe('WebWorker preview VFS example', () => { 'read', 'write', 'bash', 'glob', 'grep', 'web_search', 'todo_write', 'subagent', 'subagent_fork', ])) expect(events.some(event => event.type === 'todo/write')).toBe(true) - expect(events.some(event => event.type === 'tool/result' && event.data.message.content[0].isError === true)).toBe(true) + expect(events.some(event => event.type === 'tool/result' && event.data.message.isError === true)).toBe(true) }) it('restores one-shot and continuable child Sessions with durable descriptors', () => { diff --git a/packages/experimental/webworker-runtime/tests/vfs-example-fixture.ts b/packages/experimental/webworker-runtime/tests/vfs-example-fixture.ts index 5422fc02cb..3ba332a5e6 100644 --- a/packages/experimental/webworker-runtime/tests/vfs-example-fixture.ts +++ b/packages/experimental/webworker-runtime/tests/vfs-example-fixture.ts @@ -336,14 +336,11 @@ function mainLog(): { step: 1, message: { id: `${call.id}-result`, - role: 'user', - content: [{ - type: 'tool-result', - toolCallId: call.id, - content: [{ type: 'text', text: call.result }], - isError: call.error !== undefined, - }], + role: 'tool', + toolCallId: call.id, source: { kind: 'tool', callId: call.id }, + content: [{ type: 'text', text: call.result }], + isError: call.error !== undefined, }, ...call.meta === undefined ? {} : { meta: call.meta }, ...call.error === undefined ? {} : { error: call.error }, diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts index 04cca99a6d..7e0e16eaea 100644 --- a/packages/extensions/tool-cordis/src/api-catalog.ts +++ b/packages/extensions/tool-cordis/src/api-catalog.ts @@ -4129,7 +4129,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'AssistantMessage', - declaration: 'export interface AssistantMessage extends Message {\n readonly role: \'assistant\';\n readonly source: ModelMessageSource;\n}', + declaration: 'export interface AssistantMessage extends MessageBase {\n readonly role: \'assistant\';\n readonly source: ModelMessageSource;\n}', }, { name: 'AssistantProviderMetadata', @@ -4377,7 +4377,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'ContentBlockMap', - declaration: 'export interface ContentBlockMap {\n \'text\': TextBlock;\n \'reasoning\': ReasoningBlock;\n \'image\': ImageBlock;\n \'file\': FileBlock;\n \'tool-call\': ToolCallBlock;\n \'tool-result\': ToolResultBlock;\n}', + declaration: 'export interface ContentBlockMap {\n \'text\': TextBlock;\n \'reasoning\': ReasoningBlock;\n \'image\': ImageBlock;\n \'file\': FileBlock;\n \'tool-call\': ToolCallBlock;\n}', }, { name: 'ContentBlockType', @@ -5097,7 +5097,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'Message', - declaration: 'export interface Message {\n readonly id: MessageId;\n readonly role: \'system\' | \'user\' | \'assistant\';\n readonly content: ContentBlock[];\n readonly source: MessageSource;\n}', + declaration: 'export type Message = MessageRoleMap[keyof MessageRoleMap];', }, { name: 'MessageFeedbackDeleteRequest', @@ -5180,8 +5180,8 @@ export const TYPE_API: readonly TypeApiEntry[] = [ declaration: 'export type MessageId = Branded<\'MessageId\'>;', }, { - name: 'MessageSource', - declaration: 'export type MessageSource = MessageSourceMap[keyof MessageSourceMap];', + name: 'MessageRoleMap', + declaration: 'export interface MessageRoleMap {\n system: SystemMessage;\n user: UserMessage;\n assistant: AssistantMessage;\n tool: ToolResultMessage;\n}', }, { name: 'MessageSourceMap', @@ -6405,7 +6405,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'SubagentResult', - declaration: 'export interface SubagentResult {\n readonly output: ContentBlock[];\n readonly structured?: unknown;\n readonly diagnostic?: string;\n readonly stopReason: SubagentStopReason;\n}', + declaration: 'export interface SubagentResult {\n readonly output: readonly ContentBlock[];\n readonly structured?: unknown;\n readonly diagnostic?: string;\n readonly stopReason: SubagentStopReason;\n}', }, { name: 'SubagentRun', @@ -6413,7 +6413,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'SubagentRunEndInfo', - declaration: 'export interface SubagentRunEndInfo {\n readonly runId: SubagentRunId;\n readonly provider: string;\n readonly id: SessionId;\n readonly local: boolean;\n readonly stopReason: SubagentResult[\'stopReason\'];\n readonly lastAssistantMessage?: ContentBlock[];\n}', + declaration: 'export interface SubagentRunEndInfo {\n readonly runId: SubagentRunId;\n readonly provider: string;\n readonly id: SessionId;\n readonly local: boolean;\n readonly stopReason: SubagentResult[\'stopReason\'];\n readonly lastAssistantMessage?: readonly ContentBlock[];\n}', }, { name: 'SubagentRunId', @@ -6525,7 +6525,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'SystemMessage', - declaration: 'export interface SystemMessage extends Message {\n readonly role: \'system\';\n readonly source: MessageSourceMap[\'plugin\'];\n}', + declaration: 'export interface SystemMessage extends MessageBase {\n readonly role: \'system\';\n readonly source: MessageSourceMap[\'plugin\'];\n}', }, { name: 'SystemPrompt', @@ -6787,13 +6787,9 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'ToolResult', declaration: 'export interface ToolResult {\n content: ContentBlock[];\n isError: boolean;\n meta?: JsonValue;\n}', }, - { - name: 'ToolResultBlock', - declaration: 'export interface ToolResultBlock {\n type: \'tool-result\';\n toolCallId: ToolCallId;\n content: ContentBlock[];\n isError?: boolean;\n}', - }, { name: 'ToolResultMessage', - declaration: 'export interface ToolResultMessage extends Message {\n readonly role: \'user\';\n readonly content: [\n ToolResultBlock\n ];\n readonly source: ToolMessageSource;\n}', + declaration: 'export interface ToolResultMessage extends MessageBase {\n readonly role: \'tool\';\n readonly source: ToolMessageSource;\n readonly toolCallId: ToolCallId;\n readonly isError?: boolean;\n}', }, { name: 'ToolResultView', @@ -6937,7 +6933,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'UserMessage', - declaration: 'export interface UserMessage extends Message {\n readonly role: \'user\';\n}', + declaration: 'export interface UserMessage extends MessageBase {\n readonly role: \'user\';\n}', }, { name: 'VerifiedWebhookDelivery', diff --git a/packages/goal/goal-round-driver/src/index.ts b/packages/goal/goal-round-driver/src/index.ts index cac74fe66c..b8cffbfc29 100644 --- a/packages/goal/goal-round-driver/src/index.ts +++ b/packages/goal/goal-round-driver/src/index.ts @@ -58,7 +58,7 @@ function sameRound(source: GoalMessageSource, round: RoundIdentity): boolean { } /** Compare the complete queued record to the driver's reservation. */ -function sameQueued(content: ContentBlock[], source: MessageSource, attempt: RoundAttempt): boolean { +function sameQueued(content: readonly ContentBlock[], source: MessageSource, attempt: RoundAttempt): boolean { return isGoalRoundSource(source) && sameRound(source, attempt) && isDeepStrictEqual(content, attempt.content) } @@ -344,7 +344,7 @@ export function apply(ctx: Context): void { /** Fail closed unless the queued prompt still owns the exact live revision. */ function validReservation( state: DriverState, - content: ContentBlock[], + content: readonly ContentBlock[], source: GoalMessageSource, ): boolean { const attempt = state.attempt diff --git a/packages/guard/repeat-tool-reminder/tests/repeat-tool-reminder.spec.ts b/packages/guard/repeat-tool-reminder/tests/repeat-tool-reminder.spec.ts index 4c505d6cf0..7ce965ba25 100644 --- a/packages/guard/repeat-tool-reminder/tests/repeat-tool-reminder.spec.ts +++ b/packages/guard/repeat-tool-reminder/tests/repeat-tool-reminder.spec.ts @@ -338,8 +338,8 @@ describe('fold onto the downstream decision', () => { expect(found[2]).toEqual({ text: 'downstream-ctx', source: { kind: 'plugin', plugin: 'test' } }) // The block's feedback reached the tool result unchanged. const results = agent.session.snapshotEvents().filter((e): e is SessionEvent<'tool/result'> => e.type === 'tool/result') - expect(results.every(r => r.data.message.content[0].isError)).toBe(true) - expect(results[1]!.data.message.content[0].content).toEqual([{ type: 'text', text: 'nope' }]) + expect(results.every(r => r.data.message.isError)).toBe(true) + expect(results[1]!.data.message.content).toEqual([{ type: 'text', text: 'nope' }]) }) it('preserves a downstream canonical value replacement while folding', async () => { @@ -362,7 +362,7 @@ describe('fold onto the downstream decision', () => { expect(found).toHaveLength(1) expect(found[0]!.text).toContain('repeating the exact same tool call') const results = agent.session.snapshotEvents().filter((e): e is SessionEvent<'tool/result'> => e.type === 'tool/result') - expect(results[1]!.data.message.content[0].content).toEqual([{ type: 'text', text: 'replaced' }]) + expect(results[1]!.data.message.content).toEqual([{ type: 'text', text: 'replaced' }]) }) }) diff --git a/packages/hooks/hooks-claude-code/tests/bridge.spec.ts b/packages/hooks/hooks-claude-code/tests/bridge.spec.ts index 68f6c8319d..c5780a7490 100644 --- a/packages/hooks/hooks-claude-code/tests/bridge.spec.ts +++ b/packages/hooks/hooks-claude-code/tests/bridge.spec.ts @@ -153,8 +153,8 @@ describe('hooks-claude-code bridge — PreToolUse', () => { expect(ran).toBe(false) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('danger tool blocked'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('danger tool blocked'))).toBe(true) }) it('a PreToolUse hook whose matcher does NOT match leaves the tool alone', async () => { @@ -176,7 +176,7 @@ describe('hooks-claude-code bridge — PreToolUse', () => { expect(ran).toBe(true) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(false) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(false) }) }) @@ -198,8 +198,8 @@ describe('hooks-claude-code bridge — PostToolUse', () => { const result = events(agent).find(e => e.type === 'tool/result') // PostToolUse blocks AFTER the tool ran: the result is rewritten to isError + feedback. - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('output rejected, retry'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('output rejected, retry'))).toBe(true) }) it('a PostToolUse hook printing additionalContext attaches it after the tool result', async () => { @@ -244,8 +244,8 @@ describe('hooks-claude-code bridge — PostToolUse', () => { // No approval service is mounted, so `ask` fails closed: the tool does not run and the result is isError. expect(ran).toBe(false) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('needs approval'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('needs approval'))).toBe(true) }) }) diff --git a/packages/hooks/hooks-claude-code/tests/coverage-cases.ts b/packages/hooks/hooks-claude-code/tests/coverage-cases.ts index a05812666d..cdadb753ca 100644 --- a/packages/hooks/hooks-claude-code/tests/coverage-cases.ts +++ b/packages/hooks/hooks-claude-code/tests/coverage-cases.ts @@ -278,7 +278,7 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('blocked by PreToolUse hook'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('blocked by PreToolUse hook'))).toBe(true) }) it('PostToolUse deny with EMPTY stderr + no context uses the default feedback', async () => { @@ -292,7 +292,7 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('blocked by PostToolUse hook'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('blocked by PostToolUse hook'))).toBe(true) }) it('SubagentStop with no registered child runs the hook cleanly (fire-and-forget)', async () => { @@ -338,7 +338,7 @@ export function defineCoverageCases(group: CoverageGroup): void { await waitForIdle(ctx, agent) // ask (no reason) → degrades to deny with the registry's generic message. expect(ran).toBe(false) - expect(events(agent).some(e => e.type === 'tool/result' && e.data.message.content[0].isError)).toBe(true) + expect(events(agent).some(e => e.type === 'tool/result' && e.data.message.isError)).toBe(true) }) it('a recorded clean exit-0 hook with no stderr omits exitCode-extra/stderrSummary fields', async () => { @@ -408,7 +408,7 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) }) }) @@ -444,8 +444,8 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('bad'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('bad'))).toBe(true) // additionalContext also injected (the block + context arm). expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('context too')))).toBe(true) }) @@ -559,7 +559,7 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text === 'rewritten-result')).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text === 'rewritten-result')).toBe(true) expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('bridge-note')))).toBe(true) }) @@ -603,8 +603,8 @@ export function defineCoverageCases(group: CoverageGroup): void { agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })) await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('downstream-block'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('downstream-block'))).toBe(true) // the bridge's context still landed (folded onto the block) expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('bridge-note')))).toBe(true) }) diff --git a/packages/hooks/hooks-codex/tests/bridge.spec.ts b/packages/hooks/hooks-codex/tests/bridge.spec.ts index a910f00e9b..67047d8ba7 100644 --- a/packages/hooks/hooks-codex/tests/bridge.spec.ts +++ b/packages/hooks/hooks-codex/tests/bridge.spec.ts @@ -104,8 +104,8 @@ describe('hooks-codex bridge', () => { expect(ran).toBe(false) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('codex blocked it'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('codex blocked it'))).toBe(true) expect(events(agent).some(e => e.type === 'hook/invoked' && e.data.dialect === 'codex' && e.data.point === 'PreToolUse')).toBe(true) }) diff --git a/packages/hooks/hooks-codex/tests/coverage-cases.ts b/packages/hooks/hooks-codex/tests/coverage-cases.ts index 6eebc5e7c1..508f674ff2 100644 --- a/packages/hooks/hooks-codex/tests/coverage-cases.ts +++ b/packages/hooks/hooks-codex/tests/coverage-cases.ts @@ -161,7 +161,7 @@ export function defineCoverageCases(groups: CoverageGroup | readonly CoverageGro const agent = await ctx.agentLoop.create(SessionId('a1'), { provider: 'mock', model: 'mock' }) agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })); await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text === 'rewritten-result')).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text === 'rewritten-result')).toBe(true) expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('bridge-note')))).toBe(true) }) @@ -198,8 +198,8 @@ export function defineCoverageCases(groups: CoverageGroup | readonly CoverageGro const agent = await ctx.agentLoop.create(SessionId('a1'), { provider: 'mock', model: 'mock' }) agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })); await waitForIdle(ctx, agent) const result = events(agent).find(e => e.type === 'tool/result') - expect(result?.type === 'tool/result' && result.data.message.content[0].isError).toBe(true) - expect(result?.type === 'tool/result' && result.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('downstream-block'))).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.isError).toBe(true) + expect(result?.type === 'tool/result' && result.data.message.content.some(b => b.type === 'text' && b.text.includes('downstream-block'))).toBe(true) expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('bridge-note')))).toBe(true) }, 10_000) // The real hook subprocess needs startup and teardown headroom under full-suite contention. @@ -224,8 +224,8 @@ export function defineCoverageCases(groups: CoverageGroup | readonly CoverageGro const agent = await ctx.agentLoop.create(SessionId('a1'), { provider: 'mock', model: 'mock' }) agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })); await waitForIdle(ctx, agent) const r = events(agent).find(e => e.type === 'tool/result') - expect(r?.type === 'tool/result' && r.data.message.content[0].isError).toBe(true) - expect(r?.type === 'tool/result' && r.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('blocked by PostToolUse hook'))).toBe(true) + expect(r?.type === 'tool/result' && r.data.message.isError).toBe(true) + expect(r?.type === 'tool/result' && r.data.message.content.some(b => b.type === 'text' && b.text.includes('blocked by PostToolUse hook'))).toBe(true) }) it('PostToolUse additionalContext (clean exit) is attached after the result', async () => { @@ -426,7 +426,7 @@ export function defineCoverageCases(groups: CoverageGroup | readonly CoverageGro const agent = await ctx.agentLoop.create(SessionId('a1'), { provider: 'mock', model: 'mock' }) agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })); await waitForIdle(ctx, agent) const r = events(agent).find(e => e.type === 'tool/result') - expect(r?.type === 'tool/result' && r.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('blocked by PreToolUse hook'))).toBe(true) + expect(r?.type === 'tool/result' && r.data.message.content.some(b => b.type === 'text' && b.text.includes('blocked by PreToolUse hook'))).toBe(true) }) it('PostToolUse block AND additionalContext are surfaced together', async () => { @@ -438,8 +438,8 @@ export function defineCoverageCases(groups: CoverageGroup | readonly CoverageGro const agent = await ctx.agentLoop.create(SessionId('a1'), { provider: 'mock', model: 'mock' }) agent.followup(createUserMessage({ content: [{ type: 'text', text: 'go' }], source: { kind: 'user' } })); await waitForIdle(ctx, agent) const r = events(agent).find(e => e.type === 'tool/result') - expect(r?.type === 'tool/result' && r.data.message.content[0].isError).toBe(true) - expect(r?.type === 'tool/result' && r.data.message.content[0].content.some(b => b.type === 'text' && b.text.includes('bad'))).toBe(true) + expect(r?.type === 'tool/result' && r.data.message.isError).toBe(true) + expect(r?.type === 'tool/result' && r.data.message.content.some(b => b.type === 'text' && b.text.includes('bad'))).toBe(true) expect(events(agent).some(e => e.type === 'user/message' && e.data.source.kind !== 'user' && e.data.content.some(b => b.type === 'text' && b.text.includes('ctx too')))).toBe(true) }) diff --git a/packages/llm/llm-deepseek/src/protocols/chat-completions/adapter.ts b/packages/llm/llm-deepseek/src/protocols/chat-completions/adapter.ts index 3d2e50ea45..77d2bf6ca5 100644 --- a/packages/llm/llm-deepseek/src/protocols/chat-completions/adapter.ts +++ b/packages/llm/llm-deepseek/src/protocols/chat-completions/adapter.ts @@ -50,7 +50,6 @@ function collectImageRefs( ): void { for (const block of content) { if (block.type === 'image' && block.offloaded !== true) refs.set(block.attachment.attachmentId, block.attachment) - else if (block.type === 'tool-result') collectImageRefs(block.content, refs) } } diff --git a/packages/llm/llm-deepseek/src/protocols/chat-completions/serialize.ts b/packages/llm/llm-deepseek/src/protocols/chat-completions/serialize.ts index 62e79bf94c..d20042b848 100644 --- a/packages/llm/llm-deepseek/src/protocols/chat-completions/serialize.ts +++ b/packages/llm/llm-deepseek/src/protocols/chat-completions/serialize.ts @@ -1,8 +1,9 @@ /** * Serialize harness messages into DeepSeek chat completions. Text-only * requests retain string user content; the image path resolves durable - * attachments into ordered file-id or inline parts. Tool-result images follow their - * string-only tool messages in a separate user message. + * attachments into ordered file-id or inline parts. Tool-role messages map to + * string-only `tool` wire messages; their image parts follow in one shared + * trailing user message. * @module dsh-llm-deepseek/serialize */ @@ -91,8 +92,8 @@ function resolveThinking(options: GenerateOptions, defaults: RequestDefaults): R return defaults.thinking === undefined ? {} : { thinking: defaults.thinking } } -/** Join the text blocks of a message (used for user/tool-result content). */ -function flattenText(blocks: ContentBlock[]): string { +/** Join the text blocks of a message (used for user and tool-role content). */ +function flattenText(blocks: readonly ContentBlock[]): string { return blocks .filter(block => block.type === 'text') .map(block => block.text) @@ -109,7 +110,7 @@ function assertTextOnly(blocks: readonly ContentBlock[]): void { /** Reject roles whose DeepSeek history format cannot carry image input. */ function assertSupportedImageRoles(messages: readonly Message[]): void { for (const message of messages) { - if (message.role !== 'user' && contentHasImage(message.content)) { + if (message.role !== 'user' && message.role !== 'tool' && contentHasImage(message.content)) { throw new LlmError( `The DeepSeek chat-completions adapter cannot represent image content in a ${message.role} message.`, 'UNSUPPORTED_CONTENT', @@ -154,7 +155,7 @@ async function imageParts( return [imageHandle(block.attachment, version, images.resolveImageAccess, precededByContent), image] } -/** Convert user or nested tool-result blocks into ordered wire parts. */ +/** Convert one message's content blocks into ordered wire parts. */ async function contentParts( blocks: readonly ContentBlock[], images: ImageSerializationOptions, @@ -171,9 +172,6 @@ async function contentParts( nextImage.value += 1 parts.push(...await imageParts(block, images, { message, image: nextImage.value }, parts.length > 0)) break - case 'tool-result': - parts.push(...await contentParts(block.content, images, message, nextImage)) - break default: // Other merge-extensible blocks are not DeepSeek user-input vocabulary. break @@ -229,12 +227,11 @@ function serializeAssistant(message: Message): WireMessage { } /** - * Serialize the conversation. `tool-result` blocks become standalone - * `{role: 'tool'}` messages; the harness puts each tool result in its own - * user-role message, so a mixed user message contributes its text first and - * its tool results as separate wire messages after. + * Serialize the conversation. Tool-role messages map one-to-one onto + * `{role: 'tool'}` wire messages; user messages contribute their text as a + * plain `{role: 'user'}` wire message. * @param messages - the harness conversation, in order. - * @returns the wire messages; order preserved, each tool result expanded into its own entry. + * @returns the wire messages; order preserved. */ export function serializeMessages(messages: Message[]): WireMessage[] { const wire: WireMessage[] = [] @@ -248,29 +245,25 @@ export function serializeMessages(messages: Message[]): WireMessage[] { wire.push(serializeAssistant(message)) continue } - // user role: tool results ride in user messages in the harness - // vocabulary, but DeepSeek wants them as role:'tool' messages. - const toolResults = message.content.filter(block => block.type === 'tool-result') - const text = flattenText(message.content) - if (text.length > 0 || toolResults.length === 0) { - wire.push({ role: 'user', content: text }) - } - for (const result of toolResults) { + if (message.role === 'tool') { wire.push({ role: 'tool', - tool_call_id: result.toolCallId, + tool_call_id: message.toolCallId, // Empty tool output still needs SOME content on the wire. - content: flattenText(result.content) || '(no output)', + content: flattenText(message.content) || '(no output)', }) + continue } + // User text always lands on the wire, including empty ones. + wire.push({ role: 'user', content: flattenText(message.content) }) } return wire } /** * Serialize image-capable history after resolving durable attachments. - * Consecutive tool results keep string `tool` messages and share one following - * user message containing their images. + * Consecutive tool messages keep string `tool` wire messages and share one + * following user message containing their images. * @param messages - request history whose offloaded occurrences are already placeholder text. * @param images - prepared request versions, one provider representation, and its budget. * @returns ordered DeepSeek wire messages. @@ -303,30 +296,23 @@ export async function serializeMessagesWithImages( wire.push(serializeAssistant(message)) continue } - - const regular = message.content.filter(block => block.type !== 'tool-result') - const toolResults = message.content.filter((block): block is Extract => ( - block.type === 'tool-result' - )) - const content = userContent(await contentParts(regular, images, messageIndex + 1, nextImage)) - if (content.length > 0 || toolResults.length === 0) { - flushToolImages() - wire.push({ - role: 'user', - content, - }) - } - for (const result of toolResults) { - const parts = await contentParts(result.content, images, messageIndex + 1, nextImage) + if (message.role === 'tool') { + const parts = await contentParts(message.content, images, messageIndex + 1, nextImage) const imageParts = parts.filter((part): part is WireImageContentPart => part.type !== 'text') const text = parts.filter(part => part.type === 'text').map(part => part.text).join('') wire.push({ role: 'tool', - tool_call_id: result.toolCallId, + tool_call_id: message.toolCallId, content: text || '(no output)', }) pendingToolImages.push(...imageParts) + continue } + // User text serializes as a user message, including empty content. This + // keeps the image-capable route aligned with the text-only route. + const content = userContent(await contentParts(message.content, images, messageIndex + 1, nextImage)) + flushToolImages() + wire.push({ role: 'user', content }) } flushToolImages() return wire diff --git a/packages/llm/llm-deepseek/src/protocols/messages/images.ts b/packages/llm/llm-deepseek/src/protocols/messages/images.ts index 64b0933b12..a00354f69a 100644 --- a/packages/llm/llm-deepseek/src/protocols/messages/images.ts +++ b/packages/llm/llm-deepseek/src/protocols/messages/images.ts @@ -23,7 +23,6 @@ function bounds(connection: Connection, representation: 'raw' | 'base64') { function* imageRefs(blocks: readonly ContentBlock[]): Generator { for (const block of blocks) { if (block.type === 'image') yield block.attachment - else if (block.type === 'tool-result') yield* imageRefs(block.content) } } @@ -47,7 +46,7 @@ export async function prepareImages( if (model?.inputModalities?.includes('image') !== true || attachments === undefined) { throw new LlmError('DeepSeek Messages image input requires a vision model and attachment service', 'UNSUPPORTED_CONTENT') } - if (messages.some(message => message.role !== 'user' && contentHasImage(message.content))) { + if (messages.some(message => message.role !== 'user' && message.role !== 'tool' && contentHasImage(message.content))) { throw new LlmError('DeepSeek Messages supports images only in user messages and tool results', 'UNSUPPORTED_CONTENT') } for (const message of messages) { diff --git a/packages/llm/llm-deepseek/src/protocols/messages/serialize.ts b/packages/llm/llm-deepseek/src/protocols/messages/serialize.ts index 41d3f3bb4a..a50361cf0a 100644 --- a/packages/llm/llm-deepseek/src/protocols/messages/serialize.ts +++ b/packages/llm/llm-deepseek/src/protocols/messages/serialize.ts @@ -97,14 +97,16 @@ export function serialize( continue } if (message.role === 'assistant') flushSystemUpdates() - const content: WireBlock[] = message.role === 'assistant' ? assistant(message, options.model, onReplayDegrade) : message.content.flatMap((block): WireBlock[] => { - if (block.type !== 'tool-result') return input([block]) - return [{ type: 'tool_result', tool_use_id: block.toolCallId, content: input(block.content), ...block.isError === undefined ? {} : { is_error: block.isError } }] - }) + const content: WireBlock[] = message.role === 'assistant' + ? assistant(message, options.model, onReplayDegrade) + : message.role === 'tool' + ? [{ type: 'tool_result', tool_use_id: message.toolCallId, content: input(message.content), ...message.isError === undefined ? {} : { is_error: message.isError } }] + : message.content.flatMap((block): WireBlock[] => input([block])) if (message.role === 'user' && content.length === 0) continue + const wireRole = message.role === 'tool' ? 'user' : message.role const previous = messages.at(-1) - if (previous?.role === message.role) previous.content.push(...content) - else messages.push({ role: message.role, content }) + if (previous?.role === wireRole) previous.content.push(...content) + else messages.push({ role: wireRole, content }) } flushSystemUpdates() let pending = new Set() diff --git a/packages/llm/llm-deepseek/tests/adapter.e2e.ts b/packages/llm/llm-deepseek/tests/adapter.e2e.ts index 6270d385ca..cc8a564027 100644 --- a/packages/llm/llm-deepseek/tests/adapter.e2e.ts +++ b/packages/llm/llm-deepseek/tests/adapter.e2e.ts @@ -7,7 +7,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { Context } from '@deepseek-ai/cordis' import Loader from '@deepseek-ai/cordis-plugin-loader' import AgentRegistry from '@deepseek-ai/dsh-agent' -import LlmRuntime, { createUserMessage, ToolCallId, ReasoningEffortId, createMessage, createSystemMessage } from '@deepseek-ai/dsh-llm' +import LlmRuntime, { createToolResultMessage, createUserMessage, ToolCallId, ReasoningEffortId, createMessage, createSystemMessage } from '@deepseek-ai/dsh-llm' import type { Message, ToolSchema } from '@deepseek-ai/dsh-llm' import AttachmentStore, { AttachmentId, ImageVariantId } from '@deepseek-ai/dsh-attachment' import LocalAttachments from '@deepseek-ai/dsh-attachment-local' @@ -209,7 +209,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('llm-deepseek e2e (real API)', () { type: 'text', text: 'Briefly describe this image.' }, { type: 'image', attachment: attachments.ref }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'user' }, })], maxTokens: 100, }) @@ -335,15 +335,12 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('llm-deepseek e2e (real API)', () ...ask('What is the weather in Paris right now? Use the get_weather tool.'), createMessage({ role: 'assistant', content: first.message.content, - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId(call!.id), - content: [{ type: 'text', text: 'Sunny, 22°C' }], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId(call!.id), + content: [{ type: 'text', text: 'Sunny, 22°C' }], + isError: false, }), ], tools: [weatherTool], @@ -418,7 +415,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('llm-deepseek e2e (real API)', () expect(reusableTokens).toBeLessThanOrEqual(initialTokens) expect(reusableTokens).toBeGreaterThan(0) const assistant = createMessage({ - role: 'assistant', content: first.message.content, source: { kind: 'plugin', plugin: 'test' }, + role: 'assistant', content: first.message.content, source: first.message.source, }) const updated = await assemble(ctx, { diff --git a/packages/llm/llm-deepseek/tests/adapter.spec.ts b/packages/llm/llm-deepseek/tests/adapter.spec.ts index 767c0d5c73..3951cd1ff3 100644 --- a/packages/llm/llm-deepseek/tests/adapter.spec.ts +++ b/packages/llm/llm-deepseek/tests/adapter.spec.ts @@ -8,6 +8,7 @@ import type { AttachmentStore, ImageAttachmentRef, RequestImageAttachment } from import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment' import LlmRuntime, { ToolCallId, createUserMessage, CONTEXT_WINDOW_EXCEEDED_CODE, + createToolResultMessage, LlmError, ProviderRequestId, QUOTA_EXCEEDED_CODE, @@ -348,7 +349,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-pro', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) expect(result.message.content).toEqual([{ type: 'text', text: 'hello' }]) @@ -392,7 +393,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'text', text: 'describe ' }, { type: 'image', attachment: imageRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -438,7 +439,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: imageRef }, { type: 'image', attachment: secondRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -464,7 +465,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: Array.from({ length: 21 }, () => ({ type: 'image' as const, attachment: imageRef })), - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'IMAGE_OFFLOAD_REQUIRED', message: expect.stringContaining('11 more') as string }) expect(server.requests).toHaveLength(0) @@ -493,7 +494,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: imageRef }, { type: 'image', attachment: secondRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -525,7 +526,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) await started.promise @@ -557,7 +558,7 @@ describe('DeepSeekAdapter against a mock server', () => { signal: controller.signal, messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) await started.promise @@ -586,7 +587,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'SERVER', message: 'chat unavailable' }) @@ -616,7 +617,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: old, offloaded: true }, { type: 'image', attachment: recent }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -658,13 +659,10 @@ describe('DeepSeekAdapter against a mock server', () => { }, ], }, attachmentMocks.store) - const nested = createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('image-result'), - content: [{ type: 'image', attachment: imageRef }], - }], - source: { kind: 'plugin', plugin: 'test' }, + const nested = createToolResultMessage({ + callId: ToolCallId('image-result'), + content: [{ type: 'image', attachment: imageRef }], + isError: false, }) await drain(adapter.stream({ provider: 'deepseek-official', model: 'vision-low', messages: [nested] })) @@ -731,7 +729,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) } catch (error: unknown) { @@ -763,7 +761,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ message: expect.stringContaining(`normalized image "${imageRef.attachmentId}"`) as string, @@ -799,7 +797,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: imageRef }, { type: 'image', attachment: secondRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'INVALID_REQUEST', @@ -872,7 +870,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -912,7 +910,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: imageRef }, { type: 'image', attachment: secondRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -969,7 +967,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: secondRef }, { type: 'image', attachment: thirdRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -1019,7 +1017,7 @@ describe('DeepSeekAdapter against a mock server', () => { { type: 'image', attachment: imageRef }, { type: 'image', attachment: secondRef }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) @@ -1046,7 +1044,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'INVALID_REQUEST', message: 'file_id file-api-1 expired' }) expect(server.requests).toHaveLength(2) @@ -1072,7 +1070,7 @@ describe('DeepSeekAdapter against a mock server', () => { model, messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) expect(resolveApiKey).not.toHaveBeenCalled() @@ -1100,7 +1098,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: imageRef }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }))).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) expect(resolveApiKey).not.toHaveBeenCalled() @@ -1117,7 +1115,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })) { kinds.push(chunk.type) @@ -1133,7 +1131,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], sessionId: SessionId('child-session'), }) @@ -1150,7 +1148,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], purpose: 'compaction', }) @@ -1170,7 +1168,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) await assemble(ctx,{ @@ -1178,7 +1176,7 @@ describe('DeepSeekAdapter against a mock server', () => { reasoningEffort: ReasoningEffortId('off'), messages: [createUserMessage({ content: [{ type: 'text', text: 'hi again' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) await assemble(ctx,{ @@ -1186,7 +1184,7 @@ describe('DeepSeekAdapter against a mock server', () => { reasoningEffort: ReasoningEffortId('max'), messages: [createUserMessage({ content: [{ type: 'text', text: 'one more time' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) expect(server.requests[0]).toMatchObject({ @@ -1225,7 +1223,7 @@ describe('DeepSeekAdapter against a mock server', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) expect(server.requests[0]).toMatchObject({ @@ -1254,7 +1252,7 @@ describe('DeepSeekAdapter against a mock server', () => { reasoningEffort: ReasoningEffortId('high'), messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) expect(result.finish).toMatchObject({ @@ -1276,7 +1274,7 @@ describe('DeepSeekAdapter against a mock server', () => { reasoningEffort: ReasoningEffortId(effort), messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) await expect(async () => { diff --git a/packages/llm/llm-deepseek/tests/assemble.ts b/packages/llm/llm-deepseek/tests/assemble.ts index 2ed51d0f3d..20770fca7d 100644 --- a/packages/llm/llm-deepseek/tests/assemble.ts +++ b/packages/llm/llm-deepseek/tests/assemble.ts @@ -7,10 +7,10 @@ import { BlockAssembler } from '@deepseek-ai/dsh-llm' import type { Context } from '@deepseek-ai/cordis' -import type { FinishReason, GenerateOptions, Message, TokenUsage } from '@deepseek-ai/dsh-llm' +import type { AssistantMessage, FinishReason, GenerateOptions, TokenUsage } from '@deepseek-ai/dsh-llm' export interface AssembledResult { - message: Message + message: AssistantMessage usage?: TokenUsage finish: FinishReason } @@ -21,7 +21,6 @@ export async function assemble(ctx: Context, options: Omit { const records = fixture.trim().split('\n').map(line => JSON.parse(line) as { type: string; data: { message?: Message } }) const assistant = records.find(record => record.type === 'assistant/message')!.data.message! if (assistant.source.kind === 'model') assistant.source.provider = 'deepseek-official' - const result = records.find(record => record.type === 'tool/result')!.data.message! + // The released v2 row still wraps its tool result inside a user message. + const released = records.find(record => record.type === 'tool/result')!.data.message! as unknown as { + readonly content: readonly { + readonly type: string + readonly toolCallId: ToolCallId + readonly content: readonly ContentBlock[] + readonly isError?: boolean + }[] + } + const releasedBlock = released.content[0]! + const result = createToolResultMessage({ + callId: releasedBlock.toolCallId, content: [...releasedBlock.content], isError: releasedBlock.isError === true, + }) const saved = JSON.stringify([assistant, result]) const response = await assemble(ctx.llm.stream(options({ messages: [user(), assistant, result] }))) expect(response.assembler.finish.kind).toBe('stop') diff --git a/packages/llm/llm-deepseek/tests/messages/files.spec.ts b/packages/llm/llm-deepseek/tests/messages/files.spec.ts index 1b5ee31941..e4f1a9060e 100644 --- a/packages/llm/llm-deepseek/tests/messages/files.spec.ts +++ b/packages/llm/llm-deepseek/tests/messages/files.spec.ts @@ -174,11 +174,11 @@ describe('Messages Files requests', () => { const prepared = await prepareImages(messages, resolveAdapterOptions({}), 'text-model', undefined, () => ({ readonlyPath: '/workspace/image.png' }), new AbortController().signal) expect(prepared.versions.size).toBe(0) - expect(prepared.messages[0]?.content).toMatchObject([{ type: 'tool-result', content: [ + expect(prepared.messages[0]?.content).toMatchObject([ { type: 'text', text: expect.stringContaining('image omitted to fit request image limits') as string }, - ] }]) + ]) expect(JSON.stringify(prepared.messages)).toContain('/workspace/image.png') - expect(messages[0]?.content).toMatchObject([{ type: 'tool-result', content: [{ type: 'image', offloaded: true }] }]) + expect(messages[0]?.content).toMatchObject([{ type: 'image', offloaded: true }]) }) it('falls back when the Files deadline expires but never converts caller cancellation into another request', async () => { diff --git a/packages/llm/llm-deepseek/tests/messages/serialize.spec.ts b/packages/llm/llm-deepseek/tests/messages/serialize.spec.ts index eb1c6bccdf..817f7ed8ea 100644 --- a/packages/llm/llm-deepseek/tests/messages/serialize.spec.ts +++ b/packages/llm/llm-deepseek/tests/messages/serialize.spec.ts @@ -115,7 +115,7 @@ describe('Messages request conversion', () => { it('preserves empty results without inventing model-visible output', () => { const response = body([user(), assistant([call()]), result('a', [])]) expect(response.messages[2]?.content[0]).toMatchObject({ content: [] }) - const minimal = createMessage({ role: 'user', source: { kind: 'user' }, content: [{ type: 'tool-result', toolCallId: ToolCallId('a'), content: [{ type: 'text', text: '' }] }] }) + const { isError: _isError, ...minimal } = createToolResultMessage({ callId: ToolCallId('a'), content: [{ type: 'text', text: '' }], isError: false }) expect(body([assistant([call()]), minimal]).messages[1]?.content[0]).toEqual({ type: 'tool_result', tool_use_id: 'a', content: [] }) }) @@ -370,14 +370,14 @@ describe('Messages images', () => { }) const history = [result('a', [image, image])] const prepared = await prepareImages(history, config, model, attachments, access, signal) - expect(prepared.messages[0]?.content[0]).toMatchObject({ content: [image, image] }) + expect(prepared.messages[0]?.content).toMatchObject([image, image]) expect(() => inlineImages(prepared.messages, prepared.versions, config)).toThrow(expect.objectContaining({ failure: expect.objectContaining({ code: 'IMAGE_OFFLOAD_REQUIRED', offloadImages: 1 }) as unknown, })) const offloaded: ImageBlock = { ...image, offloaded: true } const retry = await prepareImages([result('a', [offloaded, image])], config, model, attachments, access, signal) - expect(inlineImages(retry.messages, retry.versions, config)[0]?.content[0]).toMatchObject({ content: [{ type: 'text' }, { type: 'image' }] }) - expect(history[0]?.content[0]).toMatchObject({ content: [image, image] }) + expect(inlineImages(retry.messages, retry.versions, config)[0]?.content).toMatchObject([{ type: 'text' }, { type: 'image' }]) + expect(history[0]?.content).toMatchObject([image, image]) expect(imagePricing(config, model, access).priceImages([image, image]).map(entry => entry.visualTokens)) .toEqual([expect.any(Number), expect.any(Number)]) const large = { readImageRequest: async () => ({ ...version, bytes: 30, data: new Uint8Array(30) }) } as unknown as AttachmentStore @@ -393,6 +393,7 @@ describe('Messages images', () => { await expect(prepareImages([assistant([image])], connection, model, attachments, access, signal)).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) expect(() => body([result('a', [image])])).toThrow(/image/) expect(() => body([assistant([image])])).toThrow(/assistant/) + // @ts-expect-error -- malformed provider input can carry a retired nested result block. expect(() => body([result('a', [{ type: 'tool-result', toolCallId: ToolCallId('nested'), content: [] }])])) .toThrow(/user\/tool-result content tool-result/) expect(() => serialize(options({ model }), connection, [result('a', [image])], new Map([[ref.attachmentId, version]]), access, undefined, new Map())) diff --git a/packages/llm/llm-deepseek/tests/serialize.spec.ts b/packages/llm/llm-deepseek/tests/serialize.spec.ts index 25cbbbbb49..59ec241f40 100644 --- a/packages/llm/llm-deepseek/tests/serialize.spec.ts +++ b/packages/llm/llm-deepseek/tests/serialize.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import { AttachmentId, ImageVariantId } from '@deepseek-ai/dsh-attachment' import type { ImageAttachmentRef, ImageMediaType, RequestImageAttachment } from '@deepseek-ai/dsh-attachment' -import { createUserMessage, ToolCallId, ReasoningEffortId, createMessage } from '@deepseek-ai/dsh-llm' +import { createToolResultMessage, createUserMessage, ToolCallId, ReasoningEffortId, createMessage } from '@deepseek-ai/dsh-llm' import type { ContentBlock, GenerateOptions, Message } from '@deepseek-ai/dsh-llm' import { serializeMessages, @@ -83,7 +83,7 @@ describe('serializeMessages', () => { const wire = serializeMessages([ createUserMessage({ content: [{ type: 'text', text: 'hello ' }, { type: 'text', text: 'world' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ]) expect(wire).toEqual([{ role: 'user', content: 'hello world' }]) @@ -107,7 +107,7 @@ describe('serializeMessages', () => { { type: 'reasoning', text: 'thinking…' }, { type: 'text', text: 'answer' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ]) // A gateway that re-encodes the conversation for another vendor recovers @@ -124,7 +124,7 @@ describe('serializeMessages', () => { { type: 'reasoning', text: 'I should check the weather.' }, { type: 'tool-call', id: ToolCallId('call-1'), name: 'get_weather', arguments: '{"city":"Paris"}' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ]) expect(wire).toEqual([{ @@ -145,46 +145,42 @@ describe('serializeMessages', () => { { type: 'tool-call', id: ToolCallId('a'), name: 'one', arguments: '{}' }, { type: 'tool-call', id: ToolCallId('b'), name: 'two', arguments: '{}' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ]) const assistant = wire[0] as { tool_calls: { id: string }[] } expect(assistant.tool_calls.map(call => call.id)).toEqual(['a', 'b']) }) - it('turns tool results into role:tool messages', () => { + it('turns tool messages into role:tool wire messages', () => { const wire = serializeMessages([ - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('call-1'), - content: [{ type: 'text', text: 'Sunny 22C' }], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId('call-1'), + content: [{ type: 'text', text: 'Sunny 22C' }], + isError: false, }), ]) expect(wire).toEqual([{ role: 'tool', tool_call_id: 'call-1', content: 'Sunny 22C' }]) }) - it('sends a sentinel for empty tool-result content', () => { + it('sends a sentinel for empty tool content', () => { const wire = serializeMessages([ - createUserMessage({ - content: [{ type: 'tool-result', toolCallId: ToolCallId('call-1'), content: [] }], - source: { kind: 'plugin', plugin: 'test' }, - }), + createToolResultMessage({ callId: ToolCallId('call-1'), content: [], isError: false }), ]) expect(wire).toEqual([{ role: 'tool', tool_call_id: 'call-1', content: '(no output)' }]) }) - it('splits mixed user text + tool results into separate wire messages', () => { + it('keeps user text and tool messages as separate wire messages', () => { const wire = serializeMessages([ createUserMessage({ - content: [ - { type: 'text', text: 'context note' }, - { type: 'tool-result', toolCallId: ToolCallId('call-1'), content: [{ type: 'text', text: 'ok' }] }, - ], + content: [{ type: 'text', text: 'context note' }], source: { kind: 'plugin', plugin: 'test' }, }), + createToolResultMessage({ + callId: ToolCallId('call-1'), + content: [{ type: 'text', text: 'ok' }], + isError: false, + }), ]) expect(wire).toEqual([ { role: 'user', content: 'context note' }, @@ -199,7 +195,7 @@ describe('serializeMessages', () => { { type: 'chart', data: 'x' } as unknown as ContentBlock, { type: 'text', text: 'see chart' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ]) expect(wire).toEqual([{ role: 'user', content: 'see chart' }]) @@ -376,7 +372,7 @@ describe('image serialization', () => { { type: 'image', attachment: ref }, { type: 'text', text: 'after' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), imageOptions([ref], resolveFileId)) @@ -402,7 +398,7 @@ describe('image serialization', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), inlineImageOptions([ref])) @@ -421,7 +417,7 @@ describe('image serialization', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), imageOptions([ref])) @@ -448,7 +444,7 @@ describe('image serialization', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), images) @@ -473,24 +469,18 @@ describe('image serialization', () => { it('keeps tool content textual and groups consecutive tool-result images afterward', async () => { const messages = [ - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('first'), - content: [{ type: 'image', attachment: imageRef() }], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId('first'), + content: [{ type: 'image', attachment: imageRef() }], + isError: false, }), - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('second'), - content: [ - { type: 'text', text: 'caption' }, - { type: 'image', attachment: imageRef('image/jpeg') }, - ], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId('second'), + content: [ + { type: 'text', text: 'caption' }, + { type: 'image', attachment: imageRef('image/jpeg') }, + ], + isError: false, }), ] @@ -521,41 +511,37 @@ describe('image serialization', () => { ]) }) - it('does not emit an empty user message for ignored content beside a tool result', async () => { - const messages = [createUserMessage({ - content: [ - { type: 'text', text: '' }, - { type: 'chart', data: 'ignored' } as unknown as ContentBlock, - { - type: 'tool-result', - toolCallId: ToolCallId('result'), - content: [{ type: 'text', text: 'ok' }], - }, - ], - source: { kind: 'plugin', plugin: 'test' }, - })] + it('keeps an empty user message for ignored content beside a tool message', async () => { + const messages = [ + createUserMessage({ + content: [ + { type: 'text', text: '' }, + { type: 'chart', data: 'ignored' } as unknown as ContentBlock, + ], + source: { kind: 'plugin', plugin: 'test' }, + }), + createToolResultMessage({ + callId: ToolCallId('result'), + content: [{ type: 'text', text: 'ok' }], + isError: false, + }), + ] await expect(serializeMessagesWithImages(messages, imageOptions([], fileResolver()))).resolves.toEqual([ + { role: 'user', content: '' }, { role: 'tool', tool_call_id: 'result', content: 'ok' }, ]) }) - it('recursively converts nested tool-result content and preserves the empty fallback', async () => { - const messages = [createUserMessage({ - content: [ - { - type: 'tool-result', - toolCallId: ToolCallId('nested'), - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('inner'), - content: [{ type: 'text', text: 'inside' }], - }], - }, - { type: 'tool-result', toolCallId: ToolCallId('empty'), content: [] }, - ], - source: { kind: 'plugin', plugin: 'test' }, - })] + it('converts consecutive tool messages and preserves the empty fallback', async () => { + const messages = [ + createToolResultMessage({ + callId: ToolCallId('nested'), + content: [{ type: 'text', text: 'inside' }], + isError: false, + }), + createToolResultMessage({ callId: ToolCallId('empty'), content: [], isError: false }), + ] await expect(serializeMessagesWithImages(messages, imageOptions([], fileResolver()))).resolves.toEqual([ { role: 'tool', tool_call_id: 'nested', content: 'inside' }, @@ -564,13 +550,10 @@ describe('image serialization', () => { }) it('flushes tool-result images before system and assistant history', async () => { - const imageResult = (id: string) => createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId(id), - content: [{ type: 'image', attachment: imageRef() }], - }], - source: { kind: 'plugin' as const, plugin: 'test' }, + const imageResult = (id: string) => createToolResultMessage({ + callId: ToolCallId(id), + content: [{ type: 'image', attachment: imageRef() }], + isError: false, }) const messages = [ imageResult('before-system'), @@ -583,7 +566,7 @@ describe('image serialization', () => { createMessage({ role: 'assistant', content: [{ type: 'text', text: 'assistant history' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, }), ] @@ -621,7 +604,7 @@ describe('image serialization', () => { { type: 'image', attachment: png, offloaded: true }, { type: 'image', attachment: jpeg }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), images) @@ -647,7 +630,7 @@ describe('image serialization', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: Array.from({ length: 21 }, () => ({ type: 'image' as const, attachment: ref })), - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), inlineImageOptions([ref], 80, 40))).rejects.toMatchObject({ code: 'IMAGE_OFFLOAD_REQUIRED', @@ -677,18 +660,18 @@ describe('image serialization', () => { model: 'deepseek-v4-flash-vision-exp', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), imageOptions([]))).rejects.toMatchObject({ code: 'INVALID_REQUEST' }) }) it.each(['system', 'assistant'] as const)('rejects an image in %s history before reading attachments', async (role) => { const resolveFileId = vi.fn() - await expect(serializeMessagesWithImages([createMessage({ - role, - content: [{ type: 'image', attachment: imageRef() }], - source: { kind: 'plugin', plugin: 'test' }, - })], imageOptions([imageRef()], resolveFileId))) + const content: ContentBlock[] = [{ type: 'image', attachment: imageRef() }] + const message = role === 'system' + ? createMessage({ role, content, source: { kind: 'plugin', plugin: 'test' } }) + : createMessage({ role, content, source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' } }) + await expect(serializeMessagesWithImages([message], imageOptions([imageRef()], resolveFileId))) .rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) expect(resolveFileId).not.toHaveBeenCalled() }) @@ -712,7 +695,7 @@ describe('image serialization', () => { system: 'system prompt', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }), imageOptions([ref])) expect(wire.messages[0]).toEqual({ role: 'system', content: 'system prompt' }) @@ -746,7 +729,7 @@ describe('review fixes: assistant content shapes', () => { // message without tool_calls ("content or tool_calls must be set"). const wire = serializeMessages([createMessage({ role: 'assistant', content: [], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })]) expect(wire).toEqual([{ role: 'assistant', content: '' }]) }) @@ -757,7 +740,7 @@ describe('review fixes: assistant content shapes', () => { // the session log and bricked every later turn of that session. const wire = serializeMessages([createMessage({ role: 'assistant', content: [{ type: 'reasoning', text: '你好!有什么我可以帮你的吗?' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })]) expect(wire).toEqual([{ role: 'assistant', content: '', reasoning_content: '你好!有什么我可以帮你的吗?', @@ -768,7 +751,7 @@ describe('review fixes: assistant content shapes', () => { const wire = serializeMessages([createMessage({ role: 'assistant', content: [{ type: 'tool-call', id: ToolCallId('c'), name: 'f', arguments: '{}' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })]) expect(wire[0]).toMatchObject({ content: '' }) }) diff --git a/packages/llm/llm-deepseek/tests/translate.spec.ts b/packages/llm/llm-deepseek/tests/translate.spec.ts index e54ae71a0e..5e19f0c94f 100644 --- a/packages/llm/llm-deepseek/tests/translate.spec.ts +++ b/packages/llm/llm-deepseek/tests/translate.spec.ts @@ -48,7 +48,7 @@ describe('translate: text', () => { ))) { assembler.push(chunk) } - const result = { message: assembler.message(), finish: assembler.finish } + const result = { message: assembler.message({ provider: 'mock', model: 'mock' }), finish: assembler.finish } expect(result.message.content).toEqual([{ type: 'text', text: 'hi' }]) expect(result.finish).toEqual({ kind: 'stop' }) }) diff --git a/packages/llm/llm-pi-ai/README.i18n.yaml b/packages/llm/llm-pi-ai/README.i18n.yaml index a1d3124f89..b601bf978c 100644 --- a/packages/llm/llm-pi-ai/README.i18n.yaml +++ b/packages/llm/llm-pi-ai/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/llm/llm-pi-ai/README.md -README.md: 89ae11fff20923309f3fc90e30de9f92977dcba2 -README.zh.md: 23d7ad170b5434b65b4d50e9a141e532694337dc +README.md: 2d43d17a381b73991f5bfc5ee0112fdbbfade119 +README.zh.md: abd26b01d088f6dcae697f242a60bea605c2c7a7 diff --git a/packages/llm/llm-pi-ai/README.md b/packages/llm/llm-pi-ai/README.md index 89ae11fff2..2d43d17a38 100644 --- a/packages/llm/llm-pi-ai/README.md +++ b/packages/llm/llm-pi-ai/README.md @@ -154,7 +154,7 @@ The plugin declares every installed catalog provider it can authenticate in the ### Replay and vocabulary -Successful assistant responses store a versioned, lossless-JSON replay state beside the provider and model that produced them — response-level facts plus one per-block entry per streamed block. At request time, `LlmRuntime` passes replay state only when the same adapter instance owns both routes; the adapter validates it and restores native response ids, provider signatures, and optional `providerThinkingLevel` effort metadata, keeping absent effort metadata absent. Replay validates the requested model identity against the assistant source and separately restores an Anthropic response model when the provider resolved an alias or fallback. An unusable state degrades to provider-neutral content instead of failing the request. pi-ai tool-call arguments are parsed objects, so the adapter parses input and re-stringifies output to the harness raw-JSON convention; pi-ai in-stream error events map to terminal `finish` chunks. +Successful assistant responses store a versioned, lossless-JSON replay state beside the provider and model that produced them — response-level facts plus one per-block entry per streamed block. At request time, `LlmRuntime` passes replay state only when the same adapter instance owns both routes; the adapter validates it and restores native response ids, provider signatures, and optional `providerThinkingLevel` effort metadata, keeping absent effort metadata absent. Replay validates the requested model identity against the assistant source and separately restores an Anthropic response model when the provider resolved an alias or fallback. Absent or unusable replay state degrades to provider-neutral content while preserving the assistant source’s required provider and model. pi-ai tool-call arguments are parsed objects, so the adapter parses input and re-stringifies output to the harness raw-JSON convention; pi-ai in-stream error events map to terminal `finish` chunks. diff --git a/packages/llm/llm-pi-ai/README.zh.md b/packages/llm/llm-pi-ai/README.zh.md index 23d7ad170b..abd26b01d0 100644 --- a/packages/llm/llm-pi-ai/README.zh.md +++ b/packages/llm/llm-pi-ai/README.zh.md @@ -154,7 +154,7 @@ Settings 写入会在合并组合层与用户层后严格校验每个新增或 ### 回放与词汇 -成功 assistant 响应会存储带版本的、无损 JSON 回放状态,与产生它们的提供方和模型放在一起——响应级事实加每个流式块一条逐块条目。请求时,`LlmRuntime` 仅当同一适配器实例拥有两条路由时才传递回放状态;适配器校验它并恢复原生响应 id、提供方签名与可选的 `providerThinkingLevel` effort 元数据,缺失的 effort 元数据仍保持缺失。回放会对照 assistant 来源校验请求模型身份,并在提供方解析别名或回退时单独恢复 Anthropic 响应模型。无法使用的状态会降级为提供方无关内容而不是让请求失败。pi-ai 工具调用参数是解析后的对象,因此适配器解析输入并重新字符串化输出,以符合 harness 原始 JSON 约定;pi-ai 流内错误事件映射为终止 `finish` 分片。 +成功 assistant 响应会存储带版本的、无损 JSON 回放状态,与产生它们的提供方和模型放在一起——响应级事实加每个流式块一条逐块条目。请求时,`LlmRuntime` 仅当同一适配器实例拥有两条路由时才传递回放状态;适配器校验它并恢复原生响应 id、提供方签名与可选的 `providerThinkingLevel` effort 元数据,缺失的 effort 元数据仍保持缺失。回放会对照 assistant 来源校验请求模型身份,并在提供方解析别名或回退时单独恢复 Anthropic 响应模型。回放状态缺失或无法使用时会降级为提供方无关内容,并保留 assistant 来源中必需的提供方和模型。pi-ai 工具调用参数是解析后的对象,因此适配器解析输入并重新字符串化输出,以符合 harness 原始 JSON 约定;pi-ai 流内错误事件映射为终止 `finish` 分片。 diff --git a/packages/llm/llm-pi-ai/src/context.ts b/packages/llm/llm-pi-ai/src/context.ts index d16e842845..7d9aab7db4 100644 --- a/packages/llm/llm-pi-ai/src/context.ts +++ b/packages/llm/llm-pi-ai/src/context.ts @@ -28,17 +28,28 @@ function flattenText(message: Message): string { } -/** Flatten text recursively inside one tool result. */ -function toolResultText(blocks: readonly ContentBlock[]): string { - return blocks.map(block => block.type === 'text' - ? block.text - : block.type === 'tool-result' ? toolResultText(block.content) : '').join('') +/** Recover the pi-ai toolResult message for one harness tool-role message. */ +function toolResultOf( + message: Extract, + toolNames: Map, + content: string | (TextContent | ImageContent)[], +): PiMessage { + return { + role: 'toolResult', + toolCallId: message.toolCallId, + toolName: toolNames.get(message.toolCallId) ?? 'unknown', + content: typeof content === 'string' + ? [{ type: 'text', text: content || '(no output)' }] + : content, + isError: message.isError ?? false, + timestamp: 0, + } } /** Reject image roles that pi-ai cannot replay before request-size offloading can replace them. */ function assertSupportedImageRoles(messages: readonly Message[]): void { for (const message of messages) { - if (message.role !== 'user' && contentHasImage(message.content)) { + if (message.role !== 'user' && message.role !== 'tool' && contentHasImage(message.content)) { throw new LlmError( `pi-ai cannot represent an image in an in-history ${message.role} message`, 'UNSUPPORTED_CONTENT', @@ -47,11 +58,11 @@ function assertSupportedImageRoles(messages: readonly Message[]): void { } } -async function userContent( +function userContent( blocks: readonly ContentBlock[], requestImages: ReadonlyMap, resolveImageAccess: ImageAttachmentAccessResolver, -): Promise { +): string | (TextContent | ImageContent)[] { const content: (TextContent | ImageContent)[] = [] for (const block of blocks) { switch (block.type) { @@ -71,16 +82,6 @@ async function userContent( }) break } - case 'tool-result': - { - const nested = await userContent(block.content, requestImages, resolveImageAccess) - if (typeof nested === 'string') { - if (nested.length > 0) content.push({ type: 'text', text: nested }) - } else { - content.push(...nested) - } - } - break default: // Other merge-extensible blocks are not user-input vocabulary for pi-ai. break @@ -97,8 +98,6 @@ function collectImageRefs( for (const block of blocks) { if (block.type === 'image') { if (block.offloaded !== true) refs.set(block.attachment.attachmentId, block.attachment) - } else if (block.type === 'tool-result') { - collectImageRefs(block.content, refs) } } } @@ -166,7 +165,7 @@ function piContext(systemPrompt: string | undefined, options: GenerateOptions, m } function appendAssistant( - message: Message, + message: Extract, messages: PiMessage[], toolNames: Map, onReplayDegrade?: (reason: string) => void, @@ -178,6 +177,26 @@ function appendAssistant( messages.push(assistant) } +/** Append the system and assistant roles both context builders treat identically; true when consumed. */ +function appendSystemOrAssistant( + message: Message, + messages: PiMessage[], + toolNames: Map, + onReplayDegrade?: (reason: string) => void, +): boolean { + if (message.role === 'system') { + // pi-ai has a single systemPrompt slot; a system message that did not + // supply it folds into a user message to preserve order. + messages.push({ role: 'user', content: flattenText(message), timestamp: 0 }) + return true + } + if (message.role === 'assistant') { + appendAssistant(message, messages, toolNames, onReplayDegrade) + return true + } + return false +} + function textOnlyContext(options: GenerateOptions, onReplayDegrade?: (reason: string) => void): PiContext { assertSupportedImageRoles(options.messages) const split = splitSystemPrompt(options) @@ -187,32 +206,12 @@ function textOnlyContext(options: GenerateOptions, onReplayDegrade?: (reason: st if (contentHasImage(message.content)) { throw new LlmError('pi-ai image conversion requires the durable attachment service', 'UNSUPPORTED_CONTENT') } - if (message.role === 'system') { - // pi-ai has a single systemPrompt slot; a system message that did not - // supply it folds into a user message to preserve order. - messages.push({ role: 'user', content: flattenText(message), timestamp: 0 }) + if (appendSystemOrAssistant(message, messages, toolNames, onReplayDegrade)) continue + if (message.role === 'tool') { + messages.push(toolResultOf(message, toolNames, flattenText(message))) continue } - if (message.role === 'assistant') { - appendAssistant(message, messages, toolNames, onReplayDegrade) - continue - } - const text = flattenText(message) - const results = message.content.filter(block => block.type === 'tool-result') - if (text.length > 0 || results.length === 0) messages.push({ role: 'user', content: text, timestamp: 0 }) - for (const result of results) { - messages.push({ - role: 'toolResult', - toolCallId: result.toolCallId, - toolName: toolNames.get(result.toolCallId) ?? 'unknown', - content: [{ - type: 'text', - text: toolResultText(result.content) || '(no output)', - }], - isError: result.isError ?? false, - timestamp: 0, - }) - } + messages.push({ role: 'user', content: flattenText(message), timestamp: 0 }) } return piContext(split.systemPrompt, options, messages) } @@ -318,38 +317,13 @@ async function toPiContextWithImages( const messages: PiMessage[] = [] for (const message of exactMessages) { - if (message.role === 'system') { - // pi-ai has a single systemPrompt slot; a system message that did not - // supply it folds into a user message to preserve order. - messages.push({ role: 'user', content: flattenText(message), timestamp: 0 }) + if (appendSystemOrAssistant(message, messages, toolNames, onReplayDegrade)) continue + if (message.role === 'tool') { + messages.push(toolResultOf(message, toolNames, userContent(message.content, requestImages, resolveImageAccess))) continue } - if (message.role === 'assistant') { - appendAssistant(message, messages, toolNames, onReplayDegrade) - continue - } - // user role: text + tool results (each result becomes its own message). - const regular = message.content.filter(block => block.type !== 'tool-result') - const content = await userContent(regular, requestImages, resolveImageAccess) - const results = message.content.filter((block): block is Extract => ( - block.type === 'tool-result' - )) - if (content.length > 0 || results.length === 0) { - messages.push({ role: 'user', content, timestamp: 0 }) - } - for (const result of results) { - const resultContent = await userContent(result.content, requestImages, resolveImageAccess) - messages.push({ - role: 'toolResult', - toolCallId: result.toolCallId, - toolName: toolNames.get(result.toolCallId) ?? 'unknown', - content: typeof resultContent === 'string' - ? [{ type: 'text', text: resultContent || '(no output)' }] - : resultContent, - isError: result.isError ?? false, - timestamp: 0, - }) - } + const content = userContent(message.content, requestImages, resolveImageAccess) + messages.push({ role: 'user', content, timestamp: 0 }) } return piContext(split.systemPrompt, options, messages) diff --git a/packages/llm/llm-pi-ai/src/replay.ts b/packages/llm/llm-pi-ai/src/replay.ts index 3e71c11f84..7df034522c 100644 --- a/packages/llm/llm-pi-ai/src/replay.ts +++ b/packages/llm/llm-pi-ai/src/replay.ts @@ -9,7 +9,7 @@ */ import { LlmError } from '@deepseek-ai/dsh-llm' -import type { Message, ModelMessageSource, ReplayEnvelope } from '@deepseek-ai/dsh-llm' +import type { AssistantMessage as HarnessAssistantMessage, ModelMessageSource, ReplayEnvelope } from '@deepseek-ai/dsh-llm' import type { Api, AssistantMessage, Usage as PiUsage } from '@earendil-works/pi-ai' /** Per-block half of the pi-ai replay envelope, one entry per content block. */ @@ -150,8 +150,8 @@ function readReplayState(value: unknown): PiAiReplayState { } /** Convert provider-neutral blocks without trusting them as same-model replay. */ -function foreignAssistant(message: Message): AssistantMessage { - const source = message.source.kind === 'model' ? message.source : undefined +function foreignAssistant(message: HarnessAssistantMessage): AssistantMessage { + const source = message.source const content: AssistantMessage['content'] = [] for (const block of message.content) { switch (block.type) { @@ -176,8 +176,8 @@ function foreignAssistant(message: Message): AssistantMessage { // Deliberately never equals a catalog API: absent replay state is foreign // even if source names the same provider/model as this request. api: 'dsh-foreign', - provider: source?.provider ?? 'dsh-foreign', - model: source?.model ?? 'dsh-foreign', + provider: source.provider, + model: source.model, usage: emptyPiUsage(), stopReason: content.some(piece => piece.type === 'toolCall') ? 'toolUse' : 'stop', timestamp: 0, @@ -185,7 +185,7 @@ function foreignAssistant(message: Message): AssistantMessage { } /** Recombine durable Harness content with validated pi-ai replay metadata. */ -function replayedAssistant(message: Message, source: ModelMessageSource, rawState: unknown): AssistantMessage { +function replayedAssistant(message: HarnessAssistantMessage, source: ModelMessageSource, rawState: unknown): AssistantMessage { const state = readReplayState(rawState) if (state.response.provider !== source.provider) return invalidReplay('provider does not match assistant source') if (state.response.model !== source.model) return invalidReplay('model does not match assistant source') @@ -241,14 +241,14 @@ function replayedAssistant(message: Message, source: ModelMessageSource, rawStat * another adapter's kind, another version, a malformed value, or metadata that * no longer matches the content — therefore degrades the one message to * provider-neutral history instead of failing the request. - * @param message - assistant content with required source and optional adapter-owned replay metadata. + * @param message - model-produced assistant content with provider, model, and optional adapter-owned replay metadata. * @param onDegrade - called with the diagnostic reason when an unusable replay * state falls back to provider-neutral conversion. * @returns a native pi-ai assistant message reconstructed from durable content. */ -export function toPiAssistant(message: Message, onDegrade?: (reason: string) => void): AssistantMessage { +export function toPiAssistant(message: HarnessAssistantMessage, onDegrade?: (reason: string) => void): AssistantMessage { const source = message.source - if (source.kind !== 'model' || source.replayState === undefined) return foreignAssistant(message) + if (source.replayState === undefined) return foreignAssistant(message) try { return replayedAssistant(message, source, source.replayState) } catch (error: unknown) { diff --git a/packages/llm/llm-pi-ai/tests/adapter.e2e.ts b/packages/llm/llm-pi-ai/tests/adapter.e2e.ts index b3190011cb..de8cd86532 100644 --- a/packages/llm/llm-pi-ai/tests/adapter.e2e.ts +++ b/packages/llm/llm-pi-ai/tests/adapter.e2e.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest' import { Context } from '@deepseek-ai/cordis' -import LlmRuntime, { createUserMessage, ToolCallId, ReasoningEffortId } from '@deepseek-ai/dsh-llm' +import LlmRuntime, { createToolResultMessage, createUserMessage, ToolCallId, ReasoningEffortId } from '@deepseek-ai/dsh-llm' import type { Message, ToolSchema } from '@deepseek-ai/dsh-llm' import * as LlmPiAi from '@deepseek-ai/dsh-llm-pi-ai' import type { PiAiProviderProfile } from '@deepseek-ai/dsh-llm-pi-ai' @@ -39,7 +39,7 @@ afterEach(async () => { function ask(text: string): Message[] { return [createUserMessage({ content: [{ type: 'text', text }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })] } @@ -127,13 +127,10 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('llm-pi-ai e2e (real API)', () => messages: [ ...ask('What is the weather in Paris right now? Use the get_weather tool.'), first.message, - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId(call!.id), - content: [{ type: 'text', text: 'Sunny, 22°C' }], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId(call!.id), + content: [{ type: 'text', text: 'Sunny, 22°C' }], + isError: false, }), ], tools: [weatherTool], diff --git a/packages/llm/llm-pi-ai/tests/adapter.spec.ts b/packages/llm/llm-pi-ai/tests/adapter.spec.ts index a247b20e42..1081125a7e 100644 --- a/packages/llm/llm-pi-ai/tests/adapter.spec.ts +++ b/packages/llm/llm-pi-ai/tests/adapter.spec.ts @@ -9,7 +9,7 @@ import type { SaveImageAttachment, StoredImageAttachment, } from '@deepseek-ai/dsh-attachment' -import LlmRuntime, { createUserMessage, CONTEXT_WINDOW_EXCEEDED_CODE, LlmError, ReasoningEffortId, userAgent } from '@deepseek-ai/dsh-llm' +import LlmRuntime, { createToolResultMessage, createUserMessage, CONTEXT_WINDOW_EXCEEDED_CODE, LlmError, ReasoningEffortId, userAgent } from '@deepseek-ai/dsh-llm' import * as LlmPiAi from '@deepseek-ai/dsh-llm-pi-ai' import { PiAiAdapter } from '@deepseek-ai/dsh-llm-pi-ai' import { MAX_TIMER_DELAY_MS } from '@deepseek-ai/dsh-timeout' @@ -80,7 +80,7 @@ describe('PiAiAdapter provider routing', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'text', text: 'hi' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) expect(result.message.content).toEqual([{ type: 'text', text: 'hello' }]) @@ -319,7 +319,7 @@ describe('PiAiAdapter provider routing', () => { model: 'gpt-4.1', messages: [createUserMessage({ content: [{ type: 'image', attachment: ref }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], }) @@ -914,7 +914,7 @@ describe('provider profile lifecycle', () => { model: 'deepseek-v4-flash', messages: [createUserMessage({ content: [{ type: 'image', attachment: IMAGE_REF }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) await expect(drain({ @@ -922,23 +922,16 @@ describe('provider profile lifecycle', () => { model: 'gpt-4.1', messages: [createUserMessage({ content: [{ type: 'image', attachment: IMAGE_REF }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], })).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) await expect(drain({ provider: 'openai', model: 'gpt-4.1', - messages: [createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: 'call-outer' as never, - content: [{ - type: 'tool-result', - toolCallId: 'call-inner' as never, - content: [{ type: 'image', attachment: IMAGE_REF }], - }], - }], - source: { kind: 'plugin', plugin: 'test' }, + messages: [createToolResultMessage({ + callId: 'call-outer' as never, + content: [{ type: 'image', attachment: IMAGE_REF }], + isError: false, })], })).rejects.toMatchObject({ code: 'UNSUPPORTED_CONTENT' }) }) diff --git a/packages/llm/llm-pi-ai/tests/assemble.ts b/packages/llm/llm-pi-ai/tests/assemble.ts index 8d415941c7..d22b4c2fb9 100644 --- a/packages/llm/llm-pi-ai/tests/assemble.ts +++ b/packages/llm/llm-pi-ai/tests/assemble.ts @@ -21,7 +21,6 @@ export async function assemble(ctx: Context, options: Omit { @@ -81,19 +83,13 @@ describe('pi-ai request context conversion', () => { expect(toPiContext({ ...base, tools: [] })).toEqual({ messages: [] }) }) - it('converts complete text-only history and rejects nested images without storage', () => { + it('converts complete text-only history and rejects tool images without storage', () => { const callId = ToolCallId('call-1') expect(toPiContext(request([ history('system', [{ type: 'text', text: 'history system' }]), history('assistant', [{ type: 'tool-call', id: callId, name: 'lookup', arguments: '{}' }]), - user([ - { type: 'text', text: 'after tool' }, - { - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: '' }], - }, - ]), + user([{ type: 'text', text: 'after tool' }]), + createToolResultMessage({ callId, content: [{ type: 'text', text: '' }], isError: false }), ]))).toMatchObject({ systemPrompt: 'system prompt', tools: [{ name: 'lookup' }], @@ -111,11 +107,9 @@ describe('pi-ai request context conversion', () => { ], }) - expect(() => toPiContext(request([user([{ - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'image', attachment: ref }], - }])]))).toThrow(/durable attachment service/) + expect(() => toPiContext(request([ + createToolResultMessage({ callId, content: [{ type: 'image', attachment: ref }], isError: false }), + ]))).toThrow(/durable attachment service/) }) it('resolves user and tool-result images while preserving explicit fallbacks', async () => { @@ -132,20 +126,12 @@ describe('pi-ai request context conversion', () => { { type: 'text', text: 'caption' }, { type: 'reasoning', text: 'ignored' }, ]), - user([{ - type: 'tool-result', - toolCallId: knownCallId, - content: [{ type: 'text', text: '' }], - }]), - user([{ - type: 'tool-result', - toolCallId: callId, + createToolResultMessage({ callId: knownCallId, content: [{ type: 'text', text: '' }], isError: false }), + createToolResultMessage({ + callId, + content: [{ type: 'image', attachment: ref }], isError: true, - content: [ - { type: 'tool-result', toolCallId: callId, content: [] }, - { type: 'image', attachment: ref }, - ], - }]), + }), ]), imageContext(attachments)) expect(context.messages).toEqual([ @@ -203,24 +189,30 @@ describe('pi-ai request context conversion', () => { expect(JSON.stringify(context.messages[0])).toContain('request preview 1130x565px') }) - it('recursively converts nested tool-result text and images', async () => { - const callId = ToolCallId('nested-call') - const context = await toPiContext(request([user([{ - type: 'tool-result', + it('treats a tool message without isError as a successful result', () => { + const callId = ToolCallId('default-success') + const message = createMessage({ + role: 'tool', + source: { kind: 'tool', callId }, toolCallId: callId, + content: [{ type: 'text', text: 'result' }], + }) + expect(toPiContext(request([message])).messages).toEqual([{ + role: 'toolResult', toolCallId: callId, toolName: 'unknown', + content: [{ type: 'text', text: 'result' }], isError: false, timestamp: 0, + }]) + }) + + it('converts tool text and images on the image path', async () => { + const callId = ToolCallId('nested-call') + const context = await toPiContext(request([createToolResultMessage({ + callId, content: [ - { - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: 'nested text' }], - }, - { - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'image', attachment: ref }], - }, + { type: 'text', text: 'nested text' }, + { type: 'image', attachment: ref }, ], - }])]), imageContext(attachments)) + isError: false, + })]), imageContext(attachments)) expect(context.messages).toEqual([{ role: 'toolResult', @@ -236,20 +228,18 @@ describe('pi-ai request context conversion', () => { }]) }) - it('flattens nested text-only tool results and ignores other block types without storage', () => { + it('flattens tool text and ignores other block types without storage', () => { const callId = ToolCallId('nested-text') - expect(toPiContext(request([user([{ - type: 'tool-result', - toolCallId: callId, - content: [ - { type: 'chart', data: 'ignored' } as unknown as ContentBlock, - { - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: 'nested' }], - }, - ], - }])]))).toMatchObject({ + expect(toPiContext(request([ + createToolResultMessage({ + callId, + content: [ + { type: 'chart', data: 'ignored' } as unknown as ContentBlock, + { type: 'text', text: 'nested' }, + ], + isError: false, + }), + ]))).toMatchObject({ messages: [{ role: 'toolResult', content: [{ type: 'text', text: 'nested' }], @@ -264,14 +254,14 @@ describe('pi-ai request context conversion', () => { const store = projectionStore(readImageRequest) const sized: ImageAttachmentRef = { ...ref, bytes: 3 } const callId = ToolCallId('shot-call') - // The nested occurrence is offloaded on the surface; the two retained 3-byte images cost + // The tool-result occurrence is offloaded on the surface; the two retained 3-byte images cost // 4 base64 characters each and fit the 8-byte bound exactly. const context = await toPiContext(request([ - user([{ - type: 'tool-result', - toolCallId: callId, + createToolResultMessage({ + callId, content: [{ type: 'image', attachment: sized, offloaded: true }], - }]), + isError: false, + }), user([{ type: 'image', attachment: sized }, { type: 'text', text: 'newer' }]), user([{ type: 'image', attachment: sized }]), ]), imageContext(store, { maxRequestImageBytes: 8 })) @@ -426,11 +416,7 @@ describe('pi-ai request context conversion', () => { { type: 'text', text: 'answer' }, { type: 'tool-call', id: ToolCallId('other-call'), name: 'lookup', arguments: '{}' }, ]), - user([{ - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: 'result' }], - }]), + createToolResultMessage({ callId, content: [{ type: 'text', text: 'result' }], isError: false }), ]))).toMatchObject({ messages: [ { role: 'user', content: '' }, @@ -463,7 +449,10 @@ describe('pi-ai request context conversion', () => { }) expect(() => toPiAssistant( - history('assistant', [{ type: 'image', attachment: ref }]), + createAssistantMessage({ + content: [{ type: 'image', attachment: ref }], + source: { provider: 'openai', model: 'gpt-4.1' }, + }), )).toThrow(/assistant image output/) }) @@ -477,14 +466,6 @@ describe('pi-ai system prompt source', () => { it.each<{ label: string; content: ContentBlock[] }>([ { label: 'image-only', content: [{ type: 'image', attachment: ref }] }, { label: 'text and image', content: [{ type: 'text', text: 'rule' }, { type: 'image', attachment: ref }] }, - { - label: 'nested image', - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('system-image'), - content: [{ type: 'image', attachment: ref }], - }], - }, ])('rejects a leading system $label on both conversion paths', async ({ content }) => { const options: GenerateOptions = { ...base, messages: [history('system', content), question] } const error = { diff --git a/packages/llm/llm-pi-ai/tests/convert.spec.ts b/packages/llm/llm-pi-ai/tests/convert.spec.ts index 4347d74858..c08e2eac34 100644 --- a/packages/llm/llm-pi-ai/tests/convert.spec.ts +++ b/packages/llm/llm-pi-ai/tests/convert.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import { AttachmentId, ImageVariantId } from '@deepseek-ai/dsh-attachment' import type { AttachmentStore, ImageAttachmentRef, ImageRequestTarget, RequestImageAttachment } from '@deepseek-ai/dsh-attachment' -import { createUserMessage, ToolCallId, CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, createMessage } from '@deepseek-ai/dsh-llm' +import { createToolResultMessage, createUserMessage, ToolCallId, CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, createMessage } from '@deepseek-ai/dsh-llm' import type { ContentBlock, StreamChunk } from '@deepseek-ai/dsh-llm' import type { AssistantMessage, AssistantMessageEvent, Usage } from '@earendil-works/pi-ai' import { transformMessages } from '@earendil-works/pi-ai/api/transform-messages' @@ -133,7 +133,7 @@ describe('toPiContext', () => { }) }) - it('flattens nested tool-result images into the enclosing result', async () => { + it('converts a tool message with text and images on the image path', async () => { const attachment = { attachmentId: AttachmentId(`sha256:${'c'.repeat(64)}`), mediaType: 'image/png' as const, @@ -147,25 +147,15 @@ describe('toPiContext', () => { const context = await toPiContext({ provider: 'openai', model: 'gpt-4.1', - messages: [createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('outer'), - content: [ - { type: 'tool-result', toolCallId: ToolCallId('empty'), content: [] }, - { type: 'text', text: 'before' }, - { type: 'tool-result', toolCallId: ToolCallId('text'), content: [{ type: 'text', text: 'middle' }] }, - { - type: 'tool-result', - toolCallId: ToolCallId('inner'), - content: [ - { type: 'image', attachment }, - { type: 'text', text: 'after' }, - ], - }, - ], - }], - source: { kind: 'plugin', plugin: 'test' }, + messages: [createToolResultMessage({ + callId: ToolCallId('outer'), + content: [ + { type: 'text', text: 'before' }, + { type: 'text', text: 'middle' }, + { type: 'image', attachment }, + { type: 'text', text: 'after' }, + ], + isError: false, })], }, imageContext(attachmentStore(readImageRequest))) @@ -212,7 +202,7 @@ describe('toPiContext', () => { { type: 'text', text: 'calling' }, { type: 'tool-call', id: ToolCallId('c1'), name: 'f', arguments: '{"a":1}' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, })], }) const message = context.messages[0] as AssistantMessage @@ -231,7 +221,7 @@ describe('toPiContext', () => { model: 'm', messages: [createMessage({ role: 'assistant', content: [{ type: 'text', text: 'done' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, })], }) expect((context.messages[0] as AssistantMessage).stopReason).toBe('stop') @@ -262,7 +252,7 @@ describe('toPiContext', () => { messages: [createMessage({ role: 'assistant', content: [{ type: 'tool-call', id: ToolCallId('c1'), name: 'f', arguments: '{broken' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, })], }) const message = context.messages[0] as AssistantMessage @@ -276,7 +266,7 @@ describe('toPiContext', () => { messages: [createMessage({ role: 'assistant', content: [{ type: 'tool-call', id: ToolCallId('c1'), name: 'f', arguments: '[1,2]' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, })], }) expect((context.messages[0] as AssistantMessage).content[0]).toMatchObject({ arguments: {} }) @@ -290,19 +280,16 @@ describe('toPiContext', () => { createMessage({ role: 'assistant', content: [{ type: 'tool-call', id: ToolCallId('c1'), name: 'get_weather', arguments: '{}' }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, }), - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('c1'), - content: [ - { type: 'text', text: 'Sunny' }, - { type: 'tool-result', toolCallId: ToolCallId('nested'), content: [{ type: 'text', text: '!' }] }, - { type: 'chart', data: 'ignored' } as unknown as ContentBlock, - ], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId('c1'), + content: [ + { type: 'text', text: 'Sunny' }, + { type: 'text', text: '!' }, + { type: 'chart', data: 'ignored' } as unknown as ContentBlock, + ], + isError: false, }), ], }) @@ -320,10 +307,7 @@ describe('toPiContext', () => { const context = toPiContext({ provider: 'deepseek', model: 'm', - messages: [createUserMessage({ - content: [{ type: 'tool-result', toolCallId: ToolCallId('zz'), content: [], isError: true }], - source: { kind: 'plugin', plugin: 'test' }, - })], + messages: [createToolResultMessage({ callId: ToolCallId('zz'), content: [], isError: true })], }) expect(context.messages[0]).toMatchObject({ role: 'toolResult', @@ -343,11 +327,13 @@ describe('toPiContext', () => { source: { kind: 'plugin', plugin: 'test' }, }), createUserMessage({ - content: [ - { type: 'text', text: 'note' }, - { type: 'tool-result', toolCallId: ToolCallId('c1'), content: [{ type: 'text', text: 'ok' }] }, - ], - source: { kind: 'plugin', plugin: 'test' }, + content: [{ type: 'text', text: 'note' }], + source: { kind: 'model', provider: 'deepseek', model: 'm' }, + }), + createToolResultMessage({ + callId: ToolCallId('c1'), + content: [{ type: 'text', text: 'ok' }], + isError: false, }), ], }) @@ -365,7 +351,7 @@ describe('toPiContext', () => { { type: 'chart', data: 'x' } as unknown as ContentBlock, { type: 'text', text: 'visible' }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek', model: 'm' }, })], }) expect((context.messages[0] as AssistantMessage).content).toEqual([{ type: 'text', text: 'visible' }]) diff --git a/packages/llm/llm-pi-ai/tests/provider-apis.e2e.ts b/packages/llm/llm-pi-ai/tests/provider-apis.e2e.ts index fd917c7a66..21aacab18f 100644 --- a/packages/llm/llm-pi-ai/tests/provider-apis.e2e.ts +++ b/packages/llm/llm-pi-ai/tests/provider-apis.e2e.ts @@ -10,7 +10,7 @@ import type { SaveImageAttachment, StoredImageAttachment, } from '@deepseek-ai/dsh-attachment' -import LlmRuntime, { createUserMessage, ToolCallId } from '@deepseek-ai/dsh-llm' +import LlmRuntime, { createToolResultMessage, createUserMessage, ToolCallId } from '@deepseek-ai/dsh-llm' import type { Message, ToolSchema } from '@deepseek-ai/dsh-llm' import * as LlmPiAi from '@deepseek-ai/dsh-llm-pi-ai' import type { PiAiReplayResponse } from '../src/replay.ts' @@ -121,7 +121,7 @@ afterEach(async () => { function ask(text: string): Message[] { return [createUserMessage({ content: [{ type: 'text', text }], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })] } @@ -209,13 +209,10 @@ for (const profile of providerCases) { messages: [ ...prompt, first.message, - createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: ToolCallId(call!.id), - content: [{ type: 'text', text: 'The code blue means ocean.' }], - }], - source: { kind: 'plugin', plugin: 'test' }, + createToolResultMessage({ + callId: ToolCallId(call!.id), + content: [{ type: 'text', text: 'The code blue means ocean.' }], + isError: false, }), ], tools: [lookupTool], @@ -252,7 +249,7 @@ for (const profile of providerCases) { }, { type: 'image', attachment: ref }, ], - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'deepseek-official', model: 'deepseek-v4-flash' }, })], maxTokens: 256, }) diff --git a/packages/llm/llm/README.i18n.yaml b/packages/llm/llm/README.i18n.yaml index c105e97d77..983bf7f806 100644 --- a/packages/llm/llm/README.i18n.yaml +++ b/packages/llm/llm/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/llm/llm/README.md -README.md: 7192ee58eaffb153231268095feb3d9c7ddda37a -README.zh.md: 6898833c6eb5199ce8a93b7ec33cbf4ce7a31cb3 +README.md: 3374d3cfde00face3f9f4c24d48019f309d3892e +README.zh.md: d59eeed383d86c1c43682de46ba893065c9186c9 diff --git a/packages/llm/llm/README.md b/packages/llm/llm/README.md index 7192ee58ea..3374d3cfde 100644 --- a/packages/llm/llm/README.md +++ b/packages/llm/llm/README.md @@ -101,9 +101,9 @@ The service is built on one separation: **the logical contract is provider-neutr ### Main flow -A request is validated against its exact model's capability — context window, output default, reasoning efforts, input modalities, and `systemPromptUpdate` mode — and any adapter-configured defaults are materialized, then the whole request is deep-frozen. `prepareCall()` binds those facts, detached context, and retry policy to the exact adapter generation that performs terminal dispatch, so HMR or dynamic settings cannot combine one generation's image capability with another generation's endpoint. An image-capable adapter projects durable references into route-specific request versions; `resolveImageAttachmentAccess()` separately maps an attachment provider's optional host object into the current tool execution world without changing the request image or its `variantId`. A text-only route receives deterministic per-image placeholders, including nested tool-result images, without rewriting append-only session history. Durable `FileBlock` references never reach any adapter: request assembly replaces each one, nested tool-result occurrences included, with deterministic handle text naming the file and its saved read-only path, resolved through the mounted attachment and filesystem providers. `ctx.llm.fileRequestText(ref)` exposes that exact synchronous projection to request measurement. An image occurrence derived with `offloaded: true` reaches every route as placeholder text through `projectOffloadedImages()`. An image-capable route whose retained occurrences exceed its `LlmImageRequestBudget` at their exact bytes fails with `IMAGE_OFFLOAD_REQUIRED` naming the additional oldest occurrences (`requiredImageOffload()`), never with an unlogged projection; `dsh-compaction-image-offload` logs the selected occurrences in one `image/offload` event and retries. Adapters that charge visual tokens declare per-route `imageRequestPricing`, which `ctx.llm.imageRequestPricing(provider, model)` resolves synchronously for the token meter. Dispatch goes through the `llm/stream` waterfall, then chunks return as token-level deltas and every adapter outcome reaches the consumer as one terminal `finish` chunk. +A request is validated against its exact model's capability — context window, output default, reasoning efforts, input modalities, and `systemPromptUpdate` mode — and any adapter-configured defaults are materialized, then the whole request is deep-frozen. `prepareCall()` binds those facts, detached context, and retry policy to the exact adapter generation that performs terminal dispatch, so HMR or dynamic settings cannot combine one generation's image capability with another generation's endpoint. An image-capable adapter projects durable references into route-specific request versions; `resolveImageAttachmentAccess()` separately maps an attachment provider's optional host object into the current tool execution world without changing the request image or its `variantId`. A text-only route receives deterministic per-image placeholders, including tool-role result images, without rewriting append-only session history. Durable `FileBlock` references never reach any adapter: request assembly replaces each one, including tool-role result occurrences, with deterministic handle text naming the file and its saved read-only path, resolved through the mounted attachment and filesystem providers. `ctx.llm.fileRequestText(ref)` exposes that exact synchronous projection to request measurement. An image occurrence derived with `offloaded: true` reaches every route as placeholder text through `projectOffloadedImages()`. An image-capable route whose retained occurrences exceed its `LlmImageRequestBudget` at their exact bytes fails with `IMAGE_OFFLOAD_REQUIRED` naming the additional oldest occurrences (`requiredImageOffload()`), never with an unlogged projection; `dsh-compaction-image-offload` logs the selected occurrences in one `image/offload` event and retries. Adapters that charge visual tokens declare per-route `imageRequestPricing`, which `ctx.llm.imageRequestPricing(provider, model)` resolves synchronously for the token meter. Dispatch goes through the `llm/stream` waterfall, then chunks return as token-level deltas and every adapter outcome reaches the consumer as one terminal `finish` chunk. -File detection reads current content, including nested tool results, on every request without caching message identities or freeze state. The [file-scan decision](../../../.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md) records the measured traversal cost. +File detection reads current content, including tool-role result content, on every request without caching message identities or freeze state. The [file-scan decision](../../../.agents/notes/implemented/simplification/2026-09-07-file-content-scan.md) records the measured traversal cost. ### Invariants diff --git a/packages/llm/llm/README.zh.md b/packages/llm/llm/README.zh.md index 6898833c6e..d59eeed383 100644 --- a/packages/llm/llm/README.zh.md +++ b/packages/llm/llm/README.zh.md @@ -101,9 +101,9 @@ for await (const chunk of ctx.llm.stream({ ### 主流程 -请求会对照其精确模型的能力校验,包括上下文窗口、输出默认值、推理强度、输入模态与 `systemPromptUpdate` 模式,填入任何适配器配置的默认值,然后整个请求被深度冻结。`prepareCall()` 把这些事实、分离的上下文与重试策略绑定到执行最终分发的精确适配器代次,因此 HMR(热模块替换)或动态设置无法把一个代次的图片能力与另一代次的端点混用。支持图片的适配器把持久引用投影为路由专用请求版本;`resolveImageAttachmentAccess()` 会单独把附件提供方的可选宿主对象映射进当前工具执行世界,而不改变请求图片或其 `variantId`。纯文本路由接收确定性的逐图片占位符,包括嵌套工具结果图片,而不会改写仅追加会话历史。持久 `FileBlock` 引用永远不会到达任何适配器:请求组装把每个引用(包括嵌套工具结果中的出现)替换为确定性 句柄文本,指出文件与其只读保存路径,路径经由挂载的附件与文件系统提供方解析。`ctx.llm.fileRequestText(ref)` 向请求计量公开相同的同步投影。派生后带有 `offloaded: true` 的图片出现位置,经 `projectOffloadedImages()` 以占位文本到达每条路由。支持图片的路由在保留的出现位置按精确字节超过其 `LlmImageRequestBudget` 时,以 `IMAGE_OFFLOAD_REQUIRED` 失败并说明还需省略多少最老的出现位置(`requiredImageOffload()`),绝不发送未记录的投影;`dsh-compaction-image-offload` 用一条 `image/offload` 事件记录所选位置并重试。对视觉 token 收费的适配器声明按路由的 `imageRequestPricing`,`ctx.llm.imageRequestPricing(provider, model)` 为 token meter 同步解析它。分发经过 `llm/stream` waterfall(瀑布式事件),随后分片以 token 级增量返回,每个适配器结果都以唯一一个终止 `finish` 分片到达消费方。 +请求会对照其精确模型的能力校验,包括上下文窗口、输出默认值、推理强度、输入模态与 `systemPromptUpdate` 模式,填入任何适配器配置的默认值,然后整个请求被深度冻结。`prepareCall()` 把这些事实、分离的上下文与重试策略绑定到执行最终分发的精确适配器代次,因此 HMR(热模块替换)或动态设置无法把一个代次的图片能力与另一代次的端点混用。支持图片的适配器把持久引用投影为路由专用请求版本;`resolveImageAttachmentAccess()` 会单独把附件提供方的可选宿主对象映射进当前工具执行世界,而不改变请求图片或其 `variantId`。纯文本路由接收确定性的逐图片占位符,包括 tool-role 结果图片,而不会改写仅追加会话历史。持久 `FileBlock` 引用永远不会到达任何适配器:请求组装把每个引用(包括 tool-role 结果中的出现)替换为确定性句柄文本,指出文件与其只读保存路径,路径经由挂载的附件与文件系统提供方解析。`ctx.llm.fileRequestText(ref)` 向请求计量公开相同的同步投影。派生后带有 `offloaded: true` 的图片出现位置,经 `projectOffloadedImages()` 以占位文本到达每条路由。支持图片的路由在保留的出现位置按精确字节超过其 `LlmImageRequestBudget` 时,以 `IMAGE_OFFLOAD_REQUIRED` 失败并说明还需省略多少最老的出现位置(`requiredImageOffload()`),绝不发送未记录的投影;`dsh-compaction-image-offload` 用一条 `image/offload` 事件记录所选位置并重试。对视觉 token 收费的适配器声明按路由的 `imageRequestPricing`,`ctx.llm.imageRequestPricing(provider, model)` 为 token meter 同步解析它。分发经过 `llm/stream` waterfall(瀑布式事件),随后分片以 token 级增量返回,每个适配器结果都以唯一一个终止 `finish` 分片到达消费方。 -文件检测在每次请求时读取当前内容,包括嵌套工具结果,不缓存消息身份或冻结状态。[文件扫描决策](../../../.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md)记录了实测遍历成本。 +文件检测在每次请求时读取当前内容,包括 tool-role 结果内容,不缓存消息身份或冻结状态。[文件扫描决策](../../../.agents/notes/implemented/simplification/2026-09-07-file-content-scan.zh.md)记录了实测遍历成本。 ### 不变式 diff --git a/packages/llm/llm/src/assembler.ts b/packages/llm/llm/src/assembler.ts index 88ae77d80b..917dd11e2c 100644 --- a/packages/llm/llm/src/assembler.ts +++ b/packages/llm/llm/src/assembler.ts @@ -9,8 +9,8 @@ import { brandString } from '@deepseek-ai/dsh-brand' import { assertNever } from '@deepseek-ai/dsh-util-values' import type { ToolCallId } from './brand.ts' -import { createMessage } from './message.ts' -import type { Message, MessageSource } from './message.ts' +import { createAssistantMessage } from './message.ts' +import type { AssistantMessage, ModelMessageSource } from './message.ts' import type { ContentBlock, FinishReason, ReplayEnvelope, StreamChunk, TokenUsage } from './types.ts' interface PartialBlock { @@ -199,10 +199,10 @@ export class BlockAssembler { /** * The assembled assistant message. - * @param source - producer attribution for the assembled message. + * @param source - provider/model attribution (without the `kind` tag) for the assembled message. * @returns a frozen assistant-role message over `blocks()` (same open-block assembly rules). */ - message(source: MessageSource = { kind: 'plugin', plugin: 'dsh-llm/assembler' }): Message { - return createMessage({ role: 'assistant', content: this.blocks(), source }) + message(source: Omit): AssistantMessage { + return createAssistantMessage({ content: this.blocks(), source }) } } diff --git a/packages/llm/llm/src/content.ts b/packages/llm/llm/src/content.ts index b5c3e59f3d..817660d91b 100644 --- a/packages/llm/llm/src/content.ts +++ b/packages/llm/llm/src/content.ts @@ -116,29 +116,25 @@ export function offloadedImageText( } /** - * True when typed model content contains an image block, walking nested - * tool-result content. This is the one recursive image walk shared by every - * image policy (capability gating, text-only serialization, compaction - * survey), so a consumer cannot silently diverge on nesting depth. + * True when typed model content contains an image block. This is the one image + * walk shared by every image policy (capability gating, text-only + * serialization, compaction survey), so a consumer cannot silently diverge. * @param content - typed model content blocks. - * @returns whether any nested block is an image. + * @returns whether any block is an image. */ export function contentHasImage(content: readonly ContentBlock[]): boolean { - return content.some(block => block.type === 'image' - || (block.type === 'tool-result' && contentHasImage(block.content))) + return content.some(block => block.type === 'image') } /** - * True when typed model content contains a file block, walking nested - * tool-result content on the same recursion every file policy shares. + * True when typed model content contains a file block. * Reads current content on every call without retaining scan results. * @param content - typed model content blocks. - * @returns whether any nested block is a file. + * @returns whether any block is a file. */ export function contentHasFile(content: readonly ContentBlock[]): boolean { for (const block of content) { - if (block.type === 'file' - || (block.type === 'tool-result' && contentHasFile(block.content))) return true + if (block.type === 'file') return true } return false } @@ -160,7 +156,7 @@ export function fileHandleText(ref: FileAttachmentRef, readonlyPath: string | un return `[${identity}: verbatim read-only copy saved at ${quoted(readonlyPath)}. Read that path with your file tools when its contents are needed; copy it to a writable location before modifying it. When delegating file work, include this saved path in the delegation prompt; only subagents sharing this execution environment can read it.]` } -/** Replace every file occurrence, including nested tool results, with handle text. */ +/** Replace every file occurrence with handle text. */ function replaceFilesWithHandles( blocks: readonly ContentBlock[], resolvePath: (ref: FileAttachmentRef) => string | undefined, @@ -172,14 +168,6 @@ function replaceFilesWithHandles( next.push({ type: 'text', text: fileHandleText(block.attachment, resolvePath(block.attachment)) }) continue } - if (block.type === 'tool-result') { - const content = replaceFilesWithHandles(block.content, resolvePath) - if (content !== block.content) { - next ??= blocks.slice(0, index) - next.push({ ...block, content }) - continue - } - } next?.push(block) } return next ?? blocks as ContentBlock[] @@ -210,19 +198,17 @@ function base64Length(bytes: number): number { } /** - * Visit every image occurrence of typed content in message order, including - * nested tool-result content. + * Visit every image occurrence of typed content in message order. * @param content - typed model content blocks. * @param visit - called once per occurrence. */ function visitImageBlocks(content: readonly ContentBlock[], visit: (block: ImageBlock) => void): void { for (const block of content) { if (block.type === 'image') visit(block) - else if (block.type === 'tool-result') visitImageBlocks(block.content, visit) } } -/** Replace every offloaded occurrence, including nested tool results, with its placeholder. */ +/** Replace every offloaded occurrence with its placeholder. */ function replaceOffloadedImages( blocks: readonly ContentBlock[], placeholder: (ref: ImageAttachmentRef) => string, @@ -234,14 +220,6 @@ function replaceOffloadedImages( next.push({ type: 'text', text: placeholder(block.attachment) }) continue } - if (block.type === 'tool-result') { - const content = replaceOffloadedImages(block.content, placeholder) - if (content !== block.content) { - next ??= blocks.slice(0, index) - next.push({ ...block, content }) - continue - } - } next?.push(block) } return next ?? blocks as ContentBlock[] @@ -324,7 +302,7 @@ export function requiredImageOffload( return offloadedImagePrefixCount(lengths, budget) } -/** Replace every image occurrence, including nested tool results, for a text-only model. */ +/** Replace every image occurrence for a text-only model. */ function replaceImagesForTextModel(blocks: readonly ContentBlock[]): ContentBlock[] { let next: ContentBlock[] | undefined for (const [index, block] of blocks.entries()) { @@ -333,14 +311,6 @@ function replaceImagesForTextModel(blocks: readonly ContentBlock[]): ContentBloc next.push({ type: 'text', text: textOnlyImageText(block.attachment) }) continue } - if (block.type === 'tool-result') { - const content = replaceImagesForTextModel(block.content) - if (content !== block.content) { - next ??= blocks.slice(0, index) - next.push({ ...block, content }) - continue - } - } next?.push(block) } return next ?? blocks as ContentBlock[] diff --git a/packages/llm/llm/src/message.ts b/packages/llm/llm/src/message.ts index 05af6bae3e..129bcc02ea 100644 --- a/packages/llm/llm/src/message.ts +++ b/packages/llm/llm/src/message.ts @@ -4,7 +4,7 @@ import { randomUUID } from '@deepseek-ai/dsh-util-crypto' import { brandString } from '@deepseek-ai/dsh-brand' import { deepFreeze } from '@deepseek-ai/dsh-util-values' import type { MessageId, ToolCallId } from './brand.ts' -import type { ContentBlock, ToolResultBlock } from './types.ts' +import type { ContentBlock } from './types.ts' /** Provider/model identity and adapter-private replay data for an assistant message. */ export interface AssistantProviderMetadata { @@ -25,7 +25,7 @@ export interface ModelMessageSource extends AssistantProviderMetadata { kind: 'model' } -/** Required source of a user-role message carrying one tool result. */ +/** Required source of a tool-role message carrying one tool result. */ export interface ToolMessageSource { kind: 'tool' callId: ToolCallId @@ -107,9 +107,9 @@ export interface MessageSourceMap { } /** - * Bound for a `notice` summary. The account rides a collapsed transcript row - * and is committed to the durable log, while its inputs — task labels, goal - * objectives, tool arguments — are caller text with no length of their own. + * Bound for a `notice` summary. Producers commit the one-line account to the + * durable log; its inputs — task labels, goal objectives, tool arguments — + * are caller text with no length of their own. */ export const CONTEXT_SUMMARY_MAX_CHARS = 120 @@ -127,47 +127,61 @@ export function boundContextSummary(summary: string): string { /** Any known message source, derived from {@link MessageSourceMap}; switch on `kind` and fall through unknowns (merge-extensible). */ export type MessageSource = MessageSourceMap[keyof MessageSourceMap] -/** One immutable message representation shared by delivery, durable history, and model requests. */ -export interface Message { +/** Shared immutable fields of every conversation message. */ +interface MessageBase { /** Stable identity preserved across every representation boundary. */ readonly id: MessageId - /** Provider-neutral conversation role. */ - readonly role: 'system' | 'user' | 'assistant' /** Exact model-facing blocks. */ - readonly content: ContentBlock[] + readonly content: readonly ContentBlock[] /** Required source fields supplied by the producer. */ readonly source: MessageSource } -/** A user-role specialization of the one shared message representation. */ -export interface UserMessage extends Message { - readonly role: 'user' -} - -/** A model-produced assistant specialization of the shared message representation. */ -export interface AssistantMessage extends Message { - readonly role: 'assistant' - readonly source: ModelMessageSource -} - -/** - * A system-role specialization of the shared message representation: one - * rendered system prompt attributed to the plugin that assembled it. Empty - * `content` means "no system prompt" and projects to no wire message. - */ -export interface SystemMessage extends Message { +/** A rendered system prompt attributed to its assembling plugin; empty content sends no prompt. */ +export interface SystemMessage extends MessageBase { readonly role: 'system' readonly source: MessageSourceMap['plugin'] } -/** A tool-result specialization whose model-facing block retains call correlation. */ -export interface ToolResultMessage extends Message { +/** A user-role specialization of the shared message representation. */ +export interface UserMessage extends MessageBase { readonly role: 'user' - readonly content: [ToolResultBlock] - readonly source: ToolMessageSource } -type NewMessage = Omit +/** A model-produced assistant specialization of the shared message representation. */ +export interface AssistantMessage extends MessageBase { + readonly role: 'assistant' + readonly source: ModelMessageSource +} + +/** A first-class tool-role message carrying the result of one tool invocation. */ +export interface ToolResultMessage extends MessageBase { + readonly role: 'tool' + readonly source: ToolMessageSource + /** Provider-issued id of the tool call this message answers. */ + readonly toolCallId: ToolCallId + /** Whether the tool invocation failed. */ + readonly isError?: boolean +} + +/** + * The conversation messages persisted by Session, keyed by role. This map is + * closed because every model-visible role must have a durable Session event + * and an adapter projection. + */ +export interface MessageRoleMap { + system: SystemMessage + user: UserMessage + assistant: AssistantMessage + tool: ToolResultMessage +} + +/** Any persisted conversation message, discriminated by its `role`. */ +export type Message = MessageRoleMap[keyof MessageRoleMap] + +type NewMessage = { + [Role in keyof MessageRoleMap]: Omit +}[keyof MessageRoleMap] type NewUserMessage = Omit type NewAssistantMessage = Omit & { readonly source: Omit & { readonly kind?: never } @@ -190,10 +204,10 @@ export function freezeMessage(message: T): T { export function createMessage( input: T & { readonly id?: never }, ): T & Pick { - return freezeMessage({ + return deepFreeze(structuredClone({ ...input, id: brandString(randomUUID()), - }) + })) } /** @@ -246,23 +260,21 @@ export function createSystemMessage(text: string, plugin: string): SystemMessage /** Input whose acceptance creates one tool-result message. */ export interface ToolResultMessageInput { readonly callId: ToolCallId - readonly content: ContentBlock[] + readonly content: readonly ContentBlock[] readonly isError: boolean } /** * Create and freeze one identified tool-result message. * @param input - call identity, raw result blocks, and outcome. - * @returns an immutable user-role tool-result message. + * @returns an immutable tool-role message that answers the tool call. */ export function createToolResultMessage(input: ToolResultMessageInput): ToolResultMessage { - return createUserMessage({ + return createMessage({ + role: 'tool', source: { kind: 'tool', callId: input.callId }, - content: [{ - type: 'tool-result', - toolCallId: input.callId, - content: input.content, - isError: input.isError, - }], + toolCallId: input.callId, + content: input.content, + isError: input.isError, }) } diff --git a/packages/llm/llm/src/types.ts b/packages/llm/llm/src/types.ts index d77aa7f042..cb1757f028 100644 --- a/packages/llm/llm/src/types.ts +++ b/packages/llm/llm/src/types.ts @@ -110,14 +110,6 @@ export interface ToolCallBlock { arguments: string } -/** The result of a tool invocation, sent back to the model. */ -export interface ToolResultBlock { - type: 'tool-result' - toolCallId: ToolCallId - content: ContentBlock[] - isError?: boolean -} - /** * Merge-extensible content blocks keyed by `type`. New core blocks must land * with adapter, UI, and compaction support. @@ -128,7 +120,6 @@ export interface ContentBlockMap { 'image': ImageBlock 'file': FileBlock 'tool-call': ToolCallBlock - 'tool-result': ToolResultBlock } /** The block `type` tag vocabulary; widens as plugins add entries to {@link ContentBlockMap}. */ diff --git a/packages/llm/llm/tests/assembler.spec.ts b/packages/llm/llm/tests/assembler.spec.ts index 2cbfc07f63..dc6b14422c 100644 --- a/packages/llm/llm/tests/assembler.spec.ts +++ b/packages/llm/llm/tests/assembler.spec.ts @@ -26,7 +26,7 @@ describe('BlockAssembler', () => { ]) expect(assembler.usage).toEqual({ inputTokens: 10, outputTokens: 5 }) expect(assembler.finish).toEqual({ kind: 'tool-calls' }) - expect(assembler.message().role).toBe('assistant') + expect(assembler.message({ provider: 'mock', model: 'mock' }).role).toBe('assistant') }) it('records the completed block from block-end', () => { diff --git a/packages/llm/llm/tests/content.spec.ts b/packages/llm/llm/tests/content.spec.ts index 61821d8f9a..c01b3dbf1d 100644 --- a/packages/llm/llm/tests/content.spec.ts +++ b/packages/llm/llm/tests/content.spec.ts @@ -4,6 +4,7 @@ import type { AttachmentStore, ImageMediaType } from '@deepseek-ai/dsh-attachmen import { ToolCallId, contentHasFile, + createToolResultMessage, createUserMessage, fileHandleText, projectFilesToText, @@ -35,31 +36,26 @@ function image(bytes: number, offloaded?: true): Extract { - it('visits image occurrences at every tool-result depth in message order', () => { + it('visits image occurrences in user and tool messages in message order', () => { const seen: number[] = [] - const content: ContentBlock[] = [ - { type: 'text', text: 'before' }, - image(1), - { - type: 'tool-result', - toolCallId: ToolCallId('shot'), - content: [ - { type: 'text', text: 'x' }, - image(2), - { - type: 'tool-result', - toolCallId: ToolCallId('nested'), - content: [{ type: 'tool-result', toolCallId: ToolCallId('deep'), content: [image(4)] }], - }, - ], - }, - image(3), + const messages = [ + createUserMessage({ content: [{ type: 'text', text: 'before' }, image(1)], source }), + createToolResultMessage({ + callId: ToolCallId('shot'), + content: [{ type: 'text', text: 'x' }, image(2)], + isError: false, + }), + createToolResultMessage({ + callId: ToolCallId('second'), + content: [image(4)], + isError: false, + }), + createUserMessage({ content: [image(3)], source }), ] - expect(requiredImageOffload([createUserMessage({ content, source })], - { representation: 'raw', maxImages: 0 }, (block) => { - seen.push(block.attachment.bytes) - return block.attachment.bytes - })).toBe(4) + expect(requiredImageOffload(messages, { representation: 'raw', maxImages: 0 }, (block) => { + seen.push(block.attachment.bytes) + return block.attachment.bytes + })).toBe(4) expect(seen).toEqual([1, 2, 4, 3]) }) }) @@ -71,35 +67,31 @@ describe('projectOffloadedImages', () => { expect(projected[0]).toBe(messages[0]) }) - it('replaces marked top-level and nested occurrences with route placeholders', () => { + it('replaces marked user and tool occurrences with route placeholders', () => { const messages = [ - createUserMessage({ - content: [{ type: 'tool-result', toolCallId: ToolCallId('shot'), content: [image(3, true)] }], - source, + createToolResultMessage({ + callId: ToolCallId('shot'), + content: [image(3, true)], + isError: false, }), createUserMessage({ content: [image(3, true), image(3)], source }), ] const projected = projectOffloadedImages(messages, ref => `${OMITTED}:${ref.bytes}`) - expect(projected[0]?.content).toEqual([{ - type: 'tool-result', - toolCallId: ToolCallId('shot'), - content: [{ type: 'text', text: `${OMITTED}:3` }], - }]) + expect(projected[0]?.content).toEqual([{ type: 'text', text: `${OMITTED}:3` }]) expect(projected[1]?.content).toEqual([{ type: 'text', text: `${OMITTED}:3` }, image(3)]) expect(messages[1]?.content[0]).toEqual(image(3, true)) }) - it('keeps unchanged nested content while replacing a later occurrence', () => { - const nested = { - type: 'tool-result' as const, - toolCallId: ToolCallId('text-only'), - content: [{ type: 'text' as const, text: 'kept' }], - } - const messages = [createUserMessage({ content: [nested, image(3, true)], source })] - expect(projectOffloadedImages(messages, () => OMITTED)[0]?.content).toEqual([ - nested, - { type: 'text', text: OMITTED }, - ]) + it('keeps unchanged tool content while replacing a later image', () => { + const unchanged = createToolResultMessage({ + callId: ToolCallId('text-only'), + content: [{ type: 'text', text: 'kept' }], + isError: false, + }) + const messages = [unchanged, createUserMessage({ content: [image(3, true)], source })] + const projected = projectOffloadedImages(messages, () => OMITTED) + expect(projected[0]).toBe(unchanged) + expect(projected[1]?.content).toEqual([{ type: 'text', text: OMITTED }]) }) }) @@ -265,44 +257,46 @@ describe('projectImagesForTextModel', () => { it('returns image-free history unchanged', () => { const messages = [createUserMessage({ content: [{ type: 'text', text: 'plain' }], source })] expect(projectImagesForTextModel(messages)).toBe(messages) - const nested = [createUserMessage({ - content: [{ type: 'tool-result', toolCallId: ToolCallId('plain-result'), content: messages[0]!.content }], - source, + const results = [createToolResultMessage({ + callId: ToolCallId('plain-result'), + content: messages[0]!.content, + isError: false, })] - expect(projectImagesForTextModel(nested)).toBe(nested) + expect(projectImagesForTextModel(results)).toBe(results) }) - it('replaces direct and nested images while retaining unaffected messages and blocks', () => { + it('replaces direct images while retaining unaffected messages', () => { const plain = createUserMessage({ content: [{ type: 'text', text: 'plain' }], source }) - const nested = { - type: 'tool-result' as const, - toolCallId: ToolCallId('nested-image'), - content: [{ type: 'text' as const, text: 'before' }, image(3), { type: 'text' as const, text: 'after' }], - } - const unchangedNested = { - type: 'tool-result' as const, - toolCallId: ToolCallId('text-only'), - content: [{ type: 'text' as const, text: 'unchanged' }], - } + const unchangedTool = createToolResultMessage({ + callId: ToolCallId('text-only'), + content: [{ type: 'text', text: 'unchanged' }], + isError: false, + }) const visual = createUserMessage({ - content: [{ type: 'text', text: 'lead' }, image(3), unchangedNested, nested], + content: [{ type: 'text', text: 'lead' }, image(3)], source, }) + const visualTool = createToolResultMessage({ + callId: ToolCallId('nested-image'), + content: [ + { type: 'text', text: 'before' }, + image(3), + { type: 'text', text: 'after' }, + ], + isError: false, + }) - const projected = projectImagesForTextModel([plain, visual]) + const projected = projectImagesForTextModel([plain, visual, unchangedTool, visualTool]) expect(projected[0]).toBe(plain) expect(projected[1]?.content).toEqual([ { type: 'text', text: 'lead' }, { type: 'text', text: '[image omitted because this model accepts text only; attachment sha256:aaaaaaaa]' }, - unchangedNested, - { - ...nested, - content: [ - { type: 'text', text: 'before' }, - { type: 'text', text: '[image omitted because this model accepts text only; attachment sha256:aaaaaaaa]' }, - { type: 'text', text: 'after' }, - ], - }, + ]) + expect(projected[2]).toBe(unchangedTool) + expect(projected[3]?.content).toEqual([ + { type: 'text', text: 'before' }, + { type: 'text', text: '[image omitted because this model accepts text only; attachment sha256:aaaaaaaa]' }, + { type: 'text', text: 'after' }, ]) }) }) @@ -319,41 +313,23 @@ describe('file projection', () => { } } - it('detects file blocks at the top level and inside nested tool results', () => { + it('detects file blocks anywhere in message content', () => { expect(contentHasFile([{ type: 'text', text: 'x' }])).toBe(false) expect(contentHasFile([fileBlock('a.txt')])).toBe(true) - expect(contentHasFile([{ - type: 'tool-result', - toolCallId: ToolCallId('call-1'), - content: [{ - type: 'tool-result', - toolCallId: ToolCallId('call-2'), - content: [fileBlock('deep.txt')], - }], - }])).toBe(true) }) - it('scans frozen branches and observes later mutations in file-free content', () => { - const nested: ContentBlock[] = [{ type: 'text', text: 'plain' }] - const empty: ContentBlock[] = [] - Object.freeze(empty) - const content: ContentBlock[] = [ - { type: 'tool-result', toolCallId: ToolCallId('empty'), content: empty }, - { type: 'tool-result', toolCallId: ToolCallId('nested'), content: nested }, - ] + it('scans frozen blocks and observes later mutations in file-free content', () => { + const content: ContentBlock[] = [{ type: 'text', text: 'plain' }] Object.freeze(content[0]) - Object.freeze(content[1]) - Object.freeze(content) expect(contentHasFile(Object.freeze([]))).toBe(false) expect(contentHasFile(content)).toBe(false) - nested.push(fileBlock('later.txt')) + content.push(fileBlock('later.txt')) expect(contentHasFile(content)).toBe(true) - nested.pop() + content.pop() expect(contentHasFile(content)).toBe(false) - nested.push(fileBlock('frozen.txt')) - Object.freeze(nested[0]) - Object.freeze(nested[1]) - Object.freeze(nested) + content.push(fileBlock('frozen.txt')) + Object.freeze(content[1]) + Object.freeze(content) expect(contentHasFile(content)).toBe(true) }) @@ -373,37 +349,33 @@ describe('file projection', () => { it('replaces every file occurrence with handle text and keeps file-free history identical', () => { const plain = [createUserMessage({ content: [{ type: 'text', text: 'hi' }], source })] expect(projectFilesToText(plain, () => '/p')).toBe(plain) - const unchangedTool = { - type: 'tool-result' as const, - toolCallId: ToolCallId('call-plain'), - content: [{ type: 'text' as const, text: 'unchanged result' }], - } - const messages = [plain[0]!, createUserMessage({ - content: [ - fileBlock('top.csv'), - { type: 'text', text: 'keep' }, - unchangedTool, - { - type: 'tool-result', - toolCallId: ToolCallId('call-3'), - content: [fileBlock('nested.csv')], - }, - ], - source, - })] + const messages = [ + plain[0]!, + createUserMessage({ + content: [ + fileBlock('top.csv'), + { type: 'text', text: 'keep' }, + ], + source, + }), + createToolResultMessage({ + callId: ToolCallId('call-3'), + content: [fileBlock('nested.csv')], + isError: false, + }), + ] const projected = projectFilesToText(messages, ref => `/copies/${ref.name}`) expect(projected).not.toBe(messages) expect(projected[0]).toBe(messages[0]) const content = projected[1]!.content expect(content[0]).toEqual({ type: 'text', text: fileHandleText(fileBlock('top.csv').attachment, '/copies/top.csv') }) expect(content[1]).toEqual({ type: 'text', text: 'keep' }) - expect(content[2]).toBe(messages[1]!.content[2]) - const nested = content[3] as Extract - expect(nested.content[0]).toEqual({ + expect(projected[2]!.content[0]).toEqual({ type: 'text', text: fileHandleText(fileBlock('nested.csv').attachment, '/copies/nested.csv'), }) // The durable message is untouched: projection returns shallow copies. expect(messages[1]!.content[0]!.type).toBe('file') + expect(messages[2]!.content[0]!.type).toBe('file') }) }) diff --git a/packages/llm/llm/tests/message.spec.ts b/packages/llm/llm/tests/message.spec.ts index 3d458611d2..e600f6902f 100644 --- a/packages/llm/llm/tests/message.spec.ts +++ b/packages/llm/llm/tests/message.spec.ts @@ -83,14 +83,11 @@ describe('message construction', () => { }) expect(message).toMatchObject({ - role: 'user', + role: 'tool', + toolCallId: callId, + isError: false, source: { kind: 'tool', callId }, - content: [{ - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: 'result' }], - isError: false, - }], + content: [{ type: 'text', text: 'result' }], }) expect(message.id).not.toHaveLength(0) expect(Object.isFrozen(message)).toBe(true) diff --git a/packages/llm/llm/tests/properties.spec.ts b/packages/llm/llm/tests/properties.spec.ts index 22f854b378..a6752adc65 100644 --- a/packages/llm/llm/tests/properties.spec.ts +++ b/packages/llm/llm/tests/properties.spec.ts @@ -76,7 +76,7 @@ describe('BlockAssembler properties', () => { const a = feed(chunks) expect(a.blocks()).toEqual(a.blocks()) // And message().content mirrors blocks(). - expect(a.message().content).toEqual(a.blocks()) + expect(a.message({ provider: 'mock', model: 'mock' }).content).toEqual(a.blocks()) })) }) diff --git a/packages/llm/token-meter/src/estimate.ts b/packages/llm/token-meter/src/estimate.ts index 99ebbb2aaf..ca54abf6b2 100644 --- a/packages/llm/token-meter/src/estimate.ts +++ b/packages/llm/token-meter/src/estimate.ts @@ -52,9 +52,6 @@ export function estimateContent(blocks: readonly ContentBlock[]): number { + Math.ceil(block.arguments.length / CHARS_PER_TOKEN) + BLOCK_OVERHEAD break - case 'tool-result': - tokens += estimateContent(block.content) + BLOCK_OVERHEAD - break default: // ContentBlockMap is merge-extensible; unknown blocks (and image // references, whose request price is route-owned) retain a diff --git a/packages/llm/token-meter/src/surface-fold.ts b/packages/llm/token-meter/src/surface-fold.ts index 7cea95adb0..29df77f87a 100644 --- a/packages/llm/token-meter/src/surface-fold.ts +++ b/packages/llm/token-meter/src/surface-fold.ts @@ -64,10 +64,6 @@ function collectProjectedAttachments( } else if (block.type === 'file') { files.push(block.attachment) fileTokens += estimateStructuralBlock(block) - } else if (block.type === 'tool-result') { - const nested = collectProjectedAttachments(block.content, images, files) - imageTokens += nested.imageTokens - fileTokens += nested.fileTokens } } return { imageTokens, fileTokens } diff --git a/packages/llm/token-meter/tests/context-breakdown-projection.spec.ts b/packages/llm/token-meter/tests/context-breakdown-projection.spec.ts index 3c7081a9b2..3f172bd776 100644 --- a/packages/llm/token-meter/tests/context-breakdown-projection.spec.ts +++ b/packages/llm/token-meter/tests/context-breakdown-projection.spec.ts @@ -494,10 +494,7 @@ describe('shared estimator', () => { expect(estimateContent([{ type: 'text', text: 'abcd' }])).toBe(5) expect(estimateContent([{ type: 'reasoning', text: 'abcdefgh' }] as ContentBlock[])).toBe(6) expect(estimateContent([{ type: 'tool-call', id: 'c' as never, name: 'bash', arguments: '{"a":1}' }])).toBe(7) - expect(estimateContent([{ - type: 'tool-result', toolCallId: 'c' as never, - content: [{ type: 'text', text: 'abcd' }], - }])).toBe(9) + expect(estimateContent([{ type: 'text', text: 'abcd' }])).toBe(5) const unknown = { type: 'mystery', payload: 'abc' } as unknown as ContentBlock expect(estimateContent([unknown])).toBe(4 + Math.ceil(JSON.stringify(unknown).length / 4)) }) diff --git a/packages/llm/token-meter/tests/route-pricing.spec.ts b/packages/llm/token-meter/tests/route-pricing.spec.ts index 360d1b6352..bf11f1b039 100644 --- a/packages/llm/token-meter/tests/route-pricing.spec.ts +++ b/packages/llm/token-meter/tests/route-pricing.spec.ts @@ -2,7 +2,7 @@ import { imageOffloadProjection } from '@deepseek-ai/dsh-compaction-image-offloa import { describe, expect, it } from 'vitest' import { Context } from '@deepseek-ai/cordis' import { - LlmRuntime, LlmAdapter, createMessage, createUserMessage, projectFilesToText, + LlmRuntime, LlmAdapter, createMessage, createToolResultMessage, createUserMessage, projectFilesToText, ToolCallId, } from '@deepseek-ai/dsh-llm' import type { GenerateOptions, LlmImageRequestPricing, Message, StreamChunk, TokenUsage, UserMessage } from '@deepseek-ai/dsh-llm' import { AttachmentId } from '@deepseek-ai/dsh-attachment' @@ -274,29 +274,24 @@ describe('request projection pricing', () => { } }) - it('prices nested tool-result images through the same route pricing', async () => { + it('prices tool-result images through the same route pricing', async () => { const { meter, session } = await harness(() => fixedPricing) - const nested = createUserMessage({ - content: [{ - type: 'tool-result', - toolCallId: 'call-1' as never, - content: [ - { type: 'text', text: 'screenshot below' }, - { type: 'image', attachment: imageRef('nested') }, - ], - }], - source: { kind: 'user' }, + const result = createToolResultMessage({ + callId: ToolCallId('call-1'), + content: [ + { type: 'text', text: 'screenshot below' }, + { type: 'image', attachment: imageRef('nested') }, + ], + isError: false, }) - session.append('user/message', nested, { surfaceOp: 'append' }) + session.append('tool/result', { turn: 1, step: 1, message: result }, { surfaceOp: 'append' }) session.append('request/header', { header: header('vision'), reason: 'initial' }) const measurement = meter.measure(session) - const imageFree = estimateMessage({ - ...nested, - content: [{ - ...nested.content[0] as Extract, - content: [{ type: 'text', text: 'screenshot below' }], - }], - }) + const imageFree = estimateMessage(createToolResultMessage({ + callId: ToolCallId('call-1'), + content: [{ type: 'text', text: 'screenshot below' }], + isError: false, + })) expect(measurement.nodes[0]!.tokens) .toBe(imageFree + VISUAL_TOKENS + estimateContent([{ type: 'text', text: HANDLE_TEXT }])) }) diff --git a/packages/llm/token-meter/tests/token-meter.spec.ts b/packages/llm/token-meter/tests/token-meter.spec.ts index e795ea5507..08599680e1 100644 --- a/packages/llm/token-meter/tests/token-meter.spec.ts +++ b/packages/llm/token-meter/tests/token-meter.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, expectTypeOf, it } from 'vitest' import { Context } from '@deepseek-ai/cordis' -import { AssistantStreamAccumulator, createUserMessage, createSystemMessage, ToolCallId, createMessage } from '@deepseek-ai/dsh-llm' +import { AssistantStreamAccumulator, createAssistantMessage, createUserMessage, createSystemMessage, ToolCallId, createMessage } from '@deepseek-ai/dsh-llm' import type { ContentBlock, Message, TokenUsage } from '@deepseek-ai/dsh-llm' import SessionStore, { Session, SessionId, SessionSeq, canonicalHeader } from '@deepseek-ai/dsh-session' import type { EpochHeader, SessionEvent, SessionSeq as SessionSeqType } from '@deepseek-ai/dsh-session' @@ -12,14 +12,10 @@ function header(model: string, extras: Omit = {}): EpochH return canonicalHeader({ config: { provider: 'mock', model }, ...extras }) } -function textMessage(text: string, role: Message['role'] = 'user'): Message { - return createMessage({ - role, - content: [{ type: 'text', text }], - source: role === 'assistant' - ? { kind: 'model', provider: 'mock', model: 'mock' } - : { kind: 'user' }, - }) +function textMessage(text: string, role: 'user' | 'assistant' = 'user'): Message { + return role === 'assistant' + ? createAssistantMessage({ content: [{ type: 'text', text }], source: { provider: 'mock', model: 'mock' } }) + : createUserMessage({ content: [{ type: 'text', text }], source: { kind: 'user' } }) } function appendHeader(session: Session, value: EpochHeader): void { @@ -148,17 +144,12 @@ describe('TokenMeter pricing', () => { { type: 'text', text: 'abcd' }, { type: 'reasoning', text: 'ab' }, { type: 'tool-call', id: ToolCallId('c'), name: 'read', arguments: '{"x":1}' }, - { - type: 'tool-result', - toolCallId: ToolCallId('c'), - content: [{ type: 'text', text: 'xy' }], - isError: false, - }, + { type: 'text', text: 'xy' }, { type: 'future-block', payload: 'abcd' } as unknown as ContentBlock, ] const estimated = service.estimateMessage(createMessage({ role: 'assistant', content: blocks, - source: { kind: 'plugin', plugin: 'test' }, + source: { kind: 'model', provider: 'mock', model: 'mock' }, })) expect(estimated).toBeGreaterThan(30) expect(service.estimateMessage(textMessage('abcd'))).toBe(9) diff --git a/packages/plan/plan-mode/tests/integration.spec.ts b/packages/plan/plan-mode/tests/integration.spec.ts index ac82e45822..ac0f22bc18 100644 --- a/packages/plan/plan-mode/tests/integration.spec.ts +++ b/packages/plan/plan-mode/tests/integration.spec.ts @@ -122,7 +122,7 @@ describe('plan mode through the agent loop', () => { // guidance alone (enforcement lives on the independent sandbox/approval // axes). The mode itself stays plan throughout. const result = findEvent(log, 'tool/result') - expect(result.data.message.content[0].isError).toBe(false) + expect(result.data.message.isError).toBe(false) expect(planActive(ctx, agent)).toBe(true) expect(log.some(event => event.type === 'user/message' && event.data.source.kind === 'plugin')).toBe(false) }) diff --git a/packages/sdk/server/src/server.ts b/packages/sdk/server/src/server.ts index 031508993b..bdb58687da 100644 --- a/packages/sdk/server/src/server.ts +++ b/packages/sdk/server/src/server.ts @@ -121,7 +121,9 @@ export class HarnessSdkJsonRpcServer { childSessionId: String(info.id), status: successStatus(info.stopReason, serverOptions), stopReason: info.stopReason, - ...(info.lastAssistantMessage === undefined ? {} : { lastAssistantMessage: info.lastAssistantMessage }), + ...(info.lastAssistantMessage === undefined + ? {} + : { lastAssistantMessage: [...info.lastAssistantMessage] }), } transport.notify('subagent.finished', payload) })) diff --git a/packages/session-query/session-query/src/extraction.ts b/packages/session-query/session-query/src/extraction.ts index f31bfb4c5f..198b118197 100644 --- a/packages/session-query/session-query/src/extraction.ts +++ b/packages/session-query/session-query/src/extraction.ts @@ -75,8 +75,6 @@ function blockText(block: SessionContentBlock): string[] { return [] case 'tool-call': return [block.name, block.arguments] - case 'tool-result': - return block.content.flatMap(blockText) // ContentBlockMap is merge-extensible. Unknown blocks do not become // searchable merely because their payload happens to contain strings. default: diff --git a/packages/session-query/session-query/tests/search-helpers.spec.ts b/packages/session-query/session-query/tests/search-helpers.spec.ts index b8021a9e64..4dac95c5c9 100644 --- a/packages/session-query/session-query/tests/search-helpers.spec.ts +++ b/packages/session-query/session-query/tests/search-helpers.spec.ts @@ -38,12 +38,7 @@ describe('session-query semantic extraction', () => { { type: 'text', text: ' visible ' }, { type: 'reasoning', text: 'thought' }, { type: 'tool-call', id: callId, name: 'read', arguments: '{"path":"a"}' }, - { - type: 'tool-result', - toolCallId: callId, - content: [{ type: 'text', text: 'nested' }], - isError: false, - }, + { type: 'text', text: 'nested' }, { type: 'future-content', payload: 'hidden' } as never, ] const events: SessionEvent[] = [ diff --git a/packages/session-query/session-query/tests/session-query.spec.ts b/packages/session-query/session-query/tests/session-query.spec.ts index ea89275ef3..e8837dc4b9 100644 --- a/packages/session-query/session-query/tests/session-query.spec.ts +++ b/packages/session-query/session-query/tests/session-query.spec.ts @@ -1030,7 +1030,7 @@ describe('session-query exact reads', () => { ]) if (snapshot.events[0]?.type !== 'user/message') throw new Error('expected current user message') expect(() => { - (snapshot.events[0]!.data as { content: unknown[] }).content = [] + (snapshot.events[0]!.data as unknown as { content: unknown[] }).content = [] }).toThrow() Object.assign(snapshot.session, { cwd: '/mutated' }) diff --git a/packages/session/session-checkpoint-policy/tests/crash-recovery.e2e.ts b/packages/session/session-checkpoint-policy/tests/crash-recovery.e2e.ts index f978d8acf1..eee1f54536 100644 --- a/packages/session/session-checkpoint-policy/tests/crash-recovery.e2e.ts +++ b/packages/session/session-checkpoint-policy/tests/crash-recovery.e2e.ts @@ -112,9 +112,9 @@ describe.skipIf(process.platform === 'win32')('semantic checkpoint hard-crash re expect(result?.type === 'tool/result' && result.data.error).toEqual({ name: 'ToolOutcomeUnknownError', code: TOOL_OUTCOME_UNKNOWN, }) - if (result?.type !== 'tool/result' || result.data.message.content[0].content[0]?.type !== 'text') { + if (result?.type !== 'tool/result' || result.data.message.content[0]?.type !== 'text') { throw new Error('expected a text tool result') } - expect(result.data.message.content[0].content[0].text).toContain('Do not retry blindly.') + expect(result.data.message.content[0].text).toContain('Do not retry blindly.') }) }) diff --git a/packages/session/session-format-catalog/tests/catalog.spec.ts b/packages/session/session-format-catalog/tests/catalog.spec.ts index 45a26e7ccb..5740dc9f8b 100644 --- a/packages/session/session-format-catalog/tests/catalog.spec.ts +++ b/packages/session/session-format-catalog/tests/catalog.spec.ts @@ -263,13 +263,17 @@ describe('first-party Session format catalog', () => { }).toThrow(/format v2 delivery marker claims target format v3/) }) - it('validates complete relationships after streaming migration', () => { + it('finishes a streaming migration with the target header and dense rows', () => { const stream = createSessionFormatCatalogWithChildren([]).createRestore({ - type: 'session', version: 1, id: 'invalid-stream', createdAt: 1, delegationDepth: 0, + type: 'session', version: 1, id: 'streaming', createdAt: 1, delegationDepth: 0, }, { recovery: 'strict', validation: 'current' }) - stream.decodeRow({ type: 'step/start', seq: 0, time: 2, data: { turn: 1, step: 1 } }) + stream.decodeRow({ type: 'feedback/record', seq: 0, time: 2, data: { text: 'retained' } }) - expect(() => stream.finish()).toThrow(/open turn/) + expect(stream.finish()).toMatchObject({ + header: { version: 4, id: 'streaming' }, + inheritedEventCount: 0, + events: [{ type: 'feedback/record', seq: 0 }], + }) }) }) diff --git a/packages/session/session-format-v3-to-v4/README.i18n.yaml b/packages/session/session-format-v3-to-v4/README.i18n.yaml index 9e6766414a..e5925d4d64 100644 --- a/packages/session/session-format-v3-to-v4/README.i18n.yaml +++ b/packages/session/session-format-v3-to-v4/README.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/session/session-format-v3-to-v4/README.md -README.md: 8181860dd816aa2aecbd10a5e3a4dc4703d167db -README.zh.md: 640a20e29b265a9f9cad9f931f08ad0fefb7b04a +README.md: 7c749ecc6cfd721947b18f0458e796325bdb3ecd +README.zh.md: 0746528e52bf211eee8b2617bd28b4f07a7cf0a9 diff --git a/packages/session/session-format-v3-to-v4/README.md b/packages/session/session-format-v3-to-v4/README.md index 8181860dd8..7c749ecc6c 100644 --- a/packages/session/session-format-v3-to-v4/README.md +++ b/packages/session/session-format-v3-to-v4/README.md @@ -1,5 +1,5 @@ --- -description: "Restore V3 Sessions as V4 while preserving events, inherited cuts, and recorded delivery generations." +description: "Restore V3 Sessions as V4 with native tool-role rows, inherited cuts, and recorded delivery generations." kind: "package-library" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -`dsh-session-format-v3-to-v4` restores released V3 Sessions into the unreleased V4 integration format. The incoming edge preserves admitted events, appends missing parent catalog records, and inherits V3 framing and relationship validation. The static format catalog consumes this library; JSONL persistence owns source reads and successor publication. +`dsh-session-format-v3-to-v4` restores released V3 Sessions into the unreleased V4 integration format. Tool results become tool-role messages; the incoming edge preserves admitted events and inherited cuts, appends missing parent catalog records, and prevents historical delivery markers from becoming active V4 watermarks. The V4 codec retains the released physical row framing without invoking the V3 validator; the static format catalog consumes it, while JSONL persistence owns source reads and successor publication. ## Table of Contents @@ -41,15 +41,15 @@ Complete restoration decodes rows, passes them through a fresh stage, and valida ## V3-to-V4 specification -The logical header changes only `version: 3` to `version: 4`. Every admitted event retains its type, payload, timestamp, sequence, message identity, surface operation, and references. The stage emits the original event object. It appends missing own parent catalog records after the unchanged source events. The released V3 codec remains owned by [V2-to-V3](../session-format-v2-to-v3/README.md); this package reuses it without changing earlier migration semantics. +The logical header changes only `version: 3` to `version: 4`. Released user-role tool-result wrappers become tool-role messages with `toolCallId`, optional `isError`, and direct result content. Every admitted source event retains its type, timestamp, sequence, message identity, surface operation, references, and all non-migrated payload fields; the stage appends only missing own parent catalog records after processing the source events. The released V3 codec remains owned by [V2-to-V3](../session-format-v2-to-v3/README.md); this package reuses it without changing earlier migration semantics. Source events must be dense from zero. A seeded Session's last `session/end-seed` carrying `inherited: true` determines its inherited event count, excluding the marker. A supplied source cut must agree. Missing seeded markers and inherited markers in unseeded Sessions are refused. Each stage owns its counters and cut; seeded stages leave the cut unknown before EOF, including when preceding migrations change event count. -Complete restoration applies [native V3 admission](../session-format-v2-to-v3/README.md#native-v3-admission) to the unchanged representation: malformed canonical events and invalid relationships are refused; unknown required event types require installed vocabulary; unknown ignorable events retain their opaque values. This edge changes no source coordinates or payload meaning, so retaining opaque data does not require interpreting it. The separate source-audit policies of earlier edges remain unchanged. +Complete restoration validates native V4 tool and fork results, turn/step order, tool and PTC lifecycles, retries, title citations, commands, compaction ownership and spans, the protected system head, deliveries, catalog membership, inherited cuts, and installed event vocabulary. It permits unfinished tails but refuses closing events with unresolved tools or mismatched transactions. Installed Session restoration owns common event-envelope and message acceptance. The [native validation decision](../../../.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.md) records the ownership split. The V3 semantic validator never receives a V4 event. A `session-log-deepseek/delivery-accepted` event must identify a nonnegative safe-integer generation; omission identifies V0. A source marker claiming V4 is refused because advancing the header would activate it. Source V3 markers require a nonempty Session id and a `throughSeq` that names an earlier event. A foreign V3 marker is permitted only inside the inherited prefix of a Session with `parentSession`. Other generations retain their recorded coordinates and ids. No delivery payload is rewritten. -V4 restoration validates V4 delivery coordinates and ownership under the same rules. V3 deliveries are historical in V4 and do not become V4 watermarks. The V4 codec preserves V3 framing and pre-recovery structural refusal; complete vocabulary, delivery, and relationship checks require the target restorer or catalog `validation: 'current'`. Recoverable codec reads alone do not establish strict restoration. +V4 restoration validates V4 delivery coordinates and ownership under the same rules. V3 deliveries are historical in V4 and do not become V4 watermarks. The V4 codec retains the released V2 physical framing and performs native tool-result and system-message field admission before recovery; complete vocabulary, delivery, and relationship checks require the target restorer or catalog `validation: 'current'`. Retired `header.system` fields and required predecessor PTC tags are refused even in a recoverable suffix; ignorable predecessor PTC records remain opaque. Recoverable codec reads alone do not establish strict restoration. ----- @@ -70,7 +70,7 @@ An existing own parent catalog entry does not require an available child descrip Migration retains every source event, order, sequence, timestamp, and payload, appending missing own catalog records sorted by creation time then child id. Appended records use the last source event time, or header creation time for an empty log. Catalog field and uniqueness checks apply only after the final inherited cut; inherited payloads remain opaque and do not establish own membership. Existing catalog extensions remain intact. -V4 also admits fork-generated `TOOL_NOT_STARTED` results with deterministic `forked-tool-result--` IDs and branch-specific text. Validation checks the advertised call and error result, using a private canonical V3 repair view; persisted and restored data retain the original fork ID and wording. Later surface replacements, including tool-result pruning, retain that identity and validate their source references through the released rules. Released V0–V3 validators remain unchanged. +V4 also admits fork-generated `TOOL_NOT_STARTED` results with deterministic `forked-tool-result--` IDs and branch-specific text. Native validation checks the advertised call, error result, identity suffix, and surface operation directly; persisted and restored data retain the original fork ID and wording. Later surface replacements, including tool-result pruning, retain that identity and validate their source references through the installed Session. Released V0–V3 validators remain unchanged. ## Understand the implementation @@ -78,9 +78,9 @@ V4 also admits fork-generated `TOOL_NOT_STARTED` results with deterministic `for
Implementation internals — click to expand -The migration declaration creates independent streaming stages. Compact runs expand as iterables without an intermediate event array. The V4 codec translates only the physical header version while delegating released V3 event framing and recovery. JSONL scanners call `assertV4RowAdmission` before suppressing recoverable rows. +The migration declaration creates independent streaming stages. Compact runs expand as iterables without an intermediate event array. The V4 codec uses the released V2 codec only for physical header and source-range framing, and validates native tool-role rows directly. JSONL scanners call `assertV4RowAdmission` before suppressing recoverable rows and the shared mandatory relationship validator before returning the completed logical prefix. -The target restorer uses a private V3 relationship view to distinguish V4 deliveries from historical V3 deliveries, then returns the original artifact. Its temporary generation substitutions never escape. No runtime invariant companion is published because this pure library owns no independently maintained runtime observations. +The target restorer validates native fields and mandatory cross-event relationships, then returns the original artifact. Unknown ignorable events remain opaque, and unfinished inherited compactions expire at the end-seed marker. No runtime invariant companion is published because this pure library owns no independently maintained runtime observations.
@@ -102,11 +102,11 @@ The target restorer uses a private V3 relationship view to distinguish V4 delive #### What the model sees -Historical requests retain their recorded messages and model configuration because the [migration stage](src/migration.ts) preserves `SessionFormatEvent.data`. This edge adds no model-visible content. +Historical requests retain their recorded messages and model configuration. The [migration stage](src/migration.ts) represents `tool/result` payloads as tool-role messages without adding model-visible content; catalog records do not enter model messages directly, though later subagent listing can discover the historical children. #### Token effect -Catalog records do not enter model messages directly; subsequent subagent listing can discover the historical children. +The conversion changes no request text or token-bearing data. #### KV Cache effect @@ -117,6 +117,8 @@ The edge preserves the recorded request prefix. Provider cache availability and - **Unreleased integration format** — integrate and validate the selected structural changes before releasing V4; already-written V4 files do not rerun this incoming edge. Use disposable integration homes and retain the original historical inputs. +- **Nested historical tool results** — migration refuses results containing another tool-result wrapper because flattening loses its call identity and error status. The original generation remains intact and no V4 successor is published; those histories need a preserving conversion before they can resume. +- **Historical tool-result extensions** — outer message JSON properties remain own data properties, including `__proto__` and `constructor`. Unknown wrapper fields have no defined V4 destination and refuse migration. Existing outer `toolCallId` or `isError` fields must agree with the lifted result; conflicts refuse without publishing a successor. - **Retained child logs required** — a parent alone cannot recover unrecorded child ids, creation times, or descriptors. Deleted children cannot be reconstructed from tool arguments; existing parent catalog records remain. - **Storage scope** — facts cover recognizable children within the same persistence root. Cross-root import and corrupt-log repair are outside this migration. diff --git a/packages/session/session-format-v3-to-v4/README.zh.md b/packages/session/session-format-v3-to-v4/README.zh.md index 640a20e29b..0746528e52 100644 --- a/packages/session/session-format-v3-to-v4/README.zh.md +++ b/packages/session/session-format-v3-to-v4/README.zh.md @@ -1,5 +1,5 @@ --- -description: "将 V3 Session 恢复为 V4,保留事件、继承切分点和已记录的投递代际。" +description: "将 V3 Session 恢复为 V4,使用原生工具角色行并保留继承切分点和已记录的投递代际。" kind: "package-library" --- @@ -9,7 +9,7 @@ kind: "package-library" ## 概述 -`dsh-session-format-v3-to-v4` 将已发布的 V3 Session 恢复为尚未发布的 V4 集成格式。入边保留已接纳事件,追加缺失的父目录记录,并继承 V3 分帧与关系校验。静态格式目录使用本库;JSONL 持久化负责源读取和后继代发布。 +`dsh-session-format-v3-to-v4` 将已发布的 V3 Session 恢复为尚未发布的 V4 集成格式。工具结果转换为工具角色消息;入边保留已接纳事件和继承切分点,追加缺失的自身父目录记录,并防止历史投递标记成为生效的 V4 水位。V4 编解码器保留已发布的物理行格式,但不调用 V3 校验器;静态格式目录使用本库,JSONL 持久化负责源读取和后继代发布。 ## 目录 @@ -41,15 +41,15 @@ const targetHeader = sessionFormatV3ToV4.migrateHeader(sourceHeader) ## V3 到 V4 规范 -逻辑头部只将 `version: 3` 改为 `version: 4`。每个获准事件都保留其类型、载荷、时间戳、序号、消息身份、surface 操作和引用。Stage 输出原始事件对象,并在未改变的源事件之后追加缺失的自身父目录记录。已发布 V3 编解码器仍由 [V2 到 V3](../session-format-v2-to-v3/README.zh.md)拥有;本包复用它,不改变较早迁移的语义。 +逻辑头部只将 `version: 3` 改为 `version: 4`。已发布的用户角色工具结果包装转换为工具角色消息,包含 `toolCallId`、可选的 `isError` 和直接结果内容。每个获准源事件都保留其类型、时间戳、序号、消息身份、surface 操作、引用和所有未迁移的载荷字段;Stage 处理源事件之后只追加缺失的自身父目录记录。已发布 V3 编解码器仍由 [V2 到 V3](../session-format-v2-to-v3/README.zh.md)拥有;本包复用它,不改变较早迁移的语义。 源事件必须从零开始连续编号。带种子的 Session 中,最后一个携带 `inherited: true` 的 `session/end-seed` 决定继承事件数,不包含该标记本身。传入的源切分点必须与之相符。带种子却缺少标记,或不带种子却出现继承标记的 Session 均被拒绝。每个 Stage 独立拥有计数器和切分点;带种子的 Stage 在 EOF 前保持切分点未知,包括前序迁移改变事件数的情况。 -完整恢复对未改变的表示应用[原生 V3 准入规则](../session-format-v2-to-v3/README.zh.md#native-v3-admission):拒绝格式错误的规范事件和无效关系;未知必需事件类型要求已安装的事件词表支持;未知可忽略事件保留其不透明值。该迁移不改变源坐标或载荷含义,因此保留不透明数据不需要解释其内容。较早迁移边各自的源审计策略保持不变。 +完整恢复校验原生 V4 工具与 fork 结果、turn/step 顺序、工具与 PTC 生命周期、重试、标题引用、命令、压缩归属与区间、受保护的 system 首节点、投递、目录成员关系、继承切分点及已安装的事件词表。它允许未完成的尾部,但会拒绝带有未结算工具或事务不匹配的关闭事件。已安装的 Session 恢复器负责通用事件行和消息的接纳。[原生校验决策](../../../.agents/notes/implemented/architecture/2026-09-17-native-v4-read-validation.zh.md)记录了职责划分。V3 语义校验器永远不会接收 V4 事件。 `session-log-deepseek/delivery-accepted` 事件必须标识非负安全整数代际;省略时表示 V0。声称属于 V4 的源标记会被拒绝,因为推进头部会使它生效。源 V3 标记要求非空 Session id,以及指向较早事件的 `throughSeq`。属于其他 Session 的 V3 标记只允许出现在带有 `parentSession` 的 Session 的继承前缀中。其他代际保留记录的坐标和 id。任何投递载荷都不会被重写。 -V4 恢复按相同规则校验 V4 投递坐标和归属。V3 投递在 V4 中属于历史数据,不会成为 V4 水位。V4 编解码器保留 V3 行格式和恢复前的结构性拒绝规则;完整的词表、投递和关系校验需要目标恢复器或目录的 `validation: 'current'`。仅执行可恢复编解码读取不能证明严格恢复成功。 +V4 恢复按相同规则校验 V4 投递坐标和归属。V3 投递在 V4 中属于历史数据,不会成为 V4 水位。V4 编解码器只复用已发布 V2 的物理分帧,并在恢复前直接执行原生工具结果和 system 消息字段准入;完整的词表、投递和关系校验需要目标恢复器或目录的 `validation: 'current'`。即使位于可恢复的后缀,退役的 `header.system` 字段和必需的前代 PTC 标签也会被拒绝;可忽略的前代 PTC 记录保持不透明。仅执行可恢复编解码读取不能证明严格恢复成功。 ----- @@ -70,7 +70,7 @@ const artifact = restore.finish() 迁移保留每个来源事件及其顺序、序号、时间和 payload,仅按创建时间、子 id 排序追加缺失的自身目录记录。追加时间使用来源最后一个事件的时间,空日志使用 header 创建时间。目录字段与唯一性检查仅作用于最终继承截点之后的记录;继承的 payload 保持不透明,也不计入自身成员关系。已有目录的扩展字段原样保留。 -V4 还接受 fork 生成的 `TOOL_NOT_STARTED` 结果,使用确定性的 `forked-tool-result--` ID 和分支专用文案。校验通过内部规范 V3 修复视图检查声明的调用和错误结果;持久化与恢复的数据保留原始 fork ID 和文案。后续 surface 替换(包括工具结果裁剪)保留该身份,并通过已发布规则校验其源引用。已发布的 V0–V3 校验器保持不变。 +V4 还接受 fork 生成的 `TOOL_NOT_STARTED` 结果,使用确定性的 `forked-tool-result--` ID 和分支专用文案。原生校验直接检查声明的调用、错误结果、身份后缀和 surface 操作;持久化与恢复的数据保留原始 fork ID 和文案。后续 surface 替换(包括工具结果裁剪)保留该身份,并由已安装的 Session 校验其源引用。已发布的 V0–V3 校验器保持不变。 ## 理解实现 @@ -78,9 +78,9 @@ V4 还接受 fork 生成的 `TOOL_NOT_STARTED` 结果,使用确定性的 `fork
实现内部机制 — 点击展开 -迁移声明创建相互独立的流式 Stage。紧凑事件段通过迭代器展开,不生成中间事件数组。V4 编解码器只转换物理头部版本,将已发布 V3 事件行格式和恢复行为委托给原编解码器。JSONL 扫描器在抑制可恢复行之前调用 `assertV4RowAdmission`。 +迁移声明创建相互独立的流式 Stage。紧凑事件段通过迭代器展开,不生成中间事件数组。V4 编解码器只为物理头部和源范围分帧使用已发布 V2 编解码器,并直接校验原生工具角色行。JSONL 扫描器在抑制可恢复行之前调用 `assertV4RowAdmission`,并在返回完整逻辑前缀之前调用共用的强制关系校验器。 -目标恢复器通过私有 V3 关系视图区分 V4 投递和历史 V3 投递,然后返回原始产物。临时的代际替换不会离开该视图。本包不发布运行时不变量伴随插件,因为这个纯函数库不拥有独立维护的运行时观测。 +目标恢复器校验原生字段和强制跨事件关系,然后返回原始产物。未知的可忽略事件保持不透明,未完成的继承压缩事务在 end-seed 标记处结束。本包不发布运行时不变量伴随插件,因为这个纯函数库不拥有独立维护的运行时观测。
@@ -102,11 +102,11 @@ V4 还接受 fork 生成的 `TOOL_NOT_STARTED` 结果,使用确定性的 `fork #### 模型看到什么 -历史请求保留记录的消息与模型配置,因为[迁移 Stage](src/migration.ts)保留 `SessionFormatEvent.data`。该迁移边不添加模型可见内容。 +历史请求保留记录的消息与模型配置。[迁移 Stage](src/migration.ts)将 `tool/result` 载荷表示为工具角色消息,不添加模型可见内容;目录记录不会直接进入模型消息,后续子代理列举可以发现历史子 Session。 #### Token 影响 -目录记录不直接进入模型消息;后续子代理列举可以发现历史子 Session。 +转换不改变请求文本或承载 token 的数据。 #### KV Cache 影响 @@ -117,6 +117,8 @@ V4 还接受 fork 生成的 `TOOL_NOT_STARTED` 结果,使用确定性的 `fork - **尚未发布的集成格式**——发布 V4 前须集成并验证选定的结构变更;已写入的 V4 文件不会重跑此入边。使用可丢弃的集成 home,并保留原始历史输入。 +- **历史嵌套工具结果**——迁移会拒绝包含另一层 tool-result 包装的结果,因为展平会丢失其调用身份和错误状态。原始代际保持不变,也不会发布 V4 后继;这些历史需要能保留信息的转换才能继续运行。 +- **历史工具结果扩展**——外层消息的 JSON 属性仍保留为自有数据属性,包括 `__proto__` 和 `constructor`。未知 wrapper 字段没有已定义的 V4 存放位置,因此拒绝迁移。已有外层 `toolCallId` 或 `isError` 字段必须与提升后的结果一致;冲突时拒绝且不发布 successor。 - **依赖保留的子日志**——仅凭父日志无法恢复未记录的子 id、创建时间或 descriptor。删除的子 Session 无法从工具参数恢复;已存在的父目录记录仍保留。 - **存储范围**——事实只覆盖同一持久化根目录内可识别的子 Session。跨根目录导入和损坏日志修复不属于此迁移。 diff --git a/packages/session/session-format-v3-to-v4/package.json b/packages/session/session-format-v3-to-v4/package.json index fe8d1e734e..d99577e387 100644 --- a/packages/session/session-format-v3-to-v4/package.json +++ b/packages/session/session-format-v3-to-v4/package.json @@ -1,6 +1,6 @@ { "name": "@deepseek-ai/dsh-session-format-v3-to-v4", - "description": "Streaming identity migration and delivery validation from Session V3 to V4", + "description": "Streaming tool-role migration and delivery validation from Session V3 to V4", "version": "0.1.6-alpha.2", "publishConfig": { "access": "public" diff --git a/packages/session/session-format-v3-to-v4/src/codec.ts b/packages/session/session-format-v3-to-v4/src/codec.ts index 889ad45400..10d577d3e4 100644 --- a/packages/session/session-format-v3-to-v4/src/codec.ts +++ b/packages/session/session-format-v3-to-v4/src/codec.ts @@ -1,57 +1,61 @@ -/** V4 framing retains released V3 event encoding and structural admission. */ +/** V4 framing with native tool-role admission and released physical rows. */ -import { SessionFormatError, isSessionFormatJsonObject, snapshotSessionFormatJson } from '@deepseek-ai/dsh-session-format' +import { SessionFormatError, isSessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' import type { SessionFormatCodec, SessionFormatCurrentEncoder, SessionFormatHeader, SessionFormatEvent } from '@deepseek-ai/dsh-session-format' -import { assertV3RowAdmission, releasedV3SessionFormatCodec } from '@deepseek-ai/dsh-session-format-v2-to-v3' +import { releasedV2SessionFormatCodec } from '@deepseek-ai/dsh-session-format-v2-to-v3' +import { assertV4RetiredSyntax } from './retired-syntax.ts' +import { assertV4SystemMessageFields } from './system-message.ts' +import { assertV4ForkResult } from './fork-result.ts' +import { assertV4ToolResultMessage } from './tool-role.ts' import { assertReleasedV4Header } from './validation.ts' -import { forkResultValidationView } from './fork-result.ts' -/** V4 codec preserves the released V3 physical event representation. */ +function physicalV2(value: unknown): SessionFormatHeader { + if (!isSessionFormatJsonObject(value) || value['version'] !== 4) throw new SessionFormatError('expected format v4 physical header') + return { ...value, version: 2 } as SessionFormatHeader +} + +/** + * V4 physical encoder and decoder retain the released row framing while + * validating the native tool-role message directly. + */ export const releasedV4SessionFormatCodec = Object.freeze({ version: 4, decodeHeader(value: unknown) { - return { ...releasedV3SessionFormatCodec.decodeHeader(physicalV3(value)), version: 4 } + return { ...releasedV2SessionFormatCodec.decodeHeader(physicalV2(value)), version: 4 } }, createDecoder(value, recovery) { - const decoder = releasedV3SessionFormatCodec.createDecoder(physicalV3(value), recovery) + const decoder = releasedV2SessionFormatCodec.createDecoder(physicalV2(value), recovery) return { ...decoder, header: { ...decoder.header, version: 4 }, decodeRow(row, context) { - const view = forkResultValidationView(row) - decoder.decodeRow(view, { + assertV4RowAdmission(row) + decoder.decodeRow(row, { emitRun: context.emitRun.bind(context), - emitEvent(event) { - context.emitEvent(view === row ? event : { - ...event, data: snapshotSessionFormatJson((row as SessionFormatEvent).data, 'V4 fork result data'), - }) - }, + emitEvent: context.emitEvent.bind(context), }) }, } }, encodeHeader(header, inheritedEventCount) { assertReleasedV4Header(header) - return { ...releasedV3SessionFormatCodec.encodeHeader({ ...header, version: 3 }, inheritedEventCount), version: 4 } + return { ...releasedV2SessionFormatCodec.encodeHeader({ ...header, version: 2 }, inheritedEventCount), version: 4 } }, - encodeEvent(event) { - const view = forkResultValidationView(event) - const encoded = releasedV3SessionFormatCodec.encodeEvent(view) - return view === event ? encoded : { ...encoded, data: snapshotSessionFormatJson(event.data, 'V4 fork result data') } + encodeEvent(event: SessionFormatEvent) { + assertV4RowAdmission(event) + return releasedV2SessionFormatCodec.encodeEvent(event) }, } satisfies SessionFormatCodec & SessionFormatCurrentEncoder) /** - * Apply V4 structural admission before a scanner discards a recoverable suffix. + * Apply native V4 admission before a scanner discards a recoverable suffix. * @param row - parsed physical row before framing and source-event range decoding. */ export function assertV4RowAdmission(row: unknown): void { - assertV3RowAdmission(forkResultValidationView(row)) -} - -function physicalV3(value: unknown): SessionFormatHeader { - if (!isSessionFormatJsonObject(value) || value['version'] !== 4) { - throw new SessionFormatError('expected format v4 physical Session header') - } - return { ...value, version: 3 } as SessionFormatHeader + assertV4RetiredSyntax(row) + assertV4SystemMessageFields(row) + if (!isSessionFormatJsonObject(row) || row['type'] !== 'tool/result') return + const event = row as unknown as SessionFormatEvent + assertV4ToolResultMessage(event) + assertV4ForkResult(event) } diff --git a/packages/session/session-format-v3-to-v4/src/fork-result.ts b/packages/session/session-format-v3-to-v4/src/fork-result.ts index 31ce3b32db..352a31d1a7 100644 --- a/packages/session/session-format-v3-to-v4/src/fork-result.ts +++ b/packages/session/session-format-v3-to-v4/src/fork-result.ts @@ -1,25 +1,21 @@ -/** V4 fork-result admission for the private released-validator view. */ +/** Native V4 fork-result identity and not-started error validation. */ import { SessionFormatError, isSessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' -import type { SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' /** - * Present a V4 not-started fork result to the frozen V3 validators. - * Only the private view changes; codecs preserve the original result data. - * Tool-result rows encode one event each. Replacements retain the original - * identity suffix while the released validator checks their surface references. + * Validate fork-generated not-started results without changing their identity or text. + * Append results carry their own sequence; replacement results retain an earlier identity. * @param row - logical event or physical event row. - * @returns the original row, or its validated fork result represented as a V3 repair. */ -export function forkResultValidationView(row: T): T { - if (!isSessionFormatJsonObject(row) || row['type'] !== 'tool/result') return row +export function assertV4ForkResult(row: unknown): void { + if (!isSessionFormatJsonObject(row) || row['type'] !== 'tool/result') return const data = row['data'] - if (!isSessionFormatJsonObject(data)) return row + if (!isSessionFormatJsonObject(data)) return const error = data['error'] const message = data['message'] if (!isSessionFormatJsonObject(error) || error['code'] !== 'TOOL_NOT_STARTED' || !isSessionFormatJsonObject(message) || typeof message['id'] !== 'string' - || !message['id'].startsWith('forked-tool-result-')) return row + || !message['id'].startsWith('forked-tool-result-')) return const source = message['source'] const callId = isSessionFormatJsonObject(source) ? source['callId'] : undefined const prefix = `forked-tool-result-${String(callId)}-` @@ -28,25 +24,17 @@ export function forkResultValidationView(row: T): T { const replacement = isSessionFormatJsonObject(operation) && operation['op'] === 'replace' const sequence = Number(suffix) const content = message['content'] - const block: unknown = Array.isArray(content) && content.length === 1 ? content[0] : undefined - const result = isSessionFormatJsonObject(block) ? block['content'] : undefined - const text: unknown = Array.isArray(result) && result.length === 1 ? result[0] : undefined + const text: unknown = Array.isArray(content) && content.length === 1 ? content[0] : undefined + const sourceEventSeqs = row['sourceEventSeqs'] if (typeof callId !== 'string' || !message['id'].startsWith(prefix) || !/^(0|[1-9]\d*)$/.test(suffix) || !Number.isSafeInteger(sequence) || (replacement ? typeof row['seq'] !== 'number' || sequence >= row['seq'] : sequence !== row['seq']) || error['name'] !== 'ToolNotStartedError' - || (!replacement && (row['sourceEventSeqs'] !== undefined || operation !== 'append')) || !isSessionFormatJsonObject(block) - || block['type'] !== 'tool-result' || block['isError'] !== true || block['toolCallId'] !== callId + || (!replacement && (sourceEventSeqs !== undefined || operation !== 'append')) + || (replacement && (!Array.isArray(sourceEventSeqs) || sourceEventSeqs.length !== 1 || sourceEventSeqs[0] !== sequence)) + || message['role'] !== 'tool' || message['isError'] !== true || message['toolCallId'] !== callId + || !isSessionFormatJsonObject(source) || source['kind'] !== 'tool' || !isSessionFormatJsonObject(text) || text['type'] !== 'text' || typeof text['text'] !== 'string') { throw new SessionFormatError('invalid V4 not-started fork result') } - const canonical: SessionFormatJsonObject = { - ...data, - message: { - ...message, - id: `interrupted-tool-result-${callId}-${suffix}`, - content: [{ ...block, content: [{ ...text, text: 'The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed.' }] }], - }, - } - return { ...row, data: canonical } } diff --git a/packages/session/session-format-v3-to-v4/src/index.ts b/packages/session/session-format-v3-to-v4/src/index.ts index 439ea404cf..7e59150a6c 100644 --- a/packages/session/session-format-v3-to-v4/src/index.ts +++ b/packages/session/session-format-v3-to-v4/src/index.ts @@ -1,4 +1,4 @@ -/** V3 framing and adjacent historical parent-catalog migration into V4. */ +/** Tool-role V3-to-V4 migration with native V4 framing and delivery validation. */ export { releasedV3SessionFormatCodec } from '@deepseek-ai/dsh-session-format-v2-to-v3' export * from './codec.ts' diff --git a/packages/session/session-format-v3-to-v4/src/migration.ts b/packages/session/session-format-v3-to-v4/src/migration.ts index 228715d53a..72c77219cd 100644 --- a/packages/session/session-format-v3-to-v4/src/migration.ts +++ b/packages/session/session-format-v3-to-v4/src/migration.ts @@ -1,8 +1,9 @@ -/** Append historical child facts after the unchanged V3 source suffix. */ +/** Append historical child facts after converting V3 source events to V4. */ import { defineSessionFormatMigration, SessionFormatError, SessionFormatUnsupportedMigrationError, isSessionFormatJsonObject, sessionFormatCount } from '@deepseek-ai/dsh-session-format' import type { SessionFormatEvent, SessionFormatEventRun, SessionFormatJsonObject, SessionFormatJsonValue, SessionFormatMigration, SessionFormatMigrationContext, SessionFormatMigrationStage, SessionFormatMigrationStageInput } from '@deepseek-ai/dsh-session-format' import { assertReleasedV3Header } from '@deepseek-ai/dsh-session-format-v2-to-v3' +import { liftToolResult } from './tool-role.ts' import { assertReleasedV4Header, validateDeliveryAccepted } from './validation.ts' import { catalogFact, childCatalogSource, childCatalogFact, childCatalogSubject } from './facts.ts' @@ -68,7 +69,7 @@ class ReleasedV3ToV4Stage implements SessionFormatMigrationStage { } if (deliveryId !== undefined && deliveryId !== this.input.sourceHeader.id) this.foreignDeliverySeq = event.seq } - context.emitEvent(event) + context.emitEvent(liftToolResult(event)) } transformRun(run: SessionFormatEventRun, context: SessionFormatMigrationContext): void { diff --git a/packages/session/session-format-v3-to-v4/src/relationships.ts b/packages/session/session-format-v3-to-v4/src/relationships.ts new file mode 100644 index 0000000000..6da2a8898c --- /dev/null +++ b/packages/session/session-format-v3-to-v4/src/relationships.ts @@ -0,0 +1,356 @@ +/** Mandatory native V4 relationships; incomplete tails retain their open transactions. */ + +import { isDeepStrictEqual } from 'node:util' +import { SessionFormatError, isSessionFormatJsonObject, sessionFormatCount } from '@deepseek-ai/dsh-session-format' +import type { SessionFormatArtifact, SessionFormatEvent, SessionFormatJsonObject, SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format' + +const SURFACE_TYPES = new Set(['system/message', 'user/message', 'assistant/message', 'tool/result']) +const STEP_EVENT_TYPES = new Set(['system/message', 'assistant/attempt']) +const RELATIONSHIP_TYPES = new Set([ + ...SURFACE_TYPES, ...STEP_EVENT_TYPES, 'turn/start', 'turn/end', 'step/start', 'step/end', + 'tool/call', 'request/header', 'request/context', 'tool/ptc-dispatch-start', 'tool/ptc-dispatch', + 'llm/retry', 'llm/retry-started', 'session/title', 'session/title-llm-request', 'command/run', + 'command/done', 'compaction/start', 'compaction/summary', 'compaction/end', 'compaction/prune', 'session/end-seed', +]) + +function record(value: SessionFormatJsonValue | undefined, subject: string): SessionFormatJsonObject { + if (!isSessionFormatJsonObject(value)) throw new SessionFormatError(`${subject} requires an object`) + return value +} + +function text(value: SessionFormatJsonValue | undefined, subject: string): string { + if (typeof value !== 'string' || value.length === 0) throw new SessionFormatError(`${subject} requires a nonempty string`) + return value +} + +function array(value: SessionFormatJsonValue | undefined, subject: string): readonly SessionFormatJsonValue[] { + if (!Array.isArray(value)) throw new SessionFormatError(`${subject} requires an array`) + return value as readonly SessionFormatJsonValue[] +} + +function earlier(value: SessionFormatJsonValue | undefined, seq: number, subject: string): number { + const coordinate = sessionFormatCount(value, subject) + if (coordinate >= seq) throw new SessionFormatError(`${subject} must name an earlier event`) + return coordinate +} + +interface ToolState { + readonly name: SessionFormatJsonValue | undefined + readonly arguments: SessionFormatJsonValue | undefined + started: boolean +} + +interface Compaction { + readonly id: string + readonly command: SessionFormatJsonValue | undefined + readonly turn: number | null + readonly seq: number + summarized: boolean +} + +/** One native artifact's lifecycle state; no state survives between reads. */ +class Relationships { + turn: number | null = null + step: number | null = null + nextTurn = 1 + nextStep = 1 + provider: SessionFormatJsonValue | undefined + surface: number[] = [] + protectedHead: number | undefined + compaction: Compaction | undefined + readonly tools = new Map() + readonly dispatches = new Map() + readonly retries: SessionFormatJsonObject[] = [] + readonly startedRetries = new Set() + readonly commands = new Set() + readonly orphanCompactions = new Set() + + constructor(readonly artifact: SessionFormatArtifact, readonly knownEventTypes: ReadonlySet) { + let start: number | undefined + for (const event of artifact.events) { + if (!knownEventTypes.has(event.type)) continue + if (event.type === 'compaction/start') start = event.seq + if (event.type === 'compaction/end') start = undefined + if (event.type === 'session/end-seed') { + if (start !== undefined) this.orphanCompactions.add(start) + start = undefined + } + } + } + + requireTurn(type: string): void { + if (this.turn === null) throw new SessionFormatError(`${type} is outside an open turn`) + } + + requireStep(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + if (this.turn === null || this.step === null || data['turn'] !== this.turn || data['step'] !== this.step) { + throw new SessionFormatError(`${event.type} does not match an open turn and step`) + } + } + + closeTools(type: string): void { + if (this.tools.size !== 0) throw new SessionFormatError(`${type} leaves unresolved tool call ${String(this.tools.keys().next().value)}`) + this.tools.clear() + } + + foldSurface(event: SessionFormatEvent): void { + if (!SURFACE_TYPES.has(event.type)) return + if (event.type === 'system/message' && this.surface.length > 0 && this.protectedHead === undefined) { + throw new SessionFormatError('system/message requires a protected first surface head') + } + if (event['surfaceOp'] === 'append') { + if (event.type === 'system/message' && this.surface.length === 0) this.protectedHead = event.seq + this.surface.push(event.seq) + return + } + const operation = record(event['surfaceOp'], `${event.type} surfaceOp`) + const first = this.surface.indexOf(earlier(operation['startSeq'], event.seq, 'replacement start')) + const last = this.surface.indexOf(earlier(operation['endSeq'], event.seq, 'replacement end')) + if (first < 0 || last < first) throw new SessionFormatError(`${event.type} replacement range is not on the current surface`) + const removed = this.surface.slice(first, last + 1) + const sources = array(event['sourceEventSeqs'], 'replacement sourceEventSeqs') + if (removed.some(seq => !sources.includes(seq))) throw new SessionFormatError('replacement sourceEventSeqs omit a shadowed surface node') + if (this.protectedHead !== undefined && removed.includes(this.protectedHead)) { + if (event.type !== 'system/message' || removed.length !== 1) throw new SessionFormatError('surface replacement cannot shadow the protected system head') + this.protectedHead = event.seq + } + this.surface.splice(first, removed.length, event.seq) + } + + tool(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + if (event.type === 'tool/result' && event['surfaceOp'] !== 'append') { + this.requireTurn(event.type) + return + } + this.requireStep(event, data) + if (event.type === 'assistant/message') { + const message = record(data['message'], 'assistant message') + for (const value of array(message['content'], 'assistant content')) { + const block = record(value, 'assistant content block') + if (block['type'] !== 'tool-call') continue + const id = text(block['id'], 'tool call id') + if (this.tools.has(id)) throw new SessionFormatError(`assistant/message repeats advertised tool call ${id}`) + this.tools.set(id, { name: block['name'], arguments: block['arguments'], started: false }) + } + return + } + const message = event.type === 'tool/result' ? record(data['message'], 'tool result message') : undefined + const id = text(message === undefined ? data['callId'] : message['toolCallId'], 'tool call id') + const pending = this.tools.get(id) + if (pending === undefined) throw new SessionFormatError(`${event.type} ${id} has no advertised tool lifecycle`) + if (message === undefined) { + if (pending.started || pending.name !== data['name'] || pending.arguments !== data['arguments']) { + throw new SessionFormatError(`tool/call ${id} does not match one advertised tool call`) + } + pending.started = true + } else { + if (!pending.started && !notStartedRepair(event, data, message, id)) { + throw new SessionFormatError(`tool/result ${id} is not the exact TOOL_NOT_STARTED repair`) + } + this.tools.delete(id) + } + } + + dispatch(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + this.requireTurn(event.type) + const id = text(data['subCallId'], 'PTC subCallId') + const root = text(data['rootCallId'], 'PTC rootCallId') + const parent = text(data['parentCallId'], 'PTC parentCallId') + const existing = this.dispatches.get(id) + if (existing !== undefined && existing.data['rootCallId'] !== root) throw new SessionFormatError('PTC dispatch changes its rootCallId') + if (parent !== root && this.dispatches.get(parent)?.data['rootCallId'] !== root) throw new SessionFormatError('PTC parentCallId does not belong to rootCallId') + if (event.type === 'tool/ptc-dispatch-start') { + if (existing !== undefined) throw new SessionFormatError('PTC dispatch repeats subCallId') + this.dispatches.set(id, { data, settled: false }) + return + } + if (existing === undefined || existing.settled) throw new SessionFormatError('PTC dispatch has no unique start') + if (['rootCallId', 'parentCallId', 'name', 'arguments'].some(key => !isDeepStrictEqual(existing.data[key], data[key]))) { + throw new SessionFormatError('PTC dispatch does not match its start') + } + existing.settled = true + } + + retry(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + const id = text(data['retryId'], 'retryId') + const attempt = sessionFormatCount(data['retry'], 'retry') + if (event.type === 'llm/retry-started') { + const scheduled = this.retries.find(item => item['retryId'] === id && item['retry'] === attempt) + if (scheduled === undefined) throw new SessionFormatError('llm/retry-started pairs no prior scheduled attempt') + if (scheduled['turn'] !== data['turn'] || scheduled['step'] !== data['step']) throw new SessionFormatError('llm/retry-started changes scheduled coordinates') + const key = JSON.stringify([id, attempt]) + if (this.startedRetries.has(key)) throw new SessionFormatError('llm/retry-started repeats one scheduled attempt') + this.startedRetries.add(key) + return + } + if (this.turn === null || data['turn'] !== this.turn || data['step'] !== (this.step ?? this.nextStep - 1)) { + throw new SessionFormatError('llm/retry does not match the current turn and step') + } + if (data['provider'] !== this.provider) throw new SessionFormatError('llm/retry provider does not match the open request/header') + const prior = this.retries.findLast(item => ['turn', 'step', 'provider', 'policyKey'].every(key => item[key] === data[key])) + if (attempt !== (prior === undefined ? 1 : sessionFormatCount(prior['retry'], 'prior retry') + 1)) throw new SessionFormatError('llm/retry skips its policy attempt sequence') + if (prior === undefined ? this.retries.some(item => item['retryId'] === id) : prior['retryId'] !== id) { + throw new SessionFormatError('llm/retry must keep one retryId per policy chain') + } + this.retries.push(data) + } + + compact(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + if (event.type === 'compaction/prune' || event.type === 'compaction/summary') this.span(event, data) + if (event.type === 'compaction/prune') return + if (event.type === 'compaction/start') { + if (this.compaction !== undefined) throw new SessionFormatError('compaction/start overlaps an open compaction') + const owner = data['turn'] === null ? null : sessionFormatCount(data['turn'], 'compaction turn') + if (owner !== this.turn) throw new SessionFormatError('compaction/start does not match the open turn') + this.compaction = { id: text(data['compactionId'], 'compactionId'), command: data['sourceCommandId'], turn: owner, seq: event.seq, summarized: false } + return + } + const current = this.compactionOwner(data, event.type) + if (current.turn !== this.turn) throw new SessionFormatError(`${event.type} does not match the open turn`) + if (event.type === 'compaction/summary') { + if (current.summarized) throw new SessionFormatError('compaction/summary repeats') + current.summarized = true + } else { + if (data['turn'] !== current.turn) throw new SessionFormatError('compaction/end changes its owner turn') + if (data['error'] === undefined && !current.summarized) throw new SessionFormatError('successful compaction/end requires one summary') + this.compaction = undefined + } + } + + compactionOwner(data: SessionFormatJsonObject, subject: string): Compaction { + if (this.compaction === undefined || this.compaction.id !== data['compactionId'] || this.compaction.command !== data['sourceCommandId']) { + throw new SessionFormatError(`${subject} has no matching compaction/start`) + } + return this.compaction + } + + span(event: SessionFormatEvent, data: SessionFormatJsonObject): void { + const range = record(data['shadowedRange'], 'compaction shadowedRange') + const start = this.surface.indexOf(earlier(range['start'], event.seq, 'compaction range start')) + const end = this.surface.indexOf(earlier(range['end'], event.seq, 'compaction range end')) + const seqs = array(data['shadowedSeqs'], 'compaction shadowedSeqs') + if (start < 0 || end < start || !isDeepStrictEqual(this.surface.slice(start, end + 1), seqs)) { + throw new SessionFormatError(`${event.type} shadowedSeqs do not name an exact current surface span`) + } + if (this.protectedHead !== undefined && seqs.includes(this.protectedHead)) throw new SessionFormatError('compaction cannot shadow the protected system head') + } + + accept(event: SessionFormatEvent): void { + if (!this.knownEventTypes.has(event.type) || !RELATIONSHIP_TYPES.has(event.type)) return + const data = record(event.data, event.type) + if (STEP_EVENT_TYPES.has(event.type)) this.requireStep(event, data) + if (event.type.startsWith('turn/') && this.compaction !== undefined && !this.orphanCompactions.has(this.compaction.seq)) { + throw new SessionFormatError(`${event.type} crosses an open compaction`) + } + this.foldSurface(event) + switch (event.type) { + case 'turn/start': + if (this.turn !== null || data['turn'] !== this.nextTurn) throw new SessionFormatError('turn/start does not open the expected turn') + this.turn = this.nextTurn + this.nextStep = 1 + this.tools.clear() + break + case 'turn/end': + if (this.turn === null || data['turn'] !== this.turn || this.step !== null) throw new SessionFormatError('turn/end does not match the open turn with no open step') + this.closeTools(event.type) + this.turn = null + this.nextTurn += 1 + break + case 'step/start': + if (this.turn === null || data['turn'] !== this.turn || this.step !== null || data['step'] !== this.nextStep) throw new SessionFormatError('step/start does not match the open turn and next step') + this.step = this.nextStep + break + case 'step/end': + this.requireStep(event, data) + this.closeTools(event.type) + this.step = null + this.nextStep += 1 + break + case 'assistant/message': case 'tool/call': case 'tool/result': this.tool(event, data); break + case 'request/header': + this.requireTurn(event.type) + this.provider = record(record(data['header'], 'request header')['config'], 'request config')['provider'] + break + case 'request/context': this.requireTurn(event.type); break + case 'tool/ptc-dispatch-start': case 'tool/ptc-dispatch': this.dispatch(event, data); break + case 'llm/retry': case 'llm/retry-started': this.retry(event, data); break + case 'session/title': case 'session/title-llm-request': titleSources(this.artifact.events, event, data, this.knownEventTypes); break + case 'command/run': { + const id = text(data['commandId'], 'commandId') + if (this.commands.has(id)) throw new SessionFormatError(`command/run repeats commandId ${id}`) + this.commands.add(id) + break + } + case 'command/done': { + if (!this.commands.has(text(data['commandId'], 'commandId'))) throw new SessionFormatError('command/done has no prior command/run') + if (data['sourceEventSeq'] !== undefined) { + const source = this.artifact.events[earlier(data['sourceEventSeq'], event.seq, 'command sourceEventSeq')] + if (data['kind'] !== 'success' || source?.type === 'command/run' || source?.type === 'command/done') throw new SessionFormatError('command/done has invalid sourceEventSeq') + } + break + } + case 'compaction/start': case 'compaction/summary': case 'compaction/end': case 'compaction/prune': this.compact(event, data); break + case 'user/message': { + const source = record(data['source'], 'user message source') + if (event['surfaceOp'] !== 'append' && source['kind'] === 'plugin' && source['plugin'] === 'compact') this.compactionOwner(source, 'compaction checkpoint') + break + } + case 'session/end-seed': this.compaction = undefined; break + } + } +} + +function notStartedRepair( + event: SessionFormatEvent, data: SessionFormatJsonObject, message: SessionFormatJsonObject, callId: string, +): boolean { + const error = record(data['error'], 'not-started error') + if (error['name'] !== 'ToolNotStartedError' || error['code'] !== 'TOOL_NOT_STARTED' || message['isError'] !== true || event['sourceEventSeqs'] !== undefined) return false + const id = text(message['id'], 'not-started message id') + // Fork-specific fields and identity are checked by assertV4ForkResult before relationships. + if (id.startsWith(`forked-tool-result-${callId}-`)) return true + const prefix = `interrupted-tool-result-${callId}-` + const suffix = id.slice(prefix.length) + const content = array(message['content'], 'not-started content') + const block = content[0] + return id.startsWith(prefix) && /^(0|[1-9]\d*)$/.test(suffix) && Number.isSafeInteger(Number(suffix)) + && content.length === 1 && isSessionFormatJsonObject(block) && block['type'] === 'text' + && block['text'] === 'The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed.' +} + +function titleSources( + events: readonly SessionFormatEvent[], event: SessionFormatEvent, data: SessionFormatJsonObject, knownEventTypes: ReadonlySet, +): void { + const references = array(data['messageSeqs'], 'title messageSeqs') + if (event.type === 'session/title' && (references.length === 0) !== (record(data['source'], 'title source')['kind'] === 'user')) { + throw new SessionFormatError('session/title messageSeqs must be empty exactly for a user title') + } + const seen = new Set() + for (const value of references) { + const seq = earlier(value, event.seq, 'title messageSeqs') + const source = events[seq] + if (seen.has(seq) || source?.type !== 'user/message' || !knownEventTypes.has(source.type) || record(record(source.data, 'title input')['source'], 'title input source')['kind'] !== 'user') { + throw new SessionFormatError(`${event.type} messageSeqs must cite distinct earlier human user/message events`) + } + seen.add(seq) + } + if (event.type !== 'session/title-llm-request') return + const messages = array(data['messages'], 'title messages') + const message = record(messages[0], 'title message') + const content = array(message['content'], 'title content') + const block = content[0] + if (references.length === 0 || messages.length !== 1 || message['role'] !== 'user' + || (record(message['source'], 'title source')['kind'] !== 'plugin' || record(message['source'], 'title source')['plugin'] !== 'dsh-session-title-llm') + || content.length !== 1 || !isSessionFormatJsonObject(block) || block['type'] !== 'text') { + throw new SessionFormatError('session/title-llm-request messages do not represent messageSeqs') + } +} + +/** + * Validate native V4 lifecycle and ownership facts without rewriting any event. + * @param artifact - artifact whose V4 envelopes and messages have been admitted. + * @param knownEventTypes - installed event types whose payloads this reader interprets. + */ +export function assertV4LifecycleRelationships(artifact: SessionFormatArtifact, knownEventTypes: ReadonlySet): void { + const state = new Relationships(artifact, knownEventTypes) + for (const event of artifact.events) state.accept(event) +} diff --git a/packages/session/session-format-v3-to-v4/src/retired-syntax.ts b/packages/session/session-format-v3-to-v4/src/retired-syntax.ts new file mode 100644 index 0000000000..6644f60c3b --- /dev/null +++ b/packages/session/session-format-v3-to-v4/src/retired-syntax.ts @@ -0,0 +1,22 @@ +/** Retired native syntax remains a hard refusal even after a recoverable physical-row failure. */ + +import { SessionFormatError, SessionFormatUnsupportedMigrationError, isSessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' + +/** + * Refuse retired request-header system text and predecessor PTC tags without interpreting extension payloads. + * @param row - parsed physical row or complete native logical event. + */ +export function assertV4RetiredSyntax(row: unknown): void { + if (!isSessionFormatJsonObject(row)) return + if ((row['type'] === 'tool/code-dispatch-start' || row['type'] === 'tool/code-dispatch') && row['ignorable'] !== true) { + throw new SessionFormatUnsupportedMigrationError(`format v4 rejects retired event type ${row['type']}`) + } + if (row['type'] !== 'request/header') return + const data = row['data'] + if (!isSessionFormatJsonObject(data) || !isSessionFormatJsonObject(data['header'])) { + throw new SessionFormatError('format v4 request/header requires data and header objects') + } + if (Object.hasOwn(data['header'], 'system')) { + throw new SessionFormatError('format v4 request/header rejects retired header.system') + } +} diff --git a/packages/session/session-format-v3-to-v4/src/system-message.ts b/packages/session/session-format-v3-to-v4/src/system-message.ts new file mode 100644 index 0000000000..f2a2ed1378 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/src/system-message.ts @@ -0,0 +1,64 @@ +/** Native system-message fields checked before physical recovery can discard a row. */ + +import { SessionFormatError, isSessionFormatJsonObject, sessionFormatCount } from '@deepseek-ai/dsh-session-format' + +function record(value: unknown, subject: string): Readonly> { + if (!isSessionFormatJsonObject(value)) throw new SessionFormatError(`format v4 ${subject} requires an object`) + return value +} + +function string(value: unknown, subject: string, nonempty = false): void { + if (typeof value !== 'string' || nonempty && value.length === 0) throw new SessionFormatError(`format v4 ${subject} requires a string${nonempty ? ' with content' : ''}`) +} + +function positive(value: unknown, subject: string): void { + if (sessionFormatCount(value, subject) === 0) throw new SessionFormatError(`format v4 ${subject} must be positive`) +} + +function image(value: unknown): void { + const attachment = record(value, 'system image attachment') + string(attachment['attachmentId'], 'system image attachmentId', true) + if (!['image/png', 'image/jpeg', 'image/webp', 'image/gif'].includes(attachment['mediaType'] as string)) throw new SessionFormatError('format v4 system image requires a supported mediaType') + sessionFormatCount(attachment['bytes'], 'system image bytes') + positive(attachment['width'], 'system image width') + positive(attachment['height'], 'system image height') + if (attachment['name'] !== undefined) string(attachment['name'], 'system image name') + if (attachment['originalDimensions'] !== undefined) { + const original = record(attachment['originalDimensions'], 'system image originalDimensions') + positive(original['width'], 'system image original width') + positive(original['height'], 'system image original height') + } +} + +/** + * Validate system fields independently of historical message representations; preserve additional JSON fields. + * @param row - complete logical event or parsed physical row before corruption recovery. + */ +export function assertV4SystemMessageFields(row: unknown): void { + if (!isSessionFormatJsonObject(row) || row['type'] !== 'system/message') return + const data = record(row['data'], 'system/message data') + positive(data['turn'], 'system/message turn') + positive(data['step'], 'system/message step') + const message = record(data['message'], 'system message') + string(message['id'], 'system message id', true) + if (message['role'] !== 'system') throw new SessionFormatError('format v4 system message requires system role') + const content = message['content'] + if (!Array.isArray(content)) throw new SessionFormatError('format v4 system message requires content array') + for (const value of content) { + const block = record(value, 'system content block') + string(block['type'], 'system content type', true) + switch (block['type']) { + case 'text': case 'reasoning': string(block['text'], 'system content text'); break + case 'tool-call': + string(block['id'], 'system tool-call id', true) + string(block['name'], 'system tool-call name', true) + string(block['arguments'], 'system tool-call arguments') + break + case 'image': image(block['attachment']); break + case 'tool-result': throw new SessionFormatError('format v4 system content rejects retired tool-result wrappers') + default: + // ContentBlockMap is merge-extensible; only known block fields are interpreted here. + break + } + } +} diff --git a/packages/session/session-format-v3-to-v4/src/tool-role.ts b/packages/session/session-format-v3-to-v4/src/tool-role.ts new file mode 100644 index 0000000000..dc10537ac3 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/src/tool-role.ts @@ -0,0 +1,115 @@ +/** First-class tool-role messages in the V4 representation. */ + +import { SessionFormatError, SessionFormatUnsupportedMigrationError, isSessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' +import type { SessionFormatEvent, SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format' + +const WRAPPER_FIELDS = new Set(['type', 'toolCallId', 'content', 'isError']) + +function resultContent(value: SessionFormatJsonValue | undefined, subject: string): SessionFormatJsonValue[] { + if (!Array.isArray(value)) throw new SessionFormatError(`${subject} tool-result content must be an array`) + if (value.some(block => isSessionFormatJsonObject(block) && block['type'] === 'tool-result')) { + throw new SessionFormatUnsupportedMigrationError( + `${subject} contains a nested tool-result; migration cannot preserve its call identity and error status`, + ) + } + return value as SessionFormatJsonValue[] +} + +/** + * Lift one released-V3 wrapper tool/result row into the first-class V4 message. + * Validate the wrapper before dropping it so malformed historical content is + * rejected instead of being silently truncated. + * @param event - released wrapper tool/result event. + * @returns the same event with a first-class tool-role message. + * @throws {SessionFormatUnsupportedMigrationError} when nested results, wrapper + * extensions, or conflicting target fields cannot be preserved. + */ +export function liftToolResult(event: SessionFormatEvent): SessionFormatEvent { + if (event.type !== 'tool/result' || !isSessionFormatJsonObject(event.data)) return event + const data = event.data + const message = data['message'] + if (!isSessionFormatJsonObject(message) || message['role'] !== 'user') return event + const source = message['source'] + const callId = isSessionFormatJsonObject(source) ? source['callId'] : undefined + const content = message['content'] + const wrapper = Array.isArray(content) && content.length === 1 && isSessionFormatJsonObject(content[0]) + ? content[0] + : undefined + const id = message['id'] + if (typeof id !== 'string' || id.length === 0 + || !isSessionFormatJsonObject(source) || source['kind'] !== 'tool' + || typeof callId !== 'string' || callId.length === 0 + || wrapper === undefined || wrapper['type'] !== 'tool-result' + || wrapper['toolCallId'] !== callId) { + throw new SessionFormatError(`format v3 ${event.type} at seq ${event.seq} requires exactly one tool-result wrapper matching its tool source`) + } + const isError = wrapper['isError'] + if (isError !== undefined && typeof isError !== 'boolean') { + throw new SessionFormatError(`format v3 ${event.type} at seq ${event.seq} tool-result isError must be boolean`) + } + const unmapped = Object.keys(wrapper).find(field => !WRAPPER_FIELDS.has(field)) + if (unmapped !== undefined) { + throw new SessionFormatUnsupportedMigrationError( + `format v3 ${event.type} at seq ${event.seq} has unmapped tool-result field ${JSON.stringify(unmapped)}`, + ) + } + if (Object.hasOwn(message, 'toolCallId') && message['toolCallId'] !== callId) { + throw new SessionFormatUnsupportedMigrationError(`format v3 ${event.type} at seq ${event.seq} has conflicting outer toolCallId`) + } + if (Object.hasOwn(message, 'isError') && (typeof message['isError'] !== 'boolean' || message['isError'] !== (isError ?? false))) { + throw new SessionFormatUnsupportedMigrationError(`format v3 ${event.type} at seq ${event.seq} has conflicting outer isError`) + } + const targetIsError = isError ?? message['isError'] + // Recorded replay compares serialized messages with createToolResultMessage's field order. + const targetMessage: Record = { + role: 'tool', + source, + toolCallId: callId, + content: resultContent(wrapper['content'] as SessionFormatJsonValue | undefined, `format v3 ${event.type} at seq ${event.seq}`), + ...(targetIsError === undefined ? {} : { isError: targetIsError }), + id, + } + const extensions = Object.fromEntries(Object.entries(message).filter(([key]) => !Object.hasOwn(targetMessage, key))) + return { ...event, data: { ...data, message: { ...targetMessage, ...extensions } } } +} + +/** + * Validate the native V4 first-class tool-role message of one tool/result row. + * @param event - canonical V4 event. + * @throws {SessionFormatError} when the row is not an exact first-class tool result. + */ +export function assertV4ToolResultMessage(event: SessionFormatEvent): void { + if (event.type !== 'tool/result') return + const subject = `format v4 ${event.type} at seq ${event.seq}` + const data = event.data + if (!isSessionFormatJsonObject(data)) throw new SessionFormatError(`${subject} data must be an object`) + const message = data['message'] + if (!isSessionFormatJsonObject(message)) throw new SessionFormatError(`${subject} message must be an object`) + const id = message['id'] + const role = message['role'] + const toolCallId = message['toolCallId'] + const source = message['source'] + const isError = message['isError'] + const content = message['content'] + const sourceCallId = isSessionFormatJsonObject(source) ? source['callId'] : undefined + if (typeof id !== 'string' || id.length === 0) { + throw new SessionFormatError(`${subject} requires a first-class message with a string id`) + } + if (role !== 'tool') throw new SessionFormatError(`${subject} requires a tool-role message`) + if (typeof toolCallId !== 'string' || toolCallId.length === 0 || sourceCallId !== toolCallId) { + throw new SessionFormatError(`${subject} requires toolCallId matching its tool source`) + } + if (!isSessionFormatJsonObject(source) || source['kind'] !== 'tool') { + throw new SessionFormatError(`${subject} requires a tool source`) + } + if (!Array.isArray(content)) throw new SessionFormatError(`${subject} requires array content`) + if (content.some(block => isSessionFormatJsonObject(block) && block['type'] === 'tool-result')) { + throw new SessionFormatError(`${subject} content must not contain a released tool-result wrapper`) + } + if (isError !== undefined && typeof isError !== 'boolean') { + throw new SessionFormatError(`${subject} isError must be boolean when present`) + } + if (data['error'] !== undefined && isError !== true) { + throw new SessionFormatError(`${subject} carries error metadata for a non-error tool result`) + } +} diff --git a/packages/session/session-format-v3-to-v4/src/validation.ts b/packages/session/session-format-v3-to-v4/src/validation.ts index a53ba2610b..c2964776e4 100644 --- a/packages/session/session-format-v3-to-v4/src/validation.ts +++ b/packages/session/session-format-v3-to-v4/src/validation.ts @@ -1,40 +1,80 @@ -/** V4 metadata and relationship validation without changing recorded delivery generations. */ +/** Native V4 metadata and generation-owned relationship validation. */ -import { SessionFormatError, isSessionFormatJsonObject, sessionFormatCount } from '@deepseek-ai/dsh-session-format' -import type { SessionFormatArtifact, SessionFormatEvent, SessionFormatHeader, SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' -import { assertReleasedV3Header, restoreReleasedV3Artifact } from '@deepseek-ai/dsh-session-format-v2-to-v3' +import { isAbsolute } from 'node:path' +import { SessionFormatError, SessionFormatUnsupportedMigrationError, isSessionFormatJsonObject, sessionFormatCount } from '@deepseek-ai/dsh-session-format' +import type { SessionFormatArtifact, SessionFormatEvent } from '@deepseek-ai/dsh-session-format' +import { assertV4LifecycleRelationships } from './relationships.ts' import { catalogFact } from './facts.ts' -import { forkResultValidationView } from './fork-result.ts' +import { assertV4RetiredSyntax } from './retired-syntax.ts' +import { assertV4SystemMessageFields } from './system-message.ts' +import { assertV4ForkResult } from './fork-result.ts' +import { assertV4ToolResultMessage } from './tool-role.ts' /** - * Validate V4 metadata with the unchanged released V3 header fields. - * @param header - decoded V4 Session header. + * Validate the exact native V4 logical header. + * @param header - decoded or otherwise untrusted V4 Session header candidate. */ -export function assertReleasedV4Header(header: SessionFormatHeader): void { - if (header.version !== 4) throw new SessionFormatError('expected format v4 header') - assertReleasedV3Header({ ...header, version: 3 }) +export function assertReleasedV4Header(header: unknown): void { + if (!isSessionFormatJsonObject(header) || header['version'] !== 4) throw new SessionFormatError('expected format v4 header') + const required = ['version', 'id', 'createdAt', 'isSeeded', 'delegationDepth'] + const allowed = new Set([...required, 'cwd', 'parentSession', 'origin', 'agentPreset']) + const missing = required.find(key => !Object.hasOwn(header, key)) + const unexpected = Object.keys(header).find(key => !allowed.has(key)) + if (missing !== undefined) throw new SessionFormatError(`format v4 header lacks required field ${missing}`) + if (unexpected !== undefined) throw new SessionFormatError(`format v4 header has unexpected field ${unexpected}`) + if (typeof header.id !== 'string') throw new SessionFormatError('format v4 header id must be a string') + sessionFormatCount(header.createdAt, 'format v4 header createdAt') + sessionFormatCount(header.delegationDepth, 'format v4 header delegationDepth') + if (typeof header.isSeeded !== 'boolean') throw new SessionFormatError('format v4 header isSeeded must be boolean') + if (header.cwd !== undefined && (typeof header.cwd !== 'string' || !isAbsolute(header.cwd))) { + throw new SessionFormatError('format v4 header cwd must be absolute') + } + for (const key of ['parentSession', 'agentPreset']) { + if (header[key] !== undefined && typeof header[key] !== 'string') { + throw new SessionFormatError(`format v4 header ${key} must be a string`) + } + } + if (header.origin !== undefined && header.origin !== 'subagent') { + throw new SessionFormatError('format v4 header origin must be "subagent"') + } } /** - * Validate V4 relationships and delivery coordinates while retaining the original artifact. + * Validate V4 inheritance, vocabulary, native message admission, and + * lifecycle, compaction, tool, retry, title, command, catalog, and delivery ownership. + * Installed Session restoration owns common event envelopes and message acceptance. * @param artifact - complete detached V4 artifact. * @param knownEventTypes - event types understood by the installed Session package. * @returns the same validated artifact and event objects. */ export function restoreReleasedV4Artifact(artifact: SessionFormatArtifact, knownEventTypes: ReadonlySet): SessionFormatArtifact { assertReleasedV4Header(artifact.header) - assertReleasedV4Relationships(artifact) - const events = artifact.events.map((original): SessionFormatEvent => { - const event = forkResultValidationView(original) - if (event.type !== 'session-log-deepseek/delivery-accepted') return event - const data = event.data as SessionFormatJsonObject - const version = data['sessionFormatVersion'] - // Only this private relationship view substitutes generations; recorded delivery identities stay unchanged. - return version === 4 || version === 3 - ? { ...event, data: { ...data, sessionFormatVersion: version === 4 ? 3 : 2 } } - : event - }) - restoreReleasedV3Artifact({ ...artifact, header: { ...artifact.header, version: 3 }, events }, knownEventTypes) + const cut = sessionFormatCount(artifact.inheritedEventCount, 'format v4 inherited event count') + if (cut > artifact.events.length) throw new SessionFormatError('format v4 inherited event count exceeds its events') + if (!artifact.header.isSeeded && cut !== 0) throw new SessionFormatError('unseeded format v4 Session has inherited events') + let lastInheritedMarker: number | undefined + for (const [index, event] of artifact.events.entries()) { + if (!knownEventTypes.has(event.type) && event['ignorable'] !== true) { + throw new SessionFormatUnsupportedMigrationError( + `format v4 contains unknown event type ${JSON.stringify(event.type)} at seq ${index}`, + ) + } + if (event.seq !== index) throw new SessionFormatError(`format v4 event ${index} is not dense`) + if (!knownEventTypes.has(event.type)) continue + assertV4RetiredSyntax(event) + assertV4SystemMessageFields(event) + assertV4ToolResultMessage(event) + assertV4ForkResult(event) + if (event.type === 'session/end-seed' && isSessionFormatJsonObject(event.data) + && event.data['inherited'] === true) lastInheritedMarker = index + } + if (artifact.header.isSeeded && lastInheritedMarker !== cut) { + throw new SessionFormatError('format v4 seeded header disagrees with its last inherited end-seed marker') + } + if (!artifact.header.isSeeded && lastInheritedMarker !== undefined) { + throw new SessionFormatError('format v4 unseeded Session contains an inherited end-seed marker') + } + assertReleasedV4Relationships(artifact, knownEventTypes) return artifact } @@ -58,12 +98,16 @@ export function validateDeliveryAccepted(event: SessionFormatEvent, currentVersi } /** - * Validate V4 catalog membership and delivery ownership without changing vocabulary or turn recovery policies. + * Validate mandatory native lifecycle, catalog, and delivery relationships without changing event vocabulary or tail recovery. + * The owning admission stage rejects unknown required events; + * unknown ignorable records retain their uninterpreted payloads. * @param artifact - decoded artifact with its final inherited cut. + * @param knownEventTypes - installed event types whose payloads this reader interprets. */ -export function assertReleasedV4Relationships(artifact: SessionFormatArtifact): void { +export function assertReleasedV4Relationships(artifact: SessionFormatArtifact, knownEventTypes: ReadonlySet): void { const ids = new Set() for (const event of artifact.events) { + if (!knownEventTypes.has(event.type)) continue const deliveryId = validateDeliveryAccepted(event, 4) if (deliveryId !== undefined && !(artifact.header.parentSession !== undefined && event.seq < artifact.inheritedEventCount) @@ -77,4 +121,5 @@ export function assertReleasedV4Relationships(artifact: SessionFormatArtifact): ids.add(id) } } + assertV4LifecycleRelationships(artifact, knownEventTypes) } diff --git a/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts b/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts index a0b52938e2..954ef5f968 100644 --- a/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts +++ b/packages/session/session-format-v3-to-v4/tests/catalog-completion.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { isSessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' -import { catalogFact, childCatalogFact } from '../src/facts.ts' +import { catalogFact, childCatalogFact, childCatalogSubject } from '../src/facts.ts' import type { SessionFormatEvent, SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format' import { createSessionFormatV3ToV4, historicalChildCatalogSource, sessionFormatV3ToV4 } from '../src/index.ts' @@ -26,6 +26,15 @@ function migrate(events: SessionFormatEvent[], facts: readonly SessionFormatJson } describe('V3 parent catalog completion', () => { + it('interprets V1 descriptors and includes an evidence source path in diagnostics', () => { + expect(childCatalogFact({ + childId: 'child', childCreatedAt: 2, descriptorCount: 1, + descriptor: { version: 1, provider: 'spawn', label: 'legacy child' }, + })).toEqual({ version: 0, childId: 'child', childCreatedAt: 2, mode: 'continuable', label: 'legacy child' }) + expect(childCatalogSubject({ childId: 'child', sourcePath: '/tmp/session.v3.jsonl' })) + .toBe('Session child (raw log: /tmp/session.v3.jsonl)') + }) + it('appends deterministic child facts without changing source events', () => { const source = [{ type: 'feedback/record', seq: 0, time: 10, data: { text: 'retained' } }] const result = migrate(source, [child]) diff --git a/packages/session/session-format-v3-to-v4/tests/codec.spec.ts b/packages/session/session-format-v3-to-v4/tests/codec.spec.ts index c89e62db65..1efaa9ff28 100644 --- a/packages/session/session-format-v3-to-v4/tests/codec.spec.ts +++ b/packages/session/session-format-v3-to-v4/tests/codec.spec.ts @@ -2,8 +2,8 @@ import { describe, expect, it } from 'vitest' import { SessionFormatEventCollector } from '@deepseek-ai/dsh-session-format' import type { SessionFormatEvent, SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' import { sessionFormatCatalog } from '@deepseek-ai/dsh-session-format-catalog' -import { releasedV3SessionFormatCodec as previousCodec } from '@deepseek-ai/dsh-session-format-v2-to-v3' -import { assertReleasedV4Header, assertV4RowAdmission, releasedV3SessionFormatCodec, releasedV4SessionFormatCodec, restoreReleasedV4Artifact } from '../src/index.ts' +import { releasedV2SessionFormatCodec } from '@deepseek-ai/dsh-session-format-v2-to-v3' +import { assertReleasedV4Header, assertV4RowAdmission, releasedV4SessionFormatCodec, restoreReleasedV4Artifact } from '../src/index.ts' const header = { version: 4, id: 'parent', createdAt: 1, isSeeded: false, delegationDepth: 0 } const fact: SessionFormatEvent = { type: 'feedback/record', seq: 0, time: 1, data: { text: 'retained' } } @@ -19,8 +19,7 @@ function restore(events: readonly SessionFormatEvent[], sourceHeader = header) { } describe('V4 framing and restoration', () => { - it('reuses the released V3 codec and round trips unchanged V3 event encoding', () => { - expect(releasedV3SessionFormatCodec).toBe(previousCodec) + it('reuses released V2 physical framing and round trips native V4 rows', () => { const physical = releasedV4SessionFormatCodec.encodeHeader(header, 0) expect(physical).toEqual({ type: 'session', ...header }) expect(releasedV4SessionFormatCodec.decodeHeader(physical)).toEqual(header) @@ -28,7 +27,7 @@ describe('V4 framing and restoration', () => { const output = new SessionFormatEventCollector() expect(decoder.header).toEqual(header) const row = releasedV4SessionFormatCodec.encodeEvent(fact) - expect(row).toEqual(releasedV3SessionFormatCodec.encodeEvent(fact)) + expect(row).toEqual(releasedV2SessionFormatCodec.encodeEvent(fact)) decoder.decodeRow(row, output) expect(decoder.finish(output)).toBe(0) expect(output.values).toEqual([fact]) @@ -44,6 +43,24 @@ describe('V4 framing and restoration', () => { expect(() => releasedV4SessionFormatCodec.decodeHeader({ type: 'session', ...header, extra: 1 })).toThrow(/field|member/) }) + it('rejects malformed optional and required native header fields', () => { + const { id: _id, ...missingId } = header + const malformed = [ + [missingId, 'lacks required field id'], + [{ ...header, extra: true }, 'unexpected field extra'], + [{ ...header, id: 7 }, 'id must be a string'], + [{ ...header, isSeeded: 'no' }, 'isSeeded must be boolean'], + [{ ...header, cwd: 'relative' }, 'cwd must be absolute'], + [{ ...header, cwd: 7 }, 'cwd must be absolute'], + [{ ...header, parentSession: 7 }, 'parentSession must be a string'], + [{ ...header, agentPreset: 7 }, 'agentPreset must be a string'], + [{ ...header, origin: 'parent' }, 'origin must be "subagent"'], + ] as const + for (const [value, message] of malformed) { + expect(() => { assertReleasedV4Header(value) }).toThrow(message) + } + }) + it('retains predecessor and future delivery generations without activating their watermarks', () => { for (const version of [undefined, 0, 1, 2, 3, 5]) { const marker = { ...delivery(version, 'foreign'), data: { ...delivery(version).data as SessionFormatJsonObject, sessionId: 'foreign', throughSeq: 500 } } @@ -83,6 +100,18 @@ describe('V4 framing and restoration', () => { expect(() => restoreReleasedV4Artifact({ ...artifact, inheritedEventCount: 1 }, types)).toThrow('marker') }) + it('rejects invalid inherited cuts, sparse rows, and unseeded inherited markers', () => { + expect(() => restoreReleasedV4Artifact({ header, inheritedEventCount: 1, events: [] }, types)) + .toThrow('exceeds its events') + expect(() => restoreReleasedV4Artifact({ header, inheritedEventCount: 1, events: [fact] }, types)) + .toThrow('unseeded format v4 Session has inherited events') + expect(() => restoreReleasedV4Artifact({ header, inheritedEventCount: 0, + events: [{ ...fact, seq: 1 }] }, types)).toThrow('not dense') + expect(() => restoreReleasedV4Artifact({ header, inheritedEventCount: 0, + events: [{ type: 'session/end-seed', seq: 0, time: 1, data: { inherited: true } }] }, types)) + .toThrow('unseeded Session contains an inherited end-seed marker') + }) + it('preserves unknown ignorable values and requires installed vocabulary for unknown required events', () => { const opaque = { type: 'external/opaque', seq: 0, time: 1, data: { untouched: ['a', 3] }, ignorable: true } expect(restore([opaque]).events[0]).toBe(opaque) @@ -92,16 +121,16 @@ describe('V4 framing and restoration', () => { expect(restoreReleasedV4Artifact(artifact, new Set([required.type]))).toBe(artifact) }) - it.each([ - { type: 'request/header', seq: 0, time: 1, data: { header: { system: '' } } }, - { type: 'system/message', seq: 0, time: 1, data: {} }, - { type: 'tool/code-dispatch', seq: 0, time: 1, data: null }, - ])('refuses structural $type violations even after recoverable corruption', (row) => { - expect(() => { assertV4RowAdmission(row) }).toThrow() - const decoder = releasedV4SessionFormatCodec.createDecoder({ type: 'session', ...header }, 'recoverable') - const output = new SessionFormatEventCollector() - decoder.decodeRow(null, output) - expect(() => { decoder.decodeRow(row, output) }).toThrow() + it('refuses wrapper-shaped and malformed native tool results before recovery', () => { + const wrapper = { type: 'tool/result', seq: 0, time: 1, data: { message: { id: 'result', role: 'user', source: { kind: 'tool', callId: 'call' }, content: [] } } } + const malformed = { type: 'tool/result', seq: 0, time: 1, data: { message: { id: 'result', role: 'tool', source: { kind: 'tool', callId: 'call' }, toolCallId: 'call', content: [], isError: 'yes' } } } + for (const row of [wrapper, malformed]) { + expect(() => { assertV4RowAdmission(row) }).toThrow() + const decoder = releasedV4SessionFormatCodec.createDecoder({ type: 'session', ...header }, 'recoverable') + const output = new SessionFormatEventCollector() + decoder.decodeRow(null, output) + expect(() => { decoder.decodeRow(row, output) }).toThrow() + } }) it('leaves ordinary framing recovery to the released decoder', () => { diff --git a/packages/session/session-format-v3-to-v4/tests/corpus.spec.ts b/packages/session/session-format-v3-to-v4/tests/corpus.spec.ts index e4ea5fc648..34ab1ff418 100644 --- a/packages/session/session-format-v3-to-v4/tests/corpus.spec.ts +++ b/packages/session/session-format-v3-to-v4/tests/corpus.spec.ts @@ -4,6 +4,7 @@ import { expect, it } from 'vitest' import { createSessionFormatCatalogWithChildren, historicalSessionFormatCatalog } from '@deepseek-ai/dsh-session-format-catalog' import { isSessionFormatJsonObject, type SessionFormatArtifact, type SessionFormatJsonObject, type SessionFormatJsonValue } from '@deepseek-ai/dsh-session-format' import { historicalChildCatalogSource } from '../src/index.ts' +import { liftToolResult } from '../src/tool-role.ts' const root = resolve(import.meta.dirname, '../../../..') @@ -62,10 +63,14 @@ it('refuses recorded parent/child clock conflicts and migrates consistent copies if (children.some(child => conflicts.includes(child.path))) { expect(() => migrate(parent.artifact, children.map(child => child.artifact)), parent.path).toThrow('conflicts with its parent catalog') } else { - expect(migrate(parent.artifact, children.map(child => child.artifact)).events, parent.path).toEqual(parent.artifact.events) + expect(migrate(parent.artifact, children.map(child => child.artifact)).events, parent.path).toEqual( + parent.artifact.events.map(liftToolResult), + ) } expect(migrate(parent.artifact, aligned), parent.path).toEqual({ - ...parent.artifact, header: { ...parent.artifact.header, version: 4 }, + ...parent.artifact, + header: { ...parent.artifact.header, version: 4 }, + events: parent.artifact.events.map(liftToolResult), }) } } diff --git a/packages/session/session-format-v3-to-v4/tests/fork.spec.ts b/packages/session/session-format-v3-to-v4/tests/fork.spec.ts index 86b7a6436e..a6b8e8298e 100644 --- a/packages/session/session-format-v3-to-v4/tests/fork.spec.ts +++ b/packages/session/session-format-v3-to-v4/tests/fork.spec.ts @@ -4,15 +4,15 @@ import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection' import TokenMeter from '@deepseek-ai/dsh-token-meter' import ToolResultPruner from '@deepseek-ai/dsh-compaction-tool-result-pruner' import { SessionFormatEventCollector, type SessionFormatEvent, type SessionFormatArtifact, type SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' -import { releasedV3SessionFormatCodec, restoreReleasedV3Artifact } from '@deepseek-ai/dsh-session-format-v2-to-v3' import { Session, SessionId, SessionLogOffset, SessionSeq } from '@deepseek-ai/dsh-session' import { buildForkSeed } from '@deepseek-ai/dsh-session/fork' import { createMessage, ToolCallId } from '@deepseek-ai/dsh-llm' import { releasedV4SessionFormatCodec as codec, assertV4RowAdmission, restoreReleasedV4Artifact } from '../src/index.ts' +import { assertV4ForkResult } from '../src/fork-result.ts' type MutableResult = { data: { - message: { id: string; content: { toolCallId: string; isError: boolean; content: unknown[] }[] } + message: { id: string; role: 'tool'; toolCallId: string; isError: boolean; content: unknown[] } error: { name: string } } sourceEventSeqs?: number[] @@ -44,6 +44,19 @@ function restore(events: readonly SessionFormatEvent[]) { } describe('V4 fork results', () => { + it('ignores non-object fork-result data and validates non-object sources', () => { + expect(() => { assertV4ForkResult({ type: 'tool/result', data: null }) }).not.toThrow() + expect(() => { assertV4ForkResult({ + type: 'tool/result', seq: 0, surfaceOp: 'append', data: { + error: { code: 'TOOL_NOT_STARTED', name: 'ToolNotStartedError' }, + message: { + id: 'forked-tool-result-undefined-0', role: 'tool', toolCallId: 'call-1', isError: true, + source: null, content: [{ type: 'text', text: 'not started' }], + }, + }, + }) }).toThrow('invalid V4 not-started fork result') + }) + it('persists original fork IDs and wording, restores relationships and retains nested inherited cuts', () => { const child = fork() const original = artifact(child).events @@ -63,9 +76,6 @@ describe('V4 fork results', () => { const result = child.snapshotEvents().find(event => event.type === 'tool/result')! expect(result.data.message.id).toBe(`forked-tool-result-read-one-${result.seq}`) expect(JSON.stringify(result)).toContain('The parent session may have executed it after the fork point.') - expect(() => restoreReleasedV3Artifact({ header: { ...artifact(child).header, version: 3 }, events: original, inheritedEventCount: 3 }, new Set(original.map(event => event.type)))).toThrow('TOOL_NOT_STARTED') - // V3 framing alone does not validate advertised-tool relationships. - expect(releasedV3SessionFormatCodec.encodeEvent(original[result.seq]!)).toBeDefined() const nested = Session.create(SessionId('fork-grandchild'), buildForkSeed(child.snapshotEvents(), result.seq), { version: 4, id: SessionId('fork-grandchild'), createdAt: 1, delegationDepth: 0, isSeeded: true, parentSession: child.id, }, SessionLogOffset(result.seq + 1)) @@ -118,10 +128,7 @@ describe('V4 fork results', () => { const message = data['message'] as SessionFormatJsonObject const variants = [ null, - { message }, { ...data, message: { ...message, source: null } }, - { ...data, message: { ...message, content: [] } }, - { ...data, message: { ...message, content: [null] } }, ] for (const invalid of variants) { const events = original.map(event => event === result ? { ...event, data: invalid } : event) @@ -132,10 +139,10 @@ describe('V4 fork results', () => { it.each([ ['ID sequence', (row: MutableResult) => { row.data.message.id = 'forked-tool-result-read-one-0' }], ['error name', (row: MutableResult) => { row.data.error.name = 'OtherError' }], - ['call ID', (row: MutableResult) => { row.data.message.content[0]!.toolCallId = 'different' }], - ['error result', (row: MutableResult) => { row.data.message.content[0]!.isError = false }], + ['call ID', (row: MutableResult) => { row.data.message.toolCallId = 'different' }], + ['error result', (row: MutableResult) => { row.data.message.isError = false }], ['source references', (row: MutableResult) => { row.sourceEventSeqs = [2] }], - ['content', (row: MutableResult) => { row.data.message.content[0]!.content = [] }], + ['content', (row: MutableResult) => { row.data.message.content = [] }], ] as const)('rejects malformed fork %s', (_name, mutate) => { const events = structuredClone(artifact().events) const result = events.find(event => event.type === 'tool/result')! @@ -143,4 +150,5 @@ describe('V4 fork results', () => { expect(() => restore(events)).toThrow() expect(() => { assertV4RowAdmission(result) }).toThrow() }) + }) diff --git a/packages/session/session-format-v3-to-v4/tests/open-vocabulary.spec.ts b/packages/session/session-format-v3-to-v4/tests/open-vocabulary.spec.ts new file mode 100644 index 0000000000..834c661682 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/tests/open-vocabulary.spec.ts @@ -0,0 +1,48 @@ +import { describe, expect, it } from 'vitest' +import type { SessionFormatArtifact, SessionFormatEvent } from '@deepseek-ai/dsh-session-format' +import { restoreReleasedV4Artifact } from '../src/index.ts' + +const header = { version: 4, id: 'open-vocabulary', createdAt: 1, delegationDepth: 0, isSeeded: false } +function artifact(events: readonly { type: string; data: unknown; ignorable?: true; surfaceOp?: unknown }[]): SessionFormatArtifact { + return { header, inheritedEventCount: 0, events: events.map((event, seq) => ({ ...event, seq, time: seq })) as SessionFormatEvent[] } +} + +describe('known V4 event interpretation', () => { + it('keeps unknown ignorable payloads and coordinates opaque to every native semantic pass', () => { + const unknown = ['tool/result', 'system/message', 'request/header', 'session/title-llm-request', 'subagent/catalog', 'session-log-deepseek/delivery-accepted', 'compaction/start', 'compaction/end', 'session/end-seed'].map(type => ({ type, data: null, ignorable: true as const })) + const input = artifact([...unknown, { type: 'turn/start', data: { turn: 1 } }, { type: 'turn/end', data: { turn: 1 } }]) + const before = JSON.stringify(input) + expect(restoreReleasedV4Artifact(input, new Set(['turn/start', 'turn/end']))).toBe(input) + expect(JSON.stringify(input)).toBe(before) + expect(input.events.at(-1)?.seq).toBe(unknown.length + 1) + }) + + it('does not let an opaque end-seed clear an owned compaction', () => { + const input = artifact([ + { type: 'compaction/start', data: { compactionId: 'owner', turn: null } }, + { type: 'session/end-seed', data: {}, ignorable: true }, + { type: 'turn/start', data: { turn: 1 } }, + ]) + expect(() => restoreReleasedV4Artifact(input, new Set(['compaction/start', 'turn/start']))).toThrow(/crosses an open compaction/) + }) + + it('does not reinterpret an unknown ignorable user row through a known title citation', () => { + const input = artifact([ + { type: 'user/message', data: null, ignorable: true }, + { type: 'session/title', data: { title: 'title', source: { kind: 'generated' }, messageSeqs: [0] } }, + ]) + expect(() => restoreReleasedV4Artifact(input, new Set(['session/title']))).toThrow(/earlier human user\/message/) + }) + + it('still validates known events marked ignorable', () => { + const input = artifact([{ type: 'tool/result', data: null, ignorable: true }]) + expect(() => restoreReleasedV4Artifact(input, new Set(['tool/result']))).toThrow(/data must be an object/) + }) + + it('still validates unknown envelopes and refuses unknown required types', () => { + const required = artifact([{ type: 'external/event', data: null }]) + expect(() => restoreReleasedV4Artifact(required, new Set())).toThrow(/unknown event type/) + const input = artifact([{ type: 'external/event', data: null, ignorable: true }]) + expect(() => restoreReleasedV4Artifact({ ...input, events: [{ ...input.events[0]!, seq: 3 }] }, new Set())).toThrow(/not dense/) + }) +}) diff --git a/packages/session/session-format-v3-to-v4/tests/relationships.spec.ts b/packages/session/session-format-v3-to-v4/tests/relationships.spec.ts new file mode 100644 index 0000000000..15b5641d30 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/tests/relationships.spec.ts @@ -0,0 +1,218 @@ +import { describe, expect, it } from 'vitest' +import { Session, SessionId, SessionLogOffset, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session' +import { sessionFormatCatalog } from '@deepseek-ai/dsh-session-format-catalog' +import type { SessionFormatEvent } from '@deepseek-ai/dsh-session-format' + +type Row = { type: string; data: Record; surfaceOp?: unknown; sourceEventSeqs?: number[]; ignorable?: true } +const row = (type: string, data: Record): Row => ({ type, data }) +const user = (kind = 'user') => ({ id: 'input', role: 'user', source: { kind }, content: [{ type: 'text', text: 'input' }] }) +const input = (kind = 'user'): Row => ({ ...row('user/message', user(kind)), surfaceOp: 'append' }) +const step = { turn: 1, step: 1 } +const call = { type: 'tool-call', id: 'call', name: 'read', arguments: '{}' } +const assistant = (content: unknown[] = [call]): Row => ({ + ...row('assistant/message', { ...step, stream: [], message: { id: 'assistant', role: 'assistant', source: { kind: 'model', provider: 'mock', model: 'mock' }, content } }), + surfaceOp: 'append', +}) +const result = (id = 'call', extra: Record = {}): Row => ({ + ...row('tool/result', { ...step, message: { id: 'result', role: 'tool', source: { kind: 'tool', callId: id }, toolCallId: id, content: [{ type: 'text', text: 'done' }], ...extra } }), + surfaceOp: 'append', +}) +const begin = () => [row('turn/start', { turn: 1 }), row('step/start', step)] +const end = () => [row('step/end', step), row('turn/end', { turn: 1, reason: { kind: 'completed' } })] +const toolCall = () => row('tool/call', { ...step, callId: 'call', name: 'read', arguments: '{}' }) +const request = () => row('request/header', { reason: 'initial', header: { config: { provider: 'mock', model: 'mock' } } }) + +/** Exercise physical JSON, catalog relationship admission, Session adoption, and derivation together. */ +function reopen(rows: readonly Row[], inherited = 0, seeded = false) { + const restore = sessionFormatCatalog.createRestore({ type: 'session', version: 4, id: 'native-relations', createdAt: 1, delegationDepth: 0, isSeeded: seeded, ...(seeded ? { parentSession: 'parent' } : {}) }, { recovery: 'strict', validation: 'current' }) + for (const [seq, candidate] of rows.entries()) { + const event = { ...candidate, seq, time: seq + 1 } as unknown as SessionFormatEvent + restore.decodeRow(JSON.parse(JSON.stringify(sessionFormatCatalog.encodeCurrentEvent(event)))) + } + const artifact = restore.finish() + expect(artifact.inheritedEventCount).toBe(inherited) + const session = Session.fromRestore(SessionId(artifact.header.id), artifact.events as SessionEvent[], artifact.header as unknown as SessionHeader, SessionLogOffset(inherited), 'detached') + return { artifact, messages: session.deriveMessages() } +} + +const compact = (): Row[] => [ + row('turn/start', { turn: 1 }), input(), + row('compaction/start', { compactionId: 'c', turn: 1, sourceCommandId: 'cmd' }), + row('compaction/summary', { compactionId: 'c', sourceCommandId: 'cmd', summary: [{ type: 'text', text: 'summary' }], shadowedRange: { start: 1, end: 1 }, shadowedSeqs: [1], shadowedTokenCount: 1, provider: 'mock', model: 'mock' }), + { ...input('compact-checkpoint'), data: { + ...user('compact-checkpoint'), id: 'checkpoint', source: { kind: 'plugin', plugin: 'compact', compactionId: 'c', sourceCommandId: 'cmd' }, + }, surfaceOp: { op: 'replace', startSeq: 1, endSeq: 1 }, sourceEventSeqs: [1, 2, 3] }, + row('compaction/end', { compactionId: 'c', sourceCommandId: 'cmd', turn: 1 }), + row('turn/end', { turn: 1, reason: { kind: 'completed' } }), +] +const change = (rows: Row[], index: number, data: Record): Row[] => + rows.map((candidate, i) => i === index ? { ...candidate, data: { ...candidate.data, ...data } } : candidate) +const retry = (changes: Record = {}) => row('llm/retry', { ...step, retryId: 'retry', retry: 1, provider: 'mock', policyKey: 'policy', ...changes }) +const retryStart = (changes: Record = {}) => row('llm/retry-started', { ...step, retryId: 'retry', retry: 1, ...changes }) +const dispatch = (type: 'start' | 'end', changes: Record = {}) => row(type === 'start' ? 'tool/ptc-dispatch-start' : 'tool/ptc-dispatch', { rootCallId: 'root', parentCallId: 'root', subCallId: 'child', name: 'read', arguments: { a: 1, b: 2 }, ...changes }) + +describe('mandatory V4 lifecycle restoration', () => { + it('retains valid ordinary tool exchanges and open interrupted tails', () => { + const rows = [...begin(), input(), request(), assistant(), toolCall(), result(), ...end()] + expect(reopen(rows).messages.map(message => message.role)).toEqual(['user', 'assistant', 'tool']) + for (let length = 0; length < rows.length; length += 1) expect(() => reopen(rows.slice(0, length))).not.toThrow() + }) + + it.each([ + ['turn order', [row('turn/start', { turn: 2 })]], + ['duplicate turn', [row('turn/start', { turn: 1 }), row('turn/start', { turn: 1 })]], + ['unopened turn end', [row('turn/end', { turn: 1 })]], + ['open step at turn end', [...begin(), row('turn/end', { turn: 1 })]], + ['unopened step', [row('step/start', step)]], + ['step sequence', [row('turn/start', { turn: 1 }), row('step/start', { turn: 1, step: 2 })]], + ['mismatched step end', [...begin(), row('step/end', { turn: 2, step: 1 })]], + ['assistant outside step', [assistant([])]], + ['assistant attempt outside step', [row('assistant/attempt', { ...step, stream: [] })]], + ['tool without advertisement', [...begin(), toolCall()]], + ['result without advertisement', [...begin(), result()]], + ['repeated advertisement', [...begin(), assistant([call, call])]], + ['changed tool name', [...begin(), assistant(), row('tool/call', { ...step, callId: 'call', name: 'other', arguments: '{}' })]], + ['changed tool arguments', [...begin(), assistant(), row('tool/call', { ...step, callId: 'call', name: 'read', arguments: '[]' })]], + ['repeated start', [...begin(), assistant(), toolCall(), toolCall()]], + ['unstarted success', [...begin(), assistant(), result()]], + ['repeated result', [...begin(), assistant(), toolCall(), result(), result()]], + ['unresolved advertised call', [...begin(), assistant(), ...end()]], + ['unresolved started call', [...begin(), assistant(), toolCall(), ...end()]], + ['header outside turn', [request()]], + ['context outside turn', [row('request/context', { provider: 'mock', model: 'mock' })]], + ] satisfies Array<[string, Row[]]>)('rejects %s', (_name, rows) => { + expect(() => reopen(rows)).toThrow() + }) + + it('accepts exact not-started repairs with preserved historical identity suffixes', () => { + const repaired = result('call', { id: 'interrupted-tool-result-call-200', isError: true, content: [{ type: 'text', text: 'The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed.' }] }) + repaired.data['error'] = { name: 'ToolNotStartedError', code: 'TOOL_NOT_STARTED' } + expect(() => reopen([...begin(), assistant(), repaired, ...end()])).not.toThrow() + for (const extra of [{ id: 'made-up' }, { id: 'interrupted-tool-result-call-01' }, { id: 'interrupted-tool-result-call-9007199254740992' }, { content: [] }, { content: [{ type: 'text', text: 'invented repair' }] }]) { + const invalid = { ...repaired, data: { ...repaired.data, message: { ...(repaired.data['message'] as Record), ...extra } } } + expect(() => reopen([...begin(), assistant(), invalid])).toThrow() + } + expect(() => reopen([...begin(), assistant(), { ...repaired, sourceEventSeqs: [2] }])).toThrow() + expect(() => reopen([...begin(), assistant(), { ...repaired, data: { ...repaired.data, error: { name: 'OtherError', code: 'TOOL_NOT_STARTED' } } }])).toThrow() + }) + + it('preserves ignorable payloads and unknown attribution metadata', () => { + const message = { ...user('external'), source: JSON.parse('{"kind":"external","__proto__":{"x":1},"meta":{"a":2}}') as unknown } + const opaque: Row = { type: 'external/event', data: { arbitrary: true }, ignorable: true } + const rows = [opaque, { ...input(), data: message }] + const restored = reopen(rows) + expect(restored.artifact.events[0]?.data).toEqual(opaque.data) + expect(restored.messages[0]?.source).toEqual(message.source) + }) +}) + +describe('mandatory V4 compaction restoration', () => { + it('retains matching checkpoint sources and inherited unfinished compactions', () => { + expect(reopen(compact()).messages[0]?.source).toEqual({ kind: 'plugin', plugin: 'compact', compactionId: 'c', sourceCommandId: 'cmd' }) + const inherited = [row('compaction/start', { compactionId: 'old', turn: null }), ...begin(), ...end(), row('session/end-seed', { inherited: true })] + expect(() => reopen(inherited, 5, true)).not.toThrow() + expect(() => reopen([row('compaction/start', { compactionId: 'c', turn: null }), row('compaction/end', { compactionId: 'c', turn: null, error: 'cancelled' })])).not.toThrow() + expect(() => reopen(compact().slice(0, 5))).not.toThrow() + }) + + it.each([ + ['checkpoint identity', change(compact(), 4, { source: { kind: 'plugin', plugin: 'compact', compactionId: 'WRONG', sourceCommandId: 'cmd' } })], + ['checkpoint command', change(compact(), 4, { source: { kind: 'plugin', plugin: 'compact', compactionId: 'c', sourceCommandId: 'WRONG' } })], + ['summary identity', change(compact(), 3, { compactionId: 'WRONG' })], + ['end identity', change(compact(), 5, { compactionId: 'WRONG' })], + ['end turn', change(compact(), 5, { turn: null })], + ['start turn', change(compact(), 2, { turn: null })], + ['wrong span', change(compact(), 3, { shadowedSeqs: [] })], + ['missing span', change(compact(), 3, { shadowedRange: { start: 0, end: 0 }, shadowedSeqs: [0] })], + ['overlap', [...compact().slice(0, 3), row('compaction/start', { compactionId: 'second', turn: 1 })]], + ['repeated summary', [...compact().slice(0, 4), compact()[3]!]], + ['success without summary', [...compact().slice(0, 3), compact()[5]!]], + ['turn closes transaction', [...compact().slice(0, 3), compact()[6]!]], + ['unowned end', [row('compaction/end', { compactionId: 'c', turn: null })]], + ] satisfies Array<[string, Row[]]>)('rejects %s', (_name, rows) => { + expect(() => reopen(rows)).toThrow() + }) +}) + +describe('mandatory V4 dependent event restoration', () => { + it('accepts PTC nesting and settlements with equal argument objects', () => { + expect(() => reopen([...begin(), dispatch('start'), dispatch('start', { subCallId: 'grandchild', parentCallId: 'child' }), dispatch('end', { subCallId: 'grandchild', parentCallId: 'child' }), dispatch('end', { arguments: { b: 2, a: 1 } }), ...end()])).not.toThrow() + }) + + it.each([ + ['outside turn', [dispatch('start')]], + ['without start', [...begin(), dispatch('end')]], + ['duplicate start', [...begin(), dispatch('start'), dispatch('start')]], + ['duplicate settlement', [...begin(), dispatch('start'), dispatch('end'), dispatch('end')]], + ['unknown parent', [...begin(), dispatch('start', { parentCallId: 'unknown' })]], + ['root changes', [...begin(), dispatch('start'), dispatch('end', { rootCallId: 'different' })]], + ['arguments change', [...begin(), dispatch('start'), dispatch('end', { arguments: {} })]], + ['name changes', [...begin(), dispatch('start'), dispatch('end', { name: 'different' })]], + ] satisfies Array<[string, Row[]]>)('rejects PTC %s', (_name, rows) => { expect(() => reopen(rows)).toThrow() }) + + it('accepts retry chains, including retries scheduled after the step ends', () => { + expect(() => reopen([...begin(), request(), retry(), retryStart(), retry({ retry: 2 }), retryStart({ retry: 2 }), row('step/end', step), retry({ retry: 3 }), row('turn/end', { turn: 1, reason: { kind: 'completed' } })])).not.toThrow() + }) + + it.each([ + ['outside turn', [retry()]], + ['wrong step', [...begin(), request(), retry({ step: 2 })]], + ['wrong provider', [...begin(), request(), retry({ provider: 'other' })]], + ['skip attempt', [...begin(), request(), retry({ retry: 2 })]], + ['changed identity', [...begin(), request(), retry(), retry({ retry: 2, retryId: 'other' })]], + ['reused identity', [...begin(), request(), retry(), retry({ policyKey: 'other' })]], + ['unpaired start', [retryStart()]], + ['changed start coordinates', [...begin(), request(), retry(), retryStart({ step: 2 })]], + ['duplicate start', [...begin(), request(), retry(), retryStart(), retryStart()]], + ] satisfies Array<[string, Row[]]>)('rejects retry %s', (_name, rows) => { expect(() => reopen(rows)).toThrow() }) + + it('requires command completion to cite its run and an earlier non-command success event', () => { + const run = row('command/run', { commandId: 'cmd', name: 'test', source: { kind: 'user' } }) + const done = row('command/done', { commandId: 'cmd', kind: 'success', sourceEventSeq: 1 }) + expect(() => reopen([run, input(), done, row('command/done', { commandId: 'cmd', kind: 'error' })])).not.toThrow() + for (const rows of [[done], [run, run], [run, done], [run, input(), { ...done, data: { ...done.data, kind: 'error' } }], [run, input(), { ...done, data: { ...done.data, sourceEventSeq: 10 } }]]) { + expect(() => reopen(rows)).toThrow() + } + }) + + it('requires titles and durable title requests to cite earlier human messages', () => { + const title = row('session/title', { title: 'Example', source: { kind: 'generated' }, messageSeqs: [0] }) + const requestTitle = row('session/title-llm-request', { messageSeqs: [0], messages: [{ ...user(), source: { kind: 'plugin', plugin: 'dsh-session-title-llm' }, content: [{ type: 'text', text: 'historical frame with original coordinates' }] }] }) + expect(() => reopen([input(), title, requestTitle, row('session/title', { title: 'Manual', source: { kind: 'user' }, messageSeqs: [] })])).not.toThrow() + for (const rows of [[input('external'), title], [input(), { ...title, data: { ...title.data, source: { kind: 'user' } } }], [input(), { ...title, data: { ...title.data, messageSeqs: [0, 0] } }], [input(), { ...title, data: { ...title.data, messageSeqs: [1] } }], [input(), { ...requestTitle, data: { ...requestTitle.data, messages: [user()] } }], [input(), { ...requestTitle, data: { ...requestTitle.data, messageSeqs: [] } }]]) { + expect(() => reopen(rows)).toThrow() + } + }) +}) + + +describe('V4 protected system surface and malformed relationship inputs', () => { + const system = (): Row => ({ ...row('system/message', { ...step, message: { id: 'system', role: 'system', source: { kind: 'plugin', plugin: '@deepseek-ai/dsh-system-prompt' }, content: [{ type: 'text', text: 'system' }] } }), surfaceOp: 'append' }) + it('keeps the first system head protected across exact replacements', () => { + const replacement = { ...system(), surfaceOp: { op: 'replace', startSeq: 2, endSeq: 2 }, sourceEventSeqs: [2] } + expect(() => reopen([...begin(), system(), input(), replacement, system(), ...end()])).not.toThrow() + const prune = row('compaction/prune', { shadowedRange: { start: 3, end: 3 }, shadowedSeqs: [3], shadowedTokenCount: 1 }) + expect(() => reopen([...begin(), system(), input(), prune, ...end()])).not.toThrow() + for (const rows of [ + [...begin(), input(), system()], + [...begin(), input(), { ...replacement, sourceEventSeqs: [2] }], + [...begin(), system(), { ...input(), surfaceOp: { op: 'replace', startSeq: 2, endSeq: 2 }, sourceEventSeqs: [2] }], + [...begin(), system(), input(), { ...replacement, surfaceOp: { op: 'replace', startSeq: 2, endSeq: 3 }, sourceEventSeqs: [2, 3] }], + [...begin(), system(), input(), { ...replacement, surfaceOp: { op: 'replace', startSeq: 0, endSeq: 0 } }], + [...begin(), system(), input(), { ...replacement, surfaceOp: { op: 'replace', startSeq: 3, endSeq: 2 } }], + [...begin(), system(), input(), { ...replacement, sourceEventSeqs: [0] }], + [...begin(), system(), row('compaction/prune', { shadowedRange: { start: 2, end: 2 }, shadowedSeqs: [2] })], + ]) expect(() => reopen(rows)).toThrow() + }) + + it('rejects malformed relationship values and mismatched inherited transaction ownership', () => { + expect(() => reopen([row('command/run', { commandId: '' })])).toThrow() + expect(() => reopen([row('session/title', { messageSeqs: null })])).toThrow() + const inherited = [ + row('compaction/start', { compactionId: 'old', turn: null }), row('turn/start', { turn: 1 }), input(), + row('compaction/summary', { compactionId: 'old', shadowedRange: { start: 2, end: 2 }, shadowedSeqs: [2] }), + row('turn/end', { turn: 1, reason: { kind: 'completed' } }), row('session/end-seed', { inherited: true }), + ] + expect(() => reopen(inherited, 5, true)).toThrow(/does not match the open turn/) + }) +}) diff --git a/packages/session/session-format-v3-to-v4/tests/retired-syntax.spec.ts b/packages/session/session-format-v3-to-v4/tests/retired-syntax.spec.ts new file mode 100644 index 0000000000..8a121b2389 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/tests/retired-syntax.spec.ts @@ -0,0 +1,41 @@ +import { describe, expect, it } from 'vitest' +import { SessionFormatEventCollector, type SessionFormatEvent } from '@deepseek-ai/dsh-session-format' +import { sessionFormatCatalog } from '@deepseek-ai/dsh-session-format-catalog' +import { releasedV4SessionFormatCodec, restoreReleasedV4Artifact } from '../src/index.ts' + +const header = { version: 4, id: 'native-syntax', createdAt: 1, delegationDepth: 0, isSeeded: false } +const physical = { type: 'session', ...header } +const request = (data: unknown): SessionFormatEvent => ({ type: 'request/header', seq: 1, time: 1, data }) as SessionFormatEvent +const turn: SessionFormatEvent = { type: 'turn/start', seq: 0, time: 1, data: { turn: 1 } } + +describe('native retired syntax admission', () => { + it('rejects retired headers and PTC tags in strict reads, encoding, and recoverable suffixes', () => { + const invalid = [ + request(null), request({ header: null }), request({ header: { config: { provider: 'mock', model: 'mock' }, system: '' } }), + { type: 'tool/code-dispatch-start', seq: 1, time: 1, data: {} }, + { type: 'tool/code-dispatch', seq: 1, time: 1, data: {} }, + ] + for (const event of invalid) { + expect(() => sessionFormatCatalog.encodeCurrentEvent(event)).toThrow() + const read = sessionFormatCatalog.createRestore(physical, { recovery: 'strict', validation: 'current' }) + read.decodeRow(turn) + expect(() => { read.decodeRow(event) }).toThrow() + const scanner = releasedV4SessionFormatCodec.createDecoder(physical, 'recoverable') + const output = new SessionFormatEventCollector() + scanner.decodeRow(null, output) + expect(() => { scanner.decodeRow(event, output) }).toThrow() + const artifact = { header, inheritedEventCount: 0, events: [turn, event] } + expect(() => restoreReleasedV4Artifact(artifact, new Set([turn.type, event.type]))).toThrow() + } + }) + + it('keeps known request fields open and obsolete ignorable tags opaque', () => { + const rows = [turn, request({ reason: 'initial', header: { config: { provider: 'mock', model: 'mock' }, extra: true } }), + { type: 'tool/code-dispatch-start', seq: 2, time: 1, data: { unknown: true }, ignorable: true }, + { type: 'tool/code-dispatch', seq: 3, time: 1, data: null, ignorable: true }, + ] as SessionFormatEvent[] + const read = sessionFormatCatalog.createRestore(physical, { recovery: 'strict', validation: 'current' }) + for (const event of rows) read.decodeRow(JSON.parse(JSON.stringify(sessionFormatCatalog.encodeCurrentEvent(event)))) + expect(read.finish().events).toEqual(rows) + }) +}) diff --git a/packages/session/session-format-v3-to-v4/tests/system-message.spec.ts b/packages/session/session-format-v3-to-v4/tests/system-message.spec.ts new file mode 100644 index 0000000000..a5de21b6cf --- /dev/null +++ b/packages/session/session-format-v3-to-v4/tests/system-message.spec.ts @@ -0,0 +1,59 @@ +import { describe, expect, it } from 'vitest' +import { SessionFormatEventCollector, type SessionFormatEvent } from '@deepseek-ai/dsh-session-format' +import { createSessionFormatCatalogWithChildren, sessionFormatCatalog } from '@deepseek-ai/dsh-session-format-catalog' +import { releasedV4SessionFormatCodec } from '../src/codec.ts' + +const header = { type: 'session', version: 4, id: 'system-fields', createdAt: 1, delegationDepth: 0, isSeeded: false } +const migrated = createSessionFormatCatalogWithChildren([]).createRestore({ ...header, version: 3 }, { recovery: 'strict', validation: 'current' }) +for (const event of [ + { type: 'turn/start', seq: 0, time: 1, data: { turn: 1 } }, + { type: 'step/start', seq: 1, time: 1, data: { turn: 1, step: 1 } }, + { type: 'system/message', seq: 2, time: 1, surfaceOp: 'append', data: { turn: 1, step: 1, message: { + id: 'system', role: 'system', source: { kind: 'plugin', plugin: '@deepseek-ai/dsh-system-prompt' }, content: [], + } } }, +]) migrated.decodeRow(event) +const source = (migrated.finish().events[2]?.data as { message: { source: object } }).message.source +const attachment = { attachmentId: 'sha256:image', mediaType: 'image/png', bytes: 1, width: 1, height: 1 } +const message = (content: unknown) => ({ id: 'system', role: 'system', source, content }) +const row = (data: unknown): SessionFormatEvent => ({ type: 'system/message', seq: 2, time: 1, surfaceOp: 'append', data }) as SessionFormatEvent + +function restored(data: unknown) { + const read = sessionFormatCatalog.createRestore(header, { recovery: 'strict', validation: 'current' }) + for (const event of [{ type: 'turn/start', seq: 0, time: 1, data: { turn: 1 } }, { type: 'step/start', seq: 1, time: 1, data: { turn: 1, step: 1 } }, row(data)]) { + read.decodeRow(JSON.parse(JSON.stringify(sessionFormatCatalog.encodeCurrentEvent(event)))) + } + return read.finish() +} + +describe('native system-message fields', () => { + it('preserves required fields and extra JSON on known and extensible block types', () => { + const content = [ + { type: 'text', text: '', extension: { keep: true } }, { type: 'reasoning', text: 'reasoning' }, + { type: 'tool-call', id: 'call', name: 'read', arguments: '{}' }, { type: 'file', extension: true }, + { type: 'image', attachment }, { type: 'image', attachment: { + ...attachment, name: 'name', originalDimensions: { width: 1, height: 2 }, extension: true, + } }, + ] + const data = { turn: 1, step: 1, message: message(content), extra: true } + expect(restored(data).events[2]?.data).toEqual(data) + }) + + it('rejects malformed fields before a recoverable scanner can discard the row', () => { + const contents = [ + null, [null], [{}], [{ type: '' }], [{ type: 'text', text: 1 }], [{ type: 'tool-call', id: '' }], + [{ type: 'tool-call', id: 'id', name: '' }], [{ type: 'tool-call', id: 'id', name: 'name', arguments: null }], + [{ type: 'tool-result', toolCallId: 'call', content: [] }], + ...[null, { ...attachment, mediaType: 'text/plain' }, { ...attachment, attachmentId: '' }, { ...attachment, bytes: -1 }, { ...attachment, width: 0 }, { ...attachment, height: 0 }, { ...attachment, name: 1 }, { ...attachment, originalDimensions: null }, { ...attachment, originalDimensions: { width: 0, height: 1 } }, { ...attachment, originalDimensions: { width: 1, height: 0 } }].map(value => ({ type: 'image', attachment: value })).map(block => [block]), + ] + const invalid = [null, { turn: 0, step: 1 }, { turn: 1, step: 0 }, { turn: 1, step: 1, message: null }, + ...[{ ...message([]), id: '' }, { ...message([]), role: 'user' }, ...contents.map(message)].map(value => ({ turn: 1, step: 1, message: value })), + ] + for (const data of invalid) { + expect(() => restored(data)).toThrow() + const read = releasedV4SessionFormatCodec.createDecoder(header, 'recoverable') + const output = new SessionFormatEventCollector() + read.decodeRow(null, output) + expect(() => { read.decodeRow(row(data), output) }).toThrow() + } + }) +}) diff --git a/packages/session/session-format-v3-to-v4/tests/tool-role.spec.ts b/packages/session/session-format-v3-to-v4/tests/tool-role.spec.ts new file mode 100644 index 0000000000..63cc58b346 --- /dev/null +++ b/packages/session/session-format-v3-to-v4/tests/tool-role.spec.ts @@ -0,0 +1,437 @@ +import { describe, expect, it } from 'vitest' +import type { SessionFormatEvent, SessionFormatHeader, SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' +import { SessionFormatEventCollector, SessionFormatUnsupportedMigrationError } from '@deepseek-ai/dsh-session-format' +import { createToolResultMessage, ToolCallId } from '@deepseek-ai/dsh-llm' +import { createSessionFormatV3ToV4, releasedV4SessionFormatCodec, restoreReleasedV4Artifact, sessionFormatV3ToV4 } from '../src/index.ts' +import { assertV4ToolResultMessage, liftToolResult } from '../src/tool-role.ts' + +const header = { version: 4, id: 'tool-role', createdAt: 1, isSeeded: false, delegationDepth: 0 } + +function event(seq: number, type: string, data: SessionFormatJsonObject): SessionFormatEvent { + return { type, seq, time: seq + 1, data } +} + +/** Released V3 canonical user-role wrapper tool/result message. */ +function wrapperMessage(callId = 'call-1', text = 'result'): SessionFormatJsonObject { + return { + id: `tool-result-${callId}`, + role: 'user', + source: { kind: 'tool', callId }, + content: [{ + type: 'tool-result', + toolCallId: callId, + isError: false, + content: [{ type: 'text', text }], + }], + } +} + +/** Native V4 first-class tool-role message. */ +function firstClassMessage(callId = 'call-1', text = 'result', isError: boolean | undefined = false): SessionFormatJsonObject { + return { + id: `tool-result-${callId}`, + role: 'tool', + source: { kind: 'tool', callId }, + toolCallId: callId, + content: [{ type: 'text', text }], + ...(isError === undefined ? {} : { isError }), + } +} + +describe('V4 tool-role view and lift', () => { + it.each([false, true])('serializes lifted result fields in current writer order with isError=%s', (isError) => { + const content = [{ type: 'text' as const, text: 'result' }] + const current = createToolResultMessage({ callId: ToolCallId('call-1'), content, isError }) + const row = event(0, 'tool/result', { turn: 1, step: 1, message: { + ...wrapperMessage(), + content: [{ type: 'tool-result', toolCallId: 'call-1', content, isError }], + } }) + const target = (liftToolResult(row).data as SessionFormatJsonObject)['message'] + expect(JSON.stringify(target)).toBe(JSON.stringify({ ...current, id: 'tool-result-call-1' })) + }) + + it.each([undefined, false, true])('preserves own outer message metadata and matching target fields with isError=%s', (isError) => { + const metadata = JSON.parse('{"__proto__":{"saved":"prototype"},"constructor":{"saved":"constructor"},"extension":{"saved":true}}') as SessionFormatJsonObject + const content = [{ type: 'text', text: 'result' }] + const message = { + ...metadata, ...wrapperMessage(), toolCallId: 'call-1', ...(isError === undefined ? {} : { isError }), + content: [{ type: 'tool-result', toolCallId: 'call-1', content, ...(isError === undefined ? {} : { isError }) }], + } + const row = { ...event(0, 'tool/result', { turn: 1, step: 1, message }), surfaceOp: 'append' } as SessionFormatEvent + const before = structuredClone(row) + const lifted = liftToolResult(row) + const target = (lifted.data as SessionFormatJsonObject)['message'] as SessionFormatJsonObject + expect(target).toEqual({ ...message, role: 'tool', content }) + expect(Object.hasOwn(target, '__proto__')).toBe(true) + expect(Object.hasOwn(target, 'constructor')).toBe(true) + expect(Object.getPrototypeOf(target)).toBe(Object.prototype) + expect(row).toEqual(before) + expect(JSON.parse(JSON.stringify(releasedV4SessionFormatCodec.encodeEvent(lifted)))).toEqual(lifted) + }) + + it.each([ + ['toolCallId', 'other-call', false], + ['isError', true, false], + ['isError', true, undefined], + ['isError', 'false', false], + ] as const)('refuses an outer %s field whose meaning conflicts with the lifted value', (field, value, isError) => { + const row = event(0, 'tool/result', { turn: 1, step: 1, message: { + ...wrapperMessage(), [field]: value, + content: [{ type: 'tool-result', toolCallId: 'call-1', content: [], ...(isError === undefined ? {} : { isError }) }], + } }) + const before = structuredClone(row) + expect(() => liftToolResult(row)).toThrow(SessionFormatUnsupportedMigrationError) + expect(() => liftToolResult(row)).toThrow(`conflicting outer ${field}`) + expect(row).toEqual(before) + }) + + it('preserves an outer false flag when the wrapper omits its equivalent non-error flag', () => { + const row = event(0, 'tool/result', { turn: 1, step: 1, message: { + ...wrapperMessage(), isError: false, content: [{ type: 'tool-result', toolCallId: 'call-1', content: [] }], + } }) + expect(liftToolResult(row).data).toMatchObject({ message: { role: 'tool', isError: false } }) + }) + + it.each(['extension', '__proto__', 'constructor'])('refuses unmapped wrapper field %s without losing it', (field) => { + const wrapper = Object.fromEntries([ + ['type', 'tool-result'], ['toolCallId', 'call-1'], ['content', []], [field, { saved: true }], + ]) as SessionFormatJsonObject + const row = event(0, 'tool/result', { turn: 1, step: 1, message: { ...wrapperMessage(), content: [wrapper] } }) + const before = structuredClone(row) + expect(() => liftToolResult(row)).toThrow(SessionFormatUnsupportedMigrationError) + expect(() => liftToolResult(row)).toThrow('unmapped tool-result field') + expect(row).toEqual(before) + }) + + it('lifts a released wrapper into the native tool-role message', () => { + const wrapperRow = { ...event(0, 'tool/result', { turn: 1, step: 1, message: wrapperMessage() }), surfaceOp: 'append' } as SessionFormatEvent + const lifted = liftToolResult(wrapperRow) + expect(lifted.data).toEqual({ + turn: 1, + step: 1, + message: firstClassMessage(), + }) + }) + + it('omits isError when a released wrapper did not persist the flag', () => { + const row = event(0, 'tool/result', { + turn: 1, step: 1, + message: { + ...wrapperMessage(), + content: [{ type: 'tool-result', toolCallId: 'call-1', content: [{ type: 'text', text: 'result' }] }], + }, + }) + expect(liftToolResult(row).data).toMatchObject({ message: { role: 'tool', content: [{ type: 'text', text: 'result' }] } }) + expect((liftToolResult(row).data as SessionFormatJsonObject)['message']).not.toHaveProperty('isError') + }) + + it('rejects a released wrapper with a non-boolean isError flag', () => { + const row = event(0, 'tool/result', { + turn: 1, step: 1, + message: { + ...wrapperMessage(), + content: [{ type: 'tool-result', toolCallId: 'call-1', isError: 'yes', content: [] }], + }, + }) + expect(() => liftToolResult(row)).toThrow(/tool-result isError must be boolean/) + }) + + it('passes non-tool rows through both transforms', () => { + const row = event(0, 'user/message', { content: [], source: { kind: 'user' }, role: 'user', id: 'u' }) + expect(liftToolResult(row)).toBe(row) + }) + + it('preserves isError and repair identity across the lift', () => { + const repair = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { + id: 'interrupted-tool-result-call-1-0', + role: 'user', + source: { kind: 'tool', callId: 'call-1' }, + content: [{ + type: 'tool-result', + toolCallId: 'call-1', + isError: true, + content: [{ + type: 'text', + text: 'The tool call was interrupted before the Harness recorded it as started. Retry it if it is still needed.', + }], + }], + }, + error: { name: 'ToolNotStartedError', code: 'TOOL_NOT_STARTED' }, + }) + const lifted = liftToolResult(repair) + expect((lifted.data as SessionFormatJsonObject)['message']).toMatchObject({ + role: 'tool', + toolCallId: 'call-1', + isError: true, + id: 'interrupted-tool-result-call-1-0', + }) + expect((lifted.data as SessionFormatJsonObject)['error']).toEqual({ name: 'ToolNotStartedError', code: 'TOOL_NOT_STARTED' }) + }) + + it('refuses nested released results without discarding their identity or error status', () => { + const row = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { + ...wrapperMessage(), + content: [{ + type: 'tool-result', + toolCallId: 'call-1', + isError: false, + content: [{ + type: 'tool-result', + toolCallId: 'nested-call', + isError: true, + content: [{ type: 'text', text: 'hidden' }], + }], + }], + }, + }) + const before = structuredClone(row) + expect(() => liftToolResult(row)).toThrow(SessionFormatUnsupportedMigrationError) + expect(() => liftToolResult(row)).toThrow('cannot preserve its call identity and error status') + expect(row).toEqual(before) + }) + + it('rejects a released wrapper with extra top-level content blocks', () => { + const row = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { + ...wrapperMessage(), + content: [ + { type: 'tool-result', toolCallId: 'call-1', isError: false, content: [{ type: 'text', text: 'result' }] }, + { type: 'text', text: 'extra' }, + ], + }, + }) + expect(() => liftToolResult(row)).toThrow(/exactly one tool-result wrapper/) + }) +}) + +describe('released V4 codec with native tool-role rows', () => { + it('encodes and decodes a first-class tool result unchanged', () => { + const row = { ...event(0, 'tool/result', { turn: 1, step: 1, message: firstClassMessage() }), surfaceOp: 'append' } as SessionFormatEvent + const encoded = releasedV4SessionFormatCodec.encodeEvent(row) + expect(encoded).toEqual(row) + const collector = new SessionFormatEventCollector() + const decoder = releasedV4SessionFormatCodec.createDecoder( + { type: 'session', ...header }, + 'strict', + ) + decoder.decodeRow(row, collector) + expect(collector.values).toEqual([row]) + }) + + it('rejects a released-wrapper row in the current V4 decoder', () => { + const wrapperRow = { ...event(0, 'tool/result', { turn: 1, step: 1, message: wrapperMessage() }), surfaceOp: 'append' } as SessionFormatEvent + const collector = new SessionFormatEventCollector() + const decoder = releasedV4SessionFormatCodec.createDecoder( + { type: 'session', ...header }, + 'strict', + ) + expect(() => { decoder.decodeRow(wrapperRow, collector) }).toThrow(/requires a tool-role message/) + }) + + it('keeps native semantic failures hard even in recoverable mode', () => { + const row = { ...event(0, 'tool/result', { turn: 1, step: 1, message: firstClassMessage('call-1', 'result', 'yes' as never) }), surfaceOp: 'append' } as SessionFormatEvent + const decoder = releasedV4SessionFormatCodec.createDecoder({ type: 'session', ...header }, 'recoverable') + expect(() => { decoder.decodeRow(row, new SessionFormatEventCollector()) }).toThrow(/isError must be boolean/) + }) + + it('refuses a native row whose error metadata lacks the message isError flag', () => { + const bad = event(0, 'tool/result', { + turn: 1, + step: 1, + message: firstClassMessage('call-1', 'result', false), + error: { name: 'ToolNotStartedError', code: 'TOOL_NOT_STARTED' }, + }) + expect(() => releasedV4SessionFormatCodec.encodeEvent(bad)).toThrow(/error metadata for a non-error tool result/) + }) + + it('restores a first-class artifact through the released V3 relationship rules', () => { + const artifact = { + header: header as unknown as SessionFormatHeader, + inheritedEventCount: 0, + events: [ + event(0, 'turn/start', { turn: 1 }), + event(1, 'step/start', { turn: 1, step: 1 }), + { + type: 'assistant/message', seq: 2, time: 3, surfaceOp: 'append', + data: { + turn: 1, step: 1, + message: { + id: 'a-1', role: 'assistant', + content: [{ type: 'tool-call', id: 'call-1', name: 'bash', arguments: '{}' }], + source: { kind: 'model', provider: 'mock', model: 'mock' }, + }, + stream: [], + }, + }, + { + type: 'tool/call', seq: 3, time: 4, + data: { turn: 1, step: 1, callId: 'call-1', name: 'bash', arguments: '{}' }, + }, + { + type: 'tool/result', seq: 4, time: 5, surfaceOp: 'append', + data: { turn: 1, step: 1, message: firstClassMessage('call-1') }, + }, + event(5, 'step/end', { turn: 1, step: 1 }), + event(6, 'turn/end', { turn: 1, reason: { kind: 'completed' } }), + ], + } + expect(restoreReleasedV4Artifact(artifact as never, new Set(artifact.events.map(item => item.type)))).toBe(artifact) + expect(artifact.events[4]).toMatchObject({ data: { message: { role: 'tool', toolCallId: 'call-1' } } }) + }) +}) + +describe('V3 to V4 edge lifts released tool results', () => { + function migrate(rows: readonly SessionFormatEvent[]) { + const targetHeader = sessionFormatV3ToV4.migrateHeader({ ...header, version: 3 }) + const stage = createSessionFormatV3ToV4([]).createStage({ + sourceHeader: { ...header, version: 3 }, + targetHeader, + sourceInheritedEventCount: 0, + sourceKind: 'decoded', + }) + const collector = new SessionFormatEventCollector() + for (const [seq, row] of rows.entries()) stage.transformEvent({ ...row, seq }, collector) + return { header: targetHeader, cut: stage.finish(collector), events: collector.values } + } + + it('lifts a released wrapper tool result into the native message', () => { + const rows = [ + event(0, 'turn/start', { turn: 1 }), + event(1, 'step/start', { turn: 1, step: 1 }), + { + type: 'tool/result', seq: 2, time: 3, surfaceOp: 'append', + data: { turn: 1, step: 1, message: wrapperMessage() }, + }, + ] + const output = migrate(rows) + expect(output.events[2]?.data).toEqual({ turn: 1, step: 1, message: firstClassMessage() }) + }) + + it('keeps non-tool rows intact and expands runs through the same transform', () => { + const row = event(0, 'turn/start', { turn: 1 }) + const run = { runType: 'identity', firstSeq: 0, eventCount: 1, expand: () => [row] } + const emitted: SessionFormatEvent[] = [] + const stage = createSessionFormatV3ToV4([]).createStage({ + sourceHeader: { ...header, version: 3 }, + targetHeader: { ...header }, + sourceInheritedEventCount: 0, + sourceKind: 'decoded', + }) + stage.transformRun(run, { + emitEvent: (value) => { emitted.push(value) }, + emitRun: () => { throw new Error('unexpected run emission') }, + }) + expect(emitted).toEqual([{ ...row, seq: 0 }]) + }) +}) + +describe('native tool-result validation', () => { + function native(overrides: SessionFormatJsonObject = {}): SessionFormatEvent { + return event(0, 'tool/result', { turn: 1, step: 1, message: { ...firstClassMessage(), ...overrides } }) + } + + function raw(data: unknown): SessionFormatEvent { + return { type: 'tool/result', seq: 0, time: 1, data } as SessionFormatEvent + } + + it('accepts a native message and ignores rows of other event types', () => { + expect(() => { assertV4ToolResultMessage(native()) }).not.toThrow() + expect(() => { assertV4ToolResultMessage(event(0, 'user/message', { role: 'user', content: [] })) }).not.toThrow() + }) + + it('refuses data and messages that are not objects', () => { + expect(() => { assertV4ToolResultMessage(raw('nope')) }).toThrow(/data must be an object/) + expect(() => { assertV4ToolResultMessage(raw({ message: 'nope' })) }).toThrow(/message must be an object/) + }) + + it('refuses ids that are not non-empty strings', () => { + expect(() => { assertV4ToolResultMessage(native({ id: '' })) }).toThrow(/string id/) + expect(() => { assertV4ToolResultMessage(native({ id: 7 })) }).toThrow(/string id/) + }) + + it('refuses a message that is not the tool role', () => { + expect(() => { assertV4ToolResultMessage(native({ role: 'user' })) }).toThrow(/tool-role message/) + }) + + it('refuses a tool call id that does not match the tool source', () => { + expect(() => { assertV4ToolResultMessage(native({ toolCallId: 'other' })) }).toThrow(/matching its tool source/) + expect(() => { assertV4ToolResultMessage(native({ toolCallId: '' })) }).toThrow(/matching its tool source/) + expect(() => { assertV4ToolResultMessage(native({ source: { kind: 'tool', callId: 'other' } })) }).toThrow(/matching its tool source/) + expect(() => { assertV4ToolResultMessage(native({ source: 'nope' })) }).toThrow(/matching its tool source/) + }) + + it('refuses a source that is not the tool source', () => { + expect(() => { assertV4ToolResultMessage(native({ source: { kind: 'model', callId: 'call-1' } })) }).toThrow(/requires a tool source/) + }) + + it('refuses content that is not an array', () => { + expect(() => { assertV4ToolResultMessage(native({ content: 'nope' })) }).toThrow(/array content/) + }) + + it('refuses an isError flag that is not boolean', () => { + expect(() => { assertV4ToolResultMessage(native({ isError: 'yes' })) }).toThrow(/isError must be boolean/) + }) + + it('round trips a native message without an isError flag', () => { + const message: SessionFormatJsonObject = { + id: 'tool-result-call-1', + role: 'tool', + source: { kind: 'tool', callId: 'call-1' }, + toolCallId: 'call-1', + content: [{ type: 'text', text: 'result' }], + } + const row = { ...event(0, 'tool/result', { turn: 1, step: 1, message }), surfaceOp: 'append' } as SessionFormatEvent + expect(liftToolResult(row)).toBe(row) + }) + + it('refuses a released wrapper without its wrapper block', () => { + const row = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { id: 'x', role: 'user', source: { kind: 'tool', callId: 'call-1' }, content: [] }, + }) + expect(() => liftToolResult(row)).toThrow(/exactly one tool-result wrapper/) + }) + + it('refuses wrapper rows with invalid source or content fields', () => { + const invalidSource = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { id: 'x', role: 'user', source: 'nope', content: [] }, + }) + expect(() => liftToolResult(invalidSource)).toThrow(/exactly one tool-result wrapper/) + + const invalidContent = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { id: 'x', role: 'user', source: { kind: 'tool', callId: 'call-1' }, content: 'nope' }, + }) + expect(() => liftToolResult(invalidContent)).toThrow(/exactly one tool-result wrapper/) + + const invalidNestedContent = event(0, 'tool/result', { + turn: 1, + step: 1, + message: { + ...wrapperMessage(), + content: [{ type: 'tool-result', toolCallId: 'call-1', content: 'nope' }], + }, + }) + expect(() => liftToolResult(invalidNestedContent)).toThrow(/tool-result content must be an array/) + }) + + it('refuses a native message that still contains a released wrapper', () => { + expect(() => { + assertV4ToolResultMessage(native({ + content: [{ type: 'tool-result', toolCallId: 'call-1', content: [] }], + })) + }).toThrow(/must not contain a released tool-result wrapper/) + }) +}) diff --git a/packages/session/session-log-deepseek/tests/feedback-composition.spec.ts b/packages/session/session-log-deepseek/tests/feedback-composition.spec.ts index c31cce05c6..7bf73bc369 100644 --- a/packages/session/session-log-deepseek/tests/feedback-composition.spec.ts +++ b/packages/session/session-log-deepseek/tests/feedback-composition.spec.ts @@ -78,8 +78,12 @@ it('uploads freeform feedback and message put/edit/delete through the unchanged try { const user = createUserMessage({ content: [{ type: 'text', text: 'Question' }], source: { kind: 'user' } }) const assistant = createAssistantMessage({ content: [{ type: 'text', text: 'Answer' }], source: { provider: 'deepseek-official', model: 'deepseek-v4-flash' } }) + session.append('turn/start', { turn: 1 }) + session.append('step/start', { turn: 1, step: 1 }) session.append('user/message', user, { surfaceOp: 'append' }) session.append('assistant/message', { message: assistant, stream: [], turn: 1, step: 1 }, { surfaceOp: 'append' }) + session.append('step/end', { turn: 1, step: 1 }) + session.append('turn/end', { turn: 1, reason: { kind: 'completed' } }) const messages = session.deriveMessages() recordFeedback(session, { text: ' The session needs a clearer explanation. ' }) const created = await ctx.messageFeedback.put({ sessionId: session.id, messageId: assistant.id, rating: 'negative', note: 'Explain the result.', ifVersion: null }) diff --git a/packages/session/session-persistence-jsonl/src/format.ts b/packages/session/session-persistence-jsonl/src/format.ts index 0c9df5b05e..6d370fc886 100644 --- a/packages/session/session-persistence-jsonl/src/format.ts +++ b/packages/session/session-persistence-jsonl/src/format.ts @@ -11,6 +11,7 @@ import { isAbsolute, join } from 'node:path' import { SESSION_FORMAT_VERSION, + KNOWN_SESSION_EVENT_TYPES, SessionLogOffset, } from '@deepseek-ai/dsh-session' import type { @@ -464,7 +465,7 @@ export class SessionLogScanner { finish(): SessionLogScan { this.finished = true const artifact = this.restore.finish() - assertReleasedV4Relationships(artifact) + assertReleasedV4Relationships(artifact, KNOWN_SESSION_EVENT_TYPES) return { meta: this.meta, inheritedEventCount: SessionLogOffset(artifact.inheritedEventCount), diff --git a/packages/session/session-persistence-jsonl/tests/current-event-admission.spec.ts b/packages/session/session-persistence-jsonl/tests/current-event-admission.spec.ts index 36f5ef40b7..b7cbb7e6ee 100644 --- a/packages/session/session-persistence-jsonl/tests/current-event-admission.spec.ts +++ b/packages/session/session-persistence-jsonl/tests/current-event-admission.spec.ts @@ -1,6 +1,5 @@ import { Context } from '@deepseek-ai/cordis' import { SESSION_FORMAT_VERSION, SessionId, SessionSeq } from '@deepseek-ai/dsh-session' -import { SessionFormatUnsupportedError } from '@deepseek-ai/dsh-session-persistence' import JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl' import { mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' @@ -69,46 +68,6 @@ describe('current event admission at EOF', () => { } }) - it.each(obsoleteTypes)('scanLog refuses a complete required %s EOF row', (type) => { - const bytes = Buffer.from(prefix + JSON.stringify(obsoleteEvent(type)) + '\n') - expect(() => scanLog(bytes)).toThrow(SessionFormatUnsupportedError) - expect(() => scanLog(bytes)).toThrow('format v3 contains unknown event type') - }) - - it.each(obsoleteTypes.flatMap(type => ['', '{not json\n', 'null\n'].map(corruption => ({ type, corruption }))))( - 'scan, read and write refuse required $type after "$corruption" without changing bytes or inode', async ({ type, corruption }) => { - const bytes = Buffer.from(prefix + corruption + JSON.stringify(obsoleteEvent(type)) + '\n') - expect(() => scanLog(bytes)).toThrow(SessionFormatUnsupportedError) - expect(() => scanLog(bytes)).toThrow('format v3 contains unknown event type') - const path = await store(bytes) - const sourceStat = await stat(path) - for (const access of ['read', 'write'] as const) { - const opened = ctx.sessionPersistence.open(id, access).then(async (handle) => { - await handle.close() - }) - await expect(opened).rejects.toThrow(SessionFormatUnsupportedError) - expect(await readFile(path)).toEqual(bytes) - expect(await stat(path)).toMatchObject({ dev: sourceStat.dev, ino: sourceStat.ino }) - } - }, - ) - - it.each(['', '{not json\n', 'null\n'])('refuses malformed system payloads after %j without modifying storage', async (corruption) => { - const malformed = { type: 'system/message', seq: 1, time: 2, data: null, surfaceOp: 'append' } - const bytes = Buffer.from(prefix + corruption + JSON.stringify(malformed) + '\n') - expect(() => scanLog(bytes)).toThrow('system/message data must be an object') - const path = await store(bytes) - const sourceStat = await stat(path) - for (const access of ['read', 'write'] as const) { - const opened = ctx.sessionPersistence.open(id, access).then(async (handle) => { - await handle.close() - }) - await expect(opened).rejects.toThrow('system/message data must be an object') - expect(await readFile(path)).toEqual(bytes) - expect(await stat(path)).toMatchObject({ dev: sourceStat.dev, ino: sourceStat.ino }) - } - }) - it.each(obsoleteTypes)('retains ignorable %s through scanning and a provider append', async (type) => { const event = obsoleteEvent(type, true) const bytes = Buffer.from(prefix + JSON.stringify(event) + '\n') @@ -126,26 +85,4 @@ describe('current event admission at EOF', () => { expect((await readFile(path)).subarray(0, bytes.length)).toEqual(bytes) }) - it.each([ - '{not json', - 'null', - JSON.stringify({ type: 'user/message', seq: 1, time: 2, data: { - id: 'missing-surface-op', role: 'user', content: [{ type: 'text', text: 'malformed canonical tail' }], - } }), - ])('still recovers an ordinary malformed EOF row: %s', async (tail) => { - const bytes = Buffer.from(prefix + tail + '\n') - expect(scanLog(bytes)).toMatchObject({ events: [start], committedBytes: Buffer.byteLength(prefix) }) - const path = await store(bytes) - const writer = await ctx.sessionPersistence.open(id, 'write') - const end = { - type: 'turn/end' as const, seq: SessionSeq(1), time: 3, data: { turn: 1, reason: { kind: 'completed' as const } }, - } - try { - expect((await writer.read()).events).toEqual([start]) - await writer.append([end]) - } finally { - await writer.close() - } - expect(await readFile(path, 'utf8')).toBe(prefix + JSON.stringify(end) + '\n') - }) }) diff --git a/packages/session/session-persistence-jsonl/tests/generation.spec.ts b/packages/session/session-persistence-jsonl/tests/generation.spec.ts index 664f66b2ba..c42603eb92 100644 --- a/packages/session/session-persistence-jsonl/tests/generation.spec.ts +++ b/packages/session/session-persistence-jsonl/tests/generation.spec.ts @@ -398,7 +398,10 @@ describe('JSONL immutable generation publication', () => { ...boundaryBase, data: { ...boundaryBase.data, text: 'x'.repeat(1024 * 1024 - JSON.stringify(boundaryBase).length) }, } - const largeEvent = { ...event0, seq: 1, data: { turn: 1, text: 'y'.repeat(1024 * 1024) } } + const largeEvent = { type: 'user/message', seq: 1, time: 3, surfaceOp: 'append', data: { + id: 'large-message', role: 'user', source: { kind: 'user' }, + content: [{ type: 'text', text: 'y'.repeat(1024 * 1024) }], + } } const finalEvent = { ...event1, seq: 2 } await writeFile(request.sourcePath, line(header(0)) + line(boundaryEvent) + line(largeEvent) + line(finalEvent)) let now = 0 diff --git a/packages/session/session-persistence-jsonl/tests/jsonl.spec.ts b/packages/session/session-persistence-jsonl/tests/jsonl.spec.ts index 02a494368f..8ee6fc2138 100644 --- a/packages/session/session-persistence-jsonl/tests/jsonl.spec.ts +++ b/packages/session/session-persistence-jsonl/tests/jsonl.spec.ts @@ -666,16 +666,17 @@ describe('JsonlSessionPersistence: stored-format refusals', () => { .rejects.toThrow(/contains event type "request\/header-delta" \(seq 1\) unknown to this harness/) }) - it('rejects a stored v0 full header carrying the legacy fallback reason', async () => { + it('rejects a stored full header carrying the legacy fallback reason', async () => { const m = meta('legacy-header-fallback', '/legacy') const path = rawLogPath(root, m.cwd, m.id) await mkdir(sessionDir(root, m.cwd, m.id), { recursive: true }) await writeFile(path, [ JSON.stringify(toHeaderLine(m)), + JSON.stringify({ type: 'turn/start', seq: SessionSeq(0), time: 1, data: { turn: 1 } }), JSON.stringify({ type: 'request/header', - seq: SessionSeq(0), - time: 1, + seq: SessionSeq(1), + time: 2, data: { header: { config: { provider: 'mock', model: 'legacy' } }, reason: 'fallback' }, }), '', diff --git a/packages/session/session-persistence-jsonl/tests/migration-refusal.spec.ts b/packages/session/session-persistence-jsonl/tests/migration-refusal.spec.ts index 24f3844a62..8821cdf873 100644 --- a/packages/session/session-persistence-jsonl/tests/migration-refusal.spec.ts +++ b/packages/session/session-persistence-jsonl/tests/migration-refusal.spec.ts @@ -2,8 +2,9 @@ import { Context } from '@deepseek-ai/cordis' import { SESSION_FORMAT_VERSION, SessionId } from '@deepseek-ai/dsh-session' +import { createSessionFormatCatalogWithChildren } from '@deepseek-ai/dsh-session-format-catalog' import type { SessionFormatJsonObject } from '@deepseek-ai/dsh-session-format' -import { SessionFormatUnsupportedError } from '@deepseek-ai/dsh-session-persistence' +import { SessionFormatUnsupportedError, SessionPersistenceCorruptionError } from '@deepseek-ai/dsh-session-persistence' import JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl' import { createHash } from 'node:crypto' import { mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises' @@ -29,6 +30,18 @@ const prefix: readonly SessionFormatJsonObject[] = [ { type: 'user/message', data: question, surfaceOp: 'append' }, { type: 'request/header', data: { header: { config, system: 'Inspect the durable audit.' }, reason: 'initial' } }, ] +/** Released V3 files still carry plugin attribution; current V4 files are producer-owned. */ +const releasedPrefix: readonly SessionFormatJsonObject[] = [ + ...prefix.slice(0, 2), + { type: 'system/message', surfaceOp: 'append', data: { + turn: 1, step: 1, message: { + id: 'native-system', role: 'system', source: { kind: 'plugin', plugin: '@deepseek-ai/dsh-system-prompt' }, + content: [{ type: 'text', text: 'Inspect the durable audit.' }], + }, + } }, + { type: 'user/message', data: question, surfaceOp: 'append' }, + { type: 'request/header', data: { header: { config }, reason: 'initial' } }, +] const nativePrefix: readonly SessionFormatJsonObject[] = [ ...prefix.slice(0, 2), { type: 'system/message', surfaceOp: 'append', data: { @@ -41,6 +54,58 @@ const nativePrefix: readonly SessionFormatJsonObject[] = [ { type: 'request/header', data: { header: { config }, reason: 'initial' } }, ] + +function checkpointSource(): SessionFormatJsonObject { + const restore = createSessionFormatCatalogWithChildren([]).createRestore({ + type: 'session', version: 3, id: 'checkpoint-source', createdAt: 0, isSeeded: false, delegationDepth: 0, + }, { recovery: 'strict', validation: 'current' }) + restore.decodeRow({ type: 'user/message', seq: 0, time: 0, surfaceOp: 'append', data: { + ...question, source: { kind: 'plugin', plugin: 'compact' }, + } }) + return (restore.finish().events[0]?.data as SessionFormatJsonObject)['source'] as SessionFormatJsonObject +} + +function nativeCheckpoint(compactionId: string): readonly SessionFormatJsonObject[] { + return [ + ...nativePrefix, + { type: 'compaction/start', data: { compactionId: 'owner', turn: 1 } }, + { type: 'compaction/summary', data: { + compactionId: 'owner', summary: [{ type: 'text', text: 'Summary' }], shadowedRange: { start: 3, end: 3 }, + shadowedSeqs: [3], shadowedTokenCount: 1, provider: config.provider, model: config.model, + } }, + { type: 'user/message', surfaceOp: { op: 'replace', startSeq: 3, endSeq: 3 }, sourceEventSeqs: [3, 5, 6], data: { + ...question, id: 'checkpoint', source: { ...checkpointSource(), compactionId }, + } }, + { type: 'compaction/end', data: { compactionId: 'owner', turn: 1 } }, + { type: 'step/end', data: { turn: 1, step: 1 } }, + { type: 'turn/end', data: { turn: 1, reason: { kind: 'completed' } } }, + ] +} + +function releasedToolRows( + messageFields: SessionFormatJsonObject = {}, wrapperFields: SessionFormatJsonObject = {}, +): SessionFormatJsonObject[] { + return [ + ...releasedPrefix, + { type: 'assistant/message', surfaceOp: 'append', data: { + turn: 1, step: 1, stream: [], message: { + id: 'assistant', role: 'assistant', source: { kind: 'model', provider: config.provider, model: config.model }, + content: [{ type: 'tool-call', id: 'outer-call', name: 'example', arguments: '{}' }], + }, + } }, + { type: 'tool/call', data: { turn: 1, step: 1, callId: 'outer-call', name: 'example', arguments: '{}' } }, + { type: 'tool/result', surfaceOp: 'append', data: { + turn: 1, step: 1, message: { + ...messageFields, id: 'result', role: 'user', source: { kind: 'tool', callId: 'outer-call' }, + content: [{ type: 'tool-result', toolCallId: 'outer-call', isError: false, + content: [{ type: 'text', text: 'result' }], ...wrapperFields }], + }, + } }, + { type: 'step/end', data: { turn: 1, step: 1 } }, + { type: 'turn/end', data: { turn: 1, reason: { kind: 'completed' } } }, + ] +} + function ptcRow(type: string): SessionFormatJsonObject { return { type, data: type.endsWith('-start') ? dispatch : { ...dispatch, isError: false, content: [{ type: 'text', text: 'Audit is intact.' }], @@ -76,6 +141,8 @@ const nativeRefusals = [ name: type, tail: ptcRow(type), diagnostic: 'format v3 contains unknown event type ' + JSON.stringify(type) + ' at seq ' + String(nativePrefix.length), + currentError: 'unsupported' as const, + currentSubject: type, })), { name: 'retired request/header.system', @@ -83,8 +150,16 @@ const nativeRefusals = [ header: { config, system: 'This prompt must not be discarded.' }, reason: 'change', } }, diagnostic: 'format v3 request/header rejects retired header.system', + currentError: 'corruption' as const, + currentSubject: 'header.system', }, -] satisfies readonly { name: string; tail: SessionFormatJsonObject; diagnostic: string }[] +] satisfies readonly { + name: string + tail: SessionFormatJsonObject + diagnostic: string + currentError: 'unsupported' | 'corruption' + currentSubject: string +}[] const modes = (['none', 'zstd'] as const).flatMap(compression => (['read', 'write'] as const).map(access => ({ compression, access })), @@ -148,6 +223,23 @@ async function expectRefusal(ctx: Context, access: 'read' | 'write', path: strin await expect(opened).rejects.toMatchObject({ message, location: { kind: 'jsonl', path } }) } +async function expectCurrentRefusal( + ctx: Context, + access: 'read' | 'write', + path: string, + kind: 'unsupported' | 'corruption', + subject: string, +) { + // Close an unexpectedly successful open before the rejection assertion fails. + const opened = ctx.sessionPersistence.open(id, access).then(async (handle) => { await handle.close() }) + const expected = kind === 'unsupported' ? SessionFormatUnsupportedError : SessionPersistenceCorruptionError + await expect(opened).rejects.toBeInstanceOf(expected) + await expect(opened).rejects.toThrow(subject) + if (kind === 'unsupported') { + await expect(opened).rejects.toMatchObject({ location: { kind: 'jsonl', path } }) + } +} + async function expectOnlyGenerations(paths: readonly string[]) { const directory = dirname(paths[0]!) // A released write lease keeps session.lock; every other extra entry is forbidden. @@ -174,8 +266,135 @@ describe.each(modes)('EOF migration refusal ($compression, $access)', ({ compres } }) + it('refuses a V3 watermark claiming V4 without publishing a successor', async () => { + const marker = { type: 'session-log-deepseek/delivery-accepted', data: { + sessionId: id, throughSeq: 0, sessionFormatVersion: 4, + } } + const path = await store(3, compression, [...releasedPrefix, marker]) + const original = await observe(path) + const ctx = await mount(compression) + await expectRefusal(ctx, access, path, + 'format v3 delivery marker claims target format v4; source v3 artifact remains unchanged (raw log: ' + path + ')') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it.each(['tool/code-dispatch-start', 'tool/code-dispatch'])('keeps %s unsupported beyond a damaged native suffix', async (type) => { + const path = await store(SESSION_FORMAT_VERSION, compression, [...nativePrefix, {}, ptcRow(type)]) + const original = await observe(path) + const ctx = await mount(compression) + await expectCurrentRefusal(ctx, access, path, 'unsupported', type) + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it('refuses a native checkpoint owned by a different compaction before exposing a handle', async () => { + const path = await store(SESSION_FORMAT_VERSION, compression, nativeCheckpoint('wrong-owner')) + const original = await observe(path) + const ctx = await mount(compression) + await expectCurrentRefusal(ctx, access, path, 'corruption', 'matching compaction/start') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it('refuses a native tool result without its advertised call before exposing a handle', async () => { + const path = await store(SESSION_FORMAT_VERSION, compression, [...nativePrefix, { + type: 'tool/result', surfaceOp: 'append', data: { turn: 1, step: 1, message: { + id: 'orphan', role: 'tool', toolCallId: 'missing', source: { kind: 'tool', callId: 'missing' }, + content: [{ type: 'text', text: 'orphan result' }], + } }, + }]) + const original = await observe(path) + const ctx = await mount(compression) + await expectCurrentRefusal(ctx, access, path, 'corruption', 'advertised tool lifecycle') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it.each([false, true])('reopens native matching checkpoints with unfinished tail=%s without changing records', async (unfinished) => { + const rows = nativeCheckpoint('owner') + const path = await store(SESSION_FORMAT_VERSION, compression, unfinished ? rows.slice(0, 8) : rows) + const original = await observe(path) + const ctx = await mount(compression) + const handle = await ctx.sessionPersistence.open(id, access) + try { + const restored = await handle.read() + expect(restored.events.find(event => event.type === 'user/message' && event.data.id === 'checkpoint')?.data) + .toMatchObject({ source: { ...checkpointSource(), compactionId: 'owner' } }) + } finally { + await handle.close() + } + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it('preserves a V3 nested tool result when its identity and error status cannot migrate', async () => { + const rows = releasedToolRows({}, { content: [ + { type: 'tool-result', toolCallId: 'nested-call', isError: true, content: [{ type: 'text', text: 'inner failure' }] }, + ] }) + const path = await store(3, compression, rows) + const original = await observe(path) + const ctx = await mount(compression) + await expectRefusal(ctx, access, path, + 'format v3 tool/result at seq 7 contains a nested tool-result; migration cannot preserve its call identity and error status' + + '; source v3 artifact remains unchanged (raw log: ' + path + ')') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it.each(['extension', '__proto__', 'constructor'])('refuses a V3 wrapper with unmapped %s metadata without publishing', async (field) => { + const rows = releasedToolRows({}, Object.fromEntries([[field, { saved: true }]])) + const path = await store(3, compression, rows) + const original = await observe(path) + const ctx = await mount(compression) + await expectRefusal(ctx, access, path, + `format v3 tool/result at seq 7 has unmapped tool-result field ${JSON.stringify(field)}` + + '; source v3 artifact remains unchanged (raw log: ' + path + ')') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it.each([ + { field: 'toolCallId', value: 'conflicting-call' }, + { field: 'isError', value: true }, + ])('refuses a conflicting outer $field before publishing', async ({ field, value }) => { + const rows = releasedToolRows({ [field]: value }) + const path = await store(3, compression, rows) + const original = await observe(path) + const ctx = await mount(compression) + await expectRefusal(ctx, access, path, `format v3 tool/result at seq 7 has conflicting outer ${field}` + + '; source v3 artifact remains unchanged (raw log: ' + path + ')') + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations([path]) + }) + + it('preserves outer V3 tool-message metadata through migration and native reopening', async () => { + const metadata = JSON.parse('{"__proto__":{"saved":"prototype"},"constructor":{"saved":"constructor"},"extension":{"saved":true}}') as SessionFormatJsonObject + const path = await store(3, compression, releasedToolRows({ ...metadata, toolCallId: 'outer-call', isError: false })) + const original = await observe(path) + const ctx = await mount(compression) + const expected = { + ...metadata, id: 'result', role: 'tool', source: { kind: 'tool', callId: 'outer-call' }, + toolCallId: 'outer-call', isError: false, content: [{ type: 'text', text: 'result' }], + } + for (const mode of [access, 'read'] as const) { + const handle = await ctx.sessionPersistence.open(id, mode) + try { + const restored = await handle.read() + const result = restored.events.find(event => event.type === 'tool/result') + expect(result?.data.message).toEqual(expected) + expect(Object.hasOwn(result!.data.message, '__proto__')).toBe(true) + expect(Object.getPrototypeOf(result!.data.message)).toBe(Object.prototype) + } finally { + await handle.close() + } + } + expect(await observe(path)).toEqual(original) + await expectOnlyGenerations(access === 'read' ? [path] : [path, generationLogPath(root, undefined, id, SESSION_FORMAT_VERSION, compression)]) + }) + it.each(nativeRefusals.flatMap(refusal => ([3, SESSION_FORMAT_VERSION] as const).map(version => ({ ...refusal, version }))))( - 'refuses V$version $name instead of falling back to readable V2', async ({ tail, diagnostic, version }) => { + 'refuses V$version $name instead of falling back to readable V2', async ({ tail, diagnostic, currentError, currentSubject, version }) => { const lowerPath = await store(2, compression, prefix) const lower = await observe(lowerPath) const ctx = await mount(compression) @@ -193,12 +412,15 @@ describe.each(modes)('EOF migration refusal ($compression, $access)', ({ compres expect(await observe(lowerPath)).toEqual(lower) await expectOnlyGenerations([lowerPath]) - const path = await store(version, compression, [...nativePrefix, tail]) + const path = await store(version, compression, [...(version === 3 ? releasedPrefix : nativePrefix), tail]) const original = await observe(path) - const message = diagnostic + (version < SESSION_FORMAT_VERSION ? `; source v${version} artifact remains unchanged` : '') - + ' (raw log: ' + path + ')' for (let attempt = 0; attempt < 2; attempt += 1) { - await expectRefusal(ctx, access, path, message) + if (version === 3) { + await expectRefusal(ctx, access, path, + diagnostic + `; source v${version} artifact remains unchanged (raw log: ${path})`) + } else { + await expectCurrentRefusal(ctx, access, path, currentError, currentSubject) + } expect(await observe(path)).toEqual(original) expect(await observe(lowerPath)).toEqual(lower) await expectOnlyGenerations([lowerPath, path]) diff --git a/packages/session/session-persistence-jsonl/tests/v2-ptc-migration.spec.ts b/packages/session/session-persistence-jsonl/tests/v2-ptc-migration.spec.ts index e53e646f23..c3d2689eb6 100644 --- a/packages/session/session-persistence-jsonl/tests/v2-ptc-migration.spec.ts +++ b/packages/session/session-persistence-jsonl/tests/v2-ptc-migration.spec.ts @@ -40,6 +40,10 @@ const toolMessage = { content: [{ type: 'text', text: 'tools-code-mode: image attached; tool/code-dispatch' }], }], } +const currentToolMessage = { + role: 'tool', source: toolMessage.source, toolCallId: toolCall.id, + content: toolMessage.content[0]!.content, isError: false, id: toolMessage.id, +} const imageMessage = { id: 'tools-code-mode:root-call:image-context', role: 'user', source: { kind: 'plugin', plugin: 'tools-code-mode', form: 'notice', summary: 'Image from tools-code-mode' }, @@ -157,6 +161,7 @@ describe('JSONL V2 PTC publication and restore', () => { const expectedEvents: SessionFormatEvent[] = events.map(event => ({ ...event, seq: event.seq < 2 ? event.seq : event.seq + 1 })) expectedEvents[5] = { ...expectedEvents[5], type: 'tool/ptc-dispatch-start' } as SessionFormatEvent expectedEvents[6] = { ...expectedEvents[6], type: 'tool/ptc-dispatch' } as SessionFormatEvent + expectedEvents[7] = { ...expectedEvents[7], data: { turn: 1, step: 1, message: currentToolMessage } } as SessionFormatEvent expectedEvents[8] = { ...expectedEvents[8], data: { target: 'next-step', start: 0, removedCount: 0, inserted: [currentImageMessage], } } as SessionFormatEvent @@ -186,10 +191,10 @@ describe('JSONL V2 PTC publication and restore', () => { expect(restored.events).toEqual(expectedEvents) const session = Session.fromRestore(id, restored.events, reloaded.header, reloaded.inheritedEventCount, restored.eventState) const messages = session.deriveMessages() - expect(messages).toEqual([userMessage, assistantMessage, toolMessage, currentImageMessage]) + expect(messages).toEqual([userMessage, assistantMessage, currentToolMessage, currentImageMessage]) // Provider-neutral input evidence: no provider converter is a declared dependency here. expect(messages.map(({ id, role, content }) => ({ id, role, content }))).toEqual( - [userMessage, assistantMessage, toolMessage, imageMessage].map(({ id, role, content }) => ({ id, role, content })), + [userMessage, assistantMessage, currentToolMessage, imageMessage].map(({ id, role, content }) => ({ id, role, content })), ) expect(messages[1]?.source).toEqual(assistantMessage.source) expect(messages[2]?.source).toEqual({ kind: 'tool', callId: 'tools-code-mode:root-call' }) diff --git a/packages/session/session-telemetry-otel/tests/otel.spec.ts b/packages/session/session-telemetry-otel/tests/otel.spec.ts index 4e15d9058f..754f87bd2d 100644 --- a/packages/session/session-telemetry-otel/tests/otel.spec.ts +++ b/packages/session/session-telemetry-otel/tests/otel.spec.ts @@ -571,9 +571,13 @@ describe('OpenTelemetrySessionBackend route and feedback', () => { const session = ctx.sessions.create(SessionId('live-ratings')) const handle = await ctx.sessionPersistence.create(session.header) try { + session.append('turn/start', { turn: 1 }) + session.append('step/start', { turn: 1, step: 1 }) if (provider !== undefined) session.append('request/header', { header: { config: { provider, model: 'm' } }, reason: 'initial' }) const message = createAssistantMessage({ content: [{ type: 'text', text: 'answer' }], source: { provider: provider ?? 'mock', model: 'm' } }) session.append('assistant/message', { message, stream: [], turn: 1, step: 1 }, { surfaceOp: 'append' }) + session.append('step/end', { turn: 1, step: 1 }) + session.append('turn/end', { turn: 1, reason: { kind: 'completed' } }) const request = { sessionId: session.id, messageId: message.id, rating: 'positive' as const, ifVersion: null } const before = session.seq expect((await ctx.messageFeedback.put({ ...request, note: ' ' })).ok).toBe(false) @@ -639,9 +643,13 @@ describe('OpenTelemetrySessionBackend route and feedback', () => { await ctx.plugin(MessageFeedbackService, { maxNoteBytes: 1024 }) await ctx.plugin(OpenTelemetrySessionBackend, { mode, exporter: { url }, processor: { scheduledDelayMillis: 1 } }) const parent = Session.create(SessionId('cold-parent')) + parent.append('turn/start', { turn: 1 }) + parent.append('step/start', { turn: 1, step: 1 }) parent.append('request/header', { header: { config: { provider: 'mock', model: 'm' } }, reason: 'initial' }) const message = createAssistantMessage({ content: [{ type: 'text', text: 'inherited answer' }], source: { provider: 'mock', model: 'm' } }) parent.append('assistant/message', { message, stream: [], turn: 1, step: 1 }, { surfaceOp: 'append' }) + parent.append('step/end', { turn: 1, step: 1 }) + parent.append('turn/end', { turn: 1, reason: { kind: 'completed' } }) const child = Session.create(SessionId('cold-child'), parent.snapshotEvents(), { ...parent.header, id: SessionId('cold-child'), parentSession: parent.id, isSeeded: true, }, parent.seq) @@ -669,7 +677,8 @@ describe('OpenTelemetrySessionBackend route and feedback', () => { rmSync(root, { recursive: true, force: true }) } expect(eventTypes(captures)).toEqual([ - 'request/header', 'assistant/message', 'session/end-seed', 'feedback/record', 'feedback/message-put', + 'turn/start', 'step/start', 'request/header', 'assistant/message', 'step/end', 'turn/end', + 'session/end-seed', 'feedback/record', 'feedback/message-put', ]) expect(allRecords(captures).some(record => record.scope.endsWith('/ops'))).toBe(false) }) @@ -690,9 +699,13 @@ describe('OpenTelemetrySessionBackend route and feedback', () => { await ctx.plugin(MessageFeedbackService, { maxNoteBytes: 1024 }) await ctx.plugin(OpenTelemetrySessionBackend, { mode, exporter: { url }, processor: { scheduledDelayMillis: 1 } }) const session = Session.create(SessionId('cold-feedback')) + session.append('turn/start', { turn: 1 }) + session.append('step/start', { turn: 1, step: 1 }) if (provider !== undefined) session.append('request/header', { header: { config: { provider, model: 'm' } }, reason: 'initial' }) const message = createAssistantMessage({ content: [{ type: 'text', text: 'answer' }], source: { provider: provider ?? 'mock', model: 'm' } }) session.append('assistant/message', { message, stream: [], turn: 1, step: 1 }, { surfaceOp: 'append' }) + session.append('step/end', { turn: 1, step: 1 }) + session.append('turn/end', { turn: 1, reason: { kind: 'completed' } }) const handle = await ctx.sessionPersistence.create(session.header) try { await handle.append(session.snapshotEvents()) diff --git a/packages/session/session-telemetry/src/coordinator.ts b/packages/session/session-telemetry/src/coordinator.ts index d1a0466355..7f3b5d6052 100644 --- a/packages/session/session-telemetry/src/coordinator.ts +++ b/packages/session/session-telemetry/src/coordinator.ts @@ -268,7 +268,7 @@ function shutdownRecord(session: Session): SessionTelemetryRecord { function severityOf(event: SessionEvent): SessionTelemetrySeverity { switch (event.type) { case 'tool/result': - return event.data.message.content[0].isError === true ? 'error' : 'info' + return event.data.message.isError === true ? 'error' : 'info' case 'turn/end': return event.data.reason.kind === 'error' ? 'error' : 'info' default: diff --git a/packages/session/session-telemetry/src/index.ts b/packages/session/session-telemetry/src/index.ts index 8840423617..392df907f7 100644 --- a/packages/session/session-telemetry/src/index.ts +++ b/packages/session/session-telemetry/src/index.ts @@ -47,7 +47,7 @@ declare module '@deepseek-ai/cordis' { /** * Severity of a telemetry record, pre-mapped at capture so a receiver can * alert with zero configuration: `error` for events whose own outcome flag - * says so (the tool-result block's `isError`, `turn/end` error reasons) and for + * says so (the tool message's `isError`, `turn/end` error reasons) and for * `agent-error` operational records. Captured events otherwise default to * `info`; `warn` remains available to `session-telemetry/record` policies and * backends. diff --git a/packages/shell/tool-bash/tests/integration.spec.ts b/packages/shell/tool-bash/tests/integration.spec.ts index 013eaacf58..a75b7370d4 100644 --- a/packages/shell/tool-bash/tests/integration.spec.ts +++ b/packages/shell/tool-bash/tests/integration.spec.ts @@ -76,7 +76,7 @@ function findEvent( function resultText(event: SessionEvent): string { if (event.type !== 'tool/result') return '' - return event.data.message.content[0].content + return event.data.message.content .filter(block => block.type === 'text') .map(block => block.text) .join('') @@ -136,14 +136,12 @@ describe('bash tool through the agent loop', () => { expect(toolCall.data.name).toBe('bash') const toolResult = findEvent(log, 'tool/result') - expect(toolResult.data.message.content[0].isError).toBe(false) + expect(toolResult.data.message.isError).toBe(false) expect(resultText(toolResult)).toBe('integration-ok\n') // The second model call saw the tool result in its derived history. const lastRequest = adapter.requests.at(-1) - const toolResultBlocks = (lastRequest?.messages ?? []) - .flatMap(message => message.content) - .filter(block => block.type === 'tool-result') + const toolResultBlocks = (lastRequest?.messages ?? []).filter(message => message.role === 'tool') expect(toolResultBlocks).toHaveLength(1) const finalMessage = findEvent(log, 'assistant/message', 'last') @@ -164,7 +162,7 @@ describe('bash tool through the agent loop', () => { await waitForIdle(ctx, agent) const toolResult = findEvent(events(agent), 'tool/result') - expect(toolResult.data.message.content[0].isError).toBe(false) + expect(toolResult.data.message.isError).toBe(false) expect(resultText(toolResult)).toContain('[exit code: 9]') }) @@ -197,7 +195,7 @@ describe('bash tool through the agent loop', () => { await waitForIdle(ctx, agent) const firstResult = findEvent(events(agent), 'tool/result') - expect(firstResult.data.message.content[0].isError).toBe(false) + expect(firstResult.data.message.isError).toBe(false) expect(resultText(firstResult)).toBe('started background job bash-1') // The turn closed with the task still running, so the notice cannot exist yet. const isNotice = (e: SessionEvent): e is SessionEvent<'user/message'> => @@ -229,7 +227,7 @@ describe('bash tool through the agent loop', () => { form: 'notice', }) const readResult = findEvent(events(agent), 'tool/result', 'last') - expect(readResult.data.message.content[0].isError).toBe(false) + expect(readResult.data.message.isError).toBe(false) expect(resultText(readResult)).toContain('bg-ok') expect(resultText(readResult)).toContain('[status: completed, exit code: 0]') }) diff --git a/packages/subagent/subagent-acp/src/run.ts b/packages/subagent/subagent-acp/src/run.ts index 3164c5d634..59413da0f2 100644 --- a/packages/subagent/subagent-acp/src/run.ts +++ b/packages/subagent/subagent-acp/src/run.ts @@ -476,7 +476,7 @@ export async function startAcpRun(request: SubagentStartRequest, spec: AcpRunSpe request.signal.addEventListener('abort', onAbort, { once: true }) // Read at every return so a partial answer survives a later cancel/error. - const collectOutput = (): ContentBlock[] => fold.collect() ?? [] + const collectOutput = (): readonly ContentBlock[] => fold.collect() ?? [] // Establish the remote session before publishing a handle. Any failure owns // the still-private process and therefore reaps it before rejecting. diff --git a/packages/subagent/subagent-acp/tests/fixtures/loader/mock-delegating-llm.ts b/packages/subagent/subagent-acp/tests/fixtures/loader/mock-delegating-llm.ts index f318424153..ca1f556656 100644 --- a/packages/subagent/subagent-acp/tests/fixtures/loader/mock-delegating-llm.ts +++ b/packages/subagent/subagent-acp/tests/fixtures/loader/mock-delegating-llm.ts @@ -10,12 +10,13 @@ import { ToolCallId, LlmAdapter } from '@deepseek-ai/dsh-llm' */ class MockDelegatingAdapter extends LlmAdapter { async * stream(options: GenerateOptions): AsyncIterable { - const toolResultText = options.messages.at(-1)?.content - .filter(block => block.type === 'tool-result') - .flatMap(block => block.content) - .filter(block => block.type === 'text') - .map(block => block.text) - .join('') ?? '' + const last = options.messages.at(-1) + const toolResultText = last?.role === 'tool' + ? last.content + .filter(block => block.type === 'text') + .map(block => block.text) + .join('') + : '' if (toolResultText.length === 0) { const args = JSON.stringify({ description: 'cwd probe', prompt: 'report your workspace' }) diff --git a/packages/subagent/subagent-acp/tests/loader-composition.e2e.ts b/packages/subagent/subagent-acp/tests/loader-composition.e2e.ts index 2d93909fab..791cb36b06 100644 --- a/packages/subagent/subagent-acp/tests/loader-composition.e2e.ts +++ b/packages/subagent/subagent-acp/tests/loader-composition.e2e.ts @@ -37,7 +37,7 @@ async function jsonlFiles(dir: string): Promise { function toolResultText(events: SessionEvent[]): string { const results = events.filter(event => event.type === 'tool/result') expect(results).toHaveLength(1) - return results[0]!.data.message.content[0].content + return results[0]!.data.message.content .filter(block => block.type === 'text') .map(block => block.text) .join('') diff --git a/packages/subagent/subagent-acp/tests/subagent-acp.spec.ts b/packages/subagent/subagent-acp/tests/subagent-acp.spec.ts index 6db46da475..25a25a5e88 100644 --- a/packages/subagent/subagent-acp/tests/subagent-acp.spec.ts +++ b/packages/subagent/subagent-acp/tests/subagent-acp.spec.ts @@ -59,7 +59,7 @@ async function setup(mockEnv: SetupEnv = {}, permission: 'allow' | 'reject' = 'r return ctx } -function text(blocks: { type: string; text?: string }[]): string { +function text(blocks: readonly { type: string; text?: string }[]): string { return blocks.filter(b => b.type === 'text').map(b => b.text).join('') } diff --git a/packages/subagent/subagent-dsh-sdk/src/run.ts b/packages/subagent/subagent-dsh-sdk/src/run.ts index 565b9860bd..165952b5a5 100644 --- a/packages/subagent/subagent-dsh-sdk/src/run.ts +++ b/packages/subagent/subagent-dsh-sdk/src/run.ts @@ -303,7 +303,7 @@ export async function startSdkRun(request: SubagentStartRequest, spec: SdkRunSpe if (notification.method !== 'session.event' || notification.params.sessionId !== childSessionId) return fold.push(notification.params.event as SessionEvent) } - const collectOutput = (): ContentBlock[] => fold.collect() ?? [] + const collectOutput = (): readonly ContentBlock[] => fold.collect() ?? [] const teardown = async (): Promise => { try { await harness.close() diff --git a/packages/subagent/subagent-dsh-sdk/tests/fixtures/loader/mock-delegating-llm.ts b/packages/subagent/subagent-dsh-sdk/tests/fixtures/loader/mock-delegating-llm.ts index f07a50379c..1a102296ef 100644 --- a/packages/subagent/subagent-dsh-sdk/tests/fixtures/loader/mock-delegating-llm.ts +++ b/packages/subagent/subagent-dsh-sdk/tests/fixtures/loader/mock-delegating-llm.ts @@ -25,12 +25,13 @@ class MockDelegatingAdapter extends LlmAdapter { } async * stream(options: GenerateOptions): AsyncIterable { - const toolResultText = options.messages.at(-1)?.content - .filter(block => block.type === 'tool-result') - .flatMap(block => block.content) - .filter(block => block.type === 'text') - .map(block => block.text) - .join('') ?? '' + const last = options.messages.at(-1) + const toolResultText = last?.role === 'tool' + ? last.content + .filter(block => block.type === 'text') + .map(block => block.text) + .join('') + : '' if (toolResultText.length === 0) { const selectedRoute = process.env.DSH_TEST_CHILD_DEFAULT_ROUTE === '1' diff --git a/packages/subagent/subagent-dsh-sdk/tests/loader-composition.e2e.ts b/packages/subagent/subagent-dsh-sdk/tests/loader-composition.e2e.ts index 5ea51ec585..ae9b8e8609 100644 --- a/packages/subagent/subagent-dsh-sdk/tests/loader-composition.e2e.ts +++ b/packages/subagent/subagent-dsh-sdk/tests/loader-composition.e2e.ts @@ -41,7 +41,7 @@ async function sessionEvents(log: string): Promise { function toolResultText(events: SessionEvent[]): string { const results = events.filter(event => event.type === 'tool/result') expect(results).toHaveLength(1) - return results[0]!.data.message.content[0].content + return results[0]!.data.message.content .filter(block => block.type === 'text') .map(block => block.text) .join('') @@ -114,7 +114,7 @@ describe('SDK subagent routing and diagnostics through the production profile', // process's launch directory. const results = events.filter(event => event.type === 'tool/result') expect(results).toHaveLength(1) - const resultText = results[0]!.data.message.content[0].content + const resultText = results[0]!.data.message.content .filter(block => block.type === 'text') .map(block => block.text) .join('') diff --git a/packages/subagent/subagent-dsh-sdk/tests/subagent-dsh-sdk.spec.ts b/packages/subagent/subagent-dsh-sdk/tests/subagent-dsh-sdk.spec.ts index ba26c0c69c..99a9d93b27 100644 --- a/packages/subagent/subagent-dsh-sdk/tests/subagent-dsh-sdk.spec.ts +++ b/packages/subagent/subagent-dsh-sdk/tests/subagent-dsh-sdk.spec.ts @@ -102,7 +102,7 @@ async function setup(fakeEnv: Record = {}, config: Partial b.type === 'text').map(b => b.text).join('') } diff --git a/packages/subagent/subagent-fork-in-process/tests/multi-subagent.spec.ts b/packages/subagent/subagent-fork-in-process/tests/multi-subagent.spec.ts index 35c8af4df3..26b54630d0 100644 --- a/packages/subagent/subagent-fork-in-process/tests/multi-subagent.spec.ts +++ b/packages/subagent/subagent-fork-in-process/tests/multi-subagent.spec.ts @@ -45,7 +45,7 @@ async function setup(script: Script) { return { ctx, parent } } -function text(blocks: { type: string; text?: string }[]): string { +function text(blocks: readonly { type: string; text?: string }[]): string { return blocks.filter(b => b.type === 'text').map(b => b.text).join('') } diff --git a/packages/subagent/subagent-fork-in-process/tests/subagent-fork-in-process.spec.ts b/packages/subagent/subagent-fork-in-process/tests/subagent-fork-in-process.spec.ts index 6f7080cd31..2f34a7d359 100644 --- a/packages/subagent/subagent-fork-in-process/tests/subagent-fork-in-process.spec.ts +++ b/packages/subagent/subagent-fork-in-process/tests/subagent-fork-in-process.spec.ts @@ -52,7 +52,7 @@ async function setup(script: Script) { return { ctx, parent } } -function text(blocks: { type: string; text?: string }[]): string { +function text(blocks: readonly { type: string; text?: string }[]): string { return blocks.filter(b => b.type === 'text').map(b => b.text).join('') } diff --git a/packages/subagent/subagent-in-process-driver/src/index.ts b/packages/subagent/subagent-in-process-driver/src/index.ts index 91348b2da9..dbaac326b1 100644 --- a/packages/subagent/subagent-in-process-driver/src/index.ts +++ b/packages/subagent/subagent-in-process-driver/src/index.ts @@ -223,7 +223,7 @@ function readResult( // `error` through `toStopReason(undefined)`, which never overstates success. const lastEnd = foldConsumedWork(own).end // The seam's canonical selection rule; a partial answer survives cancel and truncation. - const output: ContentBlock[] = finalAssistantOutput(own) ?? [] + const output: readonly ContentBlock[] = finalAssistantOutput(own) ?? [] const recorded = toStopReason(lastEnd?.data.reason) // Disposal can tear the owner down before the loop records its ordinary // `aborted` end, yielding `disposed` instead. diff --git a/packages/subagent/subagent-in-process-driver/tests/inheritance.spec.ts b/packages/subagent/subagent-in-process-driver/tests/inheritance.spec.ts index 81a34bc3c3..d3c22b2ac7 100644 --- a/packages/subagent/subagent-in-process-driver/tests/inheritance.spec.ts +++ b/packages/subagent/subagent-in-process-driver/tests/inheritance.spec.ts @@ -73,7 +73,6 @@ function toolResultTexts(agent: Agent): string[] { return agent.session.snapshotEvents() .filter((event): event is SessionEvent<'tool/result'> => event.type === 'tool/result') .map(event => event.data.message.content - .flatMap(block => block.content) .filter((block): block is Extract => block.type === 'text') .map(block => block.text) .join('')) diff --git a/packages/subagent/subagent-in-process-driver/tests/structured.spec.ts b/packages/subagent/subagent-in-process-driver/tests/structured.spec.ts index 1ec0b16852..404c4da097 100644 --- a/packages/subagent/subagent-in-process-driver/tests/structured.spec.ts +++ b/packages/subagent/subagent-in-process-driver/tests/structured.spec.ts @@ -199,7 +199,7 @@ describe('in-process structured output', () => { const child = ctx.agents.get(run.id) const sideEffectResult = child?.session.snapshotEvents().find(event => event.type === 'tool/result' && event.data.message.source.callId === 'c2') - expect(sideEffectResult?.type === 'tool/result' && sideEffectResult.data.message.content[0].isError).toBe(true) + expect(sideEffectResult?.type === 'tool/result' && sideEffectResult.data.message.isError).toBe(true) await run.dispose() }) @@ -243,7 +243,7 @@ describe('in-process structured output', () => { const child = ctx.agents.get(run.id)! const results = child.session.snapshotEvents().filter(e => e.type === 'tool/result') expect(results.length).toBe(2) - expect(results[0]!.data.message.content[0].isError).toBe(true) + expect(results[0]!.data.message.isError).toBe(true) await run.dispose() }) @@ -325,7 +325,7 @@ describe('in-process structured output', () => { // ...the logged tool result is the blocked isError with the feedback... const child = ctx.agents.get(run.id)! const results = child.session.snapshotEvents().filter(e => e.type === 'tool/result') - expect(results[0]!.data.message.content[0].isError).toBe(true) + expect(results[0]!.data.message.isError).toBe(true) expect(JSON.stringify(results[0]!.data.message.content)).toContain('capture rejected by hook') // ...and the turn CONTINUED past the blocked call (no captured veto): // the model got to react to the failure with a second step. @@ -371,7 +371,7 @@ describe('in-process structured output', () => { const child = ctx.agents.get(run.id) const captureResult = child?.session.snapshotEvents().find(event => event.type === 'tool/result' && event.data.message.source.callId === 'c1') - expect(captureResult?.type === 'tool/result' && captureResult.data.message.content[0].isError).toBe(true) + expect(captureResult?.type === 'tool/result' && captureResult.data.message.isError).toBe(true) await run.dispose() }) @@ -443,7 +443,7 @@ describe('in-process structured output', () => { const child = ctx.agents.get(run.id)! const outer = child.session.snapshotEvents().find(event => event.type === 'tool/result' && event.data.message.source.callId === ToolCallId('c1')) - expect(outer?.type === 'tool/result' && outer.data.message.content[0].isError).toBe(true) + expect(outer?.type === 'tool/result' && outer.data.message.isError).toBe(true) await run.dispose() }) diff --git a/packages/subagent/subagent-spawn-in-process/tests/subagent-spawn-in-process.spec.ts b/packages/subagent/subagent-spawn-in-process/tests/subagent-spawn-in-process.spec.ts index 5df47ab30e..e199b7c9aa 100644 --- a/packages/subagent/subagent-spawn-in-process/tests/subagent-spawn-in-process.spec.ts +++ b/packages/subagent/subagent-spawn-in-process/tests/subagent-spawn-in-process.spec.ts @@ -46,7 +46,7 @@ async function setup(script: Script) { return { ctx, parent, adapter } } -function text(blocks: { type: string; text?: string }[]): string { +function text(blocks: readonly { type: string; text?: string }[]): string { return blocks.filter(b => b.type === 'text').map(b => b.text).join('') } diff --git a/packages/subagent/subagent/src/assistant-output.ts b/packages/subagent/subagent/src/assistant-output.ts index 2961082deb..1094a107a5 100644 --- a/packages/subagent/subagent/src/assistant-output.ts +++ b/packages/subagent/subagent/src/assistant-output.ts @@ -20,7 +20,7 @@ import type { SessionEvent } from '@deepseek-ai/dsh-session' * text into the same streamed fallback. */ export class AssistantOutputFold { - private message: ContentBlock[] | undefined + private message: readonly ContentBlock[] | undefined private partial: string[] = [] /** @@ -52,7 +52,7 @@ export class AssistantOutputFold { * @returns the last non-empty assistant message, else the accumulated * streamed text, or `undefined` when the child produced neither. */ - collect(): ContentBlock[] | undefined { + collect(): readonly ContentBlock[] | undefined { if (this.message !== undefined) return this.message const text = this.partial.join('') return text.length > 0 ? [{ type: 'text', text }] : undefined @@ -64,7 +64,7 @@ export class AssistantOutputFold { * @param events - the child-owned events (after any seed or epoch boundary). * @returns the selected output, or `undefined` when the child produced none. */ -export function finalAssistantOutput(events: readonly SessionEvent[]): ContentBlock[] | undefined { +export function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined { // TODO: this folds the complete suffix once per run/epoch settlement. If a // long continuable epoch ever profiles hot here, scan backward with early // exit for the last non-empty message and fold text deltas only on the diff --git a/packages/subagent/subagent/src/lifecycle.ts b/packages/subagent/subagent/src/lifecycle.ts index 2685dddf14..d0ccf55b30 100644 --- a/packages/subagent/subagent/src/lifecycle.ts +++ b/packages/subagent/subagent/src/lifecycle.ts @@ -33,7 +33,7 @@ export interface ActivationTerminal { /** Why this epoch's last ordinary turn ended, or `error` when teardown failed. */ readonly stopReason: SubagentResult['stopReason'] /** The epoch's final assistant content, absent when it produced none or failed. */ - readonly output?: ContentBlock[] + readonly output?: readonly ContentBlock[] } /** diff --git a/packages/subagent/subagent/src/out-of-process.ts b/packages/subagent/subagent/src/out-of-process.ts index 4dc158a240..adfc566afb 100644 --- a/packages/subagent/subagent/src/out-of-process.ts +++ b/packages/subagent/subagent/src/out-of-process.ts @@ -166,7 +166,7 @@ export interface RunResultSettlement { /** The turn attempt (typically racing local cancellation); returns the terminal result. */ attempt: () => Promise /** Snapshot the provider exposes when cancellation or failure wins settlement. */ - collectOutput: () => ContentBlock[] + collectOutput: () => readonly ContentBlock[] /** Snapshot safe provider-authored detail when a failure wins settlement. */ collectDiagnostic?: (() => string | undefined) | undefined /** Whether local cancellation settled before the attempt's outcome is observed. */ diff --git a/packages/subagent/subagent/src/run-settlement.ts b/packages/subagent/subagent/src/run-settlement.ts index 02f61a7baf..90eb9eec43 100644 --- a/packages/subagent/subagent/src/run-settlement.ts +++ b/packages/subagent/subagent/src/run-settlement.ts @@ -11,7 +11,7 @@ import type { JobOutcome } from '@deepseek-ai/dsh-jobs' import type { SubagentResult, SubagentRun } from './types.ts' /** Flatten a child's final output blocks to the task's final text. */ -function finalText(blocks: ContentBlock[]): string { +function finalText(blocks: readonly ContentBlock[]): string { return blocks .filter((block): block is Extract => block.type === 'text') .map(block => block.text) diff --git a/packages/subagent/subagent/src/types.ts b/packages/subagent/subagent/src/types.ts index 1b9ce56c3f..48ac0df1e1 100644 --- a/packages/subagent/subagent/src/types.ts +++ b/packages/subagent/subagent/src/types.ts @@ -113,7 +113,7 @@ export interface SubagentRunEndInfo { * {@link SubagentResult.output}; absent on infrastructure rejection or when * the child produced none. */ - readonly lastAssistantMessage?: ContentBlock[] + readonly lastAssistantMessage?: readonly ContentBlock[] } /** @@ -275,7 +275,7 @@ export interface SubagentResult { * are skipped. Without a non-empty message, the output is its accumulated * assistant text stream, or `[]` when the child produced neither. */ - readonly output: ContentBlock[] + readonly output: readonly ContentBlock[] /** * The structured result after a requested `outputSchema` was successfully * satisfied. Requesting a schema does not guarantee presence: a provider can diff --git a/packages/subagent/subagent/tests/assistant-output.spec.ts b/packages/subagent/subagent/tests/assistant-output.spec.ts index a21694052d..07585a8853 100644 --- a/packages/subagent/subagent/tests/assistant-output.spec.ts +++ b/packages/subagent/subagent/tests/assistant-output.spec.ts @@ -26,15 +26,13 @@ function toolResult(text: string): SessionEvent { type: 'tool/result', data: { message: { - content: [{ - type: 'tool-result', - toolCallId: 'call-1', - content: [{ type: 'text', text }], - isError: false, - }], + role: 'tool', + toolCallId: 'call-1', + content: [{ type: 'text', text }], + isError: false, }, }, - } as SessionEvent + } as unknown as SessionEvent } describe('finalAssistantOutput', () => { diff --git a/packages/subagent/tool-subagent-control/tests/list-agents.spec.ts b/packages/subagent/tool-subagent-control/tests/list-agents.spec.ts index 3f2c98d5ca..2fd206ed1a 100644 --- a/packages/subagent/tool-subagent-control/tests/list-agents.spec.ts +++ b/packages/subagent/tool-subagent-control/tests/list-agents.spec.ts @@ -77,7 +77,7 @@ async function setup(script: ConstructorParameters[0]) { return setupWith(new MockAdapter(script)) } -function text(result: { content: { type: string; text?: string }[] }): string { +function text(result: { content: readonly { type: string; text?: string }[] }): string { return result.content.filter(block => block.type === 'text').map(block => block.text).join('') } diff --git a/packages/subagent/tool-subagent-control/tests/tool-subagent-control.spec.ts b/packages/subagent/tool-subagent-control/tests/tool-subagent-control.spec.ts index d94709afad..6408b9e6f8 100644 --- a/packages/subagent/tool-subagent-control/tests/tool-subagent-control.spec.ts +++ b/packages/subagent/tool-subagent-control/tests/tool-subagent-control.spec.ts @@ -80,7 +80,7 @@ async function setup(script: ConstructorParameters[0]) { return setupWith(new MockAdapter(script)) } -function text(result: { content: { type: string; text?: string }[] }): string { +function text(result: { content: readonly { type: string; text?: string }[] }): string { return result.content.filter(block => block.type === 'text').map(block => block.text).join('') } diff --git a/packages/subagent/tool-subagent/tests/harness.ts b/packages/subagent/tool-subagent/tests/harness.ts index 659127e4f7..60b5ecf791 100644 --- a/packages/subagent/tool-subagent/tests/harness.ts +++ b/packages/subagent/tool-subagent/tests/harness.ts @@ -116,6 +116,6 @@ export function callSubagent( } /** Join text blocks from one rendered tool result. */ -export function text(result: { content: { type: string; text?: string }[] }): string { +export function text(result: { content: readonly { type: string; text?: string }[] }): string { return result.content.filter(block => block.type === 'text').map(block => block.text).join('') } diff --git a/packages/test-support/llm-replay/tests/llm-replay.spec.ts b/packages/test-support/llm-replay/tests/llm-replay.spec.ts index 49ae763ef7..d92172b459 100644 --- a/packages/test-support/llm-replay/tests/llm-replay.spec.ts +++ b/packages/test-support/llm-replay/tests/llm-replay.spec.ts @@ -17,6 +17,7 @@ import LlmRuntime, { GenerateOptions, LlmAdapter, StreamChunk, + type ToolResultMessage, } from '@deepseek-ai/dsh-llm' import { type Config, @@ -76,6 +77,25 @@ function sessionJsonl( return [headerLine, ...events.map(event => JSON.stringify(event))].join('\n') + '\n' } +/** + * Released v2 canonical tool-result message: a user-role wrapper row. + * @param callId - the released tool call the result answers. + * @returns JSON-only wrapper shape for historical fixtures. + */ +function releasedV2ResultMessage(callId: ToolCallId): ToolResultMessage { + return { + id: `${callId}-result`, + role: 'user', + source: { kind: 'tool', callId }, + content: [{ + type: 'tool-result', + toolCallId: callId, + content: [], + isError: false, + }], + } as unknown as ToolResultMessage +} + /** Build a valid one-turn Session around recorded model calls. */ function replaySessionJsonl( calls: readonly StreamChunk[][], @@ -102,15 +122,14 @@ function replaySessionJsonl( name: chunk.block.name, arguments: chunk.block.arguments, }) + const message = version >= 3 + ? createToolResultMessage({ callId: chunk.block.id, content: [], isError: false }) + : releasedV2ResultMessage(chunk.block.id) events.push({ type: 'tool/result', seq: SessionSeq(seq++), time: 0, - data: { - turn: 1, - step, - message: createToolResultMessage({ callId: chunk.block.id, content: [], isError: false }), - }, + data: { turn: 1, step, message }, surfaceOp: 'append', }) } diff --git a/packages/test-support/loader-smoke/tests/fixtures/cli-mock-llm.ts b/packages/test-support/loader-smoke/tests/fixtures/cli-mock-llm.ts index 1ab09d6db0..4dbdb23b0b 100644 --- a/packages/test-support/loader-smoke/tests/fixtures/cli-mock-llm.ts +++ b/packages/test-support/loader-smoke/tests/fixtures/cli-mock-llm.ts @@ -37,7 +37,8 @@ class CliMockAdapter extends LlmAdapter { yield { type: 'finish', reason: { kind: 'error', failure: { code: 'SERVER', message: 'CLI mock provider failed' } } } return } - const toolResult = options.messages.at(-1)?.content.find(block => block.type === 'tool-result') + const last = options.messages.at(-1) + const toolResult = last?.role === 'tool' ? last : undefined if (toolResult === undefined) { const reasoning = 'Inspecting the task before the tool call.' const args = JSON.stringify({ command: SHELL_COMMAND, description: 'Prove the CLI tool round trip.' }) diff --git a/packages/todo/tool-todo/tests/integration.spec.ts b/packages/todo/tool-todo/tests/integration.spec.ts index 3384372a65..4db57022b6 100644 --- a/packages/todo/tool-todo/tests/integration.spec.ts +++ b/packages/todo/tool-todo/tests/integration.spec.ts @@ -65,7 +65,7 @@ describe('todo_write tool through the agent loop', () => { const log = agent.session.snapshotEvents() expect(findEvent(log, 'tool/call').data.name).toBe('todo_write') - expect(findEvent(log, 'tool/result').data.message.content[0].isError).toBe(false) + expect(findEvent(log, 'tool/result').data.message.isError).toBe(false) const todoEvent = findEvent(log, 'todo/write') expect(todoEvent.data.todos).toEqual([ diff --git a/python/sdk/tests/test_smoke_model.py b/python/sdk/tests/test_smoke_model.py index e972365779..e32fa569ea 100644 --- a/python/sdk/tests/test_smoke_model.py +++ b/python/sdk/tests/test_smoke_model.py @@ -590,6 +590,9 @@ def test_committed_python_native_goldens_compare_current_output_without_rewritin directory = SMOKE[f"{scenario}_SNAPSHOT_DIRECTORY"] filenames = SMOKE[f"{scenario}_SNAPSHOT_FILENAMES"] before = {path.name: path.read_bytes() for path in directory.iterdir() if path.is_file()} + selected = SMOKE["selected_snapshot_session_files"](directory) + first = next(iter(selected.values())) + source_version = SMOKE["session_header_version"](before[first.name].decode("utf-8"), first.name) def current_writer(value: object) -> object: if isinstance(value, list): @@ -598,18 +601,19 @@ def test_committed_python_native_goldens_compare_current_output_without_rewritin return value result = {key: current_writer(item) for key, item in value.items()} if result.get("type") == "session": - assert result["version"] == 3 + assert result["version"] == source_version result["version"] = SESSION_FORMAT_VERSION if result.get("type") == "session-log-deepseek/delivery-accepted": - assert result["data"]["sessionFormatVersion"] == 3 + assert result["data"]["sessionFormatVersion"] == source_version result["data"]["sessionFormatVersion"] = SESSION_FORMAT_VERSION return result fresh = {} for name in filenames: - content = before[name].decode("utf-8") - if name.endswith(".jsonl"): - parsed = SMOKE["parse_snapshot_session_filename"](name) + parsed = SMOKE["parse_snapshot_session_filename"](name) + source_name = selected[parsed[0]].name if parsed is not None else name + content = before[source_name].decode("utf-8") + if parsed is not None: fresh[SMOKE["snapshot_session_filename"](parsed[0], SESSION_FORMAT_VERSION)] = SMOKE["render_jsonl"]([ current_writer(json.loads(line)) for line in content.splitlines() if line ]) diff --git a/scripts/session-fixture-layout.spec.ts b/scripts/session-fixture-layout.spec.ts index 9f654962b4..61a0979c8d 100644 --- a/scripts/session-fixture-layout.spec.ts +++ b/scripts/session-fixture-layout.spec.ts @@ -131,7 +131,7 @@ describe('canonicalSessionFixture', () => { ].join('\n') const canonical = canonicalSessionFixture(source) expect(canonical).toBe(source) - expect(() => decodedBody(canonical!)).toThrow(/session snapshot line 3:.*empty optional header fields must be omitted/) + expect(() => decodedBody(canonical!)).toThrow(/session snapshot line 1:.*seed request\/header.*empty tools/) }) it.each(historicalVersions)('preserves physically valid v%i bytes without requiring migration to current', (version) => { diff --git a/scripts/smoke-python-runtime.py b/scripts/smoke-python-runtime.py index 9922646910..254663733e 100644 --- a/scripts/smoke-python-runtime.py +++ b/scripts/smoke-python-runtime.py @@ -2229,7 +2229,7 @@ def normalize_snapshot_value( dt = member.get("dt") if isinstance(dt, list): member["dt"] = [0] * len(dt) - if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "system", "user"): + if isinstance(normalized.get("id"), str) and normalized.get("role") in ("assistant", "system", "user", "tool"): if not normalized["id"].startswith("{{message:"): normalized["id"] = "{{messageId}}" if normalized.get("type") in ("feedback/message-put", "feedback/message-delete"): diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/result.json b/scripts/snapshots/python-sdk-single-exe/advanced/result.json index 12de2f3ab5..c3629c2115 100644 --- a/scripts/snapshots/python-sdk-single-exe/advanced/result.json +++ b/scripts/snapshots/python-sdk-single-exe/advanced/result.json @@ -318,7 +318,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 19 } }, @@ -501,24 +501,19 @@ "turn": 1, "step": 1, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-code" }, + "toolCallId": "advanced-code", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-code", - "content": [ - { - "type": "text", - "text": "42" - } - ], - "isError": false + "type": "text", + "text": "42" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -551,7 +546,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 27 } }, @@ -699,24 +694,19 @@ "turn": 1, "step": 2, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-denied-native" }, + "toolCallId": "advanced-denied-native", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-denied-native", - "content": [ - { - "type": "text", - "text": "Error: Auto review rejected tool \"snapshot_double\"; its body was not executed" - } - ], - "isError": true + "type": "text", + "text": "Error: Auto review rejected tool \"snapshot_double\"; its body was not executed" } ], - "role": "user", + "isError": true, "id": "{{messageId}}" }, "error": { @@ -754,7 +744,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 33 } }, @@ -942,24 +932,19 @@ "turn": 1, "step": 3, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-denied-ptc" }, + "toolCallId": "advanced-denied-ptc", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-denied-ptc", - "content": [ - { - "type": "text", - "text": "Auto review rejected tool \"snapshot_double\"; its body was not executed" - } - ], - "isError": false + "type": "text", + "text": "Auto review rejected tool \"snapshot_double\"; its body was not executed" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -992,7 +977,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 41 } }, @@ -1152,24 +1137,19 @@ "turn": 1, "step": 4, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-direct-child" }, + "toolCallId": "advanced-direct-child", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-direct-child", - "content": [ - { - "type": "text", - "text": "DIRECT_CHILD_OK" - } - ], - "isError": false + "type": "text", + "text": "DIRECT_CHILD_OK" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -1202,7 +1182,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 48 } }, @@ -1401,24 +1381,19 @@ "turn": 1, "step": 5, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-workflow" }, + "toolCallId": "advanced-workflow", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-workflow", - "content": [ - { - "type": "text", - "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" - } - ], - "isError": false + "type": "text", + "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -1451,7 +1426,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 59 } }, @@ -2088,7 +2063,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 19 } } @@ -2301,24 +2276,19 @@ "turn": 1, "step": 1, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-code" }, + "toolCallId": "advanced-code", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-code", - "content": [ - { - "type": "text", - "text": "42" - } - ], - "isError": false + "type": "text", + "text": "42" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -2369,7 +2339,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 27 } } @@ -2535,24 +2505,19 @@ "turn": 1, "step": 2, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-denied-native" }, + "toolCallId": "advanced-denied-native", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-denied-native", - "content": [ - { - "type": "text", - "text": "Error: Auto review rejected tool \"snapshot_double\"; its body was not executed" - } - ], - "isError": true + "type": "text", + "text": "Error: Auto review rejected tool \"snapshot_double\"; its body was not executed" } ], - "role": "user", + "isError": true, "id": "{{messageId}}" }, "error": { @@ -2608,7 +2573,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 33 } } @@ -2826,24 +2791,19 @@ "turn": 1, "step": 3, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-denied-ptc" }, + "toolCallId": "advanced-denied-ptc", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-denied-ptc", - "content": [ - { - "type": "text", - "text": "Auto review rejected tool \"snapshot_double\"; its body was not executed" - } - ], - "isError": false + "type": "text", + "text": "Auto review rejected tool \"snapshot_double\"; its body was not executed" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -2894,7 +2854,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 41 } } @@ -3425,7 +3385,7 @@ "time": 0, "data": { "sessionId": "{{child-1}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 16 } } @@ -3613,24 +3573,19 @@ "turn": 1, "step": 4, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-direct-child" }, + "toolCallId": "advanced-direct-child", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-direct-child", - "content": [ - { - "type": "text", - "text": "DIRECT_CHILD_OK" - } - ], - "isError": false + "type": "text", + "text": "DIRECT_CHILD_OK" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -3681,7 +3636,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 48 } } @@ -4243,7 +4198,7 @@ "time": 0, "data": { "sessionId": "{{child-2}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 16 } } @@ -4462,24 +4417,19 @@ "turn": 1, "step": 5, "message": { + "role": "tool", "source": { "kind": "tool", "callId": "advanced-workflow" }, + "toolCallId": "advanced-workflow", "content": [ { - "type": "tool-result", - "toolCallId": "advanced-workflow", - "content": [ - { - "type": "text", - "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" - } - ], - "isError": false + "type": "text", + "text": "workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}" } ], - "role": "user", + "isError": false, "id": "{{messageId}}" } }, @@ -4530,7 +4480,7 @@ "time": 0, "data": { "sessionId": "{{parent}}", - "sessionFormatVersion": 3, + "sessionFormatVersion": 4, "throughSeq": 59 } } diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.1.v4.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.1.v4.jsonl new file mode 100644 index 0000000000..291a8f2695 --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.1.v4.jsonl @@ -0,0 +1,22 @@ +{"type":"session","version":4,"id":"{{child-1}}","createdAt":0,"cwd":"{{cwd}}","parentSession":"{{parent}}","isSeeded":false,"origin":"subagent","delegationDepth":1} +{"type":"sandbox/mode","data":{"mode":"danger-full-access","source":"delegation"}} +{"type":"approval/policy","data":{"policy":"never","source":"delegation"}} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"inserted":[{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}}]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Reply with exactly DIRECT_CHILD_OK and nothing else."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"removedCount":1,"inserted":[]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"subagent/descriptor","data":{"version":3,"mode":"one-shot","provider":"spawn","label":"Check direct child"}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Reply with exactly DIRECT_CHILD_OK and nothing else."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","snapshot_double","subagent","workflow"]},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}} +{"type":"session/title","data":{"title":"Reply with exactly DIRECT_CHILD_OK and","messageSeqs":[12],"source":{"kind":"fallback"}}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{child-1}}","sessionFormatVersion":4,"throughSeq":16}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"DIRECT_CHILD_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["DIRECT_CHILD_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"DIRECT_CHILD_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.2.v4.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.2.v4.jsonl new file mode 100644 index 0000000000..c36218feac --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.2.v4.jsonl @@ -0,0 +1,22 @@ +{"type":"session","version":4,"id":"{{child-2}}","createdAt":0,"cwd":"{{cwd}}","parentSession":"{{parent}}","isSeeded":false,"origin":"subagent","delegationDepth":1} +{"type":"sandbox/mode","data":{"mode":"danger-full-access","source":"delegation"}} +{"type":"approval/policy","data":{"policy":"never","source":"delegation"}} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"inserted":[{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}}]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Reply with exactly WORKFLOW_CHILD_OK and nothing else."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"removedCount":1,"inserted":[]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"subagent/descriptor","data":{"version":3,"mode":"one-shot","provider":"spawn"}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Reply with exactly WORKFLOW_CHILD_OK and nothing else."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","reasoningEffort":"high","maxTokens":256000},"adapterDefaults":{"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","snapshot_double","subagent","workflow"]},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}} +{"type":"session/title","data":{"title":"Reply with exactly WORKFLOW_CHILD_OK and","messageSeqs":[12],"source":{"kind":"fallback"}}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{child-2}}","sessionFormatVersion":4,"throughSeq":16}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"WORKFLOW_CHILD_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["WORKFLOW_CHILD_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"WORKFLOW_CHILD_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/scripts/snapshots/python-sdk-single-exe/advanced/session.v4.jsonl b/scripts/snapshots/python-sdk-single-exe/advanced/session.v4.jsonl new file mode 100644 index 0000000000..a3d4cad70e --- /dev/null +++ b/scripts/snapshots/python-sdk-single-exe/advanced/session.v4.jsonl @@ -0,0 +1,72 @@ +{"type":"session","version":4,"id":"{{parent}}","createdAt":0,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access"}} +{"type":"approval/policy","data":{"policy":"never"}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"inserted":[{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}}]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Run the advanced packaged-runtime snapshot scenario."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-step","start":0,"removedCount":1,"inserted":[]}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{messageId}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"text","text":"Serial agent creation completed."}],"source":{"kind":"plugin","plugin":"serial-created-fixture"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Run the advanced packaged-runtime snapshot scenario."}],"source":{"kind":"user"},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{messageId}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"id":"{{messageId}}","role":"user","content":[{"type":"image","attachment":{"attachmentId":"sha256:b1ff9c8ea3a780bad09b346c423d2d0e46815926879b18e841d928376a946640","mediaType":"image/png","width":1,"height":1,"bytes":69}}],"source":{"kind":"plugin","plugin":"python-snapshot-image-offload"}},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","snapshot_double","subagent","workflow"]},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"smoke-model","contextWindow":1000000}} +{"type":"session/title","data":{"title":"Run the advanced packaged-runtime snapsh","messageSeqs":[11],"source":{"kind":"fallback"}}} +{"type":"assistant/attempt","data":{"turn":1,"step":1,"stream":[{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"error","failure":{"code":"IMAGE_OFFLOAD_REQUIRED","message":"authored image budget failure","offloadImages":1}}}}]}} +{"type":"image/offload","data":{"targets":[{"seq":13,"imageIndexes":[0]}]}} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"smoke-model","maxTokens":256000,"reasoningEffort":"high"},"adapterDefaults":{"reasoningEffort":true,"maxTokens":true},"tools":["cordis_inspect_list","cordis_inspect_query","job_kill","job_list","job_output","run_code","snapshot_double","subagent","workflow"]},"reason":"series"}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":19}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\", \"description\": \"Call the configured Plugin tool\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-code","name":"run_code","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-code","args":["{\"code\": \"return await tools.snapshot_double({ value: 21 })\", \"description\": \"Call the configured Plugin tool\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\", \"description\": \"Call the configured Plugin tool\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"advanced-code","name":"run_code","arguments":"{\"code\": \"return await tools.snapshot_double({ value: 21 })\", \"description\": \"Call the configured Plugin tool\"}"}} +{"type":"tool/ptc-dispatch-start","data":{"rootCallId":"advanced-code","parentCallId":"advanced-code","subCallId":"advanced-code:ptc:1","name":"snapshot_double","arguments":{"value":21}}} +{"type":"tool/ptc-dispatch","data":{"rootCallId":"advanced-code","parentCallId":"advanced-code","subCallId":"advanced-code:ptc:1","name":"snapshot_double","arguments":{"value":21},"isError":false,"content":[{"type":"text","text":"42"}]}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-code"},"toolCallId":"advanced-code","content":[{"type":"text","text":"42"}],"isError":false,"id":"{{messageId}}"}},"sourceEventSeqs":[22],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":27}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-denied-native","name":"snapshot_double","arguments":"{\"value\": -1}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-denied-native","name":"snapshot_double","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-denied-native","args":["{\"value\": -1}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-denied-native","name":"snapshot_double","arguments":"{\"value\": -1}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":2,"callId":"advanced-denied-native","name":"snapshot_double","arguments":"{\"value\": -1}"}} +{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-denied-native"},"toolCallId":"advanced-denied-native","content":[{"type":"text","text":"Error: Auto review rejected tool \"snapshot_double\"; its body was not executed"}],"isError":true,"id":"{{messageId}}"},"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "}},"sourceEventSeqs":[30],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"step/start","data":{"turn":1,"step":3}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":33}} +{"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-denied-ptc","name":"run_code","arguments":"{\"code\": \"try { await tools.snapshot_double({ value: -1 }) } catch (error) { return error.message }\", \"description\": \"Catch a structured inner tool denial\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-denied-ptc","name":"run_code","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-denied-ptc","args":["{\"code\": \"try { await tools.snapshot_double({ value: -1 }) } catch (error) { return error.message }\", \"description\": \"Catch a structured inner tool denial\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-denied-ptc","name":"run_code","arguments":"{\"code\": \"try { await tools.snapshot_double({ value: -1 }) } catch (error) { return error.message }\", \"description\": \"Catch a structured inner tool denial\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":3,"callId":"advanced-denied-ptc","name":"run_code","arguments":"{\"code\": \"try { await tools.snapshot_double({ value: -1 }) } catch (error) { return error.message }\", \"description\": \"Catch a structured inner tool denial\"}"}} +{"type":"tool/ptc-dispatch-start","data":{"rootCallId":"advanced-denied-ptc","parentCallId":"advanced-denied-ptc","subCallId":"advanced-denied-ptc:ptc:1","name":"snapshot_double","arguments":{"value":-1}}} +{"type":"tool/ptc-dispatch","data":{"rootCallId":"advanced-denied-ptc","parentCallId":"advanced-denied-ptc","subCallId":"advanced-denied-ptc:ptc:1","name":"snapshot_double","arguments":{"value":-1},"isError":true,"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "},"content":[{"type":"text","text":"Error: Auto review rejected tool \"snapshot_double\"; its body was not executed"}]}} +{"type":"tool/result","data":{"turn":1,"step":3,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-denied-ptc"},"toolCallId":"advanced-denied-ptc","content":[{"type":"text","text":"Auto review rejected tool \"snapshot_double\"; its body was not executed"}],"isError":false,"id":"{{messageId}}"}},"sourceEventSeqs":[36],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":3}} +{"type":"step/start","data":{"turn":1,"step":4}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":41}} +{"type":"assistant/message","data":{"turn":1,"step":4,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-direct-child","name":"subagent","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-direct-child","args":["{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":4,"callId":"advanced-direct-child","name":"subagent","arguments":"{\"description\": \"Check direct child\", \"prompt\": \"Reply with exactly DIRECT_CHILD_OK and nothing else.\"}"}} +{"type":"subagent/catalog","data":{"version":0,"childId":"{{child-1}}","childCreatedAt":0,"mode":"one-shot","label":"Check direct child"}} +{"type":"tool/result","data":{"turn":1,"step":4,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-direct-child"},"toolCallId":"advanced-direct-child","content":[{"type":"text","text":"DIRECT_CHILD_OK"}],"isError":false,"id":"{{messageId}}"}},"sourceEventSeqs":[44],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":4}} +{"type":"step/start","data":{"turn":1,"step":5}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":48}} +{"type":"assistant/message","data":{"turn":1,"step":5,"message":{"role":"assistant","content":[{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}},"id":"{{messageId}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-workflow","name":"workflow","args":[""]},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"advanced-workflow","args":["{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"tool-call"}]}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":5,"callId":"advanced-workflow","name":"workflow","arguments":"{\"script\": \"phase('Delegate')\\nconst reply = await agent('Reply with exactly WORKFLOW_CHILD_OK and nothing else.', { label: 'workflow-child' })\\nreturn { reply }\", \"meta\": {\"name\": \"advanced-exe-snapshot\", \"description\": \"exercise one packaged workflow child\"}}"}} +{"type":"tool-workflow/run-start","data":{"runId":"{{workflow-run}}","name":"advanced-exe-snapshot"}} +{"type":"subagent/catalog","data":{"version":0,"childId":"{{child-2}}","childCreatedAt":0,"mode":"one-shot"}} +{"type":"tool-workflow/agent-start","data":{"runId":"{{workflow-run}}","seq":1,"label":"workflow-child","phase":"Delegate","childId":"{{child-2}}"}} +{"type":"tool-workflow/agent-end","data":{"runId":"{{workflow-run}}","seq":1,"outcome":"completed"}} +{"type":"tool-workflow/run-end","data":{"runId":"{{workflow-run}}","stopReason":"completed"}} +{"type":"tool/result","data":{"turn":1,"step":5,"message":{"role":"tool","source":{"kind":"tool","callId":"advanced-workflow"},"toolCallId":"advanced-workflow","content":[{"type":"text","text":"workflow \"advanced-exe-snapshot\" completed (1 agent).\nReturn value:\n{\n \"reply\": \"WORKFLOW_CHILD_OK\"\n}"}],"isError":false,"id":"{{messageId}}"}},"sourceEventSeqs":[51],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":5}} +{"type":"step/start","data":{"turn":1,"step":6}} +{"type":"session-log-deepseek/delivery-accepted","data":{"sessionId":"{{parent}}","sessionFormatVersion":4,"throughSeq":59}} +{"type":"assistant/message","data":{"turn":1,"step":6,"message":{"role":"assistant","content":[{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"smoke-model","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}},"id":"{{message:1}}"},"usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ADVANCED_EXECUTABLE_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ADVANCED_EXECUTABLE_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3,"totalTokens":6}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"smoke-model"},"blocks":[{"type":"text"}]}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":6}} +{"type":"command/run","data":{"commandId":"{{command:1}}","name":"feedback","source":{"kind":"user"}}} +{"type":"feedback/record","data":{"text":"The session needs a clearer explanation."}} +{"type":"command/done","data":{"commandId":"{{command:1}}","kind":"success","text":"Feedback recorded for session {{parent}}\nAnonymous user: {{anonymous-user}}."}} +{"type":"feedback/record","data":{"category":"other"}} +{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"negative","note":"Explain the result.","category":"task-result","version":"{{feedback-version:1}}","createdAt":0,"updatedAt":0}}} +{"type":"feedback/message-put","data":{"sessionId":"{{parent}}","item":{"messageId":"{{message:1}}","rating":"positive","note":"The explanation is clear now.","version":"{{feedback-version:2}}","createdAt":0,"updatedAt":0}}} +{"type":"feedback/message-delete","data":{"sessionId":"{{parent}}","messageId":"{{message:1}}"}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/snapshots/sdk/bash-tool/notifications.expected.jsonl b/snapshots/sdk/bash-tool/notifications.expected.jsonl index fb38074df3..3ee7dd795a 100644 --- a/snapshots/sdk/bash-tool/notifications.expected.jsonl +++ b/snapshots/sdk/bash-tool/notifications.expected.jsonl @@ -11,7 +11,7 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session/title","seq":12,"time":0,"data":{"title":"Run this exact command with","messageSeqs":[8],"source":{"kind":"fallback"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":13,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The user wants me to run a specific bash command and reply with its stdout only."},{"type":"tool-call","id":"call_00_Ry17evSfTr0uJnHhg3X93070","name":"bash","arguments":"{\"command\": \"echo dsh-sdk-proof-7391\", \"description\": \"Run the echo command as requested\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":123,"outputTokens":89,"cacheReadTokens":1664,"reasoningTokens":17},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":0,"index":0,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," user"," wants"," me"," to"," run"," a"," specific"," bash"," command"," and"," reply"," with"," its"," stdout"," only","."]},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":1,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":"call_00_Ry17evSfTr0uJnHhg3X93070","name":"bash","args":["","{","\"","command","\"",": ","\"","echo"," d","sh","-s","dk","-proof","-","739","1","\"",", ","\"","description","\"",": ","\"","Run"," the"," echo"," command"," as"," requested","\"","}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The user wants me to run a specific bash command and reply with its stdout only."}}},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_Ry17evSfTr0uJnHhg3X93070","name":"bash","arguments":"{\"command\": \"echo dsh-sdk-proof-7391\", \"description\": \"Run the echo command as requested\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":123,"outputTokens":89,"cacheReadTokens":1664,"reasoningTokens":17}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":14,"time":0,"data":{"turn":1,"step":1,"callId":"call_00_Ry17evSfTr0uJnHhg3X93070","name":"bash","arguments":"{\"command\": \"echo dsh-sdk-proof-7391\", \"description\": \"Run the echo command as requested\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_00_Ry17evSfTr0uJnHhg3X93070"},"content":[{"type":"tool-result","toolCallId":"call_00_Ry17evSfTr0uJnHhg3X93070","content":[{"type":"text","text":"dsh-sdk-proof-7391\n"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_Ry17evSfTr0uJnHhg3X93070"},"toolCallId":"call_00_Ry17evSfTr0uJnHhg3X93070","content":[{"type":"text","text":"dsh-sdk-proof-7391\n"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":16,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":17,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":18,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The command produced the expected output. I'll reply with just that stdout."},{"type":"text","text":"dsh-sdk-proof-7391"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":233,"outputTokens":24,"cacheReadTokens":1664,"reasoningTokens":15},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":0,"index":0,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," command"," produced"," the"," expected"," output","."," I","'ll"," reply"," with"," just"," that"," stdout","."]},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":1,"dt":[0,0,0,0,0,0,0],"texts":["d","sh","-s","dk","-proof","-","739","1"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The command produced the expected output. I'll reply with just that stdout."}}},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"dsh-sdk-proof-7391"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":233,"outputTokens":24,"cacheReadTokens":1664,"reasoningTokens":15}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/persistent-tools/notifications.expected.jsonl b/snapshots/sdk/persistent-tools/notifications.expected.jsonl index 4139dd054a..84dde87b80 100644 --- a/snapshots/sdk/persistent-tools/notifications.expected.jsonl +++ b/snapshots/sdk/persistent-tools/notifications.expected.jsonl @@ -11,37 +11,37 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session/title","seq":9,"time":0,"data":{"title":"Prove that bash state persists.","messageSeqs":[5],"source":{"kind":"fallback"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":10,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"bash-1","name":"bash","arguments":"{\"command\":\"cd /tmp && export DSH_EXAMPLE_COUNT=1 && printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"bash-1","name":"bash","args":["{\"command\":\"cd /tmp && export DSH_EXAMPLE_COUNT=1 && printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"bash-1","name":"bash","arguments":"{\"command\":\"cd /tmp && export DSH_EXAMPLE_COUNT=1 && printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":11,"time":0,"data":{"turn":1,"step":1,"callId":"bash-1","name":"bash","arguments":"{\"command\":\"cd /tmp && export DSH_EXAMPLE_COUNT=1 && printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":12,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"bash-1"},"content":[{"type":"tool-result","toolCallId":"bash-1","content":[{"type":"text","text":"COUNT=1 CWD=/tmp\n[Command finished with exit code 0]"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[11],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":12,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"bash-1"},"content":[{"type":"text","text":"COUNT=1 CWD=/tmp\n[Command finished with exit code 0]"}],"role":"tool","toolCallId":"bash-1","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[11],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":13,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":14,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":15,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"bash-2","name":"bash","arguments":"{\"command\":\"DSH_EXAMPLE_COUNT=$((DSH_EXAMPLE_COUNT + 1)); printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"bash-2","name":"bash","args":["{\"command\":\"DSH_EXAMPLE_COUNT=$((DSH_EXAMPLE_COUNT + 1)); printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"bash-2","name":"bash","arguments":"{\"command\":\"DSH_EXAMPLE_COUNT=$((DSH_EXAMPLE_COUNT + 1)); printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":16,"time":0,"data":{"turn":1,"step":2,"callId":"bash-2","name":"bash","arguments":"{\"command\":\"DSH_EXAMPLE_COUNT=$((DSH_EXAMPLE_COUNT + 1)); printf \\\"COUNT=%s CWD=%s\\\\n\\\" \\\"$DSH_EXAMPLE_COUNT\\\" \\\"$PWD\\\"\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":17,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"bash-2"},"content":[{"type":"tool-result","toolCallId":"bash-2","content":[{"type":"text","text":"COUNT=2 CWD=/tmp\n[Command finished with exit code 0]"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[16],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":17,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"bash-2"},"content":[{"type":"text","text":"COUNT=2 CWD=/tmp\n[Command finished with exit code 0]"}],"role":"tool","toolCallId":"bash-2","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[16],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":18,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":19,"time":0,"data":{"turn":1,"step":3}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":20,"time":0,"data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"tool-call","id":"bash-delayed-pipeline","name":"bash","arguments":"{\"command\":\"{ sleep 0.1; echo delayed; } | cat\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"bash-delayed-pipeline","name":"bash","args":["{\"command\":\"{ sleep 0.1; echo delayed; } | cat\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"bash-delayed-pipeline","name":"bash","arguments":"{\"command\":\"{ sleep 0.1; echo delayed; } | cat\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":21,"time":0,"data":{"turn":1,"step":3,"callId":"bash-delayed-pipeline","name":"bash","arguments":"{\"command\":\"{ sleep 0.1; echo delayed; } | cat\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":3,"message":{"source":{"kind":"tool","callId":"bash-delayed-pipeline"},"content":[{"type":"tool-result","toolCallId":"bash-delayed-pipeline","content":[{"type":"text","text":"delayed\n[Command finished with exit code 0]"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":3,"message":{"source":{"kind":"tool","callId":"bash-delayed-pipeline"},"content":[{"type":"text","text":"delayed\n[Command finished with exit code 0]"}],"role":"tool","toolCallId":"bash-delayed-pipeline","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":23,"time":0,"data":{"turn":1,"step":3}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":24,"time":0,"data":{"turn":1,"step":4}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":25,"time":0,"data":{"turn":1,"step":4,"message":{"role":"assistant","content":[{"type":"tool-call","id":"editor-create","name":"str_replace_editor","arguments":"{\"command\":\"create\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":\"target:\\n\\told\\n\",\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"editor-create","name":"str_replace_editor","args":["{\"command\":\"create\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":\"target:\\n\\told\\n\",\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"editor-create","name":"str_replace_editor","arguments":"{\"command\":\"create\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":\"target:\\n\\told\\n\",\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":26,"time":0,"data":{"turn":1,"step":4,"callId":"editor-create","name":"str_replace_editor","arguments":"{\"command\":\"create\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":\"target:\\n\\told\\n\",\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":27,"time":0,"data":{"turn":1,"step":4,"message":{"source":{"kind":"tool","callId":"editor-create"},"content":[{"type":"tool-result","toolCallId":"editor-create","content":[{"type":"text","text":"New file created successfully at: {{cwd}}/note.txt"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[26],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":27,"time":0,"data":{"turn":1,"step":4,"message":{"source":{"kind":"tool","callId":"editor-create"},"content":[{"type":"text","text":"New file created successfully at: {{cwd}}/note.txt"}],"role":"tool","toolCallId":"editor-create","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[26],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":28,"time":0,"data":{"turn":1,"step":4}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":29,"time":0,"data":{"turn":1,"step":5}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":30,"time":0,"data":{"turn":1,"step":5,"message":{"role":"assistant","content":[{"type":"tool-call","id":"editor-view","name":"str_replace_editor","arguments":"{\"command\":\"view\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":null,\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"editor-view","name":"str_replace_editor","args":["{\"command\":\"view\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":null,\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"editor-view","name":"str_replace_editor","arguments":"{\"command\":\"view\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":null,\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":31,"time":0,"data":{"turn":1,"step":5,"callId":"editor-view","name":"str_replace_editor","arguments":"{\"command\":\"view\",\"path\":\"{{cwd}}/note.txt\",\"file_text\":null,\"insert_line\":null,\"new_str\":null,\"old_str\":null,\"view_range\":null}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":32,"time":0,"data":{"turn":1,"step":5,"message":{"source":{"kind":"tool","callId":"editor-view"},"content":[{"type":"tool-result","toolCallId":"editor-view","content":[{"type":"text","text":"Here's the content of {{cwd}}/note.txt with line numbers (which has a total of 3 lines):\n 1 target:\n 2 \told\n 3 \n"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[31],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":32,"time":0,"data":{"turn":1,"step":5,"message":{"source":{"kind":"tool","callId":"editor-view"},"content":[{"type":"text","text":"Here's the content of {{cwd}}/note.txt with line numbers (which has a total of 3 lines):\n 1 target:\n 2 \told\n 3 \n"}],"role":"tool","toolCallId":"editor-view","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[31],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":33,"time":0,"data":{"turn":1,"step":5}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":34,"time":0,"data":{"turn":1,"step":6}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":35,"time":0,"data":{"turn":1,"step":6,"message":{"role":"assistant","content":[{"type":"tool-call","id":"editor-replace","name":"str_replace_editor","arguments":"{\"command\":\"str_replace\",\"path\":\"{{cwd}}/note.txt\",\"old_str\":\"\\told\",\"new_str\":\"\\tnew\",\"file_text\":null,\"insert_line\":null,\"view_range\":null}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"editor-replace","name":"str_replace_editor","args":["{\"command\":\"str_replace\",\"path\":\"{{cwd}}/note.txt\",\"old_str\":\"\\told\",\"new_str\":\"\\tnew\",\"file_text\":null,\"insert_line\":null,\"view_range\":null}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"editor-replace","name":"str_replace_editor","arguments":"{\"command\":\"str_replace\",\"path\":\"{{cwd}}/note.txt\",\"old_str\":\"\\told\",\"new_str\":\"\\tnew\",\"file_text\":null,\"insert_line\":null,\"view_range\":null}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":36,"time":0,"data":{"turn":1,"step":6,"callId":"editor-replace","name":"str_replace_editor","arguments":"{\"command\":\"str_replace\",\"path\":\"{{cwd}}/note.txt\",\"old_str\":\"\\told\",\"new_str\":\"\\tnew\",\"file_text\":null,\"insert_line\":null,\"view_range\":null}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":37,"time":0,"data":{"turn":1,"step":6,"message":{"source":{"kind":"tool","callId":"editor-replace"},"content":[{"type":"tool-result","toolCallId":"editor-replace","content":[{"type":"text","text":"The file {{cwd}}/note.txt has been edited successfully."}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[36],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":37,"time":0,"data":{"turn":1,"step":6,"message":{"source":{"kind":"tool","callId":"editor-replace"},"content":[{"type":"text","text":"The file {{cwd}}/note.txt has been edited successfully."}],"role":"tool","toolCallId":"editor-replace","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[36],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":38,"time":0,"data":{"turn":1,"step":6}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":39,"time":0,"data":{"turn":1,"step":7}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":40,"time":0,"data":{"turn":1,"step":7,"message":{"role":"assistant","content":[{"type":"tool-call","id":"bash-exit","name":"bash","arguments":"{\"command\":\"exit 9\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"bash-exit","name":"bash","args":["{\"command\":\"exit 9\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"bash-exit","name":"bash","arguments":"{\"command\":\"exit 9\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":41,"time":0,"data":{"turn":1,"step":7,"callId":"bash-exit","name":"bash","arguments":"{\"command\":\"exit 9\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":42,"time":0,"data":{"turn":1,"step":7,"message":{"source":{"kind":"tool","callId":"bash-exit"},"content":[{"type":"tool-result","toolCallId":"bash-exit","content":[{"type":"text","text":"exit\n[shell exited: code 9]\nThe persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment."}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[41],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":42,"time":0,"data":{"turn":1,"step":7,"message":{"source":{"kind":"tool","callId":"bash-exit"},"content":[{"type":"text","text":"exit\n[shell exited: code 9]\nThe persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment."}],"role":"tool","toolCallId":"bash-exit","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[41],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":43,"time":0,"data":{"turn":1,"step":7}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":44,"time":0,"data":{"turn":1,"step":8}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":45,"time":0,"data":{"turn":1,"step":8,"message":{"role":"assistant","content":[{"type":"text","text":"PERSISTENT_TOOLS_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["PERSISTENT_TOOLS_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"PERSISTENT_TOOLS_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/ptc-turn/notifications.expected.jsonl b/snapshots/sdk/ptc-turn/notifications.expected.jsonl index 930e4e6eb3..02655a9e0b 100644 --- a/snapshots/sdk/ptc-turn/notifications.expected.jsonl +++ b/snapshots/sdk/ptc-turn/notifications.expected.jsonl @@ -15,7 +15,7 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/ptc-dispatch","seq":16,"time":0,"data":{"rootCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","parentCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","subCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875:ptc:1","name":"bash","arguments":{"command":"echo CODE_ONE","description":"Print CODE_ONE"},"isError":false,"content":[{"type":"text","text":"CODE_ONE\n"}]}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/ptc-dispatch-start","seq":17,"time":0,"data":{"rootCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","parentCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","subCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875:ptc:2","name":"bash","arguments":{"command":"echo CODE_TWO","description":"Print CODE_TWO"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/ptc-dispatch","seq":18,"time":0,"data":{"rootCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","parentCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","subCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875:ptc:2","name":"bash","arguments":{"command":"echo CODE_TWO","description":"Print CODE_TWO"},"isError":false,"content":[{"type":"text","text":"CODE_TWO\n"}]}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":19,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_00_UiQPVqoELyzBZCY5pm1z7875"},"content":[{"type":"tool-result","toolCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","content":[{"type":"text","text":"captured output\nCODE_ONE+CODE_TWO"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":19,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_UiQPVqoELyzBZCY5pm1z7875"},"toolCallId":"call_00_UiQPVqoELyzBZCY5pm1z7875","content":[{"type":"text","text":"captured output\nCODE_ONE+CODE_TWO"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":20,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":21,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":22,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The program ran successfully. The console.log output \"captured output\" appeared, and the return value is \"CODE_ONE+CODE_TWO\". The user asked me to reply with that joined string only."},{"type":"text","text":"CODE_ONE+CODE_TWO"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":117,"outputTokens":50,"cacheReadTokens":6272,"reasoningTokens":42},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":0,"index":0,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," program"," ran"," successfully","."," The"," console",".log"," output"," \"","capt","ured"," output","\""," appeared",","," and"," the"," return"," value"," is"," \"","CODE","_","ONE","+","CODE","_T","WO","\"."," The"," user"," asked"," me"," to"," reply"," with"," that"," joined"," string"," only","."]},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":1,"dt":[0,0,0,0,0,0],"texts":["CODE","_","ONE","+","CODE","_T","WO"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The program ran successfully. The console.log output \"captured output\" appeared, and the return value is \"CODE_ONE+CODE_TWO\". The user asked me to reply with that joined string only."}}},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"CODE_ONE+CODE_TWO"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":117,"outputTokens":50,"cacheReadTokens":6272,"reasoningTokens":42}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/sdk.snapshot.ts b/snapshots/sdk/sdk.snapshot.ts index 59135c84a4..952619af21 100644 --- a/snapshots/sdk/sdk.snapshot.ts +++ b/snapshots/sdk/sdk.snapshot.ts @@ -830,7 +830,7 @@ describe('TypeScript SDK snapshots over the jsonrpc runtime', () => { const denied = records(ordered[0]!.content).find(record => record.type === 'tool/result' && JSON.stringify(record).includes('call_over_capacity')) expect(denied).toMatchObject({ data: { - message: { content: [{ isError: true, content: [{ type: 'text', text: expect.stringContaining('subagent limit reached (active child limit: 1)') }] }] }, + message: { content: [{ type: 'text', text: expect.stringContaining('subagent limit reached (active child limit: 1)') }], isError: true }, } }) } if (scenario.name === 'tool-error-details') { diff --git a/snapshots/sdk/subagent-dsh-sdk-diagnostic/notifications.expected.jsonl b/snapshots/sdk/subagent-dsh-sdk-diagnostic/notifications.expected.jsonl index 21305966ab..1d0739374b 100644 --- a/snapshots/sdk/subagent-dsh-sdk-diagnostic/notifications.expected.jsonl +++ b/snapshots/sdk/subagent-dsh-sdk-diagnostic/notifications.expected.jsonl @@ -12,19 +12,19 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session-log-deepseek/delivery-accepted","seq":13,"time":0,"data":{"sessionId":"{{sessionId}}","sessionFormatVersion":3,"throughSeq":12}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":14,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_dsh_sdk_foreground","name":"subagent_dsh_sdk","arguments":"{\"description\":\"Observe DSH SDK foreground failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":false}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_dsh_sdk_foreground","name":"subagent_dsh_sdk","args":["{\"description\":\"Observe DSH SDK foreground failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":false}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_dsh_sdk_foreground","name":"subagent_dsh_sdk","arguments":"{\"description\":\"Observe DSH SDK foreground failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":false}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":15,"time":0,"data":{"turn":1,"step":1,"callId":"call_dsh_sdk_foreground","name":"subagent_dsh_sdk","arguments":"{\"description\":\"Observe DSH SDK foreground failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":false}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_foreground"},"content":[{"type":"tool-result","toolCallId":"call_dsh_sdk_foreground","content":[{"type":"text","text":"Error: subagent run failed\nDiagnostic: Subagent failure (provider: DSH SDK; stage: session-run; category: child-error)\nPartial output before the run ended:\npartial child loader answer"}],"isError":true}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_foreground"},"content":[{"type":"text","text":"Error: subagent run failed\nDiagnostic: Subagent failure (provider: DSH SDK; stage: session-run; category: child-error)\nPartial output before the run ended:\npartial child loader answer"}],"role":"tool","toolCallId":"call_dsh_sdk_foreground","isError":true,"id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":17,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":18,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session-log-deepseek/delivery-accepted","seq":19,"time":0,"data":{"sessionId":"{{sessionId}}","sessionFormatVersion":3,"throughSeq":18}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":20,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_dsh_sdk_background","name":"subagent_dsh_sdk_background","arguments":"{\"description\":\"Observe DSH SDK background failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":true}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_dsh_sdk_background","name":"subagent_dsh_sdk_background","args":["{\"description\":\"Observe DSH SDK background failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":true}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_dsh_sdk_background","name":"subagent_dsh_sdk_background","arguments":"{\"description\":\"Observe DSH SDK background failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":true}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":21,"time":0,"data":{"turn":1,"step":2,"callId":"call_dsh_sdk_background","name":"subagent_dsh_sdk_background","arguments":"{\"description\":\"Observe DSH SDK background failure\",\"prompt\":\"Return the scripted DSH SDK failure.\",\"run_in_background\":true}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_background"},"content":[{"type":"tool-result","toolCallId":"call_dsh_sdk_background","content":[{"type":"text","text":"started background subagent job subagent-1"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_background"},"content":[{"type":"text","text":"started background subagent job subagent-1"}],"role":"tool","toolCallId":"call_dsh_sdk_background","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":23,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":24,"time":0,"data":{"turn":1,"step":3}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session-log-deepseek/delivery-accepted","seq":25,"time":0,"data":{"sessionId":"{{sessionId}}","sessionFormatVersion":3,"throughSeq":24}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":26,"time":0,"data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_dsh_sdk_output","name":"job_output","arguments":"{\"job_id\":\"subagent-1\",\"wait\":true}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_dsh_sdk_output","name":"job_output","args":["{\"job_id\":\"subagent-1\",\"wait\":true}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_dsh_sdk_output","name":"job_output","arguments":"{\"job_id\":\"subagent-1\",\"wait\":true}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":27,"time":0,"data":{"turn":1,"step":3,"callId":"call_dsh_sdk_output","name":"job_output","arguments":"{\"job_id\":\"subagent-1\",\"wait\":true}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":28,"time":0,"data":{"turn":1,"step":3,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_output"},"content":[{"type":"tool-result","toolCallId":"call_dsh_sdk_output","content":[{"type":"text","text":"(no new output)\n[status: failed, error; diagnostic: Subagent failure (provider: DSH SDK; stage: session-run; category: child-error)]"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[27],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":28,"time":0,"data":{"turn":1,"step":3,"message":{"source":{"kind":"tool","callId":"call_dsh_sdk_output"},"content":[{"type":"text","text":"(no new output)\n[status: failed, error; diagnostic: Subagent failure (provider: DSH SDK; stage: session-run; category: child-error)]"}],"role":"tool","toolCallId":"call_dsh_sdk_output","isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[27],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":29,"time":0,"data":{"turn":1,"step":3}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":30,"time":0,"data":{"turn":1,"step":4}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session-log-deepseek/delivery-accepted","seq":31,"time":0,"data":{"sessionId":"{{sessionId}}","sessionFormatVersion":3,"throughSeq":30}}}} diff --git a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/notifications.expected.jsonl b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/notifications.expected.jsonl index c392d6eeae..45ac6eed74 100644 --- a/snapshots/sdk/subagent-dsh-sdk-dynamic-route/notifications.expected.jsonl +++ b/snapshots/sdk/subagent-dsh-sdk-dynamic-route/notifications.expected.jsonl @@ -11,7 +11,7 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session/title","seq":13,"time":0,"data":{"title":"Delegate once using the requested","messageSeqs":[9],"source":{"kind":"fallback"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":14,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"mock-routed\",\"reasoning_effort\":\"max\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"mock-delegate"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call-delegate","name":"subagent","args":["{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"mock-routed\",\"reasoning_effort\":\"max\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"mock-routed\",\"reasoning_effort\":\"max\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":15,"time":0,"data":{"turn":1,"step":1,"callId":"call-delegate","name":"subagent","arguments":"{\"description\":\"route probe\",\"prompt\":\"report your route and workspace\",\"provider\":\"mock\",\"model\":\"mock-routed\",\"reasoning_effort\":\"max\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call-delegate"},"content":[{"type":"tool-result","toolCallId":"call-delegate","content":[{"type":"text","text":"child route: mock/mock-routed/max/777; cwd: {{cwd}}"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call-delegate"},"toolCallId":"call-delegate","content":[{"type":"text","text":"child route: mock/mock-routed/max/777; cwd: {{cwd}}"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":17,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":18,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":19,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"text","text":"child reported:\nchild route: mock/mock-routed/max/777; cwd: {{cwd}}"}],"source":{"kind":"model","provider":"deepseek-official","model":"mock-delegate"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["child reported:\nchild route: mock/mock-routed/max/777; cwd: {{cwd}}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"child reported:\nchild route: mock/mock-routed/max/777; cwd: {{cwd}}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/subagent-spawn-in-process/notifications.expected.jsonl b/snapshots/sdk/subagent-spawn-in-process/notifications.expected.jsonl index 1a5029d705..d9944cb242 100644 --- a/snapshots/sdk/subagent-spawn-in-process/notifications.expected.jsonl +++ b/snapshots/sdk/subagent-spawn-in-process/notifications.expected.jsonl @@ -30,7 +30,7 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"turn/end","seq":15,"time":0,"data":{"turn":1,"reason":{"kind":"error","error":{"message":"llm-replay: script exhausted — session requested model call #1 but its script has only 0; re-record the scenario","code":"UNKNOWN"}}}}}} {"method":"session.status","params":{"sessionId":"{{sessionId}}","status":"idle"}} {"method":"subagent.finished","params":{"provider":"spawn","agentId":"{{sessionId}}","parentSessionId":"{{sessionId}}","childSessionId":"{{sessionId}}","status":"error","stopReason":"error"}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_00_oHPNQ1nLoakoaAGXIxCM7404"},"content":[{"type":"tool-result","toolCallId":"call_00_oHPNQ1nLoakoaAGXIxCM7404","content":[{"type":"text","text":"Error: subagent run failed"}],"isError":true}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":16,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_00_oHPNQ1nLoakoaAGXIxCM7404"},"content":[{"type":"text","text":"Error: subagent run failed"}],"role":"tool","toolCallId":"call_00_oHPNQ1nLoakoaAGXIxCM7404","isError":true,"id":"{{sessionId}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":17,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":18,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":19,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The subagent replied with \"child answer 42.\" Now I need to reply with the subagent's final answer verbatim."},{"type":"text","text":"child answer 42."}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":19,"outputTokens":32,"cacheReadTokens":1920,"reasoningTokens":26},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":0,"index":0,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," sub","agent"," replied"," with"," \"","child"," answer"," ","42",".\""," Now"," I"," need"," to"," reply"," with"," the"," sub","agent","'s"," final"," answer"," verb","atim","."]},{"type":"chunk","time":0,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":1,"dt":[0,0,0,0],"texts":["child"," answer"," ","42","."]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The subagent replied with \"child answer 42.\" Now I need to reply with the subagent's final answer verbatim."}}},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"child answer 42."}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":19,"outputTokens":32,"cacheReadTokens":1920,"reasoningTokens":26}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/system-prompt-in-history/notifications.expected.jsonl b/snapshots/sdk/system-prompt-in-history/notifications.expected.jsonl index 0ded34c8db..1b8458c0b8 100644 --- a/snapshots/sdk/system-prompt-in-history/notifications.expected.jsonl +++ b/snapshots/sdk/system-prompt-in-history/notifications.expected.jsonl @@ -11,7 +11,7 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session/title","seq":12,"time":0,"data":{"title":"Read task.txt with the read","messageSeqs":[8],"source":{"kind":"fallback"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":13,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_task_read","name":"read","arguments":"{\"file_path\":\"task.txt\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-flash"},"id":"{{sessionId}}"},"usage":{"inputTokens":10,"outputTokens":5},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"call_task_read","name":"read","args":["{\"file_path\":\"task.txt\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_task_read","name":"read","arguments":"{\"file_path\":\"task.txt\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"usage","usage":{"inputTokens":10,"outputTokens":5}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":14,"time":0,"data":{"turn":1,"step":1,"callId":"call_task_read","name":"read","arguments":"{\"file_path\":\"task.txt\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"call_task_read"},"content":[{"type":"tool-result","toolCallId":"call_task_read","content":[{"type":"text","text":"{{cwd}}/task.txt\nfile\n\n1: Reply with the single word DONE after reading this file.\n\n(End of file - total 1 lines)\n"}],"isError":false}],"role":"user","id":"{{sessionId}}"},"meta":{"path":"{{cwd}}/task.txt","offset":1,"lines":[{"number":1,"text":"Reply with the single word DONE after reading this file."}],"totalLines":1}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_task_read"},"toolCallId":"call_task_read","content":[{"type":"text","text":"{{cwd}}/task.txt\nfile\n\n1: Reply with the single word DONE after reading this file.\n\n(End of file - total 1 lines)\n"}],"isError":false,"id":"{{sessionId}}"},"meta":{"path":"{{cwd}}/task.txt","offset":1,"lines":[{"number":1,"text":"Reply with the single word DONE after reading this file."}],"totalLines":1}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":16,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":17,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"system/message","seq":18,"time":0,"data":{"turn":1,"step":2,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{sessionId}}"}},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/tool-error-details/notifications.expected.jsonl b/snapshots/sdk/tool-error-details/notifications.expected.jsonl index d4445a0847..2c7604fab8 100644 --- a/snapshots/sdk/tool-error-details/notifications.expected.jsonl +++ b/snapshots/sdk/tool-error-details/notifications.expected.jsonl @@ -11,14 +11,14 @@ {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"session/title","seq":12,"time":0,"data":{"title":"Exercise a native denial and","messageSeqs":[8],"source":{"kind":"fallback"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":13,"time":0,"data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"denied-native","name":"bash","args":["{\"command\":\"echo AUTO_DENIED\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":14,"time":0,"data":{"turn":1,"step":1,"callId":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"source":{"kind":"tool","callId":"denied-native"},"content":[{"type":"tool-result","toolCallId":"denied-native","content":[{"type":"text","text":"Error: Auto review rejected tool \"bash\"; its body was not executed"}],"isError":true}],"role":"user","id":"{{sessionId}}"},"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":15,"time":0,"data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"denied-native"},"toolCallId":"denied-native","content":[{"type":"text","text":"Error: Auto review rejected tool \"bash\"; its body was not executed"}],"isError":true,"id":"{{sessionId}}"},"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "}},"sourceEventSeqs":[14],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":16,"time":0,"data":{"turn":1,"step":1}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":17,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":18,"time":0,"data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":0,"index":0,"dt":[],"id":"denied-code","name":"run_code","args":["{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/call","seq":19,"time":0,"data":{"turn":1,"step":2,"callId":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/ptc-dispatch-start","seq":20,"time":0,"data":{"rootCallId":"denied-code","parentCallId":"denied-code","subCallId":"denied-code:ptc:1","name":"bash","arguments":{"command":"echo AUTO_DENIED"}}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/ptc-dispatch","seq":21,"time":0,"data":{"rootCallId":"denied-code","parentCallId":"denied-code","subCallId":"denied-code:ptc:1","name":"bash","arguments":{"command":"echo AUTO_DENIED"},"isError":true,"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "},"content":[{"type":"text","text":"Error: Auto review rejected tool \"bash\"; its body was not executed"}]}}}} -{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":2,"message":{"source":{"kind":"tool","callId":"denied-code"},"content":[{"type":"tool-result","toolCallId":"denied-code","content":[{"type":"text","text":"Auto review rejected tool \"bash\"; its body was not executed"}],"isError":false}],"role":"user","id":"{{sessionId}}"}},"sourceEventSeqs":[19],"surfaceOp":"append"}}} +{"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"tool/result","seq":22,"time":0,"data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"denied-code"},"toolCallId":"denied-code","content":[{"type":"text","text":"Auto review rejected tool \"bash\"; its body was not executed"}],"isError":false,"id":"{{sessionId}}"}},"sourceEventSeqs":[19],"surfaceOp":"append"}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/end","seq":23,"time":0,"data":{"turn":1,"step":2}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"step/start","seq":24,"time":0,"data":{"turn":1,"step":3}}}} {"method":"session.event","params":{"sessionId":"{{sessionId}}","event":{"type":"assistant/message","seq":25,"time":0,"data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"text","text":"ERROR_DETAILS_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{sessionId}}"},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["ERROR_DETAILS_OK"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ERROR_DETAILS_OK"}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}}} diff --git a/snapshots/sdk/tool-error-details/session.v4.jsonl b/snapshots/sdk/tool-error-details/session.v4.jsonl new file mode 100644 index 0000000000..6e400afbfc --- /dev/null +++ b/snapshots/sdk/tool-error-details/session.v4.jsonl @@ -0,0 +1,29 @@ +{"type":"session","version":4,"id":"{{session:1}}","createdAt":0,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access"}} +{"type":"approval/policy","data":{"policy":"never"}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Exercise a native denial and a caught PTC inner denial, then reply ERROR_DETAILS_OK."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Exercise a native denial and a caught PTC inner denial, then reply ERROR_DETAILS_OK."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} +{"type":"session/title","data":{"title":"Exercise a native denial and","messageSeqs":[8],"source":{"kind":"fallback"}}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:4}}"},"stream":[{"type":"chunk","time":1788896434400,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788896434400,"index":0,"dt":[],"id":"denied-native","name":"bash","args":["{\"command\":\"echo AUTO_DENIED\"}"]},{"type":"chunk","time":1788896434400,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}}},{"type":"chunk","time":1788896434400,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"denied-native","name":"bash","arguments":"{\"command\":\"echo AUTO_DENIED\"}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"denied-native"},"toolCallId":"denied-native","content":[{"type":"text","text":"Error: Auto review rejected tool \"bash\"; its body was not executed"}],"isError":true,"id":"{{message:5}}"},"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "}},"sourceEventSeqs":[14],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:6}}"},"stream":[{"type":"chunk","time":1788896434418,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788896434418,"index":0,"dt":[],"id":"denied-code","name":"run_code","args":["{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"]},{"type":"chunk","time":1788896434418,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}}},{"type":"chunk","time":1788896434418,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":2,"callId":"denied-code","name":"run_code","arguments":"{\"code\":\"try { await tools.bash({command: \\\"echo AUTO_DENIED\\\"}) } catch (error) { return error.message }\",\"description\":\"Catch one denied inner call\"}"}} +{"type":"tool/ptc-dispatch-start","data":{"rootCallId":"denied-code","parentCallId":"denied-code","subCallId":"denied-code:ptc:1","name":"bash","arguments":{"command":"echo AUTO_DENIED"}}} +{"type":"tool/ptc-dispatch","data":{"rootCallId":"denied-code","parentCallId":"denied-code","subCallId":"denied-code:ptc:1","name":"bash","arguments":{"command":"echo AUTO_DENIED"},"isError":true,"error":{"name":"AutoReviewDeniedError","code":"AUTO_REVIEW_DENIED","reason":" transport raw\r\nreason "},"content":[{"type":"text","text":"Error: Auto review rejected tool \"bash\"; its body was not executed"}]}} +{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"denied-code"},"toolCallId":"denied-code","content":[{"type":"text","text":"Auto review rejected tool \"bash\"; its body was not executed"}],"isError":false,"id":"{{message:7}}"}},"sourceEventSeqs":[19],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"step/start","data":{"turn":1,"step":3}} +{"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"text","text":"ERROR_DETAILS_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:8}}"},"stream":[{"type":"chunk","time":1788896434482,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":1788896434482,"index":0,"dt":[],"texts":["ERROR_DETAILS_OK"]},{"type":"chunk","time":1788896434482,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"ERROR_DETAILS_OK"}}},{"type":"chunk","time":1788896434482,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":3}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/snapshots/session/cordis-inspect-jsdoc/session.v4.jsonl b/snapshots/session/cordis-inspect-jsdoc/session.v4.jsonl new file mode 100644 index 0000000000..03ae3bb966 --- /dev/null +++ b/snapshots/session/cordis-inspect-jsdoc/session.v4.jsonl @@ -0,0 +1,27 @@ +{"type":"session","version":4,"id":"{{session:1}}","createdAt":1783951000000,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access"}} +{"type":"approval/policy","data":{"policy":"never"}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Inspect the exact tools service API, tools/pre-execute event, and subprocess service API with cordis_inspect_query, then reply with exactly CORDIS_INSPECT_JSDOC_OK."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Inspect the exact tools service API, tools/pre-execute event, and subprocess service API with cordis_inspect_query, then reply with exactly CORDIS_INSPECT_JSDOC_OK."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} +{"type":"session/title","data":{"title":"Inspect the exact tools service","messageSeqs":[8],"source":{"kind":"fallback"}}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"inspect-tools-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"tools\"}}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:4}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":1788778145981,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788778145981,"index":0,"dt":[],"id":"inspect-tools-api","name":"cordis_inspect_query","args":["{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"tools\"}}"]},{"type":"chunk","time":1788778145981,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"inspect-tools-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"tools\"}}"}}},{"type":"chunk","time":1788778145981,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":1788778145981,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"inspect-tools-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"tools\"}}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"inspect-tools-api"},"toolCallId":"inspect-tools-api","content":[{"type":"text","text":"{\n \"platform\": \"host\",\n \"provider\": \"Service\",\n \"method\": \"listService\",\n \"data\": {\n \"mode\": \"service\",\n \"service\": {\n \"key\": \"tools\",\n \"description\": \"Tool registry and execution pipeline. Scoped registrations shadow globals; one visibility resolver feeds presentation, lookup, and dispatch.\",\n \"access\": {\n \"optional\": {\n \"expression\": \"ctx.get(\\\"tools\\\")\",\n \"requiresUndefinedCheck\": true\n },\n \"hardDependency\": {\n \"inject\": [\n \"tools\"\n ],\n \"expression\": \"ctx.tools\"\n }\n },\n \"methods\": [\n {\n \"signature\": \"presentAs(mode: ToolPresentationMode): () => void\",\n \"description\": \"Present the calling scope's tools in `mode` instead of the deployment default. Nearest scope on the chain wins, so a preset's standing declaration covers every agent joined under it.\\n\\nScoped only, and one declaration per scope: this is how an agent preset composes PTC mode agents beside native ones in the same process, and a process-global override would be the `mode` config field instead.\",\n \"parameters\": [\n {\n \"name\": \"mode\",\n \"description\": \"the presentation the covered agents' models see.\"\n }\n ],\n \"returns\": \"the exact disposer that restores the deployment default.\"\n },\n {\n \"signature\": \"register(definition: ToolDefinition): () => void\",\n \"description\": \"Register globally or in the calling agent scope. Scoped tools shadow globals; duplicates within one layer and the reserved `run_code` name fail.\",\n \"parameters\": [\n {\n \"name\": \"definition\",\n \"description\": \"tool schema, execution, and optional finalization/presentation callbacks.\"\n }\n ],\n \"returns\": \"the exact disposer that unregisters the tool.\"\n },\n {\n \"signature\": \"restrict(filter: ToolRestriction): () => void\",\n \"description\": \"Restrict global tools for the calling agent scope. Empty filters, unknown names, scope-local names, and reserved transport names fail. Restrictions intersect; scoped registrations remain visible.\",\n \"parameters\": [\n {\n \"name\": \"filter\",\n \"description\": \"global-tool mask: `allow` (keep only) and/or `deny` (remove).\"\n }\n ],\n \"returns\": \"the exact disposer that lifts this restriction.\"\n },\n {\n \"signature\": \"guard(guard: ToolGuard): () => void\",\n \"description\": \"Register a monotonic guard after the extensible `tools/pre-execute` waterfall. A plain-context guard applies globally; one registered through `agent.ctx` applies only to that agent. Any matching guard may deny by returning a reason, while no guard can force-allow a call another guard denied. The exact effect disposer is returned for ordered ownership and HMR cleanup.\",\n \"parameters\": [\n {\n \"name\": \"guard\",\n \"description\": \"synchronous check; a returned string denies the execution.\"\n }\n ],\n \"returns\": \"the exact disposer that unregisters the guard.\"\n },\n {\n \"signature\": \"get(name: string, scope?: ScopeKey): ToolDefinition | undefined\",\n \"description\": \"Look up a tool as one scope sees it (scoped shadows global; a restricted-away global reads as absent). Presenters pass the calling agent so the rendered card matches the definition that actually executed.\",\n \"parameters\": [\n {\n \"name\": \"name\",\n \"description\": \"the tool name as registered.\"\n },\n {\n \"name\": \"scope\",\n \"description\": \"the viewing scope (the agent); omitted = the global view.\"\n }\n ],\n \"returns\": \"the definition the scope resolves, or undefined when none is visible.\"\n },\n {\n \"signature\": \"schemas(scope?: ScopeKey): ToolSchema[]\",\n \"description\": \"Project visible definitions onto the allowlisted model-facing schema fields, excluding execution and presentation callbacks.\",\n \"parameters\": [\n {\n \"name\": \"scope\",\n \"description\": \"the viewing scope (the agent); omitted = the global view.\"\n }\n ],\n \"returns\": \"one deep-cloned schema per visible tool.\"\n },\n {\n \"signature\": \"executionMode(exec: ToolExecutionInput): ToolExecutionMode\",\n \"description\": \"Classify a pending call through the caller's visible tool definition. Only an exact `true` is parallel; unknown, hidden, undeclared, invalid, or throwing classifiers are exclusive.\",\n \"parameters\": [\n {\n \"name\": \"exec\",\n \"description\": \"call name, parsed arguments, and optional agent scope.\"\n }\n ],\n \"returns\": \"the fail-closed scheduling mode.\"\n },\n {\n \"signature\": \"async execute(exec: ToolExecutionInput): Promise\",\n \"description\": \"Execute through pre-policy, guards, around-dispatch, post-policy, definition-owned content finalization, and final notification. Tool and listener failures resolve as materialized error results; an invisible tool reports `UNKNOWN_TOOL`. The returned outcome is the same lossless, frozen snapshot final observers receive. Cancellation arriving after entry and before final result materialization skips a not-yet-started body with `ABORTED_BEFORE_DISPATCH` or replaces a successful started outcome with `ABORTED`; already-started work is still drained and may retain a tool-owned structured error.\",\n \"parameters\": [\n {\n \"name\": \"exec\",\n \"description\": \"the typed same-process call input. The registry assigns its correlation token before policy begins.\"\n }\n ],\n \"returns\": \"the materialized final result.\"\n }\n ]\n },\n \"referencedTypes\": [\n {\n \"name\": \"Agent\",\n \"declaration\": \"export interface Agent {\\n readonly id: SessionId;\\n}\"\n },\n {\n \"name\": \"Branded\",\n \"declaration\": \"export type Branded = string & {\\n readonly [BRAND]: B;\\n};\"\n },\n {\n \"name\": \"DiffCallView\",\n \"declaration\": \"export interface DiffCallView {\\n card: 'diff';\\n title: string;\\n diffs: FileDiff[];\\n locations?: FileLocation[];\\n}\"\n },\n {\n \"name\": \"DiffResultView\",\n \"declaration\": \"export interface DiffResultView {\\n card: 'diff';\\n title?: string;\\n diffs: FileDiff[];\\n}\"\n },\n {\n \"name\": \"FileDiff\",\n \"declaration\": \"export interface FileDiff {\\n path: string;\\n oldText: string | null;\\n newText: string;\\n}\"\n },\n {\n \"name\": \"FileLocation\",\n \"declaration\": \"export interface FileLocation {\\n path: string;\\n line?: number;\\n}\"\n },\n {\n \"name\": \"GenericCallView\",\n \"declaration\": \"export interface GenericCallView {\\n card: 'generic';\\n title: string;\\n kind?: ToolCallKind;\\n rawInput?: unknown;\\n content?: ContentBlock[];\\n locations?: FileLocation[];\\n}\"\n },\n {\n \"name\": \"GenericResultView\",\n \"declaration\": \"export interface GenericResultView {\\n card: 'generic';\\n title?: string;\\n content?: ContentBlock[];\\n}\"\n },\n {\n \"name\": \"JsonSchemaNode\",\n \"declaration\": \"export interface JsonSchemaNode {\\n type?: JsonSchemaType;\\n oneOf?: JsonSchemaNode[];\\n properties?: Record;\\n required?: string[];\\n additionalProperties?: boolean;\\n items?: JsonSchemaNode;\\n enum?: JsonSchemaScalar[];\\n const?: JsonSchemaScalar;\\n description?: string;\\n title?: string;\\n default?: JsonValue;\\n examples?: JsonValue;\\n}\"\n },\n {\n \"name\": \"JsonSchemaScalar\",\n \"declaration\": \"export type JsonSchemaScalar = string | number | boolean | null;\"\n },\n {\n \"name\": \"JsonSchemaType\",\n \"declaration\": \"export type JsonSchemaType = 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';\"\n },\n {\n \"name\": \"JsonValue\",\n \"declaration\": \"export type JsonValue = null | boolean | number | string | JsonValue[] | {\\n [key: string]: JsonValue;\\n};\"\n },\n {\n \"name\": \"ReadFileLine\",\n \"declaration\": \"export interface ReadFileLine {\\n number: number;\\n text: string;\\n}\"\n },\n {\n \"name\": \"ReadResultView\",\n \"declaration\": \"export interface ReadResultView {\\n card: 'read';\\n title?: string;\\n path: string;\\n offset: number;\\n lines: ReadFileLine[];\\n totalLines: number;\\n lang?: string;\\n content?: ContentBlock[];\\n}\"\n },\n {\n \"name\": \"ScopeKey\",\n \"declaration\": \"export type ScopeKey = object;\"\n },\n {\n \"name\": \"SearchFileMatches\",\n \"declaration\": \"export interface SearchFileMatches {\\n path: string;\\n matches: SearchLineMatch[];\\n}\"\n },\n {\n \"name\": \"SearchLineMatch\",\n \"declaration\": \"export interface SearchLineMatch {\\n lineNumber: number;\\n line: string;\\n}\"\n },\n {\n \"name\": \"SearchMatchesResultView\",\n \"declaration\": \"export interface SearchMatchesResultView {\\n card: 'search';\\n shape: 'matches';\\n title?: string;\\n files: SearchFileMatches[];\\n truncated: boolean;\\n total: number;\\n}\"\n },\n {\n \"name\": \"SearchPathsResultView\",\n \"declaration\": \"export interface SearchPathsResultView {\\n card: 'search';\\n shape: 'paths';\\n title?: string;\\n paths: string[];\\n truncated: boolean;\\n total: number;\\n}\"\n },\n {\n \"name\": \"SearchResultView\",\n \"declaration\": \"export type SearchResultView = SearchMatchesResultView | SearchPathsResultView;\"\n },\n {\n \"name\": \"SessionId\",\n \"declaration\": \"export type SessionId = Branded<'SessionId'>;\"\n },\n {\n \"name\": \"TerminalCallView\",\n \"declaration\": \"export interface TerminalCallView {\\n card: 'terminal';\\n title: string;\\n description?: string;\\n cwd?: string;\\n}\"\n },\n {\n \"name\": \"TerminalResultView\",\n \"declaration\": \"export interface TerminalResultView {\\n card: 'terminal';\\n title?: string;\\n output?: string;\\n exitCode?: number;\\n signal?: string;\\n}\"\n },\n {\n \"name\": \"ToolCallKind\",\n \"declaration\": \"export type ToolCallKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'fetch' | 'other';\"\n },\n {\n \"name\": \"ToolCallView\",\n \"declaration\": \"export type ToolCallView = GenericCallView | TerminalCallView | DiffCallView;\"\n },\n {\n \"name\": \"ToolDefinition\",\n \"declaration\": \"export interface ToolDefinition extends ToolSchema {\\n readonly output: ToolOutputDefinition;\\n execute(args: unknown, exec: ToolRunContext): Promise;\\n finalizeContent?(exec: Readonly, result: Readonly): ContentBlock[] | undefined;\\n timeoutMs?: number;\\n isConcurrencySafe?(args: unknown): boolean;\\n presentCall?(args: unknown): ToolCallView | undefined;\\n presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined;\\n}\"\n },\n {\n \"name\": \"ToolErrorInfo\",\n \"declaration\": \"export interface ToolErrorInfo {\\n name: string;\\n code: string;\\n reason?: string;\\n}\"\n },\n {\n \"name\": \"ToolExecution\",\n \"declaration\": \"export interface ToolExecution extends ToolExecutionInput {\\n readonly rootCallId: ToolCallId;\\n readonly token: ToolExecutionToken;\\n}\"\n },\n {\n \"name\": \"ToolExecutionFailure\",\n \"declaration\": \"export interface ToolExecutionFailure {\\n readonly isError: true;\\n readonly error: ToolFailure;\\n readonly value?: never;\\n readonly content: ContentBlock[];\\n readonly meta?: JsonValue;\\n readonly additionalContexts?: UserMessage[];\\n readonly concludesTurn?: never;\\n}\"\n },\n {\n \"name\": \"ToolExecutionInput\",\n \"declaration\": \"export interface ToolExecutionInput {\\n readonly callId: ToolCallId;\\n readonly rootCallId?: ToolCallId;\\n readonly name: string;\\n readonly schema?: ToolSchema;\\n readonly arguments: unknown;\\n readonly agent?: Agent;\\n readonly parent?: ToolExecutionToken;\\n readonly signal: AbortSignal;\\n}\"\n },\n {\n \"name\": \"ToolExecutionMode\",\n \"declaration\": \"export type ToolExecutionMode = {\\n kind: 'parallel';\\n} | {\\n kind: 'exclusive';\\n};\"\n },\n {\n \"name\": \"ToolExecutionResult\",\n \"declaration\": \"export type ToolExecutionResult = ToolExecutionSuccess | ToolExecutionFailure;\"\n },\n {\n \"name\": \"ToolExecutionSuccess\",\n \"declaration\": \"export interface ToolExecutionSuccess {\\n readonly isError: false;\\n readonly value: JsonValue;\\n readonly content: ContentBlock[];\\n readonly error?: never;\\n readonly meta?: JsonValue;\\n readonly additionalContexts?: UserMessage[];\\n readonly concludesTurn?: true;\\n}\"\n },\n {\n \"name\": \"ToolExecutionToken\",\n \"declaration\": \"export type ToolExecutionToken = symbol & {\\n readonly [toolExecutionTokenBrand]: true;\\n};\"\n },\n {\n \"name\": \"ToolFailure\",\n \"declaration\": \"export interface ToolFailure {\\n message: string;\\n info?: ToolErrorInfo;\\n}\"\n },\n {\n \"name\": \"ToolGuard\",\n \"declaration\": \"export type ToolGuard = (execution: Readonly) => string | undefined;\"\n },\n {\n \"name\": \"ToolOutputDefinition\",\n \"declaration\": \"export interface ToolOutputDefinition {\\n readonly schema: JsonSchemaNode;\\n render(args: unknown, value: JsonValue): ContentBlock[];\\n presentationMeta?(args: unknown, value: JsonValue): JsonValue;\\n}\"\n },\n {\n \"name\": \"ToolPresentationMode\",\n \"declaration\": \"export type ToolPresentationMode = 'native' | 'ptc' | 'both';\"\n },\n {\n \"name\": \"ToolRestriction\",\n \"declaration\": \"export interface ToolRestriction {\\n readonly allow?: readonly string[];\\n readonly deny?: readonly string[];\\n}\"\n },\n {\n \"name\": \"ToolResult\",\n \"declaration\": \"export interface ToolResult {\\n content: ContentBlock[];\\n isError: boolean;\\n meta?: JsonValue;\\n}\"\n },\n {\n \"name\": \"ToolResultView\",\n \"declaration\": \"export type ToolResultView = GenericResultView | TerminalResultView | DiffResultView | SearchResultView | ReadResultView | WebResultView;\"\n },\n {\n \"name\": \"ToolRunContext\",\n \"declaration\": \"export interface ToolRunContext extends ToolExecution {\\n deferContext(context: UserMessage): void;\\n concludeTurn(): void;\\n}\"\n },\n {\n \"name\": \"ToolSchema\",\n \"declaration\": \"export interface ToolSchema {\\n name: string;\\n description: string;\\n parameters: Record;\\n}\"\n },\n {\n \"name\": \"UserMessage\",\n \"declaration\": \"export interface UserMessage extends MessageBase {\\n readonly role: 'user';\\n}\"\n },\n {\n \"name\": \"WebFetchResultView\",\n \"declaration\": \"export interface WebFetchResultView {\\n card: 'web';\\n kind: 'fetch';\\n title?: string;\\n url: string;\\n statusCode: number;\\n truncated: boolean;\\n}\"\n },\n {\n \"name\": \"WebResultView\",\n \"declaration\": \"export type WebResultView = WebSearchResultView | WebFetchResultView;\"\n },\n {\n \"name\": \"WebSearchResultView\",\n \"declaration\": \"export interface WebSearchResultView {\\n card: 'web';\\n kind: 'search';\\n title?: string;\\n sources: WebSource[];\\n answer?: string;\\n truncated: boolean;\\n}\"\n },\n {\n \"name\": \"WebSource\",\n \"declaration\": \"export interface WebSource {\\n url: string;\\n title?: string;\\n snippet?: string;\\n publishedAt?: string;\\n}\"\n }\n ]\n }\n}"}],"isError":false,"id":"{{message:5}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"tool-call","id":"inspect-subprocess-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"subprocess\"}}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:6}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":1788778146017,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788778146017,"index":0,"dt":[],"id":"inspect-subprocess-api","name":"cordis_inspect_query","args":["{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"subprocess\"}}"]},{"type":"chunk","time":1788778146017,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"inspect-subprocess-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"subprocess\"}}"}}},{"type":"chunk","time":1788778146017,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":1788778146017,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":2,"callId":"inspect-subprocess-api","name":"cordis_inspect_query","arguments":"{\"platform\":\"host\",\"provider\":\"Service\",\"method\":\"listService\",\"input\":{\"service\":\"subprocess\"}}"}} +{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"inspect-subprocess-api"},"toolCallId":"inspect-subprocess-api","content":[{"type":"text","text":"{\n \"platform\": \"host\",\n \"provider\": \"Service\",\n \"method\": \"listService\",\n \"data\": {\n \"mode\": \"service\",\n \"service\": {\n \"key\": \"subprocess\",\n \"description\": \"Abstract subprocess service. Subclass, implement spawn, and load the subclass as a plugin — it registers as `ctx.subprocess` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).\\n\\nImplementations must honor these semantics:\\n\\n- Executable paths belong to one execution world shared with the mounted filesystem provider.\\n- spawn returns a live handle synchronously. Target identity remains provider-private; `done` resolves with the spawned command's exit facts and may reject for spawn or provider failures.\\n- Collect-mode readers are offset-based and non-consuming, so independent readers never consume one another's output; lossy reads report truncation and the spill file holding the complete stream when one exists. Piped streams are handed to the caller raw and never buffered here.\\n- SubprocessHandle.terminate (and the spec's abort signal) starts the provider's documented procedure against its managed range. SubprocessHandle.waitForExit observes that same range so a consumer-owned teardown ladder can hold each tier on real quiescence; each provider documents its signalling and observability limits.\\n- Disposal of the service terminates all still-running managed processes and awaits their exit.\\n- spawnTerminal owns terminal allocation, text transport, foreground groups, signalling, and whole-session quiescence behind one awaited termination method; readiness and persistent-shell policy stay in the PTY consumer. Its output stream ends after queued terminal output when the top-level process exits.\",\n \"access\": {\n \"optional\": {\n \"expression\": \"ctx.get(\\\"subprocess\\\")\",\n \"requiresUndefinedCheck\": true\n },\n \"hardDependency\": {\n \"inject\": [\n \"subprocess\"\n ],\n \"expression\": \"ctx.subprocess\"\n }\n },\n \"methods\": [\n {\n \"signature\": \"abstract resolveExecutable( command: string, env?: Readonly>, signal?: AbortSignal, ): Promise\",\n \"description\": \"Resolve one configured executable in this provider's execution world. Absolute paths are verified; bare names use the provider's scrubbed PATH plus explicit environment overrides. Relative paths containing separators are rejected: the resolution base is undefined, so providers fail loud instead of guessing.\",\n \"parameters\": [\n {\n \"name\": \"command\",\n \"description\": \"absolute executable path or bare PATH name.\"\n },\n {\n \"name\": \"env\",\n \"description\": \"explicit environment entries used for lookup.\"\n },\n {\n \"name\": \"signal\",\n \"description\": \"aborts remote or local lookup.\"\n }\n ],\n \"returns\": \"a canonical executable path.\"\n },\n {\n \"signature\": \"abstract terminalEnvironment(signal?: AbortSignal): Promise\",\n \"description\": \"Inspect shell-selection facts in the provider's execution environment.\",\n \"parameters\": [\n {\n \"name\": \"signal\",\n \"description\": \"cancellation of remote environment inspection.\"\n }\n ],\n \"returns\": \"platform and preferred shell; executable lookup and allocation remain separate operations.\"\n },\n {\n \"signature\": \"abstract spawn(spec: SubprocessSpawnSpec): SubprocessHandle\",\n \"description\": \"Start one managed child process from a fully-specified spec; this seam applies no defaults.\",\n \"parameters\": [\n {\n \"name\": \"spec\",\n \"description\": \"argv, directory, stdio dispositions, grace, cancellation, and environment.\"\n }\n ],\n \"returns\": \"the live process handle (streams/readers, signalling, outcome promise).\",\n \"throws\": [\n \"synchronously when pre-aborted or when argv, cwd, environment, or grace is invalid before handle creation.\"\n ]\n },\n {\n \"signature\": \"abstract spawnTerminal(spec: SubprocessTerminalSpawnSpec): Promise\",\n \"description\": \"Allocate a real terminal and start one owned process session. This is the only non-pipe process primitive: implementations own terminal byte I/O, foreground groups, signals, and whole-session quiescence.\",\n \"parameters\": [\n {\n \"name\": \"spec\",\n \"description\": \"fully specified argv, cwd, environment, dimensions, grace, and allocation cancellation.\"\n }\n ],\n \"returns\": \"the live terminal handle after allocation succeeds.\"\n }\n ]\n },\n \"referencedTypes\": [\n {\n \"name\": \"SubprocessCollect\",\n \"declaration\": \"export interface SubprocessCollect {\\n maxBytes: number;\\n spill?: {\\n maxBytes: number;\\n };\\n}\"\n },\n {\n \"name\": \"SubprocessCollectedOutputs\",\n \"declaration\": \"export interface SubprocessCollectedOutputs {\\n readonly stdout?: SubprocessOutputReader;\\n readonly stderr?: SubprocessOutputReader;\\n}\"\n },\n {\n \"name\": \"SubprocessHandle\",\n \"declaration\": \"export interface SubprocessHandle {\\n readonly stdin: Writable | undefined;\\n readonly stdout: Readable | undefined;\\n readonly stderr: Readable | undefined;\\n readonly control: Duplex | undefined;\\n readonly collected: SubprocessCollectedOutputs;\\n readonly done: Promise;\\n terminate(): void;\\n waitForExit(signal?: AbortSignal): Promise;\\n}\"\n },\n {\n \"name\": \"SubprocessOutcome\",\n \"declaration\": \"export interface SubprocessOutcome {\\n exitCode: number | null;\\n signal: NodeJS.Signals | null;\\n}\"\n },\n {\n \"name\": \"SubprocessOutputMode\",\n \"declaration\": \"export type SubprocessOutputMode = 'pipe' | 'inherit' | SubprocessCollect;\"\n },\n {\n \"name\": \"SubprocessOutputRead\",\n \"declaration\": \"export interface SubprocessOutputRead {\\n text: string;\\n nextOffset: number;\\n lossy: boolean;\\n spillPath?: string;\\n}\"\n },\n {\n \"name\": \"SubprocessOutputReader\",\n \"declaration\": \"export interface SubprocessOutputReader {\\n readFrom(fromByte: number): SubprocessOutputRead;\\n}\"\n },\n {\n \"name\": \"SubprocessSpawnSpec\",\n \"declaration\": \"export interface SubprocessSpawnSpec {\\n argv: readonly string[];\\n cwd: string;\\n stdio: SubprocessStdio;\\n graceMs: number;\\n signal?: AbortSignal | undefined;\\n env?: NodeJS.ProcessEnv | undefined;\\n}\"\n },\n {\n \"name\": \"SubprocessStdinMode\",\n \"declaration\": \"export type SubprocessStdinMode = 'ignore' | 'pipe' | {\\n readonly data: string;\\n};\"\n },\n {\n \"name\": \"SubprocessStdio\",\n \"declaration\": \"export interface SubprocessStdio {\\n stdin: SubprocessStdinMode;\\n stdout: SubprocessOutputMode;\\n stderr: SubprocessOutputMode;\\n control?: 'pipe';\\n}\"\n },\n {\n \"name\": \"SubprocessTerminalActivity\",\n \"declaration\": \"export interface SubprocessTerminalActivity {\\n state: 'idle' | 'busy' | 'unknown';\\n revision: number;\\n}\"\n },\n {\n \"name\": \"SubprocessTerminalEnvironment\",\n \"declaration\": \"export interface SubprocessTerminalEnvironment {\\n platform: 'posix' | 'windows';\\n defaultShell?: string;\\n}\"\n },\n {\n \"name\": \"SubprocessTerminalForeground\",\n \"declaration\": \"export interface SubprocessTerminalForeground {\\n processGroupId: number;\\n inputWaiting: boolean;\\n}\"\n },\n {\n \"name\": \"SubprocessTerminalHandle\",\n \"declaration\": \"export interface SubprocessTerminalHandle {\\n readonly pid: number;\\n readonly output: Readable;\\n readonly done: Promise;\\n write(data: string): Promise;\\n resize(cols: number, rows: number): Promise;\\n inspectForeground(): Promise;\\n inspectActivity(): Promise;\\n signalForeground(signal: SubprocessTerminalSignal): Promise;\\n terminate(): Promise;\\n}\"\n },\n {\n \"name\": \"SubprocessTerminalSignal\",\n \"declaration\": \"export type SubprocessTerminalSignal = 'SIGINT' | 'SIGTERM' | 'SIGKILL' | 'SIGTSTP' | 'SIGHUP';\"\n },\n {\n \"name\": \"SubprocessTerminalSpawnSpec\",\n \"declaration\": \"export interface SubprocessTerminalSpawnSpec {\\n argv: readonly string[];\\n cwd: string;\\n env?: Record | undefined;\\n rows: number;\\n cols: number;\\n terminalType: string;\\n shellActivity?: boolean | undefined;\\n graceMs: number;\\n signal?: AbortSignal | undefined;\\n}\"\n }\n ]\n }\n}"}],"isError":false,"id":"{{message:7}}"}},"sourceEventSeqs":[19],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"step/start","data":{"turn":1,"step":3}} +{"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"text","text":"CORDIS_INSPECT_JSDOC_OK"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:8}}"},"usage":{"inputTokens":3,"outputTokens":3},"stream":[{"type":"chunk","time":1788778146037,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":1788778146037,"index":0,"dt":[],"texts":["CORDIS_INSPECT_JSDOC_OK"]},{"type":"chunk","time":1788778146037,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"CORDIS_INSPECT_JSDOC_OK"}}},{"type":"chunk","time":1788778146037,"chunk":{"type":"usage","usage":{"inputTokens":3,"outputTokens":3}}},{"type":"chunk","time":1788778146037,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":3}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/snapshots/session/headless.snapshot.ts b/snapshots/session/headless.snapshot.ts index 783c024798..d5fd9507d4 100644 --- a/snapshots/session/headless.snapshot.ts +++ b/snapshots/session/headless.snapshot.ts @@ -582,9 +582,7 @@ function sessionReferenceSpillExpected(actual: readonly JsonObject[], expectedLo /** Require successful verification and the complete canonical event before refresh can write a fixture. */ async function verifySessionQuerySpill(log: string, spillRoot: string, locatorRoot: string): Promise { const events = parseSessionLog(log) - const results = events.flatMap(event => event.type === 'tool/result' - ? event.data.message.content.filter(block => block.type === 'tool-result') - : []) + const results = events.flatMap(event => event.type === 'tool/result' ? [event.data.message] : []) const readResult = results.find(result => result.toolCallId === 'call_session_query_spill') const verification = results.find(result => result.toolCallId === 'call_verify_session_query_spill') expect(readResult?.isError).toBe(false) @@ -609,9 +607,7 @@ async function verifySessionQuerySpill(log: string, spillRoot: string, locatorRo /** Require real resource results and literal instructions before recording or replay succeeds. */ function verifyMcpResources(log: string, ptc: boolean): void { const events = parseSessionLog(log) - const nativeResults = events.flatMap(event => event.type === 'tool/result' - ? event.data.message.content.filter(block => block.type === 'tool-result') - : []) + const nativeResults = events.flatMap(event => event.type === 'tool/result' ? [event.data.message] : []) const dispatches = events.flatMap(event => event.type === 'tool/ptc-dispatch' ? [event.data] : []) const results = ptc ? dispatches : nativeResults expect(results.length).toBeGreaterThanOrEqual(5) @@ -660,8 +656,7 @@ function verifyNoMcpServers(log: string, ptc: boolean): void { /** Require an admitted failed job and zero process allocations before updating its recorded oracle. */ async function verifyBackgroundConfinementFailure(log: string, cwd: string): Promise { - const results = parseSessionLog(log).flatMap(event => event.type === 'tool/result' - ? event.data.message.content.filter(block => block.type === 'tool-result') : []) + const results = parseSessionLog(log).flatMap(event => event.type === 'tool/result' ? [event.data.message] : []) const started = results.find(result => result.toolCallId === 'async-confinement-start') const inspected = results.find(result => result.toolCallId === 'async-confinement-result') expect(started).toMatchObject({ isError: false, content: [{ type: 'text', text: 'started background job bash-1' }] }) diff --git a/snapshots/session/tool-call-turn/session.v4.jsonl b/snapshots/session/tool-call-turn/session.v4.jsonl new file mode 100644 index 0000000000..d671ed51dc --- /dev/null +++ b/snapshots/session/tool-call-turn/session.v4.jsonl @@ -0,0 +1,22 @@ +{"type":"session","version":4,"id":"{{session:1}}","createdAt":1783352044766,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access"}} +{"type":"approval/policy","data":{"policy":"never"}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Use the bash tool to run exactly: echo SNAPSHOT_OK. Then reply with the single word DONE and stop."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Use the bash tool to run exactly: echo SNAPSHOT_OK. Then reply with the single word DONE and stop."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} +{"type":"session/title","data":{"title":"Use the bash tool to","messageSeqs":[8],"source":{"kind":"fallback"}}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The user wants me to run a specific bash command and then reply with DONE."},{"type":"tool-call","id":"call_00_Rn2Mz1y8uZN62ukEXiNO2077","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run echo SNAPSHOT_OK\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:4}}"},"usage":{"inputTokens":2879,"outputTokens":89,"cacheReadTokens":0,"reasoningTokens":17},"stream":[{"type":"chunk","time":1788699447885,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1788699447885,"index":0,"dt":[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],"texts":["The"," user"," wants"," me"," to"," run"," a"," specific"," bash"," command"," and"," then"," reply"," with"," D","ONE","."]},{"type":"chunk","time":1788699447886,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788699447886,"index":1,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"id":"call_00_Rn2Mz1y8uZN62ukEXiNO2077","name":"bash","args":["","{","\"","command","\"",": ","\"","echo"," S","NA","PS","H","OT","_OK","\"",", ","\"","description","\"",": ","\"","Run"," echo"," S","NA","PS","H","OT","_OK","\"","}"]},{"type":"chunk","time":1788699447886,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The user wants me to run a specific bash command and then reply with DONE."}}},{"type":"chunk","time":1788699447886,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_Rn2Mz1y8uZN62ukEXiNO2077","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run echo SNAPSHOT_OK\"}"}}},{"type":"chunk","time":1788699447886,"chunk":{"type":"usage","usage":{"inputTokens":2879,"outputTokens":89,"cacheReadTokens":0,"reasoningTokens":17}}},{"type":"chunk","time":1788699447886,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_00_Rn2Mz1y8uZN62ukEXiNO2077","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run echo SNAPSHOT_OK\"}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_Rn2Mz1y8uZN62ukEXiNO2077"},"toolCallId":"call_00_Rn2Mz1y8uZN62ukEXiNO2077","content":[{"type":"text","text":"SNAPSHOT_OK\n"}],"isError":false,"id":"{{message:5}}"}},"sourceEventSeqs":[14],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The command executed successfully and printed SNAPSHOT_OK. Now I need to reply with the single word DONE."},{"type":"text","text":"DONE"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:6}}"},"usage":{"inputTokens":170,"outputTokens":28,"cacheReadTokens":2816,"reasoningTokens":25},"stream":[{"type":"chunk","time":1788699447912,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1788699447912,"index":0,"dt":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," command"," executed"," successfully"," and"," printed"," S","NA","PS","H","OT","_OK","."," Now"," I"," need"," to"," reply"," with"," the"," single"," word"," D","ONE","."]},{"type":"chunk","time":1788699447912,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":1788699447912,"index":1,"dt":[0],"texts":["D","ONE"]},{"type":"chunk","time":1788699447912,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The command executed successfully and printed SNAPSHOT_OK. Now I need to reply with the single word DONE."}}},{"type":"chunk","time":1788699447912,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"DONE"}}},{"type":"chunk","time":1788699447912,"chunk":{"type":"usage","usage":{"inputTokens":170,"outputTokens":28,"cacheReadTokens":2816,"reasoningTokens":25}}},{"type":"chunk","time":1788699447912,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}}