@sema-agent/cli 1.0.39 → 1.0.40

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 +5 -5
  3. package/sema.js +538 -308
package/sema.js CHANGED
@@ -143220,11 +143220,28 @@ __export(liveModelCatalog_exports, {
143220
143220
  getLiveModelCatalog: () => getLiveModelCatalog,
143221
143221
  liveDefaultModelName: () => liveDefaultModelName,
143222
143222
  normalizeLiveModelRef: () => normalizeLiveModelRef,
143223
- setLiveModelCatalog: () => setLiveModelCatalog
143223
+ refreshLiveModelCatalog: () => refreshLiveModelCatalog,
143224
+ setLiveModelCatalog: () => setLiveModelCatalog,
143225
+ setLiveModelCatalogRefresher: () => setLiveModelCatalogRefresher
143224
143226
  });
143225
143227
  function setLiveModelCatalog(next) {
143226
143228
  catalog = next;
143227
143229
  }
143230
+ function setLiveModelCatalogRefresher(fn2) {
143231
+ refresher = fn2;
143232
+ }
143233
+ async function refreshLiveModelCatalog() {
143234
+ if (!refresher) return false;
143235
+ try {
143236
+ const next = await refresher();
143237
+ if (next && Array.isArray(next.models) && next.models.length > 0) {
143238
+ catalog = next;
143239
+ return true;
143240
+ }
143241
+ } catch {
143242
+ }
143243
+ return false;
143244
+ }
143228
143245
  function getLiveModelCatalog() {
143229
143246
  return catalog;
143230
143247
  }
@@ -143238,10 +143255,11 @@ function liveDefaultModelName() {
143238
143255
  if (!catalog?.default) return null;
143239
143256
  return normalizeLiveModelRef(catalog.default);
143240
143257
  }
143241
- var catalog;
143258
+ var catalog, refresher;
143242
143259
  var init_liveModelCatalog = __esm({
143243
143260
  "build-src/src/sema/liveModelCatalog.ts"() {
143244
143261
  catalog = null;
143262
+ refresher = null;
143245
143263
  }
143246
143264
  });
143247
143265
 
@@ -165333,6 +165351,16 @@ var init_appStateRef = __esm({
165333
165351
  }
165334
165352
  });
165335
165353
 
165354
+ // build-src/src/sema/footerRowBelt.ts
165355
+ function isFooterTaskRow(r) {
165356
+ const tail = r.id.split(/\s+/).pop() ?? r.id;
165357
+ return r.parentId !== void 0 && r.workflowRunId === void 0 && !/^wa[0-9a-f]{16}$/.test(tail);
165358
+ }
165359
+ var init_footerRowBelt = __esm({
165360
+ "build-src/src/sema/footerRowBelt.ts"() {
165361
+ }
165362
+ });
165363
+
165336
165364
  // build-src/src/sema/fleetClient.ts
165337
165365
  var fleetClient_exports = {};
