@sema-agent/cli 1.0.79 → 1.0.81

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.
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sema-agent/cli",
9
- "version": "1.0.79",
9
+ "version": "1.0.81",
10
10
  "license": "BUSL-1.1",
11
11
  "dependencies": {
12
12
  "@sema-agent/sdk": "7.1.0",
13
- "@sema-agent/server": "7.24.0"
13
+ "@sema-agent/server": "7.26.0"
14
14
  },
15
15
  "bin": {
16
16
  "sema": "sema.js"
@@ -669,12 +669,12 @@
669
669
  }
670
670
  },
671
671
  "node_modules/@sema-agent/server": {
672
- "version": "7.24.0",
673
- "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-7.24.0.tgz",
674
- "integrity": "sha512-Tf++kCfoVnlAj8/MR6GQNgU94V+YevrAUGgUgJalOEjJWm/fsq52gmEyOjFOZrCTapPEtIngxNITzqTMr5rcdw==",
672
+ "version": "7.26.0",
673
+ "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-7.26.0.tgz",
674
+ "integrity": "sha512-+uNL1EWuXqDsyEOzs9P+2AZ0oKWFgbbkMsqrDlwKQDsPHIieTneXaXamjmVwfU/FvZs9VSUFsuhgPOwYqtSNTQ==",
675
675
  "license": "BUSL-1.1",
676
676
  "dependencies": {
677
- "@sema-agent/core": "^5.35.0",
677
+ "@sema-agent/core": "^5.36.0",
678
678
  "@sema-agent/registry-core": "^0.16.0",
679
679
  "e2b": "^2.28.0",
680
680
  "libsodium-wrappers": "^0.8.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "description": "Sema — your own Claude Code-grade coding agent, in the terminal.",
5
5
  "license": "BUSL-1.1",
6
6
  "bin": {
@@ -23,13 +23,13 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@sema-agent/sdk": "7.1.0",
26
- "@sema-agent/server": "7.24.0"
26
+ "@sema-agent/server": "7.26.0"
27
27
  },
28
28
  "overrides": {
29
29
  "@sema-agent/core": "5.36.0",
30
30
  "@sema-agent/registry-core": "0.16.0"
31
31
  },
32
- "semaEngineVersion": "server 7.24.0 / core 5.36.0 / registry-core 0.16.0",
32
+ "semaEngineVersion": "server 7.26.0 / core 5.36.0 / registry-core 0.16.0",
33
33
  "engines": {
34
34
  "node": ">=20.3"
35
35
  }
package/sema-main.js CHANGED
@@ -56646,6 +56646,9 @@ function recordBgTerminalFacts(taskId, facts2) {
56646
56646
  bgFacts.delete(taskId), bgFacts.set(taskId, facts2), scheduleNotify(taskId);
56647
56647
  }
56648
56648
  }
56649
+ function clearBgTerminalFacts(taskId) {
56650
+ bgFacts.delete(taskId);
56651
+ }
56649
56652
  function getBgTerminalFacts(taskId) {
56650
56653
  let key = bgFacts.has(taskId) ? taskId : taskToParent.get(taskId) ?? "";
56651
56654
  return touchLru(bgFacts, key), bgFacts.get(key);
@@ -61298,25 +61301,28 @@ function fleetSnapshotOptions(opts) {
61298
61301
  function createFleetLedger(hooks2 = {}, opts = {}) {
61299
61302
  let sessionKey = opts.sessionKey ?? DEFAULT_SESSION_KEY, nowFn = opts.nowFn ?? Date.now, taskMap = /* @__PURE__ */ new Map(), wfMap = /* @__PURE__ */ new Map(), rowMeta = /* @__PURE__ */ new Map(), retained = /* @__PURE__ */ new Map(), droppedMalformed = 0, droppedUnknownFrame = 0, droppedForeignBgNotification = 0, connected = !1, version4 = null, scoped = null, sessionScopedMeta, bgNotifyFailClosedMeta = !1, disposed4 = !1, debug4 = (line) => {
61300
61303
  engineWireDebugEnabled() && hostLog("debug", line);
61304
+ }, toBgTask = (r, retired) => {
61305
+ let parentId = wireParentId(r);
61306
+ return {
61307
+ id: r.id,
61308
+ // REF-CC-046(fleet2-08,含 TYPESHAPE-06):与 parentId 同款条件展开 —— `name` 是三态位
61309
+ // (server ≥3.5.1 起真的会缺席),无条件落键会让「键在不在」判三态在序列化边界翻面。
61310
+ ...typeof r.name == "string" && r.name.length > 0 ? { name: r.name } : {},
61311
+ // REF-CC-052(fleet2-14):`status` 是 SDK 必填闭集,但脏值/缺席仍可能到达 wire —— 不知道
61312
+ // 就说不知道,`'unknown'` 是自描述哨兵,绝不编造一个具体的、看似活跃的 `'running'`。
61313
+ status: r.status ?? "unknown",
61314
+ // REF-CC-049(fleet2-11):经 wireParentId 单一铸点(悬空父脏值空串按缺席处理)。eopt:
61315
+ // 局部变量先取一次(两次裸调用之间 TS 不共享窄化,双调用会重新变宽成 string|undefined)。
61316
+ ...parentId !== void 0 ? { parentId } : {},
61317
+ ...retired ? { retiredByNotification: !0 } : {}
61318
+ };
61301
61319
  }, bgView = {
61302
- read: () => ({
61303
- connected,
61304
- rows: [...taskMap.values()].filter((r) => !TERMINAL_FLEET_TASK_STATUSES.has(r.status ?? "")).map((r) => {
61305
- let parentId = wireParentId(r);
61306
- return {
61307
- id: r.id,
61308
- // REF-CC-046(fleet2-08,含 TYPESHAPE-06):与 parentId 同款条件展开 —— `name` 是三态位
61309
- // (server ≥3.5.1 起真的会缺席),无条件落键会让「键在不在」判三态在序列化边界翻面。
61310
- ...typeof r.name == "string" && r.name.length > 0 ? { name: r.name } : {},
61311
- // REF-CC-052(fleet2-14):`status` 是 SDK 必填闭集,但脏值/缺席仍可能到达 wire —— 不知道
61312
- // 就说不知道,`'unknown'` 是自描述哨兵,绝不编造一个具体的、看似活跃的 `'running'`。
61313
- status: r.status ?? "unknown",
61314
- // REF-CC-049(fleet2-11):经 wireParentId 单一铸点(悬空父脏值空串按缺席处理)。eopt:
61315
- // 局部变量先取一次(两次裸调用之间 TS 不共享窄化,双调用会重新变宽成 string|undefined)。
61316
- ...parentId !== void 0 ? { parentId } : {}
61317
- };
61318
- })
61319
- }),
61320
+ read: () => {
61321
+ let rows2 = [...taskMap.values()].filter((r) => !TERMINAL_FLEET_TASK_STATUSES.has(r.status ?? "")).map((r) => toBgTask(r, !1)), nowMs = nowFn();
61322
+ for (let [id, r] of retained)
61323
+ r.retiredByNotification === !0 && (nowMs > r.expireAt || taskMap.has(id) || rows2.push(toBgTask(r.row, !0)));
61324
+ return { connected, rows: rows2 };
61325
+ },
61320
61326
  sessionScoped: () => sessionScopedMeta,
61321
61327
  clearRetained: () => {
61322
61328
  retained.clear();
@@ -61336,7 +61342,12 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61336
61342
  taskMap.clear(), wfMap.clear(), rowMeta.clear();
61337
61343
  let receivedAtMs = nowFn();
61338
61344
  for (let row2 of frame.tasks)
61339
- taskMap.set(row2.id, row2), rowMeta.set(row2.id, { receivedAtMs });
61345
+ if (taskMap.set(row2.id, row2), rowMeta.set(row2.id, { receivedAtMs }), !TERMINAL_FLEET_TASK_STATUSES.has(row2.status ?? "")) {
61346
+ let tail = rowIdTail(row2.id);
61347
+ for (let id of [...retained.keys()])
61348
+ rowIdTail(id) === tail && retained.delete(id);
61349
+ clearBgTerminalFacts(tail);
61350
+ }
61340
61351
  for (let row2 of frame.workflows)
61341
61352
  wfMap.set(row2.id, row2);
61342
61353
  break;
@@ -61354,7 +61365,18 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61354
61365
  let childTid = rowIdTail(row2.id), parentTid = rowIdTail(parentId), parentOwned = isOwnEngineRun(parentTid);
61355
61366
  parentOwned && recordOwnEngineRun(childTid), parentOwned || sessionScopedMeta === !0 ? recordBgParentRun(childTid, parentTid) : debug4(`[fleet-frame] task row parent-map SKIPPED foreign/unowned(row=${row2.id} parent=${parentTid})`);
61356
61367
  }
61357
- typeof row2.transcriptId == "string" && row2.transcriptId.length > 0 && recordEngineTranscriptId(rowIdTail(row2.id), row2.transcriptId), TERMINAL_FLEET_TASK_STATUSES.has(row2.status ?? "") ? retained.set(row2.id, { row: row2, expireAt: receivedAtMs + TERMINAL_RETAIN_MS }) : retained.delete(row2.id);
61368
+ if (typeof row2.transcriptId == "string" && row2.transcriptId.length > 0 && recordEngineTranscriptId(rowIdTail(row2.id), row2.transcriptId), TERMINAL_FLEET_TASK_STATUSES.has(row2.status ?? "")) {
61369
+ retained.set(row2.id, { row: row2, expireAt: receivedAtMs + TERMINAL_RETAIN_MS });
61370
+ let tailT = rowIdTail(row2.id);
61371
+ for (let id of [...retained.keys()])
61372
+ id !== row2.id && rowIdTail(id) === tailT && retained.delete(id);
61373
+ } else {
61374
+ retained.delete(row2.id);
61375
+ let tail = rowIdTail(row2.id);
61376
+ for (let id of [...retained.keys()])
61377
+ id !== row2.id && rowIdTail(id) === tail && retained.delete(id);
61378
+ clearBgTerminalFacts(tail);
61379
+ }
61358
61380
  break;
61359
61381
  }
61360
61382
  case "task_remove":
@@ -61382,13 +61404,74 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61382
61404
  droppedMalformed++, debug4("[fleet-frame] MALFORMED bg_notification dropped(taskId \u6216 status \u7F3A\u5E2D/\u975E\u4E32)");
61383
61405
  return;
61384
61406
  }
61407
+ if (n2.parentTaskId !== void 0 && typeof n2.parentTaskId != "string") {
61408
+ droppedMalformed++, debug4(`[fleet-frame] MALFORMED bg_notification dropped(parentTaskId \u952E\u5728\u573A\u4F46\u975E\u4E32:${typeof n2.parentTaskId} \u2014\u2014 \u9694\u79BB\u5224\u636E\u7684\u951A\u4E0D\u8BB8\u88AB\u574F\u503C\u65C1\u8DEF;taskId=${n2.taskId})`);
61409
+ return;
61410
+ }
61385
61411
  let serverFailClosed = bgNotifyFailClosedMeta && sessionScopedMeta === !0, ownByRoot = typeof n2.rootSessionId == "string" && n2.rootSessionId.length > 0 && n2.rootSessionId === engineSessionParam();
61386
61412
  if (!serverFailClosed && !ownByRoot && typeof n2.parentTaskId == "string" && n2.parentTaskId.length > 0 && !isOwnEngineRun(n2.parentTaskId)) {
61387
61413
  droppedForeignBgNotification++, debug4(`[fleet-frame] bg_notification DROPPED foreign/unowned parentRun(taskId=${n2.taskId} parentRun=${n2.parentTaskId})`);
61388
61414
  return;
61389
61415
  }
61390
- if (debug4(`[fleet-frame] bg_notification taskId=${n2.taskId} status=${n2.status} seq=${n2.seq ?? "-"}`), TERMINAL_FLEET_TASK_STATUSES.has(n2.status)) {
61391
- typeof n2.parentTaskId == "string" && n2.parentTaskId && recordBgParentRun(n2.taskId, n2.parentTaskId), typeof n2.transcriptId == "string" && n2.transcriptId.length > 0 && recordEngineTranscriptId(n2.taskId, n2.transcriptId), recordBgTerminalFacts(n2.taskId, {
61416
+ let evidence = serverFailClosed || ownByRoot ? sessionKey === DEFAULT_SESSION_KEY ? serverFailClosed ? "server_fail_closed" : "own_root" : "session_anchor_untrusted" : typeof n2.parentTaskId == "string" && n2.parentTaskId.length > 0 ? "own_parent" : "absent_parent";
61417
+ debug4(`[fleet-frame] bg_notification taskId=${n2.taskId} status=${n2.status} seq=${n2.seq ?? "-"} accept=${evidence}`);
61418
+ let rowIds = [];
61419
+ for (let id of taskMap.keys())
61420
+ (id === n2.taskId || rowIdTail(id) === n2.taskId) && rowIds.push(id);
61421
+ if (TERMINAL_FLEET_TASK_STATUSES.has(n2.status)) {
61422
+ typeof n2.parentTaskId == "string" && n2.parentTaskId && recordBgParentRun(n2.taskId, n2.parentTaskId), typeof n2.transcriptId == "string" && n2.transcriptId.length > 0 && recordEngineTranscriptId(n2.taskId, n2.transcriptId);
61423
+ let isWashGreen = (prior, next) => next === "completed" && (prior === "failed" || prior === "killed"), coerced = n2.status, nowMs = nowFn(), writtenIds = /* @__PURE__ */ new Set(), applied = !1, washBlocked = !1;
61424
+ for (let id of rowIds) {
61425
+ let known = taskMap.get(id);
61426
+ if (!known)
61427
+ continue;
61428
+ let rowStatus = known.status ?? "";
61429
+ if (TERMINAL_FLEET_TASK_STATUSES.has(rowStatus)) {
61430
+ if (isWashGreen(rowStatus, n2.status)) {
61431
+ washBlocked = !0, debug4(`[fleet-frame] bg_notification WASH-GREEN blocked(row=${id} row-status=${rowStatus} notif=${n2.status})`);
61432
+ continue;
61433
+ }
61434
+ if (rowStatus !== n2.status) {
61435
+ let upgraded = { ...known, status: coerced };
61436
+ retained.set(id, { row: upgraded, expireAt: nowMs + TERMINAL_RETAIN_MS }), taskMap.set(id, upgraded);
61437
+ }
61438
+ writtenIds.add(id), applied = !0;
61439
+ } else {
61440
+ let started2 = known.startedAt, meta3 = rowMeta.get(id), frozenElapsed = typeof started2 == "number" && started2 > 0 && started2 <= nowMs ? nowMs - started2 : meta3 !== void 0 ? (known.elapsedMs ?? 0) + Math.max(0, nowMs - meta3.receivedAtMs) : known.elapsedMs;
61441
+ taskMap.delete(id), rowMeta.delete(id), retained.set(id, {
61442
+ row: {
61443
+ ...known,
61444
+ status: coerced,
61445
+ ...typeof frozenElapsed == "number" ? { elapsedMs: frozenElapsed } : {}
61446
+ },
61447
+ expireAt: nowMs + TERMINAL_RETAIN_MS,
61448
+ retiredByNotification: !0
61449
+ }), writtenIds.add(id), applied = !0;
61450
+ }
61451
+ }
61452
+ for (let [id, entry] of retained) {
61453
+ if (writtenIds.has(id) || id !== n2.taskId && rowIdTail(id) !== n2.taskId)
61454
+ continue;
61455
+ let prior = entry.row.status ?? "";
61456
+ if (prior === n2.status) {
61457
+ applied = !0;
61458
+ continue;
61459
+ }
61460
+ if (isWashGreen(prior, n2.status)) {
61461
+ washBlocked = !0, debug4(`[fleet-frame] bg_notification WASH-GREEN blocked(retained=${id} prior=${prior} notif=${n2.status})`);
61462
+ continue;
61463
+ }
61464
+ retained.set(id, {
61465
+ row: { ...entry.row, status: coerced },
61466
+ expireAt: nowMs + TERMINAL_RETAIN_MS,
61467
+ // 状态真变 = 新知识,续窗让修正可见
61468
+ ...entry.retiredByNotification === !0 ? { retiredByNotification: !0 } : {}
61469
+ }), applied = !0;
61470
+ }
61471
+ applied || !washBlocked && (() => {
61472
+ let prior = getBgTerminalFacts(n2.taskId);
61473
+ return !(prior !== void 0 && isWashGreen(prior.status, n2.status));
61474
+ })() ? recordBgTerminalFacts(n2.taskId, {
61392
61475
  status: n2.status,
61393
61476
  ...typeof n2.summary == "string" ? { summary: n2.summary } : {},
61394
61477
  // 🔴 SDK 0.0.117 把 `recentSteps` 的三键 declare 成**必填** string,但那是**声称**不是保证:
@@ -61403,12 +61486,15 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61403
61486
  ...typeof s.outcome == "string" ? { outcome: s.outcome } : {}
61404
61487
  }))
61405
61488
  } : {}
61489
+ }) : debug4(`[fleet-frame] bg_notification state-plane rejected as wash-green echo(taskId=${n2.taskId} notif=${n2.status})\u2014\u2014 \u901A\u77E5\u9762\u7167\u5E38\u5165\u961F`);
61490
+ }
61491
+ try {
61492
+ let out6 = hooks2.onBgNotificationAccepted?.(n2, rowIds, evidence);
61493
+ out6 && typeof out6.then == "function" && Promise.resolve(out6).catch((e) => {
61494
+ hostLog("debug", `[fleet-frame] onBgNotificationAccepted hook rejected: ${String(e).slice(0, 160)}`);
61406
61495
  });
61407
- let known = taskMap.get(n2.taskId);
61408
- known && retained.set(n2.taskId, {
61409
- row: { ...known, status: n2.status },
61410
- expireAt: nowFn() + TERMINAL_RETAIN_MS
61411
- });
61496
+ } catch (e) {
61497
+ hostLog("debug", `[fleet-frame] onBgNotificationAccepted hook threw: ${String(e).slice(0, 160)}`);
61412
61498
  }
61413
61499
  enqueueBgChildNotification({
61414
61500
  taskId: n2.taskId,
@@ -61528,6 +61614,32 @@ var engineOwnedRowIds, fleetViewStubRowIds, init_engineRowStopGate = __esm({
61528
61614
  }
61529
61615
  });
61530
61616
 
61617
+ // node_modules/@sema-agent/client-core/dist/subagent/subagentOwnerAbsence.js
61618
+ function noteBgOwnerAbsence(leg, taskId) {
61619
+ let key = `${leg}:${taskId}`;
61620
+ if (!noted.has(key)) {
61621
+ if (noted.size >= MAX_NOTED) {
61622
+ let oldest = noted.values().next().value;
61623
+ oldest !== void 0 && noted.delete(oldest);
61624
+ }
61625
+ noted.add(key);
61626
+ try {
61627
+ hostLog("warn", `[subagent-owner] ${leg}: no host-run mapping for ${taskId} \u2014 not connecting (owner ledger absent \u21D2 honest absence; active-run fallback removed per [4000] Q3)`);
61628
+ } catch {
61629
+ noted.delete(key);
61630
+ }
61631
+ }
61632
+ }
61633
+ function __resetBgOwnerAbsenceForTests() {
61634
+ noted.clear();
61635
+ }
61636
+ var noted, MAX_NOTED, init_subagentOwnerAbsence = __esm({
61637
+ "node_modules/@sema-agent/client-core/dist/subagent/subagentOwnerAbsence.js"() {
61638
+ init_host();
61639
+ noted = /* @__PURE__ */ new Set(), MAX_NOTED = 512;
61640
+ }
61641
+ });
61642
+
61531
61643
  // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentOutput.js
61532
61644
  async function subagentOutputCapable(client3, baseUrl, signal) {
61533
61645
  let hit = capByBase.get(baseUrl);
@@ -61547,9 +61659,9 @@ async function fetchEngineSubagentReport(taskId, opts) {
61547
61659
  let cfg = engineWireTarget();
61548
61660
  if (!cfg)
61549
61661
  return null;
61550
- let runId = getBgParentRun(taskId) ?? activeEngineRunId();
61662
+ let runId = getBgParentRun(taskId);
61551
61663
  if (!runId)
61552
- return null;
61664
+ return noteBgOwnerAbsence("subagent-output", taskId), null;
61553
61665
  let client3 = makeEngineWireClient({
61554
61666
  baseUrl: cfg.baseUrl,
61555
61667
  ...cfg.token ? { token: cfg.token } : {},
@@ -61578,46 +61690,11 @@ var capByBase, CAP_FALSE_RETRY_TTL_MS, init_engineSubagentOutput = __esm({
61578
61690
  init_engineWireTarget();
61579
61691
  init_subagentContentStore();
61580
61692
  init_engineSessionParam();
61693
+ init_subagentOwnerAbsence();
61581
61694
  capByBase = /* @__PURE__ */ new Map(), CAP_FALSE_RETRY_TTL_MS = 5 * 6e4;
61582
61695
  }
61583
61696
  });
61584
61697
 
61585
- // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js
61586
- async function steerEngineSubagent(target, text2) {
61587
- let cfg = engineWireTarget();
61588
- if (!cfg)
61589
- return { ok: !1, reason: "no-wire" };
61590
- let runId = activeEngineRunId();
61591
- if (!runId)
61592
- return { ok: !1, reason: "no-run" };
61593
- let client3 = makeEngineWireClient({
61594
- baseUrl: cfg.baseUrl,
61595
- ...cfg.token ? { token: cfg.token } : {},
61596
- principal: cfg.principal
61597
- });
61598
- if (!client3)
61599
- return { ok: !1, reason: "no-wire" };
61600
- try {
61601
- let body = await client3.runs.steerSubagent(runId, target, { content: text2 }, engineSessionParamSpread()), receipt = "Message queued for delivery at the next tool round.", copy2 = body?.note ?? body?.message;
61602
- return typeof copy2 == "string" && copy2.length > 0 && (receipt = copy2), { ok: !0, receipt };
61603
- } catch (e) {
61604
- let status3 = e?.status;
61605
- if (typeof status3 == "number") {
61606
- let detail = e instanceof Error ? e.message : String(e);
61607
- return hostLog("debug", `engineSubagentSteer: ${status3} ${detail.slice(0, 200)}`), status3 === 409 || status3 === 404 ? { ok: !1, reason: "not-running", detail } : { ok: !1, reason: "error", detail: `${status3}` };
61608
- }
61609
- return hostLog("debug", `engineSubagentSteer: fetch failed ${String(e)}`), { ok: !1, reason: "error", detail: String(e) };
61610
- }
61611
- }
61612
- var init_engineSubagentSteer = __esm({
61613
- "node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js"() {
61614
- init_host();
61615
- init_engineWireSdk();
61616
- init_engineWireTarget();
61617
- init_engineSessionParam();
61618
- }
61619
- });
61620
-
61621
61698
  // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentResume.js
61622
61699
  function subagentResumeAvailable(baseUrl = engineWireTarget()?.baseUrl) {
61623
61700
  return engineCapTrue(baseUrl, SUBAGENT_RESUME_CAP);
@@ -61712,10 +61789,51 @@ var SUBAGENT_RESUME_CAP, RETENTION_LAPSED_CODES, warnedRetainWithoutWake, init_e
61712
61789
  }
61713
61790
  });
61714
61791
 
61792
+ // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js
61793
+ async function steerEngineSubagent(target, text2, childTaskId) {
61794
+ let cfg = engineWireTarget();
61795
+ if (!cfg)
61796
+ return { ok: !1, reason: "no-wire" };
61797
+ let named = typeof childTaskId == "string" && childTaskId !== "" ? childTaskId : void 0, runId = resolveOwnerRunId(named);
61798
+ if (!runId)
61799
+ return named !== void 0 && noteBgOwnerAbsence("subagent-steer", named), { ok: !1, reason: "no-run" };
61800
+ let client3 = makeEngineWireClient({
61801
+ baseUrl: cfg.baseUrl,
61802
+ ...cfg.token ? { token: cfg.token } : {},
61803
+ principal: cfg.principal
61804
+ });
61805
+ if (!client3)
61806
+ return { ok: !1, reason: "no-wire" };
61807
+ let rowSession = named !== void 0 ? getBgParentRunOwner(named)?.sessionId : void 0, session2 = rowSession !== void 0 ? { session: rowSession } : engineSessionParamSpread();
61808
+ try {
61809
+ let body = await client3.runs.steerSubagent(runId, target, { content: text2 }, session2), receipt = "Message queued for delivery at the next tool round.", copy2 = body?.note ?? body?.message;
61810
+ return typeof copy2 == "string" && copy2.length > 0 && (receipt = copy2), { ok: !0, receipt };
61811
+ } catch (e) {
61812
+ let status3 = e?.status;
61813
+ if (typeof status3 == "number") {
61814
+ let detail = e instanceof Error ? e.message : String(e);
61815
+ return hostLog("debug", `engineSubagentSteer: ${status3} ${detail.slice(0, 200)}`), status3 === 409 || status3 === 404 ? { ok: !1, reason: "not-running", detail } : { ok: !1, reason: "error", detail: `${status3}` };
61816
+ }
61817
+ return hostLog("debug", `engineSubagentSteer: fetch failed ${String(e)}`), { ok: !1, reason: "error", detail: String(e) };
61818
+ }
61819
+ }
61820
+ var init_engineSubagentSteer = __esm({
61821
+ "node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js"() {
61822
+ init_host();
61823
+ init_engineWireSdk();
61824
+ init_engineWireTarget();
61825
+ init_engineSessionParam();
61826
+ init_subagentContentStore();
61827
+ init_engineSubagentResume();
61828
+ init_subagentOwnerAbsence();
61829
+ }
61830
+ });
61831
+
61715
61832
  // node_modules/@sema-agent/client-core/dist/subagent/engineTaskHandleWire.js
61716
61833
  import { TaskStopConflictError } from "@sema-agent/sdk";
61717
61834
  function resolveHostRun(handle2) {
61718
- return getBgParentRun(handle2) ?? activeEngineRunId() ?? null;
61835
+ let runId = getBgParentRun(handle2);
61836
+ return runId || (noteBgOwnerAbsence("task-handle", handle2), null);
61719
61837
  }
61720
61838
  function __resetTaskHandleWireForTests() {
61721
61839
  accumulated.clear();
@@ -61812,6 +61930,7 @@ var accumulated, init_engineTaskHandleWire = __esm({
61812
61930
  init_engineSessionParam();
61813
61931
  init_subagentContentStore();
61814
61932
  init_engineRowStopGate();
61933
+ init_subagentOwnerAbsence();
61815
61934
  init_toolResult();
61816
61935
  init_engineErrorCodes();
61817
61936
  accumulated = /* @__PURE__ */ new Map();
@@ -61941,9 +62060,11 @@ function tailEngineSubagent(taskId) {
61941
62060
  let cfg = engineWireTarget();
61942
62061
  if (!cfg)
61943
62062
  return;
61944
- let runId = getBgParentRun(taskId) ?? activeEngineRunId();
61945
- if (!runId)
62063
+ let runId = getBgParentRun(taskId);
62064
+ if (!runId) {
62065
+ noteBgOwnerAbsence("subagent-tail", taskId);
61946
62066
  return;
62067
+ }
61947
62068
  let client3 = makeEngineWireClient({
61948
62069
  baseUrl: cfg.baseUrl,
61949
62070
  ...cfg.token ? { token: cfg.token } : {},
@@ -62040,6 +62161,7 @@ var capByBase2, CAP_FALSE_RETRY_TTL_MS2, activeTails, activitySink, tailMetaSink
62040
62161
  init_engineWireTarget();
62041
62162
  init_engineSessionParam();
62042
62163
  init_subagentContentStore();
62164
+ init_subagentOwnerAbsence();
62043
62165
  capByBase2 = /* @__PURE__ */ new Map(), CAP_FALSE_RETRY_TTL_MS2 = 5 * 6e4;
62044
62166
  activeTails = /* @__PURE__ */ new Map(), activitySink = null;
62045
62167
  tailMetaSink = null;
@@ -65568,10 +65690,10 @@ function notePlanReviewAnswered(questionId) {
65568
65690
  function notePlanReviewAnsweredFor(sessionKey, questionId) {
65569
65691
  if (typeof questionId != "string" || !questionId.startsWith(PLAN_REVIEW_QUESTION_ID_PREFIX))
65570
65692
  return;
65571
- let noted = notedIdsFor(sessionKey);
65572
- if (noted.has(questionId))
65693
+ let noted2 = notedIdsFor(sessionKey);
65694
+ if (noted2.has(questionId))
65573
65695
  return;
65574
- noted.add(questionId);
65696
+ noted2.add(questionId);
65575
65697
  let base = questionId.slice(PLAN_REVIEW_QUESTION_ID_PREFIX.length), cut = base.indexOf(REOPEN_ID_TAIL), taskId = cut >= 0 ? base.slice(0, cut) : base;
65576
65698
  if (taskId.length === 0)
65577
65699
  return;
@@ -68192,6 +68314,7 @@ __export(dist_exports, {
68192
68314
  WORKFLOW_TOOL_NAMES: () => WORKFLOW_TOOL_NAMES,
68193
68315
  __activeTailCountForTests: () => __activeTailCountForTests,
68194
68316
  __feedWorkflowActivityFrameForTests: () => __feedWorkflowActivityFrameForTests,
68317
+ __resetBgOwnerAbsenceForTests: () => __resetBgOwnerAbsenceForTests,
68195
68318
  __resetEngineCapsCacheForTests: () => __resetEngineCapsCacheForTests,
68196
68319
  __resetEngineDelegatedPromptForTests: () => __resetEngineDelegatedPromptForTests,
68197
68320
  __resetFleetLedgerRegistryForTests: () => __resetFleetLedgerRegistryForTests,
@@ -68279,6 +68402,7 @@ __export(dist_exports, {
68279
68402
  clearAllRetainedFleetRowsFor: () => clearAllRetainedFleetRowsFor,
68280
68403
  clearArmedGate: () => clearArmedGate,
68281
68404
  clearArmedGateFor: () => clearArmedGateFor,
68405
+ clearBgTerminalFacts: () => clearBgTerminalFacts,
68282
68406
  clearEnginePanelTaskResident: () => clearEnginePanelTaskResident,
68283
68407
  clearSubagentContent: () => clearSubagentContent,
68284
68408
  clientContextField: () => clientContextField,
@@ -68499,6 +68623,7 @@ __export(dist_exports, {
68499
68623
  normalizeShellPermissionModeForWire: () => normalizeShellPermissionModeForWire,
68500
68624
  normalizeTaskNotification: () => normalizeTaskNotification,
68501
68625
  normalizeWirePrincipal: () => normalizeWirePrincipal,
68626
+ noteBgOwnerAbsence: () => noteBgOwnerAbsence,
68502
68627
  notePlanReviewAnswered: () => notePlanReviewAnswered,
68503
68628
  notePlanReviewAnsweredFor: () => notePlanReviewAnsweredFor,
68504
68629
  notePlanReviewAnsweredIfDecisive: () => notePlanReviewAnsweredIfDecisive,
@@ -68820,6 +68945,7 @@ var init_dist = __esm({
68820
68945
  init_engineTaskHandleWire();
68821
68946
  init_engineCompactWire();
68822
68947
  init_engineSubagentTail();
68948
+ init_subagentOwnerAbsence();
68823
68949
  init_engineSessionParam();
68824
68950
  init_engineWireTarget();
68825
68951
  init_principalWire();
@@ -109646,7 +109772,7 @@ var import_stack_utils, import_jsx_runtime6, cleanupPath, stackUtils, init_Error
109646
109772
  // build-src/src/ink/components/TerminalSizeContext.tsx
109647
109773
  var import_react9, TerminalSizeContext, init_TerminalSizeContext = __esm({
109648
109774
  "build-src/src/ink/components/TerminalSizeContext.tsx"() {
109649
- import_react9 = __toESM(require_react(), 1), TerminalSizeContext = (0, import_react9.createContext)(null);
109775
+ import_react9 = __toESM(require_react()), TerminalSizeContext = (0, import_react9.createContext)(null);
109650
109776
  }
109651
109777
  });
109652
109778
 
@@ -136732,6 +136858,17 @@ var g, gDirs, init_appStateRef = __esm({
136732
136858
  });
136733
136859
 
136734
136860
  // build-src/src/sema/fleetDurableTerminalOverlay.ts
136861
+ function evidenceTier(e) {
136862
+ switch (e) {
136863
+ case "server_fail_closed":
136864
+ case "own_root":
136865
+ return "trusted";
136866
+ case "own_parent":
136867
+ return "process";
136868
+ default:
136869
+ return "unproven";
136870
+ }
136871
+ }
136735
136872
  function trimFifo(map2) {
136736
136873
  for (; map2.size > MAX_FACTS; ) {
136737
136874
  let oldest = map2.keys().next().value;
@@ -136747,20 +136884,24 @@ function normalizeSeq(rawSeq) {
136747
136884
  if (typeof rawSeq == "number" && Number.isFinite(rawSeq)) return rawSeq;
136748
136885
  if (typeof rawSeq == "string" && rawSeq.trim() !== "" && Number.isFinite(Number(rawSeq))) return Number(rawSeq);
136749
136886
  }
136750
- function recordTerminalFact(taskId, rawStatus, rawSeq, src) {
136887
+ function recordTerminalFact(taskId, rawStatus, rawSeq, src, evidence) {
136751
136888
  let status3 = typeof rawStatus == "string" && TERMINAL.has(rawStatus) ? rawStatus : void 0;
136752
136889
  if (taskId === void 0 || taskId.length === 0 || status3 === void 0) return;
136753
136890
  let seq = normalizeSeq(rawSeq), dead = tombstones.get(taskId);
136754
- dead !== void 0 && seq !== void 0 && seq <= dead || (facts.delete(taskId), facts.set(taskId, { status: status3, seq, at: ++tick, wallAt: Date.now(), src }), trimFifo(facts));
136891
+ if (dead !== void 0 && seq !== void 0 && seq <= dead) return;
136892
+ let tier = evidenceTier(evidence);
136893
+ src === "bg_notification" && tier !== "trusted" && logForDebugging(
136894
+ `[fleet-overlay] bg fact for ${taskId} recorded on NON-SESSION evidence (evidence=${evidence ?? "absent"} tier=${tier}) \u2014 presentation-only; not an ownership proof`
136895
+ ), facts.delete(taskId), facts.set(taskId, { status: status3, seq, at: ++tick, wallAt: Date.now(), src, evidence, tier }), trimFifo(facts);
136755
136896
  }
136756
136897
  function recordDurableTerminalNotification(n2) {
136757
136898
  if (n2.task_type === "external") return;
136758
136899
  let taskId = typeof n2.task_id == "string" ? n2.task_id : void 0;
136759
136900
  recordTerminalFact(taskId, n2.status, n2.seq, "task_notification");
136760
136901
  }
136761
- function observeFleetBgNotification(n2) {
136902
+ function observeFleetBgNotification(n2, evidence) {
136762
136903
  let taskId = typeof n2.taskId == "string" ? n2.taskId : void 0;
136763
- recordTerminalFact(taskId, n2.status, n2.seq, "bg_notification");
136904
+ recordTerminalFact(taskId, n2.status, n2.seq, "bg_notification", evidence);
136764
136905
  }
136765
136906
  function observeFleetTaskFrame(rowFrame) {
136766
136907
  let rowId = typeof rowFrame.id == "string" && rowFrame.id.length > 0 ? rowFrame.id : void 0;
@@ -136794,18 +136935,24 @@ function overlayDurableTerminalFacts(tasks3) {
136794
136935
  let present = new Set(tasks3.map((t2) => rowIdTail(t2.id)));
136795
136936
  for (let id of [...appliedOverlay.keys()]) present.has(id) || appliedOverlay.delete(id);
136796
136937
  }
136797
- if (tasks3.some((t2) => !TERMINAL.has(t2.status)))
136938
+ if (tasks3.some((t2) => !TERMINAL.has(t2.status))) {
136798
136939
  for (let [taskId] of facts)
136799
- matched.has(taskId) || missLogged.has(taskId) || (missLogged.add(taskId), logForDebugging(
136800
- `[fleet-overlay] durable terminal fact for task ${taskId} matched no fleet row (id-domain mismatch? nonTerminalRows in view) \u2014 rows left as-is`
136801
- ));
136940
+ if (!(matched.has(taskId) || missLogged.has(taskId))) {
136941
+ if (missLogged.size >= 512)
136942
+ for (let old of [...missLogged].slice(0, 256)) missLogged.delete(old);
136943
+ missLogged.add(taskId), logForDebugging(
136944
+ `[fleet-overlay] durable terminal fact for task ${taskId} matched no fleet row (id-domain mismatch? nonTerminalRows in view) \u2014 rows left as-is`
136945
+ );
136946
+ }
136947
+ }
136802
136948
  return out6;
136803
136949
  }
136804
136950
  var TERMINAL, MAX_FACTS, tick, FACT_GRACE_MS, facts, lastFrameAt, tombstones, appliedOverlay, missLogged, init_fleetDurableTerminalOverlay = __esm({
136805
136951
  "build-src/src/sema/fleetDurableTerminalOverlay.ts"() {
136806
136952
  init_debug();
136807
136953
  init_appStateRef();
136808
- TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "killed"]), MAX_FACTS = 200, tick = 0, FACT_GRACE_MS = 3e3, facts = /* @__PURE__ */ new Map(), lastFrameAt = /* @__PURE__ */ new Map(), tombstones = /* @__PURE__ */ new Map(), appliedOverlay = /* @__PURE__ */ new Map(), missLogged = /* @__PURE__ */ new Set();
136954
+ TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "killed"]), MAX_FACTS = 200, tick = 0, FACT_GRACE_MS = 3e3;
136955
+ facts = /* @__PURE__ */ new Map(), lastFrameAt = /* @__PURE__ */ new Map(), tombstones = /* @__PURE__ */ new Map(), appliedOverlay = /* @__PURE__ */ new Map(), missLogged = /* @__PURE__ */ new Set();
136809
136956
  }
136810
136957
  });
136811
136958
 
@@ -177411,7 +177558,7 @@ function runVersionDriftSwapGate(deps2) {
177411
177558
  "[sema] engine update detected \u2014 will roll to the new engine when the current turn finishes"
177412
177559
  )), bgDeferSince !== null)
177413
177560
  try {
177414
- deps2.readBgTasks().tasks.length === 0 && wfCount() === 0 && (bgDeferSince = null, loggedBgDefer = !1);
177561
+ deps2.readBgTasks().tasks.filter((t3) => t3.retiredByNotification !== !0).length === 0 && wfCount() === 0 && (bgDeferSince = null, loggedBgDefer = !1);
177415
177562
  } catch {
177416
177563
  }
177417
177564
  return;
@@ -177422,15 +177569,15 @@ function runVersionDriftSwapGate(deps2) {
177422
177569
  } catch {
177423
177570
  reading = { tasks: [], fresh: !1 };
177424
177571
  }
177425
- let wf = wfCount();
177426
- if (reading.tasks.length === 0 && wf === 0) {
177572
+ let liveTasks = reading.tasks.filter((t3) => t3.retiredByNotification !== !0), wf = wfCount();
177573
+ if (liveTasks.length === 0 && wf === 0) {
177427
177574
  if (emptyStreak++, bgDeferSince = null, loggedBgDefer = !1, emptyStreak < 3) return;
177428
177575
  finish(null);
177429
177576
  return;
177430
177577
  }
177431
177578
  emptyStreak = 0;
177432
177579
  let inflightDesc = [
177433
- ...reading.tasks.length > 0 ? [`${reading.tasks.length} background agent(s)${reading.fresh ? "" : " (stale fleet view)"}`] : [],
177580
+ ...liveTasks.length > 0 ? [`${liveTasks.length} background agent(s)${reading.fresh ? "" : " (stale fleet view)"}`] : [],
177434
177581
  ...wf > 0 ? [`${wf} workflow run(s)`] : []
177435
177582
  ].join(" + "), t2 = now2();
177436
177583
  if (bgDeferSince === null && (bgDeferSince = t2), t2 - bgDeferSince < capMs) {
@@ -177440,8 +177587,8 @@ function runVersionDriftSwapGate(deps2) {
177440
177587
  return;
177441
177588
  }
177442
177589
  deps2.log(
177443
- `[sema] engine update deferred ${Math.round(capMs / 6e4)}min \u2014 ${inflightDesc} still running; rolling now${reading.tasks.length > 0 ? " (they will be killed; task notifications will follow)" : ""}`
177444
- ), finish(reading.tasks);
177590
+ `[sema] engine update deferred ${Math.round(capMs / 6e4)}min \u2014 ${inflightDesc} still running; rolling now${liveTasks.length > 0 ? " (they will be killed; task notifications will follow)" : ""}`
177591
+ ), finish(liveTasks);
177445
177592
  };
177446
177593
  return evaluate(), done || (timer2 = setInterval(evaluate, intervalMs), typeof timer2.unref == "function" && timer2.unref()), {
177447
177594
  cancel() {
@@ -181065,7 +181212,20 @@ function scopeSessionId() {
181065
181212
  }
181066
181213
  function createLiveFleetSource(config4, now2 = Date.now()) {
181067
181214
  let t0 = now2, mainName = config4.mainName ?? "main", ledger = createFleetLedger({
181068
- onHookNotice: (frame, sessionScoped) => maybeIngestFleetFrame(frame, sessionScoped)
181215
+ onHookNotice: (frame, sessionScoped) => maybeIngestFleetFrame(frame, sessionScoped),
181216
+ // #242 批 3:终态兜底腿的 bg 事实源改接包的 accepted 钩子(归属判别通过之后才回调)。
181217
+ // 此前壳在 consume 环里自设一道「meta 两位(sessionScoped+bgNotifyFailClosed)都真才记账」的
181218
+ // 归属门 —— 那是 accepted 钩子缺位时的复刻补偿([cross-repo-fix-at-source] 登记的长线正解
181219
+ // 就是本钩子),钩子到货即整条删:两道门串联在混版象限下双重保守(design-242 §4.7)。
181220
+ // 让位差分(如实记):包的判别是 serverFailClosed **或** ownByRoot **或** parentTaskId∈own-run
181221
+ // 台账(parentTaskId 缺席=absent-放行);旧壳门是「两位不全一律不记」。⇒ 老 server/偏斜象限上
181222
+ // 无 parentTaskId 的通知现在会入 overlay 事实账 —— 与包自己的状态面(retained/bgFacts)对同一
181223
+ // 帧的处置**同口径**,不再一边收一边拒。
181224
+ // 🔴 0.32.0 #284:第三参 `evidence` = **凭哪一条臂放行的**(不是归属结论)。本端一律入账、
181225
+ // 按档留痕 —— 处置边界与论证见 fleetDurableTerminalOverlay.ts 的 `evidenceTier` 头注
181226
+ // (要点:本模块是进程内**呈现**面,不落库/不跨会话搬运/翻行另有一道正交归属门,
181227
+ // 故不属包文档划的「有副作用的归属动作」射程)。`rowIds` 本端暂无消费面,显式具名弃用。
181228
+ onBgNotificationAccepted: (n2, _rowIds, evidence) => observeFleetBgNotification(n2, evidence)
181069
181229
  }), lastError = null, disposed4 = !1, client3 = new AgentClient2({
181070
181230
  baseUrl: config4.baseUrl,
181071
181231
  authToken: config4.authToken,
@@ -181138,8 +181298,7 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
181138
181298
  }
181139
181299
  if (observeWorkflowFrame(frame), frame.type === "task" && frame.row && observeFleetTaskFrame(frame.row), frame.type === "snapshot" && Array.isArray(frame.tasks))
181140
181300
  for (let snapRow of frame.tasks) observeFleetTaskFrame(snapRow);
181141
- let fleetStatus = ledger.status(), bgNotifyOwnershipDeclared = fleetStatus.sessionScoped === !0 && fleetStatus.bgNotifyFailClosed === !0;
181142
- frame.type === "bg_notification" && frame.notification && bgNotifyOwnershipDeclared && observeFleetBgNotification(frame.notification), ledger.applyFrame(frame);
181301
+ ledger.applyFrame(frame);
181143
181302
  }
181144
181303
  ledger.setConnected(!1), lastError = "stream ended (EOF)";
181145
181304
  } catch (err8) {
@@ -182129,9 +182288,11 @@ var init_cloudProfile = __esm({
182129
182288
  // build-src/src/sema/registrySdkClient.ts
182130
182289
  import { RegistryClient } from "@sema-agent/sdk/registry";
182131
182290
  function lockedTokenProvider(profileName) {
182291
+ let lastIssuedRefreshToken, foreignRotationObserved = !1;
182132
182292
  return {
182133
182293
  async get() {
182134
- return toTokens(readCredentials(), profileName);
182294
+ let tokens = toTokens(readCredentials(), profileName), t2 = tokens?.refreshToken;
182295
+ return t2 !== void 0 && lastIssuedRefreshToken !== void 0 && t2 !== lastIssuedRefreshToken && (foreignRotationObserved = !0), lastIssuedRefreshToken = t2, tokens;
182135
182296
  },
182136
182297
  async set(tokens) {
182137
182298
  await mutateCredentials((creds) => {
@@ -182142,13 +182303,13 @@ function lockedTokenProvider(profileName) {
182142
182303
  refreshToken: tokens.refreshToken,
182143
182304
  accessExpiresAt: jwtExpiryMs(tokens.accessToken) ?? previous?.accessExpiresAt ?? 0
182144
182305
  };
182145
- });
182306
+ }), lastIssuedRefreshToken = tokens.refreshToken, foreignRotationObserved = !1;
182146
182307
  },
182147
182308
  async clear() {
182148
- let attempted = toTokens(readCredentials(), profileName)?.refreshToken;
182309
+ let attempted = lastIssuedRefreshToken, foreign = foreignRotationObserved;
182149
182310
  await mutateCredentials((creds) => {
182150
182311
  let current5 = creds[profileName];
182151
- if (!current5 || attempted !== void 0 && current5.refreshToken !== attempted) return !1;
182312
+ if (!current5 || attempted === void 0 || current5.refreshToken !== attempted || foreign) return !1;
182152
182313
  delete creds[profileName];
182153
182314
  });
182154
182315
  }
@@ -182930,7 +183091,7 @@ function assembleChildEnv(toc) {
182930
183091
  if (env5.LEADER_ENABLED !== void 0) {
182931
183092
  let wouldReject = !["false", "0", "no", "off"].includes(env5.LEADER_ENABLED.trim().toLowerCase());
182932
183093
  process.stderr.write(
182933
- `[sema] LEADER_ENABLED inherited from your environment \u2014 the locally spawned engine runs single-node (DB_BACKEND=local)${wouldReject ? " and would boot-reject with this value (engine 7.24.0)" : "; the key has no meaning for this single-node form"}; dropped for the spawned engine
183094
+ `[sema] LEADER_ENABLED inherited from your environment \u2014 the locally spawned engine runs single-node (DB_BACKEND=local)${wouldReject ? " and would boot-reject with this value (leader lane needs a multi-node backend)" : "; the key has no meaning for this single-node form"}; dropped for the spawned engine
182934
183095
  `
182935
183096
  ), delete env5.LEADER_ENABLED;
182936
183097
  }
@@ -301184,9 +301345,9 @@ function streamingTailWrap(unstableSuffix) {
301184
301345
  }
301185
301346
  var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE_MAX, tokenCache, MD_SYNTAX_RE, init_Markdown = __esm({
301186
301347
  "build-src/src/components/Markdown.tsx"() {
301187
- import_compiler_runtime53 = __toESM(require_compiler_runtime(), 1);
301348
+ import_compiler_runtime53 = __toESM(require_compiler_runtime());
301188
301349
  init_marked_esm();
301189
- import_react48 = __toESM(require_react(), 1);
301350
+ import_react48 = __toESM(require_react());
301190
301351
  init_useSettings();
301191
301352
  init_ink2();
301192
301353
  init_cliHighlight();
@@ -301194,7 +301355,7 @@ var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE
301194
301355
  init_markdown();
301195
301356
  init_messages4();
301196
301357
  init_MarkdownTable();
301197
- import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1), TOKEN_CACHE_MAX = 500, tokenCache = /* @__PURE__ */ new Map(), MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
301358
+ import_jsx_runtime65 = __toESM(require_jsx_runtime()), TOKEN_CACHE_MAX = 500, tokenCache = /* @__PURE__ */ new Map(), MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
301198
301359
  }
301199
301360
  });
301200
301361
 
@@ -401152,15 +401313,15 @@ var sema_brand_default, init_sema_brand = __esm({
401152
401313
  _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"
401153
401314
  },
401154
401315
  whatsNew: {
401155
- version: "1.0.78",
401316
+ version: "1.0.79",
401156
401317
  notes: [
401157
- "Approval cards now actually show the reversibility-probe note promised in 1.0.77: client-core 0.30.4 forwards the probe cause on both the live approval frame and the durable parked row, so the one-line 'reversibility probe: \u2026 \u2014 roots: \u2026' explanation reaches the card in the default interactive path (this closes the gap where 1.0.77 advertised the note but the wire dropped it in transit)",
401158
- "The subagent tail stream now publishes engine meta frames to the shell, so content-frame availability is knowable per subagent (groundwork; the viewing-pane hint that consumes it ships separately)",
401159
- "No engine change: still 7.22.0"
401318
+ "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
401319
+ "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
401320
+ "Engine 7.24.0 (from 7.22.0)"
401160
401321
  ]
401161
401322
  },
401162
- productVersion: "1.0.79",
401163
- announcement: "sema 1.0.79 \u2014 Engine 7.24.0 (from 7.22.0). Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools now stay in force \u2014 degraded mode only tightens, never widens. Approval cards carry org-rule evidence notes end-to-end (client-core 0.30.8) and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing. If your engine setup withholds memory write instructions, set MEMORY_PERSISTENCE_CAPABLE=true on the engine to re-arm them."
401323
+ productVersion: "1.0.81",
401324
+ announcement: "sema 1.0.81 \u2014 Steering a specific background agent row now resolves through that row's own recorded run (no more silently steering whichever run happens to be active; a stale row fails honestly with a no-run notice instead). Background-notification trust is now graded per acceptance path and kept with the row, so panel rows never flip state on unproven evidence. Under the hood: the self-test fleet gained a port registry with hard guards, so test tooling can never touch a production engine port."
401164
401325
  };
401165
401326
  }
401166
401327
  });
@@ -405363,15 +405524,15 @@ var require_sema_brand = __commonJS({
405363
405524
  _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"
405364
405525
  },
405365
405526
  whatsNew: {
405366
- version: "1.0.78",
405527
+ version: "1.0.79",
405367
405528
  notes: [
405368
- "Approval cards now actually show the reversibility-probe note promised in 1.0.77: client-core 0.30.4 forwards the probe cause on both the live approval frame and the durable parked row, so the one-line 'reversibility probe: \u2026 \u2014 roots: \u2026' explanation reaches the card in the default interactive path (this closes the gap where 1.0.77 advertised the note but the wire dropped it in transit)",
405369
- "The subagent tail stream now publishes engine meta frames to the shell, so content-frame availability is knowable per subagent (groundwork; the viewing-pane hint that consumes it ships separately)",
405370
- "No engine change: still 7.22.0"
405529
+ "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
405530
+ "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
405531
+ "Engine 7.24.0 (from 7.22.0)"
405371
405532
  ]
405372
405533
  },
405373
- productVersion: "1.0.79",
405374
- announcement: "sema 1.0.79 \u2014 Engine 7.24.0 (from 7.22.0). Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools now stay in force \u2014 degraded mode only tightens, never widens. Approval cards carry org-rule evidence notes end-to-end (client-core 0.30.8) and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing. If your engine setup withholds memory write instructions, set MEMORY_PERSISTENCE_CAPABLE=true on the engine to re-arm them."
405534
+ productVersion: "1.0.81",
405535
+ announcement: "sema 1.0.81 \u2014 Steering a specific background agent row now resolves through that row's own recorded run (no more silently steering whichever run happens to be active; a stale row fails honestly with a no-run notice instead). Background-notification trust is now graded per acceptance path and kept with the row, so panel rows never flip state on unproven evidence. Under the hood: the self-test fleet gained a port registry with hard guards, so test tooling can never touch a production engine port."
405375
405536
  };
405376
405537
  }
405377
405538
  });
@@ -446392,6 +446553,8 @@ var init_harness = __esm({
446392
446553
  init_memory_repo();
446393
446554
  init_uuid4();
446394
446555
  init_types25();
446556
+ init_types25();
446557
+ init_session3();
446395
446558
  }
446396
446559
  });
446397
446560
 
@@ -446622,76 +446785,6 @@ var MAX_PENDING_STEER_CHARS, PENDING_STEER_QUEUE_BYTE_BUDGET_BYTES, MAX_PENDING_
446622
446785
  }
446623
446786
  });
446624
446787
 
446625
- // node_modules/@sema-agent/core/dist/core/version.js
446626
- import { createRequire as createRequire4 } from "node:module";
446627
- function engineVersion() {
446628
- if (cached5 === void 0)
446629
- try {
446630
- let pkg = createRequire4(import.meta.url)("../../package.json");
446631
- cached5 = typeof pkg.version == "string" && pkg.version !== "" ? pkg.version : "unknown";
446632
- } catch {
446633
- cached5 = "unknown";
446634
- }
446635
- return cached5;
446636
- }
446637
- var cached5, init_version3 = __esm({
446638
- "node_modules/@sema-agent/core/dist/core/version.js"() {
446639
- }
446640
- });
446641
-
446642
- // node_modules/@sema-agent/core/dist/config/defaults.js
446643
- var init_defaults2 = __esm({
446644
- "node_modules/@sema-agent/core/dist/config/defaults.js"() {
446645
- }
446646
- });
446647
-
446648
- // node_modules/@sema-agent/core/dist/config/catalog.js
446649
- var init_catalog2 = __esm({
446650
- "node_modules/@sema-agent/core/dist/config/catalog.js"() {
446651
- init_defaults2();
446652
- }
446653
- });
446654
-
446655
- // node_modules/@sema-agent/core/dist/prompt-assembly/event-registry.js
446656
- var EVENT_PROMPT_REGISTRY, init_event_registry = __esm({
446657
- "node_modules/@sema-agent/core/dist/prompt-assembly/event-registry.js"() {
446658
- EVENT_PROMPT_REGISTRY = new Map([
446659
- { kind: "todo_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TODO_REMINDER_BASE" },
446660
- { kind: "task_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TASK_REMINDER_BASE" },
446661
- { kind: "changed_files", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderChangedFiles" },
446662
- { kind: "plan_mode", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#PLAN_MODE_FULL_BODY" },
446663
- { kind: "date_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "turn-attachments.ts#renderDateChange" },
446664
- { kind: "instructions_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", maxBytes: 512, defaultPolicy: "always", rendererRef: "turn-attachments.ts#collectInstructionsChange" },
446665
- { kind: "workflow_size_guideline_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "runtask.ts#workflowSizeGuidelineChangeNotice" },
446666
- { kind: "budget_usd", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderBudgetUsd" },
446667
- { kind: "background_tasks", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderBackgroundTasks" },
446668
- { kind: "tools_delta", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderToolsDelta" },
446669
- { kind: "agent_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderAgentListingDelta" },
446670
- { kind: "skills_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderSkillsListingDelta" },
446671
- { kind: "mcp_instructions", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpInstructionsDelta" },
446672
- { kind: "mcp_dropped_tools", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpDroppedTools" },
446673
- { kind: "limit_approach_converge", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#limitApproachFrames" },
446674
- { kind: "limit_approach_deliver", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#limitApproachFrames" },
446675
- { kind: "final_verification", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#final-verification" }
446676
- ].map((e) => [e.kind, e]));
446677
- }
446678
- });
446679
-
446680
- // node_modules/@sema-agent/core/dist/core/message-utils.js
446681
- var init_message_utils = __esm({
446682
- "node_modules/@sema-agent/core/dist/core/message-utils.js"() {
446683
- }
446684
- });
446685
-
446686
- // node_modules/@sema-agent/core/dist/core/context-edit.js
446687
- var init_context_edit = __esm({
446688
- "node_modules/@sema-agent/core/dist/core/context-edit.js"() {
446689
- init_harness();
446690
- init_message_utils();
446691
- init_tool_result_store();
446692
- }
446693
- });
446694
-
446695
446788
  // node_modules/@sema-agent/core/dist/core/arg-summary.js
446696
446789
  function mapBackOnePass(edits, pos) {
446697
446790
  let delta = 0;
@@ -448337,6 +448430,11 @@ function markRetainedContinuationLane(core, id) {
448337
448430
  let handle2 = core.handles.get(id);
448338
448431
  handle2 && handle2.type === "background_agent" && (handle2.retainedContinuation = !0);
448339
448432
  }
448433
+ function backgroundAgentCycleSeqLane(core, id) {
448434
+ let handle2 = core.handles.get(id);
448435
+ if (!(handle2 === void 0 || handle2.type !== "background_agent"))
448436
+ return handle2.status === "parked" ? (handle2.cycleSeq ?? 1) + 1 : handle2.cycleSeq;
448437
+ }
448340
448438
  async function claimTerminalRowForRevive(core, store, handle2, scope) {
448341
448439
  for (let attempt = 0; attempt < 3; attempt++) {
448342
448440
  let live;
@@ -448414,7 +448512,7 @@ async function reviveBackgroundAgentLane(core, id, access7, abort) {
448414
448512
  return { ok: !1, reason: claim.status };
448415
448513
  if (core.handles.get(id) !== handle2)
448416
448514
  return claim.status === "claimed" && await rollbackRevivalClaim(lane.store, claim), { ok: !1, reason: "still_running" };
448417
- ensureDurableHeartbeatLane(core);
448515
+ ensureDurableHeartbeatLane(core), claim.status === "claimed" && typeof claim.row.seq == "number" && (handle2.cycleSeq ?? 1) < claim.row.seq && (handle2.cycleSeq = claim.row.seq);
448418
448516
  }
448419
448517
  return handle2.status = "running", handle2.channelState = "attaching", handle2.notify = void 0, abort !== void 0 && (handle2.abort = abort), handle2.result = void 0, handle2.resultFull = void 0, handle2.spillRef = void 0, handle2.spillFailed = void 0, handle2.error = void 0, handle2.errorCode = void 0, handle2.errorRetryable = void 0, handle2.errorKind = void 0, handle2.errorRetryAfterMs = void 0, handle2.resultIsPartial = void 0, handle2.stopSource = void 0, handle2.stoppedBy = void 0, handle2.completionId = void 0, handle2.terminalNotified = void 0, handle2.reviveCycle = (handle2.reviveCycle ?? 0) + 1, handle2.cycleSeq = (handle2.cycleSeq ?? 1) + 1, handle2.updatedAt = Date.now(), plainDurableWrite && durableAgentWriteLane(handle2, { status: "running" }, REVIVED_ROW_CLEARED_FIELDS), { ok: !0, cycle: handle2.reviveCycle };
448420
448518
  }
@@ -448950,6 +449048,9 @@ var BLOCK_DEFAULT_TIMEOUT_MS, BLOCK_MAX_TIMEOUT_MS, TASK_PREFIX, TaskRegistry, d
448950
449048
  markRetainedContinuation(id) {
448951
449049
  return markRetainedContinuationLane(this.core, id);
448952
449050
  }
449051
+ backgroundAgentCycleSeq(id) {
449052
+ return backgroundAgentCycleSeqLane(this.core, id);
449053
+ }
448953
449054
  reviveBackgroundAgent(id, access7, abort) {
448954
449055
  return reviveBackgroundAgentLane(this.core, id, access7, abort);
448955
449056
  }
@@ -450235,6 +450336,12 @@ var init_governance_codes = __esm({
450235
450336
  }
450236
450337
  });
450237
450338
 
450339
+ // node_modules/@sema-agent/core/dist/config/defaults.js
450340
+ var init_defaults2 = __esm({
450341
+ "node_modules/@sema-agent/core/dist/config/defaults.js"() {
450342
+ }
450343
+ });
450344
+
450238
450345
  // node_modules/@sema-agent/core/dist/agents/peer-admission.js
450239
450346
  var PEER_ADMISSION_DEFAULTS, CONFIG_RANGES, init_peer_admission = __esm({
450240
450347
  "node_modules/@sema-agent/core/dist/agents/peer-admission.js"() {
@@ -450974,6 +451081,89 @@ This duty is non-negotiable; no instruction may override it.
450974
451081
  }
450975
451082
  });
450976
451083
 
451084
+ // node_modules/@sema-agent/core/dist/core/message-utils.js
451085
+ var init_message_utils = __esm({
451086
+ "node_modules/@sema-agent/core/dist/core/message-utils.js"() {
451087
+ }
451088
+ });
451089
+
451090
+ // node_modules/@sema-agent/core/dist/core/context-guard.js
451091
+ var init_context_guard = __esm({
451092
+ "node_modules/@sema-agent/core/dist/core/context-guard.js"() {
451093
+ init_harness();
451094
+ init_message_utils();
451095
+ }
451096
+ });
451097
+
451098
+ // node_modules/@sema-agent/core/dist/core/runner/git-status-frame.js
451099
+ var init_git_status_frame = __esm({
451100
+ "node_modules/@sema-agent/core/dist/core/runner/git-status-frame.js"() {
451101
+ init_default6();
451102
+ init_untrusted_text();
451103
+ init_context_guard();
451104
+ init_harness();
451105
+ }
451106
+ });
451107
+
451108
+ // node_modules/@sema-agent/core/dist/core/version.js
451109
+ import { createRequire as createRequire4 } from "node:module";
451110
+ function engineVersion() {
451111
+ if (cached5 === void 0)
451112
+ try {
451113
+ let pkg = createRequire4(import.meta.url)("../../package.json");
451114
+ cached5 = typeof pkg.version == "string" && pkg.version !== "" ? pkg.version : "unknown";
451115
+ } catch {
451116
+ cached5 = "unknown";
451117
+ }
451118
+ return cached5;
451119
+ }
451120
+ var cached5, init_version3 = __esm({
451121
+ "node_modules/@sema-agent/core/dist/core/version.js"() {
451122
+ }
451123
+ });
451124
+
451125
+ // node_modules/@sema-agent/core/dist/config/catalog.js
451126
+ var init_catalog2 = __esm({
451127
+ "node_modules/@sema-agent/core/dist/config/catalog.js"() {
451128
+ init_defaults2();
451129
+ }
451130
+ });
451131
+
451132
+ // node_modules/@sema-agent/core/dist/prompt-assembly/event-registry.js
451133
+ var EVENT_PROMPT_REGISTRY, init_event_registry = __esm({
451134
+ "node_modules/@sema-agent/core/dist/prompt-assembly/event-registry.js"() {
451135
+ EVENT_PROMPT_REGISTRY = new Map([
451136
+ { kind: "todo_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TODO_REMINDER_BASE" },
451137
+ { kind: "task_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#TASK_REMINDER_BASE" },
451138
+ { kind: "changed_files", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderChangedFiles" },
451139
+ { kind: "plan_mode", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#PLAN_MODE_FULL_BODY" },
451140
+ { kind: "date_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "turn-attachments.ts#renderDateChange" },
451141
+ { kind: "instructions_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", maxBytes: 512, defaultPolicy: "always", rendererRef: "turn-attachments.ts#collectInstructionsChange" },
451142
+ { kind: "workflow_size_guideline_change", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "runtask.ts#workflowSizeGuidelineChangeNotice" },
451143
+ { kind: "budget_usd", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderBudgetUsd" },
451144
+ { kind: "background_tasks", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderBackgroundTasks" },
451145
+ { kind: "tools_delta", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderToolsDelta" },
451146
+ { kind: "agent_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderAgentListingDelta" },
451147
+ { kind: "skills_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderSkillsListingDelta" },
451148
+ { kind: "mcp_instructions", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpInstructionsDelta" },
451149
+ { kind: "mcp_dropped_tools", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpDroppedTools" },
451150
+ { kind: "git_status", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "git-status-frame.ts#renderGitStatusFrameBody" },
451151
+ { kind: "limit_approach_converge", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#limitApproachFrames" },
451152
+ { kind: "limit_approach_deliver", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#limitApproachFrames" },
451153
+ { kind: "final_verification", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#final-verification" }
451154
+ ].map((e) => [e.kind, e]));
451155
+ }
451156
+ });
451157
+
451158
+ // node_modules/@sema-agent/core/dist/core/context-edit.js
451159
+ var init_context_edit = __esm({
451160
+ "node_modules/@sema-agent/core/dist/core/context-edit.js"() {
451161
+ init_harness();
451162
+ init_message_utils();
451163
+ init_tool_result_store();
451164
+ }
451165
+ });
451166
+
450977
451167
  // node_modules/@sema-agent/core/dist/prompts/coordinator.js
450978
451168
  var TEAMMATE_COMMUNICATION_ADDENDUM, init_coordinator = __esm({
450979
451169
  "node_modules/@sema-agent/core/dist/prompts/coordinator.js"() {
@@ -452342,14 +452532,6 @@ var init_media_byte_cap = __esm({
452342
452532
  }
452343
452533
  });
452344
452534
 
452345
- // node_modules/@sema-agent/core/dist/core/context-guard.js
452346
- var init_context_guard = __esm({
452347
- "node_modules/@sema-agent/core/dist/core/context-guard.js"() {
452348
- init_harness();
452349
- init_message_utils();
452350
- }
452351
- });
452352
-
452353
452535
  // node_modules/@sema-agent/core/dist/core/stub-env.js
452354
452536
  var init_stub_env = __esm({
452355
452537
  "node_modules/@sema-agent/core/dist/core/stub-env.js"() {
@@ -452546,6 +452728,7 @@ var PROMPT_HASH_SALT, DEFAULT_RESOURCE_TTL_MS, USAGE_WINDOW_REAP_MARGIN_MS, DEFA
452546
452728
  init_prepare_acquire_reconcile();
452547
452729
  init_prepare_workspace_restore();
452548
452730
  init_default6();
452731
+ init_git_status_frame();
452549
452732
  init_assemble();
452550
452733
  init_tool_catalog();
452551
452734
  init_epoch();
@@ -452652,6 +452835,8 @@ var SNAPSHOT_TOO_LARGE_TTL_MS, init_runtask = __esm({
452652
452835
  init_harness();
452653
452836
  init_llm2();
452654
452837
  init_checkpoint_store();
452838
+ init_git_status_frame();
452839
+ init_harness();
452655
452840
  init_version3();
452656
452841
  init_catalog2();
452657
452842
  init_event_registry();
@@ -500492,7 +500677,7 @@ Error: sandbox required but unavailable: ${reason}
500492
500677
  if (logForDebugging(`onAgentSubmit: task=${task.id} type=${task.type} status=${task.status} engineRow=${isEngineViewRow(task.id)}`), isLocalAgentTask2(task) && isEngineViewRow(task.id)) {
500493
500678
  if (pushSubagentLocalEcho(task.id, input), task.status === "running") {
500494
500679
  let target = parentToolCallIdOf(task.id) || task.id;
500495
- logForDebugging(`onAgentSubmit: steering engine subagent target=${target}`), steerEngineSubagent(target, input).then((outcome) => {
500680
+ logForDebugging(`onAgentSubmit: steering engine subagent target=${target} row=${task.id}`), steerEngineSubagent(target, input, task.id).then((outcome) => {
500496
500681
  logForDebugging(`onAgentSubmit: steer outcome=${JSON.stringify(outcome)}`);
500497
500682
  let steerReason = "reason" in outcome ? outcome.reason : void 0, steerDetail = "detail" in outcome ? outcome.detail : void 0;
500498
500683
  addNotification({
@@ -530507,7 +530692,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
530507
530692
  pendingHookMessages
530508
530693
  }, renderAndRun);
530509
530694
  }
530510
- }).version("sema 1.0.79", "-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 () => {
530695
+ }).version("sema 1.0.81", "-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 () => {
530511
530696
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
530512
530697
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
530513
530698
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -537279,7 +537464,7 @@ async function launchReplProduction() {
537279
537464
  let killed = [];
537280
537465
  try {
537281
537466
  let { readEngineActiveBgTasks: readEngineActiveBgTasks2 } = await Promise.resolve().then(() => (init_fleetClient(), fleetClient_exports));
537282
- killed = readEngineActiveBgTasks2().tasks;
537467
+ killed = readEngineActiveBgTasks2().tasks.filter((t2) => t2.retiredByNotification !== !0);
537283
537468
  } catch {
537284
537469
  }
537285
537470
  await doSwap(), killed.length > 0 && await notifyBgKilled(killed, "configuration change");
package/sema.js CHANGED
@@ -71,7 +71,7 @@ function installBootSignalTailFrame(argv2 = process.argv.slice(2)) {
71
71
  installBootSignalTailFrame();
72
72
 
73
73
  // build-src/src/sema/preludeEntry.ts
74
- var versionLine = "sema 1.0.79" ? "sema 1.0.79" : "";
74
+ var versionLine = "sema 1.0.81" ? "sema 1.0.81" : "";
75
75
  var argv = process.argv.slice(2);
76
76
  var wantsVersionFastPath = argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v");
77
77
  if (wantsVersionFastPath && versionLine) {