@sema-agent/cli 1.0.122 → 1.0.123

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/sema-main.js CHANGED
@@ -4331,9 +4331,143 @@ function isEnginePanelTaskResident(taskId) {
4331
4331
  return residentTaskIds.has(taskId);
4332
4332
  }
4333
4333
  function launchAnchorChanged(prev, next) {
4334
- return prev.kind !== "fleet-row" || next.kind !== "fleet-row" ? !1 : prev.startedAt !== void 0 && next.startedAt !== void 0 && prev.startedAt !== next.startedAt;
4334
+ return prev.kind !== "fleet-row" || next.kind !== "fleet-row" ? !1 : prev.cycleSeq !== void 0 && next.cycleSeq !== void 0 && prev.cycleSeq !== next.cycleSeq ? !0 : prev.startedAt !== void 0 && next.startedAt !== void 0 && prev.startedAt !== next.startedAt;
4335
+ }
4336
+ function cycleSeqOf(v2) {
4337
+ let n2 = v2?.cycleSeq;
4338
+ return typeof n2 == "number" && Number.isInteger(n2) && n2 >= 1 ? n2 : void 0;
4339
+ }
4340
+ function startedAtOf(v2) {
4341
+ let n2 = v2?.startedAt;
4342
+ return typeof n2 == "number" && Number.isFinite(n2) && n2 > 0 ? n2 : void 0;
4343
+ }
4344
+ function isStaleEngineAgentPanelEnd(end, current6) {
4345
+ let ec2 = cycleSeqOf(end), cc = cycleSeqOf(current6);
4346
+ if (ec2 !== void 0 && cc !== void 0)
4347
+ return ec2 < cc;
4348
+ let es = startedAtOf(end), cs = startedAtOf(current6);
4349
+ return es !== void 0 && cs !== void 0 ? es < cs : !1;
4350
+ }
4351
+ function remember(map2, key, alias2) {
4352
+ if (map2.delete(key), map2.set(key, alias2), map2.size > MAX_IDENTITY_KEYS) {
4353
+ let oldest = map2.keys().next().value;
4354
+ oldest !== void 0 && map2.delete(oldest);
4355
+ }
4356
+ }
4357
+ function resolveEnginePanelTaskId(wireTaskId, parentToolCallId) {
4358
+ let byTranscript = fleetIdByTranscriptId.get(wireTaskId);
4359
+ if (byTranscript !== void 0)
4360
+ return remember(fleetIdByTranscriptId, wireTaskId, byTranscript), identityOf(byTranscript);
4361
+ let byParent = parentToolCallId !== void 0 ? fleetIdByParentToolCallId.get(parentToolCallId) : void 0;
4362
+ return byParent !== void 0 ? (remember(fleetIdByParentToolCallId, parentToolCallId, byParent), identityOf(byParent)) : { taskId: wireTaskId, origin: "wire" };
4363
+ }
4364
+ function identityOf(alias2) {
4365
+ return {
4366
+ taskId: alias2.fleetId,
4367
+ origin: "fleet-row",
4368
+ ...alias2.cycleSeq !== void 0 ? { cycleSeq: alias2.cycleSeq } : {},
4369
+ ...alias2.startedAt !== void 0 ? { startedAt: alias2.startedAt } : {}
4370
+ };
4371
+ }
4372
+ function rememberResolvedWire(wireTaskId, id) {
4373
+ fleetIdByTranscriptId.has(wireTaskId) || remember(fleetIdByTranscriptId, wireTaskId, {
4374
+ fleetId: id.taskId,
4375
+ ...id.cycleSeq !== void 0 ? { cycleSeq: id.cycleSeq } : {},
4376
+ ...id.startedAt !== void 0 ? { startedAt: id.startedAt } : {}
4377
+ });
4378
+ }
4379
+ function ageHeld(except) {
4380
+ for (let [wireId, held] of [...heldWireTicks])
4381
+ wireId !== except && (held.beats += 1, held.beats >= MAX_HELD_WIRE_TICK_BEATS && (heldWireTicks.delete(wireId), deliverEngineAgentPanelEvent(asIsTick(held.ev))));
4382
+ }
4383
+ function migrateResidency(wireTaskId, fleetId) {
4384
+ wireTaskId !== fleetId && residentTaskIds.has(wireTaskId) && (residentTaskIds.delete(wireTaskId), residentTaskIds.add(fleetId));
4385
+ }
4386
+ function normalizedTick(ev, fleetId) {
4387
+ let { cardBound: _cardBound, ...rest } = ev;
4388
+ return migrateResidency(ev.taskId, fleetId), { ...rest, taskId: fleetId, wireTaskId: ev.taskId, taskIdOrigin: "fleet-row" };
4389
+ }
4390
+ function asIsTick(ev) {
4391
+ let { cardBound: _cardBound, ...rest } = ev;
4392
+ return { ...rest, taskIdOrigin: "wire" };
4393
+ }
4394
+ function flushHeld(wireTaskId) {
4395
+ let held = heldWireTicks.get(wireTaskId);
4396
+ if (held === void 0)
4397
+ return;
4398
+ heldWireTicks.delete(wireTaskId);
4399
+ let id = resolveEnginePanelTaskId(held.ev.taskId, held.ev.parentToolCallId);
4400
+ id.origin === "fleet-row" && rememberResolvedWire(held.ev.taskId, id), deliverEngineAgentPanelEvent(id.origin === "fleet-row" ? normalizedTick(held.ev, id.taskId) : asIsTick(held.ev));
4401
+ }
4402
+ function clearEnginePanelTaskResidentByWire(wireTaskId) {
4403
+ residentTaskIds.delete(wireTaskId);
4404
+ let id = resolveEnginePanelTaskId(wireTaskId);
4405
+ id.taskId !== wireTaskId && (isStaleEngineAgentPanelEnd(id, latestCycleByFleetId.get(id.taskId)) || residentTaskIds.delete(id.taskId));
4406
+ }
4407
+ function __resetEngineAgentPanelIdentityForTests() {
4408
+ fleetIdByTranscriptId.clear(), fleetIdByParentToolCallId.clear(), heldWireTicks.clear(), latestCycleByFleetId.clear();
4335
4409
  }
