@wrongstack/cli 0.302.0 → 0.303.0

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 (120) hide show
  1. package/data/providers.json +41 -155
  2. package/dist/{acp-DATHHPNT.js → acp-AQMGKW6O.js} +6 -5
  3. package/dist/{audit-QRCLEHHW.js → audit-BBR22QH3.js} +2 -2
  4. package/dist/{auth-PJD3JRH2.js → auth-K7CYVVKH.js} +121 -78
  5. package/dist/auth-menu/index.d.ts +5 -5
  6. package/dist/auth-menu/local.d.ts +4 -5
  7. package/dist/auth-menu/openai-codex-oauth.d.ts +1 -1
  8. package/dist/{auto-discover-providers-DRW4OZHG.js → auto-discover-providers-MHFLDSD3.js} +2 -2
  9. package/dist/{bench-7ZDWSNEF.js → bench-XNDUJOSZ.js} +10 -11
  10. package/dist/boot/auto-discover-providers.d.ts +1 -1
  11. package/dist/boot/container-wiring.d.ts +3 -3
  12. package/dist/boot/dispatch-webui.d.ts +1 -1
  13. package/dist/boot/system-prompt.d.ts +1 -2
  14. package/dist/boot/tool-registry.d.ts +1 -1
  15. package/dist/boot/tui-coordinator-setup.d.ts +1 -1
  16. package/dist/boot/tui-project-picker-callback.d.ts +1 -1
  17. package/dist/boot/tui-theme-adapter.d.ts +33 -0
  18. package/dist/boot-config.d.ts +2 -2
  19. package/dist/boot.d.ts +1 -1
  20. package/dist/{chunk-ETOEGL3V.js → chunk-3IC4IEZC.js} +7 -2
  21. package/dist/{chunk-PFVVUH5B.js → chunk-3JPTNADJ.js} +3 -2
  22. package/dist/{chunk-4GVH7V3S.js → chunk-52C7PD2H.js} +1 -1
  23. package/dist/{chunk-I5MEUFDI.js → chunk-53STH6CX.js} +94 -15
  24. package/dist/{chunk-OP47B3IX.js → chunk-7YLN7YUA.js} +7 -2
  25. package/dist/{chunk-263G3FMB.js → chunk-B4JLSXZB.js} +11 -14
  26. package/dist/{chunk-MT6FGXO3.js → chunk-C5NXM2SI.js} +19 -6
  27. package/dist/{chunk-XTIXVJXP.js → chunk-DGXNL7OT.js} +1 -1
  28. package/dist/{chunk-3MOUBRKZ.js → chunk-FJVCVZIV.js} +974 -935
  29. package/dist/{chunk-MRLYDHQ7.js → chunk-JQURRYU4.js} +4 -6
  30. package/dist/{chunk-ZECLGUTF.js → chunk-KV6DNQT6.js} +2 -2
  31. package/dist/{chunk-2KDOFTTM.js → chunk-LUAFQIXT.js} +1067 -900
  32. package/dist/{chunk-F4PEGAJZ.js → chunk-NUIHRGPY.js} +1 -1
  33. package/dist/{chunk-GUHQQG63.js → chunk-RK7E3IXT.js} +2 -4
  34. package/dist/{chunk-PYTFS4MC.js → chunk-SSSJQVUY.js} +27 -16
  35. package/dist/{chunk-PJHET45A.js → chunk-SZ42FYPT.js} +3 -3
  36. package/dist/{chunk-A6Q5KGLV.js → chunk-YKBRFSGL.js} +5 -5
  37. package/dist/cli-context.d.ts +2 -2
  38. package/dist/cli-eternal-flag.d.ts +1 -2
  39. package/dist/{cli-main-EOJ74CI4.js → cli-main-37XO26GK.js} +3269 -2206
  40. package/dist/context-limit.d.ts +11 -5
  41. package/dist/{diag-doctor-OQ3AA63O.js → diag-doctor-ZF5BF2MK.js} +2 -3
  42. package/dist/execute-deps.d.ts +1 -1
  43. package/dist/{execution-CQ772VPS.js → execution-MVOH6PAQ.js} +302 -149
  44. package/dist/{export-DOBGPY23.js → export-CCUXRJOU.js} +3 -11
  45. package/dist/fleet/host-context.d.ts +9 -0
  46. package/dist/fleet/host-learning-tracker.d.ts +2 -2
  47. package/dist/fleet/host-learning.d.ts +12 -1
  48. package/dist/fleet/host-subagent-factory.d.ts +1 -1
  49. package/dist/fleet/host-supervisor.d.ts +1 -1
  50. package/dist/fleet/host.d.ts +23 -1
  51. package/dist/fleet/routing.d.ts +1 -2
  52. package/dist/goal-host.d.ts +2 -2
  53. package/dist/hooks-wiring.d.ts +1 -1
  54. package/dist/{hq-LN5CJHCM.js → hq-CD77GVSS.js} +104 -55
  55. package/dist/hq-command-controller.d.ts +1 -1
  56. package/dist/hq-server/routes/system-handlers.d.ts +1 -2
  57. package/dist/hq-server/routes.d.ts +7 -7
  58. package/dist/{hq-server-S7HZG3PA.js → hq-server-DME6EWIO.js} +2 -2
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.js +2635 -2642
  61. package/dist/mailbox-bridge-bootstrap.d.ts +2 -2
  62. package/dist/{mcp-OHPJH73U.js → mcp-AX6ZAFJR.js} +8 -7
  63. package/dist/mcp-serve.d.ts +1 -1
  64. package/dist/{modeldiag-3DOK4BWW.js → modeldiag-SIVUOX2Y.js} +18 -13
  65. package/dist/{permissions-FNYLZIL4.js → permissions-2PWBL4YU.js} +5 -3
  66. package/dist/picker.d.ts +1 -1
  67. package/dist/plugin-management.d.ts +1 -1
  68. package/dist/{plugin-usage-YEVLOR33.js → plugin-usage-PTEETL3J.js} +2 -2
  69. package/dist/{plugins-K3BAUP4D.js → plugins-XRGWC3NJ.js} +3 -3
  70. package/dist/pre-launch.d.ts +2 -2
  71. package/dist/{providers-models-WEZ4EGLL.js → providers-models-VV74TRQ2.js} +86 -37
  72. package/dist/repl.d.ts +1 -1
  73. package/dist/{replay-FCBNHW3K.js → replay-WBRMEWQ5.js} +2 -2
  74. package/dist/{rewind-AOD3JIYX.js → rewind-7RE6ONIC.js} +17 -17
  75. package/dist/{sdd-runtime-AIJCJGWC.js → sdd-runtime-GFZ3NJKS.js} +2 -2
  76. package/dist/{sessions-config-XXN7267N.js → sessions-config-YX2ZPAFM.js} +36 -32
  77. package/dist/{simpleui-dist-JIFGUJO7.js → simpleui-dist-33VO3QHF.js} +9 -2
  78. package/dist/slash-commands/agent-improve.d.ts +4 -1
  79. package/dist/slash-commands/agents.d.ts +14 -0
  80. package/dist/slash-commands/command-context.d.ts +2 -3
  81. package/dist/slash-commands/helpers.d.ts +1 -1
  82. package/dist/slash-commands/index.d.ts +1 -1
  83. package/dist/slash-commands/intake.d.ts +10 -0
  84. package/dist/slash-commands/memory-triage.d.ts +1 -1
  85. package/dist/slash-commands/provider-status.d.ts +1 -1
  86. package/dist/slash-commands/theme.d.ts +6 -0
  87. package/dist/subcommands/handlers/hq.d.ts +20 -0
  88. package/dist/subcommands/handlers/per-subcommand-help-data.d.ts +1 -1
  89. package/dist/subcommands/handlers/update.d.ts +2 -0
  90. package/dist/{update-MV6TUACD.js → update-VZSOZGYC.js} +3 -3
  91. package/dist/{update-check-UMYTOH7Z.js → update-check-WARHSVZA.js} +2 -2
  92. package/dist/webui-server/connection-handler.d.ts +1 -1
  93. package/dist/webui-server/context-breakdown.d.ts +1 -1
  94. package/dist/webui-server/cost-helpers.d.ts +1 -1
  95. package/dist/webui-server/lifecycle.d.ts +1 -1
  96. package/dist/webui-server/prefs-seeding.d.ts +1 -1
  97. package/dist/webui-server/setup-events.d.ts +1 -1
  98. package/dist/webui-server/static-serve.d.ts +1 -1
  99. package/dist/{webui-server-NFNRGNNT.js → webui-server-E3OPEKU5.js} +18 -10
  100. package/dist/webui-server-options.d.ts +1 -1
  101. package/dist/wiring/command-host-state.d.ts +2 -2
  102. package/dist/wiring/controllers.d.ts +1 -2
  103. package/dist/wiring/dep-watcher.d.ts +1 -1
  104. package/dist/wiring/director-setup.d.ts +3 -3
  105. package/dist/wiring/eternal-command-handlers.d.ts +2 -2
  106. package/dist/wiring/management-tools.d.ts +2 -2
  107. package/dist/wiring/provider-runtime.d.ts +1 -1
  108. package/dist/wiring/provider-status.d.ts +1 -1
  109. package/dist/wiring/provider-utility-tools.d.ts +3 -3
  110. package/dist/wiring/provider.d.ts +1 -1
  111. package/dist/wiring/replay.d.ts +1 -1
  112. package/dist/wiring/runtime-controller-deps.d.ts +1 -1
  113. package/dist/wiring/runtime-dispatch-state.d.ts +1 -2
  114. package/dist/wiring/runtime-lifecycle-deps.d.ts +2 -2
  115. package/dist/wiring/runtime-picker-deps.d.ts +1 -2
  116. package/dist/wiring/sage.d.ts +1 -1
  117. package/dist/wiring/session-command-handlers.d.ts +1 -2
  118. package/dist/wiring/session.d.ts +6 -1
  119. package/dist/wiring/slash-commands.d.ts +2 -3
  120. package/package.json +23 -23
