@sema-agent/cli 1.0.81 → 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(
@@ -62391,8 +62398,8 @@ function projectActivity(beats) {
62391
62398
  continue;
62392
62399
  let key = typeof b3.toolCallId == "string" && b3.toolCallId ? b3.toolCallId : `#${anon++}`;
62393
62400
  byCall.has(key) || order2.push(key);
62394
- let prev = byCall.get(key), arg = typeof b3.arg == "string" && b3.arg.trim() ? oneLineSummary(b3.arg.trim()) : prev?.summary, call77 = { name };
62395
- 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 });
62396
62403
  }
62397
62404
  return order2.map((k2) => byCall.get(k2)).filter((c2) => !!c2);
62398
62405
  }
@@ -117296,6 +117303,18 @@ var init_probePlan = __esm({
117296
117303
  }
117297
117304
  });
117298
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
+
117299
117318
  // build-src/src/utils/caCerts.ts
117300
117319
  var caCerts_exports = {};
117301
117320
  __export(caCerts_exports, {
@@ -121100,7 +121119,7 @@ var require_webidl = __commonJS({
121100
121119
  return new TypeError(`${message.header}: ${message.message}`);
121101
121120
  };
121102
121121
  webidl.errors.conversionFailed = function(opts) {
121103
- 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(", ")}.`;
121104
121123
  return webidl.errors.exception({
121105
121124
  header: opts.prefix,
121106
121125
  message
@@ -136156,7 +136175,10 @@ function getTLSFetchOptions() {
136156
136175
  passphrase: tlsConfig.passphrase,
136157
136176
  ...tlsConfig.ca && { ca: tlsConfig.ca }
136158
136177
  },
136159
- pipelining: 1
136178
+ pipelining: 1,
136179
+ // #270:长挂豁免。缺省 300s 会把 plan_review 这类「挂着等人做决定」的请求单方面掐断
136180
+ // (引擎侧记 499),用户观感 = 审批完没反应。取值理由见 dispatcherTimeouts.ts 头注。
136181
+ ...LONG_POLL_DISPATCHER_TIMEOUTS
136160
136182
  }) };
136161
136183
  }
136162
136184
  function clearMTLSCache() {
@@ -136172,6 +136194,7 @@ var getMTLSConfig, getMTLSAgent, init_mtls = __esm({
136172
136194
  init_memoize();
136173
136195
  init_caCerts();
136174
136196
  init_debug();
136197
+ init_dispatcherTimeouts();
136175
136198
  init_fsOperations();
136176
136199
  getMTLSConfig = memoize_default(() => {
136177
136200
  let config4 = {};
@@ -136392,11 +136415,15 @@ var import_https_proxy_agent2, keepAliveDisabled, getProxyAgent, proxyIntercepto
136392
136415
  init_memoize();
136393
136416
  init_caCerts();
136394
136417
  init_debug();
136418
+ init_dispatcherTimeouts();
136395
136419
  init_envUtils();
136396
136420
  init_mtls();
136397
136421
  keepAliveDisabled = !1;
136398
136422
  getProxyAgent = memoize_default((uri) => {
136399
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,
136400
136427
  // Override both HTTP and HTTPS proxy with the provided URI
136401
136428
  httpProxy: uri,
136402
136429
  httpsProxy: uri,
@@ -136479,10 +136506,16 @@ async function injectDispatcher(extra) {
136479
136506
  noProxy: process.env.NO_PROXY || process.env.no_proxy,
136480
136507
  connect: { ca }
136481
136508
  };
136482
- 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));
136483
136510
  return;
136484
136511
  }
136485
- 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
+ );
136486
136519
  }
136487
136520
  async function applyPersistedTlsTrust() {
136488
136521
  try {
@@ -136523,6 +136556,7 @@ async function applySystemTlsTrust() {
136523
136556
  var caPath, builtinRootBodies, init_tlsTrust = __esm({
136524
136557
  "build-src/src/sema/tlsTrust.ts"() {
136525
136558
  init_failOpen();
136559
+ init_dispatcherTimeouts();
136526
136560
  init_envUtils();
136527
136561
  caPath = () => join32(getClaudeConfigHomeDir(), "extra-ca.pem");
136528
136562
  }
@@ -171585,16 +171619,37 @@ var officialUrls, init_officialRegistry = __esm({
171585
171619
  });
171586
171620
 
171587
171621
  // build-src/src/utils/agentSwarmsEnabled.ts
171588
- function isAgentTeamsFlagSet() {
171589
- 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;
171590
171639
  }
171591
171640
  function isAgentSwarmsEnabled() {
171592
- 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
+ );
171593
171646
  }
171594
- var init_agentSwarmsEnabled = __esm({
171647
+ var AGENT_TEAMS_ENV_VAR, AGENT_TEAMS_SETTING_KEY, AGENT_TEAMS_FLAG, settingCache, init_agentSwarmsEnabled = __esm({
171595
171648
  "build-src/src/utils/agentSwarmsEnabled.ts"() {
171596
- init_growthbook_advisor_flag();
171597
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";
171598
171653
  }
171599
171654
  });
171600
171655
 
@@ -182306,10 +182361,10 @@ function lockedTokenProvider(profileName) {
182306
182361
  }), lastIssuedRefreshToken = tokens.refreshToken, foreignRotationObserved = !1;
182307
182362
  },
182308
182363
  async clear() {
182309
- let attempted = lastIssuedRefreshToken, foreign = foreignRotationObserved;
182364
+ let attempted2 = lastIssuedRefreshToken, foreign = foreignRotationObserved;
182310
182365
  await mutateCredentials((creds) => {
182311
182366
  let current5 = creds[profileName];
182312
- if (!current5 || attempted === void 0 || current5.refreshToken !== attempted || foreign) return !1;
182367
+ if (!current5 || attempted2 === void 0 || current5.refreshToken !== attempted2 || foreign) return !1;
182313
182368
  delete creds[profileName];
182314
182369
  });
182315
182370
  }
@@ -189726,14 +189781,22 @@ var PROMPT_PREFIX, init_bashClassifier = __esm({
189726
189781
  // build-src/src/utils/permissions/permissionsLoader.ts
189727
189782
  var permissionsLoader_exports = {};
189728
189783
  __export(permissionsLoader_exports, {
189784
+ _resetPermissionsLoaderNoticesForTest: () => _resetPermissionsLoaderNoticesForTest,
189729
189785
  addPermissionRulesToSettings: () => addPermissionRulesToSettings,
189730
189786
  deletePermissionRuleFromSettings: () => deletePermissionRuleFromSettings,
189731
189787
  getPermissionRulesForSource: () => getPermissionRulesForSource,
189732
189788
  loadAllPermissionRulesFromDisk: () => loadAllPermissionRulesFromDisk,
189789
+ permissionsLoaderLoudNoticesActive: () => permissionsLoaderLoudNoticesActive,
189733
189790
  resolveManagedPermissionRuleScope: () => resolveManagedPermissionRuleScope,
189734
189791
  shouldAllowManagedPermissionRulesOnly: () => shouldAllowManagedPermissionRulesOnly,
189735
189792
  shouldShowAlwaysAllowOptions: () => shouldShowAlwaysAllowOptions
189736
189793
  });
189794
+ function permissionsLoaderLoudNoticesActive() {
189795
+ return [...loudPermissionsLoaderNotices];
189796
+ }
189797
+ function _resetPermissionsLoaderNoticesForTest() {
189798
+ loudManagedPolicyDegradationEmitted = !1, loudPermissionsLoaderNotices.length = 0;
189799
+ }
189737
189800
  function shouldAllowManagedPermissionRulesOnly() {
189738
189801
  return resolveManagedPermissionRuleScope() !== "all-sources";
189739
189802
  }
@@ -189741,10 +189804,16 @@ function resolveManagedPermissionRuleScope() {
189741
189804
  let health = resolveManagedPolicyLayerHealth(
189742
189805
  () => filterManagedPolicyErrors(getSettingsWithErrors().errors)
189743
189806
  );
189744
- return health.healthy ? getSettingsForSource("policySettings")?.allowManagedPermissionRulesOnly === !0 ? "managed-only" : "all-sources" : (loudManagedPolicyDegradationEmitted || (loudManagedPolicyDegradationEmitted = !0, process.stderr.write(
189745
- `[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
189746
- `
189747
- )), "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";
189748
189817
  }
189749
189818
  function shouldShowAlwaysAllowOptions() {
189750
189819
  return !shouldAllowManagedPermissionRulesOnly();
@@ -189855,7 +189924,7 @@ function addPermissionRulesToSettings({
189855
189924
  return logError(error51), !1;
189856
189925
  }
189857
189926
  }
189858
- var loudManagedPolicyDegradationEmitted, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOURCES, init_permissionsLoader = __esm({
189927
+ var loudManagedPolicyDegradationEmitted, loudPermissionsLoaderNotices, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOURCES, init_permissionsLoader = __esm({
189859
189928
  "build-src/src/utils/permissions/permissionsLoader.ts"() {
189860
189929
  init_fileRead();
189861
189930
  init_fsOperations();
@@ -189865,7 +189934,7 @@ var loudManagedPolicyDegradationEmitted, SUPPORTED_RULE_BEHAVIORS, EDITABLE_SOUR
189865
189934
  init_settings2();
189866
189935
  init_settings();
189867
189936
  init_permissionRuleParser();
189868
- loudManagedPolicyDegradationEmitted = !1;
189937
+ loudManagedPolicyDegradationEmitted = !1, loudPermissionsLoaderNotices = [];
189869
189938
  SUPPORTED_RULE_BEHAVIORS = [
189870
189939
  "allow",
189871
189940
  "deny",
@@ -286939,7 +287008,7 @@ function FileEditToolUseRejectedMessage(t0) {
286939
287008
  }
286940
287009
  var import_compiler_runtime43, import_jsx_runtime52, MAX_LINES_TO_RENDER, init_FileEditToolUseRejectedMessage = __esm({
286941
287010
  "build-src/src/components/FileEditToolUseRejectedMessage.tsx"() {
286942
- import_compiler_runtime43 = __toESM(require_compiler_runtime());
287011
+ import_compiler_runtime43 = __toESM(require_compiler_runtime(), 1);
286943
287012
  init_useTerminalSize();
286944
287013
  init_cwd();
286945
287014
  init_ink2();
@@ -286947,7 +287016,7 @@ var import_compiler_runtime43, import_jsx_runtime52, MAX_LINES_TO_RENDER, init_F
286947
287016
  init_MessageResponse();
286948
287017
  init_StructuredDiffList();
286949
287018
  init_stringUtils();
286950
- import_jsx_runtime52 = __toESM(require_jsx_runtime()), MAX_LINES_TO_RENDER = 10;
287019
+ import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1), MAX_LINES_TO_RENDER = 10;
286951
287020
  }
286952
287021
  });
286953
287022
 
@@ -301345,9 +301414,9 @@ function streamingTailWrap(unstableSuffix) {
301345
301414
  }
301346
301415
  var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE_MAX, tokenCache, MD_SYNTAX_RE, init_Markdown = __esm({
301347
301416
  "build-src/src/components/Markdown.tsx"() {
301348
- import_compiler_runtime53 = __toESM(require_compiler_runtime());
301417
+ import_compiler_runtime53 = __toESM(require_compiler_runtime(), 1);
301349
301418
  init_marked_esm();
301350
- import_react48 = __toESM(require_react());
301419
+ import_react48 = __toESM(require_react(), 1);
301351
301420
  init_useSettings();
301352
301421
  init_ink2();
301353
301422
  init_cliHighlight();
@@ -301355,7 +301424,7 @@ var import_compiler_runtime53, import_react48, import_jsx_runtime65, TOKEN_CACHE
301355
301424
  init_markdown();
301356
301425
  init_messages4();
301357
301426
  init_MarkdownTable();
301358
- 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+\. /;
301359
301428
  }
301360
301429
  });
301361
301430
 
@@ -304301,7 +304370,17 @@ var PROVIDER_MANAGED_ENV_VARS, PROVIDER_MANAGED_ENV_PREFIXES, DANGEROUS_SHELL_SE
304301
304370
  "SEMA_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
304302
304371
  "SEMA_CODE_DISABLE_TERMINAL_TITLE",
304303
304372
  "SEMA_CODE_ENABLE_TELEMETRY",
304304
- "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' —— 见上,刻意不在册。
304305
304384
  "SEMA_CODE_IDE_SKIP_AUTO_INSTALL",
304306
304385
  "SEMA_CODE_MAX_OUTPUT_TOKENS",
304307
304386
  "SEMA_CODE_SKIP_BEDROCK_AUTH",
@@ -317775,7 +317854,7 @@ function useClaudeAiLimits() {
317775
317854
  }
317776
317855
  var import_react69, init_claudeAiLimitsHook = __esm({
317777
317856
  "build-src/src/services/claudeAiLimitsHook.ts"() {
317778
- import_react69 = __toESM(require_react());
317857
+ import_react69 = __toESM(require_react(), 1);
317779
317858
  init_claudeAiLimits();
317780
317859
  }
317781
317860
  });
@@ -348161,26 +348240,26 @@ function formatIncomingCallsResult(result, cwd5) {
348161
348240
  let lines = [
348162
348241
  `Found ${result.length} incoming ${plural(result.length, "call")}:`
348163
348242
  ], byFile = /* @__PURE__ */ new Map();
348164
- for (let call77 of result) {
348165
- if (!call77.from) {
348243
+ for (let call78 of result) {
348244
+ if (!call78.from) {
348166
348245
  logForDebugging(
348167
348246
  "formatIncomingCallsResult: CallHierarchyIncomingCall has undefined from field",
348168
348247
  { level: "warn" }
348169
348248
  );
348170
348249
  continue;
348171
348250
  }
348172
- let filePath = formatUri2(call77.from.uri, cwd5), existing = byFile.get(filePath);
348173
- 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]);
348174
348253
  }
348175
348254
  for (let [filePath, calls] of byFile) {
348176
348255
  lines.push(`
348177
348256
  ${filePath}:`);
348178
- for (let call77 of calls) {
348179
- if (!call77.from)
348257
+ for (let call78 of calls) {
348258
+ if (!call78.from)
348180
348259
  continue;
348181
- let kind = symbolKindToString(call77.from.kind), line = call77.from.range.start.line + 1, callLine = ` ${call77.from.name} (${kind}) - Line ${line}`;
348182
- if (call77.fromRanges && call77.fromRanges.length > 0) {
348183
- 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(", ");
348184
348263
  callLine += ` [calls at: ${callSites}]`;
348185
348264
  }
348186
348265
  lines.push(callLine);
@@ -348195,26 +348274,26 @@ function formatOutgoingCallsResult(result, cwd5) {
348195
348274
  let lines = [
348196
348275
  `Found ${result.length} outgoing ${plural(result.length, "call")}:`
348197
348276
  ], byFile = /* @__PURE__ */ new Map();
348198
- for (let call77 of result) {
348199
- if (!call77.to) {
348277
+ for (let call78 of result) {
348278
+ if (!call78.to) {
348200
348279
  logForDebugging(
348201
348280
  "formatOutgoingCallsResult: CallHierarchyOutgoingCall has undefined to field",
348202
348281
  { level: "warn" }
348203
348282
  );
348204
348283
  continue;
348205
348284
  }
348206
- let filePath = formatUri2(call77.to.uri, cwd5), existing = byFile.get(filePath);
348207
- 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]);
348208
348287
  }
348209
348288
  for (let [filePath, calls] of byFile) {
348210
348289
  lines.push(`
348211
348290
  ${filePath}:`);
348212
- for (let call77 of calls) {
348213
- if (!call77.to)
348291
+ for (let call78 of calls) {
348292
+ if (!call78.to)
348214
348293
  continue;
348215
- let kind = symbolKindToString(call77.to.kind), line = call77.to.range.start.line + 1, callLine = ` ${call77.to.name} (${kind}) - Line ${line}`;
348216
- if (call77.fromRanges && call77.fromRanges.length > 0) {
348217
- 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(", ");
348218
348297
  callLine += ` [called from: ${callSites}]`;
348219
348298
  }
348220
348299
  lines.push(callLine);
@@ -348777,11 +348856,11 @@ function countUniqueFilesFromCallItems(items) {
348777
348856
  return new Set(validUris).size;
348778
348857
  }
348779
348858
  function countUniqueFilesFromIncomingCalls(calls) {
348780
- let validUris = calls.map((call77) => call77.from?.uri).filter((uri) => uri);
348859
+ let validUris = calls.map((call78) => call78.from?.uri).filter((uri) => uri);
348781
348860
  return new Set(validUris).size;
348782
348861
  }
348783
348862
  function countUniqueFilesFromOutgoingCalls(calls) {
348784
- let validUris = calls.map((call77) => call77.to?.uri).filter((uri) => uri);
348863
+ let validUris = calls.map((call78) => call78.to?.uri).filter((uri) => uri);
348785
348864
  return new Set(validUris).size;
348786
348865
  }
348787
348866
  var MAX_LSP_FILE_SIZE_BYTES, inputSchema25, outputSchema21, LSPTool, init_LSPTool = __esm({
@@ -401313,15 +401392,14 @@ var sema_brand_default, init_sema_brand = __esm({
401313
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"
401314
401393
  },
401315
401394
  whatsNew: {
401316
- version: "1.0.79",
401395
+ version: "1.0.82",
401317
401396
  notes: [
401318
- "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
401319
- "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
401320
- "Engine 7.24.0 (from 7.22.0)"
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)"
401321
401399
  ]
401322
401400
  },
401323
- productVersion: "1.0.81",
401324
- announcement: "sema 1.0.81 \u2014 Steering a specific background agent row now resolves through that row's own recorded run (no more silently steering whichever run happens to be active; a stale row fails honestly with a no-run notice instead). Background-notification trust is now graded per acceptance path and kept with the row, so panel rows never flip state on unproven evidence. Under the hood: the self-test fleet gained a port registry with hard guards, so test tooling can never touch a production engine port."
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."
401325
401403
  };
401326
401404
  }
401327
401405
  });
@@ -405524,15 +405602,14 @@ var require_sema_brand = __commonJS({
405524
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"
405525
405603
  },
405526
405604
  whatsNew: {
405527
- version: "1.0.79",
405605
+ version: "1.0.82",
405528
405606
  notes: [
405529
- "Permissions fail-closed hardening: when the managed policy layer is unreadable (broken managed-settings JSON, EACCES, MDM read failure) your own deny/ask rules and --disallowedTools stay in force \u2014 degraded mode only tightens, never widens",
405530
- "Approval cards carry org-rule evidence notes end-to-end and sanitize untrusted display fields (subagent identity, rule text) against bidi/control-character spoofing",
405531
- "Engine 7.24.0 (from 7.22.0)"
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)"
405532
405609
  ]
405533
405610
  },
405534
- productVersion: "1.0.81",
405535
- announcement: "sema 1.0.81 \u2014 Steering a specific background agent row now resolves through that row's own recorded run (no more silently steering whichever run happens to be active; a stale row fails honestly with a no-run notice instead). Background-notification trust is now graded per acceptance path and kept with the row, so panel rows never flip state on unproven evidence. Under the hood: the self-test fleet gained a port registry with hard guards, so test tooling can never touch a production engine port."
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."
405536
405613
  };
405537
405614
  }
405538
405615
  });
@@ -412900,27 +412977,27 @@ var collab, collab_default, init_collab2 = __esm({
412900
412977
  }
412901
412978
  });
412902
412979
 
412903
- // build-src/src/commands/team.ts
412904
- var USAGE, WORKFLOW_NAME, TRAMPOLINE, team, team_default, init_team = __esm({
412905
- "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"() {
412906
412983
  init_dist();
412907
412984
  USAGE = [
412908
- "Usage: /team <topic> \u2014 start a multi-agent team discussion on the topic.",
412909
- "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",
412910
412987
  "To browse collaboration-mode templates instead, use /collab."
412911
412988
  ].join(`
412912
- `), 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:
412913
412990
 
412914
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.
412915
412992
  2. When the workflow finishes, present its final synthesis to the user as your answer.
412916
412993
 
412917
- 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 = {
412918
412995
  type: "prompt",
412919
- name: "team",
412996
+ name: "discuss",
412920
412997
  // 裁项 #5 默认:壳 author 一句入口标签(成本提示,与 whenToUse 语义对齐但不逐字复制)。
412921
- 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)",
412922
412999
  argNames: ["topic"],
412923
- progressMessage: "starting team discussion",
413000
+ progressMessage: "starting discussion",
412924
413001
  contentLength: 0,
412925
413002
  // dynamic (built per-invocation from the topic)
412926
413003
  source: "builtin",
@@ -412930,10 +413007,201 @@ If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not r
412930
413007
  throw new Error(USAGE);
412931
413008
  if (selfOrchestrationFromEnv() === void 0)
412932
413009
  throw new Error(
412933
- `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.`
412934
413011
  );
412935
413012
  return [{ type: "text", text: TRAMPOLINE(topic) }];
412936
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 })
412937
413205
  }, team_default = team;
412938
413206
  }
412939
413207
  });
@@ -412941,7 +413209,7 @@ If the Workflow tool is not available, or the name "${WORKFLOW_NAME}" does not r
412941
413209
  // build-src/src/commands/think-back/thinkback.tsx
412942
413210
  var thinkback_exports = {};
412943
413211
  __export(thinkback_exports, {
412944
- call: () => call44,
413212
+ call: () => call45,
412945
413213
  playAnimation: () => playAnimation
412946
413214
  });
412947
413215
  import { readFile as readFile46 } from "fs/promises";
@@ -413214,7 +413482,7 @@ function ThinkbackFlow(t0) {
413214
413482
  let t8;
413215
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;
413216
413484
  }
413217
- async function call44(onDone) {
413485
+ async function call45(onDone) {
413218
413486
  return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(ThinkbackFlow, { onDone });
413219
413487
  }
413220
413488
  var import_compiler_runtime210, import_react176, import_jsx_runtime302, OFFICIAL_MARKETPLACE_REPO, SKILL_NAME, EDIT_PROMPT, FIX_PROMPT, REGENERATE_PROMPT, init_thinkback = __esm({
@@ -413263,13 +413531,13 @@ var thinkback, think_back_default, init_think_back = __esm({
413263
413531
  // build-src/src/commands/thinkback-play/thinkback-play.ts
413264
413532
  var thinkback_play_exports = {};
413265
413533
  __export(thinkback_play_exports, {
413266
- call: () => call45
413534
+ call: () => call46
413267
413535
  });
413268
413536
  import { join as join155 } from "path";
413269
413537
  function getPluginId2() {
413270
413538
  return `thinkback@${process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME}`;
413271
413539
  }
413272
- async function call45() {
413540
+ async function call46() {
413273
413541
  let v2Data = loadInstalledPluginsV2(), pluginId = getPluginId2(), installations = v2Data.plugins[pluginId];
413274
413542
  if (!installations || installations.length === 0)
413275
413543
  return {
@@ -413803,6 +414071,16 @@ function collectCcSettingsLayers(cwd5 = process.cwd()) {
413803
414071
  }
413804
414072
  return out6;
413805
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
+ }
413806
414084
  function buildToolApprovalRespondBody(input) {
413807
414085
  let wantsPersist = typeof input.persistRule == "string" && input.persistRule !== "" && input.decision !== "deny";
413808
414086
  return {
@@ -413908,6 +414186,10 @@ var init_ccRulesImport = __esm({
413908
414186
  // build-src/src/sema/rules/ccImportMarker.ts
413909
414187
  import { existsSync as existsSync25, readFileSync as readFileSync35, writeFileSync as writeFileSync19, mkdirSync as mkdirSync20 } from "node:fs";
413910
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
+ }
413911
414193
  function markerPath() {
413912
414194
  return join157(getClaudeConfigHomeDir(), "cc-import.json");
413913
414195
  }
@@ -413921,7 +414203,8 @@ function readCcImportMarker() {
413921
414203
  return typeof raw2.importedAt != "string" || typeof raw2.importedCount != "number" ? null : {
413922
414204
  importedAt: raw2.importedAt,
413923
414205
  sourcePath: typeof raw2.sourcePath == "string" ? raw2.sourcePath : "",
413924
- importedCount: raw2.importedCount
414206
+ importedCount: raw2.importedCount,
414207
+ declined: raw2.declined === !0
413925
414208
  };
413926
414209
  } catch {
413927
414210
  return null;
@@ -413932,6 +414215,31 @@ function writeCcImportMarker(marker) {
413932
414215
  mkdirSync20(dirname73(p), { recursive: !0 }), writeFileSync19(p, JSON.stringify(marker, null, 2) + `
413933
414216
  `, "utf8");
413934
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
+ }
413935
414243
  var init_ccImportMarker = __esm({
413936
414244
  "build-src/src/sema/rules/ccImportMarker.ts"() {
413937
414245
  init_envUtils();
@@ -415242,13 +415550,13 @@ var import_compiler_runtime217, React107, import_react180, import_jsx_runtime312
415242
415550
  // build-src/src/commands/permissions/permissions.tsx
415243
415551
  var permissions_exports3 = {};
415244
415552
  __export(permissions_exports3, {
415245
- call: () => call46
415553
+ call: () => call47
415246
415554
  });
415247
- var import_jsx_runtime313, call46, init_permissions3 = __esm({
415555
+ var import_jsx_runtime313, call47, init_permissions3 = __esm({
415248
415556
  "build-src/src/commands/permissions/permissions.tsx"() {
415249
415557
  init_PermissionRuleList();
415250
415558
  init_messages4();
415251
- 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) => {
415252
415560
  context3.setMessages((prev) => [...prev, createPermissionRetryMessage(commands)]);
415253
415561
  } });
415254
415562
  }
@@ -415271,7 +415579,7 @@ var permissions, permissions_default, init_permissions4 = __esm({
415271
415579
  // build-src/src/commands/plan/plan.tsx
415272
415580
  var plan_exports = {};
415273
415581
  __export(plan_exports, {
415274
- call: () => call47
415582
+ call: () => call48
415275
415583
  });
415276
415584
  function PlanDisplay(t0) {
415277
415585
  let $3 = (0, import_compiler_runtime218.c)(11), {
@@ -415298,7 +415606,7 @@ function PlanDisplay(t0) {
415298
415606
  t4
415299
415607
  ] }), $3[7] = t2, $3[8] = t3, $3[9] = t4, $3[10] = t5) : t5 = $3[10], t5;
415300
415608
  }
415301
- async function call47(onDone, context3, args) {
415609
+ async function call48(onDone, context3, args) {
415302
415610
  let {
415303
415611
  getAppState,
415304
415612
  setAppState
@@ -415401,7 +415709,7 @@ var import_compiler_runtime219, import_jsx_runtime315, init_FastIcon = __esm({
415401
415709
  var fast_exports = {};
415402
415710
  __export(fast_exports, {
415403
415711
  FastModePicker: () => FastModePicker,
415404
- call: () => call48
415712
+ call: () => call49
415405
415713
  });
415406
415714
  function applyFastMode(enable, setAppState) {
415407
415715
  clearFastModeCooldown(), updateSettingsForSource("userSettings", {
@@ -415534,7 +415842,7 @@ async function handleFastModeShortcut(enable, getAppState, setAppState) {
415534
415842
  } else
415535
415843
  return "Fast mode OFF";
415536
415844
  }
415537
- async function call48(onDone, context3, args) {
415845
+ async function call49(onDone, context3, args) {
415538
415846
  if (!isFastModeEnabled())
415539
415847
  return null;
415540
415848
  await prefetchFastModeStatus();
@@ -415705,9 +416013,9 @@ var import_react182, import_jsx_runtime317, init_Passes = __esm({
415705
416013
  // build-src/src/commands/passes/passes.tsx
415706
416014
  var passes_exports = {};
415707
416015
  __export(passes_exports, {
415708
- call: () => call49
416016
+ call: () => call50
415709
416017
  });
415710
- async function call49(onDone) {
416018
+ async function call50(onDone) {
415711
416019
  let isFirstVisit = !getGlobalConfig().hasVisitedPasses;
415712
416020
  if (isFirstVisit) {
415713
416021
  let remaining = getCachedRemainingPasses();
@@ -416025,9 +416333,9 @@ var import_compiler_runtime221, import_react183, import_jsx_runtime319, NEW_TERM
416025
416333
  // build-src/src/commands/privacy-settings/privacy-settings.tsx
416026
416334
  var privacy_settings_exports = {};
416027
416335
  __export(privacy_settings_exports, {
416028
- call: () => call50
416336
+ call: () => call51
416029
416337
  });
416030
- async function call50(onDone) {
416338
+ async function call51(onDone) {
416031
416339
  if (!await isQualifiedForGrove())
416032
416340
  return onDone(FALLBACK_MESSAGE), null;
416033
416341
  let [settingsResult, configResult] = await Promise.all([getGroveSettings(), getGroveNoticeConfig()]);
@@ -417062,14 +417370,14 @@ var import_compiler_runtime225, import_react184, import_jsx_runtime325, init_Hoo
417062
417370
  // build-src/src/commands/hooks/hooks.tsx
417063
417371
  var hooks_exports = {};
417064
417372
  __export(hooks_exports, {
417065
- call: () => call51
417373
+ call: () => call52
417066
417374
  });
417067
- var import_jsx_runtime326, call51, init_hooks3 = __esm({
417375
+ var import_jsx_runtime326, call52, init_hooks3 = __esm({
417068
417376
  "build-src/src/commands/hooks/hooks.tsx"() {
417069
417377
  init_HooksConfigMenu();
417070
417378
  init_analytics_index();
417071
417379
  init_tools2();
417072
- 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) => {
417073
417381
  let permissionContext = context3.getAppState().toolPermissionContext, toolNames = getTools(permissionContext).map((tool) => tool.name);
417074
417382
  return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(HooksConfigMenu, { toolNames, onExit: onDone });
417075
417383
  };
@@ -417092,10 +417400,10 @@ var hooks, hooks_default, init_hooks4 = __esm({
417092
417400
  // build-src/src/commands/files/files.ts
417093
417401
  var files_exports2 = {};
417094
417402
  __export(files_exports2, {
417095
- call: () => call52
417403
+ call: () => call53
417096
417404
  });
417097
417405
  import { relative as relative26 } from "path";
417098
- async function call52(_args, context3) {
417406
+ async function call53(_args, context3) {
417099
417407
  let files2 = context3.readFileState ? cacheKeys(context3.readFileState) : [];
417100
417408
  return files2.length === 0 ? { type: "text", value: "No files in context" } : { type: "text", value: `Files in context:
417101
417409
  ${files2.map((file2) => relative26(getCwd(), file2)).join(`
@@ -417233,7 +417541,7 @@ async function getUniqueForkName(baseName) {
417233
417541
  nextNumber++;
417234
417542
  return `${baseName} (Branch ${nextNumber})`;
417235
417543
  }
417236
- async function call53(onDone, context3, args) {
417544
+ async function call54(onDone, context3, args) {
417237
417545
  let customTitle = args?.trim() || void 0, originalSessionId = getSessionId();
417238
417546
  try {
417239
417547
  let {
@@ -417303,7 +417611,7 @@ function resolveDurable() {
417303
417611
  function makeLiveBranchDeps() {
417304
417612
  return {
417305
417613
  resolveDurable,
417306
- localBranch: call53
417614
+ localBranch: call54
417307
417615
  };
417308
417616
  }
417309
417617
  var init_branchDurableLive = __esm({
@@ -417342,14 +417650,14 @@ var agents_exports2 = {};
417342
417650
  __export(agents_exports2, {
417343
417651
  default: () => agents_default
417344
417652
  });
417345
- var WIZARD_REMOVED_TEXT, call54, agents, agents_default, init_agents2 = __esm({
417653
+ var WIZARD_REMOVED_TEXT, call55, agents, agents_default, init_agents2 = __esm({
417346
417654
  "build-src/src/commands/agents/index.ts"() {
417347
417655
  WIZARD_REMOVED_TEXT = `The /agents wizard has been removed.
417348
417656
 
417349
417657
  Ask sema to create or update subagents for you (e.g. "create a code-reviewer subagent that ..."),
417350
417658
  or edit the files directly:
417351
417659
  \u2022 .sema/agents/ (this project)
417352
- \u2022 ~/.sema/agents/ (all projects)`, call54 = async () => ({
417660
+ \u2022 ~/.sema/agents/ (all projects)`, call55 = async () => ({
417353
417661
  type: "text",
417354
417662
  value: WIZARD_REMOVED_TEXT
417355
417663
  }), agents = {
@@ -417357,7 +417665,7 @@ or edit the files directly:
417357
417665
  name: "agents",
417358
417666
  description: "(removed) Ask sema to create/manage subagents, or edit .sema/agents/",
417359
417667
  supportsNonInteractive: !0,
417360
- load: () => Promise.resolve({ call: call54 })
417668
+ load: () => Promise.resolve({ call: call55 })
417361
417669
  }, agents_default = agents;
417362
417670
  }
417363
417671
  });
@@ -418451,9 +418759,9 @@ For -m/--message and --remote, use the CLI: sema plugin tag --help`;
418451
418759
  // build-src/src/commands/plugin/plugin.tsx
418452
418760
  var plugin_exports = {};
418453
418761
  __export(plugin_exports, {
418454
- call: () => call55
418762
+ call: () => call56
418455
418763
  });
418456
- async function call55(onDone, context3, args) {
418764
+ async function call56(onDone, context3, args) {
418457
418765
  let getSessionContext = () => ({
418458
418766
  readFileState: context3.readFileState,
418459
418767
  bashTools: extractBashToolsFromMessages(context3.messages ?? []),
@@ -418634,12 +418942,12 @@ var init_refresh = __esm({
418634
418942
  // build-src/src/commands/reload-plugins/reload-plugins.ts
418635
418943
  var reload_plugins_exports = {};
418636
418944
  __export(reload_plugins_exports, {
418637
- call: () => call56
418945
+ call: () => call57
418638
418946
  });
418639
418947
  function n(count3, noun) {
418640
418948
  return `${count3} ${plural(count3, noun)}`;
418641
418949
  }
418642
- var call56, init_reload_plugins = __esm({
418950
+ var call57, init_reload_plugins = __esm({
418643
418951
  "build-src/src/commands/reload-plugins/reload-plugins.ts"() {
418644
418952
  init_state();
418645
418953
  init_settingsSync();
@@ -418647,7 +418955,7 @@ var call56, init_reload_plugins = __esm({
418647
418955
  init_refresh();
418648
418956
  init_changeDetector();
418649
418957
  init_stringUtils();
418650
- call56 = async (_args, context3) => {
418958
+ call57 = async (_args, context3) => {
418651
418959
  let r = await refreshActivePlugins(context3.setAppState), msg = `Reloaded: ${[
418652
418960
  n(r.enabled_count, "plugin"),
418653
418961
  n(r.command_count, "skill"),
@@ -418684,9 +418992,9 @@ var reloadPlugins, reload_plugins_default, init_reload_plugins2 = __esm({
418684
418992
  // build-src/src/commands/rewind/rewind.ts
418685
418993
  var rewind_exports = {};
418686
418994
  __export(rewind_exports, {
418687
- call: () => call57
418995
+ call: () => call58
418688
418996
  });
418689
- async function call57(_args, context3) {
418997
+ async function call58(_args, context3) {
418690
418998
  return context3.openMessageSelector && context3.openMessageSelector(), { type: "skip" };
418691
418999
  }
418692
419000
  var init_rewind = __esm({
@@ -418840,9 +419148,9 @@ var init_heapDumpService = __esm({
418840
419148
  // build-src/src/commands/heapdump/heapdump.ts
418841
419149
  var heapdump_exports = {};
418842
419150
  __export(heapdump_exports, {
418843
- call: () => call58
419151
+ call: () => call59
418844
419152
  });
418845
- async function call58() {
419153
+ async function call59() {
418846
419154
  let result = await performHeapDump();
418847
419155
  return result.success ? {
418848
419156
  type: "text",
@@ -419238,10 +419546,10 @@ var debugHandle, faultQueue, init_bridgeDebug = __esm({
419238
419546
  });
419239
419547
 
419240
419548
  // build-src/src/commands/bridge-kick.ts
419241
- var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419549
+ var USAGE3, call60, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419242
419550
  "build-src/src/commands/bridge-kick.ts"() {
419243
419551
  init_bridgeDebug();
419244
- USAGE2 = `/bridge-kick <subcommand>
419552
+ USAGE3 = `/bridge-kick <subcommand>
419245
419553
  close <code> fire ws_closed with the given code (e.g. 1002)
419246
419554
  poll <status> [type] next poll throws BridgeFatalError(status, type)
419247
419555
  poll transient next poll throws axios-style rejection (5xx/net)
@@ -419250,7 +419558,7 @@ var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419250
419558
  reconnect-session fail next POST /bridge/reconnect fails
419251
419559
  heartbeat <status> next heartbeat throws BridgeFatalError(status)
419252
419560
  reconnect call reconnectEnvironmentWithSession directly
419253
- status print bridge state`, call59 = async (args) => {
419561
+ status print bridge state`, call60 = async (args) => {
419254
419562
  let h = getBridgeDebugHandle();
419255
419563
  if (!h)
419256
419564
  return {
@@ -419265,7 +419573,7 @@ var USAGE2, call59, bridgeKick, bridge_kick_default, init_bridge_kick = __esm({
419265
419573
  type: "text",
419266
419574
  value: `Fired transport close(${code2}). Watch debug.log for [bridge:repl] recovery.`
419267
419575
  }) : { type: "text", value: `close: need a numeric code
419268
- ${USAGE2}` };
419576
+ ${USAGE3}` };
419269
419577
  }
419270
419578
  case "poll": {
419271
419579
  if (a === "transient")
@@ -419283,7 +419591,7 @@ ${USAGE2}` };
419283
419591
  return {
419284
419592
  type: "text",
419285
419593
  value: `poll: need 'transient' or a status code
419286
- ${USAGE2}`
419594
+ ${USAGE3}`
419287
419595
  };
419288
419596
  let errorType = b3 ?? (status3 === 404 ? "not_found_error" : "authentication_error");
419289
419597
  return h.injectFault({
@@ -419352,7 +419660,7 @@ ${USAGE2}`
419352
419660
  case "status":
419353
419661
  return { type: "text", value: h.describe() };
419354
419662
  default:
419355
- return { type: "text", value: USAGE2 };
419663
+ return { type: "text", value: USAGE3 };
419356
419664
  }
419357
419665
  }, bridgeKick = {
419358
419666
  type: "local",
@@ -419360,16 +419668,16 @@ ${USAGE2}`
419360
419668
  description: "Inject bridge failure states for manual recovery testing",
419361
419669
  isEnabled: () => process.env.USER_TYPE === "ant",
419362
419670
  supportsNonInteractive: !1,
419363
- load: () => Promise.resolve({ call: call59 })
419671
+ load: () => Promise.resolve({ call: call60 })
419364
419672
  }, bridge_kick_default = bridgeKick;
419365
419673
  }
419366
419674
  });
419367
419675
 
419368
419676
  // build-src/src/commands/version.ts
419369
- var SEMA_PRODUCT_VERSION, call60, version3, version_default, init_version2 = __esm({
419677
+ var SEMA_PRODUCT_VERSION, call61, version3, version_default, init_version2 = __esm({
419370
419678
  "build-src/src/commands/version.ts"() {
419371
419679
  init_sema_brand();
419372
- 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 () => ({
419373
419681
  type: "text",
419374
419682
  value: `sema ${SEMA_PRODUCT_VERSION} (CC-compatible base 2.1.187)`
419375
419683
  }), version3 = {
@@ -419378,7 +419686,7 @@ var SEMA_PRODUCT_VERSION, call60, version3, version_default, init_version2 = __e
419378
419686
  description: "Print the version this session is running (not what autoupdate downloaded)",
419379
419687
  isEnabled: () => process.env.USER_TYPE === "ant",
419380
419688
  supportsNonInteractive: !0,
419381
- load: () => Promise.resolve({ call: call60 })
419689
+ load: () => Promise.resolve({ call: call61 })
419382
419690
  }, version_default = version3;
419383
419691
  }
419384
419692
  });
@@ -419855,10 +420163,10 @@ var import_compiler_runtime228, import_jsx_runtime331, init_SandboxSettings = __
419855
420163
  // build-src/src/commands/sandbox/sandbox-toggle.tsx
419856
420164
  var sandbox_toggle_exports = {};
419857
420165
  __export(sandbox_toggle_exports, {
419858
- call: () => call61
420166
+ call: () => call62
419859
420167
  });
419860
420168
  import { relative as relative28 } from "path";
419861
- async function call61(onDone, _context, args) {
420169
+ async function call62(onDone, _context, args) {
419862
420170
  let themeName = getSettings_DEPRECATED().theme || "light", platform4 = getPlatform();
419863
420171
  if (!SandboxManager2.isSupportedPlatform()) {
419864
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);
@@ -419987,7 +420295,7 @@ var PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID, init_setupPortable =
419987
420295
 
419988
420296
  // build-src/src/utils/claudeInChrome/setup.ts
419989
420297
  import { chmod as chmod12, mkdir as mkdir40, readFile as readFile50, writeFile as writeFile43 } from "fs/promises";
419990
- import { homedir as homedir42 } from "os";
420298
+ import { homedir as homedir43 } from "os";
419991
420299
  import { join as join161 } from "path";
419992
420300
  import { fileURLToPath as fileURLToPath8 } from "url";
419993
420301
  function shouldEnableClaudeInChrome(chromeFlag) {
@@ -420063,7 +420371,7 @@ function setupClaudeInChrome() {
420063
420371
  }
420064
420372
  function getNativeMessagingHostsDirs() {
420065
420373
  if (getPlatform() === "windows") {
420066
- let home = homedir42(), appData = process.env.APPDATA || join161(home, "AppData", "Local");
420374
+ let home = homedir43(), appData = process.env.APPDATA || join161(home, "AppData", "Local");
420067
420375
  return [join161(appData, "Sema", "ChromeNativeHost")];
420068
420376
  }
420069
420377
  return getAllNativeMessagingHostsDirs().map(({ path: path28 }) => path28);
@@ -420191,7 +420499,7 @@ var CHROME_EXTENSION_RECONNECT_URL, NATIVE_HOST_IDENTIFIER, NATIVE_HOST_MANIFEST
420191
420499
  // build-src/src/commands/chrome/chrome.tsx
420192
420500
  var chrome_exports = {};
420193
420501
  __export(chrome_exports, {
420194
- call: () => call62
420502
+ call: () => call63
420195
420503
  });
420196
420504
  async function callChromeTool(chromeClient, tool, args) {
420197
420505
  let result = await chromeClient.client.callTool({ name: tool, arguments: args }), content = Array.isArray(result.content) ? result.content[0] : void 0;
@@ -420408,7 +420716,7 @@ function ClaudeInChromeMenu(t0) {
420408
420716
  }
420409
420717
  );
420410
420718
  }
420411
- 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({
420412
420720
  "build-src/src/commands/chrome/chrome.tsx"() {
420413
420721
  import_react186 = __toESM(require_react(), 1);
420414
420722
  init_v4();
@@ -420432,7 +420740,7 @@ var import_react186, import_jsx_runtime333, CHROME_EXTENSION_URL, CHROME_PERMISS
420432
420740
  name: external_exports.string().default("Browser"),
420433
420741
  osPlatform: external_exports.string().optional()
420434
420742
  });
420435
- call62 = async function(onDone) {
420743
+ call63 = async function(onDone) {
420436
420744
  let isExtensionInstalled = await isChromeExtensionInstalled().catch((error51) => (logError(
420437
420745
  new Error(
420438
420746
  `[Claude in Chrome] Extension detection failed: ${error51 instanceof Error ? error51.message : String(error51)}`
@@ -420470,9 +420778,9 @@ var command7, chrome_default, init_chrome2 = __esm({
420470
420778
  // build-src/src/commands/stickers/stickers.ts
420471
420779
  var stickers_exports = {};
420472
420780
  __export(stickers_exports, {
420473
- call: () => call63
420781
+ call: () => call64
420474
420782
  });
420475
- async function call63() {
420783
+ async function call64() {
420476
420784
  let url3 = "https://www.stickermule.com/claudecode";
420477
420785
  return await openBrowser(url3) ? { type: "text", value: "Opening sticker page in browser\u2026" } : {
420478
420786
  type: "text",
@@ -420647,7 +420955,7 @@ function AdvisorDialog({
420647
420955
  ] })
420648
420956
  ] }) });
420649
420957
  }
420650
- 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({
420651
420959
  "build-src/src/commands/advisor.tsx"() {
420652
420960
  import_react187 = __toESM(require_react(), 1);
420653
420961
  init_select();
@@ -420669,7 +420977,7 @@ var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REF
420669
420977
  "claude-mythos-5": 5,
420670
420978
  "claude-fable-5": 5
420671
420979
  };
420672
- call64 = async (onDone, _context, args) => {
420980
+ call65 = async (onDone, _context, args) => {
420673
420981
  let arg = (args ?? "").trim().toLowerCase();
420674
420982
  if (!arg)
420675
420983
  return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(AdvisorDialog, { onDone });
@@ -420694,7 +421002,7 @@ var import_react187, import_jsx_runtime334, ADVISOR_BLOG_URL, ADVISOR_REMOTE_REF
420694
421002
  get isHidden() {
420695
421003
  return !canUserConfigureAdvisor();
420696
421004
  },
420697
- load: () => Promise.resolve({ call: call64 })
421005
+ load: () => Promise.resolve({ call: call65 })
420698
421006
  }, advisor_default = advisor;
420699
421007
  }
420700
421008
  });
@@ -420967,13 +421275,13 @@ var import_compiler_runtime229, import_jsx_runtime336, GOODBYE_MESSAGES, init_Ex
420967
421275
  // build-src/src/commands/exit/exit.tsx
420968
421276
  var exit_exports = {};
420969
421277
  __export(exit_exports, {
420970
- call: () => call65
421278
+ call: () => call66
420971
421279
  });
420972
421280
  import { spawnSync as spawnSync10 } from "child_process";
420973
421281
  function getRandomGoodbyeMessage2() {
420974
421282
  return sample_default(GOODBYE_MESSAGES2) ?? "Goodbye!";
420975
421283
  }
420976
- async function call65(onDone) {
421284
+ async function call66(onDone) {
420977
421285
  if (isBgSession())
420978
421286
  return onDone(), spawnSync10("tmux", ["detach-client"], {
420979
421287
  stdio: "ignore"
@@ -421150,7 +421458,7 @@ var import_react190, import_jsx_runtime339, init_exportRenderer = __esm({
421150
421458
  // build-src/src/commands/export/export.tsx
421151
421459
  var export_exports = {};
421152
421460
  __export(export_exports, {
421153
- call: () => call66,
421461
+ call: () => call67,
421154
421462
  extractFirstPrompt: () => extractFirstPrompt,
421155
421463
  sanitizeFilename: () => sanitizeFilename
421156
421464
  });
@@ -421180,7 +421488,7 @@ async function exportWithReactRenderer(context3) {
421180
421488
  let tools = context3.options.tools || [];
421181
421489
  return renderMessagesToPlainText(context3.messages, tools);
421182
421490
  }
421183
- async function call66(onDone, context3, args) {
421491
+ async function call67(onDone, context3, args) {
421184
421492
  let content = await exportWithReactRenderer(context3), filename = args.trim();
421185
421493
  if (filename) {
421186
421494
  let finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt", filepath = join164(getCwd(), finalFilename);
@@ -421580,7 +421888,7 @@ var import_react191, import_jsx_runtime341, NO_PREFERENCE2, HEADER_TEXT, MAX_EFF
421580
421888
  // build-src/src/commands/model/model.tsx
421581
421889
  var model_exports2 = {};
421582
421890
  __export(model_exports2, {
421583
- call: () => call67,
421891
+ call: () => call68,
421584
421892
  renderModelLabel: () => renderModelLabel
421585
421893
  });
421586
421894
  function ModelPickerWrapper(t0) {
@@ -421730,7 +422038,7 @@ function renderModelLabel(model) {
421730
422038
  let rendered = renderDefaultModelSetting(model ?? getDefaultMainLoopModelSetting());
421731
422039
  return model === null ? `${rendered} (default)` : rendered;
421732
422040
  }
421733
- 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({
421734
422042
  "build-src/src/commands/model/model.tsx"() {
421735
422043
  import_compiler_runtime230 = __toESM(require_compiler_runtime(), 1);
421736
422044
  init_source2();
@@ -421751,7 +422059,7 @@ var import_compiler_runtime230, React113, import_jsx_runtime342, call67, init_mo
421751
422059
  init_modelAllowlist();
421752
422060
  init_validateModel();
421753
422061
  import_jsx_runtime342 = __toESM(require_jsx_runtime(), 1);
421754
- call67 = async (onDone, _context, args) => {
422062
+ call68 = async (onDone, _context, args) => {
421755
422063
  if (args = args?.trim() || "", COMMON_INFO_ARGS.includes(args))
421756
422064
  return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(ShowModelAndClose, { onDone });
421757
422065
  if (COMMON_HELP_ARGS.includes(args)) {
@@ -421790,7 +422098,7 @@ var model_default, init_model3 = __esm({
421790
422098
  // build-src/src/commands/tag/tag.tsx
421791
422099
  var tag_exports = {};
421792
422100
  __export(tag_exports, {
421793
- call: () => call68
422101
+ call: () => call69
421794
422102
  });
421795
422103
  function ConfirmRemoveTag(t0) {
421796
422104
  let $3 = (0, import_compiler_runtime231.c)(11), {
@@ -421885,7 +422193,7 @@ Examples:
421885
422193
  });
421886
422194
  }, t2 = [onDone], $3[0] = onDone, $3[1] = t1, $3[2] = t2) : (t1 = $3[1], t2 = $3[2]), React114.useEffect(t1, t2), null;
421887
422195
  }
421888
- async function call68(onDone, _context, args) {
422196
+ async function call69(onDone, _context, args) {
421889
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 });
421890
422198
  }
421891
422199
  var import_compiler_runtime231, React114, import_jsx_runtime343, init_tag = __esm({
@@ -421922,9 +422230,9 @@ var tag, tag_default, init_tag2 = __esm({
421922
422230
  // build-src/src/commands/output-style/output-style.tsx
421923
422231
  var output_style_exports = {};
421924
422232
  __export(output_style_exports, {
421925
- call: () => call69
422233
+ call: () => call70
421926
422234
  });
421927
- async function call69(onDone) {
422235
+ async function call70(onDone) {
421928
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.", {
421929
422237
  display: "system"
421930
422238
  });
@@ -422168,9 +422476,9 @@ var import_compiler_runtime232, import_react192, import_jsx_runtime344, DIALOG_T
422168
422476
  // build-src/src/commands/remote-env/remote-env.tsx
422169
422477
  var remote_env_exports = {};
422170
422478
  __export(remote_env_exports, {
422171
- call: () => call70
422479
+ call: () => call71
422172
422480
  });
422173
- async function call70(onDone) {
422481
+ async function call71(onDone) {
422174
422482
  return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(RemoteEnvironmentDialog, { onDone });
422175
422483
  }
422176
422484
  var import_jsx_runtime345, init_remote_env = __esm({
@@ -422201,9 +422509,9 @@ var remote_env_default, init_remote_env2 = __esm({
422201
422509
  // build-src/src/commands/upgrade/upgrade.tsx
422202
422510
  var upgrade_exports = {};
422203
422511
  __export(upgrade_exports, {
422204
- call: () => call71
422512
+ call: () => call72
422205
422513
  });
422206
- async function call71(onDone, context3) {
422514
+ async function call72(onDone, context3) {
422207
422515
  try {
422208
422516
  if (isClaudeAISubscriber()) {
422209
422517
  let tokens = getClaudeAIOAuthTokens(), isMax20x = !1;
@@ -422254,7 +422562,7 @@ var upgrade, upgrade_default, init_upgrade2 = __esm({
422254
422562
  // build-src/src/commands/rate-limit-options/rate-limit-options.tsx
422255
422563
  var rate_limit_options_exports = {};
422256
422564
  __export(rate_limit_options_exports, {
422257
- call: () => call72
422565
+ call: () => call73
422258
422566
  });
422259
422567
  function RateLimitOptionsMenu(t0) {
422260
422568
  let $3 = (0, import_compiler_runtime233.c)(25), {
@@ -422312,7 +422620,7 @@ function RateLimitOptionsMenu(t0) {
422312
422620
  }, $3[13] = onDone, $3[14] = t4) : t4 = $3[14];
422313
422621
  let handleCancel = t4, t5;
422314
422622
  $3[15] !== context3 || $3[16] !== handleCancel || $3[17] !== onDone ? (t5 = function(value) {
422315
- value === "upgrade" ? call71(onDone, context3).then((jsx526) => {
422623
+ value === "upgrade" ? call72(onDone, context3).then((jsx526) => {
422316
422624
  jsx526 && setSubCommandJSX(jsx526);
422317
422625
  }) : value === "extra-usage" ? call2(onDone, context3).then((jsx_0) => {
422318
422626
  jsx_0 && setSubCommandJSX(jsx_0);
@@ -422326,7 +422634,7 @@ function RateLimitOptionsMenu(t0) {
422326
422634
  let t7;
422327
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;
422328
422636
  }
422329
- async function call72(onDone, context3) {
422637
+ async function call73(onDone, context3) {
422330
422638
  return /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(RateLimitOptionsMenu, { onDone, context: context3 });
422331
422639
  }
422332
422640
  var import_compiler_runtime233, import_react193, import_jsx_runtime347, init_rate_limit_options = __esm({
@@ -422503,7 +422811,7 @@ var import_compiler_runtime234, React116, import_jsx_runtime348, init_effort2 =
422503
422811
  // build-src/src/sema/overrides/effort.tsx
422504
422812
  var effort_exports = {};
422505
422813
  __export(effort_exports, {
422506
- call: () => call73,
422814
+ call: () => call74,
422507
422815
  executeEffort: () => executeEffort,
422508
422816
  showCurrentEffort: () => showCurrentEffort
422509
422817
  });
@@ -422654,7 +422962,7 @@ function EffortSlider({ onDone }) {
422654
422962
  footer
422655
422963
  ] });
422656
422964
  }
422657
- async function call73(onDone, _context, args) {
422965
+ async function call74(onDone, _context, args) {
422658
422966
  if (args = args?.trim() || "", COMMON_HELP_ARGS2.includes(args)) {
422659
422967
  onDone(HELP_TEXT);
422660
422968
  return;
@@ -422735,12 +423043,12 @@ var effort_default, init_effort4 = __esm({
422735
423043
  // build-src/src/commands/stats/stats.tsx
422736
423044
  var stats_exports = {};
422737
423045
  __export(stats_exports, {
422738
- call: () => call74
423046
+ call: () => call75
422739
423047
  });
422740
- var import_jsx_runtime350, call74, init_stats2 = __esm({
423048
+ var import_jsx_runtime350, call75, init_stats2 = __esm({
422741
423049
  "build-src/src/commands/stats/stats.tsx"() {
422742
423050
  init_Stats();
422743
- 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 });
422744
423052
  }
422745
423053
  });
422746
423054
 
@@ -422977,7 +423285,7 @@ var import_react195, import_jsx_runtime351, init_RemoteCallout = __esm({
422977
423285
  // build-src/src/commands/remote-control/bridge.tsx
422978
423286
  var bridge_exports = {};
422979
423287
  __export(bridge_exports, {
422980
- call: () => call75
423288
+ call: () => call76
422981
423289
  });
422982
423290
  function BridgeToggle(t0) {
422983
423291
  let $3 = (0, import_compiler_runtime235.c)(10), {
@@ -423174,7 +423482,7 @@ async function checkBridgePrerequisites() {
423174
423482
  let versionError = isEnvLessBridgeEnabled() ? await checkEnvLessBridgeMinVersion() : checkBridgeMinVersion();
423175
423483
  return versionError || (getBridgeAccessToken() ? (logForDebugging("[bridge] Prerequisites passed, enabling bridge"), null) : BRIDGE_LOGIN_INSTRUCTION);
423176
423484
  }
423177
- async function call75(onDone, _context, args) {
423485
+ async function call76(onDone, _context, args) {
423178
423486
  let name = args.trim() || void 0;
423179
423487
  return /* @__PURE__ */ (0, import_jsx_runtime352.jsx)(BridgeToggle, { onDone, name });
423180
423488
  }
@@ -423373,7 +423681,7 @@ var CCR_BYOC_BETA_HEADER, RedactedGithubToken, init_api4 = __esm({
423373
423681
  // build-src/src/commands/web-setup/remote-setup.tsx
423374
423682
  var remote_setup_exports = {};
423375
423683
  __export(remote_setup_exports, {
423376
- call: () => call76
423684
+ call: () => call77
423377
423685
  });
423378
423686
  async function checkLoginState() {
423379
423687
  if (!await isSignedIn())
@@ -423478,7 +423786,7 @@ function Web({
423478
423786
  }, onCancel: handleCancel })
423479
423787
  ] });
423480
423788
  }
423481
- async function call76(onDone) {
423789
+ async function call77(onDone) {
423482
423790
  return /* @__PURE__ */ (0, import_jsx_runtime353.jsx)(Web, { onDone });
423483
423791
  }
423484
423792
  var import_react197, import_jsx_runtime353, init_remote_setup = __esm({
@@ -425617,6 +425925,7 @@ var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteCo
425617
425925
  init_vim2();
425618
425926
  init_websearch2();
425619
425927
  init_collab2();
425928
+ init_discuss();
425620
425929
  init_team();
425621
425930
  init_think_back();
425622
425931
  init_thinkback_play2();
@@ -425777,6 +426086,7 @@ var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteCo
425777
426086
  stickers_default,
425778
426087
  tag_default,
425779
426088
  collab_default,
426089
+ discuss_default,
425780
426090
  team_default,
425781
426091
  theme_default,
425782
426092
  websearch_default,
@@ -428852,7 +429162,7 @@ __export(filesystem_exports, {
428852
429162
  toPosixPath: () => toPosixPath
428853
429163
  });
428854
429164
  import { randomBytes as randomBytes21 } from "crypto";
428855
- import { homedir as homedir43, tmpdir as tmpdir14 } from "os";
429165
+ import { homedir as homedir44, tmpdir as tmpdir14 } from "os";
428856
429166
  import { join as join168, normalize as normalize17, posix as posix8, sep as sep37 } from "path";
428857
429167
  function normalizeCaseForComparison2(path28) {
428858
429168
  return path28.toLowerCase();
@@ -428864,7 +429174,7 @@ function getClaudeSkillScope(filePath) {
428864
429174
  prefix: "/.sema/skills/"
428865
429175
  },
428866
429176
  {
428867
- dir: expandPath(join168(homedir43(), ".sema", "skills")),
429177
+ dir: expandPath(join168(homedir44(), ".sema", "skills")),
428868
429178
  prefix: "~/.sema/skills/"
428869
429179
  }
428870
429180
  ];
@@ -429103,7 +429413,7 @@ function patternWithRoot(pattern, source) {
429103
429413
  if (pattern.startsWith(`~${DIR_SEP}`))
429104
429414
  return {
429105
429415
  relativePattern: pattern.slice(1),
429106
- root: homedir43().normalize("NFC")
429416
+ root: homedir44().normalize("NFC")
429107
429417
  };
429108
429418
  if (pattern.startsWith(DIR_SEP))
429109
429419
  return {
@@ -450301,7 +450611,7 @@ var WORKTREE_PARENT, init_git_worktree_env = __esm({
450301
450611
  });
450302
450612
 
450303
450613
  // node_modules/@sema-agent/core/dist/core/memory-engine/layout.js
450304
- 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";
450305
450615
  var O_WRONLY, O_CREAT, O_TRUNC, O_NOFOLLOW3, O_EXCL, init_layout = __esm({
450306
450616
  "node_modules/@sema-agent/core/dist/core/memory-engine/layout.js"() {
450307
450617
  ({ O_WRONLY, O_CREAT, O_TRUNC, O_NOFOLLOW: O_NOFOLLOW3, O_EXCL } = fsConstants8);
@@ -458819,8 +459129,11 @@ var init_caCertsConfig = __esm({
458819
459129
  // build-src/src/utils/managedEnv.ts
458820
459130
  var managedEnv_exports = {};
458821
459131
  __export(managedEnv_exports, {
459132
+ PROJECT_FORBIDDEN_ENV_VARS: () => PROJECT_FORBIDDEN_ENV_VARS,
458822
459133
  applyConfigEnvironmentVariables: () => applyConfigEnvironmentVariables,
458823
- applySafeConfigEnvironmentVariables: () => applySafeConfigEnvironmentVariables
459134
+ applySafeConfigEnvironmentVariables: () => applySafeConfigEnvironmentVariables,
459135
+ stripUntrustedCapabilityEnv: () => stripUntrustedCapabilityEnv,
459136
+ trustedCapabilityEnv: () => trustedCapabilityEnv
458824
459137
  });
458825
459138
  function withoutSSHTunnelVars(env5) {
458826
459139
  if (!env5 || !process.env.ANTHROPIC_UNIX_SOCKET) return env5 || {};
@@ -458866,14 +459179,48 @@ function applySafeConfigEnvironmentVariables() {
458866
459179
  process.env,
458867
459180
  filterSettingsEnv(getSettingsForSource("policySettings")?.env)
458868
459181
  );
458869
- 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
+ );
458870
459186
  for (let [key, value] of Object.entries(settingsEnv4))
458871
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;
458872
459211
  }
458873
459212
  function applyConfigEnvironmentVariables() {
458874
- 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();
458875
459222
  }
458876
- var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, init_managedEnv = __esm({
459223
+ var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, PROJECT_FORBIDDEN_ENV_VARS, init_managedEnv = __esm({
458877
459224
  "build-src/src/utils/managedEnv.ts"() {
458878
459225
  init_syncCache();
458879
459226
  init_caCerts();
@@ -458889,6 +459236,24 @@ var ccdSpawnEnvKeys, TRUSTED_SETTING_SOURCES, init_managedEnv = __esm({
458889
459236
  "flagSettings",
458890
459237
  "policySettings"
458891
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
+ ]);
458892
459257
  }
458893
459258
  });
458894
459259
 
@@ -459113,7 +459478,7 @@ __export(upstreamproxy_exports, {
459113
459478
  resetUpstreamProxyForTests: () => resetUpstreamProxyForTests
459114
459479
  });
459115
459480
  import { mkdir as mkdir45, readFile as readFile53, unlink as unlink26, writeFile as writeFile46 } from "fs/promises";
459116
- import { homedir as homedir44 } from "os";
459481
+ import { homedir as homedir45 } from "os";
459117
459482
  import { join as join177 } from "path";
459118
459483
  async function initUpstreamProxy(opts) {
459119
459484
  if (!isEnvTruthy(process.env.SEMA_CODE_REMOTE) || !isEnvTruthy(process.env.CCR_UPSTREAM_PROXY_ENABLED))
@@ -459128,7 +459493,7 @@ async function initUpstreamProxy(opts) {
459128
459493
  if (!token)
459129
459494
  return logForDebugging("[upstreamproxy] no session token file; proxy disabled"), state3;
459130
459495
  setNonDumpable();
459131
- 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");
459132
459497
  if (!await downloadCaBundle(
459133
459498
  baseUrl,
459134
459499
  opts?.systemCaPath ?? SYSTEM_CA_BUNDLE,
@@ -462607,6 +462972,66 @@ var import_compiler_runtime243, import_jsx_runtime365, init_WorkerPendingPermiss
462607
462972
  }
462608
462973
  });
462609
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
+
462610
463035
  // build-src/src/hooks/useLogMessages.ts
462611
463036
  function useLogMessages(messages, ignore6 = !1) {
462612
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);
@@ -472593,7 +473018,7 @@ var import_compiler_runtime255, import_jsx_runtime383, init_ShowInIDEPrompt = __
472593
473018
  });
472594
473019
 
472595
473020
  // build-src/src/components/permissions/FilePermissionDialog/permissionOptions.tsx
472596
- import { homedir as homedir45 } from "os";
473021
+ import { homedir as homedir46 } from "os";
472597
473022
  import { basename as basename56, join as join181, sep as sep39 } from "path";
472598
473023
  function isInClaudeFolder(filePath) {
472599
473024
  let absolutePath = expandPath(filePath), claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`), normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath), normalizedClaudeFolderPath = normalizeCaseForComparison2(claudeFolderPath);
@@ -472601,7 +473026,7 @@ function isInClaudeFolder(filePath) {
472601
473026
  normalizedAbsolutePath.startsWith(normalizedClaudeFolderPath + "/");
472602
473027
  }
472603
473028
  function isInGlobalClaudeFolder(filePath) {
472604
- 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);
472605
473030
  return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep39.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
472606
473031
  }
472607
473032
  function getFilePermissionOptions({
@@ -481801,41 +482226,6 @@ var import_compiler_runtime284, import_react256, import_jsx_runtime427, init_Thi
481801
482226
  }
481802
482227
  });
481803
482228
 
481804
- // build-src/src/utils/teamDiscovery.ts
481805
- function getTeammateStatuses(teamName) {
481806
- let teamFile = readTeamFile(teamName);
481807
- if (!teamFile)
481808
- return [];
481809
- let hiddenPaneIds = new Set(teamFile.hiddenPaneIds ?? []), statuses = [];
481810
- for (let member of teamFile.members) {
481811
- if (member.name === "team-lead")
481812
- continue;
481813
- let status3 = member.isActive !== !1 ? "running" : "idle";
481814
- statuses.push({
481815
- name: member.name,
481816
- agentId: member.agentId,
481817
- agentType: member.agentType,
481818
- model: member.model,
481819
- prompt: member.prompt,
481820
- status: status3,
481821
- color: member.color,
481822
- tmuxPaneId: member.tmuxPaneId,
481823
- cwd: member.cwd,
481824
- worktreePath: member.worktreePath,
481825
- isHidden: hiddenPaneIds.has(member.tmuxPaneId),
481826
- backendType: member.backendType && isPaneBackend(member.backendType) ? member.backendType : void 0,
481827
- mode: member.mode
481828
- });
481829
- }
481830
- return statuses;
481831
- }
481832
- var init_teamDiscovery = __esm({
481833
- "build-src/src/utils/teamDiscovery.ts"() {
481834
- init_types18();
481835
- init_teamHelpers();
481836
- }
481837
- });
481838
-
481839
482229
  // build-src/src/components/teams/TeamsDialog.tsx
481840
482230
  import { randomUUID as randomUUID43 } from "crypto";
481841
482231
  function TeamsDialog({
@@ -488558,7 +488948,7 @@ var SESSION_SCAN_INTERVAL_MS, DEFAULTS, runner, init_autoDream = __esm({
488558
488948
 
488559
488949
  // build-src/src/utils/cleanup.ts
488560
488950
  import * as fs14 from "fs/promises";
488561
- import { homedir as homedir46 } from "os";
488951
+ import { homedir as homedir47 } from "os";
488562
488952
  import { join as join183 } from "path";
488563
488953
  function getCleanupPeriodDays() {
488564
488954
  return (getSettings_DEPRECATED() || {}).cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
@@ -488873,7 +489263,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
488873
489263
  return;
488874
489264
  }
488875
489265
  logForDebugging("npm cache cleanup: starting");
488876
- 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();
488877
489267
  try {
488878
489268
  let cacache = await import("cacache"), cutoff = startTime - ONE_DAY_MS2, stream5 = cacache.ls.stream(npmCachePath), anthropicEntries = [];
488879
489269
  for await (let entry of stream5)
@@ -491236,8 +491626,8 @@ function processQueueIfReady({
491236
491626
  let cmd = dequeue(isMainThread);
491237
491627
  return executeInput([cmd]), { processed: !0 };
491238
491628
  }
491239
- let targetMode = next.mode, commands = dequeueAllMatching(
491240
- (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
491241
491631
  );
491242
491632
  return commands.length === 0 ? { processed: !1 } : (executeInput(commands), { processed: !0 });
491243
491633
  }
@@ -493135,6 +493525,52 @@ var import_react295, INBOX_POLL_INTERVAL_MS, init_useInboxPoller = __esm({
493135
493525
  }
493136
493526
  });
493137
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
+
493138
493574
  // build-src/src/sema/resumePendingReconcile.ts
493139
493575
  var resumePendingReconcile_exports = {};
493140
493576
  __export(resumePendingReconcile_exports, {
@@ -493434,10 +493870,10 @@ async function runQuestionPermissionRequestHooks(frame, getHookToolUseContext) {
493434
493870
  }
493435
493871
  return null;
493436
493872
  }
493437
- function buildQuestionToolUseConfirm(frame, getHookToolUseContext) {
493873
+ function buildQuestionToolUseConfirm(frame, getHookToolUseContext, setAppState) {
493438
493874
  let questionId = frame.questionId, questions = frame.questions ?? [], answerAndRelease = (answer) => {
493439
493875
  respondToQuestion(questionId, answer).then(() => {
493440
- notePlanReviewAnsweredIfDecisive(questionId, answer);
493876
+ notePlanReviewAnsweredIfDecisive(questionId, answer), setAppState && exitPlanModeIfApproved(questionId, answer, setAppState);
493441
493877
  }).catch(() => {
493442
493878
  });
493443
493879
  };
@@ -493472,21 +493908,22 @@ function buildQuestionToolUseConfirm(frame, getHookToolUseContext) {
493472
493908
  }
493473
493909
  function useLiveQuestionOverlay({
493474
493910
  setToolUseConfirmQueue,
493475
- getHookToolUseContext
493911
+ getHookToolUseContext,
493912
+ setAppState
493476
493913
  }) {
493477
493914
  (0, import_react296.useEffect)(() => {
493478
493915
  let completedBeforeDialog = /* @__PURE__ */ new Set(), seenQuestionIds = /* @__PURE__ */ new Set(), alive = !0, unsubscribe = onQuestionFrame((frame) => {
493479
493916
  if (frame.type === "question") {
493480
493917
  if (!frame.questions || frame.questions.length === 0 || seenQuestionIds.has(frame.questionId)) return;
493481
493918
  seenQuestionIds.add(frame.questionId);
493482
- let entry = buildQuestionToolUseConfirm(frame, getHookToolUseContext);
493919
+ let entry = buildQuestionToolUseConfirm(frame, getHookToolUseContext, setAppState);
493483
493920
  (async () => {
493484
493921
  let decision = await runQuestionPermissionRequestHooks(frame, getHookToolUseContext);
493485
493922
  if (!completedBeforeDialog.has(frame.questionId)) {
493486
493923
  if (decision?.behavior === "allow") {
493487
493924
  let updated = decision.updatedInput, wireAnswer = questionAnswersToWire(frame.questions ?? [], updated?.answers, updated?.annotations);
493488
493925
  respondToQuestion(frame.questionId, wireAnswer).then(() => {
493489
- notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer);
493926
+ notePlanReviewAnsweredIfDecisive(frame.questionId, wireAnswer), setAppState && exitPlanModeIfApproved(frame.questionId, wireAnswer, setAppState);
493490
493927
  }).catch(() => {
493491
493928
  });
493492
493929
  return;
@@ -493520,6 +493957,7 @@ var import_react296, init_useLiveQuestionOverlay = __esm({
493520
493957
  init_messages4();
493521
493958
  init_dist();
493522
493959
  init_armedGateRegistry2();
493960
+ init_planReviewModeExit();
493523
493961
  init_resumePendingReconcile();
493524
493962
  }
493525
493963
  });
@@ -496758,7 +497196,7 @@ function _temp158() {
496758
497196
  }
496759
497197
  var import_compiler_runtime308, import_react313, SETTINGS_ERRORS_NOTIFICATION_KEY, init_useSettingsErrors = __esm({
496760
497198
  "build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
496761
- import_compiler_runtime308 = __toESM(require_compiler_runtime(), 1), import_react313 = __toESM(require_react(), 1);
497199
+ import_compiler_runtime308 = __toESM(require_compiler_runtime()), import_react313 = __toESM(require_react());
496762
497200
  init_notifications2();
496763
497201
  init_state();
496764
497202
  init_allErrors();
@@ -499598,9 +500036,12 @@ function REPL({
499598
500036
  }
499599
500037
  rawSetMessages(next);
499600
500038
  }, []);
499601
- (0, import_react332.useEffect)(() => registerTranscriptSystemNoticeSink((text2) => {
499602
- setMessages((prev) => [...prev, createSystemMessage(text2, "warning")]);
499603
- }), [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]);
499604
500045
  let setUserInputOnProcessing = (0, import_react332.useCallback)((input) => {
499605
500046
  input !== void 0 ? (userInputBaselineRef.current = messagesRef.current.length, userMessagePendingRef.current = !0) : userMessagePendingRef.current = !1, setUserInputOnProcessingRaw(input);
499606
500047
  }, []), {
@@ -500998,7 +501439,9 @@ ${fileList}`);
500998
501439
  let getHookToolUseContext = (0, import_react332.useCallback)(() => getToolUseContext(messagesRef.current, [], new AbortController(), mainLoopModel), [getToolUseContext, mainLoopModel]);
500999
501440
  useLiveQuestionOverlay({
501000
501441
  setToolUseConfirmQueue,
501001
- getHookToolUseContext
501442
+ getHookToolUseContext,
501443
+ // #266:plan 卡 approve 后退出壳本地 plan 模式(rc.47 挂账的 app-state seam 只有这一层有)。
501444
+ setAppState
501002
501445
  }), useMailboxBridge({
501003
501446
  isLoading,
501004
501447
  onSubmitMessage: handleIncomingPrompt
@@ -501531,6 +501974,7 @@ var import_compiler_runtime325, React175, import_react332, import_jsx_runtime478
501531
501974
  init_LocalAgentTask();
501532
501975
  init_leaderPermissionBridge();
501533
501976
  init_transcriptSystemNotice();
501977
+ init_ccImportBootRun();
501534
501978
  init_sessionTracing();
501535
501979
  init_useLogMessages();
501536
501980
  init_useReplBridge();
@@ -509658,7 +510102,7 @@ var lastMemoryMessageUuid, initSessionMemoryConfigIfNeeded, hasLoggedGateFailure
509658
510102
 
509659
510103
  // build-src/src/utils/iTermBackup.ts
509660
510104
  import { copyFile as copyFile11, stat as stat50 } from "fs/promises";
509661
- import { homedir as homedir47 } from "os";
510105
+ import { homedir as homedir48 } from "os";
509662
510106
  import { join as join193 } from "path";
509663
510107
  function markITerm2SetupComplete() {
509664
510108
  saveGlobalConfig((current5) => ({
@@ -509675,7 +510119,7 @@ function getIterm2RecoveryInfo() {
509675
510119
  }
509676
510120
  function getITerm2PlistPath() {
509677
510121
  return join193(
509678
- homedir47(),
510122
+ homedir48(),
509679
510123
  "Library",
509680
510124
  "Preferences",
509681
510125
  "com.googlecode.iterm2.plist"
@@ -510114,7 +510558,7 @@ var STDOUT_GUARD_MARKER, installed2, buffer4, originalWrite, init_streamJsonStdo
510114
510558
 
510115
510559
  // build-src/src/sema/config/mcpChannels.ts
510116
510560
  import { readFileSync as readFileSync49 } from "node:fs";
510117
- import { homedir as homedir48 } from "node:os";
510561
+ import { homedir as homedir49 } from "node:os";
510118
510562
  import { join as join194 } from "node:path";
510119
510563
  function mcpTransportOf(config4) {
510120
510564
  let c2 = config4;
@@ -510160,9 +510604,9 @@ function externalEntryToConfig(e) {
510160
510604
  };
510161
510605
  }
510162
510606
  function detectMcpChannels() {
510163
- 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;
510164
510608
  settingsServers && typeof settingsServers == "object" && Object.assign(merged, settingsServers);
510165
- let globalServers = readJsoncSafe(join194(homedir48(), CC_GLOBAL_FILE2))?.mcpServers;
510609
+ let globalServers = readJsoncSafe(join194(homedir49(), CC_GLOBAL_FILE2))?.mcpServers;
510166
510610
  globalServers && typeof globalServers == "object" && Object.assign(merged, globalServers), Object.keys(merged).length > 0 && out6.push({ channel: "claude-code", label: CC_BRAND, servers: merged });
510167
510611
  for (let [channel, detected] of [
510168
510612
  ["openclaw", detectOpenclawMcp()],
@@ -510248,23 +510692,23 @@ var CC_DIR5, CC_GLOBAL_FILE2, MCP_SCOPE_LABELS, init_mcpChannels = __esm({
510248
510692
  });
510249
510693
 
510250
510694
  // build-src/src/sema/importSources.ts
510251
- 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";
510252
510696
  import { createHash as createHash29 } from "node:crypto";
510253
- import { homedir as homedir49 } from "node:os";
510697
+ import { homedir as homedir50 } from "node:os";
510254
510698
  import { dirname as dirname89, join as join195, resolve as resolve49, sep as sep42 } from "node:path";
510255
510699
  function toSafeName(raw2) {
510256
510700
  return raw2.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "item";
510257
510701
  }
510258
510702
  function safeReaddirFiles(dir, ext) {
510259
510703
  try {
510260
- 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);
510261
510705
  } catch {
510262
510706
  return [];
510263
510707
  }
510264
510708
  }
510265
510709
  function hasNamespacedSubdirs(dir) {
510266
510710
  try {
510267
- 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);
510268
510712
  } catch {
510269
510713
  return [];
510270
510714
  }
@@ -510444,7 +510888,7 @@ function hasShellExecMarker(body) {
510444
510888
  return /!\{[^}]+\}/.test(body) || /!`[^`]*`/.test(body);
510445
510889
  }
510446
510890
  function codexRoot() {
510447
- return process.env.SEMA_CODEX_ROOT || join195(homedir49(), ".codex");
510891
+ return process.env.SEMA_CODEX_ROOT || join195(homedir50(), ".codex");
510448
510892
  }
510449
510893
  function codexDetect() {
510450
510894
  let root2 = codexRoot();
@@ -510519,7 +510963,7 @@ async function codexScan() {
510519
510963
  return { items, unmappable };
510520
510964
  }
510521
510965
  function geminiRoot() {
510522
- return process.env.SEMA_GEMINI_ROOT || join195(homedir49(), ".gemini");
510966
+ return process.env.SEMA_GEMINI_ROOT || join195(homedir50(), ".gemini");
510523
510967
  }
510524
510968
  function geminiDetect() {
510525
510969
  let root2 = geminiRoot();
@@ -510632,7 +511076,7 @@ async function geminiScan() {
510632
511076
  return { items, unmappable };
510633
511077
  }
510634
511078
  function claudeRoot() {
510635
- return process.env.SEMA_CC_ROOT || join195(homedir49(), SEMA_SOURCE_DIR);
511079
+ return process.env.SEMA_CC_ROOT || join195(homedir50(), SEMA_SOURCE_DIR);
510636
511080
  }
510637
511081
  function claudeDetect() {
510638
511082
  let root2 = claudeRoot();
@@ -510755,7 +511199,7 @@ __export(cmd_import_exports, {
510755
511199
  default: () => cmd_import_default,
510756
511200
  runImportNonInteractive: () => runImportNonInteractive
510757
511201
  });
510758
- function plural4(n2, word) {
511202
+ function plural5(n2, word) {
510759
511203
  return n2 === 1 ? word : `${word}s`;
510760
511204
  }
510761
511205
  function allItems(scans) {
@@ -510766,13 +511210,13 @@ function allUnmappable(scans) {
510766
511210
  }
510767
511211
  function formatPreview(scans, from, digest, warnings) {
510768
511212
  let items = allItems(scans), unmappable = allUnmappable(scans), sourceNames = scans.map((s) => s.displayName).join(" and "), lines = [
510769
- `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}).`,
510770
511214
  ...warnings
510771
511215
  ];
510772
511216
  for (let item of items)
510773
511217
  lines.push(` [${item.source}] ${item.label} (${item.kind})`);
510774
511218
  if (unmappable.length > 0) {
510775
- 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:`);
510776
511220
  for (let u of unmappable)
510777
511221
  lines.push(` \u26A0 [${u.source}] ${u.label}: ${u.reason}`);
510778
511222
  }
@@ -510792,8 +511236,8 @@ async function applyScans(scans, dryRun, warnings) {
510792
511236
  } catch (e) {
510793
511237
  resultLines.push(` \u2717 ${item.label}: ${e instanceof Error ? e.message : String(e)}`);
510794
511238
  }
510795
- let header = dryRun ? `Dry run \u2014 would import ${imported} ${plural4(imported, "item")}:` : `Imported ${imported} ${plural4(imported, "item")}:`, footer = [...warnings];
510796
- 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(`
510797
511241
  `);
510798
511242
  }
510799
511243
  async function handleImport(argsRaw) {
@@ -510889,6 +511333,10 @@ async function tryPrintLocalCommand(objective, deps2 = {}) {
510889
511333
  let result = await (await (await Promise.resolve().then(() => (init_agents2(), agents_exports2))).default.load()).call();
510890
511334
  return result.type === "text" ? result.value : null;
510891
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
+ }
510892
511340
  return null;
510893
511341
  }
510894
511342
  var MCP_USAGE, MCP_NONE, MCP_CONTROLS_UNAVAILABLE, MODEL_HELP_TOKENS, init_printLocalCommands = __esm({
@@ -511948,8 +512396,8 @@ function resolveAgentModel(opts = {}) {
511948
512396
  let deps2 = { ...defaultDeps, ...opts.deps }, env5 = opts.env ?? process.env, envRaw = normalize19(env5.SEMA_SUBAGENT_MODEL) ?? normalize19(env5.SEMA_CODE_SUBAGENT_MODEL);
511949
512397
  if (envRaw && envRaw.toLowerCase() !== "inherit")
511950
512398
  return resolveWord(envRaw, "env", deps2);
511951
- let call77 = normalize19(opts.callParam);
511952
- if (call77) return resolveWord(call77, "call", deps2);
512399
+ let call78 = normalize19(opts.callParam);
512400
+ if (call78) return resolveWord(call78, "call", deps2);
511953
512401
  let fm = normalize19(opts.frontmatterModel);
511954
512402
  return fm ? resolveWord(fm, "frontmatter", deps2) : { model: "inherit", source: "main", kind: "inherit" };
511955
512403
  }
@@ -517299,7 +517747,7 @@ __export(claudeDesktop_exports, {
517299
517747
  readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers
517300
517748
  });
517301
517749
  import { readdir as readdir33, readFile as readFile58, stat as stat52 } from "fs/promises";
517302
- import { homedir as homedir50 } from "os";
517750
+ import { homedir as homedir51 } from "os";
517303
517751
  import { join as join198 } from "path";
517304
517752
  async function getClaudeDesktopConfigPath() {
517305
517753
  let platform4 = getPlatform();
@@ -517309,7 +517757,7 @@ async function getClaudeDesktopConfigPath() {
517309
517757
  );
517310
517758
  if (platform4 === "macos")
517311
517759
  return join198(
517312
- homedir50(),
517760
+ homedir51(),
517313
517761
  "Library",
517314
517762
  "Application Support",
517315
517763
  "Claude",
@@ -517794,18 +518242,18 @@ __export(adoptionGuard_exports, {
517794
518242
  countLocalSessionArtifacts: () => countLocalSessionArtifacts,
517795
518243
  remoteSwitchSessionNotice: () => remoteSwitchSessionNotice
517796
518244
  });
517797
- import { readdirSync as readdirSync13, existsSync as existsSync34 } from "node:fs";
518245
+ import { readdirSync as readdirSync14, existsSync as existsSync34 } from "node:fs";
517798
518246
  import { join as join199 } from "node:path";
517799
518247
  function countLocalSessionArtifacts() {
517800
518248
  let census = { projects: 0, sessions: 0 };
517801
518249
  try {
517802
518250
  let root2 = getProjectsDir();
517803
518251
  if (!existsSync34(root2)) return census;
517804
- for (let entry of readdirSync13(root2, { withFileTypes: !0 })) {
518252
+ for (let entry of readdirSync14(root2, { withFileTypes: !0 })) {
517805
518253
  if (!entry.isDirectory()) continue;
517806
518254
  let n2 = 0;
517807
518255
  try {
517808
- 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;
517809
518257
  } catch {
517810
518258
  continue;
517811
518259
  }
@@ -519704,7 +520152,7 @@ __export(cloudResources_exports, {
519704
520152
  cloudResourceSync: () => cloudResourceSync
519705
520153
  });
519706
520154
  import { createHash as createHash30 } from "node:crypto";
519707
- 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";
519708
520156
  import { basename as basename69, dirname as dirname91, isAbsolute as isAbsolute34, join as join202, resolve as resolve50 } from "node:path";
519709
520157
  import { getEffective as getEffective2, getMeConfig, getScopeConfigDraft as getScopeConfigDraft2, OAuthFlowError as OAuthFlowError3, RegistryApiError as RegistryApiError3 } from "@sema-agent/sdk/registry";
519710
520158
  function fail4(e) {
@@ -520203,7 +520651,7 @@ async function loadLocalSkillEntries() {
520203
520651
  for (let root2 of roots) {
520204
520652
  let dirs = [];
520205
520653
  try {
520206
- dirs = readdirSync14(root2).filter((d4) => {
520654
+ dirs = readdirSync15(root2).filter((d4) => {
520207
520655
  try {
520208
520656
  return statSync16(join202(root2, d4)).isDirectory() && existsSync36(join202(root2, d4, "SKILL.md"));
520209
520657
  } catch {
@@ -524609,9 +525057,9 @@ var install_exports = {};
524609
525057
  __export(install_exports, {
524610
525058
  install: () => install
524611
525059
  });
524612
- import { homedir as homedir51 } from "node:os";
525060
+ import { homedir as homedir52 } from "node:os";
524613
525061
  function getInstallationPath2(realPath) {
524614
- let isWindows2 = env2.platform === "win32", homeDir = homedir51();
525062
+ let isWindows2 = env2.platform === "win32", homeDir = homedir52();
524615
525063
  return isWindows2 ? realPath.replace(/\//g, "\\") : realPath.startsWith(homeDir) ? `~${realPath.slice(homeDir.length)}` : realPath;
524616
525064
  }
524617
525065
  function SetupNotes(t0) {
@@ -525337,18 +525785,18 @@ var configSync_exports = {};
525337
525785
  __export(configSync_exports, {
525338
525786
  configSyncHandler: () => configSyncHandler
525339
525787
  });
525340
- import { homedir as homedir52 } from "node:os";
525788
+ import { homedir as homedir53 } from "node:os";
525341
525789
  import {
525342
525790
  copyFileSync as copyFileSync8,
525343
525791
  existsSync as existsSync38,
525344
525792
  mkdirSync as mkdirSync28,
525345
- readdirSync as readdirSync15,
525793
+ readdirSync as readdirSync16,
525346
525794
  readFileSync as readFileSync55,
525347
525795
  statSync as statSync18
525348
525796
  } from "node:fs";
525349
525797
  import { dirname as dirname95, join as join207, relative as relative37 } from "node:path";
525350
525798
  function display(p) {
525351
- let home = homedir52();
525799
+ let home = homedir53();
525352
525800
  return p.startsWith(home) ? "~" + p.slice(home.length) : p;
525353
525801
  }
525354
525802
  function filesEqual(a, b3) {
@@ -525463,7 +525911,7 @@ function syncTree(srcDir, destDir, labelBase, opts, report) {
525463
525911
  syncPlainFile(srcDir, destDir, labelBase, opts, report);
525464
525912
  return;
525465
525913
  }
525466
- for (let name of readdirSync15(srcDir)) {
525914
+ for (let name of readdirSync16(srcDir)) {
525467
525915
  let srcChild = join207(srcDir, name), destChild = join207(destDir, name), childStat;
525468
525916
  try {
525469
525917
  childStat = statSync18(srcChild);
@@ -525543,7 +525991,7 @@ async function configSyncHandler(opts) {
525543
525991
  }, dryTag = opts.dryRun ? source_default.yellow(" [dry-run]") : "";
525544
525992
  process.stdout.write(source_default.bold(`sema config sync${dryTag}
525545
525993
  `));
525546
- let userSrc = join207(homedir52(), LEGACY_DIR3), userDest = getClaudeConfigHomeDir();
525994
+ let userSrc = join207(homedir53(), LEGACY_DIR3), userDest = getClaudeConfigHomeDir();
525547
525995
  process.stdout.write(
525548
525996
  source_default.bold(`
525549
525997
  user: ${display(userSrc)} \u2192 ${display(userDest)}
@@ -525562,7 +526010,7 @@ user: ${display(userSrc)} \u2192 ${display(userDest)}
525562
526010
  opts,
525563
526011
  report
525564
526012
  );
525565
- let globalSrc = join207(homedir52(), LEGACY_GLOBAL_FILE), globalDest = getGlobalClaudeFile();
526013
+ let globalSrc = join207(homedir53(), LEGACY_GLOBAL_FILE), globalDest = getGlobalClaudeFile();
525566
526014
  if (existsSync38(globalSrc) && globalSrc !== globalDest && syncJsonFile(globalSrc, globalDest, display(globalDest), opts, report), flushEntries(report, userStart, opts), opts.project) {
525567
526015
  let projSrc = join207(process.cwd(), LEGACY_DIR3), projDest = join207(process.cwd(), ".sema");
525568
526016
  process.stdout.write(
@@ -525658,7 +526106,7 @@ __export(importCredentials_exports, {
525658
526106
  });
525659
526107
  import { execFileSync as execFileSync7 } from "node:child_process";
525660
526108
  import { readFileSync as readFileSync56 } from "node:fs";
525661
- import { homedir as homedir53, userInfo as userInfo4 } from "node:os";
526109
+ import { homedir as homedir54, userInfo as userInfo4 } from "node:os";
525662
526110
  import { join as join208 } from "node:path";
525663
526111
  function readCcKeychain() {
525664
526112
  if (process.platform !== "darwin") return null;
@@ -525681,7 +526129,7 @@ function readCcFile(ccRoot2) {
525681
526129
  }
525682
526130
  }
525683
526131
  async function importCredentialsHandler(opts) {
525684
- 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);
525685
526133
  if (!fromKeychain && !fromFile) {
525686
526134
  console.log(`No ${SOURCE_BRAND2} credentials found (checked keychain and ${ccRoot2}/.credentials.json).`), process.exitCode = 1;
525687
526135
  return;
@@ -527676,7 +528124,7 @@ var React192, import_jsx_runtime504, init_navStack = __esm({
527676
528124
 
527677
528125
  // build-src/src/sema/config/PluginsHub.tsx
527678
528126
  import { readFileSync as readFileSync57 } from "node:fs";
527679
- import { homedir as homedir54 } from "node:os";
528127
+ import { homedir as homedir55 } from "node:os";
527680
528128
  import { join as join209 } from "node:path";
527681
528129
  function listInstalledPluginRows() {
527682
528130
  let plugins = {};
@@ -527710,7 +528158,7 @@ function readJsonSafe(path28) {
527710
528158
  }
527711
528159
  }
527712
528160
  function detectCcPlugins() {
527713
- 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;
527714
528162
  if (pluginsField && typeof pluginsField == "object")
527715
528163
  for (let [id, v2] of Object.entries(pluginsField)) {
527716
528164
  let entry = Array.isArray(v2) ? v2[0] : v2;
@@ -528345,7 +528793,7 @@ var React194, import_jsx_runtime506, lastTierEditError, init_TiersHub = __esm({
528345
528793
  });
528346
528794
 
528347
528795
  // build-src/src/sema/config/skillsChannels.ts
528348
- 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";
528349
528797
  import { basename as basename72, dirname as dirname96, join as join210 } from "node:path";
528350
528798
  function skillsDirFor(source) {
528351
528799
  return source === "user" ? join210(getClaudeConfigHomeDir(), "skills") : join210(getCwd(), ".sema", "skills");
@@ -528392,7 +528840,7 @@ function listInstalledSkills() {
528392
528840
  for (let source of sources) {
528393
528841
  let dir = skillsDirFor(source), entries;
528394
528842
  try {
528395
- entries = readdirSync16(dir).filter((n2) => !n2.startsWith("."));
528843
+ entries = readdirSync17(dir).filter((n2) => !n2.startsWith("."));
528396
528844
  } catch {
528397
528845
  continue;
528398
528846
  }
@@ -529254,7 +529702,7 @@ function OnboardWizardBody({
529254
529702
  {
529255
529703
  layers: detected.layers,
529256
529704
  onDone: (summary) => {
529257
- summary !== null && flow.summary.push(summary), advance(i, nav);
529705
+ summary !== null ? flow.summary.push(summary) : writeCcImportDeclinedMarker(), advance(i, nav);
529258
529706
  }
529259
529707
  }
529260
529708
  )
@@ -530692,7 +531140,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
530692
531140
  pendingHookMessages
530693
531141
  }, renderAndRun);
530694
531142
  }
530695
- }).version("sema 1.0.81", "-v, --version", "Output the version number"), program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)"), program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."), canUserConfigureAdvisor() && program2.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp()), program2.addOption(new Option("--bg, --background", "Start the session as a background agent and return immediately (manage with `sema agents`)")), program2.command("ps").description("List background sessions").action(async () => {
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 () => {
530696
531144
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).psHandler([]), process.exit(process.exitCode ?? 0);
530697
531145
  }), program2.command("logs [id]").description("Print a background session's recent terminal output").action(async (id) => {
530698
531146
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).logsHandler(id, []), process.exit(process.exitCode ?? 0);
@@ -530700,7 +531148,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
530700
531148
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).attachHandler(id, []), process.exit(process.exitCode ?? 0);
530701
531149
  }), program2.command("kill [id]").description("Terminate a background session").action(async (id) => {
530702
531150
  await (await Promise.resolve().then(() => (init_bg2(), bg_exports))).killHandler(id, []), process.exit(process.exitCode ?? 0);
530703
- }), 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");
530704
531152
  let isPrintMode = process.argv.includes("-p") || process.argv.includes("--print"), isCcUrl = process.argv.some((a) => a.startsWith("cc://") || a.startsWith("cc+unix://"));
530705
531153
  if (isPrintMode && !isCcUrl)
530706
531154
  return profileCheckpoint("run_before_parse"), await program2.parseAsync(process.argv), profileCheckpoint("run_after_parse"), program2;
@@ -531211,7 +531659,7 @@ Usage: sema --remote "your task description"`, () => gracefulShutdown(1));
531211
531659
  let after = installedVersion2();
531212
531660
  console.log(`sema ${cur ?? "unknown"} \u2192 ${after ?? "unknown"}${cur === after ? " (forced reinstall, same version)" : ""}`);
531213
531661
  let { finalizeEngineSwapAfterUpdate: finalizeEngineSwapAfterUpdate2 } = await Promise.resolve().then(() => (init_semaUpdater(), semaUpdater_exports));
531214
- 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);
531215
531663
  }
531216
531664
  }
531217
531665
  let {
@@ -532305,7 +532753,7 @@ var TrustDialog_exports = {};
532305
532753
  __export(TrustDialog_exports, {
532306
532754
  TrustDialog: () => TrustDialog
532307
532755
  });
532308
- import { homedir as homedir55 } from "os";
532756
+ import { homedir as homedir56 } from "os";
532309
532757
  function TrustDialog(t0) {
532310
532758
  let $3 = (0, import_compiler_runtime350.c)(33), {
532311
532759
  onDone,
@@ -532336,7 +532784,7 @@ function TrustDialog(t0) {
532336
532784
  $3[11] !== commands ? (t11 = commands?.some(_temp437) ?? !1, $3[11] = commands, $3[12] = t11) : t11 = $3[12];
532337
532785
  let hasSkillsBash = t11, hasAnyBashExecution = bashSettingSources.length > 0 || hasSlashCommandBash || hasSkillsBash, hasTrustDialogAccepted = checkHasTrustDialogAccepted(), t12, t13;
532338
532786
  $3[13] !== hasAnyBashExecution ? (t12 = () => {
532339
- let isHomeDir = homedir55() === getCwd();
532787
+ let isHomeDir = homedir56() === getCwd();
532340
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);
532341
532789
  let t14;
532342
532790
  $3[16] !== hasAnyBashExecution || $3[17] !== onDone ? (t14 = function(value) {
@@ -532344,7 +532792,7 @@ function TrustDialog(t0) {
532344
532792
  gracefulShutdownSync(1);
532345
532793
  return;
532346
532794
  }
532347
- let isHomeDir_0 = homedir55() === getCwd();
532795
+ let isHomeDir_0 = homedir56() === getCwd();
532348
532796
  isHomeDir_0 ? setSessionTrustAccepted(!0) : saveCurrentProjectConfig(_temp523), onDone();
532349
532797
  }, $3[16] = hasAnyBashExecution, $3[17] = onDone, $3[18] = t14) : t14 = $3[18];
532350
532798
  let onChange = t14, exitState = useExitOnCtrlCDWithKeybindings(_temp619), t15;
@@ -533289,13 +533737,13 @@ __export(claudeImportHint_exports, {
533289
533737
  maybeEmitClaudeImportHint: () => maybeEmitClaudeImportHint
533290
533738
  });
533291
533739
  import { existsSync as existsSync40 } from "node:fs";
533292
- import { homedir as homedir56 } from "node:os";
533740
+ import { homedir as homedir57 } from "node:os";
533293
533741
  import { join as join212 } from "node:path";
533294
533742
  function shouldShowClaudeImportHint() {
533295
533743
  try {
533296
533744
  if (process.env.SEMA_CONFIG_DIR || process.env["CLAUDE_CONFIG_DIR"]) return !1;
533297
- let legacyDir = join212(homedir56(), ".claude");
533298
- 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);
533299
533747
  } catch {
533300
533748
  return !1;
533301
533749
  }
@@ -533689,7 +534137,7 @@ var init_schedulerDaemonWire = __esm({
533689
534137
  });
533690
534138
 
533691
534139
  // build-src/src/sema/scheduler/sessionReap.ts
533692
- 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";
533693
534141
  import { dirname as dirname99, join as join215 } from "node:path";
533694
534142
  function isSessionLifetimeRecord(r) {
533695
534143
  return r.lifetime === "session";
@@ -533743,7 +534191,7 @@ function removeSchedulerClaim(storePath, pid = process.pid) {
533743
534191
  function readAliveClaimedSessionIds(storePath, opts = {}) {
533744
534192
  let alive = opts.isPidAlive ?? pidAlive3, dir = schedulerClaimsDir(storePath), out6 = /* @__PURE__ */ new Set(), files2;
533745
534193
  try {
533746
- files2 = readdirSync17(dir);
534194
+ files2 = readdirSync18(dir);
533747
534195
  } catch {
533748
534196
  return out6;
533749
534197
  }
@@ -534227,11 +534675,11 @@ var init_skillsFill = __esm({
534227
534675
  });
534228
534676
 
534229
534677
  // build-src/src/sema/teamOnboarding.ts
534230
- import { existsSync as existsSync42, readdirSync as readdirSync18 } from "fs";
534678
+ import { existsSync as existsSync42, readdirSync as readdirSync19 } from "fs";
534231
534679
  function hasWorkspaceData() {
534232
534680
  try {
534233
534681
  let dir = getProjectsDir2();
534234
- return existsSync42(dir) ? readdirSync18(dir).length > 0 : !1;
534682
+ return existsSync42(dir) ? readdirSync19(dir).length > 0 : !1;
534235
534683
  } catch {
534236
534684
  return !1;
534237
534685
  }
@@ -535316,7 +535764,7 @@ __export(mcpFill_exports, {
535316
535764
  default: () => mcpFill_default,
535317
535765
  loadCanonicalMcpClients: () => loadCanonicalMcpClients
535318
535766
  });
535319
- import { homedir as homedir57 } from "os";
535767
+ import { homedir as homedir58 } from "os";
535320
535768
  import { readFileSync as readFileSync64 } from "fs";
535321
535769
  function builtinDynamicConfig(command8) {
535322
535770
  return { type: "stdio", command: command8, args: [], scope: "dynamic" };
@@ -535329,7 +535777,7 @@ function builtinDynamicClients() {
535329
535777
  }));
535330
535778
  }
535331
535779
  function canonicalGlobalConfigFile() {
535332
- return `${process.env.HOME ?? process.env.USERPROFILE ?? homedir57()}/.claude.json`;
535780
+ return `${process.env.HOME ?? process.env.USERPROFILE ?? homedir58()}/.claude.json`;
535333
535781
  }
535334
535782
  async function loadCanonicalMcpClients() {
535335
535783
  try {
@@ -537973,7 +538421,7 @@ async function launchReplProduction() {
537973
538421
  let offlineFallback = process.env.SEMA_LIVE_BASEURL ? "unknown" : "opus[1m]";
537974
538422
  initialState.mainLoopModel = resolved ?? offlineFallback;
537975
538423
  }
537976
- let bypassModeLaunch = !1, settingsRejectionNotices = [];
538424
+ let bypassModeLaunch = !1, settingsRejectionNotices = [], bootFailClosedNotices = [];
537977
538425
  try {
537978
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;
537979
538427
  try {
@@ -537985,15 +538433,16 @@ async function launchReplProduction() {
537985
538433
  () => getInitialSettings2()?.permissions?.disableBypassPermissionsMode,
537986
538434
  () => mdmMod.filterManagedPolicyErrors(getSettingsWithErrors2().errors)
537987
538435
  );
537988
- settingsDisableBypass = verdict.disable, verdict.loudReason && process.stderr.write(
537989
- `[sema] bypassPermissions kept unavailable (fail-closed): ${verdict.loudReason}
537990
- `
537991
- );
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
+ }
537992
538441
  } catch (e) {
537993
- settingsDisableBypass = !0, process.stderr.write(
537994
- `[sema] settings read failed \u2014 bypassPermissions kept unavailable (fail-closed): ${e instanceof Error ? e.message : String(e)}
537995
- `
537996
- );
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);
537997
538446
  }
537998
538447
  let isBypassPermissionsModeAvailable = (launchMode === "bypassPermissions" || allowDangerouslySkipPermissions) && !settingsDisableBypass, tpc = initialState.toolPermissionContext;
537999
538448
  launchMode && (tpc.mode = launchMode), tpc.isBypassPermissionsModeAvailable = isBypassPermissionsModeAvailable, bypassModeLaunch = isBypassPermissionsModeAvailable;
@@ -538009,11 +538458,9 @@ async function launchReplProduction() {
538009
538458
  try {
538010
538459
  let deadRules = unenforceableSettingsRules(fullWire);
538011
538460
  if (deadRules.length > 0) {
538012
- let shown = deadRules.slice(0, 5).map((r) => JSON.stringify(r)).join(", "), more = deadRules.length > 5 ? ` (+${deadRules.length - 5} more)` : "";
538013
- process.stderr.write(
538014
- `[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
538015
- `
538016
- );
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);
538017
538464
  }
538018
538465
  } catch {
538019
538466
  }
@@ -538307,15 +538754,25 @@ async function launchReplProduction() {
538307
538754
  }
538308
538755
  let { launchRepl: launchRepl2 } = await Promise.resolve().then(() => (init_replLauncher(), replLauncher_exports)), { createSystemMessage: createSystemMessage3 } = await Promise.resolve().then(() => (init_messages4(), messages_exports2));
538309
538756
  try {
538310
- 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));
538311
538758
  settingsRejectionNotices = [
538312
538759
  ...settingsRejectionNotices,
538313
538760
  ...settingsLoudNoticesActive2(),
538314
- ...resolverLoudNoticesActive2()
538761
+ ...resolverLoudNoticesActive2(),
538762
+ ...bootFailClosedNotices,
538763
+ ...permissionsLoaderLoudNoticesActive2()
538315
538764
  ];
538316
538765
  } catch (eN) {
538317
538766
  process.env.SEMA_DEBUG && console.error("[sema] settings notices merge soft-failed:", eN);
538318
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
+ }
538319
538776
  await launchRepl2(
538320
538777
  root2,
538321
538778
  {