@sema-agent/cli 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sema-main.js CHANGED
@@ -39600,8 +39600,8 @@ var require_get_proto = __commonJS({
39600
39600
  var require_hasown = __commonJS({
39601
39601
  "node_modules/hasown/index.js"(exports2, module2) {
39602
39602
  "use strict";
39603
- var call77 = Function.prototype.call, $hasOwn = Object.prototype.hasOwnProperty, bind2 = require_function_bind();
39604
- module2.exports = bind2.call(call77, $hasOwn);
39603
+ var call78 = Function.prototype.call, $hasOwn = Object.prototype.hasOwnProperty, bind2 = require_function_bind();
39604
+ module2.exports = bind2.call(call78, $hasOwn);
39605
39605
  }
39606
39606
  });
39607
39607
 
@@ -40775,9 +40775,9 @@ var require_ms = __commonJS({
40775
40775
  }
40776
40776
  function fmtLong(ms) {
40777
40777
  var msAbs = Math.abs(ms);
40778
- return msAbs >= d4 ? plural5(ms, msAbs, d4, "day") : msAbs >= h ? plural5(ms, msAbs, h, "hour") : msAbs >= m2 ? plural5(ms, msAbs, m2, "minute") : msAbs >= s ? plural5(ms, msAbs, s, "second") : ms + " ms";
40778
+ return msAbs >= d4 ? plural6(ms, msAbs, d4, "day") : msAbs >= h ? plural6(ms, msAbs, h, "hour") : msAbs >= m2 ? plural6(ms, msAbs, m2, "minute") : msAbs >= s ? plural6(ms, msAbs, s, "second") : ms + " ms";
40779
40779
  }
40780
- function plural5(ms, msAbs, n2, name) {
40780
+ function plural6(ms, msAbs, n2, name) {
40781
40781
  var isPlural = msAbs >= n2 * 1.5;
40782
40782
  return Math.round(ms / n2) + " " + name + (isPlural ? "s" : "");
40783
40783
  }
@@ -46920,6 +46920,13 @@ var EnvironmentVariablesSchema, PermissionsSchema, KILL_SWITCH_KEYS, ExtraKnownM
46920
46920
  semaAutoModeModels: external_exports.array(external_exports.string()).optional().catch(void 0).describe(
46921
46921
  "sema: model allowlist force-enabling auto mode for the listed models (tengu_auto_mode_config.allowModels; exact model IDs or canonical family names). Default (absent/empty) keeps the built-in allowlist. Applies on next shell start."
46922
46922
  ),
46923
+ // agent-teams(具名持久队友族)的 settings 面 opt-in。门本体 = utils/agentSwarmsEnabled.ts
46924
+ // (grep semaAgentTeamsEnabled),三源析取:本键 / env SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS /
46925
+ // --agent-teams flag,任一为真即开,默认关。读的是**用户级** settings.json(不吃
46926
+ // projectSettings —— 起子进程队友的能力不该由 clone 来的仓库替用户打开),boot-only 快照。
46927
+ semaAgentTeamsEnabled: external_exports.boolean().optional().catch(void 0).describe(
46928
+ "sema: opt in to the experimental agent teams feature (named persistent teammates with a shared task list). Default (absent/false) keeps it off. Equivalent to the SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS env var or the --agent-teams flag; any one of the three turns it on. Applies on next shell start."
46929
+ ),
46923
46930
  sshConfigs: external_exports.array(
46924
46931
  external_exports.object({
46925
46932
  id: external_exports.string().describe(
@@ -61404,12 +61411,17 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61404
61411
  droppedMalformed++, debug4("[fleet-frame] MALFORMED bg_notification dropped(taskId \u6216 status \u7F3A\u5E2D/\u975E\u4E32)");
61405
61412
  return;
61406
61413
  }
61414
+ if (n2.parentTaskId !== void 0 && typeof n2.parentTaskId != "string") {
61415
+ droppedMalformed++, debug4(`[fleet-frame] MALFORMED bg_notification dropped(parentTaskId \u952E\u5728\u573A\u4F46\u975E\u4E32:${typeof n2.parentTaskId} \u2014\u2014 \u9694\u79BB\u5224\u636E\u7684\u951A\u4E0D\u8BB8\u88AB\u574F\u503C\u65C1\u8DEF;taskId=${n2.taskId})`);
61416
+ return;
61417
+ }
61407
61418
  let serverFailClosed = bgNotifyFailClosedMeta && sessionScopedMeta === !0, ownByRoot = typeof n2.rootSessionId == "string" && n2.rootSessionId.length > 0 && n2.rootSessionId === engineSessionParam();
61408
61419
  if (!serverFailClosed && !ownByRoot && typeof n2.parentTaskId == "string" && n2.parentTaskId.length > 0 && !isOwnEngineRun(n2.parentTaskId)) {
61409
61420
  droppedForeignBgNotification++, debug4(`[fleet-frame] bg_notification DROPPED foreign/unowned parentRun(taskId=${n2.taskId} parentRun=${n2.parentTaskId})`);
61410
61421
  return;
61411
61422
  }
61412
- debug4(`[fleet-frame] bg_notification taskId=${n2.taskId} status=${n2.status} seq=${n2.seq ?? "-"}`);
61423
+ let evidence = serverFailClosed || ownByRoot ? sessionKey === DEFAULT_SESSION_KEY ? serverFailClosed ? "server_fail_closed" : "own_root" : "session_anchor_untrusted" : typeof n2.parentTaskId == "string" && n2.parentTaskId.length > 0 ? "own_parent" : "absent_parent";
61424
+ debug4(`[fleet-frame] bg_notification taskId=${n2.taskId} status=${n2.status} seq=${n2.seq ?? "-"} accept=${evidence}`);
61413
61425
  let rowIds = [];
61414
61426
  for (let id of taskMap.keys())
61415
61427
  (id === n2.taskId || rowIdTail(id) === n2.taskId) && rowIds.push(id);
@@ -61426,7 +61438,11 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61426
61438
  washBlocked = !0, debug4(`[fleet-frame] bg_notification WASH-GREEN blocked(row=${id} row-status=${rowStatus} notif=${n2.status})`);
61427
61439
  continue;
61428
61440
  }
61429
- rowStatus !== n2.status && retained.set(id, { row: { ...known, status: coerced }, expireAt: nowMs + TERMINAL_RETAIN_MS }), writtenIds.add(id), applied = !0;
61441
+ if (rowStatus !== n2.status) {
61442
+ let upgraded = { ...known, status: coerced };
61443
+ retained.set(id, { row: upgraded, expireAt: nowMs + TERMINAL_RETAIN_MS }), taskMap.set(id, upgraded);
61444
+ }
61445
+ writtenIds.add(id), applied = !0;
61430
61446
  } else {
61431
61447
  let started2 = known.startedAt, meta3 = rowMeta.get(id), frozenElapsed = typeof started2 == "number" && started2 > 0 && started2 <= nowMs ? nowMs - started2 : meta3 !== void 0 ? (known.elapsedMs ?? 0) + Math.max(0, nowMs - meta3.receivedAtMs) : known.elapsedMs;
61432
61448
  taskMap.delete(id), rowMeta.delete(id), retained.set(id, {
@@ -61480,7 +61496,7 @@ function createFleetLedger(hooks2 = {}, opts = {}) {
61480
61496
  }) : debug4(`[fleet-frame] bg_notification state-plane rejected as wash-green echo(taskId=${n2.taskId} notif=${n2.status})\u2014\u2014 \u901A\u77E5\u9762\u7167\u5E38\u5165\u961F`);
61481
61497
  }
61482
61498
  try {
61483
- let out6 = hooks2.onBgNotificationAccepted?.(n2, rowIds);
61499
+ let out6 = hooks2.onBgNotificationAccepted?.(n2, rowIds, evidence);
61484
61500
  out6 && typeof out6.then == "function" && Promise.resolve(out6).catch((e) => {
61485
61501
  hostLog("debug", `[fleet-frame] onBgNotificationAccepted hook rejected: ${String(e).slice(0, 160)}`);
61486
61502
  });
@@ -61686,42 +61702,6 @@ var capByBase, CAP_FALSE_RETRY_TTL_MS, init_engineSubagentOutput = __esm({
61686
61702
  }
61687
61703
  });
61688
61704
 
61689
- // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js
61690
- async function steerEngineSubagent(target, text2) {
61691
- let cfg = engineWireTarget();
61692
- if (!cfg)
61693
- return { ok: !1, reason: "no-wire" };
61694
- let runId = activeEngineRunId();
61695
- if (!runId)
61696
- return { ok: !1, reason: "no-run" };
61697
- let client3 = makeEngineWireClient({
61698
- baseUrl: cfg.baseUrl,
61699
- ...cfg.token ? { token: cfg.token } : {},
61700
- principal: cfg.principal
61701
- });
61702
- if (!client3)
61703
- return { ok: !1, reason: "no-wire" };
61704
- try {
61705
- let body = await client3.runs.steerSubagent(runId, target, { content: text2 }, engineSessionParamSpread()), receipt = "Message queued for delivery at the next tool round.", copy2 = body?.note ?? body?.message;
61706
- return typeof copy2 == "string" && copy2.length > 0 && (receipt = copy2), { ok: !0, receipt };
61707
- } catch (e) {
61708
- let status3 = e?.status;
61709
- if (typeof status3 == "number") {
61710
- let detail = e instanceof Error ? e.message : String(e);
61711
- return hostLog("debug", `engineSubagentSteer: ${status3} ${detail.slice(0, 200)}`), status3 === 409 || status3 === 404 ? { ok: !1, reason: "not-running", detail } : { ok: !1, reason: "error", detail: `${status3}` };
61712
- }
61713
- return hostLog("debug", `engineSubagentSteer: fetch failed ${String(e)}`), { ok: !1, reason: "error", detail: String(e) };
61714
- }
61715
- }
61716
- var init_engineSubagentSteer = __esm({
61717
- "node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js"() {
61718
- init_host();
61719
- init_engineWireSdk();
61720
- init_engineWireTarget();
61721
- init_engineSessionParam();
61722
- }
61723
- });
61724
-
61725
61705
  // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentResume.js
61726
61706
  function subagentResumeAvailable(baseUrl = engineWireTarget()?.baseUrl) {
61727
61707
  return engineCapTrue(baseUrl, SUBAGENT_RESUME_CAP);
@@ -61816,6 +61796,46 @@ var SUBAGENT_RESUME_CAP, RETENTION_LAPSED_CODES, warnedRetainWithoutWake, init_e
61816
61796
  }
61817
61797
  });
61818
61798
 
61799
+ // node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js
61800
+ async function steerEngineSubagent(target, text2, childTaskId) {
61801
+ let cfg = engineWireTarget();
61802
+ if (!cfg)
61803
+ return { ok: !1, reason: "no-wire" };
61804
+ let named = typeof childTaskId == "string" && childTaskId !== "" ? childTaskId : void 0, runId = resolveOwnerRunId(named);
61805
+ if (!runId)
61806
+ return named !== void 0 && noteBgOwnerAbsence("subagent-steer", named), { ok: !1, reason: "no-run" };
61807
+ let client3 = makeEngineWireClient({
61808
+ baseUrl: cfg.baseUrl,
61809
+ ...cfg.token ? { token: cfg.token } : {},
61810
+ principal: cfg.principal
61811
+ });
61812
+ if (!client3)
61813
+ return { ok: !1, reason: "no-wire" };
61814
+ let rowSession = named !== void 0 ? getBgParentRunOwner(named)?.sessionId : void 0, session2 = rowSession !== void 0 ? { session: rowSession } : engineSessionParamSpread();
61815
+ try {
61816
+ let body = await client3.runs.steerSubagent(runId, target, { content: text2 }, session2), receipt = "Message queued for delivery at the next tool round.", copy2 = body?.note ?? body?.message;
61817
+ return typeof copy2 == "string" && copy2.length > 0 && (receipt = copy2), { ok: !0, receipt };
61818
+ } catch (e) {
61819
+ let status3 = e?.status;
61820
+ if (typeof status3 == "number") {
61821
+ let detail = e instanceof Error ? e.message : String(e);
61822
+ return hostLog("debug", `engineSubagentSteer: ${status3} ${detail.slice(0, 200)}`), status3 === 409 || status3 === 404 ? { ok: !1, reason: "not-running", detail } : { ok: !1, reason: "error", detail: `${status3}` };
61823
+ }
61824
+ return hostLog("debug", `engineSubagentSteer: fetch failed ${String(e)}`), { ok: !1, reason: "error", detail: String(e) };
61825
+ }
61826
+ }
61827
+ var init_engineSubagentSteer = __esm({
61828
+ "node_modules/@sema-agent/client-core/dist/subagent/engineSubagentSteer.js"() {
61829
+ init_host();
61830
+ init_engineWireSdk();
61831
+ init_engineWireTarget();
61832
+ init_engineSessionParam();
61833
+ init_subagentContentStore();
61834
+ init_engineSubagentResume();
61835
+ init_subagentOwnerAbsence();
61836
+ }
61837
+ });
61838
+
61819
61839
  // node_modules/@sema-agent/client-core/dist/subagent/engineTaskHandleWire.js
61820
61840
  import { TaskStopConflictError } from "@sema-agent/sdk";
61821
61841
  function resolveHostRun(handle2) {
@@ -62378,8 +62398,8 @@ function projectActivity(beats) {
62378
62398
  continue;
62379
62399
  let key = typeof b3.toolCallId == "string" && b3.toolCallId ? b3.toolCallId : `#${anon++}`;
62380
62400
  byCall.has(key) || order2.push(key);
62381
- let prev = byCall.get(key), arg = typeof b3.arg == "string" && b3.arg.trim() ? oneLineSummary(b3.arg.trim()) : prev?.summary, call77 = { name };
62382
- arg && (call77.summary = arg), byCall.set(key, { ...prev, ...call77 });
62401
+ let prev = byCall.get(key), arg = typeof b3.arg == "string" && b3.arg.trim() ? oneLineSummary(b3.arg.trim()) : prev?.summary, call78 = { name };
62402
+ arg && (call78.summary = arg), byCall.set(key, { ...prev, ...call78 });
62383
62403
  }
62384
62404
  return order2.map((k2) => byCall.get(k2)).filter((c2) => !!c2);
62385
62405
  }
@@ -117283,6 +117303,18 @@ var init_probePlan = __esm({
117283
117303
  }
117284
117304
  });
117285
117305
 
117306
+ // build-src/src/utils/dispatcherTimeouts.ts
117307
+ var LONG_POLL_DISPATCHER_TIMEOUTS, init_dispatcherTimeouts = __esm({
117308
+ "build-src/src/utils/dispatcherTimeouts.ts"() {
117309
+ LONG_POLL_DISPATCHER_TIMEOUTS = {
117310
+ /** 等响应头的上限(HITL 审批挂在这一段:请求发出去了,人还没点)。 */
117311
+ headersTimeout: 216e5,
117312
+ /** 两个 body 分片之间的上限(SSE / 流式响应的静默段)。 */
117313
+ bodyTimeout: 216e5
117314
+ };
117315
+ }
117316
+ });
117317
+
117286
117318
  // build-src/src/utils/caCerts.ts
117287
117319
  var caCerts_exports = {};
117288
117320
  __export(caCerts_exports, {
@@ -121087,7 +121119,7 @@ var require_webidl = __commonJS({
121087
121119
  return new TypeError(`${message.header}: ${message.message}`);
121088
121120
  };
121089
121121
  webidl.errors.conversionFailed = function(opts) {
121090
- let plural5 = opts.types.length === 1 ? "" : " one of", message = `${opts.argument} could not be converted to${plural5}: ${opts.types.join(", ")}.`;
121122
+ let plural6 = opts.types.length === 1 ? "" : " one of", message = `${opts.argument} could not be converted to${plural6}: ${opts.types.join(", ")}.`;
121091
121123
  return webidl.errors.exception({
121092
121124
  header: opts.prefix,
121093
121125
  message
@@ -136143,7 +136175,10 @@ function getTLSFetchOptions() {
136143
136175
  passphrase: tlsConfig.passphrase,
136144
136176
  ...tlsConfig.ca && { ca: tlsConfig.ca }
136145
136177
  },
136146
- pipelining: 1
136178
+ pipelining: 1,
136179
+ // #270:长挂豁免。缺省 300s 会把 plan_review 这类「挂着等人做决定」的请求单方面掐断
136180
+ // (引擎侧记 499),用户观感 = 审批完没反应。取值理由见 dispatcherTimeouts.ts 头注。
136181
+ ...LONG_POLL_DISPATCHER_TIMEOUTS
136147
136182
  }) };
136148
136183
  }
136149
136184
  function clearMTLSCache() {
@@ -136159,6 +136194,7 @@ var getMTLSConfig, getMTLSAgent, init_mtls = __esm({
136159
136194
  init_memoize();
136160
136195
  init_caCerts();
136161
136196
  init_debug();
136197
+ init_dispatcherTimeouts();
136162
136198
  init_fsOperations();
136163
136199
  getMTLSConfig = memoize_default(() => {
136164
136200
  let config4 = {};
@@ -136379,11 +136415,15 @@ var import_https_proxy_agent2, keepAliveDisabled, getProxyAgent, proxyIntercepto
136379
136415
  init_memoize();
136380
136416
  init_caCerts();
136381
136417
  init_debug();
136418
+ init_dispatcherTimeouts();
136382
136419
  init_envUtils();
136383
136420
  init_mtls();
136384
136421
  keepAliveDisabled = !1;
136385
136422
  getProxyAgent = memoize_default((uri) => {
136386
136423
  let undiciMod = require_undici(), mtlsConfig = getMTLSConfig(), caCerts = getCACertificates(), proxyOptions = {
136424
+ // #270:长挂豁免。EnvHttpProxyAgent 把这两个键透传给它内部的 no-proxy/http/https 三个
136425
+ // 子 agent(缺一条真实路径就等于没修)。取值理由见 dispatcherTimeouts.ts 头注。
136426
+ ...LONG_POLL_DISPATCHER_TIMEOUTS,
136387
136427
  // Override both HTTP and HTTPS proxy with the provided URI
136388
136428
  httpProxy: uri,
136389
136429
  httpsProxy: uri,
@@ -136466,10 +136506,16 @@ async function injectDispatcher(extra) {
136466
136506
  noProxy: process.env.NO_PROXY || process.env.no_proxy,
136467
136507
  connect: { ca }
136468
136508
  };
136469
- opts.requestTls = { ca }, undici.setGlobalDispatcher(new undici.EnvHttpProxyAgent(opts));
136509
+ opts.requestTls = { ca }, Object.assign(opts, LONG_POLL_DISPATCHER_TIMEOUTS), undici.setGlobalDispatcher(new undici.EnvHttpProxyAgent(opts));
136470
136510
  return;
136471
136511
  }
136472
- undici.setGlobalDispatcher(new undici.Agent({ connect: { ca: [...tls.rootCertificates, ...extra] } }));
136512
+ undici.setGlobalDispatcher(
136513
+ new undici.Agent({
136514
+ connect: { ca: [...tls.rootCertificates, ...extra] },
136515
+ // #270 同上:无代理臂也是一个真的全局出口,同样不许留在 300s 缺省。
136516
+ ...LONG_POLL_DISPATCHER_TIMEOUTS
136517
+ })
136518
+ );
136473
136519
  }
136474
136520
  async function applyPersistedTlsTrust() {
136475
136521
  try {
@@ -136510,6 +136556,7 @@ async function applySystemTlsTrust() {
136510
136556
  var caPath, builtinRootBodies, init_tlsTrust = __esm({
136511
136557
  "build-src/src/sema/tlsTrust.ts"() {
136512
136558
  init_failOpen();
136559
+ init_dispatcherTimeouts();
136513
136560
  init_envUtils();
136514
136561
  caPath = () => join32(getClaudeConfigHomeDir(), "extra-ca.pem");
136515
136562
  }
@@ -136845,6 +136892,17 @@ var g, gDirs, init_appStateRef = __esm({
136845
136892
  });
136846
136893
 
136847
136894
  // build-src/src/sema/fleetDurableTerminalOverlay.ts
136895
+ function evidenceTier(e) {
136896
+ switch (e) {
136897
+ case "server_fail_closed":
136898
+ case "own_root":
136899
+ return "trusted";
136900
+ case "own_parent":
136901
+ return "process";
136902
+ default:
136903
+ return "unproven";
136904
+ }
136905
+ }
136848
136906
  function trimFifo(map2) {
136849
136907
  for (; map2.size > MAX_FACTS; ) {
136850
136908
  let oldest = map2.keys().next().value;
@@ -136860,20 +136918,24 @@ function normalizeSeq(rawSeq) {
136860
136918
  if (typeof rawSeq == "number" && Number.isFinite(rawSeq)) return rawSeq;
136861
136919
  if (typeof rawSeq == "string" && rawSeq.trim() !== "" && Number.isFinite(Number(rawSeq))) return Number(rawSeq);
136862
136920
  }
136863
- function recordTerminalFact(taskId, rawStatus, rawSeq, src) {
136921
+ function recordTerminalFact(taskId, rawStatus, rawSeq, src, evidence) {
136864
136922
  let status3 = typeof rawStatus == "string" && TERMINAL.has(rawStatus) ? rawStatus : void 0;
136865
136923
  if (taskId === void 0 || taskId.length === 0 || status3 === void 0) return;
136866
136924
  let seq = normalizeSeq(rawSeq), dead = tombstones.get(taskId);
136867
- dead !== void 0 && seq !== void 0 && seq <= dead || (facts.delete(taskId), facts.set(taskId, { status: status3, seq, at: ++tick, wallAt: Date.now(), src }), trimFifo(facts));
136925
+ if (dead !== void 0 && seq !== void 0 && seq <= dead) return;
136926
+ let tier = evidenceTier(evidence);
136927
+ src === "bg_notification" && tier !== "trusted" && logForDebugging(
136928
+ `[fleet-overlay] bg fact for ${taskId} recorded on NON-SESSION evidence (evidence=${evidence ?? "absent"} tier=${tier}) \u2014 presentation-only; not an ownership proof`
136929
+ ), facts.delete(taskId), facts.set(taskId, { status: status3, seq, at: ++tick, wallAt: Date.now(), src, evidence, tier }), trimFifo(facts);
136868
136930
  }
136869
136931
  function recordDurableTerminalNotification(n2) {
136870
136932
  if (n2.task_type === "external") return;
136871
136933
  let taskId = typeof n2.task_id == "string" ? n2.task_id : void 0;
136872
136934
  recordTerminalFact(taskId, n2.status, n2.seq, "task_notification");
136873
136935
  }
136874
- function observeFleetBgNotification(n2) {
136936
+ function observeFleetBgNotification(n2, evidence) {
136875
136937
  let taskId = typeof n2.taskId == "string" ? n2.taskId : void 0;
136876
- recordTerminalFact(taskId, n2.status, n2.seq, "bg_notification");
136938
+ recordTerminalFact(taskId, n2.status, n2.seq, "bg_notification", evidence);
136877
136939
  }
136878
136940
  function observeFleetTaskFrame(rowFrame) {
136879
136941
  let rowId = typeof rowFrame.id == "string" && rowFrame.id.length > 0 ? rowFrame.id : void 0;
@@ -136923,7 +136985,8 @@ var TERMINAL, MAX_FACTS, tick, FACT_GRACE_MS, facts, lastFrameAt, tombstones, ap
136923
136985
  "build-src/src/sema/fleetDurableTerminalOverlay.ts"() {
136924
136986
  init_debug();
136925
136987
  init_appStateRef();
136926
- TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "killed"]), MAX_FACTS = 200, tick = 0, FACT_GRACE_MS = 3e3, facts = /* @__PURE__ */ new Map(), lastFrameAt = /* @__PURE__ */ new Map(), tombstones = /* @__PURE__ */ new Map(), appliedOverlay = /* @__PURE__ */ new Map(), missLogged = /* @__PURE__ */ new Set();
136988
+ TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "killed"]), MAX_FACTS = 200, tick = 0, FACT_GRACE_MS = 3e3;
136989
+ facts = /* @__PURE__ */ new Map(), lastFrameAt = /* @__PURE__ */ new Map(), tombstones = /* @__PURE__ */ new Map(), appliedOverlay = /* @__PURE__ */ new Map(), missLogged = /* @__PURE__ */ new Set();
136927
136990
  }
136928
136991
  });
136929
136992
 
@@ -171556,16 +171619,37 @@ var officialUrls, init_officialRegistry = __esm({
171556
171619
  });
171557
171620
 
171558
171621
  // build-src/src/utils/agentSwarmsEnabled.ts
171559
- function isAgentTeamsFlagSet() {
171560
- return process.argv.includes("--agent-teams");
171622
+ function readAgentTeamsSetting() {
171623
+ if (!isSettingSourceEnabled("userSettings")) return !1;
171624
+ try {
171625
+ return getSettingsForSource("userSettings")?.semaAgentTeamsEnabled === !0;
171626
+ } catch {
171627
+ return !1;
171628
+ }
171629
+ }
171630
+ function argvHasFlagBeforeTerminator(argv, flag) {
171631
+ let terminator = argv.indexOf("--");
171632
+ return (terminator === -1 ? argv : argv.slice(0, terminator)).includes(flag);
171633
+ }
171634
+ function agentTeamsEnabledFrom(settingEnabled, env5, argv) {
171635
+ return settingEnabled || isEnvTruthy(env5[AGENT_TEAMS_ENV_VAR]) ? !0 : argvHasFlagBeforeTerminator(argv, AGENT_TEAMS_FLAG);
171636
+ }
171637
+ function agentTeamsSettingCached() {
171638
+ return settingCache === void 0 && (settingCache = readAgentTeamsSetting()), settingCache;
171561
171639
  }
171562
171640
  function isAgentSwarmsEnabled() {
171563
- return process.env.USER_TYPE === "ant" ? !0 : !(!isEnvTruthy(process.env.SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS) && !isAgentTeamsFlagSet() || !getFeatureValue_CACHED_MAY_BE_STALE2("tengu_amber_flint", !0));
171641
+ return agentTeamsEnabledFrom(
171642
+ agentTeamsSettingCached(),
171643
+ process.env,
171644
+ process.argv
171645
+ );
171564
171646
  }
171565
- var init_agentSwarmsEnabled = __esm({
171647
+ var AGENT_TEAMS_ENV_VAR, AGENT_TEAMS_SETTING_KEY, AGENT_TEAMS_FLAG, settingCache, init_agentSwarmsEnabled = __esm({
171566
171648
  "build-src/src/utils/agentSwarmsEnabled.ts"() {
171567
- init_growthbook_advisor_flag();
171568
171649
  init_envUtils();
171650
+ init_constants2();
171651
+ init_settings2();
171652
+ AGENT_TEAMS_ENV_VAR = "SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS", AGENT_TEAMS_SETTING_KEY = "semaAgentTeamsEnabled", AGENT_TEAMS_FLAG = "--agent-teams";
171569
171653
  }
171570
171654
  });
171571
171655
 
@@ -181192,7 +181276,11 @@ function createLiveFleetSource(config4, now2 = Date.now()) {
181192
181276
  // 台账(parentTaskId 缺席=absent-放行);旧壳门是「两位不全一律不记」。⇒ 老 server/偏斜象限上
181193
181277
  // 无 parentTaskId 的通知现在会入 overlay 事实账 —— 与包自己的状态面(retained/bgFacts)对同一
181194
181278
  // 帧的处置**同口径**,不再一边收一边拒。
181195
- onBgNotificationAccepted: (n2) => observeFleetBgNotification(n2)
181279
+ // 🔴 0.32.0 #284:第三参 `evidence` = **凭哪一条臂放行的**(不是归属结论)。本端一律入账、
181280
+ // 按档留痕 —— 处置边界与论证见 fleetDurableTerminalOverlay.ts 的 `evidenceTier` 头注
181281
+ // (要点:本模块是进程内**呈现**面,不落库/不跨会话搬运/翻行另有一道正交归属门,
181282
+ // 故不属包文档划的「有副作用的归属动作」射程)。`rowIds` 本端暂无消费面,显式具名弃用。
181283
+ onBgNotificationAccepted: (n2, _rowIds, evidence) => observeFleetBgNotification(n2, evidence)
181196
181284
  }), lastError = null, disposed4 = !1, client3 = new AgentClient2({
181197
181285
  baseUrl: config4.baseUrl,
181198
181286
  authToken: config4.authToken,
@@ -182273,10 +182361,10 @@ function lockedTokenProvider(profileName) {
182273
182361
  }), lastIssuedRefreshToken = tokens.refreshToken, foreignRotationObserved = !1;
182274
182362
  },
182275
182363
  async clear() {
182276
- let attempted = lastIssuedRefreshToken, foreign = foreignRotationObserved;
182364
+ let attempted2 = lastIssuedRefreshToken, foreign = foreignRotationObserved;
182277
182365
  await mutateCredentials((creds) => {
182278
182366
  let current5 = creds[profileName];
182279
- if (!current5 || attempted === void 0 || current5.refreshToken !== attempted || foreign) return !1;
182367
+ if (!current5 || attempted2 === void 0 || current5.refreshToken !== attempted2 || foreign) return !1;
182280
182368
  delete creds[profileName];
182281
182369
  });
182282
182370
  }
@@ -189693,14 +189781,22 @@ var PROMPT_PREFIX, init_bashClassifier = __esm({
189693
189781
  // build-src/src/utils/permissions/permissionsLoader.ts
189694
189782
  var permissionsLoader_exports = {};
189695
189783
  __export(permissionsLoader_exports, {
189784
+ _resetPermissionsLoaderNoticesForTest: () => _resetPermissionsLoaderNoticesForTest,
189696
189785
  addPermissionRulesToSettings: () => addPermissionRulesToSettings,
189697
189786
  deletePermissionRuleFromSettings: () => deletePermissionRuleFromSettings,
189698
189787
  getPermissionRulesForSource: () => getPermissionRulesForSource,
189699
189788
  loadAllPermissionRulesFromDisk: () => loadAllPermissionRulesFromDisk,
189789
+ permissionsLoaderLoudNoticesActive: () => permissionsLoaderLoudNoticesActive,
189700
189790
  resolveManagedPermissionRuleScope: () => resolveManagedPermissionRuleScope,
189701
189791
  shouldAllowManagedPermissionRulesOnly: () => shouldAllowManagedPermissionRulesOnly,
189702
189792
  shouldShowAlwaysAllowOptions: () => shouldShowAlwaysAllowOptions
189703
189793
  });
189794
+ function permissionsLoaderLoudNoticesActive() {
189795
+ return [...loudPermissionsLoaderNotices];
189796
+ }
189797
+ function _resetPermissionsLoaderNoticesForTest() {
189798
+ loudManagedPolicyDegradationEmitted = !1, loudPermissionsLoaderNotices.length = 0;
189799
+ }
189704
189800
  function shouldAllowManagedPermissionRulesOnly() {
189705
189801
  return resolveManagedPermissionRuleScope() !== "all-sources";
189706
189802
  }
@@ -189708,10 +189804,16 @@ function resolveManagedPermissionRuleScope() {
189708
189804
  let health = resolveManagedPolicyLayerHealth(
189709
189805
  () => filterManagedPolicyErrors(getSettingsWithErrors().errors)
189710
189806
  );
189711
- return health.healthy ? getSettingsForSource("policySettings")?.allowManagedPermissionRulesOnly === !0 ? "managed-only" : "all-sources" : (loudManagedPolicyDegradationEmitted || (loudManagedPolicyDegradationEmitted = !0, process.stderr.write(
189712
- `[sema] permission rules degraded to policy deny/ask only (fail-closed): ${health.loudReason} \u2014 allow rules from every source (including the user-writable HKCU policy slot) are NOT applied until the managed policy layer reads cleanly
189713
- `
189714
- )), "degraded");
189807
+ if (!health.healthy) {
189808
+ if (!loudManagedPolicyDegradationEmitted) {
189809
+ loudManagedPolicyDegradationEmitted = !0;
189810
+ let msg = `permission rules degraded to policy deny/ask only (fail-closed): ${health.loudReason} \u2014 allow rules from every source (including the user-writable HKCU policy slot) are NOT applied until the managed policy layer reads cleanly`;
189811
+ process.stderr.write(`[sema] ${msg}
189812
+ `), loudPermissionsLoaderNotices.push(msg);
189813
+ }
189814
+ return "degraded";
189815
+ }
189816
+ return getSettingsForSource("policySettings")?.allowManagedPermissionRulesOnly === !0 ? "managed-only" : "all-sources";
189715
189817
  }
189716
189818
  function shouldShowAlwaysAllowOptions() {
189717
189819
  return !shouldAllowManagedPermissionRulesOnly();
@@ -189822,7 +189924,7 @@ function addPermissionRulesToSettings({
189822
189924
  return logError(error51), !1;
189823
189925
  }
189824
189926
  }
189825
- var loudManagedPolicyDegradationEmitted, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOURCES, init_permissionsLoader = __esm({
189927
+ var loudManagedPolicyDegradationEmitted, loudPermissionsLoaderNotices, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOURCES, init_permissionsLoader = __esm({
189826
189928
  "build-src/src/utils/permissions/permissionsLoader.ts"() {
189827
189929
  init_fileRead();
189828
189930
  init_fsOperations();
@@ -189832,7 +189934,7 @@ var loudManagedPolicyDegradationEmitted, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOUR
189832
189934
  init_settings2();
189833
189935
  init_settings();
189834
189936
  init_permissionRuleParser();
189835
- loudManagedPolicyDegradationEmitted = !1;
189937
+ loudManagedPolicyDegradationEmitted = !1, loudPermissionsLoaderNotices = [];
189836
189938
  SUPPORTED_RULE_BEHAVIORS = [
189837
189939
  "allow",
189838
189940
  "deny",
@@ -301312,9 +301414,9 @@ function streamingTailWrap(unstableSuffix) {
301312
301414
  }
301313
301415
  var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE_MAX, tokenCache, MD_SYNTAX_RE, init_Markdown = __esm({
301314
301416
  "build-src/src/components/Markdown.tsx"() {
301315
- import_compiler_runtime53 = __toESM(require_compiler_runtime());
301417
+ import_compiler_runtime53 = __toESM(require_compiler_runtime(), 1);
301316
301418
  init_marked_esm();
301317
- import_react48 = __toESM(require_react());
301419
+ import_react48 = __toESM(require_react(), 1);
301318
301420
  init_useSettings();
301319
301421
  init_ink2();
301320
301422
  init_cliHighlight();
@@ -301322,7 +301424,7 @@ var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE
301322
301424
  init_markdown();
301323
301425
  init_messages4();
301324
301426
  init_MarkdownTable();
301325
- import_jsx_runtime65 = __toESM(require_jsx_runtime()), TOKEN_CACHE_MAX = 500, tokenCache = /* @__PURE__ */ new Map(), MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
301427
+ import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1), TOKEN_CACHE_MAX = 500, tokenCache = /* @__PURE__ */ new Map(), MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
301326
301428
  }
301327
301429
  });
301328
301430
 
@@ -304268,7 +304370,17 @@ var PROVIDER_MANAGED_ENV_VARS, PROVIDER_MANAGED_ENV_PREFIXES, DANGEROUS_SHELL_SE
304268
304370
  "SEMA_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
304269
304371
  "SEMA_CODE_DISABLE_TERMINAL_TITLE",
304270
304372
  "SEMA_CODE_ENABLE_TELEMETRY",
304271
- "SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS",
304373
+ // 🔴 sema 分歧(安全收紧类,cc-divergences 已登记;#287 / C-R13,对抗复审 finding):CC 把
304374
+ // agent-teams 的 opt-in env 放在这张**项目可写**的允许表里,于是 clone 来的仓库只要在
304375
+ // `.sema/settings.json` 的 `env` 块写一行,就能替用户挂上具名队友族(TeamCreate/TeamDelete/
304376
+ // SendMessage + 起子进程/worktree 的队友任务)—— 把 agentSwarmsEnabled 那道「只认用户级 settings
304377
+ // 且服从 --setting-sources」的隔离整条绕过去。这类「能起进程、能改状态」的能力位不属于
304378
+ // 「项目可安全设置」的语义,故移出本表。
304379
+ // 影响面两条,都朝更紧的方向:①applySafeConfigEnvironmentVariables 的合并层不再从
304380
+ // project/local 注入它(受信源 user/flag/policy 走 TRUSTED 循环灌全部键,不受影响 ⇒ 用户级
304381
+ // `env` 块照常生效);②bashPermissions 的前缀跳过表同源 —— 带该前缀的命令不再被当成
304382
+ // 「可忽略的安全赋值」去匹配 allow 规则,退回询问。
304383
+ // 'SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS' —— 见上,刻意不在册。
304272
304384
  "SEMA_CODE_IDE_SKIP_AUTO_INSTALL",
304273
304385
  "SEMA_CODE_MAX_OUTPUT_TOKENS",
304274
304386
  "SEMA_CODE_SKIP_BEDROCK_AUTH",
@@ -348128,26 +348240,26 @@ function formatIncomingCallsResult(result, cwd5) {
348128
348240
  let lines = [
348129
348241
  `Found ${result.length} incoming ${plural(result.length, "call")}:`
348130
348242
  ], byFile = /* @__PURE__ */ new Map();
348131
- for (let call77 of result) {
348132
- if (!call77.from) {
348243
+ for (let call78 of result) {
348244
+ if (!call78.from) {
348133
348245
  logForDebugging(
348134
348246
  "formatIncomingCallsResult: CallHierarchyIncomingCall has undefined from field",
348135
348247
  { level: "warn" }
348136
348248
  );
348137
348249
  continue;
348138
348250
  }
348139
- let filePath = formatUri2(call77.from.uri, cwd5), existing = byFile.get(filePath);
348140
- existing ? existing.push(call77) : byFile.set(filePath, [call77]);
348251
+ let filePath = formatUri2(call78.from.uri, cwd5), existing = byFile.get(filePath);
348252
+ existing ? existing.push(call78) : byFile.set(filePath, [call78]);
348141
348253
  }
348142
348254
  for (let [filePath, calls] of byFile) {
348143
348255
  lines.push(`
348144
348256
  ${filePath}:`);
348145
- for (let call77 of calls) {
348146
- if (!call77.from)
348257
+ for (let call78 of calls) {
348258
+ if (!call78.from)
348147
348259
  continue;
348148
- let kind = symbolKindToString(call77.from.kind), line = call77.from.range.start.line + 1, callLine = ` ${call77.from.name} (${kind}) - Line ${line}`;
348149
- if (call77.fromRanges && call77.fromRanges.length > 0) {
348150
- let callSites = call77.fromRanges.map((r) => `${r.start.line + 1}:${r.start.character + 1}`).join(", ");
348260
+ let kind = symbolKindToString(call78.from.kind), line = call78.from.range.start.line + 1, callLine = ` ${call78.from.name} (${kind}) - Line ${line}`;
348261
+ if (call78.fromRanges && call78.fromRanges.length > 0) {
348262
+ let callSites = call78.fromRanges.map((r) => `${r.start.line + 1}:${r.start.character + 1}`).join(", ");
348151
348263
  callLine += ` [calls at: ${callSites}]`;
348152
348264
  }
348153
348265
  lines.push(callLine);
@@ -348162,26 +348274,26 @@ function formatOutgoingCallsResult(result, cwd5) {
348162
348274
  let lines = [
348163
348275
  `Found ${result.length} outgoing ${plural(result.length, "call")}:`
348164
348276
  ], byFile = /* @__PURE__ */ new Map();
348165
- for (let call77 of result) {
348166
- if (!call77.to) {
348277
+ for (let call78 of result) {
348278
+ if (!call78.to) {
348167
348279
  logForDebugging(
348168
348280
  "formatOutgoingCallsResult: CallHierarchyOutgoingCall has undefined to field",
348169
348281
  { level: "warn" }
348170
348282
  );
348171
348283
  continue;
348172
348284
  }
348173
- let filePath = formatUri2(call77.to.uri, cwd5), existing = byFile.get(filePath);
348174
- existing ? existing.push(call77) : byFile.set(filePath, [call77]);
348285
+ let filePath = formatUri2(call78.to.uri, cwd5), existing = byFile.get(filePath);
348286
+ existing ? existing.push(call78) : byFile.set(filePath, [call78]);
348175
348287
  }
348176
348288
  for (let [filePath, calls] of byFile) {
348177
348289
  lines.push(`
348178
348290
  ${filePath}:`);
348179
- for (let call77 of calls) {
348180
- if (!call77.to)
348291
+ for (let call78 of calls) {
348292
+ if (!call78.to)
348181
348293
  continue;
348182
- let kind = symbolKindToString(call77.to.kind), line = call77.to.range.start.line + 1, callLine = ` ${call77.to.name} (${kind}) - Line ${line}`;
348183
- if (call77.fromRanges && call77.fromRanges.length > 0) {
348184
- let callSites = call77.fromRanges.map((r) => `${r.start.line + 1}:${r.start.character + 1}`).join(", ");
348294
+ let kind = symbolKindToString(call78.to.kind), line = call78.to.range.start.line + 1, callLine = ` ${call78.to.name} (${kind}) - Line ${line}`;
348295
+ if (call78.fromRanges && call78.fromRanges.length > 0) {
348296
+ let callSites = call78.fromRanges.map((r) => `${r.start.line + 1}:${r.start.character + 1}`).join(", ");
348185
348297
  callLine += ` [called from: ${callSites}]`;
348186
348298
  }
348187
348299
  lines.push(callLine);
@@ -348744,11 +348856,11 @@ function countUniqueFilesFromCallItems(items) {
348744
348856
  return new Set(validUris).size;
348745
348857
  }
348746
348858
  function countUniqueFilesFromIncomingCalls(calls) {
348747
- let validUris = calls.map((call77) => call77.from?.uri).filter((uri) => uri);
348859
+ let validUris = calls.map((call78) => call78.from?.uri).filter((uri) => uri);
348748
348860
  return new Set(validUris).size;
348749
348861
  }
348750
348862
  function countUniqueFilesFromOutgoingCalls(calls) {
348751
- let validUris = calls.map((call77) => call77.to?.uri).filter((uri) => uri);
348863
+ let validUris = calls.map((call78) => call78.to?.uri).filter((uri) => uri);
348752
348864
  return new Set(validUris).size;
348753
348865
  }
348754
348866
  var MAX_LSP_FILE_SIZE_BYTES, inputSchema25, outputSchema21, LSPTool, init_LSPTool = __esm({
@@ -401280,15 +401392,14 @@ var sema_brand_default, init_sema_brand = __esm({
401280
401392
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
401281
401393
  },
401282
401394
  whatsNew: {
401283
- version: "1.0.79",
401395
+ version: "1.0.82",
401284
401396
  notes: [
401285
- "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
401286
- "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
401287
- "Engine 7.24.0 (from 7.22.0)"
401397
+ "Claude Code permission rules are imported automatically on first launch when detected \u2014 no confirmation step, and a one-line notice tells you what was imported; review or roll back anytime in /permissions",
401398
+ "Engine 7.28.0 (from 7.26.0)"
401288
401399
  ]
401289
401400
  },
401290
- productVersion: "1.0.80",
401291
- announcement: "sema 1.0.80 \u2014 Engine 7.26.0 (from 7.24.0). Background-agent bookkeeping overhaul: when a background agent's completion notice arrives, its panel row now truly settles (no more rows stuck at 'running' with a climbing timer), and reading a background task's output fails honestly instead of ever wiring you to the wrong host run (client-core 0.31.0, BREAKING for integrators relying on the old fallback). Engine-side reconciliation retires orphaned rows when their publisher dies. Engine warm-swap no longer waits up to 30min on already-finished tasks, and never sends 'killed by engine restart' notices for tasks that had already completed. Memory write instructions now arm automatically on bare host installs \u2014 the MEMORY_PERSISTENCE_CAPABLE workaround from 1.0.79 is no longer needed (explicit settings still win)."
401401
+ productVersion: "1.0.82",
401402
+ announcement: "sema 1.0.82 \u2014 Claude Code permission rules are now imported automatically on first launch when detected, with a one-line notice and full visibility in /permissions afterward (no confirmation step, no silent surprises). Under the hood: the agent-teams gate was hardened against config-source bypass, and a queue-processing edge case around injected background prompts was tightened."
401292
401403
  };
401293
401404
  }
401294
401405
  });
@@ -405491,15 +405602,14 @@ var require_sema_brand = __commonJS({
405491
405602
  _doc: "displayName/email \u7559 null = \u8FD0\u884C\u65F6\u56DE\u9000(\u540D\u5B57\u53D6\u672C\u673A OS \u7528\u6237\u540D,\u90AE\u7BB1\u4E0D\u663E\u793A)\u3002\u522B\u70E7\u4E2A\u4EBA\u4FE1\u606F\u8FDB\u54C1\u724C\u6587\u4EF6(F-S1-1:\u65B0\u7528\u6237\u66FE\u770B\u5230 Welcome back Clay!)\u3002"
405492
405603
  },
405493
405604
  whatsNew: {
405494
- version: "1.0.79",
405605
+ version: "1.0.82",
405495
405606
  notes: [
405496
- "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
405497
- "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
405498
- "Engine 7.24.0 (from 7.22.0)"
405607
+ "Claude Code permission rules are imported automatically on first launch when detected \u2014 no confirmation step, and a one-line notice tells you what was imported; review or roll back anytime in /permissions",
405608
+ "Engine 7.28.0 (from 7.26.0)"
405499
405609
  ]
405500
405610
  },
405501
- productVersion: "1.0.80",
405502
- announcement: "sema 1.0.80 \u2014 Engine 7.26.0 (from 7.24.0). Background-agent bookkeeping overhaul: when a background agent's completion notice arrives, its panel row now truly settles (no more rows stuck at 'running' with a climbing timer), and reading a background task's output fails honestly instead of ever wiring you to the wrong host run (client-core 0.31.0, BREAKING for integrators relying on the old fallback). Engine-side reconciliation retires orphaned rows when their publisher dies. Engine warm-swap no longer waits up to 30min on already-finished tasks, and never sends 'killed by engine restart' notices for tasks that had already completed. Memory write instructions now arm automatically on bare host installs \u2014 the MEMORY_PERSISTENCE_CAPABLE workaround from 1.0.79 is no longer needed (explicit settings still win)."
405611
+ productVersion: "1.0.82",
405612
+ announcement: "sema 1.0.82 \u2014 Claude Code permission rules are now imported automatically on first launch when detected, with a one-line notice and full visibility in /permissions afterward (no confirmation step, no silent surprises). Under the hood: the agent-teams gate was hardened against config-source bypass, and a queue-processing edge case around injected background prompts was tightened."
405503
405613
  };
405504
405614
  }
405505
405615
  });
@@ -412867,27 +412977,27 @@ var collab, collab_default, init_collab2 = __esm({
412867
412977
  }
412868
412978
  });
412869
412979
 
412870
- // build-src/src/commands/team.ts
412871
- var USAGE, WORKFLOW_NAME, TRAMPOLINE, team, team_default, init_team = __esm({
412872
- "build-src/src/commands/team.ts"() {
412980
+ // build-src/src/commands/discuss.ts
412981
+ var USAGE, WORKFLOW_NAME, TRAMPOLINE, discuss, discuss_default, init_discuss = __esm({
412982
+ "build-src/src/commands/discuss.ts"() {
412873
412983
  init_dist();
412874
412984
  USAGE = [
412875
- "Usage: /team <topic> \u2014 start a multi-agent team discussion on the topic.",
412876
- "Example: /team should we introduce write-through caching for the session store",
412985
+ "Usage: /discuss <topic> \u2014 start a multi-agent discussion on the topic.",
412986
+ "Example: /discuss should we introduce write-through caching for the session store",
412877
412987
  "To browse collaboration-mode templates instead, use /collab."
412878
412988
  ].join(`
412879
- `), WORKFLOW_NAME = "team-discussion", TRAMPOLINE = (topic) => `The user ran /team to start a team discussion. Do this now:
412989
+ `), WORKFLOW_NAME = "team-discussion", TRAMPOLINE = (topic) => `The user ran /discuss to start a team discussion. Do this now:
412880
412990
 
412881
412991
  1. Call the Workflow tool with exactly: {"name": "${WORKFLOW_NAME}", "args": {"topic": ${JSON.stringify(topic)}}}. The user explicitly requested this discussion, which authorizes the workflow invocation.
412882
412992
  2. When the workflow finishes, present its final synthesis to the user as your answer.
412883
412993
 
412884
- If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not resolve, do NOT pretend a discussion happened: tell the user plainly that team discussions are unavailable in this deployment, then answer the topic yourself as a single agent.`, team = {
412994
+ If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not resolve, do NOT pretend a discussion happened: tell the user plainly that team discussions are unavailable in this deployment, then answer the topic yourself as a single agent.`, discuss = {
412885
412995
  type: "prompt",
412886
- name: "team",
412996
+ name: "discuss",
412887
412997
  // 裁项 #5 默认:壳 author 一句入口标签(成本提示,与 whenToUse 语义对齐但不逐字复制)。
412888
- description: "Start a team discussion (multi-agent, multi-round; cost \u2248 members \xD7 rounds \u2014 not for single factual questions)",
412998
+ description: "Start a multi-agent discussion (multi-round; cost \u2248 members \xD7 rounds \u2014 not for single factual questions)",
412889
412999
  argNames: ["topic"],
412890
- progressMessage: "starting team discussion",
413000
+ progressMessage: "starting discussion",
412891
413001
  contentLength: 0,
412892
413002
  // dynamic (built per-invocation from the topic)
412893
413003
  source: "builtin",
@@ -412897,10 +413007,201 @@ If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not r
412897
413007
  throw new Error(USAGE);
412898
413008
  if (selfOrchestrationFromEnv() === void 0)
412899
413009
  throw new Error(
412900
- `Team discussions need the workflow engine, but it is disabled (${SELF_ORCHESTRATION_ENV}=${process.env[SELF_ORCHESTRATION_ENV]}). Unset ${SELF_ORCHESTRATION_ENV} (or set it to 1) and restart to enable /team.`
413010
+ `Multi-agent discussions need the workflow engine, but it is disabled (${SELF_ORCHESTRATION_ENV}=${process.env[SELF_ORCHESTRATION_ENV]}). Unset ${SELF_ORCHESTRATION_ENV} (or set it to 1) and restart to enable /discuss.`
412901
413011
  );
412902
413012
  return [{ type: "text", text: TRAMPOLINE(topic) }];
412903
413013
  }
413014
+ }, discuss_default = discuss;
413015
+ }
413016
+ });
413017
+
413018
+ // build-src/src/utils/teamDiscovery.ts
413019
+ import { readdirSync as readdirSync11 } from "fs";
413020
+ function discoverTeams(sessionId = getSessionId()) {
413021
+ let entries;
413022
+ try {
413023
+ entries = readdirSync11(getTeamsDir(), { withFileTypes: !0 }).filter((d4) => d4.isDirectory()).map((d4) => d4.name);
413024
+ } catch (e) {
413025
+ let code2 = getErrnoCode(e);
413026
+ return { teams: [], skipped: 0, dirError: code2 === "ENOENT" ? void 0 : code2 ?? "EUNKNOWN" };
413027
+ }
413028
+ let teams = [], skipped = 0;
413029
+ for (let dirName of entries)
413030
+ try {
413031
+ let teamFile = readTeamFile(dirName);
413032
+ if (!teamFile) {
413033
+ skipped++;
413034
+ continue;
413035
+ }
413036
+ let rawMembers = teamFile.members;
413037
+ if (!Array.isArray(rawMembers)) {
413038
+ skipped++;
413039
+ continue;
413040
+ }
413041
+ if (!rawMembers.every(
413042
+ (m2) => m2 !== null && typeof m2 == "object" && typeof m2.name == "string" && (m2.isActive === void 0 || typeof m2.isActive == "boolean")
413043
+ )) {
413044
+ skipped++;
413045
+ continue;
413046
+ }
413047
+ let members = rawMembers.filter((m2) => m2.name !== TEAM_LEAD_NAME), runningCount = members.filter((m2) => m2.isActive !== !1).length, name = typeof teamFile.name == "string" && teamFile.name.length > 0 ? teamFile.name : dirName;
413048
+ teams.push({
413049
+ name,
413050
+ memberCount: members.length,
413051
+ runningCount,
413052
+ idleCount: members.length - runningCount,
413053
+ ledByThisSession: typeof teamFile.leadSessionId == "string" && teamFile.leadSessionId === sessionId
413054
+ });
413055
+ } catch {
413056
+ skipped++;
413057
+ continue;
413058
+ }
413059
+ return teams.sort((a, b3) => a.name.localeCompare(b3.name)), { teams, skipped };
413060
+ }
413061
+ function getTeammateStatuses(teamName) {
413062
+ let teamFile = readTeamFile(teamName);
413063
+ if (!teamFile)
413064
+ return [];
413065
+ let hiddenPaneIds = new Set(teamFile.hiddenPaneIds ?? []), statuses = [];
413066
+ for (let member of teamFile.members) {
413067
+ if (member.name === "team-lead")
413068
+ continue;
413069
+ let status3 = member.isActive !== !1 ? "running" : "idle";
413070
+ statuses.push({
413071
+ name: member.name,
413072
+ agentId: member.agentId,
413073
+ agentType: member.agentType,
413074
+ model: member.model,
413075
+ prompt: member.prompt,
413076
+ status: status3,
413077
+ color: member.color,
413078
+ tmuxPaneId: member.tmuxPaneId,
413079
+ cwd: member.cwd,
413080
+ worktreePath: member.worktreePath,
413081
+ isHidden: hiddenPaneIds.has(member.tmuxPaneId),
413082
+ backendType: member.backendType && isPaneBackend(member.backendType) ? member.backendType : void 0,
413083
+ mode: member.mode
413084
+ });
413085
+ }
413086
+ return statuses;
413087
+ }
413088
+ var init_teamDiscovery = __esm({
413089
+ "build-src/src/utils/teamDiscovery.ts"() {
413090
+ init_errors2();
413091
+ init_state();
413092
+ init_types18();
413093
+ init_constants10();
413094
+ init_envUtils();
413095
+ init_teamHelpers();
413096
+ }
413097
+ });
413098
+
413099
+ // build-src/src/commands/team.ts
413100
+ var team_exports = {};
413101
+ __export(team_exports, {
413102
+ default: () => team_default,
413103
+ renderTeamPanel: () => renderTeamPanel,
413104
+ runTeamCommand: () => runTeamCommand,
413105
+ userSettingsPathForGuidance: () => userSettingsPathForGuidance
413106
+ });
413107
+ function sanitizeDiskText(raw2) {
413108
+ let cleaned = raw2.replace(/[\u0000-\u001f\u007f-\u009f]/g, "").replace(/[<>]/g, "").trim();
413109
+ return cleaned.length === 0 ? "(unnamed)" : cleaned.length > 64 ? `${cleaned.slice(0, 64)}\u2026` : cleaned;
413110
+ }
413111
+ function plural4(n2, word) {
413112
+ return `${n2} ${word}${n2 === 1 ? "" : "s"}`;
413113
+ }
413114
+ function renderTeamPanel(input) {
413115
+ let { gateOpen, discovery, settingsPath, teamsDir } = input, { teams, skipped, dirError } = discovery;
413116
+ if (!gateOpen)
413117
+ return [
413118
+ "Agent teams: off (experimental, off by default).",
413119
+ "",
413120
+ "Named persistent teammates that share a task list. Turn it on with any one of",
413121
+ "these, then restart sema:",
413122
+ ` \xB7 settings \u2014 add "${AGENT_TEAMS_SETTING_KEY}": true to ${settingsPath}`,
413123
+ ` \xB7 env \u2014 ${AGENT_TEAMS_ENV_VAR}=1`,
413124
+ ` \xB7 flag \u2014 sema ${AGENT_TEAMS_FLAG}`,
413125
+ "",
413126
+ "Once it is on, /team lists your teams."
413127
+ ].join(`
413128
+ `);
413129
+ let skippedNotice = skipped > 0 ? `${plural4(skipped, "team file")} could not be read and ${skipped === 1 ? "is" : "are"} not listed above \u2014 that is not the same as not having them.` : null;
413130
+ if (dirError !== void 0)
413131
+ return [
413132
+ `Agent teams: on (experimental). Could not read the team directory (${dirError}).`,
413133
+ "",
413134
+ `${teamsDir} is unreadable, so this list may be incomplete \u2014 it does NOT mean you`,
413135
+ "have no teams. Fix the path/permissions and run /team again."
413136
+ ].join(`
413137
+ `);
413138
+ if (teams.length === 0)
413139
+ return skippedNotice ? [
413140
+ "Agent teams: on (experimental). No teams could be listed.",
413141
+ "",
413142
+ skippedNotice,
413143
+ `Team files live in ${teamsDir}.`
413144
+ ].join(`
413145
+ `) : [
413146
+ "Agent teams: on (experimental). No teams yet.",
413147
+ "",
413148
+ 'Ask Claude to create one \u2014 for example: "create a team of two reviewers to go',
413149
+ 'over this diff". Claude builds it with the TeamCreate tool.',
413150
+ `Team files live in ${teamsDir}.`
413151
+ ].join(`
413152
+ `);
413153
+ let rows2 = teams.map((t2) => {
413154
+ let counts2 = `${plural4(t2.memberCount, "teammate")} (${t2.runningCount} running, ${t2.idleCount} idle)`;
413155
+ return ` \xB7 ${sanitizeDiskText(t2.name)} \u2014 ${counts2}${t2.ledByThisSession ? " \u2014 led by this session" : ""}`;
413156
+ });
413157
+ return [
413158
+ `Agent teams: on (experimental). ${plural4(teams.length, "team")}:`,
413159
+ "",
413160
+ ...rows2,
413161
+ "",
413162
+ ...skippedNotice ? [skippedNotice] : [],
413163
+ // 诚实边界:running/idle 读的是团队台账里的 isActive 心跳位,不是进程存活探测。
413164
+ "Counts come from each team file, not from a live process probe.",
413165
+ `Team files live in ${teamsDir}.`
413166
+ ].join(`
413167
+ `);
413168
+ }
413169
+ function userSettingsPathForGuidance() {
413170
+ return getSettingsFilePathForSource("userSettings") ?? "your user settings.json";
413171
+ }
413172
+ async function runTeamCommand(args) {
413173
+ if ((args ?? "").trim().length > 0)
413174
+ return { type: "text", value: USAGE2, level: "error" };
413175
+ let gateOpen = isAgentSwarmsEnabled();
413176
+ return {
413177
+ type: "text",
413178
+ value: renderTeamPanel({
413179
+ gateOpen,
413180
+ // 门关时不去扫磁盘:功能没开,列表既无意义也只会让指路文案被噪音淹掉。
413181
+ discovery: gateOpen ? discoverTeams() : { teams: [], skipped: 0 },
413182
+ settingsPath: userSettingsPathForGuidance(),
413183
+ teamsDir: getTeamsDir()
413184
+ })
413185
+ };
413186
+ }
413187
+ var USAGE2, call44, team, team_default, init_team = __esm({
413188
+ "build-src/src/commands/team.ts"() {
413189
+ init_agentSwarmsEnabled();
413190
+ init_envUtils();
413191
+ init_settings2();
413192
+ init_teamDiscovery();
413193
+ USAGE2 = [
413194
+ "Usage: /team \u2014 show agent-teams status (named persistent teammates).",
413195
+ "It takes no arguments.",
413196
+ "To start a one-off multi-agent discussion instead, use /discuss <topic>."
413197
+ ].join(`
413198
+ `);
413199
+ call44 = (args) => runTeamCommand(args), team = {
413200
+ type: "local",
413201
+ name: "team",
413202
+ description: "Show agent-teams status: named persistent teammates and how to enable them (experimental)",
413203
+ supportsNonInteractive: !0,
413204
+ load: () => Promise.resolve({ call: call44 })
412904
413205
  }, team_default = team;
412905
413206
  }
412906
413207
  });
@@ -412908,7 +413209,7 @@ If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not r
412908
413209
  // build-src/src/commands/think-back/thinkback.tsx
412909
413210
  var thinkback_exports = {};
412910
413211
  __export(thinkback_exports, {
412911
- call: () => call44,
413212
+ call: () => call45,
412912
413213
  playAnimation: () => playAnimation
412913
413214
  });
412914
413215
  import { readFile as readFile46 } from "fs/promises";
@@ -413181,7 +413482,7 @@ function ThinkbackFlow(t0) {
413181
413482
  let t8;
413182
413483
  return $3[22] !== handleAction || $3[23] !== hasGenerated || $3[24] !== onDone || $3[25] !== skillDir ? (t8 = /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(ThinkbackMenu, { onDone, onAction: handleAction, skillDir, hasGenerated }), $3[22] = handleAction, $3[23] = hasGenerated, $3[24] = onDone, $3[25] = skillDir, $3[26] = t8) : t8 = $3[26], t8;
413183
413484
  }
413184
- async function call44(onDone) {
413485
+ async function call45(onDone) {
413185
413486
  return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(ThinkbackFlow, { onDone });
413186
413487
  }
413187
413488
  var import_compiler_runtime210, import_react176, import_jsx_runtime302, OFFICIAL_MARKETPLACE_REPO, SKILL_NAME, EDIT_PROMPT, FIX_PROMPT, REGENERATE_PROMPT, init_thinkback = __esm({
@@ -413230,13 +413531,13 @@ var thinkback, think_back_default, init_think_back = __esm({
413230
413531
  // build-src/src/commands/thinkback-play/thinkback-play.ts
413231
413532
  var thinkback_play_exports = {};
413232
413533
  __export(thinkback_play_exports, {
413233
- call: () => call45
413534
+ call: () => call46
413234
413535
  });
413235
413536
  import { join as join155 } from "path";
413236
413537
  function getPluginId2() {
413237
413538
  return `thinkback@${process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME}`;
413238
413539
  }
413239
- async function call45() {
413540
+ async function call46() {
413240
413541
  let v2Data = loadInstalledPluginsV2(), pluginId = getPluginId2(), installations = v2Data.plugins[pluginId];
413241
413542
  if (!installations || installations.length === 0)
413242
413543
  return {
@@ -413770,6 +414071,16 @@ function collectCcSettingsLayers(cwd5 = process.cwd()) {
413770
414071
  }
413771
414072
  return out6;
413772
414073
  }
414074
+ function collectCcUserLayerAt(settingsPath) {
414075
+ let root2;
414076
+ try {
414077
+ root2 = realpathSync9(homedir41());
414078
+ } catch {
414079
+ root2 = homedir41();
414080
+ }
414081
+ let out6 = { layers: [], missing: [] }, res = readOneLayer("userSettings", settingsPath, root2, { refuseSymlinks: !1 });
414082
+ return "layer" in res ? out6.layers.push(res.layer) : out6.missing.push(res.missing), out6;
414083
+ }
413773
414084
  function buildToolApprovalRespondBody(input) {
413774
414085
  let wantsPersist = typeof input.persistRule == "string" && input.persistRule !== "" && input.decision !== "deny";
413775
414086
  return {
@@ -413875,6 +414186,10 @@ var init_ccRulesImport = __esm({
413875
414186
  // build-src/src/sema/rules/ccImportMarker.ts
413876
414187
  import { existsSync as existsSync25, readFileSync as readFileSync35, writeFileSync as writeFileSync19, mkdirSync as mkdirSync20 } from "node:fs";
413877
414188
  import { join as join157, dirname as dirname73 } from "node:path";
414189
+ import { homedir as homedir42 } from "node:os";
414190
+ function ruleStoreWireAvailable() {
414191
+ return persistedRulesLaneAvailable2();
414192
+ }
413878
414193
  function markerPath() {
413879
414194
  return join157(getClaudeConfigHomeDir(), "cc-import.json");
413880
414195
  }
@@ -413888,7 +414203,8 @@ function readCcImportMarker() {
413888
414203
  return typeof raw2.importedAt != "string" || typeof raw2.importedCount != "number" ? null : {
413889
414204
  importedAt: raw2.importedAt,
413890
414205
  sourcePath: typeof raw2.sourcePath == "string" ? raw2.sourcePath : "",
413891
- importedCount: raw2.importedCount
414206
+ importedCount: raw2.importedCount,
414207
+ declined: raw2.declined === !0
413892
414208
  };
413893
414209
  } catch {
413894
414210
  return null;
@@ -413899,6 +414215,31 @@ function writeCcImportMarker(marker) {
413899
414215
  mkdirSync20(dirname73(p), { recursive: !0 }), writeFileSync19(p, JSON.stringify(marker, null, 2) + `
413900
414216
  `, "utf8");
413901
414217
  }
414218
+ function writeCcImportDeclinedMarker() {
414219
+ writeCcImportMarker({ importedAt: (/* @__PURE__ */ new Date()).toISOString(), sourcePath: "", importedCount: 0, declined: !0 });
414220
+ }
414221
+ function detectCcAllowRulesSource() {
414222
+ let ccEnvKey = "CLAUDE_CONFIG_DIR", ccLegacyDir = join157(homedir42(), ".claude"), roots = [process.env[ccEnvKey], ccLegacyDir].filter(
414223
+ (r) => typeof r == "string" && r.length > 0
414224
+ );
414225
+ for (let root2 of roots) {
414226
+ let p = join157(root2, "settings.json");
414227
+ if (existsSync25(p))
414228
+ try {
414229
+ let parsed = JSON.parse(readFileSync35(p, "utf8"));
414230
+ if (typeof parsed != "object" || parsed === null) continue;
414231
+ let perms = parsed.permissions;
414232
+ if (typeof perms != "object" || perms === null) continue;
414233
+ let allow = perms.allow;
414234
+ if (Array.isArray(allow) && allow.length > 0) return p;
414235
+ } catch {
414236
+ }
414237
+ }
414238
+ return null;
414239
+ }
414240
+ function ccImportBootGate() {
414241
+ return !ruleStoreWireAvailable() || readCcImportMarker() !== null ? null : detectCcAllowRulesSource();
414242
+ }
413902
414243
  var init_ccImportMarker = __esm({
413903
414244
  "build-src/src/sema/rules/ccImportMarker.ts"() {
413904
414245
  init_envUtils();
@@ -415209,13 +415550,13 @@ var import_compiler_runtime217, React107, import_react180, import_jsx_runtime312
415209
415550
  // build-src/src/commands/permissions/permissions.tsx
415210
415551
  var permissions_exports3 = {};
415211
415552
  __export(permissions_exports3, {
415212
- call: () => call46
415553
+ call: () => call47
415213
415554
  });
415214
- var import_jsx_runtime313, call46, init_permissions3 = __esm({
415555
+ var import_jsx_runtime313, call47, init_permissions3 = __esm({
415215
415556
  "build-src/src/commands/permissions/permissions.tsx"() {
415216
415557
  init_PermissionRuleList();
415217
415558
  init_messages4();
415218
- import_jsx_runtime313 = __toESM(require_jsx_runtime(), 1), call46 = async (onDone, context3) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(PermissionRuleList, { onExit: onDone, onRetryDenials: (commands) => {
415559
+ import_jsx_runtime313 = __toESM(require_jsx_runtime(), 1), call47 = async (onDone, context3) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(PermissionRuleList, { onExit: onDone, onRetryDenials: (commands) => {
415219
415560
  context3.setMessages((prev) => [...prev, createPermissionRetryMessage(commands)]);
415220
415561
  } });
415221
415562
  }
@@ -415238,7 +415579,7 @@ var permissions, permissions_default, init_permissions4 = __esm({
415238
415579
  // build-src/src/commands/plan/plan.tsx
415239
415580
  var plan_exports = {};
415240
415581
  __export(plan_exports, {
415241
- call: () => call47
415582
+ call: () => call48
415242
415583
  });
415243
415584
  function PlanDisplay(t0) {
415244
415585
  let $3 = (0, import_compiler_runtime218.c)(11), {
@@ -415265,7 +415606,7 @@ function PlanDisplay(t0) {
415265
415606
  t4
415266
415607
  ] }), $3[7] = t2, $3[8] = t3, $3[9] = t4, $3[10] = t5) : t5 = $3[10], t5;
415267
415608
  }
415268
- async function call47(onDone, context3, args) {
415609
+ async function call48(onDone, context3, args) {
415269
415610
  let {
415270
415611
  getAppState,
415271
415612
  setAppState
@@ -415368,7 +415709,7 @@ var import_compiler_runtime219, import_jsx_runtime315, init_FastIcon = __esm({
415368
415709
  var fast_exports = {};
415369
415710
  __export(fast_exports, {
415370
415711
  FastModePicker: () => FastModePicker,
415371
- call: () => call48
415712
+ call: () => call49
415372
415713
  });
415373
415714
  function applyFastMode(enable, setAppState) {
415374
415715
  clearFastModeCooldown(), updateSettingsForSource("userSettings", {
@@ -415501,7 +415842,7 @@ async function handleFastModeShortcut(enable, getAppState, setAppState) {
415501
415842
  } else
415502
415843
  return "Fast mode OFF";
415503
415844
  }
415504
- async function call48(onDone, context3, args) {
415845
+ async function call49(onDone, context3, args) {
415505
415846
  if (!isFastModeEnabled())
415506
415847
  return null;
415507
415848
  await prefetchFastModeStatus();
@@ -415672,9 +416013,9 @@ var import_react182, import_jsx_runtime317, init_Passes = __esm({
415672
416013
  // build-src/src/commands/passes/passes.tsx
415673
416014
  var passes_exports = {};
415674
416015
  __export(passes_exports, {
415675
- call: () => call49
416016
+ call: () => call50
415676
416017
  });
415677
- async function call49(onDone) {
416018
+ async function call50(onDone) {
415678
416019
  let isFirstVisit = !getGlobalConfig().hasVisitedPasses;
415679
416020
  if (isFirstVisit) {
415680
416021
  let remaining = getCachedRemainingPasses();
@@ -415992,9 +416333,9 @@ var import_compiler_runtime221, import_react183, import_jsx_runtime319, NEW_TERM
415992
416333
  // build-src/src/commands/privacy-settings/privacy-settings.tsx
415993
416334
  var privacy_settings_exports = {};
415994
416335
  __export(privacy_settings_exports, {
415995
- call: () => call50
416336
+ call: () => call51
415996
416337
  });
415997
- async function call50(onDone) {
416338
+ async function call51(onDone) {
415998
416339
  if (!await isQualifiedForGrove())
415999
416340
  return onDone(FALLBACK_MESSAGE), null;
416000
416341
  let [settingsResult, configResult] = await Promise.all([getGroveSettings(), getGroveNoticeConfig()]);
@@ -417029,14 +417370,14 @@ var import_compiler_runtime225, import_react184, import_jsx_runtime325, init_Hoo
417029
417370
  // build-src/src/commands/hooks/hooks.tsx
417030
417371
  var hooks_exports = {};
417031
417372
  __export(hooks_exports, {
417032
- call: () => call51
417373
+ call: () => call52
417033
417374
  });
417034
- var import_jsx_runtime326, call51, init_hooks3 = __esm({
417375
+ var import_jsx_runtime326, call52, init_hooks3 = __esm({
417035
417376
  "build-src/src/commands/hooks/hooks.tsx"() {
417036
417377
  init_HooksConfigMenu();
417037
417378
  init_analytics_index();
417038
417379
  init_tools2();
417039
- import_jsx_runtime326 = __toESM(require_jsx_runtime(), 1), call51 = async (onDone, context3) => {
417380
+ import_jsx_runtime326 = __toESM(require_jsx_runtime(), 1), call52 = async (onDone, context3) => {
417040
417381
  let permissionContext = context3.getAppState().toolPermissionContext, toolNames = getTools(permissionContext).map((tool) => tool.name);
417041
417382
  return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(HooksConfigMenu, { toolNames, onExit: onDone });
417042
417383
  };
@@ -417059,10 +417400,10 @@ var hooks, hooks_default, init_hooks4 = __esm({
417059
417400
  // build-src/src/commands/files/files.ts
417060
417401
  var files_exports2 = {};
417061
417402
  __export(files_exports2, {
417062
- call: () => call52
417403
+ call: () => call53
417063
417404
  });
417064
417405
  import { relative as relative26 } from "path";
417065
- async function call52(_args, context3) {
417406
+ async function call53(_args, context3) {
417066
417407
  let files2 = context3.readFileState ? cacheKeys(context3.readFileState) : [];
417067
417408
  return files2.length === 0 ? { type: "text", value: "No files in context" } : { type: "text", value: `Files in context:
417068
417409
  ${files2.map((file2) => relative26(getCwd(), file2)).join(`
@@ -417200,7 +417541,7 @@ async function getUniqueForkName(baseName) {
417200
417541
  nextNumber++;
417201
417542
  return `${baseName} (Branch ${nextNumber})`;
417202
417543
  }
417203
- async function call53(onDone, context3, args) {
417544
+ async function call54(onDone, context3, args) {
417204
417545
  let customTitle = args?.trim() || void 0, originalSessionId = getSessionId();
417205
417546
  try {
417206
417547
  let {
@@ -417270,7 +417611,7 @@ function resolveDurable() {
417270
417611
  function makeLiveBranchDeps() {
417271
417612
  return {
417272
417613
  resolveDurable,
417273
- localBranch: call53
417614
+ localBranch: call54
417274
417615
  };
417275
417616
  }
417276
417617
  var init_branchDurableLive = __esm({
@@ -417309,14 +417650,14 @@ var agents_exports2 = {};
417309
417650
  __export(agents_exports2, {
417310
417651
  default: () => agents_default
417311
417652
  });
417312
- var WIZARD_REMOVED_TEXT, call54, agents, agents_default, init_agents2 = __esm({
417653
+ var WIZARD_REMOVED_TEXT, call55, agents, agents_default, init_agents2 = __esm({
417313
417654
  "build-src/src/commands/agents/index.ts"() {
417314
417655
  WIZARD_REMOVED_TEXT = `The /agents wizard has been removed.
417315
417656
 
417316
417657
  Ask sema to create or update subagents for you (e.g. "create a code-reviewer subagent that ..."),
417317
417658
  or edit the files directly:
417318
417659
  \u2022 .sema/agents/ (this project)
417319
- \u2022 ~/.sema/agents/ (all projects)`, call54 = async () => ({
417660
+ \u2022 ~/.sema/agents/ (all projects)`, call55 = async () => ({
417320
417661
  type: "text",
417321
417662
  value: WIZARD_REMOVED_TEXT
417322
417663
  }), agents = {
@@ -417324,7 +417665,7 @@ or edit the files directly:
417324
417665
  name: "agents",
417325
417666
  description: "(removed) Ask sema to create/manage subagents, or edit .sema/agents/",
417326
417667
  supportsNonInteractive: !0,
417327
- load: () => Promise.resolve({ call: call54 })
417668
+ load: () => Promise.resolve({ call: call55 })
417328
417669
  }, agents_default = agents;
417329
417670
  }
417330
417671
  });
@@ -418418,9 +418759,9 @@ For -m/--message and --remote, use the CLI: sema plugin tag --help`;
418418
418759
  // build-src/src/commands/plugin/plugin.tsx
418419
418760
  var plugin_exports = {};
418420
418761
  __export(plugin_exports, {
418421
- call: () => call55
418762
+ call: () => call56
418422
418763
  });
418423
- async function call55(onDone, context3, args) {
418764
+ async function call56(onDone, context3, args) {
418424
418765
  let getSessionContext = () => ({
418425
418766
  readFileState: context3.readFileState,
418426
418767
  bashTools: extractBashToolsFromMessages(context3.messages ?? []),
@@ -418601,12 +418942,12 @@ var init_refresh = __esm({
418601
418942
  // build-src/src/commands/reload-plugins/reload-plugins.ts
418602
418943
  var reload_plugins_exports = {};
418603
418944
  __export(reload_plugins_exports, {
418604
- call: () => call56
418945
+ call: () => call57
418605
418946
  });
418606
418947
  function n(count3, noun) {
418607
418948
  return `${count3} ${plural(count3, noun)}`;
418608
418949
  }
418609
- var call56, init_reload_plugins = __esm({
418950
+ var call57, init_reload_plugins = __esm({
418610
418951
  "build-src/src/commands/reload-plugins/reload-plugins.ts"() {
418611
418952
  init_state();
418612
418953
  init_settingsSync();
@@ -418614,7 +418955,7 @@ var call56, init_reload_plugins = __esm({
418614
418955
  init_refresh();
418615
418956
  init_changeDetector();
418616
418957
  init_stringUtils();
418617
- call56 = async (_args, context3) => {
418958
+ call57 = async (_args, context3) => {
418618
418959
  let r = await refreshActivePlugins(context3.setAppState), msg = `Reloaded: ${[
418619
418960
  n(r.enabled_count, "plugin"),
418620
418961
  n(r.command_count, "skill"),
@@ -418651,9 +418992,9 @@ var reloadPlugins, reload_plugins_default, init_reload_plugins2 = __esm({
418651
418992
  // build-src/src/commands/rewind/rewind.ts
418652
418993
  var rewind_exports = {};
418653
418994
  __export(rewind_exports, {
418654
- call: () => call57
418995
+ call: () => call58
418655
418996
  });
418656
- async function call57(_args, context3) {
418997
+ async function call58(_args, context3) {
418657
418998
  return context3.openMessageSelector && context3.openMessageSelector(), { type: "skip" };
418658
418999
  }
418659
419000
  var init_rewind = __esm({
@@ -418807,9 +419148,9 @@ var init_heapDumpService = __esm({
418807
419148
  // build-src/src/commands/heapdump/heapdump.ts
418808
419149
  var heapdump_exports = {};
418809
419150
  __export(heapdump_exports, {
418810
- call: () => call58
419151
+ call: () => call59
418811
419152
  });
418812
- async function call58() {
419153
+ async function call59() {
418813
419154
  let result = await performHeapDump();
418814
419155
  return result.success ? {
418815
419156
  type: "text",
@@ -419205,10 +419546,10 @@ var debugHandle, faultQueue, init_bridgeDebug = __esm({
419205
419546
  });
419206
419547
 
419207
419548
  // build-src/src/commands/bridge-kick.ts
419208
- var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419549
+ var USAGE3, call60, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419209
419550
  "build-src/src/commands/bridge-kick.ts"() {
419210
419551
  init_bridgeDebug();
419211
- USAGE2 = `/bridge-kick <subcommand>
419552
+ USAGE3 = `/bridge-kick <subcommand>
419212
419553
  close <code> fire ws_closed with the given code (e.g. 1002)
419213
419554
  poll <status> [type] next poll throws BridgeFatalError(status, type)
419214
419555
  poll transient next poll throws axios-style rejection (5xx/net)
@@ -419217,7 +419558,7 @@ var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419217
419558
  reconnect-session fail next POST /bridge/reconnect fails
419218
419559
  heartbeat <status> next heartbeat throws BridgeFatalError(status)
419219
419560
  reconnect call reconnectEnvironmentWithSession directly
419220
- status print bridge state`, call59 = async (args) => {
419561
+ status print bridge state`, call60 = async (args) => {
419221
419562
  let h = getBridgeDebugHandle();
419222
419563
  if (!h)
419223
419564
  return {
@@ -419232,7 +419573,7 @@ var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419232
419573
  type: "text",
419233
419574
  value: `Fired transport close(${code2}). Watch debug.log for [bridge:repl] recovery.`
419234
419575
  }) : { type: "text", value: `close: need a numeric code
419235
- ${USAGE2}` };
419576
+ ${USAGE3}` };
419236
419577
  }
419237
419578
  case "poll": {
419238
419579
  if (a === "transient")
@@ -419250,7 +419591,7 @@ ${USAGE2}` };
419250
419591
  return {
419251
419592
  type: "text",
419252
419593
  value: `poll: need 'transient' or a status code
419253
- ${USAGE2}`
419594
+ ${USAGE3}`
419254
419595
  };
419255
419596
  let errorType = b3 ?? (status3 === 404 ? "not_found_error" : "authentication_error");
419256
419597
  return h.injectFault({
@@ -419319,7 +419660,7 @@ ${USAGE2}`
419319
419660
  case "status":
419320
419661
  return { type: "text", value: h.describe() };
419321
419662
  default:
419322
- return { type: "text", value: USAGE2 };
419663
+ return { type: "text", value: USAGE3 };
419323
419664
  }
419324
419665
  }, bridgeKick = {
419325
419666
  type: "local",
@@ -419327,16 +419668,16 @@ ${USAGE2}`
419327
419668
  description: "Inject bridge failure states for manual recovery testing",
419328
419669
  isEnabled: () => process.env.USER_TYPE === "ant",
419329
419670
  supportsNonInteractive: !1,
419330
- load: () => Promise.resolve({ call: call59 })
419671
+ load: () => Promise.resolve({ call: call60 })
419331
419672
  }, bridge_kick_default = bridgeKick;
419332
419673
  }
419333
419674
  });
419334
419675
 
419335
419676
  // build-src/src/commands/version.ts
419336
- var SEMA_PRODUCT_VERSION, call60, version3, version_default, init_version2 = __esm({
419677
+ var SEMA_PRODUCT_VERSION, call61, version3, version_default, init_version2 = __esm({
419337
419678
  "build-src/src/commands/version.ts"() {
419338
419679
  init_sema_brand();
419339
- SEMA_PRODUCT_VERSION = sema_brand_default.productVersion ?? "0.0.0", call60 = async () => ({
419680
+ SEMA_PRODUCT_VERSION = sema_brand_default.productVersion ?? "0.0.0", call61 = async () => ({
419340
419681
  type: "text",
419341
419682
  value: `sema ${SEMA_PRODUCT_VERSION} (CC-compatible base 2.1.187)`
419342
419683
  }), version3 = {
@@ -419345,7 +419686,7 @@ var SEMA_PRODUCT_VERSION, call60, version3, version_default, init_version2 = __e
419345
419686
  description: "Print the version this session is running (not what autoupdate downloaded)",
419346
419687
  isEnabled: () => process.env.USER_TYPE === "ant",
419347
419688
  supportsNonInteractive: !0,
419348
- load: () => Promise.resolve({ call: call60 })
419689
+ load: () => Promise.resolve({ call: call61 })
419349
419690
  }, version_default = version3;
419350
419691
  }
419351
419692
  });
@@ -419822,10 +420163,10 @@ var import_compiler_runtime228, import_jsx_runtime331, init_SandboxSettings = __
419822
420163
  // build-src/src/commands/sandbox/sandbox-toggle.tsx
419823
420164
  var sandbox_toggle_exports = {};
419824
420165
  __export(sandbox_toggle_exports, {
419825
- call: () => call61
420166
+ call: () => call62
419826
420167
  });
419827
420168
  import { relative as relative28 } from "path";
419828
- async function call61(onDone, _context, args) {
420169
+ async function call62(onDone, _context, args) {
419829
420170
  let themeName = getSettings_DEPRECATED().theme || "light", platform4 = getPlatform();
419830
420171
  if (!SandboxManager2.isSupportedPlatform()) {
419831
420172
  let errorMessage4 = platform4 === "wsl" ? "Error: Sandboxing requires WSL2. WSL1 is not supported." : "Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.", message = color("error", themeName)(errorMessage4);
@@ -419954,7 +420295,7 @@ var PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID, init_setupPortable =
419954
420295
 
419955
420296
  // build-src/src/utils/claudeInChrome/setup.ts
419956
420297
  import { chmod as chmod12, mkdir as mkdir40, readFile as readFile50, writeFile as writeFile43 } from "fs/promises";
419957
- import { homedir as homedir42 } from "os";
420298
+ import { homedir as homedir43 } from "os";
419958
420299
  import { join as join161 } from "path";
419959
420300
  import { fileURLToPath as fileURLToPath8 } from "url";
419960
420301
  function shouldEnableClaudeInChrome(chromeFlag) {
@@ -420030,7 +420371,7 @@ function setupClaudeInChrome() {
420030
420371
  }
420031
420372
  function getNativeMessagingHostsDirs() {
420032
420373
  if (getPlatform() === "windows") {
420033
- let home = homedir42(), appData = process.env.APPDATA || join161(home, "AppData", "Local");
420374
+ let home = homedir43(), appData = process.env.APPDATA || join161(home, "AppData", "Local");
420034
420375
  return [join161(appData, "Sema", "ChromeNativeHost")];
420035
420376
  }
420036
420377
  return getAllNativeMessagingHostsDirs().map(({ path: path28 }) => path28);
@@ -420158,7 +420499,7 @@ var CHROME_EXTENSION_RECONNECT_URL, NATIVE_HOST_IDENTIFIER, NATIVE_HOST_MANIFEST
420158
420499
  // build-src/src/commands/chrome/chrome.tsx
420159
420500
  var chrome_exports = {};
420160
420501
  __export(chrome_exports, {
420161
- call: () => call62
420502
+ call: () => call63
420162
420503
  });
420163
420504
  async function callChromeTool(chromeClient, tool, args) {
420164
420505
  let result = await chromeClient.client.callTool({ name: tool, arguments: args }), content = Array.isArray(result.content) ? result.content[0] : void 0;
@@ -420375,7 +420716,7 @@ function ClaudeInChromeMenu(t0) {
420375
420716
  }
420376
420717
  );
420377
420718
  }
420378
- var import_react186, import_jsx_runtime333, CHROME_EXTENSION_URL, CHROME_PERMISSIONS_URL, CHROME_RECONNECT_URL, ConnectedBrowserSchema, call62, init_chrome = __esm({
420719
+ var import_react186, import_jsx_runtime333, CHROME_EXTENSION_URL, CHROME_PERMISSIONS_URL, CHROME_RECONNECT_URL, ConnectedBrowserSchema, call63, init_chrome = __esm({
420379
420720
  "build-src/src/commands/chrome/chrome.tsx"() {
420380
420721
  import_react186 = __toESM(require_react(), 1);
420381
420722
  init_v4();
@@ -420399,7 +420740,7 @@ var import_react186, import_jsx_runtime333, CHROME_EXTENSION_URL, CHROME_PERMISS
420399
420740
  name: external_exports.string().default("Browser"),
420400
420741
  osPlatform: external_exports.string().optional()
420401
420742
  });
420402
- call62 = async function(onDone) {
420743
+ call63 = async function(onDone) {
420403
420744
  let isExtensionInstalled = await isChromeExtensionInstalled().catch((error51) => (logError(
420404
420745
  new Error(
420405
420746
  `[Claude in Chrome] Extension detection failed: ${error51 instanceof Error ? error51.message : String(error51)}`
@@ -420437,9 +420778,9 @@ var command7, chrome_default, init_chrome2 = __esm({
420437
420778
  // build-src/src/commands/stickers/stickers.ts
420438
420779
  var stickers_exports = {};
420439
420780
  __export(stickers_exports, {
420440
- call: () => call63
420781
+ call: () => call64
420441
420782
  });
420442
- async function call63() {
420783
+ async function call64() {
420443
420784
  let url3 = "https://www.stickermule.com/claudecode";
420444
420785
  return await openBrowser(url3) ? { type: "text", value: "Opening sticker page in browser\u2026" } : {
420445
420786
  type: "text",
@@ -420614,7 +420955,7 @@ function AdvisorDialog({
420614
420955
  ] })
420615
420956
  ] }) });
420616
420957
  }
420617
- var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REFUSAL, ADVISOR_MODEL_ALIASES, MODEL_CAPABILITY_RANK, call64, advisor, advisor_default, init_advisor2 = __esm({
420958
+ var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REFUSAL, ADVISOR_MODEL_ALIASES, MODEL_CAPABILITY_RANK, call65, advisor, advisor_default, init_advisor2 = __esm({
420618
420959
  "build-src/src/commands/advisor.tsx"() {
420619
420960
  import_react187 = __toESM(require_react(), 1);
420620
420961
  init_select();
@@ -420636,7 +420977,7 @@ var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REF
420636
420977
  "claude-mythos-5": 5,
420637
420978
  "claude-fable-5": 5
420638
420979
  };
420639
- call64 = async (onDone, _context, args) => {
420980
+ call65 = async (onDone, _context, args) => {
420640
420981
  let arg = (args ?? "").trim().toLowerCase();
420641
420982
  if (!arg)
420642
420983
  return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(AdvisorDialog, { onDone });
@@ -420661,7 +421002,7 @@ var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REF
420661
421002
  get isHidden() {
420662
421003
  return !canUserConfigureAdvisor();
420663
421004
  },
420664
- load: () => Promise.resolve({ call: call64 })
421005
+ load: () => Promise.resolve({ call: call65 })
420665
421006
  }, advisor_default = advisor;
420666
421007
  }
420667
421008
  });
@@ -420934,13 +421275,13 @@ var import_compiler_runtime229, import_jsx_runtime336, GOODBYE_MESSAGES, init_Ex
420934
421275
  // build-src/src/commands/exit/exit.tsx
420935
421276
  var exit_exports = {};
420936
421277
  __export(exit_exports, {
420937
- call: () => call65
421278
+ call: () => call66
420938
421279
  });
420939
421280
  import { spawnSync as spawnSync10 } from "child_process";
420940
421281
  function getRandomGoodbyeMessage2() {
420941
421282
  return sample_default(GOODBYE_MESSAGES2) ?? "Goodbye!";
420942
421283
  }
420943
- async function call65(onDone) {
421284
+ async function call66(onDone) {
420944
421285
  if (isBgSession())
420945
421286
  return onDone(), spawnSync10("tmux", ["detach-client"], {
420946
421287
  stdio: "ignore"
@@ -421117,7 +421458,7 @@ var import_react190, import_jsx_runtime339, init_exportRenderer = __esm({
421117
421458
  // build-src/src/commands/export/export.tsx
421118
421459
  var export_exports = {};
421119
421460
  __export(export_exports, {
421120
- call: () => call66,
421461
+ call: () => call67,
421121
421462
  extractFirstPrompt: () => extractFirstPrompt,
421122
421463
  sanitizeFilename: () => sanitizeFilename
421123
421464
  });
@@ -421147,7 +421488,7 @@ async function exportWithReactRenderer(context3) {
421147
421488
  let tools = context3.options.tools || [];
421148
421489
  return renderMessagesToPlainText(context3.messages, tools);
421149
421490
  }
421150
- async function call66(onDone, context3, args) {
421491
+ async function call67(onDone, context3, args) {
421151
421492
  let content = await exportWithReactRenderer(context3), filename = args.trim();
421152
421493
  if (filename) {
421153
421494
  let finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt", filepath = join164(getCwd(), finalFilename);
@@ -421547,7 +421888,7 @@ var import_react191, import_jsx_runtime341, NO_PREFERENCE2, HEADER_TEXT, MAX_EFF
421547
421888
  // build-src/src/commands/model/model.tsx
421548
421889
  var model_exports2 = {};
421549
421890
  __export(model_exports2, {
421550
- call: () => call67,
421891
+ call: () => call68,
421551
421892
  renderModelLabel: () => renderModelLabel
421552
421893
  });
421553
421894
  function ModelPickerWrapper(t0) {
@@ -421697,7 +422038,7 @@ function renderModelLabel(model) {
421697
422038
  let rendered = renderDefaultModelSetting(model ?? getDefaultMainLoopModelSetting());
421698
422039
  return model === null ? `${rendered} (default)` : rendered;
421699
422040
  }
421700
- var import_compiler_runtime230, React113, import_jsx_runtime342, call67, init_model2 = __esm({
422041
+ var import_compiler_runtime230, React113, import_jsx_runtime342, call68, init_model2 = __esm({
421701
422042
  "build-src/src/commands/model/model.tsx"() {
421702
422043
  import_compiler_runtime230 = __toESM(require_compiler_runtime(), 1);
421703
422044
  init_source2();
@@ -421718,7 +422059,7 @@ var import_compiler_runtime230, React113, import_jsx_runtime342, call67, init_mo
421718
422059
  init_modelAllowlist();
421719
422060
  init_validateModel();
421720
422061
  import_jsx_runtime342 = __toESM(require_jsx_runtime(), 1);
421721
- call67 = async (onDone, _context, args) => {
422062
+ call68 = async (onDone, _context, args) => {
421722
422063
  if (args = args?.trim() || "", COMMON_INFO_ARGS.includes(args))
421723
422064
  return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(ShowModelAndClose, { onDone });
421724
422065
  if (COMMON_HELP_ARGS.includes(args)) {
@@ -421757,7 +422098,7 @@ var model_default, init_model3 = __esm({
421757
422098
  // build-src/src/commands/tag/tag.tsx
421758
422099
  var tag_exports = {};
421759
422100
  __export(tag_exports, {
421760
- call: () => call68
422101
+ call: () => call69
421761
422102
  });
421762
422103
  function ConfirmRemoveTag(t0) {
421763
422104
  let $3 = (0, import_compiler_runtime231.c)(11), {
@@ -421852,7 +422193,7 @@ Examples:
421852
422193
  });
421853
422194
  }, t2 = [onDone], $3[0] = onDone, $3[1] = t1, $3[2] = t2) : (t1 = $3[1], t2 = $3[2]), React114.useEffect(t1, t2), null;
421854
422195
  }
421855
- async function call68(onDone, _context, args) {
422196
+ async function call69(onDone, _context, args) {
421856
422197
  return args = args?.trim() || "", COMMON_INFO_ARGS.includes(args) || COMMON_HELP_ARGS.includes(args) ? /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(ShowHelp, { onDone }) : args ? /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(ToggleTagAndClose, { tagName: args, onDone }) : /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(ShowHelp, { onDone });
421857
422198
  }
421858
422199
  var import_compiler_runtime231, React114, import_jsx_runtime343, init_tag = __esm({
@@ -421889,9 +422230,9 @@ var tag, tag_default, init_tag2 = __esm({
421889
422230
  // build-src/src/commands/output-style/output-style.tsx
421890
422231
  var output_style_exports = {};
421891
422232
  __export(output_style_exports, {
421892
- call: () => call69
422233
+ call: () => call70
421893
422234
  });
421894
- async function call69(onDone) {
422235
+ async function call70(onDone) {
421895
422236
  onDone("/output-style has been deprecated. Use /config to change your output style, or set it in your settings file. Changes take effect on the next session.", {
421896
422237
  display: "system"
421897
422238
  });
@@ -422135,9 +422476,9 @@ var import_compiler_runtime232, import_react192, import_jsx_runtime344, DIALOG_T
422135
422476
  // build-src/src/commands/remote-env/remote-env.tsx
422136
422477
  var remote_env_exports = {};
422137
422478
  __export(remote_env_exports, {
422138
- call: () => call70
422479
+ call: () => call71
422139
422480
  });
422140
- async function call70(onDone) {
422481
+ async function call71(onDone) {
422141
422482
  return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(RemoteEnvironmentDialog, { onDone });
422142
422483
  }
422143
422484
  var import_jsx_runtime345, init_remote_env = __esm({
@@ -422168,9 +422509,9 @@ var remote_env_default, init_remote_env2 = __esm({
422168
422509
  // build-src/src/commands/upgrade/upgrade.tsx
422169
422510
  var upgrade_exports = {};
422170
422511
  __export(upgrade_exports, {
422171
- call: () => call71
422512
+ call: () => call72
422172
422513
  });
422173
- async function call71(onDone, context3) {
422514
+ async function call72(onDone, context3) {
422174
422515
  try {
422175
422516
  if (isClaudeAISubscriber()) {
422176
422517
  let tokens = getClaudeAIOAuthTokens(), isMax20x = !1;
@@ -422221,7 +422562,7 @@ var upgrade, upgrade_default, init_upgrade2 = __esm({
422221
422562
  // build-src/src/commands/rate-limit-options/rate-limit-options.tsx
422222
422563
  var rate_limit_options_exports = {};
422223
422564
  __export(rate_limit_options_exports, {
422224
- call: () => call72
422565
+ call: () => call73
422225
422566
  });
422226
422567
  function RateLimitOptionsMenu(t0) {
422227
422568
  let $3 = (0, import_compiler_runtime233.c)(25), {
@@ -422279,7 +422620,7 @@ function RateLimitOptionsMenu(t0) {
422279
422620
  }, $3[13] = onDone, $3[14] = t4) : t4 = $3[14];
422280
422621
  let handleCancel = t4, t5;
422281
422622
  $3[15] !== context3 || $3[16] !== handleCancel || $3[17] !== onDone ? (t5 = function(value) {
422282
- value === "upgrade" ? call71(onDone, context3).then((jsx526) => {
422623
+ value === "upgrade" ? call72(onDone, context3).then((jsx526) => {
422283
422624
  jsx526 && setSubCommandJSX(jsx526);
422284
422625
  }) : value === "extra-usage" ? call2(onDone, context3).then((jsx_0) => {
422285
422626
  jsx_0 && setSubCommandJSX(jsx_0);
@@ -422293,7 +422634,7 @@ function RateLimitOptionsMenu(t0) {
422293
422634
  let t7;
422294
422635
  return $3[22] !== handleCancel || $3[23] !== t6 ? (t7 = /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(Dialog, { title: "What do you want to do?", onCancel: handleCancel, color: "suggestion", children: t6 }), $3[22] = handleCancel, $3[23] = t6, $3[24] = t7) : t7 = $3[24], t7;
422295
422636
  }
422296
- async function call72(onDone, context3) {
422637
+ async function call73(onDone, context3) {
422297
422638
  return /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(RateLimitOptionsMenu, { onDone, context: context3 });
422298
422639
  }
422299
422640
  var import_compiler_runtime233, import_react193, import_jsx_runtime347, init_rate_limit_options = __esm({
@@ -422470,7 +422811,7 @@ var import_compiler_runtime234, React116, import_jsx_runtime348, init_effort2 =
422470
422811
  // build-src/src/sema/overrides/effort.tsx
422471
422812
  var effort_exports = {};
422472
422813
  __export(effort_exports, {
422473
- call: () => call73,
422814
+ call: () => call74,
422474
422815
  executeEffort: () => executeEffort,
422475
422816
  showCurrentEffort: () => showCurrentEffort
422476
422817
  });
@@ -422621,7 +422962,7 @@ function EffortSlider({ onDone }) {
422621
422962
  footer
422622
422963
  ] });
422623
422964
  }
422624
- async function call73(onDone, _context, args) {
422965
+ async function call74(onDone, _context, args) {
422625
422966
  if (args = args?.trim() || "", COMMON_HELP_ARGS2.includes(args)) {
422626
422967
  onDone(HELP_TEXT);
422627
422968
  return;
@@ -422702,12 +423043,12 @@ var effort_default, init_effort4 = __esm({
422702
423043
  // build-src/src/commands/stats/stats.tsx
422703
423044
  var stats_exports = {};
422704
423045
  __export(stats_exports, {
422705
- call: () => call74
423046
+ call: () => call75
422706
423047
  });
422707
- var import_jsx_runtime350, call74, init_stats2 = __esm({
423048
+ var import_jsx_runtime350, call75, init_stats2 = __esm({
422708
423049
  "build-src/src/commands/stats/stats.tsx"() {
422709
423050
  init_Stats();
422710
- import_jsx_runtime350 = __toESM(require_jsx_runtime(), 1), call74 = async (onDone) => /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(Stats2, { onClose: onDone });
423051
+ import_jsx_runtime350 = __toESM(require_jsx_runtime(), 1), call75 = async (onDone) => /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(Stats2, { onClose: onDone });
422711
423052
  }
422712
423053
  });
422713
423054
 
@@ -422944,7 +423285,7 @@ var import_react195, import_jsx_runtime351, init_RemoteCallout = __esm({
422944
423285
  // build-src/src/commands/remote-control/bridge.tsx
422945
423286
  var bridge_exports = {};
422946
423287
  __export(bridge_exports, {
422947
- call: () => call75
423288
+ call: () => call76
422948
423289
  });
422949
423290
  function BridgeToggle(t0) {
422950
423291
  let $3 = (0, import_compiler_runtime235.c)(10), {
@@ -423141,7 +423482,7 @@ async function checkBridgePrerequisites() {
423141
423482
  let versionError = isEnvLessBridgeEnabled() ? await checkEnvLessBridgeMinVersion() : checkBridgeMinVersion();
423142
423483
  return versionError || (getBridgeAccessToken() ? (logForDebugging("[bridge] Prerequisites passed, enabling bridge"), null) : BRIDGE_LOGIN_INSTRUCTION);
423143
423484
  }
423144
- async function call75(onDone, _context, args) {
423485
+ async function call76(onDone, _context, args) {
423145
423486
  let name = args.trim() || void 0;
423146
423487
  return /* @__PURE__ */ (0, import_jsx_runtime352.jsx)(BridgeToggle, { onDone, name });
423147
423488
  }
@@ -423340,7 +423681,7 @@ var CCR_BYOC_BETA_HEADER, RedactedGithubToken, init_api4 = __esm({
423340
423681
  // build-src/src/commands/web-setup/remote-setup.tsx
423341
423682
  var remote_setup_exports = {};
423342
423683
  __export(remote_setup_exports, {
423343
- call: () => call76
423684
+ call: () => call77
423344
423685
  });
423345
423686
  async function checkLoginState() {
423346
423687
  if (!await isSignedIn())
@@ -423445,7 +423786,7 @@ function Web({
423445
423786
  }, onCancel: handleCancel })
423446
423787
  ] });
423447
423788
  }
423448
- async function call76(onDone) {
423789
+ async function call77(onDone) {
423449
423790
  return /* @__PURE__ */ (0, import_jsx_runtime353.jsx)(Web, { onDone });
423450
423791
  }
423451
423792
  var import_react197, import_jsx_runtime353, init_remote_setup = __esm({
@@ -425584,6 +425925,7 @@ var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteCo
425584
425925
  init_vim2();
425585
425926
  init_websearch2();
425586
425927
  init_collab2();
425928
+ init_discuss();
425587
425929
  init_team();
425588
425930
  init_think_back();
425589
425931
  init_thinkback_play2();
@@ -425744,6 +426086,7 @@ var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteCo
425744
426086
  stickers_default,
425745
426087
  tag_default,
425746
426088
  collab_default,
426089
+ discuss_default,
425747
426090
  team_default,
425748
426091
  theme_default,
425749
426092
  websearch_default,
@@ -428819,7 +429162,7 @@ __export(filesystem_exports, {
428819
429162
  toPosixPath: () => toPosixPath
428820
429163
  });
428821
429164
  import { randomBytes as randomBytes21 } from "crypto";
428822
- import { homedir as homedir43, tmpdir as tmpdir14 } from "os";
429165
+ import { homedir as homedir44, tmpdir as tmpdir14 } from "os";
428823
429166
  import { join as join168, normalize as normalize17, posix as posix8, sep as sep37 } from "path";
428824
429167
  function normalizeCaseForComparison2(path28) {
428825
429168
  return path28.toLowerCase();
@@ -428831,7 +429174,7 @@ function getClaudeSkillScope(filePath) {
428831
429174
  prefix: "/.sema/skills/"
428832
429175
  },
428833
429176
  {
428834
- dir: expandPath(join168(homedir43(), ".sema", "skills")),
429177
+ dir: expandPath(join168(homedir44(), ".sema", "skills")),
428835
429178
  prefix: "~/.sema/skills/"
428836
429179
  }
428837
429180
  ];
@@ -429070,7 +429413,7 @@ function patternWithRoot(pattern, source) {
429070
429413
  if (pattern.startsWith(`~${DIR_SEP}`))
429071
429414
  return {
429072
429415
  relativePattern: pattern.slice(1),
429073
- root: homedir43().normalize("NFC")
429416
+ root: homedir44().normalize("NFC")
429074
429417
  };
429075
429418
  if (pattern.startsWith(DIR_SEP))
429076
429419
  return {
@@ -450268,7 +450611,7 @@ var WORKTREE_PARENT, init_git_worktree_env = __esm({
450268
450611
  });
450269
450612
 
450270
450613
  // node_modules/@sema-agent/core/dist/core/memory-engine/layout.js
450271
- import { closeSync as closeSync13, constants as fsConstants8, copyFileSync as copyFileSync6, existsSync as existsSync27, fstatSync as fstatSync3, fsyncSync as fsyncSync10, lstatSync as lstatSync4, mkdirSync as mkdirSync22, openSync as openSync14, readFileSync as readFileSync37, readdirSync as readdirSync11, realpathSync as realpathSync10, renameSync as renameSync13, rmSync as rmSync7, rmdirSync as rmdirSync3, statSync as statSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync21, writeSync as writeSync7 } from "node:fs";
450614
+ import { closeSync as closeSync13, constants as fsConstants8, copyFileSync as copyFileSync6, existsSync as existsSync27, fstatSync as fstatSync3, fsyncSync as fsyncSync10, lstatSync as lstatSync4, mkdirSync as mkdirSync22, openSync as openSync14, readFileSync as readFileSync37, readdirSync as readdirSync12, realpathSync as realpathSync10, renameSync as renameSync13, rmSync as rmSync7, rmdirSync as rmdirSync3, statSync as statSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync21, writeSync as writeSync7 } from "node:fs";
450272
450615
  var O_WRONLY, O_CREAT, O_TRUNC, O_NOFOLLOW3, O_EXCL, init_layout = __esm({
450273
450616
  "node_modules/@sema-agent/core/dist/core/memory-engine/layout.js"() {
450274
450617
  ({ O_WRONLY, O_CREAT, O_TRUNC, O_NOFOLLOW: O_NOFOLLOW3, O_EXCL } = fsConstants8);
@@ -458786,8 +459129,11 @@ var init_caCertsConfig = __esm({
458786
459129
  // build-src/src/utils/managedEnv.ts
458787
459130
  var managedEnv_exports = {};
458788
459131
  __export(managedEnv_exports, {
459132
+ PROJECT_FORBIDDEN_ENV_VARS: () => PROJECT_FORBIDDEN_ENV_VARS,
458789
459133
  applyConfigEnvironmentVariables: () => applyConfigEnvironmentVariables,
458790
- applySafeConfigEnvironmentVariables: () => applySafeConfigEnvironmentVariables
459134
+ applySafeConfigEnvironmentVariables: () => applySafeConfigEnvironmentVariables,
459135
+ stripUntrustedCapabilityEnv: () => stripUntrustedCapabilityEnv,
459136
+ trustedCapabilityEnv: () => trustedCapabilityEnv
458791
459137
  });
458792
459138
  function withoutSSHTunnelVars(env5) {
458793
459139
  if (!env5 || !process.env.ANTHROPIC_UNIX_SOCKET) return env5 || {};
@@ -458833,14 +459179,48 @@ function applySafeConfigEnvironmentVariables() {
458833
459179
  process.env,
458834
459180
  filterSettingsEnv(getSettingsForSource("policySettings")?.env)
458835
459181
  );
458836
- let settingsEnv4 = filterSettingsEnv(getSettings_DEPRECATED()?.env);
459182
+ let settingsEnv4 = stripUntrustedCapabilityEnv(
459183
+ filterSettingsEnv(getSettings_DEPRECATED()?.env),
459184
+ (source) => isSettingSourceEnabled(source) ? filterSettingsEnv(getSettingsForSource(source)?.env) : void 0
459185
+ );
458837
459186
  for (let [key, value] of Object.entries(settingsEnv4))
458838
459187
  SAFE_ENV_VARS3.has(key.toUpperCase()) && (process.env[key] = value);
459188
+ Object.assign(
459189
+ process.env,
459190
+ trustedCapabilityEnv(
459191
+ (source) => isSettingSourceEnabled(source) ? filterSettingsEnv(getSettingsForSource(source)?.env) : void 0
459192
+ )
459193
+ );
459194
+ }
459195
+ function stripUntrustedCapabilityEnv(merged, readSourceEnv) {
459196
+ let out6 = { ...merged };
459197
+ for (let key of Object.keys(out6))
459198
+ PROJECT_FORBIDDEN_ENV_VARS.has(key.toUpperCase()) && delete out6[key];
459199
+ return Object.assign(out6, trustedCapabilityEnv(readSourceEnv));
459200
+ }
459201
+ function trustedCapabilityEnv(readSourceEnv) {
459202
+ let out6 = {};
459203
+ for (let canonical2 of PROJECT_FORBIDDEN_ENV_VARS)
459204
+ for (let source of TRUSTED_SETTING_SOURCES) {
459205
+ let sourceEnv = readSourceEnv(source);
459206
+ if (sourceEnv)
459207
+ for (let [key, value] of Object.entries(sourceEnv))
459208
+ key.toUpperCase() === canonical2 && (out6[canonical2] = value);
459209
+ }
459210
+ return out6;
458839
459211
  }
458840
459212
  function applyConfigEnvironmentVariables() {
458841
- Object.assign(process.env, filterSettingsEnv(getGlobalConfig().env)), Object.assign(process.env, filterSettingsEnv(getSettings_DEPRECATED()?.env)), clearCACertsCache(), clearMTLSCache(), clearProxyCache(), configureGlobalAgents();
459213
+ Object.assign(process.env, filterSettingsEnv(getGlobalConfig().env)), Object.assign(
459214
+ process.env,
459215
+ stripUntrustedCapabilityEnv(
459216
+ filterSettingsEnv(getSettings_DEPRECATED()?.env),
459217
+ // 🔴 取回也要服从 `--setting-sources`:该 flag 排除 userSettings 时,那份文件里的
459218
+ // 能力位不该还能透过(getSettingsForSource 自身不查源开关)。
459219
+ (source) => isSettingSourceEnabled(source) ? filterSettingsEnv(getSettingsForSource(source)?.env) : void 0
459220
+ )
459221
+ ), clearCACertsCache(), clearMTLSCache(), clearProxyCache(), configureGlobalAgents();
458842
459222
  }
458843
- var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, init_managedEnv = __esm({
459223
+ var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, PROJECT_FORBIDDEN_ENV_VARS, init_managedEnv = __esm({
458844
459224
  "build-src/src/utils/managedEnv.ts"() {
458845
459225
  init_syncCache();
458846
459226
  init_caCerts();
@@ -458856,6 +459236,24 @@ var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, init_managedEnv = __esm({
458856
459236
  "flagSettings",
458857
459237
  "policySettings"
458858
459238
  ];
459239
+ PROJECT_FORBIDDEN_ENV_VARS = /* @__PURE__ */ new Set([
459240
+ // agent-teams 的 opt-in:开门 = 挂上 TeamCreate/TeamDelete/SendMessage + 起队友进程的能力面。
459241
+ // 🔴 品牌名 + CC 名两形都要登记(1.0.82 扫码修,真病 S3):裸字面量 'SEMA_CODE_...' 会被
459242
+ // branding codemod 逐字改写成 'SEMA_CODE_...'(dist 直证:产物里恒 0 处 CLAUDE_ 形、6 处
459243
+ // SEMA_ 形),于是构建后的禁表**只剩品牌名一形**。而 `ccEnvCompatBoot.ts` 的 `applyCcEnvCompat()`
459244
+ // 只在进程边界跑一次、只读**真实 shell env**——它不会回头翻译「后来才从 settings.json 合并
459245
+ // 进 process.env」的值。项目 `.sema/settings.json` 写 `{"env":{"SEMA_CODE_EXPERIMENTAL_
459246
+ // AGENT_TEAMS":"1"}}` 时,合并层按品牌名做的剥离扫不到这个 CC 原名键,它原样滲进
459247
+ // `process.env`——本进程的门读不到(读的是品牌名),但**继承该 env 的子 sema 进程**
459248
+ // (main.tsx spawnSync/worktree.ts/Bash 工具再跑 sema)在自己 boot 期重新跑 compat,会把这个
459249
+ // 继承来的 CC 原名值回翻成品牌名,子进程的门就开了。
459250
+ // 拼接规避同一条 codemod(仓内 envUtils.ts/ccImportMarker.ts 同款纪律):裸写会被连带改掉,
459251
+ // 拼接后的字符串在源码文本层面不含 `\bCLAUDE_\b`,codemod 认不出,构建后仍保持 CC 原形——
459252
+ // 于是禁表在**构建产物**里真同时含两个不同字符串(品牌名+CC 原名);raw src 下两条字面量相同,
459253
+ // Set 天然去重成一条,对 raw src 测试无害(此时两形本就同形)。
459254
+ "SEMA_CODE_EXPERIMENTAL_AGENT_TEAMS",
459255
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS".toUpperCase()
459256
+ ]);
458859
459257
  }
458860
459258
  });
458861
459259
 
@@ -459080,7 +459478,7 @@ __export(upstreamproxy_exports, {
459080
459478
  resetUpstreamProxyForTests: () => resetUpstreamProxyForTests
459081
459479
  });
459082
459480
  import { mkdir as mkdir45, readFile as readFile53, unlink as unlink26, writeFile as writeFile46 } from "fs/promises";
459083
- import { homedir as homedir44 } from "os";
459481
+ import { homedir as homedir45 } from "os";
459084
459482
  import { join as join177 } from "path";
459085
459483
  async function initUpstreamProxy(opts) {
459086
459484
  if (!isEnvTruthy(process.env.SEMA_CODE_REMOTE) || !isEnvTruthy(process.env.CCR_UPSTREAM_PROXY_ENABLED))
@@ -459095,7 +459493,7 @@ async function initUpstreamProxy(opts) {
459095
459493
  if (!token)
459096
459494
  return logForDebugging("[upstreamproxy] no session token file; proxy disabled"), state3;
459097
459495
  setNonDumpable();
459098
- let baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com", caBundlePath = opts?.caBundlePath ?? join177(homedir44(), ".ccr", "ca-bundle.crt");
459496
+ let baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com", caBundlePath = opts?.caBundlePath ?? join177(homedir45(), ".ccr", "ca-bundle.crt");
459099
459497
  if (!await downloadCaBundle(
459100
459498
  baseUrl,
459101
459499
  opts?.systemCaPath ?? SYSTEM_CA_BUNDLE,
@@ -462574,6 +462972,66 @@ var import_compiler_runtime243, import_jsx_runtime365, init_WorkerPendingPermiss
462574
462972
  }
462575
462973
  });
462576
462974
 
462975
+ // build-src/src/sema/rules/ccImportBootRun.ts
462976
+ var ccImportBootRun_exports = {};
462977
+ __export(ccImportBootRun_exports, {
462978
+ __resetCcImportBootLatchForTests: () => __resetCcImportBootLatchForTests,
462979
+ __resetCcImportBootPendingNoticeForTests: () => __resetCcImportBootPendingNoticeForTests,
462980
+ drainPendingCcImportBootNotice: () => drainPendingCcImportBootNotice,
462981
+ runCcImportBootAuto: () => runCcImportBootAuto,
462982
+ runCcImportBootAutoWith: () => runCcImportBootAutoWith
462983
+ });
462984
+ async function runCcImportBootAutoWith(deps2) {
462985
+ try {
462986
+ let sourcePath = deps2.gate();
462987
+ if (sourcePath === null) return "gate-closed";
462988
+ let { layers: layers2 } = deps2.collect(sourcePath);
462989
+ if (layers2.length === 0) return "no-layers";
462990
+ let facade = await deps2.facade(), prep = await prepareCcRuleImport(facade, layers2);
462991
+ if (!prep.ok) return "prepare-failed";
462992
+ if ((Array.isArray(prep.prepared?.preview?.candidates) ? prep.prepared.preview.candidates : []).length === 0)
462993
+ return deps2.writeMarker({ importedAt: (/* @__PURE__ */ new Date()).toISOString(), sourcePath, importedCount: 0 }), "nothing-to-import";
462994
+ let red = await redeemCcRuleImport(facade, prep.prepared.ticket);
462995
+ if (!red.ok) return "redeem-failed";
462996
+ let persisted = Array.isArray(red.redeemed?.persisted) ? red.redeemed.persisted.length : 0, deduped = Array.isArray(red.redeemed?.deduped) ? red.redeemed.deduped.length : 0;
462997
+ if (deps2.writeMarker({ importedAt: (/* @__PURE__ */ new Date()).toISOString(), sourcePath, importedCount: persisted }), persisted > 0) {
462998
+ let noun = persisted === 1 ? "rule" : "rules", dedupTail = deduped > 0 ? ` (${deduped} already present)` : "", text2 = `Imported ${persisted} permission ${noun} from Sema settings${dedupTail} \u2014 review in /permissions`;
462999
+ deps2.notice(text2) || (pendingNotice = text2);
463000
+ }
463001
+ return "imported";
463002
+ } catch {
463003
+ return "prepare-failed";
463004
+ }
463005
+ }
463006
+ function __resetCcImportBootLatchForTests() {
463007
+ attempted = !1;
463008
+ }
463009
+ function drainPendingCcImportBootNotice() {
463010
+ let n2 = pendingNotice;
463011
+ return pendingNotice = null, n2;
463012
+ }
463013
+ function __resetCcImportBootPendingNoticeForTests() {
463014
+ pendingNotice = null;
463015
+ }
463016
+ function runCcImportBootAuto() {
463017
+ return attempted ? Promise.resolve("already-attempted") : (attempted = !0, runCcImportBootAutoWith({
463018
+ gate: ccImportBootGate,
463019
+ collect: collectCcUserLayerAt,
463020
+ facade: resolveRulesFacade,
463021
+ writeMarker: writeCcImportMarker,
463022
+ notice: surfaceTranscriptSystemNotice
463023
+ }));
463024
+ }
463025
+ var attempted, pendingNotice, init_ccImportBootRun = __esm({
463026
+ "build-src/src/sema/rules/ccImportBootRun.ts"() {
463027
+ init_persistedRulesWire2();
463028
+ init_transcriptSystemNotice();
463029
+ init_ccImportMarker();
463030
+ attempted = !1;
463031
+ pendingNotice = null;
463032
+ }
463033
+ });
463034
+
462577
463035
  // build-src/src/hooks/useLogMessages.ts
462578
463036
  function useLogMessages(messages, ignore6 = !1) {
462579
463037
  let teamContext = useAppState((s) => s.teamContext), lastRecordedLengthRef = (0, import_react205.useRef)(0), lastParentUuidRef = (0, import_react205.useRef)(void 0), firstMessageUuidRef = (0, import_react205.useRef)(void 0), callSeqRef = (0, import_react205.useRef)(0);
@@ -472560,7 +473018,7 @@ var import_compiler_runtime255, import_jsx_runtime383, init_ShowInIDEPrompt = __
472560
473018
  });
472561
473019
 
472562
473020
  // build-src/src/components/permissions/FilePermissionDialog/permissionOptions.tsx
472563
- import { homedir as homedir45 } from "os";
473021
+ import { homedir as homedir46 } from "os";
472564
473022
  import { basename as basename56, join as join181, sep as sep39 } from "path";
472565
473023
  function isInClaudeFolder(filePath) {
472566
473024
  let absolutePath = expandPath(filePath), claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`), normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath), normalizedClaudeFolderPath = normalizeCaseForComparison2(claudeFolderPath);
@@ -472568,7 +473026,7 @@ function isInClaudeFolder(filePath) {
472568
473026
  normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + "/");
472569
473027
  }
472570
473028
  function isInGlobalClaudeFolder(filePath) {
472571
- let absolutePath = expandPath(filePath), globalClaudeFolderPath = join181(homedir45(), ".sema"), normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath), normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
473029
+ let absolutePath = expandPath(filePath), globalClaudeFolderPath = join181(homedir46(), ".sema"), normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath), normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
472572
473030
  return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep39.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
472573
473031
  }
472574
473032
  function getFilePermissionOptions({
@@ -481768,41 +482226,6 @@ var import_compiler_runtime284, import_react256, import_jsx_runtime427, init_Thi
481768
482226
  }
481769
482227
  });
481770
482228
 
481771
- // build-src/src/utils/teamDiscovery.ts
481772
- function getTeammateStatuses(teamName) {
481773
- let teamFile = readTeamFile(teamName);
481774
- if (!teamFile)
481775
- return [];
481776
- let hiddenPaneIds = new Set(teamFile.hiddenPaneIds ?? []), statuses = [];
481777
- for (let member of teamFile.members) {
481778
- if (member.name === "team-lead")
481779
- continue;
481780
- let status3 = member.isActive !== !1 ? "running" : "idle";
481781
- statuses.push({
481782
- name: member.name,
481783
- agentId: member.agentId,
481784
- agentType: member.agentType,
481785
- model: member.model,
481786
- prompt: member.prompt,
481787
- status: status3,
481788
- color: member.color,
481789
- tmuxPaneId: member.tmuxPaneId,
481790
- cwd: member.cwd,
481791
- worktreePath: member.worktreePath,
481792
- isHidden: hiddenPaneIds.has(member.tmuxPaneId),
481793
- backendType: member.backendType && isPaneBackend(member.backendType) ? member.backendType : void 0,
481794
- mode: member.mode
481795
- });
481796
- }
481797
- return statuses;
481798
- }
481799
- var init_teamDiscovery = __esm({
481800
- "build-src/src/utils/teamDiscovery.ts"() {
481801
- init_types18();
481802
- init_teamHelpers();
481803
- }
481804
- });
481805
-
481806
482229
  // build-src/src/components/teams/TeamsDialog.tsx
481807
482230
  import { randomUUID as randomUUID43 } from "crypto";
481808
482231
  function TeamsDialog({
@@ -488525,7 +488948,7 @@ var SESSION_SCAN_INTERVAL_MS, DEFAULTS, runner, init_autoDream = __esm({
488525
488948
 
488526
488949
  // build-src/src/utils/cleanup.ts
488527
488950
  import * as fs14 from "fs/promises";
488528
- import { homedir as homedir46 } from "os";
488951
+ import { homedir as homedir47 } from "os";
488529
488952
  import { join as join183 } from "path";
488530
488953
  function getCleanupPeriodDays() {
488531
488954
  return (getSettings_DEPRECATED() || {}).cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
@@ -488840,7 +489263,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
488840
489263
  return;
488841
489264
  }
488842
489265
  logForDebugging("npm cache cleanup: starting");
488843
- let npmCachePath = join183(homedir46(), ".npm", "_cacache"), NPM_CACHE_RETENTION_COUNT = 5, startTime = Date.now();
489266
+ let npmCachePath = join183(homedir47(), ".npm", "_cacache"), NPM_CACHE_RETENTION_COUNT = 5, startTime = Date.now();
488844
489267
  try {
488845
489268
  let cacache = await import("cacache"), cutoff = startTime - ONE_DAY_MS2, stream5 = cacache.ls.stream(npmCachePath), anthropicEntries = [];
488846
489269
  for await (let entry of stream5)
@@ -491203,8 +491626,8 @@ function processQueueIfReady({
491203
491626
  let cmd = dequeue(isMainThread);
491204
491627
  return executeInput([cmd]), { processed: !0 };
491205
491628
  }
491206
- let targetMode = next.mode, commands = dequeueAllMatching(
491207
- (cmd) => isMainThread(cmd) && !isSlashCommand(cmd) && cmd.mode === targetMode
491629
+ let targetMode = next.mode, targetInjected = next.isMeta === !0, commands = dequeueAllMatching(
491630
+ (cmd) => isMainThread(cmd) && !isSlashCommand(cmd) && cmd.mode === targetMode && cmd.isMeta === !0 === targetInjected
491208
491631
  );
491209
491632
  return commands.length === 0 ? { processed: !1 } : (executeInput(commands), { processed: !0 });
491210
491633
  }
@@ -493102,6 +493525,52 @@ var import_react295, INBOX_POLL_INTERVAL_MS, init_useInboxPoller = __esm({
493102
493525
  }
493103
493526
  });
493104
493527
 
493528
+ // build-src/src/sema/planReviewModeExit.ts
493529
+ function isPlanReviewQuestionId(questionId) {
493530
+ return typeof questionId == "string" && questionId.startsWith(PLAN_REVIEW_QUESTION_ID_PREFIX);
493531
+ }
493532
+ function shouldExitPlanModeForAnswer(questionId, answer) {
493533
+ return isPlanReviewQuestionId(questionId) ? planReviewDecisionFromAnswer(answer) === "approve" : !1;
493534
+ }
493535
+ function reevaluateRestoreMode(ctx) {
493536
+ let wanted = ctx.prePlanMode ?? "default";
493537
+ if (wanted !== "auto" && wanted !== "bypassPermissions") return wanted;
493538
+ try {
493539
+ return wanted === "auto" ? isAutoModeGateEnabled() ? "auto" : "default" : ctx.isBypassPermissionsModeAvailable === !1 || isBypassPermissionsModeDisabled() ? "default" : "bypassPermissions";
493540
+ } catch (e) {
493541
+ return process.env.SEMA_DEBUG && console.error(
493542
+ `[sema][planReviewModeExit] ${wanted} availability probe threw \u2014 falling back to default (fail-closed): ${String(e)}`
493543
+ ), "default";
493544
+ }
493545
+ }
493546
+ function applyPlanModeExit(prev) {
493547
+ let ctx = prev.toolPermissionContext;
493548
+ if (ctx.mode !== "plan") return prev;
493549
+ let restoreMode = reevaluateRestoreMode(ctx), nextCtx;
493550
+ try {
493551
+ nextCtx = transitionPermissionMode("plan", restoreMode, ctx);
493552
+ } catch (e) {
493553
+ return process.env.SEMA_DEBUG && console.error(`[sema][planReviewModeExit] transition to ${restoreMode} threw: ${String(e)}`), { ...prev, toolPermissionContext: { ...ctx, mode: "default", prePlanMode: void 0 } };
493554
+ }
493555
+ return {
493556
+ ...prev,
493557
+ toolPermissionContext: { ...nextCtx, mode: restoreMode }
493558
+ };
493559
+ }
493560
+ function exitPlanModeIfApproved(questionId, answer, setAppState) {
493561
+ try {
493562
+ return shouldExitPlanModeForAnswer(questionId, answer) ? (setAppState(applyPlanModeExit), !0) : !1;
493563
+ } catch (e) {
493564
+ return process.env.SEMA_DEBUG && console.error(`[sema][planReviewModeExit] exit failed for ${String(questionId)}: ${String(e)}`), !1;
493565
+ }
493566
+ }
493567
+ var init_planReviewModeExit = __esm({
493568
+ "build-src/src/sema/planReviewModeExit.ts"() {
493569
+ init_dist();
493570
+ init_permissionSetup();
493571
+ }
493572
+ });
493573
+
493105
493574
  // build-src/src/sema/resumePendingReconcile.ts
493106
493575
  var resumePendingReconcile_exports = {};
493107
493576
  __export(resumePendingReconcile_exports, {
@@ -493401,10 +493870,10 @@ async function runQuestionPermissionRequestHooks(frame, getHookToolUseContext) {
493401
493870
  }
493402
493871
  return null;
493403
493872
  }
493404
- function buildQuestionToolUseConfirm(frame, getHookToolUseContext) {
493873
+ function buildQuestionToolUseConfirm(frame, getHookToolUseContext, setAppState) {
493405
493874
  let questionId = frame.questionId, questions = frame.questions ?? [], answerAndRelease = (answer) => {
493406
493875
  respondToQuestion(questionId, answer).then(() => {
493407
- notePlanReviewAnsweredIfDecisive(questionId, answer);
493876
+ notePlanReviewAnsweredIfDecisive(questionId, answer), setAppState && exitPlanModeIfApproved(questionId, answer, setAppState);
493408
493877
  }).catch(() => {
493409
493878
  });
493410
493879
  };
@@ -493439,21 +493908,22 @@ function buildQuestionToolUseConfirm(frame, getHookToolUseContext) {
493439
493908
  }
493440
493909
  function useLiveQuestionOverlay({
493441
493910
  setToolUseConfirmQueue,
493442
- getHookToolUseContext
493911
+ getHookToolUseContext,
493912
+ setAppState
493443
493913
  }) {
493444
493914
  (0, import_react296.useEffect)(() => {
493445
493915
  let completedBeforeDialog = /* @__PURE__ */ new Set(), seenQuestionIds = /* @__PURE__ */ new Set(), alive = !0, unsubscribe = onQuestionFrame((frame) => {
493446
493916
  if (frame.type === "question") {
493447
493917
  if (!frame.questions || frame.questions.length === 0 || seenQuestionIds.has(frame.questionId)) return;
493448
493918
  seenQuestionIds.add(frame.questionId);
493449
- let entry = buildQuestionToolUseConfirm(frame, getHookToolUseContext);
493919
+ let entry = buildQuestionToolUseConfirm(frame, getHookToolUseContext, setAppState);
493450
493920
  (async () => {
493451
493921
  let decision = await runQuestionPermissionRequestHooks(frame, getHookToolUseContext);
493452
493922
  if (!completedBeforeDialog.has(frame.questionId)) {
493453
493923
  if (decision?.behavior === "allow") {
493454
493924
  let updated = decision.updatedInput, wireAnswer = questionAnswersToWire(frame.questions ?? [], updated?.answers, updated?.annotations);
493455
493925
  respondToQuestion(frame.questionId, wireAnswer).then(() => {
493456
- notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer);
493926
+ notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer), setAppState && exitPlanModeIfApproved(frame.questionId, wireAnswer, setAppState);
493457
493927
  }).catch(() => {
493458
493928
  });
493459
493929
  return;
@@ -493487,6 +493957,7 @@ var import_react296, init_useLiveQuestionOverlay = __esm({
493487
493957
  init_messages4();
493488
493958
  init_dist();
493489
493959
  init_armedGateRegistry2();
493960
+ init_planReviewModeExit();
493490
493961
  init_resumePendingReconcile();
493491
493962
  }
493492
493963
  });
@@ -499565,9 +500036,12 @@ function REPL({
499565
500036
  }
499566
500037
  rawSetMessages(next);
499567
500038
  }, []);
499568
- (0, import_react332.useEffect)(() => registerTranscriptSystemNoticeSink((text2) => {
499569
- setMessages((prev) => [...prev, createSystemMessage(text2, "warning")]);
499570
- }), [setMessages]);
500039
+ (0, import_react332.useEffect)(() => {
500040
+ let unregister = registerTranscriptSystemNoticeSink((text2) => {
500041
+ setMessages((prev) => [...prev, createSystemMessage(text2, "warning")]);
500042
+ }), pending2 = drainPendingCcImportBootNotice();
500043
+ return pending2 !== null && setMessages((prev) => [...prev, createSystemMessage(pending2, "info")]), unregister;
500044
+ }, [setMessages]);
499571
500045
  let setUserInputOnProcessing = (0, import_react332.useCallback)((input) => {
499572
500046
  input !== void 0 ? (userInputBaselineRef.current = messagesRef.current.length, userMessagePendingRef.current = !0) : userMessagePendingRef.current = !1, setUserInputOnProcessingRaw(input);
499573
500047
  }, []), {
@@ -500644,7 +501118,7 @@ Error: sandbox required but unavailable: ${reason}
500644
501118
  if (logForDebugging(`onAgentSubmit: task=${task.id} type=${task.type} status=${task.status} engineRow=${isEngineViewRow(task.id)}`), isLocalAgentTask2(task) && isEngineViewRow(task.id)) {
500645
501119
  if (pushSubagentLocalEcho(task.id, input), task.status === "running") {
500646
501120
  let target = parentToolCallIdOf(task.id) || task.id;
500647
- logForDebugging(`onAgentSubmit: steering engine subagent target=${target}`), steerEngineSubagent(target, input).then((outcome) => {
501121
+ logForDebugging(`onAgentSubmit: steering engine subagent target=${target} row=${task.id}`), steerEngineSubagent(target, input, task.id).then((outcome) => {
500648
501122
  logForDebugging(`onAgentSubmit: steer outcome=${JSON.stringify(outcome)}`);
500649
501123
  let steerReason = "reason" in outcome ? outcome.reason : void 0, steerDetail = "detail" in outcome ? outcome.detail : void 0;
500650
501124
  addNotification({
@@ -500965,7 +501439,9 @@ ${fileList}`);
500965
501439
  let getHookToolUseContext = (0, import_react332.useCallback)(() => getToolUseContext(messagesRef.current, [], new AbortController(), mainLoopModel), [getToolUseContext, mainLoopModel]);
500966
501440
  useLiveQuestionOverlay({
500967
501441
  setToolUseConfirmQueue,
500968
- getHookToolUseContext
501442
+ getHookToolUseContext,
501443
+ // #266:plan 卡 approve 后退出壳本地 plan 模式(rc.47 挂账的 app-state seam 只有这一层有)。
501444
+ setAppState
500969
501445
  }), useMailboxBridge({
500970
501446
  isLoading,
500971
501447
  onSubmitMessage: handleIncomingPrompt
@@ -501498,6 +501974,7 @@ var import_compiler_runtime325, React175, import_react332, import_jsx_runtime478
501498
501974
  init_LocalAgentTask();
501499
501975
  init_leaderPermissionBridge();
501500
501976
  init_transcriptSystemNotice();
501977
+ init_ccImportBootRun();
501501
501978
  init_sessionTracing();
501502
501979
  init_useLogMessages();
501503
501980
  init_useReplBridge();
@@ -509625,7 +510102,7 @@ var lastMemoryMessageUuid, initSessionMemoryConfigIfNeeded, hasLoggedGateFailure
509625
510102
 
509626
510103
  // build-src/src/utils/iTermBackup.ts
509627
510104
  import { copyFile as copyFile11, stat as stat50 } from "fs/promises";
509628
- import { homedir as homedir47 } from "os";
510105
+ import { homedir as homedir48 } from "os";
509629
510106
  import { join as join193 } from "path";
509630
510107
  function markITerm2SetupComplete() {
509631
510108
  saveGlobalConfig((current5) => ({
@@ -509642,7 +510119,7 @@ function getIterm2RecoveryInfo() {
509642
510119
  }
509643
510120
  function getITerm2PlistPath() {
509644
510121
  return join193(
509645
- homedir47(),
510122
+ homedir48(),
509646
510123
  "Library",
509647
510124
  "Preferences",
509648
510125
  "com.googlecode.iterm2.plist"
@@ -510081,7 +510558,7 @@ var STDOUT_GUARD_MARKER, installed2, buffer4, originalWrite, init_streamJsonStdo
510081
510558
 
510082
510559
  // build-src/src/sema/config/mcpChannels.ts
510083
510560
  import { readFileSync as readFileSync49 } from "node:fs";
510084
- import { homedir as homedir48 } from "node:os";
510561
+ import { homedir as homedir49 } from "node:os";
510085
510562
  import { join as join194 } from "node:path";
510086
510563
  function mcpTransportOf(config4) {
510087
510564
  let c2 = config4;
@@ -510127,9 +510604,9 @@ function externalEntryToConfig(e) {
510127
510604
  };
510128
510605
  }
510129
510606
  function detectMcpChannels() {
510130
- let out6 = [], ccRoot2 = process.env.SEMA_CC_ROOT || join194(homedir48(), CC_DIR5), merged = {}, settingsServers = readJsoncSafe(join194(ccRoot2, "settings.json"))?.mcpServers;
510607
+ let out6 = [], ccRoot2 = process.env.SEMA_CC_ROOT || join194(homedir49(), CC_DIR5), merged = {}, settingsServers = readJsoncSafe(join194(ccRoot2, "settings.json"))?.mcpServers;
510131
510608
  settingsServers && typeof settingsServers == "object" && Object.assign(merged, settingsServers);
510132
- let globalServers = readJsoncSafe(join194(homedir48(), CC_GLOBAL_FILE2))?.mcpServers;
510609
+ let globalServers = readJsoncSafe(join194(homedir49(), CC_GLOBAL_FILE2))?.mcpServers;
510133
510610
  globalServers && typeof globalServers == "object" && Object.assign(merged, globalServers), Object.keys(merged).length > 0 && out6.push({ channel: "claude-code", label: CC_BRAND, servers: merged });
510134
510611
  for (let [channel, detected] of [
510135
510612
  ["openclaw", detectOpenclawMcp()],
@@ -510215,23 +510692,23 @@ var CC_DIR5, CC_GLOBAL_FILE2, MCP_SCOPE_LABELS, init_mcpChannels = __esm({
510215
510692
  });
510216
510693
 
510217
510694
  // build-src/src/sema/importSources.ts
510218
- import { existsSync as existsSync33, mkdirSync as mkdirSync26, readdirSync as readdirSync12, readFileSync as readFileSync50, writeFileSync as writeFileSync26 } from "node:fs";
510695
+ import { existsSync as existsSync33, mkdirSync as mkdirSync26, readdirSync as readdirSync13, readFileSync as readFileSync50, writeFileSync as writeFileSync26 } from "node:fs";
510219
510696
  import { createHash as createHash29 } from "node:crypto";
510220
- import { homedir as homedir49 } from "node:os";
510697
+ import { homedir as homedir50 } from "node:os";
510221
510698
  import { dirname as dirname89, join as join195, resolve as resolve49, sep as sep42 } from "node:path";
510222
510699
  function toSafeName(raw2) {
510223
510700
  return raw2.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "item";
510224
510701
  }
510225
510702
  function safeReaddirFiles(dir, ext) {
510226
510703
  try {
510227
- return readdirSync12(dir, { withFileTypes: !0 }).filter((e) => e.isFile() && e.name.endsWith(ext)).map((e) => e.name);
510704
+ return readdirSync13(dir, { withFileTypes: !0 }).filter((e) => e.isFile() && e.name.endsWith(ext)).map((e) => e.name);
510228
510705
  } catch {
510229
510706
  return [];
510230
510707
  }
510231
510708
  }
510232
510709
  function hasNamespacedSubdirs(dir) {
510233
510710
  try {
510234
- return readdirSync12(dir, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => e.name);
510711
+ return readdirSync13(dir, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => e.name);
510235
510712
  } catch {
510236
510713
  return [];
510237
510714
  }
@@ -510411,7 +510888,7 @@ function hasShellExecMarker(body) {
510411
510888
  return /!\{[^}]+\}/.test(body) || /!`[^`]*`/.test(body);
510412
510889
  }
510413
510890
  function codexRoot() {
510414
- return process.env.SEMA_CODEX_ROOT || join195(homedir49(), ".codex");
510891
+ return process.env.SEMA_CODEX_ROOT || join195(homedir50(), ".codex");
510415
510892
  }
510416
510893
  function codexDetect() {
510417
510894
  let root2 = codexRoot();
@@ -510486,7 +510963,7 @@ async function codexScan() {
510486
510963
  return { items, unmappable };
510487
510964
  }
510488
510965
  function geminiRoot() {
510489
- return process.env.SEMA_GEMINI_ROOT || join195(homedir49(), ".gemini");
510966
+ return process.env.SEMA_GEMINI_ROOT || join195(homedir50(), ".gemini");
510490
510967
  }
510491
510968
  function geminiDetect() {
510492
510969
  let root2 = geminiRoot();
@@ -510599,7 +511076,7 @@ async function geminiScan() {
510599
511076
  return { items, unmappable };
510600
511077
  }
510601
511078
  function claudeRoot() {
510602
- return process.env.SEMA_CC_ROOT || join195(homedir49(), SEMA_SOURCE_DIR);
511079
+ return process.env.SEMA_CC_ROOT || join195(homedir50(), SEMA_SOURCE_DIR);
510603
511080
  }
510604
511081
  function claudeDetect() {
510605
511082
  let root2 = claudeRoot();
@@ -510722,7 +511199,7 @@ __export(cmd_import_exports, {
510722
511199
  default: () => cmd_import_default,
510723
511200
  runImportNonInteractive: () => runImportNonInteractive
510724
511201
  });
510725
- function plural4(n2, word) {
511202
+ function plural5(n2, word) {
510726
511203
  return n2 === 1 ? word : `${word}s`;
510727
511204
  }
510728
511205
  function allItems(scans) {
@@ -510733,13 +511210,13 @@ function allUnmappable(scans) {
510733
511210
  }
510734
511211
  function formatPreview(scans, from, digest, warnings) {
510735
511212
  let items = allItems(scans), unmappable = allUnmappable(scans), sourceNames = scans.map((s) => s.displayName).join(" and "), lines = [
510736
- `Found ${items.length} importable ${plural4(items.length, "item")} from ${sourceNames} (scan digest: ${digest}).`,
511213
+ `Found ${items.length} importable ${plural5(items.length, "item")} from ${sourceNames} (scan digest: ${digest}).`,
510737
511214
  ...warnings
510738
511215
  ];
510739
511216
  for (let item of items)
510740
511217
  lines.push(` [${item.source}] ${item.label} (${item.kind})`);
510741
511218
  if (unmappable.length > 0) {
510742
- lines.push("", `${unmappable.length} ${plural4(unmappable.length, "item")} could not be mapped automatically:`);
511219
+ lines.push("", `${unmappable.length} ${plural5(unmappable.length, "item")} could not be mapped automatically:`);
510743
511220
  for (let u of unmappable)
510744
511221
  lines.push(` \u26A0 [${u.source}] ${u.label}: ${u.reason}`);
510745
511222
  }
@@ -510759,8 +511236,8 @@ async function applyScans(scans, dryRun, warnings) {
510759
511236
  } catch (e) {
510760
511237
  resultLines.push(` \u2717 ${item.label}: ${e instanceof Error ? e.message : String(e)}`);
510761
511238
  }
510762
- let header = dryRun ? `Dry run \u2014 would import ${imported} ${plural4(imported, "item")}:` : `Imported ${imported} ${plural4(imported, "item")}:`, footer = [...warnings];
510763
- return unmappable.length > 0 && footer.push("", `${unmappable.length} ${plural4(unmappable.length, "item")} could not be mapped automatically \u2014 re-run \`/import\` to review.`), [header, ...resultLines, ...footer].join(`
511239
+ let header = dryRun ? `Dry run \u2014 would import ${imported} ${plural5(imported, "item")}:` : `Imported ${imported} ${plural5(imported, "item")}:`, footer = [...warnings];
511240
+ return unmappable.length > 0 && footer.push("", `${unmappable.length} ${plural5(unmappable.length, "item")} could not be mapped automatically \u2014 re-run \`/import\` to review.`), [header, ...resultLines, ...footer].join(`
510764
511241
  `);
510765
511242
  }
510766
511243
  async function handleImport(argsRaw) {
@@ -510856,6 +511333,10 @@ async function tryPrintLocalCommand(objective, deps2 = {}) {
510856
511333
  let result = await (await (await Promise.resolve().then(() => (init_agents2(), agents_exports2))).default.load()).call();
510857
511334
  return result.type === "text" ? result.value : null;
510858
511335
  }
511336
+ if (name === "team") {
511337
+ let { runTeamCommand: runTeamCommand2 } = await Promise.resolve().then(() => (init_team(), team_exports)), result = await runTeamCommand2(args);
511338
+ return result.type === "text" ? result.value : null;
511339
+ }
510859
511340
  return null;
510860
511341
  }
510861
511342
  var MCP_USAGE, MCP_NONE, MCP_CONTROLS_UNAVAILABLE, MODEL_HELP_TOKENS, init_printLocalCommands = __esm({
@@ -511915,8 +512396,8 @@ function resolveAgentModel(opts = {}) {
511915
512396
  let deps2 = { ...defaultDeps, ...opts.deps }, env5 = opts.env ?? process.env, envRaw = normalize19(env5.SEMA_SUBAGENT_MODEL) ?? normalize19(env5.SEMA_CODE_SUBAGENT_MODEL);
511916
512397
  if (envRaw && envRaw.toLowerCase() !== "inherit")
511917
512398
  return resolveWord(envRaw, "env", deps2);
511918
- let call77 = normalize19(opts.callParam);
511919
- if (call77) return resolveWord(call77, "call", deps2);
512399
+ let call78 = normalize19(opts.callParam);
512400
+ if (call78) return resolveWord(call78, "call", deps2);
511920
512401
  let fm = normalize19(opts.frontmatterModel);
511921
512402
  return fm ? resolveWord(fm, "frontmatter", deps2) : { model: "inherit", source: "main", kind: "inherit" };
511922
512403
  }
@@ -517266,7 +517747,7 @@ __export(claudeDesktop_exports, {
517266
517747
  readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers
517267
517748
  });
517268
517749
  import { readdir as readdir33, readFile as readFile58, stat as stat52 } from "fs/promises";
517269
- import { homedir as homedir50 } from "os";
517750
+ import { homedir as homedir51 } from "os";
517270
517751
  import { join as join198 } from "path";
517271
517752
  async function getClaudeDesktopConfigPath() {
517272
517753
  let platform4 = getPlatform();
@@ -517276,7 +517757,7 @@ async function getClaudeDesktopConfigPath() {
517276
517757
  );
517277
517758
  if (platform4 === "macos")
517278
517759
  return join198(
517279
- homedir50(),
517760
+ homedir51(),
517280
517761
  "Library",
517281
517762
  "Application Support",
517282
517763
  "Claude",
@@ -517761,18 +518242,18 @@ __export(adoptionGuard_exports, {
517761
518242
  countLocalSessionArtifacts: () => countLocalSessionArtifacts,
517762
518243
  remoteSwitchSessionNotice: () => remoteSwitchSessionNotice
517763
518244
  });
517764
- import { readdirSync as readdirSync13, existsSync as existsSync34 } from "node:fs";
518245
+ import { readdirSync as readdirSync14, existsSync as existsSync34 } from "node:fs";
517765
518246
  import { join as join199 } from "node:path";
517766
518247
  function countLocalSessionArtifacts() {
517767
518248
  let census = { projects: 0, sessions: 0 };
517768
518249
  try {
517769
518250
  let root2 = getProjectsDir();
517770
518251
  if (!existsSync34(root2)) return census;
517771
- for (let entry of readdirSync13(root2, { withFileTypes: !0 })) {
518252
+ for (let entry of readdirSync14(root2, { withFileTypes: !0 })) {
517772
518253
  if (!entry.isDirectory()) continue;
517773
518254
  let n2 = 0;
517774
518255
  try {
517775
- n2 = readdirSync13(join199(root2, entry.name)).filter((f) => f.endsWith(".jsonl")).length;
518256
+ n2 = readdirSync14(join199(root2, entry.name)).filter((f) => f.endsWith(".jsonl")).length;
517776
518257
  } catch {
517777
518258
  continue;
517778
518259
  }
@@ -519671,7 +520152,7 @@ __export(cloudResources_exports, {
519671
520152
  cloudResourceSync: () => cloudResourceSync
519672
520153
  });
519673
520154
  import { createHash as createHash30 } from "node:crypto";
519674
- import { existsSync as existsSync36, readdirSync as readdirSync14, readFileSync as readFileSync54, statSync as statSync16 } from "node:fs";
520155
+ import { existsSync as existsSync36, readdirSync as readdirSync15, readFileSync as readFileSync54, statSync as statSync16 } from "node:fs";
519675
520156
  import { basename as basename69, dirname as dirname91, isAbsolute as isAbsolute34, join as join202, resolve as resolve50 } from "node:path";
519676
520157
  import { getEffective as getEffective2, getMeConfig, getScopeConfigDraft as getScopeConfigDraft2, OAuthFlowError as OAuthFlowError3, RegistryApiError as RegistryApiError3 } from "@sema-agent/sdk/registry";
519677
520158
  function fail4(e) {
@@ -520170,7 +520651,7 @@ async function loadLocalSkillEntries() {
520170
520651
  for (let root2 of roots) {
520171
520652
  let dirs = [];
520172
520653
  try {
520173
- dirs = readdirSync14(root2).filter((d4) => {
520654
+ dirs = readdirSync15(root2).filter((d4) => {
520174
520655
  try {
520175
520656
  return statSync16(join202(root2, d4)).isDirectory() && existsSync36(join202(root2, d4, "SKILL.md"));
520176
520657
  } catch {
@@ -524576,9 +525057,9 @@ var install_exports = {};
524576
525057
  __export(install_exports, {
524577
525058
  install: () => install
524578
525059
  });
524579
- import { homedir as homedir51 } from "node:os";
525060
+ import { homedir as homedir52 } from "node:os";
524580
525061
  function getInstallationPath2(realPath) {
524581
- let isWindows2 = env2.platform === "win32", homeDir = homedir51();
525062
+ let isWindows2 = env2.platform === "win32", homeDir = homedir52();
524582
525063
  return isWindows2 ? realPath.replace(/\//g, "\\") : realPath.startsWith(homeDir) ? `~${realPath.slice(homeDir.length)}` : realPath;
524583
525064
  }
524584
525065
  function SetupNotes(t0) {
@@ -525304,18 +525785,18 @@ var configSync_exports = {};
525304
525785
  __export(configSync_exports, {
525305
525786
  configSyncHandler: () => configSyncHandler
525306
525787
  });
525307
- import { homedir as homedir52 } from "node:os";
525788
+ import { homedir as homedir53 } from "node:os";
525308
525789
  import {
525309
525790
  copyFileSync as copyFileSync8,
525310
525791
  existsSync as existsSync38,
525311
525792
  mkdirSync as mkdirSync28,
525312
- readdirSync as readdirSync15,
525793
+ readdirSync as readdirSync16,
525313
525794
  readFileSync as readFileSync55,
525314
525795
  statSync as statSync18
525315
525796
  } from "node:fs";
525316
525797
  import { dirname as dirname95, join as join207, relative as relative37 } from "node:path";
525317
525798
  function display(p) {
525318
- let home = homedir52();
525799
+ let home = homedir53();
525319
525800
  return p.startsWith(home) ? "~" + p.slice(home.length) : p;
525320
525801
  }
525321
525802
  function filesEqual(a, b3) {
@@ -525430,7 +525911,7 @@ function syncTree(srcDir, destDir, labelBase, opts, report) {
525430
525911
  syncPlainFile(srcDir, destDir, labelBase, opts, report);
525431
525912
  return;
525432
525913
  }
525433
- for (let name of readdirSync15(srcDir)) {
525914
+ for (let name of readdirSync16(srcDir)) {
525434
525915
  let srcChild = join207(srcDir, name), destChild = join207(destDir, name), childStat;
525435
525916
  try {
525436
525917
  childStat = statSync18(srcChild);
@@ -525510,7 +525991,7 @@ async function configSyncHandler(opts) {
525510
525991
  }, dryTag = opts.dryRun ? source_default.yellow(" [dry-run]") : "";
525511
525992
  process.stdout.write(source_default.bold(`sema config sync${dryTag}
525512
525993
  `));
525513
- let userSrc = join207(homedir52(), LEGACY_DIR3), userDest = getClaudeConfigHomeDir();
525994
+ let userSrc = join207(homedir53(), LEGACY_DIR3), userDest = getClaudeConfigHomeDir();
525514
525995
  process.stdout.write(
525515
525996
  source_default.bold(`
525516
525997
  user: ${display(userSrc)} \u2192 ${display(userDest)}
@@ -525529,7 +526010,7 @@ user: ${display(userSrc)} \u2192 ${display(userDest)}
525529
526010
  opts,
525530
526011
  report
525531
526012
  );
525532
- let globalSrc = join207(homedir52(), LEGACY_GLOBAL_FILE), globalDest = getGlobalClaudeFile();
526013
+ let globalSrc = join207(homedir53(), LEGACY_GLOBAL_FILE), globalDest = getGlobalClaudeFile();
525533
526014
  if (existsSync38(globalSrc) && globalSrc !== globalDest && syncJsonFile(globalSrc, globalDest, display(globalDest), opts, report), flushEntries(report, userStart, opts), opts.project) {
525534
526015
  let projSrc = join207(process.cwd(), LEGACY_DIR3), projDest = join207(process.cwd(), ".sema");
525535
526016
  process.stdout.write(
@@ -525625,7 +526106,7 @@ __export(importCredentials_exports, {
525625
526106
  });
525626
526107
  import { execFileSync as execFileSync7 } from "node:child_process";
525627
526108
  import { readFileSync as readFileSync56 } from "node:fs";
525628
- import { homedir as homedir53, userInfo as userInfo4 } from "node:os";
526109
+ import { homedir as homedir54, userInfo as userInfo4 } from "node:os";
525629
526110
  import { join as join208 } from "node:path";
525630
526111
  function readCcKeychain() {
525631
526112
  if (process.platform !== "darwin") return null;
@@ -525648,7 +526129,7 @@ function readCcFile(ccRoot2) {
525648
526129
  }
525649
526130
  }
525650
526131
  async function importCredentialsHandler(opts) {
525651
- let ccRoot2 = opts.from ?? join208(homedir53(), LEGACY_DIR4), fromKeychain = readCcKeychain(), fromFile = readCcFile(ccRoot2);
526132
+ let ccRoot2 = opts.from ?? join208(homedir54(), LEGACY_DIR4), fromKeychain = readCcKeychain(), fromFile = readCcFile(ccRoot2);
525652
526133
  if (!fromKeychain && !fromFile) {
525653
526134
  console.log(`No ${SOURCE_BRAND2} credentials found (checked keychain and ${ccRoot2}/.credentials.json).`), process.exitCode = 1;
525654
526135
  return;
@@ -527643,7 +528124,7 @@ var React192, import_jsx_runtime504, init_navStack = __esm({
527643
528124
 
527644
528125
  // build-src/src/sema/config/PluginsHub.tsx
527645
528126
  import { readFileSync as readFileSync57 } from "node:fs";
527646
- import { homedir as homedir54 } from "node:os";
528127
+ import { homedir as homedir55 } from "node:os";
527647
528128
  import { join as join209 } from "node:path";
527648
528129
  function listInstalledPluginRows() {
527649
528130
  let plugins = {};
@@ -527677,7 +528158,7 @@ function readJsonSafe(path28) {
527677
528158
  }
527678
528159
  }
527679
528160
  function detectCcPlugins() {
527680
- let ccRoot2 = process.env.SEMA_CC_ROOT || join209(homedir54(), CC_DIR6), byId = /* @__PURE__ */ new Map(), pluginsField = readJsonSafe(join209(ccRoot2, "plugins", "installed_plugins.json"))?.plugins;
528161
+ let ccRoot2 = process.env.SEMA_CC_ROOT || join209(homedir55(), CC_DIR6), byId = /* @__PURE__ */ new Map(), pluginsField = readJsonSafe(join209(ccRoot2, "plugins", "installed_plugins.json"))?.plugins;
527681
528162
  if (pluginsField && typeof pluginsField == "object")
527682
528163
  for (let [id, v2] of Object.entries(pluginsField)) {
527683
528164
  let entry = Array.isArray(v2) ? v2[0] : v2;
@@ -528312,7 +528793,7 @@ var React194, import_jsx_runtime506, lastTierEditError, init_TiersHub = __esm({
528312
528793
  });
528313
528794
 
528314
528795
  // build-src/src/sema/config/skillsChannels.ts
528315
- import { existsSync as existsSync39, mkdirSync as mkdirSync29, readdirSync as readdirSync16, readFileSync as readFileSync58, realpathSync as realpathSync15, renameSync as renameSync17, statSync as statSync19 } from "node:fs";
528796
+ import { existsSync as existsSync39, mkdirSync as mkdirSync29, readdirSync as readdirSync17, readFileSync as readFileSync58, realpathSync as realpathSync15, renameSync as renameSync17, statSync as statSync19 } from "node:fs";
528316
528797
  import { basename as basename72, dirname as dirname96, join as join210 } from "node:path";
528317
528798
  function skillsDirFor(source) {
528318
528799
  return source === "user" ? join210(getClaudeConfigHomeDir(), "skills") : join210(getCwd(), ".sema", "skills");
@@ -528359,7 +528840,7 @@ function listInstalledSkills() {
528359
528840
  for (let source of sources) {
528360
528841
  let dir = skillsDirFor(source), entries;
528361
528842
  try {
528362
- entries = readdirSync16(dir).filter((n2) => !n2.startsWith("."));
528843
+ entries = readdirSync17(dir).filter((n2) => !n2.startsWith("."));
528363
528844
  } catch {
528364
528845
  continue;
528365
528846
  }
@@ -529221,7 +529702,7 @@ function OnboardWizardBody({
529221
529702
  {
529222
529703
  layers: detected.layers,
529223
529704
  onDone: (summary) => {
529224
- summary !== null && flow.summary.push(summary), advance(i, nav);
529705
+ summary !== null ? flow.summary.push(summary) : writeCcImportDeclinedMarker(), advance(i, nav);
529225
529706
  }
529226
529707
  }
529227
529708
  )
@@ -530659,7 +531140,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
530659
531140
  pendingHookMessages
530660
531141
  }, renderAndRun);
530661
531142
  }
530662
- }).version("sema 1.0.80", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
531143
+ }).version("sema 1.0.82", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
530663
531144
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
530664
531145
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
530665
531146
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -530667,7 +531148,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
530667
531148
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).attachHandler(id, []), process.exit(process.exitCode ?? 0);
530668
531149
  }), program2.command("kill [id]").description("Terminate a background session").action(async (id) => {
530669
531150
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).killHandler(id, []), process.exit(process.exitCode ?? 0);
530670
- }), program2.addOption(new Option("--brief", "Enable SendUserMessage tool for agent-to-user communication")), program2.addOption(new Option("--ax-screen-reader", "Render screen-reader friendly output (flat text, no decorative borders or animations).")), program2.addOption(new Option("--enable-auto-mode", "Opt in to auto mode").hideHelp()), program2.addOption(new Option("--agent-id <id>", "Teammate agent ID").hideHelp()), program2.addOption(new Option("--agent-name <name>", "Teammate display name").hideHelp()), program2.addOption(new Option("--team-name <name>", "Team name for swarm coordination").hideHelp()), program2.addOption(new Option("--agent-color <color>", "Teammate UI color").hideHelp()), program2.addOption(new Option("--plan-mode-required", "Require plan mode before implementation").hideHelp()), program2.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp()), program2.addOption(new Option("--teammate-mode <mode>", 'How to spawn teammates: "tmux", "iterm2", "in-process", or "auto"').choices(["auto", "tmux", "iterm2", "in-process"]).hideHelp()), program2.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp()), program2.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()), program2.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp()), program2.addOption(new Option("--cloud [description|session_id|url]", "Create a cloud session with the given description, or attach to an existing one by session ID or claude.ai/code URL").hideHelp()), program2.addOption(new Option("--remote [description|session_id|url]", "Deprecated alias for --cloud").hideHelp()), program2.addOption(new Option("--remote-control [name]", "Start an interactive session with Remote Control enabled (optionally named)").argParser((value) => value || !0)), program2.addOption(new Option("--rc [name]", "Alias for --remote-control").argParser((value) => value || !0).hideHelp()), program2.option("--remote-control-session-name-prefix <prefix>", "Prefix for auto-generated Remote Control session names (default: hostname)"), profileCheckpoint("run_main_options_built");
531151
+ }), program2.addOption(new Option("--brief", "Enable SendUserMessage tool for agent-to-user communication")), program2.addOption(new Option("--ax-screen-reader", "Render screen-reader friendly output (flat text, no decorative borders or animations).")), program2.option("--agent-teams", "Enable agent teams: named persistent teammates with a shared task list (experimental, off by default)", () => !0), program2.addOption(new Option("--enable-auto-mode", "Opt in to auto mode").hideHelp()), program2.addOption(new Option("--agent-id <id>", "Teammate agent ID").hideHelp()), program2.addOption(new Option("--agent-name <name>", "Teammate display name").hideHelp()), program2.addOption(new Option("--team-name <name>", "Team name for swarm coordination").hideHelp()), program2.addOption(new Option("--agent-color <color>", "Teammate UI color").hideHelp()), program2.addOption(new Option("--plan-mode-required", "Require plan mode before implementation").hideHelp()), program2.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp()), program2.addOption(new Option("--teammate-mode <mode>", 'How to spawn teammates: "tmux", "iterm2", "in-process", or "auto"').choices(["auto", "tmux", "iterm2", "in-process"]).hideHelp()), program2.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp()), program2.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()), program2.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp()), program2.addOption(new Option("--cloud [description|session_id|url]", "Create a cloud session with the given description, or attach to an existing one by session ID or claude.ai/code URL").hideHelp()), program2.addOption(new Option("--remote [description|session_id|url]", "Deprecated alias for --cloud").hideHelp()), program2.addOption(new Option("--remote-control [name]", "Start an interactive session with Remote Control enabled (optionally named)").argParser((value) => value || !0)), program2.addOption(new Option("--rc [name]", "Alias for --remote-control").argParser((value) => value || !0).hideHelp()), program2.option("--remote-control-session-name-prefix <prefix>", "Prefix for auto-generated Remote Control session names (default: hostname)"), profileCheckpoint("run_main_options_built");
530671
531152
  let isPrintMode = process.argv.includes("-p") || process.argv.includes("--print"), isCcUrl = process.argv.some((a) => a.startsWith("cc://") || a.startsWith("cc+unix://"));
530672
531153
  if (isPrintMode && !isCcUrl)
530673
531154
  return profileCheckpoint("run_before_parse"), await program2.parseAsync(process.argv), profileCheckpoint("run_after_parse"), program2;
@@ -531178,7 +531659,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
531178
531659
  let after = installedVersion2();
531179
531660
  console.log(`sema ${cur ?? "unknown"} \u2192 ${after ?? "unknown"}${cur === after ? " (forced reinstall, same version)" : ""}`);
531180
531661
  let { finalizeEngineSwapAfterUpdate: finalizeEngineSwapAfterUpdate2 } = await Promise.resolve().then(() => (init_semaUpdater(), semaUpdater_exports));
531181
- await finalizeEngineSwapAfterUpdate2(after ?? latest), process.exit(0);
531662
+ await finalizeEngineSwapAfterUpdate2(after ?? latest), console.log("Run 'sema doctor' to verify your configuration on the new version."), process.exit(0);
531182
531663
  }
531183
531664
  }
531184
531665
  let {
@@ -532272,7 +532753,7 @@ var TrustDialog_exports = {};
532272
532753
  __export(TrustDialog_exports, {
532273
532754
  TrustDialog: () => TrustDialog
532274
532755
  });
532275
- import { homedir as homedir55 } from "os";
532756
+ import { homedir as homedir56 } from "os";
532276
532757
  function TrustDialog(t0) {
532277
532758
  let $3 = (0, import_compiler_runtime350.c)(33), {
532278
532759
  onDone,
@@ -532303,7 +532784,7 @@ function TrustDialog(t0) {
532303
532784
  $3[11] !== commands ? (t11 = commands?.some(_temp437) ?? !1, $3[11] = commands, $3[12] = t11) : t11 = $3[12];
532304
532785
  let hasSkillsBash = t11, hasAnyBashExecution = bashSettingSources.length > 0 || hasSlashCommandBash || hasSkillsBash, hasTrustDialogAccepted = checkHasTrustDialogAccepted(), t12, t13;
532305
532786
  $3[13] !== hasAnyBashExecution ? (t12 = () => {
532306
- let isHomeDir = homedir55() === getCwd();
532787
+ let isHomeDir = homedir56() === getCwd();
532307
532788
  }, t13 = [hasMcpServers, hasHooks2, hasAnyBashExecution, hasApiKeyHelper2, hasAwsCommands2, hasGcpCommands2, hasOtelHeadersHelper2, hasDangerousEnvVars2], $3[13] = hasAnyBashExecution, $3[14] = t12, $3[15] = t13) : (t12 = $3[14], t13 = $3[15]), import_react350.default.useEffect(t12, t13);
532308
532789
  let t14;
532309
532790
  $3[16] !== hasAnyBashExecution || $3[17] !== onDone ? (t14 = function(value) {
@@ -532311,7 +532792,7 @@ function TrustDialog(t0) {
532311
532792
  gracefulShutdownSync(1);
532312
532793
  return;
532313
532794
  }
532314
- let isHomeDir_0 = homedir55() === getCwd();
532795
+ let isHomeDir_0 = homedir56() === getCwd();
532315
532796
  isHomeDir_0 ? setSessionTrustAccepted(!0) : saveCurrentProjectConfig(_temp523), onDone();
532316
532797
  }, $3[16] = hasAnyBashExecution, $3[17] = onDone, $3[18] = t14) : t14 = $3[18];
532317
532798
  let onChange = t14, exitState = useExitOnCtrlCDWithKeybindings(_temp619), t15;
@@ -533256,13 +533737,13 @@ __export(claudeImportHint_exports, {
533256
533737
  maybeEmitClaudeImportHint: () => maybeEmitClaudeImportHint
533257
533738
  });
533258
533739
  import { existsSync as existsSync40 } from "node:fs";
533259
- import { homedir as homedir56 } from "node:os";
533740
+ import { homedir as homedir57 } from "node:os";
533260
533741
  import { join as join212 } from "node:path";
533261
533742
  function shouldShowClaudeImportHint() {
533262
533743
  try {
533263
533744
  if (process.env.SEMA_CONFIG_DIR || process.env["CLAUDE_CONFIG_DIR"]) return !1;
533264
- let legacyDir = join212(homedir56(), ".claude");
533265
- return !(!existsSync40(legacyDir) || existsSync40(join212(homedir56(), ".sema")) || getGlobalConfig().hasSeenClaudeImportHint);
533745
+ let legacyDir = join212(homedir57(), ".claude");
533746
+ return !(!existsSync40(legacyDir) || existsSync40(join212(homedir57(), ".sema")) || getGlobalConfig().hasSeenClaudeImportHint);
533266
533747
  } catch {
533267
533748
  return !1;
533268
533749
  }
@@ -533656,7 +534137,7 @@ var init_schedulerDaemonWire = __esm({
533656
534137
  });
533657
534138
 
533658
534139
  // build-src/src/sema/scheduler/sessionReap.ts
533659
- import { mkdirSync as mkdirSync32, readdirSync as readdirSync17, readFileSync as readFileSync63, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "node:fs";
534140
+ import { mkdirSync as mkdirSync32, readdirSync as readdirSync18, readFileSync as readFileSync63, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "node:fs";
533660
534141
  import { dirname as dirname99, join as join215 } from "node:path";
533661
534142
  function isSessionLifetimeRecord(r) {
533662
534143
  return r.lifetime === "session";
@@ -533710,7 +534191,7 @@ function removeSchedulerClaim(storePath, pid = process.pid) {
533710
534191
  function readAliveClaimedSessionIds(storePath, opts = {}) {
533711
534192
  let alive = opts.isPidAlive ?? pidAlive3, dir = schedulerClaimsDir(storePath), out6 = /* @__PURE__ */ new Set(), files2;
533712
534193
  try {
533713
- files2 = readdirSync17(dir);
534194
+ files2 = readdirSync18(dir);
533714
534195
  } catch {
533715
534196
  return out6;
533716
534197
  }
@@ -534194,11 +534675,11 @@ var init_skillsFill = __esm({
534194
534675
  });
534195
534676
 
534196
534677
  // build-src/src/sema/teamOnboarding.ts
534197
- import { existsSync as existsSync42, readdirSync as readdirSync18 } from "fs";
534678
+ import { existsSync as existsSync42, readdirSync as readdirSync19 } from "fs";
534198
534679
  function hasWorkspaceData() {
534199
534680
  try {
534200
534681
  let dir = getProjectsDir2();
534201
- return existsSync42(dir) ? readdirSync18(dir).length > 0 : !1;
534682
+ return existsSync42(dir) ? readdirSync19(dir).length > 0 : !1;
534202
534683
  } catch {
534203
534684
  return !1;
534204
534685
  }
@@ -535283,7 +535764,7 @@ __export(mcpFill_exports, {
535283
535764
  default: () => mcpFill_default,
535284
535765
  loadCanonicalMcpClients: () => loadCanonicalMcpClients
535285
535766
  });
535286
- import { homedir as homedir57 } from "os";
535767
+ import { homedir as homedir58 } from "os";
535287
535768
  import { readFileSync as readFileSync64 } from "fs";
535288
535769
  function builtinDynamicConfig(command8) {
535289
535770
  return { type: "stdio", command: command8, args: [], scope: "dynamic" };
@@ -535296,7 +535777,7 @@ function builtinDynamicClients() {
535296
535777
  }));
535297
535778
  }
535298
535779
  function canonicalGlobalConfigFile() {
535299
- return `${process.env.HOME ?? process.env.USERPROFILE ?? homedir57()}/.claude.json`;
535780
+ return `${process.env.HOME ?? process.env.USERPROFILE ?? homedir58()}/.claude.json`;
535300
535781
  }
535301
535782
  async function loadCanonicalMcpClients() {
535302
535783
  try {
@@ -537940,7 +538421,7 @@ async function launchReplProduction() {
537940
538421
  let offlineFallback = process.env.SEMA_LIVE_BASEURL ? "unknown" : "opus[1m]";
537941
538422
  initialState.mainLoopModel = resolved ?? offlineFallback;
537942
538423
  }
537943
- let bypassModeLaunch = !1, settingsRejectionNotices = [];
538424
+ let bypassModeLaunch = !1, settingsRejectionNotices = [], bootFailClosedNotices = [];
537944
538425
  try {
537945
538426
  let argv = process.argv.slice(2), allowDangerouslySkipPermissions = argv.includes("--dangerously-skip-permissions"), pmIdx = argv.indexOf("--permission-mode"), cliPermissionMode = pmIdx >= 0 ? argv[pmIdx + 1] : void 0, { PERMISSION_MODES: PERMISSION_MODES3 } = await Promise.resolve().then(() => (init_PermissionMode(), PermissionMode_exports)), launchMode = ((m2) => !!m2 && PERMISSION_MODES3.includes(m2))(cliPermissionMode) ? cliPermissionMode : allowDangerouslySkipPermissions ? "bypassPermissions" : void 0, settingsDisableBypass = !0;
537946
538427
  try {
@@ -537952,15 +538433,16 @@ async function launchReplProduction() {
537952
538433
  () => getInitialSettings2()?.permissions?.disableBypassPermissionsMode,
537953
538434
  () => mdmMod.filterManagedPolicyErrors(getSettingsWithErrors2().errors)
537954
538435
  );
537955
- settingsDisableBypass = verdict.disable, verdict.loudReason && process.stderr.write(
537956
- `[sema] bypassPermissions kept unavailable (fail-closed): ${verdict.loudReason}
537957
- `
537958
- );
538436
+ if (settingsDisableBypass = verdict.disable, verdict.loudReason) {
538437
+ let msg = `bypassPermissions kept unavailable (fail-closed): ${verdict.loudReason}`;
538438
+ process.stderr.write(`[sema] ${msg}
538439
+ `), bootFailClosedNotices.push(msg);
538440
+ }
537959
538441
  } catch (e) {
537960
- settingsDisableBypass = !0, process.stderr.write(
537961
- `[sema] settings read failed \u2014 bypassPermissions kept unavailable (fail-closed): ${e instanceof Error ? e.message : String(e)}
537962
- `
537963
- );
538442
+ settingsDisableBypass = !0;
538443
+ let msg = `settings read failed \u2014 bypassPermissions kept unavailable (fail-closed): ${e instanceof Error ? e.message : String(e)}`;
538444
+ process.stderr.write(`[sema] ${msg}
538445
+ `), bootFailClosedNotices.push(msg);
537964
538446
  }
537965
538447
  let isBypassPermissionsModeAvailable = (launchMode === "bypassPermissions" || allowDangerouslySkipPermissions) && !settingsDisableBypass, tpc = initialState.toolPermissionContext;
537966
538448
  launchMode && (tpc.mode = launchMode), tpc.isBypassPermissionsModeAvailable = isBypassPermissionsModeAvailable, bypassModeLaunch = isBypassPermissionsModeAvailable;
@@ -537976,11 +538458,9 @@ async function launchReplProduction() {
537976
538458
  try {
537977
538459
  let deadRules = unenforceableSettingsRules(fullWire);
537978
538460
  if (deadRules.length > 0) {
537979
- let shown = deadRules.slice(0, 5).map((r) => JSON.stringify(r)).join(", "), more = deadRules.length > 5 ? ` (+${deadRules.length - 5} more)` : "";
537980
- process.stderr.write(
537981
- `[sema] permissions: ${deadRules.length} rule(s) use tool names this engine does not recognize and will not be enforced: ${shown}${more} \u2014 update these entries in your settings permissions lists
537982
- `
537983
- );
538461
+ let shown = deadRules.slice(0, 5).map((r) => JSON.stringify(r)).join(", "), more = deadRules.length > 5 ? ` (+${deadRules.length - 5} more)` : "", msg = `permissions: ${deadRules.length} rule(s) use tool names this engine does not recognize and will not be enforced: ${shown}${more} \u2014 update these entries in your settings permissions lists`;
538462
+ process.stderr.write(`[sema] ${msg}
538463
+ `), bootFailClosedNotices.push(msg);
537984
538464
  }
537985
538465
  } catch {
537986
538466
  }
@@ -538274,15 +538754,25 @@ async function launchReplProduction() {
538274
538754
  }
538275
538755
  let { launchRepl: launchRepl2 } = await Promise.resolve().then(() => (init_replLauncher(), replLauncher_exports)), { createSystemMessage: createSystemMessage3 } = await Promise.resolve().then(() => (init_messages4(), messages_exports2));
538276
538756
  try {
538277
- let { settingsLoudNoticesActive: settingsLoudNoticesActive2 } = await Promise.resolve().then(() => (init_settings2(), settings_exports2)), { resolverLoudNoticesActive: resolverLoudNoticesActive2 } = await Promise.resolve().then(() => (init_resolver2(), resolver_exports));
538757
+ let { settingsLoudNoticesActive: settingsLoudNoticesActive2 } = await Promise.resolve().then(() => (init_settings2(), settings_exports2)), { resolverLoudNoticesActive: resolverLoudNoticesActive2 } = await Promise.resolve().then(() => (init_resolver2(), resolver_exports)), { permissionsLoaderLoudNoticesActive: permissionsLoaderLoudNoticesActive2 } = await Promise.resolve().then(() => (init_permissionsLoader(), permissionsLoader_exports));
538278
538758
  settingsRejectionNotices = [
538279
538759
  ...settingsRejectionNotices,
538280
538760
  ...settingsLoudNoticesActive2(),
538281
- ...resolverLoudNoticesActive2()
538761
+ ...resolverLoudNoticesActive2(),
538762
+ ...bootFailClosedNotices,
538763
+ ...permissionsLoaderLoudNoticesActive2()
538282
538764
  ];
538283
538765
  } catch (eN) {
538284
538766
  process.env.SEMA_DEBUG && console.error("[sema] settings notices merge soft-failed:", eN);
538285
538767
  }
538768
+ try {
538769
+ let { runCcImportBootAuto: runCcImportBootAuto2 } = await Promise.resolve().then(() => (init_ccImportBootRun(), ccImportBootRun_exports));
538770
+ runCcImportBootAuto2().then((outcome) => {
538771
+ process.env.SEMA_DEBUG && console.error(`[sema] cc-import boot arm: ${outcome}`);
538772
+ });
538773
+ } catch (eI) {
538774
+ process.env.SEMA_DEBUG && console.error("[sema] cc-import boot arm load soft-failed:", eI);
538775
+ }
538286
538776
  await launchRepl2(
538287
538777
  root2,
538288
538778
  {