@wrongstack/cli 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{acp-T77EAEDB.js → acp-QLU7T5WX.js} +3 -3
  2. package/dist/{auth-M6LXZTDA.js → auth-AED7RW7D.js} +5 -5
  3. package/dist/{automation-MCDFCIMV.js → automation-3E3AUPBF.js} +19 -4
  4. package/dist/{boot-auto-thin-YMAZI3QL.js → boot-auto-thin-AGJ6TAWY.js} +3 -3
  5. package/dist/{chunk-4BX2YDTQ.js → chunk-4JMAWKLA.js} +45 -4
  6. package/dist/{chunk-TWSQTQKR.js → chunk-4R6TVMYA.js} +2 -2
  7. package/dist/{chunk-HHRYIDOW.js → chunk-ACW64W4M.js} +34 -7
  8. package/dist/{chunk-LKFKO4JW.js → chunk-B6EHK772.js} +2 -2
  9. package/dist/{chunk-4UWCMBPG.js → chunk-BJH44J7G.js} +3 -3
  10. package/dist/{chunk-6Z6C6ZHH.js → chunk-GF7LUWQS.js} +4 -10
  11. package/dist/{chunk-TXAFIERF.js → chunk-L5NWFP5R.js} +2 -2
  12. package/dist/{chunk-LDXXMPMS.js → chunk-LPGZ3NUF.js} +20 -20
  13. package/dist/{chunk-GZSKLXYG.js → chunk-NEWXDNF2.js} +8 -8
  14. package/dist/{chunk-6SIUTX75.js → chunk-NOZJIN46.js} +1 -2
  15. package/dist/{chunk-KMU7GF7X.js → chunk-RE73FP2X.js} +2 -2
  16. package/dist/{chunk-LDV4ERNV.js → chunk-RYTSPBNM.js} +2 -2
  17. package/dist/{chunk-WTJDSTYD.js → chunk-T5KR6SNO.js} +2 -2
  18. package/dist/{chunk-ZYACRPLN.js → chunk-ULYAI7CP.js} +6 -3
  19. package/dist/{chunk-HLSHFXTO.js → chunk-WY74MMDB.js} +2 -2
  20. package/dist/{chunk-RWNI5OWT.js → chunk-ZWBI7ORM.js} +2 -2
  21. package/dist/{cli-context-II57EHD2.js → cli-context-I6HJCVCV.js} +76 -68
  22. package/dist/{cli-main-YR2WJCPL.js → cli-main-X7KD7IOC.js} +213 -153
  23. package/dist/{config-transfer-VOIFY7U4.js → config-transfer-YPD7HYXH.js} +6 -4
  24. package/dist/{execution-IBAZ2EIU.js → execution-M7D4KNBB.js} +37 -12
  25. package/dist/{hq-5OIEKB4V.js → hq-BBLGEEUH.js} +3 -3
  26. package/dist/{hq-server-DU3ZH3X7.js → hq-server-5TR6NBGS.js} +2 -2
  27. package/dist/{hq-service-LYZV7EK7.js → hq-service-4Q64WFNT.js} +2 -2
  28. package/dist/{import-claude-code-AYG24RG2.js → import-claude-code-GHIS2F7Y.js} +3 -3
  29. package/dist/index.js +4 -4
  30. package/dist/{mailbox-serve-S536N66F.js → mailbox-serve-DRWJVMYU.js} +2 -2
  31. package/dist/{modeldiag-NEPTLFZW.js → modeldiag-F3LUF4VJ.js} +3 -3
  32. package/dist/plugin-config.d.ts +6 -0
  33. package/dist/{plugin-usage-3TZGROK7.js → plugin-usage-EM752WHG.js} +3 -3
  34. package/dist/{plugins-ITH4SLO6.js → plugins-U6HQFJ7N.js} +4 -4
  35. package/dist/{providers-models-37DUV2GW.js → providers-models-S3S6VXME.js} +3 -3
  36. package/dist/{sage-FFKUOCQL.js → sage-BMRDJCDI.js} +9 -5
  37. package/dist/{sage-sync-ZMTHB477.js → sage-sync-PCWCNEUK.js} +2 -2
  38. package/dist/{sessions-config-VE26SB56.js → sessions-config-RQRQDW5Q.js} +2 -2
  39. package/dist/{short-circuit-flags-EXJBJ5GT.js → short-circuit-flags-IEV3FEOT.js} +2 -2
  40. package/dist/slash-commands/doctor.d.ts +0 -9
  41. package/dist/{standalone-auto-update-VQC4GYCM.js → standalone-auto-update-QUXOZ4B5.js} +13 -2
  42. package/dist/{subcommands-DTKBXLPU.js → subcommands-75IB23LS.js} +2 -2
  43. package/dist/{typesafe-NHC322W5.js → typesafe-KW2XHOG3.js} +2 -2
  44. package/dist/{update-6OEPAEUV.js → update-LHCWAWEZ.js} +2 -2
  45. package/dist/webui-server/credential-watcher.d.ts +3 -1
  46. package/dist/{webui-server-6IC3SLZG.js → webui-server-CUIFA25W.js} +5 -33
  47. package/dist/wiring/management-tools.d.ts +9 -1
  48. package/package.json +31 -31
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  appendHistory,
7
7
  backupCurrent
