@sema-agent/client-core 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/adapt.d.ts +17 -3
  2. package/dist/adapt.js +555 -36
  3. package/dist/clientSlice.d.ts +169 -0
  4. package/dist/clientSlice.js +62 -0
  5. package/dist/diff/patch.d.ts +29 -0
  6. package/dist/diff/patch.js +45 -0
  7. package/dist/engineSessionParam.d.ts +7 -0
  8. package/dist/engineSessionParam.js +35 -0
  9. package/dist/engineWireSdk.d.ts +25 -1
  10. package/dist/engineWireSdk.js +30 -4
  11. package/dist/finalVerifyWire.d.ts +74 -0
  12. package/dist/finalVerifyWire.js +63 -0
  13. package/dist/headlessPermissionModeWire.d.ts +55 -0
  14. package/dist/headlessPermissionModeWire.js +111 -0
  15. package/dist/headlessReconnectWire.d.ts +96 -0
  16. package/dist/headlessReconnectWire.js +141 -0
  17. package/dist/host.d.ts +90 -0
  18. package/dist/host.js +84 -0
  19. package/dist/index.d.ts +36 -1
  20. package/dist/index.js +48 -3
  21. package/dist/interactiveToolsWire.d.ts +48 -0
  22. package/dist/interactiveToolsWire.js +86 -0
  23. package/dist/limitsWire.d.ts +89 -0
  24. package/dist/limitsWire.js +225 -0
  25. package/dist/notifications.d.ts +7 -0
  26. package/dist/notifications.js +32 -0
  27. package/dist/request/taskRequest.d.ts +135 -0
  28. package/dist/request/taskRequest.js +176 -0
  29. package/dist/sandboxWire.d.ts +75 -0
  30. package/dist/sandboxWire.js +138 -0
  31. package/dist/scenarioWire.d.ts +62 -0
  32. package/dist/scenarioWire.js +115 -0
  33. package/dist/scratchpadWireCaps.d.ts +16 -0
  34. package/dist/scratchpadWireCaps.js +65 -0
  35. package/dist/seam.d.ts +114 -11
  36. package/dist/seam.js +31 -0
  37. package/dist/toolResult.d.ts +118 -0
  38. package/dist/toolResult.js +774 -0
  39. package/package.json +4 -2
package/dist/adapt.d.ts CHANGED
@@ -38,6 +38,15 @@ export declare const CANCEL_MESSAGE = "The user doesn't want to take this action
38
38
  /** CJK 加权 token 估算(cli estimateCjkTokens 逐字:CJK≈0.6,其余≈0.25 tok/char)。 */
39
39
  export declare function estimateCjkTokens(s: string): number;
40
40
  /** 引擎 subagent 卡的短标签(cli shortTaskLabel 逐字)。 */
41
+ /**
42
+ * T8 —— 压平 §E1 wire `output`(**非均匀**:`string` | `(TextContent|ImageContent)[]`,events.d.ts:78)
43
+ * 成一条纯文本(cli `flattenWireOutput` 逐字)。text 块贡献 `.text`,image 块贡献中性占位 `[image]`
44
+ * (转录卡是文本粒度),裸字符串直通。
45
+ * 🔴 载荷 UNTRUSTED + 仅供观测(events.d.ts:80-85):渲染可以,**绝不回喂模型**;`truncated` 的更不行。
46
+ * B4 把它从 B 层(`wireOutputToBody`)提到独立导出:A 层的 `settlePanelTasks(report)` 也要用它
47
+ * (关卡时把子代最终报告串到面板行 end 事件上),两处必须同一份实现。
48
+ */
49
+ export declare function flattenWireOutput(output: unknown): string;
41
50
  export declare function shortTaskLabel(task: string): string;
42
51
  /**
43
52
  * tool_use 块的渲染面消毒(cli assistant 臂逐条搬运,**纯函数**,不改入参):
@@ -53,6 +62,7 @@ export declare function sanitizeToolUseBlock(block: Record<string, unknown>): {
53
62
  rawInput: unknown;
54
63
  eventId?: string;
55
64
  parentToolCallId?: string;
65
+ label?: string;
56
66
  };
57
67
  /** 台账序列化形(#63 回植:重启恢复 = 台账加载 + 纯重放)。 */
