diff --git a/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml new file mode 100644 index 0000000000..a54db0a426 --- /dev/null +++ b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml @@ -0,0 +1,43 @@ +# Bilingual-pair consistency record for 2026-09-19-timed-user-question-two-settlements.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.md +/agent-note-timed-user-questions-as-two-settlements: + en: 5b6fa73158a11213 + zh: b55c32342d6e6692 +/agent-note-timed-user-questions-as-two-settlements/problem: + en: f665127a9b5b8225 + zh: b19845f62310f3a2 +/agent-note-timed-user-questions-as-two-settlements/decision: + en: ce869bf2eed04e81 + zh: 5b1fcf44c44c6137 +/agent-note-timed-user-questions-as-two-settlements/decision/modes-and-scope: + en: adccc5dc758ad8f6 + zh: 50304d68db42e8b1 +/agent-note-timed-user-questions-as-two-settlements/decision/ownership: + en: 0543678ad9d26fc5 + zh: aa6ba207e661c567 +/agent-note-timed-user-questions-as-two-settlements/decision/foreground-wait-and-claim-lifetime: + en: 447713bbdf1ab4d8 + zh: 2757678ae47822aa +/agent-note-timed-user-questions-as-two-settlements/decision/durable-state-and-late-answers: + en: 93f3def953d10a2e + zh: e1106340e0043254 +/agent-note-timed-user-questions-as-two-settlements/decision/card-state-and-delivery-races: + en: 3dd7321bd37c51bf + zh: 2d1f058732bd6d0f +/agent-note-timed-user-questions-as-two-settlements/decision/local-countdown-and-panel-actions: + en: 3a33f2583e30e32a + zh: 0ad7e8d1e47dc510 +/agent-note-timed-user-questions-as-two-settlements/decision/reply-node-and-grouping: + en: 10323b0e0340a40b + zh: a17fc3a4d4d820a7 +/agent-note-timed-user-questions-as-two-settlements/alternatives-considered: + en: bf61d0ec80c63bb4 + zh: d4ce4d4438ffb013 +/agent-note-timed-user-questions-as-two-settlements/verification: + en: d912a73a5ff409eb + zh: 7b626794773e2301 +/agent-note-timed-user-questions-as-two-settlements/consequences: + en: 2bc99c99be8ca9da + zh: 8f262ec8b9b0945e diff --git a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.md b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.md similarity index 61% rename from .agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.md rename to .agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.md index a4f4bf6e30..4bdf47cb2c 100644 --- a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.md +++ b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.md @@ -1,6 +1,6 @@ # Agent Note: Timed user questions as two settlements -Status: proposed +Status: implemented English | [中文](2026-09-19-timed-user-question-two-settlements.zh.md) @@ -10,14 +10,14 @@ A question can block an agent even when useful work does not depend on the answe The foreground tool result and the eventual answer have different lifetimes. A `user-questions/request` waterfall settles once; keeping it alive after returning pending creates a second answer path that outlives its caller. Countdown, focus, and editing also have different owners from durable question state. -## Proposal +## Decision -Keep foreground answers on the existing Remote Event waterfall. A timeout ends that request and returns pending; a later answer uses a business RPC that steers a durable user message. The claim stream controls the foreground wait only. It neither transports answers nor replaces the Remote Event. +Foreground answers use the existing Remote Event waterfall. A timeout ends that request and returns pending; a later answer uses a business RPC that steers a durable user message. The claim stream controls the foreground wait only. It neither transports answers nor replaces the Remote Event. ### Modes and scope - The default `mode: legacy` retains the blocking schema and `ask()` path. Explicit `mode: timed` adds `timeout`, using the configured default of 120 seconds when omitted. -- A positive integer timeout selects `askTimed()`; `-1` selects blocking `ask()`. A blocking call made with the timed schema still participates in timed-question projection and review; it is not identical to a legacy call. +- A positive integer timeout selects `askTimed()`; `-1` selects blocking `ask()`. A native blocking call made with the timed schema still participates in timed-question projection and review; it is not identical to a legacy call. - Plan review retains `ask()`, its `plan-review` intent, and `BAD_INTENT` validation. This decision does not move plan review to another package. - Human interaction requires the exact live runtime root when an Agent is supplied. A stale instance fails with `CALLER_NOT_LIVE`; an owned child fails with `DELEGATED_CALLER`. Durable Session lineage does not prevent a resumed runtime root from asking. @@ -46,27 +46,27 @@ Client countdown expiry rejects the waterfall with `ASK_TIMED_OUT`. Unattended H ### Durable state and late answers -The `userQuestions` projection reconstructs question state from existing Session events. It recognises the timed schema by the `timeout` parameter recorded in `request/header`; legacy calls are not tracked. A valid `tool/call` opens a question. Its `tool/result` makes it continued for pending or `TOOL_OUTCOME_UNKNOWN`, settles it with a valid answer batch, or removes it for another result or failure. +The `userQuestions` projection reconstructs question state from existing Session events. For native calls, it recognises the timed schema by the `timeout` parameter recorded in `request/header`; legacy calls are not tracked. A valid `tool/call` opens a question. Its `tool/result` makes it continued for pending or `TOOL_OUTCOME_UNKNOWN`, settles it with a valid answer batch, or removes it for another result or failure. A PTC sub-call enters the projection when its `tool/ptc-dispatch` result is pending, since only `run_code` appears in the model request header. -A continued question accepts `answer(agent, callId, answer)`. The method returns `false` for an unknown or non-continued call and throws `BAD_ANSWER` unless the batch names each question exactly once. Accepted answers use `agent.steer(createUserMessage(...))`, source `{ kind: 'user-question-reply', callId, outcome: 'answered' }`, and JSON text containing `answer_to_pending_question`, the call id, original questions, and answers. Remote Agent resolution from the Session id resumes a root when needed; the `answer()` body does not own that resume operation. +A continued question accepts `answer(agent, callId, answer)`. The method returns `false` for an unknown or non-continued call, throws `REPLY_QUEUED` while another reply awaits admission, and throws `BAD_ANSWER` unless the batch names each question exactly once. Accepted answers use `agent.steer(createUserMessage(...))`, source `{ kind: 'user-question-reply', callId, outcome: 'answered' }`, and JSON text containing `answer_to_pending_question`, the call id, original questions, and answers. Remote Agent resolution from the Session id resumes a root when needed; the `answer()` body does not own that resume operation. -The inbox message is the durable reply. `agent/inbox/spliced` settles the question when the message is queued; the later admitted `user/message` is idempotent for that settlement. Settled answer batches remain in the projection so the original tool row can show late answers even though its own result remains pending. Unusable recorded reply text settles with an empty batch. +The inbox message is the durable queued reply. A per-Session reservation covers the interval from queuing through claim and admission; claiming a restored inbox reply creates the reservation again. Admission as `user/message` settles the question, while discard or a Turn that ends without admission releases the reservation for another answer. Settled answer batches remain in the projection so the original tool row can show late answers even though its own result remains pending. Unusable recorded reply text settles with an empty batch. -No new Session event type or wait-state log is needed. The message-source extension requires the repository's persistence-type acknowledgement. `dismissed` remains readable for historical records but has no producer: hiding a panel does not manufacture a reply. +No new Session event type or wait-state log is needed. The message-source extension requires the repository's persistence-type acknowledgement. Hiding a panel does not manufacture a reply. ### Card state and delivery races -`QuestionCards` shares one `PendingQuestion` between the live request and the continued projection, keyed by Session and `callId`. A blocking request without a call id has its own per-request card. An open card submits through its waterfall; without that channel it disables submission. A continued card uses the late-answer RPC. +`QuestionCards` shares one `PendingQuestion` between the live request and the continued projection, keyed by Session and `callId`. A forwarded request keeps its card through the claim's first frame even before the projection lists it. A blocking request without a call id has its own per-request card with a reload-unique key, so an old persisted draft cannot attach to another request. An open card submits through its waterfall; without that channel it disables submission. A continued card uses the late-answer RPC. -A waterfall submission has no delivery acknowledgement. The Gateway can discard an outcome that loses a settlement race. The card therefore retains its draft and stays busy until projection reconciliation. If the question becomes continued during submission, the controls re-arm with a resubmit hint; the user can submit the retained draft through RPC. This is not automatic retry or a guarantee that every local submission reaches the model. +A waterfall submission has no delivery acknowledgement. The Gateway can discard an outcome that loses a settlement race. The card therefore retains its draft and stays busy until projection reconciliation. If the question becomes continued during submission, the controls re-arm with a resubmit hint; the user can submit the retained draft through RPC. An accepted RPC submission steers a reply toward the nearest step without settling the question, and the panel closes. A current tool wait must finish before that step can read the reply; if the steer is discarded, the question can be reopened and answered again. This is not automatic retry or a guarantee that every local submission reaches the model. -A tool-call-keyed card is removed when its call is absent from the active projection and no waterfall remains. Removal closes the card and clears its draft. Neither a local submission nor a transport cancel frame alone decides that the question is answered. An unkeyed blocking card ends with its waterfall; closing that blocking panel rejects with `ASK_CANCELLED`. +A tool-call-keyed card is removed when its call is absent from the active projection and no forwarded request remains. Removal closes the card and clears its draft. Neither a local submission nor a transport cancel frame alone decides that the question is answered. An unkeyed blocking card ends with its waterfall; closing that blocking panel rejects with `ASK_CANCELLED`. ### Local countdown and panel actions The Client computes `Date.now() + remainingMs`. Manual focus on a pristine answer surface pauses its countdown, and blur resumes the preserved remainder. Focus before the claim handshake remains effective when the deadline arrives; blur before the handshake does not create a timer. First edit or Take time freezes the countdown, with that disposition saved beside the browser-local draft. -Autofocus applies only when the answer channel is ready, no countdown is active, and the card is not locked. Hiding a timed-call panel leaves its claim and countdown running; its tool row can reopen it. A settled call opens a read-only panel from recorded questions and answers, not another answer channel. +Autofocus applies only when the answer channel is ready, no countdown is active, and the card is not locked. Hiding a timed-call panel leaves its claim and countdown running; its tool row can reopen it. Once a late reply enters the Inbox, the tool row displays its submitted answers and “View answers” expands the read-only transcript while admission is pending. A settled call opens a read-only panel with recorded answers. Discarding the queued reply restores the answer action. ### Reply node and grouping @@ -86,7 +86,7 @@ This decision adds no process-role field, independent-layout flag, user-message **Delegate every timed request immediately.** Dispatching to an intentionally empty answerer set wastes the existing blocking-answer path and requires special handling of `NO_PROVIDER`. Delegation is for an unavailable answerer, not the timed mode itself. -**Persist a whole-value wait/focus/edit stream or use Host focus leases.** Durable question status is derivable from tool and inbox events. Focus and editing are local UI state; logging them or synchronising focus leases adds Host state without making multiple Clients share one editing session. +**Persist a whole-value wait/focus/edit stream or use Host focus leases.** Durable question status is derivable from tool and admitted user events. Focus and editing are local UI state; logging them or synchronising focus leases adds Host state without making multiple Clients share one editing session. **Reclassify JSON inside generic `MessageItem`, borrow the relay form, or use the default context row.** Parsing text to identify the business message confuses its source with its content; the relay form describes another agent's message, and a generic context row exposes JSON. A dedicated source, Definition, and renderer own the question presentation. @@ -94,20 +94,24 @@ This decision adds no process-role field, independent-layout flag, user-message **A log-only close event or a manufactured dismissal message on panel close.** A log-only close hides the user's decision from the model and adds another durable mechanism. Manufacturing a reply treats hiding the panel as an answer. Panel close therefore leaves a timed question answerable. -**A dedicated late-reply Session event beside the inbox message.** The inbox splice and admitted user message already record the reply. A third event duplicates the same fact and adds another persistence type. +**A dedicated late-reply Session event beside the inbox message.** The inbox splice records the queued reply and the admitted user message records its delivery. A third event duplicates those facts and adds another persistence type. -## Acceptance criteria +## Verification -- Service tests cover claimed and unclaimed waits, last-claim disconnect, cancellation, timeout error mapping, continued-only answers, and exact answer-id validation. -- Projection tests distinguish legacy and timed schemas and cover pending, answered, other failures, resume repair, and duplicate inbox/message settlement. -- Client tests cover claim retention through Host acceptance, focus before handshake, indefinite waits, draft retention, RPC resubmission, and panel hiding/reopening. -- Grouping and browser replay cover one rendered reply with both projections retained, ordinary collapsed placement, disclosure ordering, and the original tool row's read-only late-answer panel. -- Legacy question round trips, cancellation, plan-review intent, and Session remounts retain their existing behavior. Live multi-Client delivery races and real Host restart remain integration coverage gaps beyond isolated lifecycle and projection tests. +- [Service tests](../../../../packages/interaction/user-questions/tests/user-questions.spec.ts) and [wait tests](../../../../packages/interaction/user-questions/tests/timed-wait.spec.ts) cover claimed and unclaimed waits, last-claim disconnect, cancellation, timeout error mapping, continued-only answers, and exact answer-id validation. +- [Projection tests](../../../../packages/interaction/user-questions/tests/projection.spec.ts) distinguish legacy and timed schemas and cover native and PTC pending calls, other failures, resume repair, queued reply cancellation, and admitted settlement. +- [Client listener tests](../../../../packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts) and [composer tests](../../../../packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx) cover claim retention through Host acceptance, focus before handshake, indefinite waits, draft retention, RPC resubmission, and panel actions. +- [Grouping tests](../../../../packages/client/ui-chat/tests/process-groups.client.spec.ts) and [browser replay](../../../../apps/web/tests/question-composer.e2e.ts) cover one rendered reply with both projections retained, ordinary collapsed placement, disclosure ordering, and the original tool row's read-only late-answer panel. +- Legacy round-trip, cancellation, plan-review intent, and Session-remount regressions remain covered by their owning tests. Live multi-Client delivery races and real Host restart remain integration coverage gaps beyond isolated lifecycle and projection tests. -## Risks +## Consequences + +The model can continue independent work while the question remains answerable. Business-owned timing and reply rendering reuse the existing transport and conversation APIs, at the cost of local rather than globally coordinated waiting and ordinary folded visibility. - Take time affects only one Client. Another Client can answer or expire the shared waterfall; local focus does not establish a global hold. - A terminal claim-stream failure can reject the foreground question rather than produce pending. No unattended-wait fallback is provided for that failure. - Host and Client clocks need not align, but Client system-clock changes can move expiry and transport latency can delay the local countdown's start. - The duplicate projections remain stored. Aggregation adds linear scans during structural grouping rebuilds; ordinary text-only streaming updates retain their incremental path. This is an algorithmic bound, not a measured latency claim. - Unanswered continued questions can remain after reopening a Session. Panel close records nothing, and visibility follows normal folding rather than an always-visible reply guarantee. +- A queued late reply can be canceled before the agent admits it. The question stays answerable until an admitted `user/message` records the answer. +- A PTC sub-call interrupted before its `tool/ptc-dispatch` result is recorded cannot be reconstructed from the parent `run_code` failure, so it cannot take a late answer after recovery. diff --git a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.zh.md b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.zh.md similarity index 62% rename from .agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.zh.md rename to .agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.zh.md index 7f2d42f73b..6bce5e9960 100644 --- a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-19-timed-user-question-two-settlements.zh.md @@ -1,6 +1,6 @@ # Agent Note: 计时用户提问的两次结算 -Status: proposed +Status: implemented [English](2026-09-19-timed-user-question-two-settlements.md) | 中文 @@ -10,14 +10,14 @@ Status: proposed 前台工具结果与最终回答的生命周期不同。`user-questions/request` waterfall(瀑布式事件)只结算一次;返回 pending 后仍保留它,会产生一条活过调用方的第二回答路径。倒计时、聚焦和编辑的归属也不同于持久问题状态。 -## Proposal +## Decision 前台回答继续使用现有 Remote Event waterfall。超时结束该请求并返回 pending;迟到回答通过业务 RPC steer 一条持久用户消息。接手 stream 只控制前台等待,既不传递回答,也不替代 Remote Event。 ### 模式与范围 - 默认 `mode: legacy` 保留阻塞式 schema 和 `ask()` 路径。显式 `mode: timed` 增加 `timeout`,省略时使用配置默认值 120 秒。 -- 正整数超时选择 `askTimed()`;`-1` 选择阻塞式 `ask()`。timed schema 发出的阻塞调用仍参与计时问题投影和答案查看,并不等同于 legacy 调用。 +- 正整数超时选择 `askTimed()`;`-1` 选择阻塞式 `ask()`。timed schema 发出的原生阻塞调用仍参与计时问题投影和答案查看,并不等同于 legacy 调用。 - 计划评审保留 `ask()`、`plan-review` 意图及 `BAD_INTENT` 校验。本决策不把计划评审迁移到其他包。 - 提供 Agent 时,人机交互要求它是运行时中确切的存活根实例。陈旧实例以 `CALLER_NOT_LIVE` 失败;被其他 agent 拥有的子实例以 `DELEGATED_CALLER` 失败。持久 Session 的血缘关系不妨碍恢复后的运行时根实例提问。 @@ -46,27 +46,27 @@ Client 倒计时到期以 `ASK_TIMED_OUT` 拒绝 waterfall。无人接手时,H ### 持久状态与迟到回答 -`userQuestions` 投影从现有 Session 事件重建问题状态。它通过 `request/header` 记录的 `timeout` 参数识别 timed schema,不跟踪 legacy 调用。有效的 `tool/call` 打开问题。其 `tool/result` 在 pending 或 `TOOL_OUTCOME_UNKNOWN` 时将问题标为已继续,在有效回答批次时结算并保存答案,其他结果或失败则移除问题。 +`userQuestions` 投影从现有 Session 事件重建问题状态。对原生调用,它通过 `request/header` 记录的 `timeout` 参数识别 timed schema,不跟踪 legacy 调用。有效的 `tool/call` 打开问题。其 `tool/result` 在 pending 或 `TOOL_OUTCOME_UNKNOWN` 时将问题标为已继续,在有效回答批次时结算并保存答案,其他结果或失败则移除问题。PTC 子调用在 `tool/ptc-dispatch` 结果为 pending 时进入投影,因为模型请求头只列出 `run_code`。 -已继续的问题接受 `answer(agent, callId, answer)`。未知或非已继续调用返回 `false`;回答批次没有恰好包含每个问题一次时抛出 `BAD_ANSWER`。接受的回答通过 `agent.steer(createUserMessage(...))` 送入 agent,来源为 `{ kind: 'user-question-reply', callId, outcome: 'answered' }`,JSON 文本包含 `answer_to_pending_question`、调用 id、原问题及答案。Remote 根据 Session id 解析 Agent 时按需恢复根实例;恢复操作不属于 `answer()` 方法体。 +已继续的问题接受 `answer(agent, callId, answer)`。未知或非已继续调用返回 `false`;另一条回复等待准入时抛出 `REPLY_QUEUED`;回答批次没有恰好包含每个问题一次时抛出 `BAD_ANSWER`。接受的回答通过 `agent.steer(createUserMessage(...))` 送入 agent,来源为 `{ kind: 'user-question-reply', callId, outcome: 'answered' }`,JSON 文本包含 `answer_to_pending_question`、调用 id、原问题及答案。Remote 根据 Session id 解析 Agent 时按需恢复根实例;恢复操作不属于 `answer()` 方法体。 -inbox 消息就是持久回复。`agent/inbox/spliced` 在消息入队时结算问题;随后接纳的 `user/message` 对该结算是幂等的。已结算答案批次保留在投影中,让原工具行即使自身结果仍是 pending,也能显示迟到回答。无法使用的已记录回复文本以空答案批次结算。 +inbox 消息是持久的排队回复。逐 Session 预约覆盖从排队、领取到准入的期间;领取恢复后的 inbox 回复时会重建预约。回复作为 `user/message` 准入时问题结算;丢弃回复或 Turn 结束而未准入时释放预约,允许再次回答。已结算答案批次保留在投影中,让原工具行即使自身结果仍是 pending,也能显示迟到回答。无法使用的已记录回复文本以空答案批次结算。 -无需新增 Session 事件类型或等待状态日志。消息来源扩展需要仓库的持久化类型变更确认。`dismissed` 为历史记录保留可读性,但没有生产者:隐藏面板不会伪造回复。 +无需新增 Session 事件类型或等待状态日志。消息来源扩展需要仓库的持久化类型变更确认。隐藏面板不会伪造回复。 ### 卡片状态与投递竞争 -`QuestionCards` 按 Session 和 `callId`,让实时请求与已继续投影共享一个 `PendingQuestion`。没有调用 id 的阻塞请求拥有独立的逐请求卡片。开放卡片通过 waterfall 提交;缺少该通道时禁用提交。已继续卡片使用迟到回答 RPC。 +`QuestionCards` 按 Session 和 `callId`,让实时请求与已继续投影共享一个 `PendingQuestion`。转发请求在投影列出问题之前,仍会让卡片存活至接手 stream 的首帧。没有调用 id 的阻塞请求拥有独立的逐请求卡片,并使用跨重载唯一的键,避免旧草稿附着到另一请求。开放卡片通过 waterfall 提交;缺少该通道时禁用提交。已继续卡片使用迟到回答 RPC。 -waterfall 提交没有送达确认。Gateway 可能丢弃输掉结算竞争的结果,因此卡片保留草稿并保持忙碌,等待投影同步。若提交期间问题变为已继续,控件带重提提示重新可用,用户可以通过 RPC 提交保留的草稿。这不是自动重试,也不保证每次本地提交都能到达模型。 +waterfall 提交没有送达确认。Gateway 可能丢弃输掉结算竞争的结果,因此卡片保留草稿并保持忙碌,等待投影同步。若提交期间问题变为已继续,控件带重提提示重新可用,用户可以通过 RPC 提交保留的草稿。RPC 接受提交后会将回复作为 steer 送往最近一步,但不会立即结算问题,同时关闭面板。当前工具等待须先结束,该步才能读取回复;若 steer 被丢弃,可以重新打开问题并再次回答。这不是自动重试,也不保证每次本地提交都能到达模型。 -按工具调用标识的卡片在调用不属于活动投影且没有 waterfall 时移除。移除会关闭卡片并清理草稿。本地提交和传输取消帧都不能单独决定问题已经回答。无调用标识的阻塞卡片随 waterfall 结束;关闭这种阻塞面板以 `ASK_CANCELLED` 拒绝请求。 +按工具调用标识的卡片在调用不属于活动投影且没有转发中的请求时移除。移除会关闭卡片并清理草稿。本地提交和传输取消帧都不能单独决定问题已经回答。无调用标识的阻塞卡片随 waterfall 结束;关闭这种阻塞面板以 `ASK_CANCELLED` 拒绝请求。 ### 本地倒计时与面板操作 Client 计算 `Date.now() + remainingMs`。手动聚焦未编辑的回答区会暂停倒计时,失焦后从保留的剩余时间继续。接手握手前的聚焦在 deadline 到达时仍生效;握手前失焦不会制造计时器。首次编辑或「慢慢回答」冻结倒计时,该状态与浏览器本地草稿一起保存。 -只有回答通道就绪、没有活动倒计时且卡片未锁定时才自动聚焦。隐藏计时调用的面板会保留接手和倒计时,工具行可以重新打开面板。已结算调用依据记录的问题与答案打开只读面板,不产生另一条回答通道。 +只有回答通道就绪、没有活动倒计时且卡片未锁定时才自动聚焦。隐藏计时调用的面板会保留接手和倒计时,工具行可以重新打开面板。迟到回复进入 Inbox 后,工具行显示已提交的答案;等待准入期间,「查看回答」展开只读的行内记录。已结算调用打开只读面板,显示记录的答案。排队回复被丢弃后,回答操作恢复可用。 ### 回复节点与分组 @@ -86,7 +86,7 @@ Client 计算 `Date.now() + remainingMs`。手动聚焦未编辑的回答区会 **立即委托所有计时请求。** 向故意留空的回答方集合派发请求,浪费现有阻塞回答路径,还要求特殊处理 `NO_PROVIDER`。委托表示回答方不可用,不代表计时模式本身。 -**持久化整值等待/聚焦/编辑流,或使用 Host 聚焦租约。** 持久问题状态可从工具与 inbox 事件推导。聚焦和编辑属于本地 UI 状态;记录它们或同步聚焦租约会增加 Host 状态,却不能让多个 Client 共享同一编辑会话。 +**持久化整值等待/聚焦/编辑流,或使用 Host 聚焦租约。** 持久问题状态可从工具事件与已准入的用户事件推导。聚焦和编辑属于本地 UI 状态;记录它们或同步聚焦租约会增加 Host 状态,却不能让多个 Client 共享同一编辑会话。 **在通用 `MessageItem` 内重新分类 JSON、借用 relay form,或使用默认 context 行。** 解析文本来识别业务消息混淆了来源与内容;relay form 表示其他 agent 的消息,通用 context 行则会暴露 JSON。专用来源、Definition 和渲染器拥有问题呈现。 @@ -94,20 +94,24 @@ Client 计算 `Date.now() + remainingMs`。手动聚焦未编辑的回答区会 **面板关闭时写仅入日志的关闭事件,或伪造放弃消息。** 仅入日志会让模型看不到用户决定,还增加另一套持久机制。伪造回复则把隐藏面板当成回答。因此关闭面板仍让计时问题保持可回答。 -**在 inbox 消息之外增加专用迟到回复 Session 事件。** inbox 插入与接纳的用户消息已经记录回复。第三个事件重复同一事实,并增加另一种持久化类型。 +**在 inbox 消息之外增加专用迟到回复 Session 事件。** inbox 插入记录排队回复,准入的用户消息记录其交付。第三个事件重复这些事实,并增加另一种持久化类型。 -## Acceptance criteria +## 验证 -- 服务测试覆盖有人与无人接手、最后接手方断开、取消、超时错误映射、仅接受已继续问题的回答,以及答案 id 的精确校验。 -- 投影测试区分 legacy 与 timed schema,并覆盖 pending、已回答、其他失败、恢复修复及 inbox/消息重复结算。 -- Client 测试覆盖接手保留到 Host 接受结果、握手前聚焦、无限期等待、草稿保留、RPC 重提及面板隐藏/重开。 -- 分组与浏览器回放覆盖保留两个投影但只渲染一次回复、普通折叠位置、折叠控件顺序,以及原工具行的迟到答案只读面板。 -- legacy 问答往返、取消、计划评审意图及 Session 重新挂载保留既有行为。真实多 Client 投递竞争与真实 Host 重启仍是独立生命周期和投影测试之外的集成覆盖缺口。 +- [服务测试](../../../../packages/interaction/user-questions/tests/user-questions.spec.ts)与[等待测试](../../../../packages/interaction/user-questions/tests/timed-wait.spec.ts)覆盖有人与无人接手、最后接手方断开、取消、超时错误映射、仅接受已继续问题的回答,以及答案 id 的精确校验。 +- [投影测试](../../../../packages/interaction/user-questions/tests/projection.spec.ts)区分 legacy 与 timed schema,并覆盖原生及 PTC pending 调用、其他失败、恢复修复、排队回复取消和准入后结算。 +- [Client 监听器测试](../../../../packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts)与[composer 测试](../../../../packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx)覆盖接手保留到 Host 接受结果、握手前聚焦、无限期等待、草稿保留、RPC 重提及面板操作。 +- [分组测试](../../../../packages/client/ui-chat/tests/process-groups.client.spec.ts)与[浏览器回放](../../../../apps/web/tests/question-composer.e2e.ts)覆盖保留两个投影但只渲染一次回复、普通折叠位置、折叠控件顺序,以及原工具行的迟到答案只读面板。 +- legacy 问答往返、取消、计划评审意图及 Session 重新挂载的回归仍由各自测试覆盖。真实多 Client 投递竞争与真实 Host 重启仍是独立生命周期和投影测试之外的集成覆盖缺口。 -## Risks +## Consequences + +模型可以继续独立工作,问题同时保持可回答。业务层拥有的计时与回复渲染复用现有传输和对话 API,代价是等待由本地而非全局协调,可见性遵循普通折叠。 - 「慢慢回答」只影响一个 Client。其他 Client 可以回答或让共享 waterfall 到期,本地聚焦不构成全局暂停。 - 接手 stream 的终止性失败可能让前台问题失败,而不是产生 pending。不为该失败提供无人接手等待的 fallback。 - Host 与 Client 时钟不必对齐,但 Client 系统时钟变化可能移动到期时间,传输延迟可能推迟本地倒计时的开始。 - 重复投影仍保留在存储中。聚合在结构性分组重建时增加线性扫描;普通纯文本 stream 更新保留增量路径。这是算法复杂度界限,不是实测延迟结论。 - 无人回答的已继续问题可以在重新打开 Session 后继续存在。关闭面板不写记录,可见性遵循普通折叠,而不是保证回复始终可见。 +- 排队的迟到回复可能在 agent 准入前被取消。只有已准入的 `user/message` 记录答案,问题在此之前保持可回答。 +- PTC 子调用若在记录 `tool/ptc-dispatch` 结果前中断,无法从父 `run_code` 的失败中重建,因此恢复后不能接受迟到回答。 diff --git a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml b/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml deleted file mode 100644 index 737e671e9a..0000000000 --- a/.agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.i18n.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Bilingual-pair consistency record for 2026-09-19-timed-user-question-two-settlements.md (docs/i18n/README.md): per heading -# section, a hash of its English and Chinese blocks outside code blocks and generated regions. -# After editing either side, bring the other along and re-record with: -# pnpm run verify-translation-pairing --write .agents/notes/proposed/architecture/2026-09-19-timed-user-question-two-settlements.md -/agent-note-timed-user-questions-as-two-settlements: - en: 15c55d3b120b8fd4 - zh: 6b86ac34f4a1e9cd -/agent-note-timed-user-questions-as-two-settlements/problem: - en: f665127a9b5b8225 - zh: b19845f62310f3a2 -/agent-note-timed-user-questions-as-two-settlements/proposal: - en: 56ca8c0f97976358 - zh: 69163bb5f064e069 -/agent-note-timed-user-questions-as-two-settlements/proposal/modes-and-scope: - en: d23e622ee4643b48 - zh: 3732c10c12344755 -/agent-note-timed-user-questions-as-two-settlements/proposal/ownership: - en: 0543678ad9d26fc5 - zh: aa6ba207e661c567 -/agent-note-timed-user-questions-as-two-settlements/proposal/foreground-wait-and-claim-lifetime: - en: 447713bbdf1ab4d8 - zh: 2757678ae47822aa -/agent-note-timed-user-questions-as-two-settlements/proposal/durable-state-and-late-answers: - en: b8729d06ab7814ed - zh: acaa8f4174701248 -/agent-note-timed-user-questions-as-two-settlements/proposal/card-state-and-delivery-races: - en: 8c55b693e7a5bca4 - zh: aea6e966ce3667e3 -/agent-note-timed-user-questions-as-two-settlements/proposal/local-countdown-and-panel-actions: - en: 4c0c9ec59fc51217 - zh: 322870eeb49176c7 -/agent-note-timed-user-questions-as-two-settlements/proposal/reply-node-and-grouping: - en: 10323b0e0340a40b - zh: a17fc3a4d4d820a7 -/agent-note-timed-user-questions-as-two-settlements/alternatives-considered: - en: ce8ff9d5bc4b85b7 - zh: 49024fe3a5b194b2 -/agent-note-timed-user-questions-as-two-settlements/acceptance-criteria: - en: 5a993484c73befe9 - zh: 38cd3209c68178c3 -/agent-note-timed-user-questions-as-two-settlements/risks: - en: aae260b0cd95554f - zh: 3d7fbd6cbe9e2d37 diff --git a/apps/web/tests/question-composer.e2e.ts b/apps/web/tests/question-composer.e2e.ts index 09dc3cc1ad..eda964da3e 100644 --- a/apps/web/tests/question-composer.e2e.ts +++ b/apps/web/tests/question-composer.e2e.ts @@ -15,6 +15,7 @@ import { chromium } from 'playwright' import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest' import type { SessionEvent } from '@deepseek-ai/dsh-session' import type { SessionId } from '@deepseek-ai/dsh-session/types' +import { TIMED_WAIT_PARAMETER } from '@deepseek-ai/dsh-user-questions' import { assertFixtureInventory, captureStableAria, compareOrRefreshGolden, fixtureUserPrompts, launchWebScaffold, recordFixture, seedSession, watchConsole, webSnapshotMode, type WebScaffold, @@ -33,8 +34,14 @@ const COMPOSED_EXPECTED = join(SNAPSHOT_DIR, 'composed.expected.md') const ANSWERED_EXPECTED = join(SNAPSHOT_DIR, 'answered.expected.md') const CANCELLED_EXPECTED = join(SNAPSHOT_DIR, 'cancelled.expected.md') const ANSWERED_EXPANDED_EXPECTED = join(SNAPSHOT_DIR, 'answered-expanded.expected.md') +// The timed tool's second settlement: the wait expired, and the answer arrived +// afterwards. Its golden owns the state the reported symptom lands in. +const LATE_ANSWERED_EXPECTED = join(SNAPSHOT_DIR, 'late-answered.expected.md') +const QUEUED_EXPECTED = join(SNAPSHOT_DIR, 'queued.expected.md') const MODE = webSnapshotMode() const CANCELLED_SEED_ID = 'ask-question-cancelled-row-web-e2e' +const LATE_ANSWERED_SEED_ID = 'ask-question-late-answered-row-web-e2e' +const QUEUED_SEED_ID = 'ask-question-queued-row-web-e2e' // The composer's own growth cap, in text lines (QuestionComposer.module.css // .fieldMirror). Asserted as TEXT lines, not as a box height: the two variants @@ -70,8 +77,100 @@ function isRecord(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value) } -/** Replace the successful Tool settlement and omit the answer-dependent model step. */ -function cancelledFixture(fixture: string): string { +/** The batch the derived late reply submits, distinct from the in-time answer. */ +const LATE_ANSWERS = [{ id: 'color', selected: ['Green'], custom: 'Answered after the timeout' }] + +/** + * The `ask_user_question` schema as the timed tool declares it, in the shape a + * request header records. A late reply can only follow a timed call, and the + * `userQuestions` projection tells a timed call from a legacy one by exactly + * this schema in the header in effect; the recorded fixture's header carries + * the placeholder token of a legacy recording, so the derived fixture must + * carry the timed schema for its call to be tracked at all. + */ +const TIMED_ASK_USER_QUESTION_SCHEMA = { + name: 'ask_user_question', + description: 'Ask brief, direct, self-contained questions about missing information, preferences, or decisions.', + parameters: { + type: 'object', + properties: { + questions: { type: 'array', items: { type: 'object' } }, + [TIMED_WAIT_PARAMETER]: { type: 'integer' }, + }, + required: ['questions'], + }, +} + +/** + * What the timed tool records when its foreground wait expires. Both readers of + * a recorded result take `pending` and `callId` out of this one JSON object — + * the `userQuestions` projection to keep the call answerable, the question row + * to tell a timeout from an answer batch; the `message` is the model's own + * continuation instruction and no reader parses it. + * @param callId - the call whose questions stay answerable. + * @returns the recorded result text. + */ +function pendingResultText(callId: string): string { + return JSON.stringify({ + pending: true, + callId, + message: 'No answer batch arrived before the timeout. This is pending, not a skipped answer.', + }) +} + +/** + * The message a late answer lands as: the timed question's `callId` names it, + * and it carries both the questions it answers and the batch itself. + * @param callId - the call the reply settles. + * @param questions - the call's questions, echoed from its recorded arguments. + * @returns the reply, as the inbox splice and the durable message both record it. + */ +function lateReplyMessage(callId: string, questions: unknown): Record { + return { + content: [{ + type: 'text', + text: JSON.stringify({ + kind: 'answer_to_pending_question', tool: 'ask_user_question', callId, questions, answers: LATE_ANSWERS, + }), + }], + source: { kind: 'user-question-reply', callId, outcome: 'answered' }, + role: 'user', + id: '{{message:7}}', + } +} + +/** + * The turn a late reply opens: the reply enters the agent inbox, the next turn + * claims it, and it lands as this Session's durable user message. + * @param callId - the call the reply settles. + * @param questions - the call's questions, echoed from its recorded arguments. + * @returns the appended fixture lines, ending in the closing `turn/end`. + */ +function lateReplyTail(callId: string, questions: unknown): string[] { + const message = lateReplyMessage(callId, questions) + return [ + { type: 'agent/inbox/spliced', data: { target: 'next-turn', start: 0, inserted: [message] } }, + { type: 'turn/start', data: { turn: 2 } }, + { type: 'agent/inbox/spliced', data: { target: 'next-turn', start: 0, removedCount: 1, inserted: [] } }, + { type: 'step/start', data: { turn: 2, step: 1 } }, + { type: 'user/message', data: message, surfaceOp: 'append' }, + { type: 'step/end', data: { turn: 2, step: 1 } }, + { type: 'turn/end', data: { turn: 2, reason: { kind: 'completed' } } }, + ].map(event => JSON.stringify(event)) +} + +/** + * Derive one settlement other than the recorded answer batch. The model step + * that follows the Tool settlement reads the answer, so every derivation drops + * it and keeps the recorded turn closed. + * @param fixture - the recorded round trip. + * @param outcome - `cancelled` settles the call as the user's own dismissal; + * `queued` and `late-answered` settle the expired wait and append its reply + * before or after the next turn admits it. + * @returns the derived fixture text. + */ +function resettledFixture(fixture: string, outcome: 'cancelled' | 'queued' | 'late-answered'): string { + let asked: { callId: string; questions: unknown } | undefined let replaced = false const lines: string[] = [] for (const line of fixture.trimEnd().split('\n')) { @@ -90,6 +189,26 @@ function cancelledFixture(fixture: string): string { || event.type === 'turn/end') lines.push(line) continue } + if (event.type === 'request/header' && outcome !== 'cancelled') { + // The recording was made under the blocking legacy tool; the derived + // timed settlement needs the header that tool's timed sibling records. + const data = event.data + if (!isRecord(data) || !isRecord(data.header)) throw new Error('question fixture request/header is invalid') + data.header.tools = [TIMED_ASK_USER_QUESTION_SCHEMA] + lines.push(JSON.stringify(event)) + continue + } + if (event.type === 'tool/call') { + const data = event.data + if (!isRecord(data) || typeof data.callId !== 'string' || typeof data.arguments !== 'string') { + throw new Error('question fixture tool/call is invalid') + } + const args: unknown = JSON.parse(data.arguments) + if (!isRecord(args)) throw new Error('question fixture tool/call arguments are invalid') + asked = { callId: data.callId, questions: args.questions } + lines.push(line) + continue + } if (event.type !== 'tool/result') { lines.push(line) continue @@ -100,20 +219,70 @@ function cancelledFixture(fixture: string): string { if (!isRecord(message) || !Array.isArray(message.content) || !isRecord(message.content[0])) { throw new Error('question fixture tool/result message is invalid') } - message.content[0].content = [{ - type: 'text', - text: 'Error: the user cancelled ask_user_question', - }] - message.content[0].isError = true - data.error = { - name: 'UserQuestionError', - code: 'ASK_CANCELLED', + if (asked === undefined) throw new Error('question fixture settles a call it never made') + if (outcome === 'cancelled') { + message.content[0].content = [{ + type: 'text', + text: 'Error: the user cancelled ask_user_question', + }] + message.content[0].isError = true + data.error = { + name: 'UserQuestionError', + code: 'ASK_CANCELLED', + } + } else { + message.content[0].content = [{ type: 'text', text: pendingResultText(asked.callId) }] } replaced = true lines.push(JSON.stringify(event)) } - if (!replaced) throw new Error('question fixture has no tool/result event') - return `${lines.join('\n')}\n` + if (!replaced || asked === undefined) throw new Error('question fixture has no settled ask_user_question call') + if (outcome === 'queued') { + const end = lines.pop() + const final: unknown = end === undefined ? undefined : JSON.parse(end) + if (!isRecord(final) || final.type !== 'turn/end') throw new Error('question fixture does not end its first turn') + return `${[...lines, lateReplyTail(asked.callId, asked.questions)[0], end].join('\n')}\n` + } + const tail = outcome === 'cancelled' ? [] : lateReplyTail(asked.callId, asked.questions) + return `${[...lines, ...tail].join('\n')}\n` +} + +/** One derived transcript, seeded into its own scaffold and opened in the browser. */ +interface SeededTranscript { + readonly scaffold: WebScaffold + readonly browser: Browser + readonly page: Page + readonly tripwire: ReturnType +} + +/** + * Seed one derived fixture and open its Session in a fresh browser. + * @param fixtureText - the derived fixture to persist. + * @param seedId - the seeded Session id, which its golden tokenizes. + * @returns the scaffold, browser, page, and console tripwire teardown closes. + */ +async function openSeededTranscript(fixtureText: string, seedId: string): Promise { + const scaffold = await launchWebScaffold({}) + let browser: Browser | undefined + try { + await seedSession(scaffold, fixtureText, seedId) + browser = await chromium.launch() + const page = await newEnglishPage(browser) + const tripwire = watchConsole(page) + await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) + await page.waitForSelector('[class*="frame"]', { timeout: 30_000 }) + + const groupRow = page.locator('[role="treeitem"]').first() + await groupRow.waitFor({ timeout: 15_000 }) + await groupRow.click() + const sessionRow = page.locator('[role="treeitem"]').nth(1) + await sessionRow.waitFor({ timeout: 10_000 }) + await sessionRow.click() + return { scaffold, browser, page, tripwire } + } catch (error) { + await Promise.allSettled([browser?.close(), scaffold.close()]) + throw error + } } describe('web e2e: resident question composer round trip', () => { @@ -252,6 +421,15 @@ describe('web e2e: resident question composer round trip', () => { expect(await blue.getAttribute('aria-checked')).toBe('true') expect(await custom.inputValue()).toBe('Include accessibility notes') if (MODE !== 'record') { + // Replay only, like the measurements above: record mode must reach the + // recording write. This fixture composes the shipped legacy tool, whose + // request carries no call id and whose row offers no pill: the projection + // never lists a legacy call, so the transcript reads exactly as it did + // before timed questions existed. Reopening a hidden panel belongs to the + // timed tool; the late-answered scenario below and the ui-user-questions + // unit specs cover it. + expect(await page.getByRole('button', { name: 'Answer', exact: true }).count()).toBe(0) + // A strict Session-slot switch remounts the composer. Open a fresh blank // Session, then return to the still-waiting request and require its // Session-scoped store to restore both option and free-text drafts. @@ -302,12 +480,15 @@ describe('web e2e: resident question composer round trip', () => { // Keep the ask_user_question card's readable answer in the expanded golden // even though Compact mode hides the process by default. await expandTurnProcesses(page) + // A legacy call's answered row carries no pill and no read-only panel; its + // accessible name is the bare summary, as before timed questions existed. const answeredRow = page.getByRole('button', { name: 'Ask question 1/1 answered', exact: true }) await answeredRow.click() await page.getByText('Which color do you prefer?', { exact: true }).waitFor({ timeout: 10_000 }) expect(await page.getByText('Blue', { exact: true }).count()).toBeGreaterThanOrEqual(1) expect(await page.getByText('Include accessibility notes', { exact: true }).count()).toBe(1) expect(await page.getByText(/"answers"/).count()).toBe(0) + expect(await page.getByRole('button', { name: 'View answers', exact: true }).count()).toBe(0) const expanded = await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd) await compareOrRefreshGolden(ANSWERED_EXPANDED_EXPECTED, expanded, MODE) expect(tripwire.pageErrors).toEqual([]) @@ -358,38 +539,22 @@ describe('web e2e: resident question composer round trip', () => { }) describe.skipIf(MODE === 'record')('web e2e: cancelled question transcript', () => { - let cancelledScaffold: WebScaffold - let cancelledBrowser: Browser - let cancelledPage: Page - let cancelledTripwire: ReturnType + let seeded: SeededTranscript beforeAll(async () => { - cancelledScaffold = await launchWebScaffold({}) - await seedSession( - cancelledScaffold, - cancelledFixture(await readFile(FIXTURE, 'utf8')), + seeded = await openSeededTranscript( + resettledFixture(await readFile(FIXTURE, 'utf8'), 'cancelled'), CANCELLED_SEED_ID, ) - cancelledBrowser = await chromium.launch() - cancelledPage = await newEnglishPage(cancelledBrowser) - cancelledTripwire = watchConsole(cancelledPage) - await cancelledPage.goto(cancelledScaffold.authenticatedUrl, { waitUntil: 'load' }) - await cancelledPage.waitForSelector('[class*="frame"]', { timeout: 30_000 }) - - const groupRow = cancelledPage.locator('[role="treeitem"]').first() - await groupRow.waitFor({ timeout: 15_000 }) - await groupRow.click() - const sessionRow = cancelledPage.locator('[role="treeitem"]').nth(1) - await sessionRow.waitFor({ timeout: 10_000 }) - await sessionRow.click() }, 120_000) afterAll(async () => { - await cancelledBrowser?.close() - await cancelledScaffold?.close() + await seeded?.browser.close() + await seeded?.scaffold.close() }) it('expands to the cancellation verdict and original questions', async () => { + const { page: cancelledPage, scaffold, tripwire } = seeded onTestFailed(() => saveFailureShot(cancelledPage, 'web-e2e-question-cancelled-row')) await expandTurnProcesses(cancelledPage) const row = cancelledPage.getByRole('button', { name: 'Ask question cancelled', exact: true }) @@ -407,11 +572,118 @@ describe.skipIf(MODE === 'record')('web e2e: cancelled question transcript', () const snapshot = (await captureStableAria( cancelledPage, '[class*="centerCol"]', - cancelledScaffold.workspaceCwd, + scaffold.workspaceCwd, )).split(CANCELLED_SEED_ID).join('{{seededId}}') await compareOrRefreshGolden(CANCELLED_EXPECTED, snapshot, MODE) - expect(cancelledTripwire.pageErrors).toEqual([]) - expect(cancelledTripwire.warnings).toEqual([]) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) + }, 60_000) +}) + +describe.skipIf(MODE === 'record')('web e2e: queued question reply', () => { + let seeded: SeededTranscript + + beforeAll(async () => { + seeded = await openSeededTranscript( + resettledFixture(await readFile(FIXTURE, 'utf8'), 'queued'), + QUEUED_SEED_ID, + ) + }, 120_000) + + afterAll(async () => { + await seeded?.browser.close() + await seeded?.scaffold.close() + }) + + it('keeps a submitted reply read-only across a browser reload', async () => { + const { page, scaffold, tripwire } = seeded + onTestFailed(() => saveFailureShot(page, 'web-e2e-question-queued-row')) + await expandTurnProcesses(page) + const row = page.locator('[data-tool="ask_user_question"]') + await row.waitFor() + await page.getByRole('button', { name: 'View answers', exact: true }).waitFor() + expect(await page.locator('[data-question-key]').count()).toBe(0) + + await page.reload({ waitUntil: 'load' }) + await expandTurnProcesses(page) + await row.waitFor() + await page.getByRole('button', { name: 'View answers', exact: true }).waitFor() + expect(await page.locator('[data-question-key]').count()).toBe(0) + await page.getByRole('button', { name: 'View answers', exact: true }).click() + await page.getByText('Answered after the timeout', { exact: true }).waitFor() + + const snapshot = (await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd)) + .split(QUEUED_SEED_ID).join('{{seededId}}') + await compareOrRefreshGolden(QUEUED_EXPECTED, snapshot, MODE) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) + }, 60_000) +}) + +// The timed tool's own second settlement. The recorded result is the expired +// wait, so the answers live in the reply that landed a turn later and reach the +// row only through the `userQuestions` projection — the whole chain the reported +// symptom broke on, where an answered question kept no way back to its answers. +describe.skipIf(MODE === 'record')('web e2e: late-answered question transcript', () => { + let seeded: SeededTranscript + + beforeAll(async () => { + seeded = await openSeededTranscript( + resettledFixture(await readFile(FIXTURE, 'utf8'), 'late-answered'), + LATE_ANSWERED_SEED_ID, + ) + }, 120_000) + + afterAll(async () => { + await seeded?.browser.close() + await seeded?.scaffold.close() + }) + + it('reads a late answer as an answered question and reopens its answers', async () => { + const { page: latePage, scaffold, tripwire } = seeded + onTestFailed(() => saveFailureShot(latePage, 'web-e2e-question-late-answered-row')) + const reply = latePage.locator('[data-question-reply]') + await reply.waitFor({ state: 'attached', timeout: 15_000 }) + expect(await reply.count()).toBe(1) + expect(await latePage.locator('[data-chat-flow-kind="turn-trigger"]').count()).toBe(0) + expect(await reply.isVisible()).toBe(false) + // Whether the answer beat the timeout is the agent's pacing, not something + // a reader of the row has to reason about. + await expandTurnProcesses(latePage) + await reply.waitFor({ state: 'visible', timeout: 15_000 }) + const row = latePage.locator('[data-tool="ask_user_question"]') + await row.waitFor({ timeout: 15_000 }) + await row.getByRole('button', { name: 'Ask question', exact: true }).click() + await latePage.getByText('Which color do you prefer?', { exact: true }).waitFor({ timeout: 10_000 }) + expect(await latePage.getByText('Green', { exact: true }).count()).toBeGreaterThanOrEqual(1) + expect(await latePage.getByText('Answered after the timeout', { exact: true }).count()).toBeGreaterThanOrEqual(1) + // The recorded timeout is the row's state, never its transcript copy. + expect(await latePage.getByText(/"pending"/).count()).toBe(0) + + // The same read-only panel an in-time answer reopens, over the answers the + // late reply carried. + await latePage.getByRole('button', { name: 'View answers', exact: true }).click() + const review = latePage.locator('[data-question-key]') + await review.waitFor({ timeout: 10_000 }) + await review.getByText('Answered', { exact: true }).waitFor({ timeout: 10_000 }) + const recorded = review.getByRole('checkbox', { name: 'Green' }) + expect(await recorded.getAttribute('aria-checked')).toBe('true') + expect(await recorded.isDisabled()).toBe(true) + expect(await review.getByRole('checkbox', { name: 'Blue' }).getAttribute('aria-checked')).toBe('false') + const recordedCustom = review.getByRole('textbox') + expect(await recordedCustom.inputValue()).toBe('Answered after the timeout') + expect(await recordedCustom.isDisabled()).toBe(true) + expect(await review.getByRole('button', { name: 'Submit' }).count()).toBe(0) + expect(await review.getByRole('button', { name: 'Skip' }).count()).toBe(0) + + const snapshot = (await captureStableAria( + latePage, + '[class*="centerCol"]', + scaffold.workspaceCwd, + )).split(LATE_ANSWERED_SEED_ID).join('{{seededId}}') + await compareOrRefreshGolden(LATE_ANSWERED_EXPECTED, snapshot, MODE) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) }, 60_000) it('keeps the fixture inventory closed', async () => { @@ -423,6 +695,8 @@ describe.skipIf(MODE === 'record')('web e2e: cancelled question transcript', () 'answered.expected.md', 'cancelled.expected.md', 'answered-expanded.expected.md', + 'late-answered.expected.md', + 'queued.expected.md', ]) }) }) diff --git a/docs/config-catalog.md b/docs/config-catalog.md index 162fff2e57..aeb6975be9 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -3455,6 +3455,25 @@ export type TokenMeterConfig = Record ``` + + + +## `@deepseek-ai/dsh-tool-ask-user` + +- `inject`: `tools` · `userQuestions` +- `source`: [`packages/interaction/tool-ask-user/src/index.ts:16`](../packages/interaction/tool-ask-user/src/index.ts) + +```ts config-catalog +/** Cordis row selecting the tool schema and its default foreground wait. */ +export interface Config { + /** Tool definition selected by this Cordis row. Defaults to the blocking legacy tool. */ + mode?: 'legacy' | 'timed' + /** Foreground wait before automatic continuation. Defaults to 120 seconds. */ + timeout?: number +} +``` + + @@ -4399,7 +4418,6 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co | `@deepseek-ai/dsh-subprocess-local` | — | [`packages/subprocess/subprocess-local/src/index.ts`](../packages/subprocess/subprocess-local/src/index.ts) | | `@deepseek-ai/dsh-subprocess-ssh` | `ssh` | [`packages/ssh/subprocess-ssh/src/index.ts`](../packages/ssh/subprocess-ssh/src/index.ts) | | `@deepseek-ai/dsh-terminal` | — | [`packages/terminal/terminal/src/index.ts`](../packages/terminal/terminal/src/index.ts) | -| `@deepseek-ai/dsh-tool-ask-user` | `tools` · `userQuestions` | [`packages/interaction/tool-ask-user/src/index.ts`](../packages/interaction/tool-ask-user/src/index.ts) | | `@deepseek-ai/dsh-tool-call-timeout-policy` | `tools` | [`packages/guard/timeout-policy/src/index.ts`](../packages/guard/timeout-policy/src/index.ts) | | `@deepseek-ai/dsh-tool-cordis` | `tools` · `cordisInspect` | [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts) | | `@deepseek-ai/dsh-tool-subagent-control` | `tools` · `subagents` | [`packages/subagent/tool-subagent-control/src/index.ts`](../packages/subagent/tool-subagent-control/src/index.ts) | diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index 72bab78412..13218e1684 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -3457,6 +3457,25 @@ export type TokenMeterConfig = Record ``` + + + +## `@deepseek-ai/dsh-tool-ask-user` + +- `inject`: `tools` · `userQuestions` +- `source`: [`packages/interaction/tool-ask-user/src/index.ts:16`](../packages/interaction/tool-ask-user/src/index.ts) + +```ts config-catalog +/** Cordis row selecting the tool schema and its default foreground wait. */ +export interface Config { + /** Tool definition selected by this Cordis row. Defaults to the blocking legacy tool. */ + mode?: 'legacy' | 'timed' + /** Foreground wait before automatic continuation. Defaults to 120 seconds. */ + timeout?: number +} +``` + + @@ -4401,7 +4420,6 @@ export interface Config { | `@deepseek-ai/dsh-subprocess-local` | — | [`packages/subprocess/subprocess-local/src/index.ts`](../packages/subprocess/subprocess-local/src/index.ts) | | `@deepseek-ai/dsh-subprocess-ssh` | `ssh` | [`packages/ssh/subprocess-ssh/src/index.ts`](../packages/ssh/subprocess-ssh/src/index.ts) | | `@deepseek-ai/dsh-terminal` | — | [`packages/terminal/terminal/src/index.ts`](../packages/terminal/terminal/src/index.ts) | -| `@deepseek-ai/dsh-tool-ask-user` | `tools` · `userQuestions` | [`packages/interaction/tool-ask-user/src/index.ts`](../packages/interaction/tool-ask-user/src/index.ts) | | `@deepseek-ai/dsh-tool-call-timeout-policy` | `tools` | [`packages/guard/timeout-policy/src/index.ts`](../packages/guard/timeout-policy/src/index.ts) | | `@deepseek-ai/dsh-tool-cordis` | `tools` · `cordisInspect` | [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts) | | `@deepseek-ai/dsh-tool-subagent-control` | `tools` · `subagents` | [`packages/subagent/tool-subagent-control/src/index.ts`](../packages/subagent/tool-subagent-control/src/index.ts) | diff --git a/docs/event-producer-consumer.md b/docs/event-producer-consumer.md index 4385771ec8..9af81e3523 100644 --- a/docs/event-producer-consumer.md +++ b/docs/event-producer-consumer.md @@ -14,8 +14,8 @@ This matrix shows which packages dispatch each harness-owned event and which pac | `agent/created` | `serial` | [`packages/core/agent/src/runtime-types.ts:261`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`serial`) | `agent-team`, `browser-use-runtime`, [`file-reference-local`](../packages/context/file-reference-local), [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`loader-smoke`](../packages/test-support/loader-smoke), [`schedule`](../packages/schedule/schedule), `session-controller`, `tool-agent-team`, [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:270`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`schedule`](../packages/schedule/schedule), `session-controller`, [`subagent`](../packages/subagent/subagent), `tool-agent-team`, [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:393`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`deepseek-account`](../packages/credentials/deepseek-account), [`goal-round-driver`](../packages/goal/goal-round-driver), `session-controller`, [`session-telemetry`](../packages/session/session-telemetry) | -| `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:299`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs) | -| `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:307`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent) | +| `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:299`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`user-questions`](../packages/interaction/user-questions) | +| `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:307`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/inserted` | `emit` | [`packages/core/agent/src/runtime-types.ts:288`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver) | | `agent/pre-step` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:320`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`agent`](../packages/core/agent), [`agent-instructions`](../packages/context/agent-instructions), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`plan-mode`](../packages/plan/plan-mode), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), `session-controller`, [`session-reference`](../packages/context/session-reference), [`subagent-in-process-driver`](../packages/subagent/subagent-in-process-driver), [`time-context`](../packages/context/time-context), [`tmux-context`](../packages/context/tmux-context), [`tool-skill`](../packages/skill/tool-skill), [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/request` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:337`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`agent`](../packages/core/agent), [`webhook`](../packages/webhook/webhook) | @@ -63,7 +63,7 @@ This matrix shows which packages dispatch each harness-owned event and which pac | `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - | | `session/created` | `emit` | [`packages/core/session/src/index.ts:55`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`compaction`](../packages/compaction/compaction), [`goal`](../packages/goal/goal), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm-retry`](../packages/llm/llm-retry), [`permission-presets`](../packages/interaction/permission-presets), [`plan-mode`](../packages/plan/plan-mode), [`schedule`](../packages/schedule/schedule), `server`, [`session`](../packages/core/session), `session-controller`, [`session-log-deepseek`](../packages/session/session-log-deepseek), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`time-context`](../packages/context/time-context), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval) | | `session/disposed` | `emit` | [`packages/core/session/src/index.ts:65`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `agent-team`, `file-upload`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `session/event` | `emit` | [`packages/core/session/src/index.ts:77`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `agent-team`, [`compaction`](../packages/compaction/compaction), [`compaction-basic`](../packages/compaction/compaction-basic), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`hook-protocol`](../packages/hooks/hook-protocol), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, `server`, [`session`](../packages/core/session), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`token-meter`](../packages/llm/token-meter), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `session/event` | `emit` | [`packages/core/session/src/index.ts:77`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `agent-team`, [`compaction`](../packages/compaction/compaction), [`compaction-basic`](../packages/compaction/compaction-basic), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`hook-protocol`](../packages/hooks/hook-protocol), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, `server`, [`session`](../packages/core/session), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`token-meter`](../packages/llm/token-meter), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `session/flush` | `parallel` | [`packages/core/session/src/index.ts:86`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-telemetry`](../packages/session/session-telemetry) | | `settings/document-updated` | `emit` | [`packages/settings/settings/src/types.ts:75`](../packages/settings/settings/src/types.ts) | [`settings`](../packages/settings/settings) (`emit`) | `remotes` | | `skills/change` | `emit` | [`packages/skill/skill/src/index.ts:296`](../packages/skill/skill/src/index.ts) | [`skill`](../packages/skill/skill) (`events.dispatch`) | - | @@ -79,7 +79,7 @@ This matrix shows which packages dispatch each harness-owned event and which pac | `tools/pre-execute` | `waterfall` | [`packages/core/tools/src/index.ts:153`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `auto-review`, [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`tool-jobs`](../packages/jobs/tool-jobs), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `tools/ptc-dispatch-log` | `waterfall` | [`packages/core/tools/src/index.ts:190`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`waterfall`) | [`spill-policy`](../packages/spill/spill-policy) | | `tools/result` | `emit` | [`packages/core/tools/src/index.ts:198`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), [`subagent-in-process-driver`](../packages/subagent/subagent-in-process-driver), [`tool-present`](../packages/deliverables/tool-present) | -| `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:88`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | `remotes` | +| `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:157`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | `remotes` | | `webserver/index-inject` | `emit` | [`packages/host/webserver/src/index.ts:34`](../packages/host/webserver/src/index.ts) | `webserver` (`emit`) | `connection`, `inspector`, `modules`, `shortcuts`, `ui-sidebar-documentpreview`, `ui-theme` | | `workflow/agent-end` | `emit` | [`packages/workflow/workflow/src/index.ts:79`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | | `workflow/agent-start` | `emit` | [`packages/workflow/workflow/src/index.ts:68`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | diff --git a/docs/event-producer-consumer.zh.md b/docs/event-producer-consumer.zh.md index b3edadf12e..3f5f5e710f 100644 --- a/docs/event-producer-consumer.zh.md +++ b/docs/event-producer-consumer.zh.md @@ -16,8 +16,8 @@ | `agent/created` | `serial` | [`packages/core/agent/src/runtime-types.ts:261`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`serial`) | `agent-team`, `browser-use-runtime`, [`file-reference-local`](../packages/context/file-reference-local), [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`loader-smoke`](../packages/test-support/loader-smoke), [`schedule`](../packages/schedule/schedule), `session-controller`, `tool-agent-team`, [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:270`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`schedule`](../packages/schedule/schedule), `session-controller`, [`subagent`](../packages/subagent/subagent), `tool-agent-team`, [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:393`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`deepseek-account`](../packages/credentials/deepseek-account), [`goal-round-driver`](../packages/goal/goal-round-driver), `session-controller`, [`session-telemetry`](../packages/session/session-telemetry) | -| `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:299`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs) | -| `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:307`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent) | +| `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:299`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`user-questions`](../packages/interaction/user-questions) | +| `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:307`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/inserted` | `emit` | [`packages/core/agent/src/runtime-types.ts:288`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver) | | `agent/pre-step` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:320`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`agent`](../packages/core/agent), [`agent-instructions`](../packages/context/agent-instructions), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`plan-mode`](../packages/plan/plan-mode), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), `session-controller`, [`session-reference`](../packages/context/session-reference), [`subagent-in-process-driver`](../packages/subagent/subagent-in-process-driver), [`time-context`](../packages/context/time-context), [`tmux-context`](../packages/context/tmux-context), [`tool-skill`](../packages/skill/tool-skill), [`tool-subagent`](../packages/subagent/tool-subagent) | | `agent/request` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:337`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`agent`](../packages/core/agent), [`webhook`](../packages/webhook/webhook) | @@ -65,7 +65,7 @@ | `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - | | `session/created` | `emit` | [`packages/core/session/src/index.ts:55`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`compaction`](../packages/compaction/compaction), [`goal`](../packages/goal/goal), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm-retry`](../packages/llm/llm-retry), [`permission-presets`](../packages/interaction/permission-presets), [`plan-mode`](../packages/plan/plan-mode), [`schedule`](../packages/schedule/schedule), `server`, [`session`](../packages/core/session), `session-controller`, [`session-log-deepseek`](../packages/session/session-log-deepseek), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`time-context`](../packages/context/time-context), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval) | | `session/disposed` | `emit` | [`packages/core/session/src/index.ts:65`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `agent-team`, `file-upload`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `session/event` | `emit` | [`packages/core/session/src/index.ts:77`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `agent-team`, [`compaction`](../packages/compaction/compaction), [`compaction-basic`](../packages/compaction/compaction-basic), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`hook-protocol`](../packages/hooks/hook-protocol), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, `server`, [`session`](../packages/core/session), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`token-meter`](../packages/llm/token-meter), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `session/event` | `emit` | [`packages/core/session/src/index.ts:77`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `agent-team`, [`compaction`](../packages/compaction/compaction), [`compaction-basic`](../packages/compaction/compaction-basic), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`hook-protocol`](../packages/hooks/hook-protocol), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, `server`, [`session`](../packages/core/session), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`token-meter`](../packages/llm/token-meter), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `session/flush` | `parallel` | [`packages/core/session/src/index.ts:86`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-telemetry`](../packages/session/session-telemetry) | | `settings/document-updated` | `emit` | [`packages/settings/settings/src/types.ts:75`](../packages/settings/settings/src/types.ts) | [`settings`](../packages/settings/settings) (`emit`) | `remotes` | | `skills/change` | `emit` | [`packages/skill/skill/src/index.ts:296`](../packages/skill/skill/src/index.ts) | [`skill`](../packages/skill/skill) (`events.dispatch`) | - | @@ -81,7 +81,7 @@ | `tools/pre-execute` | `waterfall` | [`packages/core/tools/src/index.ts:153`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `auto-review`, [`hooks-claude-code`](../packages/hooks/hooks-claude-code), [`hooks-codex`](../packages/hooks/hooks-codex), [`tool-jobs`](../packages/jobs/tool-jobs), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `tools/ptc-dispatch-log` | `waterfall` | [`packages/core/tools/src/index.ts:190`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`waterfall`) | [`spill-policy`](../packages/spill/spill-policy) | | `tools/result` | `emit` | [`packages/core/tools/src/index.ts:198`](../packages/core/tools/src/index.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), [`subagent-in-process-driver`](../packages/subagent/subagent-in-process-driver), [`tool-present`](../packages/deliverables/tool-present) | -| `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:88`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | `remotes` | +| `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:157`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | `remotes` | | `webserver/index-inject` | `emit` | [`packages/host/webserver/src/index.ts:34`](../packages/host/webserver/src/index.ts) | `webserver` (`emit`) | `connection`, `inspector`, `modules`, `shortcuts`, `ui-sidebar-documentpreview`, `ui-theme` | | `workflow/agent-end` | `emit` | [`packages/workflow/workflow/src/index.ts:79`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | | `workflow/agent-start` | `emit` | [`packages/workflow/workflow/src/index.ts:68`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | diff --git a/docs/module-graph.md b/docs/module-graph.md index de08e4f0e6..5147fbcba0 100644 --- a/docs/module-graph.md +++ b/docs/module-graph.md @@ -666,6 +666,9 @@ flowchart TD pkg_user_questions --> pkg_agent pkg_user_questions --> pkg_llm pkg_user_questions --> pkg_scope + pkg_user_questions --> pkg_session + pkg_user_questions --> pkg_session_projection + pkg_user_questions --> pkg_typert_protocol pkg_jobs --> pkg_agent pkg_jobs --> pkg_brand pkg_jobs --> pkg_invariants @@ -1574,7 +1577,7 @@ flowchart TD | [`deepseek-account`](../packages/credentials/deepseek-account) | `credentials` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm) | | [`commands`](../packages/interaction/commands) | `interaction` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`typert-protocol`](../packages/typert/protocol) | | [`user-approval`](../packages/interaction/user-approval) | `interaction` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) | -| [`user-questions`](../packages/interaction/user-questions) | `interaction` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) | +| [`user-questions`](../packages/interaction/user-questions) | `interaction` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`typert-protocol`](../packages/typert/protocol) | | [`jobs`](../packages/jobs/jobs) | `jobs` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`session`](../packages/core/session), [`workspace`](../packages/workspace/workspace) | | [`sandbox-policy`](../packages/sandbox/sandbox-policy) | `sandbox` | [`agent`](../packages/core/agent), [`invariants`](../packages/runtime-diagnostics/invariants), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt) | | [`session-telemetry`](../packages/session/session-telemetry) | `session` | [`agent`](../packages/core/agent), [`session`](../packages/core/session) | diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md index 5bd4996a34..a1a4c081d1 100644 --- a/docs/module-graph.zh.md +++ b/docs/module-graph.zh.md @@ -668,6 +668,9 @@ flowchart TD pkg_user_questions --> pkg_agent pkg_user_questions --> pkg_llm pkg_user_questions --> pkg_scope + pkg_user_questions --> pkg_session + pkg_user_questions --> pkg_session_projection + pkg_user_questions --> pkg_typert_protocol pkg_jobs --> pkg_agent pkg_jobs --> pkg_brand pkg_jobs --> pkg_invariants @@ -1576,7 +1579,7 @@ flowchart TD | [`deepseek-account`](../packages/credentials/deepseek-account) | `credentials` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm) | | [`commands`](../packages/interaction/commands) | `interaction` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`typert-protocol`](../packages/typert/protocol) | | [`user-approval`](../packages/interaction/user-approval) | `interaction` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) | -| [`user-questions`](../packages/interaction/user-questions) | `interaction` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) | +| [`user-questions`](../packages/interaction/user-questions) | `interaction` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`typert-protocol`](../packages/typert/protocol) | | [`jobs`](../packages/jobs/jobs) | `jobs` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/runtime-diagnostics/invariants), [`session`](../packages/core/session), [`workspace`](../packages/workspace/workspace) | | [`sandbox-policy`](../packages/sandbox/sandbox-policy) | `sandbox` | [`agent`](../packages/core/agent), [`invariants`](../packages/runtime-diagnostics/invariants), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt) | | [`session-telemetry`](../packages/session/session-telemetry) | `session` | [`agent`](../packages/core/agent), [`session`](../packages/core/session) | diff --git a/docs/persistence-catalog.i18n.yaml b/docs/persistence-catalog.i18n.yaml index 6e6a1802d1..555c6e52a7 100644 --- a/docs/persistence-catalog.i18n.yaml +++ b/docs/persistence-catalog.i18n.yaml @@ -9,8 +9,8 @@ en: e7c80d1de4d328b4 zh: d9f368c27fd9f998 /session-persistence-event-catalog/persistence-type-fingerprints: - en: 0254fc43535dfaad - zh: 2f592cfae60e10ac + en: 33dd28b1c768cd8b + zh: 7256442baf2faed1 /session-persistence-event-catalog/event-envelope: en: 7ebb1a2e0dd1f916 zh: 8946f415dda5c1b8 @@ -318,8 +318,11 @@ en: 6c3effe2abc1aa53 zh: 6c3effe2abc1aa53 /session-persistence-event-catalog/resolved-persistence-types/always: - en: e318559064b455fb - zh: e318559064b455fb + en: 4cdaf9853769f3da + zh: 4cdaf9853769f3da +/session-persistence-event-catalog/resolved-persistence-types/answered: + en: 9b5e8719c6d3d7ff + zh: 9b5e8719c6d3d7ff /session-persistence-event-catalog/resolved-persistence-types/append: en: 02f63fd38e94120b zh: 02f63fd38e94120b @@ -864,8 +867,11 @@ en: f01476bd214bb78f zh: f01476bd214bb78f /session-persistence-event-catalog/resolved-persistence-types/user-approval: - en: 7c6de40d31cf20a5 - zh: 7c6de40d31cf20a5 + en: 1c8f591ed011f359 + zh: 1c8f591ed011f359 +/session-persistence-event-catalog/resolved-persistence-types/user-question-reply: + en: ce169abc5bc0ad1f + zh: ce169abc5bc0ad1f /session-persistence-event-catalog/resolved-persistence-types/user-message: en: ecc3b25a07772288 zh: ecc3b25a07772288 @@ -951,11 +957,11 @@ en: 586743dfeab78c55 zh: 26ccef4a02dd7a58 /session-persistence-event-catalog/resolved-persistence-types/deepseeksearchllmrequest: - en: b3df6dce576b01a2 - zh: f9c67e338cc6e449 + en: ea25cd944b4b4020 + zh: 87f8944f766d3a85 /session-persistence-event-catalog/resolved-persistence-types/developermessage: - en: 3df6e6aaeb92c0fa - zh: 29988ebcdd9e62e1 + en: af7ce240db9e3463 + zh: cd15cd0cd369c2c0 /session-persistence-event-catalog/resolved-persistence-types/epochheader: en: d31020fa1fda6fa4 zh: 77984c4bf09443fb @@ -1053,11 +1059,11 @@ en: 6dbe099c62f7c226 zh: 6fd788f63c038c91 /session-persistence-event-catalog/resolved-persistence-types/llmretrystartedeventdata: - en: 7854b9694cc84c3a - zh: 319ec2e2e6ffdaec + en: f4202ef53de39006 + zh: f8f1d0bfc0451c31 /session-persistence-event-catalog/resolved-persistence-types/message: - en: 45a296c31664de87 - zh: 8f235285b2f985f9 + en: a3d2a5be822c5a86 + zh: 871cc3cafabe99be /session-persistence-event-catalog/resolved-persistence-types/messagefeedbackdelete: en: c582953270d4ca44 zh: 966ccfe2e7660a2a @@ -1068,14 +1074,14 @@ en: f58575a1fc96df42 zh: 9f0c6ed9033e5c9d /session-persistence-event-catalog/resolved-persistence-types/messagefeedbackrating: - en: 490a91f1da1fc870 - zh: 2f2b9e972e22d51f + en: ef7b940d5654ce5a + zh: 72d4c5b3f6e2ff17 /session-persistence-event-catalog/resolved-persistence-types/messagesource: - en: 7d0eda01d2c3076f - zh: ce3dbfc1bd7fd176 + en: f1789e91fd4338e3 + zh: 8250eb33cda749b5 /session-persistence-event-catalog/resolved-persistence-types/message~2: - en: 8e53b2a339808ffc - zh: d453e93e45f9e752 + en: 412cc1296786d489 + zh: f457e8629515a526 /session-persistence-event-catalog/resolved-persistence-types/modelmessagesource: en: 3b677f021d7dd4d3 zh: 2a875742b22879a2 @@ -1134,11 +1140,11 @@ en: 9a54c4478ad3b620 zh: 02c4c1fd7e252770 /session-persistence-event-catalog/resolved-persistence-types/sessiontitleeventdata: - en: 415ce281c096b4c3 - zh: 39c5bf9dfaa95579 + en: 2c684a3db9219c45 + zh: 202000f582ca1ec8 /session-persistence-event-catalog/resolved-persistence-types/sessiontitlellmrequesteventdata: - en: 0e539718e4bc8ed8 - zh: 060007f55759f065 + en: 7b180deead48738e + zh: 35d43b7ef489f97b /session-persistence-event-catalog/resolved-persistence-types/sessiontitlemodelidentity: en: 9531468264499498 zh: 9da23c0ad2776563 @@ -1245,14 +1251,14 @@ en: 544292eddeff5faa zh: 4e36e575a5030fb2 /session-persistence-event-catalog/resolved-persistence-types/turnendreason: - en: 083f0fef130bb976 - zh: dafd261a95708bec + en: 7fd4741c641f9252 + zh: be115df1a8ee59ce /session-persistence-event-catalog/resolved-persistence-types/usermessage: - en: 88b294a9b0bdf0e4 - zh: 0597f465b9d45b27 + en: c9090b73ac4ce05b + zh: beb1f58404b0a2b8 /session-persistence-event-catalog/resolved-persistence-types/usermessage~2: - en: 31aaab9c9f53ed9c - zh: c5cd866b3f2b27e0 + en: a3974d05a5d357d3 + zh: 99e73822f538c99d /session-persistence-event-catalog/resolved-persistence-types/workflowagentoutcome: en: d0a3f9aab18c3de5 zh: 76ac69a835ca4e29 @@ -1422,11 +1428,11 @@ en: 51af619ed8532a43 zh: a5ad878c63d0e046 /session-persistence-event-catalog/resolved-persistence-types/header-reason-startsseries: - en: 62ca405eba4d2757 - zh: c6a8861533363ae9 + en: 2b549aa36fe3ab7b + zh: 069ef4498112c4e7 /session-persistence-event-catalog/resolved-persistence-types/headerseq-message-step-turn: - en: 76e7be9a80a4082c - zh: c06aaa42a8488aea + en: 97dc4446fd0b02ac + zh: 57ec4b27d0221957 /session-persistence-event-catalog/resolved-persistence-types/height-width: en: a5df50710083ac25 zh: aad3ccf6f6de70e4 @@ -1443,11 +1449,11 @@ en: 41f73c58a77dfa28 zh: af77f4aee3cb4a40 /session-persistence-event-catalog/resolved-persistence-types/inherited: - en: f538b60f99becc0a - zh: 0c8efa059a1e6569 + en: 7dcf0c1ade316952 + zh: 3c9cd7564659ec3d /session-persistence-event-catalog/resolved-persistence-types/inserted-outcome-removedcount-start: - en: 3985827b3ead1d92 - zh: c535166ccae6c8a3 + en: f2167c4cf3aa9b4d + zh: b4ed04a9a526f49e /session-persistence-event-catalog/resolved-persistence-types/interrupted-message-step-stream: en: f460572284c92755 zh: bae7561ce887b040 @@ -1776,8 +1782,11 @@ en: eaffa616c5b9dc9a zh: 2eb138fcf5936e20 /session-persistence-event-catalog/resolved-persistence-types/kind-user-approval-form-snapshot: - en: 58c4ff5b5d70cc02 - zh: 080be72a31b3205e + en: 993991e8f05665bb + zh: a03931839e647bac +/session-persistence-event-catalog/resolved-persistence-types/kind-user-question-reply: + en: 77a8fc6a2f3a9319 + zh: 4dc1de1358b51a8d /session-persistence-event-catalog/resolved-persistence-types/kind-webhook-form-notice: en: 4cd5dc7523fefebb zh: f467561fbd0ae394 @@ -1836,11 +1845,11 @@ en: a79b2ab16b9ed215 zh: 764cd1400ee8db63 /session-persistence-event-catalog/resolved-persistence-types/type-agent-preset-selected: - en: d59bb505610b862f - zh: e2637fbbb8365bdf + en: c8b6e46c8e161688 + zh: 3f45f3e70ce9f600 /session-persistence-event-catalog/resolved-persistence-types/type-agent-inbox-spliced: - en: 109d942de30d9227 - zh: 6c6fc06634ad7945 + en: d73cb120a4aa138e + zh: 1f5ce9f1bb430aec /session-persistence-event-catalog/resolved-persistence-types/type-approval-asked: en: 9c77f18b0dad22f0 zh: 8894cf2878fe90db @@ -1884,11 +1893,11 @@ en: ba73fb10b7e2ffc9 zh: 8d5c97e63e5f16da /session-persistence-event-catalog/resolved-persistence-types/type-deliverables-presented: - en: 49de6f547778d916 - zh: ce2a1af1ae934f68 + en: ec7e9f13864db847 + zh: 694e948cd52387ea /session-persistence-event-catalog/resolved-persistence-types/type-developer-message: - en: 686d26ced9945d4b - zh: 535b9e92eb7535fb + en: 73514ab7122858e8 + zh: 335ebf8ba5454d7e /session-persistence-event-catalog/resolved-persistence-types/type-feedback-message-delete: en: 204561e2311db97e zh: 77264396bd5e25c4 @@ -1953,11 +1962,11 @@ en: acf7e21e4d21ebff zh: fb83a853634d204a /session-persistence-event-catalog/resolved-persistence-types/type-session-title: - en: ba2f901c9981835f - zh: ce0358c7d16b0beb + en: 8dd08982ac65646b + zh: 3f22850e3160ed36 /session-persistence-event-catalog/resolved-persistence-types/type-session-title-llm-request: - en: 7515d391badb4d0a - zh: 9eb19def7a3ed752 + en: 48c9d78076942c91 + zh: 6cafb7732d3a1258 /session-persistence-event-catalog/resolved-persistence-types/type-step-end: en: 7fc233c4a569dae2 zh: bc2b3fed4a397c00 @@ -2034,11 +2043,11 @@ en: 1b045de96172be4b zh: 8a15c6f35b576b37 /session-persistence-event-catalog/resolved-persistence-types/type-usage: - en: a01e61480accb34b - zh: 6387a3cc7666aa7e + en: 5e70d314feb1b86b + zh: b98f69d4d8442c14 /session-persistence-event-catalog/resolved-persistence-types/type-user-message: - en: 58d3e616db84f840 - zh: 9aed64a03347caad + en: 4f793420e83a748e + zh: 70a4cb82e27965dd /session-persistence-event-catalog/resolved-persistence-types/type-web-deepseek-search-llm-request: en: f109997e295af37d zh: b2dcfd599f73b61c diff --git a/docs/persistence-catalog.md b/docs/persistence-catalog.md index b9a4241eef..1575e2104d 100644 --- a/docs/persistence-catalog.md +++ b/docs/persistence-catalog.md @@ -21,7 +21,7 @@ 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 | `1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c) | +| `event:agent/inbox/spliced` | event | `6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178) | | `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) | @@ -34,7 +34,7 @@ The [format references](persistence-changes/historical-formats/README.md) cover | `event:compaction/start` | event | `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | [`{ type: "compaction/start" }`](#persistence-type-sha256-db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965) | | `event:compaction/summary` | event | `e2f9a41e0989f54ed8cee80f8db2bcf9d60a5c810dc9d45b83fa050b9dce7602` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-e2f9a41e0989f54ed8cee80f8db2bcf9d60a5c810dc9d45b83fa050b9dce7602) | | `event:deliverables/presented` | event | `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | [`{ type: "deliverables/presented" }`](#persistence-type-sha256-13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176) | -| `event:developer/message` | event | `eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80` | [`{ type: "developer/message" }`](#persistence-type-sha256-eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80) | +| `event:developer/message` | event | `186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467` | [`{ type: "developer/message" }`](#persistence-type-sha256-186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467) | | `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) | | `event:feedback/record` | event | `b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8` | [`{ type: "feedback/record" }`](#persistence-type-sha256-b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8) | @@ -54,7 +54,7 @@ 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 | `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d) | +| `event:session/title-llm-request` | event | `ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46) | | `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 | `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604) | @@ -76,7 +76,7 @@ The [format references](persistence-changes/historical-formats/README.md) cover | `event:tool/result` | event | `7c9f44e90a0058f4cc532ae20dad0c10afa6eba22e70a6c79fc79490bad64397` | [`{ type: "tool/result" }`](#persistence-type-sha256-7c9f44e90a0058f4cc532ae20dad0c10afa6eba22e70a6c79fc79490bad64397) | | `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 | `3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761` | [`{ type: "user/message" }`](#persistence-type-sha256-3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761) | +| `event:user/message` | event | `b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411` | [`{ type: "user/message" }`](#persistence-type-sha256-b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411) | | `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) | @@ -1357,6 +1357,14 @@ SHA-256: `142c37d302aa22a0a57915b5255939d3ca91c1811ca13fddcf84cf76ea00758a` `"always"` + + +### `"answered"` + +SHA-256: `85d6d96ff884297410ec0026bdacba835f10e56cbcc5a3b9d670739f4aa0494b` + +`"answered"` + ### `"append"` @@ -2819,6 +2827,14 @@ SHA-256: `f68c335306535a001127dae6685ece493a0ee7f4e2a851197b6054d8a9ff7394` `"user-approval"` + + +### `"user-question-reply"` + +SHA-256: `9645cf93769a6dfb227bd400bd6cb9fa7bab9140f4a851e4ae92514ade6e3114` + +`"user-question-reply"` + ### `"user/message"` @@ -3207,7 +3223,7 @@ Sources: [`packages/web/web-search-deepseek/src/provider.ts:55`](../packages/web | `body` | required | [`{ max_tokens, messages, model, tools }`](#persistence-type-sha256-930a6567a10bb62ddd157bd8abdf4b182810c8c3b49d91309b3b009a5fed9731) | | `endpoint` | required | `string` | - + @@ -3215,7 +3231,7 @@ Sources: [`packages/web/web-search-deepseek/src/provider.ts:55`](../packages/web ### `DeveloperMessage` -SHA-256: `f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b` +SHA-256: `1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200` Sources: [`packages/llm/llm/src/message.ts:157`](../packages/llm/llm/src/message.ts) @@ -3224,11 +3240,11 @@ Sources: [`packages/llm/llm/src/message.ts:157`](../packages/llm/llm/src/message | `content` | required | [`ContentBlock[]`](#persistence-type-sha256-b52f215a6cd691058a3413c12f161fa3b563a2f4895adb3df6f744ec4b0a6ef1) | | `id` | required | `string` | | `role` | required | `"developer"` | -| `source` | required | [`MessageSource`](#persistence-type-sha256-40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945) | +| `source` | required | [`MessageSource`](#persistence-type-sha256-26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116) | Source compatibility: `source` — `session-source-attribution` v1; `session.developer-message.source`; `kind`; `preserve`. -Attribution-only additions: `tmux-context`. +Attribution-only additions: `tmux-context`, `user-question-reply`. @@ -3841,7 +3857,7 @@ Sources: [`packages/llm/llm-retry/src/types.ts:43`](../packages/llm/llm-retry/sr | `step` | required | `number` | | `turn` | required | `number` | - + @@ -3849,17 +3865,17 @@ Sources: [`packages/llm/llm-retry/src/types.ts:43`](../packages/llm/llm-retry/sr ### `Message` -SHA-256: `691c0f641cd3e8072fdacd6fa8c400253cf75a0ce9285d8ce89141bbb24f2fb6` +SHA-256: `cb7b863ddb7b3eab5f18f216602feba25f47b456e73e4e72b6bcc259875c6dab` Sources: [`packages/llm/llm/src/message.ts:196`](../packages/llm/llm/src/message.ts) One of: - [`ToolResultMessage`](#persistence-type-sha256-4b259f7f8f0a44ad5e90b70a73553ced1df27012d126921d397ff403b6c86731) -- [`DeveloperMessage`](#persistence-type-sha256-f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b) -- [`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586) -- [`AssistantMessage`](#persistence-type-sha256-fa87537f4a9c1e25602990a8bf686b383e9e00352ec8946e16ae24ba7c1625be) +- [`DeveloperMessage`](#persistence-type-sha256-1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200) +- [`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd) - [`SystemMessage`](#persistence-type-sha256-09f3f8dc417f278257202714132f98ba7b52957d7b558c4a04456603890eb363) +- [`AssistantMessage`](#persistence-type-sha256-fa87537f4a9c1e25602990a8bf686b383e9e00352ec8946e16ae24ba7c1625be) @@ -3934,7 +3950,7 @@ One of: - `"negative"` - `"positive"` - + @@ -3942,7 +3958,7 @@ One of: ### `MessageSource` -SHA-256: `40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945` +SHA-256: `26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116` Sources: [`packages/llm/llm/src/message.ts:136`](../packages/llm/llm/src/message.ts) @@ -4056,15 +4072,16 @@ Sources: [`packages/llm/llm/src/message.ts:136`](../packages/llm/llm/src/message | `user-approval` | `"relay"` | none | [`{ kind: "user-approval", form: "relay" }`](#persistence-type-sha256-5cdbf342b7748d152bc987b68f58e565e5bba4b227e076e2d2120d87662e45cd) | | `user-approval` | `"snapshot"` | `sections`: [`ContextSnapshotSection[]`](#persistence-type-sha256-c748fb42c80a120038a8c587af80ec39924803c401364db11c8974d5bf6d0262) | [`{ kind: "user-approval", form: "snapshot" }`](#persistence-type-sha256-5654685d7557ec747e74887237065e626a5bdfa426ca43f7fbb0b6fee9b0916c) | | `user-approval` | not declared | none | [`{ kind: "user-approval" }`](#persistence-type-sha256-6292bcbedaa97feaec5b48a03bb8144b581b93309d9d6c905f26da7a6a7a0a4f) | +| `user-question-reply` | not declared | `callId`: `string`; `outcome`: `"answered"` | [`{ kind: "user-question-reply" }`](#persistence-type-sha256-c55827fba7018198772c50e37cb7d3f60a3d8bb6e94b07de72dee0d9f8968005) | | `webhook` | `"notice"` | `deliveryId`: `string`; `provider`: `string`; `ruleId`: `string`; `source`: `string`; `summary`: `string` | [`{ kind: "webhook", form: "notice" }`](#persistence-type-sha256-9edc162949abf93bd5ff049191b345454ba104f583937ce5580fb50f067d2b94) | - + ### `Message[]` -SHA-256: `fc8242857caf7450d7f68a1f509dce83e237bd21571666006895124cb2246a83` +SHA-256: `3f42f45cbb8a06586d247e5f3763dc02c8d31a145a9a3b82fabcd101e7e224cc` -Array of [`Message`](#persistence-type-sha256-691c0f641cd3e8072fdacd6fa8c400253cf75a0ce9285d8ce89141bbb24f2fb6). +Array of [`Message`](#persistence-type-sha256-cb7b863ddb7b3eab5f18f216602feba25f47b456e73e4e72b6bcc259875c6dab). @@ -4431,7 +4448,7 @@ Sources: [`packages/session/session-title/src/types.ts:41`](../packages/session/ | `source` | required | [`SessionTitleSource`](#persistence-type-sha256-30d5a537b296685770b1241c4b4bbde19d5a31ff81aa23df73fab5e90b8fc65f) | | `title` | required | `string` | - + @@ -4439,7 +4456,7 @@ Sources: [`packages/session/session-title/src/types.ts:41`](../packages/session/ ### `SessionTitleLlmRequestEventData` -SHA-256: `9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd` +SHA-256: `fe3cdc6f9050584cea4a6d6998c31334bff7899f5ff1095082a44fdf3b47e996` Sources: [`packages/session/session-title-llm/src/index.ts:34`](../packages/session/session-title-llm/src/index.ts) @@ -4447,7 +4464,7 @@ Sources: [`packages/session/session-title-llm/src/index.ts:34`](../packages/sess |---|---|---| | `maxTokens` | required | `number` | | `messageSeqs` | required | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | -| `messages` | required | [`Message[]`](#persistence-type-sha256-fc8242857caf7450d7f68a1f509dce83e237bd21571666006895124cb2246a83) | +| `messages` | required | [`Message[]`](#persistence-type-sha256-3f42f45cbb8a06586d247e5f3763dc02c8d31a145a9a3b82fabcd101e7e224cc) | | `route` | required | [`SessionTitleModelIdentity`](#persistence-type-sha256-07e1a58c58b593f507b8e7f25723bb0aa42baae6e00f5ecfddf28cb1e64d3235) | | `system` | required | `string` | | `titleProvider` | required | `string` | @@ -5101,7 +5118,7 @@ Sources: [`packages/core/session/src/types.ts:232`](../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) | - + @@ -5109,7 +5126,7 @@ Sources: [`packages/core/session/src/types.ts:232`](../packages/core/session/src ### `UserMessage` -SHA-256: `64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586` +SHA-256: `cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd` Sources: [`packages/llm/llm/src/message.ts:162`](../packages/llm/llm/src/message.ts) @@ -5118,19 +5135,19 @@ Sources: [`packages/llm/llm/src/message.ts:162`](../packages/llm/llm/src/message | `content` | required | [`ContentBlock[]`](#persistence-type-sha256-b52f215a6cd691058a3413c12f161fa3b563a2f4895adb3df6f744ec4b0a6ef1) | | `id` | required | `string` | | `role` | required | `"user"` | -| `source` | required | [`MessageSource`](#persistence-type-sha256-40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945) | +| `source` | required | [`MessageSource`](#persistence-type-sha256-26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116) | Source compatibility: `source` — `session-source-attribution` v1; `session.user-message.source`; `kind`; `preserve`. -Attribution-only additions: `tmux-context`. +Attribution-only additions: `tmux-context`, `user-question-reply`. - + ### `UserMessage[]` -SHA-256: `d1f27cf1650e5f59d5d6e95ce6dfd92b31757af076a8ab6418a70b6dbdd53621` +SHA-256: `5a92f12db2059c282cdea45b6845c65e6f4a95dd3d649aeddbde6f9ae03c561f` -Array of [`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586). +Array of [`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd). @@ -5973,18 +5990,18 @@ Sources: [`packages/core/session/src/types.ts:390`](../packages/core/session/src | `reason` | required | [`RequestHeaderReason`](#persistence-type-sha256-530da6c0267813bb4511af72883cc518834e624e3b3220a7062955fd57a788a6) | | `startsSeries` | optional | `true` | - + ### `{ headerSeq?, message, step, turn }` -SHA-256: `51c78ccc9023ce6642d07fb9a10cbf942ff7e313d5b304ddc77218df71da708f` +SHA-256: `a5d80b5a2f3a6bbaf8f0334126632b78f94d8346122c68e8122ea89906d63d26` Sources: [`packages/core/session/src/types.ts:311`](../packages/core/session/src/types.ts) | Property | Presence | Type | |---|---|---| | `headerSeq` | optional | `number` | -| `message` | required | [`DeveloperMessage`](#persistence-type-sha256-f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b) | +| `message` | required | [`DeveloperMessage`](#persistence-type-sha256-1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200) | | `step` | required | `number` | | `turn` | required | `number` | @@ -6068,17 +6085,17 @@ Sources: [`packages/core/session/src/types.ts:427`](../packages/core/session/src |---|---|---| | `inherited` | optional | `true` | - + ### `{ inserted, outcome?, removedCount?, start, … }` -SHA-256: `dc4bd7ac827f4b1f9236f9a157a4b4cc171a0588064a611e43edd95f62c68130` +SHA-256: `149c5a77529cb0dc06f5ceb6273069b7606174d1e7893b5f9b1071c15306b846` Sources: [`packages/core/agent/src/types.ts:96`](../packages/core/agent/src/types.ts) | Property | Presence | Type | |---|---|---| -| `inserted` | required | [`UserMessage[]`](#persistence-type-sha256-d1f27cf1650e5f59d5d6e95ce6dfd92b31757af076a8ab6418a70b6dbdd53621) | +| `inserted` | required | [`UserMessage[]`](#persistence-type-sha256-5a92f12db2059c282cdea45b6845c65e6f4a95dd3d649aeddbde6f9ae03c561f) | | `outcome` | optional | `"canceled"` | | `removedCount` | optional | `number` | | `start` | required | `number` | @@ -7337,6 +7354,20 @@ SHA-256: `5654685d7557ec747e74887237065e626a5bdfa426ca43f7fbb0b6fee9b0916c` | `kind` | required | `"user-approval"` | | `sections` | required | [`ContextSnapshotSection[]`](#persistence-type-sha256-c748fb42c80a120038a8c587af80ec39924803c401364db11c8974d5bf6d0262) | + + +### `{ kind: "user-question-reply" }` + +SHA-256: `c55827fba7018198772c50e37cb7d3f60a3d8bb6e94b07de72dee0d9f8968005` + +Sources: [`packages/interaction/user-questions/src/types.ts:117`](../packages/interaction/user-questions/src/types.ts) + +| Property | Presence | Type | +|---|---|---| +| `callId` | required | `string` | +| `kind` | required | `"user-question-reply"` | +| `outcome` | required | `"answered"` | + ### `{ kind: "webhook", form: "notice" }` @@ -7612,17 +7643,17 @@ SHA-256: `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | `time` | required | `number` | | `type` | required | `"agent-preset/selected"` | - + ### `{ type: "agent/inbox/spliced" }` -SHA-256: `1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c` +SHA-256: `6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-dc4bd7ac827f4b1f9236f9a157a4b4cc171a0588064a611e43edd95f62c68130) | +| `data` | required | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-149c5a77529cb0dc06f5ceb6273069b7606174d1e7893b5f9b1071c15306b846) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -7863,17 +7894,17 @@ SHA-256: `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | `time` | required | `number` | | `type` | required | `"deliverables/presented"` | - + ### `{ type: "developer/message" }` -SHA-256: `eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80` +SHA-256: `186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467` | Property | Presence | Type | |---|---|---| -| `data` | required | [`{ headerSeq?, message, step, turn }`](#persistence-type-sha256-51c78ccc9023ce6642d07fb9a10cbf942ff7e313d5b304ddc77218df71da708f) | +| `data` | required | [`{ headerSeq?, message, step, turn }`](#persistence-type-sha256-a5d80b5a2f3a6bbaf8f0334126632b78f94d8346122c68e8122ea89906d63d26) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `sourceEventSeqs` | optional | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -8229,17 +8260,17 @@ SHA-256: `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | `time` | required | `number` | | `type` | required | `"session/title"` | - + ### `{ type: "session/title-llm-request" }` -SHA-256: `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` +SHA-256: `ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46` | Property | Presence | Type | |---|---|---| -| `data` | required | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd) | +| `data` | required | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-fe3cdc6f9050584cea4a6d6998c31334bff7899f5ff1095082a44fdf3b47e996) | | `ignorable` | optional | `true` | | `seq` | required | `number` | | `time` | required | `number` | @@ -8662,17 +8693,17 @@ Sources: [`packages/llm/llm/src/types.ts:458`](../packages/llm/llm/src/types.ts) | `type` | required | `"usage"` | | `usage` | required | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ type: "user/message" }` -SHA-256: `3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761` +SHA-256: `b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411` | Property | Presence | Type | |---|---|---| -| `data` | required | [`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586) | +| `data` | required | [`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd) | | `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 139a1fb20b..6bdbb92982 100644 --- a/docs/persistence-catalog.zh.md +++ b/docs/persistence-catalog.zh.md @@ -23,7 +23,7 @@ | `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 | `1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c) | +| `event:agent/inbox/spliced` | event | `6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178` | [`{ type: "agent/inbox/spliced" }`](#persistence-type-sha256-6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178) | | `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) | @@ -36,7 +36,7 @@ | `event:compaction/start` | event | `db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965` | [`{ type: "compaction/start" }`](#persistence-type-sha256-db874d463b0fdec77e9da1c4568f37cb70bd6596781eb93800db44fb8a116965) | | `event:compaction/summary` | event | `e2f9a41e0989f54ed8cee80f8db2bcf9d60a5c810dc9d45b83fa050b9dce7602` | [`{ type: "compaction/summary" }`](#persistence-type-sha256-e2f9a41e0989f54ed8cee80f8db2bcf9d60a5c810dc9d45b83fa050b9dce7602) | | `event:deliverables/presented` | event | `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | [`{ type: "deliverables/presented" }`](#persistence-type-sha256-13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176) | -| `event:developer/message` | event | `eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80` | [`{ type: "developer/message" }`](#persistence-type-sha256-eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80) | +| `event:developer/message` | event | `186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467` | [`{ type: "developer/message" }`](#persistence-type-sha256-186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467) | | `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) | | `event:feedback/record` | event | `b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8` | [`{ type: "feedback/record" }`](#persistence-type-sha256-b54940ff095c17e874c5be03815f4c2145a256cf3a1d34dae4ab2f7769dfffe8) | @@ -56,7 +56,7 @@ | `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 | `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d) | +| `event:session/title-llm-request` | event | `ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46) | | `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 | `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604) | @@ -78,7 +78,7 @@ | `event:tool/result` | event | `7c9f44e90a0058f4cc532ae20dad0c10afa6eba22e70a6c79fc79490bad64397` | [`{ type: "tool/result" }`](#persistence-type-sha256-7c9f44e90a0058f4cc532ae20dad0c10afa6eba22e70a6c79fc79490bad64397) | | `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 | `3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761` | [`{ type: "user/message" }`](#persistence-type-sha256-3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761) | +| `event:user/message` | event | `b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411` | [`{ type: "user/message" }`](#persistence-type-sha256-b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411) | | `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) | @@ -1359,6 +1359,14 @@ SHA-256: `142c37d302aa22a0a57915b5255939d3ca91c1811ca13fddcf84cf76ea00758a` `"always"` + + +### `"answered"` + +SHA-256: `85d6d96ff884297410ec0026bdacba835f10e56cbcc5a3b9d670739f4aa0494b` + +`"answered"` + ### `"append"` @@ -2821,6 +2829,14 @@ SHA-256: `f68c335306535a001127dae6685ece493a0ee7f4e2a851197b6054d8a9ff7394` `"user-approval"` + + +### `"user-question-reply"` + +SHA-256: `9645cf93769a6dfb227bd400bd6cb9fa7bab9140f4a851e4ae92514ade6e3114` + +`"user-question-reply"` + ### `"user/message"` @@ -3209,7 +3225,7 @@ SHA-256: `2517ba143a271508d3ca35126d5aca8f7f1facf5aaddce4adf011832042fa2b9` | `body` | 必需 | [`{ max_tokens, messages, model, tools }`](#persistence-type-sha256-930a6567a10bb62ddd157bd8abdf4b182810c8c3b49d91309b3b009a5fed9731) | | `endpoint` | 必需 | `string` | - + @@ -3217,7 +3233,7 @@ SHA-256: `2517ba143a271508d3ca35126d5aca8f7f1facf5aaddce4adf011832042fa2b9` ### `DeveloperMessage` -SHA-256: `f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b` +SHA-256: `1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200` 来源:[`packages/llm/llm/src/message.ts:157`](../packages/llm/llm/src/message.ts) @@ -3226,11 +3242,11 @@ SHA-256: `f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b` | `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-b52f215a6cd691058a3413c12f161fa3b563a2f4895adb3df6f744ec4b0a6ef1) | | `id` | 必需 | `string` | | `role` | 必需 | `"developer"` | -| `source` | 必需 | [`MessageSource`](#persistence-type-sha256-40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945) | +| `source` | 必需 | [`MessageSource`](#persistence-type-sha256-26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116) | 消息源兼容策略:`source` — `session-source-attribution` v1; `session.developer-message.source`; `kind`; `preserve`. -仅表示归属的新增 kind:`tmux-context`. +仅表示归属的新增 kind:`tmux-context`, `user-question-reply`. @@ -3843,7 +3859,7 @@ SHA-256: `6f72ece8f317cd080c4f20a93f1bf709965f5b81ac4669528f5a023191cfcf20` | `step` | 必需 | `number` | | `turn` | 必需 | `number` | - + @@ -3851,17 +3867,17 @@ SHA-256: `6f72ece8f317cd080c4f20a93f1bf709965f5b81ac4669528f5a023191cfcf20` ### `Message` -SHA-256: `691c0f641cd3e8072fdacd6fa8c400253cf75a0ce9285d8ce89141bbb24f2fb6` +SHA-256: `cb7b863ddb7b3eab5f18f216602feba25f47b456e73e4e72b6bcc259875c6dab` 来源:[`packages/llm/llm/src/message.ts:196`](../packages/llm/llm/src/message.ts) 以下类型之一: - [`ToolResultMessage`](#persistence-type-sha256-4b259f7f8f0a44ad5e90b70a73553ced1df27012d126921d397ff403b6c86731) -- [`DeveloperMessage`](#persistence-type-sha256-f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b) -- [`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586) -- [`AssistantMessage`](#persistence-type-sha256-fa87537f4a9c1e25602990a8bf686b383e9e00352ec8946e16ae24ba7c1625be) +- [`DeveloperMessage`](#persistence-type-sha256-1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200) +- [`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd) - [`SystemMessage`](#persistence-type-sha256-09f3f8dc417f278257202714132f98ba7b52957d7b558c4a04456603890eb363) +- [`AssistantMessage`](#persistence-type-sha256-fa87537f4a9c1e25602990a8bf686b383e9e00352ec8946e16ae24ba7c1625be) @@ -3936,7 +3952,7 @@ SHA-256: `390eed1028aba02774f14408647acec10ec5516e97d4f15ecde2b9989d5a69f2` - `"negative"` - `"positive"` - + @@ -3944,7 +3960,7 @@ SHA-256: `390eed1028aba02774f14408647acec10ec5516e97d4f15ecde2b9989d5a69f2` ### `MessageSource` -SHA-256: `40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945` +SHA-256: `26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116` 来源:[`packages/llm/llm/src/message.ts:136`](../packages/llm/llm/src/message.ts) @@ -4058,15 +4074,16 @@ SHA-256: `40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945` | `user-approval` | `"relay"` | 无 | [`{ kind: "user-approval", form: "relay" }`](#persistence-type-sha256-5cdbf342b7748d152bc987b68f58e565e5bba4b227e076e2d2120d87662e45cd) | | `user-approval` | `"snapshot"` | `sections`: [`ContextSnapshotSection[]`](#persistence-type-sha256-c748fb42c80a120038a8c587af80ec39924803c401364db11c8974d5bf6d0262) | [`{ kind: "user-approval", form: "snapshot" }`](#persistence-type-sha256-5654685d7557ec747e74887237065e626a5bdfa426ca43f7fbb0b6fee9b0916c) | | `user-approval` | 未声明 | 无 | [`{ kind: "user-approval" }`](#persistence-type-sha256-6292bcbedaa97feaec5b48a03bb8144b581b93309d9d6c905f26da7a6a7a0a4f) | +| `user-question-reply` | 未声明 | `callId`: `string`; `outcome`: `"answered"` | [`{ kind: "user-question-reply" }`](#persistence-type-sha256-c55827fba7018198772c50e37cb7d3f60a3d8bb6e94b07de72dee0d9f8968005) | | `webhook` | `"notice"` | `deliveryId`: `string`; `provider`: `string`; `ruleId`: `string`; `source`: `string`; `summary`: `string` | [`{ kind: "webhook", form: "notice" }`](#persistence-type-sha256-9edc162949abf93bd5ff049191b345454ba104f583937ce5580fb50f067d2b94) | - + ### `Message[]` -SHA-256: `fc8242857caf7450d7f68a1f509dce83e237bd21571666006895124cb2246a83` +SHA-256: `3f42f45cbb8a06586d247e5f3763dc02c8d31a145a9a3b82fabcd101e7e224cc` -[`Message`](#persistence-type-sha256-691c0f641cd3e8072fdacd6fa8c400253cf75a0ce9285d8ce89141bbb24f2fb6) 的数组。 +[`Message`](#persistence-type-sha256-cb7b863ddb7b3eab5f18f216602feba25f47b456e73e4e72b6bcc259875c6dab) 的数组。 @@ -4433,7 +4450,7 @@ SHA-256: `b56f6a885da3dc394c69a3e3cc5c0cfc4da15601b63fda4989eee8f40efc5be4` | `source` | 必需 | [`SessionTitleSource`](#persistence-type-sha256-30d5a537b296685770b1241c4b4bbde19d5a31ff81aa23df73fab5e90b8fc65f) | | `title` | 必需 | `string` | - + @@ -4441,7 +4458,7 @@ SHA-256: `b56f6a885da3dc394c69a3e3cc5c0cfc4da15601b63fda4989eee8f40efc5be4` ### `SessionTitleLlmRequestEventData` -SHA-256: `9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd` +SHA-256: `fe3cdc6f9050584cea4a6d6998c31334bff7899f5ff1095082a44fdf3b47e996` 来源:[`packages/session/session-title-llm/src/index.ts:34`](../packages/session/session-title-llm/src/index.ts) @@ -4449,7 +4466,7 @@ SHA-256: `9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd` |---|---|---| | `maxTokens` | 必需 | `number` | | `messageSeqs` | 必需 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | -| `messages` | 必需 | [`Message[]`](#persistence-type-sha256-fc8242857caf7450d7f68a1f509dce83e237bd21571666006895124cb2246a83) | +| `messages` | 必需 | [`Message[]`](#persistence-type-sha256-3f42f45cbb8a06586d247e5f3763dc02c8d31a145a9a3b82fabcd101e7e224cc) | | `route` | 必需 | [`SessionTitleModelIdentity`](#persistence-type-sha256-07e1a58c58b593f507b8e7f25723bb0aa42baae6e00f5ecfddf28cb1e64d3235) | | `system` | 必需 | `string` | | `titleProvider` | 必需 | `string` | @@ -5103,7 +5120,7 @@ SHA-256: `f1687f982fa3d41ef29e159feed154ecd13af4dd209acaee16038f223f2e9402` | `interrupted` | 未声明 | 无 | [`{ kind: "interrupted" }`](#persistence-type-sha256-56b7c047694875a843ba020dfea3c8380d54ae4ff88ab349e72004dc21e07c23) | | `max-tokens` | 未声明 | 无 | [`{ kind: "max-tokens" }`](#persistence-type-sha256-ab7ec5f9eb2c6dfacca5da4c37cf7ba85d04172053ee6b1ebf1709ffcd99c1a7) | - + @@ -5111,7 +5128,7 @@ SHA-256: `f1687f982fa3d41ef29e159feed154ecd13af4dd209acaee16038f223f2e9402` ### `UserMessage` -SHA-256: `64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586` +SHA-256: `cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd` 来源:[`packages/llm/llm/src/message.ts:162`](../packages/llm/llm/src/message.ts) @@ -5120,19 +5137,19 @@ SHA-256: `64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586` | `content` | 必需 | [`ContentBlock[]`](#persistence-type-sha256-b52f215a6cd691058a3413c12f161fa3b563a2f4895adb3df6f744ec4b0a6ef1) | | `id` | 必需 | `string` | | `role` | 必需 | `"user"` | -| `source` | 必需 | [`MessageSource`](#persistence-type-sha256-40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945) | +| `source` | 必需 | [`MessageSource`](#persistence-type-sha256-26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116) | 消息源兼容策略:`source` — `session-source-attribution` v1; `session.user-message.source`; `kind`; `preserve`. -仅表示归属的新增 kind:`tmux-context`. +仅表示归属的新增 kind:`tmux-context`, `user-question-reply`. - + ### `UserMessage[]` -SHA-256: `d1f27cf1650e5f59d5d6e95ce6dfd92b31757af076a8ab6418a70b6dbdd53621` +SHA-256: `5a92f12db2059c282cdea45b6845c65e6f4a95dd3d649aeddbde6f9ae03c561f` -[`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586) 的数组。 +[`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd) 的数组。 @@ -5975,18 +5992,18 @@ SHA-256: `ad0c38a0adb82a94c925456df41586d9b5f9202fca18593eae2213d4445b4585` | `reason` | 必需 | [`RequestHeaderReason`](#persistence-type-sha256-530da6c0267813bb4511af72883cc518834e624e3b3220a7062955fd57a788a6) | | `startsSeries` | 可选 | `true` | - + ### `{ headerSeq?, message, step, turn }` -SHA-256: `51c78ccc9023ce6642d07fb9a10cbf942ff7e313d5b304ddc77218df71da708f` +SHA-256: `a5d80b5a2f3a6bbaf8f0334126632b78f94d8346122c68e8122ea89906d63d26` 来源:[`packages/core/session/src/types.ts:311`](../packages/core/session/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| | `headerSeq` | 可选 | `number` | -| `message` | 必需 | [`DeveloperMessage`](#persistence-type-sha256-f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b) | +| `message` | 必需 | [`DeveloperMessage`](#persistence-type-sha256-1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200) | | `step` | 必需 | `number` | | `turn` | 必需 | `number` | @@ -6070,17 +6087,17 @@ SHA-256: `17d1afb770d9941936130996da00dc86782cfef731d8d6526162c301256a4ac3` |---|---|---| | `inherited` | 可选 | `true` | - + ### `{ inserted, outcome?, removedCount?, start, … }` -SHA-256: `dc4bd7ac827f4b1f9236f9a157a4b4cc171a0588064a611e43edd95f62c68130` +SHA-256: `149c5a77529cb0dc06f5ceb6273069b7606174d1e7893b5f9b1071c15306b846` 来源:[`packages/core/agent/src/types.ts:96`](../packages/core/agent/src/types.ts) | 属性 | 存在性 | 类型 | |---|---|---| -| `inserted` | 必需 | [`UserMessage[]`](#persistence-type-sha256-d1f27cf1650e5f59d5d6e95ce6dfd92b31757af076a8ab6418a70b6dbdd53621) | +| `inserted` | 必需 | [`UserMessage[]`](#persistence-type-sha256-5a92f12db2059c282cdea45b6845c65e6f4a95dd3d649aeddbde6f9ae03c561f) | | `outcome` | 可选 | `"canceled"` | | `removedCount` | 可选 | `number` | | `start` | 必需 | `number` | @@ -7339,6 +7356,20 @@ SHA-256: `5654685d7557ec747e74887237065e626a5bdfa426ca43f7fbb0b6fee9b0916c` | `kind` | 必需 | `"user-approval"` | | `sections` | 必需 | [`ContextSnapshotSection[]`](#persistence-type-sha256-c748fb42c80a120038a8c587af80ec39924803c401364db11c8974d5bf6d0262) | + + +### `{ kind: "user-question-reply" }` + +SHA-256: `c55827fba7018198772c50e37cb7d3f60a3d8bb6e94b07de72dee0d9f8968005` + +来源:[`packages/interaction/user-questions/src/types.ts:117`](../packages/interaction/user-questions/src/types.ts) + +| 属性 | 存在性 | 类型 | +|---|---|---| +| `callId` | 必需 | `string` | +| `kind` | 必需 | `"user-question-reply"` | +| `outcome` | 必需 | `"answered"` | + ### `{ kind: "webhook", form: "notice" }` @@ -7614,17 +7645,17 @@ SHA-256: `a10c17474eaf2ddab7095a099e0fe3d046fc18e56c3e344fc8894c05ff9ef97b` | `time` | 必需 | `number` | | `type` | 必需 | `"agent-preset/selected"` | - + ### `{ type: "agent/inbox/spliced" }` -SHA-256: `1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c` +SHA-256: `6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-dc4bd7ac827f4b1f9236f9a157a4b4cc171a0588064a611e43edd95f62c68130) | +| `data` | 必需 | [`{ inserted, outcome?, removedCount?, start, … }`](#persistence-type-sha256-149c5a77529cb0dc06f5ceb6273069b7606174d1e7893b5f9b1071c15306b846) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -7865,17 +7896,17 @@ SHA-256: `13d3d180f977bf78081d487ffa0ecb75857349bcab29a5a3fb48189fca2a6176` | `time` | 必需 | `number` | | `type` | 必需 | `"deliverables/presented"` | - + ### `{ type: "developer/message" }` -SHA-256: `eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80` +SHA-256: `186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`{ headerSeq?, message, step, turn }`](#persistence-type-sha256-51c78ccc9023ce6642d07fb9a10cbf942ff7e313d5b304ddc77218df71da708f) | +| `data` | 必需 | [`{ headerSeq?, message, step, turn }`](#persistence-type-sha256-a5d80b5a2f3a6bbaf8f0334126632b78f94d8346122c68e8122ea89906d63d26) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `sourceEventSeqs` | 可选 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | @@ -8231,17 +8262,17 @@ SHA-256: `1b912703e2d64f91c99c675b8f805b01076c8325b905c1218ad81ef0b24909d5` | `time` | 必需 | `number` | | `type` | 必需 | `"session/title"` | - + ### `{ type: "session/title-llm-request" }` -SHA-256: `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` +SHA-256: `ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd) | +| `data` | 必需 | [`SessionTitleLlmRequestEventData`](#persistence-type-sha256-fe3cdc6f9050584cea4a6d6998c31334bff7899f5ff1095082a44fdf3b47e996) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `time` | 必需 | `number` | @@ -8664,17 +8695,17 @@ SHA-256: `f1a96afe7503ac1817de769cd0ba13d9b80111c7034c50106b3344ecc14cc515` | `type` | 必需 | `"usage"` | | `usage` | 必需 | [`TokenUsage`](#persistence-type-sha256-fec5442b9ee4122e10514d81d5a43648003fe8bfb7ee2ba50c0cdbdd383ed394) | - + ### `{ type: "user/message" }` -SHA-256: `3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761` +SHA-256: `b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411` | 属性 | 存在性 | 类型 | |---|---|---| -| `data` | 必需 | [`UserMessage`](#persistence-type-sha256-64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586) | +| `data` | 必需 | [`UserMessage`](#persistence-type-sha256-cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd) | | `ignorable` | 可选 | `true` | | `seq` | 必需 | `number` | | `sourceEventSeqs` | 可选 | [`number[]`](#persistence-type-sha256-5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78) | diff --git a/docs/persistence-changes/2026-09-21-user-question-reply.i18n.yaml b/docs/persistence-changes/2026-09-21-user-question-reply.i18n.yaml new file mode 100644 index 0000000000..42c589c563 --- /dev/null +++ b/docs/persistence-changes/2026-09-21-user-question-reply.i18n.yaml @@ -0,0 +1,28 @@ +# Bilingual-pair consistency record for 2026-09-21-user-question-reply.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write docs/persistence-changes/2026-09-21-user-question-reply.md +/: + en: 3d5a424ae7d7e46b + zh: c22a8e4a62d8cc1a +/2026-09-21-user-question-reply: + en: de475e4778124528 + zh: 2b619b0c0f3a6a6e +/2026-09-21-user-question-reply/summary: + en: bf6a131a55aaa3bc + zh: b781b8c78d0dd7a8 +/2026-09-21-user-question-reply/table-of-contents: + en: 6cf314a069ceb451 + zh: 9adff678e9ecab3b +/2026-09-21-user-question-reply/declaration: + en: 6907136f28e48c90 + zh: 02f8298485f3d8e7 +/2026-09-21-user-question-reply/compatibility: + en: 473d2dd57ff5b150 + zh: 9a8c5ee49b9f862e +/2026-09-21-user-question-reply/verification: + en: 523c0abe85cc0061 + zh: c38e1e107bdd15a1 +/2026-09-21-user-question-reply/dev-note: + en: b75c8458928b72b9 + zh: 003ba4e17b4b5269 diff --git a/docs/persistence-changes/2026-09-21-user-question-reply.md b/docs/persistence-changes/2026-09-21-user-question-reply.md new file mode 100644 index 0000000000..c8e86c40d4 --- /dev/null +++ b/docs/persistence-changes/2026-09-21-user-question-reply.md @@ -0,0 +1,60 @@ +--- +description: "Records a persistence type transition and its compatibility acknowledgement." +kind: persistence-change +--- + +# 2026-09-21-user-question-reply + +English | [中文](2026-09-21-user-question-reply.zh.md) + +## Summary + +Adds a qualified user-question-reply message source for a late answer to a continued ask_user_question call. + +## Table of Contents + +- [Declaration](#declaration) +- [Compatibility](#compatibility) +- [Verification](#verification) +- [Dev Note](#dev-note) + + +## Declaration + +```yaml persistence-change +schemaVersion: 1 +id: 2026-09-21-user-question-reply +baseline: false +changes: + - root: "event:agent/inbox/spliced" + previous: "2026-09-16-session-format-v4" + after: "6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178" + decision: same-version + - root: "event:developer/message" + previous: "2026-09-16-session-format-v4" + after: "186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467" + decision: same-version + - root: "event:session/title-llm-request" + previous: "2026-09-16-session-format-v4" + after: "ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46" + decision: same-version + - root: "event:user/message" + previous: "2026-09-16-session-format-v4" + after: "b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411" + decision: same-version +``` + + +## Compatibility + +Existing logs contain no such source and remain valid. The new source is qualified attribution on an ordinary user message; readers without dsh-user-questions preserve the message and derive history from its content. Only the userQuestions projection reads this source to close the named question and record its answers. The answer RPC is its only producer and writes outcome answered; closing the Client panel persists no reply. No event type or Session header changes. + + +## Verification + +pnpm exec vitest run packages/interaction/user-questions/tests packages/interaction/tool-ask-user/tests: 81 tests passed. The focused projection, reply, view, and process-group suite passed 70 tests. pnpm run typecheck passed. pnpm run doc-sync passed all 42 gates, including persistence history and translation pairing. + + +## Dev Note + +None. diff --git a/docs/persistence-changes/2026-09-21-user-question-reply.schema.json b/docs/persistence-changes/2026-09-21-user-question-reply.schema.json new file mode 100644 index 0000000000..d7d9c16415 --- /dev/null +++ b/docs/persistence-changes/2026-09-21-user-question-reply.schema.json @@ -0,0 +1,11405 @@ +{ + "formatVersion": 2, + "roots": [ + { + "key": "event:agent/inbox/spliced", + "kind": "event", + "event": "agent/inbox/spliced", + "surface": false, + "digest": "6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 27, + "optional": true + }, + { + "name": "seq", + "type": 20, + "optional": false + }, + { + "name": "time", + "type": 20, + "optional": false + }, + { + "name": "type", + "type": 202, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "inserted", + "type": 2, + "optional": false + }, + { + "name": "outcome", + "type": 198, + "optional": true + }, + { + "name": "removedCount", + "type": 20, + "optional": true + }, + { + "name": "start", + "type": 20, + "optional": false + }, + { + "name": "target", + "type": 199, + "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": 32, + "optional": false + }, + { + "name": "source", + "type": 33, + "optional": false, + "compatibility": { + "version": 1, + "policy": "session-source-attribution", + "binding": "session.user-message.source", + "discriminator": "kind", + "unknownKinds": "preserve", + "attributionKinds": [ + "tmux-context", + "user-question-reply" + ] + } + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 11, + 14, + 16, + 18, + 29 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "tool", + "type": 12, + "optional": true + }, + { + "name": "toolName", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "never" + }, + { + "kind": "literal", + "value": "tool-addition" + }, + { + "kind": "object", + "properties": [ + { + "name": "toolName", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 15, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-removal" + }, + { + "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": 27, + "optional": true + }, + { + "name": "type", + "type": 28, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 20, + "optional": false + }, + { + "name": "height", + "type": 20, + "optional": false + }, + { + "name": "mediaType", + "type": 21, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": true + }, + { + "name": "originalDimensions", + "type": 26, + "optional": true + }, + { + "name": "width", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "union", + "types": [ + 22, + 23, + 24, + 25 + ] + }, + { + "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": 20, + "optional": false + }, + { + "name": "width", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": true + }, + { + "kind": "literal", + "value": "image" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 30, + "optional": false + }, + { + "name": "type", + "type": 31, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 7, + "optional": false + }, + { + "name": "bytes", + "type": 20, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 34, + 37, + 39, + 41, + 43, + 45, + 47, + 49, + 51, + 53, + 55, + 58, + 60, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 116, + 118, + 121, + 122, + 123, + 124, + 125, + 127, + 128, + 129, + 130, + 132, + 133, + 134, + 135, + 136, + 138, + 139, + 140, + 142, + 143, + 151, + 154, + 156, + 157, + 159, + 161, + 165, + 167, + 175, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 193, + 195, + 196, + 197 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "plan-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-jobs" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-approval" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "hooks-claude-code" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-codex" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model-selection" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 115, + "optional": false + }, + { + "name": "revision", + "type": 20, + "optional": false + }, + { + "name": "round", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 117, + "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": 119, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 120, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 126, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "ptc-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 131, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 137, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-registry" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 32, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 141, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 27, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 7, + "optional": true + }, + { + "name": "changes", + "type": 144, + "optional": false + }, + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 150, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 145 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 146, + "optional": false + }, + { + "name": "digest", + "type": 7, + "optional": true + }, + { + "name": "path", + "type": 7, + "optional": false + }, + { + "name": "scope", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 147, + 148, + 149 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 152, + "optional": false + }, + { + "name": "outcome", + "type": 153, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 155, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 7, + "optional": true + }, + { + "name": "kind", + "type": 32, + "optional": false + }, + { + "name": "rpcId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 158, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 7, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "compact-checkpoint" + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 7, + "optional": false + }, + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 160, + "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": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 162, + "optional": false + }, + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 164, + "optional": false + }, + { + "name": "update", + "type": 27, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 163 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 166, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 168, + "optional": false + }, + { + "name": "references", + "type": 169, + "optional": false + }, + { + "name": "version", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 170 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 20, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 171, + "optional": false + }, + { + "name": "compacted", + "type": 173, + "optional": false + }, + { + "name": "inputIndex", + "type": 20, + "optional": false + }, + { + "name": "label", + "type": 7, + "optional": false + }, + { + "name": "omittedBytes", + "type": 20, + "optional": false + }, + { + "name": "omittedMessages", + "type": 20, + "optional": false + }, + { + "name": "originalMessages", + "type": 20, + "optional": false + }, + { + "name": "retainedMessages", + "type": 20, + "optional": false + }, + { + "name": "sessionId", + "type": 7, + "optional": false + }, + { + "name": "truncated", + "type": 173, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 20, + 172 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "array", + "element": 178 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 192, + "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": 87, + "optional": false + }, + { + "name": "kind", + "type": 194, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 61, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "canceled" + }, + { + "kind": "union", + "types": [ + 200, + 201 + ] + }, + { + "kind": "literal", + "value": "next-step" + }, + { + "kind": "literal", + "value": "next-turn" + }, + { + "kind": "literal", + "value": "agent/inbox/spliced" + } + ] + } + }, + { + "key": "event:developer/message", + "kind": "event", + "event": "developer/message", + "surface": true, + "digest": "186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467", + "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": "sourceEventSeqs", + "type": 198, + "optional": true + }, + { + "name": "surfaceOp", + "type": 199, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 202, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "headerSeq", + "type": 2, + "optional": true + }, + { + "name": "message", + "type": 3, + "optional": false + }, + { + "name": "step", + "type": 2, + "optional": false + }, + { + "name": "turn", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 4, + "optional": false + }, + { + "name": "id", + "type": 7, + "optional": false + }, + { + "name": "role", + "type": 31, + "optional": false + }, + { + "name": "source", + "type": 32, + "optional": false, + "compatibility": { + "version": 1, + "policy": "session-source-attribution", + "binding": "session.developer-message.source", + "discriminator": "kind", + "unknownKinds": "preserve", + "attributionKinds": [ + "tmux-context", + "user-question-reply" + ] + } + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 5 + }, + { + "kind": "union", + "types": [ + 6, + 9, + 11, + 14, + 16, + 18, + 28 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 8, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "tool", + "type": 12, + "optional": true + }, + { + "name": "toolName", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "never" + }, + { + "kind": "literal", + "value": "tool-addition" + }, + { + "kind": "object", + "properties": [ + { + "name": "toolName", + "type": 7, + "optional": false + }, + { + "name": "type", + "type": 15, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-removal" + }, + { + "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": "literal", + "value": "developer" + }, + { + "kind": "union", + "types": [ + 33, + 36, + 38, + 40, + 42, + 44, + 46, + 48, + 50, + 52, + 54, + 57, + 59, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 115, + 117, + 120, + 121, + 122, + 123, + 124, + 125, + 127, + 128, + 129, + 130, + 132, + 133, + 134, + 135, + 136, + 138, + 140, + 141, + 143, + 151, + 154, + 156, + 157, + 159, + 161, + 165, + 167, + 175, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 193, + 195, + 196, + 197 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "model-selection" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "plan-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-jobs" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-approval" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-claude-code" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-codex" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 114, + "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": 116, + "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": 118, + "optional": false + }, + { + "name": "model", + "type": 7, + "optional": false + }, + { + "name": "provider", + "type": 7, + "optional": false + }, + { + "name": "replayState", + "type": 119, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 60, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 37, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 126, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "ptc-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 39, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 41, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 131, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 137, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-registry" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 139, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 142, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 26, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 7, + "optional": true + }, + { + "name": "changes", + "type": 144, + "optional": false + }, + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 150, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 145 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 146, + "optional": false + }, + { + "name": "digest", + "type": 7, + "optional": true + }, + { + "name": "path", + "type": 7, + "optional": false + }, + { + "name": "scope", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 147, + 148, + 149 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 152, + "optional": false + }, + { + "name": "outcome", + "type": 153, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 155, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 7, + "optional": true + }, + { + "name": "kind", + "type": 139, + "optional": false + }, + { + "name": "rpcId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 158, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 7, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "compact-checkpoint" + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 7, + "optional": false + }, + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 160, + "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": "webhook" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 162, + "optional": false + }, + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 164, + "optional": false + }, + { + "name": "update", + "type": 26, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 163 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 7, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 166, + "optional": false + }, + { + "name": "name", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 168, + "optional": false + }, + { + "name": "references", + "type": 169, + "optional": false + }, + { + "name": "version", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 170 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 2, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 171, + "optional": false + }, + { + "name": "compacted", + "type": 173, + "optional": false + }, + { + "name": "inputIndex", + "type": 2, + "optional": false + }, + { + "name": "label", + "type": 7, + "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": 7, + "optional": false + }, + { + "name": "truncated", + "type": 173, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 172 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "array", + "element": 178 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 7, + "optional": false + }, + { + "name": "text", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 37, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 192, + "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": 86, + "optional": false + }, + { + "name": "kind", + "type": 194, + "optional": false + }, + { + "name": "senderSessionId", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 56, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 60, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 2 + }, + { + "kind": "union", + "types": [ + 200, + 201 + ] + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 2, + "optional": false + }, + { + "name": "op", + "type": 148, + "optional": false + }, + { + "name": "startSeq", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "developer/message" + } + ] + } + }, + { + "key": "event:session/title-llm-request", + "kind": "event", + "event": "session/title-llm-request", + "surface": false, + "digest": "ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 29, + "optional": true + }, + { + "name": "seq", + "type": 2, + "optional": false + }, + { + "name": "time", + "type": 2, + "optional": false + }, + { + "name": "type", + "type": 208, + "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": 207, + "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, + 37, + 202, + 203, + 205 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "isError", + "type": 34, + "optional": true + }, + { + "name": "role", + "type": 35, + "optional": false + }, + { + "name": "source", + "type": 36, + "optional": false + }, + { + "name": "toolCallId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 8 + }, + { + "kind": "union", + "types": [ + 9, + 12, + 14, + 17, + 19, + 21, + 31 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "string" + }, + { + "kind": "literal", + "value": "reasoning" + }, + { + "kind": "object", + "properties": [ + { + "name": "text", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "text" + }, + { + "kind": "object", + "properties": [ + { + "name": "tool", + "type": 15, + "optional": true + }, + { + "name": "toolName", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 16, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "never" + }, + { + "kind": "literal", + "value": "tool-addition" + }, + { + "kind": "object", + "properties": [ + { + "name": "toolName", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-removal" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 10, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "type", + "type": 20, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-call" + }, + { + "kind": "object", + "properties": [ + { + "name": "attachment", + "type": 22, + "optional": false + }, + { + "name": "offloaded", + "type": 29, + "optional": true + }, + { + "name": "type", + "type": 30, + "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": 23, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": true + }, + { + "name": "originalDimensions", + "type": 28, + "optional": true + }, + { + "name": "width", + "type": 2, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 24, + 25, + 26, + 27 + ] + }, + { + "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": 32, + "optional": false + }, + { + "name": "type", + "type": 33, + "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": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 35, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 38, + "optional": false + }, + { + "name": "source", + "type": 39, + "optional": false, + "compatibility": { + "version": 1, + "policy": "session-source-attribution", + "binding": "session.developer-message.source", + "discriminator": "kind", + "unknownKinds": "preserve", + "attributionKinds": [ + "tmux-context", + "user-question-reply" + ] + } + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "developer" + }, + { + "kind": "union", + "types": [ + 36, + 40, + 45, + 47, + 49, + 51, + 53, + 55, + 57, + 59, + 60, + 62, + 64, + 65, + 68, + 71, + 73, + 75, + 77, + 79, + 88, + 91, + 92, + 94, + 96, + 98, + 100, + 105, + 107, + 115, + 116, + 117, + 118, + 119, + 120, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 174, + 175, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 187, + 189, + 192, + 193, + 194, + 195, + 196, + 197, + 199, + 200, + 201 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "literal", + "value": "user-approval" + }, + { + "kind": "array", + "element": 44 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-jobs" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-registry" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 67, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-claude-code" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-codex" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model-selection" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "plan-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 29, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 10, + "optional": true + }, + { + "name": "changes", + "type": 80, + "optional": false + }, + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 87, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 81 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 82, + "optional": false + }, + { + "name": "digest", + "type": 10, + "optional": true + }, + { + "name": "path", + "type": 10, + "optional": false + }, + { + "name": "scope", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 83, + 84, + 85 + ] + }, + { + "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": 10, + "optional": false + }, + { + "name": "kind", + "type": 89, + "optional": false + }, + { + "name": "outcome", + "type": 90, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 10, + "optional": true + }, + { + "name": "kind", + "type": 58, + "optional": false + }, + { + "name": "rpcId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 95, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 10, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "compact-checkpoint" + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 10, + "optional": false + }, + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 97, + "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": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "entries", + "type": 101, + "optional": false + }, + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 104, + "optional": false + }, + { + "name": "update", + "type": 29, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 102 + }, + { + "kind": "object", + "properties": [ + { + "name": "description", + "type": 10, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "literal", + "value": "skill-catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 106, + "optional": false + }, + { + "name": "name", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 109, + "optional": false + }, + { + "name": "references", + "type": 110, + "optional": false + }, + { + "name": "version", + "type": 114, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 111 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 2, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 112, + "optional": false + }, + { + "name": "compacted", + "type": 34, + "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": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 2, + 113 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 186, + "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": 188, + "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": 190, + "optional": false + }, + { + "name": "model", + "type": 10, + "optional": false + }, + { + "name": "provider", + "type": 10, + "optional": false + }, + { + "name": "replayState", + "type": 191, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 198, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "ptc-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 58, + "optional": false + }, + { + "name": "source", + "type": 39, + "optional": false, + "compatibility": { + "version": 1, + "policy": "session-source-attribution", + "binding": "session.user-message.source", + "discriminator": "kind", + "unknownKinds": "preserve", + "attributionKinds": [ + "tmux-context", + "user-question-reply" + ] + } + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 204, + "optional": false + }, + { + "name": "source", + "type": 189, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "assistant" + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 7, + "optional": false + }, + { + "name": "id", + "type": 10, + "optional": false + }, + { + "name": "role", + "type": 206, + "optional": false + }, + { + "name": "source", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system" + }, + { + "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:user/message", + "kind": "event", + "event": "user/message", + "surface": true, + "digest": "b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411", + "schema": { + "root": 0, + "nodes": [ + { + "kind": "object", + "properties": [ + { + "name": "data", + "type": 1, + "optional": false + }, + { + "name": "ignorable", + "type": 25, + "optional": true + }, + { + "name": "seq", + "type": 18, + "optional": false + }, + { + "name": "sourceEventSeqs", + "type": 196, + "optional": true + }, + { + "name": "surfaceOp", + "type": 197, + "optional": false + }, + { + "name": "time", + "type": 18, + "optional": false + }, + { + "name": "type", + "type": 200, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "content", + "type": 2, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "role", + "type": 30, + "optional": false + }, + { + "name": "source", + "type": 31, + "optional": false, + "compatibility": { + "version": 1, + "policy": "session-source-attribution", + "binding": "session.user-message.source", + "discriminator": "kind", + "unknownKinds": "preserve", + "attributionKinds": [ + "tmux-context", + "user-question-reply" + ] + } + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 3 + }, + { + "kind": "union", + "types": [ + 4, + 7, + 9, + 12, + 14, + 16, + 27 + ] + }, + { + "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": "tool", + "type": 10, + "optional": true + }, + { + "name": "toolName", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 11, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "never" + }, + { + "kind": "literal", + "value": "tool-addition" + }, + { + "kind": "object", + "properties": [ + { + "name": "toolName", + "type": 5, + "optional": false + }, + { + "name": "type", + "type": 13, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-removal" + }, + { + "kind": "object", + "properties": [ + { + "name": "arguments", + "type": 5, + "optional": false + }, + { + "name": "id", + "type": 5, + "optional": false + }, + { + "name": "name", + "type": 5, + "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": 25, + "optional": true + }, + { + "name": "type", + "type": 26, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "attachmentId", + "type": 5, + "optional": false + }, + { + "name": "bytes", + "type": 18, + "optional": false + }, + { + "name": "height", + "type": 18, + "optional": false + }, + { + "name": "mediaType", + "type": 19, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": true + }, + { + "name": "originalDimensions", + "type": 24, + "optional": true + }, + { + "name": "width", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "primitive", + "type": "number" + }, + { + "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": 18, + "optional": false + }, + { + "name": "width", + "type": 18, + "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": 5, + "optional": false + }, + { + "name": "bytes", + "type": 18, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "file" + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "union", + "types": [ + 32, + 35, + 37, + 39, + 41, + 43, + 45, + 47, + 49, + 51, + 54, + 56, + 58, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 113, + 115, + 118, + 119, + 120, + 121, + 122, + 124, + 125, + 126, + 127, + 129, + 130, + 131, + 132, + 133, + 135, + 136, + 137, + 139, + 140, + 148, + 151, + 153, + 154, + 156, + 158, + 162, + 164, + 172, + 176, + 177, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 190, + 192, + 193, + 194, + 195 + ] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-jobs" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-approval" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "instructions" + }, + { + "kind": "literal", + "value": "hooks-claude-code" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-codex" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model-selection" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "plan-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "recall" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "catalog" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "goalId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 112, + "optional": false + }, + { + "name": "revision", + "type": 18, + "optional": false + }, + { + "name": "round", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 114, + "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": 116, + "optional": false + }, + { + "name": "model", + "type": 5, + "optional": false + }, + { + "name": "provider", + "type": 5, + "optional": false + }, + { + "name": "replayState", + "type": 117, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model" + }, + { + "kind": "opaque", + "reason": "unknown" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 55, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 57, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 123, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "ptc-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 34, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 38, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 128, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 134, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-registry" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 30, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 138, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "baseline", + "type": 25, + "optional": true + }, + { + "name": "baselineIdentity", + "type": 5, + "optional": true + }, + { + "name": "changes", + "type": 141, + "optional": false + }, + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 147, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 142 + }, + { + "kind": "object", + "properties": [ + { + "name": "action", + "type": 143, + "optional": false + }, + { + "name": "digest", + "type": 5, + "optional": true + }, + { + "name": "path", + "type": 5, + "optional": false + }, + { + "name": "scope", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 144, + 145, + 146 + ] + }, + { + "kind": "literal", + "value": "remove" + }, + { + "kind": "literal", + "value": "replace" + }, + { + "kind": "literal", + "value": "set" + }, + { + "kind": "literal", + "value": "agent-instructions" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 149, + "optional": false + }, + { + "name": "outcome", + "type": 150, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 152, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool" + }, + { + "kind": "object", + "properties": [ + { + "name": "clientTimeZone", + "type": 5, + "optional": true + }, + { + "name": "kind", + "type": 30, + "optional": false + }, + { + "name": "rpcId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "compactionId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 155, + "optional": false + }, + { + "name": "sourceCommandId", + "type": 5, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "compact-checkpoint" + }, + { + "kind": "object", + "properties": [ + { + "name": "deliveryId", + "type": 5, + "optional": false + }, + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 157, + "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": 159, + "optional": false + }, + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 161, + "optional": false + }, + { + "name": "update", + "type": 25, + "optional": true + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 160 + }, + { + "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": 52, + "optional": false + }, + { + "name": "kind", + "type": 163, + "optional": false + }, + { + "name": "name", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "skill-invocation" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 165, + "optional": false + }, + { + "name": "references", + "type": 166, + "optional": false + }, + { + "name": "version", + "type": 171, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "session-reference" + }, + { + "kind": "array", + "element": 167 + }, + { + "kind": "object", + "properties": [ + { + "name": "capturedFormatVersion", + "type": 18, + "optional": true + }, + { + "name": "capturedThroughSeq", + "type": 168, + "optional": false + }, + { + "name": "compacted", + "type": 170, + "optional": false + }, + { + "name": "inputIndex", + "type": 18, + "optional": false + }, + { + "name": "label", + "type": 5, + "optional": false + }, + { + "name": "omittedBytes", + "type": 18, + "optional": false + }, + { + "name": "omittedMessages", + "type": 18, + "optional": false + }, + { + "name": "originalMessages", + "type": 18, + "optional": false + }, + { + "name": "retainedMessages", + "type": 18, + "optional": false + }, + { + "name": "sessionId", + "type": 5, + "optional": false + }, + { + "name": "truncated", + "type": 170, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "union", + "types": [ + 18, + 169 + ] + }, + { + "kind": "primitive", + "type": "null" + }, + { + "kind": "primitive", + "type": "boolean" + }, + { + "kind": "literal", + "value": 1 + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "snapshot" + }, + { + "kind": "array", + "element": 175 + }, + { + "kind": "object", + "properties": [ + { + "name": "name", + "type": 5, + "optional": false + }, + { + "name": "text", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 34, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 36, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 189, + "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": 84, + "optional": false + }, + { + "name": "kind", + "type": 191, + "optional": false + }, + { + "name": "senderSessionId", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 55, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 57, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 59, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "array", + "element": 18 + }, + { + "kind": "union", + "types": [ + 198, + 199 + ] + }, + { + "kind": "literal", + "value": "append" + }, + { + "kind": "object", + "properties": [ + { + "name": "endSeq", + "type": 18, + "optional": false + }, + { + "name": "op", + "type": 145, + "optional": false + }, + { + "name": "startSeq", + "type": 18, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user/message" + } + ] + } + } + ], + "types": [] +} diff --git a/docs/persistence-changes/2026-09-21-user-question-reply.zh.md b/docs/persistence-changes/2026-09-21-user-question-reply.zh.md new file mode 100644 index 0000000000..a0b3ba9a6c --- /dev/null +++ b/docs/persistence-changes/2026-09-21-user-question-reply.zh.md @@ -0,0 +1,60 @@ +--- +description: "记录持久化类型更改及其兼容性确认。" +kind: persistence-change +--- + +# 2026-09-21-user-question-reply + +[English](2026-09-21-user-question-reply.md) | 中文 + +## 概述 + +新增受限定的 user-question-reply 消息来源,将已继续的 ask_user_question 调用的迟到回答送入 agent inbox。 + +## 目录 + +- [声明](#declaration) +- [兼容性](#compatibility) +- [验证](#verification) +- [开发备注](#dev-note) + + +## 声明 + +```yaml persistence-change +schemaVersion: 1 +id: 2026-09-21-user-question-reply +baseline: false +changes: + - root: "event:agent/inbox/spliced" + previous: "2026-09-16-session-format-v4" + after: "6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178" + decision: same-version + - root: "event:developer/message" + previous: "2026-09-16-session-format-v4" + after: "186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467" + decision: same-version + - root: "event:session/title-llm-request" + previous: "2026-09-16-session-format-v4" + after: "ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46" + decision: same-version + - root: "event:user/message" + previous: "2026-09-16-session-format-v4" + after: "b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411" + decision: same-version +``` + + +## 兼容性 + +已有日志不含该来源,仍然有效。新来源是普通用户消息上的受限定归属;没有 dsh-user-questions 的读取方保留消息,并从内容推导历史。只有 userQuestions projection 读取该来源,关闭指定的问题并记录答案。answer RPC 是唯一生产方,只写入 outcome answered;关闭 Client 面板不会持久化回复。不新增事件类型,也不改变 Session header。 + + +## 验证 + +pnpm exec vitest run packages/interaction/user-questions/tests packages/interaction/tool-ask-user/tests:81 个测试通过。projection、reply、view 和 process-group 的定向测试共 70 个通过。pnpm run typecheck 通过。pnpm run doc-sync 的 42 项检查全部通过,包括持久化历史和翻译配对。 + + +## 开发备注 + +无。 diff --git a/docs/persistence-changes/historical-formats/README.i18n.yaml b/docs/persistence-changes/historical-formats/README.i18n.yaml index 4579af471a..ab050bed1e 100644 --- a/docs/persistence-changes/historical-formats/README.i18n.yaml +++ b/docs/persistence-changes/historical-formats/README.i18n.yaml @@ -15,8 +15,8 @@ en: 14c57f30e676f6e3 zh: b1a0ccf26fab3727 /session-persistence-formats/format-references: - en: 45dba01dd6d69c80 - zh: c366d1a3991118c9 + en: b19e6cfc84bfc46d + zh: 5b1d86bcdab672ca /session-persistence-formats/scope-and-evidence: en: b220062139ddac1e zh: 7c4c0efe05dafa9c diff --git a/docs/persistence-changes/historical-formats/README.md b/docs/persistence-changes/historical-formats/README.md index a1064e8158..c2da060729 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) | 62 / 587 | +| 4 | Current checkout | [Current catalog](../../persistence-catalog.md) | [JSON](../../persistence-schema.json) | 62 / 590 | diff --git a/docs/persistence-changes/historical-formats/README.zh.md b/docs/persistence-changes/historical-formats/README.zh.md index 87c9d32fa6..253c0943ba 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) | 62 / 587 | +| 4 | 当前工作树 | [当前目录](../../persistence-catalog.zh.md) | [JSON](../../persistence-schema.json) | 62 / 590 | diff --git a/docs/persistence-schema.json b/docs/persistence-schema.json index 80e6ca754e..45c1865af8 100644 --- a/docs/persistence-schema.json +++ b/docs/persistence-schema.json @@ -406,7 +406,7 @@ "kind": "event", "event": "agent/inbox/spliced", "surface": false, - "digest": "1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c", + "digest": "6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178", "schema": { "root": 0, "nodes": [ @@ -435,7 +435,7 @@ }, { "name": "type", - "type": 199, + "type": 202, "optional": false } ], @@ -451,7 +451,7 @@ }, { "name": "outcome", - "type": 195, + "type": 198, "optional": true }, { @@ -466,7 +466,7 @@ }, { "name": "target", - "type": 196, + "type": 199, "optional": false } ], @@ -505,7 +505,8 @@ "discriminator": "kind", "unknownKinds": "preserve", "attributionKinds": [ - "tmux-context" + "tmux-context", + "user-question-reply" ] } } @@ -821,10 +822,10 @@ 43, 45, 47, - 50, - 52, - 54, - 56, + 49, + 51, + 53, + 55, 58, 60, 62, @@ -834,10 +835,10 @@ 66, 67, 68, + 69, 70, 71, 72, - 73, 74, 75, 76, @@ -847,10 +848,10 @@ 80, 81, 82, + 83, 84, 85, 86, - 87, 88, 89, 90, @@ -860,10 +861,10 @@ 94, 95, 96, + 97, 98, 99, 100, - 101, 102, 103, 104, @@ -873,56 +874,57 @@ 108, 109, 110, + 111, 112, + 113, 114, - 117, + 116, 118, - 119, - 120, 121, + 122, 123, 124, 125, - 126, + 127, 128, 129, 130, - 131, 132, + 133, 134, 135, 136, 138, 139, - 147, - 149, - 150, - 152, + 140, + 142, + 143, + 151, 154, - 158, - 160, - 168, - 172, - 173, - 174, + 156, + 157, + 159, + 161, + 165, + 167, 175, - 176, - 177, - 178, 179, 180, 181, 182, 183, 184, + 185, 186, + 187, 188, 189, 190, 191, - 192, 193, - 194 + 195, + 196, + 197 ] }, { @@ -952,7 +954,7 @@ }, { "kind": "literal", - "value": "time-context" + "value": "plan-mode" }, { "kind": "object", @@ -975,6 +977,106 @@ ], "indices": [] }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 35, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "tmux-context" @@ -989,7 +1091,7 @@ }, { "name": "kind", - "type": 40, + "type": 48, "optional": false }, { @@ -1014,7 +1116,7 @@ }, { "name": "kind", - "type": 42, + "type": 50, "optional": false }, { @@ -1039,7 +1141,7 @@ }, { "name": "kind", - "type": 44, + "type": 52, "optional": false }, { @@ -1064,7 +1166,7 @@ }, { "name": "kind", - "type": 46, + "type": 54, "optional": false }, { @@ -1084,12 +1186,12 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { "name": "kind", - "type": 49, + "type": 57, "optional": false } ], @@ -1108,12 +1210,12 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { "name": "kind", - "type": 51, + "type": 59, "optional": false } ], @@ -1128,12 +1230,12 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { "name": "kind", - "type": 53, + "type": 61, "optional": false } ], @@ -1148,87 +1250,7 @@ "properties": [ { "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "plan-mode" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "repeat-tool-reminder" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "runtime-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, - "optional": false - }, - { - "name": "kind", - "type": 61, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "schedule" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1244,7 +1266,7 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1260,7 +1282,7 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1276,7 +1298,7 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1292,7 +1314,7 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1308,7 +1330,7 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { @@ -1324,12 +1346,76 @@ "properties": [ { "name": "form", - "type": 69, + "type": 56, "optional": false }, { "name": "kind", - "type": 49, + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 56, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 57, "optional": false } ], @@ -1344,71 +1430,7 @@ "properties": [ { "name": "form", - "type": 69, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 69, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 69, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 69, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1424,7 +1446,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1440,7 +1462,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1456,7 +1478,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1472,7 +1494,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1488,7 +1510,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1504,7 +1526,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1520,7 +1542,7 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { @@ -1536,12 +1558,76 @@ "properties": [ { "name": "form", - "type": 83, + "type": 73, "optional": false }, { "name": "kind", - "type": 49, + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 73, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 57, "optional": false } ], @@ -1556,71 +1642,7 @@ "properties": [ { "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1636,7 +1658,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1652,7 +1674,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1668,7 +1690,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1684,7 +1706,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1700,7 +1722,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1716,7 +1738,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1732,7 +1754,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { @@ -1748,12 +1770,76 @@ "properties": [ { "name": "form", - "type": 97, + "type": 87, "optional": false }, { "name": "kind", - "type": 49, + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 87, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 57, "optional": false } ], @@ -1768,71 +1854,7 @@ "properties": [ { "name": "form", - "type": 97, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 97, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 97, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 97, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1848,7 +1870,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1864,7 +1886,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1880,7 +1902,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1896,7 +1918,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1912,7 +1934,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1928,7 +1950,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1944,7 +1966,7 @@ "properties": [ { "name": "form", - "type": 97, + "type": 101, "optional": false }, { @@ -1955,6 +1977,70 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 101, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, { "kind": "object", "properties": [ @@ -1965,7 +2051,7 @@ }, { "name": "kind", - "type": 111, + "type": 115, "optional": false }, { @@ -1990,7 +2076,7 @@ "properties": [ { "name": "kind", - "type": 113, + "type": 117, "optional": false }, { @@ -2025,7 +2111,7 @@ "properties": [ { "name": "kind", - "type": 115, + "type": 119, "optional": false }, { @@ -2040,7 +2126,7 @@ }, { "name": "replayState", - "type": 116, + "type": 120, "optional": true } ], @@ -2054,65 +2140,6 @@ "kind": "opaque", "reason": "unknown" }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 122, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "ptc-mode" - }, { "kind": "object", "properties": [ @@ -2151,7 +2178,18 @@ "properties": [ { "name": "kind", - "type": 127, + "type": 36, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 126, "optional": false } ], @@ -2159,18 +2197,7 @@ }, { "kind": "literal", - "value": "system-prompt" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 36, - "optional": false - } - ], - "indices": [] + "value": "ptc-mode" }, { "kind": "object", @@ -2210,7 +2237,66 @@ "properties": [ { "name": "kind", - "type": 133, + "type": 131, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 137, "optional": false } ], @@ -2236,7 +2322,7 @@ "properties": [ { "name": "kind", - "type": 44, + "type": 52, "optional": false } ], @@ -2247,7 +2333,7 @@ "properties": [ { "name": "kind", - "type": 137, + "type": 141, "optional": false } ], @@ -2262,7 +2348,7 @@ "properties": [ { "name": "kind", - "type": 46, + "type": 54, "optional": false } ], @@ -2283,17 +2369,17 @@ }, { "name": "changes", - "type": 140, + "type": 144, "optional": false }, { "name": "form", - "type": 48, + "type": 56, "optional": false }, { "name": "kind", - "type": 146, + "type": 150, "optional": false } ], @@ -2301,14 +2387,14 @@ }, { "kind": "array", - "element": 141 + "element": 145 }, { "kind": "object", "properties": [ { "name": "action", - "type": 142, + "type": 146, "optional": false }, { @@ -2332,9 +2418,9 @@ { "kind": "union", "types": [ - 143, - 144, - 145 + 147, + 148, + 149 ] }, { @@ -2363,7 +2449,36 @@ }, { "name": "kind", - "type": 148, + "type": 152, + "optional": false + }, + { + "name": "outcome", + "type": 153, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 155, "optional": false } ], @@ -2404,7 +2519,7 @@ }, { "name": "kind", - "type": 151, + "type": 158, "optional": false }, { @@ -2434,7 +2549,7 @@ }, { "name": "kind", - "type": 153, + "type": 160, "optional": false }, { @@ -2469,17 +2584,17 @@ "properties": [ { "name": "entries", - "type": 155, + "type": 162, "optional": false }, { "name": "form", - "type": 97, + "type": 101, "optional": false }, { "name": "kind", - "type": 157, + "type": 164, "optional": false }, { @@ -2492,7 +2607,7 @@ }, { "kind": "array", - "element": 156 + "element": 163 }, { "kind": "object", @@ -2519,12 +2634,12 @@ "properties": [ { "name": "form", - "type": 48, + "type": 56, "optional": false }, { "name": "kind", - "type": 159, + "type": 166, "optional": false }, { @@ -2544,22 +2659,22 @@ "properties": [ { "name": "form", - "type": 69, + "type": 73, "optional": false }, { "name": "kind", - "type": 161, + "type": 168, "optional": false }, { "name": "references", - "type": 162, + "type": 169, "optional": false }, { "name": "version", - "type": 167, + "type": 174, "optional": false } ], @@ -2571,7 +2686,7 @@ }, { "kind": "array", - "element": 163 + "element": 170 }, { "kind": "object", @@ -2583,12 +2698,12 @@ }, { "name": "capturedThroughSeq", - "type": 164, + "type": 171, "optional": false }, { "name": "compacted", - "type": 166, + "type": 173, "optional": false }, { @@ -2628,7 +2743,7 @@ }, { "name": "truncated", - "type": 166, + "type": 173, "optional": false } ], @@ -2638,7 +2753,7 @@ "kind": "union", "types": [ 20, - 165 + 172 ] }, { @@ -2658,17 +2773,17 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { "name": "kind", - "type": 49, + "type": 57, "optional": false }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2680,7 +2795,7 @@ }, { "kind": "array", - "element": 171 + "element": 178 }, { "kind": "object", @@ -2703,91 +2818,7 @@ "properties": [ { "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2797,7 +2828,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2808,7 +2839,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2818,7 +2849,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2829,7 +2860,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2839,7 +2870,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2850,7 +2881,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2860,7 +2891,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2871,7 +2902,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2881,7 +2912,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2892,7 +2923,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2902,7 +2933,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2913,7 +2944,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2923,7 +2954,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -2934,7 +2965,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -2944,7 +2975,91 @@ }, { "name": "sections", - "type": 170, + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + }, + { + "name": "sections", + "type": 177, "optional": false } ], @@ -2960,7 +3075,7 @@ }, { "name": "kind", - "type": 185, + "type": 192, "optional": false }, { @@ -2985,12 +3100,12 @@ "properties": [ { "name": "form", - "type": 83, + "type": 87, "optional": false }, { "name": "kind", - "type": 187, + "type": 194, "optional": false }, { @@ -3005,90 +3120,6 @@ "kind": "literal", "value": "agent-message" }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 35, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 35, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 35, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 35, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, { "kind": "object", "properties": [ @@ -3159,8 +3190,8 @@ { "kind": "union", "types": [ - 197, - 198 + 200, + 201 ] }, { @@ -6523,7 +6554,7 @@ "kind": "event", "event": "developer/message", "surface": true, - "digest": "eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80", + "digest": "186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467", "schema": { "root": 0, "nodes": [ @@ -6547,12 +6578,12 @@ }, { "name": "sourceEventSeqs", - "type": 195, + "type": 198, "optional": true }, { "name": "surfaceOp", - "type": 196, + "type": 199, "optional": false }, { @@ -6562,7 +6593,7 @@ }, { "name": "type", - "type": 199, + "type": 202, "optional": false } ], @@ -6627,7 +6658,8 @@ "discriminator": "kind", "unknownKinds": "preserve", "attributionKinds": [ - "tmux-context" + "tmux-context", + "user-question-reply" ] } } @@ -6939,10 +6971,10 @@ 42, 44, 46, - 49, - 51, - 53, - 55, + 48, + 50, + 52, + 54, 57, 59, 61, @@ -6952,10 +6984,10 @@ 65, 66, 67, + 68, 69, 70, 71, - 72, 73, 74, 75, @@ -6965,10 +6997,10 @@ 79, 80, 81, + 82, 83, 84, 85, - 86, 87, 88, 89, @@ -6978,10 +7010,10 @@ 93, 94, 95, + 96, 97, 98, 99, - 100, 101, 102, 103, @@ -6991,13 +7023,14 @@ 107, 108, 109, + 110, 111, + 112, 113, - 116, + 115, 117, - 118, - 119, 120, + 121, 122, 123, 124, @@ -7006,41 +7039,41 @@ 128, 129, 130, - 131, + 132, 133, + 134, 135, 136, 138, - 139, - 147, - 149, - 150, - 152, + 140, + 141, + 143, + 151, 154, - 158, - 160, - 168, - 172, - 173, - 174, + 156, + 157, + 159, + 161, + 165, + 167, 175, - 176, - 177, - 178, 179, 180, 181, 182, 183, 184, + 185, 186, + 187, 188, 189, 190, 191, - 192, 193, - 194 + 195, + 196, + 197 ] }, { @@ -7070,7 +7103,7 @@ }, { "kind": "literal", - "value": "time-context" + "value": "model-selection" }, { "kind": "object", @@ -7093,6 +7126,131 @@ ], "indices": [] }, + { + "kind": "literal", + "value": "plan-mode" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 39, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "repeat-tool-reminder" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 41, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 43, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 45, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 34, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "summary", + "type": 7, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "tmux-context" @@ -7107,7 +7265,7 @@ }, { "name": "kind", - "type": 39, + "type": 49, "optional": false }, { @@ -7132,7 +7290,7 @@ }, { "name": "kind", - "type": 41, + "type": 51, "optional": false }, { @@ -7157,7 +7315,7 @@ }, { "name": "kind", - "type": 43, + "type": 53, "optional": false }, { @@ -7177,37 +7335,12 @@ "properties": [ { "name": "form", - "type": 34, + "type": 55, "optional": false }, { "name": "kind", - "type": 45, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "dsh-session-title-llm" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 48, + "type": 56, "optional": false } ], @@ -7217,6 +7350,26 @@ "kind": "literal", "value": "instructions" }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "hooks-claude-code" @@ -7226,12 +7379,12 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { "name": "kind", - "type": 50, + "type": 60, "optional": false } ], @@ -7246,107 +7399,7 @@ "properties": [ { "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "model-selection" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "plan-mode" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "repeat-tool-reminder" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "runtime-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "schedule" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7362,7 +7415,7 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7378,7 +7431,7 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7394,7 +7447,7 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7410,7 +7463,7 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7426,7 +7479,7 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { @@ -7442,12 +7495,76 @@ "properties": [ { "name": "form", - "type": 68, + "type": 55, "optional": false }, { "name": "kind", - "type": 48, + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 55, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 56, "optional": false } ], @@ -7462,71 +7579,7 @@ "properties": [ { "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7542,7 +7595,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7558,7 +7611,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7574,7 +7627,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7590,7 +7643,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7606,7 +7659,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7622,7 +7675,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7638,7 +7691,7 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { @@ -7654,12 +7707,76 @@ "properties": [ { "name": "form", - "type": 82, + "type": 72, "optional": false }, { "name": "kind", - "type": 48, + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 72, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 56, "optional": false } ], @@ -7674,71 +7791,7 @@ "properties": [ { "name": "form", - "type": 82, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 82, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 82, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 82, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7754,7 +7807,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7770,7 +7823,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7786,7 +7839,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7802,7 +7855,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7818,7 +7871,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7834,7 +7887,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7850,7 +7903,7 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { @@ -7866,12 +7919,76 @@ "properties": [ { "name": "form", - "type": 96, + "type": 86, "optional": false }, { "name": "kind", - "type": 48, + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 56, "optional": false } ], @@ -7886,71 +8003,7 @@ "properties": [ { "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -7966,7 +8019,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -7982,7 +8035,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -7998,7 +8051,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -8014,7 +8067,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -8030,7 +8083,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -8046,7 +8099,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -8062,7 +8115,7 @@ "properties": [ { "name": "form", - "type": 96, + "type": 100, "optional": false }, { @@ -8073,6 +8126,70 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 100, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, { "kind": "object", "properties": [ @@ -8083,7 +8200,7 @@ }, { "name": "kind", - "type": 110, + "type": 114, "optional": false }, { @@ -8108,7 +8225,7 @@ "properties": [ { "name": "kind", - "type": 112, + "type": 116, "optional": false }, { @@ -8143,7 +8260,7 @@ "properties": [ { "name": "kind", - "type": 114, + "type": 118, "optional": false }, { @@ -8158,7 +8275,7 @@ }, { "name": "replayState", - "type": 115, + "type": 119, "optional": true } ], @@ -8172,65 +8289,6 @@ "kind": "opaque", "reason": "unknown" }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 48, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 121, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "ptc-mode" - }, { "kind": "object", "properties": [ @@ -8264,21 +8322,6 @@ ], "indices": [] }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 126, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "system-prompt" - }, { "kind": "object", "properties": [ @@ -8301,6 +8344,21 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 126, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "ptc-mode" + }, { "kind": "object", "properties": [ @@ -8323,36 +8381,6 @@ ], "indices": [] }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 132, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-registry" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 134, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "user" - }, { "kind": "object", "properties": [ @@ -8364,6 +8392,65 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 131, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 45, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 47, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 49, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 51, + "optional": false + } + ], + "indices": [] + }, { "kind": "object", "properties": [ @@ -8377,19 +8464,49 @@ }, { "kind": "literal", - "value": "cordis-host-runner" + "value": "tool-registry" }, { "kind": "object", "properties": [ { "name": "kind", - "type": 45, + "type": 139, "optional": false } ], "indices": [] }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 53, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 142, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" + }, { "kind": "object", "properties": [ @@ -8405,17 +8522,17 @@ }, { "name": "changes", - "type": 140, + "type": 144, "optional": false }, { "name": "form", - "type": 47, + "type": 55, "optional": false }, { "name": "kind", - "type": 146, + "type": 150, "optional": false } ], @@ -8423,14 +8540,14 @@ }, { "kind": "array", - "element": 141 + "element": 145 }, { "kind": "object", "properties": [ { "name": "action", - "type": 142, + "type": 146, "optional": false }, { @@ -8454,9 +8571,9 @@ { "kind": "union", "types": [ - 143, - 144, - 145 + 147, + 148, + 149 ] }, { @@ -8485,7 +8602,36 @@ }, { "name": "kind", - "type": 148, + "type": 152, + "optional": false + }, + { + "name": "outcome", + "type": 153, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 7, + "optional": false + }, + { + "name": "kind", + "type": 155, "optional": false } ], @@ -8505,7 +8651,7 @@ }, { "name": "kind", - "type": 134, + "type": 139, "optional": false }, { @@ -8526,7 +8672,7 @@ }, { "name": "kind", - "type": 151, + "type": 158, "optional": false }, { @@ -8556,7 +8702,7 @@ }, { "name": "kind", - "type": 153, + "type": 160, "optional": false }, { @@ -8591,17 +8737,17 @@ "properties": [ { "name": "entries", - "type": 155, + "type": 162, "optional": false }, { "name": "form", - "type": 96, + "type": 100, "optional": false }, { "name": "kind", - "type": 157, + "type": 164, "optional": false }, { @@ -8614,7 +8760,7 @@ }, { "kind": "array", - "element": 156 + "element": 163 }, { "kind": "object", @@ -8641,12 +8787,12 @@ "properties": [ { "name": "form", - "type": 47, + "type": 55, "optional": false }, { "name": "kind", - "type": 159, + "type": 166, "optional": false }, { @@ -8666,22 +8812,22 @@ "properties": [ { "name": "form", - "type": 68, + "type": 72, "optional": false }, { "name": "kind", - "type": 161, + "type": 168, "optional": false }, { "name": "references", - "type": 162, + "type": 169, "optional": false }, { "name": "version", - "type": 167, + "type": 174, "optional": false } ], @@ -8693,7 +8839,7 @@ }, { "kind": "array", - "element": 163 + "element": 170 }, { "kind": "object", @@ -8705,12 +8851,12 @@ }, { "name": "capturedThroughSeq", - "type": 164, + "type": 171, "optional": false }, { "name": "compacted", - "type": 166, + "type": 173, "optional": false }, { @@ -8750,7 +8896,7 @@ }, { "name": "truncated", - "type": 166, + "type": 173, "optional": false } ], @@ -8760,7 +8906,7 @@ "kind": "union", "types": [ 2, - 165 + 172 ] }, { @@ -8780,17 +8926,17 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { "name": "kind", - "type": 48, + "type": 56, "optional": false }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -8802,7 +8948,7 @@ }, { "kind": "array", - "element": 171 + "element": 178 }, { "kind": "object", @@ -8825,91 +8971,7 @@ "properties": [ { "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "sections", - "type": 170, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -8919,7 +8981,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -8930,7 +8992,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -8940,7 +9002,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -8951,7 +9013,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -8961,7 +9023,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -8972,7 +9034,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -8982,7 +9044,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -8993,7 +9055,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -9003,7 +9065,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -9014,7 +9076,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -9024,7 +9086,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -9035,7 +9097,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -9045,7 +9107,7 @@ }, { "name": "sections", - "type": 170, + "type": 177, "optional": false } ], @@ -9056,7 +9118,7 @@ "properties": [ { "name": "form", - "type": 169, + "type": 176, "optional": false }, { @@ -9066,7 +9128,91 @@ }, { "name": "sections", - "type": 170, + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 47, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 49, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 51, + "optional": false + }, + { + "name": "sections", + "type": 177, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 176, + "optional": false + }, + { + "name": "kind", + "type": 53, + "optional": false + }, + { + "name": "sections", + "type": 177, "optional": false } ], @@ -9082,7 +9228,7 @@ }, { "name": "kind", - "type": 185, + "type": 192, "optional": false }, { @@ -9107,12 +9253,12 @@ "properties": [ { "name": "form", - "type": 82, + "type": 86, "optional": false }, { "name": "kind", - "type": 187, + "type": 194, "optional": false }, { @@ -9127,90 +9273,6 @@ "kind": "literal", "value": "agent-message" }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 34, - "optional": false - }, - { - "name": "kind", - "type": 48, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 34, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 34, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 34, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "summary", - "type": 7, - "optional": false - } - ], - "indices": [] - }, { "kind": "object", "properties": [ @@ -9281,8 +9343,8 @@ { "kind": "union", "types": [ - 197, - 198 + 200, + 201 ] }, { @@ -9299,7 +9361,7 @@ }, { "name": "op", - "type": 144, + "type": 148, "optional": false }, { @@ -11794,7 +11856,7 @@ "kind": "event", "event": "session/title-llm-request", "surface": false, - "digest": "fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d", + "digest": "ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46", "schema": { "root": 0, "nodes": [ @@ -11823,7 +11885,7 @@ }, { "name": "type", - "type": 205, + "type": 208, "optional": false } ], @@ -11849,7 +11911,7 @@ }, { "name": "route", - "type": 204, + "type": 207, "optional": false }, { @@ -11882,9 +11944,9 @@ "types": [ 6, 37, - 199, - 200, - 202 + 202, + 203, + 205 ] }, { @@ -12133,14 +12195,6 @@ 27 ] }, - { - "kind": "literal", - "value": "image/png" - }, - { - "kind": "literal", - "value": "image/webp" - }, { "kind": "literal", "value": "image/gif" @@ -12149,6 +12203,14 @@ "kind": "literal", "value": "image/jpeg" }, + { + "kind": "literal", + "value": "image/png" + }, + { + "kind": "literal", + "value": "image/webp" + }, { "kind": "object", "properties": [ @@ -12267,7 +12329,8 @@ "discriminator": "kind", "unknownKinds": "preserve", "attributionKinds": [ - "tmux-context" + "tmux-context", + "user-question-reply" ] } } @@ -12283,7 +12346,6 @@ "types": [ 36, 40, - 43, 45, 47, 49, @@ -12292,37 +12354,31 @@ 55, 57, 59, - 61, - 70, - 72, - 74, - 76, - 78, - 80, - 85, - 87, - 95, + 60, + 62, + 64, + 65, + 68, + 71, + 73, + 75, + 77, + 79, + 88, + 91, + 92, + 94, + 96, + 98, 100, - 102, - 103, - 104, 105, - 106, 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, @@ -12342,8 +12398,10 @@ 138, 139, 140, + 141, 142, 143, + 144, 145, 146, 147, @@ -12361,6 +12419,7 @@ 159, 160, 161, + 162, 163, 164, 165, @@ -12371,25 +12430,30 @@ 170, 171, 172, + 173, 174, 175, + 176, 177, + 178, + 179, 180, 181, 182, 183, 184, - 186, + 185, 187, - 188, 189, - 190, 192, 193, 194, 195, 196, - 198 + 197, + 199, + 200, + 201 ] }, { @@ -12406,8 +12470,8 @@ "optional": false }, { - "name": "summary", - "type": 10, + "name": "sections", + "type": 43, "optional": false } ], @@ -12415,27 +12479,32 @@ }, { "kind": "literal", - "value": "notice" + "value": "snapshot" }, { "kind": "literal", - "value": "model-selection" + "value": "user-approval" + }, + { + "kind": "array", + "element": 44 }, { "kind": "object", "properties": [ { - "name": "kind", - "type": 44, + "name": "name", + "type": 10, + "optional": false + }, + { + "name": "text", + "type": 10, "optional": false } ], "indices": [] }, - { - "kind": "literal", - "value": "user-approval" - }, { "kind": "object", "properties": [ @@ -12449,7 +12518,7 @@ }, { "kind": "literal", - "value": "cordis-host-runner" + "value": "system-prompt" }, { "kind": "object", @@ -12464,7 +12533,108 @@ }, { "kind": "literal", - "value": "dsh-session-title-llm" + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-goal" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-jobs" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 56, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tool-registry" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 58, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 61, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "cordis-host-runner" }, { "kind": "object", @@ -12476,7 +12646,181 @@ }, { "name": "kind", - "type": 50, + "type": 63, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "dsh-session-title-llm" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 67, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "notice" + }, + { + "kind": "literal", + "value": "subagent-settled" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 70, + "optional": false + }, + { + "name": "senderSessionId", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "relay" + }, + { + "kind": "literal", + "value": "agent-message" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-claude-code" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "hooks-codex" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "model-selection" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 78, "optional": false }, { @@ -12491,131 +12835,6 @@ "kind": "literal", "value": "plan-mode" }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "repeat-tool-reminder" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "runtime-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "schedule" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "time-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tmux-context" - }, { "kind": "object", "properties": [ @@ -12631,17 +12850,17 @@ }, { "name": "changes", - "type": 62, + "type": 80, "optional": false }, { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 69, + "type": 87, "optional": false } ], @@ -12649,14 +12868,14 @@ }, { "kind": "array", - "element": 63 + "element": 81 }, { "kind": "object", "properties": [ { "name": "action", - "type": 64, + "type": 82, "optional": false }, { @@ -12680,9 +12899,9 @@ { "kind": "union", "types": [ - 65, - 66, - 67 + 83, + 84, + 85 ] }, { @@ -12705,6 +12924,35 @@ "kind": "literal", "value": "agent-instructions" }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 10, + "optional": false + }, + { + "name": "kind", + "type": 89, + "optional": false + }, + { + "name": "outcome", + "type": 90, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, { "kind": "object", "properties": [ @@ -12715,7 +12963,7 @@ }, { "name": "kind", - "type": 71, + "type": 58, "optional": false }, { @@ -12726,9 +12974,30 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", - "value": "user" + "value": "repeat-tool-reminder" }, { "kind": "object", @@ -12740,7 +13009,7 @@ }, { "name": "kind", - "type": 73, + "type": 95, "optional": false }, { @@ -12755,31 +13024,6 @@ "kind": "literal", "value": "compact-checkpoint" }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-goal" - }, { "kind": "object", "properties": [ @@ -12790,12 +13034,12 @@ }, { "name": "form", - "type": 41, + "type": 66, "optional": false }, { "name": "kind", - "type": 77, + "type": 97, "optional": false }, { @@ -12830,12 +13074,12 @@ "properties": [ { "name": "form", - "type": 41, + "type": 66, "optional": false }, { "name": "kind", - "type": 79, + "type": 99, "optional": false }, { @@ -12848,24 +13092,24 @@ }, { "kind": "literal", - "value": "tool-jobs" + "value": "runtime-context" }, { "kind": "object", "properties": [ { "name": "entries", - "type": 81, + "type": 101, "optional": false }, { "name": "form", - "type": 83, + "type": 103, "optional": false }, { "name": "kind", - "type": 84, + "type": 104, "optional": false }, { @@ -12878,7 +13122,7 @@ }, { "kind": "array", - "element": 82 + "element": 102 }, { "kind": "object", @@ -12909,12 +13153,12 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 86, + "type": 106, "optional": false }, { @@ -12934,22 +13178,22 @@ "properties": [ { "name": "form", - "type": 88, + "type": 108, "optional": false }, { "name": "kind", - "type": 89, + "type": 109, "optional": false }, { "name": "references", - "type": 90, + "type": 110, "optional": false }, { "name": "version", - "type": 94, + "type": 114, "optional": false } ], @@ -12965,7 +13209,7 @@ }, { "kind": "array", - "element": 91 + "element": 111 }, { "kind": "object", @@ -12977,7 +13221,7 @@ }, { "name": "capturedThroughSeq", - "type": 92, + "type": 112, "optional": false }, { @@ -13032,7 +13276,7 @@ "kind": "union", "types": [ 2, - 93 + 113 ] }, { @@ -13048,154 +13292,17 @@ "properties": [ { "name": "form", - "type": 96, + "type": 41, "optional": false }, { "name": "kind", - "type": 97, + "type": 72, "optional": false }, { "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "snapshot" - }, - { - "kind": "literal", - "value": "hooks-claude-code" - }, - { - "kind": "array", - "element": 99 - }, - { - "kind": "object", - "properties": [ - { - "name": "name", - "type": 10, - "optional": false - }, - { - "name": "text", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "hooks-codex" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - }, - { - "name": "sections", - "type": 98, + "type": 43, "optional": false } ], @@ -13211,7 +13318,91 @@ }, { "name": "kind", - "type": 44, + "type": 74, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 66, + "optional": false + }, + { + "name": "kind", + "type": 121, "optional": false }, { @@ -13223,137 +13414,15 @@ "indices": [] }, { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] + "kind": "literal", + "value": "schedule" }, { "kind": "object", "properties": [ { "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, + "type": 66, "optional": false }, { @@ -13374,61 +13443,18 @@ "properties": [ { "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 97, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 68, + "type": 66, "optional": false }, { "name": "kind", "type": 50, "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false } ], "indices": [] @@ -13438,13 +13464,18 @@ "properties": [ { "name": "form", - "type": 68, + "type": 66, "optional": false }, { "name": "kind", "type": 52, "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false } ], "indices": [] @@ -13454,13 +13485,18 @@ "properties": [ { "name": "form", - "type": 68, + "type": 66, "optional": false }, { "name": "kind", "type": 54, "optional": false + }, + { + "name": "summary", + "type": 10, + "optional": false } ], "indices": [] @@ -13470,12 +13506,17 @@ "properties": [ { "name": "form", - "type": 68, + "type": 66, "optional": false }, { "name": "kind", - "type": 56, + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 10, "optional": false } ], @@ -13486,12 +13527,17 @@ "properties": [ { "name": "form", - "type": 68, + "type": 66, "optional": false }, { "name": "kind", - "type": 58, + "type": 63, + "optional": false + }, + { + "name": "summary", + "type": 10, "optional": false } ], @@ -13502,12 +13548,12 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 60, + "type": 72, "optional": false } ], @@ -13518,12 +13564,12 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 75, + "type": 74, "optional": false } ], @@ -13534,12 +13580,12 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 79, + "type": 76, "optional": false } ], @@ -13550,12 +13596,12 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, "optional": false }, { "name": "kind", - "type": 44, + "type": 78, "optional": false } ], @@ -13566,7 +13612,55 @@ "properties": [ { "name": "form", - "type": 68, + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 86, "optional": false }, { @@ -13582,76 +13676,7 @@ "properties": [ { "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 97, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 96, - "optional": false - }, - { - "name": "kind", - "type": 48, - "optional": false - }, - { - "name": "sections", - "type": 98, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, + "type": 86, "optional": false }, { @@ -13667,7 +13692,7 @@ "properties": [ { "name": "form", - "type": 88, + "type": 86, "optional": false }, { @@ -13678,118 +13703,6 @@ ], "indices": [] }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 54, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 88, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, { "kind": "object", "properties": [ @@ -13800,37 +13713,12 @@ }, { "name": "kind", - "type": 141, + "type": 99, "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": 88, - "optional": false - }, - { - "name": "kind", - "type": 48, + "name": "sections", + "type": 43, "optional": false } ], @@ -13841,91 +13729,7 @@ "properties": [ { "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 97, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "relay" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 42, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 50, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, + "type": 86, "optional": false }, { @@ -13941,151 +13745,7 @@ "properties": [ { "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 75, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 48, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 97, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, + "type": 86, "optional": false }, { @@ -14101,7 +13761,172 @@ "properties": [ { "name": "form", - "type": 83, + "type": 86, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 108, "optional": false }, { @@ -14117,32 +13942,7 @@ "properties": [ { "name": "form", - "type": 144, - "optional": false - }, - { - "name": "kind", - "type": 162, - "optional": false - }, - { - "name": "senderSessionId", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "agent-message" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, + "type": 108, "optional": false }, { @@ -14158,7 +13958,7 @@ "properties": [ { "name": "form", - "type": 83, + "type": 108, "optional": false }, { @@ -14174,12 +13974,12 @@ "properties": [ { "name": "form", - "type": 83, + "type": 108, "optional": false }, { "name": "kind", - "type": 56, + "type": 42, "optional": false } ], @@ -14190,12 +13990,12 @@ "properties": [ { "name": "form", - "type": 83, + "type": 108, "optional": false }, { "name": "kind", - "type": 58, + "type": 63, "optional": false } ], @@ -14206,12 +14006,12 @@ "properties": [ { "name": "form", - "type": 83, + "type": 69, "optional": false }, { "name": "kind", - "type": 60, + "type": 72, "optional": false } ], @@ -14222,12 +14022,12 @@ "properties": [ { "name": "form", - "type": 83, + "type": 69, "optional": false }, { "name": "kind", - "type": 75, + "type": 74, "optional": false } ], @@ -14238,45 +14038,444 @@ "properties": [ { "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 79, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, - "optional": false - }, - { - "name": "kind", - "type": 44, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 83, + "type": 41, "optional": false }, { "name": "kind", "type": 48, "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 69, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 72, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 74, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 76, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 93, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 99, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 121, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + }, + { + "name": "sections", + "type": 43, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 52, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 54, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 103, + "optional": false + }, + { + "name": "kind", + "type": 63, + "optional": false } ], "indices": [] @@ -14291,7 +14490,7 @@ }, { "name": "kind", - "type": 173, + "type": 186, "optional": false }, { @@ -14314,30 +14513,9 @@ { "kind": "object", "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, { "name": "kind", - "type": 97, - "optional": false - }, - { - "name": "summary", - "type": 10, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 176, + "type": 188, "optional": false }, { @@ -14372,7 +14550,7 @@ "properties": [ { "name": "kind", - "type": 178, + "type": 190, "optional": false }, { @@ -14387,7 +14565,7 @@ }, { "name": "replayState", - "type": 179, + "type": 191, "optional": true } ], @@ -14404,9 +14582,19 @@ { "kind": "object", "properties": [ + { + "name": "form", + "type": 41, + "optional": false + }, { "name": "kind", - "type": 97, + "type": 54, + "optional": false + }, + { + "name": "sections", + "type": 43, "optional": false } ], @@ -14417,7 +14605,7 @@ "properties": [ { "name": "kind", - "type": 101, + "type": 72, "optional": false } ], @@ -14428,7 +14616,7 @@ "properties": [ { "name": "kind", - "type": 42, + "type": 74, "optional": false } ], @@ -14439,7 +14627,7 @@ "properties": [ { "name": "kind", - "type": 50, + "type": 76, "optional": false } ], @@ -14450,7 +14638,18 @@ "properties": [ { "name": "kind", - "type": 185, + "type": 78, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 198, "optional": false } ], @@ -14465,28 +14664,7 @@ "properties": [ { "name": "kind", - "type": 52, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 41, - "optional": false - }, - { - "name": "kind", - "type": 101, - "optional": false - }, - { - "name": "summary", - "type": 10, + "type": 93, "optional": false } ], @@ -14497,7 +14675,7 @@ "properties": [ { "name": "kind", - "type": 54, + "type": 99, "optional": false } ], @@ -14508,92 +14686,7 @@ "properties": [ { "name": "kind", - "type": 56, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 191, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "system-prompt" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 58, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 60, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 75, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 79, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 197, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "tool-registry" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 71, + "type": 121, "optional": false } ], @@ -14614,7 +14707,7 @@ }, { "name": "role", - "type": 71, + "type": 58, "optional": false }, { @@ -14628,7 +14721,8 @@ "discriminator": "kind", "unknownKinds": "preserve", "attributionKinds": [ - "tmux-context" + "tmux-context", + "user-question-reply" ] } } @@ -14650,12 +14744,12 @@ }, { "name": "role", - "type": 201, + "type": 204, "optional": false }, { "name": "source", - "type": 177, + "type": 189, "optional": false } ], @@ -14680,12 +14774,12 @@ }, { "name": "role", - "type": 203, + "type": 206, "optional": false }, { "name": "source", - "type": 190, + "type": 45, "optional": false } ], @@ -18632,7 +18726,7 @@ "kind": "event", "event": "user/message", "surface": true, - "digest": "3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761", + "digest": "b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411", "schema": { "root": 0, "nodes": [ @@ -18656,12 +18750,12 @@ }, { "name": "sourceEventSeqs", - "type": 193, + "type": 196, "optional": true }, { "name": "surfaceOp", - "type": 194, + "type": 197, "optional": false }, { @@ -18671,7 +18765,7 @@ }, { "name": "type", - "type": 197, + "type": 200, "optional": false } ], @@ -18706,7 +18800,8 @@ "discriminator": "kind", "unknownKinds": "preserve", "attributionKinds": [ - "tmux-context" + "tmux-context", + "user-question-reply" ] } } @@ -19021,10 +19116,10 @@ 39, 41, 43, - 46, - 48, - 50, - 52, + 45, + 47, + 49, + 51, 54, 56, 58, @@ -19034,10 +19129,10 @@ 63, 64, 65, + 66, 67, 68, 69, - 70, 71, 72, 73, @@ -19047,10 +19142,10 @@ 77, 78, 79, + 80, 81, 82, 83, - 84, 85, 86, 87, @@ -19060,10 +19155,10 @@ 91, 92, 93, + 94, 95, 96, 97, - 98, 99, 100, 101, @@ -19073,57 +19168,58 @@ 105, 106, 107, + 108, 109, + 110, 111, - 114, + 113, 115, - 116, - 117, 118, + 119, 120, 121, 122, - 123, + 124, 125, 126, 127, - 128, 129, + 130, 131, 132, 133, 135, 136, - 144, - 146, - 147, - 149, + 137, + 139, + 140, + 148, 151, - 155, - 157, - 165, - 169, - 170, - 171, + 153, + 154, + 156, + 158, + 162, + 164, 172, - 173, - 174, - 175, 176, 177, 178, 179, 180, 181, + 182, 183, + 184, 185, 186, 187, 188, - 189, 190, - 191, - 192 + 192, + 193, + 194, + 195 ] }, { @@ -19153,7 +19249,7 @@ }, { "kind": "literal", - "value": "tmux-context" + "value": "repeat-tool-reminder" }, { "kind": "object", @@ -19176,6 +19272,106 @@ ], "indices": [] }, + { + "kind": "literal", + "value": "runtime-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 38, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "schedule" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 40, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "time-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 42, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "tmux-context" + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 33, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "summary", + "type": 5, + "optional": false + } + ], + "indices": [] + }, { "kind": "literal", "value": "tool-goal" @@ -19190,7 +19386,7 @@ }, { "name": "kind", - "type": 38, + "type": 46, "optional": false }, { @@ -19215,7 +19411,7 @@ }, { "name": "kind", - "type": 40, + "type": 48, "optional": false }, { @@ -19240,7 +19436,7 @@ }, { "name": "kind", - "type": 42, + "type": 50, "optional": false }, { @@ -19260,12 +19456,12 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 45, + "type": 53, "optional": false } ], @@ -19284,12 +19480,12 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 47, + "type": 55, "optional": false } ], @@ -19304,12 +19500,12 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 49, + "type": 57, "optional": false } ], @@ -19324,12 +19520,12 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 51, + "type": 59, "optional": false } ], @@ -19344,87 +19540,7 @@ "properties": [ { "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "repeat-tool-reminder" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 55, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "runtime-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 57, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "schedule" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, - "optional": false - }, - { - "name": "kind", - "type": 59, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "time-context" - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 44, + "type": 52, "optional": false }, { @@ -19440,7 +19556,7 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { @@ -19456,7 +19572,7 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { @@ -19472,7 +19588,7 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { @@ -19488,7 +19604,7 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { @@ -19504,12 +19620,76 @@ "properties": [ { "name": "form", - "type": 66, + "type": 52, "optional": false }, { "name": "kind", - "type": 45, + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 52, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 53, "optional": false } ], @@ -19524,71 +19704,7 @@ "properties": [ { "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19604,7 +19720,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19620,7 +19736,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19636,7 +19752,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19652,7 +19768,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19668,7 +19784,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19684,7 +19800,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19700,7 +19816,7 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { @@ -19716,12 +19832,76 @@ "properties": [ { "name": "form", - "type": 80, + "type": 70, "optional": false }, { "name": "kind", - "type": 45, + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 70, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 53, "optional": false } ], @@ -19736,71 +19916,7 @@ "properties": [ { "name": "form", - "type": 80, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 80, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 80, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 80, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19816,7 +19932,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19832,7 +19948,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19848,7 +19964,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19864,7 +19980,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19880,7 +19996,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19896,7 +20012,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19912,7 +20028,7 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { @@ -19928,12 +20044,76 @@ "properties": [ { "name": "form", - "type": 94, + "type": 84, "optional": false }, { "name": "kind", - "type": 45, + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 84, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 53, "optional": false } ], @@ -19948,71 +20128,7 @@ "properties": [ { "name": "form", - "type": 94, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 94, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 94, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 94, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20028,7 +20144,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20044,7 +20160,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20060,7 +20176,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20076,7 +20192,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20092,7 +20208,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20108,7 +20224,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20124,7 +20240,7 @@ "properties": [ { "name": "form", - "type": 94, + "type": 98, "optional": false }, { @@ -20135,6 +20251,70 @@ ], "indices": [] }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 98, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + } + ], + "indices": [] + }, { "kind": "object", "properties": [ @@ -20145,7 +20325,7 @@ }, { "name": "kind", - "type": 108, + "type": 112, "optional": false }, { @@ -20170,7 +20350,7 @@ "properties": [ { "name": "kind", - "type": 110, + "type": 114, "optional": false }, { @@ -20205,7 +20385,7 @@ "properties": [ { "name": "kind", - "type": 112, + "type": 116, "optional": false }, { @@ -20220,7 +20400,7 @@ }, { "name": "replayState", - "type": 113, + "type": 117, "optional": true } ], @@ -20234,65 +20414,6 @@ "kind": "opaque", "reason": "unknown" }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 45, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 47, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 49, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 51, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 119, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "literal", - "value": "ptc-mode" - }, { "kind": "object", "properties": [ @@ -20331,7 +20452,18 @@ "properties": [ { "name": "kind", - "type": 124, + "type": 59, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 123, "optional": false } ], @@ -20339,18 +20471,7 @@ }, { "kind": "literal", - "value": "system-prompt" - }, - { - "kind": "object", - "properties": [ - { - "name": "kind", - "type": 59, - "optional": false - } - ], - "indices": [] + "value": "ptc-mode" }, { "kind": "object", @@ -20390,7 +20511,66 @@ "properties": [ { "name": "kind", - "type": 130, + "type": 128, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "system-prompt" + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 40, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 42, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 44, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 46, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "kind", + "type": 134, "optional": false } ], @@ -20416,7 +20596,7 @@ "properties": [ { "name": "kind", - "type": 40, + "type": 48, "optional": false } ], @@ -20427,7 +20607,7 @@ "properties": [ { "name": "kind", - "type": 134, + "type": 138, "optional": false } ], @@ -20442,7 +20622,7 @@ "properties": [ { "name": "kind", - "type": 42, + "type": 50, "optional": false } ], @@ -20463,17 +20643,17 @@ }, { "name": "changes", - "type": 137, + "type": 141, "optional": false }, { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 143, + "type": 147, "optional": false } ], @@ -20481,14 +20661,14 @@ }, { "kind": "array", - "element": 138 + "element": 142 }, { "kind": "object", "properties": [ { "name": "action", - "type": 139, + "type": 143, "optional": false }, { @@ -20512,9 +20692,9 @@ { "kind": "union", "types": [ - 140, - 141, - 142 + 144, + 145, + 146 ] }, { @@ -20543,7 +20723,36 @@ }, { "name": "kind", - "type": 145, + "type": 149, + "optional": false + }, + { + "name": "outcome", + "type": 150, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "literal", + "value": "user-question-reply" + }, + { + "kind": "literal", + "value": "answered" + }, + { + "kind": "object", + "properties": [ + { + "name": "callId", + "type": 5, + "optional": false + }, + { + "name": "kind", + "type": 152, "optional": false } ], @@ -20584,7 +20793,7 @@ }, { "name": "kind", - "type": 148, + "type": 155, "optional": false }, { @@ -20614,7 +20823,7 @@ }, { "name": "kind", - "type": 150, + "type": 157, "optional": false }, { @@ -20649,17 +20858,17 @@ "properties": [ { "name": "entries", - "type": 152, + "type": 159, "optional": false }, { "name": "form", - "type": 94, + "type": 98, "optional": false }, { "name": "kind", - "type": 154, + "type": 161, "optional": false }, { @@ -20672,7 +20881,7 @@ }, { "kind": "array", - "element": 153 + "element": 160 }, { "kind": "object", @@ -20699,12 +20908,12 @@ "properties": [ { "name": "form", - "type": 44, + "type": 52, "optional": false }, { "name": "kind", - "type": 156, + "type": 163, "optional": false }, { @@ -20724,22 +20933,22 @@ "properties": [ { "name": "form", - "type": 66, + "type": 70, "optional": false }, { "name": "kind", - "type": 158, + "type": 165, "optional": false }, { "name": "references", - "type": 159, + "type": 166, "optional": false }, { "name": "version", - "type": 164, + "type": 171, "optional": false } ], @@ -20751,7 +20960,7 @@ }, { "kind": "array", - "element": 160 + "element": 167 }, { "kind": "object", @@ -20763,12 +20972,12 @@ }, { "name": "capturedThroughSeq", - "type": 161, + "type": 168, "optional": false }, { "name": "compacted", - "type": 163, + "type": 170, "optional": false }, { @@ -20808,7 +21017,7 @@ }, { "name": "truncated", - "type": 163, + "type": 170, "optional": false } ], @@ -20818,7 +21027,7 @@ "kind": "union", "types": [ 18, - 162 + 169 ] }, { @@ -20838,17 +21047,17 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { "name": "kind", - "type": 45, + "type": 53, "optional": false }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -20860,7 +21069,7 @@ }, { "kind": "array", - "element": 168 + "element": 175 }, { "kind": "object", @@ -20883,91 +21092,7 @@ "properties": [ { "name": "form", - "type": 166, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - }, - { - "name": "sections", - "type": 167, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 166, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "sections", - "type": 167, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 166, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "sections", - "type": 167, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 166, - "optional": false - }, - { - "name": "kind", - "type": 53, - "optional": false - }, - { - "name": "sections", - "type": 167, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -20977,7 +21102,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -20988,7 +21113,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -20998,7 +21123,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21009,7 +21134,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21019,7 +21144,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21030,7 +21155,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21040,7 +21165,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21051,7 +21176,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21061,7 +21186,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21072,7 +21197,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21082,7 +21207,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21093,7 +21218,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21103,7 +21228,7 @@ }, { "name": "sections", - "type": 167, + "type": 174, "optional": false } ], @@ -21114,7 +21239,7 @@ "properties": [ { "name": "form", - "type": 166, + "type": 173, "optional": false }, { @@ -21124,7 +21249,91 @@ }, { "name": "sections", - "type": 167, + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 44, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 46, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 48, + "optional": false + }, + { + "name": "sections", + "type": 174, + "optional": false + } + ], + "indices": [] + }, + { + "kind": "object", + "properties": [ + { + "name": "form", + "type": 173, + "optional": false + }, + { + "name": "kind", + "type": 50, + "optional": false + }, + { + "name": "sections", + "type": 174, "optional": false } ], @@ -21140,7 +21349,7 @@ }, { "name": "kind", - "type": 182, + "type": 189, "optional": false }, { @@ -21165,12 +21374,12 @@ "properties": [ { "name": "form", - "type": 80, + "type": 84, "optional": false }, { "name": "kind", - "type": 184, + "type": 191, "optional": false }, { @@ -21185,90 +21394,6 @@ "kind": "literal", "value": "agent-message" }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 33, - "optional": false - }, - { - "name": "kind", - "type": 45, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 33, - "optional": false - }, - { - "name": "kind", - "type": 47, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 33, - "optional": false - }, - { - "name": "kind", - "type": 49, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, - { - "kind": "object", - "properties": [ - { - "name": "form", - "type": 33, - "optional": false - }, - { - "name": "kind", - "type": 51, - "optional": false - }, - { - "name": "summary", - "type": 5, - "optional": false - } - ], - "indices": [] - }, { "kind": "object", "properties": [ @@ -21360,8 +21485,8 @@ { "kind": "union", "types": [ - 195, - 196 + 198, + 199 ] }, { @@ -21378,7 +21503,7 @@ }, { "name": "op", - "type": 141, + "type": 145, "optional": false }, { @@ -21880,6 +22005,15 @@ "names": [], "sources": [] }, + { + "digest": "1020bbc3c744c060cd31c0891ae79b9e4c3e0adfa3f0be49869309b34e9ef200", + "names": [ + "packages/llm/llm/src/message.ts#DeveloperMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:157" + ] + }, { "digest": "1033093edd0db80ff410e00830b523405e00bb0c7684948e531ff65095799625", "names": [], @@ -21944,9 +22078,11 @@ "sources": [] }, { - "digest": "1506a9b8224986c83015ae99d2cb5ede705538c58c063d6a48ef6d761a31ba6c", + "digest": "149c5a77529cb0dc06f5ceb6273069b7606174d1e7893b5f9b1071c15306b846", "names": [], - "sources": [] + "sources": [ + "packages/core/agent/src/types.ts:96" + ] }, { "digest": "15196447222782e773eb943c92b18316ce96b9af0f0cfddb6e57ba8274ecc5ff", @@ -21992,6 +22128,11 @@ "packages/core/session/src/types.ts:427" ] }, + { + "digest": "186159f5f6f67a0b8cd095b8fe55bef42d4f25ca1a1c248f859867af2ece0467", + "names": [], + "sources": [] + }, { "digest": "18dc21f12bbac8ade8377e6fbb54179e20c3d955d73fba3244c57fb6bf001df0", "names": [ @@ -22261,6 +22402,15 @@ "names": [], "sources": [] }, + { + "digest": "26df091b55c8a9b58004931ce5425b441201032cfab0b75e2ba03f428ecbd116", + "names": [ + "packages/llm/llm/src/message.ts#MessageSource" + ], + "sources": [ + "packages/llm/llm/src/message.ts:136" + ] + }, { "digest": "2765e9119edf5816ac1ab4c95c5ee32c90403f3742962eff11544f7752d59d2e", "names": [], @@ -22593,7 +22743,7 @@ "sources": [] }, { - "digest": "3f72db3d87a0c5c43e68be467b4cca728eaf5adc1d5d2b6975ff42bfbd961761", + "digest": "3f42f45cbb8a06586d247e5f3763dc02c8d31a145a9a3b82fabcd101e7e224cc", "names": [], "sources": [] }, @@ -22616,15 +22766,6 @@ "names": [], "sources": [] }, - { - "digest": "40e314bd88730b4bff04a2083cc540ef8659ee2240eeaae0132cac974784b945", - "names": [ - "packages/llm/llm/src/message.ts#MessageSource" - ], - "sources": [ - "packages/llm/llm/src/message.ts:136" - ] - }, { "digest": "4208123b50df5006b181481ab45fcf1cde807b88d3fd4d340090bc2e202fac41", "names": [], @@ -22887,13 +23028,6 @@ "names": [], "sources": [] }, - { - "digest": "51c78ccc9023ce6642d07fb9a10cbf942ff7e313d5b304ddc77218df71da708f", - "names": [], - "sources": [ - "packages/core/session/src/types.ts:311" - ] - }, { "digest": "51edec100659da3a9bd9c3f6ba1180f5e64ec9a1585e5057080df45c180bd357", "names": [ @@ -23014,6 +23148,11 @@ "names": [], "sources": [] }, + { + "digest": "5a92f12db2059c282cdea45b6845c65e6f4a95dd3d649aeddbde6f9ae03c561f", + "names": [], + "sources": [] + }, { "digest": "5abab3a27fd2736660ecddd94b28d6bbf114986dd894880153bd1be3ccacb563", "names": [], @@ -23131,6 +23270,11 @@ "names": [], "sources": [] }, + { + "digest": "6178f1edcb23f361f2a6cb2c859b1c2187220d5695ece4a3400e0d92845a7178", + "names": [], + "sources": [] + }, { "digest": "6292bcbedaa97feaec5b48a03bb8144b581b93309d9d6c905f26da7a6a7a0a4f", "names": [], @@ -23155,15 +23299,6 @@ "packages/subagent/subagent/src/descriptor.ts:72" ] }, - { - "digest": "64ea5653002834c44f29bea4620e9c42aeb6024ae5b1d58d69f95158006b2586", - "names": [ - "packages/llm/llm/src/message.ts#UserMessage" - ], - "sources": [ - "packages/llm/llm/src/message.ts:162" - ] - }, { "digest": "6598cd6da253948d6b207c6374a45335804c79b576866d6215649c2d1bc85e25", "names": [ @@ -23229,15 +23364,6 @@ "names": [], "sources": [] }, - { - "digest": "691c0f641cd3e8072fdacd6fa8c400253cf75a0ce9285d8ce89141bbb24f2fb6", - "names": [ - "packages/llm/llm/src/message.ts#Message" - ], - "sources": [ - "packages/llm/llm/src/message.ts:196" - ] - }, { "digest": "693f4952fb5565da96c06bace8924b098ac2fbc915fde0ff8019701183abc057", "names": [], @@ -23638,6 +23764,11 @@ "names": [], "sources": [] }, + { + "digest": "85d6d96ff884297410ec0026bdacba835f10e56cbcc5a3b9d670739f4aa0494b", + "names": [], + "sources": [] + }, { "digest": "85f9b505b7bdff1f61845c4cea8f36fd0fde1b62facbe87d8924d1d27e616f3a", "names": [], @@ -23856,6 +23987,11 @@ "names": [], "sources": [] }, + { + "digest": "9645cf93769a6dfb227bd400bd6cb9fa7bab9140f4a851e4ae92514ade6e3114", + "names": [], + "sources": [] + }, { "digest": "96bfb916a727cd4445a594df264c523fc039749a31bfed924b8cc7bb308a5bb0", "names": [], @@ -23942,15 +24078,6 @@ "names": [], "sources": [] }, - { - "digest": "9bc85364d1f37d9c837db6a3bdd3d1d007d923cdc7401a3322be9f12fdc225fd", - "names": [ - "packages/session/session-title-llm/src/index.ts#SessionTitleLlmRequestEventData" - ], - "sources": [ - "packages/session/session-title-llm/src/index.ts:34" - ] - }, { "digest": "9d80129e13edfb6feb03ed327e6085c6ef60b97ad074244b2f5fd4667424a6a4", "names": [], @@ -24065,6 +24192,13 @@ "packages/experimental/agent-team/src/types.ts:234" ] }, + { + "digest": "a5d80b5a2f3a6bbaf8f0334126632b78f94d8346122c68e8122ea89906d63d26", + "names": [], + "sources": [ + "packages/core/session/src/types.ts:311" + ] + }, { "digest": "a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc", "names": [], @@ -24238,6 +24372,11 @@ "names": [], "sources": [] }, + { + "digest": "ae84c5e493f94acc63cfb70389073ba616ed7ae7aa4fadde048bdcc64d49bb46", + "names": [], + "sources": [] + }, { "digest": "aec150797b655c5f15ebb7a501454b0c208fbaccec9ace49d7de2171fc02f47d", "names": [], @@ -24443,6 +24582,11 @@ "packages/goal/goal/src/types.ts:45" ] }, + { + "digest": "b83ed1b1cfffbd7bd5cca06ea72e44be57beb68b39e5a96660ce42a9e21aa411", + "names": [], + "sources": [] + }, { "digest": "b8fc636a2121df9d8423c242e03c9d23b7ab7c6fdce00e45746932c60b730f97", "names": [ @@ -24575,6 +24719,13 @@ "names": [], "sources": [] }, + { + "digest": "c55827fba7018198772c50e37cb7d3f60a3d8bb6e94b07de72dee0d9f8968005", + "names": [], + "sources": [ + "packages/interaction/user-questions/src/types.ts:117" + ] + }, { "digest": "c5687b1313206a6ff334066047b6a0681611467dc4df8c5a8e71d0b6df39311f", "names": [], @@ -24626,6 +24777,15 @@ "names": [], "sources": [] }, + { + "digest": "cb7b863ddb7b3eab5f18f216602feba25f47b456e73e4e72b6bcc259875c6dab", + "names": [ + "packages/llm/llm/src/message.ts#Message" + ], + "sources": [ + "packages/llm/llm/src/message.ts:196" + ] + }, { "digest": "cbca49bde16b656d5b8fbe4a8a507769f7b594c6287782b809c03814941bc5e3", "names": [], @@ -24658,6 +24818,15 @@ "names": [], "sources": [] }, + { + "digest": "cfa4409ab0ef198a50a1121ad5013a740760444adc225b9ea816b4667c0158fd", + "names": [ + "packages/llm/llm/src/message.ts#UserMessage" + ], + "sources": [ + "packages/llm/llm/src/message.ts:162" + ] + }, { "digest": "cffcdc19881ab61ec0a9ce18743996f7ac44ac8889f34dfac36ae745574aa22f", "names": [ @@ -24672,11 +24841,6 @@ "names": [], "sources": [] }, - { - "digest": "d1f27cf1650e5f59d5d6e95ce6dfd92b31757af076a8ab6418a70b6dbdd53621", - "names": [], - "sources": [] - }, { "digest": "d28765f87d6b6ab408e0b2f3e7e297791b004b806d8e302c49903ebae815feb2", "names": [], @@ -24765,13 +24929,6 @@ "names": [], "sources": [] }, - { - "digest": "dc4bd7ac827f4b1f9236f9a157a4b4cc171a0588064a611e43edd95f62c68130", - "names": [], - "sources": [ - "packages/core/agent/src/types.ts:96" - ] - }, { "digest": "dd2780e7e07684332f7a9ab047237798d260e7eaffb1321cb38eca695d184c3d", "names": [], @@ -24996,11 +25153,6 @@ "packages/schedule/schedule/src/types.ts:223" ] }, - { - "digest": "eef4ef54dc7a133d47448a4ee822e45a351314923ef5f66db34c8b24e4b32d80", - "names": [], - "sources": [] - }, { "digest": "eefbea819caeeea91ccb02dfafc16c68dd7f961cf9c1b2be25a2084509cf5c5a", "names": [], @@ -25105,15 +25257,6 @@ "packages/context/session-reference/src/types.ts:13" ] }, - { - "digest": "f61313bd96ed95b72eb16a4a5a77ad94a0da1756d428d3d660ff6e23c9e6342b", - "names": [ - "packages/llm/llm/src/message.ts#DeveloperMessage" - ], - "sources": [ - "packages/llm/llm/src/message.ts:157" - ] - }, { "digest": "f6329fb30c7ea8013e8975ca5e78284fb7685cc6bd620e8aa4e9a99bc81d45eb", "names": [], @@ -25186,11 +25329,6 @@ "packages/llm/llm/src/message.ts:167" ] }, - { - "digest": "fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d", - "names": [], - "sources": [] - }, { "digest": "fab2bb09bc5e3b9db0685e8f5500b029af1a2b33e70bc703c1d5d0f596fbc1fd", "names": [ @@ -25229,11 +25367,6 @@ "packages/skill/tool-skill/src/index.ts:34" ] }, - { - "digest": "fc8242857caf7450d7f68a1f509dce83e237bd21571666006895124cb2246a83", - "names": [], - "sources": [] - }, { "digest": "fcf427290c6213c2a7feb57492d832ce324f5b9737a759f424dab69e6bd101a0", "names": [], @@ -25254,6 +25387,15 @@ "names": [], "sources": [] }, + { + "digest": "fe3cdc6f9050584cea4a6d6998c31334bff7899f5ff1095082a44fdf3b47e996", + "names": [ + "packages/session/session-title-llm/src/index.ts#SessionTitleLlmRequestEventData" + ], + "sources": [ + "packages/session/session-title-llm/src/index.ts:34" + ] + }, { "digest": "fe792a6cd430494503837e21e79f91677704ccdd9e870c679aabd7d43ed47ddd", "names": [], diff --git a/docs/subsystems/user-questions.i18n.yaml b/docs/subsystems/user-questions.i18n.yaml index 2a04140f2c..10731879a7 100644 --- a/docs/subsystems/user-questions.i18n.yaml +++ b/docs/subsystems/user-questions.i18n.yaml @@ -10,7 +10,7 @@ zh: 8e1d2627823b1ffc /user-interaction/presentation-intent: en: aca3811ea3f0c2ef - zh: 91f93dc33d12e343 + zh: 6cf2aea40c7dece8 /user-interaction/question-item: en: 1ad4373e6fdfe4c7 zh: efb8d41ebe7224f8 @@ -18,8 +18,11 @@ en: e10cf6c8c9c20962 zh: 0b347b40c12b6b25 /user-interaction/answer: - en: 4235b687a9975881 - zh: 350d000d4bfa7400 + en: efd2dbb95a885d0e + zh: 7a20c75c4ea6a9e0 +/user-interaction/timed-questions-and-late-replies: + en: 74fa698d4a115e80 + zh: 4e9b03b5eab2ae5e /user-interaction/errors: - en: 33cc3bf5e352e223 - zh: 143279cc3f355453 + en: 5762b1498a426ab6 + zh: bb9987ec82103620 diff --git a/docs/subsystems/user-questions.md b/docs/subsystems/user-questions.md index d6515464e5..e409bff747 100644 --- a/docs/subsystems/user-questions.md +++ b/docs/subsystems/user-questions.md @@ -103,9 +103,96 @@ interface AskUserQuestionAnswer { } ``` +Timed answerers receive `wait: { callId, timed: true }`. The call id identifies the card and the foreground wait. The Client calls `attachWait` to claim the wait and obtain its remaining duration; transport forwards the original event without inspecting or rewriting these fields. A `wait` without `timed` identifies an indefinite card-keyed request. An absent `wait` identifies a blocking request without a card key. + +```ts type-equiv +/** Client-safe payload declared for the user-question answerer waterfall. */ +interface AskUserQuestionRequestEvent { + /** Questions to display. */ + questions: AskUserQuestionItem[] + /** Agent identity projected to the corresponding Client Context in transit. */ + agent?: Agent + /** Cancellation lifetime of the pending request. */ + signal?: AbortSignal + /** + * Tool call the Client card is keyed by. Timed answerers attach to the + * business wait stream before starting their local countdown. + */ + wait?: { + /** Tool call the Client card is keyed by. */ + callId: ToolCallId + /** True for a foreground wait that requires a Client claim; absent for indefinite waits. */ + timed?: boolean + } +} +``` + +## Timed questions and late replies + +A timed question waits for a bounded foreground window and then lets the agent continue independent work. If the user answers inside the window, the tool returns the answer batch; otherwise `TimedUserQuestionResult` is `{ pending: true, callId }`. Pending means the question is still answerable; it is not an empty answer, a refusal, a confirmation, or permission. + +```ts type-equiv +/** Timed ask result returned when the foreground answer window closes. */ +type TimedUserQuestionResult = AskUserQuestionAnswer | { pending: true; callId: ToolCallId } +``` + +A Client claim is a business Remote stream, not a Gateway delivery. `TimedQuestionWait` holds the original Host deadline and runs its timer only while no claim exists. Its `attachWait` stream yields the current remaining duration, and the Client counts down with its own clock. Focus, editing, and Take time stay local. Stream cancellation releases that claim; after the last claim leaves, the Host resumes the original deadline. An unattended timeout aborts the foreground waterfall's private signal and returns pending without cancelling the Turn. Gateway and `api-remotes` contain no question-specific timing policy. + +The `userQuestions` Session projection folds existing events into the answerable question set and the settled one; no wait state, focus state, or deadline is logged. Each `request/header` records the exact tool schemas the model saw. Native calls are tracked only when that header declares the timed `ask_user_question` schema with a `timeout` parameter; the blocking legacy tool never declares it. A native `tool/call` opens a question. A `tool/result` marks it `continued` only when it carries the pending payload or is the synthetic `TOOL_OUTCOME_UNKNOWN` result Session resume repair appends; an answer batch moves it into `settled` with that batch, and any failure drops it. A `run_code` PTC sub-call enters the projection when its `tool/ptc-dispatch` result is pending, even though the request header exposes only `run_code`. A late reply moves a continued question into `settled` when its message is admitted as `user/message`, together with the answer batch read out of that message: the timed call's own result recorded the timeout, so a transcript row has nowhere else to read what the user finally chose. A queued reply can be canceled before admission and leaves the question answerable. A reply whose text carries no readable batch settles the call with no answers; one naming a call that is not active changes nothing. + +```ts type-equiv +/** `open` while the tool call may still return the answer; `continued` once the answer can only arrive as a new turn. */ +type UserQuestionState = 'open' | 'continued' +``` + +```ts type-equiv +/** One unanswered timed `ask_user_question` call reconstructed from the Session log. */ +interface PendingUserQuestion { + readonly callId: ToolCallId + readonly questions: readonly AskUserQuestionItem[] + readonly state: UserQuestionState +} +``` + +```ts type-equiv +/** + * One timed `ask_user_question` call and the answers it settled with: the + * batch its own result carried when the user answered inside the window, + * otherwise the batch its late reply carried, because that call's own result + * recorded the timeout. A transcript row reads what the user finally answered + * from here, and only a call listed here was a timed one. + */ +interface SettledUserQuestion { + /** The settled call. */ + readonly callId: ToolCallId + /** The recorded batch, one entry per question; empty when the late reply carried none. */ + readonly answers: readonly AskUserQuestionAnswerItem[] +} +``` + +```ts type-equiv +/** + * Both halves of one Session's timed `ask_user_question` state, as every + * Client reads them. A call made while the blocking legacy tool was in + * effect appears in neither half. + */ +interface UserQuestionProjectionView { + /** Calls that can still take an answer, in ask order. */ + readonly active: readonly PendingUserQuestion[] + /** Calls an answer settled, in settlement order. */ + readonly settled: readonly SettledUserQuestion[] +} +``` + +An open question accepts answers only through the waterfall. Once it is `continued`, the `answer` Remote method queues a user message for the owning agent and wakes it if idle. The message has source `user-question-reply`, outcome `answered`, and an `answer_to_pending_question` payload. The method returns `false` for an open or unknown call, rejects a second queued reply with `REPLY_QUEUED` even after a Host restart, and rejects incomplete or duplicate answer batches with `BAD_ANSWER`. + +Closing the Client panel sends nothing. A foreground timeout ends only the tool wait. Continued questions have no deadline; they stay answerable until a reply is admitted. + +After a Host restart, the Remote layer resumes the root agent when the Session reopens. A late reply then enters a new turn. + ## Errors -`UserQuestionError` extends `HarnessError`, so `ctx.tools.execute()` preserves `{ name, code }` for model-facing tool failures such as `EMPTY_QUESTIONS`, `NO_PROVIDER`, `ASK_ABORTED`, or UI-side cancellation. +`UserQuestionError` extends `HarnessError`, so `ctx.tools.execute()` preserves `{ name, code }` for model-facing tool failures such as `EMPTY_QUESTIONS`, `BAD_INTENT`, `NO_PROVIDER`, `ASK_ABORTED`, or UI-side cancellation. ```ts type-equiv /** Stable error taxonomy for user-questions failures. */ @@ -132,6 +219,44 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp `ctx.userQuestions`: validation plus the scoped answerer waterfall. ```ts cordis-catalog +/** + * Answer a continued question. The reply is steered into the agent as a + * user message whose source names the call; that message is also the + * record that closes the question in the projection. + * @param agent - Live root agent for the owning Session. + * @param callId - Continued question identity. + * @param answer - Complete structured answer batch, one item per question of the call. + * @returns Whether the question is still continued; an accepted reply stays + * queued until the agent admits its user message. + * @throws {UserQuestionError} `BAD_ANSWER` when the batch does not name each + * question of the call exactly once, or `REPLY_QUEUED` when a reply is + * already waiting for admission. + */ +@Remote answer(agent: Agent, callId: ToolCallId, answer: AskUserQuestionAnswer): boolean + +/** + * Let one answer UI hold a live timed wait. Closing the stream releases its claim. + * @param agent - Live root agent owning the question. + * @param callId - Foreground tool call to attach to. + * @param signal - Remote stream cancellation, including Client disconnect. + * @returns One Host-computed remaining duration, or no frames once the wait ended. + */ +@Remote({ mode: 'stream' }) async *attachWait(agent: Agent, callId: ToolCallId, signal: AbortSignal): AsyncIterable<{ remainingMs: number }> + +/** + * Foreground wait whose first settlement the Client decides: the Client + * rejects with `ASK_TIMED_OUT` when its countdown ends, and this method maps + * that code to the pending result. + * @param request - Questions, live owner agent, and abort signal. + * @param callId - Tool call identity the Client card is keyed by. + * @param timeoutMs - Positive foreground wait in milliseconds. + * @returns The answer when it arrives inside the window, otherwise a pending + * result, also when no connected Client claimed the request by the deadline. + * @throws {UserQuestionError} `BAD_TIMEOUT` for a non-integer, non-positive, + * or oversized wait. + */ +async askTimed( request: AskUserQuestionRequest & { agent: Agent }, callId: ToolCallId, timeoutMs: number, ): Promise + /** * Ask the scoped answerer waterfall and wait for the user's answer. * @@ -151,6 +276,8 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp async ask(request: AskUserQuestionRequest): Promise ``` +Types: [Agent](core.md) · [ToolCallId](core.md) + Source: [`packages/interaction/user-questions/src/index.ts`](../../packages/interaction/user-questions/src/index.ts) diff --git a/docs/subsystems/user-questions.zh.md b/docs/subsystems/user-questions.zh.md index 87536c22ad..7b75b08dc6 100644 --- a/docs/subsystems/user-questions.zh.md +++ b/docs/subsystems/user-questions.zh.md @@ -22,7 +22,7 @@ interface AskUserQuestionOption { ## 呈现意图 -`AskUserQuestionIntent` 可选地声明一种已知的决策类型。它按 `kind` 打标签,因此可以增加新的意图;不认识某个标签的 UI 渲染通用选项列表。意图只改变呈现方式——遵循它的 UI 回答的仍是通用 UI 会发送的那些选项标签,因此调用方两种情况下读到的回答字段相同。`approve` 指名肯定选项,而不依赖选项顺序。`ask()` 会拒绝两种无法由类型系统表达的情况:`approve` 未指向该问题自身的任何选项,以及为没有 `detail` 的问题指定意图。 +`AskUserQuestionIntent` 可选地声明一种已知的决策类型。它以 `kind` 作为标记,以便后续加入更多意图;不认识某个标记的 UI 会渲染通用选项列表。意图只改变呈现——遵循它的 UI 回答的选项标签与通用 UI 相同,因此调用方读到的答案字段一致。`approve` 指明表示同意的选项,而不依赖选项顺序。`ask()` 拒绝两种类型无法表达的断言:`approve` 未命名该问题自己的任何选项,以及没有 `detail` 的问题声明了意图。 ```ts type-equiv /** @@ -103,9 +103,96 @@ interface AskUserQuestionAnswer { } ``` +计时回答器收到 `wait: { callId, timed: true }`。调用 id 标识卡片及前台等待。Client 调用 `attachWait` 接手等待并取得剩余时长;传输层转发原事件,不检查或改写这些字段。不带 `timed` 的 `wait` 表示无限期等待的具名卡片请求;没有 `wait` 则表示不带卡片 key 的阻塞请求。 + +```ts type-equiv +/** Client-safe payload declared for the user-question answerer waterfall. */ +interface AskUserQuestionRequestEvent { + /** Questions to display. */ + questions: AskUserQuestionItem[] + /** Agent identity projected to the corresponding Client Context in transit. */ + agent?: Agent + /** Cancellation lifetime of the pending request. */ + signal?: AbortSignal + /** + * Tool call the Client card is keyed by. Timed answerers attach to the + * business wait stream before starting their local countdown. + */ + wait?: { + /** Tool call the Client card is keyed by. */ + callId: ToolCallId + /** True for a foreground wait that requires a Client claim; absent for indefinite waits. */ + timed?: boolean + } +} +``` + +## 计时问题与迟到回复 + +计时问题在有界的前台窗口内等待,然后让 agent 继续独立工作。用户在窗口内回答,工具返回整批答案;否则 `TimedUserQuestionResult` 为 `{ pending: true, callId }`。pending 表示问题仍可回答,不是空答案、拒绝、确认或授权。 + +```ts type-equiv +/** Timed ask result returned when the foreground answer window closes. */ +type TimedUserQuestionResult = AskUserQuestionAnswer | { pending: true; callId: ToolCallId } +``` + +Client 接手通过业务 Remote stream 表达,不等同于 Gateway 投递。`TimedQuestionWait` 保存原 Host deadline,仅在没有接手记录时运行计时器。`attachWait` stream 发出当前剩余时长,Client 用本地时钟倒计时。聚焦、编辑和「慢慢回答」状态仍归本地所有。stream 取消释放相应接手记录;最后一个接手方离开后,Host 恢复原 deadline。无人接手时超时中止前台 waterfall 专属的 signal 并返回 pending,不取消 Turn。Gateway 与 `api-remotes` 不包含问答专属计时策略。 + +`userQuestions` Session 投影把现有事件折叠成可回答的问题集合与已结算的集合;不记录任何等待状态、聚焦状态或 deadline。每个 `request/header` 都记录了模型看到的确切工具 schema。只有请求头声明了带 `timeout` 参数的 timed `ask_user_question` schema,投影才跟踪原生调用;阻塞式 legacy 工具从不声明它。原生 `tool/call` 打开一个问题。`tool/result` 只在两种情况下把它标为 `continued`:带 pending 载荷,或是 Session resume 修复补写的 `TOOL_OUTCOME_UNKNOWN` 合成结果;回答批次把它连同该批次移入 `settled`,其他结果或失败都丢弃它。`run_code` 的 PTC 子调用若在 `tool/ptc-dispatch` 结果中返回 pending,也会进入投影,尽管请求头只列出 `run_code`。迟到回复在消息获准成为 `user/message` 时,才把已继续的问题连同消息中的回答批次移入 `settled`:计时调用自己的结果记录的是超时,transcript 行无处可读用户最终的选择。排队的回复可在准入前取消,此时问题仍可回答。回复正文不含可读批次时,该调用以零答案结算;回复指向的调用已不在可回答集合中时不改变任何内容。 + +```ts type-equiv +/** `open` while the tool call may still return the answer; `continued` once the answer can only arrive as a new turn. */ +type UserQuestionState = 'open' | 'continued' +``` + +```ts type-equiv +/** One unanswered timed `ask_user_question` call reconstructed from the Session log. */ +interface PendingUserQuestion { + readonly callId: ToolCallId + readonly questions: readonly AskUserQuestionItem[] + readonly state: UserQuestionState +} +``` + +```ts type-equiv +/** + * One timed `ask_user_question` call and the answers it settled with: the + * batch its own result carried when the user answered inside the window, + * otherwise the batch its late reply carried, because that call's own result + * recorded the timeout. A transcript row reads what the user finally answered + * from here, and only a call listed here was a timed one. + */ +interface SettledUserQuestion { + /** The settled call. */ + readonly callId: ToolCallId + /** The recorded batch, one entry per question; empty when the late reply carried none. */ + readonly answers: readonly AskUserQuestionAnswerItem[] +} +``` + +```ts type-equiv +/** + * Both halves of one Session's timed `ask_user_question` state, as every + * Client reads them. A call made while the blocking legacy tool was in + * effect appears in neither half. + */ +interface UserQuestionProjectionView { + /** Calls that can still take an answer, in ask order. */ + readonly active: readonly PendingUserQuestion[] + /** Calls an answer settled, in settlement order. */ + readonly settled: readonly SettledUserQuestion[] +} +``` + +开放中的问题只能通过 waterfall 回答。问题变为 `continued` 后,`answer` Remote 方法向所属 agent 排入一条用户消息,并在其空闲时唤醒它。消息的 source 为 `user-question-reply`,outcome 为 `answered`,正文是 `answer_to_pending_question` 载荷。开放或未知调用返回 `false`;回复仍在排队时的第二次提交以 `REPLY_QUEUED` 拒绝,Host 重启后也一样;遗漏或重复问题的回答批次以 `BAD_ANSWER` 拒绝。 + +收起 Client 面板不会发送内容。前台超时只结束工具等待。已继续的问题没有期限;在回复进入会话前,问题仍可回答。 + +Host 重启后,Session 重开时 Remote 层会恢复根 agent。之后的迟到回复会作为新一轮进入。 + ## 错误 -`UserQuestionError` 继承 `HarnessError`,因此 `ctx.tools.execute()` 会保留 `{ name, code }`,用于面向模型的工具失败,如 `EMPTY_QUESTIONS`、`NO_PROVIDER`、`ASK_ABORTED` 或 UI 侧取消。 +`UserQuestionError` 继承 `HarnessError`,因此 `ctx.tools.execute()` 会保留 `{ name, code }`,用于面向模型的工具失败,如 `EMPTY_QUESTIONS`、`BAD_INTENT`、`NO_PROVIDER`、`ASK_ABORTED` 或 UI 侧取消。 ```ts type-equiv /** Stable error taxonomy for user-questions failures. */ @@ -132,6 +219,44 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp `ctx.userQuestions`: validation plus the scoped answerer waterfall. ```ts cordis-catalog +/** + * Answer a continued question. The reply is steered into the agent as a + * user message whose source names the call; that message is also the + * record that closes the question in the projection. + * @param agent - Live root agent for the owning Session. + * @param callId - Continued question identity. + * @param answer - Complete structured answer batch, one item per question of the call. + * @returns Whether the question is still continued; an accepted reply stays + * queued until the agent admits its user message. + * @throws {UserQuestionError} `BAD_ANSWER` when the batch does not name each + * question of the call exactly once, or `REPLY_QUEUED` when a reply is + * already waiting for admission. + */ +@Remote answer(agent: Agent, callId: ToolCallId, answer: AskUserQuestionAnswer): boolean + +/** + * Let one answer UI hold a live timed wait. Closing the stream releases its claim. + * @param agent - Live root agent owning the question. + * @param callId - Foreground tool call to attach to. + * @param signal - Remote stream cancellation, including Client disconnect. + * @returns One Host-computed remaining duration, or no frames once the wait ended. + */ +@Remote({ mode: 'stream' }) async *attachWait(agent: Agent, callId: ToolCallId, signal: AbortSignal): AsyncIterable<{ remainingMs: number }> + +/** + * Foreground wait whose first settlement the Client decides: the Client + * rejects with `ASK_TIMED_OUT` when its countdown ends, and this method maps + * that code to the pending result. + * @param request - Questions, live owner agent, and abort signal. + * @param callId - Tool call identity the Client card is keyed by. + * @param timeoutMs - Positive foreground wait in milliseconds. + * @returns The answer when it arrives inside the window, otherwise a pending + * result, also when no connected Client claimed the request by the deadline. + * @throws {UserQuestionError} `BAD_TIMEOUT` for a non-integer, non-positive, + * or oversized wait. + */ +async askTimed( request: AskUserQuestionRequest & { agent: Agent }, callId: ToolCallId, timeoutMs: number, ): Promise + /** * Ask the scoped answerer waterfall and wait for the user's answer. * @@ -151,6 +276,8 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp async ask(request: AskUserQuestionRequest): Promise ``` +Types: [Agent](core.zh.md) · [ToolCallId](core.zh.md) + Source: [`packages/interaction/user-questions/src/index.ts`](../../packages/interaction/user-questions/src/index.ts) diff --git a/docs/tool-catalog.i18n.yaml b/docs/tool-catalog.i18n.yaml index 094d83b58f..9aa2023296 100644 --- a/docs/tool-catalog.i18n.yaml +++ b/docs/tool-catalog.i18n.yaml @@ -9,8 +9,8 @@ en: 6cc2cd9ced70bb09 zh: 1c0e6cb4ba2ed637 /tool-schema-catalog/tool-package-map: - en: 72e2a375567f5850 - zh: b51b8ea5b52814fd + en: 167287d095eee2f5 + zh: 18720d5e81379d2f /tool-schema-catalog/deepseek-ai-dsh-plugin-manager: en: e0143916bb634762 zh: e0143916bb634762 @@ -54,8 +54,8 @@ en: e713a4a11a15d13c zh: e713a4a11a15d13c /tool-schema-catalog/deepseek-ai-dsh-tool-ask-user/ask-user-question: - en: f42b7f17ad59577a - zh: 7e1eee22ff35d4b1 + en: 055268ba4dcd32f9 + zh: a1a3c4bfcbf698ed /tool-schema-catalog/deepseek-ai-dsh-tools: en: 76fbbf0fe38aef10 zh: 76fbbf0fe38aef10 diff --git a/docs/tool-catalog.md b/docs/tool-catalog.md index d2c16e3006..a77ed07737 100644 --- a/docs/tool-catalog.md +++ b/docs/tool-catalog.md @@ -18,7 +18,7 @@ This table connects model-visible tool names to the plugin package and service s | `@deepseek-ai/dsh-plugin-manager` | `plugin_manager` | `ctx.tools`, `ctx.pluginManager`, `ctx.sandboxPolicy` | `tool/call`, `tool/result`, `user/message` | - | - | | `@deepseek-ai/dsh-mcp-resources` | `list_mcp_resource_templates`, `list_mcp_resources`, `read_mcp_resource` | `ctx.tools`, `ctx.mcpResources` | `tool/call`, `tool/result` | - | - | | `@deepseek-ai/dsh-experimental-browser-use-stagehand-native` | `stagehand_act`, `stagehand_extract`, `stagehand_navigate`, `stagehand_observe`, `stagehand_screenshot`, `stagehand_tabs` | `ctx.browserUse`, `ctx.agents`, `ctx.tools`, `ctx.systemPrompt` | `tool/call`, `tool/result` | - | - | -| `@deepseek-ai/dsh-tool-ask-user` | `ask_user_question` | `ctx.tools`, `ctx.userQuestions` | `tool/call`, `tool/result after a UI/provider answers the question` | - | ask_user_question pauses the tool call until the active UI provider returns a human answer. | +| `@deepseek-ai/dsh-tool-ask-user` | `ask_user_question` | `ctx.tools`, `ctx.userQuestions` | `tool/call`, `tool/result after an answer or timeout`, `late user/message` | - | ask_user_question keeps the original blocking behavior by default; set `mode: timed` to opt into a foreground timeout and pending result while the question remains answerable. In timed mode, `timeout: -1` keeps that call blocking indefinitely. | | `@deepseek-ai/dsh-tools` | `run_code` | `ctx.tools`, `ctx.ptcRuntime (execution time)`, `ctx.systemPrompt` | `tool/call`, `one tool/ptc-dispatch-start + tool/ptc-dispatch pair per bridged sub-call`, `tool/result` | - | Owned by the tool registry as a reserved transport outside filterable capability layers under `mode: ptc` / `mode: both` (see the PTC mode Agent Note). Under `ptc` it is the registry's only wire contribution; the other visible capabilities are declared in a generated SDK section in the loaded runtime's language, and a program calls them through bindings scheduled under the native concurrency contract (submission-ordered starts and policy; concurrency-safe bodies overlap up to `maxParallelSubCalls`) that re-enter the complete guarded tool pipeline and link each nested execution to this outer result. | | `@deepseek-ai/dsh-plan-mode` | `exit_plan_mode` | `ctx.tools`, `ctx.systemPrompt`, `ctx.userQuestions (execution time, opportunistic)` | `tool/call`, `plan/mode inactive on an approved review`, `tool/result` | - | exit_plan_mode stays in the model-facing schema while planning is inactive so transitions add no tool-catalog churn on top of the plan-policy change. Its execute path rejects calls outside plan mode; in plan mode it presents the plan over the user-questions seam (approve / keep planning with feedback), and approval logs plan mode inactive at the step boundary. | | `@deepseek-ai/dsh-tool-bash` | `bash` | `ctx.tools`, `ctx.shell`, `ctx.systemPrompt`, `ctx.shellEnv`, `ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`, `tool/result` | - | The bash tool is the model-facing consumer of the bash executor seam. With a job registry composed every call registers with the generic `ctx.jobs` runtime as it starts, collected/stopped through the `job_*` tools from `@deepseek-ai/dsh-tool-jobs`; without one, or with `enableRunInBackground: false`, the tool registers a foreground-only schema without the `run_in_background` parameter. | @@ -515,7 +515,7 @@ Ask the user a concise question when you need confirmation, a choice, or missing Source: [`packages/interaction/tool-ask-user/src/index.ts`](../packages/interaction/tool-ask-user/src/index.ts) -ask_user_question pauses the tool call until the active UI provider returns a human answer. +ask_user_question keeps the original blocking behavior by default; set `mode: timed` to opt into a foreground timeout and pending result while the question remains answerable. In timed mode, `timeout: -1` keeps that call blocking indefinitely. diff --git a/docs/tool-catalog.zh.md b/docs/tool-catalog.zh.md index 1b3ad1897e..88a9804c22 100644 --- a/docs/tool-catalog.zh.md +++ b/docs/tool-catalog.zh.md @@ -22,7 +22,7 @@ | `@deepseek-ai/dsh-plugin-manager` | `plugin_manager` | `ctx.tools`, `ctx.pluginManager`, `ctx.sandboxPolicy` | `tool/call`, `tool/result`, `user/message` | - | - | | `@deepseek-ai/dsh-mcp-resources` | `list_mcp_resource_templates`, `list_mcp_resources`, `read_mcp_resource` | `ctx.tools`, `ctx.mcpResources` | `tool/call`, `tool/result` | - | - | | `@deepseek-ai/dsh-experimental-browser-use-stagehand-native` | `stagehand_act`、`stagehand_extract`、`stagehand_navigate`、`stagehand_observe`、`stagehand_screenshot`、`stagehand_tabs` | `ctx.browserUse`、`ctx.agents`、`ctx.tools`、`ctx.systemPrompt` | `tool/call`、`tool/result` | - | - | -| `@deepseek-ai/dsh-tool-ask-user` | `ask_user_question` | `ctx.tools`、`ctx.userQuestions` | `tool/call`、`tool/result after a UI/provider answers the question` | - | ask_user_question 会暂停工具调用,直到当前 UI 提供方返回人类答案。 | +| `@deepseek-ai/dsh-tool-ask-user` | `ask_user_question` | `ctx.tools`、`ctx.userQuestions` | `tool/call`、`tool/result after an answer or timeout`、`late user/message` | - | ask_user_question 默认保持原有阻塞行为;设置 `mode: timed` 后才启用前台超时与 pending 结果,同时问题仍可回答;timed 模式内 `timeout: -1` 让本次调用无限期阻塞。 | | `@deepseek-ai/dsh-tools` | `run_code` | `ctx.tools`、`ctx.ptcRuntime (execution time)`、`ctx.systemPrompt` | `tool/call`、`one tool/ptc-dispatch-start + tool/ptc-dispatch pair per bridged sub-call`、`tool/result` | - | 在 `mode: ptc`/`mode: both` 下,它由工具注册表所有,作为可过滤能力层之外的保留传输机制(参见 PTC mode Agent Note)。在 `ptc` 下,它是注册表对协议格式(wire format)的唯一贡献;其他可见能力在使用已加载运行时语言生成的 SDK 章节中声明。程序通过 binding 调用这些能力,调用按照原生并发约定调度:启动顺序和策略遵循提交顺序,并发安全的函数体最多重叠执行 `maxParallelSubCalls` 个。调用会重新进入完整且受守卫保护的工具流水线,并将每个嵌套执行关联到此外层结果。 | | `@deepseek-ai/dsh-plan-mode` | `exit_plan_mode` | `ctx.tools`、`ctx.systemPrompt`、`ctx.userQuestions (execution time, opportunistic)` | `tool/call`、`plan/mode inactive on an approved review`、`tool/result` | - | 规划未激活时,exit_plan_mode 仍保留在面向模型的 schema 中,这样状态转换不会在规划策略变更之外额外造成工具目录变动。其执行路径会拒绝规划模式之外的调用;在规划模式下,它通过用户交互 seam 提交计划(批准/根据反馈继续规划),批准后会在步骤边界记录规划模式已停用。 | | `@deepseek-ai/dsh-tool-bash` | `bash` | `ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`、`tool/result` | - | bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job 注册表时,每次调用一启动就注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具(来自 `@deepseek-ai/dsh-tool-jobs`)收集/停止;没有注册表或 `enableRunInBackground: false` 时,工具注册不带 `run_in_background` 参数的纯前台 schema。 | @@ -519,7 +519,7 @@ 来源:[`packages/interaction/tool-ask-user/src/index.ts`](../packages/interaction/tool-ask-user/src/index.ts) -ask_user_question 会暂停工具调用,直到当前 UI 提供方返回人类答案。 +ask_user_question 默认保持原有阻塞行为;设置 `mode: timed` 后才启用前台超时与 pending 结果,同时问题仍可回答;timed 模式内 `timeout: -1` 让本次调用无限期阻塞。 diff --git a/packages/api/remotes/src/client/index.ts b/packages/api/remotes/src/client/index.ts index 535d7a5243..49ed1e5392 100644 --- a/packages/api/remotes/src/client/index.ts +++ b/packages/api/remotes/src/client/index.ts @@ -4,6 +4,7 @@ import type { Context } from '@deepseek-ai/cordis' import productAnalyticsRemote from '@deepseek-ai/dsh-client-product-analytics/remote' export type {} from '@deepseek-ai/dsh-client-product-analytics/remote' import agentPresetsRemote from '@deepseek-ai/dsh-agent-preset-registry/remote' +import userQuestionsRemote from '@deepseek-ai/dsh-user-questions/remote' import commandsRemote from '@deepseek-ai/dsh-commands/remote' import accountRemote from '@deepseek-ai/dsh-api-account-controller/remote' import settingsControllerRemote from '@deepseek-ai/dsh-api-settings-controller/remote' @@ -39,6 +40,7 @@ export type {} from '@deepseek-ai/dsh-plugin-manager/remote' export type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/remote' export type { PluginInventorySnapshot } from '@deepseek-ai/dsh-host-plugin-inventory/types' export type {} from '@deepseek-ai/dsh-agent-preset-registry/remote' +export type {} from '@deepseek-ai/dsh-user-questions/remote' export type {} from '@deepseek-ai/dsh-commands/remote' export type {} from '@deepseek-ai/dsh-api-settings-controller/remote' export type {} from '@deepseek-ai/dsh-api-account-controller/remote' @@ -182,7 +184,7 @@ export async function apply(ctx: Context): Promise<() => Promise> { pluginInventoryRemote, pluginManagerRemote, pluginRegistryProbeRemote, messageFeedbackRemote, sessionFeedbackRemote, fileUploadsRemote, sessionReferencesRemote, permissionPresetsRemote, subagentsRemote, sessionRemote, jobRemote, workspaceRemote, workspaceFilesRemote, terminalRemote, - officeToPdfRemote, + officeToPdfRemote, userQuestionsRemote, ]) { disposers.push(await ctx.remote.$mount(contribution)) } diff --git a/packages/client/ui-chat/src/client/conversation-nodes/README.i18n.yaml b/packages/client/ui-chat/src/client/conversation-nodes/README.i18n.yaml index f9fe4e3545..1330f4f627 100644 --- a/packages/client/ui-chat/src/client/conversation-nodes/README.i18n.yaml +++ b/packages/client/ui-chat/src/client/conversation-nodes/README.i18n.yaml @@ -36,8 +36,8 @@ en: e4b8384f32e4ff98 zh: e8a42f078b38f41b /chat-conversation-node-rules/process-grouping: - en: 276a97b95610f5e8 - zh: 7627b2afb0a7c0f4 + en: c2650489ded57503 + zh: f2554d74e75ae0f9 /chat-conversation-node-rules/process-grouping/examples: en: 2a550f7e04bce4b0 zh: b8f95b687448cd77 diff --git a/packages/client/ui-chat/src/client/conversation-nodes/README.md b/packages/client/ui-chat/src/client/conversation-nodes/README.md index 10d46adb7b..b23d1d47f5 100644 --- a/packages/client/ui-chat/src/client/conversation-nodes/README.md +++ b/packages/client/ui-chat/src/client/conversation-nodes/README.md @@ -184,6 +184,8 @@ Switching modes retains manually opened groups and inner disclosures. It changes A group collects adjacent process content within one Turn. Step-number changes alone do not split it. All four modes use the same grouping result. A group's `closed` flag means its content segment has ended, not that its UI disclosure is collapsed. +When `question-reply` and `turn-trigger` project the same message id, grouping references only the question reply. Both Nodes stay in the Node Store; the duplicate trigger neither renders nor splits a group. The Turn control precedes the group containing an opening reply. This aggregation also applies before the owning Turn is loaded. + | Input | Membership and segmentation | |---|---| | Non-blank Assistant reasoning | Append one `reasoning` reference for that Assistant to the current group, creating a group if necessary. | diff --git a/packages/client/ui-chat/src/client/conversation-nodes/README.zh.md b/packages/client/ui-chat/src/client/conversation-nodes/README.zh.md index ee00c6e956..ef61f0dad3 100644 --- a/packages/client/ui-chat/src/client/conversation-nodes/README.zh.md +++ b/packages/client/ui-chat/src/client/conversation-nodes/README.zh.md @@ -184,6 +184,8 @@ description: "Chat 过程分组与活动摘要的明细业务规则。" 一组收集同一轮次内相邻的过程内容,仅 Step 编号变化不会拆组。四档模式使用同一分组结果。组的 `closed` 表示这段内容已经结束,不表示 UI 开合控件处于收起状态。 +当 `question-reply` 和 `turn-trigger` 投影自同一个消息 id 时,分组只引用问答回复。两个 Node 都保留在 Node Store 中;重复的触发节点既不显示,也不切开分组。整轮控件位于包含开场回复的分组之前。所属轮次尚未加载时也执行这一聚合。 + | 输入 | 归属与切分 | |---|---| | 非空白 Assistant 推理 | 将该 Assistant 的一个 `reasoning` 引用加入当前组,必要时创建组。 | diff --git a/packages/client/ui-chat/src/client/conversation-nodes/process-groups.ts b/packages/client/ui-chat/src/client/conversation-nodes/process-groups.ts index 36cb552d32..09edc21006 100644 --- a/packages/client/ui-chat/src/client/conversation-nodes/process-groups.ts +++ b/packages/client/ui-chat/src/client/conversation-nodes/process-groups.ts @@ -53,6 +53,15 @@ function readNode(input: ProcessInput, key: NodeKey): ChatNode { return node } +function questionReplyIds(input: ProcessInput, keys: readonly NodeKey[]): ReadonlySet { + const ids = new Set() + for (const key of keys) { + const node: ChatConversationViewNode = readNode(input, key) + if (node.kind === 'question-reply') ids.add(node.id) + } + return ids +} + /** One group's members and cached summary, refreshed together when its content changes. */ class ProcessGroup { private nodes: readonly ChatNode[] = [] @@ -143,17 +152,22 @@ class TurnGroups { } let previous: NodeKey | undefined let followed = false - for (const key of input.readTurn(this.turn)) { + const keys = input.readTurn(this.turn) + const replies = questionReplyIds(input, keys) + for (const key of keys) { const position = readPosition(input, key) if (previous !== undefined && position.previous !== previous) flush(true) previous = key followed = position.next !== undefined const node = readNode(input, key) + // Both Definitions retain the same message id; only its question presentation renders. + if (node.kind === 'turn-trigger' && replies.has(node.id)) continue if (INDEPENDENT.has(node.kind)) { flush(true) emit(key, { kind: 'node', key }) } else if (node.kind === 'turn-process') { - emit(key, { kind: 'node', key }) + // A coalesced opening reply can sort before the control that folds its group. + emit(pending[0]?.key ?? key, { kind: 'node', key }) } else if (node.kind === 'assistant-step') { if (reasoning(node)) pending.push({ kind: 'node', key, groupPart: 'reasoning' }) if (reply(node)) { @@ -277,9 +291,14 @@ export class ProcessState { } private rootEntries(input: ProcessInput): RenderEntry[] { + const unscoped = input.order.filter(key => readPosition(input, key).turn === undefined) + const replies = questionReplyIds(input, unscoped) return input.order.flatMap((key) => { const turn = readPosition(input, key).turn - if (turn === undefined) return [{ kind: 'node', key }] + if (turn === undefined) { + const node = readNode(input, key) + return node.kind === 'turn-trigger' && replies.has(node.id) ? [] : [{ kind: 'node', key }] + } const groups = this.turns.get(turn) if (groups === undefined) throw new Error(`Chat grouping order is missing Turn ${turn}`) return groups.references(key) diff --git a/packages/client/ui-chat/tests/chat-view.client.spec.tsx b/packages/client/ui-chat/tests/chat-view.client.spec.tsx index f9da5bf6be..932dd53060 100644 --- a/packages/client/ui-chat/tests/chat-view.client.spec.tsx +++ b/packages/client/ui-chat/tests/chat-view.client.spec.tsx @@ -2518,6 +2518,27 @@ describe('ChatView', () => { } }) + it('folds a question reply with the surrounding process and reveals it on expansion', () => { + const base = chatSnapshotFixture({ + nodes: [user(1, 'question'), assistant(2, 'inspect', 1, 1), assistant(4, 'final answer', 1, 2)], + turnEnds: new Map([[1, 5]]), + turnTimings: new Map([[1, { startTime: 0, endTime: 5_000 }]]), + }) + const snapshot = new ChatSnapshotBuilder().replace({ + nodes: [...base.nodes.values(), { + key: 'reply', id: 'reply', kind: 'question-reply', target: 'chat', anchorSeq: 3, + location: { kind: 'turn', turn: base.timeline.turns.get(1)! }, visibility: 'visible', data: {}, + }], + timeline: base.timeline, + }) + const h = makeHarness({}, {}, snapshot) + const view = render() + const reply = view.container.querySelector('[data-chat-flow-kind="question-reply"]')! + expect(reply.getAttribute('hidden')).toBe('until-found') + fireEvent.click(turnProcessControl(view.container)!) + expect(reply.getAttribute('hidden')).toBeNull() + }) + it('folds final-step reasoning under the fallback title when every summary count is zero', () => { const final = { ...assistant(3, 'final answer', 1, 1), diff --git a/packages/client/ui-chat/tests/process-groups.client.spec.ts b/packages/client/ui-chat/tests/process-groups.client.spec.ts index 2f98938274..9f652681a9 100644 --- a/packages/client/ui-chat/tests/process-groups.client.spec.ts +++ b/packages/client/ui-chat/tests/process-groups.client.spec.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import { SessionSeq } from '@deepseek-ai/dsh-session/types' import type { MessageId } from '@deepseek-ai/dsh-llm/brand' import type { ConversationTimelineSnapshot, TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client' -import type { ChatNode } from '../src/client/contract/chat-nodes.ts' +import type { ChatConversationViewNode, ChatNode } from '../src/client/contract/chat-nodes.ts' import { ChatSnapshotBuilder } from '../src/client/conversation-nodes/chat-snapshot-builder.ts' import { ProcessState } from '../src/client/conversation-nodes/process-groups.ts' import { ConversationGroupStore } from '../../ui-conversation/src/client/conversation/group-store.ts' @@ -48,7 +48,19 @@ function separator(seq: number, inTurn: boolean): ChatNode<'user'> | ChatNode<'s return inTurn ? { ...user, kind: 'steering', data: { ...user.data, kind: 'steering', messageId: 'steer' as MessageId } } : user } -function harness(nodes: ChatNode[], currentTimeline = timeline) { +function replyNodes(inTurn: boolean): readonly [ChatConversationViewNode, ChatConversationViewNode] { + const trigger: ChatConversationViewNode = { + key: 'generic-reply', id: 'reply-message', kind: 'turn-trigger', target: 'chat', anchorSeq: 6, + location: inTurn ? { kind: 'turn', turn } : { kind: 'session' }, visibility: 'visible', + data: { + kind: 'context', seq: 6, time: 6, content: [{ type: 'text', text: 'answer' }], + source: { kind: 'user-question-reply' }, producer: { role: 'inject', label: null }, form: null, + }, + } + return [trigger, { ...trigger, key: 'question-reply', kind: 'question-reply', data: {} }] +} + +function harness(nodes: readonly ChatConversationViewNode[], currentTimeline = timeline) { const builder = new ChatSnapshotBuilder() const state = new ProcessState() const store = new ConversationGroupStore() @@ -117,6 +129,71 @@ describe('Definition-owned Chat process groups', () => { expect(source.getSnapshot()?.data.summary).toEqual({ counts: [{ kind, count: 1 }], running: undefined, runningDetail: '' }) }) + it.each(['a-trigger', 'z-trigger'])('renders one question reply without splitting its group for duplicate %s', (key) => { + const [generic, reply] = replyNodes(true) + const trigger = { ...generic, key } + const h = harness([tool('before', 4), trigger, reply, tool('after', 8)]) + expect(h.store.entries.map(entry => entry.kind)).toEqual(['group']) + const group = h.store.entries[0]! + if (group.kind !== 'group') throw new Error('expected group') + expect(h.store.groupSource(group.key).getSnapshot()?.members.map(member => member.key)) + .toEqual(['before', reply.key, 'after']) + expect(h.snapshot.nodes.get(trigger.key)).toBeDefined() + expect(h.snapshot.nodes.get(reply.key)).toBeDefined() + }) + + it.each([0.9, 5])('keeps the Turn control before its coalesced opening reply at seq %s', (anchorSeq) => { + const control: ChatNode<'turn-process'> = { + key: 'control', id: '1', kind: 'turn-process', target: 'chat', anchorSeq, + location: { kind: 'turn', turn }, visibility: 'visible', + data: { + turn: 1, controlAnchorSeq: 1, processStartSeq: 1, answerAnchorSeq: null, + answerStep: null, inlineReasoning: false, messageCount: 0, toolCallCount: 1, subagentCount: 0, + }, + } + const h = harness([control, ...replyNodes(true), tool('after', 8)]) + expect(h.store.entries.map(entry => entry.kind)).toEqual(['node', 'group']) + expect(h.store.entries[0]).toEqual({ kind: 'node', key: control.key }) + }) + + it('aggregates a newly projected reply with its existing trigger', () => { + const [trigger, reply] = replyNodes(true) + const h = harness([tool('before', 4), trigger, tool('after', 8)]) + h.builder.apply({ upserts: [reply], timeline }) + h.commit() + expect(h.store.entries.map(entry => entry.kind)).toEqual(['group']) + const group = h.store.entries[0]! + if (group.kind !== 'group') throw new Error('expected group') + expect(h.store.groupSource(group.key).getSnapshot()?.members.map(member => member.key)) + .toEqual(['before', reply.key, 'after']) + + h.builder.apply({ upserts: [{ ...reply, visibility: 'hidden' }], timeline }) + h.commit() + expect(h.store.entries.map(entry => entry.kind)).toEqual(['group', 'node', 'group']) + expect(h.store.entries[1]).toEqual({ kind: 'node', key: trigger.key }) + }) + + it('aggregates reply projections before their Turn has been loaded', () => { + const [trigger, reply] = replyNodes(false) + const h = harness([trigger, reply]) + expect(h.store.entries).toEqual([{ kind: 'node', key: reply.key }]) + expect(h.snapshot.nodes.get(trigger.key)).toBeDefined() + }) + + it('keeps unscoped aggregation current when a reply arrives', () => { + const [trigger, reply] = replyNodes(false) + const h = harness([trigger]) + h.builder.apply({ upserts: [reply], timeline }) + h.commit() + expect(h.store.entries).toEqual([{ kind: 'node', key: reply.key }]) + }) + + it.each([true, false])('does not merge identical text from different messages, scoped: %s', (inTurn) => { + const [trigger, reply] = replyNodes(inTurn) + const h = harness([trigger, { ...reply, id: 'different-message', data: trigger.data }]) + expect(h.store.entries).toContainEqual({ kind: 'node', key: trigger.key }) + }) + it('retains a group through repeated prepends and a later append', () => { const b = tool('b', 4) const c = tool('c', 6) diff --git a/packages/client/ui-chat/tests/skill-name-projector.client.spec.ts b/packages/client/ui-chat/tests/skill-name-projector.client.spec.ts index 13df2da704..7deae70472 100644 --- a/packages/client/ui-chat/tests/skill-name-projector.client.spec.ts +++ b/packages/client/ui-chat/tests/skill-name-projector.client.spec.ts @@ -18,7 +18,7 @@ function viewNode(kind: string, seq: number, data: Record): Cha location: { kind: 'session' }, visibility: 'visible', data: { kind, seq, time: seq, ...data }, - } as unknown as ChatConversationViewNode + } } const user = (seq: number, text: string) => viewNode('user', seq, { content: [{ type: 'text', text }], source: { kind: 'user' } }) diff --git a/packages/client/ui-conversation/src/client/locales.ts b/packages/client/ui-conversation/src/client/locales.ts index 455198ce82..78b26f7ab6 100644 --- a/packages/client/ui-conversation/src/client/locales.ts +++ b/packages/client/ui-conversation/src/client/locales.ts @@ -289,6 +289,12 @@ export const zh = { 'command.attachmentsUnsupported': '/{command} 不接受附件,请先移除附件', 'ask.rowTitle': '提问', 'ask.waiting': '等待回答', + 'ask.pending': '已继续工作,仍可回答', + 'ask.pendingDetail': '等待中的问题仍可在输入框中回答', + 'ask.reopen': '回答', + 'ask.review': '查看回答', + 'ask.closed': '已结束', + 'ask.closedDetail': '该问题已结束,结果见下方对话', 'ask.cancelled': '已取消', 'ask.cancelledDetail': '本轮已取消,未提交回答', 'ask.interrupted': '已中断', @@ -659,6 +665,12 @@ export const en = { 'command.attachmentsUnsupported': '/{command} does not accept attachments; remove them first', 'ask.rowTitle': 'Ask question', 'ask.waiting': 'waiting', + 'ask.pending': 'continued; answer still available', + 'ask.pendingDetail': 'These pending questions remain answerable from the composer.', + 'ask.reopen': 'Answer', + 'ask.review': 'View answers', + 'ask.closed': 'closed', + 'ask.closedDetail': 'This question is closed; its outcome is in the conversation below.', 'ask.cancelled': 'cancelled', 'ask.cancelledDetail': 'This question set was cancelled before answers were submitted.', 'ask.interrupted': 'interrupted', diff --git a/packages/client/ui-primitives/src/DisclosureRow.tsx b/packages/client/ui-primitives/src/DisclosureRow.tsx index a8360d365b..7b98eca2fc 100644 --- a/packages/client/ui-primitives/src/DisclosureRow.tsx +++ b/packages/client/ui-primitives/src/DisclosureRow.tsx @@ -96,6 +96,7 @@ export const DisclosureRow = memo(function DisclosureRow({ + } + > + {open &&
+ {askQuestion != null ? :
+ {bodyRaw != null &&
+ {t('row.input')} + {formatToolBody('others', bodyRaw)} +
} + {bodyRaw != null && output != null && } + {output != null &&
+ {t('row.output')}{output} +
} +
} + {inspect !== undefined && } +
} + + + ) +} diff --git a/packages/client/ui-tool/src/client/tool/toolviews/ask-question-row.tsx b/packages/client/ui-tool/src/client/tool/toolviews/ask-question-row.tsx index ff38e3f7a3..5bf38d3e25 100644 --- a/packages/client/ui-tool/src/client/tool/toolviews/ask-question-row.tsx +++ b/packages/client/ui-tool/src/client/tool/toolviews/ask-question-row.tsx @@ -1,26 +1,20 @@ +import { useCallback } from 'react' import { IconQuestionOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives' import type { Context } from '@deepseek-ai/cordis' -import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' -import type { ToolCallViewProps } from '../../contract/slots.ts' +import type {} from '@deepseek-ai/dsh-agent/types' +import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' +// Also merges the userQuestions key into SessionProjectionMap for useProjection. +import type { + AskUserQuestionAnswerItem, AskUserQuestionItem, AskUserQuestionOption, +} from '@deepseek-ai/dsh-user-questions/types' +import type { ToolCallViewProps, UserQuestionRecord } from '../../contract/slots.ts' import type { AskQuestionCardModel } from '../models/ask-question-card-model.ts' import { singleResultText } from '../models/raw-tool-call.ts' import { toolRowModel } from '../models/tool-call-model.ts' import { ToolRow } from '../components/ToolRow.tsx' +import { QuestionToolRow } from '../components/QuestionToolRow.tsx' import { CONVERSATION_NS as NS } from '../../locale.ts' -/** One result entry after validating the fields used by the transcript card. */ -interface AnswerEntry { - id: string - selected: string[] - custom?: string -} - -/** One question after validating the fields used by the transcript card. */ -interface QuestionEntry { - id: string - question: string -} - /** One paired question and its visible answer lines. */ interface AnsweredQuestion { id: string @@ -28,9 +22,13 @@ interface AnsweredQuestion { answers: string[] } +/** Everything a recorded answer batch puts on its row. */ interface AnswerPresentation { summary: string - questions: AnsweredQuestion[] | null + /** The paired transcript card; absent when pairing the batch would be ambiguous. */ + transcript: AskQuestionCardModel | null + /** Material for the read-only panel; absent whenever the transcript card is, since both render the same pairing. */ + record: UserQuestionRecord | undefined } function isRecord(value: unknown): value is Record { @@ -46,12 +44,12 @@ function parseJson(text: string): unknown { } /** Answer records from the result JSON; null when the result is malformed. */ -function answerEntries(text: string): AnswerEntry[] | null { +function answerEntries(text: string): AskUserQuestionAnswerItem[] | null { const parsed = parseJson(text) if (!isRecord(parsed)) return null const answers = parsed.answers if (!Array.isArray(answers) || !answers.every(isRecord)) return null - const entries: AnswerEntry[] = [] + const entries: AskUserQuestionAnswerItem[] = [] for (const answer of answers) { if (typeof answer.id !== 'string' || !Array.isArray(answer.selected) @@ -66,11 +64,41 @@ function answerEntries(text: string): AnswerEntry[] | null { return entries } -/** Questions from call JSON; null when pairing with answers would be ambiguous. */ -function questionEntries(argsRaw: string): QuestionEntry[] | null { +/** Answers from a submitted steer that still awaits admission to a step. */ +function queuedAnswerEntries(message: unknown, callId: string): AskUserQuestionAnswerItem[] | null { + if (!isRecord(message) || !Array.isArray(message.content)) return null + const content: unknown = message.content[0] + if (!isRecord(content) || content.type !== 'text' || typeof content.text !== 'string') return null + const parsed = parseJson(content.text) + if (!isRecord(parsed) || parsed.kind !== 'answer_to_pending_question' || parsed.callId !== callId) return null + return answerEntries(content.text) +} + +/** One question's choices from call JSON; absent when any entry is malformed. */ +function optionEntries(value: unknown): AskUserQuestionOption[] | undefined { + if (!Array.isArray(value)) return undefined + const options: AskUserQuestionOption[] = [] + for (const option of value) { + if (!isRecord(option) || typeof option.label !== 'string') return undefined + options.push({ + label: option.label, + ...(typeof option.description === 'string' ? { description: option.description } : {}), + }) + } + return options +} + +/** + * Questions from call JSON; null when pairing with answers would be ambiguous. + * The optional presentation fields are carried for the read-only answer panel, + * which renders the same option lists the user chose from; a malformed one is + * dropped rather than failing the whole call, because the transcript card needs + * only the id and the question text. + */ +function questionEntries(argsRaw: string): AskUserQuestionItem[] | null { const parsed = parseJson(argsRaw) if (!isRecord(parsed) || !Array.isArray(parsed.questions) || parsed.questions.length === 0) return null - const questions: QuestionEntry[] = [] + const questions: AskUserQuestionItem[] = [] const ids = new Set() for (const question of parsed.questions) { if (!isRecord(question) @@ -78,16 +106,27 @@ function questionEntries(argsRaw: string): QuestionEntry[] | null { || typeof question.question !== 'string' || ids.has(question.id)) return null ids.add(question.id) - questions.push({ id: question.id, question: question.question }) + const options = optionEntries(question.options) + questions.push({ + id: question.id, + question: question.question, + ...(typeof question.header === 'string' ? { header: question.header } : {}), + ...(typeof question.detail === 'string' ? { detail: question.detail } : {}), + ...(options === undefined ? {} : { options }), + // The tool schema spells the multi-select flag in snake case. + ...(typeof question.multi_select === 'boolean' ? { multiSelect: question.multi_select } : {}), + }) } return questions } /** Pair questions with result entries by their echoed stable ids. */ -function pairAnswers(argsRaw: string, answers: AnswerEntry[]): AnsweredQuestion[] | null { - const questions = questionEntries(argsRaw) - if (questions === null || questions.length !== answers.length) return null - const byId = new Map() +function pairAnswers( + questions: readonly AskUserQuestionItem[], + answers: readonly AskUserQuestionAnswerItem[], +): AnsweredQuestion[] | null { + if (questions.length !== answers.length) return null + const byId = new Map() for (const answer of answers) { if (byId.has(answer.id)) return null byId.set(answer.id, answer) @@ -97,7 +136,8 @@ function pairAnswers(argsRaw: string, answers: AnswerEntry[]): AnsweredQuestion[ const answer = byId.get(question.id) if (answer === undefined) return null paired.push({ - ...question, + id: question.id, + question: question.question, answers: [ ...answer.selected, ...(answer.custom === undefined || answer.custom === '' ? [] : [answer.custom]), @@ -107,18 +147,29 @@ function pairAnswers(argsRaw: string, answers: AnswerEntry[]): AnsweredQuestion[ return paired } -/** Answer summary plus structured transcript content from the two wire JSON documents. */ +/** + * Answer summary, transcript content, and panel material from one recorded + * answer batch, whether the result carried it in time or a late reply did. + * @param questions - The call's questions, or null when they failed validation. + * @param answers - The recorded answer batch. + * @param t - Row translator. + * @returns What the answered row shows. + */ function answeredPresentation( - argsRaw: string, - text: string, + questions: readonly AskUserQuestionItem[] | null, + answers: readonly AskUserQuestionAnswerItem[], t: AskQuestionRowProps['t'], -): AnswerPresentation | null { - const answers = answerEntries(text) - if (answers === null) return null +): AnswerPresentation { const answered = answers.filter(answer => answer.selected.length > 0 || (answer.custom ?? '') !== '').length + const paired = questions === null ? null : pairAnswers(questions, answers) return { summary: t('ask.answered', { answered, total: answers.length }), - questions: pairAnswers(argsRaw, answers), + transcript: paired === null ? null : { kind: 'answered', questions: paired, skippedLabel: t('ask.skipped') }, + // The read-only panel renders the option lists the user chose from and + // looks each answer up by question id, so a batch this row cannot pair + // unambiguously gets no panel either: blank or dropped answers would read + // as choices the user made. + record: paired === null || questions === null ? undefined : { questions, answers }, } } @@ -134,11 +185,61 @@ function answeredSummary(text: string, t: AskQuestionRowProps['t']): string | nu return t('ask.answered', { answered, total: answers.length }) } -type AskQuestionRowProps = ToolCallViewProps & PropsLocale<'conversation'> +/** Whether a successful tool result records a still-answerable timed question. */ +function isPendingResult(text: string): boolean { + const parsed = parseJson(text) + return isRecord(parsed) && parsed.pending === true && typeof parsed.callId === 'string' +} + +/** Injected panel verbs for the row's own Session, filled by the optional panel provider. */ +interface AskQuestionPanelInjected { + /** + * Show one call's answer panel in the composer. + * @param callId - the row's own `ask_user_question` call. + * @returns whether a panel for that call was there to show. + */ + revealPanel: (callId: string) => boolean + /** + * Show one settled call's recorded answers as a read-only panel. + * @param callId - the row's own `ask_user_question` call. + * @param record - the call's questions and recorded answers, read from this row. + * @returns whether a panel provider was there to show it. + */ + reviewPanel: (callId: string, record: UserQuestionRecord) => boolean +} + +type AskQuestionRowProps = ToolCallViewProps & PropsLocale<'conversation'> & InjectFace /** Summarizes a pending, answered, cancelled, or interrupted question set. */ -export function AskQuestionRow({ toolName, block, inspect, useDisclosure, t }: AskQuestionRowProps) { +export function AskQuestionRow({ + callId, toolName, block, inspect, useDisclosure, useProjection, revealPanel, reviewPanel, t, +}: AskQuestionRowProps) { const model = toolRowModel(toolName, block) + // The `userQuestions` projection lists exactly the timed calls that can still + // take an answer — the running ones and the ones the agent continued past — + // so it, not the recorded result, decides whether this row offers its panel. + // A recorded pending result stays recorded after the reply, the skip, or the + // timeout lands, and a legacy blocking call is never listed: its row reads + // exactly as it did before timed questions existed. + const answerable = useProjection('userQuestions', view => + view?.active.some(row => row.callId === callId) ?? false) + // The same projection settles every answered timed call with its batch: the + // one its own result carried, or the one a late reply carried after the + // result recorded the timeout. A legacy call is never settled there, so its + // answers come from its result text alone, without a panel to read back. + const settled = useProjection('userQuestions', view => + view?.settled.find(row => row.callId === callId)) + // A continued call stays answerable until its steered reply is admitted. + // Select the durable Inbox entry so its submitted answers can be reviewed + // read-only during that interval, including after a browser reconnect. + const queuedReply = useProjection('inbox', (view) => { + const matches = (message: unknown): boolean => { + const source = isRecord(message) ? message.source : undefined + return isRecord(source) && source.kind === 'user-question-reply' && source.callId === callId + } + return view?.['next-step'].find(matches) ?? view?.['next-turn'].find(matches) + }) + const reopen = useCallback(() => revealPanel(callId), [callId, revealPanel]) // Composer verdicts settle the call as specific UserQuestionErrors // (ask_user_question handler): 'ASK_CANCELLED' is the user's own // dismissal of the set, 'ASK_ABORTED' is a turn interrupt landing while the @@ -150,6 +251,10 @@ export function AskQuestionRow({ toolName, block, inspect, useDisclosure, t }: A let summary = model.summary let state = model.state let transcript: AskQuestionCardModel | null = null + // An answerable call reopens its panel, a queued reply reveals the row's + // read-only transcript, and a settled call opens a read-only panel. + let rowAction: (() => boolean) | undefined + let rowActionLabel = t('ask.reopen') if (code === 'ASK_CANCELLED') { summary = t('ask.cancelled') state = 'ok' @@ -166,18 +271,84 @@ export function AskQuestionRow({ toolName, block, inspect, useDisclosure, t }: A } } else if (model.state === 'running') { summary = t('ask.waiting') + if (answerable) rowAction = reopen + } else if (code === 'TOOL_OUTCOME_UNKNOWN' && (answerable || settled !== undefined)) { + // Crash repair has no pending result text; the durable question projection + // still knows whether the interrupted call can take a late answer. + state = 'ok' + const questions = questionEntries(argsRaw) + if (answerable) { + summary = t('ask.pending') + if (questions !== null) transcript = { kind: 'unanswered', questions, verdict: t('ask.pendingDetail') } + rowAction = reopen + } else if (settled?.answers.length === 0) { + summary = t('ask.closed') + if (questions !== null) transcript = { kind: 'unanswered', questions, verdict: t('ask.closedDetail') } + } else if (settled !== undefined) { + const presentation = answeredPresentation(questions, settled.answers, t) + summary = presentation.summary + transcript = presentation.transcript + const record = presentation.record + if (record !== undefined) { + rowAction = () => reviewPanel(callId, record) + rowActionLabel = t('ask.review') + } + } } else if ('kind' in block && model.state === 'ok') { const text = singleResultText(block) if (text !== undefined) { - const presentation = answeredPresentation(argsRaw, text, t) - // Full transcripts require stable ids and valid visible fields; retain the - // legacy best-effort count when only strict pairing is unsafe. - summary = presentation?.summary ?? answeredSummary(text, t) ?? model.summary - if (presentation?.questions !== null && presentation?.questions !== undefined) { - transcript = { kind: 'answered', questions: presentation.questions, skippedLabel: t('ask.skipped') } + const questions = questionEntries(argsRaw) + // A timed question's recorded result may be the timeout; whether it is + // still answerable, and what the user finally answered, is the + // projection's to say. + const pending = isPendingResult(text) + if (pending && answerable) { + summary = t('ask.pending') + if (questions !== null) { + transcript = { kind: 'unanswered', questions, verdict: t('ask.pendingDetail') } + } + rowAction = reopen + } else if (pending && (settled === undefined || settled.answers.length === 0)) { + summary = t('ask.closed') + if (questions !== null) { + transcript = { kind: 'unanswered', questions, verdict: t('ask.closedDetail') } + } + } else { + // Answered either way: whether the answer beat the timeout is the + // agent's pacing, not something a reader of the row has to reason + // about, so a late-answered call reads exactly like an in-time one. + const answers = settled?.answers ?? answerEntries(text) + const presentation = answers === null ? null : answeredPresentation(questions, answers, t) + // Full transcripts require stable ids and valid visible fields; retain the + // legacy best-effort count when only strict pairing is unsafe. + summary = presentation?.summary ?? answeredSummary(text, t) ?? model.summary + transcript = presentation?.transcript ?? null + // Only a timed call has a panel to read its answers back in. + const record = settled === undefined ? undefined : presentation?.record + if (record !== undefined) { + rowAction = () => reviewPanel(callId, record) + rowActionLabel = t('ask.review') + } } } } + if (answerable && queuedReply !== undefined && rowAction === reopen) { + const answers = queuedAnswerEntries(queuedReply, callId) + const presentation = answers === null ? null : answeredPresentation(questionEntries(argsRaw), answers, t) + if (presentation?.record !== undefined) { + summary = presentation.summary + transcript = presentation.transcript + // The queued reply is reviewed in this row while its editable card is absent. + rowAction = () => false + rowActionLabel = t('ask.review') + } + } + if (rowAction !== undefined) return ( + + ) return ( ctx.slots.register({ name: 'tool.call.toolview', key: 'ask_user_question', locale: NS, + // Read per click, not per render: a composition with no question UI + // provides no panels, and the row then falls back to its own record. + inject: (sessionId): AskQuestionPanelInjected => ({ + revealPanel: callId => ctx.get('userQuestionPanels')?.reveal(sessionId, callId) ?? false, + reviewPanel: (callId, record) => + ctx.get('userQuestionPanels')?.review(sessionId, callId, record) ?? false, + }), }, AskQuestionRow)) }, } diff --git a/packages/client/ui-tool/tests/ask-question-row.client.spec.tsx b/packages/client/ui-tool/tests/ask-question-row.client.spec.tsx index 7e833c9659..7a3dc224b4 100644 --- a/packages/client/ui-tool/tests/ask-question-row.client.spec.tsx +++ b/packages/client/ui-tool/tests/ask-question-row.client.spec.tsx @@ -2,18 +2,22 @@ /** * ask_user_question toolview acceptance: `waiting` summary while running, * answered-count from the result JSON once settled (skipped answers - * excluded), readable question lists for ASK_CANCELLED and ASK_ABORTED, - * shared ToolRow state semantics for interrupted/failed calls, and generic - * fallbacks on malformed results. + * excluded), the same reading for a call a late reply answered, readable + * question lists for ASK_CANCELLED and ASK_ABORTED, the still-answerable + * row's reopen action and its closed counterpart, shared ToolRow state + * semantics for interrupted/failed calls, and generic fallbacks on malformed + * results. */ import { cleanup, fireEvent, render, screen } from '@testing-library/react' import { useDisclosure } from '@deepseek-ai/dsh-client-ui-chat/src/client/chat/use-disclosure.ts' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { ToolResultNode } from '@deepseek-ai/dsh-client-ui-chat/client' +import type { ToolCallBlock, ToolResultNode } from '@deepseek-ai/dsh-client-ui-chat/client' import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts' // Export discipline: packages/client/AGENTS.md. import { AskQuestionRow, askQuestionToolview } from '../src/client/tool/toolviews/ask-question-row.tsx' +import type { UserQuestionPanels } from '../src/client/contract/slots.ts' +import type { SessionId } from '@deepseek-ai/dsh-session/types' import { zh } from '@deepseek-ai/dsh-client-ui-conversation/src/client/locales.ts' afterEach(cleanup) @@ -24,6 +28,7 @@ const READABLE_ARGS = JSON.stringify({ questions: [ { id: 'scope', question: 'Which project should this apply to?' }, { id: 'notes', question: 'Anything else?' }, ] }) +const PENDING_RESULT = JSON.stringify({ pending: true, callId: 'c1' }) const resultNode = (argsRaw: string, resultText: string | null, over?: Partial): ToolResultNode => ({ kind: 'tool-result', seq: 10, time: 2_000, callTime: 1_000, callId: 'c1', @@ -32,22 +37,97 @@ const resultNode = (argsRaw: string, resultText: string | null, over?: Partial - ({ phase: 'start' as const, callId: 'c1', name: 'ask_user_question', argsRaw, turn: 1, step: 1, time: 1_000, subCalls: [] }) +const runningCall = (argsRaw: string): ToolCallBlock => + ({ phase: 'start', callId: 'c1', name: 'ask_user_question', argsRaw, turn: 1, step: 1, time: 1_000, subCalls: [] }) const t = makeTranslate(zh, commonZh) -function rowProps(block: Parameters[0]['block']): Parameters[0] { - return { - useDisclosure, callId: 'c1', toolName: 'ask_user_question', ...('kind' in block ? { phase: 'result' as const, block: block } : { phase: block.phase, block: block }), t, +/** What the row's environment says about the call, beyond the recorded block. */ +interface RowEnvironment { + /** Call ids the `userQuestions` projection still lists as answerable; absent = none. */ + answerable?: readonly string[] + /** Answer batches the projection settled a late reply with, by call id; absent = none. */ + settled?: Readonly> + /** Pending steers mirrored by the durable Inbox projection. */ + inbox?: { readonly 'next-turn': readonly unknown[]; readonly 'next-step': readonly unknown[] } + /** The injected reopen verb; absent = a panel is always there to show. */ + revealPanel?: (callId: string) => boolean + /** The injected read-only verb; absent = a provider is always there. */ + reviewPanel?: (callId: string, record: unknown) => boolean +} + +function rowProps(block: ToolCallBlock, env: RowEnvironment = {}): Parameters[0] { + const view = { + active: (env.answerable ?? []).map(callId => ({ callId })), + settled: Object.entries(env.settled ?? {}).map(([callId, answers]) => ({ callId, answers })), + } + const useProjection = (key: string, select: (value: unknown) => unknown) => + select(key === 'inbox' ? env.inbox : view) + const props = { + useDisclosure, callId: 'c1', toolName: 'ask_user_question', t, + ...('kind' in block ? { phase: 'result', block } : { phase: block.phase, block }), + useToolCallArgumentsPartial: () => '', openFile: vi.fn(), - sessionId: 's1', + loadImage: vi.fn(async () => ''), + sessionId: 's1' as SessionId, + useSession: vi.fn(), useSessions: () => undefined, + useProjection, + revealPanel: env.revealPanel ?? (() => true), + reviewPanel: env.reviewPanel ?? (() => true), } as Parameters[0] + return props } const answers = (entries: unknown[]): string => JSON.stringify({ answers: entries }) +const queuedReply = (callId: string, entries: unknown[]): unknown => ({ + source: { kind: 'user-question-reply', callId, outcome: 'answered' }, + content: [{ type: 'text', text: JSON.stringify({ + kind: 'answer_to_pending_question', tool: 'ask_user_question', callId, answers: entries, + }) }], +}) + +/** Every pill the row can offer, by its visible copy. */ +const PILL = { reopen: '回答', review: '查看回答' } as const + +/** The panel verbs the registered toolview hands each row of one Session. */ +interface PanelFace { + revealPanel: (callId: string) => boolean + reviewPanel: (callId: string, record: unknown) => boolean +} + +/** The keyed toolview declaration, as far as this spec reads it. */ +interface ToolviewDeclaration { + inject?: (sessionId: string) => PanelFace +} + +/** The optional panel provider, as far as this spec calls it. */ +type PanelProvider = UserQuestionPanels + +/** + * Apply the plugin against a fake root and return the face it injects into a + * row of Session `s1`. + * @param get - the root's optional-service lookup. + * @returns the injected panel verbs. + */ +function injectedFace(get: (name: string) => PanelProvider | undefined): PanelFace { + let declaration: ToolviewDeclaration | undefined + askQuestionToolview.apply({ + get, + slots: { + inject: (_name: string, callback: () => () => void) => callback(), + register: (declared: ToolviewDeclaration) => { + declaration = declared + return () => undefined + }, + }, + } as never) + const face = declaration?.inject?.('s1') + if (face === undefined) throw new Error('the toolview registered no injected face') + return face +} + describe('AskQuestionRow', () => { it('running call reads waiting (args-independent: the composer takeover shows the questions)', () => { const view = render() @@ -56,6 +136,228 @@ describe('AskQuestionRow', () => { expect(view.container.querySelector('[data-state="running"]')).not.toBeNull() }) + it('a running call the projection still lists offers its panel from the row body', () => { + const revealPanel = vi.fn(() => true) + render() + + fireEvent.click(screen.getByRole('button', { name: PILL.reopen })) + expect(revealPanel).toHaveBeenCalledWith('c1') + }) + + it('a pending row keeps the disclosure on its leading glyph while the body reopens the panel', () => { + const revealPanel = vi.fn(() => true) + const view = render() + + expect(view.container.querySelector('[data-disclosure-row]')?.getAttribute('role')).toBeNull() + + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(screen.getByRole('button', { expanded: true })).toBeTruthy() + expect(revealPanel).not.toHaveBeenCalled() + + fireEvent.click(screen.getByRole('button', { name: PILL.reopen })) + expect(revealPanel).toHaveBeenCalledWith('c1') + // Reopening is not a disclosure: the body the user already opened stays open. + expect(screen.getByRole('button', { expanded: true })).toBeTruthy() + }) + + it('shows a queued steer as a read-only submitted answer before it is admitted', () => { + const reviewPanel = vi.fn(() => true) + const revealPanel = vi.fn(() => true) + const batch = [ + { id: 'goal', selected: ['Develop a feature'] }, + { id: 'scope', selected: [], custom: 'the web app' }, + { id: 'notes', selected: [] }, + ] + render() + + expect(screen.getByText('2/3 已回答')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + fireEvent.click(screen.getByRole('button', { name: PILL.review })) + expect(screen.getByRole('button', { expanded: true })).toBeTruthy() + expect(screen.getByText('the web app')).toBeTruthy() + expect(reviewPanel).not.toHaveBeenCalled() + expect(revealPanel).not.toHaveBeenCalled() + }) + + it('returns to the answer action if the pending steer is removed', () => { + const block = resultNode(READABLE_ARGS, PENDING_RESULT) + const batch = [ + { id: 'goal', selected: ['Develop a feature'] }, + { id: 'scope', selected: [] }, + { id: 'notes', selected: [] }, + ] + const view = render() + expect(screen.getByRole('button', { name: PILL.review })).toBeTruthy() + + view.rerender() + expect(screen.getByRole('button', { name: PILL.reopen })).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + }) + + it('does not lock a question for an unrelated or malformed queued message', () => { + const bad = { source: { kind: 'user-question-reply', callId: 'c1' }, content: [ + { type: 'text', text: JSON.stringify({ kind: 'wrong', callId: 'c1', answers: [] }) }, + ] } + render() + expect(screen.getByRole('button', { name: PILL.reopen })).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + }) + + it('keyboard activation of the pill leaves the row disclosure closed', () => { + // The pill is a button inside the row's own button: without the keydown + // guard, one Enter would both reopen the panel and expand the record. + const revealPanel = vi.fn(() => true) + render() + fireEvent.keyDown(screen.getByRole('button', { name: PILL.reopen }), { key: 'Enter' }) + expect(screen.getByRole('button', { expanded: false })).toBeTruthy() + }) + + it('a reopen that finds no panel left expands the record instead of doing nothing', () => { + // The projection lists the call but no card answers for it — a resumed + // Session before its repair pass, or a composition with no question UI. + const revealPanel = vi.fn(() => false) + render() + + fireEvent.click(screen.getByRole('button', { name: PILL.reopen })) + expect(revealPanel).toHaveBeenCalledWith('c1') + expect(screen.getByRole('button', { expanded: true })).toBeTruthy() + expect(screen.getByText('What do you want to accomplish?')).toBeTruthy() + }) + + it('a pending result the projection dropped reads as closed, with no action on its row', () => { + // The recorded result stays `pending` after the reply, the skip, or the + // timeout lands; the projection is what says the question is over. + render() + + expect(screen.getByText('已结束')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(screen.getByText('该问题已结束,结果见下方对话')).toBeTruthy() + expect(screen.getByText('What do you want to accomplish?')).toBeTruthy() + expect(screen.queryByText(/"pending"/)).toBeNull() + }) + + it('reopens a crash-repaired question while the projection still lists it', () => { + const revealPanel = vi.fn(() => true) + const repaired = resultNode(READABLE_ARGS, 'The tool call was interrupted after it was recorded.', { + isError: true, error: { name: 'SessionFormatError', code: 'TOOL_OUTCOME_UNKNOWN' }, + }) + render() + + expect(screen.getByText('已继续工作,仍可回答')).toBeTruthy() + fireEvent.click(screen.getByRole('button', { name: PILL.reopen })) + expect(revealPanel).toHaveBeenCalledWith('c1') + }) + + it('shows a late answer after crash repair through the read-only panel', () => { + const reviewPanel = vi.fn(() => true) + const batch = [ + { id: 'goal', selected: ['Develop a feature'] }, + { id: 'scope', selected: [], custom: 'the web app' }, + { id: 'notes', selected: [] }, + ] + const repaired = resultNode(READABLE_ARGS, 'The tool call was interrupted after it was recorded.', { + isError: true, error: { name: 'SessionFormatError', code: 'TOOL_OUTCOME_UNKNOWN' }, + }) + render() + + expect(screen.getByText('2/3 已回答')).toBeTruthy() + fireEvent.click(screen.getByRole('button', { name: PILL.review })) + expect(reviewPanel).toHaveBeenCalledWith('c1', expect.objectContaining({ answers: batch })) + }) + + it('shows an unreadable late reply after crash repair as closed', () => { + const reviewPanel = vi.fn(() => true) + const repaired = resultNode(READABLE_ARGS, 'The tool call was interrupted after it was recorded.', { + isError: true, error: { name: 'SessionFormatError', code: 'TOOL_OUTCOME_UNKNOWN' }, + }) + render() + + expect(screen.getByText('已结束')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + expect(reviewPanel).not.toHaveBeenCalled() + }) + + it('a late reply makes its row read exactly like one answered in time', () => { + // The timed call's own result is the timeout, so the answers come from the + // projection; which one beat the clock is the agent's pacing, not the + // reader's problem. + const reviewPanel = vi.fn(() => true) + const answered = [ + { id: 'goal', selected: ['Develop a feature'] }, + { id: 'scope', selected: [], custom: 'the web app' }, + { id: 'notes', selected: [] }, + ] + render() + + expect(screen.getByText('2/3 已回答')).toBeTruthy() + expect(screen.queryByText('已结束')).toBeNull() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(screen.getByText('What do you want to accomplish?')).toBeTruthy() + expect(screen.getByText('the web app')).toBeTruthy() + expect(screen.getByText('未回答')).toBeTruthy() + expect(screen.queryByText(/"pending"/)).toBeNull() + + fireEvent.click(screen.getByRole('button', { name: PILL.review })) + expect(reviewPanel).toHaveBeenCalledWith('c1', { + questions: [ + { id: 'goal', question: 'What do you want to accomplish?' }, + { id: 'scope', question: 'Which project should this apply to?' }, + { id: 'notes', question: 'Anything else?' }, + ], + answers: answered, + }) + }) + + it('a reply that settled the call without answers leaves the row closed', () => { + render() + expect(screen.getByText('已结束')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + }) + + it('a still-answerable row keeps its reopen pill even after another call was settled', () => { + render() + expect(screen.getByRole('button', { name: PILL.reopen })).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + }) + + it('another session question being answered leaves this row alone', () => { + render() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + }) + it('settled result counts answered entries (selected choices or custom text)', () => { render( { expect(screen.getByText('3/3 已回答')).toBeTruthy() }) + it('shows a pending result as readable still-answerable questions', () => { + const view = render() + + expect(screen.getByText('已继续工作,仍可回答')).toBeTruthy() + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(screen.getByText('等待中的问题仍可在输入框中回答')).toBeTruthy() + expect(screen.getByText('What do you want to accomplish?')).toBeTruthy() + expect(view.container.querySelector('[class*="ioCard"]')).toBeNull() + expect(screen.queryByText(/"pending"/)).toBeNull() + }) + it('expands a successful result as paired questions and readable answer lines', () => { render( { expect(screen.queryByText(/"answers"/)).toBeNull() }) + it('a timed call the projection settled in time offers its record as a read-only panel, options included', () => { + const args = JSON.stringify({ questions: [{ + id: 'goal', + question: 'What do you want to accomplish?', + header: 'Goal', + detail: 'Pick the closest match.', + multi_select: false, + options: [{ label: 'Develop a feature', description: 'New behavior' }, { label: 'Fix a bug' }], + }] }) + const reviewPanel = vi.fn(() => true) + const batch = [{ id: 'goal', selected: ['Fix a bug'] }] + render() + + fireEvent.click(screen.getByRole('button', { name: PILL.review })) + expect(reviewPanel).toHaveBeenCalledWith('c1', { + questions: [{ + id: 'goal', + question: 'What do you want to accomplish?', + header: 'Goal', + detail: 'Pick the closest match.', + multiSelect: false, + options: [{ label: 'Develop a feature', description: 'New behavior' }, { label: 'Fix a bug' }], + }], + answers: batch, + }) + }) + + it('an answered legacy call reads exactly as before timed questions existed: transcript, no pill', () => { + // The projection never lists a call the blocking legacy tool made, so the + // row has nothing to reopen and no panel to read the answers back in. + const view = render() + + expect(screen.getByText('2/3 已回答')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + expect(view.container.querySelector('[class*="rowAction"]')).toBeNull() + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(screen.getByText('the web app')).toBeTruthy() + expect(screen.getByText('未回答')).toBeTruthy() + }) + + it('a settled call whose questions failed validation keeps only its transcript', () => { + const batch = [{ id: 'a', selected: ['x'] }] + render() + expect(screen.getByText('1/1 已回答')).toBeTruthy() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + }) + + it.each([ + { label: 'fewer answers than questions', batch: [{ id: 'goal', selected: ['x'] }] }, + { label: 'an answer to a question never asked', batch: [ + { id: 'goal', selected: ['x'] }, { id: 'scope', selected: [] }, { id: 'other', selected: ['y'] }, + ] }, + { label: 'the same question answered twice', batch: [ + { id: 'goal', selected: ['x'] }, { id: 'goal', selected: ['y'] }, { id: 'notes', selected: [] }, + ] }, + ])('a settled batch with $label offers no panel, like the transcript it cannot pair', ({ batch }) => { + const reviewPanel = vi.fn(() => true) + const view = render() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + fireEvent.click(screen.getByRole('button', { expanded: false })) + expect(view.container.querySelector('[class*="ioCard"]')).not.toBeNull() + expect(reviewPanel).not.toHaveBeenCalled() + }) + + it.each([ + { label: 'a cancelled set', code: 'ASK_CANCELLED' }, + { label: 'an aborted turn', code: 'ASK_ABORTED' }, + ])('$label has no answers to review', ({ code }) => { + render() + expect(screen.queryByRole('button', { name: PILL.review })).toBeNull() + expect(screen.queryByRole('button', { name: PILL.reopen })).toBeNull() + }) + it('keeps generic diagnostics when a valid answer result includes a non-text block', () => { const resultText = answers([ { id: 'goal', selected: ['Develop a feature'] }, @@ -238,13 +639,44 @@ describe('AskQuestionRow', () => { it('askQuestionToolview injects the toolview declaration directly', () => { expect(askQuestionToolview.name).toBe('ask-question-toolview') expect(askQuestionToolview.inject).toEqual(['slots']) - const register = vi.fn(() => () => undefined) + const register = vi.fn((_declaration: ToolviewDeclaration, _view: unknown) => () => undefined) const inject = vi.fn((_name: string, callback: () => () => void) => callback()) - askQuestionToolview.apply({ slots: { inject, register } } as never) + askQuestionToolview.apply({ slots: { inject, register }, get: () => undefined } as never) expect(inject).toHaveBeenCalledWith('tool.call.toolview', expect.any(Function)) expect(register).toHaveBeenCalledWith( - { name: 'tool.call.toolview', key: 'ask_user_question', locale: 'conversation' }, + { + name: 'tool.call.toolview', key: 'ask_user_question', locale: 'conversation', + inject: expect.any(Function) as ToolviewDeclaration['inject'], + }, AskQuestionRow, ) }) + + it('the injected reveal verb asks the optional panel provider for the row own session', () => { + const reveal = vi.fn(() => true) + const get = vi.fn((_name: string): PanelProvider => ({ + reveal: (_sessionId, callId) => reveal(_sessionId, callId), + review: () => false, + })) + expect(injectedFace(get).revealPanel('c1')).toBe(true) + expect(get).toHaveBeenCalledWith('userQuestionPanels') + expect(reveal).toHaveBeenCalledWith('s1', 'c1') + }) + + it('the injected review verb hands the row own record to the panel provider', () => { + const review = vi.fn(() => true) + const get = vi.fn((_name: string): PanelProvider => ({ + reveal: () => false, + review: (_sessionId, callId, value) => review(_sessionId, callId, value), + })) + const record = { questions: [], answers: [] } + expect(injectedFace(get).reviewPanel('c1', record)).toBe(true) + expect(get).toHaveBeenCalledWith('userQuestionPanels') + expect(review).toHaveBeenCalledWith('s1', 'c1', record) + }) + + it('a composition with no question UI reports no panel to reveal or review', () => { + expect(injectedFace(() => undefined).revealPanel('c1')).toBe(false) + expect(injectedFace(() => undefined).reviewPanel('c1', { questions: [], answers: [] })).toBe(false) + }) }) diff --git a/packages/client/ui-tool/tests/preparing-rows.client.spec.tsx b/packages/client/ui-tool/tests/preparing-rows.client.spec.tsx index 037a59a804..dd070b3aea 100644 --- a/packages/client/ui-tool/tests/preparing-rows.client.spec.tsx +++ b/packages/client/ui-tool/tests/preparing-rows.client.spec.tsx @@ -21,7 +21,7 @@ import { toolRowModel } from '../src/client/tool/models/tool-call-model.ts' afterEach(cleanup) -type Props = Parameters[0] & Parameters[0] +type Props = Parameters[0] & Parameters[0] & Parameters[0] function preparation(name: string): Props { return { @@ -29,6 +29,7 @@ function preparation(name: string): Props { block: { phase: 'preparing', callId: 'call', name, turn: 1, step: 1, time: 1, subCalls: [] }, t: makeTranslate(en, common), useDisclosure, useToolCallArgumentsPartial: vi.fn(() => ''), openFile: vi.fn(), loadImage: vi.fn(), useTodoHistory: vi.fn(), useSession: vi.fn(() => false), renderSlot: vi.fn(() => null), + useProjection: vi.fn(() => undefined), revealPanel: vi.fn(() => false), reviewPanel: vi.fn(() => false), } as Props } diff --git a/packages/client/ui-tool/tsconfig.json b/packages/client/ui-tool/tsconfig.json index 4e32e4f5b9..966cb32e1a 100644 --- a/packages/client/ui-tool/tsconfig.json +++ b/packages/client/ui-tool/tsconfig.json @@ -50,6 +50,9 @@ { "path": "../../core/tools" }, + { + "path": "../../interaction/user-questions" + }, { "path": "../../util/workspace-path" } diff --git a/packages/client/ui-user-questions/README.i18n.yaml b/packages/client/ui-user-questions/README.i18n.yaml index af7e0158f4..7cbe2978c6 100644 --- a/packages/client/ui-user-questions/README.i18n.yaml +++ b/packages/client/ui-user-questions/README.i18n.yaml @@ -3,41 +3,47 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/client/ui-user-questions/README.md /: - en: b50469addda9db2d - zh: ae560611295a5f4d + en: 50286bfa65e45456 + zh: 2347492bb65bd1b4 /deepseek-ai-dsh-client-ui-user-questions: en: f109e91b29d71f55 zh: 73200984bad7f908 /deepseek-ai-dsh-client-ui-user-questions/summary: - en: 7e81c6a53759ff37 - zh: b83f666c4ef4cbd3 + en: 1aa6291852d48a08 + zh: 414eed268fb2cf1f /deepseek-ai-dsh-client-ui-user-questions/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-user-questions/use-this-package: - en: 4aa048dcb7282f12 - zh: d2731da0870aa6a0 + en: 8d3815c19858ac85 + zh: 94fc905fa202d334 /deepseek-ai-dsh-client-ui-user-questions/use-this-package/answering: - en: 8b6f37bfb11a2c3a - zh: 59d8951211f9b21b + en: cc19c065d0aeac1e + zh: 91c8cbe08b438e7f +/deepseek-ai-dsh-client-ui-user-questions/use-this-package/reading-a-settled-question-back: + en: 10975f68ff9c6fcc + zh: 92246aadc363f0eb /deepseek-ai-dsh-client-ui-user-questions/use-this-package/the-plan-review-card: en: 6b12f1362c614a39 zh: 27d9cf54d4cbd5d2 /deepseek-ai-dsh-client-ui-user-questions/use-this-package/failure-and-recovery: - en: da530ef485c07417 - zh: b07525cfcd5034f0 + en: 3509678f4d183834 + zh: 625542b79e434eb5 /deepseek-ai-dsh-client-ui-user-questions/understand-the-implementation: en: 77e1b2585acdf67b zh: d433ec185c6b8f57 +/deepseek-ai-dsh-client-ui-user-questions/understand-the-implementation/reopening-a-panel: + en: 4350f2fbc41f6c86 + zh: a11ef5e97d0c936e /deepseek-ai-dsh-client-ui-user-questions/understand-the-implementation/intent-surface-election: - en: 7f3e0e2460317462 - zh: cb6b9410410e2f29 + en: 126a889edbc42edd + zh: 7e08968cd61d42a2 /deepseek-ai-dsh-client-ui-user-questions/understand-the-implementation/copy-and-locale: - en: 1a144dbf8bf39d43 - zh: 66bccf9c343395c7 + en: 00b3f92cdad70faf + zh: ab672ddc2faef857 /deepseek-ai-dsh-client-ui-user-questions/further-exploration: - en: 70e1ae005fa86e3c - zh: 9c779d63b3f921cc + en: dc98d242987579a3 + zh: a193b9f33a197089 /deepseek-ai-dsh-client-ui-user-questions/model-experience: en: 198421eb8ed8923f zh: 84f719be6e6dfe62 @@ -45,8 +51,8 @@ en: 1032ba29b7d7f9d7 zh: 01f1dbf4c2164fd2 /deepseek-ai-dsh-client-ui-user-questions/known-limitations-and-deferred-work: - en: beb6dc6d1496e799 - zh: d92150a88a797c21 + en: d61767a407077aaf + zh: 891e7bffa61f3017 /deepseek-ai-dsh-client-ui-user-questions/known-limitations-and-deferred-work/dev-note: - en: 7c763299daed17e4 - zh: fb410b366b407ec7 + en: 5dd8c89b228f4037 + zh: cf8d2774370d1b74 diff --git a/packages/client/ui-user-questions/README.md b/packages/client/ui-user-questions/README.md index 929494485b..c8c182444f 100644 --- a/packages/client/ui-user-questions/README.md +++ b/packages/client/ui-user-questions/README.md @@ -1,5 +1,5 @@ --- -description: "Web ask_user_question feature for the dsh web client: the composer-takeover question UI and the plan-review approval card." +description: "Web ask_user_question feature for the dsh web client: the attached question card, timed wait, drafts, late replies, and the plan-review approval card." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -When an agent asks a question in the Web client, this package replaces the chat composer with an interactive question surface. Users can move through questions, choose one or multiple options, enter custom answers, skip items, and submit one structured answer batch. Single-choice selections advance immediately, while drafts survive Session navigation for the lifetime of the page. A single question with a supported presentation intent can use a dedicated surface, including the plan-review card with `Request changes` and `Approve` actions. +The Web client shows an agent's question beside the chat input. Users choose options, enter text, skip questions, and submit one answer batch. A timed card counts down; focus pauses it, editing or `Take time` holds it, and expiry lets the agent continue while the question stays answerable. Closing a card linked to a tool call hides it; its tool row reopens it and later shows recorded answers. The Host preserves the question across restart, while this browser preserves unfinished input across reload. ## Table of Contents @@ -25,11 +25,17 @@ When an agent asks a question in the Web client, this package replaces the chat ## Use this package -When the agent asks a question, the composer becomes the question surface: answer each question, navigate with the pager, or skip it. Single-select choices advance immediately; Enter continues the flow and submits once every question is answered or skipped, while Shift+Enter breaks a line instead (during IME composition Enter only confirms the input candidate without advancing). +When the agent asks a question, the attached card temporarily occupies the composer seat: answer each question, navigate with the pager, or skip it. A first choice marked “Recommended” starts selected, but remains an unsubmitted draft and does not pause a timed countdown. Clicking a single-select choice advances immediately. Enter on a focused option attempts to submit the batch without selecting that option; missing answers return to the first incomplete question. Enter in a text answer continues the flow, while Shift+Enter breaks a line instead (during IME composition Enter only confirms the input candidate without advancing). ### Answering -A multi-select draft keeps its selected labels while the user opens or edits the custom answer, so its submitted item may carry both `selected` and `custom`; a single-select custom answer remains exclusive. Question detail reuses the assistant-output `MarkdownText` primitive, including its GFM rendering and untrusted-content policy. The capped card keeps its title, navigation, and submission actions fixed while long detail and choices share an internal scroll region. "Skip" retains other drafts and emits the existing blank `{ selected: [] }` result for that item, while close rejects the whole wait as `ASK_CANCELLED`. +A multi-select draft keeps its selected labels while the user opens or edits the custom answer, so its submitted item may carry both `selected` and `custom`; a single-select custom answer remains exclusive. Question detail reuses the assistant-output `MarkdownText` primitive, including its GFM rendering and untrusted-content policy. The capped card keeps its title, navigation, and submission actions fixed while long detail and choices share an internal scroll region. "Skip" retains other drafts and emits the existing blank `{ selected: [] }` result for that item. Close is not an answer: a question the Host named by tool call only leaves the composer seat, and its `ask_user_question` tool call row brings the panel back; a request that carries no tool call has no row to return from, so closing it rejects the whole wait as `ASK_CANCELLED`. + +### Reading a settled question back + +Each late reply is shown once, including when it opens a new Turn. Replies follow normal Chat process grouping and whole-Turn folding. Expand the containing Turn and work group to read a reply that has been folded away. + +A question that already settled opens as a read-only card: the same pager over the recorded answers, marked `Answered`. Every option and text field is disabled, Skip and the submit action are gone, a question the user skipped says so in place of its empty answer, and a free-text field appears only where the recorded answer used one. Closing it removes the card, and the tool call row builds another from the same record. ### The plan-review card @@ -37,7 +43,19 @@ A `plan-review` intent — set by `dsh-plan-mode` on the `exit_plan_mode` review ### Failure and recovery -The generic question flow keeps its current page, selected labels, custom text, and explicit skips in a non-persisted Slot store scoped to the owning Session generation and keyed by the pending request's local render identity. Switching from Session A to B retires A when no other reference owns it, so returning to A starts an empty question draft; another reference that keeps A's generation alive also keeps that draft. A different request identity reads an empty draft and replaces the previous value on its first edit; a successful answer or cancellation clears the matching value. The host remains authoritative for whether the request is pending. +An answer field autofocuses only when its answer channel is ready and no countdown exists. Manual focus and blur during the claim handshake are retained: the countdown starts paused only if the answer surface still has focus when the remaining duration arrives. + +Returning a local answer does not release its foreground claim: the Host closes that stream after accepting the waterfall outcome. The plugin owns the claim through this delivery interval. Explicit delegation releases it before calling the next answerer, and plugin disposal cancels any remaining claims. + +The card has two sources. A live Host request creates it and carries the answer back. For a timed request, the Client first opens the question-owned `attachWait` stream and derives a local deadline from its remaining-duration frame. The card remains live while that first frame is pending. The claim lasts until the request settles or the Client disconnects, including while the panel is hidden. The card owns the countdown; at zero it rejects with `ASK_TIMED_OUT` and stays available. Once the projection lists the call as continued, answers use the `answer` Remote method. Card removal follows the projection, and plugin teardown releases its requests and claims. + +A submission through the pending request is sent, not confirmed: when another browser settled the same request first, the gateway drops the late outcome silently. The card therefore keeps its draft until the projection closes it, and if the call turns continued while a submission is in flight, the controls re-arm with a hint so the same draft goes through the Remote path. An accepted Remote answer steers the agent at its nearest step. While its steer waits in the durable Inbox, the editable card closes and the question row shows the submitted answers read-only, including after a browser reconnect. Multiple pending steers are admitted together at that boundary; an active tool wait must finish before the agent can read them. Discarding a pending steer leaves the question answerable, and the user can reopen its row to submit again. A second answer while the first remains pending reports `REPLY_QUEUED`. Pristine focus freezes this browser's remaining countdown and blur resumes that remainder. The first answer mutation changes the local wait to indefinite, and `Take time` does the same explicitly. Those choices persist with this browser's draft across Session navigation and, for tool-call-keyed requests, reload. Another browser has its own countdown and can still settle the shared request; the Host projection remains the authority for whether the question is open or continued. + +Each Session and pending request has an independent draft in browser storage. A tool-call-keyed request restores unfinished input after Session navigation, page reload, or browser restart; progress that no longer matches the question batch is ignored. An unnamed legacy request has a unique card key and cannot be restored after reload. A hidden panel keeps its draft for the next opening; a mounted closed card clears its own draft, and the next mounted card prunes drafts no live card owns. Drafts do not synchronize to another browser or device; the Host-projected question does. + +A browser that reconnects while the tool call is open receives the pending request again and can still complete it with the remaining time. A Session reopened after the agent or process ended shows the card as continued; submitting resumes the Session's root agent and enters the answer as a new user turn. + +Settled question replies remain compact in chat history. A caret marks the bubble as a disclosure; clicking it reopens the read-only question and answer details, and never reopens the settled tool call for a second submission. Its copy action writes each question with the answer the user gave, the same text whether the bubble is open or closed. ----- @@ -49,16 +67,20 @@ The generic question flow keeps its current page, selected labels, custom text, The package is one ownership rule: rendering a question is a host UI capability, having the tool is an agent capability, so the `tool-ask-user` row belongs to the presets that want it (and to the TUI composition, which has no presets). +### Reopening a panel + +This package fills `userQuestionPanels`, the optional capability `dsh-client-ui-tool` declares for its `ask_user_question` row. `reveal(sessionId, callId)` republishes that call's card as the last equal-precedence pending interaction, so the composer seat shows it again, and returns `false` when this Client holds no card for the call — a legacy unkeyed request, another browser's question, or a card the projection already closed. Whether a question still takes an answer comes from the `userQuestions` Session projection, which the row reads directly, so the capability carries no state of its own. + +`review(sessionId, callId, record)` builds a card from the questions and answers the row parsed out of its own transcript, because the projection lists only answerable calls. That card has no answer channel and no countdown, the projection sweep leaves it alone, and closing it removes it rather than parking it in the registry. A call that still holds a live card shows the live one, so a stale copy never replaces a standing request; for the same reason a review card renders the record itself and takes only the page position from a draft its live card left behind. + ### Intent surface election -The card accepts one question declaring the intent, carrying the plan as `detail`, and offering the named approve label, with at most one alternative and no multi-select. Its secondary action returns to the composer for change requests. Larger choices and multi-select questions remain in the generic flow. +The card accepts one question declaring the intent, carrying the plan as `detail`, and offering the named approve label, with at most one alternative and no multi-select. Its secondary action returns to the composer for change requests. Larger choices and multi-select questions remain in the generic flow. A plan review exposes `conversation.plan-review.actions` with its request key, full text, and optional invocation identity; the plan plugin opens logged plans from history and unlogged reviews as temporary sidebar previews, and opening a document does not answer or dismiss the review. ### Copy and locale Composer chrome copy (pager, buttons, placeholders, validation feedback) is bilingual: the plugin registers zh/en dictionaries under the `question` namespace of `dsh-client-locale` and hands the entry its bound translator plus the locale snapshot source through the inject face, so a locale switch re-renders a mounted composer. Question and option text arrives from the model and renders verbatim; carrier failure messages also display untranslated. -A plan review exposes `conversation.plan-review.actions` with its request key, full text, and optional invocation identity. The plan plugin opens logged plans from history and unlogged reviews as temporary sidebar previews. Opening a document does not answer or dismiss the review. - ----- @@ -68,7 +90,8 @@ A plan review exposes `conversation.plan-review.actions` with its request key, f These pages cover the composer host, the tool seam, and the plan-mode consumer. -- [ui-conversation](../ui-conversation/README.md) — the chat surface owning the `conversation.composer` chain. +- [ui-conversation](../ui-conversation/README.md) — the chat surface owning the `conversation.composer` slot. +- [ui-tool](../ui-tool/README.md) — the tool call transcript whose `ask_user_question` row reopens a hidden panel. - [tool-ask-user](../../interaction/tool-ask-user/README.md) — the model-facing tool whose schema and answers this UI renders. - [ui-plan](../ui-plan/README.md) — the plan-mode surface that sets the `plan-review` intent. - [user-questions](../../interaction/user-questions/README.md) — the Host-side question seam and its answerer waterfall. @@ -89,10 +112,11 @@ No direct invalidation; `dsh-tool-ask-user` owns the model-visible tool call and -These limits define draft durability and composer ownership; they are current package constraints. +These limits define question-card ownership and cross-client behavior; they are current package constraints. -- **Unsubmitted drafts have page-and-Session lifetime** — Session navigation preserves them while that Session scope remains in the page, but a full page reload, Session pruning, or a newly delivered pending-request identity starts with an empty draft. The store never writes them to the Host, `localStorage`, or disk. -- **One request owns the composer at a time** — later pending requests remain in the session snapshot and become visible after the earlier request resolves. +- **Unsubmitted drafts are local to one browser** — Session navigation, page reload, and browser restart preserve them, but another browser or device reconstructs only the Host-stored question. +- **One request owns the question card at a time** — later pending requests remain in the session snapshot and become visible after the earlier request resolves. +- **Questions appear in the active Session composer** — durable pending questions do not add a separate sidebar inbox; reopen the owning Session to answer one. ### Dev Note @@ -104,4 +128,4 @@ None. -**Runtime invariant:** No companion is published. Tool and slot registrations are effects owned and observed by their respective registries; the host pending table is exercised through the public wire protocol. +**Runtime invariant:** The Host Session projection is authoritative for durable timed questions. Browser storage only preserves unfinished input and never creates or keeps a question open. No runtime invariant companion is published because the Host validates and projects the durable state before this client package renders it. diff --git a/packages/client/ui-user-questions/README.zh.md b/packages/client/ui-user-questions/README.zh.md index 0269998b74..03ed5fc906 100644 --- a/packages/client/ui-user-questions/README.zh.md +++ b/packages/client/ui-user-questions/README.zh.md @@ -1,5 +1,5 @@ --- -description: "dsh Web 客户端的 ask_user_question 功能:接管编辑器的提问 UI 与 plan-review 审批卡片。" +description: "dsh Web 客户端的 ask_user_question 功能:附着式提问卡片、计时等待、草稿、迟到回复与 plan-review 审批卡片。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -当 agent(智能体)在 Web 客户端中提问时,本包会用交互式提问界面接管聊天编辑器。用户可以在问题之间导航、选择一个或多个选项、输入自定义答案、跳过问题,并提交一批结构化答案。选择单选项后会立即前进,而草稿会在当前页面的生命周期内跨会话导航保留。若唯一的问题声明了受支持的呈现意图,则可使用专用界面,包括带 `Request changes` 和 `Approve` 操作的 plan-review 卡片。 +Web 客户端在聊天输入框旁显示 agent(智能体)的提问。用户可以选择选项、输入文本、跳过问题,并提交一批答案。计时卡片会倒计时;聚焦时暂停,编辑或选择「慢慢回答」后保持等待,到期则放行 agent,而问题仍可回答。关闭关联工具调用的卡片只是隐藏面板;工具调用行可以重新打开它,之后也能展示已记录的回答。Host 重启后仍保留问题;此浏览器重新加载后仍保留未提交的输入。 ## 目录 @@ -25,11 +25,17 @@ kind: "package-reference" ## 使用本包 -当 agent 提问时,编辑器变成提问界面:回答每个问题、用翻页器导航,或跳过它。选择单选选项后会立即前进;Enter 继续流程,并在所有问题均已回答或跳过后提交,而 Shift+Enter 改为换行(IME 组合输入期间按 Enter 只会确认输入候选,不会前进)。 +当 agent 提问时,附着式卡片会暂时占用编辑器位置:回答每个问题、用翻页器导航,或跳过它。首个带推荐标记的选项会预先选中,但仍只是未提交的草稿,不会暂停计时倒计时。点击单选选项会立即前进。聚焦选项时按 Enter 会尝试提交整组答案,不会选中该选项;若有缺失答案,则回到第一道未完成的问题。文本答案中的 Enter 会继续流程,Shift+Enter 则换行(IME 组合输入期间按 Enter 只会确认输入候选,不会前进)。 ### 作答 -用户打开或编辑自定义答案时,多选题草稿会保留已选中的标签,因此提交项可以同时携带 `selected` 与 `custom`;单选题的自定义答案仍保持互斥。问题详情复用助手输出的 `MarkdownText` 原语,包括其 GFM 渲染与不受信任内容策略。限高卡片保持标题、导航与提交动作固定,超长的详情与选项共享内部滚动区。「跳过」会保留其他草稿,并为该项发出既有的空 `{ selected: [] }` 结果;关闭则以 `ASK_CANCELLED` 拒绝整个等待。 +用户打开或编辑自定义答案时,多选题草稿会保留已选中的标签,因此提交项可以同时携带 `selected` 与 `custom`;单选题的自定义答案仍保持互斥。问题详情复用助手输出的 `MarkdownText` 原语,包括其 GFM 渲染与不受信任内容策略。限高卡片保持标题、导航与提交动作固定,超长的详情与选项共享内部滚动区。「跳过」会保留其他草稿,并为该项发出既有的空 `{ selected: [] }` 结果。关闭不是一种回答:Host 以工具调用命名的问题只是离开编辑器位置,其 `ask_user_question` 工具调用行会把面板带回来;不携带工具调用的请求没有可返回的行,关闭它仍以 `ASK_CANCELLED` 拒绝整个等待。 + +### 回看已结束的问题 + +每条迟到回复只显示一次,包括由它开启新轮次的情况。回复遵循 Chat 原有的过程分组与整轮折叠规则。回复被收起时,展开所属轮次和工作分组即可查看。 + +已经结束的问题以只读卡片打开:同一个翻页器走过已记录的回答,并标注「已回答」。所有选项与文本框都被禁用,跳过与提交动作消失,用户当时跳过的问题会在空回答处说明这一点,自由文本框只出现在当时确实用过它的回答上。关闭它会移除该卡片,工具调用行会用同一份记录再建一个。 ### plan-review 卡片 @@ -37,7 +43,19 @@ kind: "package-reference" ### 失败与恢复 -通用提问流程把当前题号、已选标签、自定义文本和显式跳过状态保存在非持久化 slot 存储中;该存储归属对应 Session generation,并以待处理请求的本地渲染标识为键。从 Session A 切换到 B 时,如果没有其他引用持有 A,A 就会结束,因此返回 A 时会得到空的问题草稿;如果另一个引用继续持有 A 的 generation,该草稿也会保留。不同的请求标识读取空草稿,并在首次编辑时替换旧值;成功回答或取消会清除相符的值。请求是否仍在等待由主机保持权威。 +回答输入框只有在回答通道就绪且没有倒计时时才自动聚焦。接手握手期间的手动聚焦与失焦会被保留:剩余时长到达时,只有回答区域仍持有焦点,倒计时才以暂停状态开始。 + +本地返回回答不会释放前台接手记录:Host 接受 waterfall 结果后才关闭该 stream。插件在这段传输期间继续拥有接手记录。显式委托会在调用下一个回答方前释放它,插件卸载则取消剩余接手记录。 + +卡片有两个来源。Host 的存活请求创建它,回答也经该请求返回。计时请求先由 Client 打开问答业务的 `attachWait` stream,再从剩余时长帧推导本地时钟上的 deadline。等待首帧期间卡片仍保持存活。接手记录持续到请求结算或 Client 断开,收起面板不会释放它。倒计时归卡片所有;到零时以 `ASK_TIMED_OUT` reject,卡片仍可用。投影把调用列为已继续后,回答改用 `answer` Remote 方法。卡片移除遵循投影,插件卸载时释放请求与接手记录。 + +经挂起请求的提交只算发出,不算确认:另一个浏览器先结算了同一请求时,gateway 会静默丢弃迟到的结果。因此卡片保留草稿直到投影关闭它;若提交在途时该调用变为已继续,控件带提示重新可用,同一份草稿改走 Remote 路径。Remote 接受回答后将回复作为 steer 交给 Agent 的最近一步。steer 在持久 Inbox 中等待期间,可编辑卡片会关闭,问题行会以只读方式显示已提交的答案;浏览器重新连接后也是如此。多个待处理的 steer 会在该步边界一起获准;当前工具等待必须先结束,Agent 才能读取它们。丢弃待处理的 steer 后问题仍可回答,用户可以重新打开问题行提交。第一条回复仍在等待准入时再次提交会收到 `REPLY_QUEUED`。未编辑时聚焦会冻结本浏览器的剩余倒计时,失焦后按该余量恢复。首次修改回答会把本地等待改为无限,「慢慢回答」也会显式执行同样操作。这些选择会随本浏览器草稿跨会话导航保留;对于带工具调用 ID 的请求,重新加载后也会保留。另一浏览器拥有自己的倒计时,仍可结算共享请求;Host projection 继续作为问题处于开放或已继续状态的权威来源。 + +每个会话和待处理请求在浏览器存储中都有独立草稿。带工具调用 ID 的请求在切换会话、重新加载页面或重启同一个浏览器后会恢复未完成输入;与当前问题批次不符的进度会被忽略。没有 ID 的 legacy 请求使用唯一卡片键,重新加载后不能恢复。隐藏的面板会保留草稿供下次打开;已关闭但仍挂载的卡片会清掉自己的草稿,下一张挂载的卡片会修剪没有存活卡片拥有的草稿。草稿不会同步到另一个浏览器或设备,Host 投影的问题会。 + +工具调用开放期间重新连接的浏览器会再次收到挂起请求,仍可用剩余时间完成它。在 agent 或进程结束后重新打开的会话把卡片显示为已继续;提交时先恢复会话的根 agent,再把回答作为新的用户轮次送入。 + +已结算的问题回复在聊天历史中保持紧凑。气泡以三角标记指示可以展开;点击它会展开只读的问题与回答详情,且不会重新打开已经结算的工具调用,也不会产生第二次提交。它的复制动作写出每个问题与用户当时给出的回答,无论气泡展开还是收起都是同一份文本。 ----- @@ -49,16 +67,20 @@ kind: "package-reference" 本包是一条归属规则:渲染提问是宿主的 UI 能力,拥有该工具则是 agent 的能力,因此 `tool-ask-user` 行属于需要它的各个 preset(以及没有 preset 的 TUI 组装)。 +### 重新打开面板 + +本包填充 `userQuestionPanels`——`dsh-client-ui-tool` 为其 `ask_user_question` 行声明的可选能力。`reveal(sessionId, callId)` 把该调用的卡片重新发布为同优先级中最后一个待处理交互,编辑器位置于是再次显示它;当本客户端没有该调用的卡片时返回 `false`——例如旧版未命名的请求、另一个浏览器的问题,或投影已关闭的卡片。问题是否仍可回答取自 `userQuestions` 会话投影,由该行直接读取,因此这项能力自身不携带状态。 + +投影只列出仍可回答的调用,因此 `review(sessionId, callId, record)` 用该行从自己转录中解析出的问题与回答建卡。这张卡片没有回答通道也没有倒计时,投影清扫不会碰它,关闭它是移除而非留在注册表里。仍持有实时卡片的调用显示实时那张,过期副本不会替换正在进行的请求;同理,只读卡片渲染记录本身,只从实时卡片留下的草稿里取页码。 + ### 意图界面选择 -卡片接管声明了意图、以 `detail` 携带计划、提供了被指名的批准标签的单个问题,要求除批准外最多一个选项,且非多选。次要操作返回编辑器供用户提出修改要求。更多选项或多选问题仍由通用流程处理。 +卡片接管声明了意图、以 `detail` 携带计划、提供了被指名的批准标签的单个问题,要求除批准外最多一个选项,且非多选。次要操作返回编辑器供用户提出修改要求。更多选项或多选问题仍由通用流程处理。计划审批通过 `conversation.plan-review.actions` 插槽提供请求键、完整正文和可选的调用标识;计划插件从历史中打开已记录计划,并把没有调用标识的审批作为临时侧边栏预览打开,打开文档不会回答或关闭审批。 ### 文案与 locale 编辑器外框文案(翻页器、按钮、占位符、校验提示)是双语的:插件在 `dsh-client-locale` 的 `question` 命名空间下注册 zh/en 词典,并通过 inject face 把绑定的翻译函数和 locale 快照源交给该条目,因此切换语言会重新渲染已挂载的编辑器。问题与选项文本来自模型并原样渲染;载体失败消息也不经翻译直接显示。 -计划审批通过 `conversation.plan-review.actions` 插槽提供请求键、完整正文和可选的调用标识。计划插件从历史中打开已记录计划,并把没有调用标识的审批作为临时侧边栏预览打开。打开文档不会回答或关闭审批。 - ----- @@ -68,7 +90,8 @@ kind: "package-reference" 以下页面覆盖编辑器宿主、工具 seam 与 plan-mode 消费方。 -- [ui-conversation](../ui-conversation/README.zh.md)——拥有 `conversation.composer` 链的聊天界面。 +- [ui-conversation](../ui-conversation/README.zh.md)——拥有 `conversation.composer` slot 的聊天界面。 +- [ui-tool](../ui-tool/README.zh.md)——工具调用记录界面,其 `ask_user_question` 行可重新打开被收起的面板。 - [tool-ask-user](../../interaction/tool-ask-user/README.zh.md)——面向模型的工具;本 UI 会渲染其 schema 与答案。 - [ui-plan](../ui-plan/README.zh.md)——设置 `plan-review` 意图的 plan-mode 界面。 - [user-questions](../../interaction/user-questions/README.zh.md)——Host 侧提问 seam 及其应答方 waterfall(瀑布式事件)。 @@ -89,10 +112,11 @@ kind: "package-reference" -这些限制定义草稿持久性与编辑器归属;它们是当前包约束。 +这些限制定义提问卡片归属与跨客户端行为;它们是当前包约束。 -- **未提交草稿的生命周期限于当前页面与会话**:只要该会话作用域仍留在页面内,会话导航就会保留草稿;完整刷新页面、会话被裁剪,或待处理请求以新的本地标识重新交付时,则从空草稿开始。存储从不把草稿写入主机、`localStorage` 或磁盘。 -- **每次只有一个请求拥有编辑器**:后续待处理请求仍留在会话快照中,并在较早请求落定后显示。 +- **未提交草稿仅保存在一个浏览器中**:切换会话、重新加载页面和重启浏览器后都会保留,但另一个浏览器或设备只会重建 Host 保存的问题。 +- **每次只有一个请求拥有提问卡片**:后续待处理请求仍留在会话快照中,并在较早请求落定后显示。 +- **问题显示在当前会话的编辑器中**:持久待处理问题不会新增独立的侧栏收件箱;请重新打开所属会话进行回答。 ### 开发备注 @@ -104,4 +128,4 @@ kind: "package-reference" -**运行时不变式:** 不发布伴生入口。工具与 slot 注册都是由各自注册表持有和观察的 effect;Host 待处理表通过公开的 wire protocol 测试。 +**运行时不变式:** Host 会话投影是持久计时问题的权威来源。浏览器存储只保留未完成输入,绝不会创建问题或让问题继续保持打开。此包不发布运行时不变量 companion,因为 Host 会先校验并投影持久状态,客户端随后才渲染它。 diff --git a/packages/client/ui-user-questions/package.json b/packages/client/ui-user-questions/package.json index a04ddc8bb8..8b2cb18e90 100644 --- a/packages/client/ui-user-questions/package.json +++ b/packages/client/ui-user-questions/package.json @@ -33,7 +33,8 @@ "@deepseek-ai/dsh-client-locale", "@deepseek-ai/dsh-client-ui-conversation", "@deepseek-ai/dsh-client-ui-renderer", - "@deepseek-ai/dsh-client-ui-session" + "@deepseek-ai/dsh-client-ui-session", + "@deepseek-ai/dsh-client-ui-chat" ], "platform": "web" } @@ -51,6 +52,7 @@ "@deepseek-ai/dsh-agent": "workspace:*", "@deepseek-ai/dsh-api-remotes": "workspace:*", "@deepseek-ai/dsh-api-session-controller": "workspace:*", + "@deepseek-ai/dsh-brand": "workspace:*", "@deepseek-ai/dsh-client-locale": "workspace:*", "@deepseek-ai/dsh-client-store": "workspace:*", "@deepseek-ai/dsh-system-prompt": "workspace:*", @@ -67,7 +69,9 @@ "@deepseek-ai/dsh-client-connection": "workspace:*", "@deepseek-ai/dsh-session": "workspace:*", "clsx": "^2.0.0", - "@deepseek-ai/dsh-llm": "workspace:*" + "@deepseek-ai/dsh-llm": "workspace:*", + "@deepseek-ai/dsh-client-ui-chat": "workspace:*", + "@deepseek-ai/dsh-client-ui-tool": "workspace:*" }, "files": [ "lib/index.js", diff --git a/packages/client/ui-user-questions/src/client/PlanReviewPanel.tsx b/packages/client/ui-user-questions/src/client/PlanReviewPanel.tsx index b0f6946f96..b63a64c0e0 100644 --- a/packages/client/ui-user-questions/src/client/PlanReviewPanel.tsx +++ b/packages/client/ui-user-questions/src/client/PlanReviewPanel.tsx @@ -27,20 +27,26 @@ function tooltip(description: string | undefined): { title?: string } { * @returns The plan-review takeover for this request. */ export function PlanReviewPanel({ pending, review, t, renderSlot }: PlanReviewPanelProps) { - // The panel waits for the host's resolved frame before leaving, so repeated - // clicks must not resubmit. A failed send re-enables it and shows the error. + // Foreground decisions wait for the resolved frame; accepted Remote decisions + // hide the panel. A failed send re-enables the buttons and shows the error. const [busy, setBusy] = useState(false) const [error, setError] = useState(null) - const settle = (send: () => Promise): void => { + const settle = (send: () => Promise, remote = false): void => { setBusy(true) setError(null) - void send().catch((cause: unknown) => { - setBusy(false) - setError(cause instanceof Error ? cause.message : String(cause)) - }) + void send() + .then(() => { + if (!remote) return + setBusy(false) + void pending.dismiss().catch(() => { setError(t('status.sent')) }) + }) + .catch((cause: unknown) => { + setBusy(false) + setError(cause instanceof Error ? cause.message : String(cause)) + }) } const decide = (label: string): void => { - settle(() => pending.answer({ answers: [{ id: review.id, selected: [label] }] })) + settle(() => pending.answer({ answers: [{ id: review.id, selected: [label] }] }), pending.snapshot().channel === 'rpc') } const summary = useMemo(() => { const title = extractMarkdownPlainText(review.plan, { mode: 'first-line' }) @@ -67,7 +73,7 @@ export function PlanReviewPanel({ pending, review, t, renderSlot }: PlanReviewPa
diff --git a/packages/client/ui-user-questions/src/client/QuestionComposer.module.css b/packages/client/ui-user-questions/src/client/QuestionComposer.module.css index f2fe1755f1..5f2eb4701b 100644 --- a/packages/client/ui-user-questions/src/client/QuestionComposer.module.css +++ b/packages/client/ui-user-questions/src/client/QuestionComposer.module.css @@ -62,6 +62,17 @@ flex-shrink: 0; } +.waitButton { + white-space: nowrap; +} + +.waitStatus { + color: var(--dsw-alias-label-secondary); + font-size: 12px; + line-height: 24px; + white-space: nowrap; +} + /* Figma 1019:36938 header, user-tuned: heading block left, close right; the pager sits in the footer to balance the card. */ .header { @@ -293,6 +304,16 @@ font-weight: 400; } +/* Read-only note standing in for a question the user skipped: it takes the + option rows' horizontal padding so it lines up with the choices above it. */ +.reviewNote { + margin: 0; + padding: 8px 12px; + color: var(--dsw-alias-label-tertiary); + font-size: 14px; + line-height: 24px; +} + /* Custom answer row (figma 973:36427): an option-shaped row whose copy is an inline text input; focus or a typed draft lifts it to the selected look. */ .customRow { diff --git a/packages/client/ui-user-questions/src/client/QuestionComposer.tsx b/packages/client/ui-user-questions/src/client/QuestionComposer.tsx index 4068deb520..33bbcbec0a 100644 --- a/packages/client/ui-user-questions/src/client/QuestionComposer.tsx +++ b/packages/client/ui-user-questions/src/client/QuestionComposer.tsx @@ -1,14 +1,14 @@ -import { useMemo, useRef, useState, type ChangeEvent, type KeyboardEvent } from 'react' +import { + useEffect, useMemo, useRef, useState, + type ChangeEvent, type FocusEvent, type KeyboardEvent, +} from 'react' import clsx from 'clsx' import { Button, IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconChevronLeftOutlineRegular, IconChevronRightOutlineRegular, IconChevronUpOutlineRegular, IconCloseOutlineRegular, IconEditOutlineRegular, MarkdownText, } from '@deepseek-ai/dsh-client-ui-primitives' -import { - planReviewOf, - type QuestionAnswer, type QuestionComposerProps, -} from './contract/slots.ts' +import { planReviewOf, type QuestionAnswer, type QuestionCardSnapshot, type QuestionComposerProps } from './contract/slots.ts' import type { PendingQuestion } from './contract/slots.ts' import type { QuestionDraftAnswer, QuestionDraftProgress } from './draft-store.ts' import { PlanReviewPanel } from './PlanReviewPanel.tsx' @@ -20,7 +20,12 @@ import css from './QuestionComposer.module.css' * runtime failure messages (finished strings from the wire) pass through * verbatim. */ -type Feedback = { key: 'error.incomplete' | 'error.unanswered' } | { text: string } +type Feedback = { key: 'error.incomplete' | 'error.unanswered' | 'error.unavailable' | 'error.resubmit' | 'status.sent' } | { text: string } + +/** A removed card can remain mounted until the composer seat updates. */ +const REMOVED_CARD: QuestionCardSnapshot = { + state: 'open', waitState: 'counting', countdown: undefined, channel: 'none', closed: true, +} /** * Split the conventional recommendation suffix without changing the answer value. @@ -34,6 +39,28 @@ export function parseRecommendedLabel(label: string): { label: string; recommend : { label, recommended: false } } +/** Only a marked first choice is an implicit draft; the user still submits it. */ +function recommendedFirstOption(question: PendingQuestion['questions'][number]): string | undefined { + const label = question.options?.[0]?.label + return label !== undefined && parseRecommendedLabel(label).recommended ? label : undefined +} + +/** Accept persisted progress only when it still describes this question batch. */ +function isQuestionDraftProgress(value: unknown, questionCount: number): value is QuestionDraftProgress { + if (typeof value !== 'object' || value === null || Array.isArray(value)) return false + const progress = value as Record + if (typeof progress.index !== 'number' || !Number.isInteger(progress.index) + || progress.index < 0 || progress.index >= questionCount + || !Array.isArray(progress.drafts) || progress.drafts.length !== questionCount + || (progress.wait !== undefined && progress.wait !== 'editing' && progress.wait !== 'waiting')) return false + return progress.drafts.every((item: unknown) => { + if (typeof item !== 'object' || item === null || Array.isArray(item)) return false + const draft = item as Record + return Array.isArray(draft.selected) && draft.selected.every((label: unknown) => typeof label === 'string') + && typeof draft.custom === 'string' && typeof draft.skipped === 'boolean' + }) +} + /** Return whether a text-field key event belongs to an active IME composition. */ function isComposing(event: KeyboardEvent): boolean { // keyCode 229 is the legacy IME-composition signal engines emit without isComposing. @@ -119,6 +146,7 @@ export function QuestionComposer(props: QuestionComposerProps) { pending={question} t={props.t} useStore={props.useStore} + useQuestionCard={props.useQuestionCard} actions={props.actions} /> ) @@ -126,26 +154,79 @@ export function QuestionComposer(props: QuestionComposerProps) { } type QuestionFlowProps = - { pending: PendingQuestion } & Pick + { pending: PendingQuestion } & Pick -function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { +function QuestionFlow({ pending, t, useStore, useQuestionCard, actions }: QuestionFlowProps) { const questions = pending.questions + // A read-only card built from a settled call's transcript: the same panel + // over the recorded answers, with nothing left to submit. + const review = pending.review const markdownLabels = useMemo(() => ({ code: { copyLabel: t('copy'), copiedLabel: t('copied'), toolbarLabels: { codeLabel: t('codeBlock.title'), wrapLabel: t('codeBlock.wrap'), unwrapLabel: t('codeBlock.unwrap') } }, footnotes: t('markdown.footnotes'), }), [t]) - const initialProgress = useMemo(() => ({ - index: 0, - drafts: questions.map(() => ({ selected: [], custom: '', skipped: false })), - }), [questions]) - const storedProgress = useStore(state => ( - state.requestKey === pending.key && state.progress.drafts.length === questions.length - ? state.progress - : undefined - )) - const { index, drafts } = storedProgress ?? initialProgress + const initialDrafts = useMemo(() => { + // Recorded answers echo the question ids rather than their order. + const recorded = new Map((review ?? []).map(answer => [answer.id, answer])) + return questions.map((item) => { + const answer = recorded.get(item.id) + const custom = answer?.custom ?? '' + const recommended = review === undefined ? recommendedFirstOption(item) : undefined + return { + selected: answer === undefined && recommended !== undefined ? [recommended] : [...answer?.selected ?? []], + custom, + // A recorded answer with no selection and no custom text was skipped. + skipped: answer !== undefined && answer.selected.length === 0 && custom === '', + } + }) + }, [questions, review]) + const stored = useStore(state => state.progressByRequest[pending.key]) + const validStored = isQuestionDraftProgress(stored, questions.length) ? stored : undefined + // A review card renders the record itself, so a draft its live card left + // behind can never surface as an answer; only the page position is restored. + const storedProgress = review === undefined ? validStored : undefined + const index = validStored?.index ?? 0 + const drafts = storedProgress?.drafts ?? initialDrafts + const restoredWait = storedProgress?.wait + ?? (storedProgress?.drafts.some((item, itemIndex) => + item.selected.length !== initialDrafts[itemIndex]?.selected.length + || item.selected.some((label, labelIndex) => label !== initialDrafts[itemIndex]?.selected[labelIndex]) + || item.custom !== '' || item.skipped) === true + ? 'editing' : undefined) const [busy, setBusy] = useState<'answer' | 'cancel' | null>(null) const [error, setError] = useState(null) + const card = useQuestionCard(pending.key, snapshot => snapshot ?? REMOVED_CARD) + const canSubmit = card.channel !== 'none' + // The answer surface freezes while a submission is in flight, and for good on + // a review card: its call has already settled. + const locked = busy !== null || review !== undefined + // A waterfall submission is only "sent": the gateway drops an outcome that + // arrives after another Client settled the event, without telling anyone. + // The draft therefore survives until the projection closes the card, and a + // card that flips to continued while a submission is in flight re-arms the + // controls so the same draft can go through the Remote path. + const sentVia = useRef<'waterfall' | null>(null) + useEffect(() => { + if (sentVia.current !== 'waterfall' || card.state !== 'continued') return + sentVia.current = null + setBusy(null) + setError({ key: 'error.resubmit' }) + }, [card.state]) + useEffect(() => { + if (card.closed) actions.clear(pending.key) + }, [actions, card.closed, pending.key]) + useEffect(() => { + actions.prune(pending.liveKeys()) + }, [actions, pending]) + const waitDisposition = useRef<'editing' | 'waiting' | undefined>(restoredWait) + useEffect(() => { + if (waitDisposition.current === 'waiting') pending.takeTime() + if (waitDisposition.current === 'editing') pending.engage() + }, [pending]) + // The countdown belongs to the carrier, not to this component: the user can + // close the panel and reopen it from the tool call row, and a timer that died + // with the mount would leave the tool call waiting past its deadline. + const countdown = card.countdown // Collapsed to the header strip so the conversation above stays readable // while the user decides; answer drafts live in the Session store above. const [minimized, setMinimized] = useState(false) @@ -153,6 +234,7 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { // collapsed question must not steal focus from the expand toggle back into // the input, so focus is granted once per question index. const focusedQuestions = useRef(new Set()) + const answerSurface = useRef(null) // Every navigation write stays in bounds and drafts mirrors questions 1:1. // oxlint-disable-next-line typescript/no-non-null-assertion const question = questions[index]! @@ -161,15 +243,71 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { const hasOptions = (question.options?.length ?? 0) > 0 const replaceProgress = (nextIndex: number, nextDrafts: QuestionDraftAnswer[]): void => { - actions.replace(pending.key, { index: nextIndex, drafts: nextDrafts }) + actions.replace(pending.key, { + index: nextIndex, + drafts: nextDrafts, + ...(waitDisposition.current === undefined ? {} : { wait: waitDisposition.current }), + }) } - const cancelFlow = (): void => { + const takeTime = (): void => { + waitDisposition.current = 'waiting' + pending.takeTime() + replaceProgress(index, drafts) + } + + const engage = (): void => { + if (waitDisposition.current !== undefined) return + waitDisposition.current = 'editing' + pending.engage() + } + + const focusAnswerSurface = (event: FocusEvent): void => { + if (!event.currentTarget.contains(event.relatedTarget)) pending.holdFocus() + } + + const blurAnswerSurface = (event: FocusEvent): void => { + if (!event.currentTarget.contains(event.relatedTarget)) pending.releaseFocus() + } + + useEffect(() => { + const release = (): void => { pending.releaseFocus() } + const refocus = (): void => { + if (waitDisposition.current === 'editing') { + pending.engage() + return + } + if (answerSurface.current?.contains(document.activeElement) === true) pending.holdFocus() + } + const visibilityChanged = (): void => { if (document.hidden) release(); else refocus() } + window.addEventListener('blur', release) + window.addEventListener('focus', refocus) + document.addEventListener('visibilitychange', visibilityChanged) + return () => { + release() + window.removeEventListener('blur', release) + window.removeEventListener('focus', refocus) + document.removeEventListener('visibilitychange', visibilityChanged) + } + }, [pending]) + + const dismissFlow = (): void => { + // A tool-call-keyed panel only leaves the seat; nothing is sent and nothing + // is persisted, and the tool call row brings it back. + if (pending.dismissal === 'hide') { + void pending.dismiss() + return + } + if (!canSubmit) { + setError({ key: 'error.unavailable' }) + return + } setBusy('cancel') setError(null) - void pending.cancel() - .then(() => { actions.clear(pending.key) }) + sentVia.current = 'waterfall' + void pending.dismiss() .catch((cause: unknown) => { + sentVia.current = null setBusy(null) setError({ text: cause instanceof Error ? cause.message : String(cause) }) }) @@ -179,6 +317,7 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { update: (current: QuestionDraftAnswer) => QuestionDraftAnswer, nextIndex = index, ): void => { + engage() const nextDrafts = drafts.map((item, itemIndex) => itemIndex === index ? update(item) : item) replaceProgress(nextIndex, nextDrafts) setError(null) @@ -208,6 +347,10 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { setError({ key: 'error.incomplete' }) return } + if (!canSubmit) { + setError({ key: 'error.unavailable' }) + return + } const answer: QuestionAnswer = { answers: questions.map((item, itemIndex) => { const value = values[itemIndex] as QuestionDraftAnswer @@ -222,9 +365,20 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { } setBusy('answer') setError(null) + // The external-store render can lag the carrier as a timed call continues. + // Read the channel used by answer() in this same event turn. + const channel = pending.snapshot().channel + sentVia.current = channel === 'waterfall' ? 'waterfall' : null void pending.answer(answer) - .then(() => { actions.clear(pending.key) }) + .then(() => { + if (channel !== 'rpc') return + sentVia.current = null + setBusy(null) + setError(null) + void pending.dismiss().catch(() => { setError({ key: 'status.sent' }) }) + }) .catch((cause: unknown) => { + sentVia.current = null setBusy(null) setError({ text: cause instanceof Error ? cause.message : String(cause) }) }) @@ -263,6 +417,7 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { } const skipQuestion = (): void => { + engage() const nextDrafts = drafts.map((item, itemIndex) => itemIndex === index ? { selected: [], custom: '', skipped: true } : item) @@ -288,6 +443,25 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) {
+ {countdown !== undefined && card.waitState !== 'waiting' && card.waitState !== 'editing' && card.waitState !== 'continued' && ( + + {t(countdown.running ? 'wait.countdown' : 'wait.paused', { + seconds: Math.ceil(countdown.remainingMs / 1000), + })} + + )} + {countdown !== undefined && card.waitState !== 'waiting' && card.waitState !== 'editing' && card.waitState !== 'continued' && ( + + )} + {card.state === 'continued' && {t('wait.continued')}} + {/* A held or frozen countdown says so; a request that never carried + one waits silently, as the blocking question always has. */} + {countdown !== undefined && (card.waitState === 'waiting' || card.waitState === 'editing') && ( + {t('wait.held')} + )} + {review !== undefined && {t('review.status')}} @@ -310,7 +485,13 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { {!minimized && ( <> -
+
{question.detail !== undefined && (
)} @@ -325,10 +506,10 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { role={question.multiSelect === true ? 'checkbox' : 'radio'} aria-checked={selected} aria-label={display.label} - disabled={busy !== null} + disabled={locked} onClick={() => { choose(option.label) }} onKeyDown={(event) => { - if (event.key !== 'Enter' || !drafts.every(completed)) return + if (event.key !== 'Enter') return event.preventDefault() submitDrafts(drafts) }} @@ -355,7 +536,14 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { ) })} - {hasOptions + {review !== undefined && draft.skipped && ( +

{t('review.skipped')}

+ )} + + {/* A review card keeps the free-text field only when the + recorded answer used it; an empty disabled box with a + placeholder would read as somewhere to type. */} + {(review === undefined || draft.custom !== '') && (hasOptions ? (
{question.multiSelect === true @@ -375,7 +563,7 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { { focusedQuestions.current.add(index) }} onChange={draftCustom} onKeyDown={continueFromCustom} /> - )} + ))}
@@ -418,19 +608,23 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) {
{error === null ? null : 'key' in error ? t(error.key) : error.text}
-
- - -
+ {/* A review card has nothing to send: the pager alone walks the record. */} + {review === undefined && ( +
+ + +
+ )} )} diff --git a/packages/client/ui-user-questions/src/client/QuestionReplyView.module.css b/packages/client/ui-user-questions/src/client/QuestionReplyView.module.css new file mode 100644 index 0000000000..651fe889dc --- /dev/null +++ b/packages/client/ui-user-questions/src/client/QuestionReplyView.module.css @@ -0,0 +1,166 @@ +.row { + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: flex-end; + gap: 6px; + padding: 4px 0; +} + +.bubble { + max-width: 72%; + padding: 10px 16px; + border-radius: var(--dsw-radius-xl); + background: var(--dsw-specific-bubble); + color: var(--dsw-alias-label-primary); + cursor: pointer; + font-size: var(--dsh-content-font-size, 14px); + line-height: calc(22px + var(--dsh-content-font-delta, 0px)); + text-align: left; + overflow-wrap: anywhere; + white-space: pre-wrap; +} + +.toggle { + width: 100%; + padding: 0; + border: 0; + background: transparent; + color: inherit; + cursor: pointer; + font: inherit; + text-align: left; +} + +.toggle:focus-visible { + outline: 2px solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); + outline-offset: 2px; +} + +.bubble:has(.toggle:focus-visible) { + box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); +} + +.labelRow { + display: flex; + align-items: center; + gap: 3px; +} + +.caret { + display: inline-flex; + color: var(--dsw-alias-label-secondary); +} + +.caret svg { + width: 12px; + height: 12px; +} + +.label { + color: var(--dsw-alias-label-secondary); + display: block; + font-size: var(--dsh-content-font-size-secondary, 13px); + line-height: calc(18px + var(--dsh-content-font-delta-secondary, 0px)); +} + +.summary { + display: block; + margin-top: 3px; + color: var(--dsw-alias-label-primary); + font-size: var(--dsh-content-font-size, 14px); +} + +.text { + margin: 8px 0 0; +} + +.details { + margin: 8px 0 0; + padding-top: 8px; + border-top: 1px solid color-mix(in srgb, var(--dsw-alias-label-secondary) 24%, transparent); +} + +.details > div + div { + margin-top: 12px; +} + +.details dt { + color: var(--dsw-alias-label-secondary); + font-size: 12px; +} + +.question { + display: grid; + gap: 3px; +} + +.header, +.detail, +.options { + color: var(--dsw-alias-label-secondary); + font-size: 11px; +} + +.questionText { + color: var(--dsw-alias-label-primary); +} + +.options { + margin: 0; + padding-left: 16px; +} + +.details dd { + margin: 4px 0 0; +} + +.answer { + font-size: 14px; +} + +.answerLabel { + margin-right: 4px; + color: var(--dsw-alias-label-secondary); + font-size: 12px; +} + +.actions { + display: flex; + align-items: center; + gap: 8px; + height: 28px; + padding-right: 4px; + color: var(--dsw-alias-label-tertiary); +} + +.time { + padding-right: 4px; + font-size: 13px; + line-height: 24px; + white-space: nowrap; +} + +.action { + display: inline-flex; + align-items: center; + justify-content: center; + width: 28px; + height: 28px; + padding: 6px; + border: none; + border-radius: var(--dsw-radius-sm); + background: transparent; + color: inherit; + cursor: pointer; +} + +.action svg { + width: 15px; + height: 15px; +} + +.action:hover { + background: var(--dsw-alias-interactive-bg-hover); + color: var(--dsw-alias-label-secondary); +} diff --git a/packages/client/ui-user-questions/src/client/QuestionReplyView.tsx b/packages/client/ui-user-questions/src/client/QuestionReplyView.tsx new file mode 100644 index 0000000000..8cd59f5b4d --- /dev/null +++ b/packages/client/ui-user-questions/src/client/QuestionReplyView.tsx @@ -0,0 +1,105 @@ +import { memo, useCallback, useState } from 'react' +import type {} from '@deepseek-ai/dsh-client-ui-chat/client' +import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' +import { + IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconChevronRightOutlineRegular, + IconCopyOutlineRegular, Tooltip, writeClipboard, +} from '@deepseek-ai/dsh-client-ui-primitives' +import type { QuestionReplyData } from './question-reply.ts' +import { replyAnswerValues, replyClipboardText } from './question-reply.ts' +import css from './QuestionReplyView.module.css' + +type QuestionReplyViewProps = + PropsRuntime<'conversation.chat.node', 'question-reply'> + & PropsLocale<'question'> + +/** + * Right-aligned late-reply bubble: a label naming the earlier pending + * questions, then one question and answer pair per question. A payload the + * Client cannot read falls back to the model-facing text. + */ +export const QuestionReplyView = memo(function QuestionReplyView({ node, t }: QuestionReplyViewProps) { + return +}) + +/** + * Render one settled question reply as a compact transcript bubble. + * @param props - Reply data and the question locale translator. + * @returns The expandable reply bubble. + */ +export function QuestionReplyBubble({ data, t }: { data: QuestionReplyData; t: PropsLocale<'question'>['t'] }) { + const label = t('reply.label') + const [open, setOpen] = useState(false) + const toggleLabel = t(open ? 'reply.close' : 'reply.open') + const summary = data.questions.map(question => replyAnswerValues(data, question.id)).flat().join(', ') + const copyText = replyClipboardText(data, t) + const [copied, setCopied] = useState(false) + const onCopy = useCallback(() => { + if (copied) return + void writeClipboard(copyText).then((ok) => { + if (!ok) return + setCopied(true) + window.setTimeout(() => { setCopied(false) }, 1000) + }) + }, [copied, copyText]) + return ( +
+
+ + {open && (data.questions.length === 0 + ?

{data.text}

+ : ( +
+ {data.questions.map((question) => { + const values = replyAnswerValues(data, question.id) + return ( +
+
+ {question.header && question.header !== question.question && {question.header}} + {question.question} + {question.detail && {question.detail}} + {question.options && question.options.length > 0 && ( +
    + {question.options.map(option =>
  • {option.label}{option.description && ` — ${option.description}`}
  • )} +
+ )} +
+
+ {t('reply.answerLabel')} + {values.length === 0 ? t('reply.skipped') : values.join(', ')} +
+
+ ) + })} +
+ ))} +
+
+ + {new Intl.DateTimeFormat(undefined, { hour: '2-digit', minute: '2-digit', hour12: false }).format(data.time)} + + + + +
+
+ ) +} diff --git a/packages/client/ui-user-questions/src/client/contract/slots.ts b/packages/client/ui-user-questions/src/client/contract/slots.ts index 813ec4a0be..4d1e9fd0e9 100644 --- a/packages/client/ui-user-questions/src/client/contract/slots.ts +++ b/packages/client/ui-user-questions/src/client/contract/slots.ts @@ -1,11 +1,11 @@ /** Question composer props and one pending Remote waterfall response. */ -import type { PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' +import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' // The client module declares the conversation.composer SlotMap entry required by PropsRuntime. import type { ToolCallId } from '@deepseek-ai/dsh-llm/brand' import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { - AskUserQuestionAnswer, AskUserQuestionItem, -} from '@deepseek-ai/dsh-user-questions' + AskUserQuestionAnswer, AskUserQuestionAnswerItem, AskUserQuestionItem, UserQuestionState, +} from '@deepseek-ai/dsh-user-questions/types' import type { createQuestionDraftStore } from '../draft-store.ts' declare module '@deepseek-ai/dsh-client-ui-session/client' { @@ -100,115 +100,458 @@ export function planReviewOf(questions: readonly QuestionItem[]): PlanReview | u } } + +/** Reload-unique prefix so an unnamed legacy card cannot reuse a persisted draft. */ +const unnamedQuestionPrefix = Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)), + byte => byte.toString(16).padStart(2, '0')).join('') let nextQuestionKey = 0 +/** Rejection codes a Client returns through the waterfall; the wire preserves `name` and `code`. */ +export type QuestionRejectionCode = 'ASK_ABORTED' | 'ASK_CANCELLED' | 'ASK_TIMED_OUT' + +const rejectionMessages: Record = { + ASK_ABORTED: 'ask_user_question was aborted before the user answered', + ASK_CANCELLED: 'the user cancelled ask_user_question', + ASK_TIMED_OUT: 'ask_user_question timed out before the user answered', +} + /** Create a wire-preserved user-question rejection. */ -function questionError(message: string, code: 'ASK_ABORTED' | 'ASK_CANCELLED'): Error { - const error = new Error(message) as Error & { code: string } +function questionError(code: QuestionRejectionCode): Error { + const error = new Error(rejectionMessages[code]) as Error & { code: string } error.name = 'UserQuestionError' error.code = code return error } -/** One answerable Client presentation of a pending Host waterfall. */ -export class PendingQuestion { - /** Presentation discriminator used by Session pending-interaction consumers. */ - readonly kind: 'question' | 'plan-review' - /** Opaque render identity and request key for the Session-scoped draft store. */ - readonly key: string - /** The request's question list. */ - readonly questions: readonly AskUserQuestionItem[] - /** Result returned by the Remote Event listener to the Host waterfall. */ +/** One live Host waterfall attached to a card; it settles once and then detaches. */ +export interface QuestionWaterfallChannel { + /** Client-clock deadline in epoch milliseconds; absent for a blocking question. */ + readonly deadline: number | undefined + /** Resolve the Host waterfall with the whole answer batch. */ + resolve(answer: QuestionAnswer): void + /** Reject the Host waterfall with a wire-preserved code. */ + reject(code: Exclude): void + /** Hand the request to the next waterfall listener. */ + delegate(): void +} + +/** The Remote answer path of a continued question. */ +export interface QuestionRpcChannel { + /** Steer the answer into the agent; false when the question is no longer continued. Rejects when a reply is already queued. */ + answer(answer: QuestionAnswer): Promise +} + +/** The composer seat a card occupies while it is visible. */ +export interface QuestionSeat { + /** Withdraw the card from the pending-interaction registry without ending the request. */ + hide(): void +} + +/** One waterfall request as the Remote Event listener awaits it. */ +export interface QuestionWaterfallRequest { + readonly channel: QuestionWaterfallChannel + /** Outcome returned to the Host: the answer, or a wire-preserved rejection. */ readonly result: Promise - - readonly #resolve: (answer: QuestionAnswer) => void - readonly #reject: (reason: unknown) => void - readonly #signal: AbortSignal | undefined - readonly #onAbort: (() => void) | undefined - readonly #delegated = Symbol('pending question delegated') - #settled = false - /** - * @param sessionId - Agent/Session identity owning the scoped request. - * @param questions - complete question batch. - * @param signal - Host request and delivery lifetime. + * Test whether a rejection asks the listener to call `next()`. + * @param reason - rejection received from {@link QuestionWaterfallRequest.result}. + * @returns whether {@link QuestionWaterfallChannel.delegate} produced it. */ - constructor( - readonly sessionId: SessionId, - questions: readonly AskUserQuestionItem[], - signal?: AbortSignal, - ) { - nextQuestionKey += 1 - this.key = `question:${String(nextQuestionKey)}` - this.questions = questions - this.kind = planReviewOf(questions) === undefined ? 'question' : 'plan-review' - const completion = Promise.withResolvers() - this.result = completion.promise - this.#resolve = completion.resolve - this.#reject = completion.reject - this.#signal = signal - if (signal === undefined) { - this.#onAbort = undefined - return - } - const onAbort = (): void => { - this.abort(questionError('ask_user_question was aborted before the user answered', 'ASK_ABORTED')) - } - this.#onAbort = onAbort + isDelegation(reason: unknown): boolean +} + +/** + * Create the deferred one Remote Event listener settles through a card. + * The request signal ends the channel with `ASK_ABORTED`; the Host ignores that + * outcome for an event it already finished, so a cancel frame loses nothing. + * @param deadline - Client-clock deadline in epoch milliseconds derived from the business claim's remaining duration. + * @param signal - Delivery lifetime of the forwarded request. + * @param onSettle - Called once with the channel when it settles or aborts. + * @returns The channel to attach and the promise the listener awaits. + */ +export function createWaterfallRequest( + deadline: number | undefined, + signal: AbortSignal | undefined, + onSettle: (channel: QuestionWaterfallChannel) => void, +): QuestionWaterfallRequest { + const completion = Promise.withResolvers() + const delegated = Symbol('pending question delegated') + let settled = false + const finish = (settle: () => void): void => { + if (settled) return + settled = true + signal?.removeEventListener('abort', onAbort) + settle() + onSettle(channel) + } + const onAbort = (): void => { + finish(() => { completion.reject(questionError('ASK_ABORTED')) }) + } + const channel: QuestionWaterfallChannel = { + deadline, + resolve: (answer) => { finish(() => { completion.resolve(answer) }) }, + reject: (code) => { finish(() => { completion.reject(questionError(code)) }) }, + delegate: () => { finish(() => { completion.reject(delegated) }) }, + } + if (signal !== undefined) { signal.addEventListener('abort', onAbort, { once: true }) if (signal.aborted) onAbort() } + return { channel, result: completion.promise, isDelegation: reason => reason === delegated } +} + +/** Reactive card state read by every mounted presentation of one question. */ +export interface QuestionCardSnapshot { + /** Mirrors the projection row; `open` until the projection says otherwise. */ + readonly state: UserQuestionState + /** User-visible foreground wait presentation. */ + readonly waitState: 'counting' | 'focused' | 'editing' | 'waiting' | 'continued' + /** + * Foreground countdown presentation, absent for a request that carried no + * deadline. The card owns the ticking, so a hidden panel keeps counting and + * still times out; `running` is false while a hold or an edit froze it. + */ + readonly countdown: { readonly remainingMs: number; readonly running: boolean } | undefined + /** Channel a submission would use right now. */ + readonly channel: 'waterfall' | 'rpc' | 'none' + /** Set once the card left the registry; the mounted composer clears its draft on this. */ + readonly closed: boolean +} + +/** + * One answerable Client card. A card keyed by tool call is created by whichever + * source arrives first, the forwarded waterfall or the Session projection, and + * removed only when the projection no longer lists the call. + */ +export class PendingQuestion { + /** Presentation discriminator used by Session pending-interaction consumers. */ + readonly kind: 'question' | 'plan-review' + /** Render identity and request key for the Session-scoped draft store. */ + readonly key: string + /** Agent/Session identity owning the request. */ + readonly sessionId: SessionId + /** The request's question list. */ + readonly questions: readonly AskUserQuestionItem[] + /** Tool call identity; absent for a blocking request that carried no `wait`. */ + readonly callId: ToolCallId | undefined + /** + * Recorded answers of a call that already settled. Present only on a + * read-only review card, which the tool call row builds from its own + * transcript so a finished question can be read back in the panel that + * asked it. Such a card has no answer channel and no countdown. + */ + readonly review: readonly AskUserQuestionAnswerItem[] | undefined + /** + * What closing the panel does. A card keyed by tool call stays reachable + * from its tool call row, so closing only withdraws the panel (`hide`) and + * persists nothing. A card the Host never named has no way back, so closing + * it ends the request (`cancel`). + */ + readonly dismissal: 'hide' | 'cancel' + + #state: UserQuestionState = 'open' + #waterfall: QuestionWaterfallChannel | undefined + #rpc: QuestionRpcChannel | undefined + #seat: QuestionSeat | undefined + #timedWait = false + #timer: ReturnType | undefined + #deadline: number | undefined + #remainingMs: number | undefined + #focused = false + #engaged = false + #held = false + #closed = false + readonly #siblings: (() => readonly string[]) | undefined + readonly #listeners = new Set<() => void>() + #snapshot: QuestionCardSnapshot /** - * Resolve the Host waterfall with the whole answer batch. + * @param sessionId - Agent/Session identity owning the request. + * @param questions - complete question batch. + * @param callId - tool call identity when the Host named one. + * @param siblings - keys of every card currently registered for the Session, for draft pruning. + * @param review - recorded answers of a settled call, making this a read-only card. + */ + constructor( + sessionId: SessionId, + questions: readonly AskUserQuestionItem[], + callId?: ToolCallId, + siblings?: () => readonly string[], + review?: readonly AskUserQuestionAnswerItem[], + ) { + this.sessionId = sessionId + this.questions = questions + this.kind = planReviewOf(questions) === undefined ? 'question' : 'plan-review' + this.callId = callId + this.review = review + this.dismissal = callId === undefined ? 'cancel' : 'hide' + this.#siblings = siblings + if (callId === undefined) nextQuestionKey += 1 + this.key = callId === undefined + ? `question:${unnamedQuestionPrefix}:${String(nextQuestionKey)}` + : PendingQuestion.keyOf(sessionId, callId) + this.#snapshot = this.createSnapshot() + } + + /** + * Card key of a tool call, shared by every source that names one. The Host + * request and the Session projection carry the branded `ToolCallId`; a + * transcript row carries the same wire value as a plain string. + * @param sessionId - owning Session. + * @param callId - tool call identity, branded or as a transcript spells it. + * @returns the render identity and draft key. + */ + static keyOf(sessionId: SessionId, callId: string): string { + return `question:${String(sessionId)}:${callId}` + } + + /** + * Draft keys that are still live in this Session, this card included. + * @returns keys the draft store must keep; everything else is stale. + */ + liveKeys(): readonly string[] { + return this.#siblings?.() ?? [this.key] + } + + /** Subscribe to card state changes. */ + readonly subscribe = (listener: () => void): (() => void) => { + this.#listeners.add(listener) + return () => { this.#listeners.delete(listener) } + } + + /** Read the stable current card state. */ + readonly snapshot = (): QuestionCardSnapshot => this.#snapshot + + /** Observable snapshot read by the renderer's keyed Hook. */ + readonly getSnapshot = this.snapshot + + private createSnapshot(): QuestionCardSnapshot { + const channel = this.#waterfall !== undefined + ? 'waterfall' + : this.#state === 'continued' && this.#rpc !== undefined ? 'rpc' : 'none' + const waitState = this.#state === 'continued' + ? 'continued' + : this.#held ? 'waiting' + : this.#engaged ? 'editing' + : this.#focused ? 'focused' : 'counting' + return { + state: this.#state, + waitState, + countdown: this.#timedWait + ? { + remainingMs: this.#deadline === undefined + ? this.#remainingMs ?? 0 + : Math.max(0, this.#deadline - Date.now()), + running: this.#deadline !== undefined, + } + : undefined, + channel, + closed: this.#closed, + } + } + + private publish(): void { + this.#snapshot = this.createSnapshot() + this.#reschedule() + for (const listener of this.#listeners) listener() + } + + /** + * Own the countdown here rather than in a mounted component: the panel can be + * hidden and remounted while the request stands, and a timer that died with + * the component would leave the tool call waiting past its deadline. + */ + #reschedule(): void { + const wanted = this.#deadline !== undefined && !this.#closed + if (wanted === (this.#timer !== undefined)) return + if (!wanted) { + clearInterval(this.#timer) + this.#timer = undefined + return + } + this.#timer = setInterval(() => { this.#tick() }, 1000) + } + + #tick(): void { + const deadline = this.#deadline + /* v8 ignore next -- #reschedule clears the interval in the same publish that drops the deadline. */ + if (deadline === undefined) return + if (Date.now() >= deadline) { + this.timeout() + return + } + this.publish() + } + + /** + * Attach the live waterfall of a forwarded request. + * @param channel - request channel created by {@link createWaterfallRequest}. + */ + attachWaterfall(channel: QuestionWaterfallChannel): void { + this.#waterfall = channel + this.#timedWait = channel.deadline !== undefined + if (!this.#held && !this.#engaged) { + this.#deadline = channel.deadline + if (this.#focused && channel.deadline !== undefined) { + this.#remainingMs = Math.max(0, channel.deadline - Date.now()) + this.#deadline = undefined + } + } + this.publish() + } + + /** + * Drop a waterfall channel that settled or was cancelled; the card stays. + * @param channel - the channel that ended. + */ + detachWaterfall(channel: QuestionWaterfallChannel): void { + if (this.#waterfall !== channel) return + this.#waterfall = undefined + this.#timedWait = false + this.#deadline = undefined + this.publish() + } + + /** + * Whether a live waterfall is attached. + * @returns whether the pending Host request still accepts settlement. + */ + hasWaterfall(): boolean { + return this.#waterfall !== undefined + } + + /** + * Attach the Remote answer path used once the question is continued. + * @param channel - Remote calls bound to this Session and call. + */ + attachRpc(channel: QuestionRpcChannel): void { + this.#rpc = channel + this.publish() + } + + /** + * Attach the composer seat this card is published into. + * @param seat - withdrawal of the published panel, owned by the card registry. + */ + attachSeat(seat: QuestionSeat): void { + this.#seat = seat + } + + /** + * Copy the projection row state. + * @param state - `open` or `continued`. + */ + setState(state: UserQuestionState): void { + if (this.#state === state) return + this.#state = state + this.publish() + } + + /** Stop this Client's countdown indefinitely; the waterfall then waits like a blocking question. */ + takeTime(): void { + if (this.#held) return + this.#held = true + this.#focused = false + this.#remainingMs = undefined + this.#deadline = undefined + this.publish() + } + + /** + * Record focus even before the request arrives, freezing a pristine countdown once attached. + * @param now - current Client epoch time. + */ + holdFocus(now = Date.now()): void { + if (this.#held || this.#engaged || this.#focused) return + this.#remainingMs = this.#deadline === undefined ? undefined : Math.max(0, this.#deadline - now) + this.#deadline = undefined + this.#focused = true + this.publish() + } + + /** + * Resume a pristine countdown after the answer surface loses focus. + * @param now - current Client epoch time. + */ + releaseFocus(now = Date.now()): void { + if (!this.#focused) return + this.#focused = false + this.#deadline = this.#timedWait && this.#remainingMs !== undefined ? now + this.#remainingMs : undefined + this.#remainingMs = undefined + this.publish() + } + + /** + * Keep the first edited draft answerable without a foreground deadline. + * @param now - current Client epoch time used to preserve the remaining duration. + */ + engage(now = Date.now()): void { + if (this.#held || this.#engaged) return + if (this.#remainingMs === undefined && this.#deadline !== undefined) { + this.#remainingMs = Math.max(0, this.#deadline - now) + } + this.#engaged = true + this.#focused = false + this.#deadline = undefined + this.publish() + } + + /** Local countdown reached zero: settle the waterfall with `ASK_TIMED_OUT`, keep the card. */ + timeout(): void { + if (this.#held || this.#engaged || this.#focused) return + const channel = this.#waterfall + if (channel === undefined) return + this.#waterfall = undefined + this.#timedWait = false + this.#deadline = undefined + channel.reject('ASK_TIMED_OUT') + this.publish() + } + + /** Hand a live waterfall to the next listener when this presentation domain unloads. */ + delegate(): void { + this.#waterfall?.delegate() + } + + /** Mark the card removed from the registry; the mounted composer clears its draft. */ + close(): void { + if (this.#closed) return + this.#closed = true + this.publish() + } + + /** + * Submit the whole answer batch through the live waterfall, or through the + * Remote path once the question is continued. * @param answer - complete structured answer batch. */ answer(answer: QuestionAnswer): Promise { - return settlePendingComposer(() => { - this.finish(() => { this.#resolve(answer) }) - }, 'pending question settlement failed') - } - - /** Delegate an unanswered request to the next waterfall listener. */ - delegate(): void { - if (this.#settled) return - this.finish(() => { this.#reject(this.#delegated) }) - } - - /** - * Test whether a rejection requests waterfall delegation. - * @param reason - rejection received from {@link PendingQuestion.result}. - * @returns whether {@link PendingQuestion.delegate} produced it. - */ - isDelegation(reason: unknown): boolean { - return reason === this.#delegated - } - - /** Reject the Host waterfall because the user closed the question. */ - cancel(): Promise { - return settlePendingComposer(() => { - this.finish(() => { - this.#reject(questionError('the user cancelled ask_user_question', 'ASK_CANCELLED')) - }) - }, 'pending question cancellation failed') - } - - /** - * End an unanswered presentation when its transport, scope, or plugin lifetime ends. - * @param reason - rejection exposed to the waiting Remote Event listener. - */ - abort(reason: unknown): void { - if (this.#settled) return - this.finish(() => { this.#reject(reason) }) - } - - private finish(settle: () => void): void { - if (this.#settled) throw new Error(`pending question ${this.key} is already settled`) - this.#settled = true - if (this.#signal !== undefined && this.#onAbort !== undefined) { - this.#signal.removeEventListener('abort', this.#onAbort) + const waterfall = this.#waterfall + if (waterfall !== undefined) { + return settlePendingComposer(() => { waterfall.resolve(answer) }, 'pending question settlement failed') } - settle() + const rpc = this.#rpc + if (this.#state === 'continued' && rpc !== undefined) { + return rpc.answer(answer).then((accepted) => { + if (!accepted) throw new Error('this question is no longer answerable') + }) + } + return Promise.reject(new Error('no channel accepts an answer yet')) + } + + /** + * Close the panel. A tool-call-keyed card only leaves the composer seat: the + * request stands, the countdown keeps running here, and the tool call row + * reopens it. A card the Host never named ends its request instead, because + * nothing could bring it back. + */ + dismiss(): Promise { + if (this.dismissal === 'hide') { + return settlePendingComposer(() => { this.#seat?.hide() }, 'pending question hide failed') + } + const waterfall = this.#waterfall + if (waterfall === undefined) return Promise.reject(new Error('no channel accepts a cancellation yet')) + return settlePendingComposer(() => { waterfall.reject('ASK_CANCELLED') }, 'pending question cancellation failed') } } @@ -226,5 +569,6 @@ export type QuestionComposerProps = PropsRuntime<'conversation.composer'> & PropsStore> & PropsRenderSlots<'conversation.plan-review.actions'> + & InjectFace<{ keyedHooks: { questionCard: (key: string) => PendingQuestion | undefined } }> & { matched: QuestionWait } & PropsLocale<'question'> diff --git a/packages/client/ui-user-questions/src/client/draft-store.ts b/packages/client/ui-user-questions/src/client/draft-store.ts index 0d4b432542..4d04ec2833 100644 --- a/packages/client/ui-user-questions/src/client/draft-store.ts +++ b/packages/client/ui-user-questions/src/client/draft-store.ts @@ -21,36 +21,43 @@ export interface QuestionDraftProgress { index: number /** One draft per question, in request order. */ drafts: QuestionDraftAnswer[] + /** Local indefinite-wait choice restored with the draft. */ + wait?: 'editing' | 'waiting' } interface QuestionDraftState { - requestKey?: string - progress: QuestionDraftProgress + progressByRequest: Record } type QuestionDraftActions = { replace: (draft: QuestionDraftState, requestKey: string, progress: QuestionDraftProgress) => void clear: (draft: QuestionDraftState, requestKey: string) => void + prune: (draft: QuestionDraftState, keep: readonly string[]) => void } -const emptyProgress = (): QuestionDraftProgress => ({ index: 0, drafts: [] }) - /** - * Declare the question composer's transient Session store. - * @returns a non-persisted store handle whose instance is owned by the Slot registry. + * Declare the question composer's Session store. Drafts persist per Session so + * leaving the Session or restarting the Client does not erase an unfinished answer. + * @returns a persisted store handle whose instance is owned by the Slot registry. */ export function createQuestionDraftStore(): EngineStoreHandle { return defineStore({ - init: (): QuestionDraftState => ({ progress: emptyProgress() }), + init: (): QuestionDraftState => ({ progressByRequest: {} }), + persist: 'dsh.user-questions.drafts.v1', actions: { replace: (draft, requestKey, progress) => { - draft.requestKey = requestKey - draft.progress = progress + draft.progressByRequest[requestKey] = progress }, clear: (draft, requestKey) => { - if (draft.requestKey !== requestKey) return - delete draft.requestKey - draft.progress = emptyProgress() + draft.progressByRequest = Object.fromEntries( + Object.entries(draft.progressByRequest).filter(([key]) => key !== requestKey), + ) + }, + prune: (draft, keep) => { + const live = new Set(keep) + draft.progressByRequest = Object.fromEntries( + Object.entries(draft.progressByRequest).filter(([key]) => live.has(key)), + ) }, }, }) diff --git a/packages/client/ui-user-questions/src/client/index.ts b/packages/client/ui-user-questions/src/client/index.ts index a356324f0b..8ee3962c39 100644 --- a/packages/client/ui-user-questions/src/client/index.ts +++ b/packages/client/ui-user-questions/src/client/index.ts @@ -6,25 +6,30 @@ * carrier (domain encoding in contract/slots.ts PendingQuestion); copy rides * the standard locale seat. Export discipline: packages/client/AGENTS.md. * - * One entry, two shapes: the composer renders a request that declares a - * presentation intent as that intent's own surface (`plan-review` → the plan - * decision card) and every other request as the generic question flow. A - * separate chain entry per shape would race the same carrier, so the shape - * choice lives inside this entry — see QuestionComposer. + * One entry, two presentations: the composer renders a request with a + * `plan-review` intent as the plan decision card and every other request as + * the generic question flow. Both use the same carrier and composer seat. */ import type { Context as ClientContext } from '@deepseek-ai/cordis' +import type { InboxWireState } from '@deepseek-ai/dsh-agent/types' import type {} from '@deepseek-ai/dsh-api-remotes/client' -import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client' +import type { SessionId } from '@deepseek-ai/dsh-session/types' +import type {} from '@deepseek-ai/dsh-client-ui-chat/client' import type { ComposerChainProps } from '@deepseek-ai/dsh-client-ui-conversation/client' import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' import type { PendingInteractionPublisher } from '@deepseek-ai/dsh-client-ui-session/client' import type { TypertClientEventListener } from '@deepseek-ai/dsh-typert-protocol' +import type { AskUserQuestionItem, PendingUserQuestion, UserQuestionProjectionView } from '@deepseek-ai/dsh-user-questions/types' // Type-only: pulls the locale plugin's Context merge (ctx.locale). import type {} from '@deepseek-ai/dsh-client-locale/client' -import type {} from '@deepseek-ai/dsh-api-session-controller/client' -import { PendingQuestion } from './contract/slots.ts' +import type { UserQuestionPanels, UserQuestionRecord } from '@deepseek-ai/dsh-client-ui-tool/client' +import type { ToolCallId } from '@deepseek-ai/dsh-llm' +import { brandString } from '@deepseek-ai/dsh-brand' +import { createWaterfallRequest, PendingQuestion, type QuestionRpcChannel } from './contract/slots.ts' import { createQuestionDraftStore } from './draft-store.ts' import { QuestionComposer } from './QuestionComposer.tsx' +import { questionReplyDefinition } from './question-reply.ts' +import { QuestionReplyView } from './QuestionReplyView.tsx' import { en, zh, type QuestionKey } from './locales.ts' export type { @@ -47,42 +52,317 @@ type ClientQuestionRequest = Parameters[0] type ClientQuestionNext = Parameters[1] type ClientQuestionAnswer = Awaited> -/** Required services: Agent scopes, Remote Events, Session UI, Slot registry, and copy. */ -export const inject = ['sessions', 'remote', 'uiSession', 'slots', 'locale'] +/** Required services: Agent scopes, Remote Events, Session UI, Slot registry, conversation nodes, and copy. */ +export const inject = ['sessions', 'remote', 'remote.userQuestions', 'uiSession', 'slots', 'locale', 'uiConversation'] -/** Present one request until the user answers, cancels, or its lifetime ends. */ +/** One card and the composer seat it moves in and out of. */ +interface QuestionCard { + readonly pending: PendingQuestion + /** Withdraw the panel from the composer seat; the request and its countdown stand. */ + readonly hide: () => void + /** Publish the panel last, so it wins the seat against any other pending question. */ + readonly reveal: () => void + /** Drop the card for good: the projection no longer lists its call. */ + readonly remove: () => void + /** Track forwarded requests through claim opening and waterfall settlement. */ + readonly trackRequest: (completion: Promise) => () => void + /** Whether the forwarded request is still opening or waiting for settlement. */ + readonly hasRequest: () => boolean +} + +/** + * Cards published to the Session pending-interaction registry, keyed by + * `PendingQuestion.key`. A tool-call-keyed card is shared by the forwarded + * waterfall and the Session projection. + * + * A card outlives its seat. Closing the panel only unpublishes it, which keeps + * the request answerable from its tool call row, so this registry — not the + * pending-interaction registry — decides when a request is over. + */ +class QuestionCards { + readonly #cards = new Map() + + constructor(private readonly publish: PendingInteractionPublisher) {} + + byCallId(sessionId: SessionId, callId: string): QuestionCard | undefined { + return this.#cards.get(PendingQuestion.keyOf(sessionId, callId)) + } + + /** Observable state for one card while the registry owns it. */ + source(key: string): PendingQuestion | undefined { + return this.#cards.get(key)?.pending + } + + values(): readonly QuestionCard[] { + return [...this.#cards.values()] + } + + /** Keys of every card registered for one Session. */ + keysFor(sessionId: SessionId): readonly string[] { + return this.values().filter(card => card.pending.sessionId === sessionId).map(card => card.pending.key) + } + + /** + * Return the card of a tool call, creating and publishing it when absent. + * A request without a call id always gets a fresh card. + */ + ensure(sessionId: SessionId, questions: readonly AskUserQuestionItem[], callId: ToolCallId | undefined): QuestionCard { + if (callId !== undefined) { + const existing = this.byCallId(sessionId, callId) + if (existing !== undefined) return existing + } + return this.#create(new PendingQuestion(sessionId, questions, callId, () => this.keysFor(sessionId))) + } + + /** Publish one carrier into the composer seat and register the card that owns it. */ + #create(pending: PendingQuestion): QuestionCard { + const requests = new Set>() + const delegate = async (): Promise => { + pending.delegate() + await Promise.all(requests) + } + // Republishing is how a revealed card reaches the seat: the registry keeps + // the last entry of equal precedence, and it rejects a duplicate key. + let unpublish: (() => void) | undefined = this.publish(pending, delegate) + const card: QuestionCard = { + pending, + hide: () => { + unpublish?.() + unpublish = undefined + }, + reveal: () => { + unpublish?.() + unpublish = this.publish(pending, delegate) + }, + remove: () => { + /* v8 ignore next -- a card leaves the registry once; no caller holds a card the registry already replaced. */ + if (this.#cards.get(pending.key) !== card) return + this.#cards.delete(pending.key) + pending.close() + unpublish?.() + unpublish = undefined + }, + trackRequest: (completion) => { + requests.add(completion) + return () => { requests.delete(completion) } + }, + hasRequest: () => requests.size > 0, + } + // A review card has no request left to park: closing it drops the card, and + // the tool call row builds another one from the same transcript record. + pending.attachSeat({ hide: pending.review === undefined ? card.hide : card.remove }) + this.#cards.set(pending.key, card) + return card + } + + /** + * Show the panel of one answerable tool call. + * @param sessionId - Session the tool call belongs to. + * @param callId - `ask_user_question` call whose panel to show, as its + * transcript row spells it. + * @returns whether a card for that call is still answerable. + */ + reveal(sessionId: SessionId, callId: string): boolean { + const card = this.byCallId(sessionId, callId) + if (card === undefined) return false + card.reveal() + return true + } + + /** + * Show one settled tool call's recorded answers as a read-only card. A call + * that somehow still holds a card is shown as it stands, so a live request is + * never replaced by a stale copy of itself. + * @param sessionId - Session the tool call belongs to. + * @param callId - `ask_user_question` call whose record to show, as its + * transcript row spells it. + * @param record - the call's questions and recorded answers. + * @returns true; a record always produces a card. + */ + review(sessionId: SessionId, callId: string, record: UserQuestionRecord): boolean { + const card = this.byCallId(sessionId, callId) ?? this.#create(new PendingQuestion( + sessionId, + record.questions, + brandString(callId), + () => this.keysFor(sessionId), + record.answers, + )) + card.reveal() + return true + } + + /** + * Hand every live waterfall back at plugin teardown. The pending-interaction + * registry only drains what it currently holds, and a hidden card is not in + * it, so its Host request would wait for its own abort instead. + */ + dispose(): void { + for (const card of this.values()) { + card.pending.delegate() + card.remove() + } + } +} + +/** Present one forwarded request through its card until the waterfall settles. */ async function answerQuestion( ctx: ClientContext, owner: ClientContext, request: ClientQuestionRequest, next: ClientQuestionNext, - registerPendingInteraction: PendingInteractionPublisher, + cards: QuestionCards, ): Promise { - const sessionId = (ctx.sessions as ISessions).scopeOf(owner) + const sessionId = ctx.sessions.scopeOf(owner) if (sessionId === undefined) return next() - const pending = new PendingQuestion(sessionId, request.questions, request.signal) + const callId = request.wait?.callId + const card = cards.ensure(sessionId, request.questions, callId) + const claimLifetime = new AbortController() + const claimSignal = request.signal === undefined ? claimLifetime.signal + : AbortSignal.any([claimLifetime.signal, request.signal]) + let claim: ReturnType | undefined + let claimEnded: Promise | undefined + let delegateRequest: (() => void) | undefined + const releaseClaim = request.wait?.timed === true && callId !== undefined + ? ctx.effect(() => { + claim = ctx.remote.userQuestions.attachWait(sessionId, callId, claimSignal) + return async () => { + delegateRequest?.() + claimLifetime.abort() + claim?.dispose() + if (claimEnded !== undefined) await Promise.allSettled([claimEnded]) + } + }, 'ui-user-questions: foreground claim') + : undefined const completed = Promise.withResolvers() - const remove = registerPendingInteraction(pending, async () => { - pending.delegate() - await completed.promise - }) + const finishRequest = card.trackRequest(completed.promise) try { + const iterator = claim?.[Symbol.asyncIterator]() + const opening = iterator === undefined ? undefined : await iterator.next() + if (opening?.done === true) return await next() + const waterfall = createWaterfallRequest( + opening === undefined ? undefined : Date.now() + opening.value.remainingMs, + claimSignal, + (channel) => { card.pending.detachWaterfall(channel) }, + ) + // Cancellation may win between the first claim frame and this continuation. + // The request has already settled, so its channel must never reach the card. + if (claimSignal.aborted) return await waterfall.result + delegateRequest = () => { waterfall.channel.delegate() } + card.pending.attachWaterfall(waterfall.channel) + if (iterator !== undefined) { + claimEnded = (async () => { + await iterator.next() + throw new Error('the foreground question wait ended') + })() + } try { - return await pending.result + return await (claimEnded === undefined ? waterfall.result : Promise.race([waterfall.result, claimEnded])) } catch (error) { - if (pending.isDelegation(error)) return await next() + if (waterfall.isDelegation(error)) { + await releaseClaim?.() + return await next() + } throw error } } finally { - remove() + if (releaseClaim === undefined) claimLifetime.abort() + else if (claimEnded === undefined) await releaseClaim() + else { + // The Host closes the claim after accepting the waterfall outcome. + // A local return precedes transmission and cannot release that claim. + void Promise.allSettled([claimEnded]).then(() => { void releaseClaim() }) + } + // A blocking request without a call id is not in the projection; its card ends with its waterfall. + if (callId === undefined) card.remove() completed.resolve() + finishRequest() } } /** - * Client plugin body: register the `question` dictionaries and the question - * composer into the composer chain. Zero business face — data and verbs live - * on the matched carrier; t rides the standard locale seat. + * Mirror answerable calls onto cards. A submitted reply in the durable Inbox + * removes the editable card until the reply is admitted or discarded. + */ +function publishContinuedQuestions(ctx: ClientContext, cards: QuestionCards): () => void { + const sessions = ctx.sessions + const stopProjections = new Map void>() + + const unwrap = (result: { ok: true; value: T } | { ok: false; error: { message: string } }): T => { + if (!result.ok) throw new Error(result.error.message) + return result.value + } + const rpcFor = (sessionId: SessionId, callId: ToolCallId): QuestionRpcChannel => ({ + answer: async answer => unwrap(await ctx.remote.userQuestions.answer(sessionId, callId, answer)), + }) + + const reconcile = (): void => { + const snapshot = sessions.list.getSnapshot() + const bound = new Map(Object.values(snapshot.byId).flatMap((summary) => { + const binding = sessions.binding(summary.id) + return binding === undefined ? [] : [[summary.id, binding] as const] + })) + for (const [sessionId, stop] of stopProjections) { + if (bound.has(sessionId)) continue + stop() + stopProjections.delete(sessionId) + } + for (const [sessionId, binding] of bound) { + if (stopProjections.has(sessionId)) continue + const stopQuestions = binding.session.projections.faceOf('userQuestions').subscribe(reconcile) + const stopInbox = binding.session.projections.faceOf('inbox').subscribe(reconcile) + stopProjections.set(sessionId, () => { stopQuestions(); stopInbox() }) + } + const rows = new Map() + for (const [sessionId, binding] of bound) { + const projected = binding.session.projections.faceOf('userQuestions').getSnapshot() as + UserQuestionProjectionView | undefined + const inbox = binding.session.projections.faceOf('inbox').getSnapshot() as InboxWireState | undefined + const queued = new Set() + for (const message of [...(inbox?.['next-step'] ?? []), ...(inbox?.['next-turn'] ?? [])]) { + if (typeof message !== 'object' || message === null || Array.isArray(message)) continue + const source = message.source + if (typeof source !== 'object' || source === null || Array.isArray(source)) continue + if (source.kind === 'user-question-reply' && typeof source.callId === 'string') queued.add(source.callId) + } + for (const row of projected?.active ?? []) { + if (row.state === 'continued' && queued.has(row.callId)) continue + rows.set(PendingQuestion.keyOf(sessionId, row.callId), { sessionId, row }) + } + } + for (const { sessionId, row } of rows.values()) { + if (row.state === 'continued') { + const card = cards.ensure(sessionId, row.questions, row.callId) + card.pending.attachRpc(rpcFor(sessionId, row.callId)) + card.pending.setState('continued') + continue + } + cards.byCallId(sessionId, row.callId)?.pending.setState('open') + } + for (const card of cards.values()) { + // A review card's call already settled, so the projection no longer lists it as answerable. + if (card.pending.callId === undefined + || card.pending.review !== undefined + || rows.has(card.pending.key) + || card.hasRequest() + || card.pending.hasWaterfall()) continue + card.remove() + } + } + + reconcile() + const stopList = sessions.list.subscribe(reconcile) + return () => { + stopList() + for (const stop of stopProjections.values()) stop() + stopProjections.clear() + } +} + +/** + * Client plugin body: register the `question` dictionaries, the question + * composer into the composer chain, and the late-reply conversation node. + * Zero business face — data and verbs live on the matched carrier; t rides + * the standard locale seat. * @param ctx - client root context. */ export function apply(ctx: ClientContext): void { @@ -91,6 +371,14 @@ export function apply(ctx: ClientContext): void { const registerPendingInteraction = ctx.uiSession.registerPendingInteraction( pending => pending.kind === 'plan-review' ? 2 : 1, ) + const cards = new QuestionCards(registerPendingInteraction) + ctx.effect(() => () => { cards.dispose() }, 'ui-user-questions: cards') + const disposePanels = ctx.reflect.provide('userQuestionPanels', { + reveal: (sessionId, callId) => cards.reveal(sessionId, callId), + review: (sessionId, callId, record) => cards.review(sessionId, callId, record), + } satisfies UserQuestionPanels) + ctx.effect(() => disposePanels, 'ui-user-questions: answer panels') + ctx.effect(() => publishContinuedQuestions(ctx, cards), 'ui-user-questions: continued questions') ctx.slots.inject('conversation.composer', () => ctx.slots.register( { name: 'conversation.composer', @@ -98,11 +386,18 @@ export function apply(ctx: ClientContext): void { pendingInteraction instanceof PendingQuestion ? pendingInteraction : null, locale: NS, store: questionDraftStore, + inject: () => ({ keyedHooks: { questionCard: (key: string) => cards.source(key) } }), children: { 'conversation.plan-review.actions': { kind: 'list', scope: 'session' } }, }, QuestionComposer, )) + ctx.uiConversation.events.register(questionReplyDefinition) + ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({ + name: 'conversation.chat.node', + key: 'question-reply', + locale: NS, + }, QuestionReplyView)) ctx.remote.$on('user-questions/request', function (request, next) { - return answerQuestion(ctx, this, request, next, registerPendingInteraction) + return answerQuestion(ctx, this, request, next, cards) }) } diff --git a/packages/client/ui-user-questions/src/client/locales.ts b/packages/client/ui-user-questions/src/client/locales.ts index 046ceb7c88..d45fd56b4a 100644 --- a/packages/client/ui-user-questions/src/client/locales.ts +++ b/packages/client/ui-user-questions/src/client/locales.ts @@ -4,11 +4,27 @@ export const zh = { 'error.incomplete': '请先完成这道问题。', 'error.unanswered': '请选择一个选项或填写自定义答案。', + 'error.unavailable': '当前无法提交,请稍候再试。', + 'error.resubmit': '回答未送达,工作已继续,请再提交一次。', + 'status.sent': '回答已发送;面板未能关闭。', + 'wait.takeTime': '慢慢回答', + 'wait.countdown': '{seconds} 秒后继续工作', + 'wait.paused': '已暂停 · 剩余 {seconds} 秒', + 'wait.held': '会一直等你回答', + 'wait.continued': '已继续工作,仍可回答', + 'review.status': '已回答', + 'review.skipped': '这道问题当时被跳过。', + 'reply.label': '回答先前等待中的问题', + 'reply.open': '展开问题详情', + 'reply.close': '收起问题详情', + 'reply.answerLabel': '回答:', + 'reply.skipped': '已跳过', 'nav.prev': '上一题', 'nav.next': '下一题', 'nav.minimize': '收起问题卡片', 'nav.maximize': '展开问题卡片', 'nav.cancel': '放弃整组问题', + 'nav.close': '收起问题面板,可从工具调用重新打开', 'option.recommended': '推荐', 'custom.placeholder': '输入你的答案', 'action.skip': '跳过', @@ -26,11 +42,27 @@ export type QuestionKey = keyof typeof zh export const en = { 'error.incomplete': 'Please complete this question first.', 'error.unanswered': 'Please select an option or enter a custom answer.', + 'error.unavailable': 'Cannot submit right now; try again in a moment.', + 'error.resubmit': 'The answer did not arrive before work continued; submit it again.', + 'status.sent': 'Reply sent; the panel could not close.', + 'wait.takeTime': 'Take time', + 'wait.countdown': 'Continuing in {seconds}s', + 'wait.paused': 'Paused · {seconds}s remaining', + 'wait.held': 'Waiting until you answer', + 'wait.continued': 'Work continued — you can still answer', + 'review.status': 'Answered', + 'review.skipped': 'This question was skipped.', + 'reply.label': 'Reply to earlier pending questions', + 'reply.open': 'Open question details', + 'reply.close': 'Close question details', + 'reply.answerLabel': 'Answer: ', + 'reply.skipped': 'Skipped', 'nav.prev': 'Previous question', 'nav.next': 'Next question', 'nav.minimize': 'Collapse the question card', 'nav.maximize': 'Expand the question card', 'nav.cancel': 'Dismiss all questions', + 'nav.close': 'Close the panel — reopen it from the tool call', 'option.recommended': 'Recommended', 'custom.placeholder': 'Type your answer', 'action.skip': 'Skip', diff --git a/packages/client/ui-user-questions/src/client/question-reply.ts b/packages/client/ui-user-questions/src/client/question-reply.ts new file mode 100644 index 0000000000..2d9a9f2245 --- /dev/null +++ b/packages/client/ui-user-questions/src/client/question-reply.ts @@ -0,0 +1,184 @@ +/** Late-reply conversation node: the steered `user-question-reply` message projected as question and answer pairs. */ +import type {} from '@deepseek-ai/dsh-client-ui-chat/client' +import type { ConversationNodeDefinition } from '@deepseek-ai/dsh-client-ui-conversation/client' +import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' +import { isAppendSurfaceEvent } from '@deepseek-ai/dsh-session/surface' +import type { SessionEvent } from '@deepseek-ai/dsh-session/types' +import type {} from '@deepseek-ai/dsh-user-questions/types' + +/** One asked question as echoed in the reply payload. */ +export interface QuestionReplyQuestion { + readonly id: string + readonly question: string + readonly detail?: string + readonly header?: string + readonly options?: readonly { readonly label: string; readonly description?: string }[] + readonly multiSelect?: boolean +} + +/** One structured answer as echoed in the reply payload. */ +export interface QuestionReplyAnswer { + readonly id: string + readonly selected: readonly string[] + readonly custom?: string +} + +/** Presentation data of one late reply. */ +export interface QuestionReplyData { + readonly callId: string + /** A late answer to the pending questions. */ + readonly outcome: 'answered' + readonly questions: readonly QuestionReplyQuestion[] + readonly answers: readonly QuestionReplyAnswer[] + /** Model-facing text, shown when the payload is unreadable. */ + readonly text: string + readonly time: number +} + +declare module '@deepseek-ai/dsh-client-ui-chat/client' { + interface ChatNodeDataMap { + /** Late answer to a continued question. */ + 'question-reply': QuestionReplyData + } +} + +interface QuestionReplyState extends QuestionReplyData { + readonly seq: number +} + +function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +/** + * Read the question and answer pairs out of the reply text at the conversation boundary. + * @param text - Model-facing JSON payload of the steered message. + * @returns The pairs, or empty lists when the payload is unreadable. + */ +export function replyPairsOf(text: string): Pick { + let value: unknown + try { + value = JSON.parse(text) + } catch (error) { + // A reply whose text is not JSON renders as its raw text. + void error + return { questions: [], answers: [] } + } + if (!isRecord(value) || !Array.isArray(value.questions)) { + return { questions: [], answers: [] } + } + const questions: QuestionReplyQuestion[] = [] + for (const question of value.questions) { + if (!isRecord(question) || typeof question.id !== 'string' || typeof question.question !== 'string') continue + questions.push({ + id: question.id, + question: question.question, + ...(typeof question.detail === 'string' ? { detail: question.detail } : {}), + ...(typeof question.header === 'string' ? { header: question.header } : {}), + ...(Array.isArray(question.options) + ? { options: question.options.flatMap((option) => { + if (!isRecord(option) || typeof option.label !== 'string') return [] + return [{ label: option.label, ...(typeof option.description === 'string' ? { description: option.description } : {}) }] + }) } + : {}), + ...(typeof question.multiSelect === 'boolean' ? { multiSelect: question.multiSelect } : {}), + }) + } + const answers: QuestionReplyAnswer[] = [] + for (const answer of Array.isArray(value.answers) ? value.answers : []) { + if (!isRecord(answer) || typeof answer.id !== 'string' || !Array.isArray(answer.selected)) continue + answers.push({ + id: answer.id, + selected: answer.selected.filter((item): item is string => typeof item === 'string'), + ...(typeof answer.custom === 'string' ? { custom: answer.custom } : {}), + }) + } + return { questions, answers } +} + +/** + * Answer values of one question in display order: the selected option labels + * followed by a non-blank custom answer. + * @param data - Projected reply holding the recorded answers. + * @param id - Question id to read. + * @returns The values, empty when the user skipped that question. + */ +export function replyAnswerValues(data: QuestionReplyData, id: string): string[] { + const answer = data.answers.find(item => item.id === id) + const custom = answer?.custom?.trim() ?? '' + return [...(answer?.selected ?? []), ...(custom === '' ? [] : [custom])] +} + +/** + * Clipboard text of one late reply: every question with the answer the user + * gave, in the layout the open bubble shows, without the options nobody chose. + * The text does not depend on whether the bubble is open. + * @param data - Projected reply to copy. + * @param t - Bound `question` namespace translator owning the answer labels. + * @returns One block per question, or the model-facing text when the payload was unreadable. + */ +export function replyClipboardText(data: QuestionReplyData, t: PropsLocale<'question'>['t']): string { + if (data.questions.length === 0) return data.text + return data.questions.map((question) => { + const values = replyAnswerValues(data, question.id) + const heading = question.header && question.header !== question.question + ? `${question.header} — ${question.question}` + : question.question + const answer = values.length === 0 + ? t('reply.skipped') + : `${t('reply.answerLabel')}${values.join(', ')}` + return `${heading}\n${answer}` + }).join('\n\n') +} + +/** Validate a late reply source at the persisted conversation boundary. */ +function replySource( + event: Pick, 'data'>, +): { callId: string; outcome: QuestionReplyData['outcome'] } | null { + const source: unknown = event.data.source + return isRecord(source) && source.kind === 'user-question-reply' + && typeof source.callId === 'string' && source.outcome === 'answered' + ? { callId: source.callId, outcome: 'answered' } + : null +} + +/** Late-reply projection owned by the questions UI. */ +export const questionReplyDefinition: ConversationNodeDefinition = { + kind: 'user-question-reply', + target: 'chat', + match: (event) => { + if (event.type !== 'user/message' || !isAppendSurfaceEvent(event)) return null + return replySource(event) === null ? null : { id: String(event.data.id), role: 'start' } + }, + start: (_context, match) => { + if (match.event.type !== 'user/message') throw new Error('user-question-reply start requires user/message') + const event = match.event + const block = event.data.content.find(item => item.type === 'text') + const text = block?.text ?? '' + const source = replySource(event) + if (source === null) throw new Error('user-question-reply start requires a reply source') + return { + seq: event.seq, + time: event.time, + callId: source.callId, + outcome: source.outcome, + text, + ...replyPairsOf(text), + } + }, + update: context => context.state, + buildViewNode: (context) => { + if (context.state === undefined) return null + const { seq, ...data } = context.state + return { + key: context.key, + kind: 'question-reply', + id: context.id, + target: 'chat', + anchorSeq: seq, + location: context.start?.location ?? { kind: 'unresolved' }, + visibility: 'visible', + data, + } + }, +} diff --git a/packages/client/ui-user-questions/tests/QuestionReplyView.client.spec.tsx b/packages/client/ui-user-questions/tests/QuestionReplyView.client.spec.tsx new file mode 100644 index 0000000000..faa41d9436 --- /dev/null +++ b/packages/client/ui-user-questions/tests/QuestionReplyView.client.spec.tsx @@ -0,0 +1,150 @@ +// @vitest-environment jsdom +import type { ComponentProps } from 'react' +import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' +import { useDisclosure } from '@deepseek-ai/dsh-client-ui-chat/src/client/chat/use-disclosure.ts' +import { zh } from '../src/client/locales.ts' +import { QuestionReplyBubble, QuestionReplyView } from '../src/client/QuestionReplyView.tsx' +import type { QuestionReplyData } from '../src/client/question-reply.ts' + +afterEach(cleanup) + +/** Render the keyed Chat renderer itself; the framework props it never reads are stubbed. */ +function renderView(data: QuestionReplyData) { + const props: Partial> = { + node: { + key: 'reply:1', id: 'msg-1', kind: 'question-reply', target: 'chat', anchorSeq: 7, + location: { kind: 'session' }, visibility: 'visible', data, + }, + openFile: vi.fn(), + openSkill: vi.fn(), + renderMessageImages: () => null, + inspectCall: vi.fn(), + forkAt: vi.fn(), + loadImage: vi.fn(() => Promise.reject(new Error('not used'))), + fileMentions: vi.fn(), + useDisclosure, + useTurnData: () => undefined, + t, + } + return render(} />) +} + +const t = makeTranslate(zh) +const data = { + callId: 'call-reply', + outcome: 'answered', + questions: [{ + id: 'goal', question: 'What should we build?', header: 'What should we build?', detail: 'Choose the first milestone.', + options: [{ label: 'A dashboard', description: 'A focused web surface.' }, { label: 'A CLI' }], + }], + answers: [{ id: 'goal', selected: ['A dashboard'] }], + text: '{"questions":[],"answers":[]}', + time: 1, +} satisfies QuestionReplyData +describe('QuestionReplyView', () => { + it('reopens the settled question details from the history bubble', () => { + render() + + const bubble = screen.getByRole('button', { name: /展开问题详情/ }) + expect(bubble.getAttribute('aria-expanded')).toBe('false') + expect(screen.getAllByText('A dashboard')).toHaveLength(1) + expect(screen.getByRole('button', { name: 'copy' })).toBeTruthy() + expect(screen.getByText(/\d{2}:\d{2}/)).toBeTruthy() + expect(screen.queryByText('What should we build?')).toBeNull() + + fireEvent.click(bubble) + + expect(screen.getByRole('button', { name: /收起问题详情/ }).getAttribute('aria-expanded')).toBe('true') + expect(screen.getByText('What should we build?')).toBeTruthy() + expect(screen.getAllByText('What should we build?')).toHaveLength(1) + expect(screen.getByText('A dashboard — A focused web surface.')).toBeTruthy() + expect(screen.getByText('回答:')).toBeTruthy() + expect(screen.getAllByText('A dashboard')).toHaveLength(1) + }) + + it('copies the question with its answer, then confirms the write', async () => { + const writeText = vi.fn().mockResolvedValue(undefined) + Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } }) + render() + + fireEvent.click(screen.getByRole('button', { name: 'copy' })) + expect(writeText).toHaveBeenCalledWith('What should we build?\n回答:A dashboard') + // Two microtask ticks: writeClipboard's own await, then the .then that + // lands the success chrome. + await act(async () => { + await Promise.resolve() + await Promise.resolve() + }) + fireEvent.click(screen.getByRole('button', { name: 'copied' })) + expect(writeText).toHaveBeenCalledTimes(1) + }) + + it('renders through the conversation.chat.node slot with the same bubble', () => { + renderView(data) + expect(screen.getByRole('group', { name: '回答先前等待中的问题' }).getAttribute('data-question-reply')).toBe('call-reply') + }) + + it('shows a distinct header, marks an unanswered question skipped, and falls back to the raw text', () => { + render() + fireEvent.click(screen.getByRole('button', { name: /展开问题详情/ })) + expect(screen.getByText('Goal')).toBeTruthy() + expect(screen.getByText('None')).toBeTruthy() + expect(screen.getAllByText('已跳过')).toHaveLength(2) + cleanup() + + render() + fireEvent.click(screen.getByRole('button', { name: /展开问题详情/ })) + expect(screen.getByText('raw reply text')).toBeTruthy() + }) + + it('keeps the copy affordance quiet when the clipboard refuses, ignores a click while confirmed, and resets after a second', async () => { + vi.useFakeTimers() + try { + const writeText = vi.fn().mockRejectedValueOnce(new Error('denied')).mockResolvedValue(undefined) + Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } }) + render() + + fireEvent.click(screen.getByRole('button', { name: 'copy' })) + await act(async () => { + await Promise.resolve() + await Promise.resolve() + }) + expect(screen.getByRole('button', { name: 'copy' })).toBeTruthy() + + fireEvent.click(screen.getByRole('button', { name: 'copy' })) + await act(async () => { + await Promise.resolve() + await Promise.resolve() + }) + fireEvent.click(screen.getByRole('button', { name: 'copied' })) + expect(writeText).toHaveBeenCalledTimes(2) + + act(() => { vi.advanceTimersByTime(1000) }) + expect(screen.getByRole('button', { name: 'copy' })).toBeTruthy() + } finally { + vi.useRealTimers() + } + }) + + it('copies the same text once the bubble is open', () => { + const writeText = vi.fn().mockResolvedValue(undefined) + Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } }) + render() + + fireEvent.click(screen.getByRole('button', { name: /展开问题详情/ })) + fireEvent.click(screen.getByRole('button', { name: 'copy' })) + expect(writeText).toHaveBeenCalledWith('What should we build?\n回答:A dashboard') + }) +}) diff --git a/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts b/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts index cbe341902f..84b5d04b21 100644 --- a/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts +++ b/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts @@ -1,29 +1,46 @@ -/** Scoped Remote Event wiring for the browser question consumer. */ +/** Scoped Remote Event wiring and projection publishing for the browser question consumer. */ import { Context } from '@deepseek-ai/cordis' import { describe, expect, it, vi } from 'vitest' import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' +import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' +import type { InboxWireState } from '@deepseek-ai/dsh-agent/types' import type { SessionId } from '@deepseek-ai/dsh-session/types' +import { ToolCallId } from '@deepseek-ai/dsh-llm' +import type { PendingUserQuestion, UserQuestionProjectionView } from '@deepseek-ai/dsh-user-questions/types' import { QuestionComposer } from '../src/client/QuestionComposer.tsx' import { PendingQuestion } from '../src/client/contract/slots.ts' import { createQuestionDraftStore } from '../src/client/draft-store.ts' import { apply, inject } from '../src/client/index.ts' +import { TimedQuestionWait } from '../../../interaction/user-questions/src/timed-wait.ts' const SESSION_ID = 'session-question' as SessionId const SESSION_SCOPE = Symbol('question-session-scope') +const CALL = ToolCallId('call-timed') const QUESTIONS = [{ id: 'mode', question: 'Choose a mode' }] as const +const ANSWER = { answers: [{ id: 'mode', selected: ['Fast'] }] } const PLAN_QUESTIONS: PendingQuestion['questions'] = [{ id: 'plan', question: 'Approve this plan?', detail: '# Plan', options: [{ label: 'Approve' }, { label: 'Keep planning' }], - intent: { kind: 'plan-review' as const, approve: 'Approve' }, + intent: { kind: 'plan-review', approve: 'Approve' }, }] -const ANSWER = { answers: [{ id: 'mode', selected: ['Fast'] }] } +/** One settled call as its tool call row reads it back. */ +const RECORD = { questions: [...QUESTIONS], answers: [...ANSWER.answers] } +const CONTINUED: PendingUserQuestion = { callId: CALL, questions: [...QUESTIONS], state: 'continued' } +/** The projection value this consumer reads; it acts on the answerable half alone. */ +const view = (active: readonly PendingUserQuestion[]): UserQuestionProjectionView => ({ active, settled: [] }) +const emptyInbox = (): InboxWireState => ({ 'next-step': [], 'next-turn': [] }) +const queuedInbox = (callId: ToolCallId): InboxWireState => ({ + 'next-step': [{ source: { kind: 'user-question-reply', callId }, content: [] }], + 'next-turn': [], +}) type QuestionRequest = { questions: PendingQuestion['questions'] signal?: AbortSignal + wait?: { callId: ToolCallId; timed?: boolean } } type QuestionAnswer = typeof ANSWER type QuestionNext = () => Promise @@ -32,14 +49,27 @@ type QuestionListener = ( request: QuestionRequest, next: QuestionNext, ) => Promise +type RemoteBooleanResult = { ok: true; value: boolean } | { ok: false; error: { message: string } } -async function bench(declare = true) { +/** `absent` seeds a projection face that has published nothing yet. */ +async function bench( + declare = true, + durable: readonly PendingUserQuestion[] | 'absent' = [], + remainingMs = 60_000, + initialInbox: InboxWireState = emptyInbox(), +) { const ctx = new Context() await ctx.plugin(SlotRegistry).await() const slots = ctx.get('slots') as SlotRegistry if (declare) { slots.register( - { name: 'root', children: { 'conversation.composer': { kind: 'chain', scope: 'session' } } } as never, + { + name: 'root', + children: { + 'conversation.composer': { kind: 'chain', scope: 'session' }, + 'conversation.chat.node': { kind: 'keyed', scope: 'session' }, + }, + } as never, () => null, ) } @@ -49,7 +79,20 @@ async function bench(declare = true) { const scopeOf = vi.fn((candidate: Context) => ( candidate as Context & { [SESSION_SCOPE]?: SessionId } )[SESSION_SCOPE]) - ctx.provide('sessions', { scopeOf } as never) + const projection = createSnapshotStore(durable === 'absent' ? undefined : view(durable)) + const inbox = createSnapshotStore(initialInbox) + const list = createSnapshotStore({ + ids: [SESSION_ID], + byId: { [SESSION_ID]: { id: SESSION_ID } }, + phase: 'ready', + subagentsByParent: {}, + jobsBySession: {}, + currentAddress: undefined, + }) + const binding = vi.fn((sessionId: SessionId) => sessionId === SESSION_ID + ? ({ sessionId: SESSION_ID, session: { projections: { faceOf: (name: string) => name === 'inbox' ? inbox : projection } } }) + : undefined) + ctx.provide('sessions', { scopeOf, list, binding } as never) const pending = new Map Promise>() const registerPendingInteraction = vi.fn((_precedence: (value: PendingQuestion) => number) => ( value: PendingQuestion, @@ -60,13 +103,40 @@ async function bench(declare = true) { return () => { pending.delete(value) } }) ctx.provide('uiSession', { registerPendingInteraction } as never) + const registerNode = vi.fn((_definition: { kind: string }) => () => {}) + ctx.provide('uiConversation', { events: { register: registerNode } } as never) let listener: QuestionListener | undefined const on = vi.fn((event: string, value: QuestionListener) => { expect(event).toBe('user-questions/request') listener = value return () => { listener = undefined } }) - ctx.provide('remote', { $on: on } as never) + const remoteQuestions = { + attachWait: vi.fn((_sessionId: SessionId, _callId: ToolCallId, signal: AbortSignal) => { + const ended = Promise.withResolvers>() + const dispose = (): void => { + signal.removeEventListener('abort', dispose) + ended.resolve({ done: true, value: undefined }) + } + signal.addEventListener('abort', dispose, { once: true }) + let first = true + return { + dispose, send: () => {}, end: () => {}, + [Symbol.asyncIterator]: () => ({ + next: () => { + if (!first) return ended.promise + first = false + return Promise.resolve({ done: false as const, value: { remainingMs } }) + }, + }), + } + }), + answer: vi.fn(async ( + _sessionId: SessionId, _callId: string, _answer: QuestionAnswer, + ): Promise => ({ ok: true, value: true })), + } + ctx.provide('remote.userQuestions', remoteQuestions as never) + ctx.provide('remote', { $on: on, userQuestions: remoteQuestions } as never) const fiber = ctx.plugin({ inject: [...inject], apply }) await fiber.await() const invoke = ( @@ -84,9 +154,17 @@ async function bench(declare = true) { agent, scopeOf, pending: { getSnapshot: () => [...pending.keys()] }, + /** The answer-panel provider this plugin fills for the tool call row. */ + panels: () => ctx.get('userQuestionPanels'), registerPendingInteraction, + registerNode, on, fiber, + list, + binding, + projection, + inbox, + remoteQuestions, invoke, async releasePending() { const delegates = [...pending.values()] @@ -96,9 +174,151 @@ async function bench(declare = true) { } } +const timed = (): QuestionRequest => ({ + questions: QUESTIONS, + wait: { callId: CALL, timed: true }, +}) + describe('apply', () => { + it('delegates an expired foreground wait and releases its claim stream', async () => { + const b = await bench() + const dispose = vi.fn() + b.remoteQuestions.attachWait.mockImplementationOnce(() => ({ + dispose, send: () => {}, end: () => {}, + [Symbol.asyncIterator]: () => ({ + next: () => Promise.resolve({ done: true as const, value: undefined }), + }), + })) + try { + const next = vi.fn(async () => ANSWER) + + await expect(b.invoke(b.agent, timed(), next)).resolves.toBe(ANSWER) + + expect(next).toHaveBeenCalledOnce() + expect(dispose).toHaveBeenCalledOnce() + expect(b.remoteQuestions.attachWait.mock.calls[0]![2].aborted).toBe(true) + expect(b.pending.getSnapshot()[0]?.snapshot()).toMatchObject({ channel: 'none', countdown: undefined }) + b.projection.set(view([])) + expect(b.pending.getSnapshot()).toEqual([]) + } finally { + await b.fiber.dispose() + } + }) + + it('does not attach a cancelled claim after its first frame', async () => { + const b = await bench(true, [CONTINUED]) + const controller = new AbortController() + b.remoteQuestions.attachWait.mockImplementationOnce(() => ({ + dispose: vi.fn(), send: () => {}, end: () => {}, + [Symbol.asyncIterator]: () => ({ + next: () => { + controller.abort() + return Promise.resolve({ done: false as const, value: { remainingMs: 60_000 } }) + }, + }), + })) + try { + await expect(b.invoke(b.agent, { ...timed(), signal: controller.signal }, async () => ANSWER)) + .rejects.toMatchObject({ code: 'ASK_ABORTED' }) + const card = b.pending.getSnapshot()[0]! + expect(card.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc' }) + await card.answer(ANSWER) + expect(b.remoteQuestions.answer).toHaveBeenCalledOnce() + } finally { + await b.fiber.dispose() + } + }) + + it('keeps a timed card during a Session update before the claim first frame', async () => { + const b = await bench() + const opening = Promise.withResolvers>() + const ended = Promise.withResolvers>() + b.remoteQuestions.attachWait.mockImplementationOnce(() => { + let reads = 0 + return { + dispose: () => { ended.resolve({ done: true, value: undefined }) }, + send: () => {}, end: () => {}, + [Symbol.asyncIterator]: () => ({ next: () => ++reads === 1 ? opening.promise : ended.promise }), + } + }) + try { + const result = b.invoke(b.agent, timed(), async () => ANSWER) + const card = b.pending.getSnapshot()[0]! + b.list.set({ ...b.list.getSnapshot() }) + expect(b.pending.getSnapshot()).toContain(card) + expect(card.snapshot().closed).toBe(false) + + opening.resolve({ done: false, value: { remainingMs: 60_000 } }) + await vi.waitFor(() => { expect(card.snapshot().channel).toBe('waterfall') }) + await card.answer(ANSWER) + await expect(result).resolves.toEqual(ANSWER) + } finally { + opening.resolve({ done: true, value: undefined }) + await b.fiber.dispose() + } + }) + + it('attaches an indefinite request before publishing control back to the caller', async () => { + const b = await bench() + try { + const result = b.invoke(b.agent, { questions: QUESTIONS }, async () => ANSWER) + expect(b.pending.getSnapshot()[0]?.snapshot().channel).toBe('waterfall') + await b.pending.getSnapshot()[0]!.answer(ANSWER) + await expect(result).resolves.toEqual(ANSWER) + } finally { + await b.fiber.dispose() + } + }) + + it('keeps a claim until the Host accepts an answer submitted after Take time', async () => { + const b = await bench() + vi.useFakeTimers() + const wait = new TimedQuestionWait(Date.now() + 5_000, undefined, new Error('unclaimed timeout')) + const claimed = Promise.withResolvers() + const released = Promise.withResolvers() + const dispose = vi.fn(() => { released.resolve(undefined) }) + b.remoteQuestions.attachWait.mockImplementationOnce((_sessionId, _callId, signal) => { + const iterator = wait.attach(signal)[Symbol.asyncIterator]() + let reads = 0 + return { + dispose, send: () => {}, end: () => {}, + [Symbol.asyncIterator]: () => ({ + next: () => { + const result = iterator.next() + if (++reads === 2) claimed.resolve(undefined) + return result + }, + }), + } + }) + try { + const result = b.invoke(b.agent, timed(), async () => ANSWER) + await claimed.promise + const pending = b.pending.getSnapshot()[0]! + pending.takeTime() + await vi.advanceTimersByTimeAsync(6_000) + await pending.answer(ANSWER) + await expect(result).resolves.toEqual(ANSWER) + + // The event carrier sends the answer only after its Client listener returns. + // Keep delivery withheld while the original deadline is already past. + await vi.advanceTimersByTimeAsync(1_000) + expect(wait.signal.aborted).toBe(false) + expect(dispose).not.toHaveBeenCalled() + + wait.close(new Error('Host accepted the answer')) + await released.promise + expect(dispose).toHaveBeenCalledOnce() + expect(vi.getTimerCount()).toBe(0) + } finally { + wait.close(new Error('test ended')) + await b.fiber.dispose() + vi.useRealTimers() + } + }) + it('declares the services it binds', () => { - expect(inject).toEqual(['sessions', 'remote', 'uiSession', 'slots', 'locale']) + expect(inject).toEqual(['sessions', 'remote', 'remote.userQuestions', 'uiSession', 'slots', 'locale', 'uiConversation']) }) it('installs the Remote Event listener and delegates an unscoped request', async () => { @@ -113,6 +333,31 @@ describe('apply', () => { expect(b.pending.getSnapshot()).toEqual([]) }) + it('registers the late-reply conversation node with the conversation runtime', async () => { + const b = await bench() + + expect(b.registerNode).toHaveBeenCalledOnce() + expect(b.registerNode.mock.calls[0]![0]).toMatchObject({ kind: 'user-question-reply', target: 'chat' }) + expect(b.slots.entries('conversation.chat.node').map(entry => entry.options.key)).toEqual(['question-reply']) + }) + + it('follows only bound Sessions and drops a projection subscription with its Session', async () => { + const b = await bench(true, 'absent') + const other = 'session-unbound' as SessionId + expect(b.pending.getSnapshot()).toEqual([]) + + b.list.set({ ...b.list.getSnapshot(), ids: [SESSION_ID, other], byId: { [SESSION_ID]: { id: SESSION_ID }, [other]: { id: other } } }) + expect(b.binding).toHaveBeenCalledWith(other) + b.projection.set(view([CONTINUED])) + expect(b.pending.getSnapshot().map(card => card.key)).toEqual([`question:${SESSION_ID}:${CALL}`]) + + // Unbinding the Session removes its cards and stops following its projection. + b.list.set({ ...b.list.getSnapshot(), ids: [other], byId: { [other]: { id: other } } }) + expect(b.pending.getSnapshot()).toEqual([]) + b.projection.set(view([{ ...CONTINUED, callId: ToolCallId('call-after-unbind') }])) + expect(b.pending.getSnapshot()).toEqual([]) + }) + it('projects a scoped request through one stable composer and returns its answer', async () => { const b = await bench() const next = vi.fn(async () => ANSWER) @@ -121,19 +366,23 @@ describe('apply', () => { const entry = b.slots.entries('conversation.composer')[0]! expect(entry.component).toBe(QuestionComposer) - expect(entry.inject).toBeUndefined() expect(entry.locale).toBe('question') const store = entry.store as ReturnType - expect(store.create(SESSION_ID).getSnapshot()).toEqual({ - progress: { index: 0, drafts: [] }, - }) + expect(store.create(SESSION_ID).getSnapshot()).toEqual({ progressByRequest: {} }) const pending = b.pending.getSnapshot()[0]! + const face = (entry.inject as () => { keyedHooks: { questionCard: (key: string) => PendingQuestion | undefined } })() + expect(face.keyedHooks.questionCard(pending.key)).toBe(pending) + expect(face.keyedHooks.questionCard('question:missing')).toBeUndefined() const select = entry.select as ( owner: { pendingInteraction: PendingQuestion | undefined }, ) => PendingQuestion | null expect(select({ pendingInteraction: undefined })).toBeNull() expect(select({ pendingInteraction: pending })).toBe(pending) - expect(pending).toMatchObject({ kind: 'question', sessionId: SESSION_ID, questions: QUESTIONS }) + expect(pending).toMatchObject({ kind: 'question', sessionId: SESSION_ID, questions: QUESTIONS, callId: undefined }) + expect(pending.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'waterfall', closed: false, + }) await pending.answer(ANSWER) await expect(result).resolves.toBe(ANSWER) @@ -142,36 +391,24 @@ describe('apply', () => { expect(b.slots.entries('conversation.composer')).toHaveLength(1) }) - it('preserves ASK_CANCELLED as a rejected waterfall result', async () => { + it('a request the Host never named ends with ASK_CANCELLED when the user closes its panel', async () => { const b = await bench() const result = b.invoke(b.agent, { questions: QUESTIONS }, async () => ANSWER) await Promise.resolve() const pending = b.pending.getSnapshot()[0]! + expect(pending.dismissal).toBe('cancel') const rejection = expect(result).rejects.toMatchObject({ name: 'UserQuestionError', code: 'ASK_CANCELLED', message: 'the user cancelled ask_user_question', }) - await pending.cancel() + await pending.dismiss() await rejection expect(b.pending.getSnapshot()).toEqual([]) - expect(b.slots.entries('conversation.composer')).toHaveLength(1) }) - it('publishes a plan-review request with its distinct interaction kind', async () => { - const b = await bench() - const result = b.invoke(b.agent, { questions: PLAN_QUESTIONS }, async () => ANSWER) - await Promise.resolve() - const pending = b.pending.getSnapshot()[0]! - - expect(pending.kind).toBe('plan-review') - await pending.answer(ANSWER) - await expect(result).resolves.toBe(ANSWER) - expect(b.pending.getSnapshot()).toEqual([]) - }) - - it('removes a cancelled request while preserving the stable composer', async () => { + it('removes an aborted blocking request while preserving the stable composer', async () => { const b = await bench() const controller = new AbortController() const result = b.invoke(b.agent, { questions: QUESTIONS, signal: controller.signal }, async () => ANSWER) @@ -185,116 +422,343 @@ describe('apply', () => { expect(b.slots.entries('conversation.composer')).toHaveLength(1) }) - it('delegates an active request when its interaction domain unloads', async () => { + it('delegates an active request when its interaction domain unloads, and settles the release only once the listener has handed it on', async () => { const b = await bench() - const next = vi.fn(async () => ANSWER) + const handedOn = Promise.withResolvers() + const next = vi.fn(() => handedOn.promise) const result = b.invoke(b.agent, { questions: QUESTIONS }, next) await Promise.resolve() expect(b.pending.getSnapshot()).toHaveLength(1) - await b.releasePending() - - await expect(result).resolves.toBe(ANSWER) + let released = false + const release = b.releasePending().then(() => { released = true }) + await Promise.resolve() + await Promise.resolve() + // The registry's release awaits the listener's `next()`, exactly as the + // blocking question always did, so a plugin teardown never resolves ahead + // of the request it is handing back. expect(next).toHaveBeenCalledOnce() + expect(released).toBe(false) + + handedOn.resolve(ANSWER) + await release + + expect(released).toBe(true) + await expect(result).resolves.toBe(ANSWER) expect(b.pending.getSnapshot()).toEqual([]) }) - it('removes the stable composer with the plugin lifetime', async () => { + it('keys a timed request by Session and call and settles it with ASK_TIMED_OUT at the local deadline', async () => { const b = await bench() + const result = b.invoke(b.agent, timed(), async () => ANSWER) + await Promise.resolve() + const pending = b.pending.getSnapshot()[0]! + expect(pending.key).toBe(`question:${SESSION_ID}:${CALL}`) + expect(pending.dismissal).toBe('hide') + expect(pending.snapshot()).toMatchObject({ + state: 'open', waitState: 'counting', channel: 'waterfall', closed: false, + }) + // The card owns the countdown, so it reads the deadline down from now. + expect(pending.snapshot().countdown).toEqual({ remainingMs: expect.any(Number) as number, running: true }) + expect(pending.snapshot().countdown!.remainingMs).toBeGreaterThan(55_000) + const rejection = expect(result).rejects.toMatchObject({ name: 'UserQuestionError', code: 'ASK_TIMED_OUT' }) + + pending.timeout() + + await rejection + expect(b.pending.getSnapshot()).toEqual([pending]) + expect(pending.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'none', closed: false, + }) + await expect(pending.answer(ANSWER)).rejects.toThrow(/no channel/) + }) + + it('anchors a Host-measured remaining wait to the Client clock', async () => { + const b = await bench(true, [], 2_000) + const request = timed() + const result = b.invoke(b.agent, request, async () => ANSWER) + await Promise.resolve() + const pending = b.pending.getSnapshot()[0]! + expect(pending.snapshot().countdown!.remainingMs).toBeLessThanOrEqual(2_000) + expect(pending.snapshot().countdown!.remainingMs).toBeGreaterThan(1_000) + pending.timeout() + await expect(result).rejects.toMatchObject({ code: 'ASK_TIMED_OUT' }) + }) + + it('a card-keyed request without a deadline waits with no countdown', async () => { + const b = await bench() + // Nothing settles an indefinite wait, so the request stays pending past this test. + void b.invoke(b.agent, { questions: QUESTIONS, wait: { callId: CALL } }, async () => ANSWER) + await Promise.resolve() + + const pending = b.pending.getSnapshot()[0]! + expect(pending.key).toBe(`question:${SESSION_ID}:${CALL}`) + expect(pending.dismissal).toBe('hide') + expect(pending.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'waterfall', closed: false, + }) + }) + + it('closing a card-keyed panel only leaves the seat, and the panel provider brings it back', async () => { + const b = await bench() + const next = vi.fn(async () => ANSWER) + const result = b.invoke(b.agent, timed(), next) + await Promise.resolve() + const pending = b.pending.getSnapshot()[0]! + + await pending.dismiss() + + // Nothing settled: the tool call still waits, and its countdown still runs. + expect(b.pending.getSnapshot()).toEqual([]) + expect(next).not.toHaveBeenCalled() + expect(pending.snapshot()).toMatchObject({ channel: 'waterfall', closed: false }) + + expect(b.panels()?.reveal(SESSION_ID, CALL)).toBe(true) + expect(b.pending.getSnapshot()).toEqual([pending]) + + await pending.answer(ANSWER) + await expect(result).resolves.toBe(ANSWER) + }) + + it('reveals nothing for a call this Client holds no card for', async () => { + const b = await bench() + expect(b.panels()?.reveal(SESSION_ID, 'call-unknown')).toBe(false) + expect(b.pending.getSnapshot()).toEqual([]) + }) + + it('builds a read-only card from a settled call record and drops it when closed', async () => { + const b = await bench() + + expect(b.panels()?.review(SESSION_ID, CALL, RECORD)).toBe(true) + const card = b.pending.getSnapshot()[0]! + expect(card.key).toBe(`question:${SESSION_ID}:${CALL}`) + expect(card.review).toEqual(RECORD.answers) + expect(card.liveKeys()).toEqual([card.key]) + // No channel and no countdown: the call settled, so nothing is answerable. + expect(card.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'none', closed: false, + }) + await expect(card.answer(ANSWER)).rejects.toThrow(/no channel accepts an answer yet/) + + // The projection never lists a settled call; the sweep must leave it alone. + b.projection.set(view([])) + expect(b.pending.getSnapshot()).toEqual([card]) + + await card.dismiss() + expect(b.pending.getSnapshot()).toEqual([]) + expect(card.snapshot().closed).toBe(true) + + // The row builds another card from the same record. + expect(b.panels()?.review(SESSION_ID, CALL, RECORD)).toBe(true) + expect(b.pending.getSnapshot()[0]).not.toBe(card) + }) + + it('a review of a call that still holds a live card shows the live one', async () => { + const b = await bench() + const result = b.invoke(b.agent, timed(), async () => ANSWER) + await Promise.resolve() + const card = b.pending.getSnapshot()[0]! + + expect(b.panels()?.review(SESSION_ID, CALL, RECORD)).toBe(true) + + expect(b.pending.getSnapshot()).toEqual([card]) + expect(card.review).toBeUndefined() + expect(card.snapshot().channel).toBe('waterfall') + await card.answer(ANSWER) + await expect(result).resolves.toBe(ANSWER) + }) + + it('withdraws the panel provider with the plugin lifetime', async () => { + const b = await bench() + expect(b.panels()).toBeDefined() + + await b.fiber.dispose() + + expect(b.panels()).toBeUndefined() + }) + + it('keeps a timed card through a cancelled delivery until the projection closes it', async () => { + const b = await bench() + const controller = new AbortController() + const result = b.invoke(b.agent, { ...timed(), signal: controller.signal }, async () => ANSWER) + await Promise.resolve() + const pending = b.pending.getSnapshot()[0]! + + controller.abort() + await expect(result).rejects.toMatchObject({ code: 'ASK_ABORTED' }) + expect(b.pending.getSnapshot()).toEqual([pending]) + expect(pending.snapshot().channel).toBe('none') + + b.projection.set(view([CONTINUED])) + expect(b.pending.getSnapshot()).toEqual([pending]) + expect(pending.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc' }) + + b.projection.set(view([])) + expect(b.pending.getSnapshot()).toEqual([]) + expect(pending.snapshot().closed).toBe(true) + }) + + it('creates a continued card from the projection and answers it through the Remote path', async () => { + const b = await bench() + + b.projection.set(view([CONTINUED, { callId: ToolCallId('call-other'), questions: [...QUESTIONS], state: 'continued' }])) + const cards = b.pending.getSnapshot() + expect(cards.map(card => card.key)).toEqual([ + `question:${SESSION_ID}:${CALL}`, `question:${SESSION_ID}:call-other`, + ]) + const card = cards[0]! + expect(card.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc' }) + expect(card.liveKeys()).toEqual(cards.map(item => item.key)) + + await card.answer(ANSWER) + expect(b.remoteQuestions.answer).toHaveBeenCalledWith(SESSION_ID, CALL, ANSWER) + + b.remoteQuestions.answer.mockResolvedValueOnce({ ok: true, value: false }) + await expect(card.answer(ANSWER)).rejects.toThrow(/no longer answerable/) + b.remoteQuestions.answer.mockResolvedValueOnce({ ok: false, error: { message: 'offline' } }) + await expect(card.answer(ANSWER)).rejects.toThrow('offline') + }) + + it('queues an older answer while a later question is waiting', async () => { + const currentCall = ToolCallId('call-current') + const b = await bench(true, [CONTINUED, { ...CONTINUED, callId: currentCall, state: 'open' }]) + const current = b.invoke(b.agent, { ...timed(), wait: { callId: currentCall, timed: true } }, async () => ANSWER) + await vi.waitFor(() => { + expect(b.pending.getSnapshot().find(card => card.callId === currentCall)?.snapshot().channel).toBe('waterfall') + }) + + const currentCard = b.pending.getSnapshot().find(card => card.callId === currentCall)! + const earlier = b.pending.getSnapshot().find(card => card.callId === CALL)! + expect(earlier.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc' }) + await earlier.answer(ANSWER) + expect(b.remoteQuestions.answer).toHaveBeenCalledWith(SESSION_ID, CALL, ANSWER) + expect(currentCard.snapshot().channel).toBe('waterfall') + + currentCard.timeout() + await expect(current).rejects.toMatchObject({ code: 'ASK_TIMED_OUT' }) + }) + + it('does not reopen a queued older answer after a browser reconnect', async () => { + const currentCall = ToolCallId('call-current') + const active = [CONTINUED, { ...CONTINUED, callId: currentCall, state: 'open' as const }] + const b = await bench(true, active) + try { + const current = b.invoke(b.agent, { ...timed(), wait: { callId: currentCall, timed: true } }, async () => ANSWER) + await vi.waitFor(() => { + expect(b.pending.getSnapshot().find(card => card.callId === currentCall)?.snapshot().channel).toBe('waterfall') + }) + const oldCard = b.pending.getSnapshot()[0]! + b.inbox.set(queuedInbox(CALL)) + + expect(oldCard.snapshot().closed).toBe(true) + expect(b.pending.getSnapshot().map(card => card.callId)).toEqual([currentCall]) + expect(b.panels()?.reveal(SESSION_ID, CALL)).toBe(false) + + b.inbox.set(emptyInbox()) + expect(b.pending.getSnapshot().find(card => card.callId === CALL)?.snapshot()) + .toMatchObject({ state: 'continued', channel: 'rpc' }) + b.pending.getSnapshot().find(card => card.callId === currentCall)?.timeout() + await expect(current).rejects.toMatchObject({ code: 'ASK_TIMED_OUT' }) + } finally { + await b.fiber.dispose() + } + + const reconnected = await bench(true, active, 60_000, queuedInbox(CALL)) + try { + expect(reconnected.pending.getSnapshot()).toEqual([]) + expect(reconnected.panels()?.reveal(SESSION_ID, CALL)).toBe(false) + } finally { + await reconnected.fiber.dispose() + } + }) + + it('ignores unrelated inbox entries and recognizes a next-turn reply', async () => { + const otherCall = ToolCallId('call-other') + const b = await bench(true, [CONTINUED, { ...CONTINUED, callId: otherCall }]) + try { + b.inbox.set(undefined) + expect(b.pending.getSnapshot().map(card => card.callId)).toEqual([CALL, otherCall]) + + b.inbox.set({ + 'next-step': [null, { source: null }, { source: { kind: 'other', callId: CALL } }, + { source: { kind: 'user-question-reply', callId: 42 } }], + 'next-turn': [{ source: { kind: 'user-question-reply', callId: otherCall } }], + }) + expect(b.pending.getSnapshot().map(card => card.callId)).toEqual([CALL]) + expect(b.panels()?.reveal(SESSION_ID, otherCall)).toBe(false) + } finally { + await b.fiber.dispose() + } + }) + + it('publishes a plan-review request ahead of plain questions', async () => { + const b = await bench() + const result = b.invoke(b.agent, { questions: PLAN_QUESTIONS }, async () => ANSWER) + await Promise.resolve() + + const pending = b.pending.getSnapshot()[0]! + expect(pending.kind).toBe('plan-review') + const precedence = b.registerPendingInteraction.mock.calls[0]![0] + expect(precedence(pending)).toBe(2) + expect(precedence(new PendingQuestion(SESSION_ID, QUESTIONS))).toBe(1) + + await pending.answer(ANSWER) + await expect(result).resolves.toBe(ANSWER) + }) + + it('closing a continued panel keeps the question answerable from its tool call', async () => { + const b = await bench() + b.projection.set(view([CONTINUED])) + const card = b.pending.getSnapshot()[0]! + + await card.dismiss() + + // No Remote call and no projection change: the dismissal is Client-local. + expect(b.remoteQuestions.answer).not.toHaveBeenCalled() + expect(b.pending.getSnapshot()).toEqual([]) + expect(card.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc', closed: false }) + + expect(b.panels()?.reveal(SESSION_ID, CALL)).toBe(true) + expect(b.pending.getSnapshot()).toEqual([card]) + }) + + it('ignores open rows and lets a re-delivered request attach to a projection-created card', async () => { + const b = await bench(true, [{ ...CONTINUED, state: 'open' }]) + expect(b.pending.getSnapshot()).toEqual([]) + + b.projection.set(view([CONTINUED])) + const card = b.pending.getSnapshot()[0]! + const result = b.invoke(b.agent, timed(), async () => ANSWER) + await Promise.resolve() + + expect(b.pending.getSnapshot()).toEqual([card]) + expect(card.snapshot()).toMatchObject({ state: 'continued', channel: 'waterfall' }) + await card.answer(ANSWER) + await expect(result).resolves.toBe(ANSWER) + expect(b.remoteQuestions.answer).not.toHaveBeenCalled() + expect(b.pending.getSnapshot()).toEqual([card]) + + b.projection.set(view([])) + expect(b.pending.getSnapshot()).toEqual([]) + }) + + it('stops following the projection with the plugin lifetime', async () => { + const b = await bench(true, [CONTINUED]) + const card = b.pending.getSnapshot()[0]! expect(b.slots.entries('conversation.composer')).toHaveLength(1) await b.fiber.dispose() + // Teardown drops every card, hidden ones included: a hidden card is not in + // the pending-interaction registry, so nothing else would end its request. expect(b.slots.entries('conversation.composer')).toHaveLength(0) - }) -}) + expect(b.pending.getSnapshot()).toEqual([]) + expect(card.snapshot().closed).toBe(true) -describe('PendingQuestion', () => { - it('preserves an already-aborted request signal as ASK_ABORTED', async () => { - const lifetime = new AbortController() - lifetime.abort() - const pending = new PendingQuestion(SESSION_ID, QUESTIONS, lifetime.signal) - - await expect(pending.result).rejects.toMatchObject({ - name: 'UserQuestionError', - code: 'ASK_ABORTED', - message: 'ask_user_question was aborted before the user answered', - }) - }) - - it('rejects on later request cancellation and removes the listener after settlement', async () => { - const lifetime = new AbortController() - const remove = vi.spyOn(lifetime.signal, 'removeEventListener') - const pending = new PendingQuestion(SESSION_ID, QUESTIONS, lifetime.signal) - const rejected = expect(pending.result).rejects.toMatchObject({ code: 'ASK_ABORTED' }) - - lifetime.abort() - - await rejected - expect(remove).toHaveBeenCalledWith('abort', expect.any(Function)) - }) - - it('ignores a lifecycle abort after the answer already settled', async () => { - const lifetime = new AbortController() - const pending = new PendingQuestion(SESSION_ID, QUESTIONS, lifetime.signal) - - await pending.answer(ANSWER) - await expect(pending.result).resolves.toBe(ANSWER) - pending.abort(new Error('late disposal')) - pending.delegate() - }) - - it('rejects an unanswered request with its caller-owned lifecycle reason', async () => { - const pending = new PendingQuestion(SESSION_ID, QUESTIONS) - const reason = new Error('scope released') - const rejected = expect(pending.result).rejects.toBe(reason) - - pending.abort(reason) - - await rejected - }) - - it('wraps a non-Error answer settlement failure with its cause', async () => { - const failure = 'resolve failed' - const completion = Promise.withResolvers() - const withResolvers = vi.spyOn(Promise, 'withResolvers').mockImplementationOnce(() => ({ - promise: completion.promise, - resolve: () => { throw failure }, - reject: completion.reject, - })) - const pending = new PendingQuestion(SESSION_ID, QUESTIONS) - withResolvers.mockRestore() - - const settlement = await pending.answer(ANSWER).catch((error: unknown) => error) - - expect(settlement).toBeInstanceOf(Error) - expect(settlement).toMatchObject({ - message: 'pending question settlement failed', - cause: failure, - }) - completion.resolve(ANSWER) - await expect(pending.result).resolves.toBe(ANSWER) - }) - - it('wraps a non-Error cancellation settlement failure with its cause', async () => { - const failure = 'reject failed' - const completion = Promise.withResolvers() - const withResolvers = vi.spyOn(Promise, 'withResolvers').mockImplementationOnce(() => ({ - promise: completion.promise, - resolve: completion.resolve as (value: T | PromiseLike) => void, - reject: () => { throw failure }, - })) - const pending = new PendingQuestion(SESSION_ID, QUESTIONS) - withResolvers.mockRestore() - - const settlement = await pending.cancel().catch((error: unknown) => error) - - expect(settlement).toBeInstanceOf(Error) - expect(settlement).toMatchObject({ - message: 'pending question cancellation failed', - cause: failure, - }) - completion.resolve(ANSWER) - await expect(pending.result).resolves.toBe(ANSWER) + b.projection.set(view([CONTINUED, { callId: ToolCallId('call-after-dispose'), questions: [...QUESTIONS], state: 'continued' }])) + expect(b.pending.getSnapshot()).toEqual([]) }) }) diff --git a/packages/client/ui-user-questions/tests/pending-question.client.spec.ts b/packages/client/ui-user-questions/tests/pending-question.client.spec.ts new file mode 100644 index 0000000000..d96bea972f --- /dev/null +++ b/packages/client/ui-user-questions/tests/pending-question.client.spec.ts @@ -0,0 +1,161 @@ +/** Card and waterfall settlement edges the composer and plugin specs do not reach. */ +import { describe, expect, it, vi } from 'vitest' +import type { SessionId } from '@deepseek-ai/dsh-session/types' +import { ToolCallId } from '@deepseek-ai/dsh-llm' +import { createWaterfallRequest, PendingQuestion } from '../src/client/contract/slots.ts' + +const SID = 's1' as SessionId +const CALL = ToolCallId('call-1') +const QUESTIONS = [{ id: 'mode', question: 'Choose a mode' }] +const ANSWER = { answers: [{ id: 'mode', selected: ['Fast'] }] } + +function attached(card: PendingQuestion, deadline?: number) { + const request = createWaterfallRequest(deadline, undefined, (channel) => { card.detachWaterfall(channel) }) + card.attachWaterfall(request.channel) + return { card, request } +} + +describe('createWaterfallRequest', () => { + it('settles once: later resolutions, rejections and delegations are ignored', async () => { + const onSettle = vi.fn() + const request = createWaterfallRequest(1_000, undefined, onSettle) + request.channel.resolve(ANSWER) + request.channel.reject('ASK_CANCELLED') + request.channel.delegate() + await expect(request.result).resolves.toBe(ANSWER) + expect(onSettle).toHaveBeenCalledOnce() + expect(request.channel.deadline).toBe(1_000) + }) + + it('rejects immediately when the request arrives already aborted', async () => { + const controller = new AbortController() + controller.abort() + const onSettle = vi.fn() + const request = createWaterfallRequest(undefined, controller.signal, onSettle) + await expect(request.result).rejects.toMatchObject({ name: 'UserQuestionError', code: 'ASK_ABORTED' }) + expect(onSettle).toHaveBeenCalledOnce() + }) +}) + +describe('PendingQuestion', () => { + it.each([true, false])('retains focus before a deadline arrives only while still focused: %s', (stillFocused) => { + vi.useFakeTimers() + const card = new PendingQuestion(SID, QUESTIONS, CALL) + try { + card.holdFocus() + if (!stillFocused) card.releaseFocus() + expect(vi.getTimerCount()).toBe(0) + + attached(card, Date.now() + 60_000) + expect(card.snapshot()).toMatchObject({ + waitState: stillFocused ? 'focused' : 'counting', + countdown: { remainingMs: 60_000, running: !stillFocused }, + }) + card.releaseFocus() + expect(card.snapshot().countdown).toEqual({ remainingMs: 60_000, running: true }) + } finally { + card.close() + vi.useRealTimers() + } + }) + + it('does not start a timer when an indefinite question loses focus', () => { + vi.useFakeTimers() + const card = new PendingQuestion(SID, QUESTIONS) + try { + attached(card) + card.holdFocus() + card.releaseFocus() + expect(card.snapshot().countdown).toBeUndefined() + expect(vi.getTimerCount()).toBe(0) + } finally { + card.close() + vi.useRealTimers() + } + }) + + it('publishes only real state changes', () => { + const card = new PendingQuestion(SID, QUESTIONS, CALL) + const listener = vi.fn() + card.subscribe(listener) + + card.setState('open') + card.timeout() + card.takeTime() + card.takeTime() + card.timeout() + card.close() + card.close() + + expect(listener).toHaveBeenCalledTimes(2) + expect(card.snapshot()).toMatchObject({ state: 'open', countdown: undefined, channel: 'none', closed: true }) + expect(card.liveKeys()).toEqual([card.key]) + }) + + it('keeps a held or edited card without a countdown when a later request attaches', () => { + vi.useFakeTimers() + try { + const now = Date.now() + const held = new PendingQuestion(SID, QUESTIONS, CALL) + held.takeTime() + attached(held, now + 60_000) + expect(held.snapshot()).toMatchObject({ waitState: 'waiting', countdown: { remainingMs: 0, running: false } }) + + const edited = new PendingQuestion(SID, QUESTIONS, CALL) + edited.engage(now) + attached(edited, now + 60_000) + expect(edited.snapshot()).toMatchObject({ waitState: 'editing', countdown: { remainingMs: 0, running: false } }) + expect(vi.getTimerCount()).toBe(0) + } finally { + vi.useRealTimers() + } + }) + + it('freezes the remaining wait while focused, also across a re-delivered request', () => { + vi.useFakeTimers() + try { + const now = Date.now() + const card = new PendingQuestion(SID, QUESTIONS, CALL) + const first = attached(card, now + 60_000) + card.holdFocus(now + 10_000) + expect(card.snapshot()).toMatchObject({ waitState: 'focused', countdown: { remainingMs: 50_000, running: false } }) + expect(vi.getTimerCount()).toBe(0) + + // The focused hold survives the request being re-delivered: a deadline + // carried by the new channel is frozen too, one without leaves it as is. + card.detachWaterfall(first.request.channel) + attached(card, now + 40_000) + expect(card.snapshot()).toMatchObject({ waitState: 'focused', countdown: { remainingMs: 40_000, running: false } }) + attached(card) + expect(card.snapshot()).toMatchObject({ waitState: 'focused', countdown: undefined }) + + card.releaseFocus(now + 20_000) + expect(card.snapshot()).toMatchObject({ waitState: 'counting', countdown: undefined }) + card.releaseFocus(now + 20_000) + expect(card.snapshot().waitState).toBe('counting') + } finally { + vi.useRealTimers() + } + }) + + it('refuses to end an unnamed request that has no live channel', async () => { + const card = new PendingQuestion(SID, QUESTIONS) + expect(card.dismissal).toBe('cancel') + await expect(card.dismiss()).rejects.toThrow(/no channel accepts a cancellation/) + }) + + it('turns a throwing settlement into the rejected submission', async () => { + const boom = new Error('subscriber failed') + const first = attached(new PendingQuestion(SID, QUESTIONS, CALL)) + first.card.subscribe(() => { throw boom }) + await expect(first.card.answer(ANSWER)).rejects.toBe(boom) + + const second = attached(new PendingQuestion(SID, QUESTIONS)) + const cancelled = expect(second.request.result).rejects.toMatchObject({ code: 'ASK_CANCELLED' }) + second.card.subscribe(() => { throw 'not an error' }) + await expect(second.card.dismiss()).rejects.toMatchObject({ + message: 'pending question cancellation failed', cause: 'not an error', + }) + await cancelled + }) +}) diff --git a/packages/client/ui-user-questions/tests/plan-review-panel.client.spec.tsx b/packages/client/ui-user-questions/tests/plan-review-panel.client.spec.tsx index 51e4ecefd2..7d9ff6da60 100644 --- a/packages/client/ui-user-questions/tests/plan-review-panel.client.spec.tsx +++ b/packages/client/ui-user-questions/tests/plan-review-panel.client.spec.tsx @@ -5,7 +5,7 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react' import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { ToolCallId } from '@deepseek-ai/dsh-llm/brand' import { - PendingQuestion, planReviewOf, type QuestionComposerProps, type QuestionWait, + createWaterfallRequest, PendingQuestion, planReviewOf, type QuestionComposerProps, type QuestionWait, } from '../src/client/contract/slots.ts' import { createQuestionDraftStore } from '../src/client/draft-store.ts' import { QuestionComposer } from '../src/client/QuestionComposer.tsx' @@ -110,6 +110,7 @@ const questionDraftStore = createQuestionDraftStore().create(SID) /** Framework standard-kit stubs: the panel consumes only the locale seat. */ const kit: Omit = { + useQuestionCard: () => { throw new Error('plan review does not read question card state') }, renderSlot: () => null, SessionProvider: ({ children }) => children, sessionId: SID, @@ -158,9 +159,11 @@ const questions = (): QuestionWait['questions'] => [{ /** Pending waterfall fixture with observable Client response methods. */ function wait(items: QuestionWait['questions'] = questions()) { const carrier = new PendingQuestion(SID, items) + const request = createWaterfallRequest(undefined, undefined, (channel) => { carrier.detachWaterfall(channel) }) + carrier.attachWaterfall(request.channel) const answer = vi.spyOn(carrier, 'answer') - const cancel = vi.spyOn(carrier, 'cancel') - void carrier.result.catch(() => {}) + const cancel = vi.spyOn(carrier, 'dismiss') + void request.result.catch(() => {}) return { carrier, answer, cancel } } @@ -292,6 +295,34 @@ describe('PlanReviewPanel', () => { expect(answer).toHaveBeenCalledTimes(1) }) + it('hides a continued plan decision after steering its reply', async () => { + const carrier = new PendingQuestion(SID, questions(), 'continued-plan' as ToolCallId) + const answer = vi.fn(async () => true) + const hide = vi.fn() + carrier.attachRpc({ answer }) + carrier.attachSeat({ hide }) + carrier.setState('continued') + render() + + fireEvent.click(screen.getByRole('button', { name: zh['plan.approve'] })) + await vi.waitFor(() => { expect(hide).toHaveBeenCalledOnce() }) + expect(screen.getByRole('button', { name: zh['plan.approve'] }).hasAttribute('disabled')).toBe(false) + expect(answer).toHaveBeenCalledOnce() + }) + + it('reports a sent plan reply when hiding its panel fails', async () => { + const carrier = new PendingQuestion(SID, questions(), 'continued-plan-hide-error' as ToolCallId) + const answer = vi.fn(async () => true) + carrier.attachRpc({ answer }) + carrier.attachSeat({ hide: () => { throw new Error('hide failed') } }) + carrier.setState('continued') + render() + + fireEvent.click(screen.getByRole('button', { name: zh['plan.approve'] })) + expect(await screen.findByText(zh['status.sent'])).toBeTruthy() + expect(answer).toHaveBeenCalledOnce() + }) + it('dismisses the request so the composer returns for a plain message', () => { const { carrier, cancel, answer } = wait() diff --git a/packages/client/ui-user-questions/tests/question-draft-store.client.spec.ts b/packages/client/ui-user-questions/tests/question-draft-store.client.spec.ts index d5f7956091..64c052b634 100644 --- a/packages/client/ui-user-questions/tests/question-draft-store.client.spec.ts +++ b/packages/client/ui-user-questions/tests/question-draft-store.client.spec.ts @@ -1,5 +1,5 @@ /** Question-composer Session store behavior. */ -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { createQuestionDraftStore, type QuestionDraftProgress } from '../src/client/draft-store.ts' const FIRST: QuestionDraftProgress = { @@ -8,20 +8,44 @@ const FIRST: QuestionDraftProgress = { } describe('createQuestionDraftStore', () => { - it('keeps one request progress and ignores cleanup from an obsolete request', () => { + it('persists unfinished answers across Session store recreation', () => { + const values = new Map() + vi.stubGlobal('localStorage', { + getItem: (key: string) => values.get(key) ?? null, + setItem: (key: string, value: string) => { values.set(key, value) }, + removeItem: (key: string) => { values.delete(key) }, + }) + try { + const first = createQuestionDraftStore().create('session-one') + first.actions.replace('question:one', FIRST) + + const restored = createQuestionDraftStore().create('session-one') + const other = createQuestionDraftStore().create('session-two') + expect(restored.getSnapshot()).toEqual({ progressByRequest: { 'question:one': FIRST } }) + expect(other.getSnapshot()).toEqual({ progressByRequest: {} }) + + restored.actions.clear('question:one') + expect(createQuestionDraftStore().create('session-one').getSnapshot()) + .toEqual({ progressByRequest: {} }) + } finally { + vi.unstubAllGlobals() + } + }) + + it('keeps request progress and ignores cleanup for another request', () => { const store = createQuestionDraftStore().create('session-one') store.actions.replace('question:one', FIRST) - expect(store.getSnapshot()).toEqual({ requestKey: 'question:one', progress: FIRST }) + expect(store.getSnapshot()).toEqual({ progressByRequest: { 'question:one': FIRST } }) store.actions.clear('question:older') - expect(store.getSnapshot()).toEqual({ requestKey: 'question:one', progress: FIRST }) + expect(store.getSnapshot()).toEqual({ progressByRequest: { 'question:one': FIRST } }) store.actions.clear('question:one') - expect(store.getSnapshot()).toEqual({ progress: { index: 0, drafts: [] } }) + expect(store.getSnapshot()).toEqual({ progressByRequest: {} }) }) - it('replaces the previous request atomically instead of accumulating drafts', () => { + it('keeps simultaneous request drafts isolated', () => { const store = createQuestionDraftStore().create('session-one') const second: QuestionDraftProgress = { index: 0, @@ -31,6 +55,22 @@ describe('createQuestionDraftStore', () => { store.actions.replace('question:one', FIRST) store.actions.replace('question:two', second) - expect(store.getSnapshot()).toEqual({ requestKey: 'question:two', progress: second }) + expect(store.getSnapshot()).toEqual({ + progressByRequest: { 'question:one': FIRST, 'question:two': second }, + }) + + store.actions.clear('question:two') + expect(store.getSnapshot()).toEqual({ progressByRequest: { 'question:one': FIRST } }) + }) + + it('prunes every draft that no live card owns', () => { + const store = createQuestionDraftStore().create('session-one') + store.actions.replace('question:session-one:call-live', FIRST) + store.actions.replace('question:session-one:call-closed', FIRST) + store.actions.replace('question:7', FIRST) + + store.actions.prune(['question:session-one:call-live']) + + expect(store.getSnapshot()).toEqual({ progressByRequest: { 'question:session-one:call-live': FIRST } }) }) }) diff --git a/packages/client/ui-user-questions/tests/question-reply.client.spec.ts b/packages/client/ui-user-questions/tests/question-reply.client.spec.ts new file mode 100644 index 0000000000..f7570515d4 --- /dev/null +++ b/packages/client/ui-user-questions/tests/question-reply.client.spec.ts @@ -0,0 +1,157 @@ +/** Late-reply conversation node: source matching and payload projection. */ +import { describe, expect, it } from 'vitest' +import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' +import { SessionSeq } from '@deepseek-ai/dsh-session' +import { messageDefinition } from '../../ui-chat/src/client/conversation-nodes/message.ts' +import { en } from '../src/client/locales.ts' +import type { QuestionReplyData } from '../src/client/question-reply.ts' +import { questionReplyDefinition, replyAnswerValues, replyClipboardText, replyPairsOf } from '../src/client/question-reply.ts' + +const answered = JSON.stringify({ + kind: 'answer_to_pending_question', + tool: 'ask_user_question', + callId: 'call-1', + questions: [{ + id: 'scope', question: 'Which scope?', header: 'Scope', detail: 'Choose the smallest useful surface.', + options: [{ label: 'Tool only', description: 'Keep the change narrow.' }], multiSelect: false, + }, { id: 'notes', question: 'Any notes?' }], + answers: [{ id: 'scope', selected: ['Tool only'], custom: 'note' }, { id: 'notes', selected: [] }], +}) +const noAnswers = JSON.stringify({ questions: [{ id: 'scope', question: 'Which scope?' }] }) + +function message(source: Record, text: string, surfaceOp: string | null = 'append') { + return { + type: 'user/message', + seq: SessionSeq(7), + time: 7_000, + ...(surfaceOp === null ? {} : { surfaceOp }), + data: { id: 'msg-1', role: 'user', source, content: [{ type: 'text', text }] }, + } as never +} + +const replySource = (outcome: string) => ({ kind: 'user-question-reply', callId: 'call-1', outcome }) + +describe('replyPairsOf', () => { + it('reads question and answer pairs, tolerating a payload without answers', () => { + expect(replyPairsOf(answered)).toEqual({ + questions: [{ + id: 'scope', question: 'Which scope?', header: 'Scope', detail: 'Choose the smallest useful surface.', + options: [{ label: 'Tool only', description: 'Keep the change narrow.' }], multiSelect: false, + }, { id: 'notes', question: 'Any notes?' }], + answers: [{ id: 'scope', selected: ['Tool only'], custom: 'note' }, { id: 'notes', selected: [] }], + }) + expect(replyPairsOf(noAnswers)).toEqual({ questions: [{ id: 'scope', question: 'Which scope?' }], answers: [] }) + }) + + it('keeps only the well-formed options of a question and drops the rest', () => { + const text = JSON.stringify({ + questions: [{ id: 'scope', question: 'Which scope?', options: [{ label: 'Tool only', description: 1 }, 'nope', { description: 'no label' }] }], + answers: [], + }) + expect(replyPairsOf(text).questions).toEqual([{ id: 'scope', question: 'Which scope?', options: [{ label: 'Tool only' }] }]) + }) + + it('renders nothing structured for text it cannot read', () => { + expect(replyPairsOf('not json')).toEqual({ questions: [], answers: [] }) + expect(replyPairsOf('{"questions":"nope"}')).toEqual({ questions: [], answers: [] }) + expect(replyPairsOf('{"questions":[{"id":1}],"answers":[{"id":"x"}]}')).toEqual({ questions: [], answers: [] }) + }) +}) + +const t = makeTranslate(en) +const replyData = (overrides: Partial = {}): QuestionReplyData => ({ + callId: 'call-1', + outcome: 'answered', + questions: [{ + id: 'scope', question: 'Which scope?', header: 'Scope', + options: [{ label: 'Tool only', description: 'Keep the change narrow.' }, { label: 'Whole package' }], + }, { id: 'notes', question: 'Any notes?' }], + answers: [{ id: 'scope', selected: ['Tool only'], custom: 'note' }, { id: 'notes', selected: [] }], + text: answered, + time: 7_000, + ...overrides, +}) + +describe('replyAnswerValues', () => { + it('orders selected labels before a non-blank custom answer', () => { + const data = replyData() + expect(replyAnswerValues(data, 'scope')).toEqual(['Tool only', 'note']) + expect(replyAnswerValues(data, 'notes')).toEqual([]) + expect(replyAnswerValues(data, 'absent')).toEqual([]) + expect(replyAnswerValues(replyData({ answers: [{ id: 'scope', selected: [], custom: ' ' }] }), 'scope')).toEqual([]) + expect(replyAnswerValues(replyData({ answers: [{ id: 'scope', selected: [], custom: 'free text' }] }), 'scope')) + .toEqual(['free text']) + }) +}) + +describe('replyClipboardText', () => { + it('pairs every question with its answer and names the questions the user skipped', () => { + expect(replyClipboardText(replyData(), t)).toBe( + 'Scope — Which scope?\nAnswer: Tool only, note\n\nAny notes?\nSkipped', + ) + }) + + it('drops a header that repeats its question', () => { + const data = replyData({ + questions: [{ id: 'scope', question: 'Which scope?', header: 'Which scope?' }], + answers: [{ id: 'scope', selected: ['Tool only'] }], + }) + expect(replyClipboardText(data, t)).toBe('Which scope?\nAnswer: Tool only') + }) + + it('falls back to the model-facing text when the payload carried no questions', () => { + expect(replyClipboardText(replyData({ questions: [], text: 'not json' }), t)).toBe('not json') + }) +}) + +describe('questionReplyDefinition', () => { + it('claims only appended user messages carrying the reply source', () => { + expect(questionReplyDefinition.match(message(replySource('answered'), answered))).toEqual({ id: 'msg-1', role: 'start' }) + expect(questionReplyDefinition.match(message({ kind: 'user' }, answered))).toBeNull() + expect(questionReplyDefinition.match(message({ kind: 'plugin', plugin: 'user-questions' }, answered))).toBeNull() + expect(questionReplyDefinition.match(message(replySource('answered'), answered, null))).toBeNull() + }) + + it('shares the message id with the generic projection', () => { + const event = message(replySource('answered'), answered) + expect(messageDefinition.match(event)).toEqual({ id: 'msg-1', role: 'start' }) + expect(questionReplyDefinition.match(event)).toEqual(messageDefinition.match(event)) + }) + + it('projects the outcome from the source and the pairs from the text into its own node', () => { + const event = message(replySource('answered'), answered) + const state = questionReplyDefinition.start({} as never, { event, id: 'msg-1', role: 'start' } as never, {} as never) + expect(state).toMatchObject({ + seq: 7, time: 7_000, callId: 'call-1', outcome: 'answered', + questions: [{ id: 'scope', question: 'Which scope?' }, { id: 'notes', question: 'Any notes?' }], answers: [{ id: 'scope', selected: ['Tool only'], custom: 'note' }, { id: 'notes', selected: [] }], text: answered, + }) + + const node = questionReplyDefinition.buildViewNode!({ state, key: 'reply:1', id: 'msg-1', start: undefined } as never) + expect(node).toMatchObject({ + key: 'reply:1', kind: 'question-reply', id: 'msg-1', target: 'chat', anchorSeq: 7, visibility: 'visible', + location: { kind: 'unresolved' }, + data: { callId: 'call-1', outcome: 'answered', text: answered }, + }) + expect(node).not.toHaveProperty('data.seq') + expect(questionReplyDefinition.update({ state } as never, {} as never)).toBe(state) + expect(questionReplyDefinition.buildViewNode!({ state: undefined } as never)).toBeNull() + }) + + it('starts an empty record for a reply without text', () => { + const untyped = { + type: 'user/message', seq: SessionSeq(8), time: 8_000, surfaceOp: 'append', + data: { id: 'msg-2', role: 'user', source: replySource('answered'), content: [{ type: 'image', source: { kind: 'inline', data: '', mediaType: 'image/png' } }] }, + } as never + const state = questionReplyDefinition.start({} as never, { event: untyped, id: 'msg-2', role: 'start' } as never, {} as never) + expect(state).toEqual({ seq: 8, time: 8_000, callId: 'call-1', outcome: 'answered', text: '', questions: [], answers: [] }) + }) + + it('rejects a reply source without an answered outcome', () => { + const event = message({ kind: 'user-question-reply', callId: 'call-1' }, answered) + expect(questionReplyDefinition.match(event)).toBeNull() + expect(() => questionReplyDefinition.start({} as never, { event, id: 'msg-1', role: 'start' } as never, {} as never)).toThrow(/requires a reply source/) + expect(() => questionReplyDefinition.start({} as never, { + event: { ...(event as object), type: 'tool/call' }, id: 'x', role: 'start', + } as never, {} as never)).toThrow(/requires user\/message/) + }) +}) diff --git a/packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx b/packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx index a907471ac6..6e0fa4f418 100644 --- a/packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx +++ b/packages/client/ui-user-questions/tests/user-questions-composer.client.spec.tsx @@ -2,11 +2,13 @@ import type { GlobalStandardProps } from '@deepseek-ai/dsh-client-ui-slots' import { useSyncExternalStore } from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { cleanup, fireEvent, render, screen } from '@testing-library/react' +import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' +import { ToolCallId } from '@deepseek-ai/dsh-llm' import type { SessionId } from '@deepseek-ai/dsh-session/types' -import { PendingQuestion, type QuestionComposerProps } from '../src/client/contract/slots.ts' +import type { AskUserQuestionAnswerItem } from '@deepseek-ai/dsh-user-questions/types' +import { createWaterfallRequest, PendingQuestion, type QuestionCardSnapshot, type QuestionComposerProps } from '../src/client/contract/slots.ts' import { createQuestionDraftStore } from '../src/client/draft-store.ts' -import { QuestionComposer, parseRecommendedLabel } from '../src/client/QuestionComposer.tsx' +import { QuestionComposer as Composer, parseRecommendedLabel } from '../src/client/QuestionComposer.tsx' import { en, zh } from '../src/client/locales.ts' import { en as commonEn } from '@deepseek-ai/dsh-client-locale/src/locales/en.ts' import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts' @@ -107,7 +109,7 @@ const inputState: InputState = { /** Framework standard-kit stubs: the composer consumes the locale and draft-store seats; * the composed props type mandates delivery of the rest (framework hooks are * plain stubs per the client testing discipline). */ -const kitBase: Omit = { +const kitBase: Omit = { renderSlot: () => null, SessionProvider: ({ children }) => children, session: undefined, @@ -137,10 +139,22 @@ const kitBase: Omit = t: seatOver(zh, commonZh), } -let kit: Omit +let kit: Omit +let draftInstance: ReturnType['create']> + +function QuestionComposer(props: Omit) { + const source = props.matched + const useQuestionCard = ((_key: string, selector?: (value: QuestionCardSnapshot | undefined) => unknown) => { + const value = useSyncExternalStore(source.subscribe, source.getSnapshot) + return selector === undefined ? value : selector(value) + }) as QuestionComposerProps['useQuestionCard'] + return +} beforeEach(() => { + localStorage.clear() const instance = createQuestionDraftStore().create(SID) + draftInstance = instance const useStore: QuestionComposerProps['useStore'] = selector => useSyncExternalStore( listener => instance.subscribe(listener), () => selector(instance.getSnapshot()), @@ -168,17 +182,65 @@ const QUESTIONS: PendingQuestion['questions'] = [ ] /** Pending waterfall fixture with observable Client response methods. */ -function wait(questions: PendingQuestion['questions'] = QUESTIONS) { +function wait(questions: PendingQuestion['questions'] = QUESTIONS, deadline?: number) { const carrier = new PendingQuestion(SID, questions) + const request = createWaterfallRequest(deadline, undefined, (channel) => { carrier.detachWaterfall(channel) }) + carrier.attachWaterfall(request.channel) const answer = vi.spyOn(carrier, 'answer') - const cancel = vi.spyOn(carrier, 'cancel') - void carrier.result.catch(() => {}) - return { carrier, answer, cancel } + const dismiss = vi.spyOn(carrier, 'dismiss') + void request.result.catch(() => {}) + return { carrier, answer, dismiss } } const answerBatch = (answers: object[]) => ({ answers }) describe('QuestionComposer', () => { + it('a blocking request shows no wait status before or after the first edit, exactly as before timed questions', () => { + // The blocking card never carried a countdown, so there is nothing for a + // held or frozen label to describe; the header keeps only the question and its two controls. + const { carrier } = wait() + const view = render() + const status = () => view.container.querySelector('[class*="waitStatus"]') + + expect(status()).toBeNull() + expect(screen.queryByText('会一直等你回答')).toBeNull() + fireEvent.click(screen.getByRole('radio', { name: /工程落地型/ })) + expect(carrier.snapshot()).toMatchObject({ waitState: 'editing', countdown: undefined }) + expect(status()).toBeNull() + expect(screen.queryByText('会一直等你回答')).toBeNull() + expect(screen.queryByRole('button', { name: '慢慢回答' })).toBeNull() + expect(screen.getByRole('button', { name: '放弃整组问题' })).toBeTruthy() + }) + + it('keeps a recommended default selected without pausing a timed wait', () => { + const { carrier } = wait(QUESTIONS, Date.now() + 30_000) + try { + const view = render() + expect(screen.getByRole('radio', { name: /工程落地型/ }).getAttribute('aria-checked')).toBe('true') + expect(carrier.snapshot().countdown?.running).toBe(true) + + fireEvent.click(screen.getByLabelText('下一题')) + view.unmount() + render() + expect(carrier.snapshot().countdown?.running).toBe(true) + expect(screen.getByText('2 / 3')).toBeTruthy() + } finally { + carrier.timeout() + } + }) + + it('treats Enter on an unselected option as submit, without selecting it', () => { + const { carrier, answer } = wait([{ + id: 'mode', question: 'Which mode?', options: [{ label: 'Alpha' }, { label: 'Beta' }], + }]) + render() + const option = screen.getByRole('radio', { name: 'Alpha' }) + expect(fireEvent.keyDown(option, { key: 'Enter' })).toBe(false) + expect(option.getAttribute('aria-checked')).toBe('false') + expect(screen.getByRole('status').textContent).toBe('请先完成这道问题。') + expect(answer).not.toHaveBeenCalled() + }) + it('collects single, custom, and multi-select answers before one batch submit', () => { const { carrier, answer } = wait() render() @@ -187,13 +249,12 @@ describe('QuestionComposer', () => { expect(screen.getByText('1 / 3')).toBeTruthy() expect(screen.getByText('推荐')).toBeTruthy() expect(screen.getByText('工程落地型')).toBeTruthy() + expect(screen.getByRole('radio', { name: /工程落地型/ }).getAttribute('aria-checked')).toBe('true') const detail = screen.getByText('按当前空缺岗位的优先级选择。') const scrollRegion = detail.closest('[data-question-scroll]') expect(scrollRegion).toBeTruthy() expect(scrollRegion?.contains(screen.getByRole('radio', { name: /工程落地型/ }))).toBe(true) expect(scrollRegion?.contains(screen.getByText('下一题').closest('button'))).toBe(false) - fireEvent.keyDown(screen.getByRole('radio', { name: /工程落地型/ }), { key: 'Enter' }) - expect(answer).not.toHaveBeenCalled() fireEvent.click(screen.getByRole('radio', { name: /工程落地型/ })) expect(screen.getByText('2 / 3')).toBeTruthy() @@ -247,7 +308,8 @@ describe('QuestionComposer', () => { const { carrier, answer } = wait() render() - expect((screen.getByText('下一题').closest('button') as HTMLButtonElement).disabled).toBe(true) + expect(screen.getByRole('radio', { name: /工程落地型/ }).getAttribute('aria-checked')).toBe('true') + expect((screen.getByText('下一题').closest('button') as HTMLButtonElement).disabled).toBe(false) fireEvent.click(screen.getByRole('radio', { name: '研究潜力型' })) expect(screen.getByText('2 / 3')).toBeTruthy() fireEvent.click(screen.getByRole('button', { name: '跳过' })) @@ -341,8 +403,8 @@ describe('QuestionComposer', () => { }) it('surfaces cancellation failures and re-arms the controls', async () => { - const { carrier, cancel } = wait() - cancel + const { carrier, dismiss } = wait() + dismiss .mockRejectedValueOnce(new Error('第一次取消失败')) .mockRejectedValueOnce(new Error('第二次取消失败')) render() @@ -413,33 +475,37 @@ describe('QuestionComposer', () => { }) describe('PendingQuestion domain face', () => { - it('resolves the waterfall result with the answer batch and settles once', async () => { - const question = new PendingQuestion(SID, QUESTIONS) - const batch = { answers: [{ id: 'mode', selected: ['Fast'] }] } - await expect(question.answer(batch)).resolves.toBeUndefined() - await expect(question.result).resolves.toBe(batch) - await expect(question.answer(batch)).rejects.toThrow(/already settled/) - }) - - it('rejects the waterfall result with ASK_CANCELLED and settles once', async () => { - const question = new PendingQuestion(SID, QUESTIONS) - const result = question.result.catch((error: unknown) => error) - await expect(question.cancel()).resolves.toBeUndefined() - await expect(result).resolves.toMatchObject({ - name: 'UserQuestionError', - code: 'ASK_CANCELLED', - message: 'the user cancelled ask_user_question', - }) - await expect(question.cancel()).rejects.toThrow(/already settled/) - }) - it('exposes its Client render identity and scoped request values', () => { const question = new PendingQuestion(SID, QUESTIONS) - expect(question.key).toMatch(/^question:\d+$/) + expect(question.key).toMatch(/^question:[0-9a-f]{32}:\d+$/) + expect(new PendingQuestion(SID, QUESTIONS).key).not.toBe(question.key) expect(question.sessionId).toBe(SID) expect(question.questions).toBe(QUESTIONS) }) + it('does not restore an old unnamed request draft into a new card', () => { + draftInstance.actions.replace('question:1', { + index: 7, + drafts: [{ selected: ['stale'], custom: '', skipped: false }], + }) + const question = new PendingQuestion(SID, QUESTIONS) + render() + + expect(question.key).not.toBe('question:1') + expect(screen.getByText('1 / 3')).toBeTruthy() + expect(screen.queryByText('stale')).toBeNull() + }) + + it('ignores persisted progress that no longer matches the question batch', () => { + const carrier = new PendingQuestion(SID, QUESTIONS, ToolCallId('stale-progress')) + draftInstance.actions.replace(carrier.key, { index: 7, drafts: [] }) + + render() + + expect(screen.getByRole('heading', { name: QUESTIONS[0]!.question })).toBeTruthy() + expect(screen.getByText(`1 / ${QUESTIONS.length}`)).toBeTruthy() + }) + it('collapses the card to the header strip and expands it back', () => { const { carrier } = wait() render() @@ -488,3 +554,382 @@ describe('parseRecommendedLabel', () => { expect(parseRecommendedLabel('Plain')).toEqual({ label: 'Plain', recommended: false }) }) }) + +const TIMED: PendingQuestion['questions'] = [{ + id: 'scope', question: '选择范围', options: [{ label: '仅工具' }, { label: '全部' }], +}] + +/** A timed card as the Remote Event listener builds it: waterfall channel with a Client-decided deadline. */ +function timedCard(deadline: number, callId = ToolCallId('ask-timed')) { + const carrier = new PendingQuestion(SID, TIMED, callId) + const request = createWaterfallRequest(deadline, undefined, (channel) => { carrier.detachWaterfall(channel) }) + carrier.attachWaterfall(request.channel) + void request.result.catch(() => {}) + return { carrier, request } +} + +describe('timed card', () => { + it.each([true, false])('does not autofocus before claiming and respects manual focus until readiness: %s', async (stillFocused) => { + vi.useFakeTimers() + const carrier = new PendingQuestion(SID, [{ id: 'free', question: '补充说明' }], ToolCallId('claiming')) + const request = createWaterfallRequest(Date.now() + 2_000, undefined, + (channel) => { carrier.detachWaterfall(channel) }) + try { + render() + const field = screen.getByPlaceholderText(zh['custom.placeholder']) + expect(document.activeElement).not.toBe(field) + + fireEvent.focus(field) + if (!stillFocused) fireEvent.blur(field, { relatedTarget: document.body }) + act(() => { carrier.attachWaterfall(request.channel) }) + expect(carrier.snapshot().countdown).toEqual({ remainingMs: 2_000, running: !stillFocused }) + if (stillFocused) { + await act(async () => { await vi.advanceTimersByTimeAsync(5_000) }) + expect(carrier.snapshot().channel).toBe('waterfall') + fireEvent.blur(field, { relatedTarget: document.body }) + expect(carrier.snapshot().countdown).toEqual({ remainingMs: 2_000, running: true }) + } + } finally { + act(() => { request.channel.resolve({ answers: [{ id: 'free', selected: [] }] }) }) + await request.result + cleanup() + carrier.close() + vi.useRealTimers() + } + }) + + it('pauses a pristine countdown while the answer surface has focus and resumes its remainder on blur', async () => { + vi.useFakeTimers() + try { + const { carrier, request } = timedCard(Date.now() + 2_000) + let settled = false + void request.result.then(() => { settled = true }, () => { settled = true }) + render() + const option = screen.getByRole('radio', { name: '仅工具' }) + + fireEvent.focus(option) + expect(carrier.snapshot()).toMatchObject({ waitState: 'focused', countdown: { running: false } }) + expect(screen.getByText(/已暂停/)).toBeTruthy() + await act(async () => { await vi.advanceTimersByTimeAsync(5_000) }) + expect(settled).toBe(false) + + fireEvent.blur(option, { relatedTarget: document.body }) + expect(carrier.snapshot()).toMatchObject({ waitState: 'counting' }) + await act(async () => { await vi.advanceTimersByTimeAsync(2_100) }) + expect(settled).toBe(true) + } finally { + vi.useRealTimers() + } + }) + + it('keeps the first edited draft indefinite and restores that choice after remount', async () => { + vi.useFakeTimers() + try { + const first = timedCard(Date.now() + 1_000) + let firstSettled = false + void first.request.result.then(() => { firstSettled = true }, () => { firstSettled = true }) + const view = render() + + fireEvent.click(screen.getByRole('radio', { name: '仅工具' })) + expect(first.carrier.snapshot()).toMatchObject({ waitState: 'editing', countdown: { running: false } }) + expect(draftInstance.getSnapshot().progressByRequest[first.carrier.key]?.wait).toBe('editing') + await act(async () => { await vi.advanceTimersByTimeAsync(5_000) }) + expect(firstSettled).toBe(false) + + view.unmount() + const restored = timedCard(Date.now() + 1_000) + let restoredSettled = false + void restored.request.result.then(() => { restoredSettled = true }, () => { restoredSettled = true }) + render() + await act(async () => { await Promise.resolve() }) + expect(restored.carrier.snapshot()).toMatchObject({ waitState: 'editing', countdown: { running: false } }) + expect(screen.getByText('会一直等你回答')).toBeTruthy() + await act(async () => { await vi.advanceTimersByTimeAsync(5_000) }) + expect(restoredSettled).toBe(false) + } finally { + vi.useRealTimers() + } + }) + + it('counts down locally, settles the waterfall with ASK_TIMED_OUT at zero, and waits for the projection', async () => { + vi.useFakeTimers() + try { + const { carrier, request } = timedCard(Date.now() + 1_500) + const rejection = expect(request.result).rejects.toMatchObject({ name: 'UserQuestionError', code: 'ASK_TIMED_OUT' }) + render() + expect(screen.getByText(/秒后继续工作/)).toBeTruthy() + expect(screen.getByRole('button', { name: '慢慢回答' })).toBeTruthy() + await act(async () => { await vi.advanceTimersByTimeAsync(2_100) }) + + await rejection + expect(carrier.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'none', closed: false, + }) + expect(screen.queryByText(/秒后继续工作/)).toBeNull() + expect(screen.getByRole('button', { name: '提交' }).disabled).toBe(true) + + const answer = vi.fn(async () => true) + act(() => { + carrier.attachRpc({ answer }) + carrier.setState('continued') + }) + expect(screen.getByText('已继续工作,仍可回答')).toBeTruthy() + fireEvent.click(screen.getByRole('radio', { name: '仅工具' })) + expect(screen.getByRole('button', { name: '提交' }).disabled).toBe(false) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + await act(async () => { await Promise.resolve() }) + expect(answer).toHaveBeenCalledWith({ answers: [{ id: 'scope', selected: ['仅工具'] }] }) + } finally { + vi.useRealTimers() + } + }) + + it('lets the user cancel this countdown and keep the request blocking', async () => { + vi.useFakeTimers() + try { + const { carrier, request } = timedCard(Date.now() + 1_000) + let settled = false + void request.result.then(() => { settled = true }, () => { settled = true }) + render() + + fireEvent.click(screen.getByRole('button', { name: '慢慢回答' })) + + expect(screen.queryByText(/秒后继续工作/)).toBeNull() + expect(screen.queryByRole('button', { name: '慢慢回答' })).toBeNull() + await act(async () => { await vi.advanceTimersByTimeAsync(5_000) }) + expect(settled).toBe(false) + expect(carrier.snapshot()).toMatchObject({ channel: 'waterfall', waitState: 'waiting' }) + } finally { + vi.useRealTimers() + } + }) + + it('re-arms the controls with a resubmit hint when a sent answer is dropped', async () => { + const { carrier, request } = timedCard(Date.now() + 60_000) + render() + fireEvent.click(screen.getByRole('radio', { name: '仅工具' })) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + + await expect(request.result).resolves.toEqual({ answers: [{ id: 'scope', selected: ['仅工具'] }] }) + expect(screen.getByRole('button', { name: '正在提交…' }).disabled).toBe(true) + expect(draftInstance.getSnapshot().progressByRequest[carrier.key]).toBeDefined() + + act(() => { carrier.setState('continued') }) + + expect(screen.getByText('回答未送达,工作已继续,请再提交一次。')).toBeTruthy() + expect(screen.getByRole('radio', { name: '仅工具' }).getAttribute('aria-checked')).toBe('true') + const answer = vi.fn(async () => true) + act(() => { carrier.attachRpc({ answer }) }) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + await vi.waitFor(() => { expect(answer).toHaveBeenCalledWith({ answers: [{ id: 'scope', selected: ['仅工具'] }] }) }) + }) + + it('steers an RPC reply, hides the panel, and rejects a duplicate before discard', async () => { + const carrier = new PendingQuestion(SID, TIMED, ToolCallId('ask-retry')) + const answer = vi.fn(async () => true) + const hide = vi.fn() + answer.mockResolvedValueOnce(true).mockRejectedValueOnce(new Error('a reply is already queued for this question')) + carrier.attachRpc({ answer }) + carrier.attachSeat({ hide }) + carrier.setState('continued') + render() + + fireEvent.click(screen.getByRole('radio', { name: '仅工具' })) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + await vi.waitFor(() => { expect(hide).toHaveBeenCalledOnce() }) + expect(screen.getByRole('button', { name: '提交' }).disabled).toBe(false) + expect(screen.queryByText(zh['status.sent'])).toBeNull() + + fireEvent.click(screen.getByRole('button', { name: '提交' })) + expect(await screen.findByText('a reply is already queued for this question')).toBeTruthy() + expect(answer).toHaveBeenCalledTimes(2) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + await vi.waitFor(() => { expect(answer).toHaveBeenCalledTimes(3) }) + await vi.waitFor(() => { + expect(screen.getByRole('button', { name: '提交' }).disabled).toBe(false) + }) + }) + + it('unlocks an older reply when the rendered channel lags its continued state', async () => { + const carrier = new PendingQuestion(SID, TIMED, ToolCallId('ask-stale-channel')) + const hide = vi.fn() + carrier.attachRpc({ answer: vi.fn(async () => true) }) + carrier.attachSeat({ hide }) + carrier.setState('continued') + const rendered = { ...carrier.snapshot(), state: 'open' as const, channel: 'waterfall' as const } + const useQuestionCard = ((_key: string, selector?: (value: QuestionCardSnapshot | undefined) => unknown) => + selector === undefined ? rendered : selector(rendered)) as QuestionComposerProps['useQuestionCard'] + render() + + fireEvent.click(screen.getByRole('radio', { name: '仅工具' })) + fireEvent.click(screen.getByRole('button', { name: '提交' })) + + await vi.waitFor(() => { expect(hide).toHaveBeenCalledOnce() }) + expect(screen.getByRole('button', { name: '提交' }).disabled).toBe(false) + }) + + it('closing a continued panel only withdraws it from the seat and sends nothing', async () => { + const carrier = new PendingQuestion(SID, TIMED, ToolCallId('ask-continued')) + const answer = vi.fn(async () => true) + const hide = vi.fn() + carrier.attachRpc({ answer }) + carrier.attachSeat({ hide }) + carrier.setState('continued') + render() + + expect(screen.getByText('已继续工作,仍可回答')).toBeTruthy() + expect(screen.queryByText(/秒后继续工作/)).toBeNull() + // The close button names the reopen path, not a dismissal of the question. + expect(screen.queryByLabelText('放弃整组问题')).toBeNull() + fireEvent.click(screen.getByLabelText('收起问题面板,可从工具调用重新打开')) + + await vi.waitFor(() => { expect(hide).toHaveBeenCalledOnce() }) + expect(answer).not.toHaveBeenCalled() + expect(carrier.snapshot()).toMatchObject({ state: 'continued', channel: 'rpc', closed: false }) + }) + + it('closing a card-keyed panel with no channel left still just withdraws it', () => { + const carrier = new PendingQuestion(SID, TIMED, ToolCallId('ask-gap')) + const hide = vi.fn() + carrier.attachSeat({ hide }) + render() + + fireEvent.click(screen.getByLabelText('收起问题面板,可从工具调用重新打开')) + + expect(hide).toHaveBeenCalledOnce() + expect(screen.queryByText('当前无法提交,请稍候再试。')).toBeNull() + }) + + it('reports an unavailable channel instead of cancelling into the gap', () => { + // A request the Host never named: closing it is the cancellation, so with + // no channel to carry the rejection there is nothing to do but say so. + const carrier = new PendingQuestion(SID, TIMED) + render() + + fireEvent.click(screen.getByLabelText('放弃整组问题')) + + expect(screen.getByText('当前无法提交,请稍候再试。')).toBeTruthy() + }) + + it('prunes drafts no card owns on mount and clears its own draft when the card closes', () => { + kit.actions.replace('question:stale', { index: 0, drafts: [{ selected: [], custom: 'old', skipped: false }] }) + const { carrier } = timedCard(Date.now() + 60_000) + render() + + expect(draftInstance.getSnapshot().progressByRequest['question:stale']).toBeUndefined() + fireEvent.click(screen.getByRole('radio', { name: '全部' })) + expect(draftInstance.getSnapshot().progressByRequest[carrier.key]?.drafts[0]?.selected).toEqual(['全部']) + + act(() => { carrier.close() }) + + expect(draftInstance.getSnapshot().progressByRequest[carrier.key]).toBeUndefined() + }) +}) + +const REVIEWED_CALL = 'ask-answered' +/** One settled call's answers in record order, which is not the question order. */ +const RECORDED: readonly AskUserQuestionAnswerItem[] = [ + { id: 'signals', selected: [] }, + { id: 'profile', selected: ['工程落地型 (Recommended)'] }, + { id: 'detail', selected: [], custom: '要能独立排查线上问题' }, +] +/** A record whose multi-select answer used the custom row beside a checked option. */ +const RECORDED_CUSTOM: readonly AskUserQuestionAnswerItem[] = [ + { id: 'profile', selected: ['研究潜力型'] }, + { id: 'detail', selected: [], custom: '要能独立排查线上问题' }, + { id: 'signals', selected: ['系统设计'], custom: '沟通能力' }, +] + +/** A read-only card as the panel provider builds it from a settled call's transcript record. */ +function reviewCard(review: readonly AskUserQuestionAnswerItem[] = RECORDED) { + const carrier = new PendingQuestion(SID, QUESTIONS, ToolCallId(REVIEWED_CALL), undefined, review) + const hide = vi.fn() + carrier.attachSeat({ hide }) + return { carrier, hide } +} + +describe('review card', () => { + it('walks a settled call record with every answer surface frozen', () => { + const { carrier } = reviewCard() + render() + + expect(screen.getByText(zh['review.status'])).toBeTruthy() + // The recorded selection is paired by question id, not by record order. + const chosen = screen.getByRole('radio', { name: '工程落地型' }) + expect(chosen.getAttribute('aria-checked')).toBe('true') + expect(chosen.disabled).toBe(true) + // Nothing is left to send, and the unused free-text field would read as + // somewhere to type. + expect(screen.queryByRole('button', { name: '跳过' })).toBeNull() + expect(screen.queryByRole('button', { name: '提交' })).toBeNull() + expect(screen.queryByPlaceholderText('输入你的答案')).toBeNull() + + fireEvent.click(screen.getByLabelText('下一题')) + + expect(screen.getByText('2 / 3')).toBeTruthy() + const optionless = screen.getByPlaceholderText('输入你的答案') + expect(optionless.value).toBe('要能独立排查线上问题') + expect(optionless.disabled).toBe(true) + expect(document.activeElement).not.toBe(optionless) + + fireEvent.click(screen.getByLabelText('下一题')) + + expect(screen.getByText('3 / 3')).toBeTruthy() + expect(screen.getByText(zh['review.skipped'])).toBeTruthy() + expect(screen.getByRole('checkbox', { name: '系统设计' }).getAttribute('aria-checked')).toBe('false') + expect(screen.queryByPlaceholderText('输入你的答案')).toBeNull() + }) + + it('reads the record back instead of a draft the live card left under the same key', () => { + kit.actions.replace(PendingQuestion.keyOf(SID, REVIEWED_CALL), { + index: 2, + drafts: [ + { selected: [], custom: '没提交的草稿', skipped: false }, + { selected: [], custom: '', skipped: false }, + { selected: ['代码质量'], custom: '', skipped: false }, + ], + }) + const { carrier } = reviewCard(RECORDED_CUSTOM) + render() + + // The page the live card was on is restored; its half-typed answers are not. + expect(screen.getByText('3 / 3')).toBeTruthy() + expect(screen.getByRole('checkbox', { name: '系统设计' }).getAttribute('aria-checked')).toBe('true') + expect(screen.getByRole('checkbox', { name: '代码质量' }).getAttribute('aria-checked')).toBe('false') + const custom = screen.getByPlaceholderText('输入你的答案') + expect(custom.value).toBe('沟通能力') + expect(custom.disabled).toBe(true) + + fireEvent.click(screen.getByLabelText('上一题')) + fireEvent.click(screen.getByLabelText('上一题')) + + expect(screen.getByRole('radio', { name: '研究潜力型' }).getAttribute('aria-checked')).toBe('true') + expect(screen.queryByDisplayValue('没提交的草稿')).toBeNull() + }) + + it('closing a read-only panel withdraws it and sends nothing', () => { + const { carrier, hide } = reviewCard() + render() + + // The card is keyed by its tool call, so closing names the reopen path. + expect(screen.queryByLabelText(zh['nav.cancel'])).toBeNull() + fireEvent.click(screen.getByLabelText(zh['nav.close'])) + + expect(hide).toHaveBeenCalledOnce() + expect(carrier.snapshot()).toEqual({ + state: 'open', waitState: 'counting', countdown: undefined, + channel: 'none', closed: false, + }) + }) + + it('renders the read-only copy through the English dictionary', () => { + const { carrier } = reviewCard() + render() + + expect(screen.getByText(en['review.status'])).toBeTruthy() + fireEvent.click(screen.getByLabelText(en['nav.next'])) + fireEvent.click(screen.getByLabelText(en['nav.next'])) + expect(screen.getByText(en['review.skipped'])).toBeTruthy() + }) +}) diff --git a/packages/client/ui-user-questions/tsconfig.json b/packages/client/ui-user-questions/tsconfig.json index f04457a07a..8368699f96 100644 --- a/packages/client/ui-user-questions/tsconfig.json +++ b/packages/client/ui-user-questions/tsconfig.json @@ -32,6 +32,9 @@ { "path": "../store" }, + { + "path": "../ui-chat/tsconfig.client.json" + }, { "path": "../ui-conversation/tsconfig.client.json" }, @@ -47,8 +50,14 @@ { "path": "../ui-session" }, + { + "path": "../ui-tool" + }, { "path": "../../llm/llm" + }, + { + "path": "../../util/brand" } ] } diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 5c8aa61316..9b84cb4413 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -268,7 +268,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ 'useProjection: UseProjection', 'useTrajectory: UseTrajectory', ], - keyDomain: 'fixed by the owner\'s key table { [Kind in ChatNodeKind]: { node: ChatNode } }, already taken: assistant-step, command, command-input, compaction, context, manual-compaction, model-retry, steering, system-prompt, tool-call, turn-error, turn-max-tokens, turn-process, turn-tail, turn-trigger, unknown, user, workflow-run', + keyDomain: 'fixed by the owner\'s key table { [Kind in ChatNodeKind]: { node: ChatNode } }, already taken: assistant-step, command, command-input, compaction, context, manual-compaction, model-retry, question-reply, steering, system-prompt, tool-call, turn-error, turn-max-tokens, turn-process, turn-tail, turn-trigger, unknown, user, workflow-run', hookContext: 'ChatNodeHookContext', slotInject: 'ChatNodeInjected', declaredBy: 'an entry in \'conversation.view\' (client-ui-chat), so it exists while that entry is mounted', @@ -290,6 +290,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ 'client-ui-chat UnknownNodeView key \'unknown\'', 'client-ui-goal GoalCommandInputView key \'command-input\'', 'client-ui-tool ToolCallTree key \'tool-call\'', + 'client-ui-user-questions QuestionReplyView key \'question-reply\'', 'client-ui-workflow-run WorkflowRunPanel key \'workflow-run\'', ], replaceRisk: 'shadows-shipped-ui', @@ -3973,7 +3974,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'tool.call.images\', () => ctx.slots.register(\n { name: \'tool.call.images\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-tool/src/client/contract/slots.ts:45', + source: 'packages/client/ui-tool/src/client/contract/slots.ts:46', }, { key: 'tool.call.toolview', @@ -4081,7 +4082,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'tool.call.toolview\', () => ctx.slots.register(\n { name: \'tool.call.toolview\', key: \'\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-tool/src/client/contract/slots.ts:25', + source: 'packages/client/ui-tool/src/client/contract/slots.ts:26', }, { key: 'tool.view.cordis', diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts index 04704013e6..e419f6edd9 100644 --- a/packages/extensions/tool-cordis/src/api-catalog.ts +++ b/packages/extensions/tool-cordis/src/api-catalog.ts @@ -3402,6 +3402,26 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [ summary: '`ctx.userQuestions`: validation plus the scoped answerer waterfall.', description: '`ctx.userQuestions`: validation plus the scoped answerer waterfall.', methods: [ + { + signature: '@Remote answer(agent: Agent, callId: ToolCallId, answer: AskUserQuestionAnswer): boolean', + description: 'Answer a continued question. The reply is steered into the agent as a user message whose source names the call; that message is also the record that closes the question in the projection.', + parameters: [{ name: 'agent', description: 'Live root agent for the owning Session.' }, { name: 'callId', description: 'Continued question identity.' }, { name: 'answer', description: 'Complete structured answer batch, one item per question of the call.' }], + returns: 'Whether the question is still continued; an accepted reply stays queued until the agent admits its user message.', + throws: ['{UserQuestionError} `BAD_ANSWER` when the batch does not name each question of the call exactly once, or `REPLY_QUEUED` when a reply is already waiting for admission.'], + }, + { + signature: '@Remote({ mode: \'stream\' }) async *attachWait(agent: Agent, callId: ToolCallId, signal: AbortSignal): AsyncIterable<{ remainingMs: number }>', + description: 'Let one answer UI hold a live timed wait. Closing the stream releases its claim.', + parameters: [{ name: 'agent', description: 'Live root agent owning the question.' }, { name: 'callId', description: 'Foreground tool call to attach to.' }, { name: 'signal', description: 'Remote stream cancellation, including Client disconnect.' }], + returns: 'One Host-computed remaining duration, or no frames once the wait ended.', + }, + { + signature: 'async askTimed( request: AskUserQuestionRequest & { agent: Agent }, callId: ToolCallId, timeoutMs: number, ): Promise', + description: 'Foreground wait whose first settlement the Client decides: the Client rejects with `ASK_TIMED_OUT` when its countdown ends, and this method maps that code to the pending result.', + parameters: [{ name: 'request', description: 'Questions, live owner agent, and abort signal.' }, { name: 'callId', description: 'Tool call identity the Client card is keyed by.' }, { name: 'timeoutMs', description: 'Positive foreground wait in milliseconds.' }], + returns: 'The answer when it arrives inside the window, otherwise a pending result, also when no connected Client claimed the request by the deadline.', + throws: ['{UserQuestionError} `BAD_TIMEOUT` for a non-integer, non-positive, or oversized wait.'], + }, { signature: 'async ask(request: AskUserQuestionRequest): Promise', description: 'Ask the scoped answerer waterfall and wait for the user\'s answer.\n\nWhen a caller supplies an agent, human interaction is valid only for the exact live runtime root. Runtime ownership, not durable session lineage, decides this boundary: an owned child has no human answerer and would block forever, while a lineage-bearing session resumed as a new runtime root may ask normally.', @@ -4549,7 +4569,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'AskUserQuestionRequestEvent', - declaration: 'export interface AskUserQuestionRequestEvent {\n questions: AskUserQuestionItem[];\n agent?: Agent;\n signal?: AbortSignal;\n}', + declaration: 'export interface AskUserQuestionRequestEvent {\n questions: AskUserQuestionItem[];\n agent?: Agent;\n signal?: AbortSignal;\n wait?: {\n callId: ToolCallId;\n timed?: boolean;\n };\n}', }, { name: 'AssembleContext', @@ -7527,6 +7547,10 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'TerminalWaitReason', declaration: 'export type TerminalWaitReason = \'stdin_read\' | \'inferred_idle\' | \'timeout\' | \'session_exit\';', }, + { + name: 'TimedUserQuestionResult', + declaration: 'export type TimedUserQuestionResult = AskUserQuestionAnswer | {\n pending: true;\n callId: ToolCallId;\n};', + }, { name: 'TimeOutOfRangeError', declaration: 'export interface TimeOutOfRangeError {\n readonly code: \'time_out_of_range\';\n readonly message: string;\n}', diff --git a/packages/interaction/README.i18n.yaml b/packages/interaction/README.i18n.yaml index 3b075262a3..c2991eac95 100644 --- a/packages/interaction/README.i18n.yaml +++ b/packages/interaction/README.i18n.yaml @@ -18,8 +18,8 @@ en: ccceebf8138e3e16 zh: fcb20d56fed52173 /interaction-the-human-collaboration-plane/related-documentation: - en: cccdb31d52ad2938 - zh: d63855e30e60cc6d + en: 52ab94f72db8979b + zh: 1f9abbaaf2618f7a /interaction-the-human-collaboration-plane/dev-note: en: 5de1d6304e00c58f zh: 8d8225361cfa29e5 diff --git a/packages/interaction/README.md b/packages/interaction/README.md index 30955da1f7..dc5a3e17eb 100644 --- a/packages/interaction/README.md +++ b/packages/interaction/README.md @@ -42,7 +42,7 @@ Start with the subsystem references for the shared vocabularies, then the neighb - [Commands subsystem](../../docs/subsystems/commands.md) — command registry semantics and the `ctx.commands` Cordis surface. - [Approval subsystem](../../docs/subsystems/approval.md) — request/outcome vocabulary, the answerer waterfall, and per-session policy. - [Permission presets subsystem](../../docs/subsystems/permission-presets.md) — the preset table and the knob write-through. -- [User interaction subsystem](../../docs/subsystems/user-questions.md) — question vocabulary, answerer waterfall, and presentation intent. +- [User interaction subsystem](../../docs/subsystems/user-questions.md) — question vocabulary, answerer waterfall, and pending-question lifecycle. - [ACP group](../acp/README.md) — the automation-only transport that answers approval requests for its own agents. diff --git a/packages/interaction/README.zh.md b/packages/interaction/README.zh.md index 302a4511e6..7182a90cb8 100644 --- a/packages/interaction/README.zh.md +++ b/packages/interaction/README.zh.md @@ -42,7 +42,7 @@ kind: "package-group" - [命令子系统](../../docs/subsystems/commands.zh.md)——命令注册表语义与 `ctx.commands` 的 Cordis 接口面。 - [审批子系统](../../docs/subsystems/approval.zh.md)——请求/结果词汇、应答者瀑布与按会话策略。 - [权限预设子系统](../../docs/subsystems/permission-presets.zh.md)——预设表与旋钮写穿。 -- [用户交互子系统](../../docs/subsystems/user-questions.zh.md)——问题词汇、answerer waterfall 与呈现意图。 +- [用户交互子系统](../../docs/subsystems/user-questions.zh.md)——问题词汇、answerer waterfall 与待处理问题生命周期。 - [ACP 组](../acp/README.zh.md)——仅自动化的传输,为其自有 agent 回答审批请求。 diff --git a/packages/interaction/tool-ask-user/README.i18n.yaml b/packages/interaction/tool-ask-user/README.i18n.yaml index 672066508b..2d3f5f2bc2 100644 --- a/packages/interaction/tool-ask-user/README.i18n.yaml +++ b/packages/interaction/tool-ask-user/README.i18n.yaml @@ -9,32 +9,32 @@ en: 2a561a70c4a900d7 zh: 3d12372992cf2634 /deepseek-ai-dsh-tool-ask-user/summary: - en: 45bb29d463d1e8d2 - zh: a462610ab6e8e61b + en: 1a9a38698a6cb1f3 + zh: 35540765df5648e7 /deepseek-ai-dsh-tool-ask-user/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-tool-ask-user/use-this-package: - en: ed8ec46772509d66 - zh: b06aad135f7a4fa3 + en: 547a3ea61708bc3e + zh: 5e251ea392940c1a /deepseek-ai-dsh-tool-ask-user/use-this-package/when-to-call-the-tool: - en: 5a142d88def1a4fd - zh: 2ae5573abf23d76a + en: 7c70d43d4cd9aa19 + zh: 7597e972067ec5fe /deepseek-ai-dsh-tool-ask-user/use-this-package/what-the-model-gets-back: - en: d0047cb9dda88606 - zh: d3432561db23f65a + en: c30ba8cefa64a287 + zh: cc8bc285ff859983 /deepseek-ai-dsh-tool-ask-user/use-this-package/when-the-call-fails: - en: dd379ed6282761b6 - zh: fa7da19a52091403 + en: c4ac3c584f900230 + zh: bd8d227f0637b8f1 /deepseek-ai-dsh-tool-ask-user/understand-the-implementation: en: e9b9d46be0b45ca2 zh: c02403486473cd80 /deepseek-ai-dsh-tool-ask-user/understand-the-implementation/source-map: - en: 8ce163d8203be215 - zh: 6fd9db8f061b8198 + en: 95a6f15bb08e239b + zh: 9def25d23f0e131d /deepseek-ai-dsh-tool-ask-user/understand-the-implementation/consumer-role: - en: 30c2b751e1b04fe4 - zh: 862c1087ad9c8f66 + en: 7de88d25287b969f + zh: be36dc5a39aeac3b /deepseek-ai-dsh-tool-ask-user/understand-the-implementation/result-rendering: en: 686176b2703dfa08 zh: 4ea4dab0da7f79f9 @@ -48,8 +48,8 @@ en: e4c7376d4f29dbd5 zh: 6b7a9eaf69c9ea53 /deepseek-ai-dsh-tool-ask-user/model-experience/tool-schema/what-the-model-sees: - en: e043611dc8d99927 - zh: 2e4b0e6548f2d64c + en: 577c8609a8bb915d + zh: 8607e0d39be0e492 /deepseek-ai-dsh-tool-ask-user/model-experience/tool-schema/token-effect: en: 97cce067584eadff zh: c376cab39ea9df68 @@ -60,8 +60,8 @@ en: 9717b983b6a857e3 zh: 611a2dadf7c0c706 /deepseek-ai-dsh-tool-ask-user/model-experience/tool-call-history-and-result/what-the-model-sees: - en: d5ba86e2dbdb5b4b - zh: f5a2d6de0d985eed + en: c2ceed515656e10b + zh: 4e9b6768e4914718 /deepseek-ai-dsh-tool-ask-user/model-experience/tool-call-history-and-result/token-effect: en: 3092d4afd4ba8678 zh: cb7a7bbefdbc3a1e @@ -69,8 +69,8 @@ en: f5d5f97a153f7c70 zh: 4db81881ebdcfcc4 /deepseek-ai-dsh-tool-ask-user/known-limitations-and-deferred-work: - en: a0f0f15f51d5affb - zh: 41f11351e852968c + en: c8df1368c2959465 + zh: b14fb07a60e75ebf /deepseek-ai-dsh-tool-ask-user/known-limitations-and-deferred-work/dev-note: - en: e67f633dc6fe7773 - zh: 3bb0c20c93f16f98 + en: 0b06d843322610c1 + zh: a1e7cadd4f03c384 diff --git a/packages/interaction/tool-ask-user/README.md b/packages/interaction/tool-ask-user/README.md index 8987d3a60c..13ff23cb79 100644 --- a/packages/interaction/tool-ask-user/README.md +++ b/packages/interaction/tool-ask-user/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -`ask_user_question` lets a model pause work and ask the human for confirmation, a choice, or missing information. It accepts one or more questions and returns their answers as compact JSON. The call waits until an answer is accepted or the turn is cancelled; if no answer handler accepts it, the model receives an error. A live child agent owned by another agent cannot call this tool and must report unresolved questions in its final result. The package does not render or collect input, so callers must provide a compatible user interaction surface. +`ask_user_question` asks the user for confirmation, a choice, or missing information. It waits for an answer by default. With `mode: timed`, a deadline can release the model to continue independent work while the question stays answerable; `timeout: -1` waits indefinitely. A live child agent cannot call the tool. Callers provide the answer UI. ## Table of Contents @@ -25,11 +25,23 @@ English | [中文](README.zh.md) ## Use this package -Compose this plugin wherever the model should be able to pause for a human decision: it provides the `ask_user_question` tool and needs the `ctx.userQuestions` seam with an answerer that accepts the scoped request. Without one, the tool call fails with an error instead of degrading. +Compose this plugin with `ctx.userQuestions` when the model needs a user decision. Without an answerer, blocking calls fail; finite timed calls return pending at their deadline. + +Shipped presets use blocking mode. To enable timed mode, set `mode: timed` on the `tool-ask-user` row in the active preset's `config.plugins` list: + +```yaml +- id: tool-ask-user + name: '@deepseek-ai/dsh-tool-ask-user' + config: + mode: timed + timeout: 120 +``` + +This is a plugin row, not a top-level `--patch` entry. In the Web profile, change the `preset-standard` plugin list or use the Agent Preset editor. `mode: legacy` or omitted config keeps the blocking schema. The row's `timeout` applies to each timed call by default; `-1` waits indefinitely unless the model supplies a positive timeout. A model-supplied `-1` applies only to that call, including all its questions. ### When to call the tool -The model calls `ask_user_question` when it needs confirmation, a choice, or missing information before proceeding. Send one or more questions, each with a stable `id` that is echoed in the answer; a recommended option goes first with `(Recommended)` appended to its label. +Send one or more questions with ids unique within the call; the answer echoes those ids. Put a recommended option first and append `(Recommended)` to its label. The optional per-call `timeout` is in seconds; use `-1` when work cannot safely continue without an answer. A timeout is never approval. In the Web card, editing or choosing Take time also holds that Client's wait until submission or cancellation. ```json { @@ -49,7 +61,9 @@ The model calls `ask_user_question` when it needs confirmation, a choice, or mis ### What the model gets back -The tool returns one answer object per question: `selected` holds the chosen option labels, and `custom` carries a free-form answer — supplementing `selected` for a multi-select question and overriding it for a single-select question. The Native renderer preserves the compact JSON text shape. +An answer returns one item per question. `selected` holds option labels; `custom` supplements a multi-select answer or replaces a single-select choice. A skipped item has empty `selected` and no `custom`. + +For a finite timed call, `{ "pending": true, "callId": "…" }` means the foreground wait ended without an answer. The question remains answerable, and the model may continue independent work. A later answer arrives as a user message identified by `kind`, `tool`, and `callId`. Web chat pairs its questions and answers; other consumers receive compact JSON text. ```json { "answers": [{ "id": "cleanup", "selected": ["Yes, delete them (Recommended)"] }] } @@ -57,7 +71,7 @@ The tool returns one answer object per question: `selected` holds the chosen opt ### When the call fails -The tool call blocks until the human answers and cancels only through the turn's signal. No accepting answerer, an aborted call, or a caller that is not the exact live runtime root each settles as an error the model sees in the tool result — most notably, a live child agent owned by another agent is rejected (`DELEGATED_CALLER`) and must include the unresolved question or decision in its final result. +Legacy and `timeout: -1` calls wait for an answer or cancellation; without an accepting answerer, they return an error. A finite timed call without an answerer returns pending at its deadline. Cancellation and a caller that is not the exact live runtime root also return errors. A live child agent is rejected with `DELEGATED_CALLER` and must include the unresolved decision in its final result. ----- @@ -73,12 +87,13 @@ The observable behavior is covered in [Use this package](#use-this-package); thi | File | Role | |---|---| -| [`src/index.ts`](src/index.ts) | Tool registration: `ask_user_question` schema, execute path, result render | +| [`src/index.ts`](src/index.ts) | Default blocking tool definition and mode selection | +| [`src/timed.ts`](src/timed.ts) | Opt-in timed tool definition and result rendering | | — | No runtime invariant companion is published; this model-facing adapter has no independent lifecycle stream; execution relations are owned by the capability seam it calls. | ### Consumer role -The plugin registers one `defineTool` entry on `ctx.tools` with injects `['tools', 'userQuestions']`. `execute` maps model arguments into an `AskUserQuestionRequest`, forwards the exact calling agent and the turn's signal, and maps the accepted answer back into the canonical `answers` array. The seam owns identity checks, intent validation, waterfall dispatch, and the error taxonomy; this package only translates. +The plugin registers one tool definition. Legacy mode calls `ask()`; timed mode calls `askTimed()` for positive timeouts and `ask()` for `-1`. Both forward the calling agent and turn signal to `ctx.userQuestions`. Timed requests include the tool call id in `wait`, so a Client can reopen their card. The projection identifies timed native calls from the `timeout` field in the recorded tool schema, even when a call omits that argument. ### Result rendering @@ -107,7 +122,7 @@ Read these pages when the package-level contract is not enough. They move from t #### What the model sees -The model sees the generated [`ask_user_question` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-ask-user), including question ids, prompts, headings, options, and multi-select flags. +The shipped presets expose the original blocking [`ask_user_question` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-ask-user). A custom Cordis row with `mode: timed` switches to the alternate schema, including question ids, prompts, headings, options, multi-select flags, `timeout`, and the pending result; the model sees only the selected definition. #### Token effect @@ -121,7 +136,7 @@ Prefix-stable while the definition and visibility are unchanged. Plugin lifecycl #### What the model sees -The model's full questions remain in the assistant tool-call arguments. After the human answers, the next step sees compact JSON in the exact shape `{"answers":[{"id":"","selected":["