@sema-agent/cli 1.0.46 → 1.0.47

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.
Files changed (3) hide show
  1. package/npm-shrinkwrap.json +13 -13
  2. package/package.json +4 -4
  3. package/sema.js +190 -38
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sema-agent/cli",
9
- "version": "1.0.46",
9
+ "version": "1.0.47",
10
10
  "license": "BUSL-1.1",
11
11
  "dependencies": {
12
- "@sema-agent/sdk": "0.0.64",
13
- "@sema-agent/server": "1.243.0"
12
+ "@sema-agent/sdk": "0.0.65",
13
+ "@sema-agent/server": "1.244.0"
14
14
  },
15
15
  "bin": {
16
16
  "sema": "sema.js"
@@ -20,9 +20,9 @@
20
20
  }
21
21
  },
22
22
  "node_modules/@bufbuild/protobuf": {
23
- "version": "2.12.1",
24
- "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.12.1.tgz",
25
- "integrity": "sha512-BvAMfS6LrgZiryOAZ4pBYucu4wG/Ei/9o9DZ9akbREnMLbPJiom2i8b9C8IsKErQoiKqVhrerzt3kOT/RrzLHg==",
23
+ "version": "2.13.0",
24
+ "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.13.0.tgz",
25
+ "integrity": "sha512-acq7c49vxfm1ggJ95P70TX7ABDM0vxr1SYD3BB0o0jnBLB4OAqeHyKuN+cD3w80gXEDQ2zxHpR6CUeA+O/aU9g==",
26
26
  "license": "(Apache-2.0 AND BSD-3-Clause)"
27
27
  },
28
28
  "node_modules/@connectrpc/connect": {
@@ -669,18 +669,18 @@
669
669
  }
670
670
  },
671
671
  "node_modules/@sema-agent/sdk": {
672
- "version": "0.0.64",
673
- "resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.64.tgz",
674
- "integrity": "sha512-1sxthy2IjoSf+4f0pAXJlEmAoG+YgQP4gBAoMbKdFwt2wxNJbJ5yQKGm8u0FoeSGcnLRzHsi5LdelTKwxvb2dQ==",
672
+ "version": "0.0.65",
673
+ "resolved": "https://registry.npmjs.org/@sema-agent/sdk/-/sdk-0.0.65.tgz",
674
+ "integrity": "sha512-VtsGEucn5T4Zxt4cK6n4Cy/YQ2e1XPMLUK9jq1hsMPjAbCAh7K2spEq1eAG2p+joa45QbCV2mc7PZ54LQfj+SA==",
675
675
  "license": "BUSL-1.1",
676
676
  "engines": {
677
677
  "node": ">=20"
678
678
  }
679
679
  },
