@sema-agent/cli 1.0.97 → 1.0.98

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
@@ -9192,9 +9192,9 @@ var _SessionToolRunner_instances, _SessionToolRunner_consumed, _SessionToolRunne
9192
9192
  yield next.value;
9193
9193
  }
9194
9194
  await streamPromise;
9195
- let pending3;
9196
- for (; (pending3 = __classPrivateFieldGet(this, _SessionToolRunner_results, "f").tryShift()) !== void 0; )
9197
- yield pending3;
9195
+ let pending4;
9196
+ for (; (pending4 = __classPrivateFieldGet(this, _SessionToolRunner_results, "f").tryShift()) !== void 0; )
9197
+ yield pending4;
9198
9198
  } finally {
9199
9199
  __classPrivateFieldGet(this, _SessionToolRunner_controller, "f").abort(), __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_disarmIdleTimer).call(this), await streamPromise;
9200
9200
  try {
@@ -9245,22 +9245,22 @@ var _SessionToolRunner_instances, _SessionToolRunner_consumed, _SessionToolRunne
9245
9245
  * already attached (see {@link SessionToolRunner.#streamLoop}).
9246
9246
  */
9247
9247
  async function() {
9248
- let ctrl = __classPrivateFieldGet(this, _SessionToolRunner_controller, "f"), pending3 = [], lastWasEndTurn = !1;
9248
+ let ctrl = __classPrivateFieldGet(this, _SessionToolRunner_controller, "f"), pending4 = [], lastWasEndTurn = !1;
9249
9249
  try {
9250
9250
  for await (let ev of this.client.beta.sessions.events.list(this.sessionId, { limit: 1e3 }, __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_requestOptions).call(this)))
9251
- __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_ingestHistory).call(this, ev, pending3), lastWasEndTurn = isEndTurnIdle(ev);
9251
+ __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_ingestHistory).call(this, ev, pending4), lastWasEndTurn = isEndTurnIdle(ev);
9252
9252
  } catch (e) {
9253
9253
  ctrl.signal.throwIfAborted(), __classPrivateFieldGet(this, _SessionToolRunner_logger, "f").warn("reconcile list failed", { error: String(e) });
9254
- for (let ev of pending3)
9254
+ for (let ev of pending4)
9255
9255
  __classPrivateFieldGet(this, _SessionToolRunner_seen, "f").delete(ev.id);
9256
9256
  return;
9257
9257
  }
9258
- let unanswered = pending3.filter((ev) => !__classPrivateFieldGet(this, _SessionToolRunner_answered, "f").has(ev.id));
9258
+ let unanswered = pending4.filter((ev) => !__classPrivateFieldGet(this, _SessionToolRunner_answered, "f").has(ev.id));
9259
9259
  lastWasEndTurn && unanswered.length === 0 ? __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_armIdleTimer).call(this) : __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_disarmIdleTimer).call(this);
9260
9260
  for (let ev of unanswered)
9261
9261
  await __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_execute).call(this, ev);
9262
- }, _SessionToolRunner_ingestHistory = function(ev, pending3) {
9263
- ev.type === "agent.tool_use" || ev.type === "agent.custom_tool_use" ? (__classPrivateFieldGet(this, _SessionToolRunner_seen, "f").add(ev.id), __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").has(ev.id) || pending3.push(ev)) : ev.type === "user.tool_result" ? __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").add(ev.tool_use_id) : ev.type === "user.custom_tool_result" && __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").add(ev.custom_tool_use_id);
9262
+ }, _SessionToolRunner_ingestHistory = function(ev, pending4) {
9263
+ ev.type === "agent.tool_use" || ev.type === "agent.custom_tool_use" ? (__classPrivateFieldGet(this, _SessionToolRunner_seen, "f").add(ev.id), __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").has(ev.id) || pending4.push(ev)) : ev.type === "user.tool_result" ? __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").add(ev.tool_use_id) : ev.type === "user.custom_tool_result" && __classPrivateFieldGet(this, _SessionToolRunner_answered, "f").add(ev.custom_tool_use_id);
9264
9264
  }, _SessionToolRunner_handleStreamEvent = /** Returns true when the runner should exit. */
