@wrongstack/cli 1.0.1 → 1.0.3

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 (54) hide show
  1. package/data/providers.json +21 -21
  2. package/dist/{acp-3LARESEO.js → acp-JK4ZQO3R.js} +4 -3
  3. package/dist/{auth-ZUMCDNE5.js → auth-XD3GN5RJ.js} +78 -54
  4. package/dist/auth-menu/index.d.ts +1 -0
  5. package/dist/auth-menu/oauth-menu.d.ts +3 -1
  6. package/dist/auth-menu/panel-service.d.ts +2 -0
  7. package/dist/auth-menu/provider-auth-login.d.ts +12 -0
  8. package/dist/auth-menu/types.d.ts +3 -0
  9. package/dist/auto-discover-providers-DXR25GTG.js +7 -0
  10. package/dist/boot/dispatch-webui.d.ts +1 -0
  11. package/dist/boot/system-prompt-builder.d.ts +7 -0
  12. package/dist/boot/system-prompt.d.ts +2 -1
  13. package/dist/chimera-reviewer-policy.d.ts +1 -1
  14. package/dist/{chunk-KHWDTNBZ.js → chunk-4NHD5OXJ.js} +2 -2
  15. package/dist/chunk-D5GB5MHA.js +87 -0
  16. package/dist/chunk-DAKVBMD4.js +36 -0
  17. package/dist/{chunk-ZSZ3EYWH.js → chunk-GMY45LO6.js} +9 -5
  18. package/dist/{chunk-D2VCUN7M.js → chunk-IUEKNHPT.js} +10 -10
  19. package/dist/{chunk-MNQQ4ZNF.js → chunk-ONOT5OJ2.js} +290 -687
  20. package/dist/chunk-SIGUWXAA.js +43 -0
  21. package/dist/{chunk-TEBMCYZN.js → chunk-SIS37L3W.js} +58 -2
  22. package/dist/{chunk-5IA5337I.js → chunk-U6KCWRMC.js} +4 -2
  23. package/dist/{cli-context-7X3M6U73.js → cli-context-Q6QP534K.js} +18 -7
  24. package/dist/{cli-main-53KG6HAV.js → cli-main-JQXCDZEA.js} +2909 -2277
  25. package/dist/execute-deps.d.ts +1 -0
  26. package/dist/{execution-MIBWBYB6.js → execution-KH7WJNAX.js} +11 -4
  27. package/dist/index.js +3 -3
  28. package/dist/live-settings-input.d.ts +2 -0
  29. package/dist/{mailbox-serve-VUCWZ2SJ.js → mailbox-serve-X3CR6VFW.js} +4 -3
  30. package/dist/{modeldiag-FMJT37SN.js → modeldiag-46CMWUNM.js} +31 -24
  31. package/dist/{plugin-usage-HFBI3TFT.js → plugin-usage-M6KET4OZ.js} +2 -2
  32. package/dist/{plugins-PZ2VZL7V.js → plugins-U7KGQAUG.js} +3 -3
  33. package/dist/{providers-models-YVMVYWRS.js → providers-models-6MOGAOVK.js} +2 -2
  34. package/dist/{short-circuit-flags-UREFSYBL.js → short-circuit-flags-ZNZX44MC.js} +2 -2
  35. package/dist/slash-commands/codebase-map.d.ts +11 -0
  36. package/dist/slash-commands/command-context.d.ts +7 -0
  37. package/dist/slash-commands/context.d.ts +10 -0
  38. package/dist/slash-commands/openai-quota.d.ts +31 -0
  39. package/dist/{subcommands-WJLBHVKC.js → subcommands-CUTGBDKP.js} +2 -2
  40. package/dist/{webui-server-5R35BHWZ.js → webui-server-QWBUT7BO.js} +19 -2
  41. package/dist/webui-server-options.d.ts +1 -0
  42. package/dist/wiring/atlas-prompt-contributor.d.ts +54 -0
  43. package/dist/wiring/cli-execute-builder.d.ts +1 -0
  44. package/dist/wiring/codebase-embeddings.d.ts +31 -0
  45. package/dist/wiring/command-host-state.d.ts +2 -0
  46. package/dist/wiring/concept-summarizer.d.ts +32 -0
  47. package/dist/wiring/external-plugins.d.ts +1 -0
  48. package/dist/wiring/lifecycle-plugins.d.ts +2 -1
  49. package/dist/wiring/plugins.d.ts +2 -1
  50. package/dist/wiring/provider.d.ts +2 -1
  51. package/package.json +29 -29
  52. package/dist/auto-discover-providers-VQU3IZMR.js +0 -7
  53. package/dist/chunk-52C7PD2H.js +0 -61
  54. package/dist/chunk-TNK6237M.js +0 -262
