@wrongstack/cli 1.0.0 → 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 (60) hide show
  1. package/data/providers.json +21 -21
  2. package/dist/{acp-3LARESEO.js → acp-JK4ZQO3R.js} +4 -3
  3. package/dist/{auth-KIBJZZIE.js → auth-XD3GN5RJ.js} +80 -56
  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-menu.d.ts +7 -0
  13. package/dist/boot/system-prompt.d.ts +2 -1
  14. package/dist/chimera-reviewer-policy.d.ts +1 -1
  15. package/dist/{chunk-4HV5RKZH.js → chunk-4NHD5OXJ.js} +3 -3
  16. package/dist/chunk-D5GB5MHA.js +87 -0
  17. package/dist/chunk-DAKVBMD4.js +36 -0
  18. package/dist/{chunk-Z7A5MXKJ.js → chunk-E6RFXHWD.js} +1 -2
  19. package/dist/{chunk-ZSZ3EYWH.js → chunk-GMY45LO6.js} +9 -5
  20. package/dist/{chunk-ETYHZPXP.js → chunk-IUEKNHPT.js} +12 -10
  21. package/dist/{chunk-MNQQ4ZNF.js → chunk-ONOT5OJ2.js} +290 -687
  22. package/dist/chunk-SIGUWXAA.js +43 -0
  23. package/dist/{chunk-TEBMCYZN.js → chunk-SIS37L3W.js} +58 -2
  24. package/dist/{chunk-5IA5337I.js → chunk-U6KCWRMC.js} +4 -2
  25. package/dist/chunk-UQUYBDMG.js +51 -0
  26. package/dist/{cli-context-CYMKNOK3.js → cli-context-Q6QP534K.js} +20 -9
  27. package/dist/{cli-main-TTIVR4DI.js → cli-main-JQXCDZEA.js} +2979 -2279
  28. package/dist/config-transfer-2YF3CRTN.js +99 -0
  29. package/dist/execute-deps.d.ts +1 -0
  30. package/dist/{execution-3Y55IWBK.js → execution-KH7WJNAX.js} +26 -19
  31. package/dist/index.js +4 -4
  32. package/dist/live-settings-input.d.ts +2 -0
  33. package/dist/{mailbox-serve-VUCWZ2SJ.js → mailbox-serve-X3CR6VFW.js} +4 -3
  34. package/dist/{modeldiag-FMJT37SN.js → modeldiag-46CMWUNM.js} +31 -24
  35. package/dist/{plugin-usage-HFBI3TFT.js → plugin-usage-M6KET4OZ.js} +2 -2
  36. package/dist/{plugins-PZ2VZL7V.js → plugins-U7KGQAUG.js} +3 -3
  37. package/dist/{providers-models-YVMVYWRS.js → providers-models-6MOGAOVK.js} +2 -2
  38. package/dist/settings-behavior-sections.d.ts +20 -0
  39. package/dist/{short-circuit-flags-6PSP56L7.js → short-circuit-flags-ZNZX44MC.js} +3 -3
  40. package/dist/slash-commands/codebase-map.d.ts +11 -0
  41. package/dist/slash-commands/command-context.d.ts +7 -0
  42. package/dist/slash-commands/context.d.ts +10 -0
  43. package/dist/slash-commands/openai-quota.d.ts +31 -0
  44. package/dist/subcommands/handlers/config-transfer.d.ts +6 -0
  45. package/dist/{subcommands-HZQKA4G2.js → subcommands-CUTGBDKP.js} +2 -2
  46. package/dist/{webui-server-T6AMOXJJ.js → webui-server-QWBUT7BO.js} +22 -5
  47. package/dist/webui-server-options.d.ts +1 -0
  48. package/dist/wiring/atlas-prompt-contributor.d.ts +54 -0
  49. package/dist/wiring/cli-execute-builder.d.ts +1 -0
  50. package/dist/wiring/codebase-embeddings.d.ts +31 -0
  51. package/dist/wiring/command-host-state.d.ts +2 -0
  52. package/dist/wiring/concept-summarizer.d.ts +32 -0
  53. package/dist/wiring/external-plugins.d.ts +1 -0
  54. package/dist/wiring/lifecycle-plugins.d.ts +2 -1
  55. package/dist/wiring/plugins.d.ts +2 -1
  56. package/dist/wiring/provider.d.ts +2 -1
  57. package/package.json +29 -29
  58. package/dist/auto-discover-providers-VQU3IZMR.js +0 -7
  59. package/dist/chunk-52C7PD2H.js +0 -61
  60. package/dist/chunk-TNK6237M.js +0 -262