8
- } from "./chunk-4BX2YDTQ.js";
8
+ } from "./chunk-4JMAWKLA.js";
9
9
 
10
10
  // src/subcommands/handlers/config-transfer.ts
11
11
  import * as fs from "node:fs/promises";
@@ -44,7 +44,7 @@ var configImportCmd = async (_args, deps) => {
44
44
  const target = path.resolve(deps.cwd, FILE_NAME);
45
45
  let payload;
46
46
  try {
47
- payload = JSON.parse(await fs.readFile(target, "utf8"));
47
+ payload = JSON.parse((await fs.readFile(target, "utf8")).replace(/^\uFEFF/, ""));
48
48
  } catch (err) {
49
49
  deps.renderer.writeError(
50
50
  `Import failed: cannot read ${FILE_NAME} in ${deps.cwd} \u2014 ${toErrorMessage(err)}`
@@ -71,7 +71,9 @@ var configImportCmd = async (_args, deps) => {
71
71
  await withFileLock(profilePath, async () => {
72
72
  let disk = {};
73
73
  try {
74
- disk = JSON.parse(await fs.readFile(profilePath, "utf8"));
74
+ disk = JSON.parse(
75
+ (await fs.readFile(profilePath, "utf8")).replace(/^\uFEFF/, "")
76
+ );
75
77
  } catch (err) {
76
78
  if (err.code !== "ENOENT") throw err;
77
79
  }
@@ -117,4 +119,4 @@ export {
117
119
  configExportCmd,
118
120
  configImportCmd
119
121
  };
120
- //# sourceMappingURL=config-transfer-VOIFY7U4.js.map
122
+ //# sourceMappingURL=config-transfer-YPD7HYXH.js.map
@@ -6,7 +6,7 @@ import {
6
6
  runGit,
7
7
  setAutoSuggestions,
8
8
  setSuggestions
9
- } from "./chunk-6SIUTX75.js";
9
+ } from "./chunk-NOZJIN46.js";
10
10
  import {
11
11
  checkStructuredAnswer,
12
12
  parseOutputFormat,
@@ -43,23 +43,23 @@ import {
43
43
  import {
44
44
  deriveFsAccessPair,
45
45
  persistConfigSetting
46
- } from "./chunk-KMU7GF7X.js";
46
+ } from "./chunk-RE73FP2X.js";
47
47
  import {
48
48
  terminalLink,
49
49
  terminalText
50
50
  } from "./chunk-HXJYHAR4.js";
51
51
  import {
52
52
  resolveActiveApiKey
53
- } from "./chunk-ZYACRPLN.js";
53
+ } from "./chunk-ULYAI7CP.js";
54
54
  import {
55
55
  activeProfileConfigPath
56
56
  } from "./chunk-YMXXOOFN.js";
57
57
  import {
58
58
  backupCurrent
59
- } from "./chunk-4BX2YDTQ.js";
59
+ } from "./chunk-4JMAWKLA.js";
60
60
  import {
61
61
  startCliHqConnection
62
- } from "./chunk-4UWCMBPG.js";
62
+ } from "./chunk-BJH44J7G.js";
63
63
  import {
64
64
  CLI_VERSION
65
65
  } from "./chunk-F5DCFAKI.js";
@@ -68,6 +68,7 @@ import {
68
68
  import * as path14 from "node:path";
69
69
  import { setQueuedMessagesSnapshot as setQueuedMessagesSnapshot2 } from "@wrongstack/core/agent";
70
70
  import { LeaderAutoWakeController as LeaderAutoWakeController2 } from "@wrongstack/core/coordination";
71
+ import { activeLeaderEffort } from "@wrongstack/core/execution";
71
72
  import { noOpVault } from "@wrongstack/core/security";
72
73
  import { attachTodosCheckpoint as attachTodosCheckpoint2, QueueStore } from "@wrongstack/core/storage";
73
74
  import { normalizeTokenSavingTier as normalizeTokenSavingTier2 } from "@wrongstack/core/types";
@@ -928,6 +929,7 @@ import { restoreRequiredSkillsFromEvents } from "@wrongstack/core/skills";
928
929
  import { DefaultSessionStore } from "@wrongstack/core/storage";
929
930
  import {
930
931
  activateProjectStateGuard,
932
+ clearLeaderEffortOverride,
931
933
  resolveWstackPaths,
932
934
  sessionScopedPath
933
935
  } from "@wrongstack/core/utils";
@@ -1038,6 +1040,7 @@ async function switchProjectInPlace(ctx, targetRoot, displayName) {
1038
1040
  context.state.replaceMessages([]);
1039
1041
  resetSessionSubagentPolicy(context);
1040
1042
  restoreSessionPermissionOverrides(context.meta, {});
1043
+ clearLeaderEffortOverride(context.meta);
1041
1044
  restoreRequiredSkillsFromEvents(context, []);
1042
1045
  context.state.replaceTodos([]);
1043
1046
  context.clearFileTracking();
@@ -2049,6 +2052,7 @@ import { emitReviewIfChanged } from "@wrongstack/core/plugin";
2049
2052
 
2050
2053
  // src/chimera-cascade-evidence.ts
2051
2054
  import { spawn as spawn2 } from "node:child_process";
2055
+ import { treeKill } from "@wrongstack/core/utils/tree-kill";
2052
2056
  import {
2053
2057
  buildWin32CmdShimInvocation,
2054
2058
  isWinCmdShim,
@@ -2160,15 +2164,28 @@ var runCascadeVerificationCommand = (command, cwd, timeoutMs) => {
2160
2164
  cwd,
2161
2165
  stdio: "ignore",
2162
2166
  windowsHide: true,
2163
- signal: AbortSignal.timeout(timeoutMs),
2164
2167
  ...windowsVerbatimArguments ? { windowsVerbatimArguments } : {}
2165
2168
  });
2166
2169
  } catch {
2167
2170
  resolve5({ exitCode: CASCADE_EVIDENCE_RUN_ERROR_EXIT });
2168
2171
  return;
2169
2172
  }
2170
- child.on("error", () => resolve5({ exitCode: CASCADE_EVIDENCE_RUN_ERROR_EXIT }));
2171
- child.on("close", (code) => resolve5({ exitCode: code ?? CASCADE_EVIDENCE_RUN_ERROR_EXIT }));
2173
+ const spawned = child;
2174
+ let timedOut = false;
2175
+ const timer = setTimeout(() => {
2176
+ timedOut = true;
2177
+ treeKill(spawned);
2178
+ }, timeoutMs);
2179
+ child.on("error", () => {
2180
+ clearTimeout(timer);
2181
+ resolve5({ exitCode: CASCADE_EVIDENCE_RUN_ERROR_EXIT });
2182
+ });
2183
+ child.on("close", (code) => {
2184
+ clearTimeout(timer);
2185
+ resolve5({
2186
+ exitCode: timedOut ? CASCADE_EVIDENCE_RUN_ERROR_EXIT : code ?? CASCADE_EVIDENCE_RUN_ERROR_EXIT
2187
+ });
2188
+ });
2172
2189
  });
2173
2190
  };
2174
2191
  async function verifyCascadeEvidence(evidence, cwd, runCommand = runCascadeVerificationCommand, timeoutMs = CASCADE_EVIDENCE_COMMAND_TIMEOUT_MS) {
@@ -5207,7 +5224,7 @@ async function runWebUIDispatch(ctx) {
5207
5224
  const isSimpleUi = !isSessionChild && flags["simpleui"] === true;
5208
5225
  agent.disableInteractiveConfirmation();
5209
5226
  renderer.setSilent(true);
5210
- const { runWebUI } = await import("./webui-server-6IC3SLZG.js");
5227
+ const { runWebUI } = await import("./webui-server-CUIFA25W.js");
5211
5228
  const flagValue = (names) => {
5212
5229
  for (const name of names) {
5213
5230
  if (!Object.hasOwn(flags, name)) continue;
@@ -6433,7 +6450,12 @@ import { restoreSessionPermissionOverrides as restoreSessionPermissionOverrides2
6433
6450
  import { restoreRequiredSkillsFromEvents as restoreRequiredSkillsFromEvents2 } from "@wrongstack/core/skills";
6434
6451
  import { attachTodosCheckpoint, loadTodosCheckpoint } from "@wrongstack/core/storage";
6435
6452
  import { projectLastRequestTokens } from "@wrongstack/core/types/session-timeline";
6436
- import { sessionScopedPath as sessionScopedPath2, toErrorMessage as toErrorMessage4 } from "@wrongstack/core/utils";
6453
+ import {
6454
+ clearLeaderEffortOverride as clearLeaderEffortOverride2,
6455
+ restoreLeaderEffortOverride,
6456
+ sessionScopedPath as sessionScopedPath2,
6457
+ toErrorMessage as toErrorMessage4
6458
+ } from "@wrongstack/core/utils";
6437
6459
 
6438
6460
  // src/boot/tui-session-resume-contracts.ts
6439
6461
  function messageText(content) {
@@ -6617,6 +6639,8 @@ async function resumeSession(ctx, sessionId) {
6617
6639
  restoreSessionSubagentModelPlan(agent.ctx, resumed.data.events);
6618
6640
  restoreSessionPermissionOverrides2(agent.ctx.meta, resumed.data);
6619
6641
  restoreRequiredSkillsFromEvents2(agent.ctx, resumed.data.events);
6642
+ clearLeaderEffortOverride2(agent.ctx.meta);
6643
+ restoreLeaderEffortOverride(agent.ctx.meta, resumed.data.events);
6620
6644
  } catch (err) {
6621
6645
  agent.ctx.session = oldWriter;
6622
6646
  agent.ctx.state.replaceMessages(oldMessages);
@@ -7093,7 +7117,7 @@ async function execute(deps) {
7093
7117
  });
7094
7118
  }
7095
7119
  if (executionMode !== "single-shot" && !webuiSessionChild) {
7096
- autoUpdate = (await import("./standalone-auto-update-VQC4GYCM.js")).startStandaloneAutoUpdate({
7120
+ autoUpdate = (await import("./standalone-auto-update-QUXOZ4B5.js")).startStandaloneAutoUpdate({
7097
7121
  getConfig: () => configStore.get(),
7098
7122
  updateInfo: bootUpdateInfo
7099
7123
  });
@@ -7289,6 +7313,7 @@ async function execute(deps) {
7289
7313
  applyLiveSettings
7290
7314
  }),
7291
7315
  ...createThemeAdapter({ configStore, wpaths }),
7316
+ getLeaderEffort: () => activeLeaderEffort(context.meta, configStore.get().modelRuntime?.reasoning?.effort),
7292
7317
  configStore,
7293
7318
  effectiveMaxContext,
7294
7319
  titleAnimation: config.autonomy?.["terminalTitleAnimation"] ?? true,
@@ -7509,4 +7534,4 @@ export {
7509
7534
  execute,
7510
7535
  resolveReviewerFallbackModels
7511
7536
  };
7512
- //# sourceMappingURL=execution-IBAZ2EIU.js.map
7537
+ //# sourceMappingURL=execution-M7D4KNBB.js.map
@@ -316,7 +316,7 @@ var hqCmd = async (args, deps) => {
316
316
  return hqAlertsCmd(args.slice(1), deps);
317
317
  }
318
318
  if (sub === "service") {
319
- const { hqServiceCmd } = await import("./hq-service-LYZV7EK7.js");
319
+ const { hqServiceCmd } = await import("./hq-service-4Q64WFNT.js");
320
320
  return hqServiceCmd(args.slice(1), deps);
321
321
  }
322
322
  if (sub === "help" || sub === "--help") {
@@ -329,7 +329,7 @@ var hqCmd = async (args, deps) => {
329
329
  return 1;
330
330
  };
331
331
  async function startServer(deps) {
332
- const { startHqServer } = await import("./hq-server-DU3ZH3X7.js");
332
+ const { startHqServer } = await import("./hq-server-5TR6NBGS.js");
333
333
  const dataDir = resolveDataDir(deps);
334
334
  const flags = deps.flags ?? {};
335
335
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
@@ -1009,4 +1009,4 @@ function printTokenHelp(deps) {
1009
1009
  export {
1010
1010
  hqCmd
1011
1011
  };
1012
- //# sourceMappingURL=hq-5OIEKB4V.js.map
1012
+ //# sourceMappingURL=hq-BBLGEEUH.js.map
@@ -10,7 +10,7 @@ import {
10
10
  readLocalSubagentTranscript,
11
11
  sanitizeApiError,
12
12
  startHqServer
13
- } from "./chunk-6Z6C6ZHH.js";
13
+ } from "./chunk-GF7LUWQS.js";
14
14
  import "./chunk-HXJYHAR4.js";
15
15
  import "./chunk-AFOH6CHO.js";
16
16
  import "./chunk-Q7E3BPDU.js";
@@ -27,4 +27,4 @@ export {
27
27
  sanitizeApiError,
28
28
  startHqServer
29
29
  };
30
- //# sourceMappingURL=hq-server-DU3ZH3X7.js.map
30
+ //# sourceMappingURL=hq-server-5TR6NBGS.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  detectUpdatePackageManager,
6
6
  detectUpdatePackageName
7
- } from "./chunk-RWNI5OWT.js";
7
+ } from "./chunk-ZWBI7ORM.js";
8
8
  import "./chunk-BHXAKTBE.js";
9
9
  import "./chunk-DIOODAYM.js";
10
10
  import "./chunk-F5DCFAKI.js";
@@ -511,4 +511,4 @@ export {
511
511
  hqServiceCmd,
512
512
  renderHqServiceAssets
513
513
  };
514
- //# sourceMappingURL=hq-service-LYZV7EK7.js.map
514
+ //# sourceMappingURL=hq-service-4Q64WFNT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeMcpServerEntry
3
- } from "./chunk-HLSHFXTO.js";
3
+ } from "./chunk-WY74MMDB.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
@@ -156,7 +156,7 @@ async function readJson(file) {
156
156
  return void 0;
157
157
  }
158
158
  try {
159
- const parsed = JSON.parse(raw);
159
+ const parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
160
160
  return isRecord(parsed) ? parsed : void 0;
161
161
  } catch {
162
162
  throw new Error(`${file} is not valid JSON`);
@@ -265,4 +265,4 @@ export {
265
265
  planClaudeCodeImport,
266
266
  readClaudeCodeSources
267
267
  };
268
- //# sourceMappingURL=import-claude-code-AYG24RG2.js.map
268
+ //# sourceMappingURL=import-claude-code-GHIS2F7Y.js.map
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  applyNodeEnvDefault,
4
4
  applySessionShellDefault
5
- } from "./chunk-WTJDSTYD.js";
5
+ } from "./chunk-T5KR6SNO.js";
6
6
  import {
7
7
  parseArgs
8
8
  } from "./chunk-CJSHS2K7.js";
@@ -121,7 +121,7 @@ async function main(argv) {
121
121
  applyAsciiMode(earlyFlags);
122
122
  }
123
123
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
124
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-EXJBJ5GT.js");
124
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-IEV3FEOT.js");
125
125
  const earlyExit = await handleHelpVersionShortCircuit(argv);
126
126
  if (earlyExit !== null) return earlyExit;
127
127
  }
@@ -130,7 +130,7 @@ async function main(argv) {
130
130
  shouldCaptureTuiStartup(parsed.flags, parsed.positional)
131
131
  );
132
132
  try {
133
- const { initializeCli } = await import("./cli-context-II57EHD2.js");
133
+ const { initializeCli } = await import("./cli-context-I6HJCVCV.js");
134
134
  const cliCtx = await initializeCli(argv, {
135
135
  onNonTuiLaunch: () => startupOutput.stop()
136
136
  });
@@ -140,7 +140,7 @@ async function main(argv) {
140
140
  } else {
141
141
  startupOutput.stop();
142
142
  }
143
- const { runInteractive } = await import("./cli-main-YR2WJCPL.js");
143
+ const { runInteractive } = await import("./cli-main-X7KD7IOC.js");
144
144
  return await runInteractive(cliCtx);
145
145
  } finally {
146
146
  startupOutput.stop();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCliHqConnection
3
- } from "./chunk-4UWCMBPG.js";
3
+ } from "./chunk-BJH44J7G.js";
4
4
  import "./chunk-F5DCFAKI.js";
5
5
 
6
6
  // src/subcommands/handlers/mailbox-serve.ts
@@ -362,4 +362,4 @@ function printHelp(deps) {
362
362
  export {
363
363
  mailboxServeCmd
364
364
  };
365
- //# sourceMappingURL=mailbox-serve-S536N66F.js.map
365
+ //# sourceMappingURL=mailbox-serve-DRWJVMYU.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  applyProviderOAuthRefresh
3
- } from "./chunk-TWSQTQKR.js";
3
+ } from "./chunk-4R6TVMYA.js";
4
4
  import {
5
5
  discoverAndMergeProviders
6
6
  } from "./chunk-PA4VBCXS.js";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-YL4KCHZG.js";
21
21
  import {
22
22
  mutateConfigProviders
23
- } from "./chunk-ZYACRPLN.js";
23
+ } from "./chunk-ULYAI7CP.js";
24
24
  import {
25
25
  activeProfileConfigPath
26
26
  } from "./chunk-YMXXOOFN.js";
@@ -843,4 +843,4 @@ var modeldiagCmd = async (args, deps) => {
843
843
  export {
844
844
  modeldiagCmd
845
845
  };
846
- //# sourceMappingURL=modeldiag-NEPTLFZW.js.map
846
+ //# sourceMappingURL=modeldiag-F3LUF4VJ.js.map
@@ -1,5 +1,11 @@
1
1
  import type { PluginConfig } from '@wrongstack/core/types';
2
2
  import type { PluginManagementDeps, PluginManagementResult } from './plugin-management-types.js';
3
+ /**
4
+ * Read the profile config for a read-modify-write. Only a MISSING file reads as
5
+ * `{}`: callers write the result back over the whole profile, so treating an
6
+ * unreadable or corrupt file as empty wiped every provider, key and setting.
7
+ * A leading UTF-8 BOM is ignorable (RFC 8259) — the config loader accepts it.
8
+ */
3
9
  export declare function readConfig(file: string): Promise<Record<string, unknown>>;
4
10
  export declare function pluginName(p: string | PluginConfig): string;
5
11
  export declare function upsertPlugin(spec: string, opts: {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runPluginManagementCommand
3
- } from "./chunk-HHRYIDOW.js";
3
+ } from "./chunk-ACW64W4M.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
7
- import "./chunk-4BX2YDTQ.js";
7
+ import "./chunk-4JMAWKLA.js";
8
8
  import {
9
9
  restoreFlags
10
10
  } from "./chunk-CSAPOCBP.js";
@@ -41,4 +41,4 @@ export {
41
41
  pluginCmd,
42
42
  usageCmd
43
43
  };
44
- //# sourceMappingURL=plugin-usage-3TZGROK7.js.map
44
+ //# sourceMappingURL=plugin-usage-EM752WHG.js.map
@@ -7,10 +7,10 @@ import {
7
7
  pluginNameFromSpec,
8
8
  setupPlugins,
9
9
  warnIfDeprecatedPluginName
10
- } from "./chunk-LKFKO4JW.js";
10
+ } from "./chunk-B6EHK772.js";
11
11
  import "./chunk-EWKESL4L.js";
12
- import "./chunk-HHRYIDOW.js";
13
- import "./chunk-4BX2YDTQ.js";
12
+ import "./chunk-ACW64W4M.js";
13
+ import "./chunk-4JMAWKLA.js";
14
14
  export {
15
15
  BUILTIN_PLUGIN_FACTORIES,
16
16
  BUILTIN_PLUGIN_NAME_HINTS,
@@ -21,4 +21,4 @@ export {
21
21
  setupPlugins,
22
22
  warnIfDeprecatedPluginName
23
23
  };
24
- //# sourceMappingURL=plugins-ITH4SLO6.js.map
24
+ //# sourceMappingURL=plugins-U6HQFJ7N.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RKU66D2O.js";
4
4
  import {
5
5
  mutateConfigProviders
6
- } from "./chunk-ZYACRPLN.js";
6
+ } from "./chunk-ULYAI7CP.js";
7
7
  import {
8
8
  activeProfileConfigPath
9
9
  } from "./chunk-YMXXOOFN.js";
@@ -392,7 +392,7 @@ async function mutateModelsConfig(deps, mutator) {
392
392
  }
393
393
  let parsed;
394
394
  try {
395
- parsed = JSON.parse(raw);
395
+ parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
396
396
  } catch (err) {
397
397
  if (fileExists) {
398
398
  throw new ConfigError({
@@ -714,4 +714,4 @@ export {
714
714
  modelsCmd,
715
715
  providersCmd
716
716
  };
717
- //# sourceMappingURL=providers-models-37DUV2GW.js.map
717
+ //# sourceMappingURL=providers-models-S3S6VXME.js.map
@@ -152,7 +152,7 @@ function isSageConnected(target, opts) {
152
152
  return content.split(/\r?\n/).some((line) => isOwnedTomlHeader(line, opts.guide.serverName));
153
153
  }
154
154
  try {
155
- const servers = JSON.parse(content).mcpServers;
155
+ const servers = JSON.parse(stripJsonBom(content)).mcpServers;
156
156
  return typeof servers === "object" && servers !== null && opts.guide.serverName in servers;
157
157
  } catch {
158
158
  return false;
@@ -161,11 +161,14 @@ function isSageConnected(target, opts) {
161
161
  function jsonEntry(target, launch) {
162
162
  return target === "claude-code" ? { type: "stdio", command: launch.command, args: launch.args } : { command: launch.command, args: launch.args };
163
163
  }
164
+ function stripJsonBom(content) {
165
+ return content.replace(/^\uFEFF/, "");
166
+ }
164
167
  function parseJsonObject(content, absPath) {
165
168
  if (content === void 0 || content.trim() === "") return {};
166
169
  let parsed;
167
170
  try {
168
- parsed = JSON.parse(content);
171
+ parsed = JSON.parse(stripJsonBom(content));
169
172
  } catch (error) {
170
173
  throw new Error(
171
174
  `${absPath} is not valid JSON (${toErrorMessage(error)}); fix it by hand, nothing was changed.`
@@ -325,7 +328,8 @@ function findExecutableOnPath(cmd) {
325
328
  };
326
329
  if (cmd.includes("/") || cmd.includes("\\")) return exists(cmd) ? path2.resolve(cmd) : null;
327
330
  const suffixes = process.platform === "win32" && path2.extname(cmd) === "" ? (process.env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
328
- for (const dir of (process.env["PATH"] ?? "").split(path2.delimiter)) {
331
+ for (const rawDir of (process.env["PATH"] ?? "").split(path2.delimiter)) {
332
+ const dir = process.platform === "win32" ? rawDir.trim().replace(/^"|"$/g, "") : rawDir;
329
333
  if (!dir) continue;
330
334
  for (const suffix of suffixes) {
331
335
  const candidate = path2.join(dir, cmd + suffix);
@@ -383,7 +387,7 @@ var sageCmd = async (rawArgs, deps) => {
383
387
  const out = (line) => deps.renderer.write(`${line}
384
388
  `);
385
389
  if (sub === "sync") {
386
- const { runSageHqSyncCommand } = await import("./sage-sync-ZMTHB477.js");
390
+ const { runSageHqSyncCommand } = await import("./sage-sync-PCWCNEUK.js");
387
391
  return runSageHqSyncCommand(deps, args.includes("--restart-service"));
388
392
  }
389
393
  if (sub === "mcp") {
@@ -472,4 +476,4 @@ export {
472
476
  findExecutableOnPath,
473
477
  sageCmd
474
478
  };
475
- //# sourceMappingURL=sage-FFKUOCQL.js.map
479
+ //# sourceMappingURL=sage-BMRDJCDI.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCliHqConnection
3
- } from "./chunk-4UWCMBPG.js";
3
+ } from "./chunk-BJH44J7G.js";
4
4
  import "./chunk-F5DCFAKI.js";
5
5
 
6
6
  // src/subcommands/handlers/sage-sync.ts
@@ -66,4 +66,4 @@ async function runSageHqSyncCommand(deps, restartService, signal) {
66
66
  export {
67
67
  runSageHqSyncCommand
68
68
  };
69
- //# sourceMappingURL=sage-sync-ZMTHB477.js.map
69
+ //# sourceMappingURL=sage-sync-PCWCNEUK.js.map
@@ -7,7 +7,7 @@ import {
7
7
  listHistory,
8
8
  restoreFromHistory,
9
9
  restoreLast
10
- } from "./chunk-4BX2YDTQ.js";
10
+ } from "./chunk-4JMAWKLA.js";
11
11
  import {
12
12
  restoreFlags
13
13
  } from "./chunk-CSAPOCBP.js";
@@ -536,4 +536,4 @@ export {
536
536
  configCmd,
537
537
  sessionsCmd
538
538
  };
539
- //# sourceMappingURL=sessions-config-VE26SB56.js.map
539
+ //# sourceMappingURL=sessions-config-RQRQDW5Q.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  handleHelpVersionShortCircuit
3
- } from "./chunk-LDV4ERNV.js";
3
+ } from "./chunk-RYTSPBNM.js";
4
4
  import "./chunk-CJSHS2K7.js";
5
5
  import "./chunk-AKESWZH5.js";
6
6
  import "./chunk-F5DCFAKI.js";
7
7
  export {
8
8
  handleHelpVersionShortCircuit
9
9
  };
10
- //# sourceMappingURL=short-circuit-flags-EXJBJ5GT.js.map
10
+ //# sourceMappingURL=short-circuit-flags-IEV3FEOT.js.map
@@ -1,13 +1,4 @@
1
1
  import type { SlashCommand } from '@wrongstack/core/types';
2
2
  import type { SlashCommandContext } from './command-context.js';
3
- /**
4
- * `/doctor` — diagnose and auto-repair the persisted config files.
5
- *
6
- * Report mode (bare `/doctor`) never writes anything. `/doctor fix` backs the
7
- * file up first (config.json.last + a timestamped .bak, the same convention
8
- * config-history uses), then writes the repaired config and mirrors it into
9
- * the in-memory store. A config that fails to parse at all is restored from
10
- * the newest parsable backup.
11
- */
12
3
  export declare function buildDoctorCommand(opts: SlashCommandContext): SlashCommand;
13
4
  //# sourceMappingURL=doctor.d.ts.map
@@ -22,6 +22,7 @@ var PENDING_FILE = "pending.json";
22
22
  var APPLIED_FILE = "last-applied.json";
23
23
  var LOCK_FILE = "update.lock";
24
24
  var LOCK_STALE_MS = 45 * 6e4;
25
+ var LOCK_TORN_GRACE_MS = 3e4;
25
26
  var DOWNLOAD_TIMEOUT_MS = 30 * 6e4;
26
27
  function updatesDir(root = wstackGlobalRoot()) {
27
28
  return path.join(root, "updates");
@@ -81,7 +82,17 @@ function acquireLock(dir) {
81
82
  let owner = {};
82
83
  try {
83
84
  owner = JSON.parse(fs.readFileSync(lock, "utf8"));
84
- } catch {
85
+ } catch (readErr) {
86
+ const code = readErr.code;
87
+ if (code === "ENOENT") continue;
88
+ if (code !== void 0) return void 0;
89
+ let ageMs;
90
+ try {
91
+ ageMs = Date.now() - fs.statSync(lock).mtimeMs;
92
+ } catch {
93
+ continue;
94
+ }
95
+ if (ageMs < LOCK_TORN_GRACE_MS) return void 0;
85
96
  }
86
97
  const fresh = typeof owner.pid === "number" && pidAlive(owner.pid) && typeof owner.at === "number" && Date.now() - owner.at < LOCK_STALE_MS;
87
98
  if (fresh) return void 0;
@@ -246,4 +257,4 @@ export {
246
257
  startStandaloneAutoUpdate,
247
258
  takeAppliedUpdate
248
259
  };
249
- //# sourceMappingURL=standalone-auto-update-VQC4GYCM.js.map
260
+ //# sourceMappingURL=standalone-auto-update-QUXOZ4B5.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  subcommandNames,
3
3
  subcommands
4
- } from "./chunk-LDXXMPMS.js";
4
+ } from "./chunk-LPGZ3NUF.js";
5
5
  export {
6
6
  subcommandNames,
7
7
  subcommands
8
8
  };
9
- //# sourceMappingURL=subcommands-DTKBXLPU.js.map
9
+ //# sourceMappingURL=subcommands-75IB23LS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  maskedKey,
3
3
  mutateConfigProviders
4
- } from "./chunk-ZYACRPLN.js";
4
+ } from "./chunk-ULYAI7CP.js";
5
5
  import {
6
6
  activeProfileConfigPath
7
7
  } from "./chunk-YMXXOOFN.js";
@@ -340,4 +340,4 @@ async function lintConventions(deps, write) {
340
340
  export {
341
341
  typesafeCmd
342
342
  };
343
- //# sourceMappingURL=typesafe-NHC322W5.js.map
343
+ //# sourceMappingURL=typesafe-KW2XHOG3.js.map
@@ -3,7 +3,7 @@ import {
3
3
  detectUpdatePackageName,
4
4
  runUpdateCommand,
5
5
  updateCmd
6
- } from "./chunk-RWNI5OWT.js";
6
+ } from "./chunk-ZWBI7ORM.js";
7
7
  import "./chunk-BHXAKTBE.js";
8
8
  import "./chunk-DIOODAYM.js";
9
9
  import "./chunk-F5DCFAKI.js";
@@ -13,4 +13,4 @@ export {
13
13
  runUpdateCommand,
14
14
  updateCmd
15
15
  };
16
- //# sourceMappingURL=update-6OEPAEUV.js.map
16
+ //# sourceMappingURL=update-LHCWAWEZ.js.map
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Hot-reload provider credentials and routing configuration when config.json changes on disk.
2
+ * Refresh provider panels, routing configuration and the display language when
3
+ * config.json changes on disk. The live provider itself is rebuilt by the CLI
4
+ * host's provider-runtime watcher (see the note in the callback).
3
5
  *
4
6
  * @module webui-server/credential-watcher
5
7
  */