@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
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-NRXWOMK7.js";
11
11
  import {
12
12
  startCliHqConnection
13
- } from "./chunk-4UWCMBPG.js";
13
+ } from "./chunk-BJH44J7G.js";
14
14
  import "./chunk-SDJCLEK6.js";
15
15
  import "./chunk-F5DCFAKI.js";
16
16
 
@@ -1112,7 +1112,7 @@ var acpCmd = async (args, deps) => {
1112
1112
  const sub = args[0];
1113
1113
  const loginIndex = sub === "auth" ? 0 : (sub === "server" || sub === "serve") && args[1] === "auth" ? 1 : -1;
1114
1114
  if (loginIndex >= 0) {
1115
- const { authCmd } = await import("./auth-M6LXZTDA.js");
1115
+ const { authCmd } = await import("./auth-AED7RW7D.js");
1116
1116
  return authCmd(args.slice(loginIndex + 1), deps);
1117
1117
  }
1118
1118
  if (!sub || sub === "server" || sub === "serve") {
@@ -1193,4 +1193,4 @@ parallel:
1193
1193
  export {
1194
1194
  acpCmd
1195
1195
  };
1196
- //# sourceMappingURL=acp-T77EAEDB.js.map
1196
+ //# sourceMappingURL=acp-QLU7T5WX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  providerCloudConfig
3
- } from "./chunk-TXAFIERF.js";
3
+ } from "./chunk-L5NWFP5R.js";
4
4
  import {
5
5
  addCustomProvider,
6
6
  addFromCatalog,
@@ -20,7 +20,7 @@ import {
20
20
  runOAuthLoginKind,
21
21
  runOAuthLoginMenu,
22
22
  validateFamily
23
- } from "./chunk-GZSKLXYG.js";
23
+ } from "./chunk-NEWXDNF2.js";
24
24
  import {
25
25
  renderAuthLocalHelpToString,
26
26
  wantsLocalHelp
@@ -33,11 +33,11 @@ import {
33
33
  normalizeKeys,
34
34
  nowIso,
35
35
  writeKeysBack
36
- } from "./chunk-ZYACRPLN.js";
36
+ } from "./chunk-ULYAI7CP.js";
37
37
  import {
38
38
  activeProfileConfigPath
39
39
  } from "./chunk-YMXXOOFN.js";
40
- import "./chunk-4BX2YDTQ.js";
40
+ import "./chunk-4JMAWKLA.js";
41
41
  import {
42
42
  restoreFlags
43
43
  } from "./chunk-CSAPOCBP.js";
