@sema-agent/client-core 0.11.13 → 0.11.14

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ Renamed from **`@sema-agent/wire-cc-adapter`** (0.1.x, deprecated — see *Migra
23
23
 
24
24
  ## Scope
25
25
 
26
- **Version:** 0.11.12
26
+ **Version:** 0.11.14
27
27
 
28
28
  - **Today** — the adapter seam, the whole `adapt()` pipeline (all 14 A-layer arms plus the
29
29
  B/D/E tool-card layers), the notification/caps/model families, the adapter kernel (stream driver
@@ -100,6 +100,9 @@ export interface AskGateWireDeps {
100
100
  * tool_approval 帧(帧被吞、引擎按自身 fail-closed TTL 自决)——mock/旧引擎路径零影响。 */
101
101
  respondToolApproval?: RespondToolApprovalFn;
102
102
  }
103
+ /** core 对被 gate/连坐 abort 的 call 铸的 tool_end 载体(逐字;desktop session-host 真引擎实测
104
+ * 同款)——HOLD 谓词锚它做**精确等值**,普通工具错的输出是各自错误文案,永不进 HOLD。 */
105
+ export declare const ENGINE_ABORT_TOOL_RESULT = "Operation aborted";
103
106
  /** CC AskUserQuestion outputSchema 形状(答过的问题卡):toolResult 的 `ask-user-question` arm
104
107
  * 消费它渲真实答案卡(否则「诚实缺席」路径会把这张卡渲成结果不可用)。 */
105
108
  export interface AskAnsweredOutput {
@@ -38,6 +38,9 @@ function rejectMessageForRender() {
38
38
  }
39
39
  /** 一 turn 内最多循环这么多次 park(防御:引擎/模型病态连环提问时不无限 attach)。 */
40
40
  const MAX_GATE_HOPS = 24;
41
+ /** core 对被 gate/连坐 abort 的 call 铸的 tool_end 载体(逐字;desktop session-host 真引擎实测
42
+ * 同款)——HOLD 谓词锚它做**精确等值**,普通工具错的输出是各自错误文案,永不进 HOLD。 */
43
+ export const ENGINE_ABORT_TOOL_RESULT = 'Operation aborted';
41
44
  function isAskTool(name) {
42
45
  return typeof name === 'string' && name.replace(/[\s_-]+/g, '').toLowerCase() === 'askuserquestion';
43
46
  }
@@ -297,18 +300,18 @@ export async function* bridgeAskUserQuestionGates(source, deps, opts) {
297
300
  const seq = ev.id;
298
301
  if (typeof seq === 'string' && seq.length > 0)
299
302
  lastSeq = seq;
300
- // ── [2084]① 扣留帧「模型推进即放行」(2026-07-30)─────────────────────────────────────
301
- // HOLD 的本意只护 park 窗口:毒化 tool_end park 信号(suspended/done-park/approval 帧)
302
- // 之间只会隔 sibling tool_end 与通知类帧——引擎 park 时模型**不可能**推进。反之,host-lane
303
- // text_delta/reasoning_delta/tool_start/turn_end 任一到达 = 没有 park 会来,扣着的是
304
- // **真工具错**,立即放行。修前真错只能等终帧 flush `-p` stream-json errored Edit/Write
305
- // 结果滞后无上界(test 生产轨迹最大 195 行,repro/cli-tool-streamjson-failed-result-delayed)。
303
+ // ── [2084]① 扣留帧「模型推进即放行」(2026-07-30;同日 web 复审纠偏收窄触发集)──────────
304
+ // HOLD 只护 park 窗口。放行触发集 = host-lane **模型推进**帧:text_delta/reasoning_delta/
305
+ // tool_start —— park 路径上这三种在 done{suspended} 之前不会出现,真错路径上下一轮必来其一。
306
+ // 🔴 turn_end 明确**不在**触发集(初版在,web 复审真机轨迹逮红):core agent-loop turn_end
307
+ // emit executeToolCalls 之后**无 abort/suspend 守卫**(邻臂都有,唯此一处没有)⇒ park
308
+ // 的帧序是 tool_end(毒化)→ message_committed turn_end → done{suspended},turn_end 若放行
309
+ // 会把毒化帧漏上屏,且 flushHeld 的 endedCalls 记账让 decide 后重放的解答帧被当已收口丢弃
310
+ // (真实答案卡永不出现)。代价 = turn 末尾无后续推进帧的 abort 形帧等到终帧 flush,与修前同。
306
311
  // parentToolCallId 在场 = sub-agent 行帧,park 期间孙代照常说话,不算 host 推进(负控①C)。
312
+ // (普通工具错自 [2084]①-b 谓词收窄后根本不进 HOLD,零滞后不依赖本触发集。)
307
313
  if (heldAskEnds.size > 0 &&
308
- (ev.type === 'text_delta' ||
309
- ev.type === 'reasoning_delta' ||
310
- ev.type === 'tool_start' ||
311
- ev.type === 'turn_end') &&
314
+ (ev.type === 'text_delta' || ev.type === 'reasoning_delta' || ev.type === 'tool_start') &&
312
315
  ev.parentToolCallId === undefined) {
313
316
  yield* flushHeld();
314
317
  }
@@ -426,8 +429,16 @@ export async function* bridgeAskUserQuestionGates(source, deps, opts) {
426
429
  yield { ...ev, output: rejectMessageForRender(), structured: undefined };
427
430
  continue;
428
431
  }
429
- heldAskEnds.set(ev.toolCallId, ev); // park 毒化帧,先 HOLD(gate 定性前不渲 Error 卡)
430
- continue;
432
+ // [2084]①-b HOLD 谓词收窄(2026-07-30,desktop 复审建议采纳):park 毒化帧的载体是
433
+ // **确切的引擎 abort 标记**(core 对被 gate/连坐 abort 的 call 铸
434
+ // `tool_end{isError:true, output:"Operation aborted"}`;desktop session-host 2026-07-29
435
+ // 对真引擎实测同款)。普通工具错(old_string 不命中/read-gate 拒绝…)输出是各自的错误
436
+ // 文案,**根本不该进 HOLD**——收窄后它们零滞后直达转录,不再依赖「推进信号放行」。
437
+ if (ev.output === ENGINE_ABORT_TOOL_RESULT) {
438
+ heldAskEnds.set(ev.toolCallId, ev); // park 毒化帧,先 HOLD(gate 定性前不渲 Error 卡)
439
+ continue;
440
+ }
441
+ // 普通失败:落到下方通用收口路径,立即上屏。
431
442
  }
432
443
  endedCalls.add(ev.toolCallId);
433
444
  heldAskEnds.delete(ev.toolCallId); // 正常收口(重放的 isError:false 解答帧)赢
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/client-core",
3
- "version": "0.11.13",
3
+ "version": "0.11.14",
4
4
  "description": "Client-side session runtime shared by every sema human client (TUI / web / desktop): sema wire frames (AgentEvent) -> CC session vocabulary (SDKMessage) with dual-plane output (transcript/chrome), deterministic transcript ids, lane discipline as a type, and the notification/dedup ledgers. Every CC-skin shape is collected here so the wire itself stays neutral. Blackboard [1832] design axioms; [1651]/[1652]/[1653] signed seam design. Renamed from @sema-agent/wire-cc-adapter (0.1.x).",
5
5
  "license": "MIT",
6
6
  "type": "module",