@@ -149,6 +149,7 @@ interface SessionDeps {
149
149
  /** Provider/model registry, selection and switching. */
150
150
  interface ProviderDeps {
151
151
  statusTracker?: import('@wrongstack/core/coordination').ProviderModelStatusTracker | undefined;
152
+ providerAuthRegistry: import('@wrongstack/core/registry').ProviderAuthRegistry;
152
153
  modelsRegistry: ModelsRegistry;
153
154
  savedProviderCfg: ProviderConfig | undefined;
154
155
  resolvedProvider: ResolvedProvider | undefined;
@@ -178,6 +178,7 @@ async function runWebUIDispatch(ctx) {
178
178
  globalConfigPath,
179
179
  projectSessionsDir,
180
180
  modelsRegistry,
181
+ providerAuthRegistry,
181
182
  mcpRegistry,
182
183
  brain,
183
184
  brainSettings,
@@ -211,7 +212,7 @@ async function runWebUIDispatch(ctx) {
211
212
  const isSimpleUi = !isSessionChild && flags["simpleui"] === true;
212
213
  agent.disableInteractiveConfirmation();
213
214
  renderer.setSilent(true);
214
- const { runWebUI } = await import("./webui-server-5R35BHWZ.js");
215
+ const { runWebUI } = await import("./webui-server-QWBUT7BO.js");
215
216
  const flagValue = (names) => {
216
217
  for (const name of names) {
217
218
  if (!Object.hasOwn(flags, name)) continue;
@@ -305,6 +306,7 @@ async function runWebUIDispatch(ctx) {
305
306
  agentTranscripts,
306
307
  hqAllowExec: flagBoolean(["hq-allow-exec"]) ?? false,
307
308
  modelsRegistry,
309
+ providerAuthRegistry,
308
310
  globalConfigPath,
309
311
  profileConfigPath: ctx.profileConfigPath,
310
312
  mcpRegistry,
@@ -1923,6 +1925,7 @@ function createSettingsAdapter(ctx) {
1923
1925
  systemPromptVariant: cfg.systemPrompt?.variant === "lite" || cfg.systemPrompt?.variant === "pro" ? cfg.systemPrompt.variant : cfg.systemPrompt?.variant === "default" ? "default" : "pro",
1924
1926
  enhanceDelayMs: cfg.autonomy?.enhanceDelayMs ?? 15e3,
1925
1927
  enhanceEnabled: cfg.autonomy?.enhance ?? true,
1928
+ preRefineSeconds: cfg.autonomy?.preRefineSeconds ?? 3,
1926
1929
  enhanceLanguage: cfg.autonomy?.enhanceLanguage === "english" ? "english" : cfg.autonomy?.enhanceLanguage === "original" ? "original" : "english",
1927
1930
  midRunSendPicker: cfg.autonomy?.midRunSendPicker ?? true,
1928
1931
  mouseMode: autonomy?.mouseMode ?? false,
@@ -1960,7 +1963,7 @@ function createSettingsAdapter(ctx) {
1960
1963
  }
1961
1964
  async function saveSettings(s) {
1962
1965
  try {
1963
- if (s.mode !== void 0 || s.delayMs !== void 0 || s.titleAnimation !== void 0 || s.yolo !== void 0 || s.fleetChatVerbosity !== void 0 || s.chime !== void 0 || s.confirmExit !== void 0 || s.mouseMode !== void 0 || s.featureMcp !== void 0 || s.featurePlugins !== void 0 || s.featureMemory !== void 0 || s.featureSkills !== void 0 || s.featureModelsRegistry !== void 0 || s.featureTokenSaving !== void 0 || s.allowOutsideProjectRoot !== void 0 || s.contextAutoCompact !== void 0 || s.contextStrategy !== void 0 || s.contextMode !== void 0 || s.maxConcurrent !== void 0 || s.logLevel !== void 0 || s.auditLevel !== void 0 || s.indexOnStart !== void 0 || s.maxIterations !== void 0 || s.multiDiffSummaryThreshold !== void 0 || s.nextStepsTool !== void 0 || s.restrictFsToRoot !== void 0 || s.nextPrediction !== void 0 || s.debugStream !== void 0 || s.shellBangWarningDontShowAgain !== void 0 || s.configScope !== void 0 || s.enhanceDelayMs !== void 0 || s.enhanceEnabled !== void 0 || s.enhanceLanguage !== void 0 || s.midRunSendPicker !== void 0 || s.statuslineMode !== void 0 || s.thinkingWord !== void 0 || s.animationStyle !== void 0 || s.autonomyNextPrompt !== void 0 || s.autoProceedMaxIterations !== void 0 || s.reasoningMode !== void 0 || s.reasoningEffort !== void 0 || s.reasoningPreserve !== void 0 || s.cacheTtl !== void 0 || s.breakerEnabled !== void 0 || s.breakerAutoKillResetMs !== void 0 || s.showModelReasoning !== void 0 || s.showAgentSwarmPanel !== void 0 || s.showSidebar !== void 0 || s.panelPositions !== void 0 || s.showSageMemoryInject !== void 0 || s.sageMemoryInjectThreshold !== void 0 || s.readSymbols !== void 0 || // WrongProxy / WrongTrace: gate the persisted-section write on
1966
+ if (s.mode !== void 0 || s.delayMs !== void 0 || s.titleAnimation !== void 0 || s.yolo !== void 0 || s.fleetChatVerbosity !== void 0 || s.chime !== void 0 || s.confirmExit !== void 0 || s.mouseMode !== void 0 || s.featureMcp !== void 0 || s.featurePlugins !== void 0 || s.featureMemory !== void 0 || s.featureSkills !== void 0 || s.featureModelsRegistry !== void 0 || s.featureTokenSaving !== void 0 || s.allowOutsideProjectRoot !== void 0 || s.contextAutoCompact !== void 0 || s.contextStrategy !== void 0 || s.contextMode !== void 0 || s.maxConcurrent !== void 0 || s.logLevel !== void 0 || s.auditLevel !== void 0 || s.indexOnStart !== void 0 || s.maxIterations !== void 0 || s.multiDiffSummaryThreshold !== void 0 || s.nextStepsTool !== void 0 || s.restrictFsToRoot !== void 0 || s.nextPrediction !== void 0 || s.debugStream !== void 0 || s.shellBangWarningDontShowAgain !== void 0 || s.configScope !== void 0 || s.enhanceDelayMs !== void 0 || s.enhanceEnabled !== void 0 || s.preRefineSeconds !== void 0 || s.enhanceLanguage !== void 0 || s.midRunSendPicker !== void 0 || s.statuslineMode !== void 0 || s.thinkingWord !== void 0 || s.animationStyle !== void 0 || s.autonomyNextPrompt !== void 0 || s.autoProceedMaxIterations !== void 0 || s.reasoningMode !== void 0 || s.reasoningEffort !== void 0 || s.reasoningPreserve !== void 0 || s.cacheTtl !== void 0 || s.breakerEnabled !== void 0 || s.breakerAutoKillResetMs !== void 0 || s.showModelReasoning !== void 0 || s.showAgentSwarmPanel !== void 0 || s.showSidebar !== void 0 || s.panelPositions !== void 0 || s.showSageMemoryInject !== void 0 || s.sageMemoryInjectThreshold !== void 0 || s.readSymbols !== void 0 || // WrongProxy / WrongTrace: gate the persisted-section write on
1964
1967
  // either key being present in the live patch. Without this, a
1965
1968
  // picker toggle round-trip would silently no-op the persistence
1966
1969
  // layer (the runtime probe would never read the change).
@@ -2005,6 +2008,7 @@ function createSettingsAdapter(ctx) {
2005
2008
  if (s.mouseMode !== void 0) autonomy.mouseMode = s.mouseMode;
2006
2009
  if (s.enhanceDelayMs !== void 0) autonomy.enhanceDelayMs = s.enhanceDelayMs;
2007
2010
  if (s.enhanceEnabled !== void 0) autonomy.enhance = s.enhanceEnabled;
2011
+ if (s.preRefineSeconds !== void 0) autonomy.preRefineSeconds = s.preRefineSeconds;
2008
2012
  if (s.enhanceLanguage !== void 0) autonomy.enhanceLanguage = s.enhanceLanguage;
2009
2013
  if (s.midRunSendPicker !== void 0) autonomy.midRunSendPicker = s.midRunSendPicker;
2010
2014
  if (s.shellBangWarningDontShowAgain !== void 0)
@@ -2570,6 +2574,7 @@ var CHIMERA_REVIEW_READ_ONLY_TOOLS = Object.freeze([
2570
2574
  "codebase-stats",
2571
2575
  "codebase-search",
2572
2576
  "codebase-skeleton",
2577
+ "codebase-context",
2573
2578
  "codebase-repo-map",
2574
2579
  "codebase-incoming-calls",
2575
2580
  "codebase-outgoing-calls"
@@ -4445,7 +4450,7 @@ ${list}`);
4445
4450
  function parsePredictions(raw, max = 3) {
4446
4451
  const text = raw.trim();
4447
4452
  if (!text) return [];
4448
- if (/^none\.?\s*$/i.test(text) || /^no further steps/i.test(text)) return [];
4453
+ if (/^none\.?\s*$/i.test(text) || /^no further steps(?: needed)?\.?\s*$/i.test(text)) return [];
4449
4454
  const out = [];
4450
4455
  for (const lineRaw of text.split("\n")) {
4451
4456
  const line = lineRaw.trim();
@@ -6091,6 +6096,7 @@ async function execute(deps) {
6091
6096
  },
6092
6097
  provider: {
6093
6098
  modelsRegistry,
6099
+ providerAuthRegistry,
6094
6100
  savedProviderCfg,
6095
6101
  resolvedProvider,
6096
6102
  statusTracker,
@@ -6595,6 +6601,7 @@ async function execute(deps) {
6595
6601
  profileConfigPath: wpaths.profileConfig(profileName),
6596
6602
  projectSessionsDir: wpaths.projectSessions,
6597
6603
  modelsRegistry,
6604
+ providerAuthRegistry,
6598
6605
  mcpRegistry,
6599
6606
  brain,
6600
6607
  brainSettings,
@@ -6741,4 +6748,4 @@ export {
6741
6748
  execute,
6742
6749
  resolveReviewerFallbackModels
6743
6750
  };
6744
- //# sourceMappingURL=execution-MIBWBYB6.js.map
6751
+ //# sourceMappingURL=execution-KH7WJNAX.js.map
package/dist/index.js CHANGED
@@ -16,14 +16,14 @@ async function main(argv) {
16
16
  applySessionShellDefault();
17
17
  const earlyFlags = parseArgs(argv).flags;
18
18
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
19
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-UREFSYBL.js");
19
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-ZNZX44MC.js");
20
20
  const earlyExit = await handleHelpVersionShortCircuit(argv);
21
21
  if (earlyExit !== null) return earlyExit;
22
22
  }
23
- const { initializeCli } = await import("./cli-context-7X3M6U73.js");
23
+ const { initializeCli } = await import("./cli-context-Q6QP534K.js");
24
24
  const cliCtx = await initializeCli(argv);
25
25
  if (typeof cliCtx === "number") return cliCtx;
26
- const { runInteractive } = await import("./cli-main-53KG6HAV.js");
26
+ const { runInteractive } = await import("./cli-main-JQXCDZEA.js");
27
27
  return runInteractive(cliCtx);
28
28
  }
29
29
 
@@ -39,6 +39,8 @@ export interface LiveSettingsInput {
39
39
  enhanceDelayMs?: number | undefined;
40
40
  enhanceEnabled?: boolean | undefined;
41
41
  enhanceLanguage?: string | undefined;
42
+ /** Pre-refine grace period (seconds) before the refiner LLM call starts. 0 = skip. Default: 3. */
43
+ preRefineSeconds?: number | undefined;
42
44
  /** Mid-run send-mode picker (queue/btw/steer) toggle. Default on. */
43
45
  midRunSendPicker?: boolean | undefined;
44
46
  /** Skip the confirmation prompt for the TUI `!<command>` shell shortcut. */
@@ -114,8 +114,9 @@ or stop the conflicting process and retry.
114
114
  credentialStore,
115
115
  projectId,
116
116
  authorize: (request) => {
117
- if (/^Credential\s+/i.test(request.headers.authorization ?? "")) {
118
- return { allowed: true };
117
+ const header = request.headers.authorization;
118
+ if (typeof header === "string" && /^Credential\s+/i.test(header)) {
119
+ return void 0;
119
120
  }
120
121
  return authorizeMailboxBearerToken(request, tentative.token);
121
122
  },
@@ -359,4 +360,4 @@ function printHelp(deps) {
359
360
  export {
360
361
  mailboxServeCmd
361
362
  };
362
- //# sourceMappingURL=mailbox-serve-VUCWZ2SJ.js.map
363
+ //# sourceMappingURL=mailbox-serve-X3CR6VFW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  discoverAndMergeProviders
3
- } from "./chunk-52C7PD2H.js";
3
+ } from "./chunk-D5GB5MHA.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
@@ -1081,30 +1081,37 @@ async function runModeldiagTest(args, deps, config) {
1081
1081
  // src/subcommands/handlers/modeldiag.ts
1082
1082
  async function readProviders(cachePath) {
1083
1083
  if (!cachePath) {
1084
- return `${color5.red("Models cache not available")}.`;
1084
+ return { ok: false, message: `${color5.red("Models cache not available")}.`, hard: true };
1085
1085
  }
1086
1086
  try {
1087
1087
  const raw = await fs.readFile(cachePath, "utf8");
1088
1088
  const parsed = JSON.parse(raw);
1089
1089
  const payload = parsed.payload ?? parsed;
1090
- return Object.entries(payload).map(([id, p]) => ({
1091
- id: p.id ?? id,
1092
- name: p.name ?? id,
1093
- family: p.npm ?? id,
1094
- models: Object.values(p.models ?? {}).map(
1095
- (m) => ({
1096
- id: m.id,
1097
- name: m.name,
1098
- capabilities: {
1099
- contextWindow: m.limit?.context,
1100
- maxOutputTokens: m.limit?.output
1101
- },
1102
- pricing: m.cost
1103
- })
1104
- )
1105
- }));
1090
+ return {
1091
+ ok: true,
1092
+ providers: Object.entries(payload).map(([id, p]) => ({
1093
+ id: p.id ?? id,
1094
+ name: p.name ?? id,
1095
+ family: p.npm ?? id,
1096
+ models: Object.values(p.models ?? {}).map(
1097
+ (m) => ({
1098
+ id: m.id,
1099
+ name: m.name,
1100
+ capabilities: {
1101
+ contextWindow: m.limit?.context,
1102
+ maxOutputTokens: m.limit?.output
1103
+ },
1104
+ pricing: m.cost
1105
+ })
1106
+ )
1107
+ }))
1108
+ };
1106
1109
  } catch {
1107
- return `${color5.amber("Models cache not available")}. Run wstack sync-models.`;
1110
+ return {
1111
+ ok: false,
1112
+ message: `${color5.amber("Models cache not available")}. Run wstack sync-models.`,
1113
+ hard: false
1114
+ };
1108
1115
  }
1109
1116
  }
1110
1117
  function checkHasKey(pid, config) {
@@ -1118,12 +1125,12 @@ function checkHasKey(pid, config) {
1118
1125
  var modeldiagCmd = async (args, deps) => {
1119
1126
  const sub = args[0]?.toLowerCase() || "full";
1120
1127
  const cacheResult = await readProviders(deps.paths.modelsCache);
1121
- if (typeof cacheResult === "string") {
1122
- deps.renderer.write(`${cacheResult}
1128
+ if (!cacheResult.ok) {
1129
+ deps.renderer.write(`${cacheResult.message}
1123
1130
  `);
1124
- return cacheResult.includes(color5.red("")) ? 1 : 0;
1131
+ return cacheResult.hard ? 1 : 0;
1125
1132
  }
1126
- const providers = cacheResult;
1133
+ const providers = cacheResult.providers;
1127
1134
  const config = deps.config;
1128
1135
  const modelMatrix = config.modelMatrix ?? {};
1129
1136
  function hasKey(pid) {
@@ -1322,4 +1329,4 @@ var modeldiagCmd = async (args, deps) => {
1322
1329
  export {
1323
1330
  modeldiagCmd
1324
1331
  };
1325
- //# sourceMappingURL=modeldiag-FMJT37SN.js.map
1332
+ //# sourceMappingURL=modeldiag-46CMWUNM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runPluginManagementCommand
3
- } from "./chunk-TEBMCYZN.js";
3
+ } from "./chunk-SIS37L3W.js";
4
4
  import {
5
5
  restoreFlags
6
6
  } from "./chunk-CSAPOCBP.js";
@@ -40,4 +40,4 @@ export {
40
40
  pluginCmd,
41
41
  usageCmd
42
42
  };
43
- //# sourceMappingURL=plugin-usage-HFBI3TFT.js.map
43
+ //# sourceMappingURL=plugin-usage-M6KET4OZ.js.map
@@ -6,9 +6,9 @@ import {
6
6
  pluginNameFromSpec,
7
7
  setupPlugins,
8
8
  warnIfDeprecatedPluginName
9
- } from "./chunk-5IA5337I.js";
9
+ } from "./chunk-U6KCWRMC.js";
10
10
  import "./chunk-EWKESL4L.js";
11
- import "./chunk-TEBMCYZN.js";
11
+ import "./chunk-SIS37L3W.js";
12
12
  export {
13
13
  BUILTIN_PLUGIN_FACTORIES,
14
14
  DEPRECATED_PLUGIN_NAMES,
@@ -18,4 +18,4 @@ export {
18
18
  setupPlugins,
19
19
  warnIfDeprecatedPluginName
20
20
  };
21
- //# sourceMappingURL=plugins-PZ2VZL7V.js.map
21
+ //# sourceMappingURL=plugins-U7KGQAUG.js.map
@@ -239,7 +239,7 @@ function aliasProviderId(configProviderId, cfg) {
239
239
  async function discoverProviderModels(deps, ids) {
240
240
  if (!("mergeOverlay" in deps.modelsRegistry)) return void 0;
241
241
  try {
242
- const { discoverAndMergeProviders } = await import("./auto-discover-providers-VQU3IZMR.js");
242
+ const { discoverAndMergeProviders } = await import("./auto-discover-providers-DXR25GTG.js");
243
243
  await discoverAndMergeProviders({
244
244
  config: deps.config,
245
245
  registry: deps.modelsRegistry,
@@ -660,4 +660,4 @@ export {
660
660
  modelsCmd,
661
661
  providersCmd
662
662
  };
663
- //# sourceMappingURL=providers-models-YVMVYWRS.js.map
663
+ //# sourceMappingURL=providers-models-6MOGAOVK.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  handleHelpVersionShortCircuit
3
- } from "./chunk-KHWDTNBZ.js";
3
+ } from "./chunk-4NHD5OXJ.js";
4
4
  import "./chunk-FPIWTJ2G.js";
5
5
  import "./chunk-XJXDOF63.js";
6
6
  import "./chunk-E6RFXHWD.js";
7
7
  export {
8
8
  handleHelpVersionShortCircuit
9
9
  };
10
- //# sourceMappingURL=short-circuit-flags-UREFSYBL.js.map
10
+ //# sourceMappingURL=short-circuit-flags-ZNZX44MC.js.map
@@ -0,0 +1,11 @@
1
+ import type { SlashCommand } from '@wrongstack/core/types';
2
+ import type { SlashCommandContext } from './command-context.js';
3
+ /**
4
+ * `/codebase-map` — read and publish the centrality-ranked view of the index.
5
+ *
6
+ * Three jobs, one command, because they are three views of the same data:
7
+ * print the map, write the committable atlas projection, and report whether a
8
+ * previously written atlas still describes the current code.
9
+ */
10
+ export declare function buildCodebaseMapCommand(opts: SlashCommandContext): SlashCommand;
11
+ //# sourceMappingURL=codebase-map.d.ts.map
@@ -3,6 +3,7 @@ import type { EventBus } from '@wrongstack/core/kernel';
3
3
  import type { SlashCommandRegistry, ToolRegistry } from '@wrongstack/core/registry';
4
4
  import type { CompactReport, HealthRegistry, MemoryPort, MetricsRuntimeStatus, MetricsSink, ModeStore, Renderer, SessionStore, SkillLoader, TokenCounter } from '@wrongstack/core/types';
5
5
  import type { WstackPaths } from '@wrongstack/core/utils';
6
+ import type { SummarizerPort } from '@wrongstack/tools';
6
7
  import type { VectorMemoryStore } from '@wrongstack/vector-memory';
7
8
  /** Host capabilities supplied to command adapters. */
8
9
  export interface SlashCommandContext {
@@ -41,6 +42,12 @@ export interface SlashCommandContext {
41
42
  cwd: string;
42
43
  /** Project root (typically resolved from cwd). */
43
44
  projectRoot: string;
45
+ /**
46
+ * Model port for the codebase index's concept layer. Present only when
47
+ * `indexing.concepts.enabled` is true — its absence is what `/codebase-map
48
+ * --enrich` reports instead of silently doing nothing.
49
+ */
50
+ codebaseConceptSummarizer?: SummarizerPort | undefined;
44
51
  metricsSink?: MetricsSink | undefined;
45
52
  healthRegistry?: HealthRegistry | undefined;
46
53
  metricsStatus?: MetricsRuntimeStatus | undefined;
@@ -1,4 +1,14 @@
1
1
  import type { SlashCommand } from '@wrongstack/core/types';
2
2
  import type { SlashCommandContext } from './command-context.js';
3
3
  export declare function buildContextCommand(opts: SlashCommandContext): SlashCommand;
4
+ /**
5
+ * One line naming what the recent per-request ratios mean.
6
+ *
7
+ * Deliberately reports a SHAPE, not a threshold. "40%" is a healthy young
8
+ * session and a broken old one; what separates them is whether the number is
9
+ * climbing as the conversation grows. The first request of a session can never
10
+ * hit, so it is excluded from the judgement rather than allowed to drag the
11
+ * verdict down.
12
+ */
13
+ export declare function cacheTrendVerdict(recent: readonly number[]): string;
4
14
  //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `/openai-quota` — how much of the ChatGPT (Codex) subscription this account
3
+ * has burned, and when the windows reset.
4
+ *
5
+ * A "Sign in with ChatGPT" account is metered on rolling windows — typically a
6
+ * 5-hour one and a weekly one — and the ChatGPT backend reports the burn on
7
+ * every `/codex/responses` response, in headers. Nothing about that reaches the
8
+ * SSE body, so before this existed the first visible sign of an exhausted plan
9
+ * was a 429 in the middle of a turn.
10
+ *
11
+ * The command is provider-scoped; the machinery underneath is not. It renders
12
+ * whatever `@wrongstack/core/quota` holds for one provider id, and the renderer
13
+ * below reads only the neutral shape. A second metered provider needs a
14
+ * reporter and a one-line command, not a second copy of this file.
15
+ *
16
+ * The reading is observational: it appears after the first request of the
17
+ * session, not before, and it is never fetched on its own — spending a request
18
+ * to ask "how much have I spent" is exactly the wrong trade on a metered plan.
19
+ *
20
+ * Usage:
21
+ * /openai-quota Show the latest reading for every metered window
22
+ */
23
+ import { type ProviderQuotaSnapshot } from '@wrongstack/core/quota';
24
+ import type { SlashCommand } from '@wrongstack/core/types';
25
+ /**
26
+ * Render one meter. Provider-neutral by construction — everything it reads is
27
+ * on the shared snapshot shape.
28
+ */
29
+ export declare function renderQuotaSnapshot(snapshot: ProviderQuotaSnapshot): string[];
30
+ export declare function buildOpenAIQuotaCommand(): SlashCommand;
31
+ //# sourceMappingURL=openai-quota.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  subcommandNames,
3
3
  subcommands
4
- } from "./chunk-D2VCUN7M.js";
4
+ } from "./chunk-IUEKNHPT.js";
5
5
  export {
6
6
  subcommandNames,
7
7
  subcommands
8
8
  };
9
- //# sourceMappingURL=subcommands-WJLBHVKC.js.map
9
+ //# sourceMappingURL=subcommands-CUTGBDKP.js.map
@@ -46,6 +46,7 @@ import {
46
46
  toSessionHistoryEntries
47
47
  } from "@wrongstack/webui-server";
48
48
  import { WebSocketServer } from "ws";
49
+ import { verifyClient as verifyWsClient2 } from "@wrongstack/webui-server/server/ws-auth";
49
50
 
50
51
  // src/webui-server/client-registration.ts
51
52
  import { mailboxSessionTag } from "@wrongstack/core/coordination";
@@ -1495,7 +1496,22 @@ async function runWebUI(opts) {
1495
1496
  ...opts.getVectorMemoryStore ? { getVectorMemoryStore: opts.getVectorMemoryStore } : {},
1496
1497
  ...opts.vectorMemoryModelCacheDir ? { vectorMemoryModelCacheDir: opts.vectorMemoryModelCacheDir } : {}
1497
1498
  });
1498
- const wss = httpServer ? new WebSocketServer({ server: httpServer.server, maxPayload: 20 * 1024 * 1024 }) : new WebSocketServer({ port: httpPort, host, maxPayload: 20 * 1024 * 1024 });
1499
+ const verifyClient = (info) => verifyWsClient2({
1500
+ origin: info.origin,
1501
+ url: info.req.url ?? "",
1502
+ hostHeader: info.req.headers.host,
1503
+ remoteAddress: info.req.socket.remoteAddress,
1504
+ cookieHeader: info.req.headers.cookie,
1505
+ wsHost: host,
1506
+ expectedToken: wsToken,
1507
+ requireToken,
1508
+ allowedHostnames: [publicUrl, publicWsUrl].filter(
1509
+ (value) => Boolean(value)
1510
+ ),
1511
+ allowBrowserUrlToken: Boolean(publicWsUrl),
1512
+ allowCrossPortLoopbackCookie: process.env["WRONGSTACK_WEBUI_DEV_CROSS_PORT_WS"] === "1"
1513
+ });
1514
+ const wss = httpServer ? new WebSocketServer({ server: httpServer.server, verifyClient, maxPayload: 20 * 1024 * 1024 }) : new WebSocketServer({ port: httpPort, host, verifyClient, maxPayload: 20 * 1024 * 1024 });
1499
1515
  wss.on("error", (err) => {
1500
1516
  console.error(
1501
1517
  JSON.stringify({
@@ -1625,6 +1641,7 @@ async function runWebUI(opts) {
1625
1641
  () => opts.appConfig?.providers ?? {}
1626
1642
  ),
1627
1643
  modelsRegistry: opts.modelsRegistry,
1644
+ providerAuthRegistry: opts.providerAuthRegistry,
1628
1645
  send,
1629
1646
  broadcast,
1630
1647
  log: (m) => console.log(m)
@@ -1951,4 +1968,4 @@ async function runWebUI(opts) {
1951
1968
  export {
1952
1969
  runWebUI
1953
1970
  };
1954
- //# sourceMappingURL=webui-server-5R35BHWZ.js.map
1971
+ //# sourceMappingURL=webui-server-QWBUT7BO.js.map
@@ -117,6 +117,7 @@ export interface CliWebUIOptions {
117
117
  webuiInstanceRegistered: boolean;
118
118
  }) => void;
119
119
  modelsRegistry?: ModelsRegistry | undefined;
120
+ providerAuthRegistry?: import('@wrongstack/core/registry').ProviderAuthRegistry | undefined;
120
121
  globalConfigPath?: string | undefined;
121
122
  /** Resolved profile config path: ~/.wrongstack/profiles/<activeProfile>/config.json */
122
123
  profileConfigPath: string;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Atlas boot-prompt contributor — the repository's shape, put in front of the
3
+ * agent instead of left to be rediscovered.
4
+ *
5
+ * Without this, every session begins the same way: a handful of searches to
6
+ * work out which packages exist, which files everything depends on, and where
7
+ * the entry points are. The index has known all of that since it was built.
8
+ * A few hundred tokens spends once what a dozen tool calls spend every time.
9
+ *
10
+ * Contract, matching `wrongtrace-prompt-contributor.ts`:
11
+ * - **Fail-open.** No index, no ranks, a throw, a timeout → `[]`. Orientation
12
+ * is a convenience; it must never be the reason a session cannot start.
13
+ * - **Bounded.** The brief is read behind a deadline, because the store lives
14
+ * on disk and a cold or busy index must not stall the first prompt.
15
+ * - **Cached per process.** The brief only changes when the index does, and
16
+ * rebuilding it on every prompt build would read SQLite on every turn.
17
+ * - **Cache-safe.** Contributor blocks are tagged `'contributor'`, which
18
+ * `EPOCH_VOLATILE_SOURCES` moves out of the wire `system` block and into
19
+ * the live-context tail — so this does not invalidate the prompt cache
20
+ * prefix the way a system-prompt edit would.
21
+ *
22
+ * It is deliberately *not* routed through SAGE. That pipeline is for episodic
23
+ * memory and gates on relevance thresholds a repository map would fail; the
24
+ * map is not a memory, it is a fact about the checkout.
25
+ */
26
+ import type { SystemPromptContributor, TokenSavingTier } from '@wrongstack/core/types';
27
+ import { type AtlasBrief } from '@wrongstack/tools';
28
+ /** Default hard ceiling on the rendered block. */
29
+ export declare const DEFAULT_BRIEF_MAX_TOKENS = 800;
30
+ /**
31
+ * Render the brief, trimming from the bottom until it fits.
32
+ *
33
+ * The order of the sections is the order of their value to somebody who knows
34
+ * nothing about the repository: what it is made of, what everything depends
35
+ * on, and — last, because it is the least load-bearing — what each subsystem
36
+ * does in prose. Trimming from the bottom therefore degrades gracefully
37
+ * instead of losing the hubs.
38
+ */
39
+ export declare function renderAtlasBrief(brief: AtlasBrief, maxTokens: number): string;
40
+ export interface AtlasPromptContributorOptions {
41
+ projectRoot: string;
42
+ indexDir?: string | undefined;
43
+ /** `indexing.atlas.injectOnSessionStart`. Default true. */
44
+ enabled?: boolean | undefined;
45
+ /** `indexing.atlas.briefMaxTokens`. Default {@link DEFAULT_BRIEF_MAX_TOKENS}. */
46
+ maxTokens?: number | undefined;
47
+ tokenSavingMode?: TokenSavingTier | boolean | undefined;
48
+ }
49
+ /**
50
+ * Build the contributor. One instance per prompt-builder binding; the brief
51
+ * cache lives on the closure, so it is per process, like the builder.
52
+ */
53
+ export declare function createAtlasPromptContributor(options: AtlasPromptContributorOptions): SystemPromptContributor;
54
+ //# sourceMappingURL=atlas-prompt-contributor.d.ts.map
@@ -73,6 +73,7 @@ export declare function runCliExecution(params: {
73
73
  agentMonitor?: X['fleet']['agentTranscripts'];
74
74
  vault: AUP['vault'];
75
75
  profileConfigPath: string;
76
+ providerAuthRegistry: NonNullable<AUP['providerAuthRegistry']>;
76
77
  onPanelOpen: X['fleet']['onPanelOpen'];
77
78
  interruptController: RC['interruptController'];
78
79
  enhanceController: RC['enhanceController'];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Host-side wiring for the codebase index's semantic embeddings.
3
+ *
4
+ * The model is `packages/vector-memory`'s transformers-backed provider, which
5
+ * already emits 384-dimensional vectors — the width `file_vectors` stores. It
6
+ * arrives here rather than inside `packages/tools` for two reasons:
7
+ *
8
+ * - `@huggingface/transformers` is an **optional** dependency. A repository
9
+ * that never enables semantic search should not have to install a model
10
+ * runtime, and `packages/tools` must stay importable without one.
11
+ * - A function cannot cross the project daemon's IPC boundary. The daemon
12
+ * compares vectors; the host produces them. That also keeps a ~90 MB model
13
+ * out of every per-project daemon process.
14
+ *
15
+ * Everything here is best-effort. When the optional dependency is absent, the
16
+ * model cannot load, or the config leaves embeddings off, the port is simply
17
+ * `undefined` and retrieval stays lexical — which is the behaviour that
18
+ * shipped before embeddings existed.
19
+ */
20
+ import type { IndexingEmbeddingsConfig } from '@wrongstack/core/types';
21
+ import type { EmbeddingPort } from '@wrongstack/tools';
22
+ /**
23
+ * Build the embedding port, or `undefined` when semantic search is off or
24
+ * unavailable.
25
+ *
26
+ * The dynamic import is what keeps `@huggingface/transformers` optional: a
27
+ * missing package throws here and is reported as "unavailable", never as a
28
+ * startup failure.
29
+ */
30
+ export declare function createCodebaseEmbeddingPort(settings: IndexingEmbeddingsConfig | undefined): Promise<EmbeddingPort | undefined>;
31
+ //# sourceMappingURL=codebase-embeddings.d.ts.map
@@ -77,6 +77,7 @@ export declare function setupCommandHostState(input: CommandHostStateInput): Pro
77
77
  project?: import("@wrongstack/core/statusline").StatuslineLine;
78
78
  prompt_variant?: import("@wrongstack/core/statusline").StatuslineLine;
79
79
  queue?: import("@wrongstack/core/statusline").StatuslineLine;
80
+ quota?: import("@wrongstack/core/statusline").StatuslineLine;
80
81
  sessions?: import("@wrongstack/core/statusline").StatuslineLine;
81
82
  side_effects?: import("@wrongstack/core/statusline").StatuslineLine;
82
83
  state?: import("@wrongstack/core/statusline").StatuslineLine;
@@ -122,6 +123,7 @@ export declare function setupCommandHostState(input: CommandHostStateInput): Pro
122
123
  project?: import("@wrongstack/core/statusline").StatuslineDensity;
123
124
  prompt_variant?: import("@wrongstack/core/statusline").StatuslineDensity;
124
125
  queue?: import("@wrongstack/core/statusline").StatuslineDensity;
126
+ quota?: import("@wrongstack/core/statusline").StatuslineDensity;
125
127
  sessions?: import("@wrongstack/core/statusline").StatuslineDensity;
126
128
  side_effects?: import("@wrongstack/core/statusline").StatuslineDensity;
127
129
  state?: import("@wrongstack/core/statusline").StatuslineDensity;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Host-side implementation of the codebase index's {@link SummarizerPort}.
3
+ *
4
+ * `packages/tools` defines what a summariser must answer; producing that answer
5
+ * needs a configured provider and the model-tier policy, both of which live
6
+ * here. The port is therefore injected rather than imported, the same way SAGE
7
+ * takes `getLlmCall` — a host that supplies nothing simply gets no concept
8
+ * layer, and the index carries on working without one.
9
+ *
10
+ * ## Cost shape
11
+ *
12
+ * One call per file, and only for files whose bytes changed since the last
13
+ * pass. Enrichment is the one part of the index that spends money, so the model
14
+ * is resolved through the tier layer at its cheapest configured level unless
15
+ * the caller pins one, and both the token ceiling and the timeout are small.
16
+ */
17
+ import { OneShotOrchestrator } from '@wrongstack/core/execution';
18
+ import type { Config } from '@wrongstack/core/types';
19
+ import type { SummarizerPort } from '@wrongstack/tools';
20
+ type OrchestratorOptions = ConstructorParameters<typeof OneShotOrchestrator>[0];
21
+ export interface ConceptSummarizerDeps {
22
+ buildProvider: OrchestratorOptions['buildProvider'];
23
+ getConfig: () => Config;
24
+ fallbackProfileManager: OrchestratorOptions['fallbackProfileManager'];
25
+ statusTracker?: OrchestratorOptions['statusTracker'];
26
+ wrapProviderCall?: OrchestratorOptions['wrapProviderCall'];
27
+ /** Explicit model override; otherwise the configured budget tier decides. */
28
+ model?: string | undefined;
29
+ }
30
+ export declare function createConceptSummarizer(deps: ConceptSummarizerDeps): SummarizerPort;
31
+ export {};
32
+ //# sourceMappingURL=concept-summarizer.d.ts.map
@@ -64,5 +64,6 @@ interface LoadExternalPluginsContext {
64
64
  importModule?: ((url: string) => Promise<unknown>) | undefined;
65
65
  }
66
66
  export declare function loadExternalPlugins(ctx: LoadExternalPluginsContext, hooks: ExternalPluginHooks): Promise<Plugin[]>;
67
+ export declare function hashPluginClosure(entryPath: string): Promise<string>;
67
68
  export {};
68
69
  //# sourceMappingURL=external-plugins.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { type RemoteMailbox } from '@wrongstack/core/coordination';
2
2
  import { HookRegistry, HookRunner } from '@wrongstack/core/hooks';
3
3
  import type { PluginHostHandle } from '@wrongstack/core/plugin';
4
- import { type ProviderRegistry, SlashCommandRegistry, type ToolRegistry } from '@wrongstack/core/registry';
4
+ import { type ProviderAuthRegistry, type ProviderRegistry, SlashCommandRegistry, type ToolRegistry } from '@wrongstack/core/registry';
5
5
  import type { Config, HealthRegistry, Logger, MetricsRuntimeStatus, ModelsRegistry, PromptLoader, Provider, ProviderConfig, SecretVault, SessionWriter, SkillLoader } from '@wrongstack/core/types';
6
6
  import type { WstackPaths } from '@wrongstack/core/utils';
7
7
  import { MCPRegistry } from '@wrongstack/mcp';
@@ -27,6 +27,7 @@ interface LifecyclePluginsDeps {
27
27
  wpaths: WstackPaths;
28
28
  toolRegistry: ToolRegistry;
29
29
  providerRegistry: ProviderRegistry;
30
+ providerAuthRegistry: ProviderAuthRegistry;
30
31
  configStore: any;
31
32
  eventWiring: EventWiring;
32
33
  healthRegistry: HealthRegistry | undefined;
@@ -2,7 +2,7 @@ import type { AgentPipelines } from '@wrongstack/core/agent';
2
2
  import type { ExtensionRegistry } from '@wrongstack/core/extension';
3
3
  import type { Container, EventBus } from '@wrongstack/core/kernel';
4
4
  import type { PluginAPIInit, PluginHostHandle } from '@wrongstack/core/plugin';
5
- import type { ProviderRegistry, SlashCommandRegistry, ToolRegistry } from '@wrongstack/core/registry';
5
+ import type { ProviderAuthRegistry, ProviderRegistry, SlashCommandRegistry, ToolRegistry } from '@wrongstack/core/registry';
6
6
  import type { Config, ConfigStore, HealthRegistry, Logger, MetricsRuntimeStatus, MetricsSinkView, ModelsRegistry, Plugin, PromptLoader, SessionWriter, SkillLoader } from '@wrongstack/core/types';
7
7
  import type { MCPRegistry } from '@wrongstack/mcp';
8
8
  export declare const DEPRECATED_PLUGIN_NAMES: Record<string, string>;
@@ -34,6 +34,7 @@ export interface PluginsWiringDeps {
34
34
  pipelines: AgentPipelines;
35
35
  toolRegistry: ToolRegistry;
36
36
  providerRegistry: ProviderRegistry;
37
+ providerAuthRegistry?: ProviderAuthRegistry | undefined;
37
38
  slashCommandRegistry: SlashCommandRegistry;
38
39
  mcpRegistry: MCPRegistry;
39
40
  log: Logger;