@sema-agent/cli 1.0.120 → 1.0.121

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
@@ -4261,7 +4261,9 @@ function parseWorkflowPollEnvelope(body) {
4261
4261
  let j3 = JSON.parse(body);
4262
4262
  return j3.type !== "workflow" || typeof j3.task_id != "string" || j3.task_id.length === 0 ? null : {
4263
4263
  taskId: j3.task_id,
4264
- status: typeof j3.status == "string" && j3.status.length > 0 ? j3.status : "completed",
4264
+ // 0.72.12 CC-50(#59 A-07):缺 status 'unknown'。此前折成 'completed',而 'completed' WF_TERMINAL ⇒
4265
+ // 消费点顺手 markEngineWorkflowNotified,把真完成通知的补发通道一起缴械。缺席不是终局。
4266
+ status: typeof j3.status == "string" && j3.status.length > 0 ? j3.status : "unknown",
4265
4267
  ...typeof j3.name == "string" && j3.name.length > 0 ? { name: j3.name } : {}
4266
4268
  };
4267
4269
  } catch {
@@ -4321,7 +4323,7 @@ function isEnginePanelTaskResident(taskId) {
4321
4323
  return residentTaskIds.has(taskId);
4322
4324
  }
4323
4325
  function publishEngineAgentPanelEvent(ev) {
4324
- if (listener) {
4326
+ if (ev.kind !== "sweep" && absenceBuffer.delete(ev.taskId), listener) {
4325
4327
  try {
4326
4328
  listener(ev);
4327
4329
  } catch {
@@ -4378,13 +4380,44 @@ function subscribeEngineAgentPanel(fn2) {
4378
4380
  listener === fn2 && (listener = null);
4379
4381
  };
4380
4382
  }
4381
- var PANEL_TOOLUSES_LANE_POLICY, residentTaskIds, MAX_BUFFER, listener, buffer, init_engineAgentPanelStore = __esm({
4383
+ function publishEngineAgentPanelAbsence(ev) {
4384
+ if (absenceListener) {
4385
+ try {
4386
+ absenceListener(ev);
4387
+ } catch {
4388
+ }
4389
+ return;
4390
+ }
4391
+ if (absenceBuffer.delete(ev.taskId), absenceBuffer.set(ev.taskId, ev), absenceBuffer.size > MAX_ABSENCE_BUFFER) {
4392
+ let oldest = absenceBuffer.keys().next().value;
4393
+ oldest !== void 0 && absenceBuffer.delete(oldest);
4394
+ }
4395
+ }
4396
+ function subscribeEngineAgentPanelAbsence(fn2) {
4397
+ if (absenceListener = fn2, absenceBuffer.size > 0) {
4398
+ let pending4 = [...absenceBuffer.values()];
4399
+ absenceBuffer.clear();
4400
+ for (let ev of pending4)
4401
+ try {
4402
+ fn2(ev);
4403
+ } catch {
4404
+ }
4405
+ }
4406
+ return () => {
4407
+ absenceListener === fn2 && (absenceListener = null);
4408
+ };
4409
+ }
4410
+ function __resetEngineAgentPanelAbsenceForTests() {
4411
+ absenceListener = null, absenceBuffer.clear();
4412
+ }
4413
+ var PANEL_TOOLUSES_LANE_POLICY, residentTaskIds, MAX_BUFFER, listener, buffer, MAX_ABSENCE_BUFFER, absenceListener, absenceBuffer, init_engineAgentPanelStore = __esm({
4382
4414
  "node_modules/@sema-agent/client-core/dist/engineAgentPanelStore.js"() {
4383
4415
  PANEL_TOOLUSES_LANE_POLICY = {
4384
4416
  tick: "required-engine-always-emits",
4385
4417
  "fleet-row": "optional-tolerate-absent"
4386
4418
  }, residentTaskIds = /* @__PURE__ */ new Set();
4387
4419
  MAX_BUFFER = 200, listener = null, buffer = [];
4420
+ MAX_ABSENCE_BUFFER = 200, absenceListener = null, absenceBuffer = /* @__PURE__ */ new Map();
4388
4421
  }
4389
4422
  });
4390
4423
 
@@ -4507,7 +4540,10 @@ function isTerminalNotSuccess(status3) {
4507
4540
  function isTerminalStatus(status3) {
4508
4541
  return typeof status3 == "string" && RUN_TERMINAL_STATUSES.includes(status3);
4509
4542
  }
4510
- var FLAT_PAUSED_STATUSES, REVIEW_PARK_GATE_KINDS, FLAT_REVIEW_STATUS, TERMINAL_CAUSE_KINDS, RUN_TERMINAL_NOT_SUCCESS_STATUSES, RUN_TERMINAL_STATUSES, init_runTerminal = __esm({
4543
+ function isTaskNotificationTerminalStatus(status3) {
4544
+ return status3 !== void 0 && TASK_NOTIFICATION_TERMINAL_STATUSES.includes(status3);
4545
+ }
4546
+ var FLAT_PAUSED_STATUSES, REVIEW_PARK_GATE_KINDS, FLAT_REVIEW_STATUS, TERMINAL_CAUSE_KINDS, RUN_TERMINAL_NOT_SUCCESS_STATUSES, RUN_TERMINAL_STATUSES, TASK_NOTIFICATION_TERMINAL_STATUSES, init_runTerminal = __esm({
4511
4547
  "node_modules/@sema-agent/client-core/dist/runTerminal.js"() {
4512
4548
  FLAT_PAUSED_STATUSES = ["suspended", "needs_review"];
4513
4549
  REVIEW_PARK_GATE_KINDS = Object.freeze([
@@ -4531,6 +4567,7 @@ var FLAT_PAUSED_STATUSES, REVIEW_PARK_GATE_KINDS, FLAT_REVIEW_STATUS, TERMINAL_C
4531
4567
  "completed",
4532
4568
  ...RUN_TERMINAL_NOT_SUCCESS_STATUSES
4533
4569
  ]);
4570
+ TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(["completed", "failed", "killed", "cancelled"]);
4534
4571
  }
4535
4572
  });
4536
4573
 
@@ -4576,11 +4613,11 @@ function normalizeTaskNotification(n2) {
4576
4613
  let taskId = typeof n2.task_id == "string" && n2.task_id.length > 0 ? n2.task_id : void 0;
4577
4614
  if (taskId === void 0)
4578
4615
  return null;
4579
- let status3 = typeof n2.status == "string" ? n2.status : "completed", lines = Array.isArray(n2.lines) ? n2.lines.filter((l3) => typeof l3 == "string") : [], recentSteps = deriveNotificationResidualLines(n2);
4616
+ let status3 = typeof n2.status == "string" ? n2.status : "unknown", lines = Array.isArray(n2.lines) ? n2.lines.filter((l3) => typeof l3 == "string") : [], recentSteps = deriveNotificationResidualLines(n2);
4580
4617
  return {
4581
4618
  taskId,
4582
4619
  status: status3,
4583
- summary: typeof n2.summary == "string" && n2.summary.length > 0 ? n2.summary : `Background task "${taskId}" ${status3}`,
4620
+ summary: typeof n2.summary == "string" && n2.summary.length > 0 ? n2.summary : status3 === "unknown" ? `Background task "${taskId}" reported without a status (outcome unknown)` : `Background task "${taskId}" ${status3}`,
4584
4621
  ...typeof n2.task_type == "string" ? { taskType: n2.task_type } : {},
4585
4622
  ...typeof n2.toolUseId == "string" && n2.toolUseId.length > 0 ? { toolUseId: n2.toolUseId } : {},
4586
4623
  ...typeof n2.output_file == "string" && n2.output_file.length > 0 ? { outputFile: n2.output_file } : {},
@@ -4602,7 +4639,8 @@ function taskNotificationDedupKey(n2) {
4602
4639
  function taskNotificationDedupKeyFromWire(n2) {
4603
4640
  return taskNotificationDedupKey({
4604
4641
  taskId: typeof n2.task_id == "string" ? n2.task_id : "",
4605
- status: typeof n2.status == "string" ? n2.status : "completed",
4642
+ // CC-50:与 normalizeTaskNotification 同判,缺席不与真 completed 同桶。
4643
+ status: typeof n2.status == "string" ? n2.status : "unknown",
4606
4644
  ...typeof n2.seq == "number" || typeof n2.seq == "string" ? { seq: n2.seq } : {},
4607
4645
  ...typeof n2.task_type == "string" ? { taskType: n2.task_type } : {}
4608
4646
  });
@@ -4914,19 +4952,21 @@ function enqueueBgChildNotification(n2) {
4914
4952
  bgCrossChannelDropped++, traceNotif(`bg notification suppressed (cross-channel: run already notified) taskId=${n2.taskId} seq=${cycle} status=${n2.status}`);
4915
4953
  return;
4916
4954
  }
4917
- bgNotifiedKeys.add(key), markRunNotified(n2.taskId, cycle), cardEnqueuedRunIds.add(n2.taskId);
4918
- try {
4919
- clearEnginePanelTaskResident(n2.taskId), publishEngineAgentPanelEvent({
4920
- kind: "end",
4921
- taskId: n2.taskId,
4922
- // L-215②(0.65.0):读**单铸谓词**而不是内联两词 —— 修前这里只认 `failed`/`killed`,
4923
- // 而 core [6908] 的 `blocked` 是 **agent 自报的终态**(不是等人)⇒ 一条自报走不下去的
4924
- // 后台 run 在面板上被 settle 成**成功**。🔴 `suspended`/`needs_review` 仍不在表里
4925
- // (那两词是「等一次人的决定」,判成终局会把一条正等着你的 run 在面板上判死)
4926
- isError: isTerminalNotSuccess(n2.status)
4927
- });
4928
- } catch {
4929
- }
4955
+ bgNotifiedKeys.add(key);
4956
+ let terminal = isTaskNotificationTerminalStatus(n2.status);
4957
+ if (terminal && (markRunNotified(n2.taskId, cycle), cardEnqueuedRunIds.add(n2.taskId)), terminal)
4958
+ try {
4959
+ clearEnginePanelTaskResident(n2.taskId), publishEngineAgentPanelEvent({
4960
+ kind: "end",
4961
+ taskId: n2.taskId,
4962
+ // L-215②(0.65.0):读**单铸谓词**而不是内联两词 —— 修前这里只认 `failed`/`killed`,
4963
+ // core [6908] 的 `blocked` 是 **agent 自报的终态**(不是等人)⇒ 一条自报走不下去的
4964
+ // 后台 run 在面板上被 settle 成**成功**。🔴 `suspended`/`needs_review` 仍不在表里
4965
+ // (那两词是「等一次人的决定」,判成终局会把一条正等着你的 run 在面板上判死)
4966
+ isError: isTerminalNotSuccess(n2.status)
4967
+ });
4968
+ } catch {
4969
+ }
4930
4970
  let message = `<${TASK_NOTIFICATION_TAG}>
4931
4971
  <${TASK_ID_TAG}>${escapeXml(n2.taskId)}</${TASK_ID_TAG}>
4932
4972
  <${STATUS_TAG}>${escapeXml(n2.status)}</${STATUS_TAG}>
@@ -4972,7 +5012,7 @@ function taskNotificationDeliverySupplement(objective) {
4972
5012
  if (status3 === "completed")
4973
5013
  return `${SUPPLEMENT_LINE_PREFIX}completed \u2014 only this notification delivery failed. Check /tasks for the result.`;
4974
5014
  let statusNote = status3 && status3.length > 0 ? ` (status: ${status3})` : "";
4975
- return `${SUPPLEMENT_LINE_PREFIX}already finished${statusNote} \u2014 only this notification delivery failed. Check /tasks for the result.`;
5015
+ return isTaskNotificationTerminalStatus(status3) ? `${SUPPLEMENT_LINE_PREFIX}already finished${statusNote} \u2014 only this notification delivery failed. Check /tasks for the result.` : `${SUPPLEMENT_LINE_PREFIX}is in a state this client cannot confirm${statusNote} \u2014 this notification delivery failed and the task's outcome is unknown here. Check /tasks for its current state.`;
4976
5016
  }
4977
5017
  function splitApiErrorSupplement(text2) {
4978
5018
  let idx = text2.lastIndexOf(`
@@ -5414,13 +5454,21 @@ async function readSessionMemoryStatus(client3, sessionId, opts) {
5414
5454
  ...typeof o.committedCount == "number" ? { committedCount: o.committedCount } : {},
5415
5455
  ...typeof o.foldedCount == "number" ? { foldedCount: o.foldedCount } : {},
5416
5456
  ...o.optOutSource === "record" || o.optOutSource === "fault" ? { optOutSource: o.optOutSource } : {},
5417
- ...typeof o.lastCaptureAt == "number" ? { lastCaptureAt: o.lastCaptureAt } : {}
5457
+ ...typeof o.lastCaptureAt == "number" ? { lastCaptureAt: o.lastCaptureAt } : {},
5458
+ // 0.72.9 CC-39②(server 7.85.0 S-403):布尔恒在场;非布尔 / 老 server 缺席 ⇒ 键不在场(不铸 false)。
5459
+ ...typeof o.autoConsolidationArmed == "boolean" ? { autoConsolidationArmed: o.autoConsolidationArmed } : {}
5418
5460
  }
5419
5461
  };
5420
5462
  } catch (e) {
5421
5463
  return classifyMemoryStatusFailure(e);
5422
5464
  }
5423
5465
  }
5466
+ function readAutoConsolidationArmed(facts2) {
5467
+ if (typeof facts2 != "object" || facts2 === null)
5468
+ return "indeterminate";
5469
+ let v2 = facts2.autoConsolidationArmed;
5470
+ return v2 === !0 ? "armed" : v2 === !1 ? "unarmed" : "indeterminate";
5471
+ }
5424
5472
  var init_sessionMemoryStatus = __esm({
5425
5473
  "node_modules/@sema-agent/client-core/dist/sessionMemoryStatus.js"() {
5426
5474
  }
@@ -6481,7 +6529,8 @@ Command was killed (exit 137 \u2014 possibly out-of-memory; consider lowering bu
6481
6529
  return wrap({
6482
6530
  task_id: parsed.taskId ?? "",
6483
6531
  task_type: "local_agent",
6484
- status: parsed.status ?? "completed",
6532
+ // 0.72.12 CC-50(#59 A-06):解不出 ⇒ unknown,不编 completed
6533
+ status: parsed.status ?? "unknown",
6485
6534
  description: parsed.taskId ?? "",
6486
6535
  output: parsed.output ?? "",
6487
6536
  result: parsed.output ?? ""
@@ -6686,7 +6735,7 @@ function structuredToToolUseResult(structured, modelText) {
6686
6735
  let taskId = typeof s.task_id == "string" ? s.task_id : void 0;
6687
6736
  if (taskId === void 0)
6688
6737
  return null;
6689
- let retrieval = s.retrieval_status === "timeout" || s.retrieval_status === "not_ready" ? s.retrieval_status : "success", taskType = typeof s.taskType == "string" ? s.taskType : "", inner = s.details && typeof s.details == "object" ? s.details : void 0, hasStatus = typeof s.status == "string" && s.status.length > 0, hasContent = typeof s.content == "string", parsed = hasStatus && hasContent ? null : parseModelFacingTaskOutput(modelText ?? ""), status3 = hasStatus ? s.status : parsed?.status ?? (retrieval === "success" ? "completed" : "running"), bodyText = hasContent ? s.content : parsed && parsed.kind !== "unknown" ? parsed.output : void 0, error51 = typeof s.error == "string" ? s.error : void 0;
6738
+ let taskType = typeof s.taskType == "string" ? s.taskType : "", inner = s.details && typeof s.details == "object" ? s.details : void 0, hasStatus = typeof s.status == "string" && s.status.length > 0, hasContent = typeof s.content == "string", rawRetrieval = typeof s.retrieval_status == "string" ? s.retrieval_status : void 0, engineSaidNotReady = rawRetrieval === "timeout" || rawRetrieval === "not_ready", retrieval = engineSaidNotReady ? rawRetrieval : "success", parsed = hasStatus && hasContent ? null : parseModelFacingTaskOutput(modelText ?? ""), status3 = hasStatus ? s.status : parsed?.status ?? (engineSaidNotReady ? "running" : "unknown"), bodyText = hasContent ? s.content : parsed && parsed.kind !== "unknown" ? parsed.output : void 0, error51 = typeof s.error == "string" ? s.error : void 0;
6690
6739
  if (taskType === "background_bash") {
6691
6740
  let exitCode = typeof inner?.exitCode == "number" ? inner.exitCode : void 0;
6692
6741
  return {
@@ -8813,8 +8862,12 @@ function coerceWorkflowStatus(s) {
8813
8862
  return "killed";
8814
8863
  case "parked":
8815
8864
  return "awaiting approval";
8816
- default:
8865
+ case "queued":
8866
+ return "queued";
8867
+ case "running":
8817
8868
  return "running";
8869
+ default:
8870
+ return "idle";
8818
8871
  }
8819
8872
  }
8820
8873
  function deriveAgentLabel(agentType, agentName, name, id) {
@@ -9130,14 +9183,14 @@ function projectFleetAgentRows(rows3, nowMs2 = Date.now()) {
9130
9183
  projectFleetAgentRowsFor(DEFAULT_SESSION_KEY, rows3, nowMs2);
9131
9184
  }
9132
9185
  function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9133
- let seenMap = seenFor(sessionKey), present = /* @__PURE__ */ new Set();
9186
+ let seenMap = seenFor(sessionKey), present2 = /* @__PURE__ */ new Set();
9134
9187
  for (let row2 of rows3) {
9135
9188
  if (!row2?.id)
9136
9189
  continue;
9137
9190
  let taskId = rowIdTail(row2.id);
9138
9191
  if (!taskId)
9139
9192
  continue;
9140
- present.add(taskId);
9193
+ present2.add(taskId);
9141
9194
  let status3 = row2.status ?? "running", tokens = row2.tokens ?? 0, toolUses = typeof row2.toolUses == "number" ? row2.toolUses : void 0, transcriptId = row2.transcriptId || void 0, startedAt = typeof row2.startedAt == "number" && row2.startedAt > 0 ? row2.startedAt : void 0, currentTool = currentToolKeyOf(row2.currentTool) !== void 0 ? row2.currentTool : void 0, currentToolKey = currentToolKeyOf(row2.currentTool), prev = seenMap.get(taskId);
9142
9195
  if (TERMINAL_FLEET_TASK_STATUSES.has(status3)) {
9143
9196
  prev?.settled || ((toolUses !== void 0 && prev?.toolUses !== toolUses || transcriptId !== void 0 && prev?.transcriptId !== transcriptId || startedAt !== void 0 && prev?.startedAt !== startedAt) && publishEngineAgentPanelEvent({
@@ -9166,11 +9219,13 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9166
9219
  lastSeenAt: nowMs2,
9167
9220
  settled: !0,
9168
9221
  // notif-F13:settle 时刻只在**首次** settle 时铸(重复投影的终态行不许一路续命回收期)。
9169
- settledAtMs: prev?.settled ? prev.settledAtMs : nowMs2
9222
+ settledAtMs: prev?.settled ? prev.settledAtMs : nowMs2,
9223
+ absentReportedAtMs: void 0
9170
9224
  });
9171
9225
  continue;
9172
9226
  }
9173
- (!prev || prev.settled || prev.status !== status3 || prev.tokens !== tokens || toolUses !== void 0 && prev.toolUses !== toolUses || transcriptId !== void 0 && prev.transcriptId !== transcriptId || startedAt !== void 0 && prev.startedAt !== startedAt || currentToolKey !== void 0 && prev.currentToolKey !== currentToolKey) && publishEngineAgentPanelEvent({
9227
+ (!prev || prev.settled || prev.absentReportedAtMs !== void 0 || // 行回来了:即使值未变也发一条,消费端据此撤掉 absent
9228
+ prev.status !== status3 || prev.tokens !== tokens || toolUses !== void 0 && prev.toolUses !== toolUses || transcriptId !== void 0 && prev.transcriptId !== transcriptId || startedAt !== void 0 && prev.startedAt !== startedAt || currentToolKey !== void 0 && prev.currentToolKey !== currentToolKey) && publishEngineAgentPanelEvent({
9174
9229
  kind: "fleet-row",
9175
9230
  taskId,
9176
9231
  ...row2.name ? { name: row2.name } : {},
@@ -9190,18 +9245,24 @@ function projectFleetAgentRowsFor(sessionKey, rows3, nowMs2 = Date.now()) {
9190
9245
  currentToolKey: currentToolKey !== void 0 ? currentToolKey : prev?.currentToolKey,
9191
9246
  lastSeenAt: nowMs2,
9192
9247
  settled: !1,
9193
- settledAtMs: void 0
9248
+ settledAtMs: void 0,
9194
9249
  // 又活了 ⇒ 回收钟归零(重新 settle 时重铸)
9250
+ absentReportedAtMs: void 0
9251
+ // 在场 ⇒ 缺席周期结束(下次再消失是新周期,会再上报一次)
9195
9252
  });
9196
9253
  }
9197
- for (let [taskId, s] of seenMap)
9198
- present.has(taskId) || s.settled || nowMs2 - s.lastSeenAt <= ABSENT_SETTLE_MS || (publishEngineAgentPanelEvent({ kind: "end", taskId, isError: !1 }), seenMap.set(taskId, { ...s, settled: !0, settledAtMs: nowMs2 }));
9199
9254
  for (let [taskId, s] of seenMap) {
9200
- if (!s.settled || present.has(taskId))
9255
+ if (present2.has(taskId) || s.settled || s.absentReportedAtMs !== void 0)
9201
9256
  continue;
9202
- let settledAt = s.settledAtMs ?? s.lastSeenAt;
9203
- nowMs2 - settledAt > SETTLED_RETENTION_MS && seenMap.delete(taskId);
9257
+ let absentForMs = nowMs2 - s.lastSeenAt;
9258
+ absentForMs <= ABSENT_SETTLE_MS || (publishEngineAgentPanelAbsence({ taskId, lastSeenAtMs: s.lastSeenAt, absentForMs }), seenMap.set(taskId, { ...s, absentReportedAtMs: nowMs2 }));
9204
9259
  }
9260
+ for (let [taskId, s] of seenMap)
9261
+ if (!present2.has(taskId))
9262
+ if (s.settled) {
9263
+ let settledAt = s.settledAtMs ?? s.lastSeenAt;
9264
+ nowMs2 - settledAt > SETTLED_RETENTION_MS && seenMap.delete(taskId);
9265
+ } else s.absentReportedAtMs !== void 0 && nowMs2 - s.absentReportedAtMs > SETTLED_RETENTION_MS && seenMap.delete(taskId);
9205
9266
  seenMap.size === 0 && seen.delete(sessionKey);
9206
9267
  }
9207
9268
  var ABSENT_SETTLE_MS, SETTLED_RETENTION_MS, seen, init_fleetAgentPanelProjection = __esm({
@@ -9732,6 +9793,259 @@ var WEB_SEARCH_BACKEND_NONE, readingByBase3, WS_DETAIL_MAX, DEPLOY_ENV, init_web
9732
9793
  }
9733
9794
  });
9734
9795
 
9796
+ // node_modules/@sema-agent/client-core/dist/executionLaneCapability.js
9797
+ function projectExecutionLaneCapability(caps) {
9798
+ if (caps === null || typeof caps != "object")
9799
+ return;
9800
+ if (!("executionLane" in caps))
9801
+ return { kind: "not_reported" };
9802
+ let lane = caps.executionLane;
9803
+ if (lane === void 0)
9804
+ return { kind: "not_reported" };
9805
+ if (lane === null || typeof lane != "object" || Array.isArray(lane))
9806
+ return;
9807
+ let provider = lane.provider, toolsOnThisHost = lane.toolsOnThisHost;
9808
+ if (!(typeof provider != "string" || provider === "") && typeof toolsOnThisHost == "boolean")
9809
+ return { kind: "present", view: { provider, toolsOnThisHost } };
9810
+ }
9811
+ function noteEngineCapsForExecutionLane(baseUrl, caps, opts) {
9812
+ try {
9813
+ if (typeof baseUrl != "string" || baseUrl === "" || opts?.generation !== void 0 && opts.generation !== engineCapsGeneration(baseUrl))
9814
+ return;
9815
+ let reading = projectExecutionLaneCapability(caps);
9816
+ if (reading === void 0) {
9817
+ readingByBase4.delete(baseUrl);
9818
+ return;
9819
+ }
9820
+ readingByBase4.set(baseUrl, reading);
9821
+ } catch {
9822
+ }
9823
+ }
9824
+ function observedExecutionLane(baseUrl = engineWireTarget()?.baseUrl) {
9825
+ if (typeof baseUrl != "string" || baseUrl === "")
9826
+ return { kind: "unobserved" };
9827
+ let hit = readingByBase4.get(baseUrl);
9828
+ return hit !== void 0 ? hit : { kind: "unobserved" };
9829
+ }
9830
+ function toolsRunHereFromExecutionLane(reading, legacyInference) {
9831
+ return reading.kind === "present" ? reading.view.toolsOnThisHost : legacyInference;
9832
+ }
9833
+ function executionLaneDoctorDetail(reading) {
9834
+ switch (reading.kind) {
9835
+ case "unobserved":
9836
+ return "execution lane not observed \u2014 the engine reports it on /v1/capabilities; this process has not received a capabilities response from the engine yet";
9837
+ case "not_reported":
9838
+ return "execution lane not reported by this engine \u2014 only newer engines advertise it; this does not say where tools run, so the client keeps inferring it the way it did before";
9839
+ case "present": {
9840
+ let lane = capForDisplay(reading.view.provider, LANE_DETAIL_MAX);
9841
+ return reading.view.toolsOnThisHost ? `execution lane ${lane} \u2014 tools run on the engine host (same filesystem), so skills that have a directory of their own can carry a baseDir` : `execution lane ${lane} \u2014 tools run on a different machine than the engine, so skill baseDir is never sent on this deployment`;
9842
+ }
9843
+ }
9844
+ }
9845
+ function forgetExecutionLaneReading(baseUrl) {
9846
+ typeof baseUrl != "string" || baseUrl === "" || readingByBase4.delete(baseUrl);
9847
+ }
9848
+ function __resetExecutionLaneReadingsForTests() {
9849
+ readingByBase4.clear();
9850
+ }
9851
+ var readingByBase4, LANE_DETAIL_MAX, init_executionLaneCapability = __esm({
9852
+ "node_modules/@sema-agent/client-core/dist/executionLaneCapability.js"() {
9853
+ init_fleetTaskDesc();
9854
+ init_engineWireTarget();
9855
+ init_engineCapsCache();
9856
+ readingByBase4 = /* @__PURE__ */ new Map();
9857
+ LANE_DETAIL_MAX = 40;
9858
+ }
9859
+ });
9860
+
9861
+ // node_modules/@sema-agent/client-core/dist/mcpReconnect.js
9862
+ function projectStatus(raw2) {
9863
+ if (!isRecord(raw2) || !nonEmpty(raw2.name) || !nonEmpty(raw2.status))
9864
+ return;
9865
+ let view = { name: raw2.name, status: raw2.status };
9866
+ nonEmpty(raw2.errorCode) && (view.errorCode = raw2.errorCode), typeof raw2.httpStatus == "number" && Number.isInteger(raw2.httpStatus) && (view.httpStatus = raw2.httpStatus), nonEmpty(raw2.delivered) && (view.delivered = raw2.delivered);
9867
+ let si = raw2.serverInfo;
9868
+ return isRecord(si) && typeof si.name == "string" && typeof si.version == "string" && (view.serverInfo = { name: capForDisplay(si.name, RECONNECT_WORD_MAX), version: capForDisplay(si.version, RECONNECT_WORD_MAX) }), typeof raw2.error == "string" && (view.error = capForDisplay(raw2.error, RECONNECT_TEXT_MAX)), raw2.transportClosed === !0 && (view.transportClosed = !0), view;
9869
+ }
9870
+ function projectListingIncomplete(raw2) {
9871
+ if (!isRecord(raw2) || !nonEmpty(raw2.reason) || typeof raw2.pages != "number" || !Number.isInteger(raw2.pages) || raw2.pages < 0)
9872
+ return;
9873
+ let view = { reason: raw2.reason, pages: raw2.pages };
9874
+ return typeof raw2.budgetMs == "number" && Number.isFinite(raw2.budgetMs) && (view.budgetMs = raw2.budgetMs), typeof raw2.error == "string" && (view.error = capForDisplay(raw2.error, RECONNECT_TEXT_MAX)), view;
9875
+ }
9876
+ function projectMcpReconnectResult(body) {
9877
+ if (!isRecord(body) || !nonEmpty(body.taskId) || !nonEmpty(body.sessionId) || !nonEmpty(body.server))
9878
+ return;
9879
+ let outcome = body.outcome;
9880
+ if (typeof outcome != "string" || !MCP_RECONNECT_OUTCOMES.includes(outcome))
9881
+ return;
9882
+ let base = { taskId: body.taskId, sessionId: body.sessionId, server: body.server };
9883
+ if (outcome === "unsupported") {
9884
+ let u = { outcome: "unsupported", ...base };
9885
+ return nonEmpty(body.reason) && (u.reason = capForDisplay(body.reason, RECONNECT_TEXT_MAX)), u;
9886
+ }
9887
+ let added = stringList(body.added), removed = stringList(body.removed);
9888
+ if (!nonEmpty(body.prefix) || typeof body.toolCount != "number" || !Number.isInteger(body.toolCount) || body.toolCount < 0 || added === void 0 || removed === void 0)
9889
+ return;
9890
+ let view = {
9891
+ outcome,
9892
+ ...base,
9893
+ prefix: body.prefix,
9894
+ toolCount: body.toolCount,
9895
+ added,
9896
+ removed
9897
+ };
9898
+ if ("toolNames" in body && body.toolNames !== void 0) {
9899
+ let toolNames = stringList(body.toolNames);
9900
+ if (toolNames === void 0)
9901
+ return;
9902
+ view.toolNames = toolNames;
9903
+ }
9904
+ nonEmpty(body.reason) && (view.reason = capForDisplay(body.reason, RECONNECT_TEXT_MAX));
9905
+ let status3 = projectStatus(body.status);
9906
+ if (status3 !== void 0 && (view.status = status3), "listingIncomplete" in body && body.listingIncomplete !== void 0) {
9907
+ let li = projectListingIncomplete(body.listingIncomplete);
9908
+ if (li === void 0)
9909
+ return;
9910
+ view.listingIncomplete = li;
9911
+ }
9912
+ return view;
9913
+ }
9914
+ function classifyMcpReconnectFailure(e) {
9915
+ let code2;
9916
+ try {
9917
+ code2 = typeof e == "object" && e !== null ? e.errorCode : void 0;
9918
+ } catch {
9919
+ return { kind: "failed", error: e };
9920
+ }
9921
+ return code2 === "steering.invalid_content" ? { kind: "invalid" } : code2 === "steering.not_running" ? { kind: "not_running" } : typeof code2 == "string" && code2.startsWith("capability.") ? { kind: "unsupported", reason: "capability" } : typeof code2 == "string" && code2.startsWith("feature.") ? { kind: "unsupported", reason: "feature" } : code2 === "not_found.route" ? { kind: "unsupported", reason: "route" } : code2 === "not_found.session" ? { kind: "not_found" } : { kind: "failed", error: e };
9922
+ }
9923
+ async function reconnectMcpServer(client3, sessionId, server, opts) {
9924
+ if (!nonEmpty(sessionId))
9925
+ return { kind: "invalid" };
9926
+ if (!nonEmpty(server) || server.length > SERVER_NAME_MAX)
9927
+ return { kind: "invalid" };
9928
+ try {
9929
+ if (typeof client3?.sessions?.mcpReconnect != "function")
9930
+ return { kind: "unsupported", reason: "route" };
9931
+ if (opts?.signal?.aborted === !0)
9932
+ return { kind: "failed", error: opts.signal.reason ?? new Error("mcpReconnect: aborted before the verb was called") };
9933
+ let raw2 = await client3.sessions.mcpReconnect(sessionId, { server }, opts?.signal ? { signal: opts.signal } : void 0), view = projectMcpReconnectResult(raw2);
9934
+ return view === void 0 ? { kind: "failed", error: new Error("mcpReconnect: malformed body") } : view.sessionId !== sessionId || view.server !== server ? { kind: "failed", error: new Error("mcpReconnect: response identity mismatch") } : { kind: "ok", result: view };
9935
+ } catch (e) {
9936
+ return classifyMcpReconnectFailure(e);
9937
+ }
9938
+ }
9939
+ function projectMcpReconnectCapability(caps) {
9940
+ if (isRecord(caps)) {
9941
+ if (!("mcpReconnect" in caps) || caps.mcpReconnect === void 0)
9942
+ return "not_reported";
9943
+ if (caps.mcpReconnect === !0)
9944
+ return "available";
9945
+ if (caps.mcpReconnect === !1)
9946
+ return "unavailable";
9947
+ }
9948
+ }
9949
+ function mcpReconnectOutcomeDetail(view) {
9950
+ let name = capForDisplay(view.server, RECONNECT_WORD_MAX);
9951
+ switch (view.outcome) {
9952
+ case "accepted":
9953
+ return `MCP server ${name} was re-dialed: ${view.toolCount} tool${view.toolCount === 1 ? "" : "s"} mounted (${view.added.length} added, ${view.removed.length} removed)`;
9954
+ case "refused": {
9955
+ let why = view.reason !== void 0 ? ` \u2014 ${view.reason}` : "";
9956
+ return view.toolNames === void 0 ? `MCP server ${name} was NOT re-dialed; its connection and tools were left untouched${why}` : view.toolNames.length === 0 ? `MCP server ${name} was NOT re-dialed and its tools were withdrawn from the model until a later re-dial succeeds${why}` : `MCP server ${name} was NOT re-dialed; the engine reports ${view.toolNames.length} tool${view.toolNames.length === 1 ? "" : "s"} for it after this attempt${why}`;
9957
+ }
9958
+ case "unsupported":
9959
+ return `This run declared no MCP servers, so there is nothing to re-dial (${name} is not part of this run)` + (view.reason !== void 0 ? ` \u2014 ${view.reason}` : "");
9960
+ }
9961
+ }
9962
+ var MCP_RECONNECT_OUTCOMES, MCP_RECONNECT_TRANSACTION_NOTICE, RECONNECT_TEXT_MAX, RECONNECT_WORD_MAX, SERVER_NAME_MAX, isRecord, nonEmpty, stringList, init_mcpReconnect = __esm({
9963
+ "node_modules/@sema-agent/client-core/dist/mcpReconnect.js"() {
9964
+ init_fleetTaskDesc();
9965
+ MCP_RECONNECT_OUTCOMES = Object.freeze(["accepted", "refused", "unsupported"]), MCP_RECONNECT_TRANSACTION_NOTICE = "Reconnecting closes the current connection before dialing again. On a healthy server this is a transaction, not a refresh: a failed re-dial leaves the server down and withdraws its tools from the model until a later re-dial succeeds.", RECONNECT_TEXT_MAX = 200, RECONNECT_WORD_MAX = 40, SERVER_NAME_MAX = 190, isRecord = (v2) => typeof v2 == "object" && v2 !== null && !Array.isArray(v2), nonEmpty = (v2) => typeof v2 == "string" && v2.length > 0, stringList = (v2) => Array.isArray(v2) && v2.every((t2) => typeof t2 == "string") ? [...v2] : void 0;
9966
+ }
9967
+ });
9968
+
9969
+ // node_modules/@sema-agent/client-core/dist/leaderConflict.js
9970
+ function readWorkers(v2) {
9971
+ if (!Array.isArray(v2))
9972
+ return;
9973
+ let out6 = [];
9974
+ for (let row2 of v2) {
9975
+ if (!isRecord2(row2) || !nonEmptyString2(row2.workerId) || !nonEmptyString2(row2.branch) || typeof row2.applied != "boolean")
9976
+ return;
9977
+ out6.push({ workerId: row2.workerId, branch: row2.branch, applied: row2.applied });
9978
+ }
9979
+ return out6;
9980
+ }
9981
+ function readConflict(v2) {
9982
+ if (!isRecord2(v2) || !nonEmptyString2(v2.baseSha) || !Array.isArray(v2.files) || !v2.files.every(nonEmptyString2))
9983
+ return;
9984
+ let workers = readWorkers(v2.workers);
9985
+ if (!workers)
9986
+ return;
9987
+ let out6 = { baseSha: v2.baseSha, files: [...v2.files], workers };
9988
+ if (present(v2, "filesTruncated")) {
9989
+ if (v2.filesTruncated !== !0)
9990
+ return;
9991
+ out6.filesTruncated = !0;
9992
+ }
9993
+ if (present(v2, "rejHead")) {
9994
+ if (typeof v2.rejHead != "string")
9995
+ return;
9996
+ out6.rejHead = capForDisplay(v2.rejHead, LEADER_REJ_HEAD_DISPLAY_MAX);
9997
+ }
9998
+ return out6;
9999
+ }
10000
+ function readSalvaged(result) {
10001
+ if (!isRecord2(result) || !present(result, "salvaged"))
10002
+ return { rows: [], incomplete: !1 };
10003
+ if (!Array.isArray(result.salvaged))
10004
+ return { rows: [], incomplete: !0 };
10005
+ let rows3 = [], dropped2 = 0;
10006
+ for (let row2 of result.salvaged) {
10007
+ if (!isRecord2(row2) || !nonEmptyString2(row2.workerId) || typeof row2.sessionId != "string" || !nonEmptyString2(row2.patch)) {
10008
+ dropped2 += 1;
10009
+ continue;
10010
+ }
10011
+ rows3.push({ workerId: row2.workerId, sessionId: row2.sessionId, patch: row2.patch });
10012
+ }
10013
+ return { rows: rows3, incomplete: dropped2 > 0 };
10014
+ }
10015
+ function projectLeaderConflict(record3) {
10016
+ try {
10017
+ if (!isRecord2(record3) || !nonEmptyString2(record3.status))
10018
+ return;
10019
+ let status3 = record3.status, result = record3.result, { rows: salvaged, incomplete } = readSalvaged(result), tail = incomplete ? { salvaged, salvagedIncomplete: !0 } : { salvaged };
10020
+ if (!isRecord2(result) || !present(result, "conflict"))
10021
+ return { kind: "none", status: status3, ...tail };
10022
+ let conflict = readConflict(result.conflict);
10023
+ return conflict ? { kind: "conflict", status: status3, conflict, ...tail } : { kind: "unreadable", status: status3, ...tail };
10024
+ } catch {
10025
+ return;
10026
+ }
10027
+ }
10028
+ function salvageSentence(view) {
10029
+ let n2 = view.salvaged.length;
10030
+ return view.salvagedIncomplete ? n2 === 0 ? "Salvage material was returned but could not be read; check the raw run result before concluding that no patches exist." : `${plural(n2, "salvaged patch", "salvaged patches")} available to save, but part of the salvage material could not be read; check the raw run result for the rest.` : n2 === 0 ? "No salvaged patches were returned." : `${plural(n2, "salvaged patch", "salvaged patches")} available to save.`;
10031
+ }
10032
+ function leaderConflictDetail(view) {
10033
+ let salvage = salvageSentence(view);
10034
+ if (view.kind === "none")
10035
+ return `No merge-conflict details were reported for this leader run. This does not show that the worker branches were merged: the run may not have reached a merge, it may have merged cleanly, or the server may not report conflicts. ${salvage}`;
10036
+ if (view.kind === "unreadable")
10037
+ return `The server reported a merge conflict for this leader run, but its details were unreadable; inspect the run on the server before using the tree. ${salvage}`;
10038
+ let c3 = view.conflict, shortSha = capForDisplay(c3.baseSha, 12), shown = c3.files.slice(0, DETAIL_FILES_MAX).map((f) => capForDisplay(f, DETAIL_PATH_MAX)), rest = c3.files.length - shown.length, fileCount = c3.filesTruncated ? `at least ${plural(c3.files.length, "file", "files")} (list truncated)` : plural(c3.files.length, "file", "files"), fileList = shown.length === 0 ? "no paths were listed" : `${shown.join(", ")}${rest > 0 ? `, and ${rest} more` : ""}`, applied = c3.workers.filter((w2) => w2.applied).map((w2) => capForDisplay(w2.branch, DETAIL_BRANCH_MAX)), notApplied = c3.workers.filter((w2) => !w2.applied).map((w2) => capForDisplay(w2.branch, DETAIL_BRANCH_MAX)), branches = c3.workers.length === 0 ? "No worker branches were listed." : `Applied: ${applied.length ? applied.join(", ") : "none"}. Not applied: ${notApplied.length ? notApplied.join(", ") : "none"}.`;
10039
+ return `This leader run is waiting for a human: worker branches could not be merged onto base ${shortSha}; ${fileCount} in conflict (${fileList}). ${branches} ${salvage}`;
10040
+ }
10041
+ var LEADER_RUN_STATUSES, LEADER_REJ_HEAD_DISPLAY_MAX, DETAIL_FILES_MAX, DETAIL_PATH_MAX, DETAIL_BRANCH_MAX, isRecord2, nonEmptyString2, present, plural, init_leaderConflict = __esm({
10042
+ "node_modules/@sema-agent/client-core/dist/leaderConflict.js"() {
10043
+ init_fleetTaskDesc();
10044
+ LEADER_RUN_STATUSES = Object.freeze(["running", "completed", "failed", "needs_human"]), LEADER_REJ_HEAD_DISPLAY_MAX = 2048, DETAIL_FILES_MAX = 5, DETAIL_PATH_MAX = 120, DETAIL_BRANCH_MAX = 80, isRecord2 = (v2) => typeof v2 == "object" && v2 !== null && !Array.isArray(v2), nonEmptyString2 = (v2) => typeof v2 == "string" && v2.length > 0, present = (o, key) => Object.hasOwn(o, key) && o[key] !== void 0;
10045
+ plural = (n2, one, many) => `${n2} ${n2 === 1 ? one : many}`;
10046
+ }
10047
+ });
10048
+
9735
10049
  // node_modules/@sema-agent/client-core/dist/readFacePosture.js
9736
10050
  function projectReadFacePosture(wiring) {
9737
10051
  if (typeof wiring != "object" || wiring === null || Array.isArray(wiring) || !("readFace" in wiring))
@@ -10986,20 +11300,20 @@ var SUGGESTION_BATCH_CAP, SUGGESTION_CHARS_CAP, INTERNAL_SDK_ARM_TYPES, projecte
10986
11300
 
10987
11301
  // node_modules/@sema-agent/client-core/dist/mcpPanel.js
10988
11302
  function projectServerRow(raw2) {
10989
- if (!isRecord(raw2) || !nonEmpty(raw2.name) || !nonEmpty(raw2.status))
11303
+ if (!isRecord3(raw2) || !nonEmpty2(raw2.name) || !nonEmpty2(raw2.status))
10990
11304
  return;
10991
11305
  let row2 = { name: raw2.name, status: raw2.status }, si = raw2.serverInfo;
10992
- return isRecord(si) && typeof si.name == "string" && typeof si.version == "string" && (row2.serverInfo = { name: si.name, version: si.version }), Array.isArray(raw2.toolNames) && raw2.toolNames.every((t2) => typeof t2 == "string") && (row2.toolNames = [...raw2.toolNames]), typeof raw2.error == "string" && (row2.error = capForDisplay(raw2.error, MCP_PANEL_ERROR_MAX)), row2;
11306
+ return isRecord3(si) && typeof si.name == "string" && typeof si.version == "string" && (row2.serverInfo = { name: si.name, version: si.version }), Array.isArray(raw2.toolNames) && raw2.toolNames.every((t2) => typeof t2 == "string") && (row2.toolNames = [...raw2.toolNames]), typeof raw2.error == "string" && (row2.error = capForDisplay(raw2.error, MCP_PANEL_ERROR_MAX)), row2;
10993
11307
  }
10994
11308
  function projectLastLeg(raw2) {
10995
- if (!isRecord(raw2) || !nonEmpty(raw2.runId) || !nonEmpty(raw2.at))
11309
+ if (!isRecord3(raw2) || !nonEmpty2(raw2.runId) || !nonEmpty2(raw2.at))
10996
11310
  return;
10997
11311
  let mcp2 = projectMcpSection(raw2.mcp);
10998
11312
  if (mcp2 !== void 0)
10999
11313
  return { runId: raw2.runId, at: raw2.at, mcp: mcp2 };
11000
11314
  }
11001
11315
  function projectMcpPanel(body) {
11002
- if (!isRecord(body) || !nonEmpty(body.asOf) || !Array.isArray(body.servers))
11316
+ if (!isRecord3(body) || !nonEmpty2(body.asOf) || !Array.isArray(body.servers))
11003
11317
  return;
11004
11318
  let servers = [];
11005
11319
  for (let r of body.servers) {
@@ -11042,12 +11356,12 @@ function mcpPanelLastLegDetail(view, opts) {
11042
11356
  function mcpEngineLegPresence(view) {
11043
11357
  return view === void 0 ? "unknown" : view.servers.length > 0 || view.lastLegMcp !== void 0 || view.lastLegMcpUnreadable === !0 || view.degraded === !0 ? "present" : "absent";
11044
11358
  }
11045
- var MCP_PANEL_ERROR_MAX, MCP_PANEL_WORD_MAX, MCP_PANEL_NAMES_MAX, isRecord, nonEmpty, init_mcpPanel = __esm({
11359
+ var MCP_PANEL_ERROR_MAX, MCP_PANEL_WORD_MAX, MCP_PANEL_NAMES_MAX, isRecord3, nonEmpty2, init_mcpPanel = __esm({
11046
11360
  "node_modules/@sema-agent/client-core/dist/mcpPanel.js"() {
11047
11361
  init_host();
11048
11362
  init_eventToSdkMessage();
11049
11363
  init_fleetTaskDesc();
11050
- MCP_PANEL_ERROR_MAX = 200, MCP_PANEL_WORD_MAX = 40, MCP_PANEL_NAMES_MAX = 8, isRecord = (v2) => typeof v2 == "object" && v2 !== null && !Array.isArray(v2), nonEmpty = (v2) => typeof v2 == "string" && v2.length > 0;
11364
+ MCP_PANEL_ERROR_MAX = 200, MCP_PANEL_WORD_MAX = 40, MCP_PANEL_NAMES_MAX = 8, isRecord3 = (v2) => typeof v2 == "object" && v2 !== null && !Array.isArray(v2), nonEmpty2 = (v2) => typeof v2 == "string" && v2.length > 0;
11051
11365
  }
11052
11366
  });
11053
11367
 
@@ -11056,7 +11370,7 @@ function readEffectiveReasoning(v2) {
11056
11370
  if (typeof v2 != "object" || v2 === null)
11057
11371
  return;
11058
11372
  let o = v2;
11059
- if (!(!nonEmpty2(o.requested) || !nonEmpty2(o.effective) || !nonEmpty2(o.format) || !nonEmpty2(o.endpoint)) && !(typeof o.graded != "boolean" || typeof o.clamped != "boolean"))
11373
+ if (!(!nonEmpty3(o.requested) || !nonEmpty3(o.effective) || !nonEmpty3(o.format) || !nonEmpty3(o.endpoint)) && !(typeof o.graded != "boolean" || typeof o.clamped != "boolean"))
11060
11374
  return {
11061
11375
  requested: o.requested,
11062
11376
  effective: o.effective,
@@ -11073,7 +11387,7 @@ function readEffectiveMemoryScopes(v2) {
11073
11387
  let o = v2;
11074
11388
  if (typeof o.state != "string" || !STATES.has(o.state) || !Array.isArray(o.scopes) || o.writeScope !== null && typeof o.writeScope != "string")
11075
11389
  return;
11076
- let contract = o.contract === "v2" || o.contract === "legacy" ? o.contract : void 0, reason = nonEmpty2(o.reason) ? o.reason : void 0;
11390
+ let contract = o.contract === "v2" || o.contract === "legacy" ? o.contract : void 0, reason = nonEmpty3(o.reason) ? o.reason : void 0;
11077
11391
  if (o.state === "mounted") {
11078
11392
  if (contract === void 0)
11079
11393
  return;
@@ -11082,7 +11396,7 @@ function readEffectiveMemoryScopes(v2) {
11082
11396
  if (typeof row2 != "object" || row2 === null)
11083
11397
  continue;
11084
11398
  let r = row2;
11085
- !nonEmpty2(r.scope) || typeof r.origin != "string" || !ORIGINS.has(r.origin) || scopes.push({ scope: r.scope, origin: r.origin });
11399
+ !nonEmpty3(r.scope) || typeof r.origin != "string" || !ORIGINS.has(r.origin) || scopes.push({ scope: r.scope, origin: r.origin });
11086
11400
  }
11087
11401
  return { state: "mounted", contract, scopes, writeScope: o.writeScope };
11088
11402
  }
@@ -11090,7 +11404,7 @@ function readEffectiveMemoryScopes(v2) {
11090
11404
  if (o.state === "memoryless") {
11091
11405
  if (reason !== "mount-failed" && reason !== "no-backend")
11092
11406
  return;
11093
- let residue = reason === "mount-failed" && Array.isArray(o.materializedResidue) ? o.materializedResidue.filter(nonEmpty2) : void 0;
11407
+ let residue = reason === "mount-failed" && Array.isArray(o.materializedResidue) ? o.materializedResidue.filter(nonEmpty3) : void 0;
11094
11408
  return {
11095
11409
  state: "memoryless",
11096
11410
  reason,
@@ -11104,9 +11418,9 @@ function readEffectiveMemoryScopes(v2) {
11104
11418
  return { state: "none", reason, scopes: [], writeScope: null };
11105
11419
  }
11106
11420
  }
11107
- var nonEmpty2, STATES, ORIGINS, init_effectiveFacts = __esm({
11421
+ var nonEmpty3, STATES, ORIGINS, init_effectiveFacts = __esm({
11108
11422
  "node_modules/@sema-agent/client-core/dist/effectiveFacts.js"() {
11109
- nonEmpty2 = (v2) => typeof v2 == "string" && v2.length > 0;
11423
+ nonEmpty3 = (v2) => typeof v2 == "string" && v2.length > 0;
11110
11424
  STATES = /* @__PURE__ */ new Set(["mounted", "memoryless", "none"]), ORIGINS = /* @__PURE__ */ new Set(["deployment", "request"]);
11111
11425
  }
11112
11426
  });
@@ -11483,6 +11797,7 @@ var ENGINE_NOTICE_CODES, CATALOG, ENGINE_NOTICE_AUDIENCE, MCP_INJECTION_DROP_REA
11483
11797
  "config.task_root_not_canonical",
11484
11798
  // core 7.20.1(0.71.4 提货,#853 C-R55):写保护判官只判拼写(spelling-only)又挂了受保护写工具 ⇒ 每 run 一条;顺序同源(紧跟 task_root_not_canonical)。
11485
11799
  "config.write_protection_target_view_absent",
11800
+ "config.write_protection_unresolved",
11486
11801
  "config.execution_env_capability_invalid",
11487
11802
  "config.tool_card_undeclared",
11488
11803
  "config.tool_face_undeclared",
@@ -11562,6 +11877,7 @@ var ENGINE_NOTICE_CODES, CATALOG, ENGINE_NOTICE_AUDIENCE, MCP_INJECTION_DROP_REA
11562
11877
  "config.artifact_host_invalid": "operator",
11563
11878
  "config.task_root_not_canonical": "operator",
11564
11879
  "config.write_protection_target_view_absent": "operator",
11880
+ "config.write_protection_unresolved": "operator",
11565
11881
  "config.execution_env_capability_invalid": "operator",
11566
11882
  "config.tool_card_undeclared": "operator",
11567
11883
  "config.tool_face_undeclared": "operator",
@@ -13544,7 +13860,9 @@ function errorResult(ctx, parts) {
13544
13860
  ...parts.degraded !== void 0 ? { degraded: parts.degraded } : {},
13545
13861
  // ADAPTER-F4:具名 additive 位(见 `ErrorResultParts.salvagedResult`)。展开的是**一个已知键**,
13546
13862
  // 覆写不到上面任何一个不变量;要加第二个位必须动这里,而动这里在 diff 里显形。
13547
- ...parts.salvagedResult !== void 0 ? { result: parts.salvagedResult } : {}
13863
+ ...parts.salvagedResult !== void 0 ? { result: parts.salvagedResult } : {},
13864
+ // CC-50:结局不知道的稀疏标记(见 `ErrorResultParts.outcomeUnknown`);真终局帧永不带。
13865
+ ...parts.outcomeUnknown === !0 ? { _sema_outcome: "unknown" } : {}
13548
13866
  });
13549
13867
  }
13550
13868
  function doneToSdkResult(ev, ctx, observed) {
@@ -13588,9 +13906,17 @@ function doneToSdkResult(ev, ctx, observed) {
13588
13906
  ]
13589
13907
  });
13590
13908
  }
13591
- return terminal?.kind === "unknown" ? errorResult(ctx, {
13909
+ return terminal == null ? errorResult(ctx, {
13592
13910
  ...errorBase,
13593
13911
  subtype: "error_during_execution",
13912
+ outcomeUnknown: !0,
13913
+ errors: [
13914
+ "run ended with no terminal record \u2014 outcome unknown, not a failure verdict (this client cannot tell whether the run succeeded; treat the result as unverified)"
13915
+ ]
13916
+ }) : terminal?.kind === "unknown" ? errorResult(ctx, {
13917
+ ...errorBase,
13918
+ subtype: "error_during_execution",
13919
+ outcomeUnknown: !0,
13594
13920
  errors: [
13595
13921
  terminal.message ?? (terminal.word !== void 0 ? `run ended with terminal cause "${terminal.word}" (not a success; this CLI predates that terminal word)` : (
13596
13922
  // 🔴 因由座在场却整个读不出(坏形 / 混合载体)—— 说的是「读不出」,不是「没有终局」,
@@ -13737,11 +14063,25 @@ function isGovernanceStopRowText(text2) {
13737
14063
  return t2.startsWith(`${RUN_STOPPED_MESSAGE_PREFIX}:`) || t2.startsWith(`${RUN_BLOCKED_MESSAGE_PREFIX}`);
13738
14064
  }
13739
14065
  function isModelOutputErrorText(text2) {
13740
- return text2.includes("tool call argument(s) not valid JSON") || text2.includes("tool call(s) arrived with no tool name and cannot be executed");
14066
+ let anchors = ["tool call argument(s) not valid JSON", "tool call(s) arrived with no tool name and cannot be executed"], t2 = text2.trimStart();
14067
+ return anchors.some((a) => t2.startsWith(a));
13741
14068
  }
13742
14069
  function isModelOutputErrorRowText(text2) {
13743
14070
  return text2.trimStart().startsWith(`${MODEL_OUTPUT_ERROR_PREFIX}:`);
13744
14071
  }
14072
+ function syntheticTerminalRow(ctx, text2) {
14073
+ return {
14074
+ session_id: ctx.sessionId ?? "",
14075
+ uuid: `err-${Date.now().toString(36)}`,
14076
+ type: "assistant",
14077
+ message: { role: "assistant", model: "<synthetic>", content: [{ type: "text", text: text2 }] },
14078
+ parent_tool_use_id: null,
14079
+ isApiErrorMessage: !0
14080
+ };
14081
+ }
14082
+ function isOutcomeUnknownRowText(text2) {
14083
+ return text2.trimStart().startsWith(`${OUTCOME_UNKNOWN_ROW_PREFIX}:`);
14084
+ }
13745
14085
  function isGovernanceTerminal(input) {
13746
14086
  return input.status === "blocked" || isLimitsExceededCode(input.errorCode) ? !0 : input.errorCode === OUTPUT_INVALID;
13747
14087
  }
@@ -13908,18 +14248,7 @@ your provider caps max_tokens lower \u2014 lower it in /model (press m, or M to
13908
14248
  // 0.72.8 CC-43:第二条中性臂 —— 模型输出坏了(core 原句锚),不是 API 错误;busy / 治理两臂优先(结构位赢过文本锚)。
13909
14249
  `${MODEL_OUTPUT_ERROR_PREFIX}: ${errText3}${maxTokHint}`
13910
14250
  ) : `API Error: ${errText3}${maxTokHint}`;
13911
- yield {
13912
- session_id: ctx.sessionId ?? "",
13913
- uuid: `err-${Date.now().toString(36)}`,
13914
- type: "assistant",
13915
- // [2084]③:message 内部要有判别哨兵——外层 isApiErrorMessage/err- uuid 只护住读信封的
13916
- // 消费者,而转录回喂/摘要器/评分器读的是 message 本体,没有 in-message 标记就会把这句
13917
- // 引擎文案当成模型自己说的话。CC 2.1.220 同款哨兵 = model:'<synthetic>'(下游投影层对
13918
- // string 型 model 原样保留,不再回填真模型名)。
13919
- message: { role: "assistant", model: "<synthetic>", content: [{ type: "text", text: rowText }] },
13920
- parent_tool_use_id: null,
13921
- isApiErrorMessage: !0
13922
- };
14251
+ yield syntheticTerminalRow(ctx, rowText);
13923
14252
  }
13924
14253
  if (ev.type === "done" && isReviewPark(doneTerminal) && ctx.emitChrome)
13925
14254
  try {
@@ -13930,7 +14259,12 @@ your provider caps max_tokens lower \u2014 lower it in /model (press m, or M to
13930
14259
  let doneStats = ev.result?.stats, costFacts = readRunCostFacts(doneStats, { usageMissingObserved });
13931
14260
  costFacts !== void 0 && emitChromeFireAndForget(ctx, { kind: "run_cost_reconciled", laneProof: MAIN2, ...costFacts.reconcile });
13932
14261
  }
13933
- yield terminalToSdkResult(ev, ctx, { usageMissingObserved, nestedUsageByTask });
14262
+ let resultFrame = terminalToSdkResult(ev, ctx, { usageMissingObserved, nestedUsageByTask });
14263
+ if (resultFrame._sema_outcome === "unknown") {
14264
+ let errs = resultFrame.errors, sentence = Array.isArray(errs) && typeof errs[0] == "string" ? errs[0] : "the run ended without a terminal record this client can read";
14265
+ yield syntheticTerminalRow(ctx, `${OUTCOME_UNKNOWN_ROW_PREFIX}: ${sentence}`);
14266
+ }
14267
+ yield resultFrame;
13934
14268
  return;
13935
14269
  }
13936
14270
  let projection = eventToSdkMessage(ev, ctx);
@@ -13941,7 +14275,7 @@ your provider caps max_tokens lower \u2014 lower it in /model (press m, or M to
13941
14275
  projection.kind === "dropped" && reportDroppedFrame(projection.why, projection.type, ctx);
13942
14276
  }
13943
14277
  }
13944
- var MAIN2, RUN_STOPPED_MESSAGE_PREFIX, RUN_BLOCKED_MESSAGE_PREFIX, MODEL_OUTPUT_ERROR_PREFIX, reportedDroppedTypes, DROPPED_TYPE_MEMO_CAP, DROPPED_TYPE_DISPLAY_CAP, DROPPED_WHY_SENTENCE, DROPPED_WHY_SENTENCE_DEFAULT, inFlightTurns, init_runStream = __esm({
14278
+ var MAIN2, RUN_STOPPED_MESSAGE_PREFIX, RUN_BLOCKED_MESSAGE_PREFIX, MODEL_OUTPUT_ERROR_PREFIX, OUTCOME_UNKNOWN_ROW_PREFIX, reportedDroppedTypes, DROPPED_TYPE_MEMO_CAP, DROPPED_TYPE_DISPLAY_CAP, DROPPED_WHY_SENTENCE, DROPPED_WHY_SENTENCE_DEFAULT, inFlightTurns, init_runStream = __esm({
13945
14279
  "node_modules/@sema-agent/client-core/dist/adapter/runStream.js"() {
13946
14280
  init_types();
13947
14281
  init_eventToSdkMessage();
@@ -13953,6 +14287,7 @@ var MAIN2, RUN_STOPPED_MESSAGE_PREFIX, RUN_BLOCKED_MESSAGE_PREFIX, MODEL_OUTPUT_
13953
14287
  MAIN2 = { lane: "main" };
13954
14288
  RUN_STOPPED_MESSAGE_PREFIX = "Run stopped", RUN_BLOCKED_MESSAGE_PREFIX = "Run blocked";
13955
14289
  MODEL_OUTPUT_ERROR_PREFIX = "Model output error";
14290
+ OUTCOME_UNKNOWN_ROW_PREFIX = "Outcome unknown";
13956
14291
  reportedDroppedTypes = /* @__PURE__ */ new Set(), DROPPED_TYPE_MEMO_CAP = 64, DROPPED_TYPE_DISPLAY_CAP = 60;
13957
14292
  DROPPED_WHY_SENTENCE = Object.freeze({
13958
14293
  duplicate_seq: "a frame with this event id was already consumed on this run stream, so it was dropped as a replay (durable idempotency, contract 02 \xA71.1). If the engine reuses an id across two DIFFERENT frames (server 7.77.0 does this for `reasoning_end`, fixed upstream in 7.78.1), the second one is lost here \u2014 this line is the only trace.",
@@ -14336,9 +14671,11 @@ async function runningChoiceArm(taskId, status3, busy, statusFromWire, runs, dep
14336
14671
  if (!injected && runningChoiceDeclined.has(declineKey))
14337
14672
  return { kind: "not-parked", taskId, status: status3, alreadyOffered: !0 };
14338
14673
  let choice = "wait", offerDelivered = !1;
14339
- if (injected)
14674
+ if (injected) {
14675
+ if (probeCallerAborted())
14676
+ return notParked;
14340
14677
  choice = "steer";
14341
- else if (typeof offer == "function")
14678
+ } else if (typeof offer == "function")
14342
14679
  try {
14343
14680
  choice = await offer({ taskId, status: status3, canSteer, canCancel }) ?? "wait", offerDelivered = !0;
14344
14681
  } catch {
@@ -14404,6 +14741,8 @@ function activeRunSelfHealRow(outcome, signal, copy2, origin2, follow) {
14404
14741
  }
14405
14742
  function injectedSubmissionRow(outcome, following = !1) {
14406
14743
  let handle2 = "taskId" in outcome && outcome.taskId ? ` (run ${outcome.taskId})` : "";
14744
+ if (outcome.kind === "running-steer-failed")
14745
+ return outcome.delivery === "unknown" ? `A system notification was handed to the run that is already working${handle2}, but the engine did not confirm delivery (${outcome.detail}) \u2014 that run may or may not have received it; sema did not retry (a steer cannot be re-sent safely). Watch that run for what it does next.` : `A system notification was NOT delivered: the engine refused it for the run that is already working${handle2} (${outcome.detail}); sema did not retry. The model was not told about it.`;
14407
14746
  switch (selfHealSubmissionDisposition(outcome)) {
14408
14747
  case "held-for-decision":
14409
14748
  return `A system notification could not be delivered while an earlier turn${handle2} is waiting on a decision \u2014 sema kept it queued and will deliver it after you answer the open card.`;
@@ -14877,14 +15216,14 @@ var ensured, init_scratchpadWireCaps = __esm({
14877
15216
 
14878
15217
  // node_modules/@sema-agent/client-core/dist/argvFlagValue.js
14879
15218
  function lastFlagValue(argv, name, onMissingValue = "invalidate") {
14880
- let eq2 = `${name}=`, present = !1, raw2, valueMissing = !1;
15219
+ let eq2 = `${name}=`, present2 = !1, raw2, valueMissing = !1;
14881
15220
  for (let i = 0; i < argv.length; i++) {
14882
15221
  let a = argv[i];
14883
15222
  if (a !== void 0) {
14884
15223
  if (a === "--")
14885
15224
  break;
14886
15225
  if (a === name) {
14887
- present = !0;
15226
+ present2 = !0;
14888
15227
  let nxt = argv[i + 1];
14889
15228
  if (nxt === void 0 || nxt.startsWith("-")) {
14890
15229
  if (onMissingValue === "latch-previous")
@@ -14893,10 +15232,10 @@ function lastFlagValue(argv, name, onMissingValue = "invalidate") {
14893
15232
  continue;
14894
15233
  }
14895
15234
  valueMissing = !1, raw2 = nxt, i++;
14896
- } else a.startsWith(eq2) && (present = !0, valueMissing = !1, raw2 = a.slice(eq2.length));
15235
+ } else a.startsWith(eq2) && (present2 = !0, valueMissing = !1, raw2 = a.slice(eq2.length));
14897
15236
  }
14898
15237
  }
14899
- return present ? valueMissing || raw2 === void 0 ? { present: !0 } : { present: !0, raw: raw2 } : { present: !1 };
15238
+ return present2 ? valueMissing || raw2 === void 0 ? { present: !0 } : { present: !0, raw: raw2 } : { present: !1 };
14900
15239
  }
14901
15240
  var init_argvFlagValue = __esm({
14902
15241
  "node_modules/@sema-agent/client-core/dist/argvFlagValue.js"() {
@@ -16642,10 +16981,11 @@ function resumeContextUnavailableFromError(err8) {
16642
16981
  };
16643
16982
  }
16644
16983
  function resumeContextUnavailableContent(d4) {
16984
+ let sec = d4.staleAfterSec, retention = typeof sec == "number" && Number.isSafeInteger(sec) && sec >= 1 ? `(\u672C\u90E8\u7F72\u7684\u4F1A\u8BDD\u4FDD\u7559\u65F6\u957F\u4E3A ${sec} \u79D2)` : "";
16645
16985
  return [
16646
16986
  "\u8FD9\u4E2A\u6279\u51C6\u65E0\u5904\u6295\u9012:\u53D1\u8D77\u8FD9\u6B21\u8FD0\u884C\u7684\u4F1A\u8BDD\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u4E0A\u4E0B\u6587\u6765\u7EE7\u7EED\u5B83",
16647
16987
  "\u4EC0\u4E48\u90FD\u6CA1\u6709\u88AB\u51B3\u5B9A,\u4F60\u7684\u51B3\u5B9A\u6CA1\u6709\u88AB\u6D88\u8D39,\u8FD9\u5F20\u5361\u4ECD\u5728\u7B49\u5F85",
16648
- d4.runId !== void 0 ? "\u9519\u8BEF\u91CC\u5E26\u4E86\u8FD9\u6761\u8FD0\u884C\u7684 id,\u8BF7\u7528\u5B83\u81EA\u5DF1\u6062\u590D\u8FD9\u6761\u8FD0\u884C\u518D\u51B3;\u8C03\u5927\u4F1A\u8BDD\u4FDD\u7559\u65F6\u957F\u53EA\u80FD\u907F\u514D\u4EE5\u540E\u518D\u53D1\u751F,\u6551\u4E0D\u56DE\u8FD9\u4E00\u6B21" : "\u9519\u8BEF\u91CC\u6CA1\u6709\u5E26\u8FD0\u884C id,\u8BF7\u56DE\u5230\u8FD0\u884C\u5217\u8868\u627E\u5230\u8FD9\u6761\u8FD0\u884C\u81EA\u5DF1\u6062\u590D\u5B83\u518D\u51B3;\u8C03\u5927\u4F1A\u8BDD\u4FDD\u7559\u65F6\u957F\u53EA\u80FD\u907F\u514D\u4EE5\u540E\u518D\u53D1\u751F,\u6551\u4E0D\u56DE\u8FD9\u4E00\u6B21"
16988
+ (d4.runId !== void 0 ? "\u9519\u8BEF\u91CC\u5E26\u4E86\u8FD9\u6761\u8FD0\u884C\u7684 id,\u8BF7\u7528\u5B83\u81EA\u5DF1\u6062\u590D\u8FD9\u6761\u8FD0\u884C\u518D\u51B3;\u8C03\u5927\u4F1A\u8BDD\u4FDD\u7559\u65F6\u957F\u53EA\u80FD\u907F\u514D\u4EE5\u540E\u518D\u53D1\u751F,\u6551\u4E0D\u56DE\u8FD9\u4E00\u6B21" : "\u9519\u8BEF\u91CC\u6CA1\u6709\u5E26\u8FD0\u884C id,\u8BF7\u56DE\u5230\u8FD0\u884C\u5217\u8868\u627E\u5230\u8FD9\u6761\u8FD0\u884C\u81EA\u5DF1\u6062\u590D\u5B83\u518D\u51B3;\u8C03\u5927\u4F1A\u8BDD\u4FDD\u7559\u65F6\u957F\u53EA\u80FD\u907F\u514D\u4EE5\u540E\u518D\u53D1\u751F,\u6551\u4E0D\u56DE\u8FD9\u4E00\u6B21") + retention
16649
16989
  ].join(" \xB7 ");
16650
16990
  }
16651
16991
  var RESUME_REFUSAL_CODES, init_resumeRefusalCopy = __esm({
@@ -16749,7 +17089,7 @@ var isoNow, init_sessionMap = __esm({
16749
17089
  function headlessDetachDisabledByEnv(env6 = hostEnv()) {
16750
17090
  return envFlagOff(env6[HEADLESS_DETACH_ENV]);
16751
17091
  }
16752
- async function engineSupportsDetach(baseUrl, opts) {
17092
+ async function probeEngineDetachSupport(baseUrl, opts) {
16753
17093
  let fetchImpl = opts?.fetchImpl ?? fetch, controller = new AbortController(), timer4 = setTimeout(() => controller.abort(), opts?.timeoutMs ?? 1500);
16754
17094
  try {
16755
17095
  let res = await fetchImpl(`${baseUrl.replace(/\/+$/, "")}/health`, {
@@ -16757,15 +17097,27 @@ async function engineSupportsDetach(baseUrl, opts) {
16757
17097
  signal: controller.signal
16758
17098
  });
16759
17099
  if (!res.ok)
16760
- return !0;
16761
- let body = await res.json(), version4 = typeof body?.version == "string" ? body.version : void 0;
16762
- return versionSupportsDetach(version4);
17100
+ return "unknown";
17101
+ let body = await res.json();
17102
+ if (body === null || typeof body != "object" || Array.isArray(body))
17103
+ return "unknown";
17104
+ if (!("version" in body))
17105
+ return "unsupported";
17106
+ let version4 = body.version;
17107
+ return typeof version4 != "string" || !/^\d+\.\d+\.\d+/.test(version4) ? "unknown" : versionSupportsDetach(version4) ? "supported" : "unsupported";
16763
17108
  } catch {
16764
- return !0;
17109
+ return "unknown";
16765
17110
  } finally {
16766
17111
  clearTimeout(timer4);
16767
17112
  }
16768
17113
  }
17114
+ function detachSupportDisclosure(support) {
17115
+ if (support === "unknown")
17116
+ return "could not confirm whether this engine supports detach (its /health did not answer usably); sending the detach header anyway \u2014 it is harmless on the wire, and a dead engine fails the request loudly";
17117
+ }
17118
+ async function engineSupportsDetach(baseUrl, opts) {
17119
+ return await probeEngineDetachSupport(baseUrl, opts) !== "unsupported";
17120
+ }
16769
17121
  async function resolveHeadlessDetach(baseUrl, env6 = hostEnv(), opts) {
16770
17122
  return headlessDetachDisabledByEnv(env6) ? { on: !1, reason: "env-off" } : env6.SEMA_ENGINE_URL && !await engineSupportsDetach(baseUrl, opts) ? { on: !1, reason: "old-engine" } : { on: !0, reason: "default-on" };
16771
17123
  }
@@ -16823,10 +17175,16 @@ function coerceRunStatus(s) {
16823
17175
  case "parked":
16824
17176
  return "parked";
16825
17177
  // 前向预挂(见上方族头注):词真到了就原样透出,绝不折成「在跑」
16826
- default:
17178
+ case "queued":
16827
17179
  return "running";
17180
+ // 无 run 级 queued 词,排队按活跃渲(正向证据:引擎说它在队里)
17181
+ default:
17182
+ return "unknown";
16828
17183
  }
16829
17184
  }
17185
+ function runStatusWithLegEvidence(coerced, agents3) {
17186
+ return coerced !== "unknown" ? coerced : agents3.some((a) => a.state === "start" || a.state === "progress" || a.state === "queued") ? "running" : "unknown";
17187
+ }
16830
17188
  function coercePhaseStatus(s) {
16831
17189
  switch (s) {
16832
17190
  case "done":
@@ -16841,8 +17199,10 @@ function coercePhaseStatus(s) {
16841
17199
  case "parked":
16842
17200
  return "parked";
16843
17201
  // 前向预挂,同 coerceRunStatus
16844
- default:
17202
+ case "running":
16845
17203
  return "running";
17204
+ default:
17205
+ return "unknown";
16846
17206
  }
16847
17207
  }
16848
17208
  function coerceAgentState(s) {
@@ -16968,15 +17328,23 @@ function projectPhases(run2, agents3) {
16968
17328
  ];
16969
17329
  }
16970
17330
  function bucketStatus(bucket) {
16971
- return bucket.some((a) => a.state === "error") ? "failed" : bucket.length > 0 && bucket.every((a) => a.state === "done") ? "done" : bucket.some((a) => a.state === "parked") && bucket.every((a) => a.state === "parked" || a.state === "done") ? "parked" : "running";
17331
+ return bucket.some((a) => a.state === "error") ? "failed" : bucket.length > 0 && bucket.every((a) => a.state === "done") ? "done" : bucket.some((a) => a.state === "parked") && bucket.every((a) => a.state === "parked" || a.state === "done") ? "parked" : bucket.some((a) => a.state === "start" || a.state === "progress" || a.state === "queued") ? "running" : "unknown";
16972
17332
  }
16973
17333
  function synthPhaseStatus(runStatus, agents3) {
16974
- return runStatus === "completed" ? "done" : runStatus === "parked" || bucketStatus(agents3) === "parked" ? "parked" : runStatus === "failed" ? "failed" : "running";
17334
+ if (runStatus === "completed")
17335
+ return "done";
17336
+ if (runStatus === "parked")
17337
+ return "parked";
17338
+ let derived = bucketStatus(agents3);
17339
+ return derived === "parked" ? "parked" : runStatus === "failed" || derived === "failed" ? "failed" : runStatus === "running" || runStatus === "queued" || derived === "running" ? "running" : "unknown";
16975
17340
  }
16976
17341
  function projectWorkflowRun(run2) {
16977
17342
  let parks = readWorkflowParks(run2), agents3 = (run2.agents ?? []).map((r, i) => projectAgent(r, i)), phases = projectPhases(run2, agents3), ownTokens = run2.stats?.tokens ?? 0, nestedTokens = run2.stats?.nested?.tokens ?? 0, totalTokens = run2.stats?.tokens != null || run2.stats?.nested?.tokens != null ? ownTokens + nestedTokens : agents3.reduce((s, a) => s + (a.tokens ?? 0), 0), state5 = {
16978
17343
  workflowRunId: run2.id,
16979
- status: coerceRunStatus(run2.status),
17344
+ // 0.72.12 CC-51(异源对抗复审 R2 [medium]):run 状态词认不出 / 缺席时先看腿上的**活跃证据** —— 有腿在跑 / 排队 ⇒ running
17345
+ // (老壳用 `status === 'running'` 算 workflowActive,run 落 unknown 会把明明在跑的腿渲成 Stopped);零证据才 unknown。
17346
+ // 不拿「腿全做完了」反推 run 完成:那是 run 自己的话。
17347
+ status: runStatusWithLegEvidence(coerceRunStatus(run2.status), agents3),
16980
17348
  // CC-12(0.69.1):park 两新键**进视图**(修前只出读器,端拿不到裸体 ⇒ 渲染面结构性造不出);铸法与缺席律逐字同两读器。
16981
17349
  ...parks !== void 0 ? { parks } : {},
16982
17350
  ...readWorkflowResumeAdmissionIncomplete(run2) ? { resumeAdmissionIncomplete: !0 } : {},
@@ -19090,6 +19458,9 @@ function denyReasonForWire(reason, tag2) {
19090
19458
  let cut = trimmed3.slice(0, MAX_DENY_REASON_CHARS), last4 = cut.charCodeAt(cut.length - 1);
19091
19459
  return last4 >= 55296 && last4 <= 56319 && (cut = cut.slice(0, -1)), hostLog("debug", `hitlBridge: reason for ${tag2} truncated ${trimmed3.length}\u2192${cut.length} chars (server caps approval reason at ${MAX_DENY_REASON_CHARS}; over-cap is a 413 reason_too_large that would drop the DECISION, not just the reason)`), cut;
19092
19460
  }
19461
+ function isPlanReviewModeAfter(v2) {
19462
+ return v2 !== void 0 && PLAN_REVIEW_MODE_AFTER_WORDS.includes(v2);
19463
+ }
19093
19464
  function readDecideCurrentPending(e) {
19094
19465
  let raw2 = e?.currentPending;
19095
19466
  if (typeof raw2 != "object" || raw2 === null)
@@ -19170,13 +19541,14 @@ function backendDeny(reason) {
19170
19541
  decisionReason: { type: "asyncAgent", reason }
19171
19542
  };
19172
19543
  }
19173
- var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, HitlSafetyError, DECIDE_TRANSPORT_RETRY_BACKOFF_MS, DECIDE_RETRY_BACKOFF_MAX_MS, DECIDE_ATTEMPT_TIMEOUT_CAP_MS, DECIDE_TIMEOUT_MIN_ATTEMPTS, DECIDE_TIMEOUT_RETRY_BUDGET_ATTEMPT_MULTIPLE, DECIDE_TIMEOUT_RETRY_TOTAL_BUDGET_MS, decideTimeoutRetryBudgetOverrideMs, TRANSIENT_NETWORK_CODES, DecideTransportRetryExhaustedError, ANY_TOOL_FAMILY, HitlBridge, init_hitlBridge = __esm({
19544
+ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, PLAN_REVIEW_MODE_AFTER_WORDS, HitlSafetyError, DECIDE_TRANSPORT_RETRY_BACKOFF_MS, DECIDE_RETRY_BACKOFF_MAX_MS, DECIDE_ATTEMPT_TIMEOUT_CAP_MS, DECIDE_TIMEOUT_MIN_ATTEMPTS, DECIDE_TIMEOUT_RETRY_BUDGET_ATTEMPT_MULTIPLE, DECIDE_TIMEOUT_RETRY_TOTAL_BUDGET_MS, decideTimeoutRetryBudgetOverrideMs, TRANSIENT_NETWORK_CODES, DecideTransportRetryExhaustedError, ANY_TOOL_FAMILY, HitlBridge, init_hitlBridge = __esm({
19174
19545
  "node_modules/@sema-agent/client-core/dist/hitl/hitlBridge.js"() {
19175
19546
  init_activeRunSelfHeal();
19176
19547
  init_types();
19177
19548
  init_host();
19178
19549
  init_abortableSleep();
19179
19550
  DEFAULT_DENY_REASON = "The user rejected this tool use", MAX_DENY_REASON_CHARS = 4096;
19551
+ PLAN_REVIEW_MODE_AFTER_WORDS = Object.freeze(["default", "acceptEdits"]);
19180
19552
  HitlSafetyError = class extends Error {
19181
19553
  code;
19182
19554
  constructor(message, code2) {
@@ -19365,8 +19737,15 @@ var DEFAULT_DENY_REASON, MAX_DENY_REASON_CHARS, HitlSafetyError, DECIDE_TRANSPOR
19365
19737
  throw new HitlSafetyError('plan-review "edit" requires a non-empty editedPlan', "bad_plan_edit");
19366
19738
  } else if (outcome.editedPlan !== void 0)
19367
19739
  throw new HitlSafetyError(`plan-review "${outcome.decision}" must NOT carry editedPlan`, "bad_plan_edit");
19740
+ let modeAfter = outcome.permissionModeAfter;
19741
+ if (modeAfter !== void 0) {
19742
+ if (outcome.decision !== "approve")
19743
+ throw new HitlSafetyError(`plan-review "${outcome.decision}" must NOT carry permissionModeAfter (it only applies to an approval)`, "bad_plan_mode");
19744
+ if (!isPlanReviewModeAfter(modeAfter))
19745
+ throw new HitlSafetyError('plan-review permissionModeAfter must be "default" or "acceptEdits"', "bad_plan_mode");
19746
+ }
19368
19747
  let req2 = { decision: outcome.decision };
19369
- if (outcome.decision === "edit" && outcome.editedPlan !== void 0 && (req2.editedPlan = outcome.editedPlan), outcome.reason !== void 0) {
19748
+ if (modeAfter !== void 0 && isPlanReviewModeAfter(modeAfter) && (req2.permissionModeAfter = modeAfter), outcome.decision === "edit" && outcome.editedPlan !== void 0 && (req2.editedPlan = outcome.editedPlan), outcome.reason !== void 0) {
19370
19749
  let r = denyReasonForWire(outcome.reason, `plan-review ${this.taskId}`);
19371
19750
  r !== void 0 && (req2.reason = r);
19372
19751
  }
@@ -21030,6 +21409,8 @@ var MAX_GATE_HOPS, MAX_TRANSPORT_REATTACHES, MAX_TOTAL_PARKS, MAX_ALREADY_RESOLV
21030
21409
  "binding_mismatch",
21031
21410
  "wrong_gate",
21032
21411
  "bad_plan_edit",
21412
+ /** 0.72.13 CC-46:plan-review 的 permissionModeAfter 坏形(非 approve 带这一位 / 词表外)被本地拦下。 */
21413
+ "bad_plan_mode",
21033
21414
  /** FIX②:空作答被本地拦下(空 answers[] / 空 selected[] / 空 header)。 */
21034
21415
  "empty_answer"
21035
21416
  ];
@@ -21253,15 +21634,45 @@ var armedGatesByKey, armedListenersByKey, planReviewGenByKey, notedPlanReviewIds
21253
21634
  });
21254
21635
 
21255
21636
  // node_modules/@sema-agent/client-core/dist/hitl/planReviewWire.js
21256
- function planReviewDecisionFromAnswer(answer) {
21257
- let selected = answer?.answers?.[0]?.selected?.[0];
21258
- return selected === APPROVE_LABEL ? "approve" : selected === REJECT_LABEL ? "reject" : "dismissed";
21637
+ function versionSupportsPlanReviewModeAfter(v2) {
21638
+ let mm = v2 ? /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(v2) : null;
21639
+ if (!mm)
21640
+ return "unknown";
21641
+ let got = [Number(mm[1]), Number(mm[2]), Number(mm[3])];
21642
+ for (let i = 0; i < 3; i++) {
21643
+ let g6 = got[i], need = PLAN_REVIEW_MODE_AFTER_MIN_ENGINE[i];
21644
+ if (g6 !== need)
21645
+ return g6 > need ? "supported" : "unsupported";
21646
+ }
21647
+ return "supported";
21648
+ }
21649
+ function planReviewDecisionFromAnswer(answer, shownLabels) {
21650
+ let choice = planReviewChoiceFromAnswer(answer, shownLabels);
21651
+ return choice === "dismissed" ? "dismissed" : choice.decision;
21652
+ }
21653
+ function planReviewChoiceFromAnswer(answer, shownLabels = LEGACY_TWO_CHOICE_LABELS) {
21654
+ let answers = answer?.answers;
21655
+ if (!Array.isArray(answers) || answers.length !== 1)
21656
+ return "dismissed";
21657
+ let picked = answers[0]?.selected;
21658
+ if (!Array.isArray(picked) || picked.length !== 1)
21659
+ return "dismissed";
21660
+ let selected = picked[0];
21661
+ return typeof selected != "string" || !shownLabels.includes(selected) ? "dismissed" : selected === PLAN_REVIEW_APPROVE_AUTO_LABEL ? { decision: "approve", permissionModeAfter: "acceptEdits" } : selected === PLAN_REVIEW_APPROVE_MANUAL_LABEL ? { decision: "approve", permissionModeAfter: "default" } : selected === APPROVE_LABEL ? { decision: "approve" } : selected === REJECT_LABEL ? { decision: "reject" } : "dismissed";
21662
+ }
21663
+ function planReviewCardOptions(offerModeAfter) {
21664
+ let reject3 = { label: REJECT_LABEL, description: "Discard this plan and stay in plan mode to refine it" };
21665
+ return offerModeAfter ? [
21666
+ { label: PLAN_REVIEW_APPROVE_AUTO_LABEL, description: "Resume and execute the plan; edits inside the working directory are not asked about one by one" },
21667
+ { label: PLAN_REVIEW_APPROVE_MANUAL_LABEL, description: "Resume and execute the plan; every edit still asks for approval" },
21668
+ reject3
21669
+ ] : [{ label: APPROVE_LABEL, description: "Resume the task now and execute the plan (runs to completion engine-side)" }, reject3];
21259
21670
  }
21260
21671
  function notePlanReviewAnsweredIfDecisive(questionId, answer) {
21261
21672
  notePlanReviewAnsweredIfDecisiveFor(DEFAULT_SESSION_KEY, questionId, answer);
21262
21673
  }
21263
21674
  function notePlanReviewAnsweredIfDecisiveFor(sessionKey, questionId, answer) {
21264
- planReviewDecisionFromAnswer(answer ?? { answers: [] }) !== "dismissed" && notePlanReviewAnsweredFor(sessionKey, questionId);
21675
+ planReviewDecisionFromAnswer(answer ?? { answers: [] }, ALL_KNOWN_LABELS) !== "dismissed" && notePlanReviewAnsweredFor(sessionKey, questionId);
21265
21676
  }
21266
21677
  function isPlanReviewPark(result) {
21267
21678
  let read = readRunTerminal(result);
@@ -21271,17 +21682,15 @@ function isPlanReviewPark(result) {
21271
21682
  return typeof taskId == "string" && taskId.length > 0;
21272
21683
  }
21273
21684
  function _resetArmedPlanReviewsForTest() {
21274
- armedPlanReviewTaskIds.clear();
21685
+ armedPlanReviewTaskIds.clear(), offerModeAfterByTask.clear();
21275
21686
  }
21276
- function planReviewQuestions(question) {
21687
+ function planReviewQuestions(question, offerModeAfter = !1) {
21277
21688
  return [
21278
21689
  {
21279
21690
  header: "Plan review",
21280
21691
  question,
21281
- options: [
21282
- { label: APPROVE_LABEL, description: "Resume the task now and execute the plan (runs to completion engine-side)" },
21283
- { label: REJECT_LABEL, description: "Discard this plan and stay in plan mode to refine it" }
21284
- ],
21692
+ // 选项单源 `planReviewCardOptions`:老两选逐字同旧;三选只在 arm 的双闸都过时出(重开腿恒老两选 = 批准不带键 ⇒ default)。
21693
+ options: planReviewCardOptions(offerModeAfter),
21285
21694
  multiSelect: !1
21286
21695
  }
21287
21696
  ];
@@ -21290,10 +21699,10 @@ function publishPlanReviewCard(taskId) {
21290
21699
  publishQuestionFrame({
21291
21700
  type: "question",
21292
21701
  questionId: planReviewQuestionId(taskId),
21293
- questions: planReviewQuestions(ARM_QUESTION)
21702
+ questions: planReviewQuestions(ARM_QUESTION, offerModeAfterByTask.get(taskId) === !0)
21294
21703
  });
21295
21704
  }
21296
- function armPlanReviewApproval(result, sessionKey) {
21705
+ function armPlanReviewApproval(result, sessionKey, opts) {
21297
21706
  let armedTaskId;
21298
21707
  try {
21299
21708
  if (!isPlanReviewPark(result))
@@ -21308,20 +21717,25 @@ function armPlanReviewApproval(result, sessionKey) {
21308
21717
  return hostLog("debug", `planReviewWire: arm replayed \u2014 re-presenting the still-armed card for task ${taskId}`), publishPlanReviewCard(taskId), !0;
21309
21718
  hostLog("debug", `planReviewWire: stale armed state for task ${taskId} (no local responder) \u2014 re-arming from scratch`), armedPlanReviewTaskIds.delete(taskId);
21310
21719
  }
21311
- armedPlanReviewTaskIds.add(taskId), armedTaskId = taskId;
21720
+ armedPlanReviewTaskIds.add(taskId), armedTaskId = taskId, opts?.submittedInPlanMode === !0 && versionSupportsPlanReviewModeAfter(engineCapString(engineWireTarget()?.baseUrl, "version")) === "supported" ? offerModeAfterByTask.set(taskId, !0) : offerModeAfterByTask.delete(taskId);
21312
21721
  let questionId = planReviewQuestionId(taskId), unregister = registerLocalQuestionResponder(questionId, async (_id, answer) => {
21313
21722
  unregister(), armedPlanReviewTaskIds.delete(taskId);
21314
- let decided = planReviewDecisionFromAnswer(answer);
21315
- return decided === "dismissed" ? { ok: !0 } : (notePlanReviewAnswered(questionId), decidePlanReview(taskId, decided), { ok: !0 });
21723
+ let shown = planReviewCardOptions(offerModeAfterByTask.get(taskId) === !0).map((o) => o.label), choice = planReviewChoiceFromAnswer(answer, shown);
21724
+ if (choice === "dismissed")
21725
+ return { ok: !0 };
21726
+ let decided = choice.decision, modeAfter = choice.decision === "approve" ? choice.permissionModeAfter : void 0;
21727
+ return offerModeAfterByTask.delete(taskId), notePlanReviewAnswered(questionId), decidePlanReview(taskId, decided, modeAfter), { ok: !0 };
21316
21728
  });
21317
21729
  return publishPlanReviewCard(taskId), hostLog("debug", `planReviewWire: approval card armed for parked plan (task ${taskId})`), !0;
21318
21730
  } catch (e) {
21319
- return armedTaskId !== void 0 && armedPlanReviewTaskIds.delete(armedTaskId), hostLog("debug", `planReviewWire: arm failed (fail-soft): ${String(e)}`), !1;
21731
+ return armedTaskId !== void 0 && (armedPlanReviewTaskIds.delete(armedTaskId), offerModeAfterByTask.delete(armedTaskId)), hostLog("debug", `planReviewWire: arm failed (fail-soft): ${String(e)}`), !1;
21320
21732
  }
21321
21733
  }
21322
- async function decidePlanReview(taskId, decision) {
21734
+ async function decidePlanReview(taskId, decision, permissionModeAfter) {
21323
21735
  let outcome, cfg = engineWireTarget();
21324
- if (!cfg)
21736
+ if (permissionModeAfter !== void 0 && (decision !== "approve" || !isPlanReviewModeAfter(permissionModeAfter)))
21737
+ hostLog("error", `planReviewWire: ${decision} NOT sent \u2014 permissionModeAfter is only valid with approve and must be "default" or "acceptEdits"`), outcome = `The plan_review ${decision} could NOT be sent: the post-approval permission mode given with it is not valid for this decision (it only applies to an approval, and must be "default" or "acceptEdits"). Tell the user plainly that the decision did not go through; the plan is still waiting.`;
21738
+ else if (!cfg)
21325
21739
  hostLog("error", `planReviewWire: ${decision} NOT sent \u2014 engineWireTarget() unavailable`), outcome = `The plan_review ${decision} could NOT be sent: no engine connection is configured on this host. Tell the user plainly that the decision did not go through.`;
21326
21740
  else {
21327
21741
  let client3 = makeEngineWireClient({
@@ -21334,7 +21748,18 @@ async function decidePlanReview(taskId, decision) {
21334
21748
  hostLog("error", `planReviewWire: ${decision} NOT sent \u2014 makeEngineWireClient() returned null`), outcome = `The plan_review ${decision} could NOT be sent: the engine client could not be constructed. Tell the user plainly that the decision did not go through.`;
21335
21749
  else
21336
21750
  try {
21337
- let body = await client3.assistant.planReview(taskId, { decision });
21751
+ let mode = isPlanReviewModeAfter(permissionModeAfter) ? permissionModeAfter : void 0, reqBody = { decision };
21752
+ mode !== void 0 && (reqBody.permissionModeAfter = mode);
21753
+ let body;
21754
+ try {
21755
+ body = await client3.assistant.planReview(taskId, reqBody);
21756
+ } catch (e1) {
21757
+ let conflict = e1;
21758
+ if (mode === "default" && conflict?.status === 400 && conflict?.errorCode === "request.field_conflict")
21759
+ hostLog("debug", 'planReviewWire: permissionModeAfter "default" refused as not applicable \u2014 re-sending the approval without the key (same meaning)'), body = await client3.assistant.planReview(taskId, { decision });
21760
+ else
21761
+ throw e1;
21762
+ }
21338
21763
  hostLog("debug", `planReviewWire: ${decision} \u2192 ok ${JSON.stringify(body).slice(0, 200)}`);
21339
21764
  let postStatus;
21340
21765
  try {
@@ -21351,8 +21776,10 @@ async function decidePlanReview(taskId, decision) {
21351
21776
  let effective = postStatus ?? (typeof body?.status == "string" ? body.status : void 0);
21352
21777
  effective === "needs_review" ? outcome = `The plan_review ${decision} returned HTTP 200 but the session is STILL locked on the same review gate (post-decide status: needs_review). The decision did NOT take effect (known engine issue, RB-471 family). Tell the user plainly that the ${decision} did not go through; the reliable exits today are approving the plan or cancelling the task.` : effective === "suspended" ? outcome = `The plan was ${decision === "approve" ? "approved" : "rejected"} and the task advanced to a NEW approval gate (post-decide status: suspended) \u2014 the next approval card will surface it; this is not a completion yet.` : effective !== void 0 ? outcome = `The plan was ${decision === "approve" ? "approved and the parked task resumed to completion" : "rejected (plan discarded)"} \u2014 final status: ${effective} (post-decide re-checked: task left the review gate).` : outcome = `The plan was ${decision === "approve" ? "approved and the parked task resumed to completion" : "rejected (plan discarded)"} \u2014 final status: unknown (post-decide verification unavailable; treat as unconfirmed).`;
21353
21778
  } catch (e) {
21354
- let status3 = e?.status;
21355
- if (typeof status3 == "number") {
21779
+ let status3 = e?.status, refusedCode = e?.errorCode;
21780
+ if (status3 === 400 && refusedCode === "request.field_conflict" && permissionModeAfter === "acceptEdits")
21781
+ hostLog("debug", "planReviewWire: approve + acceptEdits refused (request.field_conflict) \u2014 NOT re-sent with a different mode"), outcome = 'The plan approval was NOT applied: the engine refused "auto-accept edits" for this task (it was not started read-only in plan mode, so that option does not apply). Nothing changed engine-side \u2014 the plan is still waiting for review. Tell the user plainly, and that approving with "manually approve edits" will go through.';
21782
+ else if (typeof status3 == "number") {
21356
21783
  let msg = e instanceof Error ? e.message : String(e);
21357
21784
  hostLog("debug", `planReviewWire: ${decision} \u2192 ${status3} ${msg.slice(0, 200)}`), outcome = `The plan_review decision failed: HTTP ${status3} ${msg}`.trim();
21358
21785
  } else
@@ -21403,13 +21830,14 @@ function reopenPlanReviewCard(taskId, opts) {
21403
21830
  return publishQuestionFrameFor(sessionKey, {
21404
21831
  type: "question",
21405
21832
  questionId: canonicalId,
21406
- questions: planReviewQuestions(ARM_QUESTION)
21833
+ questions: planReviewQuestions(ARM_QUESTION, offerModeAfterByTask.get(taskId) === !0)
21407
21834
  }), settleOnReceipt(receipt, firstSight);
21408
21835
  }
21409
21836
  return publishQuestionFrameFor(sessionKey, {
21410
21837
  type: "question",
21411
21838
  questionId: canonicalId,
21412
- questions: planReviewQuestions(ARM_QUESTION)
21839
+ // 🔴 沿用 arm responder ⇒ 题面必须是**那张卡**的选项(三选 arm 后重绘成两选 = 屏上的 Yes 不在 responder 的读域里,点了不投递)
21840
+ questions: planReviewQuestions(ARM_QUESTION, offerModeAfterByTask.get(taskId) === !0)
21413
21841
  }), registerArmedGateFor(sessionKey, armedKey), { reopened: !0, firstSight };
21414
21842
  }
21415
21843
  retireActiveReopen(sessionKey, canonicalId), unregisterLocalQuestionResponder(canonicalId) && hostLog("debug", `planReviewWire: reopen retired the canonical responder for task ${taskId} (single-active discipline)`), publishQuestionFrameFor(sessionKey, { type: "question_complete", questionId: canonicalId });
@@ -21417,7 +21845,7 @@ function reopenPlanReviewCard(taskId, opts) {
21417
21845
  decidePlanReview(tid, decision);
21418
21846
  }), activeKey = `${sessionKey}\0${canonicalId}`, unregister = registerLocalQuestionResponder(questionId, async (_id, answer) => {
21419
21847
  unregister(), activeReopenResponders.get(activeKey)?.questionId === questionId && activeReopenResponders.delete(activeKey);
21420
- let decided = planReviewDecisionFromAnswer(answer);
21848
+ let decided = planReviewDecisionFromAnswer(answer, LEGACY_TWO_CHOICE_LABELS);
21421
21849
  if (decided === "dismissed")
21422
21850
  return { ok: !0 };
21423
21851
  notePlanReviewAnsweredFor(sessionKey, questionId);
@@ -21445,20 +21873,28 @@ function reopenPlanReviewCard(taskId, opts) {
21445
21873
  return receiptMs === void 0 ? { reopened: !1 } : Promise.resolve({ reopened: !1 });
21446
21874
  }
21447
21875
  }
21448
- var PLAN_REVIEW_RESUME_TIMEOUT_MS, PLAN_REVIEW_APPROVE_LABEL, PLAN_REVIEW_REJECT_LABEL, APPROVE_LABEL, REJECT_LABEL, armedPlanReviewTaskIds, ARM_QUESTION, REOPEN_QUESTION, activeReopenResponders, init_planReviewWire = __esm({
21876
+ var PLAN_REVIEW_RESUME_TIMEOUT_MS, PLAN_REVIEW_APPROVE_LABEL, PLAN_REVIEW_REJECT_LABEL, PLAN_REVIEW_APPROVE_AUTO_LABEL, PLAN_REVIEW_APPROVE_MANUAL_LABEL, PLAN_REVIEW_MODE_AFTER_MIN_ENGINE, APPROVE_LABEL, REJECT_LABEL, LEGACY_TWO_CHOICE_LABELS, ALL_KNOWN_LABELS, armedPlanReviewTaskIds, offerModeAfterByTask, ARM_QUESTION, REOPEN_QUESTION, activeReopenResponders, init_planReviewWire = __esm({
21449
21877
  "node_modules/@sema-agent/client-core/dist/hitl/planReviewWire.js"() {
21450
21878
  init_liveQuestionStore();
21451
21879
  init_host();
21452
21880
  init_engineWireSdk();
21453
21881
  init_engineWireTarget();
21454
21882
  init_notifications();
21883
+ init_hitlBridge();
21884
+ init_engineCapsCache();
21455
21885
  init_gateIdentity();
21456
21886
  init_armedGateRegistry();
21457
21887
  init_sessionSlot();
21458
21888
  init_activeRunSelfHeal();
21459
21889
  init_runTerminal();
21460
- PLAN_REVIEW_RESUME_TIMEOUT_MS = 360 * 6e4, PLAN_REVIEW_APPROVE_LABEL = "Yes, approve and run the plan", PLAN_REVIEW_REJECT_LABEL = "No, reject it (keep planning)", APPROVE_LABEL = PLAN_REVIEW_APPROVE_LABEL, REJECT_LABEL = PLAN_REVIEW_REJECT_LABEL;
21461
- armedPlanReviewTaskIds = /* @__PURE__ */ new Set();
21890
+ PLAN_REVIEW_RESUME_TIMEOUT_MS = 360 * 6e4, PLAN_REVIEW_APPROVE_LABEL = "Yes, approve and run the plan", PLAN_REVIEW_REJECT_LABEL = "No, reject it (keep planning)", PLAN_REVIEW_APPROVE_AUTO_LABEL = "Yes, and auto-accept edits", PLAN_REVIEW_APPROVE_MANUAL_LABEL = "Yes, and manually approve edits", PLAN_REVIEW_MODE_AFTER_MIN_ENGINE = Object.freeze([7, 86, 0]);
21891
+ APPROVE_LABEL = PLAN_REVIEW_APPROVE_LABEL, REJECT_LABEL = PLAN_REVIEW_REJECT_LABEL, LEGACY_TWO_CHOICE_LABELS = Object.freeze([PLAN_REVIEW_APPROVE_LABEL, PLAN_REVIEW_REJECT_LABEL]), ALL_KNOWN_LABELS = Object.freeze([
21892
+ PLAN_REVIEW_APPROVE_AUTO_LABEL,
21893
+ PLAN_REVIEW_APPROVE_MANUAL_LABEL,
21894
+ PLAN_REVIEW_APPROVE_LABEL,
21895
+ PLAN_REVIEW_REJECT_LABEL
21896
+ ]);
21897
+ armedPlanReviewTaskIds = /* @__PURE__ */ new Set(), offerModeAfterByTask = /* @__PURE__ */ new Map();
21462
21898
  ARM_QUESTION = "The plan is ready for review. Approve it and start the implementation?", REOPEN_QUESTION = "This plan is still waiting for your review \u2014 it is what is holding this session. Approve it and start the implementation?";
21463
21899
  activeReopenResponders = /* @__PURE__ */ new Map();
21464
21900
  }
@@ -22015,7 +22451,7 @@ function readCrashConvergedRow(v2) {
22015
22451
  put(k2, d4.value);
22016
22452
  }
22017
22453
  }
22018
- if (!nonEmptyString2(o.approvalId) || !isString(o.toolName) || !isString(o.taskId) || !isNumber(o.ts) || !isNumber(o.expiresAtMs) || !isNumber(o.convergedAtMs) || typeof o.resumeSafe != "boolean" || o.decision !== "denied" || o.cause !== "crashed_before_park" || o.orphanState !== "pending" && o.orphanState !== "decided" || o.sessionId !== void 0 && !isString(o.sessionId) || o.originalDecision !== void 0 && o.originalDecision !== "approve" || o.decidedAtMs !== void 0 && !isNumber(o.decidedAtMs))
22454
+ if (!nonEmptyString3(o.approvalId) || !isString(o.toolName) || !isString(o.taskId) || !isNumber(o.ts) || !isNumber(o.expiresAtMs) || !isNumber(o.convergedAtMs) || typeof o.resumeSafe != "boolean" || o.decision !== "denied" || o.cause !== "crashed_before_park" || o.orphanState !== "pending" && o.orphanState !== "decided" || o.sessionId !== void 0 && !isString(o.sessionId) || o.originalDecision !== void 0 && o.originalDecision !== "approve" || o.decidedAtMs !== void 0 && !isNumber(o.decidedAtMs))
22019
22455
  return null;
22020
22456
  let delivered = {};
22021
22457
  for (let k2 of Object.keys(o))
@@ -22056,9 +22492,9 @@ function projectCrashConverged(env6) {
22056
22492
  }
22057
22493
  return { total: resumeSafe.length + needsHuman.length, resumeSafe, needsHuman, dropped: dropped2 };
22058
22494
  }
22059
- var isString, isNumber, nonEmptyString2, ownDataValue, init_crashConverged = __esm({
22495
+ var isString, isNumber, nonEmptyString3, ownDataValue, init_crashConverged = __esm({
22060
22496
  "node_modules/@sema-agent/client-core/dist/hitl/crashConverged.js"() {
22061
- isString = (v2) => typeof v2 == "string", isNumber = (v2) => typeof v2 == "number", nonEmptyString2 = (v2) => typeof v2 == "string" && v2.length > 0, ownDataValue = (obj2, key) => {
22497
+ isString = (v2) => typeof v2 == "string", isNumber = (v2) => typeof v2 == "number", nonEmptyString3 = (v2) => typeof v2 == "string" && v2.length > 0, ownDataValue = (obj2, key) => {
22062
22498
  let d4 = Object.getOwnPropertyDescriptor(obj2, key);
22063
22499
  if (!(d4 === void 0 || "get" in d4 || "set" in d4))
22064
22500
  return d4.value;
@@ -22883,11 +23319,11 @@ function isoToEpochMs(iso) {
22883
23319
  let ms = Date.parse(iso);
22884
23320
  return Number.isFinite(ms) ? ms : void 0;
22885
23321
  }
22886
- function nonEmptyString3(v2) {
23322
+ function nonEmptyString4(v2) {
22887
23323
  return typeof v2 == "string" && v2 !== "" ? v2 : void 0;
22888
23324
  }
22889
23325
  function assistantTaskToBackgroundRow(t2) {
22890
- let wire = t2, updatedAtMs = isoToEpochMs(t2.updatedAt), createdAtMs = isoToEpochMs(t2.createdAt), name = nonEmptyString3(wire.name), sessionId = nonEmptyString3(t2.sessionId);
23326
+ let wire = t2, updatedAtMs = isoToEpochMs(t2.updatedAt), createdAtMs = isoToEpochMs(t2.createdAt), name = nonEmptyString4(wire.name), sessionId = nonEmptyString4(t2.sessionId);
22891
23327
  return {
22892
23328
  key: { source: "assistant", taskId: t2.taskId },
22893
23329
  status: backgroundStatusFromAssistant(t2.status),
@@ -22959,7 +23395,7 @@ function createBackgroundView(client3, opts) {
22959
23395
  async function pullAssistant() {
22960
23396
  try {
22961
23397
  let { tasks: tasks3 } = await client3.assistant.tasks({ signal: abort.signal });
22962
- return { health: capsApprovals === !1 ? "not-configured" : "ok", tasks: tasks3 ?? [] };
23398
+ return Array.isArray(tasks3) ? { health: capsApprovals === !1 ? "not-configured" : "ok", tasks: tasks3 } : { health: "unavailable", tasks: [] };
22963
23399
  } catch (err8) {
22964
23400
  return debugLog2(`assistant.tasks degrade: ${String(err8)}`), { health: capsApprovals === !1 || isNotImplemented(err8) ? "not-configured" : "unavailable", tasks: [] };
22965
23401
  }
@@ -22967,7 +23403,7 @@ function createBackgroundView(client3, opts) {
22967
23403
  async function pullFleet() {
22968
23404
  try {
22969
23405
  let { tasks: tasks3 } = await client3.fleet.snapshot({ signal: abort.signal });
22970
- return { health: "ok", tasks: tasks3 ?? [] };
23406
+ return Array.isArray(tasks3) ? { health: "ok", tasks: tasks3 } : { health: "unavailable", tasks: [] };
22971
23407
  } catch (err8) {
22972
23408
  return debugLog2(`fleet.snapshot degrade: ${String(err8)}`), { health: isNotImplemented(err8) ? "not-configured" : "unavailable", tasks: [] };
22973
23409
  }
@@ -23917,6 +24353,8 @@ __export(dist_exports, {
23917
24353
  IDLE_FLUSH_MS: () => IDLE_FLUSH_MS,
23918
24354
  INTERACTIVE_WAY_OUT: () => INTERACTIVE_WAY_OUT,
23919
24355
  INTERNAL_SDK_ARM_TYPES: () => INTERNAL_SDK_ARM_TYPES,
24356
+ LEADER_REJ_HEAD_DISPLAY_MAX: () => LEADER_REJ_HEAD_DISPLAY_MAX,
24357
+ LEADER_RUN_STATUSES: () => LEADER_RUN_STATUSES,
23920
24358
  LIMITS_MAX_COST_EXCEEDED: () => LIMITS_MAX_COST_EXCEEDED,
23921
24359
  LIMITS_MAX_TOKENS_EXCEEDED: () => LIMITS_MAX_TOKENS_EXCEEDED,
23922
24360
  LIMITS_MAX_TURNS_EXCEEDED: () => LIMITS_MAX_TURNS_EXCEEDED,
@@ -23944,6 +24382,8 @@ __export(dist_exports, {
23944
24382
  MAX_TURNS_MIN: () => MAX_TURNS_MIN,
23945
24383
  MCP_CAPS: () => MCP_CAPS,
23946
24384
  MCP_INJECTION_DROP_REASONS: () => MCP_INJECTION_DROP_REASONS,
24385
+ MCP_RECONNECT_OUTCOMES: () => MCP_RECONNECT_OUTCOMES,
24386
+ MCP_RECONNECT_TRANSACTION_NOTICE: () => MCP_RECONNECT_TRANSACTION_NOTICE,
23947
24387
  MCP_REDIAL_OUTCOMES: () => MCP_REDIAL_OUTCOMES,
23948
24388
  MCP_SERVER_REVOKED: () => MCP_SERVER_REVOKED,
23949
24389
  MEMORY_CAPTURE_OFF: () => MEMORY_CAPTURE_OFF,
@@ -23953,6 +24393,7 @@ __export(dist_exports, {
23953
24393
  MODEL_FAMILIES: () => MODEL_FAMILIES,
23954
24394
  MODEL_OUTPUT_ERROR_PREFIX: () => MODEL_OUTPUT_ERROR_PREFIX,
23955
24395
  MODEL_PROBE_VERDICTS: () => MODEL_PROBE_VERDICTS,
24396
+ OUTCOME_UNKNOWN_ROW_PREFIX: () => OUTCOME_UNKNOWN_ROW_PREFIX,
23956
24397
  OUTPUT_INVALID: () => OUTPUT_INVALID,
23957
24398
  PANEL_TOOLUSES_LANE_POLICY: () => PANEL_TOOLUSES_LANE_POLICY,
23958
24399
  PEER_FRAME_LANES: () => PEER_FRAME_LANES,
@@ -23961,9 +24402,13 @@ __export(dist_exports, {
23961
24402
  PERMISSION_RULE_ISSUE_CODES: () => PERMISSION_RULE_ISSUE_CODES,
23962
24403
  PERSISTED_RULE_BEHAVIORS: () => PERSISTED_RULE_BEHAVIORS,
23963
24404
  PERSISTED_RULE_BEHAVIOR_UNKNOWN: () => PERSISTED_RULE_BEHAVIOR_UNKNOWN,
24405
+ PLAN_REVIEW_APPROVE_AUTO_LABEL: () => PLAN_REVIEW_APPROVE_AUTO_LABEL,
23964
24406
  PLAN_REVIEW_APPROVE_LABEL: () => PLAN_REVIEW_APPROVE_LABEL,
24407
+ PLAN_REVIEW_APPROVE_MANUAL_LABEL: () => PLAN_REVIEW_APPROVE_MANUAL_LABEL,
23965
24408
  PLAN_REVIEW_GATE_KIND: () => PLAN_REVIEW_GATE_KIND,
23966
24409
  PLAN_REVIEW_GATE_KINDS: () => PLAN_REVIEW_GATE_KINDS,
24410
+ PLAN_REVIEW_MODE_AFTER_MIN_ENGINE: () => PLAN_REVIEW_MODE_AFTER_MIN_ENGINE,
24411
+ PLAN_REVIEW_MODE_AFTER_WORDS: () => PLAN_REVIEW_MODE_AFTER_WORDS,
23967
24412
  PLAN_REVIEW_QUESTION_ID_PREFIX: () => PLAN_REVIEW_QUESTION_ID_PREFIX,
23968
24413
  PLAN_REVIEW_REJECT_LABEL: () => PLAN_REVIEW_REJECT_LABEL,
23969
24414
  PLAN_REVIEW_STATES: () => PLAN_REVIEW_STATES,
@@ -24054,6 +24499,7 @@ __export(dist_exports, {
24054
24499
  SUBAGENT_TOOL_NAMES: () => SUBAGENT_TOOL_NAMES,
24055
24500
  SURFACED_TIERS: () => SURFACED_TIERS,
24056
24501
  TASK_AGENT_WIRE_FIELDS: () => TASK_AGENT_WIRE_FIELDS,
24502
+ TASK_NOTIFICATION_TERMINAL_STATUSES: () => TASK_NOTIFICATION_TERMINAL_STATUSES,
24057
24503
  TERMINAL_CAUSE_KINDS: () => TERMINAL_CAUSE_KINDS,
24058
24504
  TERMINAL_FLEET_TASK_STATUSES: () => TERMINAL_FLEET_TASK_STATUSES,
24059
24505
  TERMINAL_RETAIN_MS: () => TERMINAL_RETAIN_MS,
@@ -24086,9 +24532,11 @@ __export(dist_exports, {
24086
24532
  __activeTailCountForTests: () => __activeTailCountForTests,
24087
24533
  __feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
24088
24534
  __resetBgOwnerAbsenceForTests: () => __resetBgOwnerAbsenceForTests,
24535
+ __resetEngineAgentPanelAbsenceForTests: () => __resetEngineAgentPanelAbsenceForTests,
24089
24536
  __resetEngineCapsCacheForTests: () => __resetEngineCapsCacheForTests,
24090
24537
  __resetEngineCompactArmForTests: () => __resetEngineCompactArmForTests,
24091
24538
  __resetEngineDelegatedPromptForTests: () => __resetEngineDelegatedPromptForTests,
24539
+ __resetExecutionLaneReadingsForTests: () => __resetExecutionLaneReadingsForTests,
24092
24540
  __resetFleetLedgerRegistryForTests: () => __resetFleetLedgerRegistryForTests,
24093
24541
  __resetHooksWireCapsForTests: () => __resetHooksWireCapsForTests,
24094
24542
  __resetRetainWithoutWakeWarningForTests: () => __resetRetainWithoutWakeWarningForTests,
@@ -24183,6 +24631,7 @@ __export(dist_exports, {
24183
24631
  classifyAskParkRows: () => classifyAskParkRows,
24184
24632
  classifyHookFailureFrame: () => classifyHookFailureFrame,
24185
24633
  classifyHookNoticeFrame: () => classifyHookNoticeFrame,
24634
+ classifyMcpReconnectFailure: () => classifyMcpReconnectFailure,
24186
24635
  classifyMemoryStatusFailure: () => classifyMemoryStatusFailure,
24187
24636
  classifyPeerNotification: () => classifyPeerNotification,
24188
24637
  classifyRulesFailure: () => classifyRulesFailure,
@@ -24240,6 +24689,7 @@ __export(dist_exports, {
24240
24689
  deriveTranscriptId: () => deriveTranscriptId,
24241
24690
  detachCancelArm: () => detachCancelArm,
24242
24691
  detachDurableOffHint: () => detachDurableOffHint,
24692
+ detachSupportDisclosure: () => detachSupportDisclosure,
24243
24693
  detachedTaskId: () => detachedTaskId,
24244
24694
  detectEngineBgShellReceipt: () => detectEngineBgShellReceipt,
24245
24695
  deviceAuthProviderFor: () => deviceAuthProviderFor,
@@ -24291,6 +24741,7 @@ __export(dist_exports, {
24291
24741
  estimateCjkTokens: () => estimateCjkTokens,
24292
24742
  eventSeq: () => eventSeq,
24293
24743
  eventToSdkMessage: () => eventToSdkMessage,
24744
+ executionLaneDoctorDetail: () => executionLaneDoctorDetail,
24294
24745
  failedToSdkResult: () => failedToSdkResult,
24295
24746
  fetchDelegatedPrompt: () => fetchDelegatedPrompt,
24296
24747
  fetchEngineSubagentReport: () => fetchEngineSubagentReport,
@@ -24309,6 +24760,7 @@ __export(dist_exports, {
24309
24760
  fleetViewStubRowIds: () => fleetViewStubRowIds,
24310
24761
  fmtCtxOut: () => fmtCtxOut,
24311
24762
  fmtTokens: () => fmtTokens,
24763
+ forgetExecutionLaneReading: () => forgetExecutionLaneReading,
24312
24764
  forgetSqlEngineReading: () => forgetSqlEngineReading,
24313
24765
  forgetWebSearchBackendReading: () => forgetWebSearchBackendReading,
24314
24766
  forgetWriteProtectionReading: () => forgetWriteProtectionReading,
@@ -24420,9 +24872,11 @@ __export(dist_exports, {
24420
24872
  isLoopbackWireUrl: () => isLoopbackWireUrl,
24421
24873
  isModelOutputErrorRowText: () => isModelOutputErrorRowText,
24422
24874
  isModelOutputErrorText: () => isModelOutputErrorText,
24875
+ isOutcomeUnknownRowText: () => isOutcomeUnknownRowText,
24423
24876
  isOwnEngineRun: () => isOwnEngineRun,
24424
24877
  isOwnWorkflowRun: () => isOwnWorkflowRun,
24425
24878
  isParkSlaExpiredGate: () => isParkSlaExpiredGate,
24879
+ isPlanReviewModeAfter: () => isPlanReviewModeAfter,
24426
24880
  isPlanReviewPark: () => isPlanReviewPark,
24427
24881
  isPreStreamDrainingReject: () => isPreStreamDrainingReject,
24428
24882
  isResumeAtRejection: () => isResumeAtRejection,
@@ -24436,6 +24890,7 @@ __export(dist_exports, {
24436
24890
  isSubFlowSegmentEnd: () => isSubFlowSegmentEnd,
24437
24891
  isSupportedCatalogSchemaVersion: () => isSupportedCatalogSchemaVersion,
24438
24892
  isTaskNotificationObjective: () => isTaskNotificationObjective,
24893
+ isTaskNotificationTerminalStatus: () => isTaskNotificationTerminalStatus,
24439
24894
  isTerminalCauseKind: () => isTerminalCauseKind,
24440
24895
  isTerminalNotSuccess: () => isTerminalNotSuccess,
24441
24896
  isTerminalStatus: () => isTerminalStatus,
@@ -24449,6 +24904,7 @@ __export(dist_exports, {
24449
24904
  isWorkflowCompletionCardEnqueued: () => isWorkflowCompletionCardEnqueued,
24450
24905
  isWorkflowParkRefusalCode: () => isWorkflowParkRefusalCode,
24451
24906
  kickEngineCapsProbe: () => kickEngineCapsProbe,
24907
+ leaderConflictDetail: () => leaderConflictDetail,
24452
24908
  limitsForPrint: () => limitsForPrint,
24453
24909
  listAllPersistedRules: () => listAllPersistedRules,
24454
24910
  listNotifiedRuns: () => listNotifiedRuns,
@@ -24471,6 +24927,7 @@ __export(dist_exports, {
24471
24927
  mcpEngineLegPresence: () => mcpEngineLegPresence,
24472
24928
  mcpNamespace: () => mcpNamespace,
24473
24929
  mcpPanelLastLegDetail: () => mcpPanelLastLegDetail,
24930
+ mcpReconnectOutcomeDetail: () => mcpReconnectOutcomeDetail,
24474
24931
  memoryCaptureDeclarationField: () => memoryCaptureDeclarationField,
24475
24932
  memoryOffDeclarationField: () => memoryOffDeclarationField,
24476
24933
  memoryOffDeclared: () => memoryOffDeclared,
@@ -24487,6 +24944,7 @@ __export(dist_exports, {
24487
24944
  normalizeTaskNotification: () => normalizeTaskNotification,
24488
24945
  normalizeWirePrincipal: () => normalizeWirePrincipal,
24489
24946
  noteBgOwnerAbsence: () => noteBgOwnerAbsence,
24947
+ noteEngineCapsForExecutionLane: () => noteEngineCapsForExecutionLane,
24490
24948
  noteEngineCapsForSqlEngine: () => noteEngineCapsForSqlEngine,
24491
24949
  noteEngineCapsForWebSearchBackend: () => noteEngineCapsForWebSearchBackend,
24492
24950
  noteEngineCapsForWriteProtection: () => noteEngineCapsForWriteProtection,
@@ -24499,6 +24957,7 @@ __export(dist_exports, {
24499
24957
  notificationDropCounters: () => notificationDropCounters,
24500
24958
  notificationQueuePortMisses: () => notificationQueuePortMisses,
24501
24959
  observeCancelByDeny: () => observeCancelByDeny,
24960
+ observedExecutionLane: () => observedExecutionLane,
24502
24961
  observedSqlEngine: () => observedSqlEngine,
24503
24962
  observedWebSearchBackend: () => observedWebSearchBackend,
24504
24963
  observedWriteProtection: () => observedWriteProtection,
@@ -24542,6 +25001,8 @@ __export(dist_exports, {
24542
25001
  planModeExplicitlyRequested: () => planModeExplicitlyRequested,
24543
25002
  planReviewArmedKey: () => planReviewArmedKey,
24544
25003
  planReviewArmedKeyFor: () => planReviewArmedKeyFor,
25004
+ planReviewCardOptions: () => planReviewCardOptions,
25005
+ planReviewChoiceFromAnswer: () => planReviewChoiceFromAnswer,
24545
25006
  planReviewDecisionFromAnswer: () => planReviewDecisionFromAnswer,
24546
25007
  planReviewQuestionId: () => planReviewQuestionId,
24547
25008
  planSubagentViewSlots: () => planSubagentViewSlots,
@@ -24551,6 +25012,7 @@ __export(dist_exports, {
24551
25012
  precheckEditedRuleText: () => precheckEditedRuleText,
24552
25013
  prepareTaskAgentsWireWith: () => prepareTaskAgentsWireWith,
24553
25014
  probeEngineAlive: () => probeEngineAlive,
25015
+ probeEngineDetachSupport: () => probeEngineDetachSupport,
24554
25016
  probeHealth: () => probeHealth,
24555
25017
  probeModelCapability: () => probeModelCapability,
24556
25018
  probeRequestBody: () => probeRequestBody,
@@ -24561,9 +25023,13 @@ __export(dist_exports, {
24561
25023
  projectDescription: () => projectDescription,
24562
25024
  projectDiagnosticsFrame: () => projectDiagnosticsFrame,
24563
25025
  projectEffectiveBody: () => projectEffectiveBody,
25026
+ projectExecutionLaneCapability: () => projectExecutionLaneCapability,
24564
25027
  projectFleetAgentRows: () => projectFleetAgentRows,
24565
25028
  projectFleetAgentRowsFor: () => projectFleetAgentRowsFor,
25029
+ projectLeaderConflict: () => projectLeaderConflict,
24566
25030
  projectMcpPanel: () => projectMcpPanel,
25031
+ projectMcpReconnectCapability: () => projectMcpReconnectCapability,
25032
+ projectMcpReconnectResult: () => projectMcpReconnectResult,
24567
25033
  projectMcpSection: () => projectMcpSection,
24568
25034
  projectReadFacePosture: () => projectReadFacePosture,
24569
25035
  projectRewind: () => projectRewind,
@@ -24586,6 +25052,7 @@ __export(dist_exports, {
24586
25052
  providerCatalogRowDetail: () => providerCatalogRowDetail,
24587
25053
  providerCatalogRows: () => providerCatalogRows,
24588
25054
  providerPresetById: () => providerPresetById,
25055
+ publishEngineAgentPanelAbsence: () => publishEngineAgentPanelAbsence,
24589
25056
  publishEngineAgentPanelEvent: () => publishEngineAgentPanelEvent,
24590
25057
  publishEngineInlineTaskTick: () => publishEngineInlineTaskTick,
24591
25058
  publishQuestionFrame: () => publishQuestionFrame,
@@ -24594,6 +25061,7 @@ __export(dist_exports, {
24594
25061
  pushSubagentLocalEcho: () => pushSubagentLocalEcho,
24595
25062
  readAskUnresolvable: () => readAskUnresolvable,
24596
25063
  readAsyncLaunchedAgentReceipt: () => readAsyncLaunchedAgentReceipt,
25064
+ readAutoConsolidationArmed: () => readAutoConsolidationArmed,
24597
25065
  readCancelRequested: () => readCancelRequested,
24598
25066
  readCaptureOptOut: () => readCaptureOptOut,
24599
25067
  readCcImportRedeemCounts: () => readCcImportRedeemCounts,
@@ -24627,6 +25095,7 @@ __export(dist_exports, {
24627
25095
  readWorkflowActivityLedger: () => readWorkflowActivityLedger,
24628
25096
  readWorkflowParks: () => readWorkflowParks,
24629
25097
  readWorkflowResumeAdmissionIncomplete: () => readWorkflowResumeAdmissionIncomplete,
25098
+ reconnectMcpServer: () => reconnectMcpServer,
24630
25099
  recordBgParentRun: () => recordBgParentRun,
24631
25100
  recordBgTerminalFacts: () => recordBgTerminalFacts,
24632
25101
  recordEngineToolLabel: () => recordEngineToolLabel,
@@ -24746,6 +25215,7 @@ __export(dist_exports, {
24746
25215
  subagentResumeAvailable: () => subagentResumeAvailable,
24747
25216
  subagentUsageIsPartial: () => subagentUsageIsPartial,
24748
25217
  subscribeEngineAgentPanel: () => subscribeEngineAgentPanel,
25218
+ subscribeEngineAgentPanelAbsence: () => subscribeEngineAgentPanelAbsence,
24749
25219
  subscribeEngineInlineTaskStats: () => subscribeEngineInlineTaskStats,
24750
25220
  subscribeOutstandingWorkflows: () => subscribeOutstandingWorkflows,
24751
25221
  subscribeSubagentContent: () => subscribeSubagentContent,
@@ -24780,6 +25250,7 @@ __export(dist_exports, {
24780
25250
  toolPermissionRequestIdDomain: () => toolPermissionRequestIdDomain,
24781
25251
  toolRosterNames: () => toolRosterNames,
24782
25252
  toolShimFromRoster: () => toolShimFromRoster,
25253
+ toolsRunHereFromExecutionLane: () => toolsRunHereFromExecutionLane,
24783
25254
  turnEndUsage: () => turnEndUsage,
24784
25255
  turnUsageToModelUsage: () => turnUsageToModelUsage,
24785
25256
  ultracodeForRequest: () => ultracodeForRequest,
@@ -24794,6 +25265,7 @@ __export(dist_exports, {
24794
25265
  validateWebSearchChoice: () => validateWebSearchChoice,
24795
25266
  versionSupportsDetach: () => versionSupportsDetach,
24796
25267
  versionSupportsLimits: () => versionSupportsLimits,
25268
+ versionSupportsPlanReviewModeAfter: () => versionSupportsPlanReviewModeAfter,
24797
25269
  waitForClaimRelease: () => waitForClaimRelease,
24798
25270
  waitForGateArmed: () => waitForGateArmed,
24799
25271
  waitForGateArmedFor: () => waitForGateArmedFor,
@@ -24841,6 +25313,9 @@ var init_dist = __esm({
24841
25313
  init_sqlEngineCapability();
24842
25314
  init_writeProtectionCapability();
24843
25315
  init_webSearchBackendCapability();
25316
+ init_executionLaneCapability();
25317
+ init_mcpReconnect();
25318
+ init_leaderConflict();
24844
25319
  init_runTerminal();
24845
25320
  init_readFacePosture();
24846
25321
  init_mcpPanel();
@@ -25096,11 +25571,12 @@ function publishEngineContextUsage(frame) {
25096
25571
  }, lastFrameSessionId = currentSessionIdOrNull3());
25097
25572
  }
25098
25573
  function noteEngineCompaction(record3) {
25099
- let preTokens = finiteOrUndefined(record3.preTokens), postTokens = finiteOrUndefined(record3.postTokens), trigger = typeof record3.trigger == "string" && record3.trigger.length > 0 ? record3.trigger : void 0;
25574
+ let preTokens = finiteOrUndefined(record3.preTokens), postTokens = finiteOrUndefined(record3.postTokens), triggerTokensBefore = finiteOrUndefined(record3.triggerTokensBefore), trigger = typeof record3.trigger == "string" && record3.trigger.length > 0 ? record3.trigger : void 0;
25100
25575
  lastCompaction = {
25101
25576
  atMs: record3.atMs ?? Date.now(),
25102
25577
  ...preTokens !== void 0 ? { preTokens } : {},
25103
25578
  ...postTokens !== void 0 ? { postTokens } : {},
25579
+ ...triggerTokensBefore !== void 0 ? { triggerTokensBefore } : {},
25104
25580
  ...trigger !== void 0 ? { trigger } : {}
25105
25581
  }, lastCompactionSessionId = currentSessionIdOrNull3();
25106
25582
  }
@@ -62342,9 +62818,9 @@ var require_ms = __commonJS({
62342
62818
  }
62343
62819
  function fmtLong(ms) {
62344
62820
  var msAbs = Math.abs(ms);
62345
- return msAbs >= d4 ? plural7(ms, msAbs, d4, "day") : msAbs >= h ? plural7(ms, msAbs, h, "hour") : msAbs >= m2 ? plural7(ms, msAbs, m2, "minute") : msAbs >= s ? plural7(ms, msAbs, s, "second") : ms + " ms";
62821
+ return msAbs >= d4 ? plural8(ms, msAbs, d4, "day") : msAbs >= h ? plural8(ms, msAbs, h, "hour") : msAbs >= m2 ? plural8(ms, msAbs, m2, "minute") : msAbs >= s ? plural8(ms, msAbs, s, "second") : ms + " ms";
62346
62822
  }
62347
- function plural7(ms, msAbs, n2, name) {
62823
+ function plural8(ms, msAbs, n2, name) {
62348
62824
  var isPlural = msAbs >= n2 * 1.5;
62349
62825
  return Math.round(ms / n2) + " " + name + (isPlural ? "s" : "");
62350
62826
  }
@@ -66676,7 +67152,7 @@ function isLocalPluginSource(source) {
66676
67152
  function isLocalMarketplaceSource(source) {
66677
67153
  return source.source === "file" || source.source === "directory";
66678
67154
  }
66679
- var ALLOWED_OFFICIAL_MARKETPLACE_NAMES, NO_AUTO_UPDATE_OFFICIAL_MARKETPLACES, BLOCKED_OFFICIAL_NAME_PATTERN, NON_ASCII_PATTERN, OFFICIAL_GITHUB_ORG, RelativePath, RelativeJSONPath, McpbPath, RelativeMarkdownPath, RelativeCommandPath, MarketplaceNameSchema, PluginAuthorSchema, PluginManifestMetadataSchema, PluginHooksSchema, PluginManifestHooksSchema, CommandMetadataSchema, PluginManifestCommandsSchema, PluginManifestAgentsSchema, PluginManifestSkillsSchema, PluginManifestOutputStylesSchema, nonEmptyString4, fileExtension, PluginManifestMcpServerSchema, PluginUserConfigOptionSchema, PluginManifestUserConfigSchema, PluginManifestChannelsSchema, LspServerConfigSchema, PluginManifestLspServerSchema, NpmPackageNameSchema, PluginManifestSettingsSchema, PluginManifestSchema, MarketplaceSourceSchema, gitSha, PluginSourceSchema, SettingsMarketplacePluginSchema, PluginRelevanceSignalsSchema, PluginRelevanceSchema, PluginMarketplaceEntrySchema, PluginMarketplaceSchema, PluginIdSchema, DEP_REF_REGEX, DependencyRefSchema, SettingsPluginEntrySchema, InstalledPluginSchema, InstalledPluginsFileSchemaV1, PluginScopeSchema, PluginInstallationEntrySchema, InstalledPluginsFileSchemaV2, InstalledPluginsFileSchema, KnownMarketplaceSchema, KnownMarketplacesFileSchema, init_schemas3 = __esm({
67155
+ var ALLOWED_OFFICIAL_MARKETPLACE_NAMES, NO_AUTO_UPDATE_OFFICIAL_MARKETPLACES, BLOCKED_OFFICIAL_NAME_PATTERN, NON_ASCII_PATTERN, OFFICIAL_GITHUB_ORG, RelativePath, RelativeJSONPath, McpbPath, RelativeMarkdownPath, RelativeCommandPath, MarketplaceNameSchema, PluginAuthorSchema, PluginManifestMetadataSchema, PluginHooksSchema, PluginManifestHooksSchema, CommandMetadataSchema, PluginManifestCommandsSchema, PluginManifestAgentsSchema, PluginManifestSkillsSchema, PluginManifestOutputStylesSchema, nonEmptyString5, fileExtension, PluginManifestMcpServerSchema, PluginUserConfigOptionSchema, PluginManifestUserConfigSchema, PluginManifestChannelsSchema, LspServerConfigSchema, PluginManifestLspServerSchema, NpmPackageNameSchema, PluginManifestSettingsSchema, PluginManifestSchema, MarketplaceSourceSchema, gitSha, PluginSourceSchema, SettingsMarketplacePluginSchema, PluginRelevanceSignalsSchema, PluginRelevanceSchema, PluginMarketplaceEntrySchema, PluginMarketplaceSchema, PluginIdSchema, DEP_REF_REGEX, DependencyRefSchema, SettingsPluginEntrySchema, InstalledPluginSchema, InstalledPluginsFileSchemaV1, PluginScopeSchema, PluginInstallationEntrySchema, InstalledPluginsFileSchemaV2, InstalledPluginsFileSchema, KnownMarketplaceSchema, KnownMarketplacesFileSchema, init_schemas3 = __esm({
66680
67156
  "build-src/src/utils/plugins/schemas.ts"() {
66681
67157
  init_v4();
66682
67158
  init_hooks();
@@ -66865,7 +67341,7 @@ var ALLOWED_OFFICIAL_MARKETPLACE_NAMES, NO_AUTO_UPDATE_OFFICIAL_MARKETPLACES, BL
66865
67341
  )
66866
67342
  ])
66867
67343
  })
66868
- ), nonEmptyString4 = lazySchema(() => external_exports.string().min(1)), fileExtension = lazySchema(
67344
+ ), nonEmptyString5 = lazySchema(() => external_exports.string().min(1)), fileExtension = lazySchema(
66869
67345
  () => external_exports.string().min(2).refine((ext) => ext.startsWith("."), {
66870
67346
  message: 'File extensions must start with dot (e.g., ".ts", not "ts")'
66871
67347
  })
@@ -66946,8 +67422,8 @@ var ALLOWED_OFFICIAL_MARKETPLACE_NAMES, NO_AUTO_UPDATE_OFFICIAL_MARKETPLACES, BL
66946
67422
  ).describe(
66947
67423
  'Command to execute the LSP server (e.g., "typescript-language-server")'
66948
67424
  ),
66949
- args: external_exports.array(nonEmptyString4()).optional().describe("Command-line arguments to pass to the server"),
66950
- extensionToLanguage: external_exports.record(fileExtension(), nonEmptyString4()).refine((record3) => Object.keys(record3).length > 0, {
67425
+ args: external_exports.array(nonEmptyString5()).optional().describe("Command-line arguments to pass to the server"),
67426
+ extensionToLanguage: external_exports.record(fileExtension(), nonEmptyString5()).refine((record3) => Object.keys(record3).length > 0, {
66951
67427
  message: "extensionToLanguage must have at least one mapping"
66952
67428
  }).describe(
66953
67429
  "Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping."
@@ -67666,7 +68142,7 @@ function escapeRegExp(str7) {
67666
68142
  function capitalize(str7) {
67667
68143
  return str7.charAt(0).toUpperCase() + str7.slice(1);
67668
68144
  }
67669
- function plural(n2, word, pluralWord = word + "s") {
68145
+ function plural2(n2, word, pluralWord = word + "s") {
67670
68146
  return n2 === 1 ? word : pluralWord;
67671
68147
  }
67672
68148
  function firstLineOf(s) {
@@ -74891,7 +75367,7 @@ function formatZodError(error51, filePath) {
74891
75367
  issue2.expected === "object" && receivedType === "null" && path28 === "" ? message = "Invalid or malformed JSON" : message = `Expected ${issue2.expected}, but received ${receivedType}`;
74892
75368
  } else if (isUnrecognizedKeysIssue(issue2)) {
74893
75369
  let keys2 = issue2.keys.join(", ");
74894
- message = `Unrecognized ${plural(issue2.keys.length, "field")}: ${keys2}`;
75370
+ message = `Unrecognized ${plural2(issue2.keys.length, "field")}: ${keys2}`;
74895
75371
  } else isTooSmallIssue(issue2) && (message = `Number must be greater than or equal to ${issue2.minimum}`, expected = String(issue2.minimum));
74896
75372
  return {
74897
75373
  file: filePath,
@@ -76108,9 +76584,9 @@ function classifyAnthropicEnvRouting(env6, opts) {
76108
76584
  let catalogPresent = modelCatalogPresent(opts?.configLocalDir), own2 = opts?.ownModelConfig ?? hasOwnModelConfig(env6), CATALOG_WHY = "a model catalog (config.d/models.json) drives routing \u2014 the env override is ignored";
76109
76585
  if (own2) {
76110
76586
  if (catalogPresent) return { kind: "ignored", why: CATALOG_WHY };
76111
- let nonEmpty3 = (v2) => typeof v2 == "string" && v2.length > 0 ? v2 : void 0, explicitProvider = nonEmpty3(env6.MODEL_PROVIDER);
76587
+ let nonEmpty5 = (v2) => typeof v2 == "string" && v2.length > 0 ? v2 : void 0, explicitProvider = nonEmpty5(env6.MODEL_PROVIDER);
76112
76588
  if (explicitProvider === "anthropic") return { kind: "honored", via: "explicit-anthropic-provider" };
76113
- let inferBaseUrl = baseUrl, inferCred = nonEmpty3(env6.ANTHROPIC_API_KEY) ?? authToken;
76589
+ let inferBaseUrl = baseUrl, inferCred = nonEmpty5(env6.ANTHROPIC_API_KEY) ?? authToken;
76114
76590
  return explicitProvider === void 0 && inferBaseUrl && inferCred ? { kind: "honored", via: "engine-inferred-anthropic" } : explicitProvider !== void 0 ? {
76115
76591
  kind: "ignored",
76116
76592
  why: `sema's own model config (MODEL_ID=${env6.MODEL_ID}, explicit MODEL_PROVIDER=${explicitProvider}) drives routing \u2014 the env override is ignored (set MODEL_PROVIDER=anthropic, or unset it so the engine infers anthropic from the base URL + credential)`
@@ -87725,6 +88201,25 @@ var init_dist2 = __esm({
87725
88201
  }
87726
88202
  });
87727
88203
 
88204
+ // build-src/src/sema/servedEndpointEnv.ts
88205
+ function normalizeEndpoint(url3) {
88206
+ return (url3 ?? "").replace(/\/+$/, "");
88207
+ }
88208
+ function servedEndpointEnvKey(api2) {
88209
+ return api2 === "anthropic-messages" ? ANTHROPIC_ENDPOINT_ENV_KEY : GATEWAY_ENDPOINT_ENV_KEY;
88210
+ }
88211
+ function servedEndpointRawValue(api2, env6) {
88212
+ return servedEndpointEnvKey(api2) === GATEWAY_ENDPOINT_ENV_KEY ? env6[GATEWAY_ENDPOINT_ENV_KEY] : env6[ANTHROPIC_ENDPOINT_ENV_KEY] ?? env6[ANTHROPIC_ENDPOINT_ENV_KEY_RETIRED];
88213
+ }
88214
+ function servedEndpointValue(api2, env6) {
88215
+ return normalizeEndpoint(servedEndpointRawValue(api2, env6));
88216
+ }
88217
+ var ANTHROPIC_ENDPOINT_ENV_KEY, GATEWAY_ENDPOINT_ENV_KEY, ANTHROPIC_ENDPOINT_ENV_KEY_RETIRED, init_servedEndpointEnv = __esm({
88218
+ "build-src/src/sema/servedEndpointEnv.ts"() {
88219
+ ANTHROPIC_ENDPOINT_ENV_KEY = "ANTHROPIC_BASE_URL", GATEWAY_ENDPOINT_ENV_KEY = "MODEL_GATEWAY_BASEURL", ANTHROPIC_ENDPOINT_ENV_KEY_RETIRED = "ANTHROPIC_BASEURL";
88220
+ }
88221
+ });
88222
+
87728
88223
  // build-src/src/sema/config/modelsJsonLock.ts
87729
88224
  import { existsSync as existsSync7, mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "node:fs";
87730
88225
  import { dirname as dirname15 } from "node:path";
@@ -88445,7 +88940,7 @@ function readModelPool() {
88445
88940
  }
88446
88941
  let out6 = [];
88447
88942
  if (env6.MODEL_ID) {
88448
- let taken = /* @__PURE__ */ new Set(), api2 = env6.ANTHROPIC_BASEURL || env6.ANTHROPIC_BASE_URL ? "anthropic-messages" : "openai-completions", baseUrl = (api2 === "anthropic-messages" ? env6.ANTHROPIC_BASE_URL ?? env6.ANTHROPIC_BASEURL : env6.MODEL_GATEWAY_BASEURL) ?? "", apiKey = env6.MODEL_API_KEY || env6.ANTHROPIC_AUTH_TOKEN || void 0, mainFam = inferFamily(env6.MODEL_ID), mainCtx = Number(env6.MODEL_CONTEXT_WINDOW) || mainFam?.contextWindow || 2e5;
88943
+ let taken = /* @__PURE__ */ new Set(), api2 = env6.ANTHROPIC_BASEURL || env6.ANTHROPIC_BASE_URL ? "anthropic-messages" : "openai-completions", baseUrl = servedEndpointRawValue(api2, env6) ?? "", apiKey = env6.MODEL_API_KEY || env6.ANTHROPIC_AUTH_TOKEN || void 0, mainFam = inferFamily(env6.MODEL_ID), mainCtx = Number(env6.MODEL_CONTEXT_WINDOW) || mainFam?.contextWindow || 2e5;
88449
88944
  if (out6.push({
88450
88945
  id: poolIdFor(env6.MODEL_ID, "custom", taken),
88451
88946
  modelId: env6.MODEL_ID,
@@ -89062,6 +89557,7 @@ var CHANNEL_LABELS, POOL_EFFORT_DEFAULTS, POOL_PROBE_STATUSES, MODEL_ROLE_KEYS,
89062
89557
  init_dist();
89063
89558
  init_dist2();
89064
89559
  init_providerPresets3();
89560
+ init_servedEndpointEnv();
89065
89561
  init_modelsJsonLock();
89066
89562
  init_tierCore();
89067
89563
  init_modelsDocShape();
@@ -124134,6 +124630,82 @@ var CONTROL_CHARS, FORMAT_AND_SEPARATORS, LONE_SURROGATE, FINGERPRINT_HEX, FINGE
124134
124630
  }
124135
124631
  });
124136
124632
 
124633
+ // build-src/src/sema/appStateRef.ts
124634
+ var appStateRef_exports = {};
124635
+ __export(appStateRef_exports, {
124636
+ fleetRowTaskId: () => rowIdTail,
124637
+ getAppStateStoreRef: () => getAppStateStoreRef,
124638
+ getBootAdditionalDirectories: () => getBootAdditionalDirectories,
124639
+ setAppStateStoreRef: () => setAppStateStoreRef,
124640
+ setBootAdditionalDirectories: () => setBootAdditionalDirectories
124641
+ });
124642
+ function setAppStateStoreRef(store) {
124643
+ g.__semaAppStateStore = store;
124644
+ }
124645
+ function getAppStateStoreRef() {
124646
+ return g.__semaAppStateStore ?? null;
124647
+ }
124648
+ function setBootAdditionalDirectories(dirs) {
124649
+ gDirs.__semaBootAdditionalDirs = [...dirs];
124650
+ }
124651
+ function getBootAdditionalDirectories() {
124652
+ return gDirs.__semaBootAdditionalDirs ?? null;
124653
+ }
124654
+ var g, gDirs, init_appStateRef = __esm({
124655
+ "build-src/src/sema/appStateRef.ts"() {
124656
+ init_dist();
124657
+ g = globalThis;
124658
+ gDirs = globalThis;
124659
+ }
124660
+ });
124661
+
124662
+ // build-src/src/sema/planReviewModeAfterOffer.ts
124663
+ function submittedInPlanMode() {
124664
+ try {
124665
+ return getAppStateStoreRef()?.getState()?.toolPermissionContext?.mode === "plan";
124666
+ } catch (e) {
124667
+ return failOpen("plan-review.submitted-in-plan-mode-unreadable", !1, e instanceof Error ? e.message : String(e));
124668
+ }
124669
+ }
124670
+ function planReviewOffersModeAfterNow(submitted) {
124671
+ if (!submitted) return !1;
124672
+ try {
124673
+ return versionSupportsPlanReviewModeAfter(
124674
+ engineCapString(engineWireTarget()?.baseUrl, "version")
124675
+ ) === "supported";
124676
+ } catch (e) {
124677
+ return failOpen("plan-review.mode-after-version-gate-unreadable", !1, e instanceof Error ? e.message : String(e));
124678
+ }
124679
+ }
124680
+ function notePlanReviewOffer(taskId, offered) {
124681
+ if (taskId.length !== 0 && !(offeredByTaskId.has(taskId) && planReviewCardStillArmed(taskId)))
124682
+ for (offeredByTaskId.set(taskId, offered); offeredByTaskId.size > OFFER_LEDGER_MAX; ) {
124683
+ let oldest = offeredByTaskId.keys().next();
124684
+ if (oldest.done === !0) break;
124685
+ offeredByTaskId.delete(oldest.value);
124686
+ }
124687
+ }
124688
+ function planReviewCardStillArmed(taskId) {
124689
+ try {
124690
+ return hasLocalQuestionResponder(planReviewQuestionId(taskId));
124691
+ } catch (e) {
124692
+ return failOpen("plan-review.armed-state-unreadable", !1, e instanceof Error ? e.message : String(e));
124693
+ }
124694
+ }
124695
+ function planReviewShownLabels(questionId) {
124696
+ if (typeof questionId != "string" || !questionId.startsWith(PLAN_REVIEW_QUESTION_ID_PREFIX)) return;
124697
+ let rest = questionId.slice(PLAN_REVIEW_QUESTION_ID_PREFIX.length);
124698
+ return rest.indexOf("#") >= 0 ? planReviewCardOptions(!1).map((o) => o.label) : planReviewCardOptions(offeredByTaskId.get(rest) === !0).map((o) => o.label);
124699
+ }
124700
+ var OFFER_LEDGER_MAX, offeredByTaskId, init_planReviewModeAfterOffer = __esm({
124701
+ "build-src/src/sema/planReviewModeAfterOffer.ts"() {
124702
+ init_dist();
124703
+ init_appStateRef();
124704
+ init_failOpen();
124705
+ OFFER_LEDGER_MAX = 64, offeredByTaskId = /* @__PURE__ */ new Map();
124706
+ }
124707
+ });
124708
+
124137
124709
  // build-src/src/sema/sessionIdMapping.ts
124138
124710
  var sessionIdMapping_exports = {};
124139
124711
  __export(sessionIdMapping_exports, {
@@ -124608,6 +125180,7 @@ function watchEngineContextFrames(events3) {
124608
125180
  (m2) => m2.noteEngineCompaction({
124609
125181
  preTokens: c3.tokensBefore,
124610
125182
  postTokens: c3.tokensAfter,
125183
+ triggerTokensBefore: c3.triggerTokensBefore,
124611
125184
  trigger: c3.trigger
124612
125185
  })
124613
125186
  ).catch(() => {
@@ -124715,7 +125288,8 @@ function hostSink(e, billTurnCosts = !0, runToken, driveId) {
124715
125288
  }
124716
125289
  if (e.kind === "plan_review_park")
124717
125290
  return Promise.resolve().then(() => {
124718
- armPlanReviewApproval(e.result);
125291
+ let submitted = submittedInPlanMode(), offered = planReviewOffersModeAfterNow(submitted), park = isPlanReviewPark(e.result) ? e.result : null;
125292
+ park && notePlanReviewOffer(park.taskId, offered), armPlanReviewApproval(e.result, void 0, { submittedInPlanMode: submitted });
124719
125293
  });
124720
125294
  }
124721
125295
  function consoleLegForDroppedFrame(type, line) {
@@ -124758,6 +125332,7 @@ var runTokenSeq, mintRunToken, reportedDroppedTypes2, DROPPED_TYPE_MEMO_CAP2, in
124758
125332
  "build-src/src/seam/adapter/runStream.ts"() {
124759
125333
  init_dist();
124760
125334
  init_untrustedDisplayText();
125335
+ init_planReviewModeAfterOffer();
124761
125336
  init_turnUsageTranscriptStamp();
124762
125337
  init_activeRunSelfHeal2();
124763
125338
  init_dist();
@@ -153379,30 +153954,39 @@ var SUBSTITUTION_PLACEHOLDER, UNREADABLE_EXPANSION_TEXT, UNDELIMITED_SUBSTITUTIO
153379
153954
  });
153380
153955
 
153381
153956
  // node_modules/@sema-agent/core/dist/tools/fs/bash-program-position.js
153382
- var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, LAUNCHER_TABLE, COMMAND_LAUNCHERS, init_bash_program_position = __esm({
153957
+ var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, launcherRow, LAUNCHER_TABLE, COMMAND_LAUNCHERS, init_bash_program_position = __esm({
153383
153958
  "node_modules/@sema-agent/core/dist/tools/fs/bash-program-position.js"() {
153384
- NOT_AUTO_ALLOWED = "\u2014 not auto-allowed", NO_DECLARED_OPTIONS = { optionArity: /* @__PURE__ */ new Map() }, LAUNCHER_TABLE = /* @__PURE__ */ new Map([
153385
- ["env", NO_DECLARED_OPTIONS],
153386
- ["command", NO_DECLARED_OPTIONS],
153959
+ NOT_AUTO_ALLOWED = "\u2014 not auto-allowed", NO_DECLARED_OPTIONS = { optionArity: /* @__PURE__ */ new Map() }, launcherRow = (pairs, extra = {}) => ({ optionArity: new Map(pairs), ...extra }), LAUNCHER_TABLE = /* @__PURE__ */ new Map([
153960
+ ["env", launcherRow([["-i", 0], ["-0", 0], ["-v", 0], ["--ignore-environment", 0], ["--null", 0], ["--debug", 0], ["-u", 1], ["--unset", 1]], { assignmentOperands: !0 })],
153961
+ ["command", launcherRow([["-p", 0]])],
153387
153962
  ["builtin", NO_DECLARED_OPTIONS],
153388
153963
  ["exec", NO_DECLARED_OPTIONS],
153389
153964
  ["noglob", NO_DECLARED_OPTIONS],
153390
153965
  ["xargs", NO_DECLARED_OPTIONS],
153391
153966
  ["busybox", NO_DECLARED_OPTIONS],
153392
- ["sudo", NO_DECLARED_OPTIONS],
153967
+ ["sudo", { optionArity: /* @__PURE__ */ new Map(), assignmentOperands: !0 }],
153393
153968
  ["doas", NO_DECLARED_OPTIONS],
153394
- ["pkexec", NO_DECLARED_OPTIONS],
153395
- ["su", NO_DECLARED_OPTIONS],
153396
- ["runuser", NO_DECLARED_OPTIONS],
153397
- ["chroot", NO_DECLARED_OPTIONS],
153969
+ ["pkexec", { optionArity: /* @__PURE__ */ new Map(), whenNoProgram: "shell" }],
153970
+ ["su", { optionArity: /* @__PURE__ */ new Map(), shellText: !0 }],
153971
+ ["runuser", { optionArity: /* @__PURE__ */ new Map(), shellText: !0 }],
153972
+ ["chroot", { optionArity: /* @__PURE__ */ new Map(), requiredOperands: 1, whenNoProgram: "shell" }],
153398
153973
  ["setpriv", NO_DECLARED_OPTIONS],
153399
153974
  ["nohup", NO_DECLARED_OPTIONS],
153400
- ["nice", NO_DECLARED_OPTIONS],
153975
+ ["nice", launcherRow([["-n", 1], ["--adjustment", 1]], { negativeIntegerIsOwnArgument: !0 })],
153401
153976
  ["ionice", NO_DECLARED_OPTIONS],
153402
- ["chrt", NO_DECLARED_OPTIONS],
153403
- ["taskset", NO_DECLARED_OPTIONS],
153404
- ["stdbuf", NO_DECLARED_OPTIONS],
153405
- ["timeout", NO_DECLARED_OPTIONS],
153977
+ ["chrt", { optionArity: /* @__PURE__ */ new Map(), requiredOperands: 1 }],
153978
+ ["taskset", { optionArity: /* @__PURE__ */ new Map(), requiredOperands: 1 }],
153979
+ ["stdbuf", launcherRow([["-i", 1], ["-o", 1], ["-e", 1], ["--input", 1], ["--output", 1], ["--error", 1]])],
153980
+ ["timeout", launcherRow([
153981
+ ["--foreground", 0],
153982
+ ["--preserve-status", 0],
153983
+ ["--verbose", 0],
153984
+ ["-v", 0],
153985
+ ["-k", 1],
153986
+ ["-s", 1],
153987
+ ["--kill-after", 1],
153988
+ ["--signal", 1]
153989
+ ], { requiredOperands: 1 })],
153406
153990
  ["time", {
153407
153991
  optionArity: /* @__PURE__ */ new Map([
153408
153992
  ["-p", 0],
@@ -153421,19 +154005,19 @@ var NOT_AUTO_ALLOWED, NO_DECLARED_OPTIONS, LAUNCHER_TABLE, COMMAND_LAUNCHERS, in
153421
154005
  ["--output", 1]
153422
154006
  ])
153423
154007
  }],
153424
- ["watch", NO_DECLARED_OPTIONS],
154008
+ ["watch", { optionArity: /* @__PURE__ */ new Map(), shellText: !0 }],
153425
154009
  ["setsid", NO_DECLARED_OPTIONS],
153426
- ["flock", NO_DECLARED_OPTIONS],
153427
- ["unshare", NO_DECLARED_OPTIONS],
153428
- ["nsenter", NO_DECLARED_OPTIONS],
153429
- ["script", NO_DECLARED_OPTIONS],
154010
+ ["flock", { optionArity: /* @__PURE__ */ new Map(), requiredOperands: 1 }],
154011
+ ["unshare", { optionArity: /* @__PURE__ */ new Map(), whenNoProgram: "shell" }],
154012
+ ["nsenter", { optionArity: /* @__PURE__ */ new Map(), whenNoProgram: "shell" }],
154013
+ ["script", { optionArity: /* @__PURE__ */ new Map(), shellText: !0 }],
153430
154014
  ["numactl", NO_DECLARED_OPTIONS],
153431
154015
  ["prlimit", NO_DECLARED_OPTIONS],
153432
154016
  ["systemd-run", NO_DECLARED_OPTIONS],
153433
154017
  ["strace", NO_DECLARED_OPTIONS],
153434
154018
  ["ltrace", NO_DECLARED_OPTIONS],
153435
154019
  ["valgrind", NO_DECLARED_OPTIONS],
153436
- ["firejail", NO_DECLARED_OPTIONS],
154020
+ ["firejail", { optionArity: /* @__PURE__ */ new Map(), whenNoProgram: "shell" }],
153437
154021
  ["bwrap", NO_DECLARED_OPTIONS]
153438
154022
  ]), COMMAND_LAUNCHERS = new Set(LAUNCHER_TABLE.keys());
153439
154023
  }
@@ -153810,7 +154394,7 @@ var READ_DENY_BUILTIN_TIERS, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_DEFAULT_TIE
153810
154394
  { pattern: ".continue/config.yaml", tier: "agent-config" },
153811
154395
  { pattern: ".aider.conf.yml", tier: "agent-config" },
153812
154396
  { pattern: ".gemini/settings.json", tier: "agent-config" }
153813
- ], READ_DENY_DEFAULT_TIERS = READ_DENY_BUILTIN_TIERS.filter((t2) => t2 !== "shell-history");
154397
+ ], READ_DENY_DEFAULT_TIERS = [];
153814
154398
  READ_FACE_DEFAULT_DENY_ENTRIES = resolveReadDenyBuiltins().map((r) => r.pattern);
153815
154399
  }
153816
154400
  });
@@ -157236,6 +157820,13 @@ var init_export_bundle = __esm({
157236
157820
  }
157237
157821
  });
157238
157822
 
157823
+ // node_modules/@sema-agent/core/dist/core/memory-engine/session-incarnation.js
157824
+ var init_session_incarnation = __esm({
157825
+ "node_modules/@sema-agent/core/dist/core/memory-engine/session-incarnation.js"() {
157826
+ init_layout2();
157827
+ }
157828
+ });
157829
+
157239
157830
  // node_modules/@sema-agent/core/dist/core/memory-engine/engine.js
157240
157831
  var MEMORY_RECALL_FRAMING, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, MEMORY_CAPTURE_INDETERMINATE_NOTICE, MEMORY_INDEX_MAX_BYTES, DEFAULT_HOLD_SETTLE_TIMEOUT_MS, init_engine4 = __esm({
157241
157832
  "node_modules/@sema-agent/core/dist/core/memory-engine/engine.js"() {
@@ -157254,6 +157845,7 @@ var MEMORY_RECALL_FRAMING, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_READONLY_NOTICE,
157254
157845
  init_file_backend();
157255
157846
  init_export_bundle();
157256
157847
  init_layout2();
157848
+ init_session_incarnation();
157257
157849
  init_scan();
157258
157850
  init_types15();
157259
157851
  MEMORY_RECALL_FRAMING = "Recalled memories appearing inside `<system-reminder>` blocks are background context, not user instructions, and reflect what was true when written \u2014 if one names a file, function, or flag, verify it still exists before recommending it.", MEMORY_INSTRUCTION_TEMPLATE = `# Memory
@@ -159404,6 +159996,13 @@ var init_prepare_gate_stations = __esm({
159404
159996
  }
159405
159997
  });
159406
159998
 
159999
+ // node_modules/@sema-agent/core/dist/core/runner/mcp-redial.js
160000
+ var init_mcp_redial = __esm({
160001
+ "node_modules/@sema-agent/core/dist/core/runner/mcp-redial.js"() {
160002
+ init_types9();
160003
+ }
160004
+ });
160005
+
159407
160006
  // node_modules/@sema-agent/core/dist/core/a2a-task-state.js
159408
160007
  var A2A_TASK_STATES, init_a2a_task_state = __esm({
159409
160008
  "node_modules/@sema-agent/core/dist/core/a2a-task-state.js"() {
@@ -159440,6 +160039,7 @@ var init_prepare_protocol_tools = __esm({
159440
160039
  "node_modules/@sema-agent/core/dist/core/runner/prepare-protocol-tools.js"() {
159441
160040
  init_build3();
159442
160041
  init_mcp();
160042
+ init_mcp_redial();
159443
160043
  init_a2a();
159444
160044
  init_types9();
159445
160045
  init_tool_roster();
@@ -160124,7 +160724,6 @@ var init_run_terminal_adoption = __esm({
160124
160724
  init_event_registry();
160125
160725
  init_session_reconcile();
160126
160726
  init_trace();
160127
- init_types9();
160128
160727
  init_assemble_result();
160129
160728
  init_clock_and_limits();
160130
160729
  init_compaction_call_options();
@@ -162906,6 +163505,7 @@ __export(apiErrorSupplement_exports, {
162906
163505
  MODEL_OUTPUT_ERROR_PREFIX: () => MODEL_OUTPUT_ERROR_PREFIX,
162907
163506
  isModelOutputError: () => isModelOutputError,
162908
163507
  isModelOutputErrorRowText: () => isModelOutputErrorRowText,
163508
+ isOutcomeUnknownRowText: () => isOutcomeUnknownRowText,
162909
163509
  semaApiErrorSupplement: () => semaApiErrorSupplement,
162910
163510
  settingsBodyShapeSupplement: () => settingsBodyShapeSupplement
162911
163511
  });
@@ -162969,6 +163569,70 @@ var init_apiErrorSupplement = __esm({
162969
163569
  }
162970
163570
  });
162971
163571
 
163572
+ // build-src/src/sema/displaySafeUrl.ts
163573
+ function displaySafeBaseUrl(url3) {
163574
+ try {
163575
+ let u = new URL(url3), changed = !1;
163576
+ if ((u.username || u.password) && (u.username = "", u.password = "", changed = !0), u.search.length > 0) {
163577
+ for (let key of [...u.searchParams.keys()]) u.searchParams.set(key, "***");
163578
+ changed = !0;
163579
+ }
163580
+ return u.hash.length > 0 && (u.hash = "***", changed = !0), changed ? u.toString() : url3;
163581
+ } catch {
163582
+ return redactUnparseableUrlUserinfo(url3);
163583
+ }
163584
+ }
163585
+ function redactUnparseableUrlUserinfo(url3) {
163586
+ let m2 = /^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^/?#]*)([\s\S]*)$/.exec(url3);
163587
+ if (m2 === null)
163588
+ return /[@?#]/.test(url3) ? "(unparseable endpoint \u2014 hidden because it may contain credentials)" : url3;
163589
+ let scheme = m2[1] ?? "", authority = m2[2] ?? "", tail = m2[3] ?? "", cut = authority.lastIndexOf("@"), safeAuthority = cut === -1 ? authority : `***@${authority.slice(cut + 1)}`, q2 = tail.search(/[?#]/), safeTail = q2 === -1 ? tail : `${tail.slice(0, q2)}${tail.charAt(q2)}***`;
163590
+ return cut === -1 && q2 === -1 ? url3 : `${scheme}${safeAuthority}${safeTail}`;
163591
+ }
163592
+ var init_displaySafeUrl = __esm({
163593
+ "build-src/src/sema/displaySafeUrl.ts"() {
163594
+ }
163595
+ });
163596
+
163597
+ // build-src/src/sema/modelRoutingEnvPrecedence.ts
163598
+ var modelRoutingEnvPrecedence_exports = {};
163599
+ __export(modelRoutingEnvPrecedence_exports, {
163600
+ classifyModelRoutingEnv: () => classifyModelRoutingEnv,
163601
+ modelRoutingEnvClause: () => modelRoutingEnvClause,
163602
+ modelRoutingEnvNote: () => modelRoutingEnvNote
163603
+ });
163604
+ function classifyModelRoutingEnv(env6, entryBaseUrl) {
163605
+ let rawUrl = nonEmpty4(servedEndpointRawValue("openai-completions", env6)), provider = nonEmpty4(env6.MODEL_PROVIDER);
163606
+ if (rawUrl === void 0 || provider === void 0) return { kind: "not-applicable" };
163607
+ let envEndpoint = normalizeEndpoint(rawUrl);
163608
+ if (envEndpoint === "") return { kind: "not-applicable" };
163609
+ if (entryBaseUrl === null) return { kind: "not-applicable" };
163610
+ let ownEndpoint = normalizeEndpoint(entryBaseUrl);
163611
+ return ownEndpoint !== "" && ownEndpoint !== envEndpoint ? { kind: "not-applicable" } : GATEWAY_ROUTE_PROVIDERS.has(provider) ? { kind: "agreed" } : ANTHROPIC_ROUTE_PROVIDERS.has(provider) ? { kind: "agreed" } : { kind: "gateway-wins", displayUrl: displaySafeBaseUrl(rawUrl), provider };
163612
+ }
163613
+ function providerNotDecidingClause(provider) {
163614
+ return `MODEL_PROVIDER=${cleanUntrustedScalar(provider)} is set but is not what puts this hop on the gateway channel (only MODEL_PROVIDER=anthropic moves it to the anthropic channel)`;
163615
+ }
163616
+ function modelRoutingEnvNote(env6, entryBaseUrl) {
163617
+ let v2 = classifyModelRoutingEnv(env6, entryBaseUrl);
163618
+ if (v2.kind !== "gateway-wins") return null;
163619
+ let url3 = cleanUntrustedScalar(v2.displayUrl);
163620
+ return `routed via ${GATEWAY_ENDPOINT_ENV_KEY}=${url3} \u2014 ${providerNotDecidingClause(v2.provider)}`;
163621
+ }
163622
+ function modelRoutingEnvClause(env6, hop) {
163623
+ if (hop !== "gateway") return null;
163624
+ let v2 = classifyModelRoutingEnv(env6);
163625
+ return v2.kind !== "gateway-wins" ? null : providerNotDecidingClause(v2.provider);
163626
+ }
163627
+ var ANTHROPIC_ROUTE_PROVIDERS, GATEWAY_ROUTE_PROVIDERS, nonEmpty4, init_modelRoutingEnvPrecedence = __esm({
163628
+ "build-src/src/sema/modelRoutingEnvPrecedence.ts"() {
163629
+ init_untrustedDisplayText();
163630
+ init_displaySafeUrl();
163631
+ init_servedEndpointEnv();
163632
+ ANTHROPIC_ROUTE_PROVIDERS = /* @__PURE__ */ new Set(["anthropic"]), GATEWAY_ROUTE_PROVIDERS = /* @__PURE__ */ new Set(["gateway", "vllm"]), nonEmpty4 = (v2) => typeof v2 == "string" && v2.trim().length > 0 ? v2.trim() : void 0;
163633
+ }
163634
+ });
163635
+
162972
163636
  // build-src/src/cli/textModeError.ts
162973
163637
  function isApiErrorRowText(text2) {
162974
163638
  return /^API Error\b/.test(text2.trimStart());
@@ -163008,28 +163672,13 @@ function extractProviderErrorMessage(text2) {
163008
163672
  let bag = parsed, nested2 = bag.error !== null && typeof bag.error == "object" ? bag.error.message : void 0, message = typeof nested2 == "string" ? nested2 : bag.message;
163009
163673
  return typeof message != "string" || message.trim().length === 0 ? text2 : (text2.slice(0, open19) + message.trim() + text2.slice(close + 1)).trim();
163010
163674
  }
163011
- function displaySafeBaseUrl(url3) {
163012
- try {
163013
- let u = new URL(url3);
163014
- return u.username || u.password ? (u.username = "", u.password = "", u.toString()) : url3;
163015
- } catch {
163016
- return redactUnparseableUrlUserinfo(url3);
163017
- }
163018
- }
163019
- function redactUnparseableUrlUserinfo(url3) {
163020
- let m2 = /^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^/?#]*)([\s\S]*)$/.exec(url3);
163021
- if (m2 === null)
163022
- return url3.includes("@") ? "(unparseable endpoint \u2014 hidden because it may contain credentials)" : url3;
163023
- let scheme = m2[1] ?? "", authority = m2[2] ?? "", tail = m2[3] ?? "", cut = authority.lastIndexOf("@");
163024
- return cut === -1 ? url3 : `${scheme}***@${authority.slice(cut + 1)}${tail}`;
163025
- }
163026
163675
  function modelEndpointContextLine(text2, env6) {
163027
163676
  let m2 = text2.match(/\b(gateway|anthropic) HTTP (\d{3}|ERR)\b/);
163028
163677
  if (!m2) return null;
163029
163678
  let hop = m2[1], keyName2 = hop === "gateway" ? env6.MODEL_GATEWAY_BASEURL ? "MODEL_GATEWAY_BASEURL" : "OPENAI_BASE_URL" : "ANTHROPIC_BASE_URL", url3 = env6[keyName2] ?? (hop === "anthropic" ? env6.ANTHROPIC_BASEURL : void 0);
163030
163679
  if (!url3) return null;
163031
- let displayUrl = displaySafeBaseUrl(url3), v1Hint = m2[2] === "404" ? hop === "gateway" ? " \u2014 a 404 here often means the base URL is missing its /v1 suffix" : " \u2014 the engine appends /v1/messages to this base; a 404 here usually means the base URL itself is wrong (it should not already contain /v1 or the API path)" : "";
163032
- return `${hop} base: ${displayUrl} (from env ${keyName2} \u2014 the engine appends the API path)${v1Hint}`;
163680
+ let displayUrl = displaySafeBaseUrl(url3), v1Hint = m2[2] === "404" ? hop === "gateway" ? " \u2014 a 404 here often means the base URL is missing its /v1 suffix" : " \u2014 the engine appends /v1/messages to this base; a 404 here usually means the base URL itself is wrong (it should not already contain /v1 or the API path)" : "", routing = modelRoutingEnvClause(env6, hop);
163681
+ return `${hop} base: ${displayUrl} (from env ${keyName2} \u2014 the engine appends the API path)${v1Hint}` + (routing === null ? "" : ` \u2014 ${routing}`);
163033
163682
  }
163034
163683
  function formatTextModeExecutionError(errors2, env6) {
163035
163684
  if (Array.isArray(errors2)) {
@@ -163058,6 +163707,9 @@ function formatTextModeGovernanceStop(errors2, fallbackTemplate) {
163058
163707
  }
163059
163708
  var init_textModeError = __esm({
163060
163709
  "build-src/src/cli/textModeError.ts"() {
163710
+ init_modelRoutingEnvPrecedence();
163711
+ init_displaySafeUrl();
163712
+ init_displaySafeUrl();
163061
163713
  }
163062
163714
  });
163063
163715
 
@@ -166926,7 +167578,7 @@ var require_webidl = __commonJS({
166926
167578
  return new TypeError(`${message.header}: ${message.message}`);
166927
167579
  };
166928
167580
  webidl.errors.conversionFailed = function(opts) {
166929
- let plural7 = opts.types.length === 1 ? "" : " one of", message = `${opts.argument} could not be converted to${plural7}: ${opts.types.join(", ")}.`;
167581
+ let plural8 = opts.types.length === 1 ? "" : " one of", message = `${opts.argument} could not be converted to${plural8}: ${opts.types.join(", ")}.`;
166930
167582
  return webidl.errors.exception({
166931
167583
  header: opts.prefix,
166932
167584
  message
@@ -182728,35 +183380,6 @@ var DOCTOR_PROBE_TIMEOUT_MS, init_modelRow = __esm({
182728
183380
  }
182729
183381
  });
182730
183382
 
182731
- // build-src/src/sema/appStateRef.ts
182732
- var appStateRef_exports = {};
182733
- __export(appStateRef_exports, {
182734
- fleetRowTaskId: () => rowIdTail,
182735
- getAppStateStoreRef: () => getAppStateStoreRef,
182736
- getBootAdditionalDirectories: () => getBootAdditionalDirectories,
182737
- setAppStateStoreRef: () => setAppStateStoreRef,
182738
- setBootAdditionalDirectories: () => setBootAdditionalDirectories
182739
- });
182740
- function setAppStateStoreRef(store) {
182741
- g.__semaAppStateStore = store;
182742
- }
182743
- function getAppStateStoreRef() {
182744
- return g.__semaAppStateStore ?? null;
182745
- }
182746
- function setBootAdditionalDirectories(dirs) {
182747
- gDirs.__semaBootAdditionalDirs = [...dirs];
182748
- }
182749
- function getBootAdditionalDirectories() {
182750
- return gDirs.__semaBootAdditionalDirs ?? null;
182751
- }
182752
- var g, gDirs, init_appStateRef = __esm({
182753
- "build-src/src/sema/appStateRef.ts"() {
182754
- init_dist();
182755
- g = globalThis;
182756
- gDirs = globalThis;
182757
- }
182758
- });
182759
-
182760
183383
  // build-src/src/sema/fleetDurableTerminalOverlay.ts
182761
183384
  function evidenceTier(e) {
182762
183385
  switch (e) {
@@ -182832,8 +183455,8 @@ function overlayDurableTerminalFacts(tasks3) {
182832
183455
  return appliedOverlay.set(appliedKey, { status: winner.status, elapsedMs: frozen }), { ...t2, status: winner.status, elapsedMs: frozen };
182833
183456
  });
182834
183457
  if (appliedOverlay.size > 0) {
182835
- let present = new Set(tasks3.map((t2) => rowIdTail(t2.id)));
182836
- for (let id of [...appliedOverlay.keys()]) present.has(id) || appliedOverlay.delete(id);
183458
+ let present2 = new Set(tasks3.map((t2) => rowIdTail(t2.id)));
183459
+ for (let id of [...appliedOverlay.keys()]) present2.has(id) || appliedOverlay.delete(id);
182837
183460
  }
182838
183461
  if (tasks3.some((t2) => !TERMINAL.has(t2.status))) {
182839
183462
  for (let [taskId] of facts)
@@ -250198,11 +250821,22 @@ var reopenSeq, ownershipDeps, inFlightReopenByTask, _pendingRowGoneFromEvidenceF
250198
250821
  // build-src/src/sema/planReviewReopen.ts
250199
250822
  var planReviewReopen_exports = {};
250200
250823
  __export(planReviewReopen_exports, {
250824
+ _deliverPlanReviewDecisionForTest: () => _deliverPlanReviewDecisionForTest,
250201
250825
  _resetPlanReviewReopenSeqForTest: () => _resetPlanReviewReopenSeqForTest,
250202
250826
  reopenPlanReviewCard: () => reopenPlanReviewCard2
250203
250827
  });
250204
250828
  function deliverPlanReviewDecision(taskId, decision) {
250205
- decidePlanReview(taskId, decision).catch((e) => {
250829
+ if (deliveriesInFlight.has(taskId)) {
250830
+ logForDebugging(
250831
+ `[sema][planReviewReopen] ${decision} for task ${taskId} NOT sent \u2014 a decision for this gate is already in flight (at-most-one)`
250832
+ );
250833
+ return;
250834
+ }
250835
+ deliveriesInFlight.add(taskId), logForDebugging(
250836
+ `[sema][planReviewReopen] delivering ${decision} for task ${taskId} via the REOPENED card (shell-injected deliverDecision)`
250837
+ ), decidePlanReview(taskId, decision).finally(() => {
250838
+ deliveriesInFlight.delete(taskId);
250839
+ }).catch((e) => {
250206
250840
  try {
250207
250841
  let line = "your plan review decision could not be delivered to the engine \u2014 the session may still be held; send your message again to retry";
250208
250842
  surfaceTranscriptSystemNotice(line, "warning") || process.stderr.write(`${line}
@@ -250212,7 +250846,10 @@ function deliverPlanReviewDecision(taskId, decision) {
250212
250846
  });
250213
250847
  }
250214
250848
  function _resetPlanReviewReopenSeqForTest() {
250215
- _resetActiveReopenRespondersForTest();
250849
+ _resetActiveReopenRespondersForTest(), deliveriesInFlight.clear();
250850
+ }
250851
+ function _deliverPlanReviewDecisionForTest(taskId, decision) {
250852
+ deliverPlanReviewDecision(taskId, decision);
250216
250853
  }
250217
250854
  async function reopenPlanReviewCard2(taskId) {
250218
250855
  let verdict = await reopenPlanReviewCard(taskId, {
@@ -250223,11 +250860,13 @@ async function reopenPlanReviewCard2(taskId) {
250223
250860
  hasQuestionOverlay() ? `[sema][planReviewReopen] reopen for task ${taskId} got no presentation receipt within ${String(gateArmedWaitMs())}ms \u2014 reporting reopened:false (the overlay did not enqueue the card)` : `[sema][planReviewReopen] reopen for task ${taskId} has no overlay subscriber (headless / REPL not mounted) \u2014 reporting reopened:false`
250224
250861
  ), verdict;
250225
250862
  }
250226
- var init_planReviewReopen = __esm({
250863
+ var deliveriesInFlight, init_planReviewReopen = __esm({
250227
250864
  "build-src/src/sema/planReviewReopen.ts"() {
250228
250865
  init_dist();
250229
250866
  init_armedGateRegistry2();
250230
250867
  init_transcriptSystemNotice();
250868
+ init_debug();
250869
+ deliveriesInFlight = /* @__PURE__ */ new Set();
250231
250870
  }
250232
250871
  });
250233
250872
 
@@ -305825,7 +306464,7 @@ function HiddenLineCount({
305825
306464
  count: count3,
305826
306465
  unit = "line"
305827
306466
  }) {
305828
- return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural(count3, unit)}` });
306467
+ return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural2(count3, unit)}` });
305829
306468
  }
305830
306469
  function FileEditToolUseRejectedMessage(t0) {
305831
306470
  let $3 = (0, import_compiler_runtime38.c)(38), {
@@ -305893,7 +306532,7 @@ function FileEditToolUseRejectedMessage(t0) {
305893
306532
  }
305894
306533
  var import_compiler_runtime38, import_jsx_runtime45, MAX_LINES_TO_RENDER, init_FileEditToolUseRejectedMessage = __esm({
305895
306534
  "build-src/src/components/FileEditToolUseRejectedMessage.tsx"() {
305896
- import_compiler_runtime38 = __toESM(require_compiler_runtime());
306535
+ import_compiler_runtime38 = __toESM(require_compiler_runtime(), 1);
305897
306536
  init_useTerminalSize();
305898
306537
  init_cwd();
305899
306538
  init_ink2();
@@ -305901,7 +306540,7 @@ var import_compiler_runtime38, import_jsx_runtime45, MAX_LINES_TO_RENDER, init_F
305901
306540
  init_MessageResponse();
305902
306541
  init_StructuredDiffList();
305903
306542
  init_stringUtils();
305904
- import_jsx_runtime45 = __toESM(require_jsx_runtime()), MAX_LINES_TO_RENDER = 10;
306543
+ import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1), MAX_LINES_TO_RENDER = 10;
305905
306544
  }
305906
306545
  });
305907
306546
 
@@ -319793,7 +320432,7 @@ Found ${matches2} total ${matches2 === 1 ? "occurrence" : "occurrences"} across
319793
320432
  type: "tool_result",
319794
320433
  content: "No files found"
319795
320434
  };
319796
- let result = `Found ${numFiles} ${plural(numFiles, "file")}${limitInfo ? ` ${limitInfo}` : ""}
320435
+ let result = `Found ${numFiles} ${plural2(numFiles, "file")}${limitInfo ? ` ${limitInfo}` : ""}
319797
320436
  ${filenames.join(`
319798
320437
  `)}`;
319799
320438
  return {
@@ -330068,7 +330707,7 @@ function updateTaskState(taskId, setAppState, updater) {
330068
330707
  setAppState((prev) => {
330069
330708
  let task = prev.tasks?.[taskId];
330070
330709
  if (!task)
330071
- return prev;
330710
+ return process.env.SEMA_DEBUG && semaDebugLine(`[task-update] dropped update for missing task id=${taskId}`), prev;
330072
330711
  let updated = updater(task);
330073
330712
  return updated === task ? prev : {
330074
330713
  ...prev,
@@ -330165,6 +330804,7 @@ var STOPPED_DISPLAY_MS, PANEL_GRACE_MS, init_framework = __esm({
330165
330804
  "build-src/src/utils/task/framework.ts"() {
330166
330805
  init_xml();
330167
330806
  init_Task();
330807
+ init_debugLine();
330168
330808
  init_messageQueueManager();
330169
330809
  init_sdkEventQueue();
330170
330810
  init_diskOutput();
@@ -339740,7 +340380,7 @@ function useKeybindingWarnings(warnings, isReload) {
339740
340380
  return;
339741
340381
  }
339742
340382
  let errorCount = count(warnings, _temp15), warnCount = count(warnings, _temp25), message;
339743
- errorCount > 0 && warnCount > 0 ? message = `Found ${errorCount} keybinding ${plural(errorCount, "error")} and ${warnCount} ${plural(warnCount, "warning")}` : errorCount > 0 ? message = `Found ${errorCount} keybinding ${plural(errorCount, "error")}` : message = `Found ${warnCount} keybinding ${plural(warnCount, "warning")}`, message = message + " \xB7 /doctor for details", addNotification({
340383
+ errorCount > 0 && warnCount > 0 ? message = `Found ${errorCount} keybinding ${plural2(errorCount, "error")} and ${warnCount} ${plural2(warnCount, "warning")}` : errorCount > 0 ? message = `Found ${errorCount} keybinding ${plural2(errorCount, "error")}` : message = `Found ${warnCount} keybinding ${plural2(warnCount, "warning")}`, message = message + " \xB7 /doctor for details", addNotification({
339744
340384
  key: "keybinding-config-warning",
339745
340385
  text: message,
339746
340386
  color: errorCount > 0 ? "error" : "warning",
@@ -353137,7 +353777,7 @@ function AssistantTextMessage(t0) {
353137
353777
  return $3[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(MessageResponse, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(InterruptedByUser, {}) }), $3[14] = t2) : t2 = $3[14], t2;
353138
353778
  }
353139
353779
  default: {
353140
- if (startsWithApiErrorPrefix(text2) || isGovernanceStopRowText(text2) || isModelOutputErrorRowText(text2)) {
353780
+ if (startsWithApiErrorPrefix(text2) || isGovernanceStopRowText(text2) || isModelOutputErrorRowText(text2) || isOutcomeUnknownRowText(text2)) {
353141
353781
  let truncated = !verbose && text2.trim().length > MAX_API_ERROR_CHARS, t22 = text2 === API_ERROR_MESSAGE_PREFIX ? `${API_ERROR_MESSAGE_PREFIX}: Please wait a moment and try again.` : truncated ? text2.trim().slice(0, MAX_API_ERROR_CHARS) + "\u2026" : text2.trim(), t32;
353142
353782
  if ($3[15] !== t22) {
353143
353783
  let apiErrSplit = splitApiErrorSupplement(t22);
@@ -355288,7 +355928,7 @@ function AttachmentMessage({
355288
355928
  /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(ThemedText, { bold: !0, children: [
355289
355929
  skillCount,
355290
355930
  " ",
355291
- plural(skillCount, "skill")
355931
+ plural2(skillCount, "skill")
355292
355932
  ] }),
355293
355933
  " ",
355294
355934
  "from ",
@@ -355299,7 +355939,7 @@ function AttachmentMessage({
355299
355939
  return attachment.isInitial ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Line, { children: [
355300
355940
  /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ThemedText, { bold: !0, children: attachment.skillCount }),
355301
355941
  " ",
355302
- plural(attachment.skillCount, "skill"),
355942
+ plural2(attachment.skillCount, "skill"),
355303
355943
  " available"
355304
355944
  ] });
355305
355945
  case "agent_listing_delta": {
@@ -355309,7 +355949,7 @@ function AttachmentMessage({
355309
355949
  return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Line, { children: [
355310
355950
  /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ThemedText, { bold: !0, children: count3 }),
355311
355951
  " agent ",
355312
- plural(count3, "type"),
355952
+ plural2(count3, "type"),
355313
355953
  " available"
355314
355954
  ] });
355315
355955
  }
@@ -355441,7 +356081,7 @@ function AttachmentMessage({
355441
356081
  /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(ThemedText, { dimColor: !0, children: [
355442
356082
  attachment.count,
355443
356083
  " ",
355444
- plural(attachment.count, "teammate"),
356084
+ plural2(attachment.count, "teammate"),
355445
356085
  " shut down gracefully"
355446
356086
  ] })
355447
356087
  ] });
@@ -364929,7 +365569,7 @@ function HiddenToolUseCount({
364929
365569
  expandable = !1
364930
365570
  }) {
364931
365571
  return hiddenCount <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(ThemedText, { dimColor: !0, children: [
364932
- `\u2026 +${hiddenCount} ${plural(hiddenCount, unit)}`,
365572
+ `\u2026 +${hiddenCount} ${plural2(hiddenCount, unit)}`,
364933
365573
  expandable && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [
364934
365574
  " ",
364935
365575
  /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(CtrlOToExpand, {})
@@ -366162,7 +366802,7 @@ function renderToolResultMessage12(output) {
366162
366802
  let parts = ["Successfully loaded skill"];
366163
366803
  if ("allowedTools" in output && output.allowedTools && output.allowedTools.length > 0) {
366164
366804
  let count3 = output.allowedTools.length;
366165
- parts.push(`${count3} ${plural(count3, "tool")} allowed`);
366805
+ parts.push(`${count3} ${plural2(count3, "tool")} allowed`);
366166
366806
  }
366167
366807
  return "model" in output && output.model && parts.push(output.model), /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(MessageResponse, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ThemedText, { children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Byline, { children: parts }) }) });
366168
366808
  }
@@ -366197,7 +366837,7 @@ function HiddenToolUseCount2({
366197
366837
  count: count3,
366198
366838
  unit = "line"
366199
366839
  }) {
366200
- return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural(count3, unit)}` });
366840
+ return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural2(count3, unit)}` });
366201
366841
  }
366202
366842
  function renderToolUseRejectedMessage5(_input, {
366203
366843
  progressMessagesForMessage,
@@ -382345,7 +382985,7 @@ var inputSchema20, outputSchema18, KAIROS_BRIEF_REFRESH_MS, BriefTool, init_Brie
382345
382985
  return BRIEF_TOOL_PROMPT;
382346
382986
  },
382347
382987
  mapToolResultToToolResultBlockParam(output, toolUseID) {
382348
- let n2 = output.attachments?.length ?? 0, suffix = n2 === 0 ? "" : ` (${n2} ${plural(n2, "attachment")} included)`;
382988
+ let n2 = output.attachments?.length ?? 0, suffix = n2 === 0 ? "" : ` (${n2} ${plural2(n2, "attachment")} included)`;
382349
382989
  return {
382350
382990
  tool_use_id: toolUseID,
382351
382991
  type: "tool_result",
@@ -384153,7 +384793,7 @@ function formatWorkspaceSymbolResult(result, cwd5) {
384153
384793
  if (validSymbols.length === 0)
384154
384794
  return "No symbols found in workspace. This may occur if the workspace is empty, or if the LSP server has not finished indexing the project.";
384155
384795
  let lines = [
384156
- `Found ${validSymbols.length} ${plural(validSymbols.length, "symbol")} in workspace:`
384796
+ `Found ${validSymbols.length} ${plural2(validSymbols.length, "symbol")} in workspace:`
384157
384797
  ], byFile = groupByFile(validSymbols, cwd5);
384158
384798
  for (let [filePath, symbols] of byFile) {
384159
384799
  lines.push(`
@@ -384190,7 +384830,7 @@ function formatIncomingCallsResult(result, cwd5) {
384190
384830
  if (!result || result.length === 0)
384191
384831
  return "No incoming calls found (nothing calls this function)";
384192
384832
  let lines = [
384193
- `Found ${result.length} incoming ${plural(result.length, "call")}:`
384833
+ `Found ${result.length} incoming ${plural2(result.length, "call")}:`
384194
384834
  ], byFile = /* @__PURE__ */ new Map();
384195
384835
  for (let call81 of result) {
384196
384836
  if (!call81.from) {
@@ -384224,7 +384864,7 @@ function formatOutgoingCallsResult(result, cwd5) {
384224
384864
  if (!result || result.length === 0)
384225
384865
  return "No outgoing calls found (this function calls nothing)";
384226
384866
  let lines = [
384227
- `Found ${result.length} outgoing ${plural(result.length, "call")}:`
384867
+ `Found ${result.length} outgoing ${plural2(result.length, "call")}:`
384228
384868
  ], byFile = /* @__PURE__ */ new Map();
384229
384869
  for (let call81 of result) {
384230
384870
  if (!call81.to) {
@@ -388686,7 +389326,7 @@ var REPORT_FINDINGS_TOOL_NAME2, DESCRIPTION21, init_prompt36 = __esm({
388686
389326
  // build-src/src/tools/ReportFindingsTool/UI.tsx
388687
389327
  function renderToolUseMessage27(input, _options) {
388688
389328
  let count3 = input.findings?.length ?? 0;
388689
- return `${input.level ?? "review"} \xB7 ${count3} ${plural(count3, "finding")}`;
389329
+ return `${input.level ?? "review"} \xB7 ${count3} ${plural2(count3, "finding")}`;
388690
389330
  }
388691
389331
  function renderToolResultMessage26(output, _progressMessagesForMessage, { verbose }) {
388692
389332
  let findings = output?.findings ?? [];
@@ -388809,7 +389449,7 @@ var findingSchema, inputSchema46, outputSchema42, ReportFindingsTool, init_Repor
388809
389449
  return {
388810
389450
  tool_use_id: toolUseID,
388811
389451
  type: "tool_result",
388812
- content: count3 === 0 ? "No findings reported." : `${count3} ${plural(count3, "finding")} reported.`
389452
+ content: count3 === 0 ? "No findings reported." : `${count3} ${plural2(count3, "finding")} reported.`
388813
389453
  };
388814
389454
  }
388815
389455
  });
@@ -396919,7 +397559,7 @@ function poolEntryForModelRef(ref, pool = readModelPool()) {
396919
397559
  return pool.find((e) => e.id === ref) ?? pool.find((e) => e.modelId === ref);
396920
397560
  }
396921
397561
  function servedEndpointFor(entry, env6 = engineBootEnv()) {
396922
- return entry.api === "anthropic-messages" ? norm(env6.ANTHROPIC_BASE_URL ?? env6.ANTHROPIC_BASEURL) : norm(env6.MODEL_GATEWAY_BASEURL);
397562
+ return servedEndpointValue(entry.api, env6);
396923
397563
  }
396924
397564
  function endpointSwitchNeeded(entry, env6 = engineBootEnv()) {
396925
397565
  if (entry.baseUrl.replace(/\/+$/, "") === "") return !1;
@@ -397013,6 +397653,7 @@ var norm, warnedCrossEndpointEntries, PER_MODEL_BASEURL_MIN, init_modelEndpointS
397013
397653
  init_applyOnboard();
397014
397654
  init_debug();
397015
397655
  init_failOpen();
397656
+ init_servedEndpointEnv();
397016
397657
  norm = (u) => (u ?? "").replace(/\/+$/, ""), warnedCrossEndpointEntries = /* @__PURE__ */ new Set();
397017
397658
  PER_MODEL_BASEURL_MIN = [1, 128, 0];
397018
397659
  }
@@ -399229,6 +399870,66 @@ var init_sanitizeToolResultContent = __esm({
399229
399870
  }
399230
399871
  });
399231
399872
 
399873
+ // build-src/src/sema/engineAgentAbsence.ts
399874
+ function isAbsentRow(task) {
399875
+ return typeof task != "object" || task === null ? !1 : task._semaAbsence !== void 0;
399876
+ }
399877
+ function readRowAbsence(task) {
399878
+ if (!(typeof task != "object" || task === null))
399879
+ return task._semaAbsence;
399880
+ }
399881
+ function markEngineAgentRowAbsent(task, ev) {
399882
+ return task.status !== "running" || task._semaAbsence !== void 0 ? task : {
399883
+ ...task,
399884
+ _semaAbsence: { lastSeenAtMs: ev.lastSeenAtMs, absentForMs: ev.absentForMs },
399885
+ endTime: task.endTime ?? ev.lastSeenAtMs
399886
+ };
399887
+ }
399888
+ function clearEngineAgentRowAbsence(task) {
399889
+ return task._semaAbsence === void 0 ? task : { ...task, _semaAbsence: void 0, endTime: void 0 };
399890
+ }
399891
+ function engineAgentAbsenceExpired(task, now2 = Date.now(), ttlMs2 = 18e5) {
399892
+ let absence = readRowAbsence(task);
399893
+ return absence === void 0 ? !1 : now2 - absence.lastSeenAtMs >= ttlMs2;
399894
+ }
399895
+ function engineAgentAbsenceDroppedLine(label, ttlMs2 = 18e5) {
399896
+ let minutes = Math.round(ttlMs2 / 6e4);
399897
+ return `${label} was dropped from the task panel after ${minutes} min without an engine report \xB7 outcome unknown`;
399898
+ }
399899
+ function engineAgentTerminalAfterDropLine(label, status3, hasReport) {
399900
+ return `${label} reported ${status3} after it was dropped from the task panel${hasReport ? " \xB7 its final report arrived too late to keep in the panel" : ""}`;
399901
+ }
399902
+ function noteEngineAgentRowReclaimed(taskId, label) {
399903
+ if (taskId.length !== 0)
399904
+ for (reclaimedRows.set(taskId, label.length > 0 ? label : taskId); reclaimedRows.size > RECLAIMED_ROW_LEDGER_MAX; ) {
399905
+ let oldest = reclaimedRows.keys().next();
399906
+ if (oldest.done === !0) break;
399907
+ reclaimedRows.delete(oldest.value);
399908
+ }
399909
+ }
399910
+ function takeEngineAgentReclaimedRow(taskId) {
399911
+ let label = reclaimedRows.get(taskId);
399912
+ return label === void 0 ? null : (reclaimedRows.delete(taskId), label);
399913
+ }
399914
+ function reapExpiredEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
399915
+ let out6 = [];
399916
+ for (let [id, task] of Object.entries(tasks3))
399917
+ ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && (typeof task == "object" && task !== null && task.retain === !0 || out6.push(id));
399918
+ return out6;
399919
+ }
399920
+ function expiredButRetainedEngineAgentAbsences(tasks3, ownedRowIds, now2 = Date.now(), ttlMs2 = 18e5) {
399921
+ let out6 = [];
399922
+ for (let [id, task] of Object.entries(tasks3))
399923
+ ownedRowIds.has(id) && engineAgentAbsenceExpired(task, now2, ttlMs2) && typeof task == "object" && task !== null && task.retain === !0 && out6.push(id);
399924
+ return out6;
399925
+ }
399926
+ var ENGINE_AGENT_ABSENT_ROW_TEXT, RECLAIMED_ROW_LEDGER_MAX, reclaimedRows, init_engineAgentAbsence = __esm({
399927
+ "build-src/src/sema/engineAgentAbsence.ts"() {
399928
+ ENGINE_AGENT_ABSENT_ROW_TEXT = "engine no longer reports this agent \xB7 outcome unknown";
399929
+ RECLAIMED_ROW_LEDGER_MAX = 256, reclaimedRows = /* @__PURE__ */ new Map();
399930
+ }
399931
+ });
399932
+
399232
399933
  // build/stubs/internalLogging.ts
399233
399934
  async function logPermissionContextForAnts(_toolPermissionContext, _moment) {
399234
399935
  }
@@ -400240,7 +400941,9 @@ async function createAsyncAgentAttachmentsIfNeeded(context3) {
400240
400941
  description: agent.description,
400241
400942
  status: agent.status,
400242
400943
  deltaSummary: agent.status === "running" ? agent.progress?.summary ?? null : agent.error ?? null,
400243
- outputFilePath: getTaskOutputPath(agent.agentId)
400944
+ outputFilePath: getTaskOutputPath(agent.agentId),
400945
+ // 🔴 缺席位过境(client-core 0.72.12 §59 S-1):只在真在场时落键,缺席不补 `false`。
400946
+ ...isAbsentRow(agent) ? { engineAbsent: !0 } : {}
400244
400947
  })
400245
400948
  ]);
400246
400949
  }
@@ -400318,6 +401021,7 @@ var POST_COMPACT_MAX_FILES_TO_RESTORE, POST_COMPACT_TOKEN_BUDGET, POST_COMPACT_M
400318
401021
  init_sleep2();
400319
401022
  init_slowOperations();
400320
401023
  init_systemPromptType();
401024
+ init_engineAgentAbsence();
400321
401025
  init_diskOutput();
400322
401026
  init_tokens();
400323
401027
  init_toolSearch();
@@ -400809,10 +401513,10 @@ function getEffectiveContextWindowSize(model) {
400809
401513
  }
400810
401514
  return contextWindow - reservedTokensForSummary;
400811
401515
  }
400812
- function getAutoCompactThreshold(model) {
401516
+ function resolveAutoCompactThreshold(model) {
400813
401517
  let engineThreshold = getEngineContextUsageForCurrentSession()?.compactAtTokens;
400814
401518
  if (typeof engineThreshold == "number" && Number.isFinite(engineThreshold))
400815
- return engineThreshold;
401519
+ return { tokens: engineThreshold, source: "engine" };
400816
401520
  let effectiveContextWindow = getEffectiveContextWindowSize(model), autocompactThreshold = effectiveContextWindow - AUTOCOMPACT_BUFFER_TOKENS, envPercent = process.env.SEMA_AUTOCOMPACT_PCT_OVERRIDE;
400817
401521
  if (envPercent) {
400818
401522
  let parsed = parseFloat(envPercent);
@@ -400820,10 +401524,13 @@ function getAutoCompactThreshold(model) {
400820
401524
  let percentageThreshold = Math.floor(
400821
401525
  effectiveContextWindow * (parsed / 100)
400822
401526
  );
400823
- return Math.min(percentageThreshold, autocompactThreshold);
401527
+ return { tokens: Math.min(percentageThreshold, autocompactThreshold), source: "local" };
400824
401528
  }
400825
401529
  }
400826
- return autocompactThreshold;
401530
+ return { tokens: autocompactThreshold, source: "local" };
401531
+ }
401532
+ function getAutoCompactThreshold(model) {
401533
+ return resolveAutoCompactThreshold(model).tokens;
400827
401534
  }
400828
401535
  function calculateTokenWarningState(tokenUsage, model) {
400829
401536
  let autoCompactThreshold = getAutoCompactThreshold(model), threshold2 = isAutoCompactEnabled() ? autoCompactThreshold : getEffectiveContextWindowSize(model), percentLeft = Math.max(
@@ -401340,7 +402047,7 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
401340
402047
  )).skillInfo, skillFrontmatterTokens = skillInfo.skillFrontmatter.reduce(
401341
402048
  (sum, skill) => sum + skill.tokens,
401342
402049
  0
401343
- ), messageTokens = messageBreakdown.totalTokens, isAutoCompact = isAutoCompactEnabled(), lastEngineCompaction = getLastEngineCompactionForCurrentSession(), toolDisclosure = getEngineToolDisclosure(), engineMcpTools = engineMcpContextSection(engineHostedMcpView()), autoCompactThreshold = isAutoCompact ? getAutoCompactThreshold(model) : void 0, cats = [];
402050
+ ), messageTokens = messageBreakdown.totalTokens, isAutoCompact = isAutoCompactEnabled(), lastEngineCompaction = getLastEngineCompactionForCurrentSession(), toolDisclosure = getEngineToolDisclosure(), engineMcpTools = engineMcpContextSection(engineHostedMcpView()), thresholdResolved = isAutoCompact ? resolveAutoCompactThreshold(model) : void 0, autoCompactThreshold = thresholdResolved?.tokens, cats = [];
401344
402051
  systemPromptTokens > 0 && cats.push({
401345
402052
  name: "System prompt",
401346
402053
  tokens: systemPromptTokens,
@@ -401524,6 +402231,8 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
401524
402231
  _sema_categoryTotalSource: totalFromAPI === null ? "estimated" : "engine",
401525
402232
  ...netUnreconciled !== 0 ? { _sema_categoryUnreconciledTokens: netUnreconciled } : {},
401526
402233
  ...lastEngineCompaction !== null ? { _sema_lastCompaction: lastEngineCompaction } : {},
402234
+ // L-366:阈值的出身(自动压缩关着 ⇒ 整键缺席 ⇒ 说明句不渲)。
402235
+ ...thresholdResolved !== void 0 ? { _sema_autoCompactThresholdSource: thresholdResolved.source } : {},
401527
402236
  // L-309:引擎报过普查才带这一位(`null` = 说不出 ⇒ 整段不渲,见型面头注)。
401528
402237
  ...toolDisclosure !== null ? { _sema_toolDisclosure: toolDisclosure } : {},
401529
402238
  // L-360 ①:名册说不出 / 名册在场而零 MCP ⇒ `undefined` ⇒ 整键不带 ⇒ 渲染面整段不渲。
@@ -406061,7 +406770,7 @@ function formatSourceForDisplay(source) {
406061
406770
  case "pathPattern":
406062
406771
  return `pathPattern:${source.pathPattern}`;
406063
406772
  case "settings":
406064
- return `settings:${source.name} (${source.plugins.length} ${plural(source.plugins.length, "plugin")})`;
406773
+ return `settings:${source.name} (${source.plugins.length} ${plural2(source.plugins.length, "plugin")})`;
406065
406774
  default:
406066
406775
  return "unknown source";
406067
406776
  }
@@ -409418,7 +410127,7 @@ async function loadPluginSettings(pluginPath, manifest) {
409418
410127
  let settingsJsonPath = join139(pluginPath, "settings.json");
409419
410128
  try {
409420
410129
  let content = await readFile38(settingsJsonPath, { encoding: "utf-8" }), parsed = jsonParse(content);
409421
- if (isRecord2(parsed)) {
410130
+ if (isRecord4(parsed)) {
409422
410131
  let filtered = parsePluginSettings(parsed);
409423
410132
  if (filtered)
409424
410133
  return logForDebugging(
@@ -410131,7 +410840,7 @@ function cachePluginSettings(plugins) {
410131
410840
  `Cached plugin settings with keys: ${Object.keys(settings2).join(", ")}`
410132
410841
  ));
410133
410842
  }
410134
- function isRecord2(value) {
410843
+ function isRecord4(value) {
410135
410844
  return typeof value == "object" && value !== null && !Array.isArray(value);
410136
410845
  }
410137
410846
  var PluginSettingsSchema, loadAllPlugins, loadAllPluginsCacheOnly, init_pluginLoader = __esm({
@@ -412588,6 +413297,15 @@ You have exited auto mode. The user may now want to interact more directly. You
412588
413297
  isMeta: !0
412589
413298
  })
412590
413299
  ];
413300
+ if (attachment.status === "running" && attachment.engineAbsent === !0)
413301
+ return [
413302
+ createUserMessage({
413303
+ content: wrapInSystemReminder(
413304
+ `Background agent "${attachment.description}" (${attachment.taskId}): the engine no longer reports this agent and its outcome is unknown. Do NOT assume it finished, and do NOT assume it failed. No completion notification will arrive for it. If its result matters, verify independently (e.g. check the files or commands it was asked to touch) before continuing.`
413305
+ ),
413306
+ isMeta: !0
413307
+ })
413308
+ ];
412591
413309
  if (attachment.status === "running") {
412592
413310
  let parts = [
412593
413311
  `Background agent "${attachment.description}" (${attachment.taskId}) is still running.`
@@ -420935,7 +421653,7 @@ function createPermissionRequestMessage(toolName2, decisionReason) {
420935
421653
  needsApproval.push(cmd);
420936
421654
  if (needsApproval.length > 0) {
420937
421655
  let n2 = needsApproval.length;
420938
- return `This ${toolName2} command contains multiple operations. The following ${plural(n2, "part")} ${plural(n2, "requires", "require")} approval: ${needsApproval.join(", ")}`;
421656
+ return `This ${toolName2} command contains multiple operations. The following ${plural2(n2, "part")} ${plural2(n2, "requires", "require")} approval: ${needsApproval.join(", ")}`;
420939
421657
  }
420940
421658
  return `This ${toolName2} command contains multiple operations that require approval`;
420941
421659
  }
@@ -427354,19 +428072,20 @@ var sema_brand_default, init_sema_brand = __esm({
427354
428072
  _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"
427355
428073
  },
427356
428074
  whatsNew: {
427357
- version: "1.0.120",
428075
+ version: "1.0.121",
427358
428076
  notes: [
427359
- "Bundled engine 7.84.0 (core 7.21.1) and client runtime 0.72.8; client SDK stays 9.6.0. /doctor and the engine line report 7.84.0.",
427360
- "/doctor's WebSearch row now has three parts: the backend this shell configured, whether the engine honours it, and the deployment default backend the engine reports (brave, tavily, searxng or none, in the engine's own word). An engine that does not report a default gets a could-not-read sentence, never a made-up none.",
427361
- "New --memory off flag: the run is submitted with the whole memory surface unmounted (recall as well as capture), and /status shows the memory state the engine reports back (none, disabled) rather than what was asked. The only accepted value is off; any other value, or a missing value, is refused up front with the same sentence on the -p lane and in the interactive shell.",
427362
- "Engine notice mcp.server_redialed gets its own transcript line, one per attempt, naming the server, the outcome and the tool count delta; attempts are never folded by server name.",
427363
- "/doctor's permission-posture row adds built-in read deny tiers: \u2026 when the engine reports its built-in read deny tiers; the sentence is simply absent on engines that do not report them.",
427364
- "Plan-mode and cron prompts, the update-config and scheduling skills and /init now all consult the engine's tool roster before telling the model to use AskUserQuestion: when the engine says it is not mounted, every one of those prompts drops the tool name and its control vocabulary; when no roster has been seen they read exactly as in 1.0.119.",
427365
- "Approval cards elide long paths with a 24-bit fingerprint (was 16) so two long paths that differ only in the middle no longer share a fingerprint. After you approve a plan, a follow-up that the shell itself injects (rather than one you typed) is steered into the still-working run automatically instead of raising the Session busy prompt; a message you type while a run is busy still gets the prompt. The Model output error label now comes from the client runtime, so it appears exactly once per row."
428077
+ "Bundled engine 7.86.0 (core 7.22.0) and client runtime 0.72.13; client SDK stays 9.6.0. /doctor and the engine line report 7.86.0.",
428078
+ "On this engine the built-in read deny tiers (credentials, agent-config, shell-history and the rest) ship switched off; operators turn them on per deployment with READ_DENY_BUILTIN_TIERS. Reads of files that the previous engine refused by default (for example .netrc) now go through unless a tier is enabled or a deny rule matches. Commands that run an interpreted program (awk, perl, python) are no longer treated as an always-ask family; they ask like any other command that is not on the read-only allowlist.",
428079
+ "Approving a plan now offers two ways to say yes: approve and auto-accept edits inside the working directory, or approve and keep approving each edit. Whichever you pick is the mode the run continues in, and the shell leaves plan mode either way. Engines older than 7.86.0 keep the previous two-choice card.",
428080
+ "A background agent the engine stops reporting no longer shows up as completed. Its /tasks row says the engine no longer reports it and that the outcome is unknown, its timer stops at the last report, and it is not counted as running in the footer or the panel. After 30 minutes without a report the row is dropped from the panel with a note in the transcript; a real outcome that arrives later is written to the transcript too.",
428081
+ "/status gains a memory line saying whether automatic consolidation is armed on this deployment; when the engine does not report it the line says so instead of guessing.",
428082
+ "sema doctor's Exec row now shows two things: the execution lane this shell requests, and where the engine says tools actually run. When a skill's relative paths cannot be resolved, the second half is the reason.",
428083
+ "When both MODEL_GATEWAY_BASEURL and an explicit MODEL_PROVIDER are set and the gateway wins, model errors and /model failure receipts now say which setting is routing the request; the gateway URL is shown with any credentials or query values masked.",
428084
+ "/context labels the autocompact buffer as decided by the engine's compaction threshold, and only draws a before \u2192 after arrow when the two numbers share the same basis; otherwise both numbers are shown side by side. plugin install now reports a missing user_config value loudly (which plugin, which key, where to set it), and mcp list lists a server skipped for that reason instead of saying nothing is configured."
427366
428085
  ]
427367
428086
  },
427368
- productVersion: "1.0.120",
427369
- announcement: "sema 1.0.120 \u2014 engine 7.84.0 pickup (core 7.21.1), client runtime 0.72.8. New --memory off flag; /doctor's WebSearch row reports the engine's default backend and the permission row its built-in read deny tiers; mcp.server_redialed gets its own transcript line; every prompt that mentions AskUserQuestion now follows the engine's tool roster; injected follow-ups after a plan approval steer into the working run without the Session busy prompt.",
428087
+ productVersion: "1.0.121",
428088
+ announcement: "sema 1.0.121 \u2014 engine 7.86.0 pickup (core 7.22.0), client runtime 0.72.13. Plan approval offers auto-accept or manual approval of edits; background agents the engine stops reporting show outcome unknown instead of completed; /status reports memory auto-consolidation; doctor's Exec row shows where tools run; model errors say which setting routes the request; /context and plugin install stop hiding what they know.",
427370
428089
  version: "1.0.91"
427371
428090
  };
427372
428091
  }
@@ -427481,7 +428200,11 @@ function sessionMemoryStatusLines(verdict) {
427481
428200
  )
427482
428201
  );
427483
428202
  let effectiveScopes = effectiveMemoryScopesDisclosure();
427484
- return effectiveScopes !== void 0 && lines.push(effectiveScopes), lines;
428203
+ effectiveScopes !== void 0 && lines.push(effectiveScopes);
428204
+ let armed3 = readAutoConsolidationArmed(verdict.facts);
428205
+ return lines.push(
428206
+ armed3 === "armed" ? "Session memory: automatic consolidation is armed on this deployment" : armed3 === "unarmed" ? "Session memory: automatic consolidation is not armed on this deployment" : "Session memory: whether automatic consolidation is armed is UNKNOWN (this engine does not report it)"
428207
+ ), lines;
427485
428208
  }
427486
428209
  default:
427487
428210
  return logForDebugging(`sessionMemoryStatusPanel: unknown verdict arm: ${JSON.stringify(verdict)}`), [];
@@ -428280,6 +429003,10 @@ async function defaultEndpointOf(model) {
428280
429003
  let ports2 = modelSwitchProbePorts();
428281
429004
  return ports2 === null ? null : await ports2.endpointOf(model);
428282
429005
  }
429006
+ async function defaultRoutingNote(model) {
429007
+ let ports2 = modelSwitchProbePorts();
429008
+ return ports2 === null ? null : await ports2.routingNote(model);
429009
+ }
428283
429010
  async function defaultValidate(model) {
428284
429011
  let ports2 = modelSwitchProbePorts();
428285
429012
  if (ports2 === null)
@@ -428299,6 +429026,9 @@ function modelSwitchProbeFailureLines(f) {
428299
429026
  ` endpoint: ${f.endpoint ?? "unknown"}`,
428300
429027
  ` model: ${f.model}`,
428301
429028
  ` reason: ${f.reason}`,
429029
+ // L-365:路由来源在场才渲这一项(deploy X-17:屏上只有 `gateway HTTP 401`,没有一处说出
429030
+ // 是哪个 env 决定了这一跳)。缺席 ⇒ 整项不渲,既有四项逐字节不变(负控格)。
429031
+ ...f.routingNote !== void 0 ? [` routing: ${f.routingNote}`] : [],
428302
429032
  " Pick another model, or press Esc to keep the current one."
428303
429033
  ];
428304
429034
  }
@@ -428312,8 +429042,16 @@ async function probeModelForSwitch(model, deps2 = {}) {
428312
429042
  } catch {
428313
429043
  endpoint = null;
428314
429044
  }
428315
- let trimmed3 = rawReason.trim(), reason = trimmed3.length > 0 ? extractProviderErrorMessage(trimmed3) : UNSTATED_REASON;
428316
- return { ok: !1, failure: { model: ref, endpoint, reason, kind } };
429045
+ let trimmed3 = rawReason.trim(), reason = trimmed3.length > 0 ? extractProviderErrorMessage(trimmed3) : UNSTATED_REASON, routingNote = null;
429046
+ try {
429047
+ routingNote = deps2.routingNote !== void 0 ? await deps2.routingNote(ref) : await defaultRoutingNote(ref);
429048
+ } catch {
429049
+ routingNote = null;
429050
+ }
429051
+ return {
429052
+ ok: !1,
429053
+ failure: { model: ref, endpoint, reason, kind, ...routingNote !== null ? { routingNote } : {} }
429054
+ };
428317
429055
  };
428318
429056
  if (deps2.live === void 0 && modelSwitchProbePorts() === null)
428319
429057
  return await fail7("unavailable", PORTS_ABSENT_REASON);
@@ -432920,7 +433658,14 @@ function lastCompactionLine(data) {
432920
433658
  let rec = data._sema_lastCompaction;
432921
433659
  if (rec === void 0 || !Number.isFinite(rec.atMs)) return null;
432922
433660
  let at = localStamp(rec.atMs);
432923
- return rec.preTokens !== void 0 && rec.postTokens !== void 0 ? `Last compaction seen at ${at} \xB7 ${formatTokens(rec.preTokens)} \u2192 ${formatTokens(rec.postTokens)}` : rec.preTokens !== void 0 ? `Last compaction seen at ${at} \xB7 before ${formatTokens(rec.preTokens)}` : `Last compaction seen at ${at}`;
433661
+ if (rec.triggerTokensBefore !== void 0 && rec.postTokens !== void 0) {
433662
+ let shrank = rec.postTokens < rec.triggerTokensBefore;
433663
+ return `Last compaction seen at ${at} \xB7 ${formatTokens(rec.triggerTokensBefore)} \u2192 ${formatTokens(rec.postTokens)}` + (shrank ? "" : " (context did not shrink)");
433664
+ }
433665
+ return rec.preTokens !== void 0 && rec.postTokens !== void 0 ? `Last compaction seen at ${at} \xB7 before ${formatTokens(rec.preTokens)} \xB7 after ${formatTokens(rec.postTokens)} (different scales \u2014 not a before/after delta)` : rec.preTokens !== void 0 ? `Last compaction seen at ${at} \xB7 before ${formatTokens(rec.preTokens)}` : rec.postTokens !== void 0 ? `Last compaction seen at ${at} \xB7 after ${formatTokens(rec.postTokens)}` : `Last compaction seen at ${at}`;
433666
+ }
433667
+ function autocompactBufferSourceLine(data, bufferRowPresent) {
433668
+ return !bufferRowPresent || data._sema_autoCompactThresholdSource !== "engine" ? null : "Autocompact buffer = context window \u2212 the engine's compaction threshold (context_usage.compactAtTokens) \u2014 on a small context window it is the engine's policy, not the shell, that decides how much is reserved";
432924
433669
  }
432925
433670
  function toolDisclosureLine(data) {
432926
433671
  let d4 = data._sema_toolDisclosure;
@@ -433013,7 +433758,10 @@ function ContextVisualization({
433013
433758
  (cat2) => cat2.isDeferred && cat2.name.includes("MCP")
433014
433759
  ), autocompactCategory = categories.find(
433015
433760
  (cat2) => cat2.name === RESERVED_CATEGORY_NAME2
433016
- ), badge = modelBadge(model), compactionLine = lastCompactionLine(data), disclosureLine = toolDisclosureLine(data), engineMcp = engineMcpToolsSection(data);
433761
+ ), badge = modelBadge(model), compactionLine = lastCompactionLine(data), bufferSourceLine = autocompactBufferSourceLine(
433762
+ data,
433763
+ autocompactCategory !== void 0 && autocompactCategory.tokens > 0
433764
+ ), disclosureLine = toolDisclosureLine(data), engineMcp = engineMcpToolsSection(data);
433017
433765
  return /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(ThemedBox_default, { flexDirection: "column", paddingLeft: 1, children: [
433018
433766
  /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedText, { bold: !0, children: "Context Usage" }),
433019
433767
  /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(ThemedBox_default, { flexDirection: "row", gap: 2, children: [
@@ -433271,6 +434019,7 @@ function ContextVisualization({
433271
434019
  sourceDisplay
433272
434020
  ))
433273
434021
  ] }),
434022
+ bufferSourceLine !== null && /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedText, { dimColor: !0, children: bufferSourceLine }) }),
433274
434023
  compactionLine !== null && /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedText, { dimColor: !0, children: compactionLine }) }),
433275
434024
  disclosureLine !== null && /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedBox_default, { children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedText, { dimColor: !0, children: disclosureLine }) }),
433276
434025
  collapseDetailSections && (mcpTools.length > 0 || agents3.length > 0 || memoryFiles.length > 0 || (skills2?.tokens ?? 0) > 0) && /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ThemedText, { dimColor: !0, children: "/context all to expand" }) })
@@ -433450,7 +434199,7 @@ function formatContextAsMarkdownTable(data) {
433450
434199
  messageBreakdown,
433451
434200
  systemTools,
433452
434201
  systemPromptSections
433453
- } = data, output = `## Context Usage
434202
+ } = data, thresholdSource = data._sema_autoCompactThresholdSource, output = `## Context Usage
433454
434203
 
433455
434204
  `;
433456
434205
  output += `**Model:** ${model}
@@ -433483,7 +434232,9 @@ function formatContextAsMarkdownTable(data) {
433483
434232
  if (autocompactCategory && autocompactCategory.tokens > 0) {
433484
434233
  let percentDisplay = (autocompactCategory.tokens / rawMaxTokens * 100).toFixed(1);
433485
434234
  output += `| Autocompact buffer | ${formatTokens(autocompactCategory.tokens)} | ${percentDisplay}% |
433486
- `;
434235
+ `, thresholdSource === "engine" && (output += `
434236
+ Autocompact buffer = context window \u2212 the engine's compaction threshold (context_usage.compactAtTokens) \u2014 on a small context window it is the engine's policy, not the shell, that decides how much is reserved.
434237
+ `);
433487
434238
  }
433488
434239
  output += `
433489
434240
  `;
@@ -434104,13 +434855,13 @@ function DiffFileList(t0) {
434104
434855
  let visibleFiles = files2.slice(startIndex, endIndex), hasMoreAbove = startIndex > 0;
434105
434856
  hasMoreBelow = endIndex < files2.length, needsPagination = files2.length > MAX_VISIBLE_FILES;
434106
434857
  let maxPathWidth = Math.max(20, columns - 16 - 3 - 4);
434107
- T0 = ThemedBox_default, t2 = "column", $3[17] !== hasMoreAbove || $3[18] !== needsPagination || $3[19] !== startIndex ? (t3 = needsPagination && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(ThemedText, { dimColor: !0, children: hasMoreAbove ? ` \u2191 ${startIndex} more ${plural(startIndex, "file")}` : " " }), $3[17] = hasMoreAbove, $3[18] = needsPagination, $3[19] = startIndex, $3[20] = t3) : t3 = $3[20];
434858
+ T0 = ThemedBox_default, t2 = "column", $3[17] !== hasMoreAbove || $3[18] !== needsPagination || $3[19] !== startIndex ? (t3 = needsPagination && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(ThemedText, { dimColor: !0, children: hasMoreAbove ? ` \u2191 ${startIndex} more ${plural2(startIndex, "file")}` : " " }), $3[17] = hasMoreAbove, $3[18] = needsPagination, $3[19] = startIndex, $3[20] = t3) : t3 = $3[20];
434108
434859
  let t52;
434109
434860
  $3[21] !== maxPathWidth || $3[22] !== selectedIndex || $3[23] !== startIndex ? (t52 = (file2, index) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(FileItem, { file: file2, isSelected: startIndex + index === selectedIndex, maxPathWidth }, file2.path), $3[21] = maxPathWidth, $3[22] = selectedIndex, $3[23] = startIndex, $3[24] = t52) : t52 = $3[24], t4 = visibleFiles.map(t52), $3[6] = columns, $3[7] = endIndex, $3[8] = files2, $3[9] = selectedIndex, $3[10] = startIndex, $3[11] = T0, $3[12] = hasMoreBelow, $3[13] = needsPagination, $3[14] = t2, $3[15] = t3, $3[16] = t4;
434110
434861
  } else
434111
434862
  T0 = $3[11], hasMoreBelow = $3[12], needsPagination = $3[13], t2 = $3[14], t3 = $3[15], t4 = $3[16];
434112
434863
  let t5;
434113
- $3[25] !== endIndex || $3[26] !== files2.length || $3[27] !== hasMoreBelow || $3[28] !== needsPagination ? (t5 = needsPagination && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(ThemedText, { dimColor: !0, children: hasMoreBelow ? ` \u2193 ${files2.length - endIndex} more ${plural(files2.length - endIndex, "file")}` : " " }), $3[25] = endIndex, $3[26] = files2.length, $3[27] = hasMoreBelow, $3[28] = needsPagination, $3[29] = t5) : t5 = $3[29];
434864
+ $3[25] !== endIndex || $3[26] !== files2.length || $3[27] !== hasMoreBelow || $3[28] !== needsPagination ? (t5 = needsPagination && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(ThemedText, { dimColor: !0, children: hasMoreBelow ? ` \u2193 ${files2.length - endIndex} more ${plural2(files2.length - endIndex, "file")}` : " " }), $3[25] = endIndex, $3[26] = files2.length, $3[27] = hasMoreBelow, $3[28] = needsPagination, $3[29] = t5) : t5 = $3[29];
434114
434865
  let t6;
434115
434866
  return $3[30] !== T0 || $3[31] !== t2 || $3[32] !== t3 || $3[33] !== t4 || $3[34] !== t5 ? (t6 = /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(T0, { flexDirection: t2, children: [
434116
434867
  t3,
@@ -434276,7 +435027,7 @@ function DiffDialog(t0) {
434276
435027
  $3[38] !== diffData.stats ? (t17 = diffData.stats ? /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(ThemedText, { dimColor: !0, children: [
434277
435028
  diffData.stats.filesCount,
434278
435029
  " ",
434279
- plural(diffData.stats.filesCount, "file"),
435030
+ plural2(diffData.stats.filesCount, "file"),
434280
435031
  " ",
434281
435032
  "changed",
434282
435033
  diffData.stats.linesAdded > 0 && /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(ThemedText, { color: "diffAddedWord", children: [
@@ -437599,7 +438350,7 @@ function InstallGitHubApp(props) {
437599
438350
  step: "error",
437600
438351
  error: `GitHub CLI is missing required permissions: ${missingScopes.join(", ")}.`,
437601
438352
  errorReason: "Missing required scopes",
437602
- errorInstructions: [`Your GitHub CLI authentication is missing the "${missingScopes.join('" and "')}" ${plural(missingScopes.length, "scope")} needed to manage GitHub Actions and secrets.`, "", "To fix this, run:", " gh auth refresh -h github.com -s repo,workflow", "", "This will add the necessary permissions to manage workflows and secrets."]
438353
+ errorInstructions: [`Your GitHub CLI authentication is missing the "${missingScopes.join('" and "')}" ${plural2(missingScopes.length, "scope")} needed to manage GitHub Actions and secrets.`, "", "To fix this, run:", " gh auth refresh -h github.com -s repo,workflow", "", "This will add the necessary permissions to manage workflows and secrets."]
437603
438354
  }));
437604
438355
  return;
437605
438356
  }
@@ -438478,7 +439229,7 @@ function MCPListPanel(t0) {
438478
439229
  let renderAgentServerItem = t18, totalServers = servers.length + agentServers.length, t19;
438479
439230
  $3[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t19 = /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(McpParsingWarnings, {}), $3[45] = t19) : t19 = $3[45];
438480
439231
  let t20;
438481
- $3[46] !== totalServers ? (t20 = plural(totalServers, "server"), $3[46] = totalServers, $3[47] = t20) : t20 = $3[47];
439232
+ $3[46] !== totalServers ? (t20 = plural2(totalServers, "server"), $3[46] = totalServers, $3[47] = t20) : t20 = $3[47];
438482
439233
  let t21 = `${totalServers} ${t20}`, t22;
438483
439234
  $3[48] !== renderServerItem || $3[49] !== serversByScope ? (t22 = SCOPE_ORDER.map((scope_0) => {
438484
439235
  let scopeServers_0 = serversByScope.get(scope_0);
@@ -439304,7 +440055,7 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = !1) {
439304
440055
  timers.clear(), flushTimerRef.current !== null && (clearTimeout(flushTimerRef.current), flushTimerRef.current = null, flushPendingUpdates());
439305
440056
  };
439306
440057
  }, [flushPendingUpdates]);
439307
- let reconnectMcpServer = (0, import_react133.useCallback)(
440058
+ let reconnectMcpServer2 = (0, import_react133.useCallback)(
439308
440059
  async (serverName) => {
439309
440060
  let client3 = store.getState().mcp.clients.find((c3) => c3.name === serverName);
439310
440061
  if (!client3)
@@ -439348,7 +440099,7 @@ function useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig = !1) {
439348
440099
  retireStaleConnection
439349
440100
  ]
439350
440101
  );
439351
- return { reconnectMcpServer, toggleMcpServer };
440102
+ return { reconnectMcpServer: reconnectMcpServer2, toggleMcpServer };
439352
440103
  }
439353
440104
  function getTransportDisplayName(type) {
439354
440105
  switch (type) {
@@ -439409,13 +440160,13 @@ function MCPConnectionManager(t0) {
439409
440160
  dynamicMcpConfig,
439410
440161
  isStrictMcpConfig
439411
440162
  } = t0, {
439412
- reconnectMcpServer,
440163
+ reconnectMcpServer: reconnectMcpServer2,
439413
440164
  toggleMcpServer
439414
440165
  } = useManageMCPConnections(dynamicMcpConfig, isStrictMcpConfig), t1;
439415
- $3[0] !== reconnectMcpServer || $3[1] !== toggleMcpServer ? (t1 = {
439416
- reconnectMcpServer,
440166
+ $3[0] !== reconnectMcpServer2 || $3[1] !== toggleMcpServer ? (t1 = {
440167
+ reconnectMcpServer: reconnectMcpServer2,
439417
440168
  toggleMcpServer
439418
- }, $3[0] = reconnectMcpServer, $3[1] = toggleMcpServer, $3[2] = t1) : t1 = $3[2];
440169
+ }, $3[0] = reconnectMcpServer2, $3[1] = toggleMcpServer, $3[2] = t1) : t1 = $3[2];
439419
440170
  let value = t1, t2;
439420
440171
  return $3[3] !== children || $3[4] !== value ? (t2 = /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(MCPConnectionContext.Provider, { value, children }), $3[3] = children, $3[4] = value, $3[5] = t2) : t2 = $3[5], t2;
439421
440172
  }
@@ -439432,15 +440183,15 @@ function MCPReconnect(t0) {
439432
440183
  let $3 = (0, import_compiler_runtime162.c)(25), {
439433
440184
  serverName,
439434
440185
  onComplete
439435
- } = t0, [theme2] = useTheme(), store = useAppStateStore(), reconnectMcpServer = useMcpReconnect(), [isReconnecting, setIsReconnecting] = (0, import_react135.useState)(!0), [error51, setError] = (0, import_react135.useState)(null), t1, t2;
439436
- if ($3[0] !== onComplete || $3[1] !== reconnectMcpServer || $3[2] !== serverName || $3[3] !== store ? (t1 = () => {
440186
+ } = t0, [theme2] = useTheme(), store = useAppStateStore(), reconnectMcpServer2 = useMcpReconnect(), [isReconnecting, setIsReconnecting] = (0, import_react135.useState)(!0), [error51, setError] = (0, import_react135.useState)(null), t1, t2;
440187
+ if ($3[0] !== onComplete || $3[1] !== reconnectMcpServer2 || $3[2] !== serverName || $3[3] !== store ? (t1 = () => {
439437
440188
  (async function() {
439438
440189
  try {
439439
440190
  if (!store.getState().mcp.clients.find((c3) => c3.name === serverName)) {
439440
440191
  setError(`MCP server "${serverName}" not found`), setIsReconnecting(!1), onComplete(`MCP server "${serverName}" not found`);
439441
440192
  return;
439442
440193
  }
439443
- let result = await reconnectMcpServer(serverName);
440194
+ let result = await reconnectMcpServer2(serverName);
439444
440195
  bb43: switch (result.client.type) {
439445
440196
  case "connected": {
439446
440197
  setIsReconnecting(!1), onComplete(`Successfully reconnected to ${serverName}`);
@@ -439460,7 +440211,7 @@ function MCPReconnect(t0) {
439460
440211
  setError(errorMessage5), setIsReconnecting(!1), onComplete(`Error: ${errorMessage5}`);
439461
440212
  }
439462
440213
  })();
439463
- }, t2 = [serverName, reconnectMcpServer, store, onComplete], $3[0] = onComplete, $3[1] = reconnectMcpServer, $3[2] = serverName, $3[3] = store, $3[4] = t1, $3[5] = t2) : (t1 = $3[4], t2 = $3[5]), (0, import_react135.useEffect)(t1, t2), isReconnecting) {
440214
+ }, t2 = [serverName, reconnectMcpServer2, store, onComplete], $3[0] = onComplete, $3[1] = reconnectMcpServer2, $3[2] = serverName, $3[3] = store, $3[4] = t1, $3[5] = t2) : (t1 = $3[4], t2 = $3[5]), (0, import_react135.useEffect)(t1, t2), isReconnecting) {
439464
440215
  let t3;
439465
440216
  $3[6] !== serverName ? (t3 = /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(ThemedText, { color: "text", children: [
439466
440217
  "Reconnecting to ",
@@ -439780,17 +440531,17 @@ function MCPRemoteServerMenu({
439780
440531
  (0, import_react136.useEffect)(() => () => {
439781
440532
  unmountedRef.current = !0, authAbortControllerRef.current?.abort(), copyTimeoutRef.current !== void 0 && clearTimeout(copyTimeoutRef.current);
439782
440533
  }, []);
439783
- let isEffectivelyAuthenticated = server.isAuthenticated || server.client.type === "connected" && serverToolsCount > 0, reconnectMcpServer = useMcpReconnect(), handleClaudeAIAuthComplete = import_react136.default.useCallback(async () => {
440534
+ let isEffectivelyAuthenticated = server.isAuthenticated || server.client.type === "connected" && serverToolsCount > 0, reconnectMcpServer2 = useMcpReconnect(), handleClaudeAIAuthComplete = import_react136.default.useCallback(async () => {
439784
440535
  setIsClaudeAIAuthenticating(!1), setClaudeAIAuthUrl(null), setIsReconnecting(!0);
439785
440536
  try {
439786
- let result = await reconnectMcpServer(server.name), success2 = result.client.type === "connected";
440537
+ let result = await reconnectMcpServer2(server.name), success2 = result.client.type === "connected";
439787
440538
  success2 ? onComplete?.(`Authentication successful. Connected to ${server.name}.`) : result.client.type === "needs-auth" ? onComplete?.("Authentication successful, but server still requires authentication. You may need to manually restart Sema.") : onComplete?.("Authentication successful, but server reconnection failed. You may need to manually restart Sema for the changes to take effect.");
439788
440539
  } catch (err8) {
439789
440540
  onComplete?.(handleReconnectError(err8, server.name));
439790
440541
  } finally {
439791
440542
  setIsReconnecting(!1);
439792
440543
  }
439793
- }, [reconnectMcpServer, server.name, onComplete]), handleClaudeAIClearAuthComplete = import_react136.default.useCallback(async () => {
440544
+ }, [reconnectMcpServer2, server.name, onComplete]), handleClaudeAIClearAuthComplete = import_react136.default.useCallback(async () => {
439794
440545
  await clearServerCache(server.name, {
439795
440546
  ...server.config,
439796
440547
  scope: server.scope
@@ -439872,7 +440623,7 @@ function MCPRemoteServerMenu({
439872
440623
  setManualCallbackSubmit(() => submit);
439873
440624
  }
439874
440625
  }), server.isAuthenticated;
439875
- let result_0 = await reconnectMcpServer(server.name);
440626
+ let result_0 = await reconnectMcpServer2(server.name);
439876
440627
  if (result_0.client.type === "connected") {
439877
440628
  let message = isEffectivelyAuthenticated ? `Authentication successful. Reconnected to ${server.name}.` : `Authentication successful. Connected to ${server.name}.`;
439878
440629
  onComplete?.(message);
@@ -439883,7 +440634,7 @@ function MCPRemoteServerMenu({
439883
440634
  } finally {
439884
440635
  setIsAuthenticating(!1), authAbortControllerRef.current = null, setManualCallbackSubmit(null), setCallbackUrlInput("");
439885
440636
  }
439886
- }, [server.isAuthenticated, server.config, server.name, onComplete, reconnectMcpServer, isEffectivelyAuthenticated]), handleClearAuth = async () => {
440637
+ }, [server.isAuthenticated, server.config, server.name, onComplete, reconnectMcpServer2, isEffectivelyAuthenticated]), handleClearAuth = async () => {
439887
440638
  server.config.type !== "claudeai-proxy" && server.config && (await revokeServerTokens(server.name, server.config), await clearServerCache(server.name, {
439888
440639
  ...server.config,
439889
440640
  scope: server.scope
@@ -440135,7 +440886,7 @@ function MCPRemoteServerMenu({
440135
440886
  case "reconnectMcpServer":
440136
440887
  setIsReconnecting(!0);
440137
440888
  try {
440138
- let result_1 = await reconnectMcpServer(server.name);
440889
+ let result_1 = await reconnectMcpServer2(server.name);
440139
440890
  server.config.type === "claudeai-proxy" && (result_1.client.type, void 0);
440140
440891
  let {
440141
440892
  message: message_0
@@ -440259,7 +441010,7 @@ function MCPStdioServerMenu({
440259
441010
  onComplete,
440260
441011
  borderless = !1
440261
441012
  }) {
440262
- let [theme2] = useTheme(), exitState = useExitOnCtrlCDWithKeybindings(), mcp2 = useAppState((s) => s.mcp), reconnectMcpServer = useMcpReconnect(), toggleMcpServer = useMcpToggleEnabled(), [isReconnecting, setIsReconnecting] = (0, import_react137.useState)(!1), handleToggleEnabled = import_react137.default.useCallback(async () => {
441013
+ let [theme2] = useTheme(), exitState = useExitOnCtrlCDWithKeybindings(), mcp2 = useAppState((s) => s.mcp), reconnectMcpServer2 = useMcpReconnect(), toggleMcpServer = useMcpToggleEnabled(), [isReconnecting, setIsReconnecting] = (0, import_react137.useState)(!1), handleToggleEnabled = import_react137.default.useCallback(async () => {
440263
441014
  let wasEnabled = server.client.type !== "disabled";
440264
441015
  try {
440265
441016
  await toggleMcpServer(server.name), onCancel();
@@ -440339,7 +441090,7 @@ function MCPStdioServerMenu({
440339
441090
  else if (value === "reconnectMcpServer") {
440340
441091
  setIsReconnecting(!0);
440341
441092
  try {
440342
- let result = await reconnectMcpServer(server.name), {
441093
+ let result = await reconnectMcpServer2(server.name), {
440343
441094
  message
440344
441095
  } = handleReconnectResult(result, server.name, engineLegDeclaresServer(server.name, observedWiringMcp()));
440345
441096
  onComplete?.(message);
@@ -440537,7 +441288,7 @@ function MCPToolListView(t0) {
440537
441288
  } else
440538
441289
  t2 = $3[6];
440539
441290
  let toolOptions = t2, t3 = `Tools for ${server.name}`, t4 = serverTools.length, t5;
440540
- $3[9] !== serverTools.length ? (t5 = plural(serverTools.length, "tool"), $3[9] = serverTools.length, $3[10] = t5) : t5 = $3[10];
441291
+ $3[9] !== serverTools.length ? (t5 = plural2(serverTools.length, "tool"), $3[9] = serverTools.length, $3[10] = t5) : t5 = $3[10];
440541
441292
  let t6 = `${t4} ${t5}`, t7;
440542
441293
  $3[11] !== onBack || $3[12] !== onSelectTool || $3[13] !== serverTools || $3[14] !== toolOptions ? (t7 = serverTools.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(ThemedText, { dimColor: !0, children: "No tools available" }) : /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(Select, { options: toolOptions, onChange: (value) => {
440543
441294
  let index_0 = parseInt(value), tool_0 = serverTools[index_0];
@@ -441746,7 +442497,7 @@ function BrowseMarketplace({
441746
442497
  }));
441747
442498
  }
441748
442499
  if (setInstallingPlugins(/* @__PURE__ */ new Set()), setSelectedForInstall(/* @__PURE__ */ new Set()), clearAllCaches(), failureCount === 0) {
441749
- let message = `\u2713 Installed ${successCount_0} ${plural(successCount_0, "plugin")}. Run /reload-plugins to activate.`;
442500
+ let message = `\u2713 Installed ${successCount_0} ${plural2(successCount_0, "plugin")}. Run /reload-plugins to activate.`;
441750
442501
  setResult(message);
441751
442502
  } else if (successCount_0 === 0)
441752
442503
  setError(`Failed to install: ${formatFailureDetails(newFailedPlugins, !0)}`);
@@ -441912,7 +442663,7 @@ function BrowseMarketplace({
441912
442663
  /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ThemedBox_default, { marginLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(ThemedText, { dimColor: !0, children: [
441913
442664
  marketplace_3.totalPlugins,
441914
442665
  " ",
441915
- plural(marketplace_3.totalPlugins, "plugin"),
442666
+ plural2(marketplace_3.totalPlugins, "plugin"),
441916
442667
  " available",
441917
442668
  marketplace_3.installedCount > 0 && ` \xB7 ${marketplace_3.installedCount} already installed`,
441918
442669
  marketplace_3.source && ` \xB7 ${marketplace_3.source}`
@@ -442446,7 +443197,7 @@ function DiscoverPlugins({
442446
443197
  }));
442447
443198
  }
442448
443199
  if (setInstallingPlugins(/* @__PURE__ */ new Set()), setSelectedForInstall(/* @__PURE__ */ new Set()), clearAllCaches(), failureCount === 0) {
442449
- let message = `\u2713 Installed ${successCount_0} ${plural(successCount_0, "plugin")}. Run /reload-plugins to activate.`;
443200
+ let message = `\u2713 Installed ${successCount_0} ${plural2(successCount_0, "plugin")}. Run /reload-plugins to activate.`;
442450
443201
  setResult(message);
442451
443202
  } else if (successCount_0 === 0)
442452
443203
  setError(`Failed to install: ${formatFailureDetails(newFailedPlugins, !0)}`);
@@ -443136,12 +443887,12 @@ async function disableAllPluginsOp() {
443136
443887
  }
443137
443888
  return errors2.length > 0 ? {
443138
443889
  success: !1,
443139
- message: `Disabled ${disabled.length} ${plural(disabled.length, "plugin")}, ${errors2.length} failed:
443890
+ message: `Disabled ${disabled.length} ${plural2(disabled.length, "plugin")}, ${errors2.length} failed:
443140
443891
  ${errors2.join(`
443141
443892
  `)}`
443142
443893
  } : {
443143
443894
  success: !0,
443144
- message: `Disabled ${disabled.length} ${plural(disabled.length, "plugin")}`
443895
+ message: `Disabled ${disabled.length} ${plural2(disabled.length, "plugin")}`
443145
443896
  };
443146
443897
  }
443147
443898
  async function updatePluginOp(plugin2, scope) {
@@ -443562,10 +444313,10 @@ function ManageMarketplaces({
443562
444313
  }
443563
444314
  let actions = [];
443564
444315
  if (updatedCount > 0) {
443565
- let pluginPart = updatedPluginCount > 0 ? ` (${updatedPluginCount} ${plural(updatedPluginCount, "plugin")} bumped)` : "";
443566
- actions.push(`Updated ${updatedCount} ${plural(updatedCount, "marketplace")}${pluginPart}`);
444316
+ let pluginPart = updatedPluginCount > 0 ? ` (${updatedPluginCount} ${plural2(updatedPluginCount, "plugin")} bumped)` : "";
444317
+ actions.push(`Updated ${updatedCount} ${plural2(updatedCount, "marketplace")}${pluginPart}`);
443567
444318
  }
443568
- if (removedCount > 0 && actions.push(`Removed ${removedCount} ${plural(removedCount, "marketplace")}`), actions.length > 0) {
444319
+ if (removedCount > 0 && actions.push(`Removed ${removedCount} ${plural2(removedCount, "marketplace")}`), actions.length > 0) {
443569
444320
  let successMsg = `${figures_default.tick} ${actions.join(", ")}`;
443570
444321
  wasInDetailsView ? setSuccessMessage(successMsg) : (setResult(successMsg), setTimeout(setViewState, 2e3, {
443571
444322
  type: "menu"
@@ -443737,7 +444488,7 @@ function ManageMarketplaces({
443737
444488
  "This will also uninstall ",
443738
444489
  pluginCount,
443739
444490
  " ",
443740
- plural(pluginCount, "plugin"),
444491
+ plural2(pluginCount, "plugin"),
443741
444492
  " from this marketplace:"
443742
444493
  ] }) }),
443743
444494
  selectedMarketplace.installedPlugins && selectedMarketplace.installedPlugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(ThemedBox_default, { flexDirection: "column", marginTop: 1, marginLeft: 2, children: selectedMarketplace.installedPlugins.map((plugin2) => /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(ThemedText, { dimColor: !0, children: [
@@ -443763,7 +444514,7 @@ function ManageMarketplaces({
443763
444514
  selectedMarketplace.pluginCount || 0,
443764
444515
  " available",
443765
444516
  " ",
443766
- plural(selectedMarketplace.pluginCount || 0, "plugin")
444517
+ plural2(selectedMarketplace.pluginCount || 0, "plugin")
443767
444518
  ] }) }),
443768
444519
  selectedMarketplace.installedPlugins && selectedMarketplace.installedPlugins.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(ThemedBox_default, { flexDirection: "column", marginTop: 1, children: [
443769
444520
  /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(ThemedText, { bold: !0, children: [
@@ -443872,13 +444623,13 @@ function ManageMarketplaces({
443872
444623
  "\u2022 Update ",
443873
444624
  updateCount,
443874
444625
  " ",
443875
- plural(updateCount, "marketplace")
444626
+ plural2(updateCount, "marketplace")
443876
444627
  ] }),
443877
444628
  removeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(ThemedText, { color: "warning", children: [
443878
444629
  "\u2022 Remove ",
443879
444630
  removeCount,
443880
444631
  " ",
443881
- plural(removeCount, "marketplace")
444632
+ plural2(removeCount, "marketplace")
443882
444633
  ] })
443883
444634
  ] }),
443884
444635
  isProcessing && /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(ThemedText, { color: "claude", children: "Processing changes\u2026" }) }),
@@ -444167,7 +444918,7 @@ function UnifiedInstalledCell(t0) {
444167
444918
  let t15;
444168
444919
  $3[2] !== theme2 ? (t15 = color("error", theme2)(figures_default.cross), $3[2] = theme2, $3[3] = t15) : t15 = $3[3], statusIcon = t15;
444169
444920
  let t23 = item.errorCount, t33;
444170
- $3[4] !== item.errorCount ? (t33 = plural(item.errorCount, "error"), $3[4] = item.errorCount, $3[5] = t33) : t33 = $3[5], statusText = `${t23} ${t33}`;
444921
+ $3[4] !== item.errorCount ? (t33 = plural2(item.errorCount, "error"), $3[4] = item.errorCount, $3[5] = t33) : t33 = $3[5], statusText = `${t23} ${t33}`;
444171
444922
  } else if (item.isEnabled) {
444172
444923
  let t15;
444173
444924
  $3[8] !== theme2 ? (t15 = color("success", theme2)(figures_default.tick), $3[8] = theme2, $3[9] = t15) : t15 = $3[9], statusIcon = t15, statusText = "enabled";
@@ -444250,7 +445001,7 @@ function UnifiedInstalledCell(t0) {
444250
445001
  let t14;
444251
445002
  $3[59] !== theme2 ? (t14 = color("error", theme2)(figures_default.cross), $3[59] = theme2, $3[60] = t14) : t14 = $3[60];
444252
445003
  let statusIcon_1 = t14, t22 = item.errorCount, t32;
444253
- $3[61] !== item.errorCount ? (t32 = plural(item.errorCount, "error"), $3[61] = item.errorCount, $3[62] = t32) : t32 = $3[62];
445004
+ $3[61] !== item.errorCount ? (t32 = plural2(item.errorCount, "error"), $3[61] = item.errorCount, $3[62] = t32) : t32 = $3[62];
444254
445005
  let statusText_0 = `failed to load \xB7 ${t22} ${t32}`, t42 = isSelected ? "suggestion" : void 0, t52 = isSelected ? `${figures_default.pointer} ` : " ", t62;
444255
445006
  $3[63] !== t42 || $3[64] !== t52 ? (t62 = /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(ThemedText, { color: t42, children: t52 }), $3[63] = t42, $3[64] = t52, $3[65] = t62) : t62 = $3[65];
444256
445007
  let t72 = isSelected ? "suggestion" : void 0, t82;
@@ -445341,7 +446092,7 @@ function ManagePlugins({
445341
446092
  /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(ThemedText, { bold: !0, color: "error", children: [
445342
446093
  filteredPluginErrors.length,
445343
446094
  " ",
445344
- plural(filteredPluginErrors.length, "error"),
446095
+ plural2(filteredPluginErrors.length, "error"),
445345
446096
  ":"
445346
446097
  ] }),
445347
446098
  filteredPluginErrors.map((error_3, i_0) => {
@@ -446252,13 +447003,13 @@ Or from the command line:
446252
447003
  let result = await validateManifest2(path28), output = "";
446253
447004
  output = output + `Validating ${result.fileType} manifest: ${result.filePath}
446254
447005
 
446255
- `, result.errors.length > 0 && (output = output + `${figures_default.cross} Found ${result.errors.length} ${plural(result.errors.length, "error")}:
447006
+ `, result.errors.length > 0 && (output = output + `${figures_default.cross} Found ${result.errors.length} ${plural2(result.errors.length, "error")}:
446256
447007
 
446257
447008
  `, result.errors.forEach((error_0) => {
446258
447009
  output = output + ` ${figures_default.pointer} ${error_0.path}: ${error_0.message}
446259
447010
  `;
446260
447011
  }), output = output + `
446261
- `), result.warnings.length > 0 && (output = output + `${figures_default.warning} Found ${result.warnings.length} ${plural(result.warnings.length, "warning")}:
447012
+ `), result.warnings.length > 0 && (output = output + `${figures_default.warning} Found ${result.warnings.length} ${plural2(result.warnings.length, "warning")}:
446262
447013
 
446263
447014
  `, result.warnings.forEach((warning) => {
446264
447015
  output = output + ` ${figures_default.pointer} ${warning.path}: ${warning.message}
@@ -453998,7 +454749,7 @@ function NewMessagesPill(t0) {
453998
454749
  } = t0, [hover, setHover] = (0, import_react165.useState)(!1), t1, t2;
453999
454750
  $3[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setHover(!0), t2 = () => setHover(!1), $3[0] = t1, $3[1] = t2) : (t1 = $3[0], t2 = $3[1]);
454000
454751
  let t3 = hover ? "userMessageBackgroundHover" : "userMessageBackground", t4;
454001
- $3[2] !== count3 ? (t4 = count3 > 0 ? `${count3} new ${plural(count3, "message")}` : "Jump to bottom", $3[2] = count3, $3[3] = t4) : t4 = $3[3];
454752
+ $3[2] !== count3 ? (t4 = count3 > 0 ? `${count3} new ${plural2(count3, "message")}` : "Jump to bottom", $3[2] = count3, $3[3] = t4) : t4 = $3[3];
454002
454753
  let t5;
454003
454754
  if ($3[4] !== t3 || $3[5] !== t4) {
454004
454755
  let clickHint = process.platform === "darwin" ? " (click) " : " ";
@@ -454594,19 +455345,20 @@ var require_sema_brand = __commonJS({
454594
455345
  _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"
454595
455346
  },
454596
455347
  whatsNew: {
454597
- version: "1.0.120",
455348
+ version: "1.0.121",
454598
455349
  notes: [
454599
- "Bundled engine 7.84.0 (core 7.21.1) and client runtime 0.72.8; client SDK stays 9.6.0. /doctor and the engine line report 7.84.0.",
454600
- "/doctor's WebSearch row now has three parts: the backend this shell configured, whether the engine honours it, and the deployment default backend the engine reports (brave, tavily, searxng or none, in the engine's own word). An engine that does not report a default gets a could-not-read sentence, never a made-up none.",
454601
- "New --memory off flag: the run is submitted with the whole memory surface unmounted (recall as well as capture), and /status shows the memory state the engine reports back (none, disabled) rather than what was asked. The only accepted value is off; any other value, or a missing value, is refused up front with the same sentence on the -p lane and in the interactive shell.",
454602
- "Engine notice mcp.server_redialed gets its own transcript line, one per attempt, naming the server, the outcome and the tool count delta; attempts are never folded by server name.",
454603
- "/doctor's permission-posture row adds built-in read deny tiers: \u2026 when the engine reports its built-in read deny tiers; the sentence is simply absent on engines that do not report them.",
454604
- "Plan-mode and cron prompts, the update-config and scheduling skills and /init now all consult the engine's tool roster before telling the model to use AskUserQuestion: when the engine says it is not mounted, every one of those prompts drops the tool name and its control vocabulary; when no roster has been seen they read exactly as in 1.0.119.",
454605
- "Approval cards elide long paths with a 24-bit fingerprint (was 16) so two long paths that differ only in the middle no longer share a fingerprint. After you approve a plan, a follow-up that the shell itself injects (rather than one you typed) is steered into the still-working run automatically instead of raising the Session busy prompt; a message you type while a run is busy still gets the prompt. The Model output error label now comes from the client runtime, so it appears exactly once per row."
455350
+ "Bundled engine 7.86.0 (core 7.22.0) and client runtime 0.72.13; client SDK stays 9.6.0. /doctor and the engine line report 7.86.0.",
455351
+ "On this engine the built-in read deny tiers (credentials, agent-config, shell-history and the rest) ship switched off; operators turn them on per deployment with READ_DENY_BUILTIN_TIERS. Reads of files that the previous engine refused by default (for example .netrc) now go through unless a tier is enabled or a deny rule matches. Commands that run an interpreted program (awk, perl, python) are no longer treated as an always-ask family; they ask like any other command that is not on the read-only allowlist.",
455352
+ "Approving a plan now offers two ways to say yes: approve and auto-accept edits inside the working directory, or approve and keep approving each edit. Whichever you pick is the mode the run continues in, and the shell leaves plan mode either way. Engines older than 7.86.0 keep the previous two-choice card.",
455353
+ "A background agent the engine stops reporting no longer shows up as completed. Its /tasks row says the engine no longer reports it and that the outcome is unknown, its timer stops at the last report, and it is not counted as running in the footer or the panel. After 30 minutes without a report the row is dropped from the panel with a note in the transcript; a real outcome that arrives later is written to the transcript too.",
455354
+ "/status gains a memory line saying whether automatic consolidation is armed on this deployment; when the engine does not report it the line says so instead of guessing.",
455355
+ "sema doctor's Exec row now shows two things: the execution lane this shell requests, and where the engine says tools actually run. When a skill's relative paths cannot be resolved, the second half is the reason.",
455356
+ "When both MODEL_GATEWAY_BASEURL and an explicit MODEL_PROVIDER are set and the gateway wins, model errors and /model failure receipts now say which setting is routing the request; the gateway URL is shown with any credentials or query values masked.",
455357
+ "/context labels the autocompact buffer as decided by the engine's compaction threshold, and only draws a before \u2192 after arrow when the two numbers share the same basis; otherwise both numbers are shown side by side. plugin install now reports a missing user_config value loudly (which plugin, which key, where to set it), and mcp list lists a server skipped for that reason instead of saying nothing is configured."
454606
455358
  ]
454607
455359
  },
454608
- productVersion: "1.0.120",
454609
- announcement: "sema 1.0.120 \u2014 engine 7.84.0 pickup (core 7.21.1), client runtime 0.72.8. New --memory off flag; /doctor's WebSearch row reports the engine's default backend and the permission row its built-in read deny tiers; mcp.server_redialed gets its own transcript line; every prompt that mentions AskUserQuestion now follows the engine's tool roster; injected follow-ups after a plan approval steer into the working run without the Session busy prompt.",
455360
+ productVersion: "1.0.121",
455361
+ announcement: "sema 1.0.121 \u2014 engine 7.86.0 pickup (core 7.22.0), client runtime 0.72.13. Plan approval offers auto-accept or manual approval of edits; background agents the engine stops reporting show outcome unknown instead of completed; /status reports memory auto-consolidation; doctor's Exec row shows where tools run; model errors say which setting routes the request; /context and plugin install stop hiding what they know.",
454610
455362
  version: "1.0.91"
454611
455363
  };
454612
455364
  }
@@ -454909,7 +455661,7 @@ var import_compiler_runtime193, React94, import_react167, import_jsx_runtime279,
454909
455661
  }, [progress, progressEnabled, hasToolsInProgress]), (0, import_react167.useEffect)(() => () => progress(null), [progress]);
454910
455662
  let messageKey = (0, import_react167.useCallback)((msg_7) => `${msg_7.uuid}-${conversationId}`, [conversationId]), renderMessageRow = (msg_8, index) => {
454911
455663
  let prevType = index > 0 ? renderableMessages[index - 1]?.type : void 0, isUserContinuation = msg_8.type === "user" && prevType === "user", hasContentAfter = msg_8.type === "collapsed_read_search" && (!!streamingText || hasContentAfterIndex(renderableMessages, index, tools, streamingToolUseIDs)), k_0 = messageKey(msg_8), row2 = /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(MessageRow, { message: msg_8, isUserContinuation, hasContentAfter, tools, commands, verbose: verbose || isItemExpanded(msg_8) || cursor?.expanded === !0 && index === selectedIdx, inProgressToolUseIDs, streamingToolUseIDs, screen, canAnimate, onOpenRateLimitOptions, lastThinkingBlockId, latestBashOutputUUID, columns, isLoading, lookups: lookups_0, showMessageTimestamps }, k_0), wrapped = /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(MessageActionsSelectedContext.Provider, { value: index === selectedIdx, children: row2 }, k_0);
454912
- return unseenDivider && index === dividerBeforeIndex ? [/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(Divider, { title: `${unseenDivider.count} new ${plural(unseenDivider.count, "message")}`, width: columns, color: "inactive" }) }, "unseen-divider"), wrapped] : wrapped;
455664
+ return unseenDivider && index === dividerBeforeIndex ? [/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(Divider, { title: `${unseenDivider.count} new ${plural2(unseenDivider.count, "message")}`, width: columns, color: "inactive" }) }, "unseen-divider"), wrapped] : wrapped;
454913
455665
  }, searchTextCache2 = (0, import_react167.useRef)(/* @__PURE__ */ new WeakMap()), extractSearchText = (0, import_react167.useCallback)((msg_9) => {
454914
455666
  let cached7 = searchTextCache2.current.get(msg_9);
454915
455667
  if (cached7 !== void 0) return cached7;
@@ -457720,7 +458472,7 @@ function SkillsMenu({ onExit: onExit2, commands }) {
457720
458472
  let { error: error51 } = flushFailedWrites();
457721
458473
  error51 && addNotification({
457722
458474
  key: "skills-override-save-failed",
457723
- text: `Could not save ${pending4} skill ${plural(pending4, "override")}: ${error51.message}`,
458475
+ text: `Could not save ${pending4} skill ${plural2(pending4, "override")}: ${error51.message}`,
457724
458476
  priority: "high",
457725
458477
  timeoutMs: 12e3
457726
458478
  });
@@ -457810,10 +458562,10 @@ function SkillsMenu({ onExit: onExit2, commands }) {
457810
458562
  }
457811
458563
  for (let name of superseded) changedNames.delete(name);
457812
458564
  let changedCount = changedNames.size, parts = [];
457813
- deleted.size > 0 && parts.push(`Deleted ${deleted.size} ${plural(deleted.size, "skill")}`), changedCount > 0 && parts.push(
457814
- `Updated ${changedCount} skill ${plural(changedCount, "override")}`
458565
+ deleted.size > 0 && parts.push(`Deleted ${deleted.size} ${plural2(deleted.size, "skill")}`), changedCount > 0 && parts.push(
458566
+ `Updated ${changedCount} skill ${plural2(changedCount, "override")}`
457815
458567
  ), superseded.length > 0 && parts.push(
457816
- `${superseded.length} skill ${plural(superseded.length, "override")} superseded by a concurrent change (${superseded.join(", ")})`
458568
+ `${superseded.length} skill ${plural2(superseded.length, "override")} superseded by a concurrent change (${superseded.join(", ")})`
457817
458569
  ), onExit2(parts.length > 0 ? parts.join(" \xB7 ") : "No changes", {
457818
458570
  display: "system"
457819
458571
  });
@@ -457905,7 +458657,7 @@ function SkillsMenu({ onExit: onExit2, commands }) {
457905
458657
  /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(ThemedText, { color: isSelected ? "suggestion" : void 0, children: skill.name }),
457906
458658
  /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(ThemedText, { dimColor: !0, children: ` \xB7 ${skillSourceDisplayName(String(skill.source))} \xB7 ${tokenDisplay}${lock2 ? ` \xB7 locked by ${lock2.source}` : ""}` })
457907
458659
  ] }, `${skill.name}-${skill.source}`);
457908
- }, countText = query2 ? `${filtered.length}/${skills2.length} ${plural(skills2.length, "skill")}` : `${skills2.length} ${plural(skills2.length, "skill")}`, hint = isSearchMode ? "type to filter \xB7 \u2193/enter to select \xB7 esc to clear" : filtered.length === 0 ? `/ to search, ${escLabel} to close` : `enter/space to cycle, / to search, ${sortLabel} to sort, ${deleteLabel} to delete, ${escLabel} to close`, subtitle = `${countText}${sortByTokens ? " \xB7 sorted by tokens" : ""} \xB7 ${hint}`, belowCount = filtered.length - scrollOffset - maxVisible;
458660
+ }, countText = query2 ? `${filtered.length}/${skills2.length} ${plural2(skills2.length, "skill")}` : `${skills2.length} ${plural2(skills2.length, "skill")}`, hint = isSearchMode ? "type to filter \xB7 \u2193/enter to select \xB7 esc to clear" : filtered.length === 0 ? `/ to search, ${escLabel} to close` : `enter/space to cycle, / to search, ${sortLabel} to sort, ${deleteLabel} to delete, ${escLabel} to close`, subtitle = `${countText}${sortByTokens ? " \xB7 sorted by tokens" : ""} \xB7 ${hint}`, belowCount = filtered.length - scrollOffset - maxVisible;
457909
458661
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
457910
458662
  Dialog,
457911
458663
  {
@@ -458102,7 +458854,7 @@ var skillDoctor_exports = {};
458102
458854
  __export(skillDoctor_exports, {
458103
458855
  call: () => call37
458104
458856
  });
458105
- function plural3(n2, word) {
458857
+ function plural4(n2, word) {
458106
458858
  return n2 === 1 ? word : `${word}s`;
458107
458859
  }
458108
458860
  function lookupSkillUsage(name, unqualifiedName) {
@@ -458114,7 +458866,7 @@ function lookupSkillUsage(name, unqualifiedName) {
458114
458866
  };
458115
458867
  }
458116
458868
  function formatDaysSinceUse(days) {
458117
- return days === null ? source_default.yellow("never") : days === 0 ? "today" : `${days} ${plural3(days, "day")}`;
458869
+ return days === null ? source_default.yellow("never") : days === 0 ? "today" : `${days} ${plural4(days, "day")}`;
458118
458870
  }
458119
458871
  function formatSkillTable(rows3) {
458120
458872
  if (rows3.length === 0) return source_default.dim(" (no skills loaded)");
@@ -458149,7 +458901,7 @@ function renderSkillDoctor(commands) {
458149
458901
  let unused = rows3.filter((r) => r.usageCount === 0), out6 = [];
458150
458902
  return out6.push(source_default.bold("Skills loaded this session")), out6.push(""), out6.push(formatSkillTable(rows3)), out6.push(""), unused.length > 0 ? out6.push(
458151
458903
  source_default.yellow(
458152
- `${unused.length} ${plural3(unused.length, "skill")} loaded but never invoked. Each one adds to the system prompt every turn. Disable in /skills, or remove from .sema/skills.`
458904
+ `${unused.length} ${plural4(unused.length, "skill")} loaded but never invoked. Each one adds to the system prompt every turn. Disable in /skills, or remove from .sema/skills.`
458153
458905
  )
458154
458906
  ) : out6.push(source_default.green("All loaded skills have been used at least once.")), out6.join(`
458155
458907
  `);
@@ -458943,51 +459695,63 @@ function subagentTruncatedNoticeRow(droppedBytes) {
458943
459695
  function buildSubagentContentMessages(taskId) {
458944
459696
  let msgs = [];
458945
459697
  for (let s of planSubagentViewSlots(taskId))
458946
- s.kind === "echo" ? msgs.push(withUuid(createUserMessage({ content: s.text }), taskId, s.slot)) : s.kind === "truncated" ? msgs.push(withUuid(createUserMessage({ content: subagentTruncatedNoticeRow(s.droppedBytes) }), taskId, s.slot)) : s.kind === "text" ? msgs.push(
458947
- withUuid(
458948
- createAssistantMessage({
458949
- content: s.text,
458950
- ...s.live ? { isVirtual: !0 } : {}
458951
- }),
458952
- taskId,
458953
- s.slot
458954
- )
458955
- ) : s.kind === "thinking" ? msgs.push(
458956
- withUuid(
458957
- createAssistantMessage({
458958
- content: [{ type: "thinking", thinking: s.text, signature: "" }],
458959
- ...s.live ? { isVirtual: !0 } : {}
458960
- }),
458961
- taskId,
458962
- s.slot
458963
- )
458964
- ) : (msgs.push(
458965
- withUuid(
458966
- createAssistantMessage({
458967
- content: [
458968
- { type: "tool_use", id: s.id, name: s.name, input: s.input ?? {} }
458969
- ]
458970
- }),
458971
- taskId,
458972
- s.slot
458973
- )
458974
- ), s.output !== void 0 && msgs.push(
458975
- withUuid(
458976
- createUserMessage({
458977
- content: [
458978
- {
458979
- type: "tool_result",
458980
- tool_use_id: s.id,
458981
- content: s.output,
458982
- is_error: s.isError === !0
458983
- }
458984
- ],
458985
- toolUseResult: s.output
458986
- }),
458987
- taskId,
458988
- `r-${s.slot}`
458989
- )
458990
- ));
459698
+ if (s.kind === "echo")
459699
+ msgs.push(withUuid(createUserMessage({ content: s.text }), taskId, s.slot));
459700
+ else if (s.kind === "truncated")
459701
+ msgs.push(withUuid(createUserMessage({ content: subagentTruncatedNoticeRow(s.droppedBytes) }), taskId, s.slot));
459702
+ else if (s.kind === "text")
459703
+ msgs.push(
459704
+ withUuid(
459705
+ createAssistantMessage({
459706
+ content: s.text,
459707
+ ...s.live ? { isVirtual: !0 } : {}
459708
+ }),
459709
+ taskId,
459710
+ s.slot
459711
+ )
459712
+ );
459713
+ else if (s.kind === "thinking")
459714
+ msgs.push(
459715
+ withUuid(
459716
+ createAssistantMessage({
459717
+ content: [{ type: "thinking", thinking: s.text, signature: "" }],
459718
+ ...s.live ? { isVirtual: !0 } : {}
459719
+ }),
459720
+ taskId,
459721
+ s.slot
459722
+ )
459723
+ );
459724
+ else if (s.kind === "tool")
459725
+ msgs.push(
459726
+ withUuid(
459727
+ createAssistantMessage({
459728
+ content: [
459729
+ { type: "tool_use", id: s.id, name: s.name, input: s.input ?? {} }
459730
+ ]
459731
+ }),
459732
+ taskId,
459733
+ s.slot
459734
+ )
459735
+ ), s.output !== void 0 && msgs.push(
459736
+ withUuid(
459737
+ createUserMessage({
459738
+ content: [
459739
+ {
459740
+ type: "tool_result",
459741
+ tool_use_id: s.id,
459742
+ content: s.output,
459743
+ is_error: s.isError === !0
459744
+ }
459745
+ ],
459746
+ toolUseResult: s.output
459747
+ }),
459748
+ taskId,
459749
+ `r-${s.slot}`
459750
+ )
459751
+ );
459752
+ else {
459753
+ let unknownSlot = s;
459754
+ }
458991
459755
  return msgs;
458992
459756
  }
458993
459757
  function composeViewedMessages(t2, taskId) {
@@ -459267,6 +460031,17 @@ var import_jsx_runtime291, init_renderToolActivity = __esm({
459267
460031
  }
459268
460032
  });
459269
460033
 
460034
+ // build-src/src/tasks/runningBackgroundTasks.ts
460035
+ function isRunningBackgroundTask(task) {
460036
+ return isBackgroundTask(task) && !isAbsentRow(task);
460037
+ }
460038
+ var init_runningBackgroundTasks = __esm({
460039
+ "build-src/src/tasks/runningBackgroundTasks.ts"() {
460040
+ init_engineAgentAbsence();
460041
+ init_types24();
460042
+ }
460043
+ });
460044
+
459270
460045
  // build-src/src/components/tasks/taskStatusUtils.tsx
459271
460046
  function isTerminalStatus2(status3) {
459272
460047
  return status3 === "completed" || status3 === "failed" || status3 === "killed";
@@ -459296,7 +460071,7 @@ function shouldHideTasksFooter(tasks3, showSpinnerTree) {
459296
460071
  if (!showSpinnerTree) return !1;
459297
460072
  let hasVisibleTask = !1;
459298
460073
  for (let t2 of Object.values(tasks3))
459299
- if (isBackgroundTask(t2) && (hasVisibleTask = !0, t2.type !== "in_process_teammate"))
460074
+ if (isRunningBackgroundTask(t2) && (hasVisibleTask = !0, t2.type !== "in_process_teammate"))
459300
460075
  return !1;
459301
460076
  return hasVisibleTask;
459302
460077
  }
@@ -459304,7 +460079,7 @@ var init_taskStatusUtils = __esm({
459304
460079
  "build-src/src/components/tasks/taskStatusUtils.tsx"() {
459305
460080
  init_figures2();
459306
460081
  init_LocalAgentTask();
459307
- init_types24();
460082
+ init_runningBackgroundTasks();
459308
460083
  init_collapseReadSearch();
459309
460084
  }
459310
460085
  });
@@ -459404,14 +460179,14 @@ var React102, import_jsx_runtime292, init_SubagentContinueRow = __esm({
459404
460179
 
459405
460180
  // build-src/src/components/tasks/AsyncAgentDetailDialog.tsx
459406
460181
  function AsyncAgentDetailDialog(t0) {
459407
- let $3 = (0, import_compiler_runtime200.c)(56), {
460182
+ let $3 = (0, import_compiler_runtime200.c)(57), {
459408
460183
  agent,
459409
460184
  onDone,
459410
460185
  onKillAgent,
459411
460186
  onBack
459412
460187
  } = t0, [theme2] = useTheme(), fleetDisconnected = useFleetStreamDisconnected() && isEngineViewRow(agent.id), [continuing, setContinuing] = import_react174.default.useState(!1), continueTarget = resolveSubagentContinueTarget(agent.id, agent.agentType), canContinue = agent.status !== "running" && isEngineViewRow(agent.id) && subagentResumeAvailable() && getBgParentRunOwner(agent.id) !== void 0 && continueTarget !== void 0, t1;
459413
460188
  $3[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = getTools(getEmptyToolPermissionContext()), $3[0] = t1) : t1 = $3[0];
459414
- let tools = t1, elapsedTime = useElapsedTime(agent.startTime, agent.status === "running", 1e3, agent.totalPausedMs ?? 0, agent.endTime), t2;
460189
+ let tools = t1, agentAbsent = isAbsentRow(agent), elapsedTime = useElapsedTime(agent.startTime, agent.status === "running" && !agentAbsent, 1e3, agent.totalPausedMs ?? 0, agent.endTime), t2;
459415
460190
  $3[1] !== onDone ? (t2 = {
459416
460191
  "confirm:yes": onDone
459417
460192
  }, $3[1] = onDone, $3[2] = t2) : t2 = $3[2];
@@ -459433,12 +460208,15 @@ function AsyncAgentDetailDialog(t0) {
459433
460208
  t7
459434
460209
  ] }), $3[11] = t6, $3[12] = t7, $3[13] = t8) : t8 = $3[13];
459435
460210
  let title = t8, t9;
459436
- $3[14] !== agent.status ? (t9 = agent.status !== "running" && /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(ThemedText, { color: getTaskStatusColor(agent.status), children: [
460211
+ $3[14] !== agent.status || $3[56] !== agentAbsent ? (t9 = agentAbsent ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(ThemedText, { dimColor: !0, children: [
460212
+ ENGINE_AGENT_ABSENT_ROW_TEXT,
460213
+ " \xB7 "
460214
+ ] }) : agent.status !== "running" && /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(ThemedText, { color: getTaskStatusColor(agent.status), children: [
459437
460215
  getTaskStatusIcon(agent.status),
459438
460216
  " ",
459439
460217
  agent.status === "completed" ? "Completed" : agent.status === "failed" ? "Failed" : "Stopped",
459440
460218
  " \xB7 "
459441
- ] }), $3[14] = agent.status, $3[15] = t9) : t9 = $3[15];
460219
+ ] }), $3[14] = agent.status, $3[56] = agentAbsent, $3[15] = t9) : t9 = $3[15];
459442
460220
  let t10;
459443
460221
  $3[16] !== tokenLabel ? (t10 = tokenLabel !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [
459444
460222
  " \xB7 ",
@@ -459567,6 +460345,7 @@ var import_compiler_runtime200, import_react174, import_jsx_runtime293, init_Asy
459567
460345
  import_compiler_runtime200 = __toESM(require_compiler_runtime(), 1);
459568
460346
  init_dist();
459569
460347
  import_react174 = __toESM(require_react(), 1);
460348
+ init_engineAgentAbsence();
459570
460349
  init_engineRowStopGate2();
459571
460350
  init_fleetFooterSource();
459572
460351
  init_useElapsedTime();
@@ -459805,7 +460584,7 @@ function BackgroundTask(t0) {
459805
460584
  case "local_agent": {
459806
460585
  let t1;
459807
460586
  $3[22] !== activityLimit || $3[23] !== task.description ? (t1 = truncate(task.description, activityLimit, !0), $3[22] = activityLimit, $3[23] = task.description, $3[24] = t1) : t1 = $3[24];
459808
- let t2 = task.status === "completed" ? "done" : void 0, t3 = task.status === "completed" && !task.notified ? ", unread" : void 0, t4;
460587
+ let absent_e = isAbsentRow(task), t2 = absent_e ? ENGINE_AGENT_ABSENT_ROW_TEXT : task.status === "completed" ? "done" : void 0, t3 = !absent_e && task.status === "completed" && !task.notified ? ", unread" : void 0, t4;
459809
460588
  $3[25] !== t2 || $3[26] !== t3 || $3[27] !== task.status ? (t4 = /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(TaskStatusText, { status: task.status, label: t2, suffix: t3 }), $3[25] = t2, $3[26] = t3, $3[27] = task.status, $3[28] = t4) : t4 = $3[28];
459810
460589
  let t5;
459811
460590
  return $3[29] !== t1 || $3[30] !== t4 ? (t5 = /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)(ThemedText, { children: [
@@ -459841,7 +460620,7 @@ function BackgroundTask(t0) {
459841
460620
  let t1 = task.workflowName ?? task.summary ?? task.description, t2;
459842
460621
  $3[54] !== activityLimit || $3[55] !== t1 ? (t2 = truncate(t1, activityLimit, !0), $3[54] = activityLimit, $3[55] = t1, $3[56] = t2) : t2 = $3[56];
459843
460622
  let t3;
459844
- $3[57] !== task.agentCount || $3[58] !== task.status ? (t3 = task.status === "running" ? `${task.agentCount} ${plural(task.agentCount, "agent")}` : task.status === "completed" ? "done" : void 0, $3[57] = task.agentCount, $3[58] = task.status, $3[59] = t3) : t3 = $3[59];
460623
+ $3[57] !== task.agentCount || $3[58] !== task.status ? (t3 = task.status === "running" ? `${task.agentCount} ${plural2(task.agentCount, "agent")}` : task.status === "completed" ? "done" : void 0, $3[57] = task.agentCount, $3[58] = task.status, $3[59] = t3) : t3 = $3[59];
459845
460624
  let t4 = task.status === "completed" && !task.notified ? ", unread" : void 0, t5;
459846
460625
  $3[60] !== t3 || $3[61] !== t4 || $3[62] !== task.status ? (t5 = /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(TaskStatusText, { status: task.status, label: t3, suffix: t4 }), $3[60] = t3, $3[61] = t4, $3[62] = task.status, $3[63] = t5) : t5 = $3[63];
459847
460626
  let t6;
@@ -459865,7 +460644,7 @@ function BackgroundTask(t0) {
459865
460644
  }
459866
460645
  case "dream": {
459867
460646
  let n2 = task.filesTouched.length, t1;
459868
- $3[77] !== n2 || $3[78] !== task.phase || $3[79] !== task.sessionsReviewing ? (t1 = task.phase === "updating" && n2 > 0 ? `${n2} ${plural(n2, "file")}` : `${task.sessionsReviewing} ${plural(task.sessionsReviewing, "session")}`, $3[77] = n2, $3[78] = task.phase, $3[79] = task.sessionsReviewing, $3[80] = t1) : t1 = $3[80];
460647
+ $3[77] !== n2 || $3[78] !== task.phase || $3[79] !== task.sessionsReviewing ? (t1 = task.phase === "updating" && n2 > 0 ? `${n2} ${plural2(n2, "file")}` : `${task.sessionsReviewing} ${plural2(task.sessionsReviewing, "session")}`, $3[77] = n2, $3[78] = task.phase, $3[79] = task.sessionsReviewing, $3[80] = t1) : t1 = $3[80];
459869
460648
  let detail = t1, t2;
459870
460649
  $3[81] !== detail || $3[82] !== task.phase ? (t2 = /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)(ThemedText, { dimColor: !0, children: [
459871
460650
  "\xB7 ",
@@ -459896,6 +460675,7 @@ var import_compiler_runtime203, import_jsx_runtime296, init_BackgroundTask = __e
459896
460675
  init_figures();
459897
460676
  init_RemoteSessionProgress();
459898
460677
  init_ShellProgress();
460678
+ init_engineAgentAbsence();
459899
460679
  init_taskStatusUtils();
459900
460680
  import_jsx_runtime296 = __toESM(require_jsx_runtime(), 1);
459901
460681
  }
@@ -459925,14 +460705,14 @@ function DreamDetailDialog(t0) {
459925
460705
  let visibleTurns = task.turns.filter(_temp99), shown = visibleTurns.slice(-VISIBLE_TURNS), hidden = visibleTurns.length - shown.length;
459926
460706
  T22 = ThemedBox_default, t13 = "column", t14 = 0, t15 = !0, t16 = handleKeyDown, T1 = Dialog, t8 = "Memory consolidation";
459927
460707
  let t172 = task.sessionsReviewing, t182;
459928
- $3[33] !== task.sessionsReviewing ? (t182 = plural(task.sessionsReviewing, "session"), $3[33] = task.sessionsReviewing, $3[34] = t182) : t182 = $3[34];
460708
+ $3[33] !== task.sessionsReviewing ? (t182 = plural2(task.sessionsReviewing, "session"), $3[33] = task.sessionsReviewing, $3[34] = t182) : t182 = $3[34];
459929
460709
  let t192;
459930
460710
  $3[35] !== task.filesTouched.length ? (t192 = task.filesTouched.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)(import_jsx_runtime297.Fragment, { children: [
459931
460711
  " ",
459932
460712
  "\xB7 ",
459933
460713
  task.filesTouched.length,
459934
460714
  " ",
459935
- plural(task.filesTouched.length, "file"),
460715
+ plural2(task.filesTouched.length, "file"),
459936
460716
  " touched"
459937
460717
  ] }), $3[35] = task.filesTouched.length, $3[36] = t192) : t192 = $3[36], $3[37] !== elapsedTime || $3[38] !== t182 || $3[39] !== t192 || $3[40] !== task.sessionsReviewing ? (t9 = /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)(ThemedText, { dimColor: !0, children: [
459938
460718
  elapsedTime,
@@ -459960,7 +460740,7 @@ function DreamDetailDialog(t0) {
459960
460740
  "(",
459961
460741
  hidden,
459962
460742
  " earlier ",
459963
- plural(hidden, "turn"),
460743
+ plural2(hidden, "turn"),
459964
460744
  ")"
459965
460745
  ] }),
459966
460746
  shown.map(_temp233)
@@ -459985,7 +460765,7 @@ function _temp233(turn, i) {
459985
460765
  "(",
459986
460766
  turn.toolUseCount,
459987
460767
  " ",
459988
- plural(turn.toolUseCount, "tool"),
460768
+ plural2(turn.toolUseCount, "tool"),
459989
460769
  ")"
459990
460770
  ] })
459991
460771
  ] }, i);
@@ -460437,9 +461217,9 @@ function UltraplanSessionDetail(t0) {
460437
461217
  " "
460438
461218
  ] }), $3[27] = phase, $3[28] = t11) : t11 = $3[28];
460439
461219
  let t12;
460440
- $3[29] !== agentsWorking ? (t12 = plural(agentsWorking, "agent"), $3[29] = agentsWorking, $3[30] = t12) : t12 = $3[30];
461220
+ $3[29] !== agentsWorking ? (t12 = plural2(agentsWorking, "agent"), $3[29] = agentsWorking, $3[30] = t12) : t12 = $3[30];
460441
461221
  let t13 = phase ? AGENT_VERB[phase] : "working", t14;
460442
- $3[31] !== toolCalls ? (t14 = plural(toolCalls, "call"), $3[31] = toolCalls, $3[32] = t14) : t14 = $3[32];
461222
+ $3[31] !== toolCalls ? (t14 = plural2(toolCalls, "call"), $3[31] = toolCalls, $3[32] = t14) : t14 = $3[32];
460443
461223
  let t15;
460444
461224
  $3[33] !== agentsWorking || $3[34] !== t11 || $3[35] !== t12 || $3[36] !== t13 || $3[37] !== t14 || $3[38] !== toolCalls ? (t15 = /* @__PURE__ */ (0, import_jsx_runtime299.jsxs)(ThemedText, { children: [
460445
461225
  t11,
@@ -460540,7 +461320,7 @@ function reviewCountsLine(session2) {
460540
461320
  if (!p) return session2.status === "completed" ? "done" : "setting up";
460541
461321
  let verified = p.bugsVerified, refuted = p.bugsRefuted ?? 0;
460542
461322
  if (session2.status === "completed") {
460543
- let parts = [`${verified} ${plural(verified, "finding")}`];
461323
+ let parts = [`${verified} ${plural2(verified, "finding")}`];
460544
461324
  return refuted > 0 && parts.push(`${refuted} refuted`), parts.join(" \xB7 ");
460545
461325
  }
460546
461326
  return formatReviewStageCounts(p.stage, p.bugsFound, verified, refuted);
@@ -461085,7 +461865,7 @@ function MonitorMcpDetailDialog({
461085
461865
  "(",
461086
461866
  hidden,
461087
461867
  " earlier ",
461088
- plural(hidden, "event"),
461868
+ plural2(hidden, "event"),
461089
461869
  ")"
461090
461870
  ] }),
461091
461871
  shown.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(ThemedText, { wrap: "wrap", children: line }, i))
@@ -461405,7 +462185,7 @@ function BackgroundTasksDialog({
461405
462185
  } : void 0 }, `dream-${task_0.id}`);
461406
462186
  }
461407
462187
  }
461408
- let runningBashCount = count(bashTasks, (_2) => _2.status === "running"), runningAgentCount = count(remoteSessions, (__0) => __0.status === "running" || __0.status === "pending") + count(agentTasks, (__1) => __1.status === "running"), runningTeammateCount = count(teammateTasks, (__2) => __2.status === "running"), subtitle = intersperse([...runningTeammateCount > 0 ? [/* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(ThemedText, { children: [
462188
+ let runningBashCount = count(bashTasks, (_2) => _2.status === "running"), runningAgentCount = count(remoteSessions, (__0) => __0.status === "running" || __0.status === "pending") + count(agentTasks, (__1) => __1.status === "running" && !isAbsentRow("task" in __1 ? __1.task : void 0)), runningTeammateCount = count(teammateTasks, (__2) => __2.status === "running"), subtitle = intersperse([...runningTeammateCount > 0 ? [/* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(ThemedText, { children: [
461409
462189
  runningTeammateCount,
461410
462190
  " ",
461411
462191
  runningTeammateCount !== 1 ? "agents" : "agent"
@@ -461673,6 +462453,7 @@ var import_compiler_runtime208, import_react178, import_jsx_runtime302, Workflow
461673
462453
  init_KeyboardShortcutHint();
461674
462454
  init_AsyncAgentDetailDialog();
461675
462455
  init_BackgroundTask();
462456
+ init_engineAgentAbsence();
461676
462457
  init_DreamDetailDialog();
461677
462458
  init_InProcessTeammateDetailDialog();
461678
462459
  init_RemoteSessionDetailDialog();
@@ -462692,7 +463473,7 @@ function sanitizeDiskText(raw2) {
462692
463473
  let cleaned = raw2.replace(/[\u0000-\u001f\u007f-\u009f]/g, "").replace(/[<>]/g, "").trim();
462693
463474
  return cleaned.length === 0 ? "(unnamed)" : cleaned.length > 64 ? `${cleaned.slice(0, 64)}\u2026` : cleaned;
462694
463475
  }
462695
- function plural4(n2, word) {
463476
+ function plural5(n2, word) {
462696
463477
  return `${n2} ${word}${n2 === 1 ? "" : "s"}`;
462697
463478
  }
462698
463479
  function renderTeamPanel(input) {
@@ -462710,7 +463491,7 @@ function renderTeamPanel(input) {
462710
463491
  "Once it is on, /team lists your teams."
462711
463492
  ].join(`
462712
463493
  `);
462713
- let skippedNotice = skipped > 0 ? `${plural4(skipped, "team file")} could not be read and ${skipped === 1 ? "is" : "are"} not listed above \u2014 that is not the same as not having them.` : null;
463494
+ let skippedNotice = skipped > 0 ? `${plural5(skipped, "team file")} could not be read and ${skipped === 1 ? "is" : "are"} not listed above \u2014 that is not the same as not having them.` : null;
462714
463495
  if (dirError !== void 0)
462715
463496
  return [
462716
463497
  `Agent teams: on (experimental). Could not read the team directory (${dirError}).`,
@@ -462738,11 +463519,11 @@ function renderTeamPanel(input) {
462738
463519
  ].join(`
462739
463520
  `);
462740
463521
  let rows3 = teams.map((t2) => {
462741
- let counts2 = `${plural4(t2.memberCount, "teammate")} (${t2.runningCount} running, ${t2.idleCount} idle)`;
463522
+ let counts2 = `${plural5(t2.memberCount, "teammate")} (${t2.runningCount} running, ${t2.idleCount} idle)`;
462742
463523
  return ` \xB7 ${sanitizeDiskText(t2.name)} \u2014 ${counts2}${t2.ledByThisSession ? " \u2014 led by this session" : ""}`;
462743
463524
  });
462744
463525
  return [
462745
- `Agent teams: on (experimental). ${plural4(teams.length, "team")}:`,
463526
+ `Agent teams: on (experimental). ${plural5(teams.length, "team")}:`,
462746
463527
  "",
462747
463528
  ...rows3,
462748
463529
  "",
@@ -463367,7 +464148,7 @@ function AddPermissionRules(t0) {
463367
464148
  }
463368
464149
  }, $3[1] = initialContext, $3[2] = onAddRules, $3[3] = onCancel, $3[4] = ruleBehavior, $3[5] = ruleValues, $3[6] = setToolPermissionContext, $3[7] = t2) : t2 = $3[7];
463369
464150
  let onSelect = t2, t3;
463370
- $3[8] !== ruleValues.length ? (t3 = plural(ruleValues.length, "rule"), $3[8] = ruleValues.length, $3[9] = t3) : t3 = $3[9];
464151
+ $3[8] !== ruleValues.length ? (t3 = plural2(ruleValues.length, "rule"), $3[8] = ruleValues.length, $3[9] = t3) : t3 = $3[9];
463371
464152
  let title = `Add ${ruleBehavior} permission ${t3}`, t4;
463372
464153
  $3[10] !== ruleValues ? (t4 = ruleValues.map(_temp103), $3[10] = ruleValues, $3[11] = t4) : t4 = $3[11];
463373
464154
  let t5;
@@ -466655,7 +467436,7 @@ function SelectEventMode(t0) {
466655
467436
  onSelectEvent,
466656
467437
  onCancel
466657
467438
  } = t0, t1;
466658
- $3[0] !== totalHooksCount ? (t1 = plural(totalHooksCount, "hook"), $3[0] = totalHooksCount, $3[1] = t1) : t1 = $3[1];
467439
+ $3[0] !== totalHooksCount ? (t1 = plural2(totalHooksCount, "hook"), $3[0] = totalHooksCount, $3[1] = t1) : t1 = $3[1];
466659
467440
  let subtitle = `${totalHooksCount} ${t1} configured`, t2;
466660
467441
  $3[2] !== restrictedByPolicy ? (t2 = restrictedByPolicy && /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(ThemedBox_default, { flexDirection: "column", children: [
466661
467442
  /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(ThemedText, { color: "suggestion", children: [
@@ -466817,7 +467598,7 @@ function _temp327(item) {
466817
467598
  return {
466818
467599
  label: `[${sourceText}] ${matcherLabel}`,
466819
467600
  value: item.matcher,
466820
- description: `${item.hookCount} ${plural(item.hookCount, "hook")}`
467601
+ description: `${item.hookCount} ${plural2(item.hookCount, "hook")}`
466821
467602
  };
466822
467603
  }
466823
467604
  function _temp242() {
@@ -467053,9 +467834,9 @@ function HooksConfigMenu(t0) {
467053
467834
  let t22 = disabledByPolicy && " by a managed settings file", t23;
467054
467835
  $3[36] !== totalHooksCount ? (t23 = /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(ThemedText, { bold: !0, children: totalHooksCount }), $3[36] = totalHooksCount, $3[37] = t23) : t23 = $3[37];
467055
467836
  let t24;
467056
- $3[38] !== totalHooksCount ? (t24 = plural(totalHooksCount, "hook"), $3[38] = totalHooksCount, $3[39] = t24) : t24 = $3[39];
467837
+ $3[38] !== totalHooksCount ? (t24 = plural2(totalHooksCount, "hook"), $3[38] = totalHooksCount, $3[39] = t24) : t24 = $3[39];
467057
467838
  let t25;
467058
- $3[40] !== totalHooksCount ? (t25 = plural(totalHooksCount, "is", "are"), $3[40] = totalHooksCount, $3[41] = t25) : t25 = $3[41];
467839
+ $3[40] !== totalHooksCount ? (t25 = plural2(totalHooksCount, "is", "are"), $3[40] = totalHooksCount, $3[41] = t25) : t25 = $3[41];
467059
467840
  let t26;
467060
467841
  $3[42] !== t22 || $3[43] !== t23 || $3[44] !== t24 || $3[45] !== t25 ? (t26 = /* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(ThemedText, { children: [
467061
467842
  "All hooks are currently ",
@@ -468793,7 +469574,7 @@ __export(reload_plugins_exports, {
468793
469574
  call: () => call59
468794
469575
  });
468795
469576
  function n(count3, noun) {
468796
- return `${count3} ${plural(count3, noun)}`;
469577
+ return `${count3} ${plural2(count3, noun)}`;
468797
469578
  }
468798
469579
  var call59, init_reload_plugins = __esm({
468799
469580
  "build-src/src/commands/reload-plugins/reload-plugins.ts"() {
@@ -471383,7 +472164,7 @@ function HiddenModelCount({
471383
472164
  count: count3,
471384
472165
  unit = "line"
471385
472166
  }) {
471386
- return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural(count3, unit)}` });
472167
+ return count3 <= 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(ThemedText, { dimColor: !0, children: `\u2026 +${count3} ${plural2(count3, unit)}` });
471387
472168
  }
471388
472169
  function ModelPickerByline({
471389
472170
  children
@@ -479320,7 +480101,7 @@ function noteModelEvidenceFrom(msg, streamModel) {
479320
480101
  b3.text.includes(model) && noteModelRejected(model, "rejected by the provider");
479321
480102
  continue;
479322
480103
  }
479323
- if (isGovernanceStopRowText(b3.text) || isModelOutputErrorRowText(b3.text)) continue;
480104
+ if (isGovernanceStopRowText(b3.text) || isModelOutputErrorRowText(b3.text) || isOutcomeUnknownRowText(b3.text)) continue;
479324
480105
  b3.text.length > 0 && noteModelServed(model);
479325
480106
  continue;
479326
480107
  }
@@ -480917,13 +481698,13 @@ function policyFromPermissions(perms) {
480917
481698
  function settingsRuleBannerLine(counts2) {
480918
481699
  let { nameRules, patternEnforced, patternUncovered, patternAllow } = counts2;
480919
481700
  if (patternEnforced + patternUncovered + patternAllow === 0) return;
480920
- let plural7 = (n2, one, many) => `${String(n2)} ${n2 === 1 ? one : many}`, parts = [
480921
- `${plural7(nameRules, "name rule", "name rules")} in engine policy`,
480922
- `${plural7(patternEnforced, "pattern rule", "pattern rules")} enforced by this client`
481701
+ let plural8 = (n2, one, many) => `${String(n2)} ${n2 === 1 ? one : many}`, parts = [
481702
+ `${plural8(nameRules, "name rule", "name rules")} in engine policy`,
481703
+ `${plural8(patternEnforced, "pattern rule", "pattern rules")} enforced by this client`
480923
481704
  ];
480924
481705
  return patternUncovered > 0 && parts.push(
480925
- `${plural7(patternUncovered, "pattern deny rule", "pattern deny rules")} this client cannot match by content (that tool falls back to an approval prompt)`
480926
- ), patternAllow > 0 && parts.push(`${plural7(patternAllow, "pattern allow rule", "pattern allow rules")} never sent to the engine`), `[sema] \x1B[32m\u2713\x1B[0m settings loaded \u2014 ${parts.join(" \xB7 ")}`;
481706
+ `${plural8(patternUncovered, "pattern deny rule", "pattern deny rules")} this client cannot match by content (that tool falls back to an approval prompt)`
481707
+ ), patternAllow > 0 && parts.push(`${plural8(patternAllow, "pattern allow rule", "pattern allow rules")} never sent to the engine`), `[sema] \x1B[32m\u2713\x1B[0m settings loaded \u2014 ${parts.join(" \xB7 ")}`;
480927
481708
  }
480928
481709
  function ruleToolNameOf(entry) {
480929
481710
  try {
@@ -483272,18 +484053,40 @@ var init_engineReadRoots = __esm({
483272
484053
  // build-src/src/sema/toolsRunHereLane.ts
483273
484054
  var toolsRunHereLane_exports = {};
483274
484055
  __export(toolsRunHereLane_exports, {
484056
+ cliSharesFilesystemWithEngine: () => cliSharesFilesystemWithEngine,
483275
484057
  toolsRunOnThisHost: () => toolsRunOnThisHost
483276
484058
  });
483277
484059
  function toolsRunOnThisHost(r) {
483278
- if (!r.engineSpawnedByThisShell || typeof r.configuredRemoteEngineUrl == "string" && r.configuredRemoteEngineUrl.length > 0) return !1;
483279
- let lane = r.remoteExec;
483280
- return lane === void 0 || lane === "" || lane === "host";
484060
+ return cliSharesFilesystemWithEngine(r) && (() => {
484061
+ let lane = r.remoteExec;
484062
+ return lane === void 0 || lane === "" || lane === "host";
484063
+ })();
484064
+ }
484065
+ function cliSharesFilesystemWithEngine(r) {
484066
+ return !(!r.engineSpawnedByThisShell || typeof r.configuredRemoteEngineUrl == "string" && r.configuredRemoteEngineUrl.length > 0);
483281
484067
  }
483282
484068
  var init_toolsRunHereLane = __esm({
483283
484069
  "build-src/src/sema/toolsRunHereLane.ts"() {
483284
484070
  }
483285
484071
  });
483286
484072
 
484073
+ // build-src/src/sema/executionLaneCapability.ts
484074
+ var executionLaneCapability_exports = {};
484075
+ __export(executionLaneCapability_exports, {
484076
+ __resetExecutionLaneReadingsForTests: () => __resetExecutionLaneReadingsForTests,
484077
+ executionLaneDoctorDetail: () => executionLaneDoctorDetail,
484078
+ forgetExecutionLaneReading: () => forgetExecutionLaneReading,
484079
+ noteEngineCapsForExecutionLane: () => noteEngineCapsForExecutionLane,
484080
+ observedExecutionLane: () => observedExecutionLane,
484081
+ projectExecutionLaneCapability: () => projectExecutionLaneCapability,
484082
+ toolsRunHereFromExecutionLane: () => toolsRunHereFromExecutionLane
484083
+ });
484084
+ var init_executionLaneCapability2 = __esm({
484085
+ "build-src/src/sema/executionLaneCapability.ts"() {
484086
+ init_dist();
484087
+ }
484088
+ });
484089
+
483287
484090
  // build-src/src/sema/skillsWire.ts
483288
484091
  var skillsWire_exports = {};
483289
484092
  __export(skillsWire_exports, {
@@ -483317,20 +484120,33 @@ async function loadSkillSpecs(cwd5) {
483317
484120
  }
483318
484121
  })
483319
484122
  );
483320
- let resolveBody = (c3) => c3.skillRoot ? bodyByRoot.get(c3.skillRoot) ?? null : null, toolsRunHere = !1;
484123
+ let resolveBody = (c3) => c3.skillRoot ? bodyByRoot.get(c3.skillRoot) ?? null : null, legacyInference = !1, cliSharesFs = !1, reading = { kind: "unobserved" };
483321
484124
  try {
483322
- let [{ engineSpawnedByThisShell: engineSpawnedByThisShell2 }, { configuredEngineUrl: configuredEngineUrl2 }, { toolsRunOnThisHost: toolsRunOnThisHost2 }] = await Promise.all([
484125
+ let [
484126
+ { engineSpawnedByThisShell: engineSpawnedByThisShell2 },
484127
+ { configuredEngineUrl: configuredEngineUrl2 },
484128
+ { toolsRunOnThisHost: toolsRunOnThisHost2, cliSharesFilesystemWithEngine: cliSharesFilesystemWithEngine2 },
484129
+ { observedExecutionLane: observedExecutionLane2 }
484130
+ ] = await Promise.all([
483323
484131
  Promise.resolve().then(() => (init_engineLifecycleManager(), engineLifecycleManager_exports)),
483324
484132
  Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports)),
483325
- Promise.resolve().then(() => (init_toolsRunHereLane(), toolsRunHereLane_exports))
483326
- ]);
483327
- toolsRunHere = toolsRunOnThisHost2({
484133
+ Promise.resolve().then(() => (init_toolsRunHereLane(), toolsRunHereLane_exports)),
484134
+ Promise.resolve().then(() => (init_executionLaneCapability2(), executionLaneCapability_exports))
484135
+ ]), readings = {
483328
484136
  engineSpawnedByThisShell: engineSpawnedByThisShell2(),
483329
484137
  configuredRemoteEngineUrl: configuredEngineUrl2(),
483330
484138
  remoteExec: process.env.REMOTE_EXEC
483331
- });
484139
+ };
484140
+ legacyInference = toolsRunOnThisHost2(readings), cliSharesFs = cliSharesFilesystemWithEngine2(readings), reading = observedExecutionLane2();
484141
+ } catch {
484142
+ legacyInference = !1, cliSharesFs = !1, reading = { kind: "unobserved" };
484143
+ }
484144
+ let toolsRunHere = legacyInference;
484145
+ try {
484146
+ let { toolsRunHereFromExecutionLane: toolsRunHereFromExecutionLane2 } = await Promise.resolve().then(() => (init_executionLaneCapability2(), executionLaneCapability_exports));
484147
+ toolsRunHere = cliSharesFs && toolsRunHereFromExecutionLane2(reading, legacyInference);
483332
484148
  } catch {
483333
- toolsRunHere = !1;
484149
+ toolsRunHere = legacyInference;
483334
484150
  }
483335
484151
  let platform4 = process.platform === "win32" ? "win32" : "posix";
483336
484152
  return skillCommandsToSpecs(orderSkillCmdsForWire(cmds), resolveBody, { toolsRunHere, platform: platform4 });
@@ -483474,6 +484290,8 @@ __export(agentsWire_exports, {
483474
484290
  IDLE_FLUSH_MS: () => IDLE_FLUSH_MS,
483475
484291
  INTERACTIVE_WAY_OUT: () => INTERACTIVE_WAY_OUT,
483476
484292
  INTERNAL_SDK_ARM_TYPES: () => INTERNAL_SDK_ARM_TYPES,
484293
+ LEADER_REJ_HEAD_DISPLAY_MAX: () => LEADER_REJ_HEAD_DISPLAY_MAX,
484294
+ LEADER_RUN_STATUSES: () => LEADER_RUN_STATUSES,
483477
484295
  LIMITS_MAX_COST_EXCEEDED: () => LIMITS_MAX_COST_EXCEEDED,
483478
484296
  LIMITS_MAX_TOKENS_EXCEEDED: () => LIMITS_MAX_TOKENS_EXCEEDED,
483479
484297
  LIMITS_MAX_TURNS_EXCEEDED: () => LIMITS_MAX_TURNS_EXCEEDED,
@@ -483501,6 +484319,8 @@ __export(agentsWire_exports, {
483501
484319
  MAX_TURNS_MIN: () => MAX_TURNS_MIN,
483502
484320
  MCP_CAPS: () => MCP_CAPS,
483503
484321
  MCP_INJECTION_DROP_REASONS: () => MCP_INJECTION_DROP_REASONS,
484322
+ MCP_RECONNECT_OUTCOMES: () => MCP_RECONNECT_OUTCOMES,
484323
+ MCP_RECONNECT_TRANSACTION_NOTICE: () => MCP_RECONNECT_TRANSACTION_NOTICE,
483504
484324
  MCP_REDIAL_OUTCOMES: () => MCP_REDIAL_OUTCOMES,
483505
484325
  MCP_SERVER_REVOKED: () => MCP_SERVER_REVOKED,
483506
484326
  MEMORY_CAPTURE_OFF: () => MEMORY_CAPTURE_OFF,
@@ -483510,6 +484330,7 @@ __export(agentsWire_exports, {
483510
484330
  MODEL_FAMILIES: () => MODEL_FAMILIES,
483511
484331
  MODEL_OUTPUT_ERROR_PREFIX: () => MODEL_OUTPUT_ERROR_PREFIX,
483512
484332
  MODEL_PROBE_VERDICTS: () => MODEL_PROBE_VERDICTS,
484333
+ OUTCOME_UNKNOWN_ROW_PREFIX: () => OUTCOME_UNKNOWN_ROW_PREFIX,
483513
484334
  OUTPUT_INVALID: () => OUTPUT_INVALID,
483514
484335
  PANEL_TOOLUSES_LANE_POLICY: () => PANEL_TOOLUSES_LANE_POLICY,
483515
484336
  PEER_FRAME_LANES: () => PEER_FRAME_LANES,
@@ -483518,9 +484339,13 @@ __export(agentsWire_exports, {
483518
484339
  PERMISSION_RULE_ISSUE_CODES: () => PERMISSION_RULE_ISSUE_CODES,
483519
484340
  PERSISTED_RULE_BEHAVIORS: () => PERSISTED_RULE_BEHAVIORS,
483520
484341
  PERSISTED_RULE_BEHAVIOR_UNKNOWN: () => PERSISTED_RULE_BEHAVIOR_UNKNOWN,
484342
+ PLAN_REVIEW_APPROVE_AUTO_LABEL: () => PLAN_REVIEW_APPROVE_AUTO_LABEL,
483521
484343
  PLAN_REVIEW_APPROVE_LABEL: () => PLAN_REVIEW_APPROVE_LABEL,
484344
+ PLAN_REVIEW_APPROVE_MANUAL_LABEL: () => PLAN_REVIEW_APPROVE_MANUAL_LABEL,
483522
484345
  PLAN_REVIEW_GATE_KIND: () => PLAN_REVIEW_GATE_KIND,
483523
484346
  PLAN_REVIEW_GATE_KINDS: () => PLAN_REVIEW_GATE_KINDS,
484347
+ PLAN_REVIEW_MODE_AFTER_MIN_ENGINE: () => PLAN_REVIEW_MODE_AFTER_MIN_ENGINE,
484348
+ PLAN_REVIEW_MODE_AFTER_WORDS: () => PLAN_REVIEW_MODE_AFTER_WORDS,
483524
484349
  PLAN_REVIEW_QUESTION_ID_PREFIX: () => PLAN_REVIEW_QUESTION_ID_PREFIX,
483525
484350
  PLAN_REVIEW_REJECT_LABEL: () => PLAN_REVIEW_REJECT_LABEL,
483526
484351
  PLAN_REVIEW_STATES: () => PLAN_REVIEW_STATES,
@@ -483611,6 +484436,7 @@ __export(agentsWire_exports, {
483611
484436
  SUBAGENT_TOOL_NAMES: () => SUBAGENT_TOOL_NAMES,
483612
484437
  SURFACED_TIERS: () => SURFACED_TIERS,
483613
484438
  TASK_AGENT_WIRE_FIELDS: () => TASK_AGENT_WIRE_FIELDS,
484439
+ TASK_NOTIFICATION_TERMINAL_STATUSES: () => TASK_NOTIFICATION_TERMINAL_STATUSES,
483614
484440
  TERMINAL_CAUSE_KINDS: () => TERMINAL_CAUSE_KINDS,
483615
484441
  TERMINAL_FLEET_TASK_STATUSES: () => TERMINAL_FLEET_TASK_STATUSES,
483616
484442
  TERMINAL_RETAIN_MS: () => TERMINAL_RETAIN_MS,
@@ -483643,9 +484469,11 @@ __export(agentsWire_exports, {
483643
484469
  __activeTailCountForTests: () => __activeTailCountForTests,
483644
484470
  __feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
483645
484471
  __resetBgOwnerAbsenceForTests: () => __resetBgOwnerAbsenceForTests,
484472
+ __resetEngineAgentPanelAbsenceForTests: () => __resetEngineAgentPanelAbsenceForTests,
483646
484473
  __resetEngineCapsCacheForTests: () => __resetEngineCapsCacheForTests,
483647
484474
  __resetEngineCompactArmForTests: () => __resetEngineCompactArmForTests,
483648
484475
  __resetEngineDelegatedPromptForTests: () => __resetEngineDelegatedPromptForTests,
484476
+ __resetExecutionLaneReadingsForTests: () => __resetExecutionLaneReadingsForTests,
483649
484477
  __resetFleetLedgerRegistryForTests: () => __resetFleetLedgerRegistryForTests,
483650
484478
  __resetHooksWireCapsForTests: () => __resetHooksWireCapsForTests,
483651
484479
  __resetRetainWithoutWakeWarningForTests: () => __resetRetainWithoutWakeWarningForTests,
@@ -483741,6 +484569,7 @@ __export(agentsWire_exports, {
483741
484569
  classifyAskParkRows: () => classifyAskParkRows,
483742
484570
  classifyHookFailureFrame: () => classifyHookFailureFrame,
483743
484571
  classifyHookNoticeFrame: () => classifyHookNoticeFrame,
484572
+ classifyMcpReconnectFailure: () => classifyMcpReconnectFailure,
483744
484573
  classifyMemoryStatusFailure: () => classifyMemoryStatusFailure,
483745
484574
  classifyPeerNotification: () => classifyPeerNotification,
483746
484575
  classifyRulesFailure: () => classifyRulesFailure,
@@ -483798,6 +484627,7 @@ __export(agentsWire_exports, {
483798
484627
  deriveTranscriptId: () => deriveTranscriptId,
483799
484628
  detachCancelArm: () => detachCancelArm,
483800
484629
  detachDurableOffHint: () => detachDurableOffHint,
484630
+ detachSupportDisclosure: () => detachSupportDisclosure,
483801
484631
  detachedTaskId: () => detachedTaskId,
483802
484632
  detectEngineBgShellReceipt: () => detectEngineBgShellReceipt,
483803
484633
  deviceAuthProviderFor: () => deviceAuthProviderFor,
@@ -483849,6 +484679,7 @@ __export(agentsWire_exports, {
483849
484679
  estimateCjkTokens: () => estimateCjkTokens,
483850
484680
  eventSeq: () => eventSeq,
483851
484681
  eventToSdkMessage: () => eventToSdkMessage,
484682
+ executionLaneDoctorDetail: () => executionLaneDoctorDetail,
483852
484683
  failedToSdkResult: () => failedToSdkResult,
483853
484684
  fetchDelegatedPrompt: () => fetchDelegatedPrompt,
483854
484685
  fetchEngineSubagentReport: () => fetchEngineSubagentReport,
@@ -483867,6 +484698,7 @@ __export(agentsWire_exports, {
483867
484698
  fleetViewStubRowIds: () => fleetViewStubRowIds,
483868
484699
  fmtCtxOut: () => fmtCtxOut,
483869
484700
  fmtTokens: () => fmtTokens,
484701
+ forgetExecutionLaneReading: () => forgetExecutionLaneReading,
483870
484702
  forgetSqlEngineReading: () => forgetSqlEngineReading,
483871
484703
  forgetWebSearchBackendReading: () => forgetWebSearchBackendReading,
483872
484704
  forgetWriteProtectionReading: () => forgetWriteProtectionReading,
@@ -483978,9 +484810,11 @@ __export(agentsWire_exports, {
483978
484810
  isLoopbackWireUrl: () => isLoopbackWireUrl,
483979
484811
  isModelOutputErrorRowText: () => isModelOutputErrorRowText,
483980
484812
  isModelOutputErrorText: () => isModelOutputErrorText,
484813
+ isOutcomeUnknownRowText: () => isOutcomeUnknownRowText,
483981
484814
  isOwnEngineRun: () => isOwnEngineRun,
483982
484815
  isOwnWorkflowRun: () => isOwnWorkflowRun,
483983
484816
  isParkSlaExpiredGate: () => isParkSlaExpiredGate,
484817
+ isPlanReviewModeAfter: () => isPlanReviewModeAfter,
483984
484818
  isPlanReviewPark: () => isPlanReviewPark,
483985
484819
  isPreStreamDrainingReject: () => isPreStreamDrainingReject,
483986
484820
  isResumeAtRejection: () => isResumeAtRejection,
@@ -483994,6 +484828,7 @@ __export(agentsWire_exports, {
483994
484828
  isSubFlowSegmentEnd: () => isSubFlowSegmentEnd,
483995
484829
  isSupportedCatalogSchemaVersion: () => isSupportedCatalogSchemaVersion,
483996
484830
  isTaskNotificationObjective: () => isTaskNotificationObjective,
484831
+ isTaskNotificationTerminalStatus: () => isTaskNotificationTerminalStatus,
483997
484832
  isTerminalCauseKind: () => isTerminalCauseKind,
483998
484833
  isTerminalNotSuccess: () => isTerminalNotSuccess,
483999
484834
  isTerminalStatus: () => isTerminalStatus,
@@ -484007,6 +484842,7 @@ __export(agentsWire_exports, {
484007
484842
  isWorkflowCompletionCardEnqueued: () => isWorkflowCompletionCardEnqueued,
484008
484843
  isWorkflowParkRefusalCode: () => isWorkflowParkRefusalCode,
484009
484844
  kickEngineCapsProbe: () => kickEngineCapsProbe,
484845
+ leaderConflictDetail: () => leaderConflictDetail,
484010
484846
  limitsForPrint: () => limitsForPrint,
484011
484847
  listAllPersistedRules: () => listAllPersistedRules,
484012
484848
  listNotifiedRuns: () => listNotifiedRuns,
@@ -484029,6 +484865,7 @@ __export(agentsWire_exports, {
484029
484865
  mcpEngineLegPresence: () => mcpEngineLegPresence,
484030
484866
  mcpNamespace: () => mcpNamespace,
484031
484867
  mcpPanelLastLegDetail: () => mcpPanelLastLegDetail,
484868
+ mcpReconnectOutcomeDetail: () => mcpReconnectOutcomeDetail,
484032
484869
  memoryCaptureDeclarationField: () => memoryCaptureDeclarationField,
484033
484870
  memoryOffDeclarationField: () => memoryOffDeclarationField,
484034
484871
  memoryOffDeclared: () => memoryOffDeclared,
@@ -484045,6 +484882,7 @@ __export(agentsWire_exports, {
484045
484882
  normalizeTaskNotification: () => normalizeTaskNotification,
484046
484883
  normalizeWirePrincipal: () => normalizeWirePrincipal,
484047
484884
  noteBgOwnerAbsence: () => noteBgOwnerAbsence,
484885
+ noteEngineCapsForExecutionLane: () => noteEngineCapsForExecutionLane,
484048
484886
  noteEngineCapsForSqlEngine: () => noteEngineCapsForSqlEngine,
484049
484887
  noteEngineCapsForWebSearchBackend: () => noteEngineCapsForWebSearchBackend,
484050
484888
  noteEngineCapsForWriteProtection: () => noteEngineCapsForWriteProtection,
@@ -484057,6 +484895,7 @@ __export(agentsWire_exports, {
484057
484895
  notificationDropCounters: () => notificationDropCounters,
484058
484896
  notificationQueuePortMisses: () => notificationQueuePortMisses,
484059
484897
  observeCancelByDeny: () => observeCancelByDeny,
484898
+ observedExecutionLane: () => observedExecutionLane,
484060
484899
  observedSqlEngine: () => observedSqlEngine,
484061
484900
  observedWebSearchBackend: () => observedWebSearchBackend,
484062
484901
  observedWriteProtection: () => observedWriteProtection,
@@ -484100,6 +484939,8 @@ __export(agentsWire_exports, {
484100
484939
  planModeExplicitlyRequested: () => planModeExplicitlyRequested,
484101
484940
  planReviewArmedKey: () => planReviewArmedKey,
484102
484941
  planReviewArmedKeyFor: () => planReviewArmedKeyFor,
484942
+ planReviewCardOptions: () => planReviewCardOptions,
484943
+ planReviewChoiceFromAnswer: () => planReviewChoiceFromAnswer,
484103
484944
  planReviewDecisionFromAnswer: () => planReviewDecisionFromAnswer,
484104
484945
  planReviewQuestionId: () => planReviewQuestionId,
484105
484946
  planSubagentViewSlots: () => planSubagentViewSlots,
@@ -484110,6 +484951,7 @@ __export(agentsWire_exports, {
484110
484951
  prepareTaskAgentsWire: () => prepareTaskAgentsWire,
484111
484952
  prepareTaskAgentsWireWith: () => prepareTaskAgentsWireWith,
484112
484953
  probeEngineAlive: () => probeEngineAlive,
484954
+ probeEngineDetachSupport: () => probeEngineDetachSupport,
484113
484955
  probeHealth: () => probeHealth,
484114
484956
  probeModelCapability: () => probeModelCapability,
484115
484957
  probeRequestBody: () => probeRequestBody,
@@ -484120,9 +484962,13 @@ __export(agentsWire_exports, {
484120
484962
  projectDescription: () => projectDescription,
484121
484963
  projectDiagnosticsFrame: () => projectDiagnosticsFrame,
484122
484964
  projectEffectiveBody: () => projectEffectiveBody,
484965
+ projectExecutionLaneCapability: () => projectExecutionLaneCapability,
484123
484966
  projectFleetAgentRows: () => projectFleetAgentRows,
484124
484967
  projectFleetAgentRowsFor: () => projectFleetAgentRowsFor,
484968
+ projectLeaderConflict: () => projectLeaderConflict,
484125
484969
  projectMcpPanel: () => projectMcpPanel,
484970
+ projectMcpReconnectCapability: () => projectMcpReconnectCapability,
484971
+ projectMcpReconnectResult: () => projectMcpReconnectResult,
484126
484972
  projectMcpSection: () => projectMcpSection,
484127
484973
  projectReadFacePosture: () => projectReadFacePosture,
484128
484974
  projectRewind: () => projectRewind,
@@ -484145,6 +484991,7 @@ __export(agentsWire_exports, {
484145
484991
  providerCatalogRowDetail: () => providerCatalogRowDetail,
484146
484992
  providerCatalogRows: () => providerCatalogRows,
484147
484993
  providerPresetById: () => providerPresetById,
484994
+ publishEngineAgentPanelAbsence: () => publishEngineAgentPanelAbsence,
484148
484995
  publishEngineAgentPanelEvent: () => publishEngineAgentPanelEvent,
484149
484996
  publishEngineInlineTaskTick: () => publishEngineInlineTaskTick,
484150
484997
  publishQuestionFrame: () => publishQuestionFrame,
@@ -484153,6 +485000,7 @@ __export(agentsWire_exports, {
484153
485000
  pushSubagentLocalEcho: () => pushSubagentLocalEcho,
484154
485001
  readAskUnresolvable: () => readAskUnresolvable,
484155
485002
  readAsyncLaunchedAgentReceipt: () => readAsyncLaunchedAgentReceipt,
485003
+ readAutoConsolidationArmed: () => readAutoConsolidationArmed,
484156
485004
  readCancelRequested: () => readCancelRequested,
484157
485005
  readCaptureOptOut: () => readCaptureOptOut,
484158
485006
  readCcImportRedeemCounts: () => readCcImportRedeemCounts,
@@ -484186,6 +485034,7 @@ __export(agentsWire_exports, {
484186
485034
  readWorkflowActivityLedger: () => readWorkflowActivityLedger,
484187
485035
  readWorkflowParks: () => readWorkflowParks,
484188
485036
  readWorkflowResumeAdmissionIncomplete: () => readWorkflowResumeAdmissionIncomplete,
485037
+ reconnectMcpServer: () => reconnectMcpServer,
484189
485038
  recordBgParentRun: () => recordBgParentRun,
484190
485039
  recordBgTerminalFacts: () => recordBgTerminalFacts,
484191
485040
  recordEngineToolLabel: () => recordEngineToolLabel,
@@ -484305,6 +485154,7 @@ __export(agentsWire_exports, {
484305
485154
  subagentResumeAvailable: () => subagentResumeAvailable,
484306
485155
  subagentUsageIsPartial: () => subagentUsageIsPartial,
484307
485156
  subscribeEngineAgentPanel: () => subscribeEngineAgentPanel,
485157
+ subscribeEngineAgentPanelAbsence: () => subscribeEngineAgentPanelAbsence,
484308
485158
  subscribeEngineInlineTaskStats: () => subscribeEngineInlineTaskStats,
484309
485159
  subscribeOutstandingWorkflows: () => subscribeOutstandingWorkflows,
484310
485160
  subscribeSubagentContent: () => subscribeSubagentContent,
@@ -484339,6 +485189,7 @@ __export(agentsWire_exports, {
484339
485189
  toolPermissionRequestIdDomain: () => toolPermissionRequestIdDomain,
484340
485190
  toolRosterNames: () => toolRosterNames,
484341
485191
  toolShimFromRoster: () => toolShimFromRoster,
485192
+ toolsRunHereFromExecutionLane: () => toolsRunHereFromExecutionLane,
484342
485193
  turnEndUsage: () => turnEndUsage,
484343
485194
  turnUsageToModelUsage: () => turnUsageToModelUsage,
484344
485195
  ultracodeForRequest: () => ultracodeForRequest,
@@ -484353,6 +485204,7 @@ __export(agentsWire_exports, {
484353
485204
  validateWebSearchChoice: () => validateWebSearchChoice,
484354
485205
  versionSupportsDetach: () => versionSupportsDetach,
484355
485206
  versionSupportsLimits: () => versionSupportsLimits,
485207
+ versionSupportsPlanReviewModeAfter: () => versionSupportsPlanReviewModeAfter,
484356
485208
  waitForClaimRelease: () => waitForClaimRelease,
484357
485209
  waitForGateArmed: () => waitForGateArmed,
484358
485210
  waitForGateArmedFor: () => waitForGateArmedFor,
@@ -484572,7 +485424,7 @@ function armEngineCapsProbes(input) {
484572
485424
  });
484573
485425
  } : capsProbe;
484574
485426
  if (afterEngineRespawn) {
484575
- resetCapsDiscoveryState(baseUrl), invalidateSelfKnowledgeCap(baseUrl), forgetSqlEngineReading(baseUrl), forgetWriteProtectionReading(baseUrl), forgetWebSearchBackendReading(baseUrl), forgetWiringManifestReading(), forgetClassifierRoundObservation(), forgetEffectiveTurnFacts(), kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), invalidateEngineCaps(baseUrl, guardedCapsProbe);
485427
+ resetCapsDiscoveryState(baseUrl), invalidateSelfKnowledgeCap(baseUrl), forgetSqlEngineReading(baseUrl), forgetWriteProtectionReading(baseUrl), forgetWebSearchBackendReading(baseUrl), forgetExecutionLaneReading(baseUrl), forgetWiringManifestReading(), forgetClassifierRoundObservation(), forgetEffectiveTurnFacts(), kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), invalidateEngineCaps(baseUrl, guardedCapsProbe);
484576
485428
  return;
484577
485429
  }
484578
485430
  kickAppendSystemPromptCapProbe(baseUrl, appendCapProbe), kickEngineCapsProbe(baseUrl, guardedCapsProbe);
@@ -484587,6 +485439,7 @@ var capsTeeEpochByBase, init_engineCapsArm = __esm({
484587
485439
  init_sqlEngineCapability2();
484588
485440
  init_writeProtectionCapability2();
484589
485441
  init_webSearchBackendCapability2();
485442
+ init_executionLaneCapability2();
484590
485443
  init_wiringManifestStore();
484591
485444
  init_classifierRoundObservation();
484592
485445
  init_effectiveTurnFactsStore();
@@ -484603,7 +485456,7 @@ function noteEngineRespawnForCrashConverged(baseUrl, principal) {
484603
485456
  let key = scopeKeyOf(baseUrl, principal);
484604
485457
  readScopes.delete(key), inFlightScopes.delete(key);
484605
485458
  }
484606
- function plural5(n2, one, many) {
485459
+ function plural6(n2, one, many) {
484607
485460
  return n2 === 1 ? one : many;
484608
485461
  }
484609
485462
  function crashConvergedCauseCodes(projection) {
@@ -484627,15 +485480,15 @@ function crashConvergedNoticeText(projection) {
484627
485480
  if (total > 0) {
484628
485481
  let causes = crashConvergedCauseCodes(projection), recordedAs = causes.length > 0 ? ` (recorded as ${causes.join(", ")})` : "";
484629
485482
  parts.push(
484630
- `the previous engine run ended with ${String(total)} ${plural5(total, "approval", "approvals")} still waiting${recordedAs}, and the engine converged ${plural5(total, "it", "them")} to denied`
485483
+ `the previous engine run ended with ${String(total)} ${plural6(total, "approval", "approvals")} still waiting${recordedAs}, and the engine converged ${plural6(total, "it", "them")} to denied`
484631
485484
  ), needsHuman > 0 ? parts.push(
484632
- `${String(needsHuman)} of ${String(total)} had already been approved, or cannot be accounted for, so a side effect may have partly landed \u2014 check ${plural5(needsHuman, "it", "them")} by hand before re-running`
484633
- ) : parts.push(`${RESUME_SAFE_CAVEAT_CLAUSE}, ${plural5(total, "it", "they")} can be re-run`);
485485
+ `${String(needsHuman)} of ${String(total)} had already been approved, or cannot be accounted for, so a side effect may have partly landed \u2014 check ${plural6(needsHuman, "it", "them")} by hand before re-running`
485486
+ ) : parts.push(`${RESUME_SAFE_CAVEAT_CLAUSE}, ${plural6(total, "it", "they")} can be re-run`);
484634
485487
  } else
484635
485488
  return parts.push(
484636
- `the previous session left ${String(dropped2)} crash-converged approval ${plural5(dropped2, "record", "records")} that this version could not read`
485489
+ `the previous session left ${String(dropped2)} crash-converged approval ${plural6(dropped2, "record", "records")} that this version could not read`
484637
485490
  ), `${parts.join("; ")}. ${NO_AUTO_RERUN_CLAUSE}.`;
484638
- let droppedClause = dropped2 > 0 ? ` (${String(dropped2)} further ${plural5(dropped2, "record", "records")} could not be read.)` : "";
485491
+ let droppedClause = dropped2 > 0 ? ` (${String(dropped2)} further ${plural6(dropped2, "record", "records")} could not be read.)` : "";
484639
485492
  return `${parts.join("; ")}. ${NO_AUTO_RERUN_CLAUSE}.${droppedClause}`;
484640
485493
  }
484641
485494
  function sanitizeUntrusted(raw2) {
@@ -484683,7 +485536,7 @@ function crashConvergedDetailLines(projection) {
484683
485536
  ), out6.push(
484684
485537
  ...bucketLines("crash-converged (denied) \u2014 needs a human before re-running", projection.needsHuman)
484685
485538
  ), projection.dropped > 0 && out6.push(
484686
- `crash-converged: ${String(projection.dropped)} ${plural5(projection.dropped, "record", "records")} could not be read (upstream shape drift or a bad payload).`
485539
+ `crash-converged: ${String(projection.dropped)} ${plural6(projection.dropped, "record", "records")} could not be read (upstream shape drift or a bad payload).`
484687
485540
  ), out6;
484688
485541
  }
484689
485542
  function crashConvergedNoticeBlock(projection) {
@@ -485174,7 +486027,7 @@ function createLiveConversationClient(config4) {
485174
486027
  capsTee: (caps, generation2) => {
485175
486028
  noteEngineCapsForMcpGate(config4.baseUrl, caps), noteEngineCapsForSessionBackground(config4.baseUrl, caps), noteEngineCapsForProjectContext(config4.baseUrl, caps), readCrashConvergedOnce(client3, config4.baseUrl, { principal: config4.principal }), noteEngineCapsForWorkflowsGate(config4.baseUrl, caps, {
485176
486029
  ...typeof config4.principal == "string" ? { principal: config4.principal } : {}
485177
- }), noteEngineCapsForSqlEngine(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWriteProtection(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWebSearchBackend(config4.baseUrl, caps, { generation: generation2 });
486030
+ }), noteEngineCapsForSqlEngine(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWriteProtection(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForWebSearchBackend(config4.baseUrl, caps, { generation: generation2 }), noteEngineCapsForExecutionLane(config4.baseUrl, caps, { generation: generation2 });
485178
486031
  },
485179
486032
  afterEngineRespawn: config4.afterEngineRespawn === !0
485180
486033
  }), prepareTaskAgentsWire({
@@ -485558,6 +486411,7 @@ var ENGINE_TO_CC_TOOL, SUGGESTIONS_TAIL_MAX_ATTEMPTS, SUGGESTIONS_TAIL_RETRY_MS,
485558
486411
  init_sqlEngineCapability2();
485559
486412
  init_writeProtectionCapability2();
485560
486413
  init_webSearchBackendCapability2();
486414
+ init_executionLaneCapability2();
485561
486415
  init_liveApprovalCardHandles();
485562
486416
  init_debugLine();
485563
486417
  init_state();
@@ -485714,6 +486568,20 @@ async function resolveProbeEndpoint(model) {
485714
486568
  let { mergedModelEnv: mergedModelEnv2 } = await Promise.resolve().then(() => (init_modelRow(), modelRow_exports));
485715
486569
  return modelSwitchProbeEndpoint(poolBaseUrl, mergedModelEnv2());
485716
486570
  }
486571
+ async function productionRoutingNote(model) {
486572
+ let poolBaseUrl;
486573
+ try {
486574
+ let { poolEntryForModelRef: poolEntryForModelRef2 } = await Promise.resolve().then(() => (init_modelEndpointSwitch(), modelEndpointSwitch_exports));
486575
+ poolBaseUrl = poolEntryForModelRef2(model)?.baseUrl;
486576
+ } catch {
486577
+ poolBaseUrl = null;
486578
+ }
486579
+ let [{ mergedModelEnv: mergedModelEnv2 }, { modelRoutingEnvNote: modelRoutingEnvNote2 }] = await Promise.all([
486580
+ Promise.resolve().then(() => (init_modelRow(), modelRow_exports)),
486581
+ Promise.resolve().then(() => (init_modelRoutingEnvPrecedence(), modelRoutingEnvPrecedence_exports))
486582
+ ]);
486583
+ return modelRoutingEnvNote2(mergedModelEnv2(), poolBaseUrl);
486584
+ }
485717
486585
  async function productionValidate(model) {
485718
486586
  let { validateModel: validateModel2 } = await Promise.resolve().then(() => (init_validateModel(), validateModel_exports));
485719
486587
  return validateModel2(model);
@@ -485726,7 +486594,8 @@ function installModelSwitchProbePorts() {
485726
486594
  registerModelSwitchProbePorts({
485727
486595
  validate: productionValidate,
485728
486596
  live: productionLive,
485729
- endpointOf: resolveProbeEndpoint
486597
+ endpointOf: resolveProbeEndpoint,
486598
+ routingNote: productionRoutingNote
485730
486599
  });
485731
486600
  }
485732
486601
  var init_modelSwitchProbeAssembly = __esm({
@@ -486532,6 +487401,11 @@ function computeVisibleWindow(selected, total, viewport) {
486532
487401
  function isActive(a) {
486533
487402
  return a.state === "start" || a.state === "progress";
486534
487403
  }
487404
+ function legDisplayStatus(a, workflowActive) {
487405
+ if (workflowActive !== "unknown") return agentDisplayStatus(a, workflowActive);
487406
+ let own2 = agentDisplayStatus(a, !0);
487407
+ return own2 === "done" || own2 === "failed" || own2 === "skipped" || own2 === "parked" ? own2 : "run-unknown";
487408
+ }
486535
487409
  function statusGlyph(status3) {
486536
487410
  switch (status3) {
486537
487411
  case "done":
@@ -486547,10 +487421,12 @@ function statusGlyph(status3) {
486547
487421
  return { glyph: G_RUNNING, color: "subtle" };
486548
487422
  case "parked":
486549
487423
  return { glyph: G_QUEUED, color: "warning" };
487424
+ case "run-unknown":
487425
+ return { glyph: G_QUEUED, color: "subtle" };
486550
487426
  }
486551
487427
  }
486552
487428
  function countLabel(n2, filterLabel) {
486553
- return filterLabel ? `showing ${n2} ${filterLabel}` : `${n2} ${plural(n2, "agent")}`;
487429
+ return filterLabel ? `showing ${n2} ${filterLabel}` : `${n2} ${plural2(n2, "agent")}`;
486554
487430
  }
486555
487431
  function emptyLabel(phase, filterLabel) {
486556
487432
  return phase.status === "not-started" ? "Not started yet" : filterLabel ? `No ${filterLabel} agents` : "No agents";
@@ -486575,8 +487451,8 @@ function wrapLines(text2, width) {
486575
487451
  return out6;
486576
487452
  }
486577
487453
  function agentStats(a, workflowActive) {
486578
- let status3 = agentDisplayStatus(a, workflowActive), model = a.fallbackModel != null && a.model != null && a.fallbackModel !== a.model ? `\u2192 ${a.fallbackModel}` : a.model ?? a.fallbackModel ?? "", o = [];
486579
- if (a.isolation != null && o.push(a.isolation), a.tokens != null && o.push(`${fmtTokens2(a.tokens)} tok`), a.toolCalls != null && a.toolCalls > 0 && o.push(`${a.toolCalls} ${plural(a.toolCalls, "tool")}`), a.durationMs != null && o.push(fmtDur(a.durationMs)), status3 === "running" && a.lastProgressAt != null) {
487454
+ let status3 = legDisplayStatus(a, workflowActive), model = a.fallbackModel != null && a.model != null && a.fallbackModel !== a.model ? `\u2192 ${a.fallbackModel}` : a.model ?? a.fallbackModel ?? "", o = [];
487455
+ if (a.isolation != null && o.push(a.isolation), a.tokens != null && o.push(`${fmtTokens2(a.tokens)} tok`), a.toolCalls != null && a.toolCalls > 0 && o.push(`${a.toolCalls} ${plural2(a.toolCalls, "tool")}`), a.durationMs != null && o.push(fmtDur(a.durationMs)), status3 === "running" && a.lastProgressAt != null) {
486580
487456
  let idle = Math.floor((Date.now() - a.lastProgressAt) / 1e3);
486581
487457
  idle >= 30 && o.push(`idle ${fmtDur(idle * 1e3)}`);
486582
487458
  }
@@ -486688,7 +487564,7 @@ function phaseRow(phase, index, selectedIndex, level, width) {
486688
487564
  ), segs;
486689
487565
  }
486690
487566
  function agentRowWide(a, index, selectedIndex, level, rightWidth, labelWidth, workflowActive) {
486691
- let sel = level === "agents" && index === selectedIndex, { glyph, color: color4 } = statusGlyph(agentDisplayStatus(a, workflowActive)), label = trunc(a.label, labelWidth), labelPad = " ".repeat(Math.max(0, labelWidth - sw(label))), statsW = Math.max(0, rightWidth - (labelWidth + 4));
487567
+ let sel = level === "agents" && index === selectedIndex, { glyph, color: color4 } = statusGlyph(legDisplayStatus(a, workflowActive)), label = trunc(a.label, labelWidth), labelPad = " ".repeat(Math.max(0, labelWidth - sw(label))), statsW = Math.max(0, rightWidth - (labelWidth + 4));
486692
487568
  return [
486693
487569
  { text: sel ? F_POINTER : " ", color: "permission" },
486694
487570
  { text: glyph, color: color4 },
@@ -486703,7 +487579,7 @@ function agentRowWide(a, index, selectedIndex, level, rightWidth, labelWidth, wo
486703
487579
  ];
486704
487580
  }
486705
487581
  function agentRowNarrow(a, index, selectedIndex, leftWidth, workflowActive) {
486706
- let sel = index === selectedIndex, { glyph, color: color4 } = statusGlyph(agentDisplayStatus(a, workflowActive)), label = trunc(a.label, Math.max(1, leftWidth - 4));
487582
+ let sel = index === selectedIndex, { glyph, color: color4 } = statusGlyph(legDisplayStatus(a, workflowActive)), label = trunc(a.label, Math.max(1, leftWidth - 4));
486707
487583
  return [
486708
487584
  { text: sel ? `${F_POINTER} ` : " ", color: "permission" },
486709
487585
  { text: glyph, color: color4 },
@@ -486738,7 +487614,7 @@ function buildAgentDetailLines({
486738
487614
  ...metaText ? [{ text: metaText, dimColor: !0 }] : []
486739
487615
  ]);
486740
487616
  let stats3 = [];
486741
- if (agent.tokens != null && stats3.push(`${fmtTokens2(agent.tokens)} tok`), agent.toolCalls != null && agent.toolCalls > 0 && stats3.push(`${agent.toolCalls} ${plural(agent.toolCalls, "tool call")}`), agent.durationMs != null && stats3.push(fmtDur(agent.durationMs)), status3 === "queued" && agent.queuedAt != null && stats3.push(`waiting ${fmtDur(Math.max(0, nowMs2 - agent.queuedAt))}`), status3 === "running" && agent.lastProgressAt != null) {
487617
+ if (agent.tokens != null && stats3.push(`${fmtTokens2(agent.tokens)} tok`), agent.toolCalls != null && agent.toolCalls > 0 && stats3.push(`${agent.toolCalls} ${plural2(agent.toolCalls, "tool call")}`), agent.durationMs != null && stats3.push(fmtDur(agent.durationMs)), status3 === "queued" && agent.queuedAt != null && stats3.push(`waiting ${fmtDur(Math.max(0, nowMs2 - agent.queuedAt))}`), status3 === "running" && agent.lastProgressAt != null) {
486742
487618
  let idle = Math.floor((nowMs2 - agent.lastProgressAt) / 1e3);
486743
487619
  idle >= 30 && stats3.push(`idle ${fmtDur(idle * 1e3)}`);
486744
487620
  }
@@ -486753,7 +487629,7 @@ function buildAgentDetailLines({
486753
487629
  if (!promptExpanded && expandable) {
486754
487630
  let more = promptLines.length - KIO;
486755
487631
  lines.push([
486756
- { text: ` ${ELLIPSIS2} ${more} more ${plural(more, "line")}`, dimColor: !0 }
487632
+ { text: ` ${ELLIPSIS2} ${more} more ${plural2(more, "line")}`, dimColor: !0 }
486757
487633
  ]);
486758
487634
  }
486759
487635
  } else
@@ -486798,6 +487674,11 @@ function buildAgentDetailLines({
486798
487674
  { text: " Waiting for approval \u2014 this agent is paused on a permission card until someone decides.", color: "warning" }
486799
487675
  ]);
486800
487676
  break;
487677
+ case "run-unknown":
487678
+ lines.push([
487679
+ { text: " Outcome unknown \u2014 this end cannot read the run status, so it cannot say whether this agent is still working.", dimColor: !0 }
487680
+ ]);
487681
+ break;
486801
487682
  case "skipped":
486802
487683
  lines.push([{ text: " Skipped by user.", dimColor: !0 }]);
486803
487684
  break;
@@ -486878,7 +487759,7 @@ function SinglePaneAgents({
486878
487759
  else {
486879
487760
  let labelW = Math.min(22, Math.max(4, contentWidth - 5));
486880
487761
  for (let r = win.from; r < win.to; r++) {
486881
- let a = agents3[r], sel = level === "agents" && r === selectedAgent, { glyph, color: color4 } = statusGlyph(agentDisplayStatus(a, workflowActive)), label = trunc(a.label, labelW), labelPad = " ".repeat(Math.max(0, labelW - sw(label))), statsW = Math.max(0, contentWidth - (labelW + 5));
487762
+ let a = agents3[r], sel = level === "agents" && r === selectedAgent, { glyph, color: color4 } = statusGlyph(legDisplayStatus(a, workflowActive)), label = trunc(a.label, labelW), labelPad = " ".repeat(Math.max(0, labelW - sw(label))), statsW = Math.max(0, contentWidth - (labelW + 5));
486882
487763
  rows3.push(
486883
487764
  /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
486884
487765
  BoxRow,
@@ -487091,7 +487972,7 @@ function Header({
487091
487972
  }
487092
487973
  function buildHeader(run2, pending4) {
487093
487974
  let name = run2.name ? `dynamic workflow: ${run2.name}` : "dynamic workflow", subtext = run2.description ?? run2.summary, parts = [];
487094
- 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) {
487975
+ if ((!pending4 || run2.agentCount > 0) && parts.push(`${run2.agentCount} ${plural2(run2.agentCount, "agent")}`), run2.totalTokens > 0 && parts.push(`${fmtTokens2(run2.totalTokens)} tokens`), parts.push(run2.status), run2.status === "running" && run2.phases.length > 1) {
487095
487976
  let current6 = [...run2.phases].reverse().find((p) => p.status === "running") ?? [...run2.phases].reverse().find((p) => p.status !== "not-started");
487096
487977
  current6 && parts.push(`phase: ${current6.title}`);
487097
487978
  }
@@ -487116,10 +487997,10 @@ function WorkflowDetailDialog2({
487116
487997
  initialPhaseIndex !== void 0 ? Math.max(0, initialPhaseIndex) : 0
487117
487998
  ), [agentIdx, setAgentIdx] = (0, import_react204.useState)(0), [level, setLevel] = (0, import_react204.useState)(
487118
487999
  initialPhaseIndex !== void 0 ? "agents" : "phases"
487119
- ), [pendingDetail, setPendingDetail] = (0, import_react204.useState)(!1), [cardScroll, setCardScroll] = (0, import_react204.useState)(0), [promptExpanded, setPromptExpanded] = (0, import_react204.useState)(!1), [filter2, setFilter] = (0, import_react204.useState)("all"), [showSave, setShowSave] = (0, import_react204.useState)(!1), [showJournal, setShowJournal] = (0, import_react204.useState)(!1), [journalScroll, setJournalScroll] = (0, import_react204.useState)(0), [journal, setJournal] = (0, import_react204.useState)({ phase: "loading" }), clampedPhase = Math.min(phaseIdx, Math.max(0, phases.length - 1)), phase = phases[clampedPhase], workflowActive = workflow.status === "running", filteredPhase = (0, import_react204.useMemo)(() => !phase || filter2 === "all" || level === "phases" ? phase : {
488000
+ ), [pendingDetail, setPendingDetail] = (0, import_react204.useState)(!1), [cardScroll, setCardScroll] = (0, import_react204.useState)(0), [promptExpanded, setPromptExpanded] = (0, import_react204.useState)(!1), [filter2, setFilter] = (0, import_react204.useState)("all"), [showSave, setShowSave] = (0, import_react204.useState)(!1), [showJournal, setShowJournal] = (0, import_react204.useState)(!1), [journalScroll, setJournalScroll] = (0, import_react204.useState)(0), [journal, setJournal] = (0, import_react204.useState)({ phase: "loading" }), clampedPhase = Math.min(phaseIdx, Math.max(0, phases.length - 1)), phase = phases[clampedPhase], workflowActive = workflow.status === "unknown" ? "unknown" : workflow.status === "running", filteredPhase = (0, import_react204.useMemo)(() => !phase || filter2 === "all" || level === "phases" ? phase : {
487120
488001
  ...phase,
487121
- agents: phase.agents.filter((a) => agentDisplayStatus(a, workflowActive) === filter2)
487122
- }, [phase, filter2, level, workflowActive]), clampedAgent = filteredPhase ? Math.min(agentIdx, Math.max(0, filteredPhase.agents.length - 1)) : 0, hasPhases = phases.length > 0, selectedAgent = level !== "phases" && filteredPhase ? filteredPhase.agents[clampedAgent] : void 0, agentStatus = selectedAgent ? agentDisplayStatus(selectedAgent, workflowActive) : void 0;
488002
+ agents: phase.agents.filter((a) => legDisplayStatus(a, workflowActive) === filter2)
488003
+ }, [phase, filter2, level, workflowActive]), clampedAgent = filteredPhase ? Math.min(agentIdx, Math.max(0, filteredPhase.agents.length - 1)) : 0, hasPhases = phases.length > 0, selectedAgent = level !== "phases" && filteredPhase ? filteredPhase.agents[clampedAgent] : void 0, agentStatus = selectedAgent ? legDisplayStatus(selectedAgent, workflowActive) : void 0;
487123
488004
  function resetCard() {
487124
488005
  setCardScroll(0), setPromptExpanded(!1);
487125
488006
  }
@@ -487156,13 +488037,13 @@ function WorkflowDetailDialog2({
487156
488037
  }
487157
488038
  function cycleFilter() {
487158
488039
  if (!phase || pendingDetail) return;
487159
- let present = new Set(phase.agents.map((a) => agentDisplayStatus(a, workflowActive)));
488040
+ let present2 = new Set(phase.agents.map((a) => legDisplayStatus(a, workflowActive)));
487160
488041
  setFilter((cur) => {
487161
488042
  let i = FILTER_CYCLE.indexOf(cur);
487162
488043
  for (let k2 = 0; k2 < FILTER_CYCLE.length; k2++) {
487163
488044
  i = (i + 1) % FILTER_CYCLE.length;
487164
488045
  let f = FILTER_CYCLE[i];
487165
- if (f === "all" || present.has(f)) break;
488046
+ if (f === "all" || present2.has(f)) break;
487166
488047
  }
487167
488048
  return FILTER_CYCLE[i];
487168
488049
  }), setAgentIdx(0), resetCard();
@@ -487429,7 +488310,12 @@ var import_react204, import_jsx_runtime362, F_TICK, F_CROSS, F_POINTER, F_ARROW_
487429
488310
  interrupted: "Stopped",
487430
488311
  // sema 超集(client-core 0.63.1 起):这条腿耐久挂在一张审批卡上,等一个人做决定。
487431
488312
  // 🔴 措辞与字色都不复用 running:「在跑」承诺的是等着就好,「等批准」是一件还能动手的事。
487432
- parked: "Waiting for approval"
488313
+ parked: "Waiting for approval",
488314
+ // 🔴 1.0.121 壳侧呈现层第三态(见 `legDisplayStatus` 头注):run 级状态词读不出 ⇒
488315
+ // 推断类三词(running / queued / interrupted)没有依据,整体让位给这一句。
488316
+ // 🔴 这一员**必须在表里**:`STATUS_LABEL[status]` 是详情卡头的标签,漏一员就渲 `undefined`
488317
+ // (本仓 `tsconfig.strict = false` ⇒ tsc **不会**拦住这一格,只能靠判据)。
488318
+ "run-unknown": "Outcome unknown"
487433
488319
  }, FILTER_CYCLE = [
487434
488320
  "all",
487435
488321
  "running",
@@ -487438,8 +488324,10 @@ var import_react204, import_jsx_runtime362, F_TICK, F_CROSS, F_POINTER, F_ARROW_
487438
488324
  "done",
487439
488325
  "skipped",
487440
488326
  "interrupted",
487441
- "parked"
488327
+ "parked",
487442
488328
  // sema 超集:与 STATUS_LABEL 同批加,筛选环能选到等批准的腿
488329
+ "run-unknown"
488330
+ // 1.0.121:同上 —— 不进筛选环的话,这一档的腿筛不出来
487443
488331
  ], sw = (s) => stringWidth(s), trunc = (s, w2) => truncateToWidth(s, w2);
487444
488332
  fmtTokens2 = (n2) => formatTokens(n2), fmtDur = (ms) => formatDuration(ms);
487445
488333
  workflow_detail_dialog_default = WorkflowDetailDialog2;
@@ -487758,7 +488646,7 @@ function goalSubtitleParts(state5, opts) {
487758
488646
  // RUNNING state prefixes the duration with "running "; ACHIEVED state shows the bare duration.
487759
488647
  opts.withRunningPrefix ? `running ${duration3}` : duration3,
487760
488648
  // 187: `${iterations} ${Sn(iterations,"turn")}` — only when iterations>0.
487761
- state5.iterations > 0 && `${state5.iterations} ${plural(state5.iterations, "turn")}`,
488649
+ state5.iterations > 0 && `${state5.iterations} ${plural2(state5.iterations, "turn")}`,
487762
488650
  // 187: `${el(tokens)} tokens`. 🔴 sema 多一道 `!== undefined` 闸:live 车道没有可用的会话
487763
488651
  // 用量表(等价物读 STATE.modelUsage,而它只由壳自己的 API 路径写,引擎模式恒 0),所以
487764
488652
  // live 切片**不带** tokens,这一段整体省掉 —— 显示 "0 tokens" 会是个看起来合理的假值。
@@ -498977,16 +499865,48 @@ function useCoordinatorTaskCount() {
498977
499865
  return fleetFooterTaskCount(useFleetFooterRows());
498978
499866
  }
498979
499867
  function useEngineAgentPanelBridge(setAppState) {
498980
- let ownedRows = engineOwnedRowIds;
499868
+ let ownedRows = engineOwnedRowIds, reapAbsentRows = React133.useCallback(() => {
499869
+ let reaped = [];
499870
+ setAppState((prev) => {
499871
+ let ids = reapExpiredEngineAgentAbsences(prev.tasks ?? {}, ownedRows);
499872
+ if (ids.length === 0) return prev;
499873
+ let nextTasks = { ...prev.tasks };
499874
+ for (let id of ids) {
499875
+ let row2 = nextTasks[id];
499876
+ reaped.push({ id, label: row2?.description ?? id }), delete nextTasks[id];
499877
+ }
499878
+ return { ...prev, tasks: nextTasks };
499879
+ });
499880
+ for (let r of reaped) {
499881
+ noteEngineAgentRowReclaimed(r.id, r.label), ownedRows.delete(r.id), fleetOwnedRowIds.delete(r.id), tickLaneRowIds.delete(r.id), queueTranscriptSystemNotice(engineAgentAbsenceDroppedLine(r.label), "info");
499882
+ let pending4 = absenceReapTimers.get(r.id);
499883
+ pending4 !== void 0 && (clearTimeout(pending4), absenceReapTimers.delete(r.id));
499884
+ }
499885
+ }, [setAppState, ownedRows]), scheduleAbsenceReapAt = React133.useCallback(
499886
+ function armAbsenceReap(taskId, dueAtMs) {
499887
+ let prev = absenceReapTimers.get(taskId);
499888
+ prev !== void 0 && clearTimeout(prev);
499889
+ let delay = Math.max(0, dueAtMs - Date.now()) + 250, timer4 = setTimeout(() => {
499890
+ absenceReapTimers.delete(taskId), reapAbsentRows();
499891
+ let tasks3 = getAppStateStoreRef()?.getState()?.tasks;
499892
+ tasks3 !== void 0 && expiredButRetainedEngineAgentAbsences(tasks3, ownedRows).includes(taskId) && armAbsenceReap(taskId, Date.now() + RETAINED_ABSENCE_RECHECK_MS);
499893
+ }, delay);
499894
+ timer4.unref?.(), absenceReapTimers.set(taskId, timer4);
499895
+ },
499896
+ [reapAbsentRows, ownedRows]
499897
+ );
498981
499898
  React133.useEffect(
498982
499899
  () => subscribeEngineAgentPanel((ev) => {
498983
- let settle3 = (taskId, isError, report) => {
499900
+ let settle3 = (taskId, isError, report, opts) => {
498984
499901
  updateTaskState(taskId, setAppState, (task) => {
498985
- if (task.status !== "running") return task;
499902
+ if (task.status !== "running" || opts?.respectAbsence === !0 && isAbsentRow(task)) return task;
498986
499903
  let next = {
498987
499904
  ...task,
498988
499905
  status: isError ? "failed" : "completed",
498989
499906
  endTime: Date.now(),
499907
+ // 真终态到了 ⇒ 「结局不知道」这一位同拍清掉(absent 之后迟到的 end 是合法序,
499908
+ // 见 §59 S-1「真终态迟到照发唯一一次 end」)。
499909
+ _semaAbsence: void 0,
498990
499910
  // Review fix w0zwpa251 #2b: evictTerminalTask requires `notified` — these rows have no
498991
499911
  // runner to send a completion notification, so mark notified at settle or the row (and
498992
499912
  // its evictAfter deadline) leaks in AppState forever.
@@ -499016,7 +499936,7 @@ function useEngineAgentPanelBridge(setAppState) {
499016
499936
  // `progress?.summary || description`), so the panel row shows the current action
499017
499937
  // while running. Absent (old engine) ⇒ keep whatever summary the row had.
499018
499938
  ...ev.currentAction ? { summary: ev.currentAction } : {}
499019
- }, next = { ...existing, progress };
499939
+ }, next = { ...clearEngineAgentRowAbsence(existing), progress };
499020
499940
  return !existing.prompt && ev.prompt && (next.prompt = ev.prompt), !existing.description && ev.description && (next.description = ev.description), next.retain && next.prompt && (next.messages?.length ?? 0) > 0 && !hasDelegatedPromptSlot(next.messages, next.prompt) && (next.messages = [
499021
499941
  createUserMessage({ content: next.prompt }),
499022
499942
  ...next.messages
@@ -499054,17 +499974,23 @@ function useEngineAgentPanelBridge(setAppState) {
499054
499974
  return { ...prev, tasks: { ...prev.tasks, [ev.taskId]: row2 } };
499055
499975
  }), seedEngineAgentTranscript(setAppState, ev.taskId);
499056
499976
  else if (ev.kind === "fleet-row") {
499057
- if (tickLaneRowIds.has(ev.taskId)) return;
499977
+ if (tickLaneRowIds.has(ev.taskId)) {
499978
+ updateTaskState(ev.taskId, setAppState, clearEngineAgentRowAbsence);
499979
+ return;
499980
+ }
499058
499981
  ownedRows.add(ev.taskId);
499059
499982
  let transcriptAnchorIsNew = !!ev.transcriptId && getEngineTranscriptId(ev.taskId) !== ev.transcriptId;
499060
499983
  if (ev.transcriptId && recordEngineTranscriptId(ev.taskId, ev.transcriptId), markEnginePanelTaskResident(ev.taskId), setAppState((prev) => {
499061
499984
  let existing = prev.tasks[ev.taskId];
499062
499985
  if (existing) {
499063
499986
  if (!isLocalAgentTask2(existing) || existing.status !== "running" || !fleetOwnedRowIds.has(ev.taskId)) return prev;
499064
- let tokensChanged = ev.totalTokens !== void 0 && existing.progress?.tokenCount !== ev.totalTokens, toolUsesChanged = ev.toolUses !== void 0 && existing.progress?.toolUseCount !== ev.toolUses, startChanged = ev.startedAt !== void 0 && existing.startTime !== ev.startedAt;
499065
- if (!tokensChanged && !toolUsesChanged && !startChanged) return prev;
499987
+ let absenceCleared = isAbsentRow(existing), tokensChanged = ev.totalTokens !== void 0 && existing.progress?.tokenCount !== ev.totalTokens, toolUsesChanged = ev.toolUses !== void 0 && existing.progress?.toolUseCount !== ev.toolUses, startChanged = ev.startedAt !== void 0 && existing.startTime !== ev.startedAt;
499988
+ if (!tokensChanged && !toolUsesChanged && !startChanged && !absenceCleared) return prev;
499066
499989
  let next = {
499067
499990
  ...existing,
499991
+ // 回来了 ⇒ 清缺席位 + 撤停表(endTime 是 absent 臂为了停表落的猜测值,不是终局钟;
499992
+ // 行还在跑,留着它 elapsed 就永远冻在缺席那一刻)。
499993
+ ...absenceCleared ? { _semaAbsence: void 0, endTime: void 0 } : {},
499068
499994
  ...startChanged ? { startTime: ev.startedAt, startTimeFromWire: !0 } : {},
499069
499995
  progress: {
499070
499996
  ...existing.progress ?? {},
@@ -499130,7 +500056,15 @@ function useEngineAgentPanelBridge(setAppState) {
499130
500056
  );
499131
500057
  }
499132
500058
  } else if (ev.kind === "end") {
499133
- if (settleSubagentContent(ev.taskId), settle3(ev.taskId, ev.isError, ev.report), fleetOwnedRowIds.delete(ev.taskId), getEngineTranscriptId(ev.taskId)) {
500059
+ let droppedLabel = takeEngineAgentReclaimedRow(ev.taskId);
500060
+ if (droppedLabel !== null && queueTranscriptSystemNotice(
500061
+ engineAgentTerminalAfterDropLine(
500062
+ droppedLabel,
500063
+ ev.isError ? "failed" : "completed",
500064
+ typeof ev.report == "string" && ev.report.length > 0
500065
+ ),
500066
+ "info"
500067
+ ), settleSubagentContent(ev.taskId), settle3(ev.taskId, ev.isError, ev.report), fleetOwnedRowIds.delete(ev.taskId), getEngineTranscriptId(ev.taskId)) {
499134
500068
  let store = getAppStateStoreRef();
499135
500069
  store && hydrateEngineAgentPrompt(
499136
500070
  store,
@@ -499138,11 +500072,30 @@ function useEngineAgentPanelBridge(setAppState) {
499138
500072
  (text2) => createUserMessage({ content: text2 })
499139
500073
  );
499140
500074
  }
499141
- } else
500075
+ } else if (ev.kind === "sweep") {
499142
500076
  for (let taskId of ownedRows)
499143
- isEnginePanelTaskResident(taskId) || settle3(taskId, !1);
500077
+ isEnginePanelTaskResident(taskId) || settle3(taskId, !1, void 0, { respectAbsence: !0 });
500078
+ reapAbsentRows();
500079
+ } else
500080
+ logForDebugging(
500081
+ `[engine-agent-panel] ignored unknown event kind=${String(
500082
+ ev.kind
500083
+ )}`
500084
+ );
499144
500085
  }),
499145
500086
  [setAppState, ownedRows]
500087
+ ), React133.useEffect(
500088
+ () => subscribeEngineAgentPanelAbsence((ev) => {
500089
+ ownedRows.has(ev.taskId) && (updateTaskState(
500090
+ ev.taskId,
500091
+ setAppState,
500092
+ (task) => isLocalAgentTask2(task) ? markEngineAgentRowAbsent(task, {
500093
+ lastSeenAtMs: ev.lastSeenAtMs,
500094
+ absentForMs: ev.absentForMs
500095
+ }) : task
500096
+ ), reapAbsentRows(), scheduleAbsenceReapAt(ev.taskId, ev.lastSeenAtMs + 18e5));
500097
+ }),
500098
+ [setAppState, ownedRows, reapAbsentRows, scheduleAbsenceReapAt]
499146
500099
  ), React133.useEffect(
499147
500100
  () => subscribeSubagentContent((taskId) => {
499148
500101
  updateTaskState(taskId, setAppState, (task) => {
@@ -499186,7 +500139,7 @@ function useEngineBgShellPanelBridge(setAppState) {
499186
500139
  // unknown at register (prose-only receipt); settle late-binds the structured path
499187
500140
  };
499188
500141
  return { ...prev, tasks: { ...prev.tasks, [ev.taskId]: row2 } };
499189
- }) : updateTaskState(ev.taskId, setAppState, (task) => !isLocalShellTask(task) || task.engineSide !== !0 ? task : task.status !== "running" ? ev.outputPath && task.outputFile === "" ? { ...task, outputFile: ev.outputPath } : task : {
500142
+ }) : ev.kind === "settle" ? updateTaskState(ev.taskId, setAppState, (task) => !isLocalShellTask(task) || task.engineSide !== !0 ? task : task.status !== "running" ? ev.outputPath && task.outputFile === "" ? { ...task, outputFile: ev.outputPath } : task : {
499190
500143
  ...task,
499191
500144
  // 🔴 L-221③:`blocked`(agent 自报走不下去)是**非成功终局**,而 CC 的本地任务行
499192
500145
  // 词表里没有这个词 ⇒ 翻成 `failed`,**绝不**翻成 completed(那是把一条干不成的
@@ -499195,12 +500148,16 @@ function useEngineBgShellPanelBridge(setAppState) {
499195
500148
  endTime: Date.now(),
499196
500149
  notified: !0,
499197
500150
  ...ev.outputPath && task.outputFile === "" ? { outputFile: ev.outputPath } : {}
499198
- });
500151
+ }) : logForDebugging(
500152
+ `[engine-bg-shell-panel] ignored unknown event kind=${String(
500153
+ ev.kind
500154
+ )}`
500155
+ );
499199
500156
  }),
499200
500157
  [setAppState]
499201
500158
  );
499202
500159
  }
499203
- var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, init_chrome_agentprogress = __esm({
500160
+ var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, absenceReapTimers, RETAINED_ABSENCE_RECHECK_MS, init_chrome_agentprogress = __esm({
499204
500161
  "build-src/src/sema/overrides/chrome-agentprogress.tsx"() {
499205
500162
  React133 = __toESM(require_react(), 1);
499206
500163
  init_figures();
@@ -499218,6 +500175,8 @@ var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, init_chro
499218
500175
  init_dist();
499219
500176
  init_subagentStatusLine();
499220
500177
  init_engineDelegatedPrompt2();
500178
+ init_engineAgentAbsence();
500179
+ init_transcriptSystemNotice();
499221
500180
  init_appStateRef();
499222
500181
  init_engineBgShellPanelStore();
499223
500182
  init_guards();
@@ -499228,7 +500187,7 @@ var React133, import_jsx_runtime376, fleetOwnedRowIds, tickLaneRowIds, init_chro
499228
500187
  init_engineSubagentTail2();
499229
500188
  init_CoordinatorAgentStatus();
499230
500189
  import_jsx_runtime376 = __toESM(require_jsx_runtime(), 1);
499231
- fleetOwnedRowIds = /* @__PURE__ */ new Set(), tickLaneRowIds = /* @__PURE__ */ new Set();
500190
+ fleetOwnedRowIds = /* @__PURE__ */ new Set(), tickLaneRowIds = /* @__PURE__ */ new Set(), absenceReapTimers = /* @__PURE__ */ new Map(), RETAINED_ABSENCE_RECHECK_MS = 6e4;
499232
500191
  }
499233
500192
  });
499234
500193
 
@@ -499556,10 +500515,21 @@ function workflowRowRunStatus(raw2) {
499556
500515
  case "failed":
499557
500516
  case "killed":
499558
500517
  return "failed";
500518
+ case "running":
500519
+ return "running";
500520
+ // 包侧 `coerceRunStatus` 同判:无 run 级 queued 词,排队按活跃渲
500521
+ // (正向证据:引擎说它在队里)。
500522
+ case "queued":
500523
+ return "running";
500524
+ // `awaiting approval` = fleet 词表里 `parked` 的那一个词(包侧 `coerceWorkflowStatus`
500525
+ // 就是这么投的)。修前只有裸 `parked` 一臂 —— 而 fleet 这条道上永远送不到那个词,
500526
+ // 于是等批准的 run 掉进 default 被说成「在跑」。两个词并到同一臂(与 `killed`
500527
+ // 归 `failed` 同式的跨词表成员处置)。
500528
+ case "awaiting approval":
499559
500529
  case "parked":
499560
500530
  return "parked";
499561
500531
  default:
499562
- return "running";
500532
+ return "unknown";
499563
500533
  }
499564
500534
  }
499565
500535
  function rowFallbackRunState(id, w2) {
@@ -506866,9 +507836,9 @@ function getZodSchema(schema) {
506866
507836
  if (schema.type === "string") {
506867
507837
  let stringSchema = external_exports.string();
506868
507838
  switch (schema.minLength !== void 0 && (stringSchema = stringSchema.min(schema.minLength, {
506869
- message: `Must be at least ${schema.minLength} ${plural(schema.minLength, "character")}`
507839
+ message: `Must be at least ${schema.minLength} ${plural2(schema.minLength, "character")}`
506870
507840
  })), schema.maxLength !== void 0 && (stringSchema = stringSchema.max(schema.maxLength, {
506871
- message: `Must be at most ${schema.maxLength} ${plural(schema.maxLength, "character")}`
507841
+ message: `Must be at most ${schema.maxLength} ${plural2(schema.maxLength, "character")}`
506872
507842
  })), schema.format) {
506873
507843
  case "email":
506874
507844
  stringSchema = stringSchema.email({
@@ -507088,7 +508058,7 @@ function ElicitationFormDialog({
507088
508058
  function validateMultiSelect(fieldName, schema_0) {
507089
508059
  if (!isMultiSelectEnumSchema(schema_0)) return;
507090
508060
  let selected = formValues[fieldName] ?? [], fieldRequired = schemaFields.find((f) => f.name === fieldName)?.isRequired ?? !1, min = schema_0.minItems, max2 = schema_0.maxItems;
507091
- min !== void 0 && selected.length < min && (selected.length > 0 || fieldRequired) ? updateValidationError(fieldName, `Select at least ${min} ${plural(min, "item")}`) : max2 !== void 0 && selected.length > max2 ? updateValidationError(fieldName, `Select at most ${max2} ${plural(max2, "item")}`) : updateValidationError(fieldName);
508061
+ min !== void 0 && selected.length < min && (selected.length > 0 || fieldRequired) ? updateValidationError(fieldName, `Select at least ${min} ${plural2(min, "item")}`) : max2 !== void 0 && selected.length > max2 ? updateValidationError(fieldName, `Select at most ${max2} ${plural2(max2, "item")}`) : updateValidationError(fieldName);
507092
508062
  }
507093
508063
  function handleNavigation(direction) {
507094
508064
  currentField && isMultiSelectEnumSchema(currentField.schema) ? (validateMultiSelect(currentField.name, currentField.schema), setExpandedAccordion(void 0)) : currentField && isEnumSchema(currentField.schema) && setExpandedAccordion(void 0), isEditingTextField && currentField && (commitTextField(currentField.name, currentField.schema, textInputValue), dateDebounceRef.current !== void 0 && (clearTimeout(dateDebounceRef.current), dateDebounceRef.current = void 0), isDateTimeSchema(currentField.schema) && textInputValue.trim() !== "" && validationErrors[currentField.name] && resolveFieldAsync(currentField.name, currentField.schema, textInputValue));
@@ -507199,7 +508169,7 @@ function ElicitationFormDialog({
507199
508169
  let newSelected = selected_0.includes(optionValue) ? selected_0.filter((v2) => v2 !== optionValue) : [...selected_0, optionValue], newValue_1 = newSelected.length > 0 ? newSelected : void 0;
507200
508170
  setField(currentField.name, newValue_1);
507201
508171
  let min_0 = msSchema.minItems, max_0 = msSchema.maxItems;
507202
- min_0 !== void 0 && newSelected.length < min_0 && (newSelected.length > 0 || currentField.isRequired) ? updateValidationError(currentField.name, `Select at least ${min_0} ${plural(min_0, "item")}`) : max_0 !== void 0 && newSelected.length > max_0 ? updateValidationError(currentField.name, `Select at most ${max_0} ${plural(max_0, "item")}`) : updateValidationError(currentField.name);
508172
+ min_0 !== void 0 && newSelected.length < min_0 && (newSelected.length > 0 || currentField.isRequired) ? updateValidationError(currentField.name, `Select at least ${min_0} ${plural2(min_0, "item")}`) : max_0 !== void 0 && newSelected.length > max_0 ? updateValidationError(currentField.name, `Select at most ${max_0} ${plural2(max_0, "item")}`) : updateValidationError(currentField.name);
507203
508173
  }
507204
508174
  return;
507205
508175
  }
@@ -514509,7 +515479,7 @@ function _temp431(s_1) {
514509
515479
  return s_1.expandedView;
514510
515480
  }
514511
515481
  function _temp338(t2) {
514512
- return isBackgroundTask(t2) && !0;
515482
+ return isRunningBackgroundTask(t2) && !0;
514513
515483
  }
514514
515484
  function _temp254(s_0) {
514515
515485
  return s_0.viewingAgentTaskId;
@@ -514591,7 +515561,7 @@ var import_compiler_runtime286, React162, import_react266, import_jsx_runtime446
514591
515561
  init_teammateViewHelpers();
514592
515562
  init_LocalAgentTask();
514593
515563
  init_pillLabel();
514594
- init_types24();
515564
+ init_runningBackgroundTasks();
514595
515565
  init_horizontalScroll();
514596
515566
  init_ink2();
514597
515567
  init_agentColorManager();
@@ -514849,7 +515819,7 @@ function ModeIndicator({
514849
515819
  columns
514850
515820
  } = useTerminalSize(), modeCycleShortcut = useShortcutDisplay("chat:cycleMode", "Chat", "shift+tab"), tasks3 = useAppState((s) => s.tasks), teamContext = useAppState(
514851
515821
  (s_0) => s_0.teamContext
514852
- ), store = useAppStateStore(), [remoteSessionUrl] = (0, import_react268.useState)(() => store.getState().remoteSessionUrl), viewSelectionMode = useAppState((s_1) => s_1.viewSelectionMode), viewingAgentTaskId = useAppState((s_2) => s_2.viewingAgentTaskId), expandedView = useAppState((s_3) => s_3.expandedView), showSpinnerTree = expandedView === "teammates", prStatus = usePrStatus(isLoading, isPrStatusEnabled()), hasTmuxSession = useAppState((s_4) => !1), nextTickAt = (0, import_react268.useSyncExternalStore)(proactiveModule3?.subscribeToProactiveChanges ?? NO_OP_SUBSCRIBE, proactiveModule3?.getNextTickAt ?? NULL, NULL), voiceEnabled = !1, voiceState = "idle", voiceWarmingUp = !1, hasSelection2 = useHasSelection(), selGetState = useSelection().getState, hasNextTick = nextTickAt !== null, isCoordinator = !1, runningTaskCount = (0, import_react268.useMemo)(() => count(Object.values(tasks3), (t2) => isBackgroundTask(t2) && !0), [tasks3]), tasksV2 = useTasksV2(), hasTaskItems = tasksV2 !== void 0 && tasksV2.length > 0, escShortcut = useShortcutDisplay("chat:cancel", "Chat", "esc").toLowerCase(), todosShortcut = useShortcutDisplay("app:toggleTodos", "Global", "ctrl+t"), killAgentsShortcut = useShortcutDisplay("chat:killAgents", "Chat", "ctrl+x ctrl+k"), voiceKeyShortcut = "", [voiceHintUnderCap] = [!1], voiceHintIncrementedRef = null;
515822
+ ), store = useAppStateStore(), [remoteSessionUrl] = (0, import_react268.useState)(() => store.getState().remoteSessionUrl), viewSelectionMode = useAppState((s_1) => s_1.viewSelectionMode), viewingAgentTaskId = useAppState((s_2) => s_2.viewingAgentTaskId), expandedView = useAppState((s_3) => s_3.expandedView), showSpinnerTree = expandedView === "teammates", prStatus = usePrStatus(isLoading, isPrStatusEnabled()), hasTmuxSession = useAppState((s_4) => !1), nextTickAt = (0, import_react268.useSyncExternalStore)(proactiveModule3?.subscribeToProactiveChanges ?? NO_OP_SUBSCRIBE, proactiveModule3?.getNextTickAt ?? NULL, NULL), voiceEnabled = !1, voiceState = "idle", voiceWarmingUp = !1, hasSelection2 = useHasSelection(), selGetState = useSelection().getState, hasNextTick = nextTickAt !== null, isCoordinator = !1, runningTaskCount = (0, import_react268.useMemo)(() => count(Object.values(tasks3), (t2) => isRunningBackgroundTask(t2) && !0), [tasks3]), tasksV2 = useTasksV2(), hasTaskItems = tasksV2 !== void 0 && tasksV2.length > 0, escShortcut = useShortcutDisplay("chat:cancel", "Chat", "esc").toLowerCase(), todosShortcut = useShortcutDisplay("app:toggleTodos", "Global", "ctrl+t"), killAgentsShortcut = useShortcutDisplay("chat:killAgents", "Chat", "ctrl+x ctrl+k"), voiceKeyShortcut = "", [voiceHintUnderCap] = [!1], voiceHintIncrementedRef = null;
514853
515823
  (0, import_react268.useEffect)(() => {
514854
515824
  }, [voiceEnabled, voiceHintUnderCap]);
514855
515825
  let isKillAgentsConfirmShowing = useAppState((s_7) => s_7.notifications.current?.key === "kill-agents-confirm"), footerNavControl = globalThis.__semaFleetFooterNav, getFooterNavSnap = () => footerNavControl?.isActive?.() ? `1:${footerNavControl?.getHintsText?.() ?? ""}` : "0", footerNavSnap = (0, import_react268.useSyncExternalStore)(footerNavControl?.subscribe ?? NO_OP_SUBSCRIBE, getFooterNavSnap, getFooterNavSnap), footerNavActive = footerNavSnap !== "0", workflowsSelected = useAppState((s_wf) => s_wf.footerSelection === "workflows"), hasTeams = isAgentSwarmsEnabled() && !isInProcessEnabled() && teamContext !== void 0 && count(Object.values(teamContext.teammates), (t_0) => t_0.name !== "team-lead") > 0;
@@ -514952,7 +515922,7 @@ var import_compiler_runtime290, import_react268, import_jsx_runtime450, proactiv
514952
515922
  init_useShortcutDisplay();
514953
515923
  init_PermissionMode();
514954
515924
  init_BackgroundTaskStatus();
514955
- init_types24();
515925
+ init_runningBackgroundTasks();
514956
515926
  init_LocalAgentTask();
514957
515927
  init_chrome_agentprogress();
514958
515928
  init_array3();
@@ -515876,7 +516846,7 @@ function PromptInput({
515876
516846
  ...prev,
515877
516847
  workflowFooterIndex: next
515878
516848
  };
515879
- }), [setAppState]), minCoordinatorIndex = (0, import_react274.useMemo)(() => Object.values(tasks3).some((t2) => isBackgroundTask(t2) && t2.type !== "local_workflow"), [tasks3]) ? -1 : 0;
516849
+ }), [setAppState]), minCoordinatorIndex = (0, import_react274.useMemo)(() => Object.values(tasks3).some((t2) => isRunningBackgroundTask(t2) && t2.type !== "local_workflow"), [tasks3]) ? -1 : 0;
515880
516850
  (0, import_react274.useEffect)(() => {
515881
516851
  coordinatorTaskIndex >= coordinatorTaskCount ? setCoordinatorTaskIndex(Math.max(minCoordinatorIndex, coordinatorTaskCount - 1)) : coordinatorTaskIndex < minCoordinatorIndex && setCoordinatorTaskIndex(minCoordinatorIndex);
515882
516852
  }, [coordinatorTaskCount, coordinatorTaskIndex, minCoordinatorIndex]), (0, import_react274.useEffect)(() => {
@@ -517082,7 +518052,7 @@ var React168, import_react274, import_jsx_runtime459, PROMPT_FOOTER_LINES, MIN_I
517082
518052
  init_selectors();
517083
518053
  init_teammateViewHelpers();
517084
518054
  init_InProcessTeammateTask();
517085
- init_types24();
518055
+ init_runningBackgroundTasks();
517086
518056
  init_agentColorManager();
517087
518057
  init_agentSwarmsEnabled();
517088
518058
  init_array3();
@@ -523243,7 +524213,7 @@ function isPlanReviewQuestionId(questionId) {
523243
524213
  return typeof questionId == "string" && questionId.startsWith(PLAN_REVIEW_QUESTION_ID_PREFIX);
523244
524214
  }
523245
524215
  function shouldExitPlanModeForAnswer(questionId, answer) {
523246
- return isPlanReviewQuestionId(questionId) ? planReviewDecisionFromAnswer(answer) === "approve" : !1;
524216
+ return isPlanReviewQuestionId(questionId) ? planReviewDecisionFromAnswer(answer, planReviewShownLabels(questionId)) === "approve" : !1;
523247
524217
  }
523248
524218
  function reevaluateRestoreMode(ctx) {
523249
524219
  let wanted = ctx.prePlanMode ?? "default";
@@ -523256,10 +524226,10 @@ function reevaluateRestoreMode(ctx) {
523256
524226
  ), "default";
523257
524227
  }
523258
524228
  }
523259
- function applyPlanModeExit(prev) {
524229
+ function applyPlanModeExit(prev, chosenModeAfter) {
523260
524230
  let ctx = prev.toolPermissionContext;
523261
524231
  if (ctx.mode !== "plan") return prev;
523262
- let restoreMode = reevaluateRestoreMode(ctx), nextCtx;
524232
+ let restoreMode = chosenModeAfter ?? reevaluateRestoreMode(ctx), nextCtx;
523263
524233
  try {
523264
524234
  nextCtx = transitionPermissionMode("plan", restoreMode, ctx);
523265
524235
  } catch (e) {
@@ -523272,7 +524242,9 @@ function applyPlanModeExit(prev) {
523272
524242
  }
523273
524243
  function exitPlanModeIfApproved(questionId, answer, setAppState) {
523274
524244
  try {
523275
- return shouldExitPlanModeForAnswer(questionId, answer) ? (setAppState(applyPlanModeExit), !0) : !1;
524245
+ if (!shouldExitPlanModeForAnswer(questionId, answer)) return !1;
524246
+ let choice = planReviewChoiceFromAnswer(answer, planReviewShownLabels(questionId)), modeAfter = choice !== "dismissed" && choice.decision === "approve" ? choice.permissionModeAfter : void 0;
524247
+ return setAppState((prevState) => applyPlanModeExit(prevState, modeAfter)), !0;
523276
524248
  } catch (e) {
523277
524249
  return process.env.SEMA_DEBUG && console.error(`[sema][planReviewModeExit] exit failed for ${String(questionId)}: ${String(e)}`), !1;
523278
524250
  }
@@ -523280,6 +524252,7 @@ function exitPlanModeIfApproved(questionId, answer, setAppState) {
523280
524252
  var init_planReviewModeExit = __esm({
523281
524253
  "build-src/src/sema/planReviewModeExit.ts"() {
523282
524254
  init_dist();
524255
+ init_planReviewModeAfterOffer();
523283
524256
  init_permissionSetup();
523284
524257
  }
523285
524258
  });
@@ -523339,7 +524312,7 @@ async function runQuestionPermissionRequestHooks(frame, getHookToolUseContext) {
523339
524312
  function buildQuestionToolUseConfirm(frame, getHookToolUseContext, setAppState) {
523340
524313
  let questionId = frame.questionId, questions = frame.questions ?? [], answerAndRelease = (answer) => {
523341
524314
  journalGateResolved(questionId), respondToQuestion(questionId, answer).then(() => {
523342
- notePlanReviewAnsweredIfDecisive(questionId, answer), setAppState && exitPlanModeIfApproved(questionId, answer, setAppState);
524315
+ logForDebugging(`[sema][questionOverlay] answered card ${questionId} (interactive)`), notePlanReviewAnsweredIfDecisive(questionId, answer), setAppState && exitPlanModeIfApproved(questionId, answer, setAppState);
523343
524316
  }).catch(() => {
523344
524317
  });
523345
524318
  }, parkReopenNote = frame._sema_parkReopenNote;
@@ -523390,7 +524363,7 @@ function useLiveQuestionOverlay({
523390
524363
  if (decision?.behavior === "allow") {
523391
524364
  let updated = decision.updatedInput, wireAnswer = questionAnswersToWire(frame.questions ?? [], updated?.answers, updated?.annotations);
523392
524365
  respondToQuestion(frame.questionId, wireAnswer).then(() => {
523393
- notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer), setAppState && exitPlanModeIfApproved(frame.questionId, wireAnswer, setAppState);
524366
+ logForDebugging(`[sema][questionOverlay] answered card ${frame.questionId} (hook auto-answer)`), notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer), setAppState && exitPlanModeIfApproved(frame.questionId, wireAnswer, setAppState);
523394
524367
  }).catch(() => {
523395
524368
  });
523396
524369
  return;
@@ -523428,6 +524401,7 @@ var import_react301, init_useLiveQuestionOverlay = __esm({
523428
524401
  init_dist();
523429
524402
  init_armedGateRegistry2();
523430
524403
  init_turnGateJournal();
524404
+ init_debug();
523431
524405
  init_planReviewModeExit();
523432
524406
  init_resumePendingReconcile();
523433
524407
  }
@@ -526935,17 +527909,17 @@ function extractLspInfoFromManifest(lspServers) {
526935
527909
  }
526936
527910
  return extractFromServerConfigRecord(lspServers);
526937
527911
  }
526938
- function isRecord3(value) {
527912
+ function isRecord5(value) {
526939
527913
  return typeof value == "object" && value !== null;
526940
527914
  }
526941
527915
  function extractFromServerConfigRecord(serverConfigs) {
526942
527916
  let extensions = /* @__PURE__ */ new Set(), command8 = null;
526943
527917
  for (let [_serverName, config4] of Object.entries(serverConfigs)) {
526944
- if (!isRecord3(config4))
527918
+ if (!isRecord5(config4))
526945
527919
  continue;
526946
527920
  !command8 && typeof config4.command == "string" && (command8 = config4.command);
526947
527921
  let extMapping = config4.extensionToLanguage;
526948
- if (isRecord3(extMapping))
527922
+ if (isRecord5(extMapping))
526949
527923
  for (let ext of Object.keys(extMapping))
526950
527924
  extensions.add(ext.toLowerCase());
526951
527925
  }
@@ -527577,7 +528551,7 @@ function usePluginInstallationStatus() {
527577
528551
  /* @__PURE__ */ (0, import_jsx_runtime483.jsxs)(ThemedText, { color: "error", children: [
527578
528552
  totalFailed,
527579
528553
  " ",
527580
- plural(totalFailed, "plugin"),
528554
+ plural2(totalFailed, "plugin"),
527581
528555
  " failed to install"
527582
528556
  ] }),
527583
528557
  /* @__PURE__ */ (0, import_jsx_runtime483.jsx)(ThemedText, { dimColor: !0, children: " \xB7 /plugin for details" })
@@ -533557,7 +534531,7 @@ function handlePluginCommandError(error51, command8, plugin2) {
533557
534531
  ...telemetryFields
533558
534532
  }, process.exit(1));
533559
534533
  }
533560
- async function installPlugin(plugin2, scope = "user") {
534534
+ async function installPlugin(plugin2, scope = "user", afterSuccess) {
533561
534535
  try {
533562
534536
  console.log(`Installing plugin "${plugin2}"...`);
533563
534537
  let result = await installPluginOp(plugin2, scope);
@@ -533573,7 +534547,7 @@ async function installPlugin(plugin2, scope = "user") {
533573
534547
  },
533574
534548
  scope: result.scope,
533575
534549
  ...buildPluginTelemetryFields(name, marketplace, getManagedPluginNames())
533576
- }, process.exit(0));
534550
+ }, afterSuccess !== void 0 && await afterSuccess(result.pluginId || plugin2)), process.exit(0);
533577
534551
  } catch (error51) {
533578
534552
  handlePluginCommandError(error51, "install", plugin2);
533579
534553
  }
@@ -536208,6 +537182,7 @@ var init_readFacePosture2 = __esm({
536208
537182
  var doctorEngineCapsProbe_exports = {};
536209
537183
  __export(doctorEngineCapsProbe_exports, {
536210
537184
  doctorProbedCaps: () => doctorProbedCaps,
537185
+ doctorProbedExecutionLaneReading: () => doctorProbedExecutionLaneReading,
536211
537186
  doctorProbedReadFace: () => doctorProbedReadFace,
536212
537187
  doctorProbedSqlEngineReading: () => doctorProbedSqlEngineReading,
536213
537188
  doctorProbedWebSearchBackendReading: () => doctorProbedWebSearchBackendReading,
@@ -536230,6 +537205,7 @@ async function ensureDoctorEngineCaps(deps2) {
536230
537205
  reading: null,
536231
537206
  writeProtection: null,
536232
537207
  webSearchBackend: null,
537208
+ executionLane: null,
536233
537209
  readFace: void 0,
536234
537210
  wiringReachable: !1
536235
537211
  };
@@ -536244,9 +537220,9 @@ async function runProbe(probe3) {
536244
537220
  }
536245
537221
  let anchorLane = out6 !== null && out6.lane === "anchor", wiringReachable = anchorLane && out6?.wiringReachable === !0, readFace = anchorLane ? await projectReadFace(out6?.wiring, wiringReachable) : void 0;
536246
537222
  if (out6 === null || out6.caps === null || typeof out6.caps != "object")
536247
- return { caps: out6?.caps, reading: null, writeProtection: null, webSearchBackend: null, readFace, wiringReachable };
537223
+ return { caps: out6?.caps, reading: null, writeProtection: null, webSearchBackend: null, executionLane: null, readFace, wiringReachable };
536248
537224
  if (out6.lane !== "anchor")
536249
- return { caps: out6.caps, reading: null, writeProtection: null, webSearchBackend: null, readFace, wiringReachable };
537225
+ return { caps: out6.caps, reading: null, writeProtection: null, webSearchBackend: null, executionLane: null, readFace, wiringReachable };
536250
537226
  let reading = null, writeProtection = null;
536251
537227
  try {
536252
537228
  let { projectSqlEngineCapability: projectSqlEngineCapability2 } = await Promise.resolve().then(() => (init_sqlEngineCapability2(), sqlEngineCapability_exports));
@@ -536267,7 +537243,14 @@ async function runProbe(probe3) {
536267
537243
  } catch {
536268
537244
  webSearchBackend = null;
536269
537245
  }
536270
- return { caps: out6.caps, reading, writeProtection, webSearchBackend, readFace, wiringReachable };
537246
+ let executionLane = null;
537247
+ try {
537248
+ let { projectExecutionLaneCapability: projectExecutionLaneCapability2 } = await Promise.resolve().then(() => (init_executionLaneCapability2(), executionLaneCapability_exports));
537249
+ executionLane = projectExecutionLaneCapability2(out6.caps) ?? null;
537250
+ } catch {
537251
+ executionLane = null;
537252
+ }
537253
+ return { caps: out6.caps, reading, writeProtection, webSearchBackend, executionLane, readFace, wiringReachable };
536271
537254
  }
536272
537255
  async function projectReadFace(wiring, reachable) {
536273
537256
  if (reachable)
@@ -536315,6 +537298,9 @@ function doctorProbedWriteProtectionReading() {
536315
537298
  function doctorProbedWebSearchBackendReading() {
536316
537299
  return settled?.webSearchBackend ?? null;
536317
537300
  }
537301
+ function doctorProbedExecutionLaneReading() {
537302
+ return settled?.executionLane ?? null;
537303
+ }
536318
537304
  function doctorProbedReadFace() {
536319
537305
  return settled?.readFace;
536320
537306
  }
@@ -536630,7 +537616,21 @@ async function collectAxesRows(opts, deps2) {
536630
537616
  rows3.push({ label: "Store", status: "warn", detail: "reading unavailable" });
536631
537617
  }
536632
537618
  try {
536633
- rows3.push({ label: "Exec", status: "info", detail: engineTarget.execAxisReading() });
537619
+ let laneSeg = "";
537620
+ try {
537621
+ let { executionLaneDoctorDetail: executionLaneDoctorDetail2, observedExecutionLane: observedExecutionLane2 } = await Promise.resolve().then(() => (init_executionLaneCapability2(), executionLaneCapability_exports)), { doctorProbedExecutionLaneReading: doctorProbedExecutionLaneReading2, ensureDoctorEngineCaps: ensureDoctorEngineCaps2 } = await Promise.resolve().then(() => (init_doctorEngineCapsProbe(), doctorEngineCapsProbe_exports));
537622
+ await ensureDoctorEngineCaps2(), laneSeg = executionLaneDoctorDetail2(
537623
+ doctorProbedExecutionLaneReading2() ?? observedExecutionLane2()
537624
+ );
537625
+ } catch {
537626
+ laneSeg = "";
537627
+ }
537628
+ let execDetail = engineTarget.execAxisReading();
537629
+ rows3.push({
537630
+ label: "Exec",
537631
+ status: "info",
537632
+ detail: laneSeg === "" ? execDetail : `${execDetail} \xB7 ${laneSeg}`
537633
+ });
536634
537634
  } catch {
536635
537635
  rows3.push({ label: "Exec", status: "warn", detail: "reading unavailable" });
536636
537636
  }
@@ -540771,7 +541771,7 @@ __export(cmd_import_exports, {
540771
541771
  default: () => cmd_import_default,
540772
541772
  runImportNonInteractive: () => runImportNonInteractive
540773
541773
  });
540774
- function plural6(n2, word) {
541774
+ function plural7(n2, word) {
540775
541775
  return n2 === 1 ? word : `${word}s`;
540776
541776
  }
540777
541777
  function allItems(scans) {
@@ -540782,13 +541782,13 @@ function allUnmappable(scans) {
540782
541782
  }
540783
541783
  function formatPreview(scans, from, digest, warnings) {
540784
541784
  let items = allItems(scans), unmappable = allUnmappable(scans), sourceNames = scans.map((s) => s.displayName).join(" and "), lines = [
540785
- `Found ${items.length} importable ${plural6(items.length, "item")} from ${sourceNames} (scan digest: ${digest}).`,
541785
+ `Found ${items.length} importable ${plural7(items.length, "item")} from ${sourceNames} (scan digest: ${digest}).`,
540786
541786
  ...warnings
540787
541787
  ];
540788
541788
  for (let item of items)
540789
541789
  lines.push(` [${item.source}] ${item.label} (${item.kind})`);
540790
541790
  if (unmappable.length > 0) {
540791
- lines.push("", `${unmappable.length} ${plural6(unmappable.length, "item")} could not be mapped automatically:`);
541791
+ lines.push("", `${unmappable.length} ${plural7(unmappable.length, "item")} could not be mapped automatically:`);
540792
541792
  for (let u of unmappable)
540793
541793
  lines.push(` \u26A0 [${u.source}] ${u.label}: ${u.reason}`);
540794
541794
  }
@@ -540808,8 +541808,8 @@ async function applyScans(scans, dryRun, warnings) {
540808
541808
  } catch (e) {
540809
541809
  resultLines.push(` \u2717 ${item.label}: ${e instanceof Error ? e.message : String(e)}`);
540810
541810
  }
540811
- let header = dryRun ? `Dry run \u2014 would import ${imported} ${plural6(imported, "item")}:` : `Imported ${imported} ${plural6(imported, "item")}:`, footer = [...warnings];
540812
- return unmappable.length > 0 && footer.push("", `${unmappable.length} ${plural6(unmappable.length, "item")} could not be mapped automatically \u2014 re-run \`/import\` to review.`), [header, ...resultLines, ...footer].join(`
541811
+ let header = dryRun ? `Dry run \u2014 would import ${imported} ${plural7(imported, "item")}:` : `Imported ${imported} ${plural7(imported, "item")}:`, footer = [...warnings];
541812
+ return unmappable.length > 0 && footer.push("", `${unmappable.length} ${plural7(unmappable.length, "item")} could not be mapped automatically \u2014 re-run \`/import\` to review.`), [header, ...resultLines, ...footer].join(`
540813
541813
  `);
540814
541814
  }
540815
541815
  async function handleImport(argsRaw) {
@@ -542252,12 +543252,12 @@ async function* ask(params) {
542252
543252
  continue;
542253
543253
  }
542254
543254
  if (t2 === "workflow_complete") {
542255
- let m2 = msg;
542256
- if (typeof m2.runId == "string" && !notifiedOnce(`${m2.runId}:${m2.status === "failed" ? "failed" : "completed"}`)) {
543255
+ let m2 = msg, wfStatus = typeof m2.status == "string" && m2.status.trim().length > 0 ? m2.status : "unknown";
543256
+ if (typeof m2.runId == "string" && !notifiedOnce(`${m2.runId}:${wfStatus}`)) {
542257
543257
  let frame = taskNotificationToPrintFrame(
542258
543258
  {
542259
543259
  task_id: m2.runId,
542260
- status: m2.status === "failed" ? "failed" : "completed",
543260
+ status: wfStatus,
542261
543261
  ...typeof m2.summary == "string" && m2.summary.length > 0 ? { summary: m2.summary } : {}
542262
543262
  },
542263
543263
  { uuid: m2.uuid, session_id: m2.session_id }
@@ -543710,7 +544710,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
543710
544710
  output.enqueue(event);
543711
544711
  let currentState2 = getAppState();
543712
544712
  getRunningTasks(currentState2).some(
543713
- (t2) => (t2.type === "local_agent" || t2.type === "local_workflow") && isBackgroundTask(t2)
544713
+ (t2) => (t2.type === "local_agent" || t2.type === "local_workflow") && isRunningBackgroundTask(t2)
543714
544714
  ) ? heldBackResult = message : (heldBackResult = null, output.enqueue(message));
543715
544715
  } else {
543716
544716
  for (let event of drainSdkEvents())
@@ -543797,7 +544797,8 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
543797
544797
  runPhase = "draining_commands", await drainCommandQueue(), waitingForAgents = !1;
543798
544798
  {
543799
544799
  let state5 = getAppState(), hasRunningBg = getRunningTasks(state5).some(
543800
- (t2) => isBackgroundTask(t2) && t2.type !== "in_process_teammate"
544800
+ // 🔴 同上:引擎不再报的行不算「还有后台活要等」,否则 headless 会在这里死等。
544801
+ (t2) => isRunningBackgroundTask(t2) && t2.type !== "in_process_teammate"
543801
544802
  ), hasDeliverableEngineWork = outstandingDeliverableWorkflowCount() > 0, hasMainThreadQueued = peek(isMainThread) !== void 0;
543802
544803
  (hasRunningBg || hasMainThreadQueued || hasDeliverableEngineWork) && (waitingForAgents = !0, hasMainThreadQueued || (runPhase = "waiting_for_agents", await sleep2(100)));
543803
544804
  }
@@ -545480,6 +546481,7 @@ var extractMemoriesModule2, taskSummaryModule2, SHUTDOWN_TEAM_PROMPT, MAX_RECEIV
545480
546481
  init_tasks();
545481
546482
  init_framework();
545482
546483
  init_types24();
546484
+ init_runningBackgroundTasks();
545483
546485
  init_stopTask();
545484
546486
  init_sdkEventQueue();
545485
546487
  init_growthbook_advisor_flag();
@@ -545628,7 +546630,7 @@ function MCPServerDesktopImportDialog(t0) {
545628
546630
  }, [theme2] = useTheme(), t6;
545629
546631
  $3[8] !== onDone || $3[9] !== scope || $3[10] !== theme2 ? (t6 = (importedCount_0) => {
545630
546632
  importedCount_0 > 0 ? writeToStdout(`
545631
- ${color("success", theme2)(`Successfully imported ${importedCount_0} MCP ${plural(importedCount_0, "server")} to ${scope} config.`)}
546633
+ ${color("success", theme2)(`Successfully imported ${importedCount_0} MCP ${plural2(importedCount_0, "server")} to ${scope} config.`)}
545632
546634
  `) : writeToStdout(`
545633
546635
  No servers were imported.`), onDone(), gracefulShutdown();
545634
546636
  }, $3[8] = onDone, $3[9] = scope, $3[10] = theme2, $3[11] = t6) : t6 = $3[11];
@@ -545637,7 +546639,7 @@ No servers were imported.`), onDone(), gracefulShutdown();
545637
546639
  done(0);
545638
546640
  }, $3[12] = done, $3[13] = t7) : t7 = $3[13];
545639
546641
  let handleEscCancel = t7, t8 = serverNames.length, t9;
545640
- $3[14] !== serverNames.length ? (t9 = plural(serverNames.length, "server"), $3[14] = serverNames.length, $3[15] = t9) : t9 = $3[15];
546642
+ $3[14] !== serverNames.length ? (t9 = plural2(serverNames.length, "server"), $3[14] = serverNames.length, $3[15] = t9) : t9 = $3[15];
545641
546643
  let t10 = `Found ${t8} MCP ${t9} in Claude Desktop.`, t11;
545642
546644
  $3[16] !== collisions.length ? (t11 = collisions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime504.jsx)(ThemedText, { color: "warning", children: "Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix." }), $3[16] = collisions.length, $3[17] = t11) : t11 = $3[17];
545643
546645
  let t12;
@@ -546542,7 +547544,9 @@ async function mcpListHandler() {
546542
547544
  errors: configErrors
546543
547545
  } = await getAllMcpConfigs();
546544
547546
  if (Object.keys(configs).length === 0)
546545
- console.log("No MCP servers configured. Use `sema mcp add` to add a server.");
547547
+ configErrors.length > 0 ? console.log(
547548
+ `No MCP servers could be started. ${String(configErrors.length)} configured ${configErrors.length === 1 ? "server was" : "servers were"} skipped because ${configErrors.length === 1 ? "its" : "their"} configuration could not be resolved \u2014 see below.`
547549
+ ) : console.log("No MCP servers configured. Use `sema mcp add` to add a server.");
546546
547550
  else {
546547
547551
  console.log(`Checking MCP server health...
546548
547552
  `);
@@ -550238,12 +551242,12 @@ function handleMarketplaceError(error51, action) {
550238
551242
  }
550239
551243
  function printValidationResult(result) {
550240
551244
  result.errors.length > 0 && (console.log(
550241
- `${figures_default.cross} Found ${result.errors.length} ${plural(result.errors.length, "error")}:
551245
+ `${figures_default.cross} Found ${result.errors.length} ${plural2(result.errors.length, "error")}:
550242
551246
  `
550243
551247
  ), result.errors.forEach((error51) => {
550244
551248
  console.log(` ${figures_default.pointer} ${error51.path}: ${error51.message}`);
550245
551249
  }), console.log("")), result.warnings.length > 0 && (console.log(
550246
- `${figures_default.warning} Found ${result.warnings.length} ${plural(result.warnings.length, "warning")}:
551250
+ `${figures_default.warning} Found ${result.warnings.length} ${plural2(result.warnings.length, "warning")}:
550247
551251
  `
550248
551252
  ), result.warnings.forEach((warning) => {
550249
551253
  console.log(` ${figures_default.pointer} ${warning.path}: ${warning.message}`);
@@ -550510,7 +551514,11 @@ async function pluginInstallHandler(plugin2, options) {
550510
551514
  ...marketplace && {
550511
551515
  _PROTO_marketplace_name: marketplace
550512
551516
  }
550513
- }, await installPlugin(plugin2, scope)), await applyPluginConfigAfterInstall(plugin2, options);
551517
+ }, await installPlugin(
551518
+ plugin2,
551519
+ scope,
551520
+ (installedPluginId) => applyPluginConfigAfterInstall(installedPluginId, options)
551521
+ ));
550514
551522
  }
550515
551523
  function resolveConfigurablePlugin(pluginRef, loaded) {
550516
551524
  if (pluginRef.includes("@")) {
@@ -553443,7 +554451,7 @@ async function checkUnreachableRules(getToolPermissionContext) {
553443
554451
  return {
553444
554452
  type: "unreachable_rules",
553445
554453
  severity: "warning",
553446
- message: `${unreachable2.length} ${plural(unreachable2.length, "unreachable permission rule")} detected`,
554454
+ message: `${unreachable2.length} ${plural2(unreachable2.length, "unreachable permission rule")} detected`,
553447
554455
  details,
553448
554456
  currentValue: unreachable2.length,
553449
554457
  threshold: 0
@@ -559568,7 +560576,7 @@ ${formattedErrors}
559568
560576
  allowed,
559569
560577
  blocked
559570
560578
  } = filterMcpServersByPolicy(scopedConfigs);
559571
- blocked.length > 0 && process.stderr.write(`Warning: MCP ${plural(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
560579
+ blocked.length > 0 && process.stderr.write(`Warning: MCP ${plural2(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
559572
560580
  `), dynamicMcpConfig = {
559573
560581
  ...dynamicMcpConfig,
559574
560582
  ...allowed
@@ -559658,7 +560666,7 @@ ${hint}` : hint;
559658
560666
  allowed,
559659
560667
  blocked
559660
560668
  } = filterMcpServersByPolicy(configs);
559661
- return blocked.length > 0 && process.stderr.write(`Warning: claude.ai MCP ${plural(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
560669
+ return blocked.length > 0 && process.stderr.write(`Warning: claude.ai MCP ${plural2(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
559662
560670
  `), allowed;
559663
560671
  }) : Promise.resolve({});
559664
560672
  logForDebugging("[STARTUP] Loading MCP configs...");
@@ -560065,7 +561073,7 @@ ${customInstructions}` : customInstructions;
560065
561073
  let displayList = uniq(overlyBroadBashPermissions.map((p) => p.ruleDisplay)), displays = displayList.join(", "), sources = uniq(overlyBroadBashPermissions.map((p) => p.sourceDisplay)).join(", "), n2 = displayList.length;
560066
561074
  initialNotifications.push({
560067
561075
  key: "overly-broad-bash-notification",
560068
- text: `${displays} allow ${plural(n2, "rule")} from ${sources} ${plural(n2, "was", "were")} ignored \u2014 not available for Ants, please use auto-mode instead`,
561076
+ text: `${displays} allow ${plural2(n2, "rule")} from ${sources} ${plural2(n2, "was", "were")} ignored \u2014 not available for Ants, please use auto-mode instead`,
560069
561077
  color: "warning",
560070
561078
  priority: "high"
560071
561079
  });
@@ -560438,7 +561446,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
560438
561446
  pendingHookMessages
560439
561447
  }, renderAndRun);
560440
561448
  }
560441
- }).version("sema 1.0.120", "-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 () => {
561449
+ }).version("sema 1.0.121", "-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 () => {
560442
561450
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
560443
561451
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
560444
561452
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -564087,10 +565095,10 @@ function ScrollSpeedPanel({
564087
565095
  resetToAutoOnSave && cfg.base, cfg.base, cfg.xtermJs, cfg.wheelFlood, cfg.wtSession, cfg.useDecayCurve, sawWheel.current, sawTrackpad.current, editorSensitivity?.sensitivity;
564088
565096
  let where = settingsFileDisplay();
564089
565097
  onDone(
564090
- resetToAutoOnSave ? `Scroll speed reset to auto (${cfg.base} ${plural(
565098
+ resetToAutoOnSave ? `Scroll speed reset to auto (${cfg.base} ${plural2(
564091
565099
  cfg.base,
564092
565100
  "line"
564093
- )} per notch) \xB7 removed from ${where}` : `Scroll speed set to ${speed} ${plural(
565101
+ )} per notch) \xB7 removed from ${where}` : `Scroll speed set to ${speed} ${plural2(
564094
565102
  speed,
564095
565103
  "line"
564096
565104
  )} per notch \xB7 saved to ${where}`
@@ -564107,7 +565115,7 @@ function ScrollSpeedPanel({
564107
565115
  " ",
564108
565116
  speed,
564109
565117
  " ",
564110
- plural(speed, "line"),
565118
+ plural2(speed, "line"),
564111
565119
  " per wheel notch"
564112
565120
  ] }),
564113
565121
  showingAuto && /* @__PURE__ */ (0, import_jsx_runtime537.jsx)(ThemedText, { dimColor: !0, children: " (auto)" }),