gnosys 5.11.4 → 5.12.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 (240) hide show
  1. package/dist/cli.js +324 -5150
  2. package/dist/index.js +364 -235
  3. package/dist/lib/addCommand.d.ts +9 -0
  4. package/dist/lib/addCommand.js +103 -0
  5. package/dist/lib/addStructuredCommand.d.ts +16 -0
  6. package/dist/lib/addStructuredCommand.js +103 -0
  7. package/dist/lib/ambiguityCommand.d.ts +4 -0
  8. package/dist/lib/ambiguityCommand.js +36 -0
  9. package/dist/lib/apiKeyVault.d.ts +78 -0
  10. package/dist/lib/apiKeyVault.js +447 -0
  11. package/dist/lib/askCommand.d.ts +13 -0
  12. package/dist/lib/askCommand.js +145 -0
  13. package/dist/lib/audioExtract.js +4 -1
  14. package/dist/lib/auditCommand.d.ts +7 -0
  15. package/dist/lib/auditCommand.js +27 -0
  16. package/dist/lib/backupCommand.d.ts +6 -0
  17. package/dist/lib/backupCommand.js +54 -0
  18. package/dist/lib/bootstrapCommand.d.ts +15 -0
  19. package/dist/lib/bootstrapCommand.js +51 -0
  20. package/dist/lib/briefingCommand.d.ts +7 -0
  21. package/dist/lib/briefingCommand.js +92 -0
  22. package/dist/lib/centralizeCommand.d.ts +5 -0
  23. package/dist/lib/centralizeCommand.js +16 -0
  24. package/dist/lib/chatCommand.d.ts +12 -0
  25. package/dist/lib/chatCommand.js +46 -0
  26. package/dist/lib/checkCommand.d.ts +4 -0
  27. package/dist/lib/checkCommand.js +133 -0
  28. package/dist/lib/clientReadOverlay.d.ts +27 -0
  29. package/dist/lib/clientReadOverlay.js +73 -0
  30. package/dist/lib/clientReadResolve.d.ts +32 -0
  31. package/dist/lib/clientReadResolve.js +84 -0
  32. package/dist/lib/commitContextCommand.d.ts +9 -0
  33. package/dist/lib/commitContextCommand.js +142 -0
  34. package/dist/lib/config.d.ts +43 -3
  35. package/dist/lib/config.js +58 -57
  36. package/dist/lib/configCommand.d.ts +10 -0
  37. package/dist/lib/configCommand.js +321 -0
  38. package/dist/lib/connectCommand.d.ts +8 -0
  39. package/dist/lib/connectCommand.js +19 -0
  40. package/dist/lib/db.d.ts +52 -0
  41. package/dist/lib/db.js +169 -1
  42. package/dist/lib/dearchiveCommand.d.ts +7 -0
  43. package/dist/lib/dearchiveCommand.js +41 -0
  44. package/dist/lib/discoverCommand.d.ts +9 -0
  45. package/dist/lib/discoverCommand.js +87 -0
  46. package/dist/lib/doctorCommand.d.ts +6 -0
  47. package/dist/lib/doctorCommand.js +256 -0
  48. package/dist/lib/dream.d.ts +42 -2
  49. package/dist/lib/dream.js +290 -30
  50. package/dist/lib/dreamCommand.d.ts +10 -0
  51. package/dist/lib/dreamCommand.js +195 -0
  52. package/dist/lib/dreamLaunchd.d.ts +2 -0
  53. package/dist/lib/dreamLaunchd.js +72 -0
  54. package/dist/lib/dreamLogCommand.d.ts +10 -0
  55. package/dist/lib/dreamLogCommand.js +58 -0
  56. package/dist/lib/dreamReport.d.ts +7 -0
  57. package/dist/lib/dreamReport.js +114 -0
  58. package/dist/lib/dreamRunLog.d.ts +121 -0
  59. package/dist/lib/dreamRunLog.js +212 -0
  60. package/dist/lib/embeddings.js +3 -0
  61. package/dist/lib/exportCommand.d.ts +18 -0
  62. package/dist/lib/exportCommand.js +101 -0
  63. package/dist/lib/fsearchCommand.d.ts +8 -0
  64. package/dist/lib/fsearchCommand.js +44 -0
  65. package/dist/lib/graphCommand.d.ts +4 -0
  66. package/dist/lib/graphCommand.js +68 -0
  67. package/dist/lib/helperGenerateCommand.d.ts +5 -0
  68. package/dist/lib/helperGenerateCommand.js +27 -0
  69. package/dist/lib/historyCommand.d.ts +5 -0
  70. package/dist/lib/historyCommand.js +51 -0
  71. package/dist/lib/hybridSearchCommand.d.ts +12 -0
  72. package/dist/lib/hybridSearchCommand.js +95 -0
  73. package/dist/lib/importCommand.d.ts +16 -0
  74. package/dist/lib/importCommand.js +89 -0
  75. package/dist/lib/importProjectCommand.d.ts +6 -0
  76. package/dist/lib/importProjectCommand.js +43 -0
  77. package/dist/lib/ingestCommand.d.ts +13 -0
  78. package/dist/lib/ingestCommand.js +95 -0
  79. package/dist/lib/installOutput.d.ts +36 -0
  80. package/dist/lib/installOutput.js +55 -0
  81. package/dist/lib/lensCommand.d.ts +20 -0
  82. package/dist/lib/lensCommand.js +61 -0
  83. package/dist/lib/lensing.d.ts +1 -0
  84. package/dist/lib/lensing.js +50 -9
  85. package/dist/lib/linksCommand.d.ts +7 -0
  86. package/dist/lib/linksCommand.js +48 -0
  87. package/dist/lib/listCommand.d.ts +8 -0
  88. package/dist/lib/listCommand.js +74 -0
  89. package/dist/lib/llm.d.ts +1 -1
  90. package/dist/lib/llm.js +26 -8
  91. package/dist/lib/localDiskCheck.d.ts +17 -0
  92. package/dist/lib/localDiskCheck.js +54 -0
  93. package/dist/lib/machineConfig.d.ts +11 -1
  94. package/dist/lib/machineConfig.js +16 -0
  95. package/dist/lib/machineRegistry.d.ts +61 -0
  96. package/dist/lib/machineRegistry.js +80 -0
  97. package/dist/lib/maintainCommand.d.ts +8 -0
  98. package/dist/lib/maintainCommand.js +34 -0
  99. package/dist/lib/masterLease.d.ts +20 -0
  100. package/dist/lib/masterLease.js +68 -0
  101. package/dist/lib/migrateCommand.d.ts +7 -0
  102. package/dist/lib/migrateCommand.js +158 -0
  103. package/dist/lib/migrateDbCommand.d.ts +9 -0
  104. package/dist/lib/migrateDbCommand.js +94 -0
  105. package/dist/lib/modelValidation.d.ts +5 -0
  106. package/dist/lib/modelValidation.js +27 -0
  107. package/dist/lib/openrouterTiers.d.ts +29 -0
  108. package/dist/lib/openrouterTiers.js +113 -0
  109. package/dist/lib/prefCommand.d.ts +10 -0
  110. package/dist/lib/prefCommand.js +118 -0
  111. package/dist/lib/projectsCommand.d.ts +8 -0
  112. package/dist/lib/projectsCommand.js +131 -0
  113. package/dist/lib/readCommand.d.ts +7 -0
  114. package/dist/lib/readCommand.js +62 -0
  115. package/dist/lib/recall.d.ts +3 -0
  116. package/dist/lib/recall.js +19 -4
  117. package/dist/lib/recallCommand.d.ts +11 -0
  118. package/dist/lib/recallCommand.js +112 -0
  119. package/dist/lib/reflectCommand.d.ts +8 -0
  120. package/dist/lib/reflectCommand.js +61 -0
  121. package/dist/lib/reindexCommand.d.ts +4 -0
  122. package/dist/lib/reindexCommand.js +34 -0
  123. package/dist/lib/reindexGraphCommand.d.ts +4 -0
  124. package/dist/lib/reindexGraphCommand.js +12 -0
  125. package/dist/lib/reinforceCommand.d.ts +8 -0
  126. package/dist/lib/reinforceCommand.js +40 -0
  127. package/dist/lib/remote.d.ts +5 -1
  128. package/dist/lib/remote.js +5 -1
  129. package/dist/lib/remoteWizard.d.ts +24 -5
  130. package/dist/lib/remoteWizard.js +308 -319
  131. package/dist/lib/restoreCommand.d.ts +5 -0
  132. package/dist/lib/restoreCommand.js +35 -0
  133. package/dist/lib/sandboxStartCommand.d.ts +6 -0
  134. package/dist/lib/sandboxStartCommand.js +25 -0
  135. package/dist/lib/sandboxStatusCommand.d.ts +4 -0
  136. package/dist/lib/sandboxStatusCommand.js +24 -0
  137. package/dist/lib/sandboxStopCommand.d.ts +4 -0
  138. package/dist/lib/sandboxStopCommand.js +21 -0
  139. package/dist/lib/searchCommand.d.ts +9 -0
  140. package/dist/lib/searchCommand.js +90 -0
  141. package/dist/lib/semanticSearchCommand.d.ts +8 -0
  142. package/dist/lib/semanticSearchCommand.js +52 -0
  143. package/dist/lib/setup/configSetRender.js +2 -0
  144. package/dist/lib/setup/providerGlyphs.d.ts +19 -0
  145. package/dist/lib/setup/providerGlyphs.js +42 -0
  146. package/dist/lib/setup/remoteRender.d.ts +31 -1
  147. package/dist/lib/setup/remoteRender.js +95 -4
  148. package/dist/lib/setup/sections/providers.d.ts +17 -0
  149. package/dist/lib/setup/sections/providers.js +255 -0
  150. package/dist/lib/setup/sections/routing.d.ts +2 -6
  151. package/dist/lib/setup/sections/routing.js +33 -85
  152. package/dist/lib/setup/sections/taskRoutingEditor.d.ts +17 -0
  153. package/dist/lib/setup/sections/taskRoutingEditor.js +149 -0
  154. package/dist/lib/setup/summary.d.ts +9 -0
  155. package/dist/lib/setup/summary.js +51 -37
  156. package/dist/lib/setup/ui/status.d.ts +1 -0
  157. package/dist/lib/setup/ui/status.js +2 -0
  158. package/dist/lib/setup.d.ts +108 -3
  159. package/dist/lib/setup.js +762 -157
  160. package/dist/lib/setupKeys.d.ts +42 -0
  161. package/dist/lib/setupKeys.js +564 -0
  162. package/dist/lib/setupRemoteCommand.d.ts +4 -0
  163. package/dist/lib/setupRemoteCommand.js +28 -0
  164. package/dist/lib/setupRemotePullCommand.d.ts +5 -0
  165. package/dist/lib/setupRemotePullCommand.js +52 -0
  166. package/dist/lib/setupRemotePushCommand.d.ts +5 -0
  167. package/dist/lib/setupRemotePushCommand.js +57 -0
  168. package/dist/lib/setupRemoteResolveCommand.d.ts +4 -0
  169. package/dist/lib/setupRemoteResolveCommand.js +48 -0
  170. package/dist/lib/setupRemoteStatusCommand.d.ts +4 -0
  171. package/dist/lib/setupRemoteStatusCommand.js +73 -0
  172. package/dist/lib/setupRemoteSyncCommand.d.ts +6 -0
  173. package/dist/lib/setupRemoteSyncCommand.js +65 -0
  174. package/dist/lib/setupSyncProjectsCommand.d.ts +4 -0
  175. package/dist/lib/setupSyncProjectsCommand.js +292 -0
  176. package/dist/lib/staleCommand.d.ts +8 -0
  177. package/dist/lib/staleCommand.js +34 -0
  178. package/dist/lib/statsCommand.d.ts +6 -0
  179. package/dist/lib/statsCommand.js +142 -0
  180. package/dist/lib/statusCommand.d.ts +18 -0
  181. package/dist/lib/statusCommand.js +250 -0
  182. package/dist/lib/storesCommand.d.ts +2 -0
  183. package/dist/lib/storesCommand.js +4 -0
  184. package/dist/lib/syncClient.d.ts +47 -0
  185. package/dist/lib/syncClient.js +212 -0
  186. package/dist/lib/syncCommand.d.ts +6 -0
  187. package/dist/lib/syncCommand.js +57 -0
  188. package/dist/lib/syncDoctorCommand.d.ts +5 -0
  189. package/dist/lib/syncDoctorCommand.js +100 -0
  190. package/dist/lib/syncIngest.d.ts +19 -0
  191. package/dist/lib/syncIngest.js +152 -0
  192. package/dist/lib/syncIngestLaunchd.d.ts +8 -0
  193. package/dist/lib/syncIngestLaunchd.js +93 -0
  194. package/dist/lib/syncIngestStartup.d.ts +5 -0
  195. package/dist/lib/syncIngestStartup.js +29 -0
  196. package/dist/lib/syncIngestSystemd.d.ts +10 -0
  197. package/dist/lib/syncIngestSystemd.js +97 -0
  198. package/dist/lib/syncIngestTimer.d.ts +8 -0
  199. package/dist/lib/syncIngestTimer.js +27 -0
  200. package/dist/lib/syncIngestTimerCommand.d.ts +7 -0
  201. package/dist/lib/syncIngestTimerCommand.js +83 -0
  202. package/dist/lib/syncLock.d.ts +6 -0
  203. package/dist/lib/syncLock.js +74 -0
  204. package/dist/lib/syncSnapshot.d.ts +30 -0
  205. package/dist/lib/syncSnapshot.js +184 -0
  206. package/dist/lib/syncStaging.d.ts +81 -0
  207. package/dist/lib/syncStaging.js +239 -0
  208. package/dist/lib/tagsAddCommand.d.ts +8 -0
  209. package/dist/lib/tagsAddCommand.js +18 -0
  210. package/dist/lib/tagsCommand.d.ts +4 -0
  211. package/dist/lib/tagsCommand.js +16 -0
  212. package/dist/lib/timelineCommand.d.ts +7 -0
  213. package/dist/lib/timelineCommand.js +49 -0
  214. package/dist/lib/traceCommand.d.ts +6 -0
  215. package/dist/lib/traceCommand.js +39 -0
  216. package/dist/lib/traverseCommand.d.ts +6 -0
  217. package/dist/lib/traverseCommand.js +58 -0
  218. package/dist/lib/updateCommand.d.ts +13 -0
  219. package/dist/lib/updateCommand.js +67 -0
  220. package/dist/lib/updateStatusCommand.d.ts +5 -0
  221. package/dist/lib/updateStatusCommand.js +38 -0
  222. package/dist/lib/webAddCommand.d.ts +8 -0
  223. package/dist/lib/webAddCommand.js +55 -0
  224. package/dist/lib/webBuildCommand.d.ts +10 -0
  225. package/dist/lib/webBuildCommand.js +65 -0
  226. package/dist/lib/webBuildIndexCommand.d.ts +8 -0
  227. package/dist/lib/webBuildIndexCommand.js +37 -0
  228. package/dist/lib/webIngestCommand.d.ts +11 -0
  229. package/dist/lib/webIngestCommand.js +51 -0
  230. package/dist/lib/webInitCommand.d.ts +9 -0
  231. package/dist/lib/webInitCommand.js +167 -0
  232. package/dist/lib/webRemoveCommand.d.ts +5 -0
  233. package/dist/lib/webRemoveCommand.js +41 -0
  234. package/dist/lib/webStatusCommand.d.ts +5 -0
  235. package/dist/lib/webStatusCommand.js +94 -0
  236. package/dist/lib/webUpdateCommand.d.ts +7 -0
  237. package/dist/lib/webUpdateCommand.js +72 -0
  238. package/dist/lib/workingSetCommand.d.ts +6 -0
  239. package/dist/lib/workingSetCommand.js +37 -0
  240. package/package.json +2 -1