165338
165366
  __export(fleetClient_exports, {
@@ -165423,9 +165451,7 @@ function taskDescFromName(name, agentType) {
165423
165451
  return name.startsWith(prefix) ? collapseLabel(name.slice(prefix.length)) : "";
165424
165452
  }
165425
165453
  function projectTasks(allRows, viewingTaskId) {
165426
- const rows2 = allRows.filter(
165427
- (r) => r.parentId !== void 0 && !/^wa[0-9a-f]{16}$/.test(fleetRowTaskId(r.id))
165428
- );
165454
+ const rows2 = allRows.filter(isFooterTaskRow);
165429
165455
  const byId = new Map(rows2.map((r) => [r.id, r]));
165430
165456
  const depthOf = (r) => {
165431
165457
  let d4 = 0;
@@ -165654,6 +165680,7 @@ var init_fleetClient = __esm({
165654
165680
  init_engineTaskNotification();
165655
165681
  init_liveSessionStore();
165656
165682
  init_appStateRef();
165683
+ init_footerRowBelt();
165657
165684
  FLEET_STREAM_PATH = "/v1/fleet/stream";
165658
165685
  TERMINAL_FLEET_TASK_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "killed"]);
165659
165686
  liveBgViews = /* @__PURE__ */ new Set();
@@ -188181,8 +188208,8 @@ function generateProxyEnvVars(httpProxyPort, socksProxyPort, caCertPath, proxyAu
188181
188208
  const auth2 = proxyAuthToken2 ? `srt:${proxyAuthToken2}@` : "";
188182
188209
  const envVars = [`SANDBOX_RUNTIME=1`];
188183
188210
  if (!skipTmpdir) {
188184
- const tmpdir17 = process.env.CLAUDE_CODE_TMPDIR || process.env.CLAUDE_TMPDIR || "/tmp/claude";
188185
- envVars.push(`TMPDIR=${tmpdir17}`);
188211
+ const tmpdir18 = process.env.CLAUDE_CODE_TMPDIR || process.env.CLAUDE_TMPDIR || "/tmp/claude";
188212
+ envVars.push(`TMPDIR=${tmpdir18}`);
188186
188213
  }
188187
188214
  if (caCertPath) {
188188
188215
  for (const v2 of CA_TRUST_VARS) {
@@ -216942,7 +216969,7 @@ var require_filesystem = __commonJS({
216942
216969
  var LDD_PATH = "/usr/bin/ldd";
216943
216970
  var SELF_PATH = "/proc/self/exe";
216944
216971
  var MAX_LENGTH = 2048;
216945
- var readFileSync55 = (path27) => {
216972
+ var readFileSync56 = (path27) => {
216946
216973
  const fd2 = fs15.openSync(path27, "r");
216947
216974
  const buffer5 = Buffer.alloc(MAX_LENGTH);
216948
216975
  const bytesRead = fs15.readSync(fd2, buffer5, 0, MAX_LENGTH, 0);
@@ -216967,7 +216994,7 @@ var require_filesystem = __commonJS({
216967
216994
  module2.exports = {
216968
216995
  LDD_PATH,
216969
216996
  SELF_PATH,
216970
- readFileSync: readFileSync55,
216997
+ readFileSync: readFileSync56,
216971
216998
  readFile: readFile59
216972
216999
  };
216973
217000
  }
@@ -217016,7 +217043,7 @@ var require_detect_libc = __commonJS({
217016
217043
  "use strict";
217017
217044
  var childProcess3 = __require("child_process");
217018
217045
  var { isLinux: isLinux2, getReport: getReport2 } = require_process();
217019
- var { LDD_PATH, SELF_PATH, readFile: readFile59, readFileSync: readFileSync55 } = require_filesystem();
217046
+ var { LDD_PATH, SELF_PATH, readFile: readFile59, readFileSync: readFileSync56 } = require_filesystem();
217020
217047
  var { interpreterPath } = require_elf();
217021
217048
  var cachedFamilyInterpreter;
217022
217049
  var cachedFamilyFilesystem;
@@ -217108,7 +217135,7 @@ var require_detect_libc = __commonJS({
217108
217135
  }
217109
217136
  cachedFamilyFilesystem = null;
217110
217137
  try {
217111
- const lddContent = readFileSync55(LDD_PATH);
217138
+ const lddContent = readFileSync56(LDD_PATH);
217112
217139
  cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
217113
217140
  } catch (e) {
217114
217141
  }
@@ -217133,7 +217160,7 @@ var require_detect_libc = __commonJS({
217133
217160
  }
217134
217161
  cachedFamilyInterpreter = null;
217135
217162
  try {
217136
- const selfContent = readFileSync55(SELF_PATH);
217163
+ const selfContent = readFileSync56(SELF_PATH);
217137
217164
  const path27 = interpreterPath(selfContent);
217138
217165
  cachedFamilyInterpreter = familyFromInterpreterPath(path27);
217139
217166
  } catch (e) {
@@ -217197,7 +217224,7 @@ var require_detect_libc = __commonJS({
217197
217224
  }
217198
217225
  cachedVersionFilesystem = null;
217199
217226
  try {
217200
- const lddContent = readFileSync55(LDD_PATH);
217227
+ const lddContent = readFileSync56(LDD_PATH);
217201
217228
  const versionMatch = lddContent.match(RE_GLIBC_VERSION);
217202
217229
  if (versionMatch) {
217203
217230
  cachedVersionFilesystem = versionMatch[1];
@@ -229198,11 +229225,11 @@ async function createBashShellProvider(shellPath, options) {
229198
229225
  }
229199
229226
  lastSnapshotFilePath = snapshotFilePath;
229200
229227
  currentSandboxTmpDir = opts.sandboxTmpDir;
229201
- const tmpdir17 = osTmpdir();
229228
+ const tmpdir18 = osTmpdir();
229202
229229
  const isWindows2 = getPlatform() === "windows";
229203
- const shellTmpdir = isWindows2 ? windowsPathToPosixPath(tmpdir17) : tmpdir17;
229230
+ const shellTmpdir = isWindows2 ? windowsPathToPosixPath(tmpdir18) : tmpdir18;
229204
229231
  const shellCwdFilePath = opts.useSandbox ? posixJoin(opts.sandboxTmpDir, `cwd-${opts.id}`) : posixJoin(shellTmpdir, `claude-${opts.id}-cwd`);
229205
- const cwdFilePath = opts.useSandbox ? posixJoin(opts.sandboxTmpDir, `cwd-${opts.id}`) : nativeJoin(tmpdir17, `claude-${opts.id}-cwd`);
229232
+ const cwdFilePath = opts.useSandbox ? posixJoin(opts.sandboxTmpDir, `cwd-${opts.id}`) : nativeJoin(tmpdir18, `claude-${opts.id}-cwd`);
229206
229233
  const normalizedCommand = rewriteWindowsNullRedirect(command8);
229207
229234
  const addStdinRedirect = shouldAddStdinRedirect(normalizedCommand);
229208
229235
  let quotedCommand = quoteShellCommand(normalizedCommand, addStdinRedirect);
@@ -332048,9 +332075,9 @@ function streamingTailWrap(unstableSuffix) {
332048
332075
  var import_compiler_runtime43, import_react43, import_jsx_runtime53, TOKEN_CACHE_MAX, tokenCache, MD_SYNTAX_RE;
332049
332076
  var init_Markdown = __esm({
332050
332077
  "build-src/src/components/Markdown.tsx"() {
332051
- import_compiler_runtime43 = __toESM(require_compiler_runtime(), 1);
332078
+ import_compiler_runtime43 = __toESM(require_compiler_runtime());
332052
332079
  init_marked_esm();
332053
- import_react43 = __toESM(require_react(), 1);
332080
+ import_react43 = __toESM(require_react());
332054
332081
  init_useSettings();
332055
332082
  init_ink2();
332056
332083
  init_cliHighlight();
@@ -332058,7 +332085,7 @@ var init_Markdown = __esm({
332058
332085
  init_markdown();
332059
332086
  init_messages4();
332060
332087
  init_MarkdownTable();
332061
- import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
332088
+ import_jsx_runtime53 = __toESM(require_jsx_runtime());
332062
332089
  TOKEN_CACHE_MAX = 500;
332063
332090
  tokenCache = /* @__PURE__ */ new Map();
332064
332091
  MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
@@ -353927,7 +353954,7 @@ function useClaudeAiLimits() {
353927
353954
  var import_react64;
353928
353955
  var init_claudeAiLimitsHook = __esm({
353929
353956
  "build-src/src/services/claudeAiLimitsHook.ts"() {
353930
- import_react64 = __toESM(require_react());
353957
+ import_react64 = __toESM(require_react(), 1);
353931
353958
  init_claudeAiLimits();
353932
353959
  }
353933
353960
  });
@@ -397170,14 +397197,14 @@ var require_turndown_cjs = __commonJS({
397170
397197
  } else if (node.nodeType === 1) {
397171
397198
  replacement = replacementForNode.call(self2, node);
397172
397199
  }
397173
- return join207(output, replacement);
397200
+ return join208(output, replacement);
397174
397201
  }, "");
397175
397202
  }
397176
397203
  function postProcess(output) {
397177
397204
  var self2 = this;
397178
397205
  this.rules.forEach(function(rule) {
397179
397206
  if (typeof rule.append === "function") {
397180
- output = join207(output, rule.append(self2.options));
397207
+ output = join208(output, rule.append(self2.options));
397181
397208
  }
397182
397209
  });
397183
397210
  return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
@@ -397189,7 +397216,7 @@ var require_turndown_cjs = __commonJS({
397189
397216
  if (whitespace.leading || whitespace.trailing) content = content.trim();
397190
397217
  return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
397191
397218
  }
397192
- function join207(output, replacement) {
397219
+ function join208(output, replacement) {
397193
397220
  var s1 = trimTrailingNewlines(output);
397194
397221
  var s2 = trimLeadingNewlines(replacement);
397195
397222
  var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
@@ -403896,6 +403923,16 @@ var init_applyOnboard = __esm({
403896
403923
  });
403897
403924
 
403898
403925
  // build-src/src/sema/config/rosterStore.ts
403926
+ var rosterStore_exports = {};
403927
+ __export(rosterStore_exports, {
403928
+ PRIMARY_SLOTS: () => PRIMARY_SLOTS,
403929
+ ensureDefaultRoster: () => ensureDefaultRoster,
403930
+ readRosters: () => readRosters,
403931
+ reapplyActiveRoster: () => reapplyActiveRoster,
403932
+ rosterSummary: () => rosterSummary,
403933
+ saveRosters: () => saveRosters,
403934
+ switchRoster: () => switchRoster
403935
+ });
403899
403936
  function readRosters() {
403900
403937
  try {
403901
403938
  const raw2 = getSettingsForSource("userSettings")?.semaRosters;
@@ -403972,15 +404009,49 @@ function switchRoster(name, opts) {
403972
404009
  const pErr = writeModelPool(pool, { defaultId: main3.id, cheapId: cheap?.id });
403973
404010
  return { error: pErr, main: main3, cheap };
403974
404011
  }
404012
+ function reapplyActiveRoster() {
404013
+ const rosters = readRosters();
404014
+ if (!rosters) return { error: null };
404015
+ return switchRoster(rosters.active, { rosters });
404016
+ }
404017
+ function rosterSummary() {
404018
+ const rosters = readRosters();
404019
+ if (!rosters) {
404020
+ return readModelPool().length > 0 ? "1 roster \xB7 active: default" : "none configured";
404021
+ }
404022
+ const n2 = Object.keys(rosters.rosters).length;
404023
+ return `${n2} roster${n2 === 1 ? "" : "s"} \xB7 active: ${rosters.active}`;
404024
+ }
404025
+ var PRIMARY_SLOTS;
403975
404026
  var init_rosterStore = __esm({
403976
404027
  "build-src/src/sema/config/rosterStore.ts"() {
403977
404028
  init_settings2();
403978
404029
  init_applyOnboard();
403979
404030
  init_modelChannels();
404031
+ PRIMARY_SLOTS = ["main", "cheap"];
403980
404032
  }
403981
404033
  });
403982
404034
 
403983
404035
  // build-src/src/sema/config/tierStore.ts
404036
+ var tierStore_exports = {};
404037
+ __export(tierStore_exports, {
404038
+ CC_TIER_ALIASES: () => CC_TIER_ALIASES,
404039
+ DEFAULT_TIER: () => DEFAULT_TIER,
404040
+ SURFACED_TIERS: () => SURFACED_TIERS,
404041
+ TIER_BLURBS: () => TIER_BLURBS,
404042
+ TIER_ORDER: () => TIER_ORDER,
404043
+ ensureDefaultTierGroup: () => ensureDefaultTierGroup,
404044
+ projectTierGroups: () => projectTierGroups,
404045
+ readTierGroups: () => readTierGroups,
404046
+ reapplyActiveTierGroup: () => reapplyActiveTierGroup,
404047
+ resolveTierBinding: () => resolveTierBinding,
404048
+ saveTierGroups: () => saveTierGroups,
404049
+ setGroupDefaultTier: () => setGroupDefaultTier,
404050
+ setTierBinding: () => setTierBinding,
404051
+ switchTierGroup: () => switchTierGroup,
404052
+ syncActiveGroupDefaultBinding: () => syncActiveGroupDefaultBinding,
404053
+ tiersSummary: () => tiersSummary
404054
+ });
403984
404055
  function readTierGroups() {
403985
404056
  try {
403986
404057
  const raw2 = getSettingsForSource("userSettings")?.semaTierGroups;
@@ -404575,10 +404646,70 @@ function removeFromPool(id) {
404575
404646
  const error51 = writeModelPool(pool);
404576
404647
  return { pool, error: error51 };
404577
404648
  }
404649
+ function derivedIdBase(modelId) {
404650
+ let name = modelId.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+/, "");
404651
+ if (!name) name = "model";
404652
+ if (name === "default") name = "m-default";
404653
+ return name;
404654
+ }
404578
404655
  function updatePoolEntry(entry) {
404579
- const pool = readModelPool().map((e) => e.id === entry.id ? entry : e);
404656
+ const prevPool = readModelPool();
404657
+ const prev = prevPool.find((e) => e.id === entry.id);
404658
+ let next = entry;
404659
+ let renamedTo;
404660
+ if (prev && prev.modelId !== entry.modelId) {
404661
+ const oldBase = derivedIdBase(prev.modelId);
404662
+ const isDerived = prev.id === oldBase || new RegExp(`^${oldBase.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}-[a-z0-9-]+$`).test(prev.id);
404663
+ if (isDerived) {
404664
+ const taken = new Set(prevPool.filter((e) => e.id !== prev.id).map((e) => e.id));
404665
+ const newId = poolIdFor(entry.modelId, entry.channel, taken);
404666
+ if (newId !== prev.id) {
404667
+ next = { ...entry, id: newId };
404668
+ renamedTo = newId;
404669
+ }
404670
+ }
404671
+ }
404672
+ const pool = prevPool.map((e) => e.id === entry.id ? next : e);
404580
404673
  const error51 = writeModelPool(pool);
404581
- return { pool, error: error51 };
404674
+ if (!error51 && renamedTo && prev) {
404675
+ try {
404676
+ const rosterStore = (init_rosterStore(), __toCommonJS(rosterStore_exports));
404677
+ const rs = rosterStore.readRosters();
404678
+ if (rs) {
404679
+ let touched = false;
404680
+ for (const def of Object.values(rs.rosters)) {
404681
+ for (const [slot, ref] of Object.entries(def.slots)) {
404682
+ if (ref === prev.id) {
404683
+ def.slots[slot] = renamedTo;
404684
+ touched = true;
404685
+ }
404686
+ }
404687
+ }
404688
+ if (touched) rosterStore.saveRosters(rs);
404689
+ }
404690
+ const tierStore = (init_tierStore(), __toCommonJS(tierStore_exports));
404691
+ const tg = tierStore.readTierGroups();
404692
+ if (tg) {
404693
+ let touched = false;
404694
+ for (const g6 of Object.values(tg.groups)) {
404695
+ for (const [tier, ref] of Object.entries(g6.tiers)) {
404696
+ if (ref === prev.id) {
404697
+ g6.tiers[tier] = renamedTo;
404698
+ touched = true;
404699
+ }
404700
+ }
404701
+ }
404702
+ if (touched) tierStore.saveTierGroups(tg);
404703
+ }
404704
+ const settings2 = getSettingsForSource("userSettings");
404705
+ if (settings2 && (settings2.model === prev.id || settings2.model === prev.modelId)) {
404706
+ updateSettingsForSource("userSettings", { model: renamedTo });
404707
+ }
404708
+ writeModelPool(pool);
404709
+ } catch {
404710
+ }
404711
+ }
404712
+ return { pool, error: error51, renamedTo };
404582
404713
  }
404583
404714
  function probeRejectedRefs(pool = readModelPool()) {
404584
404715
  const out6 = /* @__PURE__ */ new Set();
@@ -433891,8 +434022,8 @@ Fix: run \`sema doctor\` to diagnose, or restart sema to retry.`,
433891
434022
  const { hasOwnModelConfig: hasOwnModelConfig2, computeCcFallbackEnv: computeCcFallbackEnv2 } = await Promise.resolve().then(() => (init_ccConfigFallback(), ccConfigFallback_exports));
433892
434023
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
433893
434024
  const { existsSync: existsSync36 } = await import("node:fs");
433894
- const { join: join207 } = await import("node:path");
433895
- const hasCatalog = existsSync36(join207(getClaudeConfigHomeDir3(), "config.d", "models.json"));
434025
+ const { join: join208 } = await import("node:path");
434026
+ const hasCatalog = existsSync36(join208(getClaudeConfigHomeDir3(), "config.d", "models.json"));
433896
434027
  if (!hasOwnModelConfig2(process.env) && !hasCatalog && !computeCcFallbackEnv2(process.env)) {
433897
434028
  yield createAssistantAPIErrorMessage({
433898
434029
  content: `Model not configured \u2014 this message was NOT sent.
@@ -479908,13 +480039,13 @@ var init_sema_brand = __esm({
479908
480039
  _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).",
479909
480040
  version: "2.1.187",
479910
480041
  notes: [
479911
- "Run a dynamic workflow? confirmation before Workflow runs \u2014 phases preview, raw script view, always-allow, Tab to amend",
479912
- "Resumed sub-agent (SendMessage) completion notifications now arrive automatically",
479913
- "/plugin and /skills are now full-screen menus"
480042
+ "Selecting a footer agent row (\u2193 to manage) no longer shifts the input box \u2014 hints swap into the status line",
480043
+ "Workflow agents no longer flash in as top-level sub-agents while a run is starting",
480044
+ "Editing a saved model's Model ID carries the rename through /model, rosters, and the default"
479914
480045
  ]
479915
480046
  },
479916
- productVersion: "1.0.39",
479917
- announcement: "sema 1.0.39 \u2014 the Workflow run-confirmation dialog (phases preview, raw-script view, always-allow), resumed sub-agent completion notifications, and full-screen /plugin & /skills menus."
480047
+ productVersion: "1.0.40",
480048
+ announcement: "sema 1.0.40 \u2014 the footer agent picker no longer nudges the input box when you select a row, workflow agents stop flickering in as sub-agents, and editing a saved model's ID now carries the rename through everywhere."
479918
480049
  };
479919
480050
  }
479920
480051
  });
@@ -482843,13 +482974,13 @@ var require_sema_brand = __commonJS({
482843
482974
  _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).",
482844
482975
  version: "2.1.187",
482845
482976
  notes: [
482846
- "Run a dynamic workflow? confirmation before Workflow runs \u2014 phases preview, raw script view, always-allow, Tab to amend",
482847
- "Resumed sub-agent (SendMessage) completion notifications now arrive automatically",
482848
- "/plugin and /skills are now full-screen menus"
482977
+ "Selecting a footer agent row (\u2193 to manage) no longer shifts the input box \u2014 hints swap into the status line",
482978
+ "Workflow agents no longer flash in as top-level sub-agents while a run is starting",
482979
+ "Editing a saved model's Model ID carries the rename through /model, rosters, and the default"
482849
482980
  ]
482850
482981
  },
482851
- productVersion: "1.0.39",
482852
- announcement: "sema 1.0.39 \u2014 the Workflow run-confirmation dialog (phases preview, raw-script view, always-allow), resumed sub-agent completion notifications, and full-screen /plugin & /skills menus."
482982
+ productVersion: "1.0.40",
482983
+ announcement: "sema 1.0.40 \u2014 the footer agent picker no longer nudges the input box when you select a row, workflow agents stop flickering in as sub-agents, and editing a saved model's ID now carries the rename through everywhere."
482853
482984
  };
482854
482985
  }
482855
482986
  });
@@ -513111,6 +513242,17 @@ function ModelPicker2({
513111
513242
  const [effort, setEffort] = (0, import_react196.useState)(
513112
513243
  effortValue !== void 0 ? convertEffortValueToLevel(effortValue) : void 0
513113
513244
  );
513245
+ const [catalogBump, setCatalogBump] = (0, import_react196.useState)(0);
513246
+ (0, import_react196.useEffect)(() => {
513247
+ let alive = true;
513248
+ void refreshLiveModelCatalog().then((ok2) => {
513249
+ if (ok2 && alive) setCatalogBump((n2) => n2 + 1);
513250
+ });
513251
+ return () => {
513252
+ alive = false;
513253
+ };
513254
+ }, []);
513255
+ void catalogBump;
513114
513256
  const modelOptions = getModelOptions(isFastMode ?? false);
513115
513257
  const optionsWithInitial = initial !== null && !modelOptions.some((opt2) => opt2.value === initial) ? [
513116
513258
  ...modelOptions,
@@ -561276,6 +561418,7 @@ function createFleetFooterNav() {
561276
561418
  let _active = false;
561277
561419
  let _hasRows = false;
561278
561420
  let _closing = false;
561421
+ let _hintsText = "";
561279
561422
  const listeners6 = /* @__PURE__ */ new Set();
561280
561423
  const emit4 = () => {
561281
561424
  for (const l3 of [...listeners6]) {
@@ -561322,6 +561465,14 @@ function createFleetFooterNav() {
561322
561465
  return () => {
561323
561466
  listeners6.delete(listener5);
561324
561467
  };
561468
+ },
561469
+ setHintsText(text2) {
561470
+ if (text2 === _hintsText) return;
561471
+ _hintsText = text2;
561472
+ if (_active) emit4();
561473
+ },
561474
+ getHintsText() {
561475
+ return _hintsText;
561325
561476
  }
561326
561477
  };
561327
561478
  }
@@ -561512,6 +561663,8 @@ function FleetFooterActive(props) {
561512
561663
  state: renderState,
561513
561664
  columns,
561514
561665
  isActive: navActive,
561666
+ suppressHints: true,
561667
+ publishHintsText: navActive ? (text2) => fleetFooterNav.setHintsText(text2) : void 0,
561515
561668
  onExit: navActive ? () => fleetFooterNav.close() : void 0,
561516
561669
  onStopTask,
561517
561670
  onSelectWorkflow: navActive && detailResolver ? onSelectWorkflow : void 0
@@ -561790,6 +561943,7 @@ __export(fleet_tree_exports, {
561790
561943
  isStoppable: () => isStoppable,
561791
561944
  isTerminal: () => isTerminal2,
561792
561945
  liveParentId: () => liveParentId,
561946
+ lwcHintsText: () => lwcHintsText2,
561793
561947
  reconcileIndex: () => reconcileIndex,
561794
561948
  statusColor: () => statusColor,
561795
561949
  taskStatusParts: () => taskStatusParts,
@@ -562028,6 +562182,26 @@ function Chord3(props) {
562028
562182
  props.action
562029
562183
  ] });
562030
562184
  }
562185
+ function lwcHintsText2(state3, visible, columns) {
562186
+ const wide = columns >= 90;
562187
+ const chips = [];
562188
+ if (state3.selection.kind === "tasks") {
562189
+ const idx = state3.selection.index;
562190
+ const selected = idx != null && idx >= 1 ? visible[idx - 1] : void 0;
562191
+ if (selected) {
562192
+ chips.push("Enter to view", `x to ${isStoppable(selected) ? "stop" : "clear"}`);
562193
+ if (wide && visible.filter(isStoppable).length > 1) chips.push("ctrl+x ctrl+k to stop all agents");
562194
+ } else {
562195
+ chips.push(`${ARROW_UP}/${ARROW_DOWN} to select`, "Enter to view");
562196
+ }
562197
+ } else {
562198
+ const idx = state3.selection.index;
562199
+ const wf = idx != null ? state3.workflows[idx] : void 0;
562200
+ if (wf) chips.push("Enter to view", `x to ${isTerminal2(wf.status) ? "clear" : "stop"}`);
562201
+ else chips.push(`${ARROW_UP}/${ARROW_DOWN} to select`, "Enter to view");
562202
+ }
562203
+ return chips.join(DOT3);
562204
+ }
562031
562205
  function FooterHints(props) {
562032
562206
  const { state: state3, visible, columns } = props;
562033
562207
  const wide = columns >= 90;
@@ -562342,13 +562516,18 @@ function FleetTreeHost(props) {
562342
562516
  viewingAgentTaskId,
562343
562517
  selection: section === "workflows" ? { kind: "workflows", index: navActive ? wfIndex : null } : { kind: "tasks", index: navActive ? selIndex : null }
562344
562518
  };
562519
+ const publishHintsText = props.publishHintsText;
562520
+ const hintsText = navActive && publishHintsText ? lwcHintsText2(renderState, visible, columns) : "";
562521
+ (0, import_react202.useEffect)(() => {
562522
+ if (publishHintsText && navActive) publishHintsText(hintsText);
562523
+ }, [publishHintsText, navActive, hintsText]);
562345
562524
  return /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(
562346
562525
  FleetTree,
562347
562526
  {
562348
562527
  state: renderState,
562349
562528
  columns,
562350
562529
  windowSize: props.windowSize,
562351
- showHints: navActive,
562530
+ showHints: props.suppressHints ? false : navActive,
562352
562531
  onSelectMain: viewMain,
562353
562532
  onSelectTask: drillInto,
562354
562533
  onSelectWorkflow
@@ -579947,6 +580126,9 @@ var init_WebFetchPermissionRequest = __esm({
579947
580126
  });
579948
580127
 
579949
580128
  // build-src/src/components/permissions/EngineWorkflowPermissionRequest.tsx
580129
+ import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync33, writeFileSync as writeFileSync18 } from "node:fs";
580130
+ import { tmpdir as tmpdir16 } from "node:os";
580131
+ import { join as join171 } from "node:path";
579950
580132
  function parseWorkflowScriptPreview(script) {
579951
580133
  if (!script) return { phases: [] };
579952
580134
  const out6 = { phases: [] };
@@ -579991,11 +580173,42 @@ function EngineWorkflowPermissionRequest({
579991
580173
  }) {
579992
580174
  const input = toolUseConfirm.input;
579993
580175
  const [showRawScript, setShowRawScript] = (0, import_react229.useState)(false);
580176
+ const [editedScript, setEditedScript] = (0, import_react229.useState)(null);
580177
+ const [editNote, setEditNote] = (0, import_react229.useState)(null);
580178
+ const effectiveScript = editedScript ?? input.script;
580179
+ const WORKFLOW_EDIT_SCRIPT_READY = process.env.SEMA_WF_EDIT_SCRIPT === "1";
580180
+ const editorBin = getExternalEditor();
580181
+ const canEditScript = WORKFLOW_EDIT_SCRIPT_READY && !!input.script && !!editorBin && !classifyGuiEditor(editorBin);
580182
+ use_input_default(
580183
+ (ch2, key) => {
580184
+ if (!(key.ctrl && (ch2 === "g" || ch2 === "\x07"))) return;
580185
+ try {
580186
+ const dir = mkdtempSync3(join171(tmpdir16(), "sema-wf-edit-"));
580187
+ const file2 = join171(dir, "workflow-script.mjs");
580188
+ writeFileSync18(file2, effectiveScript ?? "");
580189
+ const ok2 = openFileInExternalEditor(file2);
580190
+ if (!ok2) {
580191
+ setEditNote("editor unavailable \u2014 set a terminal $EDITOR (vim/nano/\u2026)");
580192
+ return;
580193
+ }
580194
+ const next = readFileSync33(file2, "utf8");
580195
+ if (next !== (effectiveScript ?? "")) {
580196
+ setEditedScript(next);
580197
+ setEditNote('script edited \u2014 "Yes, run it" runs the edited script');
580198
+ } else {
580199
+ setEditNote(null);
580200
+ }
580201
+ } catch (e) {
580202
+ setEditNote(`edit failed: ${String(e)}`);
580203
+ }
580204
+ },
580205
+ { isActive: canEditScript }
580206
+ );
579994
580207
  usePermissionRequestLogging(toolUseConfirm, {
579995
580208
  completion_type: "tool_use_single",
579996
580209
  language_name: "none"
579997
580210
  });
579998
- const preview = (0, import_react229.useMemo)(() => parseWorkflowScriptPreview(input.script), [input.script]);
580211
+ const preview = (0, import_react229.useMemo)(() => parseWorkflowScriptPreview(effectiveScript), [effectiveScript]);
579999
580212
  const headline = preview.description ?? input.description ?? preview.name ?? input.name ?? "Dynamic workflow";
580000
580213
  const options = [
580001
580214
  // Tab to amend(212):feedbackConfig 即 PermissionPrompt 现成 Tab-反馈机制——accept 反馈
@@ -580024,12 +580237,14 @@ function EngineWorkflowPermissionRequest({
580024
580237
  return;
580025
580238
  }
580026
580239
  if (value === "yes") {
580027
- toolUseConfirm.onAllow(toolUseConfirm.input, [], feedback2);
580240
+ const finalInput = editedScript !== null ? { ...input, script: editedScript } : toolUseConfirm.input;
580241
+ toolUseConfirm.onAllow(finalInput, [], feedback2);
580028
580242
  onDone();
580029
580243
  return;
580030
580244
  }
580031
580245
  if (value === "yes-dont-ask-again") {
580032
- toolUseConfirm.onAllow(toolUseConfirm.input, [
580246
+ const finalInput = editedScript !== null ? { ...input, script: editedScript } : toolUseConfirm.input;
580247
+ toolUseConfirm.onAllow(finalInput, [
580033
580248
  {
580034
580249
  type: "addRules",
580035
580250
  rules: [{ toolName: toolUseConfirm.tool.name }],
@@ -580051,7 +580266,7 @@ function EngineWorkflowPermissionRequest({
580051
580266
  return /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(PermissionDialog, { title: "Run a dynamic workflow?", workerBadge, children: [
580052
580267
  /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(ThemedBox_default, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
580053
580268
  /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { children: headline }),
580054
- showRawScript && input.script ? /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { dimColor: true, children: truncateToLines(input.script, 16) }) }) : /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(import_jsx_runtime401.Fragment, { children: [
580269
+ showRawScript && effectiveScript ? /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { dimColor: true, children: truncateToLines(effectiveScript, 16) }) }) : /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(import_jsx_runtime401.Fragment, { children: [
580055
580270
  preview.phases.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(ThemedBox_default, { flexDirection: "column", marginTop: 1, children: [
580056
580271
  /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { children: "This dynamic workflow will spin up multiple subagents across the following phases:" }),
580057
580272
  preview.phases.map((ph, i) => /* @__PURE__ */ (0, import_jsx_runtime401.jsxs)(ThemedBox_default, { flexDirection: "column", paddingLeft: 2, children: [
@@ -580060,7 +580275,9 @@ function EngineWorkflowPermissionRequest({
580060
580275
  ] }, i))
580061
580276
  ] }) : null,
580062
580277
  /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { color: "warning", wrap: "wrap", children: "Dynamic workflows can use a lot of tokens quickly by running many subagents in parallel \u2014 which counts against your usage limit. Stop a running workflow at any time with /workflows, or disable dynamic workflows in /config." }) })
580063
- ] })
580278
+ ] }),
580279
+ editNote ? /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { dimColor: true, italic: true, children: editNote }) }) : null,
580280
+ canEditScript ? /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(ThemedText, { dimColor: true, children: "ctrl+g to edit script in $EDITOR" }) }) : null
580064
580281
  ] }),
580065
580282
  /* @__PURE__ */ (0, import_jsx_runtime401.jsx)(PermissionPrompt, { options, onSelect: handleSelect, onCancel: handleCancel, question: null })
580066
580283
  ] });
@@ -580072,6 +580289,7 @@ var init_EngineWorkflowPermissionRequest = __esm({
580072
580289
  init_state();
580073
580290
  init_ink2();
580074
580291
  init_stringUtils();
580292
+ init_editor();
580075
580293
  init_permissionsLoader();
580076
580294
  init_hooks8();
580077
580295
  init_PermissionDialog();
@@ -592066,14 +592284,16 @@ function ModeIndicator({
592066
592284
  }, [voiceEnabled, voiceHintUnderCap]);
592067
592285
  const isKillAgentsConfirmShowing = useAppState((s_7) => s_7.notifications.current?.key === "kill-agents-confirm");
592068
592286
  const footerNavControl = globalThis.__semaFleetFooterNav;
592069
- const getFooterNavActive = () => !!footerNavControl?.isActive?.();
592070
- const footerNavActive = (0, import_react264.useSyncExternalStore)(footerNavControl?.subscribe ?? NO_OP_SUBSCRIBE, getFooterNavActive, getFooterNavActive);
592287
+ const getFooterNavSnap = () => footerNavControl?.isActive?.() ? `1:${footerNavControl?.getHintsText?.() ?? ""}` : "0";
592288
+ const footerNavSnap = (0, import_react264.useSyncExternalStore)(footerNavControl?.subscribe ?? NO_OP_SUBSCRIBE, getFooterNavSnap, getFooterNavSnap);
592289
+ const footerNavActive = footerNavSnap !== "0";
592071
592290
  const hasTeams = isAgentSwarmsEnabled() && !isInProcessEnabled() && teamContext !== void 0 && count(Object.values(teamContext.teammates), (t_0) => t_0.name !== "team-lead") > 0;
592072
592291
  if (mode === "bash") {
592073
592292
  return /* @__PURE__ */ (0, import_jsx_runtime436.jsx)(ThemedText, { color: "bashBorder", children: "! for shell mode" });
592074
592293
  }
592075
592294
  if (footerNavActive) {
592076
- return isFullscreenEnvEnabled() ? /* @__PURE__ */ (0, import_jsx_runtime436.jsx)(ThemedText, { children: " " }) : null;
592295
+ const lwc = footerNavSnap.slice(2);
592296
+ return /* @__PURE__ */ (0, import_jsx_runtime436.jsx)(ThemedText, { dimColor: true, children: lwc || " " });
592077
592297
  }
592078
592298
  const currentMode = toolPermissionContext?.mode;
592079
592299
  const hasActiveMode = !isDefaultMode(currentMode);
@@ -597049,9 +597269,9 @@ function initSkillImprovement() {
597049
597269
  }
597050
597270
  async function applySkillImprovement(skillName, updates) {
597051
597271
  if (!skillName) return;
597052
- const { join: join207 } = await import("path");
597272
+ const { join: join208 } = await import("path");
597053
597273
  const fs15 = await import("fs/promises");
597054
- const filePath = join207(getCwd(), ".sema", "skills", skillName, "SKILL.md");
597274
+ const filePath = join208(getCwd(), ".sema", "skills", skillName, "SKILL.md");
597055
597275
  let currentContent;
597056
597276
  try {
597057
597277
  currentContent = await fs15.readFile(filePath, "utf-8");
@@ -597591,7 +597811,7 @@ var init_autoDream = __esm({
597591
597811
  // build-src/src/utils/cleanup.ts
597592
597812
  import * as fs14 from "fs/promises";
597593
597813
  import { homedir as homedir45 } from "os";
597594
- import { join as join171 } from "path";
597814
+ import { join as join172 } from "path";
597595
597815
  function getCleanupPeriodDays() {
597596
597816
  const settings2 = getSettings_DEPRECATED() || {};
597597
597817
  return settings2.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
@@ -597618,7 +597838,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
597618
597838
  try {
597619
597839
  const timestamp = convertFileNameToDate(file2.name);
597620
597840
  if (timestamp < cutoffDate) {
597621
- await getFsImplementation().unlink(join171(dirPath, file2.name));
597841
+ await getFsImplementation().unlink(join172(dirPath, file2.name));
597622
597842
  if (isMessagePath) {
597623
597843
  result.messages++;
597624
597844
  } else {
@@ -597651,7 +597871,7 @@ async function cleanupOldMessageFiles() {
597651
597871
  }
597652
597872
  const mcpLogDirs = dirents.filter(
597653
597873
  (dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")
597654
- ).map((dirent) => join171(baseCachePath, dirent.name));
597874
+ ).map((dirent) => join172(baseCachePath, dirent.name));
597655
597875
  for (const mcpLogDir of mcpLogDirs) {
597656
597876
  result = addCleanupResults(
597657
597877
  result,
@@ -597693,7 +597913,7 @@ async function cleanupOldSessionFiles() {
597693
597913
  }
597694
597914
  for (const projectDirent of projectDirents) {
597695
597915
  if (!projectDirent.isDirectory()) continue;
597696
- const projectDir2 = join171(projectsDir, projectDirent.name);
597916
+ const projectDir2 = join172(projectsDir, projectDirent.name);
597697
597917
  let entries;
597698
597918
  try {
597699
597919
  entries = await fsImpl.readdir(projectDir2);
@@ -597707,14 +597927,14 @@ async function cleanupOldSessionFiles() {
597707
597927
  continue;
597708
597928
  }
597709
597929
  try {
597710
- if (await unlinkIfOld(join171(projectDir2, entry.name), cutoffDate, fsImpl)) {
597930
+ if (await unlinkIfOld(join172(projectDir2, entry.name), cutoffDate, fsImpl)) {
597711
597931
  result.messages++;
597712
597932
  }
597713
597933
  } catch {
597714
597934
  result.errors++;
597715
597935
  }
597716
597936
  } else if (entry.isDirectory()) {
597717
- const sessionDir = join171(projectDir2, entry.name);
597937
+ const sessionDir = join172(projectDir2, entry.name);
597718
597938
  result = addCleanupResults(
597719
597939
  result,
597720
597940
  await cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl)
@@ -597732,7 +597952,7 @@ async function cleanupOldSessionFiles() {
597732
597952
  }
597733
597953
  async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
597734
597954
  const result = { messages: 0, errors: 0 };
597735
- const toolResultsDir = join171(sessionDir, TOOL_RESULTS_SUBDIR);
597955
+ const toolResultsDir = join172(sessionDir, TOOL_RESULTS_SUBDIR);
597736
597956
  let toolDirs;
597737
597957
  try {
597738
597958
  toolDirs = await fsImpl.readdir(toolResultsDir);
@@ -597743,7 +597963,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
597743
597963
  if (toolEntry.isFile()) {
597744
597964
  try {
597745
597965
  if (await unlinkIfOld(
597746
- join171(toolResultsDir, toolEntry.name),
597966
+ join172(toolResultsDir, toolEntry.name),
597747
597967
  cutoffDate,
597748
597968
  fsImpl
597749
597969
  )) {
@@ -597753,7 +597973,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
597753
597973
  result.errors++;
597754
597974
  }
597755
597975
  } else if (toolEntry.isDirectory()) {
597756
- const toolDirPath = join171(toolResultsDir, toolEntry.name);
597976
+ const toolDirPath = join172(toolResultsDir, toolEntry.name);
597757
597977
  let toolFiles;
597758
597978
  try {
597759
597979
  toolFiles = await fsImpl.readdir(toolDirPath);
@@ -597763,7 +597983,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
597763
597983
  for (const tf of toolFiles) {
597764
597984
  if (!tf.isFile()) continue;
597765
597985
  try {
597766
- if (await unlinkIfOld(join171(toolDirPath, tf.name), cutoffDate, fsImpl)) {
597986
+ if (await unlinkIfOld(join172(toolDirPath, tf.name), cutoffDate, fsImpl)) {
597767
597987
  result.messages++;
597768
597988
  }
597769
597989
  } catch {
@@ -597778,7 +597998,7 @@ async function cleanupToolResultsUnderSession(sessionDir, cutoffDate, fsImpl) {
597778
597998
  }
597779
597999
  async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
597780
598000
  const result = { messages: 0, errors: 0 };
597781
- const subagentsDir = join171(sessionDir, "subagents");
598001
+ const subagentsDir = join172(sessionDir, "subagents");
597782
598002
  let entries;
597783
598003
  try {
597784
598004
  entries = await fsImpl.readdir(subagentsDir);
@@ -597788,14 +598008,14 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
597788
598008
  for (const entry of entries) {
597789
598009
  if (entry.isFile()) {
597790
598010
  try {
597791
- if (await unlinkIfOld(join171(subagentsDir, entry.name), cutoffDate, fsImpl)) {
598011
+ if (await unlinkIfOld(join172(subagentsDir, entry.name), cutoffDate, fsImpl)) {
597792
598012
  result.messages++;
597793
598013
  }
597794
598014
  } catch {
597795
598015
  result.errors++;
597796
598016
  }
597797
598017
  } else if (entry.isDirectory()) {
597798
- const subDir = join171(subagentsDir, entry.name);
598018
+ const subDir = join172(subagentsDir, entry.name);
597799
598019
  let subEntries;
597800
598020
  try {
597801
598021
  subEntries = await fsImpl.readdir(subDir);
@@ -597806,7 +598026,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
597806
598026
  if (subEntry.isFile()) {
597807
598027
  try {
597808
598028
  if (await unlinkIfOld(
597809
- join171(subDir, subEntry.name),
598029
+ join172(subDir, subEntry.name),
597810
598030
  cutoffDate,
597811
598031
  fsImpl
597812
598032
  )) {
@@ -597816,7 +598036,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
597816
598036
  result.errors++;
597817
598037
  }
597818
598038
  } else if (subEntry.isDirectory()) {
597819
- const runDir = join171(subDir, subEntry.name);
598039
+ const runDir = join172(subDir, subEntry.name);
597820
598040
  let runFiles;
597821
598041
  try {
597822
598042
  runFiles = await fsImpl.readdir(runDir);
@@ -597826,7 +598046,7 @@ async function cleanupSubagentsUnderSession(sessionDir, cutoffDate, fsImpl) {
597826
598046
  for (const rf of runFiles) {
597827
598047
  if (!rf.isFile()) continue;
597828
598048
  try {
597829
- if (await unlinkIfOld(join171(runDir, rf.name), cutoffDate, fsImpl)) {
598049
+ if (await unlinkIfOld(join172(runDir, rf.name), cutoffDate, fsImpl)) {
597830
598050
  result.messages++;
597831
598051
  }
597832
598052
  } catch {
@@ -597855,7 +598075,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
597855
598075
  for (const dirent of dirents) {
597856
598076
  if (!dirent.isFile() || !dirent.name.endsWith(extension2)) continue;
597857
598077
  try {
597858
- if (await unlinkIfOld(join171(dirPath, dirent.name), cutoffDate, fsImpl)) {
598078
+ if (await unlinkIfOld(join172(dirPath, dirent.name), cutoffDate, fsImpl)) {
597859
598079
  result.messages++;
597860
598080
  }
597861
598081
  } catch {
@@ -597868,7 +598088,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
597868
598088
  return result;
597869
598089
  }
597870
598090
  function cleanupOldPlanFiles() {
597871
- const plansDir = join171(getClaudeConfigHomeDir(), "plans");
598091
+ const plansDir = join172(getClaudeConfigHomeDir(), "plans");
597872
598092
  return cleanupSingleDirectory(plansDir, ".md");
597873
598093
  }
597874
598094
  async function cleanupOldFileHistoryBackups() {
@@ -597877,14 +598097,14 @@ async function cleanupOldFileHistoryBackups() {
597877
598097
  const fsImpl = getFsImplementation();
597878
598098
  try {
597879
598099
  const configDir = getClaudeConfigHomeDir();
597880
- const fileHistoryStorageDir = join171(configDir, "file-history");
598100
+ const fileHistoryStorageDir = join172(configDir, "file-history");
597881
598101
  let dirents;
597882
598102
  try {
597883
598103
  dirents = await fsImpl.readdir(fileHistoryStorageDir);
597884
598104
  } catch {
597885
598105
  return result;
597886
598106
  }
597887
- const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join171(fileHistoryStorageDir, dirent.name));
598107
+ const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join172(fileHistoryStorageDir, dirent.name));
597888
598108
  await Promise.all(
597889
598109
  fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
597890
598110
  try {
@@ -597913,14 +598133,14 @@ async function cleanupOldSessionEnvDirs() {
597913
598133
  const fsImpl = getFsImplementation();
597914
598134
  try {
597915
598135
  const configDir = getClaudeConfigHomeDir();
597916
- const sessionEnvBaseDir = join171(configDir, "session-env");
598136
+ const sessionEnvBaseDir = join172(configDir, "session-env");
597917
598137
  let dirents;
597918
598138
  try {
597919
598139
  dirents = await fsImpl.readdir(sessionEnvBaseDir);
597920
598140
  } catch {
597921
598141
  return result;
597922
598142
  }
597923
- const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join171(sessionEnvBaseDir, dirent.name));
598143
+ const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join172(sessionEnvBaseDir, dirent.name));
597924
598144
  for (const sessionEnvDir of sessionEnvDirs) {
597925
598145
  try {
597926
598146
  const stats3 = await fsImpl.stat(sessionEnvDir);
@@ -597971,7 +598191,7 @@ async function cleanupOldDebugLogs() {
597971
598191
  const cutoffDate = getCutoffDate();
597972
598192
  const result = { messages: 0, errors: 0 };
597973
598193
  const fsImpl = getFsImplementation();
597974
- const debugDir = join171(getClaudeConfigHomeDir(), "debug");
598194
+ const debugDir = join172(getClaudeConfigHomeDir(), "debug");
597975
598195
  let dirents;
597976
598196
  try {
597977
598197
  dirents = await fsImpl.readdir(debugDir);
@@ -597983,7 +598203,7 @@ async function cleanupOldDebugLogs() {
597983
598203
  continue;
597984
598204
  }
597985
598205
  try {
597986
- if (await unlinkIfOld(join171(debugDir, dirent.name), cutoffDate, fsImpl)) {
598206
+ if (await unlinkIfOld(join172(debugDir, dirent.name), cutoffDate, fsImpl)) {
597987
598207
  result.messages++;
597988
598208
  }
597989
598209
  } catch {
@@ -597993,7 +598213,7 @@ async function cleanupOldDebugLogs() {
597993
598213
  return result;
597994
598214
  }
597995
598215
  async function cleanupNpmCacheForAnthropicPackages() {
597996
- const markerPath = join171(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
598216
+ const markerPath = join172(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
597997
598217
  try {
597998
598218
  const stat55 = await fs14.stat(markerPath);
597999
598219
  if (Date.now() - stat55.mtimeMs < ONE_DAY_MS2) {
@@ -598009,7 +598229,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
598009
598229
  return;
598010
598230
  }
598011
598231
  logForDebugging("npm cache cleanup: starting");
598012
- const npmCachePath = join171(homedir45(), ".npm", "_cacache");
598232
+ const npmCachePath = join172(homedir45(), ".npm", "_cacache");
598013
598233
  const NPM_CACHE_RETENTION_COUNT = 5;
598014
598234
  const startTime = Date.now();
598015
598235
  try {
@@ -598069,7 +598289,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
598069
598289
  }
598070
598290
  }
598071
598291
  async function cleanupOldVersionsThrottled() {
598072
- const markerPath = join171(getClaudeConfigHomeDir(), ".version-cleanup");
598292
+ const markerPath = join172(getClaudeConfigHomeDir(), ".version-cleanup");
598073
598293
  try {
598074
598294
  const stat55 = await fs14.stat(markerPath);
598075
598295
  if (Date.now() - stat55.mtimeMs < ONE_DAY_MS2) {
@@ -600152,8 +600372,8 @@ var init_useCanUseTool = __esm({
600152
600372
  });
600153
600373
 
600154
600374
  // build-src/src/sema/sessionAutoTitle.ts
600155
- import { readFileSync as readFileSync33 } from "node:fs";
600156
- import { join as join172 } from "node:path";
600375
+ import { readFileSync as readFileSync34 } from "node:fs";
600376
+ import { join as join173 } from "node:path";
600157
600377
  function maybeGenerateSessionTitle(sessionContent) {
600158
600378
  if (attempted) return;
600159
600379
  if (!process.env.SEMA_LIVE_BASEURL) {
@@ -600187,7 +600407,7 @@ async function generateAndSave(snippet) {
600187
600407
  let token = process.env.SEMA_LIVE_TOKEN ?? "";
600188
600408
  if (!token) {
600189
600409
  try {
600190
- token = readFileSync33(join172(getClaudeConfigHomeDir(), "engine.token"), "utf-8").trim();
600410
+ token = readFileSync34(join173(getClaudeConfigHomeDir(), "engine.token"), "utf-8").trim();
600191
600411
  } catch {
600192
600412
  }
600193
600413
  }
@@ -602115,7 +602335,7 @@ __export(asciicast_exports, {
602115
602335
  renameRecordingForSession: () => renameRecordingForSession
602116
602336
  });
602117
602337
  import { appendFile as appendFile5, rename as rename14 } from "fs/promises";
602118
- import { basename as basename63, dirname as dirname74, join as join174 } from "path";
602338
+ import { basename as basename63, dirname as dirname74, join as join175 } from "path";
602119
602339
  function getRecordFilePath() {
602120
602340
  if (recordingState.filePath !== null) {
602121
602341
  return recordingState.filePath;
@@ -602126,10 +602346,10 @@ function getRecordFilePath() {
602126
602346
  if (!isEnvTruthy(process.env.SEMA_CODE_TERMINAL_RECORDING)) {
602127
602347
  return null;
602128
602348
  }
602129
- const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
602130
- const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
602349
+ const projectsDir = join175(getClaudeConfigHomeDir(), "projects");
602350
+ const projectDir2 = join175(projectsDir, sanitizePath(getOriginalCwd()));
602131
602351
  recordingState.timestamp = Date.now();
602132
- recordingState.filePath = join174(
602352
+ recordingState.filePath = join175(
602133
602353
  projectDir2,
602134
602354
  `${getSessionId()}-${recordingState.timestamp}.cast`
602135
602355
  );
@@ -602141,13 +602361,13 @@ function _resetRecordingStateForTesting() {
602141
602361
  }
602142
602362
  function getSessionRecordingPaths() {
602143
602363
  const sessionId = getSessionId();
602144
- const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
602145
- const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
602364
+ const projectsDir = join175(getClaudeConfigHomeDir(), "projects");
602365
+ const projectDir2 = join175(projectsDir, sanitizePath(getOriginalCwd()));
602146
602366
  try {
602147
602367
  const entries = getFsImplementation().readdirSync(projectDir2);
602148
602368
  const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
602149
602369
  const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
602150
- return files2.map((f) => join174(projectDir2, f));
602370
+ return files2.map((f) => join175(projectDir2, f));
602151
602371
  } catch {
602152
602372
  return [];
602153
602373
  }
@@ -602157,9 +602377,9 @@ async function renameRecordingForSession() {
602157
602377
  if (!oldPath || recordingState.timestamp === 0) {
602158
602378
  return;
602159
602379
  }
602160
- const projectsDir = join174(getClaudeConfigHomeDir(), "projects");
602161
- const projectDir2 = join174(projectsDir, sanitizePath(getOriginalCwd()));
602162
- const newPath = join174(
602380
+ const projectsDir = join175(getClaudeConfigHomeDir(), "projects");
602381
+ const projectDir2 = join175(projectsDir, sanitizePath(getOriginalCwd()));
602382
+ const newPath = join175(
602163
602383
  projectDir2,
602164
602384
  `${getSessionId()}-${recordingState.timestamp}.cast`
602165
602385
  );
@@ -602290,7 +602510,7 @@ __export(sessionAutoSync_exports, {
602290
602510
  maybeQueueAutoSyncPushAfterTurn: () => maybeQueueAutoSyncPushAfterTurn,
602291
602511
  onAutoSyncEvent: () => onAutoSyncEvent
602292
602512
  });
602293
- import { readFileSync as readFileSync34 } from "node:fs";
602513
+ import { readFileSync as readFileSync35 } from "node:fs";
602294
602514
  function onAutoSyncEvent(cb) {
602295
602515
  listener3 = cb;
602296
602516
  for (const ev of pendingEvents2) cb(ev);
@@ -602331,7 +602551,7 @@ async function projectAutoSyncEnabled() {
602331
602551
  const { getSettingsFilePathForSource: getSettingsFilePathForSource2 } = await Promise.resolve().then(() => (init_settings2(), settings_exports));
602332
602552
  const path27 = getSettingsFilePathForSource2("localSettings");
602333
602553
  if (!path27) return false;
602334
- const doc = JSON.parse(readFileSync34(path27, "utf8"));
602554
+ const doc = JSON.parse(readFileSync35(path27, "utf8"));
602335
602555
  return doc?.[AUTO_SYNC_SETTINGS_KEY] === true;
602336
602556
  } catch {
602337
602557
  return false;
@@ -605832,7 +606052,7 @@ var init_useChromeExtensionNotification = __esm({
605832
606052
  });
605833
606053
 
605834
606054
  // build-src/src/utils/plugins/officialMarketplaceStartupCheck.ts
605835
- import { join as join175 } from "path";
606055
+ import { join as join176 } from "path";
605836
606056
  function isOfficialMarketplaceAutoInstallDisabled() {
605837
606057
  return isEnvTruthy(
605838
606058
  process.env.SEMA_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL
@@ -605923,7 +606143,7 @@ async function checkAndInstallOfficialMarketplace() {
605923
606143
  return { installed: false, skipped: true, reason: "policy_blocked" };
605924
606144
  }
605925
606145
  const cacheDir = getMarketplacesCacheDir();
605926
- const installLocation = join175(cacheDir, OFFICIAL_MARKETPLACE_NAME);
606146
+ const installLocation = join176(cacheDir, OFFICIAL_MARKETPLACE_NAME);
605927
606147
  const gcsSha = await fetchOfficialMarketplaceFromGcs(
605928
606148
  installLocation,
605929
606149
  cacheDir
@@ -606315,8 +606535,8 @@ function _temp158() {
606315
606535
  var import_compiler_runtime312, import_react310, import_jsx_runtime458, DESKTOP_UPSELL_DEFAULT;
606316
606536
  var init_DesktopUpsellStartup = __esm({
606317
606537
  "build-src/src/components/DesktopUpsell/DesktopUpsellStartup.tsx"() {
606318
- import_compiler_runtime312 = __toESM(require_compiler_runtime());
606319
- import_react310 = __toESM(require_react());
606538
+ import_compiler_runtime312 = __toESM(require_compiler_runtime(), 1);
606539
+ import_react310 = __toESM(require_react(), 1);
606320
606540
  init_ink2();
606321
606541
  init_growthbook_advisor_flag();
606322
606542
  init_analytics_index();
@@ -606324,7 +606544,7 @@ var init_DesktopUpsellStartup = __esm({
606324
606544
  init_select();
606325
606545
  init_DesktopHandoff();
606326
606546
  init_PermissionDialog();
606327
- import_jsx_runtime458 = __toESM(require_jsx_runtime());
606547
+ import_jsx_runtime458 = __toESM(require_jsx_runtime(), 1);
606328
606548
  DESKTOP_UPSELL_DEFAULT = {
606329
606549
  enable_shortcut_tip: false,
606330
606550
  enable_startup_dialog: false
@@ -608679,8 +608899,8 @@ function _temp161() {
608679
608899
  var import_compiler_runtime316, import_react314, SETTINGS_ERRORS_NOTIFICATION_KEY;
608680
608900
  var init_useSettingsErrors = __esm({
608681
608901
  "build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
608682
- import_compiler_runtime316 = __toESM(require_compiler_runtime());
608683
- import_react314 = __toESM(require_react());
608902
+ import_compiler_runtime316 = __toESM(require_compiler_runtime(), 1);
608903
+ import_react314 = __toESM(require_react(), 1);
608684
608904
  init_notifications();
608685
608905
  init_state();
608686
608906
  init_allErrors();
@@ -609333,7 +609553,7 @@ var init_usePluginRecommendationBase = __esm({
609333
609553
  });
609334
609554
 
609335
609555
  // build-src/src/hooks/useLspPluginRecommendation.tsx
609336
- import { extname as extname16, join as join176 } from "path";
609556
+ import { extname as extname16, join as join177 } from "path";
609337
609557
  function useLspPluginRecommendation() {
609338
609558
  const $3 = (0, import_compiler_runtime320.c)(12);
609339
609559
  const trackedFiles = useAppState(_temp164);
@@ -609418,7 +609638,7 @@ function useLspPluginRecommendation() {
609418
609638
  case "yes": {
609419
609639
  installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
609420
609640
  logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
609421
- const localSourcePath = typeof pluginData.entry.source === "string" ? join176(pluginData.marketplaceInstallLocation, pluginData.entry.source) : void 0;
609641
+ const localSourcePath = typeof pluginData.entry.source === "string" ? join177(pluginData.marketplaceInstallLocation, pluginData.entry.source) : void 0;
609422
609642
  await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", void 0, localSourcePath);
609423
609643
  const settings2 = getSettingsForSource("userSettings");
609424
609644
  updateSettingsForSource("userSettings", {
@@ -612199,8 +612419,8 @@ __export(REPL_exports, {
612199
612419
  REPL: () => REPL
612200
612420
  });
612201
612421
  import { spawnSync as spawnSync11 } from "child_process";
612202
- import { dirname as dirname76, join as join177 } from "path";
612203
- import { tmpdir as tmpdir16 } from "os";
612422
+ import { dirname as dirname76, join as join178 } from "path";
612423
+ import { tmpdir as tmpdir17 } from "os";
612204
612424
  import { writeFile as writeFile49 } from "fs/promises";
612205
612425
  import { randomUUID as randomUUID51 } from "crypto";
612206
612426
  function TranscriptModeFooter(t0) {
@@ -615164,7 +615384,7 @@ Note: ctrl + z now suspends Sema, ctrl + _ undoes input.
615164
615384
  const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
615165
615385
  const raw2 = await renderMessagesToPlainText(deferredMessages, tools, w2);
615166
615386
  const text2 = raw2.replace(/[ \t]+$/gm, "");
615167
- const path27 = join177(tmpdir16(), `cc-transcript-${Date.now()}.txt`);
615387
+ const path27 = join178(tmpdir17(), `cc-transcript-${Date.now()}.txt`);
615168
615388
  await writeFile49(path27, text2);
615169
615389
  const opened = openFileInExternalEditor(path27);
615170
615390
  setStatus(opened ? `opening ${path27}` : `wrote ${path27} \xB7 no $VISUAL/$EDITOR set`);
@@ -619589,8 +619809,8 @@ IMPORTANT: Start by calling mcp__claude-in-chrome__tabs_context_mcp to get infor
619589
619809
  });
619590
619810
 
619591
619811
  // build-src/src/sema/engineReportFindingsFace.ts
619592
- import { existsSync as existsSync24, readFileSync as readFileSync35 } from "fs";
619593
- import { basename as basename64, dirname as dirname78, join as join178 } from "path";
619812
+ import { existsSync as existsSync24, readFileSync as readFileSync36 } from "fs";
619813
+ import { basename as basename64, dirname as dirname78, join as join179 } from "path";
619594
619814
  function isLiveEngineSession() {
619595
619815
  return typeof process.env.SEMA_LIVE_BASEURL === "string" && process.env.SEMA_LIVE_BASEURL.length > 0;
619596
619816
  }
@@ -619608,18 +619828,18 @@ function localEngineCoreVersion() {
619608
619828
  const entry = resolveEngineEntry();
619609
619829
  if (!entry) return void 0;
619610
619830
  const candidates = [
619611
- join178(entry.cwd, "node_modules", "@sema-agent", "core", "package.json"),
619612
- join178(entry.cwd, "node_modules", "@sema-ai", "core", "package.json")
619831
+ join179(entry.cwd, "node_modules", "@sema-agent", "core", "package.json"),
619832
+ join179(entry.cwd, "node_modules", "@sema-ai", "core", "package.json")
619613
619833
  ];
619614
619834
  const parent2 = dirname78(entry.cwd);
619615
619835
  if (basename64(parent2) === "@sema-agent" || basename64(parent2) === "@sema-ai") {
619616
- candidates.push(join178(parent2, "core", "package.json"));
619617
- candidates.push(join178(dirname78(parent2), "@sema-agent", "core", "package.json"));
619836
+ candidates.push(join179(parent2, "core", "package.json"));
619837
+ candidates.push(join179(dirname78(parent2), "@sema-agent", "core", "package.json"));
619618
619838
  }
619619
619839
  for (const p of candidates) {
619620
619840
  try {
619621
619841
  if (!existsSync24(p)) continue;
619622
- const pkg = JSON.parse(readFileSync35(p, "utf8"));
619842
+ const pkg = JSON.parse(readFileSync36(p, "utf8"));
619623
619843
  if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
619624
619844
  } catch {
619625
619845
  }
@@ -621217,8 +621437,8 @@ __export(semaUpdater_exports, {
621217
621437
  startSemaAutoUpdate: () => startSemaAutoUpdate
621218
621438
  });
621219
621439
  import { execFile as execFile7 } from "node:child_process";
621220
- import { readFileSync as readFileSync36, realpathSync as realpathSync9 } from "node:fs";
621221
- import { join as join179 } from "node:path";
621440
+ import { readFileSync as readFileSync37, realpathSync as realpathSync9 } from "node:fs";
621441
+ import { join as join180 } from "node:path";
621222
621442
  function updateRegistry() {
621223
621443
  const r = process.env.SEMA_UPDATE_REGISTRY?.trim();
621224
621444
  const base = r && /^https?:\/\//.test(r) ? r : DEFAULT_REGISTRY;
@@ -621234,7 +621454,7 @@ function realArgv1() {
621234
621454
  function installedPkgRoot() {
621235
621455
  const p = realArgv1();
621236
621456
  for (const name of KNOWN_PKGS) {
621237
- const seg = join179("node_modules", ...name.split("/"));
621457
+ const seg = join180("node_modules", ...name.split("/"));
621238
621458
  const rootIdx = p.indexOf(seg);
621239
621459
  if (rootIdx >= 0) return p.slice(0, rootIdx + seg.length);
621240
621460
  }
@@ -621247,7 +621467,7 @@ function installedPkgName() {
621247
621467
  try {
621248
621468
  const root2 = installedPkgRoot();
621249
621469
  if (root2) {
621250
- const pkg = JSON.parse(readFileSync36(join179(root2, "package.json"), "utf8"));
621470
+ const pkg = JSON.parse(readFileSync37(join180(root2, "package.json"), "utf8"));
621251
621471
  if (typeof pkg.name === "string" && pkg.name.length > 0) return pkg.name;
621252
621472
  }
621253
621473
  } catch {
@@ -621258,7 +621478,7 @@ function installedVersion() {
621258
621478
  try {
621259
621479
  const pkgRoot = installedPkgRoot();
621260
621480
  if (!pkgRoot) return null;
621261
- const pkg = JSON.parse(readFileSync36(join179(pkgRoot, "package.json"), "utf8"));
621481
+ const pkg = JSON.parse(readFileSync37(join180(pkgRoot, "package.json"), "utf8"));
621262
621482
  return typeof pkg.version === "string" ? pkg.version : null;
621263
621483
  } catch {
621264
621484
  return null;
@@ -621268,7 +621488,7 @@ function installedEngineVersion() {
621268
621488
  try {
621269
621489
  const pkgRoot = installedPkgRoot();
621270
621490
  if (!pkgRoot) return null;
621271
- const pkg = JSON.parse(readFileSync36(join179(pkgRoot, "package.json"), "utf8"));
621491
+ const pkg = JSON.parse(readFileSync37(join180(pkgRoot, "package.json"), "utf8"));
621272
621492
  return typeof pkg.semaEngineVersion === "string" && pkg.semaEngineVersion.length > 0 ? pkg.semaEngineVersion : null;
621273
621493
  } catch {
621274
621494
  return null;
@@ -621277,7 +621497,7 @@ function installedEngineVersion() {
621277
621497
  function npmrcToken() {
621278
621498
  try {
621279
621499
  const host = new URL(updateRegistry()).host;
621280
- const rc = readFileSync36(join179(process.env.HOME ?? "", ".npmrc"), "utf8");
621500
+ const rc = readFileSync37(join180(process.env.HOME ?? "", ".npmrc"), "utf8");
621281
621501
  for (const line of rc.split("\n")) {
621282
621502
  const m2 = line.match(/^\s*\/\/([^/]+)[^:]*:_authToken=(.+)$/);
621283
621503
  if (m2 && m2[1] === host) return m2[2].trim();
@@ -621365,7 +621585,7 @@ var init_semaUpdater = __esm({
621365
621585
  });
621366
621586
 
621367
621587
  // build-src/src/commands/doctor/semaSections.tsx
621368
- import { existsSync as existsSync25, readFileSync as readFileSync37 } from "node:fs";
621588
+ import { existsSync as existsSync25, readFileSync as readFileSync38 } from "node:fs";
621369
621589
  function SemaVersionLines({
621370
621590
  installationType,
621371
621591
  ccVersion
@@ -621438,7 +621658,7 @@ function mergedModelEnv() {
621438
621658
  const out6 = {};
621439
621659
  try {
621440
621660
  const sj = JSON.parse(
621441
- readFileSync37(`${getClaudeConfigHomeDir()}/settings.json`, "utf8")
621661
+ readFileSync38(`${getClaudeConfigHomeDir()}/settings.json`, "utf8")
621442
621662
  );
621443
621663
  if (sj?.env) {
621444
621664
  for (const [k2, v2] of Object.entries(sj.env)) if (typeof v2 === "string") out6[k2] = v2;
@@ -621506,7 +621726,7 @@ async function collectEngineRows() {
621506
621726
  let anchor = null;
621507
621727
  try {
621508
621728
  if (existsSync25(portFilePath)) {
621509
- const parsed = JSON.parse(readFileSync37(portFilePath, "utf8"));
621729
+ const parsed = JSON.parse(readFileSync38(portFilePath, "utf8"));
621510
621730
  if (typeof parsed.port === "number" && typeof parsed.pid === "number") anchor = parsed;
621511
621731
  }
621512
621732
  } catch {
@@ -621550,7 +621770,7 @@ async function collectEngineRows() {
621550
621770
  const tokenPath = getEngineTokenFilePath();
621551
621771
  let hasToken = false;
621552
621772
  try {
621553
- hasToken = existsSync25(tokenPath) && readFileSync37(tokenPath, "utf8").trim().length > 0;
621773
+ hasToken = existsSync25(tokenPath) && readFileSync38(tokenPath, "utf8").trim().length > 0;
621554
621774
  } catch {
621555
621775
  }
621556
621776
  if (anchor && isProcessAlive(anchor.pid ?? -1)) {
@@ -624454,12 +624674,12 @@ var init_createDirectConnectSession = __esm({
624454
624674
  });
624455
624675
 
624456
624676
  // build-src/src/utils/errorLogSink.ts
624457
- import { dirname as dirname79, join as join180 } from "path";
624677
+ import { dirname as dirname79, join as join181 } from "path";
624458
624678
  function getErrorsPath() {
624459
- return join180(CACHE_PATHS.errors(), DATE2 + ".jsonl");
624679
+ return join181(CACHE_PATHS.errors(), DATE2 + ".jsonl");
624460
624680
  }
624461
624681
  function getMCPLogsPath(serverName) {
624462
- return join180(CACHE_PATHS.mcpLogs(serverName), DATE2 + ".jsonl");
624682
+ return join181(CACHE_PATHS.mcpLogs(serverName), DATE2 + ".jsonl");
624463
624683
  }
624464
624684
  function createJsonlWriter(options) {
624465
624685
  const writer = createBufferedWriter(options);
@@ -624825,7 +625045,7 @@ var init_sessionMemory = __esm({
624825
625045
  // build-src/src/utils/iTermBackup.ts
624826
625046
  import { copyFile as copyFile11, stat as stat49 } from "fs/promises";
624827
625047
  import { homedir as homedir46 } from "os";
624828
- import { join as join181 } from "path";
625048
+ import { join as join182 } from "path";
624829
625049
  function markITerm2SetupComplete() {
624830
625050
  saveGlobalConfig((current3) => ({
624831
625051
  ...current3,
@@ -624840,7 +625060,7 @@ function getIterm2RecoveryInfo() {
624840
625060
  };
624841
625061
  }
624842
625062
  function getITerm2PlistPath() {
624843
- return join181(
625063
+ return join182(
624844
625064
  homedir46(),
624845
625065
  "Library",
624846
625066
  "Preferences",
@@ -628094,7 +628314,7 @@ function surfaceApprovalCard(req) {
628094
628314
  onAbort() {
628095
628315
  settle2({ kind: "aborted" });
628096
628316
  },
628097
- onAllow(_updatedInput, permissionUpdates) {
628317
+ onAllow(updatedInput, permissionUpdates) {
628098
628318
  let allowSession = false;
628099
628319
  try {
628100
628320
  if (permissionUpdates.length > 0) {
@@ -628108,7 +628328,11 @@ function surfaceApprovalCard(req) {
628108
628328
  } catch (e) {
628109
628329
  logForDebugging(`liveToolApprovalWire: applying permission updates failed (non-fatal): ${String(e)}`);
628110
628330
  }
628111
- settle2({ kind: "allow", allowSession });
628331
+ settle2({
628332
+ kind: "allow",
628333
+ allowSession,
628334
+ ...updatedInput !== void 0 && updatedInput !== req.args ? { updatedInput } : {}
628335
+ });
628112
628336
  },
628113
628337
  onReject() {
628114
628338
  settle2({ kind: "deny" });
@@ -628161,7 +628385,7 @@ async function surfaceFsApprovalAndDecide(deps2, taskId, argsByCall, signal) {
628161
628385
  if (card.allowSession) {
628162
628386
  try {
628163
628387
  await bridge2.decideTool(
628164
- { decision: "approve", remember: "session" },
628388
+ { decision: "approve", remember: "session", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} },
628165
628389
  gatedCallId,
628166
628390
  signal ? { signal } : void 0
628167
628391
  );
@@ -628172,7 +628396,11 @@ async function surfaceFsApprovalAndDecide(deps2, taskId, argsByCall, signal) {
628172
628396
  );
628173
628397
  }
628174
628398
  }
628175
- await bridge2.decideTool({ decision: "approve" }, gatedCallId, signal ? { signal } : void 0);
628399
+ await bridge2.decideTool(
628400
+ { decision: "approve", ...card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {} },
628401
+ gatedCallId,
628402
+ signal ? { signal } : void 0
628403
+ );
628176
628404
  return { kind: "decided", gatedCallId };
628177
628405
  } catch (e) {
628178
628406
  return { kind: "failed", gatedCallId, reason: `decide(approve) failed: ${String(e)}` };
@@ -628218,7 +628446,10 @@ async function surfaceToolApprovalFrameAndRespond(frame, respond, streamArgs, si
628218
628446
  );
628219
628447
  }
628220
628448
  try {
628221
- await respond(frame.approvalId, decision, signal && !signal.aborted ? { signal } : void 0);
628449
+ await respond(frame.approvalId, decision, {
628450
+ ...signal && !signal.aborted ? { signal } : {},
628451
+ ...card.kind === "allow" && card.updatedInput !== void 0 ? { updatedInput: card.updatedInput } : {}
628452
+ });
628222
628453
  return decision;
628223
628454
  } catch (e) {
628224
628455
  logForDebugging(
@@ -628928,7 +629159,7 @@ __export(skillsWire_exports, {
628928
629159
  skillCommandsToSpecs: () => skillCommandsToSpecs,
628929
629160
  toCappedSpec: () => toCappedSpec
628930
629161
  });
628931
- import { join as join182 } from "path";
629162
+ import { join as join183 } from "path";
628932
629163
  async function loadSkillSpecs(cwd5) {
628933
629164
  const [dir, plugin2] = await Promise.all([
628934
629165
  getSkillDirCommands(cwd5).catch(() => []),
@@ -628946,7 +629177,7 @@ async function loadSkillSpecs(cwd5) {
628946
629177
  await Promise.all(
628947
629178
  roots.map(async (root2) => {
628948
629179
  try {
628949
- const raw2 = await fs15.readFile(join182(root2, "SKILL.md"), { encoding: "utf-8" });
629180
+ const raw2 = await fs15.readFile(join183(root2, "SKILL.md"), { encoding: "utf-8" });
628950
629181
  const body = parseFrontmatter(raw2).content.trim();
628951
629182
  if (body) bodyByRoot.set(root2, body);
628952
629183
  } catch {
@@ -629489,7 +629720,11 @@ function createLiveConversationClient(config4) {
629489
629720
  typeof questionsRes?.respond === "function" ? (id, answer, opts) => questionsRes.respond(id, answer, opts) : null
629490
629721
  );
629491
629722
  const respondToolApproval = async (approvalId, decision, opts) => {
629492
- await client4.toolApprovals.respond(approvalId, { decision }, opts);
629723
+ const body = {
629724
+ decision,
629725
+ ...opts?.updatedInput !== void 0 ? { updatedInput: opts.updatedInput } : {}
629726
+ };
629727
+ await client4.toolApprovals.respond(approvalId, body, opts?.signal ? { signal: opts.signal } : void 0);
629493
629728
  };
629494
629729
  const baseUrlTrimmed = config4.baseUrl.replace(/\/+$/, "");
629495
629730
  const hitlDeps = {
@@ -631034,7 +631269,7 @@ var init_idleTimeout = __esm({
631034
631269
  // build-src/src/bridge/inboundAttachments.ts
631035
631270
  import { randomUUID as randomUUID54 } from "crypto";
631036
631271
  import { mkdir as mkdir48, writeFile as writeFile51 } from "fs/promises";
631037
- import { basename as basename65, join as join183 } from "path";
631272
+ import { basename as basename65, join as join184 } from "path";
631038
631273
  function debug(msg) {
631039
631274
  logForDebugging(`[bridge:inbound-attach] ${msg}`);
631040
631275
  }
@@ -631050,7 +631285,7 @@ function sanitizeFileName(name) {
631050
631285
  return base || "attachment";
631051
631286
  }
631052
631287
  function uploadsDir() {
631053
- return join183(getClaudeConfigHomeDir(), "uploads", getSessionId());
631288
+ return join184(getClaudeConfigHomeDir(), "uploads", getSessionId());
631054
631289
  }
631055
631290
  async function resolveOne(att) {
631056
631291
  const token = getBridgeAccessToken();
@@ -631079,7 +631314,7 @@ async function resolveOne(att) {
631079
631314
  const safeName = sanitizeFileName(att.file_name);
631080
631315
  const prefix = (att.file_uuid.slice(0, 8) || randomUUID54().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
631081
631316
  const dir = uploadsDir();
631082
- const outPath = join183(dir, `${prefix}-${safeName}`);
631317
+ const outPath = join184(dir, `${prefix}-${safeName}`);
631083
631318
  try {
631084
631319
  await mkdir48(dir, { recursive: true });
631085
631320
  await writeFile51(outPath, data);
@@ -631281,7 +631516,7 @@ var init_sessionUrl = __esm({
631281
631516
 
631282
631517
  // build-src/src/utils/plugins/zipCacheAdapters.ts
631283
631518
  import { readFile as readFile54 } from "fs/promises";
631284
- import { join as join184 } from "path";
631519
+ import { join as join185 } from "path";
631285
631520
  async function readZipCacheKnownMarketplaces() {
631286
631521
  try {
631287
631522
  const content = await readFile54(getZipCacheKnownMarketplacesPath(), "utf-8");
@@ -631312,13 +631547,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
631312
631547
  const content = await readMarketplaceJsonContent(installLocation);
631313
631548
  if (content !== null) {
631314
631549
  const relPath = getMarketplaceJsonRelativePath(marketplaceName);
631315
- await atomicWriteToZipCache(join184(zipCachePath, relPath), content);
631550
+ await atomicWriteToZipCache(join185(zipCachePath, relPath), content);
631316
631551
  }
631317
631552
  }
631318
631553
  async function readMarketplaceJsonContent(dir) {
631319
631554
  const candidates = [
631320
- join184(dir, ".claude-plugin", "marketplace.json"),
631321
- join184(dir, "marketplace.json"),
631555
+ join185(dir, ".claude-plugin", "marketplace.json"),
631556
+ join185(dir, "marketplace.json"),
631322
631557
  dir
631323
631558
  // For URL sources, installLocation IS the marketplace JSON file
631324
631559
  ];
@@ -631903,9 +632138,9 @@ __export(bridgePointer_exports, {
631903
632138
  writeBridgePointer: () => writeBridgePointer
631904
632139
  });
631905
632140
  import { mkdir as mkdir49, readFile as readFile55, stat as stat50, unlink as unlink27, writeFile as writeFile52 } from "fs/promises";
631906
- import { dirname as dirname80, join as join185 } from "path";
632141
+ import { dirname as dirname80, join as join186 } from "path";
631907
632142
  function getBridgePointerPath(dir) {
631908
- return join185(getProjectsDir(), sanitizePath(dir), "bridge-pointer.json");
632143
+ return join186(getProjectsDir(), sanitizePath(dir), "bridge-pointer.json");
631909
632144
  }
631910
632145
  async function writeBridgePointer(dir, pointer) {
631911
632146
  const path27 = getBridgePointerPath(dir);
@@ -639225,7 +639460,7 @@ __export(claudeDesktop_exports, {
639225
639460
  });
639226
639461
  import { readdir as readdir32, readFile as readFile57, stat as stat52 } from "fs/promises";
639227
639462
  import { homedir as homedir47 } from "os";
639228
- import { join as join186 } from "path";
639463
+ import { join as join187 } from "path";
639229
639464
  async function getClaudeDesktopConfigPath() {
639230
639465
  const platform4 = getPlatform();
639231
639466
  if (!SUPPORTED_PLATFORMS.includes(platform4)) {
@@ -639234,7 +639469,7 @@ async function getClaudeDesktopConfigPath() {
639234
639469
  );
639235
639470
  }
639236
639471
  if (platform4 === "macos") {
639237
- return join186(
639472
+ return join187(
639238
639473
  homedir47(),
639239
639474
  "Library",
639240
639475
  "Application Support",
@@ -639260,7 +639495,7 @@ async function getClaudeDesktopConfigPath() {
639260
639495
  if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
639261
639496
  continue;
639262
639497
  }
639263
- const potentialConfigPath = join186(
639498
+ const potentialConfigPath = join187(
639264
639499
  usersDir,
639265
639500
  user.name,
639266
639501
  "AppData",
@@ -639795,7 +640030,7 @@ __export(engineBgProbe_exports, {
639795
640030
  evaluateBgSwitchGate: () => evaluateBgSwitchGate,
639796
640031
  probeEngineActiveBgTasksForCli: () => probeEngineActiveBgTasksForCli
639797
640032
  });
639798
- import { readFileSync as readFileSync38 } from "node:fs";
640033
+ import { readFileSync as readFileSync39 } from "node:fs";
639799
640034
  async function drainFleetSnapshot(baseUrl, authToken) {
639800
640035
  const { AgentClient: AgentClient6 } = await import("@sema-agent/sdk");
639801
640036
  const client4 = new AgentClient6({ baseUrl, authToken, principal: "anon:shell-live" });
@@ -639854,7 +640089,7 @@ async function probeEngineActiveBgTasksForCli(deps2) {
639854
640089
  const { getEnginePortFilePath: getEnginePortFilePath2, getEngineTokenFilePath: getEngineTokenFilePath2, isProcessAlive: isProcessAlive2, probeHealth: probeHealth2 } = await Promise.resolve().then(() => (init_engineLifecycleManager(), engineLifecycleManager_exports));
639855
640090
  let anchor = null;
639856
640091
  try {
639857
- const parsed = JSON.parse(readFileSync38(getEnginePortFilePath2(), "utf8"));
640092
+ const parsed = JSON.parse(readFileSync39(getEnginePortFilePath2(), "utf8"));
639858
640093
  if (typeof parsed.port === "number" && typeof parsed.pid === "number") anchor = parsed;
639859
640094
  } catch {
639860
640095
  }
@@ -639866,7 +640101,7 @@ async function probeEngineActiveBgTasksForCli(deps2) {
639866
640101
  }
639867
640102
  let token = { mode: "loopback-unauthed" };
639868
640103
  try {
639869
- const t2 = readFileSync38(getEngineTokenFilePath2(), "utf8").trim();
640104
+ const t2 = readFileSync39(getEngineTokenFilePath2(), "utf8").trim();
639870
640105
  if (t2) token = t2;
639871
640106
  } catch {
639872
640107
  }
@@ -641453,9 +641688,9 @@ __export(tlsTrust_exports, {
641453
641688
  });
641454
641689
  import { execFileSync as execFileSync5 } from "node:child_process";
641455
641690
  import { X509Certificate } from "node:crypto";
641456
- import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync39, writeFileSync as writeFileSync18 } from "node:fs";
641691
+ import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync40, writeFileSync as writeFileSync19 } from "node:fs";
641457
641692
  import { homedir as homedir48 } from "node:os";
641458
- import { join as join187 } from "node:path";
641693
+ import { join as join188 } from "node:path";
641459
641694
  function isCertError(detail) {
641460
641695
  return /UNABLE_TO_GET_ISSUER_CERT|SELF_SIGNED_CERT|UNABLE_TO_VERIFY_LEAF|CERT_UNTRUSTED|DEPTH_ZERO_SELF_SIGNED|CERT_HAS_EXPIRED|ERR_TLS_CERT/i.test(
641461
641696
  detail
@@ -641503,7 +641738,7 @@ async function injectDispatcher(extra) {
641503
641738
  }
641504
641739
  const ca = [...tls.rootCertificates, ...extra];
641505
641740
  try {
641506
- ca.push(readFileSync39(process.env.NODE_EXTRA_CA_CERTS, "utf8"));
641741
+ ca.push(readFileSync40(process.env.NODE_EXTRA_CA_CERTS, "utf8"));
641507
641742
  } catch {
641508
641743
  }
641509
641744
  const opts = {
@@ -641521,12 +641756,12 @@ async function injectDispatcher(extra) {
641521
641756
  async function applyPersistedTlsTrust() {
641522
641757
  try {
641523
641758
  if (!existsSync26(CA_PATH)) return false;
641524
- const raw2 = readFileSync39(CA_PATH, "utf8");
641759
+ const raw2 = readFileSync40(CA_PATH, "utf8");
641525
641760
  if (!raw2.includes("BEGIN CERTIFICATE")) return false;
641526
641761
  const kept = filterCaCertificates(raw2);
641527
641762
  if (kept.length === 0) return false;
641528
641763
  const pem = kept.join("\n") + "\n";
641529
- if (pem !== raw2) writeFileSync18(CA_PATH, pem);
641764
+ if (pem !== raw2) writeFileSync19(CA_PATH, pem);
641530
641765
  await injectDispatcher(kept);
641531
641766
  return true;
641532
641767
  } catch {
@@ -641549,8 +641784,8 @@ async function applySystemTlsTrust() {
641549
641784
  }
641550
641785
  const kept = filterCaCertificates(pem);
641551
641786
  if (kept.length === 0) return false;
641552
- mkdirSync19(join187(homedir48(), ".sema"), { recursive: true });
641553
- writeFileSync18(CA_PATH, kept.join("\n") + "\n");
641787
+ mkdirSync19(join188(homedir48(), ".sema"), { recursive: true });
641788
+ writeFileSync19(CA_PATH, kept.join("\n") + "\n");
641554
641789
  await injectDispatcher(kept);
641555
641790
  return true;
641556
641791
  } catch {
@@ -641560,7 +641795,7 @@ async function applySystemTlsTrust() {
641560
641795
  var CA_PATH, builtinRootBodies;
641561
641796
  var init_tlsTrust = __esm({
641562
641797
  "build-src/src/sema/tlsTrust.ts"() {
641563
- CA_PATH = join187(homedir48(), ".sema", "extra-ca.pem");
641798
+ CA_PATH = join188(homedir48(), ".sema", "extra-ca.pem");
641564
641799
  }
641565
641800
  });
641566
641801
 
@@ -641571,11 +641806,11 @@ __export(printModeEngine_exports, {
641571
641806
  ensurePrintModeEngine: () => ensurePrintModeEngine,
641572
641807
  reclaimOneShotEngine: () => reclaimOneShotEngine
641573
641808
  });
641574
- import { readFileSync as readFileSync40, unlinkSync as unlinkSync8 } from "node:fs";
641575
- import { join as join188 } from "node:path";
641809
+ import { readFileSync as readFileSync41, unlinkSync as unlinkSync8 } from "node:fs";
641810
+ import { join as join189 } from "node:path";
641576
641811
  function seedUserSettingsEnv() {
641577
641812
  try {
641578
- const raw2 = readFileSync40(join188(getClaudeConfigHomeDir(), "settings.json"), "utf8");
641813
+ const raw2 = readFileSync41(join189(getClaudeConfigHomeDir(), "settings.json"), "utf8");
641579
641814
  const sj = JSON.parse(raw2);
641580
641815
  if (sj?.env && typeof sj.env === "object") {
641581
641816
  for (const [k2, v2] of Object.entries(sj.env)) {
@@ -641692,7 +641927,7 @@ function reclaimOneShotEngine(pid, api2, label = "one-shot") {
641692
641927
  }
641693
641928
  try {
641694
641929
  const portPath = api2.getEnginePortFilePath();
641695
- const cur = JSON.parse(readFileSync40(portPath, "utf8"));
641930
+ const cur = JSON.parse(readFileSync41(portPath, "utf8"));
641696
641931
  if (cur && cur.pid === pid) {
641697
641932
  unlinkSync8(portPath);
641698
641933
  try {
@@ -641855,8 +642090,8 @@ __export(cloudSessions_exports, {
641855
642090
  cloudSessionPush: () => cloudSessionPush,
641856
642091
  cloudSyncCommand: () => cloudSyncCommand
641857
642092
  });
641858
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync41, writeFileSync as writeFileSync19, copyFileSync as copyFileSync5 } from "node:fs";
641859
- import { join as join189 } from "node:path";
642093
+ import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync42, writeFileSync as writeFileSync20, copyFileSync as copyFileSync5 } from "node:fs";
642094
+ import { join as join190 } from "node:path";
641860
642095
  import { realpathSync as realpathSync10 } from "node:fs";
641861
642096
  function fail3(e) {
641862
642097
  err5(`Error: ${e instanceof Error ? e.message : String(e)}`);
@@ -641870,7 +642105,7 @@ function canonicalCwd2() {
641870
642105
  }
641871
642106
  }
641872
642107
  function projectDir() {
641873
- return join189(getProjectsDir(), sanitizePath(canonicalCwd2()));
642108
+ return join190(getProjectsDir(), sanitizePath(canonicalCwd2()));
641874
642109
  }
641875
642110
  async function refuseIfTurnInflight2() {
641876
642111
  const { activeTurnInflight: activeTurnInflight2 } = await Promise.resolve().then(() => (init_turnInflightMarker(), turnInflightMarker_exports));
@@ -641979,7 +642214,7 @@ async function engineIdForShellSession(shellSessionId) {
641979
642214
  try {
641980
642215
  const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
641981
642216
  const map2 = new SessionIdMapping2();
641982
- map2.setPath(join189(projectDir(), `${shellSessionId}.session-map.json`));
642217
+ map2.setPath(join190(projectDir(), `${shellSessionId}.session-map.json`));
641983
642218
  const rec = map2.read();
641984
642219
  const engineId = rec?.engines?.local?.engineSessionId ?? rec?.engineSessionId;
641985
642220
  return typeof engineId === "string" && engineId.length > 0 ? engineId : null;
@@ -642005,7 +642240,7 @@ async function recordSyncWatermark(shellSessionId, engineSessionId, peer, leafId
642005
642240
  try {
642006
642241
  const { SessionIdMapping: SessionIdMapping2, engineNamespaceKeyFor: engineNamespaceKeyFor2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
642007
642242
  const map2 = new SessionIdMapping2();
642008
- map2.setPath(join189(projectDir(), `${shellSessionId}.session-map.json`));
642243
+ map2.setPath(join190(projectDir(), `${shellSessionId}.session-map.json`));
642009
642244
  map2.persistEngineEntry(
642010
642245
  engineNamespaceKeyFor2(peer.baseUrl),
642011
642246
  {
@@ -642042,7 +642277,7 @@ async function cloudSessionPush(sessionIdArg, opts = {}) {
642042
642277
  const shellId = await resolveSessionId(sessionIdArg);
642043
642278
  const engineId = await engineIdForShellSession(shellId);
642044
642279
  if (!engineId) {
642045
- const marker = join189(projectDir(), `${shellId}.import-seed.json`);
642280
+ const marker = join190(projectDir(), `${shellId}.import-seed.json`);
642046
642281
  err5(`Error: no engine-side record for session ${shellId} \u2014 there is nothing to push.`);
642047
642282
  if (existsSync27(marker)) {
642048
642283
  err5(" This session was imported from Sema and has not run a turn here yet.");
@@ -642143,20 +642378,20 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
642143
642378
  const { syncEntriesToTranscriptLines: syncEntriesToTranscriptLines2, selectEntriesByIds: selectEntriesByIds2, lastLineUuid: lastLineUuid2 } = await Promise.resolve().then(() => (init_sessionSyncTranscript(), sessionSyncTranscript_exports));
642144
642379
  const destDir = projectDir();
642145
642380
  mkdirSync20(destDir, { recursive: true });
642146
- const jsonlPath = join189(destDir, `${id}.jsonl`);
642381
+ const jsonlPath = join190(destDir, `${id}.jsonl`);
642147
642382
  const cwd5 = canonicalCwd2();
642148
642383
  const version4 = "0.0.0-sync";
642149
642384
  let appended = 0;
642150
642385
  let skippedNonMessage = 0;
642151
642386
  if (!existsSync27(jsonlPath)) {
642152
642387
  const conv = syncEntriesToTranscriptLines2(pulled.bundle.entries, { sessionId: id, cwd: cwd5, version: version4 });
642153
- writeFileSync19(jsonlPath, conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + (conv.lines.length ? "\n" : ""));
642388
+ writeFileSync20(jsonlPath, conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + (conv.lines.length ? "\n" : ""));
642154
642389
  appended = conv.lines.length;
642155
642390
  skippedNonMessage = conv.skippedNonMessage;
642156
642391
  } else {
642157
642392
  const plan2 = engineHalf?.plan;
642158
642393
  if (plan2 && plan2.relation === "fast_forward") {
642159
- const body = readFileSync41(jsonlPath, "utf8");
642394
+ const body = readFileSync42(jsonlPath, "utf8");
642160
642395
  const known = /* @__PURE__ */ new Set();
642161
642396
  for (const line of body.split("\n")) {
642162
642397
  try {
@@ -642173,7 +642408,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
642173
642408
  startingParentUuid: lastLineUuid2(body)
642174
642409
  });
642175
642410
  if (conv.lines.length > 0) {
642176
- writeFileSync19(jsonlPath, body + (body.endsWith("\n") || body === "" ? "" : "\n") + conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + "\n");
642411
+ writeFileSync20(jsonlPath, body + (body.endsWith("\n") || body === "" ? "" : "\n") + conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + "\n");
642177
642412
  }
642178
642413
  appended = conv.lines.length;
642179
642414
  skippedNonMessage = conv.skippedNonMessage;
@@ -642182,7 +642417,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
642182
642417
  const bak = `${jsonlPath}.bak-${Date.now()}`;
642183
642418
  copyFileSync5(jsonlPath, bak);
642184
642419
  const conv = syncEntriesToTranscriptLines2(pulled.bundle.entries, { sessionId: id, cwd: cwd5, version: version4 });
642185
- writeFileSync19(jsonlPath, conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + (conv.lines.length ? "\n" : ""));
642420
+ writeFileSync20(jsonlPath, conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + (conv.lines.length ? "\n" : ""));
642186
642421
  appended = conv.lines.length;
642187
642422
  skippedNonMessage = conv.skippedNonMessage;
642188
642423
  out3(` local transcript rewritten from the cloud log (previous file kept at ${bak})`);
@@ -642193,7 +642428,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
642193
642428
  if (!engineHalf?.pushed) {
642194
642429
  try {
642195
642430
  const { importSeedMarkerPath: importSeedMarkerPath2 } = await Promise.resolve().then(() => (init_importSessions(), importSessions_exports));
642196
- writeFileSync19(
642431
+ writeFileSync20(
642197
642432
  importSeedMarkerPath2(destDir, id),
642198
642433
  JSON.stringify({ source: `sync:${cloud.baseUrl}`, importedAt: (/* @__PURE__ */ new Date()).toISOString() }) + "\n"
642199
642434
  );
@@ -642299,7 +642534,7 @@ async function cloudSyncCommand(action2, opts = {}) {
642299
642534
  }
642300
642535
  const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
642301
642536
  const map2 = new SessionIdMapping2();
642302
- map2.setPath(join189(projectDir(), `${id}.session-map.json`));
642537
+ map2.setPath(join190(projectDir(), `${id}.session-map.json`));
642303
642538
  if (action2 === "status") {
642304
642539
  await printSyncStatus(id, map2.read());
642305
642540
  return;
@@ -642317,7 +642552,7 @@ async function cloudSyncCommand(action2, opts = {}) {
642317
642552
  if (shellId) {
642318
642553
  const { SessionIdMapping: SessionIdMapping2 } = await Promise.resolve().then(() => (init_sessionIdMapping(), sessionIdMapping_exports));
642319
642554
  const map2 = new SessionIdMapping2();
642320
- map2.setPath(join189(projectDir(), `${shellId}.session-map.json`));
642555
+ map2.setPath(join190(projectDir(), `${shellId}.session-map.json`));
642321
642556
  rec = map2.read();
642322
642557
  }
642323
642558
  await printSyncStatus(shellId, rec);
@@ -642451,8 +642686,8 @@ __export(cloudResources_exports, {
642451
642686
  cloudResourceSync: () => cloudResourceSync
642452
642687
  });
642453
642688
  import { createHash as createHash26 } from "node:crypto";
642454
- import { existsSync as existsSync28, readdirSync as readdirSync11, readFileSync as readFileSync42, statSync as statSync13 } from "node:fs";
642455
- import { basename as basename66, dirname as dirname82, isAbsolute as isAbsolute33, join as join190, resolve as resolve47 } from "node:path";
642689
+ import { existsSync as existsSync28, readdirSync as readdirSync11, readFileSync as readFileSync43, statSync as statSync13 } from "node:fs";
642690
+ import { basename as basename66, dirname as dirname82, isAbsolute as isAbsolute33, join as join191, resolve as resolve47 } from "node:path";
642456
642691
  function fail4(e) {
642457
642692
  err6(`Error: ${e instanceof Error ? e.message : String(e)}`);
642458
642693
  process.exit(1);
@@ -642823,10 +643058,10 @@ function stableStringify(v2) {
642823
643058
  }
642824
643059
  async function readLocalModels() {
642825
643060
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
642826
- const path27 = join190(getClaudeConfigHomeDir3(), "config.d", "models.json");
643061
+ const path27 = join191(getClaudeConfigHomeDir3(), "config.d", "models.json");
642827
643062
  try {
642828
643063
  const { normalizeModelsDocShape: normalizeModelsDocShape2 } = await Promise.resolve().then(() => (init_modelsDocShape(), modelsDocShape_exports));
642829
- const doc = normalizeModelsDocShape2(JSON.parse(readFileSync42(path27, "utf-8")))?.doc ?? {};
643064
+ const doc = normalizeModelsDocShape2(JSON.parse(readFileSync43(path27, "utf-8")))?.doc ?? {};
642830
643065
  const models = asArr3(doc.models).map(asRec3).filter((m2) => !!m2);
642831
643066
  if (models.length > 0) return models;
642832
643067
  } catch {
@@ -642891,7 +643126,7 @@ async function loadLocalModelEntries() {
642891
643126
  async function readLocalModelRoles() {
642892
643127
  try {
642893
643128
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
642894
- const doc = JSON.parse(readFileSync42(join190(getClaudeConfigHomeDir3(), "config.d", "models.json"), "utf-8"));
643129
+ const doc = JSON.parse(readFileSync43(join191(getClaudeConfigHomeDir3(), "config.d", "models.json"), "utf-8"));
642895
643130
  return asRec3(doc.roles);
642896
643131
  } catch {
642897
643132
  return void 0;
@@ -642979,7 +643214,7 @@ async function loadLocalMcpEntries() {
642979
643214
  function readMcpFromFile(path27) {
642980
643215
  let doc;
642981
643216
  try {
642982
- doc = JSON.parse(readFileSync42(resolve47(path27), "utf-8"));
643217
+ doc = JSON.parse(readFileSync43(resolve47(path27), "utf-8"));
642983
643218
  } catch (e) {
642984
643219
  return { error: `cannot read/parse ${path27}: ${e instanceof Error ? e.message : String(e)}` };
642985
643220
  }
@@ -643004,13 +643239,13 @@ function readMcpFromFile(path27) {
643004
643239
  async function skillRoots() {
643005
643240
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
643006
643241
  const { getProjectDirsUpToHome: getProjectDirsUpToHome2 } = await Promise.resolve().then(() => (init_markdownConfigLoader(), markdownConfigLoader_exports));
643007
- return [...getProjectDirsUpToHome2("skills", process.cwd()), join190(getClaudeConfigHomeDir3(), "skills")];
643242
+ return [...getProjectDirsUpToHome2("skills", process.cwd()), join191(getClaudeConfigHomeDir3(), "skills")];
643008
643243
  }
643009
643244
  async function resolveSkillFile(target) {
643010
643245
  const tryFile = (p) => {
643011
643246
  try {
643012
643247
  if (!existsSync28(p)) return null;
643013
- return statSync13(p).isDirectory() ? existsSync28(join190(p, "SKILL.md")) ? join190(p, "SKILL.md") : null : p;
643248
+ return statSync13(p).isDirectory() ? existsSync28(join191(p, "SKILL.md")) ? join191(p, "SKILL.md") : null : p;
643014
643249
  } catch {
643015
643250
  return null;
643016
643251
  }
@@ -643023,7 +643258,7 @@ async function resolveSkillFile(target) {
643023
643258
  }
643024
643259
  const roots = await skillRoots();
643025
643260
  for (const root2 of roots) {
643026
- const f = tryFile(join190(root2, target));
643261
+ const f = tryFile(join191(root2, target));
643027
643262
  if (f) return { file: f, fallbackName: target };
643028
643263
  }
643029
643264
  return { error: `no skill named '${target}' in the project or user skills directories (${roots.join(", ") || "none found"}) \u2014 pass a path to install from elsewhere` };
@@ -643031,7 +643266,7 @@ async function resolveSkillFile(target) {
643031
643266
  async function readSkillEntry(file2, fallbackName) {
643032
643267
  let raw2;
643033
643268
  try {
643034
- raw2 = readFileSync42(file2, "utf-8");
643269
+ raw2 = readFileSync43(file2, "utf-8");
643035
643270
  } catch (e) {
643036
643271
  return { name: fallbackName, display: fallbackName, entry: null, notes: [], skipReason: `cannot read ${file2}: ${e instanceof Error ? e.message : String(e)}` };
643037
643272
  }
@@ -643064,7 +643299,7 @@ async function loadLocalSkillEntries() {
643064
643299
  try {
643065
643300
  dirs = readdirSync11(root2).filter((d4) => {
643066
643301
  try {
643067
- return statSync13(join190(root2, d4)).isDirectory() && existsSync28(join190(root2, d4, "SKILL.md"));
643302
+ return statSync13(join191(root2, d4)).isDirectory() && existsSync28(join191(root2, d4, "SKILL.md"));
643068
643303
  } catch {
643069
643304
  return false;
643070
643305
  }
@@ -643073,7 +643308,7 @@ async function loadLocalSkillEntries() {
643073
643308
  continue;
643074
643309
  }
643075
643310
  for (const d4 of dirs) {
643076
- const e = await readSkillEntry(join190(root2, d4, "SKILL.md"), d4);
643311
+ const e = await readSkillEntry(join191(root2, d4, "SKILL.md"), d4);
643077
643312
  if (!byName2.has(e.name)) byName2.set(e.name, e);
643078
643313
  }
643079
643314
  }
@@ -643806,7 +644041,7 @@ import { execFileSync as execFileSync6, spawn as spawn14 } from "child_process";
643806
644041
  import { existsSync as existsSync29, statSync as statSync14 } from "fs";
643807
644042
  import { createRequire as createRequire4 } from "module";
643808
644043
  import { createInterface as createInterface3 } from "readline";
643809
- import { dirname as dirname83, join as join191, resolve as resolve48 } from "path";
644044
+ import { dirname as dirname83, join as join192, resolve as resolve48 } from "path";
643810
644045
  function fail5(e) {
643811
644046
  err7(`Error: ${e instanceof Error ? e.message : String(e)}`);
643812
644047
  process.exit(1);
@@ -643824,15 +644059,15 @@ function npmEngineLocalCandidates() {
643824
644059
  const candidates = [];
643825
644060
  for (const pkg of ENGINE_NPM_PACKAGES) {
643826
644061
  try {
643827
- const req = createRequire4(join191(process.cwd(), "__sema_resolve__.js"));
643828
- candidates.push(join191(dirname83(req.resolve(`${pkg}/package.json`)), ENGINE_REL_PATH));
644062
+ const req = createRequire4(join192(process.cwd(), "__sema_resolve__.js"));
644063
+ candidates.push(join192(dirname83(req.resolve(`${pkg}/package.json`)), ENGINE_REL_PATH));
643829
644064
  } catch {
643830
644065
  }
643831
644066
  }
643832
644067
  let dir = process.cwd();
643833
644068
  for (; ; ) {
643834
644069
  for (const pkg of ENGINE_NPM_PACKAGES) {
643835
- candidates.push(join191(dir, "node_modules", pkg, ENGINE_REL_PATH));
644070
+ candidates.push(join192(dir, "node_modules", pkg, ENGINE_REL_PATH));
643836
644071
  }
643837
644072
  const parent2 = dirname83(dir);
643838
644073
  if (parent2 === dir) break;
@@ -643843,7 +644078,7 @@ function npmEngineLocalCandidates() {
643843
644078
  function npmEngineGlobalCandidates() {
643844
644079
  try {
643845
644080
  const globalRoot = execFileSync6("npm", ["root", "-g"], { encoding: "utf8", timeout: 1e4 }).trim();
643846
- return globalRoot ? ENGINE_NPM_PACKAGES.map((pkg) => join191(globalRoot, pkg, ENGINE_REL_PATH)) : [];
644081
+ return globalRoot ? ENGINE_NPM_PACKAGES.map((pkg) => join192(globalRoot, pkg, ENGINE_REL_PATH)) : [];
643847
644082
  } catch {
643848
644083
  return [];
643849
644084
  }
@@ -643853,9 +644088,9 @@ function resolveEnginePath(engineFlag) {
643853
644088
  for (const base of [engineFlag, process.env.SEMA_UP_ENGINE]) {
643854
644089
  if (!base) continue;
643855
644090
  const abs = resolve48(base);
643856
- explicit.push(abs, join191(abs, "sema-up.sh"));
644091
+ explicit.push(abs, join192(abs, "sema-up.sh"));
643857
644092
  }
643858
- return firstExistingFile(explicit) ?? firstExistingFile(npmEngineLocalCandidates()) ?? firstExistingFile(npmEngineGlobalCandidates()) ?? firstExistingFile([join191(process.cwd(), "deploy", "sema-up", "sema-up.sh")]);
644093
+ return firstExistingFile(explicit) ?? firstExistingFile(npmEngineLocalCandidates()) ?? firstExistingFile(npmEngineGlobalCandidates()) ?? firstExistingFile([join192(process.cwd(), "deploy", "sema-up", "sema-up.sh")]);
643859
644094
  }
643860
644095
  async function promptQuestion(reader, q2) {
643861
644096
  out5("");
@@ -644125,7 +644360,7 @@ var init_cloudOps = __esm({
644125
644360
  err7 = (line) => process.stderr.write(`${line}
644126
644361
  `);
644127
644362
  ENGINE_NPM_PACKAGES = ["@sema-agent/server", "@sema-ai/server"];
644128
- ENGINE_REL_PATH = join191("deploy", "sema-up", "sema-up.sh");
644363
+ ENGINE_REL_PATH = join192("deploy", "sema-up", "sema-up.sh");
644129
644364
  AnswerReader = class {
644130
644365
  queue = [];
644131
644366
  waiter;
@@ -645951,7 +646186,7 @@ var Doctor_exports = {};
645951
646186
  __export(Doctor_exports, {
645952
646187
  Doctor: () => Doctor
645953
646188
  });
645954
- import { join as join192 } from "path";
646189
+ import { join as join193 } from "path";
645955
646190
  function Doctor(t0) {
645956
646191
  const $3 = (0, import_compiler_runtime346.c)(84);
645957
646192
  const {
@@ -646021,8 +646256,8 @@ function Doctor(t0) {
646021
646256
  t5 = () => {
646022
646257
  getDoctorDiagnostic().then(setDiagnostic);
646023
646258
  (async () => {
646024
- const userAgentsDir = join192(getClaudeConfigHomeDir(), "agents");
646025
- const projectAgentsDir = join192(getOriginalCwd(), ".sema", "agents");
646259
+ const userAgentsDir = join193(getClaudeConfigHomeDir(), "agents");
646260
+ const projectAgentsDir = join193(getOriginalCwd(), ".sema", "agents");
646026
646261
  const {
646027
646262
  activeAgents,
646028
646263
  allAgents,
@@ -646045,7 +646280,7 @@ function Doctor(t0) {
646045
646280
  }, async () => toolPermissionContext);
646046
646281
  setContextWarnings(warnings);
646047
646282
  if (isPidBasedLockingEnabled()) {
646048
- const locksDir = join192(getXDGStateHome(), "claude", "locks");
646283
+ const locksDir = join193(getXDGStateHome(), "claude", "locks");
646049
646284
  const staleLocksCleaned = cleanupStaleLocks(locksDir);
646050
646285
  const locks = getAllLockInfo(locksDir);
646051
646286
  setVersionLockInfo({
@@ -647880,17 +648115,17 @@ import {
647880
648115
  existsSync as existsSync30,
647881
648116
  mkdirSync as mkdirSync21,
647882
648117
  readdirSync as readdirSync12,
647883
- readFileSync as readFileSync43,
648118
+ readFileSync as readFileSync44,
647884
648119
  statSync as statSync15
647885
648120
  } from "node:fs";
647886
- import { dirname as dirname85, join as join193, relative as relative36 } from "node:path";
648121
+ import { dirname as dirname85, join as join194, relative as relative36 } from "node:path";
647887
648122
  function display(p) {
647888
648123
  const home = homedir50();
647889
648124
  return p.startsWith(home) ? "~" + p.slice(home.length) : p;
647890
648125
  }
647891
648126
  function filesEqual(a, b3) {
647892
648127
  try {
647893
- return readFileSync43(a).equals(readFileSync43(b3));
648128
+ return readFileSync44(a).equals(readFileSync44(b3));
647894
648129
  } catch {
647895
648130
  return false;
647896
648131
  }
@@ -647963,7 +648198,7 @@ function syncPlainFile(src, dest, label, opts, report) {
647963
648198
  }
647964
648199
  function syncJsonFile(src, dest, label, opts, report) {
647965
648200
  if (!existsSync30(src)) return;
647966
- const srcText = readFileSync43(src, "utf-8");
648201
+ const srcText = readFileSync44(src, "utf-8");
647967
648202
  if (!existsSync30(dest)) {
647968
648203
  if (!opts.dryRun) {
647969
648204
  ensureDir2(dest);
@@ -647972,7 +648207,7 @@ function syncJsonFile(src, dest, label, opts, report) {
647972
648207
  recordAction(report, { action: "copy", label });
647973
648208
  return;
647974
648209
  }
647975
- const destText = readFileSync43(dest, "utf-8");
648210
+ const destText = readFileSync44(dest, "utf-8");
647976
648211
  if (Buffer.from(srcText).equals(Buffer.from(destText))) {
647977
648212
  recordAction(report, { action: "same", label });
647978
648213
  return;
@@ -648027,8 +648262,8 @@ function syncTree(srcDir, destDir, labelBase, opts, report) {
648027
648262
  return;
648028
648263
  }
648029
648264
  for (const name of readdirSync12(srcDir)) {
648030
- const srcChild = join193(srcDir, name);
648031
- const destChild = join193(destDir, name);
648265
+ const srcChild = join194(srcDir, name);
648266
+ const destChild = join194(destDir, name);
648032
648267
  let childStat;
648033
648268
  try {
648034
648269
  childStat = statSync15(srcChild);
@@ -648067,12 +648302,12 @@ function syncRoot(srcRoot, destRoot, manifest, scopeLabel, opts, report) {
648067
648302
  return;
648068
648303
  }
648069
648304
  for (const dir of manifest.dirs) {
648070
- syncTree(join193(srcRoot, dir), join193(destRoot, dir), dir, opts, report);
648305
+ syncTree(join194(srcRoot, dir), join194(destRoot, dir), dir, opts, report);
648071
648306
  }
648072
648307
  for (const file2 of manifest.plainFiles) {
648073
648308
  syncPlainFile(
648074
- join193(srcRoot, file2),
648075
- join193(destRoot, file2),
648309
+ join194(srcRoot, file2),
648310
+ join194(destRoot, file2),
648076
648311
  file2,
648077
648312
  opts,
648078
648313
  report
@@ -648080,8 +648315,8 @@ function syncRoot(srcRoot, destRoot, manifest, scopeLabel, opts, report) {
648080
648315
  }
648081
648316
  for (const file2 of manifest.jsonFiles) {
648082
648317
  syncJsonFile(
648083
- join193(srcRoot, file2),
648084
- join193(destRoot, file2),
648318
+ join194(srcRoot, file2),
648319
+ join194(destRoot, file2),
648085
648320
  file2,
648086
648321
  opts,
648087
648322
  report
@@ -648115,7 +648350,7 @@ async function configSyncHandler(opts) {
648115
648350
  const dryTag = opts.dryRun ? source_default.yellow(" [dry-run]") : "";
648116
648351
  process.stdout.write(source_default.bold(`sema config sync${dryTag}
648117
648352
  `));
648118
- const userSrc = join193(homedir50(), LEGACY_DIR3);
648353
+ const userSrc = join194(homedir50(), LEGACY_DIR3);
648119
648354
  const userDest = getClaudeConfigHomeDir();
648120
648355
  process.stdout.write(
648121
648356
  source_default.bold(`
@@ -648135,15 +648370,15 @@ user: ${display(userSrc)} \u2192 ${display(userDest)}
648135
648370
  opts,
648136
648371
  report
648137
648372
  );
648138
- const globalSrc = join193(homedir50(), LEGACY_GLOBAL_FILE);
648373
+ const globalSrc = join194(homedir50(), LEGACY_GLOBAL_FILE);
648139
648374
  const globalDest = getGlobalClaudeFile();
648140
648375
  if (existsSync30(globalSrc) && globalSrc !== globalDest) {
648141
648376
  syncJsonFile(globalSrc, globalDest, display(globalDest), opts, report);
648142
648377
  }
648143
648378
  flushEntries(report, userStart, opts);
648144
648379
  if (opts.project) {
648145
- const projSrc = join193(process.cwd(), LEGACY_DIR3);
648146
- const projDest = join193(process.cwd(), ".sema");
648380
+ const projSrc = join194(process.cwd(), LEGACY_DIR3);
648381
+ const projDest = join194(process.cwd(), ".sema");
648147
648382
  process.stdout.write(
648148
648383
  source_default.bold(
648149
648384
  `
@@ -648249,9 +648484,9 @@ __export(importCredentials_exports, {
648249
648484
  importCredentialsHandler: () => importCredentialsHandler
648250
648485
  });
648251
648486
  import { execFileSync as execFileSync7 } from "node:child_process";
648252
- import { readFileSync as readFileSync44 } from "node:fs";
648487
+ import { readFileSync as readFileSync45 } from "node:fs";
648253
648488
  import { homedir as homedir51, userInfo as userInfo4 } from "node:os";
648254
- import { join as join194 } from "node:path";
648489
+ import { join as join195 } from "node:path";
648255
648490
  function readCcKeychain() {
648256
648491
  if (process.platform !== "darwin") return null;
648257
648492
  try {
@@ -648267,13 +648502,13 @@ function readCcKeychain() {
648267
648502
  }
648268
648503
  function readCcFile(ccRoot) {
648269
648504
  try {
648270
- return JSON.parse(readFileSync44(join194(ccRoot, ".credentials.json"), "utf-8"));
648505
+ return JSON.parse(readFileSync45(join195(ccRoot, ".credentials.json"), "utf-8"));
648271
648506
  } catch {
648272
648507
  return null;
648273
648508
  }
648274
648509
  }
648275
648510
  async function importCredentialsHandler(opts) {
648276
- const ccRoot = opts.from ?? join194(homedir51(), LEGACY_DIR4);
648511
+ const ccRoot = opts.from ?? join195(homedir51(), LEGACY_DIR4);
648277
648512
  const fromKeychain = readCcKeychain();
648278
648513
  const fromFile = readCcFile(ccRoot);
648279
648514
  if (!fromKeychain && !fromFile) {
@@ -648349,9 +648584,9 @@ var init_importCredentials = __esm({
648349
648584
  });
648350
648585
 
648351
648586
  // build-src/src/sema/config/mcpChannels.ts
648352
- import { readFileSync as readFileSync45 } from "node:fs";
648587
+ import { readFileSync as readFileSync46 } from "node:fs";
648353
648588
  import { homedir as homedir52 } from "node:os";
648354
- import { join as join195 } from "node:path";
648589
+ import { join as join196 } from "node:path";
648355
648590
  function mcpTransportOf(config4) {
648356
648591
  const c2 = config4;
648357
648592
  if (c2?.type) return c2.type;
@@ -648381,7 +648616,7 @@ function userScopeMcpNames() {
648381
648616
  }
648382
648617
  function readJsoncSafe(path27) {
648383
648618
  try {
648384
- const raw2 = parse5(readFileSync45(path27, "utf-8"), [], { allowTrailingComma: true });
648619
+ const raw2 = parse5(readFileSync46(path27, "utf-8"), [], { allowTrailingComma: true });
648385
648620
  return raw2 && typeof raw2 === "object" ? raw2 : null;
648386
648621
  } catch {
648387
648622
  return null;
@@ -648405,14 +648640,14 @@ function externalEntryToConfig(e) {
648405
648640
  }
648406
648641
  function detectMcpChannels() {
648407
648642
  const out6 = [];
648408
- const ccRoot = process.env.SEMA_CC_ROOT || join195(homedir52(), CC_DIR4);
648643
+ const ccRoot = process.env.SEMA_CC_ROOT || join196(homedir52(), CC_DIR4);
648409
648644
  const merged = {};
648410
- const settings2 = readJsoncSafe(join195(ccRoot, "settings.json"));
648645
+ const settings2 = readJsoncSafe(join196(ccRoot, "settings.json"));
648411
648646
  const settingsServers = settings2?.mcpServers;
648412
648647
  if (settingsServers && typeof settingsServers === "object") {
648413
648648
  Object.assign(merged, settingsServers);
648414
648649
  }
648415
- const globalDoc = readJsoncSafe(join195(homedir52(), CC_GLOBAL_FILE2));
648650
+ const globalDoc = readJsoncSafe(join196(homedir52(), CC_GLOBAL_FILE2));
648416
648651
  const globalServers = globalDoc?.mcpServers;
648417
648652
  if (globalServers && typeof globalServers === "object") {
648418
648653
  Object.assign(merged, globalServers);
@@ -648847,17 +649082,17 @@ var init_navStack = __esm({
648847
649082
  });
648848
649083
 
648849
649084
  // build-src/src/sema/config/skillsChannels.ts
648850
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readdirSync as readdirSync13, readFileSync as readFileSync46, realpathSync as realpathSync11, renameSync as renameSync9, statSync as statSync16 } from "node:fs";
648851
- import { basename as basename68, dirname as dirname86, join as join196 } from "node:path";
649085
+ import { existsSync as existsSync31, mkdirSync as mkdirSync22, readdirSync as readdirSync13, readFileSync as readFileSync47, realpathSync as realpathSync11, renameSync as renameSync9, statSync as statSync16 } from "node:fs";
649086
+ import { basename as basename68, dirname as dirname86, join as join197 } from "node:path";
648852
649087
  function skillsDirFor(source) {
648853
- return source === "user" ? join196(getClaudeConfigHomeDir(), "skills") : join196(getCwd(), ".sema", "skills");
649088
+ return source === "user" ? join197(getClaudeConfigHomeDir(), "skills") : join197(getCwd(), ".sema", "skills");
648854
649089
  }
648855
649090
  function readSkillMeta(mdPath, name) {
648856
649091
  let description;
648857
649092
  let whenToUse;
648858
649093
  let mtimeMs;
648859
649094
  try {
648860
- const { frontmatter: frontmatter2 } = parseFrontmatter(readFileSync46(mdPath, "utf-8"));
649095
+ const { frontmatter: frontmatter2 } = parseFrontmatter(readFileSync47(mdPath, "utf-8"));
648861
649096
  if (typeof frontmatter2.description === "string") description = frontmatter2.description;
648862
649097
  if (typeof frontmatter2.when_to_use === "string") whenToUse = frontmatter2.when_to_use;
648863
649098
  } catch {
@@ -648909,10 +649144,10 @@ function listInstalledSkills() {
648909
649144
  continue;
648910
649145
  }
648911
649146
  for (const entry of entries.sort()) {
648912
- const p = join196(dir, entry);
649147
+ const p = join197(dir, entry);
648913
649148
  try {
648914
649149
  if (statSync16(p).isDirectory()) {
648915
- const md3 = join196(p, "SKILL.md");
649150
+ const md3 = join197(p, "SKILL.md");
648916
649151
  out6.push({ name: entry, source, root: p, ...readSkillMeta(md3, entry) });
648917
649152
  } else if (entry.endsWith(".md")) {
648918
649153
  const name = entry.replace(/\.md$/, "");
@@ -648928,12 +649163,12 @@ function listInstalledSkills() {
648928
649163
  function removeSkillWithBackup(skill) {
648929
649164
  try {
648930
649165
  const skillsDir = dirname86(skill.root);
648931
- const removedDir = join196(
649166
+ const removedDir = join197(
648932
649167
  dirname86(skillsDir),
648933
649168
  `skills-removed-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`
648934
649169
  );
648935
649170
  mkdirSync22(removedDir, { recursive: true });
648936
- let target = join196(removedDir, basename68(skill.root));
649171
+ let target = join197(removedDir, basename68(skill.root));
648937
649172
  if (existsSync31(target)) target = `${target}-${Date.now()}`;
648938
649173
  renameSync9(skill.root, target);
648939
649174
  const nameStillPresent = listInstalledSkills().some((s) => s.name === skill.name);
@@ -649006,12 +649241,12 @@ var init_skillsChannels = __esm({
649006
649241
  });
649007
649242
 
649008
649243
  // build-src/src/sema/config/EngineScreen.tsx
649009
- import { readFileSync as readFileSync47 } from "node:fs";
649010
- import { join as join197 } from "node:path";
649244
+ import { readFileSync as readFileSync48 } from "node:fs";
649245
+ import { join as join198 } from "node:path";
649011
649246
  function settingsEnv3() {
649012
649247
  try {
649013
649248
  const sj = JSON.parse(
649014
- readFileSync47(join197(getClaudeConfigHomeDir(), "settings.json"), "utf8")
649249
+ readFileSync48(join198(getClaudeConfigHomeDir(), "settings.json"), "utf8")
649015
649250
  );
649016
649251
  const out6 = {};
649017
649252
  if (sj?.env) {
@@ -649310,7 +649545,7 @@ function mcpEntriesScreen(ch2, flow) {
649310
649545
  title: `Import from ${ch2.label} \u2014 pick servers`,
649311
649546
  intro: "Space picks the servers to copy into sema (user scope). Already-installed ones are pre-checked \u2014 unchecking removes them.",
649312
649547
  items,
649313
- hint: "space to toggle \xB7 unchecking an installed server removes it \xB7 enter on Continue to apply \xB7 esc to cancel",
649548
+ hint: "space to toggle \xB7 unchecking an installed server removes it \xB7 enter to apply \xB7 esc to cancel",
649314
649549
  onContinue: (checked, nav2) => {
649315
649550
  void applyMcpSelection(ch2.servers, checked, installed3).then((res) => {
649316
649551
  const parts = [];
@@ -649577,7 +649812,7 @@ function skillsEntriesScreen(ch2, flow) {
649577
649812
  title: `Import from ${ch2.label} \u2014 pick skills`,
649578
649813
  intro: "Space picks the skills to copy into sema. Already-installed ones are pre-checked \u2014 unchecking moves them to a backup dir.",
649579
649814
  items,
649580
- hint: "space to toggle \xB7 unchecking an installed skill moves it to backup \xB7 enter on Continue to apply \xB7 esc to cancel",
649815
+ hint: "space to toggle \xB7 unchecking an installed skill moves it to backup \xB7 enter to apply \xB7 esc to cancel",
649581
649816
  onContinue: (checked, nav2) => {
649582
649817
  const res = applySkillSelection(ch2, checked, preInstalled);
649583
649818
  const parts = [];
@@ -649793,9 +650028,9 @@ var init_SkillsHub = __esm({
649793
650028
  });
649794
650029
 
649795
650030
  // build-src/src/sema/config/PluginsHub.tsx
649796
- import { readFileSync as readFileSync48 } from "node:fs";
650031
+ import { readFileSync as readFileSync49 } from "node:fs";
649797
650032
  import { homedir as homedir53 } from "node:os";
649798
- import { join as join198 } from "node:path";
650033
+ import { join as join199 } from "node:path";
649799
650034
  function listInstalledPluginRows() {
649800
650035
  let plugins = {};
649801
650036
  try {
@@ -649821,16 +650056,16 @@ function listInstalledPluginRows() {
649821
650056
  }
649822
650057
  function readJsonSafe(path27) {
649823
650058
  try {
649824
- const raw2 = JSON.parse(readFileSync48(path27, "utf-8"));
650059
+ const raw2 = JSON.parse(readFileSync49(path27, "utf-8"));
649825
650060
  return raw2 && typeof raw2 === "object" ? raw2 : null;
649826
650061
  } catch {
649827
650062
  return null;
649828
650063
  }
649829
650064
  }
649830
650065
  function detectCcPlugins() {
649831
- const ccRoot = process.env.SEMA_CC_ROOT || join198(homedir53(), CC_DIR5);
650066
+ const ccRoot = process.env.SEMA_CC_ROOT || join199(homedir53(), CC_DIR5);
649832
650067
  const byId = /* @__PURE__ */ new Map();
649833
- const installedDoc = readJsonSafe(join198(ccRoot, "plugins", "installed_plugins.json"));
650068
+ const installedDoc = readJsonSafe(join199(ccRoot, "plugins", "installed_plugins.json"));
649834
650069
  const pluginsField = installedDoc?.plugins;
649835
650070
  if (pluginsField && typeof pluginsField === "object") {
649836
650071
  for (const [id, v2] of Object.entries(pluginsField)) {
@@ -649838,7 +650073,7 @@ function detectCcPlugins() {
649838
650073
  byId.set(id, { id, version: entry?.version });
649839
650074
  }
649840
650075
  }
649841
- const settings2 = readJsonSafe(join198(ccRoot, "settings.json"));
650076
+ const settings2 = readJsonSafe(join199(ccRoot, "settings.json"));
649842
650077
  const enabled = settings2?.enabledPlugins;
649843
650078
  if (enabled && typeof enabled === "object") {
649844
650079
  for (const [id, on] of Object.entries(enabled)) {
@@ -649846,7 +650081,7 @@ function detectCcPlugins() {
649846
650081
  byId.set(id, { ...cur, enabledInCc: on !== false });
649847
650082
  }
649848
650083
  }
649849
- const mkts = readJsonSafe(join198(ccRoot, "plugins", "known_marketplaces.json"));
650084
+ const mkts = readJsonSafe(join199(ccRoot, "plugins", "known_marketplaces.json"));
649850
650085
  const marketplaces = mkts ? Object.keys(mkts) : [];
649851
650086
  return { plugins: [...byId.values()].sort((a, b3) => a.id.localeCompare(b3.id)), marketplaces };
649852
650087
  }
@@ -649934,7 +650169,7 @@ function ccImportScreen(flow) {
649934
650169
  intro: "Space picks the plugins to install into sema (user scope). Installing fetches from the marketplace, so it needs network.",
649935
650170
  items,
649936
650171
  emptyText: "No CC plugins detected (looked at plugins/installed_plugins.json and settings enabledPlugins).",
649937
- hint: "space to toggle \xB7 enter on Continue to install the new selections (needs network) \xB7 esc to cancel",
650172
+ hint: "space to toggle \xB7 enter to install the selections (needs network) \xB7 esc to cancel",
649938
650173
  onContinue: (checked, nav2) => {
649939
650174
  const toInstall = [...checked].filter((id) => !installed3.has(id));
649940
650175
  if (toInstall.length === 0) {
@@ -650784,16 +651019,9 @@ function MultiSelectBody({
650784
651019
  else checked.add(item.key);
650785
651020
  bump();
650786
651021
  } else if (key.return) {
650787
- if (cursor === 0) {
650788
- opts.onContinue(new Set(checked), nav);
650789
- } else {
650790
- const item = rows2[cursor - 1];
650791
- if (item) {
650792
- if (checked.has(item.key)) checked.delete(item.key);
650793
- else checked.add(item.key);
650794
- bump();
650795
- }
650796
- }
651022
+ const item = cursor === 0 ? void 0 : rows2[cursor - 1];
651023
+ if (item) checked.add(item.key);
651024
+ opts.onContinue(new Set(checked), nav);
650797
651025
  }
650798
651026
  });
650799
651027
  return /* @__PURE__ */ (0, import_jsx_runtime504.jsxs)(ThemedBox_default, { flexDirection: "column", paddingLeft: 1, children: [
@@ -650817,7 +651045,7 @@ function MultiSelectBody({
650817
651045
  ] })
650818
651046
  ] }, item.key);
650819
651047
  }) }),
650820
- /* @__PURE__ */ (0, import_jsx_runtime504.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime504.jsx)(ThemedText, { dimColor: true, children: opts.hint ?? "space to toggle \xB7 enter on Continue to confirm \xB7 esc to cancel" }) })
651048
+ /* @__PURE__ */ (0, import_jsx_runtime504.jsx)(ThemedBox_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime504.jsx)(ThemedText, { dimColor: true, children: opts.hint ?? "space to toggle \xB7 enter to confirm \xB7 esc to cancel" }) })
650821
651049
  ] });
650822
651050
  }
650823
651051
  var React182, import_jsx_runtime504;
@@ -652227,7 +652455,7 @@ __export(main_exports, {
652227
652455
  main: () => main,
652228
652456
  startDeferredPrefetches: () => startDeferredPrefetches
652229
652457
  });
652230
- import { readFileSync as readFileSync49 } from "fs";
652458
+ import { readFileSync as readFileSync50 } from "fs";
652231
652459
  import { resolve as resolve51 } from "path";
652232
652460
  function logManagedSettings() {
652233
652461
  try {
@@ -652394,7 +652622,7 @@ function loadSettingsFromFlag(settingsFile) {
652394
652622
  resolvedPath: resolvedSettingsPath
652395
652623
  } = safeResolvePath(getFsImplementation(), settingsFile);
652396
652624
  try {
652397
- readFileSync49(resolvedSettingsPath, "utf8");
652625
+ readFileSync50(resolvedSettingsPath, "utf8");
652398
652626
  } catch (e) {
652399
652627
  if (isENOENT(e)) {
652400
652628
  process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
@@ -652971,7 +653199,7 @@ ${getTmuxInstallInstructions2()}
652971
653199
  }
652972
653200
  try {
652973
653201
  const filePath = resolve51(options.systemPromptFile);
652974
- systemPrompt = readFileSync49(filePath, "utf8");
653202
+ systemPrompt = readFileSync50(filePath, "utf8");
652975
653203
  } catch (error51) {
652976
653204
  const code2 = getErrnoCode(error51);
652977
653205
  if (code2 === "ENOENT") {
@@ -652992,7 +653220,7 @@ ${getTmuxInstallInstructions2()}
652992
653220
  }
652993
653221
  try {
652994
653222
  const filePath = resolve51(options.appendSystemPromptFile);
652995
- appendSystemPrompt = readFileSync49(filePath, "utf8");
653223
+ appendSystemPrompt = readFileSync50(filePath, "utf8");
652996
653224
  } catch (error51) {
652997
653225
  const code2 = getErrnoCode(error51);
652998
653226
  if (code2 === "ENOENT") {
@@ -654879,7 +655107,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
654879
655107
  pendingHookMessages
654880
655108
  }, renderAndRun);
654881
655109
  }
654882
- }).version("sema 1.0.39", "-v, --version", "Output the version number");
655110
+ }).version("sema 1.0.40", "-v, --version", "Output the version number");
654883
655111
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
654884
655112
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
654885
655113
  if (canUserConfigureAdvisor()) {
@@ -658383,14 +658611,14 @@ __export(claudeImportHint_exports, {
658383
658611
  });
658384
658612
  import { existsSync as existsSync32 } from "node:fs";
658385
658613
  import { homedir as homedir55 } from "node:os";
658386
- import { join as join199 } from "node:path";
658614
+ import { join as join200 } from "node:path";
658387
658615
  function shouldShowClaudeImportHint() {
658388
658616
  try {
658389
658617
  const claudeEnvKey = "CLAUDE_CONFIG_DIR";
658390
658618
  if (process.env.SEMA_CONFIG_DIR || process.env[claudeEnvKey]) return false;
658391
- const legacyDir = join199(homedir55(), ".claude");
658619
+ const legacyDir = join200(homedir55(), ".claude");
658392
658620
  if (!existsSync32(legacyDir)) return false;
658393
- if (existsSync32(join199(homedir55(), ".sema"))) return false;
658621
+ if (existsSync32(join200(homedir55(), ".sema"))) return false;
658394
658622
  if (getGlobalConfig().hasSeenClaudeImportHint) return false;
658395
658623
  return true;
658396
658624
  } catch {
@@ -658426,15 +658654,15 @@ var semaSettingsSeed_exports = {};
658426
658654
  __export(semaSettingsSeed_exports, {
658427
658655
  seedSemaSettings: () => seedSemaSettings
658428
658656
  });
658429
- import { existsSync as existsSync33, mkdirSync as mkdirSync23, readFileSync as readFileSync50, writeFileSync as writeFileSync20 } from "node:fs";
658430
- import { dirname as dirname87, join as join200 } from "node:path";
658657
+ import { existsSync as existsSync33, mkdirSync as mkdirSync23, readFileSync as readFileSync51, writeFileSync as writeFileSync21 } from "node:fs";
658658
+ import { dirname as dirname87, join as join201 } from "node:path";
658431
658659
  function seedSemaSettings() {
658432
- const file2 = join200(getClaudeConfigHomeDir(), "settings.json");
658660
+ const file2 = join201(getClaudeConfigHomeDir(), "settings.json");
658433
658661
  let current3 = {};
658434
658662
  let parsedOk = false;
658435
658663
  try {
658436
658664
  if (existsSync33(file2)) {
658437
- const parsed = JSON.parse(readFileSync50(file2, "utf8"));
658665
+ const parsed = JSON.parse(readFileSync51(file2, "utf8"));
658438
658666
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
658439
658667
  current3 = parsed;
658440
658668
  parsedOk = true;
@@ -658456,7 +658684,7 @@ function seedSemaSettings() {
658456
658684
  if (added.length === 0) return { wrote: false, path: file2, added };
658457
658685
  try {
658458
658686
  mkdirSync23(dirname87(file2), { recursive: true });
658459
- writeFileSync20(file2, JSON.stringify(current3, null, 2) + "\n", "utf8");
658687
+ writeFileSync21(file2, JSON.stringify(current3, null, 2) + "\n", "utf8");
658460
658688
  } catch {
658461
658689
  return { wrote: false, path: file2, added: [] };
658462
658690
  }
@@ -658743,12 +658971,12 @@ var init_local_load = __esm({
658743
658971
  });
658744
658972
 
658745
658973
  // node_modules/@sema-agent/registry-core/dist/scheduler-store-node.js
658746
- import { mkdirSync as mkdirSync24, readFileSync as readFileSync51, writeFileSync as writeFileSync21, renameSync as renameSync10 } from "node:fs";
658974
+ import { mkdirSync as mkdirSync24, readFileSync as readFileSync52, writeFileSync as writeFileSync22, renameSync as renameSync10 } from "node:fs";
658747
658975
  import { dirname as dirname88 } from "node:path";
658748
658976
  import { randomBytes as randomBytes25, createHash as createHash27 } from "node:crypto";
658749
658977
  function loadSchedulerStore(path27) {
658750
658978
  try {
658751
- return parseSchedulerStore(readFileSync51(path27, "utf-8"));
658979
+ return parseSchedulerStore(readFileSync52(path27, "utf-8"));
658752
658980
  } catch {
658753
658981
  return [];
658754
658982
  }
@@ -658756,14 +658984,14 @@ function loadSchedulerStore(path27) {
658756
658984
  function saveSchedulerStore(path27, records) {
658757
658985
  mkdirSync24(dirname88(path27), { recursive: true });
658758
658986
  const tmp = `${path27}.${randomBytes25(6).toString("hex")}.tmp`;
658759
- writeFileSync21(tmp, serializeSchedulerStore(records), { mode: 384 });
658987
+ writeFileSync22(tmp, serializeSchedulerStore(records), { mode: 384 });
658760
658988
  renameSync10(tmp, path27);
658761
658989
  }
658762
658990
  function mutateSchedulerStore(path27, fn2, opts) {
658763
658991
  const maxRetries = Math.max(0, opts?.retries ?? 5);
658764
658992
  const rawOf = () => {
658765
658993
  try {
658766
- return readFileSync51(path27, "utf-8");
658994
+ return readFileSync52(path27, "utf-8");
658767
658995
  } catch {
658768
658996
  return null;
658769
658997
  }
@@ -658827,10 +659055,10 @@ var init_firePrompt = __esm({
658827
659055
  });
658828
659056
 
658829
659057
  // build-src/src/sema/scheduler/schedulerDaemonWire.ts
658830
- import { join as join201 } from "node:path";
659058
+ import { join as join202 } from "node:path";
658831
659059
  import { homedir as homedir56 } from "node:os";
658832
659060
  function schedulerStorePath() {
658833
- return join201(process.env.SEMA_CONFIG_DIR ?? join201(homedir56(), ".sema"), "scheduled_tasks.json");
659061
+ return join202(process.env.SEMA_CONFIG_DIR ?? join202(homedir56(), ".sema"), "scheduled_tasks.json");
658834
659062
  }
658835
659063
  function fileSchedulerStoreIO(storePath) {
658836
659064
  return {
@@ -658849,8 +659077,8 @@ var init_schedulerDaemonWire = __esm({
658849
659077
  });
658850
659078
 
658851
659079
  // build-src/src/sema/scheduler/sessionReap.ts
658852
- import { mkdirSync as mkdirSync25, readdirSync as readdirSync14, readFileSync as readFileSync52, unlinkSync as unlinkSync9, writeFileSync as writeFileSync22 } from "node:fs";
658853
- import { dirname as dirname89, join as join202 } from "node:path";
659080
+ import { mkdirSync as mkdirSync25, readdirSync as readdirSync14, readFileSync as readFileSync53, unlinkSync as unlinkSync9, writeFileSync as writeFileSync23 } from "node:fs";
659081
+ import { dirname as dirname89, join as join203 } from "node:path";
658854
659082
  function isSessionLifetimeRecord(r) {
658855
659083
  return r.lifetime === "session";
658856
659084
  }
@@ -658881,7 +659109,7 @@ function reapSessionRecords(io, departedSessionIds) {
658881
659109
  return reaped.map((r) => r.id);
658882
659110
  }
658883
659111
  function schedulerClaimsDir(storePath) {
658884
- return join202(dirname89(storePath), "scheduler-claims");
659112
+ return join203(dirname89(storePath), "scheduler-claims");
658885
659113
  }
658886
659114
  function pidAlive3(pid) {
658887
659115
  if (!Number.isInteger(pid) || pid <= 0) return false;
@@ -658894,19 +659122,19 @@ function pidAlive3(pid) {
658894
659122
  }
658895
659123
  function writeSchedulerClaim(storePath, sessionIds, pid = process.pid) {
658896
659124
  const dir = schedulerClaimsDir(storePath);
658897
- const file2 = join202(dir, `${pid}.json`);
659125
+ const file2 = join203(dir, `${pid}.json`);
658898
659126
  const ids = [...new Set(sessionIds.filter((id) => typeof id === "string" && id.length > 0))].sort();
658899
659127
  try {
658900
- const prev = JSON.parse(readFileSync52(file2, "utf8"));
659128
+ const prev = JSON.parse(readFileSync53(file2, "utf8"));
658901
659129
  if (Array.isArray(prev.sessionIds) && prev.sessionIds.join("\n") === ids.join("\n")) return;
658902
659130
  } catch {
658903
659131
  }
658904
659132
  mkdirSync25(dir, { recursive: true, mode: 448 });
658905
- writeFileSync22(file2, JSON.stringify({ pid, sessionIds: ids, writtenAt: Date.now() }), { mode: 384 });
659133
+ writeFileSync23(file2, JSON.stringify({ pid, sessionIds: ids, writtenAt: Date.now() }), { mode: 384 });
658906
659134
  }
658907
659135
  function removeSchedulerClaim(storePath, pid = process.pid) {
658908
659136
  try {
658909
- unlinkSync9(join202(schedulerClaimsDir(storePath), `${pid}.json`));
659137
+ unlinkSync9(join203(schedulerClaimsDir(storePath), `${pid}.json`));
658910
659138
  } catch {
658911
659139
  }
658912
659140
  }
@@ -658926,7 +659154,7 @@ function readAliveClaimedSessionIds(storePath, opts = {}) {
658926
659154
  if (!alive(pid)) {
658927
659155
  if (opts.cleanupDead) {
658928
659156
  try {
658929
- unlinkSync9(join202(dir, f));
659157
+ unlinkSync9(join203(dir, f));
658930
659158
  } catch {
658931
659159
  }
658932
659160
  }
@@ -658934,7 +659162,7 @@ function readAliveClaimedSessionIds(storePath, opts = {}) {
658934
659162
  }
658935
659163
  if (pid === opts.excludePid) continue;
658936
659164
  try {
658937
- const c2 = JSON.parse(readFileSync52(join202(dir, f), "utf8"));
659165
+ const c2 = JSON.parse(readFileSync53(join203(dir, f), "utf8"));
658938
659166
  if (Array.isArray(c2.sessionIds)) {
658939
659167
  for (const id of c2.sessionIds) if (typeof id === "string" && id.length > 0) out6.add(id);
658940
659168
  }
@@ -659262,7 +659490,7 @@ __export(loginState_exports, {
659262
659490
  seedMockLoginState: () => seedMockLoginState,
659263
659491
  seedProjectOnboardingState: () => seedProjectOnboardingState
659264
659492
  });
659265
- import { join as join203 } from "path";
659493
+ import { join as join204 } from "path";
659266
659494
  import { mkdir as mkdir50, writeFile as writeFile53 } from "fs/promises";
659267
659495
  function osDisplayName() {
659268
659496
  try {
@@ -659331,8 +659559,8 @@ async function seedMockLoginState() {
659331
659559
  }
659332
659560
  try {
659333
659561
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
659334
- const cachePath = join203(getClaudeConfigHomeDir3(), "cache", "changelog.md");
659335
- await mkdir50(join203(getClaudeConfigHomeDir3(), "cache"), { recursive: true });
659562
+ const cachePath = join204(getClaudeConfigHomeDir3(), "cache", "changelog.md");
659563
+ await mkdir50(join204(getClaudeConfigHomeDir3(), "cache"), { recursive: true });
659336
659564
  await writeFile53(cachePath, buildChangelogMarkdown(BRAND3.whatsNew), { encoding: "utf-8" });
659337
659565
  const { getStoredChangelog: getStoredChangelog2, _resetChangelogCacheForTesting: _resetChangelogCacheForTesting2 } = await Promise.resolve().then(() => (init_releaseNotes(), releaseNotes_exports));
659338
659566
  _resetChangelogCacheForTesting2();
@@ -660185,7 +660413,7 @@ __export(agentsHotReload_exports, {
660185
660413
  stopAgentsHotReload: () => stopAgentsHotReload
660186
660414
  });
660187
660415
  import { watch as watch3, existsSync as existsSync35 } from "node:fs";
660188
- import { join as join204 } from "node:path";
660416
+ import { join as join205 } from "node:path";
660189
660417
  async function reloadAgentDefinitions(cwd5) {
660190
660418
  try {
660191
660419
  const { clearAgentDefinitionsCache: clearAgentDefinitionsCache2, getAgentDefinitionsWithOverrides: getAgentDefinitionsWithOverrides2 } = await Promise.resolve().then(() => (init_loadAgentsDir(), loadAgentsDir_exports));
@@ -660222,7 +660450,7 @@ async function startAgentsHotReload(cwd5) {
660222
660450
  }
660223
660451
  try {
660224
660452
  const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
660225
- const userDir = join204(getClaudeConfigHomeDir3(), "agents");
660453
+ const userDir = join205(getClaudeConfigHomeDir3(), "agents");
660226
660454
  if (existsSync35(userDir)) dirs.add(userDir);
660227
660455
  } catch (e) {
660228
660456
  if (process.env.SEMA_DEBUG) console.error("[sema] agents hot-reload user-dir scan soft-failed:", e);
@@ -660300,7 +660528,7 @@ __export(mcpFill_exports, {
660300
660528
  loadCanonicalMcpClients: () => loadCanonicalMcpClients
660301
660529
  });
660302
660530
  import { homedir as homedir57 } from "os";
660303
- import { readFileSync as readFileSync53 } from "fs";
660531
+ import { readFileSync as readFileSync54 } from "fs";
660304
660532
  function builtinDynamicConfig(command8) {
660305
660533
  return { type: "stdio", command: command8, args: [], scope: "dynamic" };
660306
660534
  }
@@ -660317,7 +660545,7 @@ function canonicalGlobalConfigFile() {
660317
660545
  }
660318
660546
  async function loadCanonicalMcpClients() {
660319
660547
  try {
660320
- const raw2 = readFileSync53(canonicalGlobalConfigFile(), "utf8");
660548
+ const raw2 = readFileSync54(canonicalGlobalConfigFile(), "utf8");
660321
660549
  const parsed = JSON.parse(raw2);
660322
660550
  const mcpServers = parsed?.mcpServers;
660323
660551
  if (!mcpServers || typeof mcpServers !== "object" || Object.keys(mcpServers).length === 0) {
@@ -660587,14 +660815,14 @@ var synthApprovalProbe_exports = {};
660587
660815
  __export(synthApprovalProbe_exports, {
660588
660816
  armSynthToolApprovalProbe: () => armSynthToolApprovalProbe
660589
660817
  });
660590
- import { writeFileSync as writeFileSync23, readFileSync as readFileSync54 } from "node:fs";
660818
+ import { writeFileSync as writeFileSync24, readFileSync as readFileSync55 } from "node:fs";
660591
660819
  function armSynthToolApprovalProbe() {
660592
660820
  const specPath = process.env.SEMA_SYNTH_TOOL_APPROVAL;
660593
660821
  if (!specPath) return;
660594
660822
  const outPath = process.env.SEMA_SYNTH_TOOL_APPROVAL_OUT || `${specPath}.out.json`;
660595
660823
  let spec;
660596
660824
  try {
660597
- spec = JSON.parse(readFileSync54(specPath, "utf8"));
660825
+ spec = JSON.parse(readFileSync55(specPath, "utf8"));
660598
660826
  } catch (e) {
660599
660827
  logForDebugging(`synthApprovalProbe: spec unreadable (${String(e)}) \u2014 probe disarmed`);
660600
660828
  return;
@@ -660630,7 +660858,7 @@ function armSynthToolApprovalProbe() {
660630
660858
  if (Date.now() - t0 > 6e4) {
660631
660859
  clearInterval(poll);
660632
660860
  try {
660633
- writeFileSync23(outPath, JSON.stringify({ outcome: { kind: "failed", reason: "leader queue never registered" } }));
660861
+ writeFileSync24(outPath, JSON.stringify({ outcome: { kind: "failed", reason: "leader queue never registered" } }));
660634
660862
  } catch {
660635
660863
  }
660636
660864
  return;
@@ -660639,10 +660867,10 @@ function armSynthToolApprovalProbe() {
660639
660867
  clearInterval(poll);
660640
660868
  const args = /* @__PURE__ */ new Map([["synth-c1", input]]);
660641
660869
  void surfaceFsApprovalAndDecide({ client: client4 }, "synth-task", args).then((outcome) => {
660642
- writeFileSync23(outPath, JSON.stringify({ outcome, decisions }, null, 2));
660870
+ writeFileSync24(outPath, JSON.stringify({ outcome, decisions }, null, 2));
660643
660871
  }).catch((e) => {
660644
660872
  try {
660645
- writeFileSync23(outPath, JSON.stringify({ outcome: { kind: "failed", reason: String(e) } }));
660873
+ writeFileSync24(outPath, JSON.stringify({ outcome: { kind: "failed", reason: String(e) } }));
660646
660874
  } catch {
660647
660875
  }
660648
660876
  });
@@ -660663,9 +660891,9 @@ __export(workerScreen_exports, {
660663
660891
  installWorkerVirtualTerminal: () => installWorkerVirtualTerminal,
660664
660892
  snapshotLines: () => snapshotLines
660665
660893
  });
660666
- import { writeFileSync as writeFileSync24 } from "fs";
660894
+ import { writeFileSync as writeFileSync25 } from "fs";
660667
660895
  import { writeFile as writeFile54 } from "fs/promises";
660668
- import { join as join205 } from "path";
660896
+ import { join as join206 } from "path";
660669
660897
  function clampDims(c2, r) {
660670
660898
  return {
660671
660899
  c: Number.isFinite(c2) && c2 >= 20 ? Math.min(c2, 1e3) : 80,
@@ -660759,7 +660987,7 @@ function installWorkerVirtualTerminal(config4) {
660759
660987
  }
660760
660988
  const jobDir = config4.jobDir;
660761
660989
  if (jobDir) {
660762
- const screenPath = join205(jobDir, "screen.txt");
660990
+ const screenPath = join206(jobDir, "screen.txt");
660763
660991
  let lastWritten = "";
660764
660992
  const flush = async () => {
660765
660993
  const lines = snapshotLines();
@@ -660776,7 +661004,7 @@ function installWorkerVirtualTerminal(config4) {
660776
661004
  const lines = snapshotLines();
660777
661005
  if (!lines) return;
660778
661006
  try {
660779
- writeFileSync24(screenPath, lines.slice(-500).join("\n") + "\n", { mode: 384 });
661007
+ writeFileSync25(screenPath, lines.slice(-500).join("\n") + "\n", { mode: 384 });
660780
661008
  } catch {
660781
661009
  }
660782
661010
  });
@@ -660909,7 +661137,7 @@ import { spawn as spawn15 } from "child_process";
660909
661137
  import { appendFileSync as appendFileSync7, createWriteStream as createWriteStream5 } from "fs";
660910
661138
  import { chmod as chmod13, mkdir as mkdir51, readFile as readFile58, readdir as readdir33, rename as rename15, stat as stat54, unlink as unlink28 } from "fs/promises";
660911
661139
  import { createConnection as createConnection4, createServer as createServer9 } from "net";
660912
- import { dirname as dirname90, join as join206 } from "path";
661140
+ import { dirname as dirname90, join as join207 } from "path";
660913
661141
  function probeSocketAlive(sockPath, timeoutMs = 1500) {
660914
661142
  return (async () => {
660915
661143
  const info = await readDaemonInfo();
@@ -661186,7 +661414,7 @@ var init_main4 = __esm({
661186
661414
  });
661187
661415
  this.logLine(`[daemon] supervisor up pid=${process.pid} origin=${this.origin}`);
661188
661416
  await this.recoverJobs();
661189
- await mkdir51(join206(getDispatchDir(), "rejected"), { recursive: true, mode: 448 });
661417
+ await mkdir51(join207(getDispatchDir(), "rejected"), { recursive: true, mode: 448 });
661190
661418
  } catch (e) {
661191
661419
  this.server?.close();
661192
661420
  this.server = null;
@@ -661817,7 +662045,7 @@ var init_main4 = __esm({
661817
662045
  return;
661818
662046
  }
661819
662047
  for (const f of files2) {
661820
- const p = join206(dir, f);
662048
+ const p = join207(dir, f);
661821
662049
  let size = 0;
661822
662050
  try {
661823
662051
  size = (await stat54(p)).size;
@@ -661833,7 +662061,7 @@ var init_main4 = __esm({
661833
662061
  }
661834
662062
  }
661835
662063
  if (!payload2?.job) {
661836
- await rename15(p, join206(dir, "rejected", f)).catch(() => unlink28(p).catch(() => {
662064
+ await rename15(p, join207(dir, "rejected", f)).catch(() => unlink28(p).catch(() => {
661837
662065
  }));
661838
662066
  this.logLine(`[daemon] rejected file dispatch ${f}`);
661839
662067
  continue;
@@ -663316,14 +663544,16 @@ async function launchReplProduction() {
663316
663544
  }
663317
663545
  try {
663318
663546
  const { fetchLiveModelCatalog: fetchLiveModelCatalog2 } = await Promise.resolve().then(() => (init_liveClient(), liveClient_exports));
663319
- const { setLiveModelCatalog: setLiveModelCatalog2 } = await Promise.resolve().then(() => (init_liveModelCatalog(), liveModelCatalog_exports));
663320
- const catalog2 = await fetchLiveModelCatalog2({
663547
+ const { setLiveModelCatalog: setLiveModelCatalog2, setLiveModelCatalogRefresher: setLiveModelCatalogRefresher2 } = await Promise.resolve().then(() => (init_liveModelCatalog(), liveModelCatalog_exports));
663548
+ const fetchCatalogNow = () => fetchLiveModelCatalog2({
663321
663549
  baseUrl: process.env.SEMA_LIVE_BASEURL,
663322
663550
  authToken: resolveBootAuth(process.env.SEMA_LIVE_BASEURL),
663323
663551
  // #118:同 boot client,零 'anon' 占位符
663324
663552
  principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
663325
663553
  });
663554
+ const catalog2 = await fetchCatalogNow();
663326
663555
  setLiveModelCatalog2(catalog2);
663556
+ setLiveModelCatalogRefresher2(fetchCatalogNow);
663327
663557
  if (process.env.SEMA_DEBUG) {
663328
663558
  console.error(
663329
663559
  catalog2 ? `[sema] model catalog: LIVE (${catalog2.models.length} models, default=${catalog2.default}) \u2014 models.list()` : "[sema] model catalog: LIVE read returned null \u2014 falling back to mock catalog"
@@ -663913,12 +664143,12 @@ async function launchReplProduction() {
663913
664143
  if (process.env.SEMA_QUESTION_FIXTURE) {
663914
664144
  try {
663915
664145
  const fixturePath = process.env.SEMA_QUESTION_FIXTURE;
663916
- const { readFileSync: readFileSync55 } = await import("node:fs");
664146
+ const { readFileSync: readFileSync56 } = await import("node:fs");
663917
664147
  const { publishQuestionFrame: publishQuestionFrame2 } = await Promise.resolve().then(() => (init_liveQuestionStore(), liveQuestionStore_exports));
663918
664148
  for (const delayMs of [3e3, 6e3, 9e3, 12e3, 15e3]) {
663919
664149
  setTimeout(() => {
663920
664150
  try {
663921
- const frame = JSON.parse(readFileSync55(fixturePath, "utf8"));
664151
+ const frame = JSON.parse(readFileSync56(fixturePath, "utf8"));
663922
664152
  publishQuestionFrame2(frame);
663923
664153
  try {
663924
664154
  __require("node:fs").appendFileSync(`${fixturePath}.probe`, `published @${delayMs}