@@ -1,9 +1,9 @@
1
+ export { CLAUDE_PROVIDER_ID, type ClaudeLoginOptions, type ClaudeTokens, runClaudeOAuthLogin, } from './anthropic-oauth.js';
1
2
  export { runAuthDirect } from './direct.js';
3
+ export { COPILOT_PROVIDER_ID, type CopilotLoginOptions, runCopilotOAuthLogin, } from './github-copilot-oauth.js';
4
+ export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry, type ProbeOptions, type ProbeResult, probeLocalLlm, type RunAuthLocalOptions, resolveModelList, runAuthLocal, } from './local.js';
5
+ export { type OAuthMenuKind, resolveOAuthKind, runOAuthLoginChoice, runOAuthLoginKind, runOAuthLoginMenu, } from './oauth-menu.js';
6
+ export { CODEX_BASE_URL, CODEX_CATALOG_FAMILIES, CODEX_PROVIDER_ID, type CodexLoginOptions, type CodexTokens, extractAccountId, FALLBACK_CODEX_MODELS, fallbackCodexModelIds, fallbackCodexProviderModels, fetchCodexModels, filterCurrentCodexModelIds, isCodexCatalogModel, refreshCodexToken, resolveCodexModels, runCodexOAuthLogin, } from './openai-codex-oauth.js';
2
7
  export { runTopMenu as runAuthMenu } from './top-menu.js';
3
8
  export type { AuthMenuDeps } from './types.js';