9265
9265
  async function(ev) {
9266
9266
  switch (isEndTurnIdle(ev) ? __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_armIdleTimer).call(this) : __classPrivateFieldGet(this, _SessionToolRunner_instances, "m", _SessionToolRunner_disarmIdleTimer).call(this), ev.type) {
@@ -48312,8 +48312,8 @@ function memoizeWithTTLAsync(f, cacheLifetimeMs = 300 * 1e3) {
48312
48312
  let cache6 = /* @__PURE__ */ new Map(), inFlight5 = /* @__PURE__ */ new Map(), memoized = async (...args) => {
48313
48313
  let key = jsonStringify(args), cached6 = cache6.get(key), now2 = Date.now();
48314
48314
  if (!cached6) {
48315
- let pending3 = inFlight5.get(key);
48316
- if (pending3) return pending3;
48315
+ let pending4 = inFlight5.get(key);
48316
+ if (pending4) return pending4;
48317
48317
  let promise2 = f(...args);
48318
48318
  inFlight5.set(key, promise2);
48319
48319
  try {
@@ -49065,8 +49065,8 @@ function publishEngineAgentPanelEvent(ev) {
49065
49065
  }
49066
49066
  function subscribeEngineAgentPanel(fn2) {
49067
49067
  if (listener = fn2, buffer.length > 0) {
49068
- let pending3 = buffer.splice(0, buffer.length);
49069
- for (let ev of pending3)
49068
+ let pending4 = buffer.splice(0, buffer.length);
49069
+ for (let ev of pending4)
49070
49070
  try {
49071
49071
  fn2(ev);
49072
49072
  } catch {
@@ -51139,7 +51139,7 @@ var STRUCTURED_DETAIL_TYPES, MAX_STRUCTURED_FIELD_CHARS, WF_TERMINAL_STATUSES, P
51139
51139
 
51140
51140
  // node_modules/@sema-agent/client-core/dist/adapt/toolCards.js
51141
51141
  function createToolCardLedger(ctx, idOf) {
51142
- let pending3 = /* @__PURE__ */ new Map(), assistantResponseId = null, lastLiveTodos = [];
51142
+ let pending4 = /* @__PURE__ */ new Map(), assistantResponseId = null, lastLiveTodos = [];
51143
51143
  function* buildToolResult(p, end) {
51144
51144
  let isError = end?.isError ?? !1, body = end && end.output !== void 0 ? wireOutputToBody(p.name, end.output, isError, end.truncated === !0, flattenWireOutput, end.structured) : degradedToolResultBody(isError);
51145
51145
  if ((p.name === "Bash" || p.name === "Monitor") && !isError && end?.output !== void 0) {
@@ -51178,18 +51178,18 @@ function createToolCardLedger(ctx, idOf) {
51178
51178
  }, ctx.now());
51179
51179
  }
51180
51180
  function* closeCard(p, end) {
51181
- pending3.delete(p.id), assistantResponseId = null, yield* buildToolResult(p, end);
51181
+ pending4.delete(p.id), assistantResponseId = null, yield* buildToolResult(p, end);
51182
51182
  }
51183
51183
  return {
51184
- has: (id) => pending3.has(id),
51185
- peek: (id) => pending3.get(id),
51186
- entries: () => pending3.entries(),
51184
+ has: (id) => pending4.has(id),
51185
+ peek: (id) => pending4.get(id),
51186
+ entries: () => pending4.entries(),
51187
51187
  open: (p) => {
51188
- pending3.set(p.id, p);
51188
+ pending4.set(p.id, p);
51189
51189
  },
51190
51190
  close: closeCard,
51191
51191
  *sweep() {
51192
- for (let [, p] of pending3)
51192
+ for (let [, p] of pending4)
51193
51193
  yield* closeCard(p);
51194
51194
  },
51195
51195
  mintResponseId: (frame) => assistantResponseId ??= `msg_sema_${idOf(frame, "resp")}`,
@@ -53328,11 +53328,27 @@ function classifierDenyFromToolEnd(ev) {
53328
53328
  let tail = message.slice(form.length), reason = tail.startsWith(": ") ? tail.slice(2).trim() : void 0;
53329
53329
  return { message, ...reason !== void 0 && reason.length > 0 ? { reason } : {} };
53330
53330
  }
53331
+ function toolNameKey(name) {
53332
+ return name.replace(/[\s_-]+/g, "").toLowerCase();
53333
+ }
53334
+ function classifierDenyDisplay(toolName2, args) {
53335
+ let fallback = toolName2.length > 0 ? toolName2 : "tool", key = DISPLAY_ARG_KEY_BY_TOOL.get(toolNameKey(toolName2));
53336
+ if (key === void 0 || args === null || typeof args != "object")
53337
+ return bounded(fallback);
53338
+ let raw2 = args[key];
53339
+ return typeof raw2 != "string" || raw2.trim().length === 0 ? bounded(fallback) : bounded(raw2);
53340
+ }
53341
+ function bounded(s) {
53342
+ if (s.length <= CLASSIFIER_DENY_DISPLAY_MAX)
53343
+ return s;
53344
+ let keep = CLASSIFIER_DENY_DISPLAY_MAX - 1, cut = s.slice(0, keep), last3 = cut.charCodeAt(cut.length - 1), next = s.charCodeAt(keep);
53345
+ return last3 >= 55296 && last3 <= 56319 && next >= 56320 && next <= 57343 && (cut = cut.slice(0, -1)), `${cut}\u2026`;
53346
+ }
53331
53347
  function classifierDenyNoticeText(toolName2, reason) {
53332
53348
  let r = reason ?? "";
53333
53349
  return r.length > NOTICE_REASON_MAX && (r = `${r.slice(0, NOTICE_REASON_MAX - 1)}\u2026`), `${toolName2.length > 0 ? toolName2.toLowerCase() : "tool"} denied by auto mode${r ? ` \xB7 ${r}` : ""} \xB7 /permissions`;
53334
53350
  }
53335
- var CLASSIFIER_DENY_SIGNATURE, NOTICE_REASON_MAX, CLASSIFIER_DENY_FORMS, init_classifierVerdictWire = __esm({
53351
+ var CLASSIFIER_DENY_SIGNATURE, NOTICE_REASON_MAX, CLASSIFIER_DENY_FORMS, CLASSIFIER_DENY_DISPLAY_MAX, DISPLAY_ARG_KEY_BY_TOOL, init_classifierVerdictWire = __esm({
53336
53352
  "node_modules/@sema-agent/client-core/dist/classifierVerdictWire.js"() {
53337
53353
  init_systemReminderTag();
53338
53354
  CLASSIFIER_DENY_SIGNATURE = "auto-mode classifier blocked this call", NOTICE_REASON_MAX = 80;
@@ -53341,6 +53357,17 @@ var CLASSIFIER_DENY_SIGNATURE, NOTICE_REASON_MAX, CLASSIFIER_DENY_FORMS, init_cl
53341
53357
  "auto-mode classifier blocked this call at an inherited ancestor layer",
53342
53358
  CLASSIFIER_DENY_SIGNATURE
53343
53359
  ];
53360
+ CLASSIFIER_DENY_DISPLAY_MAX = 200, DISPLAY_ARG_KEY_BY_TOOL = /* @__PURE__ */ new Map([
53361
+ ["bash", "command"],
53362
+ ["read", "file_path"],
53363
+ ["fileread", "file_path"],
53364
+ ["write", "file_path"],
53365
+ ["filewrite", "file_path"],
53366
+ ["edit", "file_path"],
53367
+ ["fileedit", "file_path"],
53368
+ ["multiedit", "file_path"],
53369
+ ["notebookedit", "notebook_path"]
53370
+ ]);
53344
53371
  }
53345
53372
  });
53346
53373
 
@@ -54007,8 +54034,8 @@ function rewindSpecForMode(mode, targetEntryId) {
54007
54034
  return { rewindFilesTo: targetEntryId };
54008
54035
  }
54009
54036
  }
54010
- function projectRewind(pending3, captureEnabled) {
54011
- return pending3 ? { ...pending3 } : captureEnabled ? { rewindFiles: !0 } : {};
54037
+ function projectRewind(pending4, captureEnabled) {
54038
+ return pending4 ? { ...pending4 } : captureEnabled ? { rewindFiles: !0 } : {};
54012
54039
  }
54013
54040
  var init_rewindWireCaps = __esm({
54014
54041
  "node_modules/@sema-agent/client-core/dist/rewindWireCaps.js"() {
@@ -55388,14 +55415,14 @@ async function waitForClaimRelease(taskId, deps2) {
55388
55415
  }
55389
55416
  }
55390
55417
  async function attemptActiveRunSelfHeal(signal, runs, deps2) {
55391
- let pending3 = !1;
55418
+ let pending4 = !1;
55392
55419
  try {
55393
- pending3 = deps2?.hasPendingDecision?.() === !0;
55420
+ pending4 = deps2?.hasPendingDecision?.() === !0;
55394
55421
  } catch {
55395
- pending3 = !1;
55422
+ pending4 = !1;
55396
55423
  }
55397
55424
  let callerAborted = () => deps2?.signal?.aborted === !0;
55398
- if (pending3 && typeof deps2?.listOwnedPendingApprovals == "function" && !callerAborted()) {
55425
+ if (pending4 && typeof deps2?.listOwnedPendingApprovals == "function" && !callerAborted()) {
55399
55426
  let recheckCtl = new AbortController(), onCallerAbort = () => {
55400
55427
  recheckCtl.abort(deps2.signal?.reason);
55401
55428
  };
@@ -55404,13 +55431,13 @@ async function attemptActiveRunSelfHeal(signal, runs, deps2) {
55404
55431
  await Promise.race([
55405
55432
  deps2.listOwnedPendingApprovals({ signal: recheckCtl.signal }),
55406
55433
  claimPollSleep(OWNED_PENDING_RECHECK_TIMEOUT_MS, recheckCtl.signal).then(() => null)
55407
- ]) === 0 && !callerAborted() && (pending3 = !1);
55434
+ ]) === 0 && !callerAborted() && (pending4 = !1);
55408
55435
  } catch {
55409
55436
  } finally {
55410
55437
  deps2.signal?.removeEventListener("abort", onCallerAbort), recheckCtl.abort(new Error("owned-pending recheck settled"));
55411
55438
  }
55412
55439
  }
55413
- if (pending3)
55440
+ if (pending4)
55414
55441
  return { kind: "decision-pending", taskId: signal.activeTaskId };
55415
55442
  let taskId = signal.activeTaskId;
55416
55443
  if (taskId === null)
@@ -58533,6 +58560,9 @@ var wireSessionStopHookPrompt, wireSessionStopHookCcSemantics, GOAL_STOP_HOOK_WI
58533
58560
  });
58534
58561
 
58535
58562
  // node_modules/@sema-agent/client-core/dist/hooksWireCaps.js
58563
+ function hooksLockedToPluginOnly(policyValue) {
58564
+ return policyValue === !0 ? !0 : Array.isArray(policyValue) ? policyValue.includes("hooks") : !1;
58565
+ }
58536
58566
  function hooksOfSource(source) {
58537
58567
  try {
58538
58568
  let s = hostSettings()?.getSettingsForSource(source);
@@ -58565,7 +58595,9 @@ function hooksForWire() {
58565
58595
  hostLog("debug", "hooksWireCaps: disableAllHooks (managed) \u2014 no hooks projected to the engine");
58566
58596
  return;
58567
58597
  }
58568
- let managedOnly = policy2?.allowManagedHooksOnly === !0, sources = managedOnly ? ["policySettings"] : ["policySettings", ...EDITABLE_HOOK_SOURCES], merged = {};
58598
+ let pluginOnlyHooks = hooksLockedToPluginOnly(policy2?.strictPluginOnlyCustomization);
58599
+ pluginOnlyHooks && hostLog("debug", "hooksWireCaps: strictPluginOnlyCustomization locks the hooks surface (managed) \u2014 only policySettings hooks projected to the engine");
58600
+ let managedOnly = policy2?.allowManagedHooksOnly === !0 || pluginOnlyHooks, sources = managedOnly ? ["policySettings"] : ["policySettings", ...EDITABLE_HOOK_SOURCES], merged = {};
58569
58601
  for (let source of sources) {
58570
58602
  let hooks2 = hooksOfSource(source);
58571
58603
  if (hooks2)
@@ -60178,8 +60210,8 @@ async function findPendingForTask(client3, taskId, matches2, opts, callId, ident
60178
60210
  } catch (e) {
60179
60211
  return { ok: !1, reason: `approvals.list failed: ${String(e)}` };
60180
60212
  }
60181
- let decidable = rows2.filter((r) => askParkForeignGateKind(r) === null), identityRow = callId !== void 0 ? decidable.find((r) => r.taskId === taskId && (r.boundCallId === callId || r.toolCallId === callId)) : void 0, identityConflicts = identityRow !== void 0 && !identityAccepts(identityRow), pool = identityConflicts ? decidable.filter((r) => identityAccepts(r)) : decidable, pending3 = (identityConflicts ? void 0 : identityRow) ?? pool.find((r) => r.taskId === taskId && matches2(typeof r.toolName == "string" ? r.toolName : void 0)) ?? pool.find((r) => r.taskId === taskId);
60182
- return pending3 ? { ok: !0, pending: pending3, gatedCallId: pending3.toolCallId ?? pending3.boundCallId ?? void 0 } : { ok: !1, reason: "no pending checkpoint for this run (resolved/expired?)", code: "no_pending" };
60213
+ let decidable = rows2.filter((r) => askParkForeignGateKind(r) === null), identityRow = callId !== void 0 ? decidable.find((r) => r.taskId === taskId && (r.boundCallId === callId || r.toolCallId === callId)) : void 0, identityConflicts = identityRow !== void 0 && !identityAccepts(identityRow), pool = identityConflicts ? decidable.filter((r) => identityAccepts(r)) : decidable, pending4 = (identityConflicts ? void 0 : identityRow) ?? pool.find((r) => r.taskId === taskId && matches2(typeof r.toolName == "string" ? r.toolName : void 0)) ?? pool.find((r) => r.taskId === taskId);
60214
+ return pending4 ? { ok: !0, pending: pending4, gatedCallId: pending4.toolCallId ?? pending4.boundCallId ?? void 0 } : { ok: !1, reason: "no pending checkpoint for this run (resolved/expired?)", code: "no_pending" };
60183
60215
  }
60184
60216
  function makeHitlCanUseTool(bridge3, prompt) {
60185
60217
  return async (tool, input, _toolUseContext, _assistantMessage, toolUseID, forceDecision) => {
@@ -60345,12 +60377,12 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, HitlSafetyError, DECIDE_TRANSPOR
60345
60377
  * `HitlSafetyError('binding_mismatch')` — the caller re-presents, NEVER auto-retries.
60346
60378
  */
60347
60379
  async decideTool(outcome, toolUseID, opts, preResolvedPending) {
60348
- let pending3 = preResolvedPending ?? await this.pendingForDecide(toolUseID, opts);
60349
- if (!pending3)
60380
+ let pending4 = preResolvedPending ?? await this.pendingForDecide(toolUseID, opts);
60381
+ if (!pending4)
60350
60382
  throw new HitlSafetyError("no pending checkpoint to decide (resolved/expired under the human) \u2014 refetch + re-present", "no_pending");
60351
60383
  let decision = outcome.decision === "approve" ? {
60352
60384
  decision: "approve",
60353
- ...this.bindingOf(pending3),
60385
+ ...this.bindingOf(pending4),
60354
60386
  // updatedInput is applied AFTER the binding check; binding still binds the ORIGINAL input.
60355
60387
  ...outcome.updatedInput !== void 0 ? { updatedInput: outcome.updatedInput } : {},
60356
60388
  // accept-session 的 durable-park 半场(server 1.191 decide 契约 `remember:"session"` →
@@ -60360,10 +60392,10 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, HitlSafetyError, DECIDE_TRANSPOR
60360
60392
  ...outcome.remember !== void 0 ? { remember: outcome.remember } : {}
60361
60393
  } : {
60362
60394
  decision: "deny",
60363
- ...this.bindingOf(pending3),
60395
+ ...this.bindingOf(pending4),
60364
60396
  ...outcome.reason !== void 0 ? { reason: outcome.reason } : {}
60365
60397
  };
60366
- return this.decideRaw(pending3.sessionId, decision, opts);
60398
+ return this.decideRaw(pending4.sessionId, decision, opts);
60367
60399
  }
60368
60400
  // ── §3. AskUserQuestion: answer through the same gate ───────────────────────
60369
60401
  /**
@@ -60385,15 +60417,15 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, HitlSafetyError, DECIDE_TRANSPOR
60385
60417
  */
60386
60418
  async answerQuestion(answers, toolUseID, opts, preResolvedPending) {
60387
60419
  assertAnswersSendable(answers);
60388
- let pending3 = preResolvedPending ?? await this.pendingForDecide(toolUseID, opts);
60389
- if (!pending3)
60420
+ let pending4 = preResolvedPending ?? await this.pendingForDecide(toolUseID, opts);
60421
+ if (!pending4)
60390
60422
  throw new HitlSafetyError("no pending AskUserQuestion checkpoint to answer \u2014 refetch + re-present", "no_pending");
60391
60423
  let decision = {
60392
60424
  decision: "approve",
60393
60425
  answer: { answers: answers.map((a) => marshalAnswer(a)) },
60394
- ...this.bindingOf(pending3)
60426
+ ...this.bindingOf(pending4)
60395
60427
  };
60396
- return this.decideRaw(pending3.sessionId, decision, opts);
60428
+ return this.decideRaw(pending4.sessionId, decision, opts);
60397
60429
  }
60398
60430
  // ── §4. plan_review: the distinct wire ──────────────────────────────────────
60399
60431
  /**
@@ -60659,47 +60691,47 @@ async function surfaceFsApprovalAndDecide(deps2, taskId, argsByCall, signal, par
60659
60691
  );
60660
60692
  if (!found.ok)
60661
60693
  return { kind: "failed", reason: found.reason, ...found.code !== void 0 ? { code: found.code } : {} };
60662
- let { pending: pending3, gatedCallId } = found, toolName2 = typeof pending3.toolName == "string" ? pending3.toolName : "", args = (gatedCallId !== void 0 ? argsByCall.get(gatedCallId) : void 0) ?? pending3.input ?? {};
60694
+ let { pending: pending4, gatedCallId } = found, toolName2 = typeof pending4.toolName == "string" ? pending4.toolName : "", args = (gatedCallId !== void 0 ? argsByCall.get(gatedCallId) : void 0) ?? pending4.input ?? {};
60663
60695
  if (typeof args != "object" || args === null)
60664
60696
  return { kind: "failed", gatedCallId, reason: "gate has no tool input payload" };
60665
- let bridge3 = new HitlBridge(deps2.client, taskId), callKey = approvalCallKey(gatedCallId, taskId), ruleOffersReadOnly = readOfferSupply(pending3.ruleOffers, pending3.ruleSuggestions), durableProbeCause = pending3.riskDescriptor?.probeCause;
60697
+ let bridge3 = new HitlBridge(deps2.client, taskId), callKey = approvalCallKey(gatedCallId, taskId), ruleOffersReadOnly = readOfferSupply(pending4.ruleOffers, pending4.ruleSuggestions), durableProbeCause = pending4.riskDescriptor?.probeCause;
60666
60698
  deps2.onPresented?.();
60667
60699
  let card = await surfaceApprovalCard({
60668
60700
  toolName: toolName2,
60669
60701
  args,
60670
60702
  callKey,
60671
60703
  ...signal ? { signal } : {},
60672
- ...pending3.governanceForced === !0 ? { governanceForced: !0 } : {},
60704
+ ...pending4.governanceForced === !0 ? { governanceForced: !0 } : {},
60673
60705
  // S-30①(0.48.0):durable 行的 bidi 披露位随卡透传。**同一个病形的第 N 例** —— 这处「行 → 卡」
60674
60706
  // 重铸是闭形的,server ≥7.53 起行上就有的这一位在这里整键丢失([C170] 那次 ruleSuggestions /
60675
60707
  // governanceForced 逐字同一个坐标)。本批由 durable-card 门 ⑦ 段的**富行键集普查**当天抓出
60676
60708
  // (红文逐字:「无账:hasBidiControls」),不是人眼发现的。
60677
60709
  // 🔴 条件 stamp **只认严格 true**,与 governanceForced / inputHasBidi 同族:上游契约是
60678
60710
  // 「`true` 或缺席,恒不写 false/null」,这里认宽了就会把一个 falsy 值渲成披露。
60679
- ...pending3.hasBidiControls === !0 ? { hasBidiControls: !0 } : {},
60711
+ ...pending4.hasBidiControls === !0 ? { hasBidiControls: !0 } : {},
60680
60712
  ...ruleOffersReadOnly !== void 0 ? { ruleOffersReadOnly } : {},
60681
60713
  ...isWireRecordCarrier(durableProbeCause) ? { probeCause: durableProbeCause } : {},
60682
60714
  // #348(0.44.0)durable 腿的对偶:行上**本来就存着**这个值(server `parked-decide.ts`;SDK
60683
60715
  // `PendingCheckpoint.toolCallId?: string | null` 直证)。与活卡帧腿同一个卡位、同一条缺席纪律 ——
60684
60716
  // `null`(SDK 声明的第二种缺席形)与空串一并降键缺席,绝不把 `null` 折成串。
60685
- ...typeof pending3.toolCallId == "string" && pending3.toolCallId !== "" ? { toolCallId: pending3.toolCallId } : {}
60717
+ ...typeof pending4.toolCallId == "string" && pending4.toolCallId !== "" ? { toolCallId: pending4.toolCallId } : {}
60686
60718
  });
60687
60719
  switch (card.kind) {
60688
60720
  case "failed":
60689
60721
  return { kind: "failed", gatedCallId, reason: card.reason };
60690
60722
  case "aborted":
60691
- return observeCancelByDeny(bridge3.decideTool({ decision: "deny", reason: "Interrupted by user" }, gatedCallId, void 0, pending3), taskId), { kind: "aborted", gatedCallId };
60723
+ return observeCancelByDeny(bridge3.decideTool({ decision: "deny", reason: "Interrupted by user" }, gatedCallId, void 0, pending4), taskId), { kind: "aborted", gatedCallId };
60692
60724
  case "allow":
60693
60725
  try {
60694
60726
  if (card.allowSession)
60695
60727
  try {
60696
- return await bridge3.decideTool({ decision: "approve", remember: "session", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} }, gatedCallId, signal ? { signal } : void 0, pending3), { kind: "decided", gatedCallId };
60728
+ return await bridge3.decideTool({ decision: "approve", remember: "session", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} }, gatedCallId, signal ? { signal } : void 0, pending4), { kind: "decided", gatedCallId };
60697
60729
  } catch (e) {
60698
60730
  if (e instanceof HitlSafetyError || e instanceof DecideTransportRetryExhaustedError || readDecideCurrentPending(e) !== void 0)
60699
60731
  throw e;
60700
60732
  hostLog("debug", `liveToolApprovalWire: decide(approve+remember) failed (${String(e)}) \u2014 falling back to plain approve`);
60701
60733
  }
60702
- return await bridge3.decideTool({ decision: "approve", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} }, gatedCallId, signal ? { signal } : void 0, pending3), { kind: "decided", gatedCallId };
60734
+ return await bridge3.decideTool({ decision: "approve", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} }, gatedCallId, signal ? { signal } : void 0, pending4), { kind: "decided", gatedCallId };
60703
60735
  } catch (e) {
60704
60736
  let currentPending = readDecideCurrentPending(e);
60705
60737
  return {
@@ -60713,7 +60745,7 @@ async function surfaceFsApprovalAndDecide(deps2, taskId, argsByCall, signal, par
60713
60745
  }
60714
60746
  case "deny":
60715
60747
  try {
60716
- return await bridge3.decideTool({ decision: "deny", reason: denyReasonForWire(card.reason, `task ${taskId}`) ?? DEFAULT_DENY_REASON }, gatedCallId, signal ? { signal } : void 0, pending3), { kind: "decided", gatedCallId, denied: !0 };
60748
+ return await bridge3.decideTool({ decision: "deny", reason: denyReasonForWire(card.reason, `task ${taskId}`) ?? DEFAULT_DENY_REASON }, gatedCallId, signal ? { signal } : void 0, pending4), { kind: "decided", gatedCallId, denied: !0 };
60717
60749
  } catch (e) {
60718
60750
  let currentPending = readDecideCurrentPending(e);
60719
60751
  return {
@@ -61215,16 +61247,16 @@ async function routeToolApprovalFrame(ev, ctx) {
61215
61247
  return decision === "deny" && !fromSubagent && (gatedCallId !== void 0 ? led.markDenied(gatedCallId) : led.armDenyStamp()), { kind: "skip" };
61216
61248
  }
61217
61249
  function routeToolStart(ev, callId, led) {
61218
- return led.markStarted(callId) ? (isGatedToolName(ev.toolName) && (led.noteGatedStart(callId, ev), typeof ev.toolName == "string" && toolNameIsFsWrite(ev.toolName) && led.pushFsCall(callId), typeof ev.toolName == "string" && (toolNameIsFsWrite(ev.toolName) || toolNameIsShellExec(ev.toolName)) && led.noteFsOrShellGate(callId)), { kind: "yield", events: [ev] }) : { kind: "skip" };
61250
+ return led.noteStart(callId, ev), led.markStarted(callId) ? (isGatedToolName(ev.toolName) && (led.noteGatedStart(callId, ev), typeof ev.toolName == "string" && toolNameIsFsWrite(ev.toolName) && led.pushFsCall(callId), typeof ev.toolName == "string" && (toolNameIsFsWrite(ev.toolName) || toolNameIsShellExec(ev.toolName)) && led.noteFsOrShellGate(callId)), { kind: "yield", events: [ev] }) : { kind: "skip" };
61219
61251
  }
61220
61252
  function routeToolEnd(ev, callId, led) {
61221
61253
  if (led.isEnded(callId))
61222
- return { kind: "skip" };
61254
+ return led.dropStartArgs(callId), { kind: "skip" };
61223
61255
  led.dropFsCall(callId);
61224
61256
  for (let arm3 of TOOL_END_ARMS) {
61225
61257
  let action = arm3.run(ev, callId, led);
61226
61258
  if (action)
61227
- return action;
61259
+ return led.dropStartArgs(callId), action;
61228
61260
  }
61229
61261
  throw new Error("frameRouter: tool_end \u6709\u5E8F\u81C2\u5168\u90E8\u843D\u7A7A \u2014\u2014 generic-close \u4E0D\u518D\u662F\u65E0\u6761\u4EF6\u515C\u5E95\u81C2");
61230
61262
  }
@@ -61269,8 +61301,11 @@ var HITL_REJECT_MESSAGE, HITL_INTERRUPT_MESSAGE_FOR_TOOL_USE, RUN_CANCELLED_ERRO
61269
61301
  if (ev.isError !== !0 || led.isDenied(callId))
61270
61302
  return;
61271
61303
  let verdict = classifierDenyFromToolEnd(ev);
61272
- if (verdict)
61273
- return led.markEnded(callId), led.dropHeld(callId), surfaceForCurrentSession()?.surfaceClassifierDeny(typeof ev.toolName == "string" ? ev.toolName : "tool", verdict), hostLog("debug", `liveHitlAskWire: classifier deny verdict on ${callId} (${String(ev.toolName)}) \u2014 labeled render + notice`), { kind: "yield", events: [{ ...ev, output: verdict.message, structured: void 0 }] };
61304
+ if (!verdict)
61305
+ return;
61306
+ led.markEnded(callId), led.dropHeld(callId);
61307
+ let startArgs = led.startArgs().get(callId);
61308
+ return surfaceForCurrentSession()?.surfaceClassifierDeny(typeof ev.toolName == "string" ? ev.toolName : "tool", verdict, { toolCallId: callId, ...startArgs !== void 0 ? { args: startArgs } : {} }), hostLog("debug", `liveHitlAskWire: classifier deny verdict on ${callId} (${String(ev.toolName)}) \u2014 labeled render + notice`), { kind: "yield", events: [{ ...ev, output: verdict.message, structured: void 0 }] };
61274
61309
  }
61275
61310
  },
61276
61311
  {
@@ -61349,7 +61384,7 @@ var installed, init_editedRuleTextPrecheck = __esm({
61349
61384
 
61350
61385
  // node_modules/@sema-agent/client-core/dist/hitl/gateLedger.js
61351
61386
  function createGateLedger() {
61352
- let startedCalls = /* @__PURE__ */ new Set(), endedCalls = /* @__PURE__ */ new Set(), heldAskEnds = /* @__PURE__ */ new Map(), gatedStartArgsByCall = /* @__PURE__ */ new Map(), deniedCalls = /* @__PURE__ */ new Set(), pendingFsCalls = [], resolvedAnswers = /* @__PURE__ */ new Map(), decidedGates = /* @__PURE__ */ new Set(), alreadyResolvedKey, alreadyResolvedStreak = 0, fsOrShellFamilyGate = !1, droppedFromBatch = /* @__PURE__ */ new Set(), batchParkCount = 0, heldSinceLastPark = !1, fsOrShellGatedCalls = /* @__PURE__ */ new Set(), lastFsOrShellGatedCall, resolveGateSubjects = () => {
61387
+ let startedCalls = /* @__PURE__ */ new Set(), endedCalls = /* @__PURE__ */ new Set(), heldAskEnds = /* @__PURE__ */ new Map(), gatedStartArgsByCall = /* @__PURE__ */ new Map(), startArgsByCall = /* @__PURE__ */ new Map(), deniedCalls = /* @__PURE__ */ new Set(), pendingFsCalls = [], resolvedAnswers = /* @__PURE__ */ new Map(), decidedGates = /* @__PURE__ */ new Set(), alreadyResolvedKey, alreadyResolvedStreak = 0, fsOrShellFamilyGate = !1, droppedFromBatch = /* @__PURE__ */ new Set(), batchParkCount = 0, heldSinceLastPark = !1, fsOrShellGatedCalls = /* @__PURE__ */ new Set(), lastFsOrShellGatedCall, resolveGateSubjects = () => {
61353
61388
  if (batchParkCount !== 1 || !fsOrShellFamilyGate)
61354
61389
  return;
61355
61390
  for (let id of heldAskEnds.keys())
@@ -61393,6 +61428,20 @@ function createGateLedger() {
61393
61428
  gatedStartArgs() {
61394
61429
  return gatedStartArgsByCall;
61395
61430
  },
61431
+ noteStart(callId, ev) {
61432
+ for (startArgsByCall.delete(callId), startArgsByCall.set(callId, ev.args); startArgsByCall.size > 256; ) {
61433
+ let oldest = startArgsByCall.keys().next();
61434
+ if (oldest.done === !0)
61435
+ break;
61436
+ startArgsByCall.delete(oldest.value);
61437
+ }
61438
+ },
61439
+ startArgs() {
61440
+ return startArgsByCall;
61441
+ },
61442
+ dropStartArgs(callId) {
61443
+ startArgsByCall.delete(callId);
61444
+ },
61396
61445
  isEnded(callId) {
61397
61446
  return endedCalls.has(callId);
61398
61447
  },
@@ -61543,9 +61592,9 @@ async function surfaceGateAndDecide(deps2, taskId, askArgsByCall, signal, parkGa
61543
61592
  );
61544
61593
  if (!found.ok)
61545
61594
  return { kind: "failed", reason: found.reason, ...found.code !== void 0 ? { code: found.code } : {} };
61546
- let { pending: pending3, gatedCallId } = found, fromArgs = gatedCallId ? askArgsByCall.get(gatedCallId)?.questions : void 0, fromPending = pending3.input?.questions, questions = Array.isArray(fromArgs) && fromArgs.length > 0 ? fromArgs : fromPending;
61595
+ let { pending: pending4, gatedCallId } = found, fromArgs = gatedCallId ? askArgsByCall.get(gatedCallId)?.questions : void 0, fromPending = pending4.input?.questions, questions = Array.isArray(fromArgs) && fromArgs.length > 0 ? fromArgs : fromPending;
61547
61596
  if (!Array.isArray(questions) || questions.length === 0) {
61548
- let truncated = pending3.input?.truncated === !0;
61597
+ let truncated = pending4.input?.truncated === !0;
61549
61598
  return {
61550
61599
  kind: "failed",
61551
61600
  gatedCallId,
@@ -61565,10 +61614,10 @@ async function surfaceGateAndDecide(deps2, taskId, askArgsByCall, signal, parkGa
61565
61614
  signal?.addEventListener("abort", onAbort, { once: !0 }), onPresented?.(), publishQuestionFrame({ type: "question", questionId, questions });
61566
61615
  }), bridge3 = new HitlBridge(deps2.client, taskId);
61567
61616
  if (answer === null)
61568
- return observeCancelByDeny(bridge3.decideTool({ decision: "deny", reason: "Interrupted by user" }, gatedCallId, void 0, pending3), taskId), { kind: "aborted", gatedCallId };
61617
+ return observeCancelByDeny(bridge3.decideTool({ decision: "deny", reason: "Interrupted by user" }, gatedCallId, void 0, pending4), taskId), { kind: "aborted", gatedCallId };
61569
61618
  try {
61570
61619
  let entries = answer.answers ?? [];
61571
- return entries.some((a) => (a.selected?.length ?? 0) > 0 || (a.note?.length ?? 0) > 0) ? (await bridge3.answerQuestion(entries, gatedCallId, signal ? { signal } : void 0, pending3), { kind: "decided", gatedCallId, answered: toAnsweredOutput(questions, answer) }) : (await bridge3.decideTool({ decision: "deny", reason: "User declined to answer" }, gatedCallId, signal ? { signal } : void 0, pending3), { kind: "decided", gatedCallId });
61620
+ return entries.some((a) => (a.selected?.length ?? 0) > 0 || (a.note?.length ?? 0) > 0) ? (await bridge3.answerQuestion(entries, gatedCallId, signal ? { signal } : void 0, pending4), { kind: "decided", gatedCallId, answered: toAnsweredOutput(questions, answer) }) : (await bridge3.decideTool({ decision: "deny", reason: "User declined to answer" }, gatedCallId, signal ? { signal } : void 0, pending4), { kind: "decided", gatedCallId });
61572
61621
  } catch (e) {
61573
61622
  let code2 = e instanceof HitlSafetyError && isGateFailureCode(e.code) ? e.code : void 0, currentPending = readDecideCurrentPending(e);
61574
61623
  return {
@@ -62146,8 +62195,8 @@ function pendingRowIsOwnedByThisSession(row2, deps2) {
62146
62195
  let sessionId = (deps2?.currentSessionId ?? (() => hostSessionFor(sessionKey)?.currentSessionId()))(), rowSessionId = typeof row2.sessionId == "string" ? row2.sessionId : "";
62147
62196
  return typeof sessionId == "string" && sessionId.length > 0 && rowSessionId.length > 0 && rowSessionId === sessionId;
62148
62197
  }
62149
- function askQuestionsFromPending(pending3) {
62150
- let input = pending3.input;
62198
+ function askQuestionsFromPending(pending4) {
62199
+ let input = pending4.input;
62151
62200
  if (typeof input != "object" || input === null)
62152
62201
  return null;
62153
62202
  let qs = input.questions;
@@ -62272,8 +62321,8 @@ var DECISION_NOTE_NOTICE_KEY, init_approvalDecisionNoteAudit = __esm({
62272
62321
 
62273
62322
  // node_modules/@sema-agent/client-core/dist/hitl/askParkRowRouting.js
62274
62323
  function classifyAskParkRows(rows2, taskId, deps2) {
62275
- let isOwned = deps2?.isOwned ?? ((row2) => pendingRowIsOwnedByThisSession(row2, deps2?.ownership)), own2 = rows2.find((r) => r.taskId === taskId), sole = rows2.length === 1 ? rows2[0] : void 0, soleUnowned = sole !== void 0 && !isOwned(sole), pending3 = own2 ?? (soleUnowned ? void 0 : sole);
62276
- if (pending3 === void 0)
62324
+ let isOwned = deps2?.isOwned ?? ((row2) => pendingRowIsOwnedByThisSession(row2, deps2?.ownership)), own2 = rows2.find((r) => r.taskId === taskId), sole = rows2.length === 1 ? rows2[0] : void 0, soleUnowned = sole !== void 0 && !isOwned(sole), pending4 = own2 ?? (soleUnowned ? void 0 : sole);
62325
+ if (pending4 === void 0)
62277
62326
  return {
62278
62327
  kind: "unborn",
62279
62328
  reason: rows2.length === 0 ? (
@@ -62282,11 +62331,11 @@ function classifyAskParkRows(rows2, taskId, deps2) {
62282
62331
  `no pending row at all for task ${taskId} \u2014 either an orphan park (a seat held with no decision outstanding) or the next gate's row is not minted yet`
62283
62332
  ) : soleUnowned ? `the only pending row (task ${String(sole?.taskId)} / session ${String(sole?.sessionId)}) could not be proven to belong to this client (not in its own-run ledger, session id absent or different) \u2014 refusing to surface an approval that may be another session's` : `${String(rows2.length)} pending rows but none for task ${taskId} \u2014 ambiguous queue, refusing to surface an unrelated row`
62284
62333
  };
62285
- let foreignKind = askParkForeignGateKind(pending3);
62334
+ let foreignKind = askParkForeignGateKind(pending4);
62286
62335
  return foreignKind !== null ? {
62287
62336
  kind: "unborn",
62288
- reason: `the visible pending row (task ${String(pending3.taskId)}) is parked on a '${foreignKind}' gate \u2014 not an ask/approval gate; this arm will not surface or decide it, and it may also be the previous gate's row still visible during a transition`
62289
- } : { kind: "row", row: pending3 };
62337
+ reason: `the visible pending row (task ${String(pending4.taskId)}) is parked on a '${foreignKind}' gate \u2014 not an ask/approval gate; this arm will not surface or decide it, and it may also be the previous gate's row still visible during a transition`
62338
+ } : { kind: "row", row: pending4 };
62290
62339
  }
62291
62340
  function askParkRowGateKind(row2) {
62292
62341
  return typeof row2.gateKind == "string" && row2.gateKind.length > 0 ? row2.gateKind : null;
@@ -64553,6 +64602,7 @@ __export(dist_exports, {
64553
64602
  CHROME_EVENT_KINDS: () => CHROME_EVENT_KINDS,
64554
64603
  CLAIM_HELD_STATES: () => CLAIM_HELD_STATES,
64555
64604
  CLAIM_RELEASED_STATES: () => CLAIM_RELEASED_STATES,
64605
+ CLASSIFIER_DENY_DISPLAY_MAX: () => CLASSIFIER_DENY_DISPLAY_MAX,
64556
64606
  CLASSIFIER_DENY_SIGNATURE: () => CLASSIFIER_DENY_SIGNATURE,
64557
64607
  CLIENT_VERBS: () => CLIENT_VERBS,
64558
64608
  CONFIG_DELEGATION_ENTRY_CAPS: () => CONFIG_DELEGATION_ENTRY_CAPS,
@@ -64843,6 +64893,7 @@ __export(dist_exports, {
64843
64893
  catalogCachePath: () => catalogCachePath,
64844
64894
  catalogShaUrlFor: () => catalogShaUrlFor,
64845
64895
  ccStopSemanticsFromVersion: () => ccStopSemanticsFromVersion,
64896
+ classifierDenyDisplay: () => classifierDenyDisplay,
64846
64897
  classifierDenyFromToolEnd: () => classifierDenyFromToolEnd,
64847
64898
  classifierDenyNoticeText: () => classifierDenyNoticeText,
64848
64899
  classifyAskParkChainFailure: () => classifyAskParkChainFailure,
@@ -84167,6 +84218,22 @@ var cachedLayers, init_userSetting = __esm({
84167
84218
  });
84168
84219
 
84169
84220
  // build-src/src/sema/overrides/settings-187.ts
84221
+ var settings_187_exports = {};
84222
+ __export(settings_187_exports, {
84223
+ semaAgentPushNotifEnabled: () => semaAgentPushNotifEnabled,
84224
+ semaAutoCompactEnabled: () => semaAutoCompactEnabled,
84225
+ semaEditorMode: () => semaEditorMode,
84226
+ semaFileCheckpointingEnabled: () => semaFileCheckpointingEnabled,
84227
+ semaInputNeededNotifEnabled: () => semaInputNeededNotifEnabled,
84228
+ semaPreferredNotifChannel: () => semaPreferredNotifChannel,
84229
+ semaRemoteControlAtStartup: () => semaRemoteControlAtStartup,
84230
+ semaShowMessageTimestamps: () => semaShowMessageTimestamps,
84231
+ semaShowTurnDuration: () => semaShowTurnDuration,
84232
+ semaTerminalProgressBarEnabled: () => semaTerminalProgressBarEnabled,
84233
+ semaUserSetting: () => semaUserSetting,
84234
+ semaVerbose: () => semaVerbose,
84235
+ writeMigratedUserSetting: () => writeMigratedUserSetting
84236
+ });
84170
84237
  function writeMigratedUserSetting(patch2) {
84171
84238
  let result = updateSettingsForSource(
84172
84239
  "userSettings",
@@ -84210,6 +84277,14 @@ function semaRemoteControlAtStartup() {
84210
84277
  let v2 = resolveUserSetting("remoteControlAtStartup");
84211
84278
  return typeof v2 == "boolean" ? v2 : void 0;
84212
84279
  }
84280
+ function semaInputNeededNotifEnabled() {
84281
+ let v2 = resolveUserSetting("inputNeededNotifEnabled");
84282
+ return typeof v2 == "boolean" ? v2 : void 0;
84283
+ }
84284
+ function semaAgentPushNotifEnabled() {
84285
+ let v2 = resolveUserSetting("agentPushNotifEnabled");
84286
+ return typeof v2 == "boolean" ? v2 : void 0;
84287
+ }
84213
84288
  function semaPreferredNotifChannel() {
84214
84289
  let v2 = resolveUserSetting("preferredNotifChannel");
84215
84290
  return typeof v2 == "string" && NOTIF_CHANNELS.has(v2) ? v2 : void 0;
@@ -88371,13 +88446,13 @@ function chordExactlyMatches(chord, binding) {
88371
88446
  }
88372
88447
  return !0;
88373
88448
  }
88374
- function resolveKeyWithChordState(input, key, activeContexts, bindings, pending3) {
88375
- if (key.escape && pending3 !== null)
88449
+ function resolveKeyWithChordState(input, key, activeContexts, bindings, pending4) {
88450
+ if (key.escape && pending4 !== null)
88376
88451
  return { type: "chord_cancelled" };
88377
88452
  let currentKeystroke = buildKeystroke(input, key);
88378
88453
  if (!currentKeystroke)
88379
- return pending3 !== null ? { type: "chord_cancelled" } : { type: "none" };
88380
- let testChord = pending3 ? [...pending3, currentKeystroke] : [currentKeystroke], ctxSet = new Set(activeContexts), contextBindings = bindings.filter((b3) => ctxSet.has(b3.context)), chordWinners = /* @__PURE__ */ new Map();
88454
+ return pending4 !== null ? { type: "chord_cancelled" } : { type: "none" };
88455
+ let testChord = pending4 ? [...pending4, currentKeystroke] : [currentKeystroke], ctxSet = new Set(activeContexts), contextBindings = bindings.filter((b3) => ctxSet.has(b3.context)), chordWinners = /* @__PURE__ */ new Map();
88381
88456
  for (let binding of contextBindings)
88382
88457
  binding.chord.length > testChord.length && chordPrefixMatches(testChord, binding) && chordWinners.set(chordToString(binding.chord), binding.action);
88383
88458
  let hasLongerChords = !1;
@@ -88391,7 +88466,7 @@ function resolveKeyWithChordState(input, key, activeContexts, bindings, pending3
88391
88466
  let exactMatch;
88392
88467
  for (let binding of contextBindings)
88393
88468
  chordExactlyMatches(testChord, binding) && (exactMatch = binding);
88394
- return exactMatch ? exactMatch.action === null ? { type: "unbound" } : { type: "match", action: exactMatch.action } : pending3 !== null ? { type: "chord_cancelled" } : { type: "none" };
88469
+ return exactMatch ? exactMatch.action === null ? { type: "unbound" } : { type: "match", action: exactMatch.action } : pending4 !== null ? { type: "chord_cancelled" } : { type: "none" };
88395
88470
  }
88396
88471
  var init_resolver = __esm({
88397
88472
  "build-src/src/keybindings/resolver.ts"() {
@@ -90432,8 +90507,8 @@ Error generating stack: ` + x3.message + `
90432
90507
  concurrentQueues[i++] = null;
90433
90508
  var lane = concurrentQueues[i];
90434
90509
  if (concurrentQueues[i++] = null, queue3 !== null && update2 !== null) {
90435
- var pending3 = queue3.pending;
90436
- pending3 === null ? update2.next = update2 : (update2.next = pending3.next, pending3.next = update2), queue3.pending = update2;
90510
+ var pending4 = queue3.pending;
90511
+ pending4 === null ? update2.next = update2 : (update2.next = pending4.next, pending4.next = update2), queue3.pending = update2;
90437
90512
  }
90438
90513
  lane !== 0 && markUpdateLaneFromFiberToRoot(fiber, update2, lane);
90439
90514
  }
@@ -90487,8 +90562,8 @@ Error generating stack: ` + x3.message + `
90487
90562
  var updateQueue = fiber.updateQueue;
90488
90563
  if (updateQueue === null) return null;
90489
90564
  if (updateQueue = updateQueue.shared, (executionContext & 2) !== 0) {
90490
- var pending3 = updateQueue.pending;
90491
- return pending3 === null ? update2.next = update2 : (update2.next = pending3.next, pending3.next = update2), updateQueue.pending = update2, update2 = getRootForUpdatedFiber(fiber), markUpdateLaneFromFiberToRoot(fiber, null, lane), update2;
90565
+ var pending4 = updateQueue.pending;
90566
+ return pending4 === null ? update2.next = update2 : (update2.next = pending4.next, pending4.next = update2), updateQueue.pending = update2, update2 = getRootForUpdatedFiber(fiber), markUpdateLaneFromFiberToRoot(fiber, null, lane), update2;
90492
90567
  }
90493
90568
  return enqueueUpdate$1(fiber, updateQueue, update2, lane), getRootForUpdatedFiber(fiber);
90494
90569
  }
@@ -91368,8 +91443,8 @@ Error generating stack: ` + x3.message + `
91368
91443
  }
91369
91444
  function enqueueRenderPhaseUpdate(queue3, update2) {
91370
91445
  didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0;
91371
- var pending3 = queue3.pending;
91372
- pending3 === null ? update2.next = update2 : (update2.next = pending3.next, pending3.next = update2), queue3.pending = update2;
91446
+ var pending4 = queue3.pending;
91447
+ pending4 === null ? update2.next = update2 : (update2.next = pending4.next, pending4.next = update2), queue3.pending = update2;
91373
91448
  }
91374
91449
  function entangleTransitionUpdate(root2, queue3, lane) {
91375
91450
  if ((lane & 4194048) !== 0) {
@@ -98823,8 +98898,8 @@ It can also happen if the client has a browser extension installed which messes
98823
98898
  concurrentQueues[i++] = null;
98824
98899
  var lane = concurrentQueues[i];
98825
98900
  if (concurrentQueues[i++] = null, queue3 !== null && update2 !== null) {
98826
- var pending3 = queue3.pending;
98827
- pending3 === null ? update2.next = update2 : (update2.next = pending3.next, pending3.next = update2), queue3.pending = update2;
98901
+ var pending4 = queue3.pending;
98902
+ pending4 === null ? update2.next = update2 : (update2.next = pending4.next, pending4.next = update2), queue3.pending = update2;
98828
98903
  }
98829
98904
  lane !== 0 && markUpdateLaneFromFiberToRoot(fiber, update2, lane);
98830
98905
  }
@@ -100162,8 +100237,8 @@ Incoming: %s`,
100162
100237
  }
100163
100238
  function enqueueRenderPhaseUpdate(queue3, update2) {
100164
100239
  didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0;
100165
- var pending3 = queue3.pending;
100166
- pending3 === null ? update2.next = update2 : (update2.next = pending3.next, pending3.next = update2), queue3.pending = update2;
100240
+ var pending4 = queue3.pending;
100241
+ pending4 === null ? update2.next = update2 : (update2.next = pending4.next, pending4.next = update2), queue3.pending = update2;
100167
100242
  }
100168
100243
  function entangleTransitionUpdate(root2, queue3, lane) {
100169
100244
  if ((lane & 4194048) !== 0) {
@@ -114598,8 +114673,8 @@ function consumeFollowScroll() {
114598
114673
  let f = followScroll;
114599
114674
  return followScroll = null, f;
114600
114675
  }
114601
- function drainAdaptive(node, pending3, innerHeight) {
114602
- let sign = pending3 > 0 ? 1 : -1, abs = Math.abs(pending3), applied = 0;
114676
+ function drainAdaptive(node, pending4, innerHeight) {
114677
+ let sign = pending4 > 0 ? 1 : -1, abs = Math.abs(pending4), applied = 0;
114603
114678
  abs > SCROLL_MAX_PENDING && (applied += sign * (abs - SCROLL_MAX_PENDING), abs = SCROLL_MAX_PENDING);
114604
114679
  let step = abs <= SCROLL_INSTANT_THRESHOLD ? abs : abs < SCROLL_HIGH_PENDING ? SCROLL_STEP_MED : SCROLL_STEP_HIGH;
114605
114680
  applied += sign * step;
@@ -114610,12 +114685,12 @@ function drainAdaptive(node, pending3, innerHeight) {
114610
114685
  }
114611
114686
  return node.pendingScrollDelta = rem > 0 ? sign * rem : void 0, applied;
114612
114687
  }
114613
- function drainProportional(node, pending3, innerHeight) {
114614
- let abs = Math.abs(pending3), cap2 = Math.max(1, innerHeight - 1), step = Math.min(cap2, Math.max(SCROLL_MIN_PER_FRAME, abs * 3 >> 2));
114688
+ function drainProportional(node, pending4, innerHeight) {
114689
+ let abs = Math.abs(pending4), cap2 = Math.max(1, innerHeight - 1), step = Math.min(cap2, Math.max(SCROLL_MIN_PER_FRAME, abs * 3 >> 2));
114615
114690
  if (abs <= step)
114616
- return node.pendingScrollDelta = void 0, pending3;
114617
- let applied = pending3 > 0 ? step : -step;
114618
- return node.pendingScrollDelta = pending3 - applied, applied;
114691
+ return node.pendingScrollDelta = void 0, pending4;
114692
+ let applied = pending4 > 0 ? step : -step;
114693
+ return node.pendingScrollDelta = pending4 - applied, applied;
114619
114694
  }
114620
114695
  function wrapWithOsc8Link(text2, url3) {
114621
114696
  return `${OSC2}8;;${url3}${BEL2}${text2}${OSC2}8;;${BEL2}`;
@@ -114846,11 +114921,11 @@ function renderNodeToOutput(node, output, {
114846
114921
  viewportBottom: vpTop + innerHeight - 1
114847
114922
  };
114848
114923
  }
114849
- let cur = node.scrollTop ?? 0, pending3 = node.pendingScrollDelta, cMin = node.scrollClampMin, cMax = node.scrollClampMax, haveClamp = cMin !== void 0 && cMax !== void 0;
114850
- if (pending3 !== void 0 && pending3 !== 0) {
114851
- let eff = haveClamp && (pending3 < 0 && cur < cMin || pending3 > 0 && cur > cMax) ? Math.min(4, innerHeight >> 3) : innerHeight;
114852
- cur += isXtermJsHost() ? drainAdaptive(node, pending3, eff) : drainProportional(node, pending3, eff);
114853
- } else pending3 === 0 && (node.pendingScrollDelta = void 0);
114924
+ let cur = node.scrollTop ?? 0, pending4 = node.pendingScrollDelta, cMin = node.scrollClampMin, cMax = node.scrollClampMax, haveClamp = cMin !== void 0 && cMax !== void 0;
114925
+ if (pending4 !== void 0 && pending4 !== 0) {
114926
+ let eff = haveClamp && (pending4 < 0 && cur < cMin || pending4 > 0 && cur > cMax) ? Math.min(4, innerHeight >> 3) : innerHeight;
114927
+ cur += isXtermJsHost() ? drainAdaptive(node, pending4, eff) : drainProportional(node, pending4, eff);
114928
+ } else pending4 === 0 && (node.pendingScrollDelta = void 0);
114854
114929
  let scrollTop = Math.max(0, Math.min(cur, maxScroll)), clamped = haveClamp ? Math.max(cMin, Math.min(scrollTop, cMax)) : scrollTop;
114855
114930
  if (node.scrollTop = scrollTop, scrollTop !== cur && (node.pendingScrollDelta = void 0), node.pendingScrollDelta !== void 0 && (scrollDrainNode = node), scrollTop = clamped, content && contentYoga) {
114856
114931
  let contentX = x3 + contentYoga.getComputedLeft(), contentY = y2 + contentYoga.getComputedTop() - scrollTop, contentCached = nodeCache.get(content), hint = null;
@@ -127850,8 +127925,8 @@ var require_pool_base = __commonJS({
127850
127925
  }
127851
127926
  get [kPending]() {
127852
127927
  let ret = this[kQueued];
127853
- for (let { [kPending]: pending3 } of this[kClients])
127854
- ret += pending3;
127928
+ for (let { [kPending]: pending4 } of this[kClients])
127929
+ ret += pending4;
127855
127930
  return ret;
127856
127931
  }
127857
127932
  get [kRunning]() {
@@ -131068,17 +131143,17 @@ var require_mock_agent = __commonJS({
131068
131143
  }
131069
131144
  pendingInterceptors() {
131070
131145
  let mockAgentClients = this[kClients];
131071
- return Array.from(mockAgentClients.entries()).flatMap(([origin2, dispatcher2]) => dispatcher2[kDispatches].map((dispatch) => ({ ...dispatch, origin: origin2 }))).filter(({ pending: pending3 }) => pending3);
131146
+ return Array.from(mockAgentClients.entries()).flatMap(([origin2, dispatcher2]) => dispatcher2[kDispatches].map((dispatch) => ({ ...dispatch, origin: origin2 }))).filter(({ pending: pending4 }) => pending4);
131072
131147
  }
131073
131148
  assertNoPendingInterceptors({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) {
131074
- let pending3 = this.pendingInterceptors();
131075
- if (pending3.length !== 0)
131149
+ let pending4 = this.pendingInterceptors();
131150
+ if (pending4.length !== 0)
131076
131151
  throw new UndiciError(
131077
- pending3.length === 1 ? `1 interceptor is pending:
131152
+ pending4.length === 1 ? `1 interceptor is pending:
131078
131153
 
131079
- ${pendingInterceptorsFormatter.format(pending3)}`.trim() : `${pending3.length} interceptors are pending:
131154
+ ${pendingInterceptorsFormatter.format(pending4)}`.trim() : `${pending4.length} interceptors are pending:
131080
131155
 
131081
- ${pendingInterceptorsFormatter.format(pending3)}`.trim()
131156
+ ${pendingInterceptorsFormatter.format(pending4)}`.trim()
131082
131157
  );
131083
131158
  }
131084
131159
  };
@@ -140533,10 +140608,21 @@ var import_react25, current, listeners4, init_retryStatusStore = __esm({
140533
140608
 
140534
140609
  // build-src/src/sema/transcriptSystemNotice.ts
140535
140610
  function registerTranscriptSystemNoticeSink(fn2) {
140536
- return sink = fn2, () => {
140611
+ if (sink = fn2, pending.length > 0) {
140612
+ let batch = pending.splice(0, pending.length);
140613
+ for (let text2 of batch)
140614
+ try {
140615
+ fn2(text2);
140616
+ } catch {
140617
+ }
140618
+ }
140619
+ return () => {
140537
140620
  sink === fn2 && (sink = null);
140538
140621
  };
140539
140622
  }
140623
+ function queueTranscriptSystemNotice(text2) {
140624
+ return surfaceTranscriptSystemNotice(text2) ? !0 : (pending.length >= PENDING_MAX && pending.shift(), pending.push(text2), !1);
140625
+ }
140540
140626
  function surfaceTranscriptSystemNotice(text2) {
140541
140627
  if (sink === null) return !1;
140542
140628
  try {
@@ -140561,9 +140647,9 @@ function surfaceTranscriptMessage(message) {
140561
140647
  return !1;
140562
140648
  }
140563
140649
  }
140564
- var sink, messageSink, init_transcriptSystemNotice = __esm({
140650
+ var sink, PENDING_MAX, pending, messageSink, init_transcriptSystemNotice = __esm({
140565
140651
  "build-src/src/sema/transcriptSystemNotice.ts"() {
140566
- sink = null;
140652
+ sink = null, PENDING_MAX = 16, pending = [];
140567
140653
  messageSink = null;
140568
140654
  }
140569
140655
  });
@@ -142718,8 +142804,8 @@ async function invalidateOAuthCacheIfDiskChanged() {
142718
142804
  }
142719
142805
  }
142720
142806
  function handleOAuth401Error(failedAccessToken) {
142721
- let pending3 = pending401Handlers.get(failedAccessToken);
142722
- if (pending3) return pending3;
142807
+ let pending4 = pending401Handlers.get(failedAccessToken);
142808
+ if (pending4) return pending4;
142723
142809
  let promise2 = handleOAuth401ErrorImpl(failedAccessToken).finally(() => {
142724
142810
  pending401Handlers.delete(failedAccessToken);
142725
142811
  });
@@ -179363,8 +179449,8 @@ var inputSchema, outputSchema, cachedDeferredToolNames, getToolDescriptionMemoiz
179363
179449
  let { query: query2, max_results = 5 } = input, deferredTools = tools.filter(isDeferredTool);
179364
179450
  maybeInvalidateCache(deferredTools);
179365
179451
  function getPendingServerNames() {
179366
- let pending3 = getAppState().mcp.clients.filter((c2) => c2.type === "pending");
179367
- return pending3.length > 0 ? pending3.map((s) => s.name) : void 0;
179452
+ let pending4 = getAppState().mcp.clients.filter((c2) => c2.type === "pending");
179453
+ return pending4.length > 0 ? pending4.map((s) => s.name) : void 0;
179368
179454
  }
179369
179455
  function logSearchOutcome(matches3, queryType) {
179370
179456
  matches3.length, deferredTools.length, matches3.length > 0;
@@ -261138,10 +261224,10 @@ function useExitOnCtrlCD(useKeybindingsHook, onInterrupt, onExit2, isActive2 = !
261138
261224
  pending: !1,
261139
261225
  keyName: null
261140
261226
  }), exitFn = (0, import_react40.useMemo)(() => onExit2 ?? exit3, [onExit2, exit3]), handleCtrlCDoublePress = useDoublePress(
261141
- (pending3) => setExitState({ pending: pending3, keyName: "Ctrl-C" }),
261227
+ (pending4) => setExitState({ pending: pending4, keyName: "Ctrl-C" }),
261142
261228
  exitFn
261143
261229
  ), handleCtrlDDoublePress = useDoublePress(
261144
- (pending3) => setExitState({ pending: pending3, keyName: "Ctrl-D" }),
261230
+ (pending4) => setExitState({ pending: pending4, keyName: "Ctrl-D" }),
261145
261231
  exitFn
261146
261232
  ), handleInterrupt = (0, import_react40.useCallback)(() => {
261147
261233
  onInterrupt?.() || handleCtrlCDoublePress();
@@ -283828,7 +283914,7 @@ function FileEditToolUseRejectedMessage(t0) {
283828
283914
  }
283829
283915
  var import_compiler_runtime43, import_jsx_runtime53, MAX_LINES_TO_RENDER, init_FileEditToolUseRejectedMessage = __esm({
283830
283916
  "build-src/src/components/FileEditToolUseRejectedMessage.tsx"() {
283831
- import_compiler_runtime43 = __toESM(require_compiler_runtime(), 1);
283917
+ import_compiler_runtime43 = __toESM(require_compiler_runtime());
283832
283918
  init_useTerminalSize();
283833
283919
  init_cwd();
283834
283920
  init_ink2();
@@ -283836,7 +283922,7 @@ var import_compiler_runtime43, import_jsx_runtime53, MAX_LINES_TO_RENDER, init_F
283836
283922
  init_MessageResponse();
283837
283923
  init_StructuredDiffList();
283838
283924
  init_stringUtils();
283839
- import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1), MAX_LINES_TO_RENDER = 10;
283925
+ import_jsx_runtime53 = __toESM(require_jsx_runtime()), MAX_LINES_TO_RENDER = 10;
283840
283926
  }
283841
283927
  });
283842
283928
 
@@ -289889,8 +289975,8 @@ function bindSessionPersistencePaths() {
289889
289975
  setLiveSessionMapPath(mapPath, getSessionId());
289890
289976
  let engineSid = restoreLiveSessionId();
289891
289977
  try {
289892
- let marker = mapPath.replace(/\.session-map\.json$/, IMPORT_SEED_MARKER_SUFFIX), pending3 = !engineSid && marker !== mapPath && existsSync20(marker);
289893
- setSeamHistorySeedPending(pending3), pending3 && logForDebugging(`sessionPersistenceWire: import-seed marker found (${marker}) + no engine continuity \u2192 history seed armed`);
289978
+ let marker = mapPath.replace(/\.session-map\.json$/, IMPORT_SEED_MARKER_SUFFIX), pending4 = !engineSid && marker !== mapPath && existsSync20(marker);
289979
+ setSeamHistorySeedPending(pending4), pending4 && logForDebugging(`sessionPersistenceWire: import-seed marker found (${marker}) + no engine continuity \u2192 history seed armed`);
289894
289980
  } catch (err8) {
289895
289981
  setSeamHistorySeedPending(!1), logForDebugging(`sessionPersistenceWire: import-seed arm check failed: ${err8}`);
289896
289982
  }
@@ -289972,9 +290058,9 @@ async function reconcileResumeJournal(probe3, cancelRun, runningArm) {
289972
290058
  sessionId: runningArm?.shellSessionId?.() ?? getSessionId()
289973
290059
  };
289974
290060
  if (resumeRunningArmAwaitsUser(deps2)) {
289975
- let pending3 = runResumeRunningArm(req, deps2);
289976
- return pending3.catch(() => {
289977
- }), { decision, recovery: "left_running_choice", runningArm: pending3 };
290061
+ let pending4 = runResumeRunningArm(req, deps2);
290062
+ return pending4.catch(() => {
290063
+ }), { decision, recovery: "left_running_choice", runningArm: pending4 };
289978
290064
  }
289979
290065
  let armed3 = await runResumeRunningArm(req, deps2);
289980
290066
  return { decision, recovery: "left_running_no_ui", runningArm: Promise.resolve(armed3) };
@@ -290322,8 +290408,8 @@ async function driveLateDurableDecide(o) {
290322
290408
  if (client3 === null) return "unavailable";
290323
290409
  let rows2;
290324
290410
  try {
290325
- let pending3 = (await client3.approvals.list()).pending;
290326
- rows2 = Array.isArray(pending3) ? pending3 : [];
290411
+ let pending4 = (await client3.approvals.list()).pending;
290412
+ rows2 = Array.isArray(pending4) ? pending4 : [];
290327
290413
  } catch (e) {
290328
290414
  return process.env.SEMA_DEBUG && semaDebugLine(`[sema][askParkExpiry] late decide: approvals.list failed (${String(e)}) \u2014 falling back to the live respond leg`), "unavailable";
290329
290415
  }
@@ -290364,7 +290450,7 @@ function classifyLateDecideOutcome(reply) {
290364
290450
  let e = reply.error;
290365
290451
  if (typeof e != "object" || e === null) return { kind: "unknown" };
290366
290452
  let status3 = e.status, code2 = e.errorCode;
290367
- return typeof code2 == "string" && REAPED_CODES.includes(code2) ? { kind: "expired-reaped" } : typeof code2 == "string" && SETTLED_ELSEWHERE_CODES.includes(code2) ? { kind: "settled-elsewhere" } : status3 === 404 || status3 === 410 ? { kind: "settled-elsewhere" } : { kind: "unknown" };
290453
+ return typeof code2 == "string" && REAPED_CODES.includes(code2) ? { kind: "expired-reaped" } : typeof code2 == "string" && SETTLED_ELSEWHERE_CODES.includes(code2) ? { kind: "settled-elsewhere" } : status3 === 404 || status3 === 410 || typeof code2 == "string" && code2.startsWith("not_found.") ? { kind: "settled-elsewhere", probeWorthy: !0 } : { kind: "unknown" };
290368
290454
  }
290369
290455
  function readTaskId(body) {
290370
290456
  if (typeof body != "object" || body === null) return;
@@ -290419,7 +290505,14 @@ function surfaceLateRespondOutcome(approvalId, ack) {
290419
290505
  function withParkDecideOutcome(client3, opts) {
290420
290506
  let approvalsHost = client3.approvals;
290421
290507
  if (typeof approvalsHost != "object" || approvalsHost === null || typeof approvalsHost.decide != "function") return client3;
290422
- let spoken = !1, sawInconclusive = !1, say = (outcome, verb) => {
290508
+ let spoken = !1, sawInconclusive = !1, withReapedProbe = async (outcome) => {
290509
+ if (outcome.kind !== "settled-elsewhere" || outcome.probeWorthy !== !0 || opts?.reapedProbe === void 0) return outcome;
290510
+ try {
290511
+ if (await opts.reapedProbe() === !0) return { kind: "expired-reaped" };
290512
+ } catch {
290513
+ }
290514
+ return outcome;
290515
+ }, say = (outcome, verb) => {
290423
290516
  if (outcome.kind === "unknown") {
290424
290517
  sawInconclusive = !0;
290425
290518
  return;
@@ -290449,8 +290542,8 @@ function withParkDecideOutcome(client3, opts) {
290449
290542
  }
290450
290543
  return typeof out6?.then != "function" ? (say(classifyLateDecideOutcome({ ok: !0, body: out6 }), verb), out6) : out6.then(
290451
290544
  (body) => (say(classifyLateDecideOutcome({ ok: !0, body }), verb), body),
290452
- (e) => {
290453
- throw say(classifyLateDecideOutcome({ ok: !1, error: e }), verb), e;
290545
+ async (e) => {
290546
+ throw say(await withReapedProbe(classifyLateDecideOutcome({ ok: !1, error: e })), verb), e;
290454
290547
  }
290455
290548
  );
290456
290549
  };
@@ -290505,6 +290598,22 @@ var liveApprovalCards, init_liveApprovalCardHandles = __esm({
290505
290598
  }
290506
290599
  });
290507
290600
 
290601
+ // build-src/src/sema/runReapedProbe.ts
290602
+ async function runReapedByDeadline(client3, taskId) {
290603
+ let runs = client3?.runs;
290604
+ if (typeof runs?.get != "function") return !1;
290605
+ try {
290606
+ return (await runs.get(taskId))?.errorCode === REAPED_CODE;
290607
+ } catch {
290608
+ return !1;
290609
+ }
290610
+ }
290611
+ var REAPED_CODE, init_runReapedProbe = __esm({
290612
+ "build-src/src/sema/runReapedProbe.ts"() {
290613
+ REAPED_CODE = "approval.expired";
290614
+ }
290615
+ });
290616
+
290508
290617
  // build-src/src/sema/decideRetry.ts
290509
290618
  function retryDelayMs() {
290510
290619
  return delayOverrideMs ?? DECIDE_RETRY_DELAY_MS;
@@ -290664,13 +290773,13 @@ function rowArmSingleFlight() {
290664
290773
  let epoch = getLiveSessionEpoch();
290665
290774
  return (rowArmFlight === null || epoch !== rowArmFlightEpoch) && (rowArmFlightEpoch = epoch, rowArmFlight = createRowArmSingleFlight()), rowArmFlight;
290666
290775
  }
290667
- function armPendingRowCoalesced(flight, taskId, pending3, client3, opts) {
290668
- let identity3 = askParkRowIdentity(taskId, pending3);
290776
+ function armPendingRowCoalesced(flight, taskId, pending4, client3, opts) {
290777
+ let identity3 = askParkRowIdentity(taskId, pending4);
290669
290778
  return flight.size() > 0 && process.env.SEMA_DEBUG && semaDebugLine(
290670
290779
  `[sema][askParkReopen] row-arm single flight holds ${String(flight.size())} in-flight chain(s); a card for row ${identity3.armedKey} that is already being presented will be joined instead of minting a second one (requested by task ${taskId})`
290671
- ), flight.join(identity3.armedKey, () => armPendingRow(taskId, pending3, client3, identity3, opts));
290780
+ ), flight.join(identity3.armedKey, () => armPendingRow(taskId, pending4, client3, identity3, opts));
290672
290781
  }
290673
- async function armPendingRow(taskId, pending3, client3, identity3, opts) {
290782
+ async function armPendingRow(taskId, pending4, client3, identity3, opts) {
290674
290783
  try {
290675
290784
  let { rowTaskId, gatedCallId, armedKey } = identity3, circuitKey = gatedCallId ?? "";
290676
290785
  if (decideCircuitOpen(circuitKey))
@@ -290733,11 +290842,11 @@ async function armPendingRow(taskId, pending3, client3, identity3, opts) {
290733
290842
  }).then(() => {
290734
290843
  startReopen();
290735
290844
  });
290736
- }, askQuestions = askQuestionsFromPending(pending3), questionGate = askParkRowArm(pending3) === "question";
290845
+ }, askQuestions = askQuestionsFromPending(pending4), questionGate = askParkRowArm(pending4) === "question";
290737
290846
  if (process.env.SEMA_DEBUG) {
290738
- let rowGateKind = typeof pending3.gateKind == "string" && pending3.gateKind.length > 0 ? pending3.gateKind : null;
290847
+ let rowGateKind = typeof pending4.gateKind == "string" && pending4.gateKind.length > 0 ? pending4.gateKind : null;
290739
290848
  semaDebugLine(
290740
- `[sema][askParkReopen] routing row (task ${rowTaskId} \xB7 gateKind ${rowGateKind ?? "null"} \xB7 toolName ${String(pending3.toolName ?? "null")} \xB7 callId ${String(gatedCallId ?? "null")}) \u21D2 ${questionGate ? "question" : "tool-gate"} arm`
290849
+ `[sema][askParkReopen] routing row (task ${rowTaskId} \xB7 gateKind ${rowGateKind ?? "null"} \xB7 toolName ${String(pending4.toolName ?? "null")} \xB7 callId ${String(gatedCallId ?? "null")}) \u21D2 ${questionGate ? "question" : "tool-gate"} arm`
290741
290850
  );
290742
290851
  }
290743
290852
  if (questionGate) {
@@ -290778,17 +290887,19 @@ async function armPendingRow(taskId, pending3, client3, identity3, opts) {
290778
290887
  retractApprovalCard(armedKey, cause);
290779
290888
  },
290780
290889
  // L-83:question 卡一定是人答的;「late」只对窗真关过的卡说。
290781
- late: () => approvalCardWindowClosed(armedKey)
290890
+ late: () => approvalCardWindowClosed(armedKey),
290891
+ // L-81:decide 404 族 ⇒ 读 run 终态定「真被收割」。
290892
+ reapedProbe: () => runReapedByDeadline(client3, rowTaskId)
290782
290893
  }
290783
290894
  ), deliver = async () => {
290784
290895
  roundOutcome2 = "failed-round";
290785
290896
  try {
290786
290897
  let bridge3 = new HitlBridge(forensicClient, rowTaskId), entries = answer.answers ?? [];
290787
- return entries.some((a) => (a.selected?.length ?? 0) > 0 || (a.note?.length ?? 0) > 0) ? await bridge3.answerQuestion(entries, gatedCallId, void 0, pending3) : await bridge3.decideTool(
290898
+ return entries.some((a) => (a.selected?.length ?? 0) > 0 || (a.note?.length ?? 0) > 0) ? await bridge3.answerQuestion(entries, gatedCallId, void 0, pending4) : await bridge3.decideTool(
290788
290899
  { decision: "deny", reason: "question dismissed without an answer" },
290789
290900
  gatedCallId,
290790
290901
  void 0,
290791
- pending3
290902
+ pending4
290792
290903
  ), { ok: !0 };
290793
290904
  } catch (e) {
290794
290905
  if (!await rowStillPending())
@@ -290829,7 +290940,7 @@ async function armPendingRow(taskId, pending3, client3, identity3, opts) {
290829
290940
  return process.env.SEMA_DEBUG && semaDebugLine(
290830
290941
  `[sema][askParkReopen] tool-gate arm for task ${rowTaskId} has no approval card port installed (headless / print lane, or the host never called installApprovalCardPort) \u2014 reporting reopened:false`
290831
290942
  ), { kind: "verdict", verdict: { reopened: !1 } };
290832
- let rowDeadline = parkRowDeadlineState(pending3, Date.now());
290943
+ let rowDeadline = parkRowDeadlineState(pending4, Date.now());
290833
290944
  registerParkRowCard(armedKey, rowDeadline.kind === "none" ? void 0 : rowDeadline.deadlineMs);
290834
290945
  let cardPresented = !1, unsubscribeArm = onGateArmed((key) => {
290835
290946
  key === armedKey && (cardPresented = !0);
@@ -290852,7 +290963,9 @@ async function armPendingRow(taskId, pending3, client3, identity3, opts) {
290852
290963
  retractApprovalCard(armedKey, cause);
290853
290964
  },
290854
290965
  presented: () => cardPresented,
290855
- late: () => approvalCardWindowClosed(armedKey)
290966
+ late: () => approvalCardWindowClosed(armedKey),
290967
+ // L-81:decide 404 族 ⇒ 读 run 终态定「真被收割」。
290968
+ reapedProbe: () => runReapedByDeadline(client3, rowTaskId)
290856
290969
  }
290857
290970
  ), runToolChain = async () => {
290858
290971
  roundOutcome = "failed-round";
@@ -290923,6 +291036,7 @@ var reopenSeq, ownershipDeps, inFlightReopenByTask, rowWaitOverrideMs, rowPollOv
290923
291036
  init_decideForensics();
290924
291037
  init_askParkExpiry();
290925
291038
  init_liveApprovalCardHandles();
291039
+ init_runReapedProbe();
290926
291040
  init_decideRetry();
290927
291041
  init_failOpen();
290928
291042
  reopenSeq = 0, ownershipDeps = {
@@ -291912,8 +292026,8 @@ async function stopEngineSideAgentRow(taskId) {
291912
292026
  }
291913
292027
  }
291914
292028
  function killAllRunningAgentTasks(tasks3, setAppState, hooks2) {
291915
- let pending3 = 0, loopDone = !1, batchFired = !1, maybeSettleBatch = () => {
291916
- batchFired || !loopDone || pending3 > 0 || (batchFired = !0, hooks2?.onBatchSettled?.());
292029
+ let pending4 = 0, loopDone = !1, batchFired = !1, maybeSettleBatch = () => {
292030
+ batchFired || !loopDone || pending4 > 0 || (batchFired = !0, hooks2?.onBatchSettled?.());
291917
292031
  }, flip2 = (taskId) => {
291918
292032
  hooks2?.beforeKill?.(taskId), killAsyncAgent(taskId, setAppState), hooks2?.onRowSettled?.(taskId, { stopped: !0 });
291919
292033
  };
@@ -291923,9 +292037,9 @@ function killAllRunningAgentTasks(tasks3, setAppState, hooks2) {
291923
292037
  flip2(taskId);
291924
292038
  continue;
291925
292039
  }
291926
- pending3++, (async () => {
292040
+ pending4++, (async () => {
291927
292041
  let outcome = await stopEngineSideAgentRow(taskId);
291928
- outcome.stopped ? flip2(taskId) : hooks2?.onRowSettled?.(taskId, outcome), pending3--, maybeSettleBatch();
292042
+ outcome.stopped ? flip2(taskId) : hooks2?.onRowSettled?.(taskId, outcome), pending4--, maybeSettleBatch();
291929
292043
  })();
291930
292044
  }
291931
292045
  loopDone = !0, maybeSettleBatch();
@@ -293085,17 +293199,17 @@ function startLLMRequestPerfettoSpan(args) {
293085
293199
  }
293086
293200
  function endLLMRequestPerfettoSpan(spanId, metadata2) {
293087
293201
  if (!isEnabled || !spanId) return;
293088
- let pending3 = pendingSpans.get(spanId);
293089
- if (!pending3) return;
293090
- let endTime = getTimestamp2(), duration3 = endTime - pending3.startTime, promptTokens = metadata2.promptTokens ?? pending3.args.prompt_tokens, ttftMs = metadata2.ttftMs, ttltMs = metadata2.ttltMs, outputTokens = metadata2.outputTokens, cacheReadTokens = metadata2.cacheReadTokens, itps = ttftMs !== void 0 && promptTokens !== void 0 && ttftMs > 0 ? Math.round(promptTokens / (ttftMs / 1e3) * 100) / 100 : void 0, samplingMs = ttltMs !== void 0 && ttftMs !== void 0 ? ttltMs - ttftMs : void 0, otps = samplingMs !== void 0 && outputTokens !== void 0 && samplingMs > 0 ? Math.round(outputTokens / (samplingMs / 1e3) * 100) / 100 : void 0, cacheHitRate = cacheReadTokens !== void 0 && promptTokens !== void 0 && promptTokens > 0 ? Math.round(cacheReadTokens / promptTokens * 1e4) / 100 : void 0, requestSetupMs = metadata2.requestSetupMs, attemptStartTimes = metadata2.attemptStartTimes, args = {
293091
- ...pending3.args,
293202
+ let pending4 = pendingSpans.get(spanId);
293203
+ if (!pending4) return;
293204
+ let endTime = getTimestamp2(), duration3 = endTime - pending4.startTime, promptTokens = metadata2.promptTokens ?? pending4.args.prompt_tokens, ttftMs = metadata2.ttftMs, ttltMs = metadata2.ttltMs, outputTokens = metadata2.outputTokens, cacheReadTokens = metadata2.cacheReadTokens, itps = ttftMs !== void 0 && promptTokens !== void 0 && ttftMs > 0 ? Math.round(promptTokens / (ttftMs / 1e3) * 100) / 100 : void 0, samplingMs = ttltMs !== void 0 && ttftMs !== void 0 ? ttltMs - ttftMs : void 0, otps = samplingMs !== void 0 && outputTokens !== void 0 && samplingMs > 0 ? Math.round(outputTokens / (samplingMs / 1e3) * 100) / 100 : void 0, cacheHitRate = cacheReadTokens !== void 0 && promptTokens !== void 0 && promptTokens > 0 ? Math.round(cacheReadTokens / promptTokens * 1e4) / 100 : void 0, requestSetupMs = metadata2.requestSetupMs, attemptStartTimes = metadata2.attemptStartTimes, args = {
293205
+ ...pending4.args,
293092
293206
  ttft_ms: ttftMs,
293093
293207
  ttlt_ms: ttltMs,
293094
293208
  prompt_tokens: promptTokens,
293095
293209
  output_tokens: outputTokens,
293096
293210
  cache_read_tokens: cacheReadTokens,
293097
293211
  cache_creation_tokens: metadata2.cacheCreationTokens,
293098
- message_id: metadata2.messageId ?? pending3.args.message_id,
293212
+ message_id: metadata2.messageId ?? pending4.args.message_id,
293099
293213
  success: metadata2.success ?? !0,
293100
293214
  error: metadata2.error,
293101
293215
  duration_ms: duration3 / 1e3,
@@ -293106,14 +293220,14 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293106
293220
  cache_hit_rate_pct: cacheHitRate
293107
293221
  }, setupUs = requestSetupMs !== void 0 && requestSetupMs > 0 ? requestSetupMs * 1e3 : 0;
293108
293222
  if (setupUs > 0) {
293109
- let setupEndTs = pending3.startTime + setupUs;
293223
+ let setupEndTs = pending4.startTime + setupUs;
293110
293224
  if (events2.push({
293111
293225
  name: "Request Setup",
293112
293226
  cat: "api,setup",
293113
293227
  ph: "B",
293114
- ts: pending3.startTime,
293115
- pid: pending3.agentInfo.processId,
293116
- tid: pending3.agentInfo.threadId,
293228
+ ts: pending4.startTime,
293229
+ pid: pending4.agentInfo.processId,
293230
+ tid: pending4.agentInfo.threadId,
293117
293231
  args: {
293118
293232
  request_setup_ms: requestSetupMs,
293119
293233
  attempt_count: attemptStartTimes?.length ?? 1
@@ -293121,22 +293235,22 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293121
293235
  }), attemptStartTimes && attemptStartTimes.length > 1) {
293122
293236
  let baseWallMs = attemptStartTimes[0];
293123
293237
  for (let i = 0; i < attemptStartTimes.length - 1; i++) {
293124
- let attemptStartUs = pending3.startTime + (attemptStartTimes[i] - baseWallMs) * 1e3, attemptEndUs = pending3.startTime + (attemptStartTimes[i + 1] - baseWallMs) * 1e3;
293238
+ let attemptStartUs = pending4.startTime + (attemptStartTimes[i] - baseWallMs) * 1e3, attemptEndUs = pending4.startTime + (attemptStartTimes[i + 1] - baseWallMs) * 1e3;
293125
293239
  events2.push({
293126
293240
  name: `Attempt ${i + 1} (retry)`,
293127
293241
  cat: "api,retry",
293128
293242
  ph: "B",
293129
293243
  ts: attemptStartUs,
293130
- pid: pending3.agentInfo.processId,
293131
- tid: pending3.agentInfo.threadId,
293244
+ pid: pending4.agentInfo.processId,
293245
+ tid: pending4.agentInfo.threadId,
293132
293246
  args: { attempt: i + 1 }
293133
293247
  }), events2.push({
293134
293248
  name: `Attempt ${i + 1} (retry)`,
293135
293249
  cat: "api,retry",
293136
293250
  ph: "E",
293137
293251
  ts: attemptEndUs,
293138
- pid: pending3.agentInfo.processId,
293139
- tid: pending3.agentInfo.threadId
293252
+ pid: pending4.agentInfo.processId,
293253
+ tid: pending4.agentInfo.threadId
293140
293254
  });
293141
293255
  }
293142
293256
  }
@@ -293145,19 +293259,19 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293145
293259
  cat: "api,setup",
293146
293260
  ph: "E",
293147
293261
  ts: setupEndTs,
293148
- pid: pending3.agentInfo.processId,
293149
- tid: pending3.agentInfo.threadId
293262
+ pid: pending4.agentInfo.processId,
293263
+ tid: pending4.agentInfo.threadId
293150
293264
  });
293151
293265
  }
293152
293266
  if (ttftMs !== void 0) {
293153
- let firstTokenStartTs = pending3.startTime + setupUs, firstTokenEndTs = firstTokenStartTs + ttftMs * 1e3;
293267
+ let firstTokenStartTs = pending4.startTime + setupUs, firstTokenEndTs = firstTokenStartTs + ttftMs * 1e3;
293154
293268
  events2.push({
293155
293269
  name: "First Token",
293156
293270
  cat: "api,ttft",
293157
293271
  ph: "B",
293158
293272
  ts: firstTokenStartTs,
293159
- pid: pending3.agentInfo.processId,
293160
- tid: pending3.agentInfo.threadId,
293273
+ pid: pending4.agentInfo.processId,
293274
+ tid: pending4.agentInfo.threadId,
293161
293275
  args: {
293162
293276
  ttft_ms: ttftMs,
293163
293277
  prompt_tokens: promptTokens,
@@ -293169,8 +293283,8 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293169
293283
  cat: "api,ttft",
293170
293284
  ph: "E",
293171
293285
  ts: firstTokenEndTs,
293172
- pid: pending3.agentInfo.processId,
293173
- tid: pending3.agentInfo.threadId
293286
+ pid: pending4.agentInfo.processId,
293287
+ tid: pending4.agentInfo.threadId
293174
293288
  });
293175
293289
  let actualSamplingMs = ttltMs !== void 0 ? ttltMs - ttftMs - setupUs / 1e3 : void 0;
293176
293290
  actualSamplingMs !== void 0 && actualSamplingMs > 0 && (events2.push({
@@ -293178,8 +293292,8 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293178
293292
  cat: "api,sampling",
293179
293293
  ph: "B",
293180
293294
  ts: firstTokenEndTs,
293181
- pid: pending3.agentInfo.processId,
293182
- tid: pending3.agentInfo.threadId,
293295
+ pid: pending4.agentInfo.processId,
293296
+ tid: pending4.agentInfo.threadId,
293183
293297
  args: {
293184
293298
  sampling_ms: actualSamplingMs,
293185
293299
  output_tokens: outputTokens,
@@ -293190,17 +293304,17 @@ function endLLMRequestPerfettoSpan(spanId, metadata2) {
293190
293304
  cat: "api,sampling",
293191
293305
  ph: "E",
293192
293306
  ts: firstTokenEndTs + actualSamplingMs * 1e3,
293193
- pid: pending3.agentInfo.processId,
293194
- tid: pending3.agentInfo.threadId
293307
+ pid: pending4.agentInfo.processId,
293308
+ tid: pending4.agentInfo.threadId
293195
293309
  }));
293196
293310
  }
293197
293311
  events2.push({
293198
- name: pending3.name,
293199
- cat: pending3.category,
293312
+ name: pending4.name,
293313
+ cat: pending4.category,
293200
293314
  ph: "E",
293201
293315
  ts: endTime,
293202
- pid: pending3.agentInfo.processId,
293203
- tid: pending3.agentInfo.threadId,
293316
+ pid: pending4.agentInfo.processId,
293317
+ tid: pending4.agentInfo.threadId,
293204
293318
  args
293205
293319
  }), pendingSpans.delete(spanId);
293206
293320
  }
@@ -293227,18 +293341,18 @@ function startInteractionPerfettoSpan(userPrompt) {
293227
293341
  }
293228
293342
  function endInteractionPerfettoSpan(spanId) {
293229
293343
  if (!isEnabled || !spanId) return;
293230
- let pending3 = pendingSpans.get(spanId);
293231
- if (!pending3) return;
293232
- let endTime = getTimestamp2(), duration3 = endTime - pending3.startTime;
293344
+ let pending4 = pendingSpans.get(spanId);
293345
+ if (!pending4) return;
293346
+ let endTime = getTimestamp2(), duration3 = endTime - pending4.startTime;
293233
293347
  events2.push({
293234
- name: pending3.name,
293235
- cat: pending3.category,
293348
+ name: pending4.name,
293349
+ cat: pending4.category,
293236
293350
  ph: "E",
293237
293351
  ts: endTime,
293238
- pid: pending3.agentInfo.processId,
293239
- tid: pending3.agentInfo.threadId,
293352
+ pid: pending4.agentInfo.processId,
293353
+ tid: pending4.agentInfo.threadId,
293240
293354
  args: {
293241
- ...pending3.args,
293355
+ ...pending4.args,
293242
293356
  duration_ms: duration3 / 1e3
293243
293357
  }
293244
293358
  }), pendingSpans.delete(spanId);
@@ -298216,10 +298330,10 @@ function KeybindingSetup({
298216
298330
  activeContextsRef.current.delete(context_0);
298217
298331
  }, []), clearChordTimeout = (0, import_react59.useCallback)(() => {
298218
298332
  chordTimeoutRef.current && (clearTimeout(chordTimeoutRef.current), chordTimeoutRef.current = null);
298219
- }, []), setPendingChord = (0, import_react59.useCallback)((pending3) => {
298220
- clearChordTimeout(), pending3 !== null && (chordTimeoutRef.current = setTimeout((pendingChordRef_0, setPendingChordState_0) => {
298333
+ }, []), setPendingChord = (0, import_react59.useCallback)((pending4) => {
298334
+ clearChordTimeout(), pending4 !== null && (chordTimeoutRef.current = setTimeout((pendingChordRef_0, setPendingChordState_0) => {
298221
298335
  logForDebugging("[keybindings] Chord timeout - cancelling"), pendingChordRef_0.current = null, setPendingChordState_0(null);
298222
- }, CHORD_TIMEOUT_MS, pendingChordRef, setPendingChordState)), pendingChordRef.current = pending3, setPendingChordState(pending3);
298336
+ }, CHORD_TIMEOUT_MS, pendingChordRef, setPendingChordState)), pendingChordRef.current = pending4, setPendingChordState(pending4);
298223
298337
  }, [clearChordTimeout]);
298224
298338
  return (0, import_react59.useEffect)(() => {
298225
298339
  initializeKeybindingWatcher();
@@ -303706,10 +303820,10 @@ function TaskListV2({
303706
303820
  ts_0 && now2 - ts_0 < RECENT_COMPLETED_TTL_MS ? recentCompleted.push(task) : olderCompleted.push(task);
303707
303821
  }
303708
303822
  recentCompleted.sort(byIdAsc), olderCompleted.sort(byIdAsc);
303709
- let inProgress = tasks3.filter((t_8) => t_8.status === "in_progress").sort(byIdAsc), pending3 = tasks3.filter((t_9) => t_9.status === "pending").sort((a, b3) => {
303823
+ let inProgress = tasks3.filter((t_8) => t_8.status === "in_progress").sort(byIdAsc), pending4 = tasks3.filter((t_9) => t_9.status === "pending").sort((a, b3) => {
303710
303824
  let aBlocked = a.blockedBy.some((id_1) => unresolvedTaskIds.has(id_1)), bBlocked = b3.blockedBy.some((id_2) => unresolvedTaskIds.has(id_2));
303711
303825
  return aBlocked !== bBlocked ? aBlocked ? 1 : -1 : byIdAsc(a, b3);
303712
- }), prioritized = [...recentCompleted, ...inProgress, ...pending3, ...olderCompleted];
303826
+ }), prioritized = [...recentCompleted, ...inProgress, ...pending4, ...olderCompleted];
303713
303827
  visibleTasks2 = prioritized.slice(0, maxDisplay), hiddenTasks = prioritized.slice(maxDisplay);
303714
303828
  } else
303715
303829
  visibleTasks2 = [...tasks3].sort(byIdAsc), hiddenTasks = [];
@@ -359525,10 +359639,10 @@ async function registerSeedMarketplaces() {
359525
359639
  if (changed > 0) {
359526
359640
  let wrote = 0;
359527
359641
  return updateKnownMarketplacesConfig((live) => {
359528
- let pending3 = [...desiredByName].filter(
359642
+ let pending4 = [...desiredByName].filter(
359529
359643
  ([name, desired]) => !isEqual_default(live[name], desired)
359530
359644
  );
359531
- return pending3.length === 0 ? live : (wrote = pending3.length, { ...live, ...Object.fromEntries(pending3) });
359645
+ return pending4.length === 0 ? live : (wrote = pending4.length, { ...live, ...Object.fromEntries(pending4) });
359532
359646
  }), logForDebugging(
359533
359647
  `Synced ${wrote} marketplace(s) from seed dir(s) (${changed} candidate(s) computed outside the lock)`
359534
359648
  ), wrote > 0;
@@ -366780,33 +366894,33 @@ var init_engineSessionParam2 = __esm({
366780
366894
  // build-src/src/sema/interruptMarkerLatch.ts
366781
366895
  function setSeamPendingInterrupt(next) {
366782
366896
  if (!next) {
366783
- pending = !1, haltUnconsumed = !1, outstandingHaltTaskId = void 0;
366897
+ pending2 = !1, haltUnconsumed = !1, outstandingHaltTaskId = void 0;
366784
366898
  return;
366785
366899
  }
366786
366900
  if (haltUnconsumed) {
366787
- haltUnconsumed = !1, outstandingHaltTaskId = void 0, pending = !1;
366901
+ haltUnconsumed = !1, outstandingHaltTaskId = void 0, pending2 = !1;
366788
366902
  return;
366789
366903
  }
366790
- pending = !0;
366904
+ pending2 = !0;
366791
366905
  }
366792
366906
  function noteHaltRequested(taskId) {
366793
366907
  typeof taskId != "string" || taskId.length === 0 || (outstandingHaltTaskId = taskId);
366794
366908
  }
366795
366909
  function isSeamPendingInterrupt() {
366796
- return pending;
366910
+ return pending2;
366797
366911
  }
366798
366912
  function takeSeamPendingInterrupt() {
366799
- let armed3 = pending;
366800
- return pending = !1, haltUnconsumed = !1, outstandingHaltTaskId = void 0, armed3;
366913
+ let armed3 = pending2;
366914
+ return pending2 = !1, haltUnconsumed = !1, outstandingHaltTaskId = void 0, armed3;
366801
366915
  }
366802
366916
  function retractSeamPendingInterrupt(noticeTaskId) {
366803
366917
  if (!(typeof noticeTaskId == "string" && noticeTaskId.length > 0 && outstandingHaltTaskId !== void 0 && noticeTaskId === outstandingHaltTaskId)) return { attributed: !1, wasArmed: !1 };
366804
- let wasArmed = pending;
366805
- return pending = !1, haltUnconsumed = !0, { attributed: !0, wasArmed };
366918
+ let wasArmed = pending2;
366919
+ return pending2 = !1, haltUnconsumed = !0, { attributed: !0, wasArmed };
366806
366920
  }
366807
- var pending, haltUnconsumed, outstandingHaltTaskId, init_interruptMarkerLatch = __esm({
366921
+ var pending2, haltUnconsumed, outstandingHaltTaskId, init_interruptMarkerLatch = __esm({
366808
366922
  "build-src/src/sema/interruptMarkerLatch.ts"() {
366809
- pending = !1, haltUnconsumed = !1;
366923
+ pending2 = !1, haltUnconsumed = !1;
366810
366924
  }
366811
366925
  });
366812
366926
 
@@ -367162,8 +367276,8 @@ function publishEngineBgShellPanelEvent(ev) {
367162
367276
  }
367163
367277
  function subscribeEngineBgShellPanel(fn2) {
367164
367278
  if (listener3 = fn2, buffer3.length > 0) {
367165
- let pending3 = buffer3.splice(0, buffer3.length);
367166
- for (let ev of pending3)
367279
+ let pending4 = buffer3.splice(0, buffer3.length);
367280
+ for (let ev of pending4)
367167
367281
  try {
367168
367282
  fn2(ev);
367169
367283
  } catch {
@@ -369315,8 +369429,8 @@ function setSeamPendingRewind(spec) {
369315
369429
  } catch {
369316
369430
  }
369317
369431
  }
369318
- function setSeamHistorySeedPending(pending3) {
369319
- seamHistorySeedPending = pending3;
369432
+ function setSeamHistorySeedPending(pending4) {
369433
+ seamHistorySeedPending = pending4;
369320
369434
  }
369321
369435
  function isSeamHistorySeedPending() {
369322
369436
  return seamHistorySeedPending;
@@ -373715,8 +373829,8 @@ function usePasteHandler({
373715
373829
  isPasting,
373716
373830
  pastePending: pastePendingRef.current
373717
373831
  })) {
373718
- let pending3 = pendingReturnRef.current;
373719
- pendingReturnRef.current = null, onInput(pending3.input, pending3.key);
373832
+ let pending4 = pendingReturnRef.current;
373833
+ pendingReturnRef.current = null, onInput(pending4.input, pending4.key);
373720
373834
  }
373721
373835
  }), import_react94.default.useEffect(() => () => {
373722
373836
  isMountedRef.current = !1;
@@ -395015,8 +395129,8 @@ function ManagePlugins({
395015
395129
  }, handleSingleOperationRef = (0, import_react146.useRef)(handleSingleOperation);
395016
395130
  handleSingleOperationRef.current = handleSingleOperation, (0, import_react146.useEffect)(() => {
395017
395131
  if (viewState === "plugin-details" && selectedPlugin && pendingAutoActionRef.current) {
395018
- let pending3 = pendingAutoActionRef.current;
395019
- if (pendingAutoActionRef.current = void 0, pending3 === "configure") {
395132
+ let pending4 = pendingAutoActionRef.current;
395133
+ if (pendingAutoActionRef.current = void 0, pending4 === "configure") {
395020
395134
  let schema = selectedPlugin.plugin.manifest.userConfig;
395021
395135
  schema && Object.keys(schema).length > 0 ? setViewState({
395022
395136
  type: "configuring-options",
@@ -395024,7 +395138,7 @@ function ManagePlugins({
395024
395138
  }) : setResult(`Plugin "${selectedPlugin.plugin.manifest.displayName ?? selectedPlugin.plugin.name}" declares no userConfig options.`);
395025
395139
  return;
395026
395140
  }
395027
- handleSingleOperationRef.current(pending3);
395141
+ handleSingleOperationRef.current(pending4);
395028
395142
  }
395029
395143
  }, [viewState, selectedPlugin, setResult]);
395030
395144
  let handleToggle = React85.useCallback(() => {
@@ -400226,20 +400340,20 @@ var sema_brand_default, init_sema_brand = __esm({
400226
400340
  _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"
400227
400341
  },
400228
400342
  whatsNew: {
400229
- version: "1.0.97",
400343
+ version: "1.0.98",
400230
400344
  notes: [
400231
- "If the engine crashes while an approval is still waiting, the next start says so: one transcript line lists the approvals that were converged to denied, split into those that look safe to re-run (based on what was recorded) and those a human should check first. sema never re-runs anything on its own.",
400232
- "--tools and --disallowedTools now reach the engine on both lanes: in interactive sessions and in -p runs, a tool outside the allowed set is denied by policy before any approval dialog, matching the built-in-set semantics of the upstream CLI. (--allowedTools is still shell-local; see the known-issues ledger.)",
400233
- "Sandbox settings changed from the UI (/sandbox exclude, the sandbox toggles) are persisted to your user settings so lower-trust project files cannot relax them. Note: these settings govern the shell's local `!` commands; the engine-side Bash sandbox is not yet enforced by this release.",
400234
- "With SEMA_SEND_SETTINGS=full, only the settings keys the engine accepts are sent (env, model, outputStyle, permissions.{allow,ask,deny,defaultMode,disableAutoMode}, ultracode, webSearch); unsupported keys are dropped locally instead of failing the request, and SEMA_DEBUG names what was dropped.",
400235
- "When an engine declines workflow orchestration for a request (server 7.57.0+ multi-tenant deployments without an entitlement resolver), sema re-sends the request once without it and says so in one line; /workflows and /effort ultracode explain that workflows are unavailable on that deployment instead of failing silently.",
400236
- "Approval cards that reach the end of their live window are no longer left hanging: the card says the request moved to the durable queue and is still decidable, shows the deadline when the engine reports one, and a late decision gets a one-line outcome instead of silence.",
400237
- "A turn that keeps re-parking on the same approval no longer runs for 15 minutes and then fails with 'gate hop limit (24) exceeded': sema re-attaches a bounded number of times, shows a status row while it does, and when it stops it says the real reason (the approval was decided but the engine parked the same call again, or nothing decidable could be read). Legitimate approvals are never capped \u2014 25 or 70 distinct gates in one turn are all answered.",
400238
- "After resuming a session whose previous turn was parked on an approval, if your permission rules decide that approval on their own, sema says so and the run resumes; your message is no longer refused with 'could not reopen that card'."
400345
+ "Print mode (-p) now picks up the project's .mcp.json. It was being read before the configuration gate opened, so the servers were silently dropped; the same run now sends them to the engine like the interactive session does.",
400346
+ "/permissions \u203A Recent Denials rows now show the denied Bash command or the file path, so three denied Bash calls no longer look identical.",
400347
+ "MCP servers you disable in /mcp are no longer sent to the engine (in both the interactive session and -p).",
400348
+ `Bash approval cards for engine-run commands are titled "Bash command (unsandboxed)" while sandboxing is on, and /sandbox status says the sandbox covers the local ! shell only \u2014 the engine's Bash is not sandboxed.`,
400349
+ "Notices that fire before the screen mounts (shared-deployment MCP warning, crash-converged approvals, imported settings) now land in the transcript instead of vanishing with the boot output.",
400350
+ 'A parked approval answered after the engine reaped it now says "nothing was run" only when the run really expired; otherwise it says the decision may already have landed elsewhere.',
400351
+ "settings.outputStyle now reaches the engine in the default settings mode and in -p; turning fileCheckpointingEnabled off in /config really stops per-turn snapshot capture; and when the programmatic-allow budget is used up the transcript says so once.",
400352
+ "The notice for a session marked externally exposed no longer claims its memory was quarantined; it says later harvests are withheld for review, which is true in every mode."
400239
400353
  ]
400240
400354
  },
400241
- productVersion: "1.0.97",
400242
- announcement: "sema 1.0.97 \u2014 crash-converged approvals are disclosed on the next start, --tools/--disallowedTools are enforced on the interactive lane too, approval cards no longer go silent at window expiry, parked approvals no longer spin into 'gate hop limit (24) exceeded', and the settings wire is aligned with the engine's accepted key set",
400355
+ productVersion: "1.0.98",
400356
+ announcement: "sema 1.0.98 \u2014 print mode (-p) now loads the project's .mcp.json, /permissions Recent Denials show the denied command or file instead of just the tool name, boot-time notices reach the transcript, engine-run Bash cards no longer imply sandboxing, and disabled MCP servers stay disabled on the engine too.",
400243
400357
  version: "1.0.91"
400244
400358
  };
400245
400359
  }
@@ -404280,8 +404394,8 @@ function VirtualMessageList({
404280
404394
  phantomBurstRef.current = 0;
404281
404395
  let ord = wantLast ? positions.length - 1 : 0;
404282
404396
  searchState.current.screenOrd = ord, startPtrRef.current = -1, highlightRef.current(ord);
404283
- let pending3 = pendingStepRef.current;
404284
- pending3 && (pendingStepRef.current = 0, stepRef.current(pending3));
404397
+ let pending4 = pendingStepRef.current;
404398
+ pending4 && (pendingStepRef.current = 0, stepRef.current(pending4));
404285
404399
  }, [seekGen]);
404286
404400
  function jump(i, wantLast) {
404287
404401
  let s = scrollRef.current;
@@ -404495,12 +404609,12 @@ function StickyTracker({
404495
404609
  break;
404496
404610
  }
404497
404611
  }
404498
- let baseOffset = firstVisibleTop >= 0 ? firstVisibleTop - offsets[firstVisible] : 0, estimate = idx >= 0 ? Math.max(0, baseOffset + offsets[idx]) : -1, pending3 = (0, import_react166.useRef)({
404612
+ let baseOffset = firstVisibleTop >= 0 ? firstVisibleTop - offsets[firstVisible] : 0, estimate = idx >= 0 ? Math.max(0, baseOffset + offsets[idx]) : -1, pending4 = (0, import_react166.useRef)({
404499
404613
  idx: -1,
404500
404614
  tries: 0
404501
404615
  }), suppress = (0, import_react166.useRef)("none"), lastIdx = (0, import_react166.useRef)(-1);
404502
404616
  return (0, import_react166.useEffect)(() => {
404503
- if (pending3.current.idx >= 0) return;
404617
+ if (pending4.current.idx >= 0) return;
404504
404618
  if (suppress.current === "armed") {
404505
404619
  suppress.current = "force";
404506
404620
  return;
@@ -404522,19 +404636,19 @@ function StickyTracker({
404522
404636
  scrollTo: () => {
404523
404637
  setStickyPrompt("clicked"), suppress.current = "armed";
404524
404638
  let el = getItemElement(capturedIdx);
404525
- el ? scrollRef.current?.scrollToElement(el, 1) : (scrollRef.current?.scrollTo(capturedEstimate), pending3.current = {
404639
+ el ? scrollRef.current?.scrollToElement(el, 1) : (scrollRef.current?.scrollTo(capturedEstimate), pending4.current = {
404526
404640
  idx: capturedIdx,
404527
404641
  tries: 0
404528
404642
  });
404529
404643
  }
404530
404644
  });
404531
404645
  }), (0, import_react166.useEffect)(() => {
404532
- if (pending3.current.idx < 0) return;
404533
- let el = getItemElement(pending3.current.idx);
404534
- el ? (scrollRef.current?.scrollToElement(el, 1), pending3.current = {
404646
+ if (pending4.current.idx < 0) return;
404647
+ let el = getItemElement(pending4.current.idx);
404648
+ el ? (scrollRef.current?.scrollToElement(el, 1), pending4.current = {
404535
404649
  idx: -1,
404536
404650
  tries: 0
404537
- }) : ++pending3.current.tries > 5 && (pending3.current = {
404651
+ }) : ++pending4.current.tries > 5 && (pending4.current = {
404538
404652
  idx: -1,
404539
404653
  tries: 0
404540
404654
  });
@@ -404572,20 +404686,20 @@ var require_sema_brand = __commonJS({
404572
404686
  _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"
404573
404687
  },
404574
404688
  whatsNew: {
404575
- version: "1.0.97",
404689
+ version: "1.0.98",
404576
404690
  notes: [
404577
- "If the engine crashes while an approval is still waiting, the next start says so: one transcript line lists the approvals that were converged to denied, split into those that look safe to re-run (based on what was recorded) and those a human should check first. sema never re-runs anything on its own.",
404578
- "--tools and --disallowedTools now reach the engine on both lanes: in interactive sessions and in -p runs, a tool outside the allowed set is denied by policy before any approval dialog, matching the built-in-set semantics of the upstream CLI. (--allowedTools is still shell-local; see the known-issues ledger.)",
404579
- "Sandbox settings changed from the UI (/sandbox exclude, the sandbox toggles) are persisted to your user settings so lower-trust project files cannot relax them. Note: these settings govern the shell's local `!` commands; the engine-side Bash sandbox is not yet enforced by this release.",
404580
- "With SEMA_SEND_SETTINGS=full, only the settings keys the engine accepts are sent (env, model, outputStyle, permissions.{allow,ask,deny,defaultMode,disableAutoMode}, ultracode, webSearch); unsupported keys are dropped locally instead of failing the request, and SEMA_DEBUG names what was dropped.",
404581
- "When an engine declines workflow orchestration for a request (server 7.57.0+ multi-tenant deployments without an entitlement resolver), sema re-sends the request once without it and says so in one line; /workflows and /effort ultracode explain that workflows are unavailable on that deployment instead of failing silently.",
404582
- "Approval cards that reach the end of their live window are no longer left hanging: the card says the request moved to the durable queue and is still decidable, shows the deadline when the engine reports one, and a late decision gets a one-line outcome instead of silence.",
404583
- "A turn that keeps re-parking on the same approval no longer runs for 15 minutes and then fails with 'gate hop limit (24) exceeded': sema re-attaches a bounded number of times, shows a status row while it does, and when it stops it says the real reason (the approval was decided but the engine parked the same call again, or nothing decidable could be read). Legitimate approvals are never capped \u2014 25 or 70 distinct gates in one turn are all answered.",
404584
- "After resuming a session whose previous turn was parked on an approval, if your permission rules decide that approval on their own, sema says so and the run resumes; your message is no longer refused with 'could not reopen that card'."
404691
+ "Print mode (-p) now picks up the project's .mcp.json. It was being read before the configuration gate opened, so the servers were silently dropped; the same run now sends them to the engine like the interactive session does.",
404692
+ "/permissions \u203A Recent Denials rows now show the denied Bash command or the file path, so three denied Bash calls no longer look identical.",
404693
+ "MCP servers you disable in /mcp are no longer sent to the engine (in both the interactive session and -p).",
404694
+ `Bash approval cards for engine-run commands are titled "Bash command (unsandboxed)" while sandboxing is on, and /sandbox status says the sandbox covers the local ! shell only \u2014 the engine's Bash is not sandboxed.`,
404695
+ "Notices that fire before the screen mounts (shared-deployment MCP warning, crash-converged approvals, imported settings) now land in the transcript instead of vanishing with the boot output.",
404696
+ 'A parked approval answered after the engine reaped it now says "nothing was run" only when the run really expired; otherwise it says the decision may already have landed elsewhere.',
404697
+ "settings.outputStyle now reaches the engine in the default settings mode and in -p; turning fileCheckpointingEnabled off in /config really stops per-turn snapshot capture; and when the programmatic-allow budget is used up the transcript says so once.",
404698
+ "The notice for a session marked externally exposed no longer claims its memory was quarantined; it says later harvests are withheld for review, which is true in every mode."
404585
404699
  ]
404586
404700
  },
404587
- productVersion: "1.0.97",
404588
- announcement: "sema 1.0.97 \u2014 crash-converged approvals are disclosed on the next start, --tools/--disallowedTools are enforced on the interactive lane too, approval cards no longer go silent at window expiry, parked approvals no longer spin into 'gate hop limit (24) exceeded', and the settings wire is aligned with the engine's accepted key set",
404701
+ productVersion: "1.0.98",
404702
+ announcement: "sema 1.0.98 \u2014 print mode (-p) now loads the project's .mcp.json, /permissions Recent Denials show the denied command or file instead of just the tool name, boot-time notices reach the transcript, engine-run Bash cards no longer imply sandboxing, and disabled MCP servers stay disabled on the engine too.",
404589
404703
  version: "1.0.91"
404590
404704
  };
404591
404705
  }
@@ -407660,12 +407774,12 @@ function SkillsMenu({ onExit: onExit2, commands }) {
407660
407774
  }, []), { addNotification } = useNotifications(), flushRef = React99.useRef(() => {
407661
407775
  });
407662
407776
  flushRef.current = () => {
407663
- let pending3 = failedWritesRef.current.size;
407664
- if (pending3 === 0) return;
407777
+ let pending4 = failedWritesRef.current.size;
407778
+ if (pending4 === 0) return;
407665
407779
  let { error: error51 } = flushFailedWrites();
407666
407780
  error51 && addNotification({
407667
407781
  key: "skills-override-save-failed",
407668
- text: `Could not save ${pending3} skill ${plural(pending3, "override")}: ${error51.message}`,
407782
+ text: `Could not save ${pending4} skill ${plural(pending4, "override")}: ${error51.message}`,
407669
407783
  priority: "high",
407670
407784
  timeoutMs: 12e3
407671
407785
  });
@@ -427487,7 +427601,7 @@ async function deliverToRunningAgentLane(core, id, access7, notification, opts)
427487
427601
  return { ok: !1, reason: "not_found" };
427488
427602
  if (handle2.status !== "running")
427489
427603
  return { ok: !1, reason: "not_running" };
427490
- let bounded = (p, fallback, onTimeout) => new Promise((resolve57) => {
427604
+ let bounded2 = (p, fallback, onTimeout) => new Promise((resolve57) => {
427491
427605
  let t2 = setTimeout(() => {
427492
427606
  try {
427493
427607
  onTimeout?.();
@@ -427505,12 +427619,12 @@ async function deliverToRunningAgentLane(core, id, access7, notification, opts)
427505
427619
  if (handle2.channelState !== "attaching")
427506
427620
  return { ok: !1, reason: "no_channel" };
427507
427621
  let q2 = handle2.preAttachQueue ??= [];
427508
- return q2.length >= 8 ? { ok: !1, reason: "queue_full" } : bounded(new Promise((resolve57) => {
427622
+ return q2.length >= 8 ? { ok: !1, reason: "queue_full" } : bounded2(new Promise((resolve57) => {
427509
427623
  q2.push([notification, opts, resolve57]);
427510
427624
  }), { ok: !0, disposition: "pending" });
427511
427625
  }
427512
427626
  let detachOnTimeout;
427513
- return await bounded(new Promise((resolve57) => {
427627
+ return await bounded2(new Promise((resolve57) => {
427514
427628
  let inflight3 = handle2.inFlightDirect ??= /* @__PURE__ */ new Set(), settleOnce = (r) => {
427515
427629
  inflight3.has(settleOnce) && (inflight3.delete(settleOnce), resolve57(r));
427516
427630
  };
@@ -442268,7 +442382,7 @@ var command6, sandbox_default, init_sandbox = __esm({
442268
442382
  let currentlyEnabled = SandboxManager2.isSandboxingEnabled(), autoAllow = SandboxManager2.isAutoAllowBashIfSandboxedEnabled(), allowUnsandboxed = SandboxManager2.areUnsandboxedCommandsAllowed(), isLocked = SandboxManager2.areSandboxSettingsLockedByPolicy(), hasDeps = SandboxManager2.checkDependencies().errors.length === 0, icon;
442269
442383
  hasDeps ? icon = currentlyEnabled ? figures_default.tick : figures_default.circle : icon = figures_default.warning;
442270
442384
  let statusText = "sandbox disabled";
442271
- return currentlyEnabled && (statusText = autoAllow ? "sandbox enabled (auto-allow)" : "sandbox enabled", statusText += allowUnsandboxed ? ", fallback allowed" : ""), isLocked && (statusText += " (managed)"), `${icon} ${statusText} (\u23CE to configure)`;
442385
+ return currentlyEnabled && (statusText = autoAllow ? "sandbox enabled (auto-allow)" : "sandbox enabled", statusText += allowUnsandboxed ? ", fallback allowed" : ""), isLocked && (statusText += " (managed)"), currentlyEnabled && (statusText += " \xB7 local ! shell only (engine-run Bash is not sandboxed)"), `${icon} ${statusText} (\u23CE to configure)`;
442272
442386
  },
442273
442387
  argumentHint: 'exclude "command pattern"',
442274
442388
  get isHidden() {
@@ -443575,27 +443689,27 @@ var exportCommand, export_default, init_export2 = __esm({
443575
443689
  function recordModelConfigOverrideNotice(model, field, value) {
443576
443690
  let name = model.trim();
443577
443691
  if (!name) return;
443578
- let byField = pending2.get(name);
443579
- byField || (byField = /* @__PURE__ */ new Map(), pending2.set(name, byField)), byField.set(field, value);
443692
+ let byField = pending3.get(name);
443693
+ byField || (byField = /* @__PURE__ */ new Map(), pending3.set(name, byField)), byField.set(field, value);
443580
443694
  }
443581
443695
  function resetModelConfigOverrideNotices() {
443582
- pending2.clear();
443696
+ pending3.clear();
443583
443697
  }
443584
443698
  function consumeModelConfigOverrideNotice(fmt) {
443585
- if (pending2.size === 0) return null;
443699
+ if (pending3.size === 0) return null;
443586
443700
  let parts = [];
443587
- for (let [model, byField] of pending2) {
443701
+ for (let [model, byField] of pending3) {
443588
443702
  let fields = ["contextWindow", "maxTokens"].filter((f) => byField.has(f)).map((f) => `${FIELD_LABEL[f]} ${fmt(byField.get(f))}`);
443589
443703
  fields.length > 0 && parts.push(`${model}: ${fields.join(", ")}`);
443590
443704
  }
443591
- return pending2.clear(), parts.length === 0 ? null : ` \xB7 Saved ${parts.join(" \xB7 ")} \u2014 in effect now; the engine applies it on its next start`;
443705
+ return pending3.clear(), parts.length === 0 ? null : ` \xB7 Saved ${parts.join(" \xB7 ")} \u2014 in effect now; the engine applies it on its next start`;
443592
443706
  }
443593
- var FIELD_LABEL, pending2, init_modelCtxOverrideNotice = __esm({
443707
+ var FIELD_LABEL, pending3, init_modelCtxOverrideNotice = __esm({
443594
443708
  "build-src/src/sema/modelCtxOverrideNotice.ts"() {
443595
443709
  FIELD_LABEL = {
443596
443710
  contextWindow: "context",
443597
443711
  maxTokens: "max tokens"
443598
- }, pending2 = /* @__PURE__ */ new Map();
443712
+ }, pending3 = /* @__PURE__ */ new Map();
443599
443713
  }
443600
443714
  });
443601
443715
 
@@ -464831,8 +464945,10 @@ function detailOf(e) {
464831
464945
  function engineNoticeLine(rawCode, rawMessage, rawDetail) {
464832
464946
  let detail = rawDetail !== null && typeof rawDetail == "object" ? rawDetail : {};
464833
464947
  switch (typeof rawCode == "string" ? rawCode : "") {
464834
- case "memory.session_polluted":
464835
- return "Engine notice: this session is marked externally exposed \u2014 memory harvested from it is quarantined";
464948
+ case "memory.session_polluted": {
464949
+ let reason = typeof detail.reason == "string" ? cleanUntrustedForDisplay(detail.reason, 60) : "";
464950
+ return `Engine notice: this session is marked externally exposed${reason.length > 0 ? ` (${reason})` : ""} \u2014 its later memory harvests are withheld for review (what each one contained is announced separately)`;
464951
+ }
464836
464952
  case "memory.harvest_quarantined": {
464837
464953
  let count3 = finiteNumber(detail.count), moved = finiteNumber(detail.moved), escalated = finiteNumber(detail.escalated), counts2 = [
464838
464954
  count3 !== void 0 ? `withheld ${String(count3)}` : null,
@@ -464850,6 +464966,34 @@ function engineNoticeLine(rawCode, rawMessage, rawDetail) {
464850
464966
  // (core types.d.ts:queued 回执过的 steer/follow-up 在 run 结束时仍在队,绝不重投)——
464851
464967
  // 必须点名丢的是哪句+给出重发指路;双码分臂(detail 键名 steer/followUp 不同,core 明写
464852
464968
  // 「a consumer routing on code alone must not mistake a stranded follow-up for a stranded steer」)。
464969
+ // 片5 5a③(core 7.3.x [6258] 闭集加员 `peer.held_settled` / `peer.idle_subscription`;design/385 Slice 4):
464970
+ // 跨会话 held 队列的结局与 idle 订阅回执。文案锚 CC250 `[cross-session-inbound] …` 字面族
464971
+ // (CC250 语料字节偏移 852639 一带:「held peer message approved but policy is now refuse」「approved but DROPPED by
464972
+ // the ingress guard on release」);detail 两闭集(settlement / reason)按 core 文档逐词,闭集外一律
464973
+ // 落通用句「held peer message settled: <settlement>/<reason>」—— 不编、不丢帧。seq/fromSession 是
464974
+ // UNTRUSTED wire 值:消毒后进文案,缺哪个不渲哪个。
464975
+ case "peer.held_settled": {
464976
+ let settlement = typeof detail.settlement == "string" ? detail.settlement : "", reason = typeof detail.reason == "string" ? detail.reason : "", seq = finiteNumber(detail.seq), from = typeof detail.fromSession == "string" ? cleanUntrustedForDisplay(detail.fromSession, 40) : "", who = `${seq !== void 0 ? ` #${String(seq)}` : ""}${from.length > 0 ? ` from ${from}` : ""}`, held = finiteNumber(detail.heldCount), body;
464977
+ if (settlement === "delivered" && reason === "approved") body = `held peer message${who} approved and delivered`;
464978
+ else if (settlement === "delivered" && reason === "rejudge") body = `held peer message${who} re-judged and delivered (policy now accepts)`;
464979
+ else if (settlement === "dropped" && reason === "rejudge") body = `held peer message${who} approved but policy is now refuse \u2014 dropped`;
464980
+ else if (settlement === "dropped" && reason === "inject_failed") body = `held peer message${who} approved but DROPPED by the ingress guard on release`;
464981
+ else if (reason === "evicted" && (settlement === "expired" || settlement === "dropped")) body = `held peer message${who} ${settlement} \u2014 held queue full${held !== void 0 ? ` (${String(held)} held)` : ""}, oldest evicted`;
464982
+ else if (settlement === "expired" && reason === "deadline") body = `held peer message${who} expired at the review deadline \u2014 not delivered`;
464983
+ else if (settlement === "expired" && reason === "cancelled") body = `held peer message${who} cancelled \u2014 not delivered`;
464984
+ else if (settlement === "expired" && reason === "shutdown") body = `shutdown: settling held peer message${who} as expired \u2014 not delivered`;
464985
+ else if (settlement === "denied") body = `held peer message${who} denied \u2014 not delivered`;
464986
+ else if (settlement === "refused") body = `held peer message${who} refused by policy \u2014 not delivered`;
464987
+ else {
464988
+ let s1 = settlement.length > 0 ? cleanUntrustedForDisplay(settlement, 24) : "unknown", r1 = reason.length > 0 ? cleanUntrustedForDisplay(reason, 24) : "unknown";
464989
+ body = `held peer message${who} settled: ${s1}/${r1}`;
464990
+ }
464991
+ return `[cross-session-inbound] ${body}`;
464992
+ }
464993
+ case "peer.idle_subscription": {
464994
+ let outcome = typeof detail.outcome == "string" ? cleanUntrustedForDisplay(detail.outcome, 24) : "unknown", from = typeof detail.fromSession == "string" ? cleanUntrustedForDisplay(detail.fromSession, 40) : "", live = detail.live === !0 ? "live" : detail.live === !1 ? "not live" : "", tail = [from.length > 0 ? `peer ${from}` : null, live.length > 0 ? live : null].filter((x3) => x3 !== null).join(", ");
464995
+ return `[Cross-session idle notice] ${outcome}${tail.length > 0 ? ` (${tail})` : ""}`;
464996
+ }
464853
464997
  case "task.user_steer_undrained": {
464854
464998
  let steer = typeof detail.steer == "string" ? cleanUntrustedForDisplay(detail.steer, 80) : "";
464855
464999
  return `Engine notice: your steer${steer.length > 0 ? ` ("${steer}")` : ""} was never consumed \u2014 the run ended before any turn could pick it up, and it will not be redelivered; send it again if you still want it`;
@@ -465912,8 +466056,10 @@ function buildWireSettingsStamp(mode, full, opts = {}) {
465912
466056
  ...deny2.length ? { deny: deny2 } : {},
465913
466057
  ...ask2.length ? { ask: ask2 } : {}
465914
466058
  };
465915
- if (mode === "rules")
465916
- return Object.keys(safePerms).length ? { permissions: safePerms } : void 0;
466059
+ if (mode === "rules") {
466060
+ let rulesOut = {};
466061
+ return Object.keys(safePerms).length && (rulesOut.permissions = safePerms), typeof full.outputStyle == "string" && full.outputStyle !== "" && (rulesOut.outputStyle = full.outputStyle), Object.keys(rulesOut).length ? rulesOut : void 0;
466062
+ }
465917
466063
  let { allow: _allow, deny: _deny, ask: _ask, ...permRest } = perms, fullPerms = { ...permRest, ...safePerms }, { hooks: _hooks, ...fullSansHooks } = full, out6 = {}, droppedTop = [];
465918
466064
  for (let [k2, v2] of Object.entries(fullSansHooks))
465919
466065
  k2 !== "permissions" && (WIRE_SETTINGS_TOP_KEYS.has(k2) ? out6[k2] = v2 : droppedTop.push(k2));
@@ -465962,13 +466108,14 @@ var cliToolFlagsSnapshot, WIRE_SETTINGS_TOP_KEYS, WIRE_PERMISSIONS_KEYS, init_se
465962
466108
  });
465963
466109
 
465964
466110
  // build-src/src/sema/classifierVerdictWire.ts
465965
- function surfaceClassifierDeny(toolName2, verdict) {
466111
+ function surfaceClassifierDeny(toolName2, verdict, ctx) {
465966
466112
  try {
465967
466113
  (init_autoModeDenials(), __toCommonJS(autoModeDenials_exports)).recordAutoModeDenial?.({
465968
466114
  toolName: toolName2,
465969
- // display:wire tool_end 不带 args(args tool_start;本桥只为 ask/fs 工具留存),
465970
- // 克制起见用 toolName 兜底 —— 裁决 reason 单列一栏,信息不丢。
465971
- display: toolName2,
466115
+ // L-69⑨(client-core 0.52.0):包侧 deny 臂现在把这一只 call tool_start args 经 ctx 交过来,
466116
+ // 行文案由包内 classifierDenyDisplay 三端同形判定(Bash command / fs 工具 ⇒ file_path / 其它 ⇒ toolName;
466117
+ // 台账缺席 ⇒ 回落 toolName)。args 是 UNTRUSTED wire 值:展示消毒在端(本行),包内只截长度。
466118
+ display: cleanUntrustedForDisplay(classifierDenyDisplay(toolName2, ctx?.args), 200),
465972
466119
  reason: verdict.reason ?? verdict.message,
465973
466120
  timestamp: Date.now()
465974
466121
  });
@@ -465994,6 +466141,7 @@ var NOTICE_KEY, NOTICE_TIMEOUT_MS, noticeTimeoutOverrideForTest, init_classifier
465994
466141
  init_dist();
465995
466142
  init_debug();
465996
466143
  init_wireNoticePort();
466144
+ init_untrustedDisplayText();
465997
466145
  NOTICE_KEY = "auto-mode-denied", NOTICE_TIMEOUT_MS = 1e4, noticeTimeoutOverrideForTest = null;
465998
466146
  }
465999
466147
  });
@@ -466396,19 +466544,32 @@ function evaluateEngineGateSyncAllow(req) {
466396
466544
  `engineGateSyncAllow: gate for "${req.toolName}" AUTO-ALLOWED by mode posture (${verdict.reason}; mode=${ctx?.mode ?? "none"})`
466397
466545
  ), verdict;
466398
466546
  }
466399
- return budgetUsed >= cap() ? (budgetExhaustedLogged || (budgetExhaustedLogged = !0, logForDebugging(
466400
- `engineGateSyncAllow: programmatic-allow budget exhausted (${budgetUsed}/${cap()}) \u2014 every further gate goes back to the approval card`
466401
- )), {
466402
- allow: !1,
466403
- reason: "programmatic-allow budget exhausted",
466404
- autoFallbackReason: "engine_gate_budget_exhausted"
466405
- }) : (budgetUsed++, verdict);
466547
+ if (budgetUsed >= cap()) {
466548
+ if (!budgetExhaustedLogged) {
466549
+ budgetExhaustedLogged = !0, logForDebugging(
466550
+ `engineGateSyncAllow: programmatic-allow budget exhausted (${budgetUsed}/${cap()}) \u2014 every further gate goes back to the approval card`
466551
+ );
466552
+ try {
466553
+ surfaceTranscriptSystemNotice(
466554
+ `sema: the programmatic-allow budget for this session is used up (${String(budgetUsed)}/${String(cap())}) \u2014 rules will no longer auto-approve; every further gate goes back to the approval card (raise SEMA_GATE_SYNC_ALLOW_BUDGET before launch to change the cap)`
466555
+ );
466556
+ } catch {
466557
+ }
466558
+ }
466559
+ return {
466560
+ allow: !1,
466561
+ reason: "programmatic-allow budget exhausted",
466562
+ autoFallbackReason: "engine_gate_budget_exhausted"
466563
+ };
466564
+ }
466565
+ return budgetUsed++, verdict;
466406
466566
  }
466407
466567
  var SYNC_ALLOW_MODES, DEFAULT_BUDGET, NO_SYNC_ALLOW_ATTRIBUTION, budgetUsed, budgetCap, budgetExhaustedLogged, FS_WRITE_TOOL_LOADERS, init_engineGateSyncAllow = __esm({
466408
466568
  "build-src/src/sema/engineGateSyncAllow.ts"() {
466409
466569
  init_appStateRef();
466410
466570
  init_envKnobs();
466411
466571
  init_debug();
466572
+ init_transcriptSystemNotice();
466412
466573
  SYNC_ALLOW_MODES = /* @__PURE__ */ new Set(["default", "acceptEdits", "auto"]), DEFAULT_BUDGET = 100, NO_SYNC_ALLOW_ATTRIBUTION = "engine_gate_no_sync_allow", budgetUsed = 0, budgetCap = null, budgetExhaustedLogged = !1;
466413
466574
  FS_WRITE_TOOL_LOADERS = {
466414
466575
  Write: () => (init_FileWriteTool(), __toCommonJS(FileWriteTool_exports)).FileWriteTool,
@@ -468071,6 +468232,7 @@ __export(agentsWire_exports, {
468071
468232
  CHROME_EVENT_KINDS: () => CHROME_EVENT_KINDS,
468072
468233
  CLAIM_HELD_STATES: () => CLAIM_HELD_STATES,
468073
468234
  CLAIM_RELEASED_STATES: () => CLAIM_RELEASED_STATES,
468235
+ CLASSIFIER_DENY_DISPLAY_MAX: () => CLASSIFIER_DENY_DISPLAY_MAX,
468074
468236
  CLASSIFIER_DENY_SIGNATURE: () => CLASSIFIER_DENY_SIGNATURE,
468075
468237
  CLIENT_VERBS: () => CLIENT_VERBS,
468076
468238
  CONFIG_DELEGATION_ENTRY_CAPS: () => CONFIG_DELEGATION_ENTRY_CAPS,
@@ -468362,6 +468524,7 @@ __export(agentsWire_exports, {
468362
468524
  catalogCachePath: () => catalogCachePath,
468363
468525
  catalogShaUrlFor: () => catalogShaUrlFor,
468364
468526
  ccStopSemanticsFromVersion: () => ccStopSemanticsFromVersion,
468527
+ classifierDenyDisplay: () => classifierDenyDisplay,
468365
468528
  classifierDenyFromToolEnd: () => classifierDenyFromToolEnd,
468366
468529
  classifierDenyNoticeText: () => classifierDenyNoticeText,
468367
468530
  classifyAskParkChainFailure: () => classifyAskParkChainFailure,
@@ -468942,16 +469105,17 @@ function noteEngineCapsForMcpGate(baseUrl, caps) {
468942
469105
  if (typeof caps != "object" || caps === null || caps.mcpInjection !== !1 || warnedBases.has(baseUrl)) return;
468943
469106
  let n2 = getSeamMcp()?.length ?? 0;
468944
469107
  if (n2 === 0) return;
468945
- warnedBases.add(baseUrl), process.stderr.write(
468946
- `[sema] mcp wire: this engine does not mount client-supplied MCP servers (capabilities.mcpInjection=false \u2014 shared deployment) \u2014 ${n2} configured MCP server${n2 === 1 ? "" : "s"} will not be available in this session
468947
- `
468948
- );
469108
+ warnedBases.add(baseUrl);
469109
+ let line = `[sema] mcp wire: this engine does not mount client-supplied MCP servers (capabilities.mcpInjection=false \u2014 shared deployment) \u2014 ${n2} configured MCP server${n2 === 1 ? "" : "s"} will not be available in this session`;
469110
+ queueTranscriptSystemNotice(line) || process.stderr.write(`${line}
469111
+ `);
468949
469112
  } catch {
468950
469113
  }
468951
469114
  }
468952
469115
  var warnedBases, init_mcpInjectionGate = __esm({
468953
469116
  "build-src/src/sema/mcpInjectionGate.ts"() {
468954
469117
  init_seamQuery();
469118
+ init_transcriptSystemNotice();
468955
469119
  warnedBases = /* @__PURE__ */ new Set();
468956
469120
  }
468957
469121
  });
@@ -471279,9 +471443,9 @@ function Header({
471279
471443
  /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedText, { dimColor: !0, wrap: "truncate", children: stats3 })
471280
471444
  ] });
471281
471445
  }
471282
- function buildHeader(run2, pending3) {
471446
+ function buildHeader(run2, pending4) {
471283
471447
  let name = run2.name ? `dynamic workflow: ${run2.name}` : "dynamic workflow", subtext = run2.description ?? run2.summary, parts = [];
471284
- if ((!pending3 || run2.agentCount > 0) && parts.push(`${run2.agentCount} ${plural(run2.agentCount, "agent")}`), run2.totalTokens > 0 && parts.push(`${fmtTokens2(run2.totalTokens)} tokens`), parts.push(run2.status), run2.status === "running" && run2.phases.length > 1) {
471448
+ if ((!pending4 || run2.agentCount > 0) && parts.push(`${run2.agentCount} ${plural(run2.agentCount, "agent")}`), run2.totalTokens > 0 && parts.push(`${fmtTokens2(run2.totalTokens)} tokens`), parts.push(run2.status), run2.status === "running" && run2.phases.length > 1) {
471285
471449
  let current6 = [...run2.phases].reverse().find((p) => p.status === "running") ?? [...run2.phases].reverse().find((p) => p.status !== "not-started");
471286
471450
  current6 && parts.push(`phase: ${current6.title}`);
471287
471451
  }
@@ -471298,9 +471462,9 @@ function WorkflowDetailDialog2({
471298
471462
  onPause,
471299
471463
  onResume,
471300
471464
  initialPhaseIndex,
471301
- pending: pending3
471465
+ pending: pending4
471302
471466
  }) {
471303
- let termSize = useTerminalSize(), { rows: rows2 } = useModalOrTerminalSize(termSize), insideModal = useIsInsideModal(), { columns } = termSize, width = Math.max(24, columns - 6), singlePaneWidth = Math.max(12, width - 6), phases = workflow.phases, header = (0, import_react204.useMemo)(() => buildHeader(workflow, pending3), [workflow, pending3]), [phaseIdx, setPhaseIdx] = (0, import_react204.useState)(
471467
+ let termSize = useTerminalSize(), { rows: rows2 } = useModalOrTerminalSize(termSize), insideModal = useIsInsideModal(), { columns } = termSize, width = Math.max(24, columns - 6), singlePaneWidth = Math.max(12, width - 6), phases = workflow.phases, header = (0, import_react204.useMemo)(() => buildHeader(workflow, pending4), [workflow, pending4]), [phaseIdx, setPhaseIdx] = (0, import_react204.useState)(
471304
471468
  initialPhaseIndex !== void 0 ? Math.max(0, initialPhaseIndex) : 0
471305
471469
  ), [agentIdx, setAgentIdx] = (0, import_react204.useState)(0), [level, setLevel] = (0, import_react204.useState)(
471306
471470
  initialPhaseIndex !== void 0 ? "agents" : "phases"
@@ -471558,7 +471722,7 @@ function WorkflowDetailDialog2({
471558
471722
  ] }) : body = /* @__PURE__ */ (0, import_jsx_runtime360.jsxs)(import_jsx_runtime360.Fragment, { children: [
471559
471723
  /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(Header, { name: header.name, subtext: header.subtext, stats: header.stats }),
471560
471724
  !tight && /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedBox_default, { height: 1 }),
471561
- /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedText, { dimColor: !0, children: pending3 ? "Loading agents\u2026" : "No agents yet." }),
471725
+ /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedText, { dimColor: !0, children: pending4 ? "Loading agents\u2026" : "No agents yet." }),
471562
471726
  /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedBox_default, { flexGrow: 1 })
471563
471727
  ] }), /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(ThemedBox_default, { flexDirection: "column", tabIndex: 0, autoFocus: !0, onKeyDown, children: /* @__PURE__ */ (0, import_jsx_runtime360.jsxs)(
471564
471728
  ThemedBox_default,
@@ -488058,7 +488222,7 @@ function BashPermissionRequestInner({
488058
488222
  sandboxingEnabled: sandboxingEnabled_0,
488059
488223
  isSandboxed: isSandboxed_0
488060
488224
  } = (0, import_react227.useMemo)(() => {
488061
- let destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE2("tengu_destructive_command_warning", !1) ? getDestructiveCommandWarning(command8) : null, sandboxingEnabled = SandboxManager2.isSandboxingEnabled(), isSandboxed = sandboxingEnabled && shouldUseSandbox(toolUseConfirm.input);
488225
+ let destructiveWarning = getFeatureValue_CACHED_MAY_BE_STALE2("tengu_destructive_command_warning", !1) ? getDestructiveCommandWarning(command8) : null, sandboxingEnabled = SandboxManager2.isSandboxingEnabled(), engineLane = wasGateArmed(toolUseConfirm.toolUseID), isSandboxed = sandboxingEnabled && !engineLane && shouldUseSandbox(toolUseConfirm.input);
488062
488226
  return {
488063
488227
  destructiveWarning,
488064
488228
  sandboxingEnabled,
@@ -488205,6 +488369,7 @@ var import_compiler_runtime256, import_react227, import_jsx_runtime397, init_Bas
488205
488369
  init_bashClassifier();
488206
488370
  init_PermissionUpdate();
488207
488371
  init_sandbox_adapter();
488372
+ init_armedGateRegistry2();
488208
488373
  init_select();
488209
488374
  init_ShimmerChar();
488210
488375
  init_useShimmerAnimation();
@@ -510413,7 +510578,7 @@ function _temp158() {
510413
510578
  }
510414
510579
  var import_compiler_runtime307, import_react317, SETTINGS_ERRORS_NOTIFICATION_KEY, init_useSettingsErrors = __esm({
510415
510580
  "build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
510416
- import_compiler_runtime307 = __toESM(require_compiler_runtime()), import_react317 = __toESM(require_react());
510581
+ import_compiler_runtime307 = __toESM(require_compiler_runtime(), 1), import_react317 = __toESM(require_react(), 1);
510417
510582
  init_notifications2();
510418
510583
  init_state();
510419
510584
  init_allErrors();
@@ -513247,8 +513412,8 @@ function REPL({
513247
513412
  (0, import_react336.useEffect)(() => {
513248
513413
  let unregister = registerTranscriptSystemNoticeSink((text2) => {
513249
513414
  setMessages((prev) => [...prev, createSystemMessage(text2, "warning")]);
513250
- }), pending3 = drainPendingCcImportBootNotice();
513251
- pending3 !== null && setMessages((prev) => [...prev, createSystemMessage(pending3, "info")]);
513415
+ }), pending4 = drainPendingCcImportBootNotice();
513416
+ pending4 !== null && setMessages((prev) => [...prev, createSystemMessage(pending4, "info")]);
513252
513417
  let crashConverged = drainPendingCrashConvergedNotice();
513253
513418
  return crashConverged !== null && setMessages((prev) => [...prev, createSystemMessage(crashConverged, "warning")]), unregister;
513254
513419
  }, [setMessages]);
@@ -514082,8 +514247,8 @@ Error: sandbox required but unavailable: ${reason}
514082
514247
  }
514083
514248
  }, [onQueryImpl, setAppState, resetLoadingState, queryGuard, mrOnBeforeQuery, mrOnTurnComplete]), initialMessageRef = (0, import_react336.useRef)(!1);
514084
514249
  (0, import_react336.useEffect)(() => {
514085
- let pending3 = initialMessage;
514086
- if (!pending3 || isLoading || initialMessageRef.current) return;
514250
+ let pending4 = initialMessage;
514251
+ if (!pending4 || isLoading || initialMessageRef.current) return;
514087
514252
  initialMessageRef.current = !0;
514088
514253
  async function processInitialMessage(initialMsg) {
514089
514254
  if (initialMsg.clearContext) {
@@ -514151,7 +514316,7 @@ Error: sandbox required but unavailable: ${reason}
514151
514316
  ref.current = !1;
514152
514317
  }, 100, initialMessageRef);
514153
514318
  }
514154
- processInitialMessage(pending3);
514319
+ processInitialMessage(pending4);
514155
514320
  }, [initialMessage, isLoading, setMessages, setAppState, onQuery, mainLoopModel, tools]);
514156
514321
  let onAgentSubmitRef = (0, import_react336.useRef)(null), onSubmit = (0, import_react336.useCallback)(async (input, helpers, speculationAccept, options) => {
514157
514322
  if (repinScroll(), !speculationAccept && !input.trim().startsWith("/")) {
@@ -515041,9 +515206,9 @@ Note: ctrl + z now suspends Sema, ctrl + _ undoes input.
515041
515206
  hasAcknowledgedCostThreshold: !0
515042
515207
  }));
515043
515208
  } }), idleReturnDialog = focusedInputDialog === "idle-return" && idleReturnPending && /* @__PURE__ */ (0, import_jsx_runtime489.jsx)(IdleReturnDialog, { idleMinutes: idleReturnPending.idleMinutes, totalInputTokens: getTotalInputTokens(), onDone: async (action) => {
515044
- let pending3 = idleReturnPending;
515045
- if (setIdleReturnPending(null), Math.round(pending3.idleMinutes), messagesRef.current.length, getTotalInputTokens(), action === "dismiss") {
515046
- setInputValue(pending3.input);
515209
+ let pending4 = idleReturnPending;
515210
+ if (setIdleReturnPending(null), Math.round(pending4.idleMinutes), messagesRef.current.length, getTotalInputTokens(), action === "dismiss") {
515211
+ setInputValue(pending4.input);
515047
515212
  return;
515048
515213
  }
515049
515214
  if (action === "never" && saveGlobalConfig((current6) => current6.idleReturnDismissed ? current6 : {
@@ -515063,7 +515228,7 @@ Note: ctrl + z now suspends Sema, ctrl + _ undoes input.
515063
515228
  setConversationId
515064
515229
  }), haikuTitleAttemptedRef.current = !1, setHaikuTitle(void 0), bashTools.current.clear(), bashToolsProcessedIdx.current = 0;
515065
515230
  }
515066
- skipIdleCheckRef.current = !0, onSubmitRef.current(pending3.input, {
515231
+ skipIdleCheckRef.current = !0, onSubmitRef.current(pending4.input, {
515067
515232
  setCursorOffset: () => {
515068
515233
  },
515069
515234
  clearBuffer: () => {
@@ -530250,8 +530415,8 @@ async function cloudPublishApprove(options) {
530250
530415
  try {
530251
530416
  let ctx = await resolveCtx(options.profile), space = options.space ?? ctx.activeScope, { status: ps, json: pj } = await api(ctx, `/api/v1/scopes/${encodeURIComponent(space)}/publish/pending`);
530252
530417
  if (ps !== 200) throw adminHttpError(ctx, ps, pj, `reading the pending publish request of space '${space}'`, "the v1 publish API");
530253
- let pending3 = asRec2(pj.pending);
530254
- if (pending3 || (err4(`Error: space '${space}' has no pending publish request \u2014 nothing to approve. Open one: sema cloud publish --space ${space}`), process.exit(1)), out2(`Pending publish request \xB7 space '${space}' \xB7 ${ctx.registryUrl}`), out2(` requested by ${asStr3(pending3.requestedBy) ?? "?"} at ${asStr3(pending3.requestedAt) ?? "?"} (draft v${asNum2(pending3.draftVersion) ?? "?"})`), out2(` approvals so far: ${asNum2(pending3.approvals) ?? 0}${asArr2(pending3.approvedBy).length > 0 ? ` (${asArr2(pending3.approvedBy).join(", ")})` : ""}`), out2(" approving may RELEASE the draft to every member of this space (when yours is the final approval)."), !await confirmDanger(`Approve the publish request for space '${space}'?`, options.yes)) {
530418
+ let pending4 = asRec2(pj.pending);
530419
+ if (pending4 || (err4(`Error: space '${space}' has no pending publish request \u2014 nothing to approve. Open one: sema cloud publish --space ${space}`), process.exit(1)), out2(`Pending publish request \xB7 space '${space}' \xB7 ${ctx.registryUrl}`), out2(` requested by ${asStr3(pending4.requestedBy) ?? "?"} at ${asStr3(pending4.requestedAt) ?? "?"} (draft v${asNum2(pending4.draftVersion) ?? "?"})`), out2(` approvals so far: ${asNum2(pending4.approvals) ?? 0}${asArr2(pending4.approvedBy).length > 0 ? ` (${asArr2(pending4.approvedBy).join(", ")})` : ""}`), out2(" approving may RELEASE the draft to every member of this space (when yours is the final approval)."), !await confirmDanger(`Approve the publish request for space '${space}'?`, options.yes)) {
530255
530420
  out2("Cancelled \u2014 the request is still pending.");
530256
530421
  return;
530257
530422
  }
@@ -531864,9 +532029,9 @@ function domainDiffLine(kind, draftValue, pubValue) {
531864
532029
  async function runPublish(ctx, yes, standalone) {
531865
532030
  let publishPath = `/api/v1/scopes/${encodeURIComponent(ctx.space)}/publish`, { status: status3, json: json2 } = await teamFetch(ctx, publishPath);
531866
532031
  if (status3 !== 200) throw await teamHttpError(ctx, status3, json2, `reading the publish state of space '${ctx.space}'`, "member (any role)");
531867
- let publishedMeta = asRec3(json2.published), pending3 = asRec3(json2.pending), approvalsRequired = typeof json2.approvalsRequired == "number" ? json2.approvalsRequired : void 0, approvalsDisplay = approvalsRequired ?? "?", mayRequireApprovals = approvalsRequired === void 0 || approvalsRequired > 0;
531868
- if (pending3) {
531869
- out4(`Space '${ctx.space}' already has a PENDING publish request \u2014 the draft is NOT live yet:`), out4(` requested by ${asStr4(pending3.requestedBy) ?? "?"} at ${asStr4(pending3.requestedAt) ?? "?"} (draft v${pending3.draftVersion ?? "?"})`), out4(` approvals: ${typeof pending3.approvals == "number" ? pending3.approvals : 0}/${approvalsDisplay} \u2014 approvers act via POST ${publishPath}/approve (or the web console)`), out4(" a new publish request cannot be opened until this one is approved or withdrawn."), standalone && process.exit(1);
532032
+ let publishedMeta = asRec3(json2.published), pending4 = asRec3(json2.pending), approvalsRequired = typeof json2.approvalsRequired == "number" ? json2.approvalsRequired : void 0, approvalsDisplay = approvalsRequired ?? "?", mayRequireApprovals = approvalsRequired === void 0 || approvalsRequired > 0;
532033
+ if (pending4) {
532034
+ out4(`Space '${ctx.space}' already has a PENDING publish request \u2014 the draft is NOT live yet:`), out4(` requested by ${asStr4(pending4.requestedBy) ?? "?"} at ${asStr4(pending4.requestedAt) ?? "?"} (draft v${pending4.draftVersion ?? "?"})`), out4(` approvals: ${typeof pending4.approvals == "number" ? pending4.approvals : 0}/${approvalsDisplay} \u2014 approvers act via POST ${publishPath}/approve (or the web console)`), out4(" a new publish request cannot be opened until this one is approved or withdrawn."), standalone && process.exit(1);
531870
532035
  return;
531871
532036
  }
531872
532037
  let lines = [], draftVersion;
@@ -542120,7 +542285,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
542120
542285
  pendingHookMessages
542121
542286
  }, renderAndRun);
542122
542287
  }
542123
- }).version("sema 1.0.97", "-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 () => {
542288
+ }).version("sema 1.0.98", "-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 () => {
542124
542289
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
542125
542290
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
542126
542291
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -544530,6 +544695,25 @@ var PUMP_SOURCE, init_teamMcpPump = __esm({
544530
544695
  }
544531
544696
  });
544532
544697
 
544698
+ // build-src/src/sema/mcpDisabledFilter.ts
544699
+ function filterDisabledMcpServers(servers, isDisabled) {
544700
+ let out6 = {};
544701
+ for (let [name, cfg] of Object.entries(servers)) {
544702
+ let disabled = !0;
544703
+ try {
544704
+ disabled = isDisabled(name);
544705
+ } catch {
544706
+ disabled = !0;
544707
+ }
544708
+ disabled || (out6[name] = cfg);
544709
+ }
544710
+ return out6;
544711
+ }
544712
+ var init_mcpDisabledFilter = __esm({
544713
+ "build-src/src/sema/mcpDisabledFilter.ts"() {
544714
+ }
544715
+ });
544716
+
544533
544717
  // build-src/src/sema/mcpWire.ts
544534
544718
  var mcpWire_exports = {};
544535
544719
  __export(mcpWire_exports, {
@@ -544542,7 +544726,7 @@ __export(mcpWire_exports, {
544542
544726
  async function loadMcpSpecs() {
544543
544727
  try {
544544
544728
  let { servers } = await getAllMcpConfigs();
544545
- return mcpConfigsToSpecs(servers);
544729
+ return mcpConfigsToSpecs(filterDisabledMcpServers(servers, isMcpServerDisabled));
544546
544730
  } catch {
544547
544731
  return [];
544548
544732
  }
@@ -544586,6 +544770,7 @@ async function loadMcpConfigFlagSpecs(argv) {
544586
544770
  var init_mcpWire = __esm({
544587
544771
  "build-src/src/sema/mcpWire.ts"() {
544588
544772
  init_config3();
544773
+ init_mcpDisabledFilter();
544589
544774
  init_dist();
544590
544775
  init_dist();
544591
544776
  }
@@ -544632,7 +544817,8 @@ async function tryCloudWires() {
544632
544817
  }
544633
544818
  }
544634
544819
  async function injectSkillsAndMcpWires(cwd5, opts = {}) {
544635
- if (await tryCloudWires()) return;
544820
+ let { enableConfigs: enableConfigs2 } = await Promise.resolve().then(() => (init_config(), config_exports));
544821
+ if (enableConfigs2(), await tryCloudWires()) return;
544636
544822
  let skillsWire = (async () => {
544637
544823
  if (process.env.SEMA_NO_SKILLS_WIRE !== "1")
544638
544824
  try {
@@ -547832,8 +548018,8 @@ var IDLE_EXIT_MS, DISPATCH_SCAN_MS, DAEMON_LOG_ROTATE_BYTES, ADOPTED_SWEEP_MS, C
547832
548018
  if (isPidAlive(adoptedWorker.pid)) return { ok: !1, code: "short-alive" };
547833
548019
  this.adopted.delete(short);
547834
548020
  }
547835
- let pending3 = this.pendingRespawns.get(short);
547836
- pending3 && (clearTimeout(pending3), this.pendingRespawns.delete(short));
548021
+ let pending4 = this.pendingRespawns.get(short);
548022
+ pending4 && (clearTimeout(pending4), this.pendingRespawns.delete(short));
547837
548023
  let existing = await readJobState(short);
547838
548024
  if (existing?.pid && existing.pid > 1) {
547839
548025
  let alive = !1;
@@ -549028,7 +549214,7 @@ async function launchReplProduction() {
549028
549214
  }
549029
549215
  if (process.env.SEMA_NO_REWIND_CAPTURE !== "1")
549030
549216
  try {
549031
- let { getGlobalConfig: getGlobalConfig5 } = await Promise.resolve().then(() => (init_config(), config_exports)), { setSeamRewindCapture: setSeamRewindCapture2 } = await Promise.resolve().then(() => (init_seamQuery(), seamQuery_exports)), enabled = getGlobalConfig5().fileCheckpointingEnabled !== !1;
549217
+ let { semaFileCheckpointingEnabled: semaFileCheckpointingEnabled2 } = await Promise.resolve().then(() => (init_settings_187(), settings_187_exports)), { setSeamRewindCapture: setSeamRewindCapture2 } = await Promise.resolve().then(() => (init_seamQuery(), seamQuery_exports)), enabled = semaFileCheckpointingEnabled2() !== !1;
549032
549218
  setSeamRewindCapture2(enabled), process.env.SEMA_DEBUG && console.error(`[sema] rewind capture wire: ${enabled ? "on" : "off"} (per-turn rewindFiles snapshot)`);
549033
549219
  } catch (eRw) {
549034
549220
  process.env.SEMA_DEBUG && console.error("[sema] rewind capture wire soft-failed:", eRw);