@@ -0,0 +1,43 @@
1
+
2
+ // src/auth-menu/openai-codex-oauth.ts
3
+ import { color } from "@wrongstack/core/utils";
4
+ import {
5
+ buildCodexAuthorizeUrl,
6
+ CODEX_BASE_URL,
7
+ CODEX_FALLBACK_REDIRECT_PORT,
8
+ CODEX_PROVIDER_ID,
9
+ CODEX_REDIRECT_HOST,
10
+ CODEX_REDIRECT_PATH,
11
+ CODEX_REDIRECT_PORT,
12
+ CODEX_SCOPE,
13
+ codexRedirectUri,
14
+ createState,
15
+ exchangeCodexAuthorizationCode,
16
+ extractAccountId,
17
+ generatePkce,
18
+ parseAuthorizationInput,
19
+ refreshCodexTokens,
20
+ resolveCodexModels
21
+ } from "@wrongstack/providers/oauth";
22
+ import {
23
+ CODEX_BASE_URL as CODEX_BASE_URL2,
24
+ CODEX_CATALOG_FAMILIES,
25
+ CODEX_PROVIDER_ID as CODEX_PROVIDER_ID2,
26
+ extractAccountId as extractAccountId2,
27
+ FALLBACK_CODEX_MODELS,
28
+ fallbackCodexModelIds,
29
+ fallbackCodexProviderModels,
30
+ fetchCodexModels,
31
+ filterCurrentCodexModelIds,
32
+ generatePkce as generatePkce2,
33
+ isCodexCatalogModel,
34
+ parseAuthorizationInput as parseAuthorizationInput2,
35
+ resolveCodexModels as resolveCodexModels2
36
+ } from "@wrongstack/providers/oauth";
37
+
38
+ export {
39
+ fallbackCodexProviderModels,
40
+ filterCurrentCodexModelIds,
41
+ isCodexCatalogModel
42
+ };
43
+ //# sourceMappingURL=chunk-SIGUWXAA.js.map
@@ -13,6 +13,10 @@ import {
13
13
  resolvePluginTarget,
14
14
  verifyPluginTrust
15
15
  } from "@wrongstack/core/plugin";