4
- export { resolveOAuthKind, runOAuthLoginChoice, runOAuthLoginKind, runOAuthLoginMenu, type OAuthMenuKind, } from './oauth-menu.js';
5
- export { runCodexOAuthLogin, refreshCodexToken, extractAccountId, fetchCodexModels, resolveCodexModels, FALLBACK_CODEX_MODELS, CODEX_CATALOG_FAMILIES, fallbackCodexModelIds, fallbackCodexProviderModels, filterCurrentCodexModelIds, isCodexCatalogModel, CODEX_PROVIDER_ID, CODEX_BASE_URL, type CodexLoginOptions, type CodexTokens, } from './openai-codex-oauth.js';
6
- export { runClaudeOAuthLogin, CLAUDE_PROVIDER_ID, type ClaudeLoginOptions, type ClaudeTokens, } from './anthropic-oauth.js';
7
- export { runCopilotOAuthLogin, COPILOT_PROVIDER_ID, type CopilotLoginOptions, } from './github-copilot-oauth.js';
8
- export { runAuthLocal, resolveModelList, probeLocalLlm, LOCAL_LLM_PRESETS, type RunAuthLocalOptions, type LocalLlmPresetEntry, type ProbeOptions, type ProbeResult, } from './local.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -25,14 +25,13 @@
25
25
  * in plaintext.
26
26
  */
27
27
  import type { SecretScrubber } from '@wrongstack/core/types';
28
+ import type { ProbeOptions, ProbeResult } from '@wrongstack/runtime/probe';
29
+ import { probeLocalLlm } from '@wrongstack/runtime/probe';
30
+ import { type AuthAuditLogger } from './auth-menu-audit.js';
28
31
  import { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry } from './local-presets.js';
29
32
  import { suggestLabel } from './shared.js';
30
33
  import type { AuthMenuDeps } from './types.js';
31
- import { probeLocalLlm } from '@wrongstack/runtime/probe';
32
- import type { ProbeOptions, ProbeResult } from '@wrongstack/runtime/probe';
33
- import { type AuthAuditLogger } from './auth-menu-audit.js';
34
- export { probeLocalLlm, type ProbeOptions, type ProbeResult };
35
- export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry };
34
+ export { LOCAL_LLM_PRESETS, type LocalLlmPresetEntry, type ProbeOptions, type ProbeResult, probeLocalLlm, };
36
35
  export interface RunAuthLocalOptions {
37
36
  /**
38
37
  * Direct pick: skip the interactive menu and configure this preset.
@@ -31,7 +31,7 @@
31
31
  import { buildCodexAuthorizeUrl, exchangeCodexAuthorizationCode, refreshCodexTokens } from '@wrongstack/providers/oauth';
32
32
  import { type LoopbackServer } from './loopback-server.js';
33
33
  import type { AuthMenuDeps } from './types.js';
34
- export { CODEX_BASE_URL, CODEX_CATALOG_FAMILIES, CODEX_PROVIDER_ID, type CodexTokens, extractAccountId, FALLBACK_CODEX_MODELS, fallbackCodexModelIds, fallbackCodexProviderModels, fetchCodexModels, filterCurrentCodexModelIds, generatePkce, isCodexCatalogModel, parseAuthorizationInput, type Pkce, resolveCodexModels, } from '@wrongstack/providers/oauth';
34
+ export { CODEX_BASE_URL, CODEX_CATALOG_FAMILIES, CODEX_PROVIDER_ID, type CodexTokens, extractAccountId, FALLBACK_CODEX_MODELS, fallbackCodexModelIds, fallbackCodexProviderModels, fetchCodexModels, filterCurrentCodexModelIds, generatePkce, isCodexCatalogModel, type Pkce, parseAuthorizationInput, resolveCodexModels, } from '@wrongstack/providers/oauth';
35
35
  /** Build the Codex authorize URL. Alias kept for the historical local name. */
36
36
  export declare const buildAuthorizeUrl: typeof buildCodexAuthorizeUrl;
37
37
  /** Exchange an authorization code (+ PKCE verifier) for tokens. */
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  discoverAndMergeProviders
3
- } from "./chunk-4GVH7V3S.js";
3
+ } from "./chunk-52C7PD2H.js";
4
4
  import "./chunk-7OCVIDC7.js";
5
5
  export {
6
6
  discoverAndMergeProviders
7
7
  };
8
- //# sourceMappingURL=auto-discover-providers-DRW4OZHG.js.map
8
+ //# sourceMappingURL=auto-discover-providers-MHFLDSD3.js.map
@@ -7,7 +7,6 @@ import "./chunk-7OCVIDC7.js";
7
7
  import * as fs from "node:fs/promises";
8
8
  import { createRequire } from "node:module";
9
9
  import * as path from "node:path";