680
680
  "node_modules/@sema-agent/server": {
681
- "version": "1.243.0",
682
- "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.243.0.tgz",
683
- "integrity": "sha512-DupPRb2H3nb59NH4+ltvKYOlgZJO6FqD3sf5EwjN8+DQfEbSl80pnxcn7SvKZurIRC2qQY+WdAVN5mymlMRc2g==",
681
+ "version": "1.244.0",
682
+ "resolved": "https://registry.npmjs.org/@sema-agent/server/-/server-1.244.0.tgz",
683
+ "integrity": "sha512-tJriflvKBu90uRwvZRHPYlvLt2XPLu1PFQYXu0Nt+ae07Ln/C3Xr4XxsvyrOJSfzXxl9iAG/wildncR/vg5ytw==",
684
684
  "license": "BUSL-1.1",
685
685
  "dependencies": {
686
686
  "@sema-agent/core": "^1.361.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/cli",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "Sema — your own Claude Code-grade coding agent, in the terminal.",
5
5
  "license": "BUSL-1.1",
6
6
  "bin": {
@@ -21,14 +21,14 @@
21
21
  "sema"
22
22
  ],
23
23
  "dependencies": {
24
- "@sema-agent/sdk": "0.0.64",
25
- "@sema-agent/server": "1.243.0"
24
+ "@sema-agent/sdk": "0.0.65",
25
+ "@sema-agent/server": "1.244.0"
26
26
  },
27
27
  "overrides": {
28
28
  "@sema-agent/core": "1.363.0",
29
29
  "@sema-agent/registry-core": "0.10.21"
30
30
  },
31
- "semaEngineVersion": "server 1.243.0 / core 1.363.0 / registry-core 0.10.21",
31
+ "semaEngineVersion": "server 1.244.0 / core 1.363.0 / registry-core 0.10.21",
32
32
  "engines": {
33
33
  "node": ">=18"
34
34
  }
package/sema.js CHANGED
@@ -35959,19 +35959,19 @@ var init_index_min = __esm({
35959
35959
  // build-src/src/utils/memoize.ts
35960
35960
  function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
35961
35961
  const cache6 = /* @__PURE__ */ new Map();
35962
- const inFlight2 = /* @__PURE__ */ new Map();
35962
+ const inFlight3 = /* @__PURE__ */ new Map();
35963
35963
  const memoized = async (...args) => {
35964
35964
  const key = jsonStringify(args);
35965
35965
  const cached5 = cache6.get(key);
35966
35966
  const now2 = Date.now();
35967
35967
  if (!cached5) {
35968
- const pending = inFlight2.get(key);
35968
+ const pending = inFlight3.get(key);
35969
35969
  if (pending) return pending;
35970
35970
  const promise2 = f(...args);
35971
- inFlight2.set(key, promise2);
35971
+ inFlight3.set(key, promise2);
35972
35972
  try {
35973
35973
  const result = await promise2;
35974
- if (inFlight2.get(key) === promise2) {
35974
+ if (inFlight3.get(key) === promise2) {
35975
35975
  cache6.set(key, {
35976
35976
  value: result,
35977
35977
  timestamp: now2,
@@ -35980,8 +35980,8 @@ function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
35980
35980
  }
35981
35981
  return result;
35982
35982
  } finally {
35983
- if (inFlight2.get(key) === promise2) {
35984
- inFlight2.delete(key);
35983
+ if (inFlight3.get(key) === promise2) {
35984
+ inFlight3.delete(key);
35985
35985
  }
35986
35986
  }
35987
35987
  }
@@ -36009,7 +36009,7 @@ function memoizeWithTTLAsync(f, cacheLifetimeMs = 5 * 60 * 1e3) {
36009
36009
  memoized.cache = {
36010
36010
  clear: () => {
36011
36011
  cache6.clear();
36012
- inFlight2.clear();
36012
+ inFlight3.clear();
36013
36013
  }
36014
36014
  };
36015
36015
  return memoized;
@@ -122328,6 +122328,17 @@ function recordBgTerminalFacts(taskId, facts) {
122328
122328
  function getBgTerminalFacts(taskId) {
122329
122329
  return bgFacts.get(taskId) ?? bgFacts.get(taskToParent.get(taskId) ?? "");
122330
122330
  }
122331
+ function recordBgParentRun(taskId, runId) {
122332
+ if (!taskId || !runId || taskId === runId) return;
122333
+ if (bgParentRun.size >= MAX_TASKS * 2 && !bgParentRun.has(taskId)) {
122334
+ const oldest = bgParentRun.keys().next().value;
122335
+ if (oldest !== void 0) bgParentRun.delete(oldest);
122336
+ }
122337
+ bgParentRun.set(taskId, runId);
122338
+ }
122339
+ function getBgParentRun(taskId) {
122340
+ return bgParentRun.get(taskId);
122341
+ }
122331
122342
  function subscribeSubagentContent(fn2) {
122332
122343
  notifyListener = fn2;
122333
122344
  for (const id of tasks.keys()) pendingNotify.add(id);
@@ -122336,7 +122347,7 @@ function subscribeSubagentContent(fn2) {
122336
122347
  if (notifyListener === fn2) notifyListener = null;
122337
122348
  };
122338
122349
  }
122339
- var MAX_ITEMS_PER_TASK, MAX_TASKS, NOTIFY_COALESCE_MS, tasks, parentToTask, taskToParent, notifyListener, pendingNotify, notifyTimer, bgFacts;
122350
+ var MAX_ITEMS_PER_TASK, MAX_TASKS, NOTIFY_COALESCE_MS, tasks, parentToTask, taskToParent, notifyListener, pendingNotify, notifyTimer, bgFacts, bgParentRun;
122340
122351
  var init_subagentContentStore = __esm({
122341
122352
  "build-src/src/sema/subagentContentStore.ts"() {
122342
122353
  MAX_ITEMS_PER_TASK = 200;
@@ -122349,6 +122360,7 @@ var init_subagentContentStore = __esm({
122349
122360
  pendingNotify = /* @__PURE__ */ new Set();
122350
122361
  notifyTimer = null;
122351
122362
  bgFacts = /* @__PURE__ */ new Map();
122363
+ bgParentRun = /* @__PURE__ */ new Map();
122352
122364
  }
122353
122365
  });
122354
122366
 
@@ -159355,7 +159367,7 @@ var init_ultracodeWireCaps = __esm({
159355
159367
  "build-src/src/sema/ultracodeWireCaps.ts"() {
159356
159368
  ultracodePreset = false;
159357
159369
  ULTRACODE_KEYWORD = /\bultracode\b/i;
159358
- WORKFLOW_KEYWORD = /\bworkflows?\b/i;
159370
+ WORKFLOW_KEYWORD = /\bworkflows?\b|\bagent[ -]?teams?\b|\bmulti[ -]?agent\b|\bswarms?\b|多\s?agent|多智能体|编排/i;
159359
159371
  WORKFLOW_DEFER_ENV = "SEMA_WORKFLOW_DEFER";
159360
159372
  DEFER_TOOLS_ENV = "SEMA_DEFER_TOOLS";
159361
159373
  DEFER_LOWFREQ_ENV = "SEMA_DEFER_LOWFREQ";
@@ -167309,6 +167321,9 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
167309
167321
  if (frame.row?.id) {
167310
167322
  taskMap.set(frame.row.id, frame.row);
167311
167323
  rowMeta.set(frame.row.id, { receivedAt: Date.now() });
167324
+ if (frame.row.parentId) {
167325
+ recordBgParentRun(fleetRowTaskId(frame.row.id), fleetRowTaskId(frame.row.parentId));
167326
+ }
167312
167327
  if (TERMINAL_FLEET_TASK_STATUSES.has(frame.row.status ?? "")) {
167313
167328
  retained.set(frame.row.id, {
167314
167329
  row: frame.row,
@@ -167336,6 +167351,9 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
167336
167351
  }
167337
167352
  if (TERMINAL_FLEET_TASK_STATUSES.has(n2.status)) {
167338
167353
  const nn = n2;
167354
+ if (typeof nn.parentTaskId === "string" && nn.parentTaskId) {
167355
+ recordBgParentRun(n2.taskId, nn.parentTaskId);
167356
+ }
167339
167357
  recordBgTerminalFacts(n2.taskId, {
167340
167358
  status: n2.status,
167341
167359
  ...typeof nn.summary === "string" ? { summary: nn.summary } : {},
@@ -356591,7 +356609,7 @@ var init_classifierApprovalsHook = __esm({
356591
356609
  var React29, SentryErrorBoundary;
356592
356610
  var init_SentryErrorBoundary = __esm({
356593
356611
  "build-src/src/components/SentryErrorBoundary.ts"() {
356594
- React29 = __toESM(require_react(), 1);
356612
+ React29 = __toESM(require_react());
356595
356613
  SentryErrorBoundary = class extends React29.Component {
356596
356614
  constructor(props) {
356597
356615
  super(props);
@@ -373571,7 +373589,7 @@ var require_connection2 = __commonJS({
373571
373589
  let unknownResponseSequenceNumber = 0;
373572
373590
  const version4 = "2.0";
373573
373591
  const maxParallelism = options?.maxParallelism ?? -1;
373574
- let inFlight2 = 0;
373592
+ let inFlight3 = 0;
373575
373593
  let starRequestHandler = void 0;
373576
373594
  const requestHandlers = /* @__PURE__ */ new Map();
373577
373595
  let starNotificationHandler = void 0;
@@ -373653,7 +373671,7 @@ var require_connection2 = __commonJS({
373653
373671
  if (timer2 || messageQueue.size === 0) {
373654
373672
  return;
373655
373673
  }
373656
- if (maxParallelism !== -1 && inFlight2 >= maxParallelism) {
373674
+ if (maxParallelism !== -1 && inFlight3 >= maxParallelism) {
373657
373675
  return;
373658
373676
  }
373659
373677
  timer2 = (0, ral_1.default)().timer.setImmediate(async () => {
@@ -373661,13 +373679,13 @@ var require_connection2 = __commonJS({
373661
373679
  if (messageQueue.size === 0) {
373662
373680
  return;
373663
373681
  }
373664
- if (maxParallelism !== -1 && inFlight2 >= maxParallelism) {
373682
+ if (maxParallelism !== -1 && inFlight3 >= maxParallelism) {
373665
373683
  return;
373666
373684
  }
373667
373685
  const message = messageQueue.shift();
373668
373686
  let result;
373669
373687
  try {
373670
- inFlight2++;
373688
+ inFlight3++;
373671
373689
  const messageStrategy = options?.messageStrategy;
373672
373690
  if (MessageStrategy.is(messageStrategy)) {
373673
373691
  result = messageStrategy.handleMessage(message, handleMessage2);
@@ -373679,13 +373697,13 @@ var require_connection2 = __commonJS({
373679
373697
  } finally {
373680
373698
  if (result instanceof Promise) {
373681
373699
  result.then(() => {
373682
- inFlight2--;
373700
+ inFlight3--;
373683
373701
  triggerMessageQueue();
373684
373702
  }).catch((error51) => {
373685
373703
  logger.error(`Processing message queue failed: ${error51.toString()}`);
373686
373704
  });
373687
373705
  } else {
373688
- inFlight2--;
373706
+ inFlight3--;
373689
373707
  }
373690
373708
  triggerMessageQueue();
373691
373709
  }
@@ -451789,7 +451807,7 @@ function Settings({
451789
451807
  var import_react113, import_jsx_runtime193;
451790
451808
  var init_cmd_config = __esm({
451791
451809
  "build-src/src/sema/overrides/cmd-config.tsx"() {
451792
- import_react113 = __toESM(require_react(), 1);
451810
+ import_react113 = __toESM(require_react());
451793
451811
  init_useKeybinding();
451794
451812
  init_useExitOnCtrlCDWithKeybindings();
451795
451813
  init_useTerminalSize();
@@ -451800,7 +451818,7 @@ var init_cmd_config = __esm({
451800
451818
  init_Config();
451801
451819
  init_settings_usage();
451802
451820
  init_Stats();
451803
- import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1);
451821
+ import_jsx_runtime193 = __toESM(require_jsx_runtime());
451804
451822
  }
451805
451823
  });
451806
451824
 
@@ -480593,15 +480611,14 @@ var init_sema_brand = __esm({
480593
480611
  _doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
480594
480612
  version: "2.1.187",
480595
480613
  notes: [
480596
- "Background/fork agents: elapsed time now ticks while they run (the engine only reports on activity; the shell keeps the clock honest in between)",
480597
- "Completed agents no longer vanish instantly \u2014 they stay in the agents tree for a minute and the completed counter finally counts them",
480598
- "Enter on an agent in the full-screen agents view now opens its transcript (it used to just refilter the tree)",
480599
- "Finished background agents show their recent tool steps and outcome when you open them; the waiting placeholder now tells the truth about what will appear",
480600
- "Product self-knowledge now rides the engine's first-class appendSystemPrompt lane (engine 1.243.0), freeing output styles for their real job"
480614
+ "Finished background agents now show their real final reply when you open them (engine 1.244.0 read surface; falls back to the step summary on older engines)",
480615
+ "Saying 'agent team', 'multi-agent' or 'swarm' now surfaces the Workflow orchestrator that was previously hidden behind the word 'workflow' alone",
480616
+ "Long-conversation compaction can now run on your cheap model slot (MODEL_CHEAP_ID) instead of burning the main model, when the engine supports it",
480617
+ "update-config skill now knows about the 'auto' permission mode"
480601
480618
  ]
480602
480619
  },
480603
- productVersion: "1.0.46",
480604
- announcement: "sema 1.0.46 \u2014 Background agents are now fully observable: elapsed time ticks live, completed agents stay listed (with a completed count) instead of vanishing, pressing enter on an agent in the agents view now really opens its transcript, and finished background agents show their recent steps and outcome. Ships on engine 1.243.0."
480620
+ productVersion: "1.0.47",
480621
+ announcement: "sema 1.0.47 \u2014 Opening a finished background agent now shows its real final reply (new engine read surface, engine 1.244.0), and asking for an agent team / multi-agent run now routes to the Workflow orchestrator instead of improvised forks."
480605
480622
  };
480606
480623
  }
480607
480624
  });
@@ -483530,15 +483547,14 @@ var require_sema_brand = __commonJS({
483530
483547
  _doc: "Rendered as the 'What's new' feed (createWhatsNewFeed). Top version MUST be >= current app version (2.1.187) and newer than config.lastReleaseNotesSeen so the notes display and full-logo mode triggers. Pinned == app version (2.1.187) + lastReleaseNotesSeen (loginState.ts) so getRecentReleaseNotes()===[] \u2192 condensed logo (matches refs/chrome.empty-input.json).",
483531
483548
  version: "2.1.187",
483532
483549
  notes: [
483533
- "Background/fork agents: elapsed time now ticks while they run (the engine only reports on activity; the shell keeps the clock honest in between)",
483534
- "Completed agents no longer vanish instantly \u2014 they stay in the agents tree for a minute and the completed counter finally counts them",
483535
- "Enter on an agent in the full-screen agents view now opens its transcript (it used to just refilter the tree)",
483536
- "Finished background agents show their recent tool steps and outcome when you open them; the waiting placeholder now tells the truth about what will appear",
483537
- "Product self-knowledge now rides the engine's first-class appendSystemPrompt lane (engine 1.243.0), freeing output styles for their real job"
483550
+ "Finished background agents now show their real final reply when you open them (engine 1.244.0 read surface; falls back to the step summary on older engines)",
483551
+ "Saying 'agent team', 'multi-agent' or 'swarm' now surfaces the Workflow orchestrator that was previously hidden behind the word 'workflow' alone",
483552
+ "Long-conversation compaction can now run on your cheap model slot (MODEL_CHEAP_ID) instead of burning the main model, when the engine supports it",
483553
+ "update-config skill now knows about the 'auto' permission mode"
483538
483554
  ]
483539
483555
  },
483540
- productVersion: "1.0.46",
483541
- announcement: "sema 1.0.46 \u2014 Background agents are now fully observable: elapsed time ticks live, completed agents stay listed (with a completed count) instead of vanishing, pressing enter on an agent in the agents view now really opens its transcript, and finished background agents show their recent steps and outcome. Ships on engine 1.243.0."
483556
+ productVersion: "1.0.47",
483557
+ announcement: "sema 1.0.47 \u2014 Opening a finished background agent now shows its real final reply (new engine read surface, engine 1.244.0), and asking for an agent team / multi-agent run now routes to the Workflow orchestrator instead of improvised forks."
483542
483558
  };
483543
483559
  }
483544
483560
  });
@@ -562314,6 +562330,66 @@ var init_fleetFooter = __esm({
562314
562330
  }
562315
562331
  });
562316
562332
 
562333
+ // build-src/src/sema/engineSubagentOutput.ts
562334
+ function wireConfig3() {
562335
+ const baseUrl = process.env.SEMA_LIVE_BASEURL;
562336
+ if (!baseUrl) return null;
562337
+ return {
562338
+ baseUrl,
562339
+ token: process.env.SEMA_LIVE_TOKEN,
562340
+ principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
562341
+ };
562342
+ }
562343
+ async function subagentOutputCapable(client4, baseUrl, signal) {
562344
+ const hit = capByBase.get(baseUrl);
562345
+ if (hit && (hit.ok || Date.now() - hit.at < CAP_FALSE_RETRY_TTL_MS2)) return hit.ok;
562346
+ try {
562347
+ const caps = await client4.capabilities({ signal });
562348
+ const ok2 = caps.subagentOutput === true;
562349
+ capByBase.set(baseUrl, { ok: ok2, at: Date.now() });
562350
+ return ok2;
562351
+ } catch {
562352
+ return false;
562353
+ }
562354
+ }
562355
+ async function fetchEngineSubagentReport(taskId, opts) {
562356
+ const cfg = wireConfig3();
562357
+ if (!cfg) return null;
562358
+ const runId = getBgParentRun(taskId) ?? getActiveEngineTaskId();
562359
+ if (!runId) return null;
562360
+ const client4 = makeEngineWireClient({
562361
+ baseUrl: cfg.baseUrl,
562362
+ ...cfg.token ? { token: cfg.token } : {},
562363
+ principal: cfg.principal
562364
+ });
562365
+ if (!client4) return null;
562366
+ if (!await subagentOutputCapable(client4, cfg.baseUrl, opts?.signal)) return null;
562367
+ try {
562368
+ const r = await client4.runs.subagentOutput(runId, taskId, opts);
562369
+ const content = typeof r?.content === "string" ? r.content : "";
562370
+ if (!content.trim()) return null;
562371
+ const status3 = typeof r?.output?.status === "string" ? r.output.status : void 0;
562372
+ return { content, ...status3 !== void 0 ? { status: status3 } : {} };
562373
+ } catch (e) {
562374
+ const status3 = e?.status;
562375
+ logForDebugging(
562376
+ `[subagent-output] ${taskId} via run ${runId}: ${typeof status3 === "number" ? status3 : String(e).slice(0, 160)}`
562377
+ );
562378
+ return null;
562379
+ }
562380
+ }
562381
+ var capByBase, CAP_FALSE_RETRY_TTL_MS2;
562382
+ var init_engineSubagentOutput = __esm({
562383
+ "build-src/src/sema/engineSubagentOutput.ts"() {
562384
+ init_debug();
562385
+ init_engineWireSdk();
562386
+ init_subagentContentStore();
562387
+ init_engineToolDetach();
562388
+ capByBase = /* @__PURE__ */ new Map();
562389
+ CAP_FALSE_RETRY_TTL_MS2 = 5 * 6e4;
562390
+ }
562391
+ });
562392
+
562317
562393
  // build-src/src/sema/engineAgentView.ts
562318
562394
  function isLocalAgent2(task) {
562319
562395
  return typeof task === "object" && task !== null && "type" in task && task.type === "local_agent";
@@ -562451,6 +562527,35 @@ function seedEngineAgentTranscript(setAppState, taskId) {
562451
562527
  };
562452
562528
  });
562453
562529
  }
562530
+ function hydrateEngineAgentReport(store, taskId) {
562531
+ if (reportHydrateInFlight.has(taskId)) return;
562532
+ const t2 = store.getState().tasks[taskId];
562533
+ if (!isLocalAgent2(t2) || !isTerminalTaskStatus(t2.status)) return;
562534
+ if (!isEngineViewRow(taskId)) return;
562535
+ if (reportTextOf(t2)) return;
562536
+ reportHydrateInFlight.add(taskId);
562537
+ void fetchEngineSubagentReport(taskId).then((r) => {
562538
+ if (!r || !r.content.trim()) {
562539
+ reportHydrateInFlight.delete(taskId);
562540
+ return;
562541
+ }
562542
+ if (r.status !== void 0 && !["completed", "failed", "killed"].includes(r.status)) {
562543
+ reportHydrateInFlight.delete(taskId);
562544
+ return;
562545
+ }
562546
+ store.setState((prev) => {
562547
+ const cur = prev.tasks[taskId];
562548
+ if (!isLocalAgent2(cur) || reportTextOf(cur)) return prev;
562549
+ const next = {
562550
+ ...cur,
562551
+ result: makeEngineAgentResult(r.content, cur),
562552
+ messages: void 0
562553
+ };
562554
+ return { ...prev, tasks: { ...prev.tasks, [taskId]: next } };
562555
+ });
562556
+ seedEngineAgentTranscript(store.setState, taskId);
562557
+ }).catch(() => reportHydrateInFlight.delete(taskId));
562558
+ }
562454
562559
  function coerceStubStatus(s) {
562455
562560
  switch (s) {
562456
562561
  case "completed":
@@ -562509,6 +562614,7 @@ function enterFleetAgentView(row2, store) {
562509
562614
  }
562510
562615
  enterTeammateView(taskId, store.setState);
562511
562616
  seedEngineAgentTranscript(store.setState, taskId);
562617
+ hydrateEngineAgentReport(store, taskId);
562512
562618
  }
562513
562619
  function exitAgentViewToMain(store) {
562514
562620
  const viewed = store.getState().viewingAgentTaskId;
@@ -562531,6 +562637,7 @@ function useEngineAgentViewSeeder(store) {
562531
562637
  }
562532
562638
  if (viewingId !== void 0) {
562533
562639
  seedEngineAgentTranscript(store.setState, viewingId);
562640
+ hydrateEngineAgentReport(store, viewingId);
562534
562641
  }
562535
562642
  }, [viewingId, store]);
562536
562643
  const releaseTicksRef = React114.useRef(0);
@@ -562566,6 +562673,7 @@ function useEngineAgentViewSeeder(store) {
562566
562673
  return { ...prev, tasks: { ...prev.tasks, [viewingId]: next } };
562567
562674
  });
562568
562675
  seedEngineAgentTranscript(store.setState, viewingId);
562676
+ hydrateEngineAgentReport(store, viewingId);
562569
562677
  }
562570
562678
  const released = (row2 === void 0 || isTerminal3) && sawLive;
562571
562679
  if (!released) {
@@ -562584,7 +562692,7 @@ function useEngineAgentViewSeeder(store) {
562584
562692
  return () => clearInterval(timer2);
562585
562693
  }, [viewingId, store]);
562586
562694
  }
562587
- var React114, engineOwnedRowIds, fleetViewStubRowIds;
562695
+ var React114, engineOwnedRowIds, fleetViewStubRowIds, reportHydrateInFlight;
562588
562696
  var init_engineAgentView = __esm({
562589
562697
  "build-src/src/sema/engineAgentView.ts"() {
562590
562698
  React114 = __toESM(require_react(), 1);
@@ -562595,8 +562703,10 @@ var init_engineAgentView = __esm({
562595
562703
  init_fleetFooter();
562596
562704
  init_debug();
562597
562705
  init_subagentContentStore();
562706
+ init_engineSubagentOutput();
562598
562707
  engineOwnedRowIds = /* @__PURE__ */ new Set();
562599
562708
  fleetViewStubRowIds = /* @__PURE__ */ new Set();
562709
+ reportHydrateInFlight = /* @__PURE__ */ new Set();
562600
562710
  }
562601
562711
  });
562602
562712
 
@@ -570638,7 +570748,7 @@ var init_rewindArm = __esm({
570638
570748
  });
570639
570749
 
570640
570750
  // build-src/src/sema/engineSubagentSteer.ts
570641
- function wireConfig3() {
570751
+ function wireConfig4() {
570642
570752
  const baseUrl = process.env.SEMA_LIVE_BASEURL;
570643
570753
  if (!baseUrl) return null;
570644
570754
  return {
@@ -570648,7 +570758,7 @@ function wireConfig3() {
570648
570758
  };
570649
570759
  }
570650
570760
  async function steerEngineSubagent(target, text2) {
570651
- const cfg = wireConfig3();
570761
+ const cfg = wireConfig4();
570652
570762
  if (!cfg) return { ok: false, reason: "no-wire" };
570653
570763
  const runId = getActiveEngineTaskId();
570654
570764
  if (!runId) return { ok: false, reason: "no-run" };
@@ -609564,8 +609674,8 @@ function _temp161() {
609564
609674
  var import_compiler_runtime316, import_react314, SETTINGS_ERRORS_NOTIFICATION_KEY;
609565
609675
  var init_useSettingsErrors = __esm({
609566
609676
  "build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
609567
- import_compiler_runtime316 = __toESM(require_compiler_runtime());
609568
- import_react314 = __toESM(require_react());
609677
+ import_compiler_runtime316 = __toESM(require_compiler_runtime(), 1);
609678
+ import_react314 = __toESM(require_react(), 1);
609569
609679
  init_notifications();
609570
609680
  init_state();
609571
609681
  init_allErrors();
@@ -630262,6 +630372,34 @@ var init_headlessReconnectWire = __esm({
630262
630372
  }
630263
630373
  });
630264
630374
 
630375
+ // build-src/src/sema/engineCapsCache.ts
630376
+ function kickEngineCapsProbe(baseUrl, probe3) {
630377
+ if (!baseUrl || capsByBase.has(baseUrl) || inFlight2.has(baseUrl)) return;
630378
+ inFlight2.add(baseUrl);
630379
+ void (async () => {
630380
+ try {
630381
+ const caps = await probe3();
630382
+ if (caps && typeof caps === "object") {
630383
+ capsByBase.set(baseUrl, caps);
630384
+ }
630385
+ } catch {
630386
+ } finally {
630387
+ inFlight2.delete(baseUrl);
630388
+ }
630389
+ })();
630390
+ }
630391
+ function engineCapTrue(baseUrl, key) {
630392
+ if (!baseUrl) return false;
630393
+ return capsByBase.get(baseUrl)?.[key] === true;
630394
+ }
630395
+ var capsByBase, inFlight2;
630396
+ var init_engineCapsCache = __esm({
630397
+ "build-src/src/sema/engineCapsCache.ts"() {
630398
+ capsByBase = /* @__PURE__ */ new Map();
630399
+ inFlight2 = /* @__PURE__ */ new Set();
630400
+ }
630401
+ });
630402
+
630265
630403
  // build-src/src/sema/liveClient.ts
630266
630404
  var liveClient_exports = {};
630267
630405
  __export(liveClient_exports, {
@@ -630334,6 +630472,14 @@ function toLiveRequest(req, capturedSessionId) {
630334
630472
  const settings2 = out6.settings ?? {};
630335
630473
  out6.settings = { ...settings2, outputStyle: withSelfKnowledgeOutputStyle(settings2.outputStyle) };
630336
630474
  }
630475
+ if (out6.compactionModel === void 0) {
630476
+ const cheap = process.env.MODEL_CHEAP_ID?.trim();
630477
+ if (cheap && engineCapTrue(liveCapsBaseUrl, "compactionModel")) {
630478
+ const cat2 = getLiveModelCatalog();
630479
+ const inCatalog = cat2?.models.some((m2) => m2.name === cheap || m2.id === cheap) === true;
630480
+ if (inCatalog) out6.compactionModel = cheap;
630481
+ }
630482
+ }
630337
630483
  if (capturedSessionId) {
630338
630484
  out6.sessionId = capturedSessionId;
630339
630485
  } else if (out6.sessionId === mockClientIds.sessionId) {
@@ -630386,6 +630532,10 @@ function createLiveConversationClient(config4) {
630386
630532
  config4.baseUrl,
630387
630533
  () => client4.capabilities()
630388
630534
  );
630535
+ kickEngineCapsProbe(
630536
+ config4.baseUrl,
630537
+ () => client4.capabilities()
630538
+ );
630389
630539
  void prepareTaskAgentsWire({
630390
630540
  baseUrl: config4.baseUrl,
630391
630541
  // loopback-unauthed = 不传 token(agentsWireCaps 对缺省 token 自然零 Authorization 头)。
@@ -630594,6 +630744,8 @@ var init_liveClient = __esm({
630594
630744
  init_detachWire();
630595
630745
  init_headlessReconnectWire();
630596
630746
  init_selfKnowledge();
630747
+ init_engineCapsCache();
630748
+ init_liveModelCatalog();
630597
630749
  init_mockClient();
630598
630750
  ENGINE_TO_CC_TOOL = {
630599
630751
  bash: "Bash",
@@ -655845,7 +655997,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
655845
655997
  pendingHookMessages
655846
655998
  }, renderAndRun);
655847
655999
  }
655848
- }).version("sema 1.0.46", "-v, --version", "Output the version number");
656000
+ }).version("sema 1.0.47", "-v, --version", "Output the version number");
655849
656001
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
655850
656002
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
655851
656003
  if (canUserConfigureAdvisor()) {