@@ -45,7 +45,9 @@ const PKG_VERSION = (() => {
45
45
  //
46
46
  // Detect the "gnosys.json says anthropic but no Anthropic key exists AND
47
47
  // another provider has a key" pattern. Offer one-keystroke repair.
48
- const PROVIDERS_WITH_KEYS = ["anthropic", "openai", "xai", "groq", "mistral"];
48
+ const PROVIDERS_WITH_KEYS = [
49
+ "anthropic", "openai", "xai", "groq", "mistral", "openrouter",
50
+ ];
49
51
  async function maybeOfferProviderRepair(cfg, projectDir, rl) {
50
52
  if (cfg.llm.defaultProvider !== "anthropic")
51
53
  return;
@@ -92,50 +94,38 @@ async function maybeOfferProviderRepair(cfg, projectDir, rl) {
92
94
  }
93
95
  catch (err) {
94
96
  process.stdout.write(`${Status("warn", `failed to repair: ${err instanceof Error ? err.message : String(err)}`)}\n`);
95
- process.stdout.write(`${Status("warn", "run 'gnosys setup models' to change manually", "fallback")}\n`);
97
+ process.stdout.write(`${Status("warn", "run 'gnosys setup providers' to change manually", "fallback")}\n`);
96
98
  }
97
99
  }
98
100
  export function buildSections() {
99
101
  return [
100
102
  {
101
103
  key: "1",
102
- label: "provider",
103
- describe: (cfg) => cfg.llm.defaultProvider,
104
- // v5.9.4 Bug 4 — row 1 now changes ONLY the provider; row 2 stays
105
- // as the full model picker. Before, both routed to `runModelsSetup`.
106
- edit: async (rl, _cfg, projectDir) => {
107
- const { runProviderOnlySetup } = await import("../setup.js");
108
- await runProviderOnlySetup({ directory: projectDir, rl });
109
- return true;
110
- },
111
- },
112
- {
113
- key: "2",
114
- label: "models",
104
+ label: "providers",
115
105
  describe: async (cfg) => {
116
- const synth = resolveTaskModel(cfg, "synthesis");
117
- return `${synth.provider} / ${synth.model}`;
106
+ const { describeProvidersSummary } = await import("./sections/providers.js");
107
+ return describeProvidersSummary(cfg);
118
108
  },
119
109
  edit: async (rl, _cfg, projectDir) => {
120
- const { runModelsSetup } = await import("../setup.js");
121
- await runModelsSetup({ directory: projectDir, rl });
122
- return true;
110
+ const { runProvidersSetup } = await import("./sections/providers.js");
111
+ return runProvidersSetup({ rl, directory: projectDir });
123
112
  },
124
113
  },
125
114
  {
126
- key: "3",
115
+ key: "2",
127
116
  label: "task routing",
128
117
  describe: async (cfg) => {
129
118
  const provs = new Set([
130
119
  resolveTaskModel(cfg, "structuring").provider,
131
120
  resolveTaskModel(cfg, "synthesis").provider,
121
+ resolveTaskModel(cfg, "chat").provider,
132
122
  ]);
133
123
  return provs.size === 1 ? `all ${[...provs][0]}` : `mixed (${[...provs].join(", ")})`;
134
124
  },
135
125
  edit: async (rl, _cfg, projectDir) => editRouting(rl, projectDir),
136
126
  },
137
127
  {
138
- key: "4",
128
+ key: "3",
139
129
  label: "ide integrations",
140
130
  describe: async () => {
141
131
  const { detectIDEs } = await import("../setup.js");
@@ -145,19 +135,9 @@ export function buildSections() {
145
135
  edit: async (rl, _cfg, projectDir) => editIDEs(rl, projectDir),
146
136
  },
147
137
  {
148
- key: "5",
138
+ key: "4",
149
139
  label: "multi-machine sync",
150
- describe: () => {
151
- try {
152
- const db = GnosysDB.openLocal();
153
- const remotePath = db.getMeta("remote_path");
154
- db.close();
155
- return remotePath ?? "not configured";
156
- }
157
- catch {
158
- return "not configured";
159
- }
160
- },
140
+ describe: async () => describeMultiMachineSyncPanel(),
161
141
  edit: async (rl) => {
162
142
  const { runConfigureWizard } = await import("../remoteWizard.js");
163
143
  const centralDb = GnosysDB.openLocal();
@@ -170,7 +150,7 @@ export function buildSections() {
170
150
  },
171
151
  },
172
152
  {
173
- key: "6",
153
+ key: "5",
174
154
  label: "dream mode",
175
155
  // v5.9.4 Bug 7 — reconcile config + local-DB so the panel reflects
176
156
  // state set elsewhere (e.g. a dream wizard run on this machine).
@@ -202,7 +182,7 @@ export function buildSections() {
202
182
  },
203
183
  },
204
184
  {
205
- key: "7",
185
+ key: "6",
206
186
  label: "user preferences",
207
187
  describe: async () => {
208
188
  const { listUserPreferences } = await import("./sections/preferences.js");
@@ -313,5 +293,39 @@ export async function runSummaryWizard(opts = {}) {
313
293
  rl.close();
314
294
  }
315
295
  }
296
+ /**
297
+ * Settings-panel value for multi-machine sync (v13 design).
298
+ * Shows the configured master folder path, or "NA (single-machine only)" when unset.
299
+ */
300
+ export function formatMultiMachineSyncSummary(remotePath) {
301
+ return remotePath ?? "NA (single-machine only)";
302
+ }
303
+ /** Resolve multi-machine sync status for the summary panel row. */
304
+ export async function describeMultiMachineSyncPanel() {
305
+ let db = null;
306
+ try {
307
+ db = GnosysDB.openLocal();
308
+ const { getConfiguredRemotePath } = await import("../remote.js");
309
+ const remotePath = getConfiguredRemotePath(db);
310
+ return formatMultiMachineSyncSummary(remotePath);
311
+ }
312
+ catch {
313
+ return formatMultiMachineSyncSummary(null);
314
+ }
315
+ finally {
316
+ try {
317
+ db?.close();
318
+ }
319
+ catch {
320
+ // ignore
321
+ }
322
+ }
323
+ }
316
324
  // Internal helpers exported for tests.
317
- export const __test = { resolveActiveStorePath, renderPanelRows, buildTrailingMap };
325
+ export const __test = {
326
+ resolveActiveStorePath,
327
+ renderPanelRows,
328
+ buildTrailingMap,
329
+ formatMultiMachineSyncSummary,
330
+ describeMultiMachineSyncPanel,
331
+ };
@@ -18,3 +18,4 @@ export type StatusKind = "ok" | "warn" | "fail" | "progress";
18
18
  export declare function Status(kind: StatusKind, text: string, meta?: string): string;
19
19
  /** Convenience: print a single status line. */
20
20
  export declare function printStatus(kind: StatusKind, text: string, meta?: string): void;
21
+ export { MASTER_UNREACHABLE_MESSAGE, formatMemoriesWaitingToSync, formatFailedToSyncCount, formatOfflinePushStarting, renderClientSyncStatusLines, type ClientSyncStatusInput, } from "../remoteRender.js";
@@ -46,3 +46,5 @@ export function Status(kind, text, meta) {
46
46
  export function printStatus(kind, text, meta) {
47
47
  process.stdout.write(`${Status(kind, text, meta)}\n`);
48
48
  }
49
+ // ─── v13 multi-machine sync (re-export render helpers for CLI/MCP callers) ─
50
+ export { MASTER_UNREACHABLE_MESSAGE, formatMemoriesWaitingToSync, formatFailedToSyncCount, formatOfflinePushStarting, renderClientSyncStatusLines, } from "../remoteRender.js";
@@ -8,6 +8,9 @@
8
8
  * Uses Node.js built-in readline/promises — no external dependencies.
9
9
  */
10
10
  import { type Interface as ReadlineInterface } from "readline/promises";
11
+ import { type GnosysConfig, type LLMProviderName } from "./config.js";
12
+ import { type ApiKeyRequirement, type ApiKeyScope, type LlmTaskName } from "./apiKeyVault.js";
13
+ export { printStatus } from "./setup/ui/status.js";
11
14
  export interface ModelTier {
12
15
  name: string;
13
16
  model: string;
@@ -39,6 +42,23 @@ export interface SetupResult {
39
42
  dreamEnabled?: boolean;
40
43
  }
41
44
  export declare const PROVIDER_TIERS: Record<string, ModelTier[]>;
45
+ /**
46
+ * Fetch models from OpenRouter, cache for 24 hours, fall back to hardcoded.
47
+ * Returns updated PROVIDER_TIERS for cloud providers only.
48
+ */
49
+ export declare function fetchDynamicModels(): Promise<Record<string, ModelTier[]>>;
50
+ export declare const TASK_DESCRIPTIONS: Record<string, string>;
51
+ /** Tasks routed via taskModels in gnosys.json */
52
+ declare const ROUTABLE_TASK_LIST: readonly ["structuring", "synthesis", "vision", "transcription", "chat"];
53
+ type RoutableTaskName = (typeof ROUTABLE_TASK_LIST)[number];
54
+ /** Routable tasks plus dream (stored under config.dream) */
55
+ type AssignableTaskName = RoutableTaskName | "dream";
56
+ export declare const ASSIGNABLE_TASK_LIST: AssignableTaskName[];
57
+ export type { AssignableTaskName, RoutableTaskName };
58
+ export declare function getAssignableRouting(cfg: GnosysConfig, task: AssignableTaskName): {
59
+ provider: LLMProviderName;
60
+ model: string;
61
+ };
42
62
  /**
43
63
  * Returns the cheapest capable model for structuring tasks.
44
64
  * Structuring (keyword extraction, tagging) doesn't need a flagship model.
@@ -49,7 +69,9 @@ export declare function getStructuringModel(provider: string, chosenModel: strin
49
69
  * Creates the directory and file if they don't exist.
50
70
  * Replaces an existing key line if found, otherwise appends.
51
71
  */
52
- export declare function writeApiKey(provider: string, key: string): Promise<void>;
72
+ export declare function writeApiKey(provider: string, key: string, opts?: {
73
+ scope?: ApiKeyScope;
74
+ }): Promise<void>;
53
75
  /**
54
76
  * Detect which IDEs are available in the given project directory.
55
77
  * Returns an array like ["claude", "cursor", "codex"].
@@ -76,7 +98,43 @@ export declare function setupIDE(ide: string, projectDir: string): Promise<{
76
98
  success: boolean;
77
99
  message: string;
78
100
  }>;
101
+ /**
102
+ * Read a single line of input with an optional default value.
103
+ */
104
+ export declare function askInput(rl: ReadlineInterface, prompt: string, opts?: {
105
+ default?: string;
106
+ }): Promise<string>;
107
+ export declare function printInfo(text: string, meta?: string): void;
108
+ /**
109
+ * Y/n prompt. Returns true for yes.
110
+ */
111
+ export declare function askYesNo(rl: ReadlineInterface, question: string, defaultYes?: boolean): Promise<boolean>;
112
+ /**
113
+ * Read a password/API key without echoing it back to the terminal.
114
+ */
115
+ export declare function askPassword(rl: ReadlineInterface, prompt: string): Promise<string>;
116
+ /** Parse `1,3,5`, `all`, or `none` into 0-based task indices. */
117
+ export declare function parseCommaSeparatedTaskSelection(input: string, count: number): number[] | "all" | "none" | null;
118
+ export declare function modelForTaskAssignment(task: string, provider: string, model: string): string;
119
+ /**
120
+ * Let the user pick a provider from the list.
121
+ * Returns the provider name or "skip".
122
+ * If currentProvider is given, shows it as the current value.
123
+ */
124
+ export declare function pickProvider(rl: ReadlineInterface, dynamicModels: Record<string, ModelTier[]>, stepLabel: string, currentProvider?: string): Promise<string>;
125
+ /**
126
+ * Let the user pick a model from a provider's tiers.
127
+ * Returns the model string. Includes a "Custom (enter model name)"
128
+ * option so users can type any model ID not in the curated list.
129
+ */
130
+ export declare function pickModel(rl: ReadlineInterface, provider: string, dynamicModels: Record<string, ModelTier[]>, stepLabel: string, currentModel?: string): Promise<string>;
79
131
  export declare function runSetup(opts: {
132
+ section: "keys";
133
+ directory?: string;
134
+ nonInteractive?: boolean;
135
+ }): Promise<void>;
136
+ export declare function runSetup(opts: {
137
+ section?: undefined;
80
138
  directory?: string;
81
139
  nonInteractive?: boolean;
82
140
  }): Promise<SetupResult>;
@@ -94,6 +152,50 @@ export interface ProviderOnlySetupOpts {
94
152
  * a new model. Now row 1 picks a provider, row 2 picks a model.
95
153
  */
96
154
  export declare function runProviderOnlySetup(opts?: ProviderOnlySetupOpts): Promise<void>;
155
+ /** Where validated keys are persisted (§3.10). */
156
+ export type KeyPersistDestination = "secure" | "dotenv" | "none";
157
+ /**
158
+ * Build API key requirements from the selected task set only (§3.7).
159
+ * One global key per distinct cloud provider in the selection.
160
+ */
161
+ export declare function buildInlineKeyRequirements(selectedTasks: AssignableTaskName[], providerForTask: (task: AssignableTaskName) => string): ApiKeyRequirement[];
162
+ /** Write or replace a single `NAME=value` line in ~/.config/gnosys/.env. */
163
+ export declare function writeServiceKeyToEnv(service: string, key: string): Promise<void>;
164
+ /**
165
+ * Validate a provider/model/key triple without persisting the key (§3.8).
166
+ * On auth failure, re-prompt for a replacement key in memory only.
167
+ */
168
+ export declare function validateTaskCombo(opts: {
169
+ rl: ReadlineInterface;
170
+ provider: string;
171
+ model: string;
172
+ apiKey: string;
173
+ customBaseUrl?: string;
174
+ isLocalProvider: boolean;
175
+ saveAnywayPrompt?: string;
176
+ saveAnywayDefault?: boolean;
177
+ repromptKey?: (rl: ReadlineInterface, provider: string) => Promise<string | null>;
178
+ }): Promise<{
179
+ proceed: boolean;
180
+ apiKey: string;
181
+ }>;
182
+ /** Ask where to store a validated key; persist or print env-var hints (§3.10). */
183
+ export declare function promptKeyDestinationAndPersist(opts: {
184
+ rl: ReadlineInterface;
185
+ service: string;
186
+ provider: string;
187
+ key: string;
188
+ scope: ApiKeyScope;
189
+ destinationChoice?: number;
190
+ }): Promise<KeyPersistDestination>;
191
+ /** Build taskModels patch — only selected routable tasks that changed. */
192
+ export declare function buildTaskModelsPatchFromAccepted(accepted: Partial<Record<AssignableTaskName, {
193
+ provider: LLMProviderName;
194
+ model: string;
195
+ }>>, currentByTask: Record<AssignableTaskName, {
196
+ provider: LLMProviderName;
197
+ model: string;
198
+ }>, selectedSet: Set<AssignableTaskName>): NonNullable<GnosysConfig["taskModels"]> | undefined;
97
199
  export interface ModelsSetupOpts {
98
200
  provider?: string;
99
201
  model?: string;
@@ -146,5 +248,8 @@ export declare function runChatSetup(opts?: ChatSetupOpts): Promise<void>;
146
248
  * Best-effort lookup of the API key for a provider. Used by the dream setup
147
249
  * wizard to power the validation step. Mirrors the resolveApiKey precedence.
148
250
  */
149
- export declare function getApiKeyForProvider(provider: string): Promise<string>;
150
- export {};
251
+ export declare function getApiKeyForProvider(provider: string, opts?: {
252
+ task?: LlmTaskName;
253
+ directory?: string;
254
+ }): Promise<string>;
255
+ export { getApiKeyForProviderFromConfig } from "./apiKeyVault.js";