16
+ import { createHash } from "node:crypto";
17
+ import { readdir, stat } from "node:fs/promises";
18
+ import { basename, dirname, relative, sep } from "node:path";
19
+ import { readFile } from "node:fs/promises";
16
20
  function resolveExternalPluginTrustMode(raw) {
17
21
  if (raw === false) return "off";
18
22
  if (raw === "required") return "required";
@@ -228,7 +232,7 @@ async function gateExternalPluginTrust(args) {
228
232
  if (!store) return { ok: true, pinned: false };
229
233
  let integrity;
230
234
  try {
231
- integrity = await hashFileContents(entryPath);
235
+ integrity = await hashPluginClosure(entryPath);
232
236
  } catch (err) {
233
237
  const message = err instanceof Error ? err.message : String(err);
234
238
  if (mode === "required") {
@@ -271,6 +275,58 @@ async function gateExternalPluginTrust(args) {
271
275
  log.error(`[plugins] REFUSING external plugin "${label}" \u2014 ${changedMessage}`);
272
276
  return { ok: false, pinned: false };
273
277
  }
278
+ var CLOSURE_HASH_LIMIT = 2e3;
279
+ var CLOSURE_FILE_LIMIT = 16 * 1024 * 1024;
280
+ async function hashPluginClosure(entryPath) {
281
+ const dir = dirname(entryPath);
282
+ let dirStat;
283
+ try {
284
+ dirStat = await stat(dir);
285
+ } catch {
286
+ return hashFileContents(entryPath);
287
+ }
288
+ if (!dirStat.isDirectory()) return hashFileContents(entryPath);
289
+ const entryBase = basename(entryPath);
290
+ const files = [];
291
+ async function walk(d) {
292
+ if (files.length > CLOSURE_HASH_LIMIT) return;
293
+ const entries = await readdir(d, { withFileTypes: true }).catch(() => []);
294
+ for (const e of entries) {
295
+ const full = d + sep + e.name;
296
+ if (e.isDirectory()) {
297
+ if (e.name === "node_modules" || e.name.startsWith(".")) continue;
298
+ await walk(full);
299
+ } else if (e.isFile()) {
300
+ files.push(full);
301
+ }
302
+ }
303
+ }
304
+ await walk(dir);
305
+ files.sort();
306
+ const manifest = [];
307
+ for (const full of files) {
308
+ const rel = relative(dir, full).split(sep).join("/");
309
+ let bytes;
310
+ try {
311
+ const st = await stat(full);
312
+ if (!st.isFile() || st.size > CLOSURE_FILE_LIMIT) continue;
313
+ bytes = await readFile(full);
314
+ } catch {
315
+ continue;
316
+ }
317
+ const sha = createHash("sha256").update(bytes).digest("hex");
318
+ manifest.push(`${rel}\0${bytes.length}\0${sha}`);
319
+ }
320
+ if (!manifest.some((line) => line.startsWith(`${entryBase}\0`))) {
321
+ const entryBytes = await readFile(entryPath);
322
+ const entrySha = createHash("sha256").update(entryBytes).digest("hex");
323
+ manifest.push(`${entryBase}\0${entryBytes.length}\0${entrySha}`);
324
+ }
325
+ manifest.sort();
326
+ const outer = createHash("sha256");
327
+ outer.update(manifest.join("\n"));
328
+ return outer.digest("hex");
329
+ }
274
330
 
275
331
  // src/plugin-management.ts
276
332
  import { execFile } from "node:child_process";
@@ -1035,4 +1091,4 @@ export {
1035
1091
  PLUGIN_AUDIT_ENTRIES,
1036
1092
  runPluginManagementCommand
1037
1093
  };
1038
- //# sourceMappingURL=chunk-TEBMCYZN.js.map
1094
+ //# sourceMappingURL=chunk-SIS37L3W.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  PLUGIN_AUDIT_ENTRIES,
6
6
  loadExternalPlugins
7
- } from "./chunk-TEBMCYZN.js";
7
+ } from "./chunk-SIS37L3W.js";
8
8
 
9
9
  // src/wiring/plugins.ts
10
10
  import { join } from "node:path";
@@ -98,6 +98,7 @@ async function setupPlugins(params) {
98
98
  events,
99
99
  toolRegistry,
100
100
  providerRegistry,
101
+ providerAuthRegistry,
101
102
  slashCommandRegistry,
102
103
  mcpRegistry,
103
104
  log,
@@ -207,6 +208,7 @@ async function setupPlugins(params) {
207
208
  pipelines,
208
209
  toolRegistry,
209
210
  providerRegistry,
211
+ providerAuthRegistry,
210
212
  slashCommandRegistry,
211
213
  mcpRegistry,
212
214
  config: pluginConfig,
@@ -261,4 +263,4 @@ export {
261
263
  BUILTIN_PLUGIN_FACTORIES,
262
264
  setupPlugins
263
265
  };
264
- //# sourceMappingURL=chunk-5IA5337I.js.map
266
+ //# sourceMappingURL=chunk-U6KCWRMC.js.map
@@ -0,0 +1,51 @@
1
+
2
+ // src/settings-behavior-sections.ts
3
+ var BEHAVIOR_SECTION_KEYS = [
4
+ "context",
5
+ "tools",
6
+ "log",
7
+ "features",
8
+ "session",
9
+ "indexing",
10
+ "circuitBreaker",
11
+ "modelRuntime",
12
+ "Sage",
13
+ "skills",
14
+ "systemPrompt",
15
+ "autonomy",
16
+ "maxConcurrent",
17
+ "yolo",
18
+ "nextPrediction",
19
+ "hints",
20
+ "debugStream"
21
+ ];
22
+ function extractBehaviorSettings(config) {
23
+ const out = {};
24
+ for (const key of BEHAVIOR_SECTION_KEYS) {
25
+ const value = config[key];
26
+ if (value !== void 0) out[key] = structuredClone(value);
27
+ }
28
+ return out;
29
+ }
30
+ function mergeBehaviorSettings(target, settings) {
31
+ const applied = [];
32
+ for (const key of BEHAVIOR_SECTION_KEYS) {
33
+ const value = settings[key];
34
+ if (value === void 0) continue;
35
+ if (value !== null && typeof value === "object") {
36
+ const current = target[key] ?? {};
37
+ target[key] = { ...current, ...value };
38
+ } else {
39
+ target[key] = value;
40
+ }
41
+ applied.push(key);
42
+ }
43
+ return applied;
44
+ }
45
+
46
+ export {
47
+ BEHAVIOR_SECTION_KEYS,
48
+ extractBehaviorSettings,
49
+ mergeBehaviorSettings
50
+ };
51
+ //# sourceMappingURL=chunk-UQUYBDMG.js.map
@@ -19,14 +19,14 @@ import {
19
19
  } from "./chunk-EWKESL4L.js";
20
20
  import {
21
21
  subcommands
22
- } from "./chunk-ETYHZPXP.js";
22
+ } from "./chunk-IUEKNHPT.js";
23
23
  import {
24
24
  renderDeepHelp,
25
25
  renderFocusedHelp
26
26
  } from "./chunk-MXEJEYT7.js";
27
27
  import {
28
28
  handleHelpVersionShortCircuit
29
- } from "./chunk-4HV5RKZH.js";
29
+ } from "./chunk-4NHD5OXJ.js";
30
30
  import {
31
31
  DEFAULT_PORT
32
32
  } from "./chunk-C2E24IXZ.js";
@@ -34,7 +34,7 @@ import "./chunk-HXJYHAR4.js";
34
34
  import "./chunk-Q5GTM25S.js";
35
35
  import {
36
36
  discoverAndMergeProviders
37
- } from "./chunk-52C7PD2H.js";
37
+ } from "./chunk-D5GB5MHA.js";
38
38
  import {
39
39
  applyNodeEnvDefault,
40
40
  applySessionShellDefault,
@@ -55,7 +55,7 @@ import {
55
55
  runPicker,
56
56
  saveToGlobalConfig,
57
57
  theme
58
- } from "./chunk-MNQQ4ZNF.js";
58
+ } from "./chunk-ONOT5OJ2.js";
59
59
  import "./chunk-2VMJ3E5Z.js";
60
60
  import "./chunk-B4JLSXZB.js";
61
61
  import {
@@ -67,8 +67,8 @@ import {
67
67
  } from "./chunk-YMXXOOFN.js";
68
68
  import {
69
69
  parseArgs
70
- } from "./chunk-Z7A5MXKJ.js";
71
- import "./chunk-TNK6237M.js";
70
+ } from "./chunk-E6RFXHWD.js";
71
+ import "./chunk-DAKVBMD4.js";
72
72
  import {
73
73
  mutateConfigProviders,
74
74
  normalizeKeys,
@@ -84,7 +84,7 @@ import "./chunk-YLQEGYV4.js";
84
84
  // src/cli-context.ts
85
85
  import { TOKENS as TOKENS3 } from "@wrongstack/core/kernel";
86
86
  import { writeErr as writeErr2 } from "@wrongstack/core/utils";
87
- import { setOAuthTokenPersister } from "@wrongstack/providers";
87
+ import { setOAuthTokenPersister, setProviderModelPersister } from "@wrongstack/providers";
88
88
 
89
89
  // src/boot/container-wiring.ts
90
90
  import { DefaultPathResolver } from "@wrongstack/core/infrastructure";
@@ -1556,7 +1556,7 @@ async function maybeRunSystemPromptMenu(opts) {
1556
1556
  });
1557
1557
  if (chosen === savedVariant) return { variant: chosen, aborted: false, changed: false };
1558
1558
  try {
1559
- await persistSystemPromptVariant(opts.profileConfigPath, chosen);
1559
+ await (opts.persist ?? persistSystemPromptVariant)(opts.profileConfigPath, chosen);
1560
1560
  } catch (err) {
1561
1561
  return { variant: chosen, aborted: false, changed: true, persistError: err };
1562
1562
  }
@@ -3095,6 +3095,17 @@ async function initializeCli(argv) {
3095
3095
  }).catch(() => {
3096
3096
  });
3097
3097
  });
3098
+ setProviderModelPersister((providerId, models) => {
3099
+ if (models.length === 0) return;
3100
+ void mutateConfigProviders(profileConfigPath, vault, (all) => {
3101
+ const p = all[providerId];
3102
+ if (!p) return;
3103
+ const live = models.map((m) => m.id);
3104
+ if (p.models?.length === live.length && p.models.every((id, i) => id === live[i])) return;
3105
+ p.models = live;
3106
+ }).catch(() => {
3107
+ });
3108
+ });
3098
3109
  const { events, container } = wireContainer({
3099
3110
  config,
3100
3111
  wpaths,
@@ -3117,4 +3128,4 @@ async function initializeCli(argv) {
3117
3128
  export {
3118
3129
  initializeCli
3119
3130
  };
3120
- //# sourceMappingURL=cli-context-CYMKNOK3.js.map
3131
+ //# sourceMappingURL=cli-context-Q6QP534K.js.map