58
68
  export interface AdapterLedgerState {
@@ -67,16 +77,20 @@ export interface AdapterLedgerState {
67
77
  /** 本批覆盖清单——差分守卫按它区分「已覆盖臂必须逐字段等价」与「已声明未覆盖臂」。 */
68
78
  export declare const ADAPTER_COVERAGE: {
69
79
  /** 已落码的帧臂。 */
70
- readonly frames: readonly ["assistant", "user", "stream_event", "turn_usage", "result", "system", "task_notification", "workflow_complete", "diagnostics", "steering_injected", "workspace_changed", "retry_status", "tool_end_result( response-id 复位 + 开卡台账出栈,不铸 tool_result)"];
80
+ readonly frames: readonly ["assistant", "user", "stream_event", "turn_usage", "result", "system", "task_notification", "workflow_complete", "diagnostics", "steering_injected", "workspace_changed", "prompt_suggestions", "retry_status", "task_progress", "tool_end_result(label 补位 + 关卡 settle + response-id 复位 + 开卡台账出栈;不铸 tool_result)"];
71
81
  /** 已落码臂产出的 transcript 消息类目(差分守卫的比对域)。 */
72
82
  readonly transcriptKinds: readonly ["assistant_text", "assistant_thinking", "assistant_tool_use", "user_tool_result_decision", "user_task_notification", "system_passthrough"];
73
83
  /** B3(0.5.0)新落码的臂/半场 —— 从 todo 移过来的,别再在 todo 里留同名条目。 */
74
84
  readonly b3: readonly ["T38 三清第三清 + T57 第五处断闸:prompt_suggestions(turn 开场作废 + 子流断闸)", "T40 IDLE-FLUSH 1.5s 竞速(需 ctx.setTimer;缺席=不启用)", "T58 手动 iterator 的 finally cleanup(early break/throw 都要关上游生成器)", "T59 abort 半场(ctx.signal;中断后不产终答)", "T60 无 result 收尾腿(泄尾增量 → 清 liveness → 尾思考 → 尾文本段)"];
85
+ /** B4(0.6.0)新落码的臂/半场 —— A 层收官批,同样别再在 todo 里留同名条目。 */
86
+ readonly b4: readonly ["A 层第 14 臂 task_progress:workflow lane 三级门 + 判据④ belt 回植 + C1 alias + bindTaskCard(显式父/FIFO/含糊即 unbound)+ inline stats + T50 双形读 + SubagentStart + #6 resident 台账 + 面板 tick", "settlePanelTasks 三处 sweep 全接线(tool_end 显式关卡带报告 / result 防御 sweep / turn 末 + abort sweep)", "P0-2 tool label 侧信道(sanitizeToolUseBlock 摘 label + engineToolLabelStore 登记;0.5.0 真缺口,label 会随 tool_use block 落转录 → /compact 直发 provider 400)", "task_notification 的两件宿主义务收回库内自持:dropQueuedNotificationsForRun + clearEnginePanelTaskResident;stop hook 的 if-started 门由库解", "T8 flattenWireOutput 提为独立导出(A 层 settle 报告与 B 层卡体同一份)"];
87
+ /** B5(0.7.0)新落码的臂/半场 —— B/D/E 层收批,同样别再在 todo 里留同名条目。 */
88
+ readonly b5: readonly ["B 层 structuredToToolUseResult 14 case(ask-user-question/bash/edit/create/update/text/grep/glob/notebook-edit/cron-create/cron-delete/cron-list/agent/task-output)+ workflow-run 登记副作用", "D 层 wireOutputToBody 3 臂(bash / taskoutput / 泛化);structured 白名单在场时 T11+T14 正则退位,缺席保回落", "E 层 4 臂:#117a bg Bash 回执(判定在库→chrome bgshell_register)· TodoWrite oldTodos 富卡 · ReportFindings 按名认领 · Remember→memory_saved 系统消息", "tool_end_result → user tool_result 正常路径(卡本体);result 与 turn 末两处开卡兜底关闭(abort 不兜底,cli 同)", "task/task-list structured → chrome task_ledger_sync{source:\"structured\"}(判定归一在库、落盘留宿主)", "T7 诚实缺席(§8-4:不搬 mock 合成器,改 degraded 标记)· T20 diff hunks 进包(src/diff/patch.ts)"];
75
89
  /** 如实留白——写不动/依赖未搬运资产的臂,#52b 起分批接。 */
76
- readonly todo: readonly ["tool_end_result user tool_result 正常路径(需搬 wireOutputToBody/structuredToToolUseResult/mock 合成器 + TodoWrite/ReportFindings 富卡片,约 600 行;workflow 轮询信封的人话投影已在 workflow.ts 就位,等这条接线)", "tool_end_result 的两个侧产物:Remember → memory_saved 系统消息、task/task-list structured 面板台账全量同步", "result/turn 末的开卡兜底关闭(同上,依赖合成器)", "task_progress 面板行绑定(bindTaskCard FIFO/显式父、inline stats、alias、resident 台账、SubagentStart hook、workflow lane 三级门)", "settlePanelTasks 三处 sweep(依赖上面的行台账)", "#117a bg Bash 回执探测(detectEngineBgShellReceipt 文案锚定探测器)", "abort 半场里依赖行台账的两件:settlePanelTasks 兜底 sweep + 开卡合成器兜底关卡(见上面两条)", "macrotask 让渡(cli 在提交前让出宏任务给 Ink;宿主渲染策略,不进库)"];
90
+ readonly todo: readonly ["T13 **D 层** 半场(taskoutput block content)未随 structured 退位:退位会改 block content 形状(cli 那里是裸对象 = 件1 隐患),属行为面改动,无真实需求驱动 DIVERGENCE-8", "macrotask 让渡(cli 在提交前让出宏任务给 Ink;宿主渲染策略,不进库)"];
77
91
  };
78
92
  /** 本批**已知的、有意的**行为分歧(差分守卫显式登记,绝不当等价) */
79
- export declare const ADAPTER_DIVERGENCES: readonly [string, string, string, string];
93
+ export declare const ADAPTER_DIVERGENCES: readonly [string, string, string, string, string, string, string, string, string];
80
94
  /** 有台账序列化位的适配器(seam 的 WireToCcAdapter 只定了 exportLedger——见 SEAM-GAP-1)。 */
81
95
  export interface WireToCcAdapterWithLedger extends WireToCcAdapter {
82
96
  exportLedger(): AdapterLedgerState & Record<string, unknown>;