4336
4410
  function publishEngineAgentPanelEvent(ev) {
4411
+ switch ((ev.kind === "end" || ev.kind === "sweep") && ageHeld(ev.kind === "sweep" ? void 0 : ev.taskId), ev.kind) {
4412
+ case "fleet-row": {
4413
+ let alias2 = {
4414
+ fleetId: ev.taskId,
4415
+ ...ev.cycleSeq !== void 0 ? { cycleSeq: ev.cycleSeq } : {},
4416
+ ...ev.startedAt !== void 0 ? { startedAt: ev.startedAt } : {}
4417
+ };
4418
+ if ((alias2.cycleSeq !== void 0 || alias2.startedAt !== void 0) && (latestCycleByFleetId.delete(ev.taskId), latestCycleByFleetId.set(ev.taskId, { ...alias2.cycleSeq !== void 0 ? { cycleSeq: alias2.cycleSeq } : {}, ...alias2.startedAt !== void 0 ? { startedAt: alias2.startedAt } : {} }), latestCycleByFleetId.size > MAX_IDENTITY_KEYS)) {
4419
+ let oldest = latestCycleByFleetId.keys().next().value;
4420
+ oldest !== void 0 && latestCycleByFleetId.delete(oldest);
4421
+ }
4422
+ ev.transcriptId !== void 0 && ev.transcriptId.length > 0 && remember(fleetIdByTranscriptId, ev.transcriptId, alias2), ev.parentToolCallId !== void 0 && ev.parentToolCallId.length > 0 && remember(fleetIdByParentToolCallId, ev.parentToolCallId, alias2), deliverEngineAgentPanelEvent(ev);
4423
+ for (let [wireId, held] of [...heldWireTicks])
4424
+ (wireId === ev.transcriptId || held.ev.parentToolCallId !== void 0 && held.ev.parentToolCallId === ev.parentToolCallId) && flushHeld(wireId);
4425
+ ageHeld(void 0);
4426
+ return;
4427
+ }
4428
+ case "tick": {
4429
+ let id = resolveEnginePanelTaskId(ev.taskId, ev.parentToolCallId);
4430
+ if (id.origin === "fleet-row") {
4431
+ heldWireTicks.delete(ev.taskId), rememberResolvedWire(ev.taskId, id), deliverEngineAgentPanelEvent(normalizedTick(ev, id.taskId));
4432
+ return;
4433
+ }
4434
+ if (ev.cardBound === !0) {
4435
+ deliverEngineAgentPanelEvent(asIsTick(ev));
4436
+ return;
4437
+ }
4438
+ if (heldWireTicks.has(ev.taskId)) {
4439
+ heldWireTicks.delete(ev.taskId), deliverEngineAgentPanelEvent(asIsTick(ev));
4440
+ return;
4441
+ }
4442
+ if (heldWireTicks.size >= MAX_HELD_WIRE_TICKS) {
4443
+ let oldest = heldWireTicks.keys().next().value;
4444
+ oldest !== void 0 && flushHeld(oldest);
4445
+ }
4446
+ heldWireTicks.set(ev.taskId, { ev, beats: 0 });
4447
+ return;
4448
+ }
4449
+ case "end": {
4450
+ let id = resolveEnginePanelTaskId(ev.taskId);
4451
+ if (id.origin === "fleet-row" && id.taskId !== ev.taskId) {
4452
+ flushHeld(ev.taskId), migrateResidency(ev.taskId, id.taskId), deliverEngineAgentPanelEvent({
4453
+ ...ev,
4454
+ taskId: id.taskId,
4455
+ wireTaskId: ev.taskId,
4456
+ taskIdOrigin: "fleet-row",
4457
+ // end 自己不带周期身份(流内 close 臂恒不带)⇒ 借钥匙上的:复活后迟到的 end{旧 UUID} 由此带着旧代际,消费端按 isStaleEngineAgentPanelEnd 挡掉
4458
+ ...ev.cycleSeq === void 0 && id.cycleSeq !== void 0 ? { cycleSeq: id.cycleSeq } : {},
4459
+ ...ev.startedAt === void 0 && id.startedAt !== void 0 ? { startedAt: id.startedAt } : {}
4460
+ });
4461
+ return;
4462
+ }
4463
+ flushHeld(ev.taskId), deliverEngineAgentPanelEvent(ev);
4464
+ return;
4465
+ }
4466
+ default:
4467
+ deliverEngineAgentPanelEvent(ev);
4468
+ }
4469
+ }
4470
+ function deliverEngineAgentPanelEvent(ev) {
4337
4471
  if (ev.kind !== "sweep" && absenceBuffer.delete(ev.taskId), listener) {
4338
4472
  try {
4339
4473
  listener(ev);
@@ -4421,13 +4555,14 @@ function subscribeEngineAgentPanelAbsence(fn2) {
4421
4555
  function __resetEngineAgentPanelAbsenceForTests() {
4422
4556
  absenceListener = null, absenceBuffer.clear();
4423
4557
  }
4424
- var PANEL_TOOLUSES_LANE_POLICY, residentTaskIds, MAX_BUFFER, listener, buffer, MAX_ABSENCE_BUFFER, absenceListener, absenceBuffer, init_engineAgentPanelStore = __esm({
4558
+ var PANEL_TOOLUSES_LANE_POLICY, residentTaskIds, MAX_BUFFER, listener, buffer, MAX_IDENTITY_KEYS, MAX_HELD_WIRE_TICKS, MAX_HELD_WIRE_TICK_BEATS, fleetIdByTranscriptId, fleetIdByParentToolCallId, heldWireTicks, latestCycleByFleetId, MAX_ABSENCE_BUFFER, absenceListener, absenceBuffer, init_engineAgentPanelStore = __esm({
4425
4559
  "node_modules/@sema-agent/client-core/dist/engineAgentPanelStore.js"() {
4426
4560
  PANEL_TOOLUSES_LANE_POLICY = {
4427
4561
  tick: "required-engine-always-emits",
4428
4562
  "fleet-row": "optional-tolerate-absent"
4429
4563
  }, residentTaskIds = /* @__PURE__ */ new Set();
4430
4564
  MAX_BUFFER = 200, listener = null, buffer = [];
4565
+ MAX_IDENTITY_KEYS = 2048, MAX_HELD_WIRE_TICKS = 64, MAX_HELD_WIRE_TICK_BEATS = 16, fleetIdByTranscriptId = /* @__PURE__ */ new Map(), fleetIdByParentToolCallId = /* @__PURE__ */ new Map(), heldWireTicks = /* @__PURE__ */ new Map(), latestCycleByFleetId = /* @__PURE__ */ new Map();
4431
4566
  MAX_ABSENCE_BUFFER = 200, absenceListener = null, absenceBuffer = /* @__PURE__ */ new Map();
4432
4567
  }
4433
4568
  });
@@ -4974,7 +5109,10 @@ function enqueueBgChildNotification(n2) {
4974
5109
  // 而 core [6908] 的 `blocked` 是 **agent 自报的终态**(不是等人)⇒ 一条自报走不下去的
4975
5110
  // 后台 run 在面板上被 settle 成**成功**。🔴 `suspended`/`needs_review` 仍不在表里
4976
5111
  // (那两词是「等一次人的决定」,判成终局会把一条正等着你的 run 在面板上判死)。
4977
- isError: isTerminalNotSuccess(n2.status)
5112
+ isError: isTerminalNotSuccess(n2.status),
5113
+ // 0.74.0:周期身份 —— **wire 真给了 seq 才带**。上面的 `cycle` 是去重键用的归一值(缺席归一成首周期),
5114
+ // 那是键不是事实;把它上屏等于对一条没报代际的通知声称「这是第一代」。
5115
+ ...typeof n2.seq == "number" && Number.isInteger(n2.seq) && n2.seq >= BG_FIRST_SEQ ? { cycleSeq: n2.seq } : {}
4978
5116
  });
4979
5117
  } catch {
4980
5118
  }
@@ -7115,7 +7253,7 @@ var init_toolCards = __esm({
7115
7253
 
7116
7254
  // node_modules/@sema-agent/client-core/dist/adapt/panelTasks.js
7117
7255
  function createPanelTaskLedger(ctx, cards, inst) {
7118
- let taskCardBinding = /* @__PURE__ */ new Map(), boundToolCalls = /* @__PURE__ */ new Set(), livePanelTasks = /* @__PURE__ */ new Set(), endedPanelTasks = /* @__PURE__ */ new Set(), liveBoundPanelTasks = /* @__PURE__ */ new Set(), subagentTypeById = /* @__PURE__ */ new Map(), laneOf = (taskId) => {
7256
+ let taskCardBinding = /* @__PURE__ */ new Map(), boundToolCalls = /* @__PURE__ */ new Set(), livePanelTasks = /* @__PURE__ */ new Set(), endedPanelTasks = /* @__PURE__ */ new Set(), liveBoundPanelTasks = /* @__PURE__ */ new Set(), clearResidencyBothKeys = (taskId) => clearEnginePanelTaskResidentByWire(taskId), subagentTypeById = /* @__PURE__ */ new Map(), laneOf = (taskId) => {
7119
7257
  let card = taskCardBinding.get(taskId);
7120
7258
  return card !== void 0 ? { lane: "subagent", parentToolCallId: card } : MAIN;
7121
7259
  };
@@ -7160,8 +7298,8 @@ function createPanelTaskLedger(ctx, cards, inst) {
7160
7298
  },
7161
7299
  // #6 session 常驻台账:live-bound(卡本 turn 开着)= 本 turn 生命周期,turn 末可 sweep;
7162
7300
  // inert/unbound(跨 turn bg 子代形)= 常驻,两处 sweep 都放行,终态只认通知帧。
7163
- noteResidency: (taskId) => {
7164
- liveBoundPanelTasks.has(taskId) ? clearEnginePanelTaskResident(taskId) : markEnginePanelTaskResident(taskId);
7301
+ noteResidency: (taskId, residentKey = taskId) => {
7302
+ liveBoundPanelTasks.has(taskId) ? clearEnginePanelTaskResident(residentKey) : markEnginePanelTaskResident(residentKey);
7165
7303
  },
7166
7304
  /** SubagentStart(cli fireSubagentStartHook 的臂化):类型恒记,fire 一生一次。 */
7167
7305
  *start(taskId, agentType) {
@@ -7208,7 +7346,7 @@ function createPanelTaskLedger(ctx, cards, inst) {
7208
7346
  * (清一次幂等,真终态权威性不变)。
7209
7347
  */
7210
7348
  *settleFromNotification(taskId, isError) {
7211
- clearEnginePanelTaskResident(taskId), !endedPanelTasks.has(taskId) && (endedPanelTasks.add(taskId), yield chrome({
7349
+ clearResidencyBothKeys(taskId), !endedPanelTasks.has(taskId) && (endedPanelTasks.add(taskId), yield chrome({
7212
7350
  kind: "panel_task",
7213
7351
  laneProof: MAIN,
7214
7352
  event: { kind: "end", taskId, isError }
@@ -7233,7 +7371,7 @@ function createPanelTaskLedger(ctx, cards, inst) {
7233
7371
  *settleFromTerminalTick(taskId, isError) {
7234
7372
  if (endedPanelTasks.has(taskId))
7235
7373
  return;
7236
- endedPanelTasks.add(taskId), clearEnginePanelTaskResident(taskId);
7374
+ endedPanelTasks.add(taskId), clearResidencyBothKeys(taskId);
7237
7375
  let lane = laneOf(taskId), card = taskCardBinding.get(taskId);
7238
7376
  if (card !== void 0 && (yield chrome({
7239
7377
  kind: "inline_task_stats",
@@ -7616,7 +7754,7 @@ function safeCut(buf, at) {
7616
7754
  }
7617
7755
  return n2;
7618
7756
  }
7619
- function remember(set2, key) {
7757
+ function remember2(set2, key) {
7620
7758
  if (!set2.has(key)) {
7621
7759
  if (set2.size >= MAX_REPLAY_KEYS) {
7622
7760
  let oldest = set2.values().next().value;
@@ -7626,7 +7764,7 @@ function remember(set2, key) {
7626
7764
  }
7627
7765
  }
7628
7766
  function rememberSegment(s, text2) {
7629
- remember(s.recordedSegments, text2);
7767
+ remember2(s.recordedSegments, text2);
7630
7768
  }
7631
7769
  function scheduleNotify(taskId) {
7632
7770
  pendingNotify.add(taskId), !notifyTimer && (notifyTimer = setTimeout(() => {
@@ -7658,7 +7796,7 @@ function replaySeen(s, ev) {
7658
7796
  if (typeof id == "string" && id.length > 0) {
7659
7797
  if (s.seenAggregateIds.has(id))
7660
7798
  return !0;
7661
- remember(s.seenAggregateIds, id);
7799
+ remember2(s.seenAggregateIds, id);
7662
7800
  }
7663
7801
  let body = ev.text;
7664
7802
  return !!(typeof body == "string" && s.recordedSegments.has(body));
@@ -7968,6 +8106,7 @@ var assistantArm, userArm, systemArm, diagnosticsArm, steeringInjectedArm, works
7968
8106
  init_toolResult();
7969
8107
  init_workflow();
7970
8108
  init_runTerminal();
8109
+ init_engineAgentPanelStore();
7971
8110
  init_ids();
7972
8111
  init_wireShapes();
7973
8112
  assistantArm = function* (m2, { ctx, idOf, text: text2, cards, inst }) {
@@ -8377,7 +8516,8 @@ var assistantArm, userArm, systemArm, diagnosticsArm, steeringInjectedArm, works
8377
8516
  let agentType = typeof m2.name == "string" && m2.name.length > 0 ? m2.name : "subagent";
8378
8517
  yield* panel.start(taskId, agentType);
8379
8518
  }
8380
- panel.noteResidency(taskId), panel.markLive(taskId), yield chrome({
8519
+ let identity3 = resolveEnginePanelTaskId(taskId, explicitParent);
8520
+ panel.noteResidency(taskId, identity3.taskId), panel.markLive(taskId), yield chrome({
8381
8521
  kind: "panel_task",
8382
8522
  laneProof: panel.laneOf(taskId),
8383
8523
  event: {
@@ -8387,6 +8527,9 @@ var assistantArm, userArm, systemArm, diagnosticsArm, steeringInjectedArm, works
8387
8527
  ...description !== void 0 ? { description } : {},
8388
8528
  ...prompt !== void 0 ? { prompt } : {},
8389
8529
  ...currentAction !== void 0 ? { currentAction } : {},
8530
+ // 0.74.3 CC-70:身份归一的两把钥匙 —— 退路键 + 发布方提示(绑卡 = 同步委派,漏斗不用等 fleet 行)。
8531
+ ...explicitParent !== void 0 ? { parentToolCallId: explicitParent } : {},
8532
+ ...panel.isLiveBound(taskId) ? { cardBound: !0 } : {},
8390
8533
  // 🔴 这里的 `: 0` 与 `fleetAgentPanelProjection` 那句「绝不在本层 `?? 0`」**不矛盾**,
8391
8534
  // 因为不是同一条 lane 的同一种供给形(两层的分层实情写在 `engineAgentPanelStore.ts`
8392
8535
  // 的 `PANEL_TOOLUSES_LANE_POLICY` 上,两条 lane 的可选性由编译钉锁住):
@@ -9026,7 +9169,7 @@ function wireNumberKey(key, v2) {
9026
9169
  }
9027
9170
  function projectWorkflows(rows3) {
9028
9171
  return rows3.map((r) => {
9029
- let startedCount = wireStartedCount(r);
9172
+ let startedCount = wireStartedCount(r), errorCode = wireErrorCode(r);
9030
9173
  return {
9031
9174
  id: r.id,
9032
9175
  // 187 workflow label = `e.summary ?? e.description`(短 label);折成单行,空 → 187 占位符。
@@ -9038,10 +9181,15 @@ function projectWorkflows(rows3) {
9038
9181
  ...wireNumberKey("elapsedMs", wireDuration(r.elapsedMs)),
9039
9182
  ...wireNumberKey("tokens", wireCount(r.tokens)),
9040
9183
  ...wireNumberKey("failedCount", wireCount(r.failedCount)),
9041
- ...startedCount !== void 0 ? { startedCount } : {}
9184
+ ...startedCount !== void 0 ? { startedCount } : {},
9185
+ ...errorCode !== void 0 ? { errorCode } : {}
9042
9186
  };
9043
9187
  });
9044
9188
  }
9189
+ function wireErrorCode(r) {
9190
+ let v2 = r.errorCode;
9191
+ return typeof v2 == "string" && v2.length > 0 ? v2 : void 0;
9192
+ }
9045
9193
  var TERMINAL_FLEET_TASK_STATUSES, CONTROL_TOOL_VERBS, FLEET_TASK_VIEW_KEY_TUPLE, FLEET_TASK_VIEW_KEYS, FLEET_WORKFLOW_VIEW_KEY_TUPLE, FLEET_WORKFLOW_VIEW_KEYS, FLEET_TASK_ROW_WIRE_KEY_TUPLE, FLEET_TASK_ROW_WIRE_KEYS, FLEET_WORKFLOW_ROW_WIRE_KEY_TUPLE, FLEET_WORKFLOW_ROW_WIRE_KEYS, FLEET_TASK_ROW_KEYS_NOT_PROJECTED, FLEET_WORKFLOW_ROW_KEYS_NOT_PROJECTED, init_fleetProjection = __esm({
9046
9194
  "node_modules/@sema-agent/client-core/dist/fleet/fleetProjection.js"() {
9047
9195
  init_fleetTaskDesc();
@@ -9096,7 +9244,8 @@ var TERMINAL_FLEET_TASK_STATUSES, CONTROL_TOOL_VERBS, FLEET_TASK_VIEW_KEY_TUPLE,
9096
9244
  "elapsedMs",
9097
9245
  "tokens",
9098
9246
  "failedCount",
9099
- "startedCount"
9247
+ "startedCount",
9248
+ "errorCode"
9100
9249
  ], FLEET_WORKFLOW_VIEW_KEYS = FLEET_WORKFLOW_VIEW_KEY_TUPLE, FLEET_TASK_ROW_WIRE_KEY_TUPLE = [
9101
9250
  "id",
9102
9251
  "name",
@@ -9217,10 +9366,16 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9217
9366
  if (!taskId)
9218
9367
  continue;
9219
9368
  present2.add(taskId);
9220
- let status3 = row2.status ?? "running", tokens = typeof row2.tokens == "number" && Number.isInteger(row2.tokens) && row2.tokens >= 0 ? row2.tokens : void 0, toolUses = typeof row2.toolUses == "number" ? row2.toolUses : void 0, transcriptId = row2.transcriptId || void 0, startedAt = typeof row2.startedAt == "number" && row2.startedAt > 0 ? row2.startedAt : void 0, currentTool = currentToolKeyOf(row2.currentTool) !== void 0 ? row2.currentTool : void 0, currentToolKey = currentToolKeyOf(row2.currentTool), prev = seenMap.get(taskId), sameCycle = prev !== void 0 && !prev.settled && (startedAt === void 0 || prev.startedAt === void 0 || prev.startedAt === startedAt), knownTokens = tokens !== void 0 ? tokens : sameCycle ? prev?.tokens : void 0, knownStartedAt = startedAt !== void 0 ? startedAt : sameCycle ? prev?.startedAt : void 0;
9369
+ let status3 = row2.status ?? "running", tokens = typeof row2.tokens == "number" && Number.isInteger(row2.tokens) && row2.tokens >= 0 ? row2.tokens : void 0, toolUses = typeof row2.toolUses == "number" ? row2.toolUses : void 0, transcriptId = row2.transcriptId || void 0, parentToolCallId = typeof row2.parentToolCallId == "string" && row2.parentToolCallId.length > 0 ? row2.parentToolCallId : void 0, startedAt = typeof row2.startedAt == "number" && row2.startedAt > 0 ? row2.startedAt : void 0, cycleSeq = typeof row2.cycleSeq == "number" && Number.isInteger(row2.cycleSeq) && row2.cycleSeq >= 1 ? row2.cycleSeq : void 0, currentTool = currentToolKeyOf(row2.currentTool) !== void 0 ? row2.currentTool : void 0, currentToolKey = currentToolKeyOf(row2.currentTool), prev = seenMap.get(taskId), rowIdentity = { ...cycleSeq !== void 0 ? { cycleSeq } : {}, ...startedAt !== void 0 ? { startedAt } : {} }, prevIdentity = prev !== void 0 ? { ...prev.cycleSeq !== void 0 ? { cycleSeq: prev.cycleSeq } : {}, ...prev.startedAt !== void 0 ? { startedAt: prev.startedAt } : {} } : void 0;
9370
+ if (prev !== void 0 && isStaleEngineAgentPanelEnd(rowIdentity, prevIdentity))
9371
+ continue;
9372
+ let rowNewerCycle = prev !== void 0 && isStaleEngineAgentPanelEnd(prevIdentity, rowIdentity), sameCycle = prev !== void 0 && !prev.settled && (startedAt === void 0 || prev.startedAt === void 0 || prev.startedAt === startedAt) && // 0.74.0:代际号变了同样是新周期(两条都报了才比;任一条没报 = 这一帧没说)
9373
+ (cycleSeq === void 0 || prev.cycleSeq === void 0 || prev.cycleSeq === cycleSeq), knownTokens = tokens !== void 0 ? tokens : sameCycle ? prev?.tokens : void 0, carryIdentity = prev !== void 0 && !rowNewerCycle, knownStartedAt = startedAt !== void 0 ? startedAt : carryIdentity ? prev.startedAt : void 0, knownCycleSeq = cycleSeq !== void 0 ? cycleSeq : carryIdentity ? prev.cycleSeq : void 0;
9221
9374
  if (TERMINAL_FLEET_TASK_STATUSES.has(status3)) {
9222
- prev?.settled || // 最终用量也算(终态帧常是唯一带全 usage 的一帧;消费端不更新非 running 必须赶在 end 之前发)
9223
- ((tokens !== void 0 && prev?.tokens !== tokens || toolUses !== void 0 && prev?.toolUses !== toolUses || transcriptId !== void 0 && prev?.transcriptId !== transcriptId || startedAt !== void 0 && prev?.startedAt !== startedAt) && publishEngineAgentPanelEvent({
9375
+ prev?.settled === !0 && !rowNewerCycle || // 0.74.0:周期身份本身推进(或首帧就带身份)也是变化 —— 消费端要先记下身份才能对 end 判陈旧。
9376
+ ((rowNewerCycle || cycleSeq !== void 0 && prev?.cycleSeq !== cycleSeq || // 含首帧(prev 缺席)就带身份的终态
9377
+ // 最终用量也算(终态帧常是唯一带全 usage 的一帧;消费端不更新非 running 行 ⇒ 必须赶在 end 之前发)
9378
+ tokens !== void 0 && prev?.tokens !== tokens || toolUses !== void 0 && prev?.toolUses !== toolUses || transcriptId !== void 0 && prev?.transcriptId !== transcriptId || parentToolCallId !== void 0 && prev?.parentToolCallId !== parentToolCallId || startedAt !== void 0 && prev?.startedAt !== startedAt) && publishEngineAgentPanelEvent({
9224
9379
  kind: "fleet-row",
9225
9380
  taskId,
9226
9381
  ...row2.name ? { name: row2.name } : {},
@@ -9228,20 +9383,27 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9228
9383
  ...knownTokens !== void 0 ? { totalTokens: knownTokens } : {},
9229
9384
  ...toolUses !== void 0 ? { toolUses } : {},
9230
9385
  ...transcriptId !== void 0 ? { transcriptId } : {},
9231
- ...knownStartedAt !== void 0 ? { startedAt: knownStartedAt } : {}
9386
+ ...parentToolCallId !== void 0 ? { parentToolCallId } : {},
9387
+ ...knownStartedAt !== void 0 ? { startedAt: knownStartedAt } : {},
9388
+ ...knownCycleSeq !== void 0 ? { cycleSeq: knownCycleSeq } : {}
9232
9389
  }), publishEngineAgentPanelEvent({
9233
9390
  kind: "end",
9234
9391
  taskId,
9235
9392
  // L-215② 族扫(0.65.0):与 `notifications.enqueueBgChildNotification` 的 `isError` 位
9236
9393
  // **同一个病形**(内联两词 ⇒ core [6908] 的 `blocked` 漏成「成功」)。两处一次改齐,
9237
9394
  // 读同一个单铸谓词;只修当格 = 下一次加词又漏一处。
9238
- isError: isTerminalNotSuccess(status3)
9395
+ isError: isTerminalNotSuccess(status3),
9396
+ // 0.74.0:这条终态属于哪个周期(在场才带)—— 消费端据此挡掉上一周期迟到的 end。
9397
+ ...knownCycleSeq !== void 0 ? { cycleSeq: knownCycleSeq } : {},
9398
+ ...knownStartedAt !== void 0 ? { startedAt: knownStartedAt } : {}
9239
9399
  })), seenMap.set(taskId, {
9240
9400
  status: status3,
9241
9401
  tokens: knownTokens,
9242
9402
  toolUses: toolUses !== void 0 ? toolUses : prev?.toolUses,
9243
9403
  transcriptId: transcriptId !== void 0 ? transcriptId : prev?.transcriptId,
9404
+ parentToolCallId: parentToolCallId !== void 0 ? parentToolCallId : prev?.parentToolCallId,
9244
9405
  startedAt: knownStartedAt,
9406
+ cycleSeq: knownCycleSeq,
9245
9407
  currentToolKey: currentToolKey !== void 0 ? currentToolKey : prev?.currentToolKey,
9246
9408
  lastSeenAt: nowMs2,
9247
9409
  settled: !0,
@@ -9252,7 +9414,7 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9252
9414
  continue;
9253
9415
  }
9254
9416
  (!prev || prev.settled || prev.absentReportedAtMs !== void 0 || // 行回来了:即使值未变也发一条,消费端据此撤掉 absent 标
9255
- prev.status !== status3 || prev.tokens !== knownTokens || toolUses !== void 0 && prev.toolUses !== toolUses || transcriptId !== void 0 && prev.transcriptId !== transcriptId || startedAt !== void 0 && prev.startedAt !== startedAt || currentToolKey !== void 0 && prev.currentToolKey !== currentToolKey) && publishEngineAgentPanelEvent({
9417
+ prev.status !== status3 || prev.tokens !== knownTokens || toolUses !== void 0 && prev.toolUses !== toolUses || transcriptId !== void 0 && prev.transcriptId !== transcriptId || parentToolCallId !== void 0 && prev.parentToolCallId !== parentToolCallId || startedAt !== void 0 && prev.startedAt !== startedAt || cycleSeq !== void 0 && prev.cycleSeq !== cycleSeq || currentToolKey !== void 0 && prev.currentToolKey !== currentToolKey) && publishEngineAgentPanelEvent({
9256
9418
  kind: "fleet-row",
9257
9419
  taskId,
9258
9420
  ...row2.name ? { name: row2.name } : {},
@@ -9261,14 +9423,18 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9261
9423
  // 🔴 缺席即不落键(消费端据「键在不在」判三态)。
9262
9424
  ...toolUses !== void 0 ? { toolUses } : {},
9263
9425
  ...transcriptId !== void 0 ? { transcriptId } : {},
9426
+ ...parentToolCallId !== void 0 ? { parentToolCallId } : {},
9264
9427
  ...knownStartedAt !== void 0 ? { startedAt: knownStartedAt } : {},
9428
+ ...knownCycleSeq !== void 0 ? { cycleSeq: knownCycleSeq } : {},
9265
9429
  ...currentTool !== void 0 ? { currentTool } : {}
9266
9430
  }), seenMap.set(taskId, {
9267
9431
  status: status3,
9268
9432
  tokens: knownTokens,
9269
9433
  toolUses: toolUses !== void 0 ? toolUses : prev?.toolUses,
9270
9434
  transcriptId: transcriptId !== void 0 ? transcriptId : prev?.transcriptId,
9435
+ parentToolCallId: parentToolCallId !== void 0 ? parentToolCallId : prev?.parentToolCallId,
9271
9436
  startedAt: knownStartedAt,
9437
+ cycleSeq: knownCycleSeq,
9272
9438
  currentToolKey: currentToolKey !== void 0 ? currentToolKey : prev?.currentToolKey,
9273
9439
  lastSeenAt: nowMs2,
9274
9440
  settled: !1,
@@ -9601,6 +9767,29 @@ var installedByKey, init_engineWireTarget = __esm({
9601
9767
  }
9602
9768
  });
9603
9769
 
9770
+ // node_modules/@sema-agent/client-core/dist/engineCapsGenerationGuard.js
9771
+ function snapshotCapsGeneration(opts) {
9772
+ try {
9773
+ return opts?.generation;
9774
+ } catch {
9775
+ return null;
9776
+ }
9777
+ }
9778
+ function capsGenerationStillCurrent(baseUrl, gen) {
9779
+ if (gen === void 0)
9780
+ return !0;
9781
+ try {
9782
+ return gen === engineCapsGeneration(baseUrl);
9783
+ } catch {
9784
+ return !1;
9785
+ }
9786
+ }
9787
+ var init_engineCapsGenerationGuard = __esm({
9788
+ "node_modules/@sema-agent/client-core/dist/engineCapsGenerationGuard.js"() {
9789
+ init_engineCapsCache();
9790
+ }
9791
+ });
9792
+
9604
9793
  // node_modules/@sema-agent/client-core/dist/sqlEngineCapability.js
9605
9794
  function projectSqlEngineCapability(caps) {
9606
9795
  if (caps === null || typeof caps != "object")
@@ -9614,21 +9803,28 @@ function projectSqlEngineCapability(caps) {
9614
9803
  return { kind: "not_reported" };
9615
9804
  if (typeof sql != "object")
9616
9805
  return;
9617
- let s = sql;
9618
- if (!(typeof s.engine != "string" || s.engine === "") && !(typeof s.isolation != "string" || s.isolation === "") && !(s.txnMode !== null && (typeof s.txnMode != "string" || s.txnMode === "")))
9619
- return { kind: "present", view: { engine: s.engine, isolation: s.isolation, txnMode: s.txnMode } };
9806
+ let s = sql, engine = s.engine, isolation = s.isolation, txnMode = s.txnMode;
9807
+ if (!(typeof engine != "string" || engine === "") && !(typeof isolation != "string" || isolation === "") && !(txnMode !== null && (typeof txnMode != "string" || txnMode === "")))
9808
+ return { kind: "present", view: { engine, isolation, txnMode } };
9620
9809
  }
9621
9810
  function noteEngineCapsForSqlEngine(baseUrl, caps, opts) {
9811
+ if (typeof baseUrl != "string" || baseUrl === "")
9812
+ return;
9813
+ let gen = snapshotCapsGeneration(opts);
9814
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
9815
+ return;
9816
+ let reading;
9622
9817
  try {
9623
- if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9624
- return;
9625
- let reading = projectSqlEngineCapability(caps);
9818
+ reading = projectSqlEngineCapability(caps);
9819
+ } catch {
9820
+ reading = void 0;
9821
+ }
9822
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
9626
9823
  if (reading === void 0) {
9627
9824
  readingByBase.delete(baseUrl);
9628
9825
  return;
9629
9826
  }
9630
9827
  readingByBase.set(baseUrl, reading);
9631
- } catch {
9632
9828
  }
9633
9829
  }
9634
9830
  function observedSqlEngine(baseUrl = engineWireTarget()?.baseUrl) {
@@ -9640,7 +9836,7 @@ function cleanSqlDetailScalar(v2) {
9640
9836
  function sqlEngineDoctorDetail(reading) {
9641
9837
  switch (reading.kind) {
9642
9838
  case "unobserved":
9643
- return "not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response from the engine yet";
9839
+ return "not observed \u2014 the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)";
9644
9840
  case "not_reported":
9645
9841
  return "not reported by this engine \u2014 the capability position needs a newer engine";
9646
9842
  case "none":
@@ -9661,7 +9857,7 @@ var readingByBase, SQL_DETAIL_MAX, init_sqlEngineCapability = __esm({
9661
9857
  "node_modules/@sema-agent/client-core/dist/sqlEngineCapability.js"() {
9662
9858
  init_fleetTaskDesc();
9663
9859
  init_engineWireTarget();
9664
- init_engineCapsCache();
9860
+ init_engineCapsGenerationGuard();
9665
9861
  readingByBase = /* @__PURE__ */ new Map();
9666
9862
  SQL_DETAIL_MAX = 40;
9667
9863
  }
@@ -9680,9 +9876,9 @@ function projectWriteProtectionCapability(caps) {
9680
9876
  return { kind: "not_reported" };
9681
9877
  if (typeof wp != "object" || Array.isArray(wp))
9682
9878
  return;
9683
- let w2 = wp;
9684
- if (typeof w2.armed == "boolean" && typeof w2.replaced == "boolean" && !(typeof w2.rows != "number" || !Number.isInteger(w2.rows) || w2.rows < 0))
9685
- return { kind: "present", view: { armed: w2.armed, rows: w2.rows, replaced: w2.replaced } };
9879
+ let w2 = wp, armed3 = w2.armed, replaced = w2.replaced, rows3 = w2.rows;
9880
+ if (typeof armed3 == "boolean" && typeof replaced == "boolean" && !(typeof rows3 != "number" || !Number.isInteger(rows3) || rows3 < 0))
9881
+ return { kind: "present", view: { armed: armed3, rows: rows3, replaced } };
9686
9882
  }
9687
9883
  function projectWriteProtectionPosture(wiring) {
9688
9884
  if (wiring === null || typeof wiring != "object")
@@ -9708,16 +9904,23 @@ function projectWriteProtectionPosture(wiring) {
9708
9904
  };
9709
9905
  }
9710
9906
  function noteEngineCapsForWriteProtection(baseUrl, caps, opts) {
9907
+ if (typeof baseUrl != "string" || baseUrl === "")
9908
+ return;
9909
+ let gen = snapshotCapsGeneration(opts);
9910
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
9911
+ return;
9912
+ let reading;
9711
9913
  try {
9712
- if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9713
- return;
9714
- let reading = projectWriteProtectionCapability(caps);
9914
+ reading = projectWriteProtectionCapability(caps);
9915
+ } catch {
9916
+ reading = void 0;
9917
+ }
9918
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
9715
9919
  if (reading === void 0) {
9716
9920
  readingByBase2.delete(baseUrl);
9717
9921
  return;
9718
9922
  }
9719
9923
  readingByBase2.set(baseUrl, reading);
9720
- } catch {
9721
9924
  }
9722
9925
  }
9723
9926
  function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
@@ -9726,7 +9929,7 @@ function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
9726
9929
  function writeProtectionDoctorDetail(reading) {
9727
9930
  switch (reading.kind) {
9728
9931
  case "unobserved":
9729
- return "not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response from the engine yet";
9932
+ return "not observed \u2014 the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)";
9730
9933
  case "not_reported":
9731
9934
  return "not reported by this engine \u2014 the capability position needs a newer engine; this says nothing about whether a protected-name table is in effect (an absent seat is the engine shipping its own default table, not the absence of one)";
9732
9935
  case "none":
@@ -9754,7 +9957,7 @@ var readingByBase2, WP_DETAIL_MAX, init_writeProtectionCapability = __esm({
9754
9957
  "node_modules/@sema-agent/client-core/dist/writeProtectionCapability.js"() {
9755
9958
  init_fleetTaskDesc();
9756
9959
  init_engineWireTarget();
9757
- init_engineCapsCache();
9960
+ init_engineCapsGenerationGuard();
9758
9961
  readingByBase2 = /* @__PURE__ */ new Map();
9759
9962
  WP_DETAIL_MAX = 40;
9760
9963
  }
@@ -9776,16 +9979,23 @@ function projectWebSearchBackendCapability(caps) {
9776
9979
  return backend === WEB_SEARCH_BACKEND_NONE ? { kind: "none" } : { kind: "present", view: { backend } };
9777
9980
  }
9778
9981
  function noteEngineCapsForWebSearchBackend(baseUrl, caps, opts) {
9982
+ if (typeof baseUrl != "string" || baseUrl === "")
9983
+ return;
9984
+ let gen = snapshotCapsGeneration(opts);
9985
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
9986
+ return;
9987
+ let reading;
9779
9988
  try {
9780
- if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9781
- return;
9782
- let reading = projectWebSearchBackendCapability(caps);
9989
+ reading = projectWebSearchBackendCapability(caps);
9990
+ } catch {
9991
+ reading = void 0;
9992
+ }
9993
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
9783
9994
  if (reading === void 0) {
9784
9995
  readingByBase3.delete(baseUrl);
9785
9996
  return;
9786
9997
  }
9787
9998
  readingByBase3.set(baseUrl, reading);
9788
- } catch {
9789
9999
  }
9790
10000
  }
9791
10001
  function observedWebSearchBackend(baseUrl = engineWireTarget()?.baseUrl) {
@@ -9794,7 +10004,7 @@ function observedWebSearchBackend(baseUrl = engineWireTarget()?.baseUrl) {
9794
10004
  function webSearchBackendDoctorDetail(reading) {
9795
10005
  switch (reading.kind) {
9796
10006
  case "unobserved":
9797
- return "deployment default backend not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response from the engine yet";
10007
+ return "deployment default backend not observed \u2014 the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)";
9798
10008
  case "not_reported":
9799
10009
  return "deployment default backend not reported by this engine \u2014 only newer engines advertise it; this does not say whether the deployment has a search backend";
9800
10010
  case "none":
@@ -9813,7 +10023,7 @@ var WEB_SEARCH_BACKEND_NONE, readingByBase3, WS_DETAIL_MAX, DEPLOY_ENV, init_web
9813
10023
  "node_modules/@sema-agent/client-core/dist/webSearchBackendCapability.js"() {
9814
10024
  init_fleetTaskDesc();
9815
10025
  init_engineWireTarget();
9816
- init_engineCapsCache();
10026
+ init_engineCapsGenerationGuard();
9817
10027
  WEB_SEARCH_BACKEND_NONE = "none";
9818
10028
  readingByBase3 = /* @__PURE__ */ new Map();
9819
10029
  WS_DETAIL_MAX = 40, DEPLOY_ENV = "WEB_SEARCH_PROVIDER";
@@ -9836,16 +10046,23 @@ function projectExecutionLaneCapability(caps) {
9836
10046
  return { kind: "present", view: { provider, toolsOnThisHost } };
9837
10047
  }
9838
10048
  function noteEngineCapsForExecutionLane(baseUrl, caps, opts) {
10049
+ if (typeof baseUrl != "string" || baseUrl === "")
10050
+ return;
10051
+ let gen = snapshotCapsGeneration(opts);
10052
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
10053
+ return;
10054
+ let reading;
9839
10055
  try {
9840
- if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9841
- return;
9842
- let reading = projectExecutionLaneCapability(caps);
10056
+ reading = projectExecutionLaneCapability(caps);
10057
+ } catch {
10058
+ reading = void 0;
10059
+ }
10060
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
9843
10061
  if (reading === void 0) {
9844
10062
  readingByBase4.delete(baseUrl);
9845
10063
  return;
9846
10064
  }
9847
10065
  readingByBase4.set(baseUrl, reading);
9848
- } catch {
9849
10066
  }
9850
10067
  }
9851
10068
  function observedExecutionLane(baseUrl = engineWireTarget()?.baseUrl) {
@@ -9860,7 +10077,7 @@ function toolsRunHereFromExecutionLane(reading, legacyInference) {
9860
10077
  function executionLaneDoctorDetail(reading) {
9861
10078
  switch (reading.kind) {
9862
10079
  case "unobserved":
9863
- return "execution lane not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response from the engine yet";
10080
+ return "execution lane not observed \u2014 the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)";
9864
10081
  case "not_reported":
9865
10082
  return "execution lane not reported by this engine \u2014 only newer engines advertise it; this does not say where tools run, so the client keeps inferring it the way it did before";
9866
10083
  case "present": {
@@ -9879,7 +10096,7 @@ var readingByBase4, LANE_DETAIL_MAX, init_executionLaneCapability = __esm({
9879
10096
  "node_modules/@sema-agent/client-core/dist/executionLaneCapability.js"() {
9880
10097
  init_fleetTaskDesc();
9881
10098
  init_engineWireTarget();
9882
- init_engineCapsCache();
10099
+ init_engineCapsGenerationGuard();
9883
10100
  readingByBase4 = /* @__PURE__ */ new Map();
9884
10101
  LANE_DETAIL_MAX = 40;
9885
10102
  }
@@ -9898,16 +10115,23 @@ function projectApprovalsStreamLiveCapability(caps) {
9898
10115
  return { kind: "present", live: v2 };
9899
10116
  }
9900
10117
  function noteEngineCapsForApprovalsStreamLive(baseUrl, caps, opts) {
10118
+ if (typeof baseUrl != "string" || baseUrl === "")
10119
+ return;
10120
+ let gen = snapshotCapsGeneration(opts);
10121
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
10122
+ return;
10123
+ let reading;
9901
10124
  try {
9902
- if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9903
- return;
9904
- let reading = projectApprovalsStreamLiveCapability(caps);
10125
+ reading = projectApprovalsStreamLiveCapability(caps);
10126
+ } catch {
10127
+ reading = void 0;
10128
+ }
10129
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
9905
10130
  if (reading === void 0) {
9906
10131
  readingByBase5.delete(baseUrl);
9907
10132
  return;
9908
10133
  }
9909
10134
  readingByBase5.set(baseUrl, reading);
9910
- } catch {
9911
10135
  }
9912
10136
  }
9913
10137
  function observedApprovalsStreamLive(baseUrl = engineWireTarget()?.baseUrl) {
@@ -9919,7 +10143,7 @@ function livePendingNeedsReconcile(reading) {
9919
10143
  function approvalsStreamLiveDoctorDetail(reading) {
9920
10144
  switch (reading.kind) {
9921
10145
  case "unobserved":
9922
- return "live approval push not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response yet, so suspended asks are pulled by the reconcile cadence";
10146
+ return "live approval push not observed \u2014 the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, or the last one was unreadable), so suspended asks are pulled by the reconcile cadence";
9923
10147
  case "not_reported":
9924
10148
  return "live approval push not reported by this engine \u2014 only newer engines advertise it; this does not say whether it pushes, so suspended asks are pulled by the reconcile cadence";
9925
10149
  case "present":
@@ -9935,11 +10159,86 @@ function __resetApprovalsStreamLiveReadingsForTests() {
9935
10159
  var readingByBase5, init_approvalsStreamLiveCapability = __esm({
9936
10160
  "node_modules/@sema-agent/client-core/dist/approvalsStreamLiveCapability.js"() {
9937
10161
  init_engineWireTarget();
9938
- init_engineCapsCache();
10162
+ init_engineCapsGenerationGuard();
9939
10163
  readingByBase5 = /* @__PURE__ */ new Map();
9940
10164
  }
9941
10165
  });
9942
10166
 
10167
+ // node_modules/@sema-agent/client-core/dist/deviceExecutorManagementCapability.js
10168
+ function projectDeviceExecutorManagementCapability(caps) {
10169
+ if (caps === null || typeof caps != "object")
10170
+ return;
10171
+ let c3 = caps;
10172
+ if (!Object.hasOwn(c3, "deviceExecutor"))
10173
+ return { kind: "not_reported", why: "capability_absent" };
10174
+ let d4 = c3.deviceExecutor;
10175
+ if (d4 === void 0)
10176
+ return { kind: "not_reported", why: "capability_absent" };
10177
+ if (d4 === !1)
10178
+ return { kind: "lane_absent" };
10179
+ if (d4 === null || typeof d4 != "object" || Array.isArray(d4))
10180
+ return;
10181
+ let o = d4;
10182
+ if (!Object.hasOwn(o, "management"))
10183
+ return { kind: "not_reported", why: "management_absent" };
10184
+ let mgmt = o.management;
10185
+ if (mgmt === void 0)
10186
+ return { kind: "not_reported", why: "management_absent" };
10187
+ if (typeof mgmt == "boolean")
10188
+ return { kind: "present", management: mgmt };
10189
+ }
10190
+ function noteEngineCapsForDeviceExecutorManagement(baseUrl, caps, opts) {
10191
+ if (typeof baseUrl != "string" || baseUrl === "")
10192
+ return;
10193
+ let gen = snapshotCapsGeneration(opts);
10194
+ if (gen === null || !capsGenerationStillCurrent(baseUrl, gen))
10195
+ return;
10196
+ let reading;
10197
+ try {
10198
+ reading = projectDeviceExecutorManagementCapability(caps);
10199
+ } catch {
10200
+ reading = void 0;
10201
+ }
10202
+ if (capsGenerationStillCurrent(baseUrl, gen)) {
10203
+ if (reading === void 0) {
10204
+ readingByBase6.delete(baseUrl);
10205
+ return;
10206
+ }
10207
+ readingByBase6.set(baseUrl, reading);
10208
+ }
10209
+ }
10210
+ function observedDeviceExecutorManagement(baseUrl = engineWireTarget()?.baseUrl) {
10211
+ return typeof baseUrl != "string" || baseUrl === "" ? { kind: "unobserved" } : readingByBase6.get(baseUrl) ?? { kind: "unobserved" };
10212
+ }
10213
+ function deviceManagementVerbsAvailable(reading) {
10214
+ return reading.kind === "present" ? reading.management ? "yes" : "no" : reading.kind === "lane_absent" ? "no" : "unknown";
10215
+ }
10216
+ function deviceExecutorManagementDoctorDetail(reading) {
10217
+ switch (reading.kind) {
10218
+ case "unobserved":
10219
+ return "device management face not observed \u2014 the engine reports it on /v1/capabilities (deviceExecutor.management); this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)";
10220
+ case "not_reported":
10221
+ return reading.why === "management_absent" ? "device management face not reported by this engine \u2014 the device lane is advertised but only newer engines say whether the /v1/devices management verbs exist; this does not say whether they exist, probe them directly" : "device executor capability not reported by this engine \u2014 only newer engines advertise the device lane at all; this does not say whether it exists";
10222
+ case "lane_absent":
10223
+ return "no device lane on this deployment \u2014 the /v1/devices management verbs are unavailable (capability.device_lane_required)";
10224
+ case "present":
10225
+ return reading.management ? "device management face on \u2014 the /v1/devices management verbs are available on this engine" : "device lane on but the /v1/devices management verbs are off on this deployment";
10226
+ }
10227
+ }
10228
+ function forgetDeviceExecutorManagementReading(baseUrl) {
10229
+ typeof baseUrl != "string" || baseUrl === "" || readingByBase6.delete(baseUrl);
10230
+ }
10231
+ function __resetDeviceExecutorManagementReadingsForTests() {
10232
+ readingByBase6.clear();
10233
+ }
10234
+ var readingByBase6, init_deviceExecutorManagementCapability = __esm({
10235
+ "node_modules/@sema-agent/client-core/dist/deviceExecutorManagementCapability.js"() {
10236
+ init_engineWireTarget();
10237
+ init_engineCapsGenerationGuard();
10238
+ readingByBase6 = /* @__PURE__ */ new Map();
10239
+ }
10240
+ });
10241
+
9943
10242
  // node_modules/@sema-agent/client-core/dist/mcpReconnect.js
9944
10243
  function projectStatus(raw2) {
9945
10244
  if (!isRecord(raw2) || !nonEmpty(raw2.name) || !nonEmpty(raw2.status))
@@ -10128,6 +10427,78 @@ var LEADER_RUN_STATUSES, LEADER_REJ_HEAD_DISPLAY_MAX, DETAIL_FILES_MAX, DETAIL_P
10128
10427
  }
10129
10428
  });
10130
10429
 
10430
+ // node_modules/@sema-agent/client-core/dist/runCancelContext.js
10431
+ function nonNegFinite(v2) {
10432
+ return typeof v2 == "number" && Number.isFinite(v2) && v2 >= 0 ? v2 : void 0;
10433
+ }
10434
+ function readRunCancelContext(record3) {
10435
+ if (record3 === null || typeof record3 != "object")
10436
+ return;
10437
+ let r = record3, holder = r.result !== null && typeof r.result == "object" ? r.result : r;
10438
+ if (!Object.hasOwn(holder, "cancelContext") || holder.cancelContext === void 0)
10439
+ return { kind: "not_reported" };
10440
+ let c3 = holder.cancelContext;
10441
+ if (c3 === null || typeof c3 != "object" || Array.isArray(c3))
10442
+ return;
10443
+ let o = c3, kind = typeof o.lastEventKind == "string" && o.lastEventKind.length > 0 ? o.lastEventKind : void 0, age = nonNegFinite(o.lastEventAgeMs), elapsed = nonNegFinite(o.elapsedMs), brain = o.lastBrainStatus !== null && typeof o.lastBrainStatus == "object" && !Array.isArray(o.lastBrainStatus) ? o.lastBrainStatus : void 0;
10444
+ return {
10445
+ kind: "present",
10446
+ context: {
10447
+ ...kind !== void 0 ? { lastEventKind: kind } : {},
10448
+ ...age !== void 0 ? { lastEventAgeMs: age } : {},
10449
+ ...elapsed !== void 0 ? { elapsedMs: elapsed } : {},
10450
+ ...brain !== void 0 ? { lastBrainStatus: brain } : {}
10451
+ }
10452
+ };
10453
+ }
10454
+ function classifyRunAbortCause(record3) {
10455
+ if (record3 === null || typeof record3 != "object")
10456
+ return { kind: "unknown" };
10457
+ let r = record3, status3 = typeof r.status == "string" && r.status.length > 0 ? r.status : void 0, holder = r.result !== null && typeof r.result == "object" ? r.result : record3, read = readRunTerminal(holder);
10458
+ if (read !== null && read.kind === "failed") {
10459
+ if (read.code === RUN_CANCELLED_CODE) {
10460
+ let cc = readRunCancelContext(record3);
10461
+ return { kind: "cancelled", ...cc?.kind === "present" ? { context: cc.context } : {} };
10462
+ }
10463
+ return { kind: "engine_error", ...read.code !== void 0 ? { code: read.code } : {}, ...read.message !== void 0 ? { message: read.message } : {} };
10464
+ }
10465
+ return read !== null && read.kind === "paused" ? { kind: "run_still_live", ...status3 !== void 0 ? { status: status3 } : {} } : (read === null || read.kind === "unknown") && status3 !== void 0 && LIVE_STATUSES.has(status3) ? { kind: "run_still_live", status: status3 } : { kind: "unknown", ...read !== null ? { terminal: read.kind } : {} };
10466
+ }
10467
+ var RUN_CANCELLED_CODE, LIVE_STATUSES, init_runCancelContext = __esm({
10468
+ "node_modules/@sema-agent/client-core/dist/runCancelContext.js"() {
10469
+ init_runTerminal();
10470
+ RUN_CANCELLED_CODE = "cancelled", LIVE_STATUSES = /* @__PURE__ */ new Set(["running", "queued", "suspended", "needs_review"]);
10471
+ }
10472
+ });
10473
+
10474
+ // node_modules/@sema-agent/client-core/dist/argvFlagValue.js
10475
+ function lastFlagValue(argv, name, onMissingValue = "invalidate") {
10476
+ let eq2 = `${name}=`, present2 = !1, raw2, valueMissing = !1;
10477
+ for (let i = 0; i < argv.length; i++) {
10478
+ let a = argv[i];
10479
+ if (a !== void 0) {
10480
+ if (a === "--")
10481
+ break;
10482
+ if (a === name) {
10483
+ present2 = !0;
10484
+ let nxt = argv[i + 1];
10485
+ if (nxt === void 0 || nxt.startsWith("-")) {
10486
+ if (onMissingValue === "latch-previous")
10487
+ continue;
10488
+ valueMissing = !0, raw2 = void 0;
10489
+ continue;
10490
+ }
10491
+ valueMissing = !1, raw2 = nxt, i++;
10492
+ } else a.startsWith(eq2) && (present2 = !0, valueMissing = !1, raw2 = a.slice(eq2.length));
10493
+ }
10494
+ }
10495
+ return present2 ? valueMissing || raw2 === void 0 ? { present: !0 } : { present: !0, raw: raw2 } : { present: !1 };
10496
+ }
10497
+ var init_argvFlagValue = __esm({
10498
+ "node_modules/@sema-agent/client-core/dist/argvFlagValue.js"() {
10499
+ }
10500
+ });
10501
+
10131
10502
  // node_modules/@sema-agent/client-core/dist/readFacePosture.js
10132
10503
  function projectReadFacePosture(wiring) {
10133
10504
  if (typeof wiring != "object" || wiring === null || Array.isArray(wiring) || !("readFace" in wiring))
@@ -15406,34 +15777,6 @@ var ensured, init_scratchpadWireCaps = __esm({
15406
15777
  }
15407
15778
  });
15408
15779
 
15409
- // node_modules/@sema-agent/client-core/dist/argvFlagValue.js
15410
- function lastFlagValue(argv, name, onMissingValue = "invalidate") {
15411
- let eq2 = `${name}=`, present2 = !1, raw2, valueMissing = !1;
15412
- for (let i = 0; i < argv.length; i++) {
15413
- let a = argv[i];
15414
- if (a !== void 0) {
15415
- if (a === "--")
15416
- break;
15417
- if (a === name) {
15418
- present2 = !0;
15419
- let nxt = argv[i + 1];
15420
- if (nxt === void 0 || nxt.startsWith("-")) {
15421
- if (onMissingValue === "latch-previous")
15422
- continue;
15423
- valueMissing = !0, raw2 = void 0;
15424
- continue;
15425
- }
15426
- valueMissing = !1, raw2 = nxt, i++;
15427
- } else a.startsWith(eq2) && (present2 = !0, valueMissing = !1, raw2 = a.slice(eq2.length));
15428
- }
15429
- }
15430
- return present2 ? valueMissing || raw2 === void 0 ? { present: !0 } : { present: !0, raw: raw2 } : { present: !1 };
15431
- }
15432
- var init_argvFlagValue = __esm({
15433
- "node_modules/@sema-agent/client-core/dist/argvFlagValue.js"() {
15434
- }
15435
- });
15436
-
15437
15780
  // node_modules/@sema-agent/client-core/dist/sandboxWire.js
15438
15781
  function parseSandboxArgv(argv) {
15439
15782
  let flag = lastFlagValue(argv, "--sandbox");
@@ -16255,7 +16598,20 @@ function isElapsedBase(v2) {
16255
16598
  return typeof v2 == "number" && Number.isFinite(v2) && v2 >= 0;
16256
16599
  }
16257
16600
  function createFleetLedger(hooks2 = {}, opts = {}) {
16258
- let sessionKey = opts.sessionKey ?? DEFAULT_SESSION_KEY, nowFn = opts.nowFn ?? Date.now, taskMap = /* @__PURE__ */ new Map(), wfMap = /* @__PURE__ */ new Map(), rowMeta = /* @__PURE__ */ new Map(), retained = /* @__PURE__ */ new Map(), droppedMalformed = 0, droppedUnknownFrame = 0, droppedForeignBgNotification = 0, droppedStaleIngress = 0, connected = !1, version4 = null, scoped = null, sessionScopedMeta, bgNotifyFailClosedMeta = !1, disposed4 = !1, epochSeq = 0, liveStreamEpoch = 0, liveSnapshotEpoch = 0, streamAnchor, everIssuedStream = !1, contentAnchor, contentAnchorSet = !1, ledgerWrites = 0, debug5 = (line) => {
16601
+ let sessionKey = opts.sessionKey ?? DEFAULT_SESSION_KEY, nowFn = opts.nowFn ?? Date.now, taskMap = /* @__PURE__ */ new Map(), wfMap = /* @__PURE__ */ new Map(), rowMeta = /* @__PURE__ */ new Map(), retained = /* @__PURE__ */ new Map(), cycleWatermark = /* @__PURE__ */ new Map(), CYCLE_WATERMARK_MAX = 512;
16602
+ function raiseCycleWatermark(tail, gen) {
16603
+ if (gen === void 0 || tail.length === 0)
16604
+ return;
16605
+ let prior = cycleWatermark.get(tail);
16606
+ if (!(prior !== void 0 && prior >= gen)) {
16607
+ if (cycleWatermark.delete(tail), cycleWatermark.size >= CYCLE_WATERMARK_MAX) {
16608
+ let oldest = cycleWatermark.keys().next().value;
16609
+ oldest !== void 0 && cycleWatermark.delete(oldest);
16610
+ }
16611
+ cycleWatermark.set(tail, gen);
16612
+ }
16613
+ }
16614
+ let droppedMalformed = 0, droppedUnknownFrame = 0, droppedForeignBgNotification = 0, droppedStaleIngress = 0, connected = !1, version4 = null, scoped = null, sessionScopedMeta, bgNotifyFailClosedMeta = !1, disposed4 = !1, epochSeq = 0, liveStreamEpoch = 0, liveSnapshotEpoch = 0, streamAnchor, everIssuedStream = !1, contentAnchor, contentAnchorSet = !1, ledgerWrites = 0, debug5 = (line) => {
16259
16615
  engineWireDebugEnabled() && hostLog("debug", line);
16260
16616
  }, toBgTask = (r, retired) => {
16261
16617
  let parentId = wireParentId(r);
@@ -16315,7 +16671,7 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
16315
16671
  break;
16316
16672
  }
16317
16673
  let receivedAtMs = nowFn();
16318
- taskMap.set(row2.id, row2), rowMeta.set(row2.id, { receivedAtMs }), debug5(`[fleet-row] id=${row2.id} parent=${row2.parentId ?? "-"} agentType=${row2.agentType ?? "-"} agentName=${row2.agentName ?? "-"} name=${row2.name ?? "-"} status=${row2.status ?? "-"} tokens=${row2.tokens ?? "-"} parentToolCallId=${row2.parentToolCallId ?? "-"}`);
16674
+ taskMap.set(row2.id, row2), raiseCycleWatermark(rowIdTail(row2.id), wireCycleSeq(row2)), rowMeta.set(row2.id, { receivedAtMs }), debug5(`[fleet-row] id=${row2.id} parent=${row2.parentId ?? "-"} agentType=${row2.agentType ?? "-"} agentName=${row2.agentName ?? "-"} name=${row2.name ?? "-"} status=${row2.status ?? "-"} tokens=${row2.tokens ?? "-"} parentToolCallId=${row2.parentToolCallId ?? "-"}`);
16319
16675
  let parentId = wireParentId(row2);
16320
16676
  if (parentId !== void 0) {
16321
16677
  let childTid = rowIdTail(row2.id), parentTid = rowIdTail(parentId), parentOwned = isOwnEngineRun(parentTid);
@@ -16335,9 +16691,27 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
16335
16691
  }
16336
16692
  break;
16337
16693
  }
16338
- case "task_remove":
16339
- taskMap.delete(frame.id), rowMeta.delete(frame.id);
16694
+ case "task_remove": {
16695
+ let fr = frame, removedGen = typeof fr.cycleSeq == "number" && Number.isInteger(fr.cycleSeq) && fr.cycleSeq >= 1 ? fr.cycleSeq : void 0, held = taskMap.get(frame.id), heldGen = held !== void 0 ? wireCycleSeq(held) : void 0, stale = removedGen !== void 0 && heldGen !== void 0 && removedGen < heldGen;
16696
+ if (stale || (taskMap.delete(frame.id), rowMeta.delete(frame.id)), hooks2.onTaskRemoved !== void 0) {
16697
+ let reason = typeof fr.removeReason == "string" && fr.removeReason.length > 0 ? fr.removeReason : void 0;
16698
+ try {
16699
+ let out6 = hooks2.onTaskRemoved({
16700
+ id: frame.id,
16701
+ ...reason !== void 0 ? { removeReason: reason } : {},
16702
+ ...removedGen !== void 0 ? { cycleSeq: removedGen } : {},
16703
+ ...stale ? { stale: !0 } : {},
16704
+ ...held === void 0 ? { unknownRow: !0 } : {}
16705
+ });
16706
+ out6 && typeof out6.then == "function" && Promise.resolve(out6).catch((e) => {
16707
+ hostLog("debug", `[fleet-frame] onTaskRemoved hook rejected: ${String(e).slice(0, 160)}`);
16708
+ });
16709
+ } catch (e) {
16710
+ hostLog("debug", `[fleet-frame] onTaskRemoved hook threw: ${String(e).slice(0, 160)}`);
16711
+ }
16712
+ }
16340
16713
  break;
16714
+ }
16341
16715
  case "workflow":
16342
16716
  frame.row?.id ? wfMap.set(frame.row.id, frame.row) : (droppedMalformed++, debug5("[fleet-frame] MALFORMED workflow frame dropped(row \u6216 row.id \u7F3A\u5E2D)"));
16343
16717
  break;
@@ -16376,11 +16750,20 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
16376
16750
  (id === n2.taskId || rowIdTail(id) === n2.taskId) && rowIds.push(id);
16377
16751
  if (TERMINAL_FLEET_TASK_STATUSES.has(n2.status)) {
16378
16752
  typeof n2.parentTaskId == "string" && n2.parentTaskId && recordBgParentRun(n2.taskId, n2.parentTaskId, ing?.session, ing?.sessionKey), typeof n2.transcriptId == "string" && n2.transcriptId.length > 0 && recordEngineTranscriptId(n2.taskId, n2.transcriptId);
16379
- let isWashGreen = (prior, next) => next === "completed" && (prior === "failed" || prior === "killed"), coerced = n2.status, nowMs2 = nowFn(), writtenIds = /* @__PURE__ */ new Set(), applied = !1, washBlocked = !1;
16753
+ let isWashGreen = (prior, next) => next === "completed" && (prior === "failed" || prior === "killed"), coerced = n2.status, nowMs2 = nowFn(), writtenIds = /* @__PURE__ */ new Set(), applied = !1, washBlocked = !1, staleBlocked = !1, notifSeq = typeof n2.seq == "number" && Number.isInteger(n2.seq) && n2.seq >= 1 ? n2.seq : void 0;
16754
+ {
16755
+ let mark = cycleWatermark.get(n2.taskId);
16756
+ notifSeq !== void 0 && mark !== void 0 && notifSeq < mark && (staleBlocked = !0, debug5(`[fleet-frame] bg_notification stale-cycle ignored(watermark=${mark} notif-seq=${notifSeq})`));
16757
+ }
16380
16758
  for (let id of rowIds) {
16381
16759
  let known = taskMap.get(id);
16382
16760
  if (!known)
16383
16761
  continue;
16762
+ let heldGen = wireCycleSeq(known);
16763
+ if (notifSeq !== void 0 && heldGen !== void 0 && notifSeq < heldGen) {
16764
+ staleBlocked = !0, debug5(`[fleet-frame] bg_notification stale-cycle ignored(row=${id} row-cycle=${heldGen} notif-seq=${notifSeq})`);
16765
+ continue;
16766
+ }
16384
16767
  let rowStatus = known.status ?? "";
16385
16768
  if (TERMINAL_FLEET_TASK_STATUSES.has(rowStatus)) {
16386
16769
  if (isWashGreen(rowStatus, n2.status)) {
@@ -16408,6 +16791,11 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
16408
16791
  for (let [id, entry] of retained) {
16409
16792
  if (writtenIds.has(id) || id !== n2.taskId && rowIdTail(id) !== n2.taskId)
16410
16793
  continue;
16794
+ let retainedGen = wireCycleSeq(entry.row);
16795
+ if (notifSeq !== void 0 && retainedGen !== void 0 && notifSeq < retainedGen) {
16796
+ staleBlocked = !0, debug5(`[fleet-frame] bg_notification stale-cycle ignored(retained=${id} row-cycle=${retainedGen} notif-seq=${notifSeq})`);
16797
+ continue;
16798
+ }
16411
16799
  let prior = entry.row.status ?? "";
16412
16800
  if (prior === n2.status) {
16413
16801
  applied = !0;
@@ -16424,11 +16812,21 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
16424
16812
  ...entry.retiredByNotification === !0 ? { retiredByNotification: !0 } : {}
16425
16813
  }), applied = !0;
16426
16814
  }
16427
- applied || !washBlocked && (() => {
16815
+ let factsAccepted = !staleBlocked && (applied || !washBlocked && (() => {
16428
16816
  let prior = getBgTerminalFacts(n2.taskId);
16429
- return !(prior !== void 0 && isWashGreen(prior.status, n2.status));
16430
- })() ? recordBgTerminalFacts(n2.taskId, {
16817
+ if (prior === void 0)
16818
+ return !0;
16819
+ if (notifSeq !== void 0 && prior.cycleSeq !== void 0) {
16820
+ if (notifSeq < prior.cycleSeq)
16821
+ return !1;
16822
+ if (notifSeq > prior.cycleSeq)
16823
+ return !0;
16824
+ }
16825
+ return !isWashGreen(prior.status, n2.status);
16826
+ })());
16827
+ factsAccepted && raiseCycleWatermark(n2.taskId, notifSeq), factsAccepted ? recordBgTerminalFacts(n2.taskId, {
16431
16828
  status: n2.status,
16829
+ ...notifSeq !== void 0 ? { cycleSeq: notifSeq } : {},
16432
16830
  ...typeof n2.summary == "string" ? { summary: n2.summary } : {},
16433
16831
  // 🔴 SDK 0.0.117 把 `recentSteps` 的三键 declare 成**必填** string,但那是**声称**不是保证:
16434
16832
  // 帧从 wire 上来,脏项(null / 缺键 / 非串)在类型面之外仍可能到达,而 BgTerminalFacts
@@ -17271,17 +17669,22 @@ function str4(v2) {
17271
17669
  function readDecideReceipt(result) {
17272
17670
  if (typeof result != "object" || result === null || Array.isArray(result))
17273
17671
  return;
17274
- let r = result, status3 = Object.hasOwn(r, "status") ? str4(r.status) : void 0, taskId = Object.hasOwn(r, "taskId") ? str4(r.taskId) : void 0, sessionId = Object.hasOwn(r, "sessionId") ? str4(r.sessionId) : void 0, idempotent = Object.hasOwn(r, "idempotent") && r.idempotent === !0 ? !0 : void 0, handoffTaskId = status3 === STATUS_RESUMING && taskId !== void 0 ? taskId : void 0, executionOutcome = Object.hasOwn(r, "executionOutcome") ? gateOutcomeOf({ gate: r.executionOutcome }) : void 0;
17275
- if (!(status3 === void 0 && taskId === void 0 && sessionId === void 0 && idempotent === void 0 && executionOutcome === void 0))
17672
+ let r = result, status3 = Object.hasOwn(r, "status") ? str4(r.status) : void 0, taskId = Object.hasOwn(r, "taskId") ? str4(r.taskId) : void 0, sessionId = Object.hasOwn(r, "sessionId") ? str4(r.sessionId) : void 0, idempotent = Object.hasOwn(r, "idempotent") && r.idempotent === !0 ? !0 : void 0, handoffTaskId = status3 === STATUS_RESUMING && taskId !== void 0 ? taskId : void 0, executionOutcome = Object.hasOwn(r, "executionOutcome") ? gateOutcomeOf({ gate: r.executionOutcome }) : void 0, errorCode = Object.hasOwn(r, "errorCode") ? str4(r.errorCode) : void 0, retriable = Object.hasOwn(r, "retriable") && typeof r.retriable == "boolean" ? r.retriable : void 0;
17673
+ if (!(status3 === void 0 && taskId === void 0 && sessionId === void 0 && idempotent === void 0 && executionOutcome === void 0 && errorCode === void 0 && retriable === void 0))
17276
17674
  return {
17277
17675
  ...status3 !== void 0 ? { status: status3 } : {},
17278
17676
  ...taskId !== void 0 ? { taskId } : {},
17279
17677
  ...sessionId !== void 0 ? { sessionId } : {},
17280
17678
  ...idempotent !== void 0 ? { idempotent } : {},
17281
17679
  ...handoffTaskId !== void 0 ? { handoffTaskId } : {},
17282
- ...executionOutcome !== void 0 ? { executionOutcome } : {}
17680
+ ...executionOutcome !== void 0 ? { executionOutcome } : {},
17681
+ ...errorCode !== void 0 ? { errorCode } : {},
17682
+ ...retriable !== void 0 ? { retriable } : {}
17283
17683
  };
17284
17684
  }
17685
+ function decideReceiptReopen(receipt) {
17686
+ return receipt === void 0 || receipt.status !== STATUS_FAILED ? null : resumeReopenFromError(receipt);
17687
+ }
17285
17688
  function decideAcceptedNotResolved(receipt) {
17286
17689
  return receipt?.status === STATUS_RESUMING;
17287
17690
  }
@@ -17297,11 +17700,13 @@ function decideRefusalFromError(e) {
17297
17700
  resendable: Object.hasOwn(DECIDE_RESENDABLE, code2) ? DECIDE_RESENDABLE[code2] === !0 : !1
17298
17701
  };
17299
17702
  }
17300
- var STATUS_RESUMING, DECIDE_REFUSAL_SENTENCES, DECIDE_RESENDABLE, init_decideReceipt = __esm({
17703
+ var STATUS_RESUMING, STATUS_FAILED, DECIDE_REFUSAL_SENTENCES, DECIDE_RESENDABLE, init_decideReceipt = __esm({
17301
17704
  "node_modules/@sema-agent/client-core/dist/decideReceipt.js"() {
17302
17705
  init_gateOutcome();
17706
+ init_resumeRefusalCopy();
17303
17707
  init_engineErrorCodes();
17304
17708
  STATUS_RESUMING = "resuming";
17709
+ STATUS_FAILED = "failed";
17305
17710
  DECIDE_REFUSAL_SENTENCES = Object.freeze({
17306
17711
  [DECIDE_WORKFLOW_HOST_UNKNOWN]: "no session is attached to this run to receive the decision, so re-sending the same decision cannot help; the approval is still pending and can be decided again once the run is reachable",
17307
17712
  [DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED]: "this run cannot remember the decision for the session; re-send the same decision without the remember option \u2014 nothing was consumed by this refusal"
@@ -19711,6 +20116,22 @@ var PROVIDER_PRESETS, MODEL_FAMILIES, VARIANT_TAIL, presetIndexCache, init_provi
19711
20116
  }
19712
20117
  });
19713
20118
 
20119
+ // node_modules/@sema-agent/client-core/dist/hitl/suspendedReopen.js
20120
+ function suspendedReopenOf(ev) {
20121
+ if (ev === null || typeof ev != "object" || Array.isArray(ev))
20122
+ return UNSTATED;
20123
+ let o = ev;
20124
+ if (!Object.hasOwn(o, "reopened"))
20125
+ return UNSTATED;
20126
+ let v2 = o.reopened;
20127
+ return v2 === null ? NOT_REOPENED : typeof v2 == "string" && v2.length > 0 ? { kind: "reopened", code: v2 } : UNSTATED;
20128
+ }
20129
+ var UNSTATED, NOT_REOPENED, init_suspendedReopen = __esm({
20130
+ "node_modules/@sema-agent/client-core/dist/hitl/suspendedReopen.js"() {
20131
+ UNSTATED = Object.freeze({ kind: "unstated" }), NOT_REOPENED = Object.freeze({ kind: "not_reopened" });
20132
+ }
20133
+ });
20134
+
19714
20135
  // node_modules/@sema-agent/client-core/dist/hitl/hitlBridge.js
19715
20136
  function denyReasonForWire(reason, tag2) {
19716
20137
  if (typeof reason != "string")
@@ -19812,6 +20233,7 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, PLAN_REVIEW_MODE_AFTER_WORDS, Hi
19812
20233
  init_types();
19813
20234
  init_host();
19814
20235
  init_abortableSleep();
20236
+ init_suspendedReopen();
19815
20237
  DEFAULT_DENY_REASON = "The user rejected this tool use", MAX_DENY_REASON_CHARS = 4096;
19816
20238
  PLAN_REVIEW_MODE_AFTER_WORDS = Object.freeze(["default", "acceptEdits"]);
19817
20239
  HitlSafetyError = class extends Error {
@@ -19852,7 +20274,7 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, PLAN_REVIEW_MODE_AFTER_WORDS, Hi
19852
20274
  observe(ev) {
19853
20275
  switch (ev.type) {
19854
20276
  case "suspended":
19855
- ev.gate ? this.active = { gate: ev.gate, seq: eventSeq(ev) } : this.active = { gate: { kind: "human" }, seq: eventSeq(ev) };
20277
+ ev.gate ? this.active = { gate: ev.gate, seq: eventSeq(ev), reopened: suspendedReopenOf(ev) } : this.active = { gate: { kind: "human" }, seq: eventSeq(ev), reopened: suspendedReopenOf(ev) };
19856
20278
  break;
19857
20279
  case "done":
19858
20280
  case "failed":
@@ -19867,6 +20289,14 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, PLAN_REVIEW_MODE_AFTER_WORDS, Hi
19867
20289
  currentGate() {
19868
20290
  return this.active?.gate ?? null;
19869
20291
  }
20292
+ /**
20293
+ * 0.74.3 CC-73:当前挂起是不是一次 reopen(`suspended.reopened` 三态);没挂起 ⇒ `null`。
20294
+ * 消费方据此把「真 reopen 成功、重试会重放」那半句说出来:`reopened` 在场码 ⇒ 卡仍 pending、决定没被消费、可再决;
20295
+ * `not_reopened` / `unstated` ⇒ 普通挂起,一个字都不多说。
20296
+ */
20297
+ currentGateReopen() {
20298
+ return this.active?.reopened ?? null;
20299
+ }
19870
20300
  /**
19871
20301
  * Fetch the `PendingCheckpoint` this decide/answer is about to resolve, for the callers that do NOT
19872
20302
  * already have one in hand (see `decideTool`/`answerQuestion`'s `preResolvedPending` param — the wire
@@ -20420,6 +20850,8 @@ async function surfaceFsApprovalAndDecide(deps2, taskId, argsByCall, signal, par
20420
20850
  switch (card.kind) {
20421
20851
  case "failed":
20422
20852
  return { kind: "failed", stage: "card", gatedCallId, reason: card.reason };
20853
+ case "retracted":
20854
+ return hostLog("debug", `liveHitlAskWire: approval card retracted without a decision for ${gatedCallId ?? "(no call)"} \u2014 nothing sent`), { kind: "retracted", gatedCallId };
20423
20855
  case "aborted":
20424
20856
  return observeCancelByDeny(bridge3.decideTool({ decision: "deny", reason: "Interrupted by user" }, gatedCallId, void 0, pending4), taskId), { kind: "aborted", gatedCallId };
20425
20857
  case "allow":
@@ -20473,7 +20905,7 @@ function readReadRootCandidate(v2) {
20473
20905
  return;
20474
20906
  let o = v2;
20475
20907
  if (!(typeof o.dir != "string" || o.dir.length === 0 || o.clearsThisAsk !== !0))
20476
- return { dir: o.dir, clearsThisAsk: !0 };
20908
+ return "covers" in o ? o.covers === "exact" ? { dir: o.dir, clearsThisAsk: !0, covers: "exact" } : void 0 : { dir: o.dir, clearsThisAsk: !0 };
20477
20909
  }
20478
20910
  function isToolApprovalDelegation(v2) {
20479
20911
  if (v2 === null || typeof v2 != "object")
@@ -20824,6 +21256,8 @@ async function surfaceToolApprovalFrameAndRespond(frame, respond, streamArgs, si
20824
21256
  });
20825
21257
  if (lane?.argsUnavailable === !0 && card.kind === "allow" && card.updatedInput !== void 0)
20826
21258
  return hostLog("error", `liveToolApprovalWire: ${frame.approvalId} card returned an edited approval on an args-unavailable ask \u2014 nothing sent (the ask stays pending)`), surfaceEditRefusedOnBlindAsk(), { decision: "unresolved", editRefused: !0 };
21259
+ if (card.kind === RETRACTED_CARD_DECISION_KIND)
21260
+ return hostLog("debug", `liveToolApprovalWire: ${frame.approvalId} card retracted without a decision${card.reason ? ` (${card.reason})` : ""} \u2014 nothing sent`), { decision: "unresolved", retracted: !0 };
20827
21261
  let decision = card.kind === "allow" ? card.allowSession ? "allow_session" : "allow" : "deny";
20828
21262
  card.kind === "failed" && hostLog("debug", `liveToolApprovalWire: approval card unavailable (${card.reason}) \u2014 fail-closed deny for ${frame.approvalId}`);
20829
21263
  let note;
@@ -20863,7 +21297,7 @@ async function surfaceToolApprovalFrameAndRespond(frame, respond, streamArgs, si
20863
21297
  return hostLog("debug", `liveToolApprovalWire: respond(${decision}) failed for ${frame.approvalId} (status=${respondRefusal?.status ?? "none"} errorCode=${logSafeErrorCode(respondRefusal?.errorCode)} messageLen=${respondRefusal?.message?.length ?? 0}) \u2014 engine self-settles (TTL/abort); the refusal text is handed back on outcome.respondRefusal for the host to surface`), respondRefusal !== void 0 ? { decision: "unresolved", respondRefusal } : { decision: "unresolved" };
20864
21298
  }
20865
21299
  }
20866
- var cardPortByKey, cardPortMissesByKey, TOOL_APPROVAL_FRAME_KEYS_MIRROR, RESPOND_DECISIONS, USELESS_REFUSAL_TEXTS, MACHINE_CODE_SHAPE, FS_WRITE_GATE_ASK_PATTERN, MAX_RULE_OFFERS_TOLERATED, MAX_RULE_OFFER_BATCH_MEMBERS_TOLERATED, MAX_RULE_OFFER_UNCOVERED_DETAIL_TOLERATED, MAX_RESPOND_NOTE_CHARS, init_toolApprovalWire = __esm({
21300
+ var RETRACTED_CARD_DECISION_KIND, cardPortByKey, cardPortMissesByKey, TOOL_APPROVAL_FRAME_KEYS_MIRROR, RESPOND_DECISIONS, USELESS_REFUSAL_TEXTS, MACHINE_CODE_SHAPE, FS_WRITE_GATE_ASK_PATTERN, MAX_RULE_OFFERS_TOLERATED, MAX_RULE_OFFER_BATCH_MEMBERS_TOLERATED, MAX_RULE_OFFER_UNCOVERED_DETAIL_TOLERATED, MAX_RESPOND_NOTE_CHARS, init_toolApprovalWire = __esm({
20867
21301
  "node_modules/@sema-agent/client-core/dist/hitl/toolApprovalWire.js"() {
20868
21302
  init_hitlBridge();
20869
21303
  init_askParkRowRouting();
@@ -20874,7 +21308,7 @@ var cardPortByKey, cardPortMissesByKey, TOOL_APPROVAL_FRAME_KEYS_MIRROR, RESPOND
20874
21308
  init_gateIdentity();
20875
21309
  init_gateVocabulary();
20876
21310
  init_decideReceipt();
20877
- cardPortByKey = createSessionSlot(), cardPortMissesByKey = /* @__PURE__ */ new Map();
21311
+ RETRACTED_CARD_DECISION_KIND = "retracted", cardPortByKey = createSessionSlot(), cardPortMissesByKey = /* @__PURE__ */ new Map();
20878
21312
  TOOL_APPROVAL_FRAME_KEYS_MIRROR = [
20879
21313
  "type",
20880
21314
  "approvalId",
@@ -21063,7 +21497,16 @@ async function routeToolApprovalFrame(ev, ctx) {
21063
21497
  }
21064
21498
  let fromSubagent = isFromSubagent(ev);
21065
21499
  hostLog("debug", `liveHitlAskWire: tool_approval frame ${ev.approvalId} tool=${String(ev.toolName)}${fromSubagent ? ` from-subagent=${String(ev.sourceTaskId ?? ev.sourceAgentName ?? "explicit")}` : ""}`);
21066
- let gatedCallId = fromSubagent ? void 0 : led.lastPendingFsCall(), { decision } = await surfaceToolApprovalFrameAndRespond(ev, deps2.respondToolApproval, argsOfGatedStart(led, gatedCallId), ctx.signal, deps2.approvalLane);
21500
+ let gatedCallId = fromSubagent ? void 0 : led.lastPendingFsCall(), outcome = await surfaceToolApprovalFrameAndRespond(ev, deps2.respondToolApproval, argsOfGatedStart(led, gatedCallId), ctx.signal, deps2.approvalLane), { decision } = outcome;
21501
+ if (deps2.onToolApprovalOutcome !== void 0)
21502
+ try {
21503
+ let out6 = deps2.onToolApprovalOutcome(ev, outcome);
21504
+ out6 && typeof out6.then == "function" && Promise.resolve(out6).catch((e) => {
21505
+ hostLog("debug", `liveHitlAskWire: onToolApprovalOutcome rejected: ${String(e).slice(0, 160)}`);
21506
+ });
21507
+ } catch (e) {
21508
+ hostLog("debug", `liveHitlAskWire: onToolApprovalOutcome threw: ${String(e).slice(0, 160)}`);
21509
+ }
21067
21510
  return decision === "deny" && !fromSubagent && (gatedCallId !== void 0 ? led.markDenied(gatedCallId) : led.armDenyStamp()), { kind: "skip" };
21068
21511
  }
21069
21512
  function routeToolStart(ev, callId, led) {
@@ -21577,14 +22020,15 @@ async function resolvePark(park, ctx) {
21577
22020
  outcome = { kind: "failed", stage: "orchestration", reason: stalledReason };
21578
22021
  else {
21579
22022
  let closing = await surfaceParkGate(park, ctx, park.gatedCallId, witness);
21580
- outcome = closing.kind === "decided" || closing.kind === "aborted" ? closing : { kind: "failed", stage: "orchestration", reason: `${stalledReason}; closing re-read: ${closing.reason}` };
22023
+ outcome = closing.kind === "decided" || closing.kind === "aborted" || closing.kind === "retracted" ? closing : { kind: "failed", stage: "orchestration", reason: `${stalledReason}; closing re-read: ${closing.reason}` };
21581
22024
  }
21582
22025
  } else
21583
22026
  park.gate === "fs" && (candidateGatedCallId = led.lastFsOrShellGatedCallId()), outcome = await surfaceParkGate(park, ctx, park.gatedCallId, witness);
21584
22027
  let alreadyDecidedById = outcome.kind === "failed" && candidateGatedCallId !== void 0 && led.takeDecided(candidateGatedCallId);
21585
22028
  if (!closingCardTried && outcome.kind === "failed" && (isAlreadyResolvedFailure(outcome) || alreadyDecidedById)) {
21586
22029
  let firstReason = outcome.reason, streakKey = alreadyResolvedStreakKey(!isAlreadyResolvedFailure(outcome) && alreadyDecidedById), reasonToken = alreadyResolvedReasonToken(outcome.reason), rescan = isFetchStepNoPending(outcome) && stalledRounds <= MAX_GATE_HOPS ? await surfaceParkGate(park, ctx, park.gatedCallId, witness) : void 0;
21587
- if (rescan !== void 0 && (rescan.kind === "decided" || rescan.kind === "aborted" || rescan.kind === "failed" && rescan.retryExhausted === !0))
22030
+ if (rescan !== void 0 && (rescan.kind === "decided" || rescan.kind === "aborted" || rescan.kind === "retracted" || // 0.74.1(CC-67):宿主撤卡也是「人那一侧有了处置」,采信,不再重探
22031
+ rescan.kind === "failed" && rescan.retryExhausted === !0))
21588
22032
  hostLog("debug", `liveHitlAskWire: gate reported already-resolved (${firstReason}) but a fresh approvals re-read for run ${taskId} surfaced a decidable row under the current coordinates \u2014 re-presented it (rescan: ${rescan.kind}) instead of re-attaching on the stale park identity`), outcome = rescan;
21589
22033
  else {
21590
22034
  let streak = led.noteAlreadyResolvedGate(streakKey);
@@ -21616,8 +22060,11 @@ async function resolvePark(park, ctx) {
21616
22060
  reason: `the decide call failed on transport ${streak} times in a row while the run stayed parked (${outcome.reason})`
21617
22061
  };
21618
22062
  }
21619
- if (outcome.kind !== "decided")
21620
- return hostLog("debug", `liveHitlAskWire: gate not decided (${outcome.kind}${"reason" in outcome ? `: ${outcome.reason}` : ""}) \u2014 fail-soft to suspended terminal`), { kind: "failsoft", events: failsoftEvents(park, ctx, outcome.kind === "aborted", outcome.kind === "failed" ? outcome.reason : void 0) };
22063
+ if (outcome.kind !== "decided") {
22064
+ hostLog("debug", `liveHitlAskWire: gate not decided (${outcome.kind}${"reason" in outcome ? `: ${outcome.reason}` : ""}) \u2014 fail-soft to suspended terminal`);
22065
+ let failedReason = outcome.kind === "failed" ? outcome.reason : outcome.kind === "retracted" ? "the approval card was retracted by the host without a decision (nothing was sent; the run stays parked and remains decidable elsewhere)" : void 0;
22066
+ return { kind: "failsoft", events: failsoftEvents(park, ctx, outcome.kind === "aborted", failedReason) };
22067
+ }
21621
22068
  led.dropHeldForDecidedPark(outcome.gatedCallId, park.gatedCallId), outcome.gatedCallId && (led.markDecided(outcome.gatedCallId), "answered" in outcome && outcome.answered && led.rememberAnswer(outcome.gatedCallId, outcome.answered));
21622
22069
  let handoffTaskId = "receipt" in outcome && outcome.receipt?.handoffTaskId !== void 0 && outcome.receipt.handoffTaskId !== taskId ? outcome.receipt.handoffTaskId : void 0, seq2 = led.lastSeq();
21623
22070
  return hostLog("debug", handoffTaskId !== void 0 ? `liveHitlAskWire: gate decided (call ${outcome.gatedCallId ?? "?"}) \u2014 the decide was ACCEPTED for delivery (status "resuming") and the engine handed the continuation to run ${handoffTaskId}; attaching runs.events(${handoffTaskId}) from the start (durable seq is per-run, so ${seq2 ?? "the previous seq"} does not apply there)` : `liveHitlAskWire: gate decided (call ${outcome.gatedCallId ?? "?"}) \u2014 attaching runs.events(${taskId})${seq2 ? ` from seq ${seq2}` : ""}`), {
@@ -24886,6 +25333,7 @@ __export(dist_exports, {
24886
25333
  MAX_AGENT_TOOLS: () => MAX_AGENT_TOOLS,
24887
25334
  MAX_AGENT_TOOL_NAME_CHARS: () => MAX_AGENT_TOOL_NAME_CHARS,
24888
25335
  MAX_GATE_HOPS: () => MAX_GATE_HOPS,
25336
+ MAX_HELD_WIRE_TICK_BEATS: () => MAX_HELD_WIRE_TICK_BEATS,
24889
25337
  MAX_HOOK_NOTICE_TEXT_CHARS: () => MAX_HOOK_NOTICE_TEXT_CHARS,
24890
25338
  MAX_TASK_AGENTS: () => MAX_TASK_AGENTS,
24891
25339
  MAX_TOKENS_MAX: () => MAX_TOKENS_MAX,
@@ -24953,6 +25401,7 @@ __export(dist_exports, {
24953
25401
  RESUME_USAGE_WINDOW_EXHAUSTED: () => RESUME_USAGE_WINDOW_EXHAUSTED,
24954
25402
  RETAIN_BACKGROUND_ENV: () => RETAIN_BACKGROUND_ENV,
24955
25403
  RETIRED_PERMISSION_RULE_ISSUE_CODES: () => RETIRED_PERMISSION_RULE_ISSUE_CODES,
25404
+ RETRACTED_CARD_DECISION_KIND: () => RETRACTED_CARD_DECISION_KIND,
24956
25405
  REVIEW_PARK_GATE_KINDS: () => REVIEW_PARK_GATE_KINDS,
24957
25406
  REWIND_ERROR_CODE_PREFIXES: () => REWIND_ERROR_CODE_PREFIXES,
24958
25407
  RULE_NOT_SENT_REJECTED_WARN_TEXT: () => RULE_NOT_SENT_REJECTED_WARN_TEXT,
@@ -24964,6 +25413,7 @@ __export(dist_exports, {
24964
25413
  RULE_STORE_UNREADABLE_KINDS: () => RULE_STORE_UNREADABLE_KINDS,
24965
25414
  RUNNING_STATES: () => RUNNING_STATES,
24966
25415
  RUN_BLOCKED_MESSAGE_PREFIX: () => RUN_BLOCKED_MESSAGE_PREFIX,
25416
+ RUN_CANCELLED_CODE: () => RUN_CANCELLED_CODE,
24967
25417
  RUN_LEVEL_STOP_ERROR_CODES: () => RUN_LEVEL_STOP_ERROR_CODES,
24968
25418
  RUN_STOPPED_MESSAGE_PREFIX: () => RUN_STOPPED_MESSAGE_PREFIX,
24969
25419
  RUN_TERMINAL_NOT_SUCCESS_STATUSES: () => RUN_TERMINAL_NOT_SUCCESS_STATUSES,
@@ -25055,7 +25505,9 @@ __export(dist_exports, {
25055
25505
  __feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
25056
25506
  __resetApprovalsStreamLiveReadingsForTests: () => __resetApprovalsStreamLiveReadingsForTests,
25057
25507
  __resetBgOwnerAbsenceForTests: () => __resetBgOwnerAbsenceForTests,
25508
+ __resetDeviceExecutorManagementReadingsForTests: () => __resetDeviceExecutorManagementReadingsForTests,
25058
25509
  __resetEngineAgentPanelAbsenceForTests: () => __resetEngineAgentPanelAbsenceForTests,
25510
+ __resetEngineAgentPanelIdentityForTests: () => __resetEngineAgentPanelIdentityForTests,
25059
25511
  __resetEngineCapsCacheForTests: () => __resetEngineCapsCacheForTests,
25060
25512
  __resetEngineCompactArmForTests: () => __resetEngineCompactArmForTests,
25061
25513
  __resetEngineDelegatedPromptForTests: () => __resetEngineDelegatedPromptForTests,
@@ -25162,6 +25614,7 @@ __export(dist_exports, {
25162
25614
  classifyMemoryStatusFailure: () => classifyMemoryStatusFailure,
25163
25615
  classifyPeerNotification: () => classifyPeerNotification,
25164
25616
  classifyRulesFailure: () => classifyRulesFailure,
25617
+ classifyRunAbortCause: () => classifyRunAbortCause,
25165
25618
  classifySelfOrchestrationRefusal: () => classifySelfOrchestrationRefusal,
25166
25619
  classifySkippedReason: () => classifySkippedReason,
25167
25620
  classifySubagentResumeFailure: () => classifySubagentResumeFailure,
@@ -25172,6 +25625,7 @@ __export(dist_exports, {
25172
25625
  clearArmedGate: () => clearArmedGate,
25173
25626
  clearBgTerminalFacts: () => clearBgTerminalFacts,
25174
25627
  clearEnginePanelTaskResident: () => clearEnginePanelTaskResident,
25628
+ clearEnginePanelTaskResidentByWire: () => clearEnginePanelTaskResidentByWire,
25175
25629
  clearRunningChoiceOffer: () => clearRunningChoiceOffer,
25176
25630
  clearSubagentContent: () => clearSubagentContent,
25177
25631
  clientContextField: () => clientContextField,
@@ -25206,6 +25660,7 @@ __export(dist_exports, {
25206
25660
  createWireToCcAdapter: () => createWireToCcAdapter,
25207
25661
  decideAcceptedNotResolved: () => decideAcceptedNotResolved,
25208
25662
  decidePlanReview: () => decidePlanReview,
25663
+ decideReceiptReopen: () => decideReceiptReopen,
25209
25664
  decideRefusalFromError: () => decideRefusalFromError,
25210
25665
  decisionNoteAuditLine: () => decisionNoteAuditLine,
25211
25666
  defaultMaxTokensFor: () => defaultMaxTokensFor,
@@ -25222,6 +25677,8 @@ __export(dist_exports, {
25222
25677
  detachedTaskId: () => detachedTaskId,
25223
25678
  detectEngineBgShellReceipt: () => detectEngineBgShellReceipt,
25224
25679
  deviceAuthProviderFor: () => deviceAuthProviderFor,
25680
+ deviceExecutorManagementDoctorDetail: () => deviceExecutorManagementDoctorDetail,
25681
+ deviceManagementVerbsAvailable: () => deviceManagementVerbsAvailable,
25225
25682
  diagnoseSseIdleTear: () => diagnoseSseIdleTear,
25226
25683
  discussionWorkflowName: () => discussionWorkflowName,
25227
25684
  doneToSdkResult: () => doneToSdkResult,
@@ -25291,6 +25748,7 @@ __export(dist_exports, {
25291
25748
  fmtCtxOut: () => fmtCtxOut,
25292
25749
  fmtTokens: () => fmtTokens,
25293
25750
  forgetApprovalsStreamLiveReading: () => forgetApprovalsStreamLiveReading,
25751
+ forgetDeviceExecutorManagementReading: () => forgetDeviceExecutorManagementReading,
25294
25752
  forgetExecutionLaneReading: () => forgetExecutionLaneReading,
25295
25753
  forgetSqlEngineReading: () => forgetSqlEngineReading,
25296
25754
  forgetWebSearchBackendReading: () => forgetWebSearchBackendReading,
@@ -25418,6 +25876,7 @@ __export(dist_exports, {
25418
25876
  isSeatModelCatalog: () => isSeatModelCatalog,
25419
25877
  isSendMessageAck: () => isSendMessageAck,
25420
25878
  isSseIdleError: () => isSseIdleError,
25879
+ isStaleEngineAgentPanelEnd: () => isStaleEngineAgentPanelEnd,
25421
25880
  isSubFlowSegmentEnd: () => isSubFlowSegmentEnd,
25422
25881
  isSupportedCatalogSchemaVersion: () => isSupportedCatalogSchemaVersion,
25423
25882
  isTaskNotificationObjective: () => isTaskNotificationObjective,
@@ -25435,6 +25894,7 @@ __export(dist_exports, {
25435
25894
  isWorkflowCompletionCardEnqueued: () => isWorkflowCompletionCardEnqueued,
25436
25895
  isWorkflowParkRefusalCode: () => isWorkflowParkRefusalCode,
25437
25896
  kickEngineCapsProbe: () => kickEngineCapsProbe,
25897
+ lastFlagValue: () => lastFlagValue,
25438
25898
  leaderConflictDetail: () => leaderConflictDetail,
25439
25899
  limitsForPrint: () => limitsForPrint,
25440
25900
  listAllPersistedRules: () => listAllPersistedRules,
@@ -25478,6 +25938,7 @@ __export(dist_exports, {
25478
25938
  normalizeWirePrincipal: () => normalizeWirePrincipal,
25479
25939
  noteBgOwnerAbsence: () => noteBgOwnerAbsence,
25480
25940
  noteEngineCapsForApprovalsStreamLive: () => noteEngineCapsForApprovalsStreamLive,
25941
+ noteEngineCapsForDeviceExecutorManagement: () => noteEngineCapsForDeviceExecutorManagement,
25481
25942
  noteEngineCapsForExecutionLane: () => noteEngineCapsForExecutionLane,
25482
25943
  noteEngineCapsForSqlEngine: () => noteEngineCapsForSqlEngine,
25483
25944
  noteEngineCapsForWebSearchBackend: () => noteEngineCapsForWebSearchBackend,
@@ -25492,6 +25953,7 @@ __export(dist_exports, {
25492
25953
  notificationQueuePortMisses: () => notificationQueuePortMisses,
25493
25954
  observeCancelByDeny: () => observeCancelByDeny,
25494
25955
  observedApprovalsStreamLive: () => observedApprovalsStreamLive,
25956
+ observedDeviceExecutorManagement: () => observedDeviceExecutorManagement,
25495
25957
  observedExecutionLane: () => observedExecutionLane,
25496
25958
  observedSqlEngine: () => observedSqlEngine,
25497
25959
  observedWebSearchBackend: () => observedWebSearchBackend,
@@ -25558,6 +26020,7 @@ __export(dist_exports, {
25558
26020
  projectBackgroundView: () => projectBackgroundView,
25559
26021
  projectCrashConverged: () => projectCrashConverged,
25560
26022
  projectDescription: () => projectDescription,
26023
+ projectDeviceExecutorManagementCapability: () => projectDeviceExecutorManagementCapability,
25561
26024
  projectDiagnosticsFrame: () => projectDiagnosticsFrame,
25562
26025
  projectEffectiveBody: () => projectEffectiveBody,
25563
26026
  projectExecutionLaneCapability: () => projectExecutionLaneCapability,
@@ -25621,6 +26084,7 @@ __export(dist_exports, {
25621
26084
  readRuleOfferSupply: () => readRuleOfferSupply,
25622
26085
  readRuleOffers: () => readRuleOffers,
25623
26086
  readRulePersistOutcome: () => readRulePersistOutcome,
26087
+ readRunCancelContext: () => readRunCancelContext,
25624
26088
  readRunCostFacts: () => readRunCostFacts,
25625
26089
  readRunTerminal: () => readRunTerminal,
25626
26090
  readSessionMemoryStatus: () => readSessionMemoryStatus,
@@ -25664,6 +26128,7 @@ __export(dist_exports, {
25664
26128
  resetWorkflowActivityLedgers: () => resetWorkflowActivityLedgers,
25665
26129
  resolveAutonomousLoopPrompt: () => resolveAutonomousLoopPrompt,
25666
26130
  resolveCatalogSources: () => resolveCatalogSources,
26131
+ resolveEnginePanelTaskId: () => resolveEnginePanelTaskId,
25667
26132
  resolveEntryVision: () => resolveEntryVision,
25668
26133
  resolveHeadlessDetach: () => resolveHeadlessDetach,
25669
26134
  resolveHeadlessFinalVerify: () => resolveHeadlessFinalVerify,
@@ -25769,6 +26234,7 @@ __export(dist_exports, {
25769
26234
  surfaceRuleArmRejected: () => surfaceRuleArmRejected,
25770
26235
  surfaceSuspendedAskAndRespond: () => surfaceSuspendedAskAndRespond,
25771
26236
  surfaceToolApprovalFrameAndRespond: () => surfaceToolApprovalFrameAndRespond,
26237
+ suspendedReopenOf: () => suspendedReopenOf,
25772
26238
  suspendedSubagentAsks: () => suspendedSubagentAsks,
25773
26239
  tailEngineSubagent: () => tailEngineSubagent,
25774
26240
  taskAgentsField: () => taskAgentsField,
@@ -25860,9 +26326,12 @@ var init_dist = __esm({
25860
26326
  init_webSearchBackendCapability();
25861
26327
  init_executionLaneCapability();
25862
26328
  init_approvalsStreamLiveCapability();
26329
+ init_deviceExecutorManagementCapability();
25863
26330
  init_mcpReconnect();
25864
26331
  init_leaderConflict();
25865
26332
  init_runTerminal();
26333
+ init_runCancelContext();
26334
+ init_argvFlagValue();
25866
26335
  init_readFacePosture();
25867
26336
  init_mcpPanel();
25868
26337
  init_effectiveFacts();
@@ -25954,6 +26423,7 @@ var init_dist = __esm({
25954
26423
  init_liveInitToolFace();
25955
26424
  init_providerPresets2();
25956
26425
  init_hitlBridge();
26426
+ init_suspendedReopen();
25957
26427
  init_frameRouter();
25958
26428
  init_frameRouter();
25959
26429
  init_hitlHostSurface();
@@ -69967,13 +70437,51 @@ function displaySafeFreeText(text2) {
69967
70437
  return out6 += text2.slice(cursor), out6.replace(SCHEMELESS_USERINFO, `${REDACTED_USERINFO}@$1`);
69968
70438
  }
69969
70439
  function redactSecretWords(text2) {
69970
- return text2.replace(SECRET_SCHEME_WORD, swapSecretValue).replace(SECRET_LABELLED_WORD, swapSecretValue);
70440
+ return redactByLabel(redactByLabel(text2, SECRET_SCHEME_WORD), SECRET_LABELLED_WORD);
70441
+ }
70442
+ function scanSecretValue(text2, from) {
70443
+ let i = from, slashes = 0;
70444
+ for (; i < text2.length && text2[i] === "\\" && slashes < 4; )
70445
+ i++, slashes++;
70446
+ let q2 = text2[i];
70447
+ if (q2 === '"' || q2 === "'") {
70448
+ let open19 = i + 1;
70449
+ if (slashes > 0) {
70450
+ let close = text2.indexOf("\\" + q2, open19);
70451
+ return close === -1 || close - open19 > VALUE_SCAN_CAP ? null : close > open19 ? { start: open19, end: close } : null;
70452
+ }
70453
+ let j4 = open19;
70454
+ for (; j4 < text2.length && j4 - open19 <= VALUE_SCAN_CAP; ) {
70455
+ if (text2[j4] === "\\") {
70456
+ j4 += 2;
70457
+ continue;
70458
+ }
70459
+ if (text2[j4] === q2) return j4 > open19 ? { start: open19, end: j4 } : null;
70460
+ j4++;
70461
+ }
70462
+ return null;
70463
+ }
70464
+ let j3 = i;
70465
+ for (; j3 < text2.length && j3 - i < VALUE_SCAN_CAP && !isBareValueStop(text2[j3]); ) j3++;
70466
+ return j3 > i ? { start: i, end: j3 } : null;
69971
70467
  }
69972
- function swapSecretValue(whole, label, value) {
70468
+ function isDiagnosticValue(value) {
70469
+ if (value.startsWith("\xABredacted") || /^[a-z][a-z0-9+.-]{1,15}:\/\//i.test(value)) return !0;
69973
70470
  let bare = value.replace(/[.,;:!?)\]}'"]{0,8}$/, "").toLowerCase();
69974
- return DIAGNOSTIC_VALUE_WORDS.has(bare) ? whole : `${label} ${REDACTED_SECRET}`;
70471
+ return bare === "" || DIAGNOSTIC_VALUE_WORDS.has(bare);
70472
+ }
70473
+ function redactByLabel(text2, re) {
70474
+ let out6 = "", last4 = 0;
70475
+ re.lastIndex = 0;
70476
+ for (let m2 = re.exec(text2); m2 !== null; m2 = re.exec(text2)) {
70477
+ let v2 = scanSecretValue(text2, m2.index + m2[0].length);
70478
+ if (v2 === null) continue;
70479
+ let value = text2.slice(v2.start, v2.end);
70480
+ out6 += text2.slice(last4, v2.start) + (isDiagnosticValue(value) ? value : REDACTED_SECRET), last4 = v2.end, re.lastIndex = v2.end;
70481
+ }
70482
+ return out6 + text2.slice(last4);
69975
70483
  }
69976
- var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRAGMENT, TOKEN_STOP, TRAILING_PUNCTUATION, VALUE_BOUNDARY_TAIL, isWhitespaceOrControl, isSchemeChar, isAlpha, SCHEMELESS_USERINFO, REDACTED_SECRET, DIAGNOSTIC_VALUE_WORDS, SECRET_SCHEME_WORD, SECRET_LABELLED_WORD, init_displaySafeUrl = __esm({
70484
+ var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRAGMENT, TOKEN_STOP, TRAILING_PUNCTUATION, VALUE_BOUNDARY_TAIL, isWhitespaceOrControl, isSchemeChar, isAlpha, SCHEMELESS_USERINFO, REDACTED_SECRET, DIAGNOSTIC_VALUE_WORDS, VALUE_SCAN_CAP, BARE_VALUE_STOP_CHARS, isBareValueStop, SECRET_SCHEME_WORD, SECRET_LABELLED_WORD, init_displaySafeUrl = __esm({
69977
70485
  "build-src/src/sema/displaySafeUrl.ts"() {
69978
70486
  DISPLAY_REDACTION_MARKER_RE = /^«redacted(?::[a-z-]{1,16}){0,2}»$/, REDACTED_USERINFO = "\xABredacted:userinfo\xBB", REDACTED_QUERY = "\xABredacted:query\xBB", REDACTED_FRAGMENT = "\xABredacted:fragment\xBB";
69979
70487
  TOKEN_STOP = /* @__PURE__ */ new Set(['"', "<", ">", "`", "|", "\\", "^", "{", "}"]), TRAILING_PUNCTUATION = /* @__PURE__ */ new Set([".", ",", ";", ":", "!", "?", "'"]), VALUE_BOUNDARY_TAIL = /[?#&=;]$/, isWhitespaceOrControl = (ch2) => {
@@ -70009,9 +70517,57 @@ var DISPLAY_REDACTION_MARKER_RE, REDACTED_USERINFO, REDACTED_QUERY, REDACTED_FRA
70009
70517
  "revoked",
70010
70518
  "disabled",
70011
70519
  "unavailable",
70012
- "incorrect"
70013
- ]);
70014
- SECRET_SCHEME_WORD = /(?:\b|(?<=\\[A-Za-z"']))(bearer|basic)[\s:=\uFF1A\uFF1D]{1,8}(?:\\{0,4}["']\s{0,4})?([A-Za-z0-9._~+/=%-]{8,})/gi, SECRET_LABELLED_WORD = /(?:\b|(?<=\\[A-Za-z"']))((?:access[-_ ]?|refresh[-_ ]?|id[-_ ]?|client[-_ ]?|api[-_ ]?|x[-_]api[-_ ]?|session[-_ ]?|auth[-_ ]?)?(?:token|key|secret|password|authorization|credential)s?)(?:\\{0,4}["']|\\{1,4})?\s{0,4}[:=\uFF1A\uFF1D]\s{0,4}(?:\\{0,4}["']|\\{1,4})?\s{0,4}([A-Za-z0-9._~+/=%-]{8,})/gi;
70520
+ "incorrect",
70521
+ "not",
70522
+ "no",
70523
+ "set",
70524
+ "unset",
70525
+ "blank",
70526
+ "value",
70527
+ "values",
70528
+ "of",
70529
+ "the",
70530
+ "a",
70531
+ "an",
70532
+ "is",
70533
+ "was",
70534
+ "are",
70535
+ "for",
70536
+ "to",
70537
+ "in",
70538
+ "on",
70539
+ "and",
70540
+ "or",
70541
+ "from",
70542
+ "with",
70543
+ "at",
70544
+ "by",
70545
+ "this",
70546
+ "that",
70547
+ "it",
70548
+ "be",
70549
+ "must",
70550
+ "should",
70551
+ "can",
70552
+ "cannot",
70553
+ "true",
70554
+ "false",
70555
+ "yes",
70556
+ "ok",
70557
+ "n/a",
70558
+ "na",
70559
+ // 认证方案词:`Authorization: Bearer <tok>` 里 `Bearer` 是标签的一部分,真值由 ① 那条正则接着洗。
70560
+ "bearer",
70561
+ "basic",
70562
+ "digest",
70563
+ "hmac",
70564
+ "oauth",
70565
+ "oauth2",
70566
+ "jwt",
70567
+ "apikey",
70568
+ "api-key"
70569
+ ]), VALUE_SCAN_CAP = 512, BARE_VALUE_STOP_CHARS = /* @__PURE__ */ new Set([",", ";", '"', "'", "\\", "(", ")", "[", "]", "{", "}", "<", ">"]), isBareValueStop = (ch2) => ch2 <= " " || BARE_VALUE_STOP_CHARS.has(ch2);
70570
+ SECRET_SCHEME_WORD = /(?:\b|(?<=\\[A-Za-z"']))(bearer|basic)[\s:=\uFF1A\uFF1D]{1,8}/gi, SECRET_LABELLED_WORD = /(?:\b|(?<=\\[A-Za-z"']))((?:access[-_ ]?|refresh[-_ ]?|id[-_ ]?|client[-_ ]?|api[-_ ]?|x[-_]api[-_ ]?|session[-_ ]?|auth[-_ ]?)?(?:token|key|secret|password|authorization|credential)s?)(?:\\{0,4}["'])?\s{0,4}[:=\uFF1A\uFF1D]\s{0,4}/gi;
70015
70571
  }
70016
70572
  });
70017
70573
 
@@ -87951,7 +88507,10 @@ var USER_ROLES, NO_ENTRIES_DROPPED, OPEN_WORLD_KNOWN_KEYS, init_config_fns = __e
87951
88507
  init_types6();
87952
88508
  USER_ROLES = ["viewer", "editor", "publisher", "admin"];
87953
88509
  NO_ENTRIES_DROPPED = Object.freeze({}), OPEN_WORLD_KNOWN_KEYS = {
87954
- limits: { "": Object.keys(LimitsConfig.shape), infraCostRates: Object.keys(InfraCostRates.shape) }
88510
+ limits: [
88511
+ [[], Object.keys(LimitsConfig.shape)],
88512
+ [["infraCostRates"], Object.keys(InfraCostRates.shape)]
88513
+ ]
87955
88514
  };
87956
88515
  }
87957
88516
  });
@@ -88780,9 +89339,10 @@ var init_migrate = __esm({
88780
89339
  }
88781
89340
  });
88782
89341
 
88783
- // node_modules/@sema-agent/settings-schema/dist/api/wire.js
88784
- var DEVICE_GRANT_TYPE, REFRESH_TOKEN_TTL_SECONDS, OAUTH_ERROR_CODES, DEVICE_AUTH_STATUSES, init_wire = __esm({
88785
- "node_modules/@sema-agent/settings-schema/dist/api/wire.js"() {
89342
+ // node_modules/@sema-agent/settings-schema/dist/api/auth.js
89343
+ var DEVICE_GRANT_TYPE, REFRESH_TOKEN_TTL_SECONDS, OAUTH_ERROR_CODES, DEVICE_AUTH_STATUSES, OAuthErrorResponse, DeviceCodeRequest, DeviceCodeResponse, DeviceTokenRequest, TokenGrantResponse, TokenRefreshRequest, LogoutRequest, LogoutResponse, DeviceApproveLookupResponse, DeviceApproveRequest, DeviceApproveResponse, init_auth = __esm({
89344
+ "node_modules/@sema-agent/settings-schema/dist/api/auth.js"() {
89345
+ init_zod();
88786
89346
  DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code", REFRESH_TOKEN_TTL_SECONDS = 720 * 60 * 60, OAUTH_ERROR_CODES = [
88787
89347
  /** device/token: the user has not approved (or denied) the handshake yet — keep polling. */
88788
89348
  "authorization_pending",
@@ -88801,17 +89361,7 @@ var DEVICE_GRANT_TYPE, REFRESH_TOKEN_TTL_SECONDS, OAUTH_ERROR_CODES, DEVICE_AUTH
88801
89361
  "invalid_grant",
88802
89362
  /** SSO not configured on the registry (HTTP 503) — a deployment problem, not a client one. */
88803
89363
  "server_error"
88804
- ], DEVICE_AUTH_STATUSES = ["pending", "approved", "denied"];
88805
- }
88806
- });
88807
-
88808
- // node_modules/@sema-agent/settings-schema/dist/api/auth.js
88809
- var OAuthErrorResponse, DeviceCodeRequest, DeviceCodeResponse, DeviceTokenRequest, TokenGrantResponse, TokenRefreshRequest, LogoutRequest, LogoutResponse, DeviceApproveLookupResponse, DeviceApproveRequest, DeviceApproveResponse, init_auth = __esm({
88810
- "node_modules/@sema-agent/settings-schema/dist/api/auth.js"() {
88811
- init_zod();
88812
- init_wire();
88813
- init_wire();
88814
- OAuthErrorResponse = external_exports2.object({
89364
+ ], DEVICE_AUTH_STATUSES = ["pending", "approved", "denied"], OAuthErrorResponse = external_exports2.object({
88815
89365
  error: external_exports2.enum(OAUTH_ERROR_CODES),
88816
89366
  error_description: external_exports2.string().optional()
88817
89367
  }).passthrough(), DeviceCodeRequest = external_exports2.object({
@@ -88913,8 +89463,6 @@ var GLOBAL_SCOPE, RESERVED_SCOPE_IDS, SCOPE_ID_REGEX, ScopeId, ScopeRole, Scope,
88913
89463
  init_zod();
88914
89464
  init_config_fns();
88915
89465
  init_auth();
88916
- init_wire();
88917
- init_wire();
88918
89466
  GLOBAL_SCOPE = "global", RESERVED_SCOPE_IDS = [GLOBAL_SCOPE], SCOPE_ID_REGEX = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
88919
89467
  ScopeId = external_exports2.string().regex(SCOPE_ID_REGEX, "scope id must be a slug: [a-z0-9-], 1-64 chars, no edge dash"), ScopeRole = external_exports2.enum(USER_ROLES), Scope = external_exports2.object({
88920
89468
  id: ScopeId,
@@ -125350,6 +125898,29 @@ var init_types8 = __esm({
125350
125898
  }
125351
125899
  });
125352
125900
 
125901
+ // build-src/src/sema/apiErrorMessageWash.ts
125902
+ function washApiErrorMessage(m2) {
125903
+ if (typeof m2 != "object" || m2 === null) return m2;
125904
+ let rec = m2;
125905
+ if (rec.isApiErrorMessage !== !0) return m2;
125906
+ let envelope = rec.message;
125907
+ if (typeof envelope != "object" || envelope === null) return m2;
125908
+ let content = envelope.content;
125909
+ if (!Array.isArray(content)) return m2;
125910
+ let changed = !1, washed = content.map((block2) => {
125911
+ let b3 = block2;
125912
+ if (typeof b3 != "object" || b3 === null || b3.type !== "text" || typeof b3.text != "string") return block2;
125913
+ let next = displaySafeFreeText(b3.text);
125914
+ return next === b3.text ? block2 : (changed = !0, { ...b3, text: next });
125915
+ });
125916
+ return changed ? { ...rec, message: { ...envelope, content: washed } } : m2;
125917
+ }
125918
+ var init_apiErrorMessageWash = __esm({
125919
+ "build-src/src/sema/apiErrorMessageWash.ts"() {
125920
+ init_displaySafeUrl();
125921
+ }
125922
+ });
125923
+
125353
125924
  // build-src/src/sema/appStateRef.ts
125354
125925
  var appStateRef_exports = {};
125355
125926
  __export(appStateRef_exports, {
@@ -125951,8 +126522,8 @@ function rewriteActiveRunBusyRow(msgs, seen2, billTurnCosts = !0, runToken) {
125951
126522
  }
125952
126523
  function passThroughWithBusyRewrite(msgs, seen2) {
125953
126524
  return (async function* () {
125954
- for await (let m2 of msgs) {
125955
- let busy = seen2.busy;
126525
+ for await (let raw2 of msgs) {
126526
+ let m2 = washApiErrorMessage(raw2), busy = seen2.busy;
125956
126527
  if (busy && typeof m2 == "object" && m2 !== null && "isApiErrorMessage" in m2 && m2.isApiErrorMessage === !0) {
125957
126528
  let envelope = "message" in m2 ? m2.message : void 0;
125958
126529
  if (typeof envelope == "object" && envelope !== null) {
@@ -126057,6 +126628,7 @@ var runTokenSeq, mintRunToken, reportedDroppedTypes2, DROPPED_TYPE_MEMO_CAP2, in
126057
126628
  "build-src/src/seam/adapter/runStream.ts"() {
126058
126629
  init_dist();
126059
126630
  init_untrustedDisplayText();
126631
+ init_apiErrorMessageWash();
126060
126632
  init_planReviewModeAfterOffer();
126061
126633
  init_turnUsageTranscriptStamp();
126062
126634
  init_activeRunSelfHeal2();
@@ -140263,6 +140835,94 @@ var PROBE_FACTS_OFF, PROBE_FACTS_ON, PROBE_VECTORS, init_epoch = __esm({
140263
140835
  }
140264
140836
  });
140265
140837
 
140838
+ // node_modules/@sema-agent/core/dist/tools/fs/read-deny.js
140839
+ function resolveReadDenyBuiltins(config4) {
140840
+ let activeTiers;
140841
+ if (config4?.tiers === void 0)
140842
+ activeTiers = new Set(READ_DENY_DEFAULT_TIERS);
140843
+ else {
140844
+ if (!Array.isArray(config4.tiers))
140845
+ throw new Error(`readDenyBuiltinTiers: expected an array of tier names, got ${JSON.stringify(config4.tiers)}.`);
140846
+ for (let t2 of config4.tiers)
140847
+ if (typeof t2 != "string" || !READ_DENY_BUILTIN_TIERS.includes(t2))
140848
+ throw new Error(`readDenyBuiltinTiers: unknown tier ${JSON.stringify(t2)} \u2014 known tiers: ${READ_DENY_BUILTIN_TIERS.join(", ")}.`);
140849
+ activeTiers = new Set(config4.tiers);
140850
+ }
140851
+ let excluded;
140852
+ if (config4?.exclude === void 0)
140853
+ excluded = /* @__PURE__ */ new Set();
140854
+ else {
140855
+ if (!Array.isArray(config4.exclude))
140856
+ throw new Error(`readDenyBuiltinExclude: expected an array of built-in row names (canonical pattern texts), got ${JSON.stringify(config4.exclude)}.`);
140857
+ for (let name of config4.exclude)
140858
+ if (typeof name != "string" || !READ_FACE_BUILTIN_DENY_TABLE.some((r) => r.pattern === name))
140859
+ throw new Error(`readDenyBuiltinExclude: ${JSON.stringify(name)} names no built-in row \u2014 row names are the canonical pattern texts of READ_FACE_BUILTIN_DENY_TABLE (e.g. ".ssh", ".config/gcloud").`);
140860
+ excluded = new Set(config4.exclude);
140861
+ }
140862
+ return READ_FACE_BUILTIN_DENY_TABLE.filter((r) => activeTiers.has(r.tier) && !excluded.has(r.pattern));
140863
+ }
140864
+ var READ_DENY_BUILTIN_TIERS, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_DEFAULT_TIERS, READ_FACE_DEFAULT_DENY_ENTRIES, init_read_deny = __esm({
140865
+ "node_modules/@sema-agent/core/dist/tools/fs/read-deny.js"() {
140866
+ READ_DENY_BUILTIN_TIERS = ["credentials", "shell-history", "browser", "wallet", "agent-config"], READ_FACE_BUILTIN_DENY_TABLE = [
140867
+ { pattern: ".ssh", tier: "credentials" },
140868
+ { pattern: "id_rsa*", tier: "credentials" },
140869
+ { pattern: "id_ed25519*", tier: "credentials" },
140870
+ { pattern: "id_ecdsa*", tier: "credentials" },
140871
+ { pattern: ".gnupg", tier: "credentials" },
140872
+ { pattern: ".aws", tier: "credentials" },
140873
+ { pattern: ".config/gcloud", tier: "credentials" },
140874
+ { pattern: ".azure", tier: "credentials" },
140875
+ { pattern: ".kube", tier: "credentials" },
140876
+ { pattern: ".netrc", tier: "credentials" },
140877
+ { pattern: "_netrc", tier: "credentials" },
140878
+ { pattern: ".git-credentials", tier: "credentials" },
140879
+ { pattern: ".docker/config.json", tier: "credentials" },
140880
+ { pattern: ".config/gh", tier: "credentials" },
140881
+ { pattern: ".npmrc", tier: "credentials" },
140882
+ { pattern: ".pypirc", tier: "credentials" },
140883
+ { pattern: ".local/share/keyrings", tier: "credentials" },
140884
+ { pattern: "Library/Keychains", tier: "credentials" },
140885
+ { pattern: ".credentials.json", tier: "credentials" },
140886
+ { pattern: ".codex/auth.json", tier: "credentials" },
140887
+ { pattern: ".config/github-copilot", tier: "credentials" },
140888
+ { pattern: ".gemini/oauth_creds.json", tier: "credentials" },
140889
+ { pattern: ".bash_history", tier: "shell-history" },
140890
+ { pattern: ".zsh_history", tier: "shell-history" },
140891
+ { pattern: "Library/Application Support/Google/Chrome", tier: "browser" },
140892
+ { pattern: "Library/Application Support/Firefox", tier: "browser" },
140893
+ { pattern: "Library/Safari", tier: "browser" },
140894
+ { pattern: ".config/google-chrome", tier: "browser" },
140895
+ { pattern: ".config/chromium", tier: "browser" },
140896
+ { pattern: ".mozilla/firefox", tier: "browser" },
140897
+ { pattern: "AppData/Local/Google/Chrome/User Data", tier: "browser" },
140898
+ { pattern: "AppData/Local/Microsoft/Edge/User Data", tier: "browser" },
140899
+ { pattern: "AppData/Roaming/Mozilla/Firefox", tier: "browser" },
140900
+ { pattern: ".bitcoin", tier: "wallet" },
140901
+ { pattern: ".ethereum", tier: "wallet" },
140902
+ { pattern: ".electrum", tier: "wallet" },
140903
+ { pattern: "Library/Application Support/Exodus", tier: "wallet" },
140904
+ { pattern: "Library/Application Support/Ledger Live", tier: "wallet" },
140905
+ { pattern: "wallet.dat", tier: "wallet" },
140906
+ { pattern: ".sema/settings.json", tier: "agent-config" },
140907
+ { pattern: ".sema/settings.local.json", tier: "agent-config" },
140908
+ { pattern: ".sema.*", tier: "agent-config" },
140909
+ { pattern: ".claude/settings.json", tier: "agent-config" },
140910
+ { pattern: ".claude/settings.local.json", tier: "agent-config" },
140911
+ { pattern: ".claude.*", tier: "agent-config" },
140912
+ { pattern: ".mcp.json", tier: "agent-config" },
140913
+ { pattern: ".ai-agent/.env", tier: "agent-config" },
140914
+ { pattern: ".sema/engine-data/.env", tier: "agent-config" },
140915
+ { pattern: ".codex/config.toml", tier: "agent-config" },
140916
+ { pattern: ".cursor/mcp.json", tier: "agent-config" },
140917
+ { pattern: ".continue/config.json", tier: "agent-config" },
140918
+ { pattern: ".continue/config.yaml", tier: "agent-config" },
140919
+ { pattern: ".aider.conf.yml", tier: "agent-config" },
140920
+ { pattern: ".gemini/settings.json", tier: "agent-config" }
140921
+ ], READ_DENY_DEFAULT_TIERS = [];
140922
+ READ_FACE_DEFAULT_DENY_ENTRIES = resolveReadDenyBuiltins().map((r) => r.pattern);
140923
+ }
140924
+ });
140925
+
140266
140926
  // node_modules/@sema-agent/core/dist/core/tool-face.js
140267
140927
  var TOOL_FAMILIES, TOOL_MOUNT_TAGS, TOOL_APPROVAL_CARDS, TOOL_PATH_BASES, TOOL_PATH_ABSENCES, TOOL_WIRE_NAME_MAX_CHARS, TOOL_CONTRACT_MAX_CHARS, TOOL_CARD_ID_MAX_CHARS, TOOL_KEY_MAX_CHARS, TOOL_KEYS_MAX, RENDER_HINT_MAX_CHARS, RENDER_HINT_ACTIVITY_MAX_CHARS, RENDER_HINT_MAX_LIST, MOUNT_TAG_IN_HANDS_BAND, HANDS_BAND_TAGS, init_tool_face = __esm({
140268
140928
  "node_modules/@sema-agent/core/dist/core/tool-face.js"() {
@@ -140679,7 +141339,7 @@ var FULL_SHELL_CONTRACT_ID, READONLY_SHELL_CONTRACT_ID, TASK_CREATE_TOOL_NAME, T
140679
141339
  { id: "task-stop-hands", name: "TaskStop", source: "builtin", definedIn: "src/tools/fs/fs-bash.ts", mountedBy: ["hands"], cards: [], face: { family: "delegate", effect: "write", contract: TASK_STOP_CONTRACT } },
140680
141340
  { id: "task-output", name: "TaskOutput", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-output"], face: { family: "delegate", effect: "read", contract: TASK_OUTPUT_CONTRACT } },
140681
141341
  { id: "task-stop", name: "TaskStop", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-stop"], face: { family: "delegate", effect: "write", contract: TASK_STOP_CONTRACT } },
140682
- { id: "monitor", name: "Monitor", source: "builtin", definedIn: "src/tools/monitor.ts", mountedBy: ["backgroundTasks"], cards: ["monitor-start"], face: { family: "other", effect: "write", contract: c("core.monitor@1"), offloadThresholdChars: 1e4 } },
141342
+ { id: "monitor", name: "Monitor", source: "builtin", definedIn: "src/tools/monitor.ts", mountedBy: ["backgroundTasks"], cards: ["monitor-start", "readonly_out_of_root"], face: { family: "other", effect: "write", contract: c("core.monitor@1"), offloadThresholdChars: 1e4 } },
140683
141343
  { id: "send-message", name: "SendMessage", source: "builtin", definedIn: "src/agents/send-message-tool.ts", mountedBy: ["delegation", "hostInternals", "peerLane"], cards: ["send-message"], face: { family: "protocol", effect: "write", contract: c("core.send_message@1") } },
140684
141344
  { id: "agent-transcript", name: "AgentTranscript", source: "builtin", definedIn: "src/agents/agent-transcript-tool.ts", mountedBy: ["delegation"], cards: ["agent-transcript"], face: { family: "delegate", effect: "read", contract: c("core.agent_transcript@1") } },
140685
141345
  { id: "list-agents", name: "ListAgents", source: "builtin", definedIn: "src/agents/list-agents-tool.ts", mountedBy: ["peerLane"], cards: ["list-agents"], face: { family: "protocol", effect: "read", aliases: ["ListPeers"], contract: c("core.list_agents@1") } },
@@ -140894,6 +141554,7 @@ function identityAnchorOf(identity3) {
140894
141554
  }
140895
141555
  var WIN_RESERVED_RE, asciiBytes, BINARY_MAGIC_SIGNATURES, init_safety = __esm({
140896
141556
  "node_modules/@sema-agent/core/dist/tools/fs/safety.js"() {
141557
+ init_read_deny();
140897
141558
  init_surrogate_safe_slice();
140898
141559
  init_tool_registry();
140899
141560
  init_gate_bounded_await();
@@ -141143,6 +141804,7 @@ var init_tools = __esm({
141143
141804
  "node_modules/@sema-agent/core/dist/core/tools.js"() {
141144
141805
  init_value2();
141145
141806
  init_tool_errors();
141807
+ init_thrown_value();
141146
141808
  init_tool_catalog();
141147
141809
  }
141148
141810
  });
@@ -151928,6 +152590,7 @@ function summarizeWorkflowRun(run2) {
151928
152590
  ...run2.name !== void 0 ? { name: run2.name } : {},
151929
152591
  ...run2.description !== void 0 ? { description: run2.description } : {},
151930
152592
  status: run2.status,
152593
+ ...run2.errorCode !== void 0 ? { errorCode: run2.errorCode } : {},
151931
152594
  ...run2.agentFailures !== void 0 ? { agentFailures: run2.agentFailures } : {},
151932
152595
  ...run2.budgetOvershoot !== void 0 ? { budgetOvershoot: { ...run2.budgetOvershoot } } : {},
151933
152596
  ...run2.timeoutInterruption !== void 0 ? { timeoutInterruption: { ...run2.timeoutInterruption } } : {},
@@ -155071,7 +155734,10 @@ var SUBSTITUTION_PLACEHOLDER, UNREADABLE_EXPANSION_TEXT, UNDELIMITED_SUBSTITUTIO
155071
155734
  });
155072
155735
 
155073
155736
  // node_modules/@sema-agent/core/dist/tools/fs/bash-program-position.js
155074
- var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, launcherRow, LAUNCHER_TABLE, COMMAND_LAUNCHERS, SHELL_SCAN_DECLINES, init_bash_program_position = __esm({
155737
+ function seatDeclineEvidence(table) {
155738
+ return new Set(SHELL_SCAN_DECLINES.filter((decline) => table[decline] === !0));
155739
+ }
155740
+ var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, launcherRow, LAUNCHER_TABLE, COMMAND_LAUNCHERS, SHELL_SCAN_DECLINES, BOUNDARY_SEAT_READS_DECLINE, CLASSIFY_SEAT_READS_DECLINE, init_bash_program_position = __esm({
155075
155741
  "node_modules/@sema-agent/core/dist/tools/fs/bash-program-position.js"() {
155076
155742
  NOT_AUTO_ALLOWED = "\u2014 not auto-allowed", NO_DECLARED_OPTIONS = { optionArity: /* @__PURE__ */ new Map() }, launcherRow = (pairs, extra = {}) => ({ optionArity: new Map(pairs), ...extra }), LAUNCHER_TABLE = /* @__PURE__ */ new Map([
155077
155743
  ["env", launcherRow([["-i", 0], ["-0", 0], ["-v", 0], ["--ignore-environment", 0], ["--null", 0], ["--debug", 0], ["-u", 1], ["--unset", 1]], { assignmentOperands: !0 })],
@@ -155136,7 +155802,13 @@ var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, launcherRow, LAUNCHER_TABLE, COMMAND_
155136
155802
  ["valgrind", NO_DECLARED_OPTIONS],
155137
155803
  ["firejail", { optionArity: /* @__PURE__ */ new Map(), whenNoProgram: "shell" }],
155138
155804
  ["bwrap", NO_DECLARED_OPTIONS]
155139
- ]), COMMAND_LAUNCHERS = new Set(LAUNCHER_TABLE.keys()), SHELL_SCAN_DECLINES = ["unreadable_program_position", "stream_fed_operands"];
155805
+ ]), COMMAND_LAUNCHERS = new Set(LAUNCHER_TABLE.keys()), SHELL_SCAN_DECLINES = ["unreadable_program_position", "stream_fed_operands"], BOUNDARY_SEAT_READS_DECLINE = {
155806
+ unreadable_program_position: !0,
155807
+ stream_fed_operands: !0
155808
+ }, CLASSIFY_SEAT_READS_DECLINE = {
155809
+ unreadable_program_position: !1,
155810
+ stream_fed_operands: !1
155811
+ };
155140
155812
  }
155141
155813
  });
155142
155814
 
@@ -155147,9 +155819,13 @@ function hasBareShellOperator(s, quotedOperatorsAreText) {
155147
155819
  let mask = quoteMask(s);
155148
155820
  if (!mask.balanced)
155149
155821
  return SHELL_OPERATORS.test(s);
155150
- for (let i = 0; i < s.length; i++)
155151
- if (!mask.quoted[i] && SHELL_OPERATORS.test(s[i]))
155822
+ for (let i = 0; i < s.length; i++) {
155823
+ let ch2 = s[i];
155824
+ if (!SHELL_OPERATORS.test(ch2))
155825
+ continue;
155826
+ if (!(SHELL_EXPANDS_IN_DOUBLE_QUOTES.test(ch2) ? mask.openedBy[i] === "'" : mask.quoted[i]))
155152
155827
  return !0;
155828
+ }
155153
155829
  return !1;
155154
155830
  }
155155
155831
  function parseLeadingCommandName(command8, options) {
@@ -155211,12 +155887,14 @@ function splitShellCompoundSegments(source, options) {
155211
155887
  let segments = lexed.segments.map((s) => s.text), connectors = lexed.segments.map((s) => s.connector);
155212
155888
  return { segments, pipeFed: connectors.map((k2) => k2 === "|"), connectors };
155213
155889
  }
155214
- var SHELL_OPERATORS, SHELL_SEGMENT_QUOTE_BLIND_REJECT, SHELL_EXPANSION_CHARS, SHELL_REDIRECTION_OPERATORS, SHELL_CONNECTOR_CHARS, BLANK_INLINE, PERL_INLINE, RUBY_INLINE, PYTHON_INLINE, NODE_INLINE, PHP_INLINE, LUA_INLINE, TCL_INLINE, EXPECT_INLINE, AWK_INLINE, JQ_INLINE, BC_INLINE, DC_INLINE, SQLITE_INLINE, PSQL_INLINE, OSASCRIPT_INLINE, RSCRIPT_INLINE, JULIA_INLINE, GHCI_INLINE, GROOVY_INLINE, BUN_INLINE, init_bash_readonly_classifier = __esm({
155890
+ var SHELL_OPERATORS, SHELL_EXPANDS_IN_DOUBLE_QUOTES, SHELL_SEGMENT_QUOTE_BLIND_REJECT, SHELL_EXPANSION_CHARS, SHELL_REDIRECTION_OPERATORS, SHELL_CONNECTOR_CHARS, BLANK_INLINE, PERL_INLINE, RUBY_INLINE, PYTHON_INLINE, NODE_INLINE, PHP_INLINE, LUA_INLINE, TCL_INLINE, EXPECT_INLINE, AWK_INLINE, JQ_INLINE, BC_INLINE, DC_INLINE, SQLITE_INLINE, PSQL_INLINE, OSASCRIPT_INLINE, RSCRIPT_INLINE, JULIA_INLINE, GHCI_INLINE, GROOVY_INLINE, BUN_INLINE, init_bash_readonly_classifier = __esm({
155215
155891
  "node_modules/@sema-agent/core/dist/tools/fs/bash-readonly-classifier.js"() {
155892
+ init_read_deny();
155216
155893
  init_safety();
155217
155894
  init_bash_lexer();
155218
155895
  init_bash_program_position();
155219
155896
  SHELL_OPERATORS = /[;&|<>$()`\n\r\\]/;
155897
+ SHELL_EXPANDS_IN_DOUBLE_QUOTES = /[$`]/;
155220
155898
  SHELL_SEGMENT_QUOTE_BLIND_REJECT = /[<>()`\n\r\\]/, SHELL_EXPANSION_CHARS = /[$]/;
155221
155899
  SHELL_REDIRECTION_OPERATORS = /[<>]/, SHELL_CONNECTOR_CHARS = /[|&;]/;
155222
155900
  BLANK_INLINE = {
@@ -155411,7 +156089,7 @@ var init_gh_rate_limit = __esm({
155411
156089
  });
155412
156090
 
155413
156091
  // node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js
155414
- var BOUNDARY_SEAT_DECLINE_EVIDENCE, TOOL_PROGRESS_BOUND, READONLY_FACE_ESCAPE_PROSE, init_fs_bash = __esm({
156092
+ var BOUNDARY_SEAT_DECLINE_EVIDENCE, CLASSIFY_SEAT_DECLINE_EVIDENCE, TOOL_PROGRESS_BOUND, READONLY_FACE_ESCAPE_PROSE, FULL_SHELL_FACE_ESCAPE_PROSE, MONITOR_ESCAPE_PROSE, init_fs_bash = __esm({
155415
156093
  "node_modules/@sema-agent/core/dist/tools/fs/fs-bash.js"() {
155416
156094
  init_build3();
155417
156095
  init_tools();
@@ -155421,6 +156099,7 @@ var BOUNDARY_SEAT_DECLINE_EVIDENCE, TOOL_PROGRESS_BOUND, READONLY_FACE_ESCAPE_PR
155421
156099
  init_task_tool_shape();
155422
156100
  init_background_shell();
155423
156101
  init_untrusted_text();
156102
+ init_surrogate_safe_slice();
155424
156103
  init_mcp();
155425
156104
  init_safety();
155426
156105
  init_remote_env();
@@ -155429,102 +156108,21 @@ var BOUNDARY_SEAT_DECLINE_EVIDENCE, TOOL_PROGRESS_BOUND, READONLY_FACE_ESCAPE_PR
155429
156108
  init_untrusted_text();
155430
156109
  init_bash_readonly_classifier();
155431
156110
  init_bash_program_position();
156111
+ init_read_deny();
155432
156112
  init_tool_catalog_entries();
155433
156113
  init_thrown_value();
155434
156114
  init_tool_catalog_entries();
155435
- BOUNDARY_SEAT_DECLINE_EVIDENCE = new Set(SHELL_SCAN_DECLINES), TOOL_PROGRESS_BOUND = Object.freeze({ intervalMs: 1e3, tailLines: 20, tailMaxBytes: 16 * 1024 }), READONLY_FACE_ESCAPE_PROSE = {
156115
+ BOUNDARY_SEAT_DECLINE_EVIDENCE = seatDeclineEvidence(BOUNDARY_SEAT_READS_DECLINE), CLASSIFY_SEAT_DECLINE_EVIDENCE = seatDeclineEvidence(CLASSIFY_SEAT_READS_DECLINE), TOOL_PROGRESS_BOUND = Object.freeze({ intervalMs: 1e3, tailLines: 20, tailMaxBytes: 16 * 1024 }), READONLY_FACE_ESCAPE_PROSE = {
156116
+ tool: "Bash",
155436
156117
  subject: "a path this command reads",
155437
156118
  verdictPhrase: ` ${NOT_AUTO_ALLOWED}`,
155438
156119
  note: BASH_READONLY_CONFINEMENT_NOTE
155439
- };
155440
- }
155441
- });
155442
-
155443
- // node_modules/@sema-agent/core/dist/tools/fs/read-deny.js
155444
- function resolveReadDenyBuiltins(config4) {
155445
- let activeTiers;
155446
- if (config4?.tiers === void 0)
155447
- activeTiers = new Set(READ_DENY_DEFAULT_TIERS);
155448
- else {
155449
- if (!Array.isArray(config4.tiers))
155450
- throw new Error(`readDenyBuiltinTiers: expected an array of tier names, got ${JSON.stringify(config4.tiers)}.`);
155451
- for (let t2 of config4.tiers)
155452
- if (typeof t2 != "string" || !READ_DENY_BUILTIN_TIERS.includes(t2))
155453
- throw new Error(`readDenyBuiltinTiers: unknown tier ${JSON.stringify(t2)} \u2014 known tiers: ${READ_DENY_BUILTIN_TIERS.join(", ")}.`);
155454
- activeTiers = new Set(config4.tiers);
155455
- }
155456
- let excluded;
155457
- if (config4?.exclude === void 0)
155458
- excluded = /* @__PURE__ */ new Set();
155459
- else {
155460
- if (!Array.isArray(config4.exclude))
155461
- throw new Error(`readDenyBuiltinExclude: expected an array of built-in row names (canonical pattern texts), got ${JSON.stringify(config4.exclude)}.`);
155462
- for (let name of config4.exclude)
155463
- if (typeof name != "string" || !READ_FACE_BUILTIN_DENY_TABLE.some((r) => r.pattern === name))
155464
- throw new Error(`readDenyBuiltinExclude: ${JSON.stringify(name)} names no built-in row \u2014 row names are the canonical pattern texts of READ_FACE_BUILTIN_DENY_TABLE (e.g. ".ssh", ".config/gcloud").`);
155465
- excluded = new Set(config4.exclude);
155466
- }
155467
- return READ_FACE_BUILTIN_DENY_TABLE.filter((r) => activeTiers.has(r.tier) && !excluded.has(r.pattern));
155468
- }
155469
- var READ_DENY_BUILTIN_TIERS, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_DEFAULT_TIERS, READ_FACE_DEFAULT_DENY_ENTRIES, init_read_deny = __esm({
155470
- "node_modules/@sema-agent/core/dist/tools/fs/read-deny.js"() {
155471
- READ_DENY_BUILTIN_TIERS = ["credentials", "shell-history", "browser", "wallet", "agent-config"], READ_FACE_BUILTIN_DENY_TABLE = [
155472
- { pattern: ".ssh", tier: "credentials" },
155473
- { pattern: "id_rsa*", tier: "credentials" },
155474
- { pattern: "id_ed25519*", tier: "credentials" },
155475
- { pattern: "id_ecdsa*", tier: "credentials" },
155476
- { pattern: ".gnupg", tier: "credentials" },
155477
- { pattern: ".aws", tier: "credentials" },
155478
- { pattern: ".config/gcloud", tier: "credentials" },
155479
- { pattern: ".azure", tier: "credentials" },
155480
- { pattern: ".kube", tier: "credentials" },
155481
- { pattern: ".netrc", tier: "credentials" },
155482
- { pattern: "_netrc", tier: "credentials" },
155483
- { pattern: ".git-credentials", tier: "credentials" },
155484
- { pattern: ".docker/config.json", tier: "credentials" },
155485
- { pattern: ".config/gh", tier: "credentials" },
155486
- { pattern: ".npmrc", tier: "credentials" },
155487
- { pattern: ".pypirc", tier: "credentials" },
155488
- { pattern: ".local/share/keyrings", tier: "credentials" },
155489
- { pattern: "Library/Keychains", tier: "credentials" },
155490
- { pattern: ".credentials.json", tier: "credentials" },
155491
- { pattern: ".codex/auth.json", tier: "credentials" },
155492
- { pattern: ".config/github-copilot", tier: "credentials" },
155493
- { pattern: ".gemini/oauth_creds.json", tier: "credentials" },
155494
- { pattern: ".bash_history", tier: "shell-history" },
155495
- { pattern: ".zsh_history", tier: "shell-history" },
155496
- { pattern: "Library/Application Support/Google/Chrome", tier: "browser" },
155497
- { pattern: "Library/Application Support/Firefox", tier: "browser" },
155498
- { pattern: "Library/Safari", tier: "browser" },
155499
- { pattern: ".config/google-chrome", tier: "browser" },
155500
- { pattern: ".config/chromium", tier: "browser" },
155501
- { pattern: ".mozilla/firefox", tier: "browser" },
155502
- { pattern: "AppData/Local/Google/Chrome/User Data", tier: "browser" },
155503
- { pattern: "AppData/Local/Microsoft/Edge/User Data", tier: "browser" },
155504
- { pattern: "AppData/Roaming/Mozilla/Firefox", tier: "browser" },
155505
- { pattern: ".bitcoin", tier: "wallet" },
155506
- { pattern: ".ethereum", tier: "wallet" },
155507
- { pattern: ".electrum", tier: "wallet" },
155508
- { pattern: "Library/Application Support/Exodus", tier: "wallet" },
155509
- { pattern: "Library/Application Support/Ledger Live", tier: "wallet" },
155510
- { pattern: "wallet.dat", tier: "wallet" },
155511
- { pattern: ".sema/settings.json", tier: "agent-config" },
155512
- { pattern: ".sema/settings.local.json", tier: "agent-config" },
155513
- { pattern: ".sema.*", tier: "agent-config" },
155514
- { pattern: ".claude/settings.json", tier: "agent-config" },
155515
- { pattern: ".claude/settings.local.json", tier: "agent-config" },
155516
- { pattern: ".claude.*", tier: "agent-config" },
155517
- { pattern: ".mcp.json", tier: "agent-config" },
155518
- { pattern: ".ai-agent/.env", tier: "agent-config" },
155519
- { pattern: ".sema/engine-data/.env", tier: "agent-config" },
155520
- { pattern: ".codex/config.toml", tier: "agent-config" },
155521
- { pattern: ".cursor/mcp.json", tier: "agent-config" },
155522
- { pattern: ".continue/config.json", tier: "agent-config" },
155523
- { pattern: ".continue/config.yaml", tier: "agent-config" },
155524
- { pattern: ".aider.conf.yml", tier: "agent-config" },
155525
- { pattern: ".gemini/settings.json", tier: "agent-config" }
155526
- ], READ_DENY_DEFAULT_TIERS = [];
155527
- READ_FACE_DEFAULT_DENY_ENTRIES = resolveReadDenyBuiltins().map((r) => r.pattern);
156120
+ }, FULL_SHELL_FACE_ESCAPE_PROSE = {
156121
+ tool: "Bash",
156122
+ subject: "a path this command names",
156123
+ verdictPhrase: "",
156124
+ note: "The read boundary judged this command's written spelling before the call was approved, and execution is past the approval step \u2014 a target reached only through symlink resolution is refused here rather than escalated."
156125
+ }, MONITOR_ESCAPE_PROSE = { ...FULL_SHELL_FACE_ESCAPE_PROSE, tool: "Monitor" };
155528
156126
  }
155529
156127
  });
155530
156128
 
@@ -155910,7 +156508,7 @@ function ruleLaneShapeOf(command8, reading) {
155910
156508
  names2.push(void 0);
155911
156509
  continue;
155912
156510
  }
155913
- let floor = parseLeadingCommandName(segment2, { ...RULE_LANE_FLOOR, quotedOperatorsAreText: reading.quotedOperatorsAreText });
156511
+ let floor = parseLeadingCommandName(segment2, RULE_LANE_FLOOR);
155914
156512
  if ("reject" in floor)
155915
156513
  return {
155916
156514
  reject: split.segments.length > 1 ? `the segment "${escapeForDisclosure(segment2.trim())}" is not a single simple command (${floor.reject})` : floor.reject
@@ -156044,7 +156642,7 @@ function admitsUnder(rule, command8, reading) {
156044
156642
  if (rule.match === "exact")
156045
156643
  return folded === rule.command;
156046
156644
  let bodyShape = ruleLaneShapeOf(rule.command, reading);
156047
- return "reject" in bodyShape || shape.segments.length !== bodyShape.segments.length ? !1 : folded === rule.command || folded.startsWith(rule.command + " ");
156645
+ return "reject" in bodyShape || foldSpacing(rule.command) === void 0 || shape.segments.length !== bodyShape.segments.length ? !1 : folded === rule.command || folded.startsWith(rule.command + " ");
156048
156646
  }
156049
156647
  function ruleBreadthWarningsOf(rule) {
156050
156648
  if (rule.match !== "prefix" && rule.match !== "wildcard")
@@ -156242,7 +156840,10 @@ var RULE_BEHAVIORS, RULE_BEHAVIOR_SET, RULE_BEHAVIOR_PRECEDENCE, RULE_BEHAVIORS_
156242
156840
  "gh search prs",
156243
156841
  "gh search code"
156244
156842
  ], LEXICON_BODIES = SUGGESTION_LEXICON.map((b3) => b3.split(" ")), SCREENED_HEAD_NAMES = new Set([...BARE_INTERPRETER_NAMES].map((n2) => n2.toLowerCase()));
156245
- RULE_LANE_FLOOR = { pathPrefixedNameIsText: !0 }, MATCH_READING = { terminator: "keep", quotedOperatorsAreText: !1, redirection: "reject" };
156843
+ RULE_LANE_FLOOR = {
156844
+ pathPrefixedNameIsText: !0,
156845
+ quotedOperatorsAreText: !0
156846
+ }, MATCH_READING = { terminator: "keep", redirection: "reject" };
156246
156847
  CONTROL_CHARS_RE = /[\u0000-\u0008\u000A-\u001F\u007F-\u009F\p{Cf}\u2028\u2029]/u, CONTROL_CHARS_GLOBAL_RE = new RegExp(CONTROL_CHARS_RE.source, "gu"), DISCLOSED_RULE_TEXT_MAX_CHARS = 120;
156247
156848
  DISPLAY_STRIP_FORMAT_RE = new RegExp("\\p{Cf}", "gu");
156248
156849
  PATH_RULE_BASE_LABEL = {
@@ -156655,6 +157256,7 @@ var MAX_PENDING_STEER_CHARS, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES, MAX_PENDING_
156655
157256
  init_permission_rule_model();
156656
157257
  init_untrusted_egress();
156657
157258
  init_ask_question();
157259
+ init_untrusted_text();
156658
157260
  MAX_PENDING_STEER_CHARS = 16e3, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES = 48e3, MAX_PENDING_STEER_ENTRIES = Math.floor(PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES / MAX_PENDING_STEER_CHARS), CheckpointError = class extends Error {
156659
157261
  code;
156660
157262
  detail;
@@ -158224,10 +158826,19 @@ var init_task_outcome = __esm({
158224
158826
  }
158225
158827
  });
158226
158828
 
158829
+ // node_modules/@sema-agent/core/dist/brain/errors.js
158830
+ var BRAIN_ERROR_CODES, CODE_ALTERNATION, CODE_RE, CODE_PREFIX_RE, init_errors10 = __esm({
158831
+ "node_modules/@sema-agent/core/dist/brain/errors.js"() {
158832
+ init_thrown_value();
158833
+ BRAIN_ERROR_CODES = ["auth", "rate_limit", "invalid_request", "server", "network", "http", "stream_torn", "refusal", "length_empty"], CODE_ALTERNATION = BRAIN_ERROR_CODES.join("|"), CODE_RE = new RegExp(`^\\[(${CODE_ALTERNATION})\\]`), CODE_PREFIX_RE = new RegExp(`^\\[(?:${CODE_ALTERNATION})\\]\\s*`);
158834
+ }
158835
+ });
158836
+
158227
158837
  // node_modules/@sema-agent/core/dist/brain/route-adjudicator.js
158228
158838
  var init_route_adjudicator = __esm({
158229
158839
  "node_modules/@sema-agent/core/dist/brain/route-adjudicator.js"() {
158230
158840
  init_request_params();
158841
+ init_errors10();
158231
158842
  }
158232
158843
  });
158233
158844
 
@@ -158247,14 +158858,6 @@ var SWAPPABLE_DEP_SEATS, SWAPPABLE_DEP_SEAT_SET, init_swappable_deps = __esm({
158247
158858
  }
158248
158859
  });
158249
158860
 
158250
- // node_modules/@sema-agent/core/dist/brain/errors.js
158251
- var BRAIN_ERROR_CODES, CODE_ALTERNATION, CODE_RE, CODE_PREFIX_RE, init_errors10 = __esm({
158252
- "node_modules/@sema-agent/core/dist/brain/errors.js"() {
158253
- init_thrown_value();
158254
- BRAIN_ERROR_CODES = ["auth", "rate_limit", "invalid_request", "server", "network", "http", "stream_torn", "refusal", "length_empty"], CODE_ALTERNATION = BRAIN_ERROR_CODES.join("|"), CODE_RE = new RegExp(`^\\[(${CODE_ALTERNATION})\\]`), CODE_PREFIX_RE = new RegExp(`^\\[(?:${CODE_ALTERNATION})\\]\\s*`);
158255
- }
158256
- });
158257
-
158258
158861
  // node_modules/@sema-agent/core/dist/brain/circuit-breaker.js
158259
158862
  var init_circuit_breaker = __esm({
158260
158863
  "node_modules/@sema-agent/core/dist/brain/circuit-breaker.js"() {
@@ -160636,6 +161239,7 @@ var MONITOR_DESCRIPTION, init_monitor = __esm({
160636
161239
  init_background_shell();
160637
161240
  init_task_registry();
160638
161241
  init_tool_catalog_entries();
161242
+ init_fs_bash();
160639
161243
  init_thrown_value();
160640
161244
  MONITOR_DESCRIPTION = `Run a shell command in the background and watch its stdout as a stream of events.
160641
161245
 
@@ -163830,11 +164434,13 @@ var ERROR_BODY_BYTE_CAP, init_stream_engine = __esm({
163830
164434
  init_stream_shared();
163831
164435
  init_context_overflow();
163832
164436
  init_errors10();
164437
+ init_route_adjudicator();
163833
164438
  init_input_too_long();
163834
164439
  init_retry();
163835
164440
  init_status_sink();
163836
164441
  init_timeout();
163837
164442
  init_thrown_value();
164443
+ init_untrusted_egress();
163838
164444
  ERROR_BODY_BYTE_CAP = 64 * 1024;
163839
164445
  }
163840
164446
  });
@@ -251285,7 +251891,7 @@ function ruleStoreUnreadableNote(kind) {
251285
251891
  function readRootCandidateNote(v2) {
251286
251892
  if (v2 === void 0) return;
251287
251893
  let dir = elideUntrustedPath(v2.dir, 512);
251288
- return `candidate read root ${dir} \u2014 if it is a directory, adding it as a session read directory (/add-dir ${dir}) clears this ask`;
251894
+ return v2.covers === "exact" ? `candidate read root ${dir} \u2014 the engine named this exact path, not a directory. This host can only add directories as session read directories, and widening to the enclosing directory would grant more than this ask needs, so there is no one-step way to clear it here: answer this card instead.` : `candidate read root ${dir} \u2014 adding it as a session read directory (/add-dir ${dir}) clears this ask`;
251289
251895
  }
251290
251896
  function askFrameNoteParts(req2, _autoModeRaw) {
251291
251897
  let denial = denialLimitFallbackNote(req2.denialLimitFallback), origin2 = askOriginNote(req2.origin), ruleStore = ruleStoreUnreadableNote(req2.ruleStoreUnreadable), absence = ruleOffersAbsenceNote(req2.ruleOffersAbsence), readRoot = readRootCandidateNote(req2.readRootCandidate);
@@ -251904,10 +252510,17 @@ function planReviewEchoBackoffMs(attempt) {
251904
252510
  let i = Math.min(Math.floor(attempt), PLAN_REVIEW_ECHO_BACKOFF_LADDER.length - 1);
251905
252511
  return PLAN_REVIEW_ECHO_BACKOFF_LADDER[i];
251906
252512
  }
251907
- var openWindows, PLAN_REVIEW_ECHO_BACKOFF_LADDER, PLAN_REVIEW_ECHO_MAX_RETRIES, init_planReviewDecisionWindow = __esm({
252513
+ function planReviewEchoDeferral(attempt, deferredSoFarMs) {
252514
+ let spent = Number.isFinite(deferredSoFarMs) && deferredSoFarMs > 0 ? deferredSoFarMs : 0;
252515
+ return spent >= PLAN_REVIEW_ECHO_TOTAL_CAP_MS ? { kind: "fallback" } : { kind: "defer", waitMs: Math.min(planReviewEchoBackoffMs(attempt), PLAN_REVIEW_ECHO_TOTAL_CAP_MS - spent) };
252516
+ }
252517
+ function shouldSuppressPlanReviewReopen(taskId) {
252518
+ return typeof taskId == "string" && taskId !== "" && openWindows.has(taskId);
252519
+ }
252520
+ var openWindows, PLAN_REVIEW_ECHO_BACKOFF_LADDER, PLAN_REVIEW_ECHO_TOTAL_CAP_MS, PLAN_REVIEW_ECHO_MAX_RETRIES, init_planReviewDecisionWindow = __esm({
251908
252521
  "build-src/src/sema/planReviewDecisionWindow.ts"() {
251909
252522
  openWindows = /* @__PURE__ */ new Set();
251910
- PLAN_REVIEW_ECHO_BACKOFF_LADDER = [400, 800, 1600, 3200], PLAN_REVIEW_ECHO_MAX_RETRIES = PLAN_REVIEW_ECHO_BACKOFF_LADDER.length;
252523
+ PLAN_REVIEW_ECHO_BACKOFF_LADDER = [400, 800, 1600, 3200, 6400], PLAN_REVIEW_ECHO_TOTAL_CAP_MS = 6e4, PLAN_REVIEW_ECHO_MAX_RETRIES = PLAN_REVIEW_ECHO_BACKOFF_LADDER.length;
251911
252524
  }
251912
252525
  });
251913
252526
 
@@ -307626,7 +308239,7 @@ function FileEditToolUseRejectedMessage(t0) {
307626
308239
  }
307627
308240
  var import_compiler_runtime38, import_jsx_runtime45, MAX_LINES_TO_RENDER, init_FileEditToolUseRejectedMessage = __esm({
307628
308241
  "build-src/src/components/FileEditToolUseRejectedMessage.tsx"() {
307629
- import_compiler_runtime38 = __toESM(require_compiler_runtime());
308242
+ import_compiler_runtime38 = __toESM(require_compiler_runtime(), 1);
307630
308243
  init_useTerminalSize();
307631
308244
  init_cwd();
307632
308245
  init_ink2();
@@ -307634,7 +308247,7 @@ var import_compiler_runtime38, import_jsx_runtime45, MAX_LINES_TO_RENDER, init_F
307634
308247
  init_MessageResponse();
307635
308248
  init_StructuredDiffList();
307636
308249
  init_stringUtils();
307637
- import_jsx_runtime45 = __toESM(require_jsx_runtime()), MAX_LINES_TO_RENDER = 10;
308250
+ import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1), MAX_LINES_TO_RENDER = 10;
307638
308251
  }
307639
308252
  });
307640
308253
 
@@ -357967,10 +358580,12 @@ __export(suspendedAskPort_exports, {
357967
358580
  claimStreamApproval: () => claimStreamApproval,
357968
358581
  forgetSuspendedAsk: () => forgetSuspendedAsk,
357969
358582
  installLiveToolApprovalResponder: () => installLiveToolApprovalResponder,
358583
+ installStreamApprovalOutcomeSink: () => installStreamApprovalOutcomeSink,
357970
358584
  installSuspendedAskTracker: () => installSuspendedAskTracker,
357971
358585
  liveToolApprovalResponder: () => liveToolApprovalResponder,
357972
358586
  noteApprovalsAwaitingDecision: () => noteApprovalsAwaitingDecision,
357973
358587
  noteSeamClientInstalled: () => noteSeamClientInstalled,
358588
+ noteStreamApprovalOutcome: () => noteStreamApprovalOutcome,
357974
358589
  noteSuspendedAskDecided: () => noteSuspendedAskDecided,
357975
358590
  noteSuspendedAskFeedInstalled: () => noteSuspendedAskFeedInstalled,
357976
358591
  noteSuspendedAskSubmitted: () => noteSuspendedAskSubmitted,
@@ -358110,8 +358725,19 @@ function requeueSuspendedAsk(approvalId) {
358110
358725
  } catch {
358111
358726
  }
358112
358727
  }
358728
+ function installStreamApprovalOutcomeSink(fn2) {
358729
+ outcomeSink = fn2;
358730
+ }
358731
+ function noteStreamApprovalOutcome(note) {
358732
+ let sink2 = outcomeSink;
358733
+ if (sink2 !== null)
358734
+ try {
358735
+ sink2(note);
358736
+ } catch {
358737
+ }
358738
+ }
358113
358739
  function _resetSuspendedAskPortForTest() {
358114
- tracker = null, responder = null, claimed.clear(), decided.clear(), requeueUsed.clear(), submitting.clear(), seenInSnapshot.clear(), ledgerOverflowed = !1, installed3 = !1, count3 = null, listeners10.clear(), clientListeners.clear();
358740
+ tracker = null, responder = null, outcomeSink = null, claimed.clear(), decided.clear(), requeueUsed.clear(), submitting.clear(), seenInSnapshot.clear(), ledgerOverflowed = !1, installed3 = !1, count3 = null, listeners10.clear(), clientListeners.clear();
358115
358741
  }
358116
358742
  function emit5() {
358117
358743
  for (let l3 of [...listeners10])
@@ -358120,13 +358746,14 @@ function emit5() {
358120
358746
  } catch {
358121
358747
  }
358122
358748
  }
358123
- var responder, clientListeners, tracker, claimed, decided, requeueUsed, submitting, seenInSnapshot, CLAIM_LEDGER_MAX, ledgerOverflowed, installed3, count3, listeners10, init_suspendedAskPort = __esm({
358749
+ var responder, clientListeners, tracker, claimed, decided, requeueUsed, submitting, seenInSnapshot, CLAIM_LEDGER_MAX, ledgerOverflowed, installed3, count3, listeners10, outcomeSink, init_suspendedAskPort = __esm({
358124
358750
  "build-src/src/sema/suspendedAskPort.ts"() {
358125
358751
  responder = null;
358126
358752
  clientListeners = /* @__PURE__ */ new Set();
358127
358753
  tracker = null, claimed = /* @__PURE__ */ new Set(), decided = /* @__PURE__ */ new Set(), requeueUsed = /* @__PURE__ */ new Map(), submitting = /* @__PURE__ */ new Set(), seenInSnapshot = /* @__PURE__ */ new Set(), CLAIM_LEDGER_MAX = 4096;
358128
358754
  ledgerOverflowed = !1;
358129
358755
  installed3 = !1, count3 = null, listeners10 = /* @__PURE__ */ new Set();
358756
+ outcomeSink = null;
358130
358757
  }
358131
358758
  });
358132
358759
 
@@ -358701,11 +359328,11 @@ function RejectedPlanMessage(t0) {
358701
359328
  }
358702
359329
  var import_compiler_runtime106, import_jsx_runtime133, init_RejectedPlanMessage = __esm({
358703
359330
  "build-src/src/components/messages/UserToolResultMessage/RejectedPlanMessage.tsx"() {
358704
- import_compiler_runtime106 = __toESM(require_compiler_runtime());
359331
+ import_compiler_runtime106 = __toESM(require_compiler_runtime(), 1);
358705
359332
  init_Markdown();
358706
359333
  init_MessageResponse();
358707
359334
  init_ink2();
358708
- import_jsx_runtime133 = __toESM(require_jsx_runtime());
359335
+ import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
358709
359336
  }
358710
359337
  });
358711
359338
 
@@ -395049,6 +395676,79 @@ var HOOK_NOTICE_WARN_KEY, HOOK_NOTICE_WARN_TIMEOUT_MS, HOOK_FAILURE_WARN_KEY, ho
395049
395676
  }
395050
395677
  });
395051
395678
 
395679
+ // build-src/src/sema/engineAgentAbsence.ts
395680
+ function isAbsentRow(task) {
395681
+ return typeof task != "object" || task === null ? !1 : task._semaAbsence !== void 0;
395682
+ }
395683
+ function readRowAbsence(task) {
395684
+ if (!(typeof task != "object" || task === null))
395685
+ return task._semaAbsence;
395686
+ }
395687
+ function markEngineAgentRowAbsent(task, ev) {
395688
+ return task.status !== "running" || task._semaAbsence !== void 0 ? task : {
395689
+ ...task,
395690
+ _semaAbsence: { lastSeenAtMs: ev.lastSeenAtMs, absentForMs: ev.absentForMs },
395691
+ endTime: task.endTime ?? ev.lastSeenAtMs
395692
+ };
395693
+ }
395694
+ function clearEngineAgentRowAbsence(task) {
395695
+ return task._semaAbsence === void 0 ? task : { ...task, _semaAbsence: void 0, endTime: void 0 };
395696
+ }
395697
+ function engineAgentAbsenceExpired(task, now2 = Date.now(), ttlMs2 = 18e5) {
395698
+ let absence = readRowAbsence(task);
395699
+ return absence === void 0 ? !1 : now2 - absence.lastSeenAtMs >= ttlMs2;
395700
+ }
395701
+ function engineAgentAbsenceDroppedLine(label, ttlMs2 = 18e5, removeReason) {
395702
+ let minutes = Math.round(ttlMs2 / 6e4), why = typeof removeReason == "string" && removeReason !== "" ? ` \xB7 the engine removed it from the fleet list (${removeReason}); that is not an outcome \u2014 read the run to settle it` : " \xB7 outcome unknown";
395703
+ return `${label} was dropped from the task panel after ${minutes} min without an engine report${why}`;
395704
+ }
395705
+ function noteEngineAgentRowRemoved(taskId, removeReason) {
395706
+ if (taskId.length !== 0 && !(typeof removeReason != "string" || removeReason === ""))
395707
+ for (removedRowReasons.set(taskId, removeReason); removedRowReasons.size > REMOVED_ROW_REASON_LEDGER_MAX; ) {
395708
+ let oldest = removedRowReasons.keys().next();
395709
+ if (oldest.done === !0) break;
395710
+ removedRowReasons.delete(oldest.value);
395711
+ }
395712
+ }
395713
+ function takeEngineAgentRowRemoveReason(taskId) {
395714
+ let reason = removedRowReasons.get(taskId);
395715
+ return reason === void 0 ? null : (removedRowReasons.delete(taskId), reason);
395716
+ }
395717
+ function engineAgentTerminalAfterDropLine(label, status3, hasReport) {
395718
+ return `${label} reported ${status3} after it was dropped from the task panel${hasReport ? " \xB7 its final report arrived too late to keep in the panel" : ""}`;
395719
+ }
395720
+ function noteEngineAgentRowReclaimed(taskId, label) {
395721
+ if (taskId.length !== 0)
395722
+ for (reclaimedRows.set(taskId, label.length > 0 ? label : taskId); reclaimedRows.size > RECLAIMED_ROW_LEDGER_MAX; ) {
395723
+ let oldest = reclaimedRows.keys().next();
395724
+ if (oldest.done === !0) break;
395725
+ reclaimedRows.delete(oldest.value);
395726
+ }
395727
+ }
395728
+ function takeEngineAgentReclaimedRow(taskId) {
395729
+ let label = reclaimedRows.get(taskId);
395730
+ return label === void 0 ? null : (reclaimedRows.delete(taskId), label);
395731
+ }
395732
+ function reapExpiredEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
395733
+ let out6 = [];
395734
+ for (let [id, task] of Object.entries(tasks3))
395735
+ ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && (typeof task == "object" && task !== null && task.retain === !0 || out6.push(id));
395736
+ return out6;
395737
+ }
395738
+ function expiredButRetainedEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
395739
+ let out6 = [];
395740
+ for (let [id, task] of Object.entries(tasks3))
395741
+ ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && typeof task == "object" && task !== null && task.retain === !0 && out6.push(id);
395742
+ return out6;
395743
+ }
395744
+ var ENGINE_AGENT_ABSENT_ROW_TEXT, REMOVED_ROW_REASON_LEDGER_MAX, removedRowReasons, RECLAIMED_ROW_LEDGER_MAX, reclaimedRows, init_engineAgentAbsence = __esm({
395745
+ "build-src/src/sema/engineAgentAbsence.ts"() {
395746
+ ENGINE_AGENT_ABSENT_ROW_TEXT = "engine no longer reports this agent \xB7 outcome unknown";
395747
+ REMOVED_ROW_REASON_LEDGER_MAX = 256, removedRowReasons = /* @__PURE__ */ new Map();
395748
+ RECLAIMED_ROW_LEDGER_MAX = 256, reclaimedRows = /* @__PURE__ */ new Map();
395749
+ }
395750
+ });
395751
+
395052
395752
  // build-src/src/sema/fleetClient.ts
395053
395753
  var fleetClient_exports = {};
395054
395754
  __export(fleetClient_exports, {
@@ -395106,7 +395806,17 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
395106
395806
  // 按档留痕 —— 处置边界与论证见 fleetDurableTerminalOverlay.ts 的 `evidenceTier` 头注
395107
395807
  // (要点:本模块是进程内**呈现**面,不落库/不跨会话搬运/翻行另有一道正交归属门,
395108
395808
  // 故不属包文档划的「有副作用的归属动作」射程)。`rowIds` 本端暂无消费面,显式具名弃用。
395109
- onBgNotificationAccepted: (n2, _rowIds, evidence) => observeFleetBgNotification(n2, evidence)
395809
+ onBgNotificationAccepted: (n2, _rowIds, evidence) => observeFleetBgNotification(n2, evidence),
395810
+ // ── CC-65(client-core 0.74.0):`task_remove` 帧的**离场读口** ─────────────────────────
395811
+ // 🔴 离场**不是终局证据**(包头注逐字:结算的属主在 durable 侧)⇒ 这一端一个状态都不改、
395812
+ // 一行都不 settle,只把引擎给的**真因**记进缺席台账 —— 「为什么这一行不再上报」此前只能
395813
+ // 落到 TTL 回收那句「outcome unknown」,而引擎其实说过。
395814
+ // 🔴 两形不入账(包给的判别位,壳零自铸):`stale` = 退的是前一代、行根本没被删;
395815
+ // `unknownRow` = 账本里本来就没这一行(晚连接者收到的退场帧)。把这两形记进去就是拿
395816
+ // 别的事实去解释这一行的缺席。
395817
+ onTaskRemoved: (removal) => {
395818
+ removal.stale === !0 || removal.unknownRow === !0 || noteEngineAgentRowRemoved(removal.id, removal.removeReason);
395819
+ }
395110
395820
  }), lastError = null, disposed4 = !1, client3 = new AgentClient({
395111
395821
  baseUrl: config4.baseUrl,
395112
395822
  authToken: config4.authToken,
@@ -395232,6 +395942,7 @@ var ROW_FILTER, workflowRowObserver, init_fleetClient = __esm({
395232
395942
  init_fleetDurableTerminalOverlay();
395233
395943
  init_footerRowBelt();
395234
395944
  init_hookNoticeStore();
395945
+ init_engineAgentAbsence();
395235
395946
  init_dist();
395236
395947
  ROW_FILTER = (rows3) => filterFooterTaskRows(rows3), workflowRowObserver = null;
395237
395948
  Promise.resolve().then(() => (init_state(), state_exports)).then((m2) => {
@@ -399482,7 +400193,7 @@ async function* query(params) {
399482
400193
  }
399483
400194
  }
399484
400195
  }
399485
- }, bgTearResends = 0, drainingRetries = 0, planReviewEchoRetries = 0, resumeAtRetried = !1, busySignal = null, readBusySignal = () => busySignal, runningChoiceOffered = !1, runningChoiceSilentWaitTaskId = null, engineFrameSeen = !1, boundRunId, retryStream = !0, interruptedResendDone = !1, pendingInterruptedSettledRow = null, pendingAttachRunId, pendingFollowRow = null;
400196
+ }, bgTearResends = 0, drainingRetries = 0, planReviewEchoRetries = 0, planReviewEchoDeferredMs = 0, resumeAtRetried = !1, busySignal = null, readBusySignal = () => busySignal, runningChoiceOffered = !1, runningChoiceSilentWaitTaskId = null, engineFrameSeen = !1, boundRunId, retryStream = !0, interruptedResendDone = !1, pendingInterruptedSettledRow = null, pendingAttachRunId, pendingFollowRow = null;
399486
400197
  for (; retryStream; ) {
399487
400198
  retryStream = !1, engineFrameSeen = !1, busySignal = null, boundRunId = void 0;
399488
400199
  let attachRunId = pendingAttachRunId;
@@ -399607,18 +400318,18 @@ async function* query(params) {
399607
400318
  activeTaskStatus: detectedBusy.activeTaskStatus,
399608
400319
  pendingGateKind: detectedBusy.pendingGate?.kind ?? null
399609
400320
  };
399610
- if (submissionOrigin === "injected" && isMainLaneQuerySource(params.querySource) && !signal?.aborted && isStalePlanReviewEcho(planReviewEcho))
399611
- if (planReviewEchoRetries < PLAN_REVIEW_ECHO_MAX_RETRIES) {
399612
- let waitMs = planReviewEchoBackoffMs(planReviewEchoRetries);
399613
- planReviewEchoRetries++, logForDebugging(
399614
- `[sema][seamQuery] plan-review echo window on run ${String(detectedBusy.activeTaskId)} \u2014 deferring this injected submission ${String(planReviewEchoRetries)}/${String(PLAN_REVIEW_ECHO_MAX_RETRIES)} by ${String(waitMs)}ms instead of racing the decision (L-405)`
399615
- ), await new Promise((res) => setTimeout(res, waitMs)), signal?.aborted || (retryStream = !0);
400321
+ if (submissionOrigin === "injected" && isMainLaneQuerySource(params.querySource) && !signal?.aborted && isStalePlanReviewEcho(planReviewEcho)) {
400322
+ let deferral = planReviewEchoDeferral(planReviewEchoRetries, planReviewEchoDeferredMs);
400323
+ if (deferral.kind === "defer") {
400324
+ planReviewEchoRetries++, planReviewEchoDeferredMs += deferral.waitMs, logForDebugging(
400325
+ `[sema][seamQuery] plan-review echo window on run ${String(detectedBusy.activeTaskId)} \u2014 deferring this injected submission (attempt ${String(planReviewEchoRetries)}, ${String(deferral.waitMs)}ms, ${String(planReviewEchoDeferredMs)}/${String(PLAN_REVIEW_ECHO_TOTAL_CAP_MS)}ms spent)`
400326
+ ), await new Promise((res) => setTimeout(res, deferral.waitMs)), signal?.aborted || (retryStream = !0);
399616
400327
  continue;
399617
400328
  } else
399618
400329
  logForDebugging(
399619
- `[sema][seamQuery] plan-review echo window on run ${String(detectedBusy.activeTaskId)} did not clear within ${String(PLAN_REVIEW_ECHO_MAX_RETRIES)} deferrals \u2014 falling through to the existing self-heal leg (L-405)`
400330
+ `[sema][seamQuery] plan-review echo window on run ${String(detectedBusy.activeTaskId)} did not clear within ${String(PLAN_REVIEW_ECHO_TOTAL_CAP_MS)}ms \u2014 falling back to the self-heal lane with plan-review reopen suppressed`
399620
400331
  );
399621
- else leftPlanReviewGate(planReviewEcho) && clearPlanReviewDecisionWindow(detectedBusy.activeTaskId);
400332
+ } else leftPlanReviewGate(planReviewEcho) && clearPlanReviewDecisionWindow(detectedBusy.activeTaskId);
399622
400333
  let outcome = await attemptActiveRunSelfHeal2(detectedBusy, durableRunVerbs(client), {
399623
400334
  // `hasPendingDecision`(车L 12,原「故意不接」记账销案):真读面 = REPL
399624
400335
  // toolUseConfirmQueue 的模块级长度镜像(leaderPermissionBridge,队列变更 effect
@@ -399642,7 +400353,9 @@ async function* query(params) {
399642
400353
  // `plan-review:<taskId>`,而 REPL overlay 钩子带一个会话级 seenQuestionIds 去重集,
399643
400354
  // 同 id 再发一次会被**静默丢掉** —— 那样「已重新打开审批卡」就成了假话。
399644
400355
  // planReviewReopen 每次铸新身份,决断通路仍是同一个 decidePlanReview wire。
399645
- reopenPlanReview: reopenPlanReviewCard2,
400356
+ // L-422 守卫:本端刚交过决断且窗没关 ⇒ 拒开(reopened:false),绝不把已决断的门再问一遍;
400357
+ // 窗关(引擎已离开那道门 / 换代 / 清窗)才走真重开口。
400358
+ reopenPlanReview: (tid) => shouldSuppressPlanReviewReopen(tid) ? (logForDebugging(`[sema][seamQuery] plan-review reopen for run ${tid} suppressed \u2014 a decision from this shell is still being applied by the engine`), { reopened: !1 }) : reopenPlanReviewCard2(tid),
399646
400359
  // ask park 的重开口(#155):待决行经 approvals.list 取。结构判定装配 —— client 真有
399647
400360
  // approvals 面(live SDK)才装;mock 车道缺席 ⇒ dep 不装 ⇒ ask-reopen-failed 诚实臂。
399648
400361
  // MED-6(复审):装配门与包 HitlClientLike 的四动词同宽——只校 list 会让「有 list
@@ -401145,66 +401858,6 @@ var init_sanitizeToolResultContent = __esm({
401145
401858
  }
401146
401859
  });
401147
401860
 
401148
- // build-src/src/sema/engineAgentAbsence.ts
401149
- function isAbsentRow(task) {
401150
- return typeof task != "object" || task === null ? !1 : task._semaAbsence !== void 0;
401151
- }
401152
- function readRowAbsence(task) {
401153
- if (!(typeof task != "object" || task === null))
401154
- return task._semaAbsence;
401155
- }
401156
- function markEngineAgentRowAbsent(task, ev) {
401157
- return task.status !== "running" || task._semaAbsence !== void 0 ? task : {
401158
- ...task,
401159
- _semaAbsence: { lastSeenAtMs: ev.lastSeenAtMs, absentForMs: ev.absentForMs },
401160
- endTime: task.endTime ?? ev.lastSeenAtMs
401161
- };
401162
- }
401163
- function clearEngineAgentRowAbsence(task) {
401164
- return task._semaAbsence === void 0 ? task : { ...task, _semaAbsence: void 0, endTime: void 0 };
401165
- }
401166
- function engineAgentAbsenceExpired(task, now2 = Date.now(), ttlMs2 = 18e5) {
401167
- let absence = readRowAbsence(task);
401168
- return absence === void 0 ? !1 : now2 - absence.lastSeenAtMs >= ttlMs2;
401169
- }
401170
- function engineAgentAbsenceDroppedLine(label, ttlMs2 = 18e5) {
401171
- let minutes = Math.round(ttlMs2 / 6e4);
401172
- return `${label} was dropped from the task panel after ${minutes} min without an engine report \xB7 outcome unknown`;
401173
- }
401174
- function engineAgentTerminalAfterDropLine(label, status3, hasReport) {
401175
- return `${label} reported ${status3} after it was dropped from the task panel${hasReport ? " \xB7 its final report arrived too late to keep in the panel" : ""}`;
401176
- }
401177
- function noteEngineAgentRowReclaimed(taskId, label) {
401178
- if (taskId.length !== 0)
401179
- for (reclaimedRows.set(taskId, label.length > 0 ? label : taskId); reclaimedRows.size > RECLAIMED_ROW_LEDGER_MAX; ) {
401180
- let oldest = reclaimedRows.keys().next();
401181
- if (oldest.done === !0) break;
401182
- reclaimedRows.delete(oldest.value);
401183
- }
401184
- }
401185
- function takeEngineAgentReclaimedRow(taskId) {
401186
- let label = reclaimedRows.get(taskId);
401187
- return label === void 0 ? null : (reclaimedRows.delete(taskId), label);
401188
- }
401189
- function reapExpiredEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
401190
- let out6 = [];
401191
- for (let [id, task] of Object.entries(tasks3))
401192
- ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && (typeof task == "object" && task !== null && task.retain === !0 || out6.push(id));
401193
- return out6;
401194
- }
401195
- function expiredButRetainedEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
401196
- let out6 = [];
401197
- for (let [id, task] of Object.entries(tasks3))
401198
- ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && typeof task == "object" && task !== null && task.retain === !0 && out6.push(id);
401199
- return out6;
401200
- }
401201
- var ENGINE_AGENT_ABSENT_ROW_TEXT, RECLAIMED_ROW_LEDGER_MAX, reclaimedRows, init_engineAgentAbsence = __esm({
401202
- "build-src/src/sema/engineAgentAbsence.ts"() {
401203
- ENGINE_AGENT_ABSENT_ROW_TEXT = "engine no longer reports this agent \xB7 outcome unknown";
401204
- RECLAIMED_ROW_LEDGER_MAX = 256, reclaimedRows = /* @__PURE__ */ new Map();
401205
- }
401206
- });
401207
-
401208
401861
  // build/stubs/internalLogging.ts
401209
401862
  async function logPermissionContextForAnts(_toolPermissionContext, _moment) {
401210
401863
  }
@@ -426139,11 +426792,11 @@ function AddDirError(t0) {
426139
426792
  ] }), $3[7] = t3, $3[8] = t4, $3[9] = t5) : t5 = $3[9], t5;
426140
426793
  }
426141
426794
  async function call5(onDone, context3, args) {
426142
- let directoryPath = (args ?? "").trim(), appState = context3.getAppState(), handleAddDirectory = async (path28, remember2 = !1) => {
426795
+ let directoryPath = (args ?? "").trim(), appState = context3.getAppState(), handleAddDirectory = async (path28, remember3 = !1) => {
426143
426796
  let permissionUpdate = {
426144
426797
  type: "addDirectories",
426145
426798
  directories: [path28],
426146
- destination: remember2 ? "localSettings" : "session"
426799
+ destination: remember3 ? "localSettings" : "session"
426147
426800
  }, latestAppState = context3.getAppState(), updatedContext = applyPermissionUpdate(latestAppState.toolPermissionContext, permissionUpdate);
426148
426801
  context3.setAppState((prev) => ({
426149
426802
  ...prev,
@@ -426152,7 +426805,7 @@ async function call5(onDone, context3, args) {
426152
426805
  let currentDirs = getAdditionalDirectoriesForClaudeMd();
426153
426806
  currentDirs.includes(path28) || setAdditionalDirectoriesForClaudeMd([...currentDirs, path28]), SandboxManager2.refreshConfig(), broadcastRootsListChanged();
426154
426807
  let message;
426155
- if (remember2) {
426808
+ if (remember3) {
426156
426809
  let persistError = null;
426157
426810
  try {
426158
426811
  persistError = persistPermissionUpdate(permissionUpdate).error;
@@ -429410,23 +430063,20 @@ var sema_brand_default, init_sema_brand = __esm({
429410
430063
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
429411
430064
  },
429412
430065
  whatsNew: {
429413
- version: "1.0.122",
430066
+ version: "1.0.123",
429414
430067
  notes: [
429415
- "Bundled engine 7.87.3 (core 7.23.2), client runtime 0.73.5 and client SDK 9.7.1; the settings schema stays 2.1.0. /doctor and the engine line report 7.87.3.",
429416
- "Credentials in an endpoint URL no longer reach the screen, the transcript or the log files. When the engine's own error text or a notice carries the URL it dialled, sema masks the user name, any query values and any fragment before rendering, on every surface: -p text, json and stream-json output, the interactive error row and notice, the /model failure receipt, sema doctor, the session transcript and the error log. Host, port, path and query key names are kept because those are what you need to fix the setting; a successful answer is never touched.",
429417
- "When both MODEL_GATEWAY_BASEURL and an explicit MODEL_PROVIDER are set and the gateway serves the hop, the line that says so now appears for every kind of model-lane failure (network, request construction, timeout, not only HTTP status codes) and in all three -p output formats. The startup warning and the /status row use the same wording, so the shell no longer says two different things about which setting routes the request. If the engine refuses to start because MODEL_PROVIDER is not one of the accepted values, the shell shows the engine's own refusal line with its machine-readable code, the offending value and the accepted values instead of guessing that the port is in use.",
429418
- "Background subagents that hit an approval gate now raise their card in the session instead of stalling silently. The footer says how many subagent approvals are waiting on you and shows a dash when the engine does not report it. On engines that do not carry the subagent call's arguments the card says so and no longer offers edit-then-approve.",
429419
- "Approving a plan no longer makes a second plan-review card appear afterwards.",
429420
- "Background task panel: a task parked at a pending approval keeps its row through compaction and the row says it is waiting for an approval. Numbers the engine did not report show as a dash instead of 0 (duration, progress), and the usage and queue badges are simply omitted. The workflow size warning no longer vanishes when the total is unknown; it says the size was not reported. When a background agent starts a new cycle its usage and tool counters reset instead of carrying the previous cycle's numbers, and the workflow details header omits the agent count when the details could not be fetched.",
429421
- "Cancel and submit failures are explained by the engine's own code: a cancel refused because the gate was already decided is worded differently from one where the cancel flag did not attach and can simply be resent, and a submit refused by the deployment's usage window says how long to wait when the engine gives a window and states no number when it does not.",
429422
- "Interrupted turns now tell you when the engine you were talking to was replaced by another process, not just when the whole instance changed. Cancelling a turn records which engine run it belonged to, so a later resume can ask the engine what happened to it.",
429423
- "Plugins: installing a plugin whose own plugin.json lists dependencies now installs them too, including plugins that come from a git or npm source. A dependency that cannot be installed automatically is named in the install output instead of being silent. Plugin options that declare a default value work without opening the configuration dialog first; the declared default is used until you set your own.",
429424
- "sema mcp list and sema mcp get now say why a connection failed (HTTP status text, the remote's own message, endpoint not found, connection refused) instead of a bare Failed to connect; credentials inside that text are masked and, when no reason is available, the row says so. mcp get adds an Issue line under Status for a failing server.",
429425
- "/context adds a note when the numbers shrank by less than the display's precision, and the read-directory hint on approval cards no longer promises that /add-dir will clear the question when the candidate is a single file."
430068
+ "Bundled engine 7.88.2 (core 7.23.5), client runtime 0.74.3, client SDK 9.8.1 and settings schema 3.0.0. /doctor and the engine line report 7.88.2.",
430069
+ "A background subagent's approval card is withdrawn when the session, the engine or the credentials change, and withdrawing it no longer sends a decision on your behalf. An approval whose answer never reached the engine comes back on the next update instead of after two.",
430070
+ "A background agent that starts a new round now shows that round: its status, timer and counters move together, and a late ending from the previous round no longer closes it. When the engine says why it removed an agent, the panel's cleanup line says so. The same agent no longer shows up as two rows.",
430071
+ "Credentials that a remote echoes back no longer reach the terminal, the streamed output or the saved transcript, including passwords with punctuation and short values. On engine 7.88 and later a gateway URL that carries credentials in its userinfo stops the engine from starting, and sema shows that refusal by name without printing the credentials. 1.0.122 covered the interactive screen, the -p result frame and stderr; the -p transcript and stream-json frames, and punctuated or short secrets, are covered from this version.",
430072
+ "Approving a plan no longer brings a second card even when the engine takes a while to resume.",
430073
+ "The workflow list now says why a failed run failed.",
430074
+ "A read-root suggestion that names a single file no longer tells you to add it as a directory.",
430075
+ "mcp list and mcp get no longer print a password that the server echoed back."
429426
430076
  ]
429427
430077
  },
429428
- productVersion: "1.0.122",
429429
- announcement: "sema 1.0.122 \u2014 engine 7.87.3 pickup (core 7.23.2), client runtime 0.73.5, client SDK 9.7.1. Credentials in endpoint URLs are masked on every surface; background subagents raise their approval card instead of stalling; approving a plan no longer brings a second card; the task panel shows a dash for numbers the engine did not report; plugins install their manifest dependencies and honour declared option defaults; mcp list and mcp get say why a connection failed.",
430078
+ productVersion: "1.0.123",
430079
+ announcement: "sema 1.0.123 \u2014 engine 7.88.2 pickup (core 7.23.5), client runtime 0.74.3, client SDK 9.8.1, settings schema 3.0.0. Background subagent approval cards are withdrawn without deciding for you; a revived agent shows its new round; credentials echoed by a remote stay out of the transcript and streamed output; a gateway URL with credentials now stops the engine at startup; approving a plan brings no second card; the workflow list says why a run failed.",
429430
430080
  version: "1.0.91"
429431
430081
  };
429432
430082
  }
@@ -456705,23 +457355,20 @@ var require_sema_brand = __commonJS({
456705
457355
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
456706
457356
  },
456707
457357
  whatsNew: {
456708
- version: "1.0.122",
457358
+ version: "1.0.123",
456709
457359
  notes: [
456710
- "Bundled engine 7.87.3 (core 7.23.2), client runtime 0.73.5 and client SDK 9.7.1; the settings schema stays 2.1.0. /doctor and the engine line report 7.87.3.",
456711
- "Credentials in an endpoint URL no longer reach the screen, the transcript or the log files. When the engine's own error text or a notice carries the URL it dialled, sema masks the user name, any query values and any fragment before rendering, on every surface: -p text, json and stream-json output, the interactive error row and notice, the /model failure receipt, sema doctor, the session transcript and the error log. Host, port, path and query key names are kept because those are what you need to fix the setting; a successful answer is never touched.",
456712
- "When both MODEL_GATEWAY_BASEURL and an explicit MODEL_PROVIDER are set and the gateway serves the hop, the line that says so now appears for every kind of model-lane failure (network, request construction, timeout, not only HTTP status codes) and in all three -p output formats. The startup warning and the /status row use the same wording, so the shell no longer says two different things about which setting routes the request. If the engine refuses to start because MODEL_PROVIDER is not one of the accepted values, the shell shows the engine's own refusal line with its machine-readable code, the offending value and the accepted values instead of guessing that the port is in use.",
456713
- "Background subagents that hit an approval gate now raise their card in the session instead of stalling silently. The footer says how many subagent approvals are waiting on you and shows a dash when the engine does not report it. On engines that do not carry the subagent call's arguments the card says so and no longer offers edit-then-approve.",
456714
- "Approving a plan no longer makes a second plan-review card appear afterwards.",
456715
- "Background task panel: a task parked at a pending approval keeps its row through compaction and the row says it is waiting for an approval. Numbers the engine did not report show as a dash instead of 0 (duration, progress), and the usage and queue badges are simply omitted. The workflow size warning no longer vanishes when the total is unknown; it says the size was not reported. When a background agent starts a new cycle its usage and tool counters reset instead of carrying the previous cycle's numbers, and the workflow details header omits the agent count when the details could not be fetched.",
456716
- "Cancel and submit failures are explained by the engine's own code: a cancel refused because the gate was already decided is worded differently from one where the cancel flag did not attach and can simply be resent, and a submit refused by the deployment's usage window says how long to wait when the engine gives a window and states no number when it does not.",
456717
- "Interrupted turns now tell you when the engine you were talking to was replaced by another process, not just when the whole instance changed. Cancelling a turn records which engine run it belonged to, so a later resume can ask the engine what happened to it.",
456718
- "Plugins: installing a plugin whose own plugin.json lists dependencies now installs them too, including plugins that come from a git or npm source. A dependency that cannot be installed automatically is named in the install output instead of being silent. Plugin options that declare a default value work without opening the configuration dialog first; the declared default is used until you set your own.",
456719
- "sema mcp list and sema mcp get now say why a connection failed (HTTP status text, the remote's own message, endpoint not found, connection refused) instead of a bare Failed to connect; credentials inside that text are masked and, when no reason is available, the row says so. mcp get adds an Issue line under Status for a failing server.",
456720
- "/context adds a note when the numbers shrank by less than the display's precision, and the read-directory hint on approval cards no longer promises that /add-dir will clear the question when the candidate is a single file."
457360
+ "Bundled engine 7.88.2 (core 7.23.5), client runtime 0.74.3, client SDK 9.8.1 and settings schema 3.0.0. /doctor and the engine line report 7.88.2.",
457361
+ "A background subagent's approval card is withdrawn when the session, the engine or the credentials change, and withdrawing it no longer sends a decision on your behalf. An approval whose answer never reached the engine comes back on the next update instead of after two.",
457362
+ "A background agent that starts a new round now shows that round: its status, timer and counters move together, and a late ending from the previous round no longer closes it. When the engine says why it removed an agent, the panel's cleanup line says so. The same agent no longer shows up as two rows.",
457363
+ "Credentials that a remote echoes back no longer reach the terminal, the streamed output or the saved transcript, including passwords with punctuation and short values. On engine 7.88 and later a gateway URL that carries credentials in its userinfo stops the engine from starting, and sema shows that refusal by name without printing the credentials. 1.0.122 covered the interactive screen, the -p result frame and stderr; the -p transcript and stream-json frames, and punctuated or short secrets, are covered from this version.",
457364
+ "Approving a plan no longer brings a second card even when the engine takes a while to resume.",
457365
+ "The workflow list now says why a failed run failed.",
457366
+ "A read-root suggestion that names a single file no longer tells you to add it as a directory.",
457367
+ "mcp list and mcp get no longer print a password that the server echoed back."
456721
457368
  ]
456722
457369
  },
456723
- productVersion: "1.0.122",
456724
- announcement: "sema 1.0.122 \u2014 engine 7.87.3 pickup (core 7.23.2), client runtime 0.73.5, client SDK 9.7.1. Credentials in endpoint URLs are masked on every surface; background subagents raise their approval card instead of stalling; approving a plan no longer brings a second card; the task panel shows a dash for numbers the engine did not report; plugins install their manifest dependencies and honour declared option defaults; mcp list and mcp get say why a connection failed.",
457370
+ productVersion: "1.0.123",
457371
+ announcement: "sema 1.0.123 \u2014 engine 7.88.2 pickup (core 7.23.5), client runtime 0.74.3, client SDK 9.8.1, settings schema 3.0.0. Background subagent approval cards are withdrawn without deciding for you; a revived agent shows its new round; credentials echoed by a remote stay out of the transcript and streamed output; a gateway URL with credentials now stops the engine at startup; approving a plan brings no second card; the workflow list says why a run failed.",
456725
457372
  version: "1.0.91"
456726
457373
  };
456727
457374
  }
@@ -467420,19 +468067,19 @@ function PermissionRuleList(t0) {
467420
468067
  }
467421
468068
  if (isAddingWorkspaceDirectory) {
467422
468069
  let t222;
467423
- $3[56] !== setAppState || $3[57] !== toolPermissionContext ? (t222 = (path_0, remember2) => {
468070
+ $3[56] !== setAppState || $3[57] !== toolPermissionContext ? (t222 = (path_0, remember3) => {
467424
468071
  let permissionUpdate = {
467425
468072
  type: "addDirectories",
467426
468073
  directories: [path_0],
467427
- destination: remember2 ? "localSettings" : "session"
468074
+ destination: remember3 ? "localSettings" : "session"
467428
468075
  }, updatedContext = applyPermissionUpdate(toolPermissionContext, permissionUpdate);
467429
468076
  setAppState((prev_4) => ({
467430
468077
  ...prev_4,
467431
468078
  toolPermissionContext: updatedContext
467432
468079
  }));
467433
468080
  let persistError = null;
467434
- remember2 && (persistError = persistPermissionUpdate(permissionUpdate).error);
467435
- let savedSuffix = persistError ? sessionOnlyPersistSuffix("localSettings", persistError) : remember2 ? " and saved to local settings" : " for this session";
468081
+ remember3 && (persistError = persistPermissionUpdate(permissionUpdate).error);
468082
+ let savedSuffix = persistError ? sessionOnlyPersistSuffix("localSettings", persistError) : remember3 ? " and saved to local settings" : " for this session";
467436
468083
  setChanges((prev_5) => [...prev_5, `Added directory ${source_default.bold(path_0)} to workspace${savedSuffix}`]), setIsAddingWorkspaceDirectory(!1);
467437
468084
  }, $3[56] = setAppState, $3[57] = toolPermissionContext, $3[58] = t222) : t222 = $3[58];
467438
468085
  let t232;
@@ -484019,6 +484666,8 @@ function askRetractionRow(cause, toolName2) {
484019
484666
  return `${what} was withdrawn by the engine, so this card was taken down. Nothing was decided on your behalf here.`;
484020
484667
  case "unanswered-after-window":
484021
484668
  return `${what} was still unanswered well after the engine's approval window closed, so this card was taken down to let this turn finish. Nothing was decided on your behalf here. If the engine parked that step it is still waiting in its durable queue \u2014 send a message and sema will re-check what it is waiting on.`;
484669
+ case "host-decision-port-gone":
484670
+ return `${what} was taken down because this session no longer has a way to answer it \u2014 the engine connection or session it belonged to was replaced. Nothing was decided on your behalf here. If the engine is still waiting on that step, send a message and sema will re-check what it is waiting on.`;
484022
484671
  case "durable-reaped":
484023
484672
  return `${what} sat in the engine's durable queue past its deadline, so this card was taken down. The engine reaps rows that pass their deadline; nothing was decided on your behalf here. If the step is still needed, ask for it again.`;
484024
484673
  default:
@@ -484264,7 +484913,7 @@ function shellApprovalCardPort(req2) {
484264
484913
  } catch (e) {
484265
484914
  logForDebugging(`liveToolApprovalWire: could not surface the retraction row: ${String(e)}`);
484266
484915
  }
484267
- settle3({ kind: "aborted" });
484916
+ settle3({ kind: RETRACTED_CARD_DECISION_KIND, reason: cause });
484268
484917
  }
484269
484918
  }, backstopWindowMs = 0, armBackstopOnce = () => {
484270
484919
  settled2 || askBackstopTimer !== void 0 || isParkRowCard(callKey) || (askBackstopTimer = setTimeout(() => {
@@ -485066,6 +485715,10 @@ async function* consumeStreamApprovalFrames(events3, deps2, opts = {}) {
485066
485715
  logging(`stream-approval ask=${askId} card aborted \u2014 no decision sent`);
485067
485716
  return;
485068
485717
  }
485718
+ if (decision.kind === RETRACTED_CARD_DECISION_KIND) {
485719
+ logging(`stream-approval ask=${askId} card retracted \u2014 no decision sent`);
485720
+ return;
485721
+ }
485069
485722
  if (decision.kind === "failed") {
485070
485723
  logging(`stream-approval ask=${askId} card unavailable (${decision.reason}) \u2014 no decision sent`);
485071
485724
  return;
@@ -485703,6 +486356,7 @@ __export(agentsWire_exports, {
485703
486356
  MAX_AGENT_TOOLS: () => MAX_AGENT_TOOLS,
485704
486357
  MAX_AGENT_TOOL_NAME_CHARS: () => MAX_AGENT_TOOL_NAME_CHARS,
485705
486358
  MAX_GATE_HOPS: () => MAX_GATE_HOPS,
486359
+ MAX_HELD_WIRE_TICK_BEATS: () => MAX_HELD_WIRE_TICK_BEATS,
485706
486360
  MAX_HOOK_NOTICE_TEXT_CHARS: () => MAX_HOOK_NOTICE_TEXT_CHARS,
485707
486361
  MAX_TASK_AGENTS: () => MAX_TASK_AGENTS,
485708
486362
  MAX_TOKENS_MAX: () => MAX_TOKENS_MAX,
@@ -485770,6 +486424,7 @@ __export(agentsWire_exports, {
485770
486424
  RESUME_USAGE_WINDOW_EXHAUSTED: () => RESUME_USAGE_WINDOW_EXHAUSTED,
485771
486425
  RETAIN_BACKGROUND_ENV: () => RETAIN_BACKGROUND_ENV,
485772
486426
  RETIRED_PERMISSION_RULE_ISSUE_CODES: () => RETIRED_PERMISSION_RULE_ISSUE_CODES,
486427
+ RETRACTED_CARD_DECISION_KIND: () => RETRACTED_CARD_DECISION_KIND,
485773
486428
  REVIEW_PARK_GATE_KINDS: () => REVIEW_PARK_GATE_KINDS,
485774
486429
  REWIND_ERROR_CODE_PREFIXES: () => REWIND_ERROR_CODE_PREFIXES,
485775
486430
  RULE_NOT_SENT_REJECTED_WARN_TEXT: () => RULE_NOT_SENT_REJECTED_WARN_TEXT,
@@ -485781,6 +486436,7 @@ __export(agentsWire_exports, {
485781
486436
  RULE_STORE_UNREADABLE_KINDS: () => RULE_STORE_UNREADABLE_KINDS,
485782
486437
  RUNNING_STATES: () => RUNNING_STATES,
485783
486438
  RUN_BLOCKED_MESSAGE_PREFIX: () => RUN_BLOCKED_MESSAGE_PREFIX,
486439
+ RUN_CANCELLED_CODE: () => RUN_CANCELLED_CODE,
485784
486440
  RUN_LEVEL_STOP_ERROR_CODES: () => RUN_LEVEL_STOP_ERROR_CODES,
485785
486441
  RUN_STOPPED_MESSAGE_PREFIX: () => RUN_STOPPED_MESSAGE_PREFIX,
485786
486442
  RUN_TERMINAL_NOT_SUCCESS_STATUSES: () => RUN_TERMINAL_NOT_SUCCESS_STATUSES,
@@ -485872,7 +486528,9 @@ __export(agentsWire_exports, {
485872
486528
  __feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
485873
486529
  __resetApprovalsStreamLiveReadingsForTests: () => __resetApprovalsStreamLiveReadingsForTests,
485874
486530
  __resetBgOwnerAbsenceForTests: () => __resetBgOwnerAbsenceForTests,
486531
+ __resetDeviceExecutorManagementReadingsForTests: () => __resetDeviceExecutorManagementReadingsForTests,
485875
486532
  __resetEngineAgentPanelAbsenceForTests: () => __resetEngineAgentPanelAbsenceForTests,
486533
+ __resetEngineAgentPanelIdentityForTests: () => __resetEngineAgentPanelIdentityForTests,
485876
486534
  __resetEngineCapsCacheForTests: () => __resetEngineCapsCacheForTests,
485877
486535
  __resetEngineCompactArmForTests: () => __resetEngineCompactArmForTests,
485878
486536
  __resetEngineDelegatedPromptForTests: () => __resetEngineDelegatedPromptForTests,
@@ -485980,6 +486638,7 @@ __export(agentsWire_exports, {
485980
486638
  classifyMemoryStatusFailure: () => classifyMemoryStatusFailure,
485981
486639
  classifyPeerNotification: () => classifyPeerNotification,
485982
486640
  classifyRulesFailure: () => classifyRulesFailure,
486641
+ classifyRunAbortCause: () => classifyRunAbortCause,
485983
486642
  classifySelfOrchestrationRefusal: () => classifySelfOrchestrationRefusal,
485984
486643
  classifySkippedReason: () => classifySkippedReason,
485985
486644
  classifySubagentResumeFailure: () => classifySubagentResumeFailure,
@@ -485990,6 +486649,7 @@ __export(agentsWire_exports, {
485990
486649
  clearArmedGate: () => clearArmedGate,
485991
486650
  clearBgTerminalFacts: () => clearBgTerminalFacts,
485992
486651
  clearEnginePanelTaskResident: () => clearEnginePanelTaskResident,
486652
+ clearEnginePanelTaskResidentByWire: () => clearEnginePanelTaskResidentByWire,
485993
486653
  clearRunningChoiceOffer: () => clearRunningChoiceOffer,
485994
486654
  clearSubagentContent: () => clearSubagentContent,
485995
486655
  clientContextField: () => clientContextField,
@@ -486024,6 +486684,7 @@ __export(agentsWire_exports, {
486024
486684
  createWireToCcAdapter: () => createWireToCcAdapter,
486025
486685
  decideAcceptedNotResolved: () => decideAcceptedNotResolved,
486026
486686
  decidePlanReview: () => decidePlanReview,
486687
+ decideReceiptReopen: () => decideReceiptReopen,
486027
486688
  decideRefusalFromError: () => decideRefusalFromError,
486028
486689
  decisionNoteAuditLine: () => decisionNoteAuditLine,
486029
486690
  defaultMaxTokensFor: () => defaultMaxTokensFor,
@@ -486040,6 +486701,8 @@ __export(agentsWire_exports, {
486040
486701
  detachedTaskId: () => detachedTaskId,
486041
486702
  detectEngineBgShellReceipt: () => detectEngineBgShellReceipt,
486042
486703
  deviceAuthProviderFor: () => deviceAuthProviderFor,
486704
+ deviceExecutorManagementDoctorDetail: () => deviceExecutorManagementDoctorDetail,
486705
+ deviceManagementVerbsAvailable: () => deviceManagementVerbsAvailable,
486043
486706
  diagnoseSseIdleTear: () => diagnoseSseIdleTear,
486044
486707
  discussionWorkflowName: () => discussionWorkflowName,
486045
486708
  doneToSdkResult: () => doneToSdkResult,
@@ -486109,6 +486772,7 @@ __export(agentsWire_exports, {
486109
486772
  fmtCtxOut: () => fmtCtxOut,
486110
486773
  fmtTokens: () => fmtTokens,
486111
486774
  forgetApprovalsStreamLiveReading: () => forgetApprovalsStreamLiveReading,
486775
+ forgetDeviceExecutorManagementReading: () => forgetDeviceExecutorManagementReading,
486112
486776
  forgetExecutionLaneReading: () => forgetExecutionLaneReading,
486113
486777
  forgetSqlEngineReading: () => forgetSqlEngineReading,
486114
486778
  forgetWebSearchBackendReading: () => forgetWebSearchBackendReading,
@@ -486236,6 +486900,7 @@ __export(agentsWire_exports, {
486236
486900
  isSeatModelCatalog: () => isSeatModelCatalog,
486237
486901
  isSendMessageAck: () => isSendMessageAck,
486238
486902
  isSseIdleError: () => isSseIdleError,
486903
+ isStaleEngineAgentPanelEnd: () => isStaleEngineAgentPanelEnd,
486239
486904
  isSubFlowSegmentEnd: () => isSubFlowSegmentEnd,
486240
486905
  isSupportedCatalogSchemaVersion: () => isSupportedCatalogSchemaVersion,
486241
486906
  isTaskNotificationObjective: () => isTaskNotificationObjective,
@@ -486253,6 +486918,7 @@ __export(agentsWire_exports, {
486253
486918
  isWorkflowCompletionCardEnqueued: () => isWorkflowCompletionCardEnqueued,
486254
486919
  isWorkflowParkRefusalCode: () => isWorkflowParkRefusalCode,
486255
486920
  kickEngineCapsProbe: () => kickEngineCapsProbe,
486921
+ lastFlagValue: () => lastFlagValue,
486256
486922
  leaderConflictDetail: () => leaderConflictDetail,
486257
486923
  limitsForPrint: () => limitsForPrint,
486258
486924
  listAllPersistedRules: () => listAllPersistedRules,
@@ -486296,6 +486962,7 @@ __export(agentsWire_exports, {
486296
486962
  normalizeWirePrincipal: () => normalizeWirePrincipal,
486297
486963
  noteBgOwnerAbsence: () => noteBgOwnerAbsence,
486298
486964
  noteEngineCapsForApprovalsStreamLive: () => noteEngineCapsForApprovalsStreamLive,
486965
+ noteEngineCapsForDeviceExecutorManagement: () => noteEngineCapsForDeviceExecutorManagement,
486299
486966
  noteEngineCapsForExecutionLane: () => noteEngineCapsForExecutionLane,
486300
486967
  noteEngineCapsForSqlEngine: () => noteEngineCapsForSqlEngine,
486301
486968
  noteEngineCapsForWebSearchBackend: () => noteEngineCapsForWebSearchBackend,
@@ -486310,6 +486977,7 @@ __export(agentsWire_exports, {
486310
486977
  notificationQueuePortMisses: () => notificationQueuePortMisses,
486311
486978
  observeCancelByDeny: () => observeCancelByDeny,
486312
486979
  observedApprovalsStreamLive: () => observedApprovalsStreamLive,
486980
+ observedDeviceExecutorManagement: () => observedDeviceExecutorManagement,
486313
486981
  observedExecutionLane: () => observedExecutionLane,
486314
486982
  observedSqlEngine: () => observedSqlEngine,
486315
486983
  observedWebSearchBackend: () => observedWebSearchBackend,
@@ -486377,6 +487045,7 @@ __export(agentsWire_exports, {
486377
487045
  projectBackgroundView: () => projectBackgroundView,
486378
487046
  projectCrashConverged: () => projectCrashConverged,
486379
487047
  projectDescription: () => projectDescription,
487048
+ projectDeviceExecutorManagementCapability: () => projectDeviceExecutorManagementCapability,
486380
487049
  projectDiagnosticsFrame: () => projectDiagnosticsFrame,
486381
487050
  projectEffectiveBody: () => projectEffectiveBody,
486382
487051
  projectExecutionLaneCapability: () => projectExecutionLaneCapability,
@@ -486440,6 +487109,7 @@ __export(agentsWire_exports, {
486440
487109
  readRuleOfferSupply: () => readRuleOfferSupply,
486441
487110
  readRuleOffers: () => readRuleOffers,
486442
487111
  readRulePersistOutcome: () => readRulePersistOutcome,
487112
+ readRunCancelContext: () => readRunCancelContext,
486443
487113
  readRunCostFacts: () => readRunCostFacts,
486444
487114
  readRunTerminal: () => readRunTerminal,
486445
487115
  readSessionMemoryStatus: () => readSessionMemoryStatus,
@@ -486483,6 +487153,7 @@ __export(agentsWire_exports, {
486483
487153
  resetWorkflowActivityLedgers: () => resetWorkflowActivityLedgers,
486484
487154
  resolveAutonomousLoopPrompt: () => resolveAutonomousLoopPrompt,
486485
487155
  resolveCatalogSources: () => resolveCatalogSources,
487156
+ resolveEnginePanelTaskId: () => resolveEnginePanelTaskId,
486486
487157
  resolveEntryVision: () => resolveEntryVision,
486487
487158
  resolveHeadlessDetach: () => resolveHeadlessDetach,
486488
487159
  resolveHeadlessFinalVerify: () => resolveHeadlessFinalVerify,
@@ -486588,6 +487259,7 @@ __export(agentsWire_exports, {
486588
487259
  surfaceRuleArmRejected: () => surfaceRuleArmRejected,
486589
487260
  surfaceSuspendedAskAndRespond: () => surfaceSuspendedAskAndRespond,
486590
487261
  surfaceToolApprovalFrameAndRespond: () => surfaceToolApprovalFrameAndRespond,
487262
+ suspendedReopenOf: () => suspendedReopenOf,
486591
487263
  suspendedSubagentAsks: () => suspendedSubagentAsks,
486592
487264
  tailEngineSubagent: () => tailEngineSubagent,
486593
487265
  taskAgentsField: () => taskAgentsField,
@@ -486829,6 +487501,13 @@ var init_approvalsStreamLiveCapability2 = __esm({
486829
487501
  }
486830
487502
  });
486831
487503
 
487504
+ // build-src/src/sema/deviceExecutorManagementCapability.ts
487505
+ var init_deviceExecutorManagementCapability2 = __esm({
487506
+ "build-src/src/sema/deviceExecutorManagementCapability.ts"() {
487507
+ init_dist();
487508
+ }
487509
+ });
487510
+
486832
487511
  // build-src/src/sema/engineCapsArm.ts
486833
487512
  function beginCapsTeeEpoch(baseUrl) {
486834
487513
  let next = (capsTeeEpochByBase.get(baseUrl) ?? 0) + 1;
@@ -486856,7 +487535,7 @@ function armEngineCapsProbes(input) {
486856
487535
  });
486857
487536
  } : capsProbe;
486858
487537
  if (afterEngineRespawn) {
486859
- resetCapsDiscoveryState(baseUrl), invalidateSelfKnowledgeCap(baseUrl), forgetSqlEngineReading(baseUrl), forgetWriteProtectionReading(baseUrl), forgetWebSearchBackendReading(baseUrl), forgetExecutionLaneReading(baseUrl), forgetApprovalsStreamLiveReading(baseUrl), forgetWiringManifestReading(), forgetClassifierRoundObservation(), forgetEffectiveTurnFacts(), kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), invalidateEngineCaps(baseUrl, guardedCapsProbe);
487538
+ resetCapsDiscoveryState(baseUrl), invalidateSelfKnowledgeCap(baseUrl), forgetSqlEngineReading(baseUrl), forgetWriteProtectionReading(baseUrl), forgetWebSearchBackendReading(baseUrl), forgetExecutionLaneReading(baseUrl), forgetApprovalsStreamLiveReading(baseUrl), forgetDeviceExecutorManagementReading(baseUrl), forgetWiringManifestReading(), forgetClassifierRoundObservation(), forgetEffectiveTurnFacts(), kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), invalidateEngineCaps(baseUrl, guardedCapsProbe);
486860
487539
  return;
486861
487540
  }
486862
487541
  kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), kickEngineCapsProbe(baseUrl, guardedCapsProbe);
@@ -486873,6 +487552,7 @@ var capsTeeEpochByBase, init_engineCapsArm = __esm({
486873
487552
  init_webSearchBackendCapability2();
486874
487553
  init_executionLaneCapability2();
486875
487554
  init_approvalsStreamLiveCapability2();
487555
+ init_deviceExecutorManagementCapability2();
486876
487556
  init_wiringManifestStore();
486877
487557
  init_classifierRoundObservation();
486878
487558
  init_effectiveTurnFactsStore();
@@ -487460,7 +488140,7 @@ function createLiveConversationClient(config4) {
487460
488140
  capsTee: (caps, generation2) => {
487461
488141
  noteEngineCapsForMcpGate(config4.baseUrl, caps), noteEngineCapsForSessionBackground(config4.baseUrl, caps), noteEngineCapsForProjectContext(config4.baseUrl, caps), readCrashConvergedOnce(client3, config4.baseUrl, { principal: config4.principal }), noteEngineCapsForWorkflowsGate(config4.baseUrl, caps, {
487462
488142
  ...typeof config4.principal == "string" ? { principal: config4.principal } : {}
487463
- }), noteEngineCapsForSqlEngine(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWriteProtection(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWebSearchBackend(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForExecutionLane(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForApprovalsStreamLive(config4.baseUrl, caps, { generation: generation2 });
488143
+ }), noteEngineCapsForSqlEngine(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWriteProtection(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWebSearchBackend(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForExecutionLane(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForApprovalsStreamLive(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForDeviceExecutorManagement(config4.baseUrl, caps, { generation: generation2 });
487464
488144
  },
487465
488145
  afterEngineRespawn: config4.afterEngineRespawn === !0
487466
488146
  }), prepareTaskAgentsWire({
@@ -487568,6 +488248,24 @@ function createLiveConversationClient(config4) {
487568
488248
  // 但显式 false 让「这条腿判过了」在 diff 与 census 上可见,不与「忘了传」同形)。
487569
488249
  windowIsCurrent
487570
488250
  };
488251
+ },
488252
+ // ── CC-68(client-core 0.74.1):流内帧腿的**结局回交** ───────────────────────────────
488253
+ // 包每次 `tool_approval` 帧经卡口决断后恰调一次(撤卡也回交)。壳这一端**只转交**,一条
488254
+ // 判定都不铸:「落没落定」由包答(`decision === 'unresolved'`),放不放认领 / 重不重出卡
488255
+ // 由悬挂 ask 装配件的既有有界预算腿答。
488256
+ // 🔴 为什么非它不可:帧腿在**出卡之前**就永久认领了这只 ask,而它那一发 respond 失败时壳
488257
+ // 这一侧此前看不到 —— 只能靠「连续两张快照都看到已认领∧没决断∧台账无活卡」这条间接
488258
+ // 判据把认领放回去(秒级两拍里审批入口是空的)。缺席 = 退回那条间接判据,零变化。
488259
+ onToolApprovalOutcome: (frame, outcome) => {
488260
+ let detail = outcome.retracted === !0 ? "the card was retracted (this host no longer has a decision port for it)" : outcome.editRefused === !0 ? "edits are not accepted on this card" : [outcome.respondRefusal?.errorCode, outcome.respondRefusal?.message].filter((x3) => typeof x3 == "string" && x3 !== "").join(" \xB7 ");
488261
+ noteStreamApprovalOutcome({
488262
+ approvalId: frame.approvalId,
488263
+ settled: outcome.decision !== "unresolved",
488264
+ // 🔴 判别位**原样过境**(不折进 detail 文本):撤卡 = 本端主动放手,与「引擎不收」在
488265
+ // `settled` 上同形却**不同义** —— 端口那一侧要靠它决定「释放认领但不扣重出卡预算」。
488266
+ ...outcome.retracted === !0 ? { retracted: !0 } : {},
488267
+ ...detail === "" ? {} : { detail }
488268
+ });
487571
488269
  }
487572
488270
  };
487573
488271
  }, approvalStreamDeps = {
@@ -487864,6 +488562,7 @@ var ENGINE_TO_CC_TOOL, SUGGESTIONS_TAIL_MAX_ATTEMPTS, SUGGESTIONS_TAIL_RETRY_MS,
487864
488562
  init_webSearchBackendCapability2();
487865
488563
  init_executionLaneCapability2();
487866
488564
  init_approvalsStreamLiveCapability2();
488565
+ init_deviceExecutorManagementCapability2();
487867
488566
  init_suspendedAskPort();
487868
488567
  init_liveApprovalCardHandles();
487869
488568
  init_debugLine();
@@ -490710,7 +491409,7 @@ function workflowParts(wf) {
490710
491409
  { text: wf.doneCount !== void 0 && wf.totalCount !== void 0 ? `${wf.doneCount}/${wf.totalCount} agents done${failedSeg}` : `${ABSENT_NUMBER_TEXT} agents done${failedSeg}` },
490711
491410
  { text: wf.elapsedMs !== void 0 ? fmtDur2(Math.max(0, wf.elapsedMs)) : ABSENT_NUMBER_TEXT }
490712
491411
  ];
490713
- wf.tokens !== void 0 && wf.tokens > 0 && segments.push({ text: `${ARROW_DOWN} ${fmtTokens3(wf.tokens)} tokens` });
491412
+ wf.tokens !== void 0 && wf.tokens > 0 && segments.push({ text: `${ARROW_DOWN} ${fmtTokens3(wf.tokens)} tokens` }), typeof wf.errorCode == "string" && wf.errorCode !== "" && segments.push({ text: cleanUntrustedForDisplay(wf.errorCode, 48), warn: !0 });
490714
491413
  let bulletColor = isTerminal2(wf.status) ? statusColor(wf.status) : wf.failedCount !== void 0 && wf.failedCount > 0 ? "error" : void 0;
490715
491414
  return {
490716
491415
  name: wf.name,
@@ -491177,6 +491876,7 @@ var React127, import_react205, import_jsx_runtime364, F_POINTER2, F_CIRCLE, G_VI
491177
491876
  init_format2();
491178
491877
  init_AppState();
491179
491878
  init_appStateRef();
491879
+ init_untrustedDisplayText();
491180
491880
  init_engineAgentView();
491181
491881
  init_subagentStatusLine();
491182
491882
  init_workflowSizeWarning2();
@@ -501214,7 +501914,8 @@ var RENDERED_UUID_PREFIX_LEN, init_rewindArm = __esm({
501214
501914
 
501215
501915
  // build-src/src/sema/fleetRowCycleProjection.ts
501216
501916
  function launchAnchorChanged2(existing, ev) {
501217
- return typeof ev.startedAt != "number" || !Number.isFinite(ev.startedAt) || existing.startTimeFromWire !== !0 || typeof existing.startTime != "number" || !Number.isFinite(existing.startTime) ? !1 : existing.startTime !== ev.startedAt;
501917
+ let seqOf = (n2) => typeof n2 == "number" && Number.isFinite(n2) ? n2 : void 0, evSeq = seqOf(ev.cycleSeq), rowSeq = seqOf(existing.cycleSeq);
501918
+ return evSeq !== void 0 && rowSeq !== void 0 ? evSeq !== rowSeq : typeof ev.startedAt != "number" || !Number.isFinite(ev.startedAt) || existing.startTimeFromWire !== !0 || typeof existing.startTime != "number" || !Number.isFinite(existing.startTime) ? !1 : existing.startTime !== ev.startedAt;
501218
501919
  }
501219
501920
  function progressAfterFleetRowFrame(existing, ev) {
501220
501921
  let num = (n2) => typeof n2 == "number" && Number.isFinite(n2), prior = launchAnchorChanged2(existing, ev) ? void 0 : existing.progress, toolUseCount = num(ev.toolUses) ? ev.toolUses : prior?.toolUseCount, tokenCount = num(ev.totalTokens) && (ev.totalTokens > 0 || num(ev.toolUses)) ? ev.totalTokens : prior?.tokenCount;
@@ -501307,6 +502008,13 @@ var import_compiler_runtime244, React132, import_jsx_runtime375, init_Coordinato
501307
502008
  function useCoordinatorTaskCount() {
501308
502009
  return fleetFooterTaskCount(useFleetFooterRows());
501309
502010
  }
502011
+ function noteFleetRowCycleIdentity(taskId, next) {
502012
+ if (fleetRowCycleIdentities.delete(taskId), fleetRowCycleIdentities.set(taskId, next), !(fleetRowCycleIdentities.size <= FLEET_ROW_CYCLE_LEDGER_MAX))
502013
+ for (let key of [...fleetRowCycleIdentities.keys()]) {
502014
+ if (fleetRowCycleIdentities.size <= FLEET_ROW_CYCLE_LEDGER_MAX) break;
502015
+ key === taskId || engineOwnedRowIds.has(key) || fleetRowCycleIdentities.delete(key);
502016
+ }
502017
+ }
501310
502018
  function useEngineAgentPanelBridge(setAppState) {
501311
502019
  let ownedRows = engineOwnedRowIds, reapAbsentRows = React133.useCallback(() => {
501312
502020
  let reaped = [];
@@ -501321,7 +502029,10 @@ function useEngineAgentPanelBridge(setAppState) {
501321
502029
  return { ...prev, tasks: nextTasks };
501322
502030
  });
501323
502031
  for (let r of reaped) {
501324
- noteEngineAgentRowReclaimed(r.id, r.label), ownedRows.delete(r.id), fleetOwnedRowIds.delete(r.id), tickLaneRowIds.delete(r.id), queueTranscriptSystemNotice(engineAgentAbsenceDroppedLine(r.label), "info");
502032
+ noteEngineAgentRowReclaimed(r.id, r.label), ownedRows.delete(r.id), fleetOwnedRowIds.delete(r.id), fleetRowCycleIdentities.delete(r.id), tickLaneRowIds.delete(r.id), queueTranscriptSystemNotice(
502033
+ engineAgentAbsenceDroppedLine(r.label, 18e5, takeEngineAgentRowRemoveReason(r.id)),
502034
+ "info"
502035
+ );
501325
502036
  let pending4 = absenceReapTimers.get(r.id);
501326
502037
  pending4 !== void 0 && (clearTimeout(pending4), absenceReapTimers.delete(r.id));
501327
502038
  }
@@ -501417,7 +502128,19 @@ function useEngineAgentPanelBridge(setAppState) {
501417
502128
  return { ...prev, tasks: { ...prev.tasks, [ev.taskId]: row2 } };
501418
502129
  }), seedEngineAgentTranscript(setAppState, ev.taskId);
501419
502130
  else if (ev.kind === "fleet-row") {
501420
- if (tickLaneRowIds.has(ev.taskId)) {
502131
+ let priorCycle = fleetRowCycleIdentities.get(ev.taskId);
502132
+ (ev.cycleSeq !== void 0 || ev.startedAt !== void 0) && noteFleetRowCycleIdentity(ev.taskId, {
502133
+ ...ev.cycleSeq !== void 0 ? { cycleSeq: ev.cycleSeq } : {},
502134
+ ...ev.startedAt !== void 0 ? { startedAt: ev.startedAt } : {}
502135
+ });
502136
+ let withPriorCycle = (existing) => priorCycle?.cycleSeq === void 0 ? existing : { ...existing, cycleSeq: priorCycle.cycleSeq };
502137
+ if (launchAnchorChanged2(
502138
+ {
502139
+ ...priorCycle?.startedAt !== void 0 ? { startTime: priorCycle.startedAt, startTimeFromWire: !0 } : {},
502140
+ ...priorCycle?.cycleSeq !== void 0 ? { cycleSeq: priorCycle.cycleSeq } : {}
502141
+ },
502142
+ ev
502143
+ ) && tickLaneRowIds.delete(ev.taskId), tickLaneRowIds.has(ev.taskId)) {
501421
502144
  updateTaskState(ev.taskId, setAppState, clearEngineAgentRowAbsence);
501422
502145
  return;
501423
502146
  }
@@ -501427,13 +502150,13 @@ function useEngineAgentPanelBridge(setAppState) {
501427
502150
  let existing = prev.tasks[ev.taskId];
501428
502151
  if (existing) {
501429
502152
  if (!isLocalAgentTask2(existing)) return prev;
501430
- let revived = launchAnchorChanged2(existing, ev);
501431
- if (!revived && (existing.status !== "running" || !fleetOwnedRowIds.has(ev.taskId)))
502153
+ let revived = launchAnchorChanged2(withPriorCycle(existing), ev);
502154
+ if (revived && fleetOwnedRowIds.add(ev.taskId), !revived && (existing.status !== "running" || !fleetOwnedRowIds.has(ev.taskId)))
501432
502155
  return prev;
501433
502156
  let absenceCleared = isAbsentRow(existing), tokensChanged = ev.totalTokens !== void 0 && existing.progress?.tokenCount !== ev.totalTokens, toolUsesChanged = ev.toolUses !== void 0 && existing.progress?.toolUseCount !== ev.toolUses, startChanged = ev.startedAt !== void 0 && existing.startTime !== ev.startedAt;
501434
502157
  if (!tokensChanged && !toolUsesChanged && !startChanged && !absenceCleared && !revived)
501435
502158
  return prev;
501436
- let mergedProgress = progressAfterFleetRowFrame(existing, ev), next = {
502159
+ let mergedProgress = progressAfterFleetRowFrame(withPriorCycle(existing), ev), next = {
501437
502160
  ...existing,
501438
502161
  // 回来了 ⇒ 清缺席位 + 撤停表(endTime 是 absent 臂为了停表落的猜测值,不是终局钟;
501439
502162
  // 行还在跑,留着它 elapsed 就永远冻在缺席那一刻)。
@@ -501447,11 +502170,25 @@ function useEngineAgentPanelBridge(setAppState) {
501447
502170
  // 删掉 fleetOwnedRowIds,活着的任务显示完成还可能被回收。那比「数字是旧的」严重一个量级。
501448
502171
  // ② [medium] 清 `result` 拦不住上一周期**在飞**的终报回填(`engineAgentView` 的异步回写
501449
502172
  // 只核行类型与「有没有 report」,不核周期)—— 清了也会被旧响应重新写回来。
501450
- // ⇒ 两条的根治都要上游给终态事件一个**周期身份**(已记进车 P 回执的上游缺口段)。
501451
- // 在那之前,壳这一层只做证得出来的那一件:把**说了假话的那两个数**拿掉。
501452
- // ⚠️ 留下的残留(如实记,已进 KNOWN-LIMITS):复活后的行在 grace 窗内仍显示上一轮的终态词,
501453
- // 数字已清;`evictAfter` 到期回收之后,下一帧走新行分支建一条干净的行 —— 窗有界(30 s)。
501454
- ...revived ? { progress: void 0, _semaAbsence: void 0 } : {},
502173
+ // ⇒ 两条的根治都要上游给终态事件一个**周期身份**。
502174
+ //
502175
+ // ── 🔴 1.0.123:那个根治到货了(client-core 0.74.0 CC-66)───────────────────────
502176
+ // `fleet-row` `end` 都带 `cycleSeq` / `startedAt`,单源判据 `isStaleEngineAgentPanelEnd`
502177
+ // 在 end 臂把「上一周期迟到的那只」挡掉(见下方 end 分支)⇒ 的理由不成立了。
502178
+ // ⇒ 复活**把状态整只翻回 running**:清终态词 / 撤停表(endTime)/ 撤回收期限(evictAfter)/
502179
+ // 撤上一轮的终报(result),数字照旧整段清。只清数字不翻状态的那一版会让复活后的行在
502180
+ // grace 窗里挂着上一轮的终态词(旧 KNOWN-LIMITS 条目,本版随之删除)。
502181
+ // 🔴 ② 那条残余(上一周期**在飞**的终报异步回填)不在本件射程内:它走的是
502182
+ // `engineAgentView` 的异步回写、不经这条 `end` 臂 —— 记在回执的上游缺口段,不在这里
502183
+ // 靠猜去挡(挡错了会把**本轮**的真终报丢掉)。
502184
+ ...revived ? {
502185
+ progress: void 0,
502186
+ _semaAbsence: void 0,
502187
+ status: "running",
502188
+ endTime: void 0,
502189
+ evictAfter: void 0,
502190
+ result: void 0
502191
+ } : {},
501455
502192
  ...startChanged ? { startTime: ev.startedAt, startTimeFromWire: !0 } : {},
501456
502193
  // 🔴 三态 + 换周期(server 1.278.0 / L-401):
501457
502194
  // · 同周期、有键 ⇒ 赋真值(**累计口径**,绝不 `+=`;真 0 也照写 0);
@@ -501513,6 +502250,16 @@ function useEngineAgentPanelBridge(setAppState) {
501513
502250
  );
501514
502251
  }
501515
502252
  } else if (ev.kind === "end") {
502253
+ let endCycle = {
502254
+ ...ev.cycleSeq !== void 0 ? { cycleSeq: ev.cycleSeq } : {},
502255
+ ...ev.startedAt !== void 0 ? { startedAt: ev.startedAt } : {}
502256
+ };
502257
+ if (isStaleEngineAgentPanelEnd(endCycle, fleetRowCycleIdentities.get(ev.taskId))) {
502258
+ logForDebugging(
502259
+ `[sema][enginePanel] ignoring a stale end for ${ev.taskId} \u2014 it belongs to an earlier cycle than the row's current one (not settling, not writing the report, not dropping ownership)`
502260
+ );
502261
+ return;
502262
+ }
501516
502263
  let droppedLabel = takeEngineAgentReclaimedRow(ev.taskId);
501517
502264
  if (droppedLabel !== null && queueTranscriptSystemNotice(
501518
502265
  engineAgentTerminalAfterDropLine(
@@ -501614,7 +502361,7 @@ function useEngineBgShellPanelBridge(setAppState) {
501614
502361
  [setAppState]
501615
502362
  );
501616
502363
  }
501617
- var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, absenceReapTimers, RETAINED_ABSENCE_RECHECK_MS, init_chrome_agentprogress = __esm({
502364
+ var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, absenceReapTimers, fleetRowCycleIdentities, FLEET_ROW_CYCLE_LEDGER_MAX, RETAINED_ABSENCE_RECHECK_MS, init_chrome_agentprogress = __esm({
501618
502365
  "build-src/src/sema/overrides/chrome-agentprogress.tsx"() {
501619
502366
  React133 = __toESM(require_react(), 1);
501620
502367
  init_figures();
@@ -501645,7 +502392,8 @@ var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, absenceRe
501645
502392
  init_engineSubagentTail2();
501646
502393
  init_CoordinatorAgentStatus();
501647
502394
  import_jsx_runtime376 = __toESM(require_jsx_runtime(), 1);
501648
- fleetOwnedRowIds = /* @__PURE__ */ new Set(), tickLaneRowIds = /* @__PURE__ */ new Set(), absenceReapTimers = /* @__PURE__ */ new Map(), RETAINED_ABSENCE_RECHECK_MS = 6e4;
502395
+ fleetOwnedRowIds = /* @__PURE__ */ new Set(), tickLaneRowIds = /* @__PURE__ */ new Set(), absenceReapTimers = /* @__PURE__ */ new Map(), fleetRowCycleIdentities = /* @__PURE__ */ new Map(), FLEET_ROW_CYCLE_LEDGER_MAX = 512;
502396
+ RETAINED_ABSENCE_RECHECK_MS = 6e4;
501649
502397
  }
501650
502398
  });
501651
502399
 
@@ -562986,7 +563734,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
562986
563734
  pendingHookMessages
562987
563735
  }, renderAndRun);
562988
563736
  }
562989
- }).version("sema 1.0.122", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
563737
+ }).version("sema 1.0.123", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
562990
563738
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
562991
563739
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
562992
563740
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -564950,7 +565698,7 @@ __export(suspendedSubagentAskWire_exports, {
564950
565698
  startSuspendedSubagentAskWire: () => startSuspendedSubagentAskWire
564951
565699
  });
564952
565700
  function startSuspendedSubagentAskWire(opts) {
564953
- let surface = opts.deps?.surface ?? surfaceSuspendedAskAndRespond, retract = opts.deps?.retract ?? ((callKey) => retractApprovalCard(callKey, "settled-elsewhere")), notify5 = opts.deps?.notify ?? ((text2) => {
565701
+ let surface = opts.deps?.surface ?? surfaceSuspendedAskAndRespond, retract = opts.deps?.retract ?? ((callKey, cause) => retractApprovalCard(callKey, cause)), notify5 = opts.deps?.notify ?? ((text2) => {
564954
565702
  surfaceTranscriptSystemNotice(text2, "warning");
564955
565703
  }), startFeed = opts.deps?.startFeed ?? startApprovalsFeed, sessionId = opts.sessionId(), tracker2 = createSuspendedAskTracker({ ...spreadSessionId(sessionId) });
564956
565704
  installSuspendedAskTracker(tracker2), noteSuspendedAskFeedInstalled(!0);
@@ -564993,7 +565741,7 @@ function startSuspendedSubagentAskWire(opts) {
564993
565741
  for (let id of [...orphanStreak.keys()]) liveIds.has(id) || orphanStreak.delete(id);
564994
565742
  noteSuspendedAsksListed(liveIds), pruneVanishedSuspendedAsks(liveIds);
564995
565743
  for (let approvalId of delta.gone)
564996
- openCards.delete(approvalId), orphanStreak.delete(approvalId), forgetSuspendedAsk(approvalId), retract(liveFrameCallKey(approvalId)) && (stats3.retracted += 1);
565744
+ openCards.delete(approvalId), orphanStreak.delete(approvalId), forgetSuspendedAsk(approvalId), retract(liveFrameCallKey(approvalId), "settled-elsewhere") && (stats3.retracted += 1);
564997
565745
  for (let row2 of delta.upgraded)
564998
565746
  stats3.upgraded += 1, logForDebugging(
564999
565747
  `[sema][suspendedAsk] ${row2.approvalId} upgraded to a full frame after a blind card was already shown \u2014 leaving the shown card as-is (no in-place args refresh on this host)`
@@ -565010,6 +565758,12 @@ function startSuspendedSubagentAskWire(opts) {
565010
565758
  ), retryLater(row2.approvalId, "edits are not accepted on this card");
565011
565759
  return;
565012
565760
  }
565761
+ if (outcome.retracted === !0) {
565762
+ requeueSuspendedAsk(row2.approvalId), orphanStreak.delete(row2.approvalId), logForDebugging(
565763
+ `[sema][suspendedAsk] ${row2.approvalId} card was retracted without a decision (this host let go of it) \u2014 claim released, re-surfaceable, no re-surface budget consumed`
565764
+ );
565765
+ return;
565766
+ }
565013
565767
  if (outcome.decision === "unresolved") {
565014
565768
  let refused = outcome.respondRefusal, detail = refused === void 0 ? "the engine did not confirm it" : [refused.errorCode, refused.message].filter((x3) => typeof x3 == "string" && x3 !== "").join(" \xB7 ");
565015
565769
  retryLater(row2.approvalId, detail === "" ? "the engine did not confirm it" : detail);
@@ -565028,7 +565782,23 @@ function startSuspendedSubagentAskWire(opts) {
565028
565782
  return;
565029
565783
  }
565030
565784
  stats3.requeued += 1, logForDebugging(`[sema][suspendedAsk] ${approvalId} did not settle (${why}) \u2014 re-surfacing it`), requeueSuspendedAsk(approvalId);
565031
- }, feed = null;
565785
+ };
565786
+ installStreamApprovalOutcomeSink((note) => {
565787
+ if (!stopped) {
565788
+ if (note.settled) {
565789
+ noteSuspendedAskDecided(note.approvalId), orphanStreak.delete(note.approvalId), openCards.delete(note.approvalId);
565790
+ return;
565791
+ }
565792
+ if (openCards.delete(note.approvalId), orphanStreak.delete(note.approvalId), note.retracted === !0) {
565793
+ requeueSuspendedAsk(note.approvalId), logForDebugging(
565794
+ `[sema][suspendedAsk] ${note.approvalId} stream-leg card was retracted without a decision \u2014 claim released, re-surfaceable, no re-surface budget consumed`
565795
+ );
565796
+ return;
565797
+ }
565798
+ retryLater(note.approvalId, note.detail ?? "the engine did not confirm it");
565799
+ }
565800
+ });
565801
+ let feed = null;
565032
565802
  try {
565033
565803
  feed = startFeed(opts.client, onSnapshot, {
565034
565804
  reconcile: {
@@ -565049,8 +565819,11 @@ function startSuspendedSubagentAskWire(opts) {
565049
565819
  } catch {
565050
565820
  }
565051
565821
  openCards.size > 0 && logForDebugging(
565052
- `[sema][suspendedAsk] teardown with ${String(openCards.size)} card(s) still on screen \u2014 leaving them up on purpose (retracting them would post a deny the user never chose)`
565053
- ), openCards.clear(), installSuspendedAskTracker(null), noteSuspendedAskFeedInstalled(!1);
565822
+ `[sema][suspendedAsk] teardown with ${String(openCards.size)} card(s) still on screen \u2014 retracting them (this host no longer has a decision port for them; CC-67 retraction sends nothing)`
565823
+ );
565824
+ for (let approvalId of [...openCards])
565825
+ retract(liveFrameCallKey(approvalId), "host-decision-port-gone") && (stats3.retracted += 1);
565826
+ openCards.clear(), installStreamApprovalOutcomeSink(null), installSuspendedAskTracker(null), noteSuspendedAskFeedInstalled(!1);
565054
565827
  }
565055
565828
  },
565056
565829
  stats: () => ({ ...stats3 })