10
- import { toErrorMessage } from "@wrongstack/core/utils";
11
10
  import {
12
11
  collectCellPredictions,
13
12
  computeToolManifestHash,
@@ -26,7 +25,7 @@ import {
26
25
  writeJsonArtifacts,
27
26
  writePredictionsJsonl
28
27
  } from "@wrongstack/bench";
29
- import { color } from "@wrongstack/core/utils";
28
+ import { color, toErrorMessage } from "@wrongstack/core/utils";
30
29
  var benchCmd = async (args, deps) => {
31
30
  const sub = args[0];
32
31
  const rest = args.slice(1);
@@ -58,9 +57,7 @@ function printUsage(deps) {
58
57
  color.dim(
59
58
  " wstack bench run --suite polyglot --polyglot-dir ./polyglot --models bench.config.json --limit 5"
60
59
  ),
61
- color.dim(
62
- " wstack bench run --suite local --suite-dir ./evals --models bench.config.json"
63
- ),
60
+ color.dim(" wstack bench run --suite local --suite-dir ./evals --models bench.config.json"),
64
61
  color.dim(" wstack bench mine --transcript ./session.jsonl --out ./evals"),
65
62
  color.dim(" wstack bench report ./bench-results/2026-06-14T10-00-00"),
66
63
  ""
@@ -198,9 +195,7 @@ async function benchReport(args, deps) {
198
195
  try {
199
196
  summary = await readSummary(outDir);
200
197
  } catch (err) {
201
- deps.renderer.writeError(
202
- `cannot read summary.json in ${outDir}: ${toErrorMessage(err)}`
203
- );
198
+ deps.renderer.writeError(`cannot read summary.json in ${outDir}: ${toErrorMessage(err)}`);
204
199
  return 1;
205
200
  }
206
201
  const md = renderMarkdownReport(summary);
@@ -211,7 +206,9 @@ async function benchReport(args, deps) {
211
206
  async function benchMine(args, deps) {
212
207
  const transcriptRaw = flagStr(deps, "transcript") ?? args.find((arg) => !arg.startsWith("-"));
213
208
  if (!transcriptRaw) {
214
- deps.renderer.writeError("Usage: wstack bench mine --transcript <session.jsonl> [--out <eval-dir>]");
209
+ deps.renderer.writeError(
210
+ "Usage: wstack bench mine --transcript <session.jsonl> [--out <eval-dir>]"
211
+ );
215
212
  return 1;
216
213
  }
217
214
  const outRaw = flagStr(deps, "out") ?? "evals";
@@ -220,7 +217,9 @@ async function benchMine(args, deps) {
220
217
  transcriptPath: path.resolve(deps.cwd, transcriptRaw),
221
218
  outDir: path.resolve(deps.cwd, outRaw)
222
219
  });
223
- deps.renderer.writeInfo(`Mined ${mined.candidates.length} edit attempt(s) from ${mined.sessionId}.`);
220
+ deps.renderer.writeInfo(
221
+ `Mined ${mined.candidates.length} edit attempt(s) from ${mined.sessionId}.`
222
+ );
224
223
  deps.renderer.writeInfo(`Pinned transcript \u2192 ${mined.copiedTranscriptPath}`);
225
224
  deps.renderer.writeInfo(`Curator drafts \u2192 ${mined.draftsPath}`);
226
225
  deps.renderer.writeInfo(
@@ -275,4 +274,4 @@ async function benchList(_args, deps) {
275
274
  export {
276
275
  benchCmd
277
276
  };
278
- //# sourceMappingURL=bench-7ZDWSNEF.js.map
277
+ //# sourceMappingURL=bench-XNDUJOSZ.js.map
@@ -1,5 +1,5 @@
1
- import type { Config, Logger } from '@wrongstack/core/types';
2
1
  import type { DefaultModelsRegistry } from '@wrongstack/core/models';
2
+ import type { Config, Logger } from '@wrongstack/core/types';
3
3
  /**
4
4
  * Fetch model lists for every auto-discovery provider in the config and merge
5
5
  * them into the catalog. Best-effort end to end: a down server or missing key
@@ -1,7 +1,7 @@
1
- import type { Config, Logger, Renderer, ModelsRegistry } from '@wrongstack/core/types';
2
- import type { WstackPaths } from '@wrongstack/core/utils';
3
- import type { EventBus } from '@wrongstack/core/kernel';
4
1
  import { DefaultPathResolver } from '@wrongstack/core/infrastructure';
2
+ import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { Config, Logger, ModelsRegistry, Renderer } from '@wrongstack/core/types';
4
+ import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  import { createDefaultContainer } from '@wrongstack/runtime';
6
6
  import { makePromptDelegate } from '../permission-prompt.js';
7
7
  interface WireContainerDeps {
@@ -1,4 +1,3 @@
1
- import { type WebuiSessionChildOptions } from './webui-session-child.js';
2
1
  import type { Agent } from '@wrongstack/core/agent';
3
2
  import type { BrainArbiter } from '@wrongstack/core/coordination';
4
3
  import type { JournalEntry } from '@wrongstack/core/goal';
@@ -8,6 +7,7 @@ import type { MCPRegistry } from '@wrongstack/mcp';
8
7
  import type { TerminalRenderer } from '../renderer.js';
9
8
  import type { AutonomyMode } from '../services/autonomy-mode.js';
10
9
  import type { CliWebUIOptions } from '../webui-server-options.js';
10
+ import { type WebuiSessionChildOptions } from './webui-session-child.js';
11
11
  export interface WebUIDispatchContext {
12
12
  agent: Agent;
13
13
  events: EventBus;
@@ -1,6 +1,5 @@
1
- import type { Config, Logger, ModelsRegistry } from '@wrongstack/core/types';
2
1
  import type { ProviderRegistry } from '@wrongstack/core/registry';
3
- import type { ResolvedProvider } from '@wrongstack/core/types';
2
+ import type { Config, Logger, ModelsRegistry, ResolvedProvider } from '@wrongstack/core/types';
4
3
  export type ModeId = string;
5
4
  export type ModePrompt = string;
6
5
  export interface ModelCapabilities {
@@ -1,8 +1,8 @@
1
1
  /** CLI boot adapter for canonical runtime tool registration and host policies. */
2
2
  import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { ToolRegistry } from '@wrongstack/core/registry';
3
4
  import type { MemoryPort, TokenSavingTier, ToolDescriptionModeConfig, ToolResultRenderModeConfig } from '@wrongstack/core/types';
4
5
  import type { WstackPaths } from '@wrongstack/core/utils';
5
- import type { ToolRegistry } from '@wrongstack/core/registry';
6
6
  interface RegisterBuiltinToolsDeps {
7
7
  toolRegistry: ToolRegistry;
8
8
  compactor: unknown;
@@ -1,5 +1,5 @@
1
- import { AutonomousCoordinator, type Director } from '@wrongstack/core/coordination';
2
1
  import type { Context } from '@wrongstack/core/agent';
2
+ import { AutonomousCoordinator, type Director } from '@wrongstack/core/coordination';
3
3
  import type { EventBus } from '@wrongstack/core/kernel';
4
4
  import type { WstackPaths } from '@wrongstack/core/utils';
5
5
  import type { TuiRuntimeState } from './tui-runtime-state.js';
@@ -1,7 +1,7 @@
1
1
  import type { Director } from '@wrongstack/core/coordination';
2
2
  import type { TerminalRenderer } from '../renderer.js';
3
- import type { TuiRuntimeState } from './tui-runtime-state.js';
4
3
  import type { ProjectSwitchContext } from './tui-project-switch.js';
4
+ import type { TuiRuntimeState } from './tui-runtime-state.js';
5
5
  export interface ProjectPickerContext {
6
6
  state: TuiRuntimeState;
7
7
  renderer: TerminalRenderer;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * TUI Theme adapter — extracts the getThemePreset/saveThemePreset pair from
3
+ * the runTui() options literal.
4
+ *
5
+ * Mirrors the `createSettingsAdapter` shape (see `./tui-settings-adapter.ts`)
6
+ * but is much narrower: theme is a single enum-valued key, so there's no
7
+ * section merge, no schema fan-out, and no encrypted-secret dance (the
8
+ * value is a plain preset name, not a credential).
9
+ *
10
+ * The disk write goes to the active profile's config file (same target
11
+ * `createSettingsAdapter` writes) so both layers share the same source of
12
+ * truth: future TUI boots read `themePreset` from the same JSON file the
13
+ * CLI writes via `/theme` and the WebUI flips via Settings.
14
+ */
15
+ import type { ConfigStore, ThemePresetId } from '@wrongstack/core/types';
16
+ import { type WstackPaths } from '@wrongstack/core/utils';
17
+ export interface ThemeAdapterDeps {
18
+ configStore: ConfigStore;
19
+ wpaths: Pick<WstackPaths, 'profileConfig'>;
20
+ }
21
+ export interface ThemeAdapter {
22
+ /** Read the live preset (memory-backed). Returns undefined when unset. */
23
+ getThemePreset: () => ThemePresetId | undefined;
24
+ /**
25
+ * Persist a new preset to BOTH the in-memory configStore (so the running
26
+ * session sees it immediately) and the active profile's config file on
27
+ * disk (so the next boot starts with this preset applied). Unknown ids
28
+ * are rejected without writing.
29
+ */
30
+ saveThemePreset: (preset: ThemePresetId) => Promise<void>;
31
+ }
32
+ export declare function createThemeAdapter({ configStore, wpaths }: ThemeAdapterDeps): ThemeAdapter;
33
+ //# sourceMappingURL=tui-theme-adapter.d.ts.map
@@ -1,7 +1,7 @@
1
- import type { Config } from '@wrongstack/core/types';
1
+ import type { DefaultPathResolver } from '@wrongstack/core/infrastructure';
2
2
  import { bootConfig as coreBootConfig } from '@wrongstack/core/infrastructure';
3
+ import type { Config } from '@wrongstack/core/types';
3
4
  import type { WstackPaths } from '@wrongstack/core/utils';
4
- import type { DefaultPathResolver } from '@wrongstack/core/infrastructure';
5
5
  export interface BootPaths {
6
6
  cwd: string;
7
7
  projectRoot: string;
package/dist/boot.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { DefaultLogger } from '@wrongstack/core/infrastructure';
1
2
  import type { Config, ModelsRegistry, SecretVault } from '@wrongstack/core/types';
2
3
  import { type WstackPaths } from '@wrongstack/core/utils';
3
- import { DefaultLogger } from '@wrongstack/core/infrastructure';
4
4
  import { ReadlineInputReader } from './input-reader.js';
5
5
  import { TerminalRenderer } from './renderer.js';
6
6
  import type { UpdateInfo } from './update-check.js';
@@ -66,7 +66,12 @@ async function buildPickableProviders(modelsRegistry, config) {
66
66
  const inherited = catalogById.get(catalogType) ?? catalogById.get(cfg.type ?? id);
67
67
  const family = cfg.family ?? inherited?.family ?? "unsupported";
68
68
  if (family === "unsupported") continue;
69
- const models = visibleModelIds(id, config, (inherited?.models ?? []).map((m) => m.id), cfg);
69
+ const models = visibleModelIds(
70
+ id,
71
+ config,
72
+ (inherited?.models ?? []).map((m) => m.id),
73
+ cfg
74
+ );
70
75
  out.push({ id, family, models });
71
76
  }
72
77
  for (const p of catalog) {
@@ -84,4 +89,4 @@ export {
84
89
  hasApiKey,
85
90
  buildPickableProviders
86
91
  };
87
- //# sourceMappingURL=chunk-ETOEGL3V.js.map
92
+ //# sourceMappingURL=chunk-3IC4IEZC.js.map
@@ -34,7 +34,8 @@ function boolFlag(flags, names) {
34
34
  function parsePositiveInteger(value, label) {
35
35
  if (value === void 0) throw new Error(`${label} is required`);
36
36
  const parsed = Number.parseInt(value, 10);
37
- if (!Number.isInteger(parsed) || parsed <= 0) throw new Error(`${label} must be a positive integer`);
37
+ if (!Number.isInteger(parsed) || parsed <= 0)
38
+ throw new Error(`${label} must be a positive integer`);
38
39
  return parsed;
39
40
  }
40
41
  function parsePort(value) {
@@ -124,4 +125,4 @@ export {
124
125
  writeWebuiSessionChildReady,
125
126
  writeWebuiSessionChildError
126
127
  };
127
- //# sourceMappingURL=chunk-PFVVUH5B.js.map
128
+ //# sourceMappingURL=chunk-3JPTNADJ.js.map
@@ -58,4 +58,4 @@ async function discoverAndMergeProviders(opts) {
58
58
  export {
59
59
  discoverAndMergeProviders
60
60
  };
61
- //# sourceMappingURL=chunk-4GVH7V3S.js.map
61
+ //# sourceMappingURL=chunk-52C7PD2H.js.map
@@ -3,11 +3,12 @@ import {
3
3
  } from "./chunk-U3SS4NRH.js";
4
4
  import {
5
5
  checkForUpdate
6
- } from "./chunk-F4PEGAJZ.js";
6
+ } from "./chunk-NUIHRGPY.js";
7
7
 
8
8
  // src/subcommands/handlers/update.ts
9
9
  import { spawn } from "node:child_process";
10
10
  import { existsSync, realpathSync } from "node:fs";
11
+ import * as path from "node:path";
11
12
  var MAX_UPDATE_OUTPUT_CHARS = 256 * 1024;
12
13
  async function runUpdateCommand(args, deps) {
13
14
  const cwd = deps.cwd;
@@ -75,9 +76,20 @@ async function runUpdateCommand(args, deps) {
75
76
  return 0;
76
77
  }
77
78
  const packageManager = parsed.packageManager ?? detectUpdatePackageManager();
78
- const updateCommand = buildUpdateCommand(packageManager, packageName, info.latest, {
79
- allowScripts: parsed.allowScripts
80
- });
79
+ let updateCommand;
80
+ try {
81
+ updateCommand = buildUpdateCommand(packageManager, packageName, info.latest, {
82
+ allowScripts: parsed.allowScripts,
83
+ cwd,
84
+ env: deps.environment
85
+ });
86
+ } catch (err) {
87
+ const msg = err instanceof Error ? err.message : String(err);
88
+ deps.renderer.write(`
89
+ Update failed: ${msg}
90
+ `);
91
+ return 1;
92
+ }
81
93
  deps.renderer.write(`Updating wrongstack from v${info.current} to v${info.latest}...
82
94
  `);
83
95
  deps.renderer.write(`Running: ${updateCommand.display}
@@ -122,6 +134,10 @@ Update ${termination}.
122
134
  ${result.stdout}`.trim();
123
135
  if (detail) deps.renderer.write(`
124
136
  ${detail}
137
+ `);
138
+ const lockedFilesGuidance = windowsLockedFilesGuidance(detail);
139
+ if (lockedFilesGuidance) deps.renderer.write(`
140
+ ${lockedFilesGuidance}
125
141
  `);
126
142
  deps.renderer.write(
127
143
  `
@@ -197,7 +213,12 @@ function parseUpdateArgs(args) {
197
213
  if (pmEq) {
198
214
  const pm = parsePackageManager(pmEq);
199
215
  if (!pm)
200
- return { checkOnly, packageManager, allowScripts, error: `Invalid package manager: ${pmEq}` };
216
+ return {
217
+ checkOnly,
218
+ packageManager,
219
+ allowScripts,
220
+ error: `Invalid package manager: ${pmEq}`
221
+ };
201
222
  packageManager = pm;
202
223
  continue;
203
224
  }
@@ -242,36 +263,53 @@ function detectUpdatePackageName(argv = process.argv) {
242
263
  const entry = (argv[1] ?? "").replace(/\\/g, "/").toLowerCase();
243
264
  return entry.includes("/node_modules/@wrongstack/cli/") || entry.includes("/packages/cli/dist/") ? "@wrongstack/cli" : "wrongstack";
244
265
  }
245
- function buildUpdateCommand(packageManager, packageName, version, opts = { allowScripts: false }) {
266
+ function buildUpdateCommand(packageManager, packageName, version, opts = {
267
+ allowScripts: false
268
+ }) {
246
269
  const ignoreScripts = !opts.allowScripts;
247
270
  const target = `${packageName}@${version}`;
248
271
  switch (packageManager) {
249
272
  case "pnpm":
250
273
  return command(
251
274
  packageManager,
252
- ignoreScripts ? ["add", "-g", "--ignore-scripts", target] : ["add", "-g", target]
275
+ ignoreScripts ? ["add", "-g", "--ignore-scripts", target] : ["add", "-g", target],
276
+ opts.cwd,
277
+ opts.env
253
278
  );
254
279
  case "yarn":
255
280
  return command(
256
281
  packageManager,
257
- ignoreScripts ? ["global", "add", "--ignore-scripts", target] : ["global", "add", target]
282
+ ignoreScripts ? ["global", "add", "--ignore-scripts", target] : ["global", "add", target],
283
+ opts.cwd,
284
+ opts.env
258
285
  );
259
286
  case "bun":
260
287
  return command(
261
288
  packageManager,
262
- ignoreScripts ? ["add", "-g", "--ignore-scripts", target] : ["add", "-g", target]
289
+ ignoreScripts ? ["add", "-g", "--ignore-scripts", target] : ["add", "-g", target],
290
+ opts.cwd,
291
+ opts.env
263
292
  );
264
293
  case "npm":
265
294
  return command(
266
295
  packageManager,
267
- ignoreScripts ? ["install", "-g", "--ignore-scripts", target] : ["install", "-g", target]
296
+ ignoreScripts ? ["install", "-g", "--ignore-scripts", target] : ["install", "-g", target],
297
+ opts.cwd,
298
+ opts.env
268
299
  );
269
300
  }
270
301
  }
271
- function command(pm, args) {
302
+ function command(pm, args, cwd, env = process.env) {
272
303
  const display = `${pm} ${args.join(" ")}`;
273
- if (process.platform === "win32" && pm !== "bun") {
274
- const shim = buildWin32CmdShimInvocation(pm, args);
304
+ const resolvedExecutable = cwd ? resolveWin32PackageManagerPath(pm, cwd, env) : void 0;
305
+ if (process.platform === "win32" && cwd && !resolvedExecutable) {
306
+ throw new Error(
307
+ `Could not find ${pm} outside the current project directory. Install ${pm} globally or put its global executable directory on PATH.`
308
+ );
309
+ }
310
+ const executable = resolvedExecutable ?? pm;
311
+ if (process.platform === "win32" && (pm !== "bun" || /\.(?:cmd|bat)$/i.test(executable))) {
312
+ const shim = buildWin32CmdShimInvocation(executable, args);
275
313
  return {
276
314
  executable: shim.command,
277
315
  args: shim.args,
@@ -279,7 +317,39 @@ function command(pm, args) {
279
317
  windowsVerbatimArguments: shim.windowsVerbatimArguments
280
318
  };
281
319
  }
282
- return { executable: pm, args, display };
320
+ return { executable, args, display };
321
+ }
322
+ function resolveWin32PackageManagerPath(packageManager, cwd, env = process.env, pathExists = existsSync) {
323
+ if (process.platform !== "win32") return void 0;
324
+ const pathValue = environmentValue(env, "PATH");
325
+ if (!pathValue) return void 0;
326
+ const cwdPath = path.win32.resolve(cwd).toLowerCase();
327
+ const extensions = packageManager.includes(".") ? [""] : environmentValue(env, "PATHEXT")?.split(";").filter(Boolean) ?? [
328
+ ".COM",
329
+ ".EXE",
330
+ ".BAT",
331
+ ".CMD"
332
+ ];
333
+ for (const rawEntry of pathValue.split(";")) {
334
+ const entry = rawEntry.trim().replace(/^"|"$/g, "");
335
+ if (!entry || !path.win32.isAbsolute(entry)) continue;
336
+ const directory = path.win32.resolve(entry);
337
+ if (isPathInsideWin32(directory, cwdPath)) continue;
338
+ for (const extension of extensions) {
339
+ const candidate = path.win32.join(directory, `${packageManager}${extension}`);
340
+ if (pathExists(candidate)) return candidate;
341
+ }
342
+ }
343
+ return void 0;
344
+ }
345
+ function environmentValue(env, key) {
346
+ const match = Object.entries(env).find(([name]) => name.toUpperCase() === key);
347
+ return typeof match?.[1] === "string" ? match[1] : void 0;
348
+ }
349
+ function isPathInsideWin32(candidate, parent) {
350
+ const normalizedCandidate = path.win32.resolve(candidate).toLowerCase();
351
+ const relative = path.win32.relative(parent, normalizedCandidate);
352
+ return relative === "" || !relative.startsWith("..\\") && relative !== ".." && !path.win32.isAbsolute(relative);
283
353
  }
284
354
  function otherManagerCommands(selected, packageName, version, opts = { allowScripts: false }) {
285
355
  const commands = ["npm", "pnpm", "yarn", "bun"].filter((pm) => pm !== selected).map((pm) => ` ${buildUpdateCommand(pm, packageName, version, opts).display}`);
@@ -296,6 +366,15 @@ function installWarningSummary(output) {
296
366
  if (!/allow-scripts|allowScripts/i.test(output)) return null;
297
367
  return "Install completed, but npm reported blocked lifecycle scripts. If a native optional feature is missing, rerun the update with npm script approval for the named package.";
298
368
  }
369
+ function windowsLockedFilesGuidance(output) {
370
+ if (process.platform !== "win32") return null;
371
+ const hasLockError = /\b(?:EBUSY|EPERM|EACCES|ENOTEMPTY)\b/i.test(output);
372
+ const isWrongStackNativeFile = /(?:\.wrongstack-|wrongstack[\\/]node_modules|electron\.exe|dd_pprof\.node|node-pty)/i.test(
373
+ output
374
+ );
375
+ if (!hasLockError || !isWrongStackNativeFile) return null;
376
+ return "Windows could not replace a native file held by a running WrongStack process. Stop any WrongStack WebUI, Desktop, or background process, then rerun the same update command. Do not remove npm\u2019s .wrongstack-* staging directory until those processes have stopped.";
377
+ }
299
378
 
300
379
  export {
301
380
  runUpdateCommand,
@@ -303,4 +382,4 @@ export {
303
382
  detectUpdatePackageManager,
304
383
  detectUpdatePackageName
305
384
  };
306
- //# sourceMappingURL=chunk-I5MEUFDI.js.map
385
+ //# sourceMappingURL=chunk-53STH6CX.js.map
@@ -4,7 +4,12 @@ function createHqCommandDispatcher(controller) {
4
4
  return async (command) => {
5
5
  const cmd = command;
6
6
  try {
7
- const result = await dispatch(controller, cmd.commandId, cmd.type, cmd.payload);
7
+ const result = await dispatch(
8
+ controller,
9
+ cmd.commandId,
10
+ cmd.type,
11
+ cmd.payload
12
+ );
8
13
  return result;
9
14
  } catch (err) {
10
15
  return {
@@ -139,4 +144,4 @@ ${command}
139
144
  export {
140
145
  createHqCommandDispatcher
141
146
  };
142
- //# sourceMappingURL=chunk-OP47B3IX.js.map
147
+ //# sourceMappingURL=chunk-7YLN7YUA.js.map
@@ -4,10 +4,9 @@ import { randomUUID } from "node:crypto";
4
4
  import * as fs from "node:fs/promises";
5
5
  import os from "node:os";
6
6
  import * as path from "node:path";
7
- import { atomicWrite, resolveWstackPaths, writeErr } from "@wrongstack/core/utils";
8
- import { ERROR_CODES, FsError } from "@wrongstack/core/types";
9
7
  import { isSecretField } from "@wrongstack/core/security";
10
- import { toErrorMessage } from "@wrongstack/core/utils";
8
+ import { ERROR_CODES, FsError } from "@wrongstack/core/types";
9
+ import { atomicWrite, resolveWstackPaths, toErrorMessage, writeErr } from "@wrongstack/core/utils";
11
10
  var defaultUidFn = () => os.userInfo().uid;
12
11
  async function getFileUid(filePath) {
13
12
  try {
@@ -141,7 +140,11 @@ function historyDir(homeFn = defaultHomeDir, targetConfigPath) {
141
140
  return path.join(path.dirname(configPath(homeFn, targetConfigPath)), "config.history", "entries");
142
141
  }
143
142
  function historyIndexPath(homeFn = defaultHomeDir, targetConfigPath) {
144
- return path.join(path.dirname(configPath(homeFn, targetConfigPath)), "config.history", "index.json");
143
+ return path.join(
144
+ path.dirname(configPath(homeFn, targetConfigPath)),
145
+ "config.history",
146
+ "index.json"
147
+ );
145
148
  }
146
149
  function configPath(homeFn = defaultHomeDir, targetConfigPath) {
147
150
  return targetConfigPath ?? activeProfileConfigPath(homeFn);
@@ -221,9 +224,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
221
224
  try {
222
225
  await atomicWrite(last, content, { mode: 384 });
223
226
  } catch (err) {
224
- writeErr(
225
- `[config-history] .last backup failed: ${toErrorMessage(err)}`
226
- );
227
+ writeErr(`[config-history] .last backup failed: ${toErrorMessage(err)}`);
227
228
  }
228
229
  }
229
230
  if (content !== void 0) {
@@ -231,9 +232,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
231
232
  const bakPath = `${cfg}.${ts}.bak`;
232
233
  await atomicWrite(bakPath, content, { mode: 384 });
233
234
  } catch (err) {
234
- writeErr(
235
- `[config-history] timestamped backup failed: ${toErrorMessage(err)}`
236
- );
235
+ writeErr(`[config-history] timestamped backup failed: ${toErrorMessage(err)}`);
237
236
  }
238
237
  }
239
238
  try {
@@ -244,9 +243,7 @@ async function backupCurrent(homeFn = defaultHomeDir, targetConfigPath) {
244
243
  await safeDelete(path.join(dir, f));
245
244
  }
246
245
  } catch (err) {
247
- writeErr(
248
- `[config-history] backup prune failed: ${toErrorMessage(err)}`
249
- );
246
+ writeErr(`[config-history] backup prune failed: ${toErrorMessage(err)}`);
250
247
  }
251
248
  }
252
249
  async function appendHistory(oldCfg, newCfg, description, homeFn = defaultHomeDir, targetConfigPath) {
@@ -366,4 +363,4 @@ export {
366
363
  restoreFromHistory,
367
364
  restoreLast
368
365
  };
369
- //# sourceMappingURL=chunk-263G3FMB.js.map
366
+ //# sourceMappingURL=chunk-B4JLSXZB.js.map
@@ -2,11 +2,11 @@ import {
2
2
  hasApiKey,
3
3
  isKeylessLocalProvider,
4
4
  visibleModelIds
5
- } from "./chunk-ETOEGL3V.js";
5
+ } from "./chunk-3IC4IEZC.js";
6
6
  import {
7
7
  appendHistory,
8
8
  backupCurrent
9
- } from "./chunk-263G3FMB.js";
9
+ } from "./chunk-B4JLSXZB.js";
10
10
 
11
11
  // src/arg-parser.ts
12
12
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
@@ -230,8 +230,15 @@ var LOCAL_LLM_PRESETS = projectLocalProviderPresets();
230
230
 
231
231
  // src/picker.ts
232
232
  import os from "node:os";
233
- import { color as color3, expectDefined as expectDefined2, setOutputLineGuard as setOutputLineGuard2, setRawMode as setRawMode2, stripAnsi as stripAnsi2, writeOut as writeOut2 } from "@wrongstack/core/utils";
234
- import { toErrorMessage } from "@wrongstack/core/utils";
233
+ import {
234
+ color as color3,
235
+ expectDefined as expectDefined2,
236
+ setOutputLineGuard as setOutputLineGuard2,
237
+ setRawMode as setRawMode2,
238
+ stripAnsi as stripAnsi2,
239
+ toErrorMessage,
240
+ writeOut as writeOut2
241
+ } from "@wrongstack/core/utils";
235
242
 
236
243
  // src/picker-key-state.ts
237
244
  function applyPickerKey(state, chunk, matchCount) {
@@ -267,7 +274,13 @@ function applyPickerKey(state, chunk, matchCount) {
267
274
  }
268
275
 
269
276
  // src/picker-model-picker.ts
270
- import { color as color2, expectDefined, setOutputLineGuard, setRawMode, writeOut } from "@wrongstack/core/utils";
277
+ import {
278
+ color as color2,
279
+ expectDefined,
280
+ setOutputLineGuard,
281
+ setRawMode,
282
+ writeOut
283
+ } from "@wrongstack/core/utils";
271
284
 
272
285
  // src/picker-ui.ts
273
286
  import { color, stripAnsi } from "@wrongstack/core/utils";
@@ -1039,4 +1052,4 @@ export {
1039
1052
  runLiveProviderPicker,
1040
1053
  runPicker
1041
1054
  };
1042
- //# sourceMappingURL=chunk-MT6FGXO3.js.map
1055
+ //# sourceMappingURL=chunk-C5NXM2SI.js.map
@@ -435,4 +435,4 @@ export {
435
435
  getTaskGraphId,
436
436
  getTaskTrackerExport
437
437
  };
438
- //# sourceMappingURL=chunk-XTIXVJXP.js.map
438
+ //# sourceMappingURL=chunk-DGXNL7OT.js.map