@@ -748,4 +748,4 @@ async function runAuthRemove(deps, providerId) {
748
748
  export {
749
749
  authCmd
750
750
  };
751
- //# sourceMappingURL=auth-M6LXZTDA.js.map
751
+ //# sourceMappingURL=auth-AED7RW7D.js.map
@@ -38,7 +38,10 @@ async function resolveAutomationCredentialBundle(refs, paths, vault) {
38
38
  let config = profiles.get(ref.profile);
39
39
  if (!config) {
40
40
  config = decryptConfigSecrets(
41
- JSON.parse(await readFile(paths.profileConfig(ref.profile), "utf8")),
41
+ // A leading UTF-8 BOM is valid (RFC 8259); the config loader accepts it.
42
+ JSON.parse(
43
+ (await readFile(paths.profileConfig(ref.profile), "utf8")).replace(/^\uFEFF/, "")
44
+ ),
42
45
  vault
43
46
  );
44
47
  profiles.set(ref.profile, config);
@@ -201,7 +204,10 @@ var automationCmd = async (args, deps) => {
201
204
  for (const ref of spec.credentials ?? []) {
202
205
  try {
203
206
  const profile = JSON.parse(
204
- await readFile2(deps.paths.profileConfig(ref.profile), "utf8")
207
+ (await readFile2(deps.paths.profileConfig(ref.profile), "utf8")).replace(
208
+ /^\uFEFF/,
209
+ ""
210
+ )
205
211
  );
206
212
  const provider = profile.providers && Object.hasOwn(profile.providers, ref.provider) ? profile.providers[ref.provider] : void 0;
207
213
  const key = provider?.apiKeys?.find(
@@ -326,8 +332,17 @@ Token file: ${path.join(directory, "token.txt")}
326
332
  mode: 384
327
333
  })
328
334
  );
335
+ let lastTickError;
329
336
  while (!abort.signal.aborted) {
330
- await service.tick();
337
+ try {
338
+ await service.tick();
339
+ lastTickError = void 0;
340
+ } catch (error) {
341
+ const message = toErrorMessage(error);
342
+ if (message !== lastTickError) deps.renderer.write(`automation: ${message}
343
+ `);
344
+ lastTickError = message;
345
+ }
331
346
  await new Promise((resolve2) => {
332
347
  const done = () => {
333
348
  clearTimeout(timer);
@@ -366,4 +381,4 @@ Token file: ${path.join(directory, "token.txt")}
366
381
  export {
367
382
  automationCmd
368
383
  };
369
- //# sourceMappingURL=automation-MCDFCIMV.js.map
384
+ //# sourceMappingURL=automation-3E3AUPBF.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  persistConfigSetting
3
- } from "./chunk-KMU7GF7X.js";
3
+ } from "./chunk-RE73FP2X.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
 
9
9
  // src/boot/boot-auto-thin.ts
10
10
  import {
@@ -99,4 +99,4 @@ async function runBootAutoThin(deps) {
99
99
  export {
100
100
  runBootAutoThin
101
101
  };
102
- //# sourceMappingURL=boot-auto-thin-YMAZI3QL.js.map
102
+ //# sourceMappingURL=boot-auto-thin-AGJ6TAWY.js.map
@@ -185,8 +185,14 @@ async function ensureHistoryDir(homeFn = defaultHomeDir, targetConfigPath) {
185
185
  }
186
186
  }
187
187
  async function readIndex(homeFn = defaultHomeDir, targetConfigPath) {
188
+ let raw;
189
+ try {
190
+ raw = await fs.readFile(historyIndexPath(homeFn, targetConfigPath), "utf8");
191
+ } catch (err) {
192
+ if (err.code !== "ENOENT") throw err;
193
+ return rebuildIndexFromEntries(homeFn, targetConfigPath);
194
+ }
188
195
  try {
189
- const raw = await fs.readFile(historyIndexPath(homeFn, targetConfigPath), "utf8");
190
196
  const parsed = JSON.parse(raw);
191
197
  if (parsed && typeof parsed === "object" && Array.isArray(parsed.entries)) {
192
198
  const entries = parsed.entries.filter(
@@ -194,10 +200,44 @@ async function readIndex(homeFn = defaultHomeDir, targetConfigPath) {
194
200
  );
195
201
  return { version: 1, entries };
196
202
  }
197
- return { version: 1, entries: [] };
198
203
  } catch {
199
- return { version: 1, entries: [] };
200
204
  }
205
+ return rebuildIndexFromEntries(homeFn, targetConfigPath);
206
+ }
207
+ async function rebuildIndexFromEntries(homeFn = defaultHomeDir, targetConfigPath) {
208
+ const dir = historyDir(homeFn, targetConfigPath);
209
+ let files;
210
+ try {
211
+ files = (await fs.readdir(dir)).filter((file) => file.endsWith(".json"));
212
+ } catch (err) {
213
+ if (err.code === "ENOENT") return { version: 1, entries: [] };
214
+ throw err;
215
+ }
216
+ const entries = [];
217
+ for (const file of files) {
218
+ const id = file.slice(0, -".json".length);
219
+ let raw;
220
+ try {
221
+ raw = await fs.readFile(path.join(dir, file), "utf8");
222
+ } catch (err) {
223
+ if (err.code === "ENOENT") continue;
224
+ entries.push({ id, timestamp: "", description: "" });
225
+ continue;
226
+ }
227
+ try {
228
+ const entry = JSON.parse(raw);
229
+ if (entry.id === id && typeof entry.timestamp === "string") {
230
+ entries.push({
231
+ id,
232
+ timestamp: entry.timestamp,
233
+ description: typeof entry.description === "string" ? entry.description : ""
234
+ });
235
+ }
236
+ } catch {
237
+ }
238
+ }
239
+ entries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
240
+ return { version: 1, entries };
201
241
  }
202
242
  async function writeIndex(idx, homeFn = defaultHomeDir, targetConfigPath) {
203
243
  await ensureHistoryDir(homeFn, targetConfigPath);
@@ -297,6 +337,7 @@ async function appendHistory(oldCfg, newCfg, description, homeFn = defaultHomeDi
297
337
  }
298
338
  await withFileLock(historyIndexPath(homeFn, targetConfigPath), async () => {
299
339
  const idx = await readIndex(homeFn, targetConfigPath);
340
+ idx.entries = idx.entries.filter((e) => e.id !== id);
300
341
  idx.entries.unshift({ id, timestamp, description });
301
342
  await pruneHistoryEntries(idx, homeFn, targetConfigPath);
302
343
  await writeIndex(idx, homeFn, targetConfigPath);
@@ -398,4 +439,4 @@ export {
398
439
  restoreFromHistory,
399
440
  restoreLast
400
441
  };
401
- //# sourceMappingURL=chunk-4BX2YDTQ.js.map
442
+ //# sourceMappingURL=chunk-4JMAWKLA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mutateConfigProviders
3
- } from "./chunk-ZYACRPLN.js";
3
+ } from "./chunk-ULYAI7CP.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
@@ -51,4 +51,4 @@ export {
51
51
  installProviderPersisters,
52
52
  applyProviderOAuthRefresh2 as applyProviderOAuthRefresh
53
53
  };
54
- //# sourceMappingURL=chunk-TWSQTQKR.js.map
54
+ //# sourceMappingURL=chunk-4R6TVMYA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  backupCurrent
3
- } from "./chunk-4BX2YDTQ.js";
3
+ } from "./chunk-4JMAWKLA.js";
4
4
 
5
5
  // src/wiring/external-plugins.ts
6
6
  import { isAbsolute, join, resolve } from "node:path";
@@ -356,11 +356,25 @@ import { homedir } from "node:os";
356
356
  import { join as join2 } from "node:path";
357
357
  import { updateJsonObjectFile } from "@wrongstack/core/utils";
358
358
  async function readConfig(file) {
359
+ let raw;
359
360
  try {
360
- return JSON.parse(await fs.readFile(file, "utf8"));
361
+ raw = await fs.readFile(file, "utf8");
362
+ } catch (error) {
363
+ if (error.code === "ENOENT") return {};
364
+ throw error;
365
+ }
366
+ let parsed;
367
+ try {
368
+ parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
361
369
  } catch {
362
- return {};
370
+ throw new Error(
371
+ `Profile config "${file}" is not valid JSON \u2014 fix or remove it before changing plugins`
372
+ );
363
373
  }
374
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
375
+ throw new Error(`Profile config "${file}" must contain a JSON object`);
376
+ }
377
+ return parsed;
364
378
  }
365
379
  function pluginName(p) {
366
380
  return typeof p === "string" ? p : p.name;
@@ -411,6 +425,7 @@ import { execFile } from "node:child_process";
411
425
  import * as fs2 from "node:fs/promises";
412
426
  import { join as join3 } from "node:path";
413
427
  import { buildChildEnv } from "@wrongstack/core/utils";
428
+ import { treeKill } from "@wrongstack/core/utils/tree-kill";
414
429
  import { resolveExecInvocation } from "@wrongstack/plugins/runtime";
415
430
  function detectPackageManager(args) {
416
431
  const override = args.find((a) => a.startsWith("--pm="));
@@ -467,7 +482,10 @@ function runPackageManagerInstall(pm, args, cwd) {
467
482
  });
468
483
  return;
469
484
  }
470
- execFile(
485
+ let settled = false;
486
+ let timedOut = false;
487
+ let timer;
488
+ const child = execFile(
471
489
  invocation.cmd,
472
490
  invocation.args,
473
491
  {
@@ -476,20 +494,29 @@ function runPackageManagerInstall(pm, args, cwd) {
476
494
  // untrusted package lifecycle scripts — with the full inherited
477
495
  // environment. Strip credentials via the shared child env.
478
496
  env: buildChildEnv(),
479
- timeout: 3e5,
480
497
  maxBuffer: 16 * 1024 * 1024,
481
498
  windowsHide: true,
482
499
  ...invocation.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
483
500
  },
484
501
  (err, stdout, stderr) => {
502
+ settled = true;
503
+ clearTimeout(timer);
485
504
  const code = err ? err.code ?? 1 : 0;
486
505
  resolvePromise({
487
- code: typeof code === "number" ? code : 1,
506
+ code: typeof code === "number" && !timedOut ? code : 1,
488
507
  stdout: typeof stdout === "string" ? stdout : "",
489
508
  stderr: typeof stderr === "string" ? stderr : ""
490
509
  });
491
510
  }
492
511
  );
512
+ if (!settled) {
513
+ timer = setTimeout(() => {
514
+ timedOut = true;
515
+ treeKill(child);
516
+ child.stdout?.destroy();
517
+ child.stderr?.destroy();
518
+ }, 3e5);
519
+ }
493
520
  });
494
521
  }
495
522
  async function installPluginPackage(spec, args, deps) {
@@ -1109,4 +1136,4 @@ export {
1109
1136
  PLUGIN_AUDIT_ENTRIES,
1110
1137
  runPluginManagementCommand
1111
1138
  };
1112
- //# sourceMappingURL=chunk-HHRYIDOW.js.map
1139
+ //# sourceMappingURL=chunk-ACW64W4M.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  PLUGIN_AUDIT_ENTRIES,
6
6
  loadExternalPlugins
7
- } from "./chunk-HHRYIDOW.js";
7
+ } from "./chunk-ACW64W4M.js";
8
8
 
9
9
  // src/wiring/plugins.ts
10
10
  import { join } from "node:path";
@@ -306,4 +306,4 @@ export {
306
306
  BUILTIN_PLUGIN_NAME_HINTS,
307
307
  setupPlugins
308
308
  };
309
- //# sourceMappingURL=chunk-LKFKO4JW.js.map
309
+ //# sourceMappingURL=chunk-B6EHK772.js.map
@@ -413,9 +413,9 @@ function pruneExpiredTombstones(state, now) {
413
413
  return changed;
414
414
  }
415
415
  async function readState(projectRoot) {
416
+ const raw = await readKanbanMetadata(projectRoot, SYNC_STATE_KEY);
417
+ if (raw === null) return { boards: {}, tombstones: {} };
416
418
  try {
417
- const raw = await readKanbanMetadata(projectRoot, SYNC_STATE_KEY);
418
- if (raw === null) return { boards: {}, tombstones: {} };
419
419
  const parsed = JSON.parse(raw);
420
420
  return { boards: parsed.boards ?? {}, tombstones: parsed.tombstones ?? {} };
421
421
  } catch {
@@ -686,4 +686,4 @@ function startCliHqConnection(options) {
686
686
  export {
687
687
  startCliHqConnection
688
688
  };
689
- //# sourceMappingURL=chunk-4UWCMBPG.js.map
689
+ //# sourceMappingURL=chunk-BJH44J7G.js.map
@@ -49,6 +49,7 @@ import {
49
49
  watchHqAuthFile
50
50
  } from "@wrongstack/core/hq";
51
51
  import { createCompatibilityTrustBoundary } from "@wrongstack/core/security";
52
+ import { isPidAlive } from "@wrongstack/core/utils";
52
53
  import { WebSocket as WebSocket4, WebSocketServer } from "ws";
53
54
 
54
55
  // src/hq-recovery-html.ts
@@ -2890,7 +2891,7 @@ async function handleApiAgentMessages(req, res, match, agentMessages) {
2890
2891
  async function handleApiSystemUpdate(res) {
2891
2892
  const [{ checkForUpdate }, { detectUpdatePackageName }] = await Promise.all([
2892
2893
  import("./update-check-VLVT4IV2.js"),
2893
- import("./update-6OEPAEUV.js")
2894
+ import("./update-LHCWAWEZ.js")
2894
2895
  ]);
2895
2896
  const packageName = detectUpdatePackageName();
2896
2897
  const info = await checkForUpdate({ packageName });
@@ -5002,14 +5003,7 @@ async function startHqServerWithAuth(options, host, port, dataDir, firstRunAuth)
5002
5003
  const metadataPath = path8.join(projectDir, ".mailbox-server.json");
5003
5004
  const ownerPid = await fs4.readFile(metadataPath, "utf8").then((raw) => JSON.parse(raw).pid).catch(() => void 0);
5004
5005
  if (ownerPid === void 0) return;
5005
- let ownerAlive = false;
5006
- try {
5007
- process.kill(ownerPid, 0);
5008
- ownerAlive = true;
5009
- } catch {
5010
- ownerAlive = false;
5011
- }
5012
- if (!ownerAlive) {
5006
+ if (!isPidAlive(ownerPid)) {
5013
5007
  await fs4.rm(metadataPath, { force: true }).catch(() => {
5014
5008
  });
5015
5009
  return;
@@ -5367,4 +5361,4 @@ export {
5367
5361
  startHqServer,
5368
5362
  HqInsecureExposureError2 as HqInsecureExposureError
5369
5363
  };
5370
- //# sourceMappingURL=chunk-6Z6C6ZHH.js.map
5364
+ //# sourceMappingURL=chunk-GF7LUWQS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadConfigProviders,
3
3
  mutateConfigProviders
4
- } from "./chunk-ZYACRPLN.js";
4
+ } from "./chunk-ULYAI7CP.js";
5
5
 
6
6
  // src/provider-cloud-config.ts
7
7
  import {
@@ -34,4 +34,4 @@ async function providerCloudConfig(id, updates, configPath, vault) {
34
34
  export {
35
35
  providerCloudConfig
36
36
  };
37
- //# sourceMappingURL=chunk-TXAFIERF.js.map
37
+ //# sourceMappingURL=chunk-L5NWFP5R.js.map
@@ -1,48 +1,48 @@
1
1
 
2
2
  // src/subcommands/index.ts
3
3
  var loaders = {
4
- automation: async () => (await import("./automation-MCDFCIMV.js")).automationCmd,
4
+ automation: async () => (await import("./automation-3E3AUPBF.js")).automationCmd,
5
5
  sandbox: async () => (await import("./sandbox-TYGD6FI2.js")).sandboxCmd,
6
- acp: async () => (await import("./acp-T77EAEDB.js")).acpCmd,
6
+ acp: async () => (await import("./acp-QLU7T5WX.js")).acpCmd,
7
7
  init: async () => (await import("./init-DRMMFG2G.js")).initCmd,
8
- auth: async () => (await import("./auth-M6LXZTDA.js")).authCmd,
9
- update: async () => (await import("./update-6OEPAEUV.js")).updateCmd,
8
+ auth: async () => (await import("./auth-AED7RW7D.js")).authCmd,
9
+ update: async () => (await import("./update-LHCWAWEZ.js")).updateCmd,
10
10
  remote: async () => (await import("./remote-C74BCNND.js")).remoteCmd,
11
- sessions: async () => (await import("./sessions-config-VE26SB56.js")).sessionsCmd,
12
- config: async () => (await import("./sessions-config-VE26SB56.js")).configCmd,
13
- "config-export": async () => (await import("./config-transfer-VOIFY7U4.js")).configExportCmd,
14
- "config-import": async () => (await import("./config-transfer-VOIFY7U4.js")).configImportCmd,
11
+ sessions: async () => (await import("./sessions-config-RQRQDW5Q.js")).sessionsCmd,
12
+ config: async () => (await import("./sessions-config-RQRQDW5Q.js")).configCmd,
13
+ "config-export": async () => (await import("./config-transfer-YPD7HYXH.js")).configExportCmd,
14
+ "config-import": async () => (await import("./config-transfer-YPD7HYXH.js")).configImportCmd,
15
15
  rewind: async () => (await import("./rewind-7AULJS7F.js")).rewindCmd,
16
16
  replay: async () => (await import("./replay-JJ2NOWD6.js")).replayCmd,
17
17
  audit: async () => (await import("./audit-KCBTHUQI.js")).auditCmd,
18
18
  tools: async () => (await import("./tools-skills-33AI6K6S.js")).toolsCmd,
19
19
  skills: async () => (await import("./tools-skills-33AI6K6S.js")).skillsCmd,
20
20
  "skill-suggest": async () => (await import("./skill-suggest-THANK3LV.js")).skillSuggestCmd,
21
- typesafe: async () => (await import("./typesafe-NHC322W5.js")).typesafeCmd,
22
- providers: async () => (await import("./providers-models-37DUV2GW.js")).providersCmd,
23
- models: async () => (await import("./providers-models-37DUV2GW.js")).modelsCmd,
21
+ typesafe: async () => (await import("./typesafe-KW2XHOG3.js")).typesafeCmd,
22
+ providers: async () => (await import("./providers-models-S3S6VXME.js")).providersCmd,
23
+ models: async () => (await import("./providers-models-S3S6VXME.js")).modelsCmd,
24
24
  mcp: async () => (await import("./mcp-LBS45HWZ.js")).mcpCmd,
25
- plugin: async () => (await import("./plugin-usage-3TZGROK7.js")).pluginCmd,
26
- plugins: async () => (await import("./plugin-usage-3TZGROK7.js")).pluginCmd,
25
+ plugin: async () => (await import("./plugin-usage-EM752WHG.js")).pluginCmd,
26
+ plugins: async () => (await import("./plugin-usage-EM752WHG.js")).pluginCmd,
27
27
  diag: async () => (await import("./diag-doctor-BIZAFIAT.js")).diagCmd,
28
28
  doctor: async () => (await import("./diag-doctor-BIZAFIAT.js")).doctorCmd,
29
29
  "proxy-status": async () => (await import("./diag-doctor-BIZAFIAT.js")).proxyCmd,
30
30
  export: async () => (await import("./export-VVRIOWFV.js")).exportCmd,
31
- usage: async () => (await import("./plugin-usage-3TZGROK7.js")).usageCmd,
31
+ usage: async () => (await import("./plugin-usage-EM752WHG.js")).usageCmd,
32
32
  version: async () => (await import("./version-help-JQGRPDJW.js")).versionCmd,
33
33
  help: async () => (await import("./version-help-JQGRPDJW.js")).helpCmd,
34
34
  projects: async () => (await import("./projects-T4CZCA25.js")).projectsCmd,
35
- modeldiag: async () => (await import("./modeldiag-NEPTLFZW.js")).modeldiagCmd,
35
+ modeldiag: async () => (await import("./modeldiag-F3LUF4VJ.js")).modeldiagCmd,
36
36
  quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
37
37
  bench: async () => (await import("./bench-MMZHFHDL.js")).benchCmd,
38
38
  chronicle: async () => (await import("./chronicle-PBJS7BN6.js")).chronicleCmd,
39
- hq: async () => (await import("./hq-5OIEKB4V.js")).hqCmd,
40
- mailbox: async () => (await import("./mailbox-serve-S536N66F.js")).mailboxServeCmd,
39
+ hq: async () => (await import("./hq-BBLGEEUH.js")).hqCmd,
40
+ mailbox: async () => (await import("./mailbox-serve-DRWJVMYU.js")).mailboxServeCmd,
41
41
  permissions: async () => (await import("./permissions-PL27UHYD.js")).permissionsCmd,
42
42
  project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
43
- sage: async () => (await import("./sage-FFKUOCQL.js")).sageCmd,
43
+ sage: async () => (await import("./sage-BMRDJCDI.js")).sageCmd,
44
44
  governance: async () => (await import("./governance-RYSHV675.js")).governanceCmd,
45
- "import-claude-code": async () => (await import("./import-claude-code-AYG24RG2.js")).importClaudeCodeCmd
45
+ "import-claude-code": async () => (await import("./import-claude-code-GHIS2F7Y.js")).importClaudeCodeCmd
46
46
  };
47
47
  var subcommands = Object.fromEntries(
48
48
  Object.entries(loaders).map(
@@ -58,4 +58,4 @@ export {
58
58
  subcommands,
59
59
  subcommandNames
60
60
  };
61
- //# sourceMappingURL=chunk-LDXXMPMS.js.map
61
+ //# sourceMappingURL=chunk-LPGZ3NUF.js.map
@@ -12,11 +12,11 @@ import {
12
12
  nowIso,
13
13
  resolveActiveApiKey,
14
14
  writeKeysBack
15
- } from "./chunk-ZYACRPLN.js";
15
+ } from "./chunk-ULYAI7CP.js";
16
16
  import {
17
17
  appendHistory,
18
18
  backupCurrent
19
- } from "./chunk-4BX2YDTQ.js";
19
+ } from "./chunk-4JMAWKLA.js";
20
20
  import {
21
21
  openBrowser
22
22
  } from "./chunk-DAKVBMD4.js";
@@ -172,7 +172,7 @@ function decideAuthLocalEvents(opts) {
172
172
  }
173
173
 
174
174
  // src/auth-menu/provider-auth-login.ts
175
- import { color } from "@wrongstack/core/utils";
175
+ import { color, toErrorMessage } from "@wrongstack/core/utils";
176
176
  import {
177
177
  applyProviderAuthOutcome,
178
178
  createBuiltinProviderAuthRegistry
@@ -289,7 +289,7 @@ async function runProviderAuthLogin(deps, strategyId, opts = {}) {
289
289
  `));
290
290
  return 0;
291
291
  } catch (error) {
292
- const message = error instanceof DOMException && error.name === "AbortError" ? "Login cancelled." : error instanceof Error ? error.message : String(error);
292
+ const message = error instanceof DOMException && error.name === "AbortError" ? "Login cancelled." : toErrorMessage(error);
293
293
  deps.renderer.writeError(` Login failed: ${message}`);
294
294
  return 1;
295
295
  } finally {
@@ -845,7 +845,7 @@ import {
845
845
 
846
846
  // src/picker.ts
847
847
  import os from "node:os";
848
- import { color as color8, expectDefined as expectDefined2, toErrorMessage, withFileLock } from "@wrongstack/core/utils";
848
+ import { color as color8, expectDefined as expectDefined2, toErrorMessage as toErrorMessage2, withFileLock } from "@wrongstack/core/utils";
849
849
 
850
850
  // src/picker-model-picker.ts
851
851
  import {
@@ -1341,7 +1341,7 @@ async function saveToGlobalConfig(configPath, provider, model, options = {}) {
1341
1341
  JSON.stringify({
1342
1342
  level: "warn",
1343
1343
  event: "picker.backup_failed",
1344
- message: toErrorMessage(err),
1344
+ message: toErrorMessage2(err),
1345
1345
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1346
1346
  })
1347
1347
  );
@@ -1364,7 +1364,7 @@ async function saveToGlobalConfig(configPath, provider, model, options = {}) {
1364
1364
  JSON.stringify({
1365
1365
  level: "warn",
1366
1366
  event: "picker.save_failed",
1367
- message: toErrorMessage(err),
1367
+ message: toErrorMessage2(err),
1368
1368
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1369
1369
  })
1370
1370
  );
@@ -2024,4 +2024,4 @@ export {
2024
2024
  addCustomProvider,
2025
2025
  addKeyForProvider
2026
2026
  };
2027
- //# sourceMappingURL=chunk-GZSKLXYG.js.map
2027
+ //# sourceMappingURL=chunk-NEWXDNF2.js.map
@@ -127,7 +127,6 @@ async function spawnHqAgent(director, sessionId, role, task, maxIterations) {
127
127
  const base = FLEET_ROSTER[role] ?? {
128
128
  id: `manual-${Date.now()}`,
129
129
  name: role,
130
- maxIterations: maxIterations ?? 0,
131
130
  maxToolCalls: 200
132
131
  };
133
132
  const overrides = maxIterations !== void 0 ? { maxIterations } : {};
@@ -157,4 +156,4 @@ export {
157
156
  spawnHqAgent,
158
157
  createHqFleetControl
159
158
  };
160
- //# sourceMappingURL=chunk-6SIUTX75.js.map
159
+ //# sourceMappingURL=chunk-NOZJIN46.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  appendHistory,
3
3
  backupCurrent
4
- } from "./chunk-4BX2YDTQ.js";
4
+ } from "./chunk-4JMAWKLA.js";
5
5
 
6
6
  // src/settings-menu.ts
7
7
  import * as fs from "node:fs/promises";
@@ -246,4 +246,4 @@ export {
246
246
  persistTelegramConfig,
247
247
  deriveFsAccessPair
248
248
  };
249
- //# sourceMappingURL=chunk-KMU7GF7X.js.map
249
+ //# sourceMappingURL=chunk-RE73FP2X.js.map
@@ -22,7 +22,7 @@ async function handleHelpVersionShortCircuit(argv) {
22
22
  }
23
23
  if (earlyFlags["help"] === true) {
24
24
  if (positional.length > 0) {
25
- const { subcommandNames } = await import("./subcommands-DTKBXLPU.js");
25
+ const { subcommandNames } = await import("./subcommands-75IB23LS.js");
26
26
  if (subcommandNames.includes(positional[0])) {
27
27
  const first = positional[0];
28
28
  const deep = positional[1];
@@ -43,4 +43,4 @@ async function handleHelpVersionShortCircuit(argv) {
43
43
  export {
44
44
  handleHelpVersionShortCircuit
45
45
  };
46
- //# sourceMappingURL=chunk-LDV4ERNV.js.map
46
+ //# sourceMappingURL=chunk-RYTSPBNM.js.map
@@ -23,7 +23,7 @@ var APPLIED_FMT = `
23
23
  `;
24
24
  async function printStandaloneUpdateNotice(info, config) {
25
25
  const [{ autoUpdateEnabled, standaloneUpdater, takeAppliedUpdate }, { isNewer }, version] = await Promise.all([
26
- import("./standalone-auto-update-VQC4GYCM.js"),
26
+ import("./standalone-auto-update-QUXOZ4B5.js"),
27
27
  import("./update-check-VLVT4IV2.js"),
28
28
  import("./version-JB2UAV2A.js")
29
29
  ]);
@@ -102,4 +102,4 @@ export {
102
102
  applySessionShellDefault,
103
103
  runPreflight
104
104
  };
105
- //# sourceMappingURL=chunk-WTJDSTYD.js.map
105
+ //# sourceMappingURL=chunk-T5KR6SNO.js.map
@@ -58,6 +58,9 @@ function maskedKey(key) {
58
58
  const tail = key.slice(-4);
59
59
  return `${color.dim(head + "\u2026")}${tail}`;
60
60
  }
61
+ function stripConfigBom(raw) {
62
+ return raw.replace(/^\uFEFF/, "");
63
+ }
61
64
  async function loadConfigProviders(configPath, vault, opts) {
62
65
  const warn = opts?.warn;
63
66
  const targetPath = opts?.profileConfigPath ?? configPath;
@@ -72,7 +75,7 @@ async function loadConfigProviders(configPath, vault, opts) {
72
75
  }
73
76
  let parsed;
74
77
  try {
75
- parsed = JSON.parse(raw);
78
+ parsed = JSON.parse(stripConfigBom(raw));
76
79
  validateProviderConfigShape(parsed);
77
80
  } catch (err) {
78
81
  warn?.(`Config at ${targetPath} is not valid JSON: ${err.message}`);
@@ -118,7 +121,7 @@ async function mutateConfigProviders(configPath, vault, mutator, profileConfigPa
118
121
  }
119
122
  let parsed;
120
123
  try {
121
- parsed = JSON.parse(raw);
124
+ parsed = JSON.parse(stripConfigBom(raw));
122
125
  validateProviderConfigShape(parsed);
123
126
  } catch (err) {
124
127
  if (fileExists) {
@@ -168,4 +171,4 @@ export {
168
171
  mutateConfigProviders,
169
172
  nowIso
170
173
  };
171
- //# sourceMappingURL=chunk-ZYACRPLN.js.map
174
+ //# sourceMappingURL=chunk-ULYAI7CP.js.map
@@ -50,7 +50,7 @@ function normalizeMcpServerEntry(name, raw) {
50
50
  function parseLaunchMcpServers(text, source) {
51
51
  let doc;
52
52
  try {
53
- doc = JSON.parse(text);
53
+ doc = JSON.parse(text.replace(/^\uFEFF/, ""));
54
54
  } catch (err) {
55
55
  throw new Error(`--mcp-config: ${source} is not valid JSON (${err.message})`);
56
56
  }
@@ -94,4 +94,4 @@ export {
94
94
  resolveLaunchMcpServers,
95
95
  effectiveMcpServers
96
96
  };
97
- //# sourceMappingURL=chunk-HLSHFXTO.js.map
97
+ //# sourceMappingURL=chunk-WY74MMDB.js.map