opencode-rag-plugin 2.12.0 → 2.12.2

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.
@@ -92,6 +92,7 @@ export function registerQuirkCommand(program) {
92
92
  const tags = q.tags.length > 0 ? ` (${q.tags.join(", ")})` : "";
93
93
  const date = q.lastObserved ? new Date(q.lastObserved).toLocaleDateString() : "";
94
94
  logCliInfo(ctx.logFilePath, "quirk list", ` ${c.value(badge)}${c.file(q.content)}${c.dim(tags)} ${c.dim(date)}`);
95
+ logCliInfo(ctx.logFilePath, "quirk list", ` ${c.dim(`id: ${q.id}`)}`);
95
96
  }
96
97
  await cleanupContext(ctx);
97
98
  }
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { existsSync, lstatSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
- import { execSync } from "node:child_process";
3
+ import { execFileSync, execSync } from "node:child_process";
4
4
  import { c } from "../format.js";
5
5
  import { getPackageMetadata } from "../helpers.js";
6
6
  import { getRuntimeDir, getVersionFile, readVersionFile, setupRuntime, } from "../../core/setup-runtime.js";
@@ -10,10 +10,12 @@ import { globalConfigPath, loadWorkspaceRawConfig, migrateLegacyProjectConfig, f
10
10
  import { createPrompter } from "../prompt.js";
11
11
  import { hasExplicitSetupFlags, answersFromFlags, runSetupWizard, } from "../wizard/flow.js";
12
12
  import { buildConfigPatch, findShadowingProviderKeys, readJsonObjectSafe, removeConfigPaths, writeConfigPatch, } from "../wizard/apply.js";
13
+ import { offerHealthRepairs } from "../wizard/repair.js";
13
14
  import { generateDefaultConfigJson } from "./workspace-helpers.js";
14
15
  import { detectOllamaBackend } from "./backend-detect.js";
15
16
  import { isLikelyProjectRoot, runWorkspaceHealthCheck, scaffoldWorkspace, } from "../workspace.js";
16
17
  import { destroyAllPooledConnections } from "../../embedder/http.js";
18
+ import { getGlobalPluginDir, installGlobalPlugin, isGlobalPluginInstalled, isWorkspacePluginInstalled, removeGlobalPlugin, } from "../../core/global-plugin.js";
17
19
  const PLUGIN_NAME = "opencode-rag-plugin";
18
20
  function removeIfExists(targetPath) {
19
21
  if (existsSync(targetPath)) {
@@ -97,9 +99,11 @@ export function registerSetupCommand(program) {
97
99
  .option("--clickhouse-user <name>", "ClickHouse user (default default)")
98
100
  .option("--clickhouse-password-env <name>", "env var holding the ClickHouse password")
99
101
  .option("--clickhouse-namespace <name>", "project namespace / table suffix")
100
- .option("--skip-install", "skip linking workspace-local plugin dependencies")
101
- .option("--skip-health-check", "skip provider connectivity and model availability check")
102
- .option("--skip-runtime", "skip the machine-level runtime install (workspace setup only)")
102
+ .option("--skip-install [on|off]", "skip linking workspace-local plugin dependencies")
103
+ .option("--skip-health-check [on|off]", "skip provider connectivity and model availability check")
104
+ .option("--skip-runtime [on|off]", "skip the machine-level runtime install (workspace setup only)")
105
+ .option("--workspace-plugin", "install the plugin into this workspace instead of the global config")
106
+ .option("--no-index", "do not offer to build the search index after setup")
103
107
  .action(async (options) => {
104
108
  await runSetup(options);
105
109
  });
@@ -129,6 +133,10 @@ function normalizeFlags(options) {
129
133
  reranking: parseToggle(options.reranking),
130
134
  shellGuard: parseToggle(options.shellGuard),
131
135
  memoryCapture: parseToggle(options.memoryCapture),
136
+ // Optional-value booleans: `--skip-x`, `--skip-x=false`, `--skip-x off`.
137
+ skipInstall: parseToggle(options.skipInstall),
138
+ skipHealthCheck: parseToggle(options.skipHealthCheck),
139
+ skipRuntime: parseToggle(options.skipRuntime),
132
140
  };
133
141
  }
134
142
  /** Write the baseline workspace config (with Ollama batch tuning when available). */
@@ -147,6 +155,25 @@ async function writeDefaultWorkspaceConfig(configPath, configLabel) {
147
155
  writeFileSync(configPath, generateDefaultConfigJson(tuning), "utf-8");
148
156
  console.log(`\n ${c.created("Created:")} ${c.file(configLabel)}`);
149
157
  }
158
+ /**
159
+ * Run `opencode-rag index` in a child process so setup can finish with a
160
+ * ready-to-query index instead of requiring a second command.
161
+ */
162
+ function buildIndexNow() {
163
+ const entry = process.argv[1];
164
+ if (!entry)
165
+ return;
166
+ try {
167
+ console.log(`\n${c.heading("Building the search index...")}\n`);
168
+ execFileSync(process.execPath, [...process.execArgv, entry, "index"], {
169
+ stdio: "inherit",
170
+ windowsHide: true,
171
+ });
172
+ }
173
+ catch {
174
+ console.log(`\n ${c.warn("Indexing did not finish.")} Run \`opencode-rag index\` to retry.`);
175
+ }
176
+ }
150
177
  /** The `setup` action body. */
151
178
  async function runSetup(rawOptions) {
152
179
  const options = normalizeFlags(rawOptions);
@@ -178,6 +205,18 @@ async function runSetup(rawOptions) {
178
205
  }
179
206
  })() : "missing"}`);
180
207
  console.log(` ${c.label("SDK:")} ${existsSync(runtimeSdkPluginDir) ? "present" : "missing"}`);
208
+ {
209
+ const globalDir = getGlobalPluginDir();
210
+ if (isGlobalPluginInstalled()) {
211
+ console.log(` ${c.label("Plugin mode:")} ${c.success("global")} at ${c.file(globalDir)}`);
212
+ }
213
+ else if (isWorkspacePluginInstalled(process.cwd())) {
214
+ console.log(` ${c.label("Plugin mode:")} ${c.value("workspace")} (legacy layout in this project)`);
215
+ }
216
+ else {
217
+ console.log(` ${c.label("Plugin mode:")} ${c.warn("not installed")} — run \`opencode-rag setup\``);
218
+ }
219
+ }
181
220
  }
182
221
  else {
183
222
  console.log(` ${c.label("Runtime:")} ${c.warn("not installed")}`);
@@ -194,6 +233,9 @@ async function runSetup(rawOptions) {
194
233
  // shared with other OpenCode plugins/tools.
195
234
  removeIfExists(runtimeSdkPluginDir);
196
235
  removeIfExists(versionFile);
236
+ if (removeGlobalPlugin()) {
237
+ console.log(` ${c.updated("Removed:")} ${c.file(getGlobalPluginDir())}`);
238
+ }
197
239
  console.log(` ${c.updated("Removed:")} ${c.file(runtimePluginDir)}`);
198
240
  console.log(` ${c.updated("Removed:")} ${c.file(runtimeSdkPluginDir)}`);
199
241
  const uninstallPm = bestAvailablePackageManager() ?? "npm";
@@ -230,6 +272,20 @@ async function runSetup(rawOptions) {
230
272
  return;
231
273
  }
232
274
  }
275
+ // --- global plugin (default) ---
276
+ let pluginMode = options.workspacePlugin ? "workspace" : "global";
277
+ if (pluginMode === "global") {
278
+ try {
279
+ const installed = installGlobalPlugin({ force: options.force });
280
+ const label = installed.written.length > 0 ? c.created("Installed:") : c.exists("Exists:");
281
+ console.log(`\n ${label} global plugin at ${c.file(installed.dir)}`);
282
+ }
283
+ catch (err) {
284
+ console.log(`\n ${c.warn("Global plugin install skipped:")} ${err.message}`);
285
+ console.log(` ${c.dim("Falling back to the workspace-local plugin layout.")}`);
286
+ pluginMode = "workspace";
287
+ }
288
+ }
233
289
  // --- workspace ---
234
290
  const cwd = process.cwd();
235
291
  const prompter = createPrompter(!options.yes);
@@ -251,17 +307,17 @@ async function runSetup(rawOptions) {
251
307
  const existing = loadWorkspaceRawConfig(cwd);
252
308
  const configured = hasConfiguredEmbedding(existing);
253
309
  const explicitFlags = hasExplicitSetupFlags(options);
310
+ const existingEmbedding = existing.embedding;
311
+ const configProxy = existingEmbedding && typeof existingEmbedding === "object" && !Array.isArray(existingEmbedding)
312
+ ? existingEmbedding.proxy
313
+ : undefined;
254
314
  let answers;
255
315
  if (prompter.interactive && (options.reconfigure || !configured)) {
256
- const existingEmbedding = existing.embedding;
257
- const proxy = existingEmbedding && typeof existingEmbedding === "object" && !Array.isArray(existingEmbedding)
258
- ? existingEmbedding.proxy
259
- : undefined;
260
316
  answers = await runSetupWizard({
261
317
  ...options,
262
318
  prompter,
263
319
  existing,
264
- proxy: proxy,
320
+ proxy: configProxy,
265
321
  });
266
322
  if (answers === undefined) {
267
323
  console.log(`\n ${c.warn("Setup cancelled.")} No configuration was changed.\n`);
@@ -322,9 +378,26 @@ async function runSetup(rawOptions) {
322
378
  force: options.force,
323
379
  skipInstall: options.skipInstall,
324
380
  configPath,
381
+ workspacePlugin: pluginMode === "workspace",
325
382
  });
326
383
  if (!options.skipHealthCheck) {
327
- await runWorkspaceHealthCheck(cwd, prompter);
384
+ const health = await runWorkspaceHealthCheck(cwd, prompter, { autoPull: answers?.recommended === true });
385
+ await offerHealthRepairs({
386
+ cwd,
387
+ workspaceConfigPath: configPath,
388
+ globalConfigPath: globalConfigPath(),
389
+ prompter,
390
+ results: health,
391
+ ...(configProxy ? { proxy: configProxy } : {}),
392
+ });
393
+ }
394
+ if (options.index !== false && prompter.interactive) {
395
+ const buildIndex = await prompter.confirm({
396
+ message: "Build the search index now? (can take a few minutes)",
397
+ defaultValue: true,
398
+ });
399
+ if (buildIndex)
400
+ buildIndexNow();
328
401
  }
329
402
  }
330
403
  catch (err) {
@@ -630,6 +630,9 @@ export function generateDefaultConfigJson(tuning) {
630
630
  mcp: {
631
631
  enabled: DEFAULT_CONFIG.mcp.enabled,
632
632
  },
633
+ setup: {
634
+ autoScaffold: DEFAULT_CONFIG.setup.autoScaffold,
635
+ },
633
636
  logging: {
634
637
  level: DEFAULT_CONFIG.logging.level,
635
638
  logFilePath: DEFAULT_CONFIG.logging.logFilePath,
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fileoverview Ollama detection hints shared by `setup` and the wizard.
3
+ */
4
+ /**
5
+ * Platform-specific command that installs Ollama.
6
+ *
7
+ * The CLI never installs Ollama itself (it is a native application with a
8
+ * service), but printing the exact command removes the "what now?" step.
9
+ */
10
+ export declare function ollamaInstallHint(): string;
11
+ /** Whether an error message looks like a refused/unreachable Ollama connection. */
12
+ export declare function isOllamaConnectionError(message: string | undefined): boolean;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @fileoverview Ollama detection hints shared by `setup` and the wizard.
3
+ */
4
+ /**
5
+ * Platform-specific command that installs Ollama.
6
+ *
7
+ * The CLI never installs Ollama itself (it is a native application with a
8
+ * service), but printing the exact command removes the "what now?" step.
9
+ */
10
+ export function ollamaInstallHint() {
11
+ switch (process.platform) {
12
+ case "win32":
13
+ return "Install it with: winget install Ollama.Ollama";
14
+ case "darwin":
15
+ return "Install it with: brew install ollama (or download it from https://ollama.com)";
16
+ default:
17
+ return "Install it with: curl -fsSL https://ollama.com/install.sh | sh";
18
+ }
19
+ }
20
+ /** Whether an error message looks like a refused/unreachable Ollama connection. */
21
+ export function isOllamaConnectionError(message) {
22
+ if (!message)
23
+ return false;
24
+ return /connection refused|ECONNREFUSED|fetch failed|cannot reach|not reachable/i.test(message);
25
+ }
26
+ //# sourceMappingURL=ollama.js.map
@@ -75,6 +75,43 @@ export interface Prompter {
75
75
  }
76
76
  /** Whether the process is attached to an interactive terminal. */
77
77
  export declare function isInteractiveTerminal(): boolean;
78
+ /**
79
+ * Prompt implementation backed by one persistent `node:readline` interface.
80
+ *
81
+ * The interface stays attached for the whole wizard and queues lines that
82
+ * arrive while no question is pending: a paste, a piped stdin or a pty script
83
+ * can deliver several answers at once, and a per-prompt interface would drop
84
+ * the extra lines (readline emits them as `line` events with no listener).
85
+ *
86
+ * Exporting the class is deliberate — the queue behaviour is covered by
87
+ * `src/__tests__/cli/prompt.test.ts`, which injects two `PassThrough` streams.
88
+ */
89
+ export declare class ReadlinePrompter implements Prompter {
90
+ private readonly input;
91
+ private readonly output;
92
+ readonly interactive = true;
93
+ private rl;
94
+ /** Bumped on every attach/detach so stale listeners from an old interface are ignored. */
95
+ private generation;
96
+ private readonly buffered;
97
+ private waiter;
98
+ private inputClosed;
99
+ private cancelled;
100
+ constructor(input: NodeJS.ReadStream, output: NodeJS.WriteStream);
101
+ /** Attach (or re-attach) the line reader. */
102
+ private ensureInterface;
103
+ /** Close the reader without ending the wizard (used by the raw-mode password path). */
104
+ private detach;
105
+ /** Hand a line to the waiting question, or queue it for the next one. */
106
+ private deliver;
107
+ /** Ask one line, resolving `undefined` on abort. */
108
+ private ask;
109
+ text(options: TextPromptOptions): Promise<string | undefined>;
110
+ password(message: string): Promise<string | undefined>;
111
+ confirm(options: ConfirmPromptOptions): Promise<boolean | undefined>;
112
+ select<T>(options: SelectPromptOptions<T>): Promise<T | undefined>;
113
+ close(): void;
114
+ }
78
115
  /**
79
116
  * Create a prompter for the current process.
80
117
  *
@@ -58,38 +58,95 @@ function writeLine(output, line) {
58
58
  }
59
59
  }
60
60
  /**
61
- * Prompt implementation backed by `node:readline`.
61
+ * Prompt implementation backed by one persistent `node:readline` interface.
62
62
  *
63
- * A readline interface is created lazily for each text/select prompt and
64
- * closed in a `finally` block; this keeps cancellation (SIGINT) and terminal
65
- * state predictable even when the user aborts halfway through the wizard.
63
+ * The interface stays attached for the whole wizard and queues lines that
64
+ * arrive while no question is pending: a paste, a piped stdin or a pty script
65
+ * can deliver several answers at once, and a per-prompt interface would drop
66
+ * the extra lines (readline emits them as `line` events with no listener).
67
+ *
68
+ * Exporting the class is deliberate — the queue behaviour is covered by
69
+ * `src/__tests__/cli/prompt.test.ts`, which injects two `PassThrough` streams.
66
70
  */
67
- class ReadlinePrompter {
71
+ export class ReadlinePrompter {
68
72
  input;
69
73
  output;
70
74
  interactive = true;
75
+ rl;
76
+ /** Bumped on every attach/detach so stale listeners from an old interface are ignored. */
77
+ generation = 0;
78
+ buffered = [];
79
+ waiter;
80
+ inputClosed = false;
81
+ cancelled = false;
71
82
  constructor(input, output) {
72
83
  this.input = input;
73
84
  this.output = output;
74
85
  }
86
+ /** Attach (or re-attach) the line reader. */
87
+ ensureInterface() {
88
+ if (this.rl)
89
+ return this.rl;
90
+ const generation = ++this.generation;
91
+ const rl = createInterface({ input: this.input, output: this.output, terminal: true });
92
+ rl.on("line", (line) => {
93
+ if (generation === this.generation)
94
+ this.deliver(line);
95
+ });
96
+ rl.on("SIGINT", () => {
97
+ if (generation !== this.generation)
98
+ return;
99
+ writeLine(this.output, "\n");
100
+ this.cancelled = true;
101
+ this.detach();
102
+ this.deliver(undefined);
103
+ });
104
+ rl.once("close", () => {
105
+ if (generation !== this.generation)
106
+ return;
107
+ this.rl = undefined;
108
+ this.inputClosed = true;
109
+ this.deliver(undefined);
110
+ });
111
+ this.rl = rl;
112
+ return rl;
113
+ }
114
+ /** Close the reader without ending the wizard (used by the raw-mode password path). */
115
+ detach() {
116
+ const rl = this.rl;
117
+ this.rl = undefined;
118
+ this.generation += 1;
119
+ rl?.close();
120
+ }
121
+ /** Hand a line to the waiting question, or queue it for the next one. */
122
+ deliver(line) {
123
+ const waiter = this.waiter;
124
+ if (waiter) {
125
+ this.waiter = undefined;
126
+ waiter(line);
127
+ return;
128
+ }
129
+ if (line !== undefined)
130
+ this.buffered.push(line);
131
+ }
75
132
  /** Ask one line, resolving `undefined` on abort. */
76
133
  ask(question) {
134
+ // Buffered answers win over EOF: a pipe ends the stream right after the
135
+ // last answer, and the wizard must still apply them.
136
+ const buffered = this.buffered.shift();
137
+ if (buffered !== undefined) {
138
+ // The answer arrived before the question was displayed (paste / piped
139
+ // input): echo both so the transcript still reads like a session.
140
+ writeLine(this.output, `${question}${buffered}\n`);
141
+ return Promise.resolve(buffered);
142
+ }
143
+ if (this.cancelled || this.inputClosed)
144
+ return Promise.resolve(undefined);
145
+ const rl = this.ensureInterface();
77
146
  return new Promise((resolve) => {
78
- const rl = createInterface({ input: this.input, output: this.output, terminal: true });
79
- let settled = false;
80
- const finish = (value) => {
81
- if (settled)
82
- return;
83
- settled = true;
84
- rl.close();
85
- resolve(value);
86
- };
87
- rl.once("SIGINT", () => {
88
- writeLine(this.output, "\n");
89
- finish(undefined);
90
- });
91
- rl.once("close", () => finish(undefined));
92
- rl.question(question, (answer) => finish(answer));
147
+ this.waiter = resolve;
148
+ rl.setPrompt(question);
149
+ rl.prompt();
93
150
  });
94
151
  }
95
152
  async text(options) {
@@ -116,6 +173,9 @@ class ReadlinePrompter {
116
173
  // Piped stdin: read a plain line (still masked in the transcript by the caller).
117
174
  return this.ask(` ${message}: `);
118
175
  }
176
+ // Raw mode must own the stream: the line reader would otherwise echo and
177
+ // consume the characters. Re-attached lazily by the next `ask`.
178
+ this.detach();
119
179
  writeLine(this.output, ` ${message}: `);
120
180
  this.input.setRawMode(true);
121
181
  this.input.resume();
@@ -230,7 +290,9 @@ class ReadlinePrompter {
230
290
  }
231
291
  }
232
292
  close() {
233
- // Interfaces are per-prompt; nothing persistent to release.
293
+ this.cancelled = true;
294
+ this.detach();
295
+ this.deliver(undefined);
234
296
  }
235
297
  }
236
298
  /**
@@ -40,12 +40,25 @@ export interface SetupOptions extends WizardFlags {
40
40
  reconfigure?: boolean;
41
41
  /** Non-interactive: never prompt and keep the existing configuration. */
42
42
  yes?: boolean;
43
- /** Skip linking workspace-local plugin dependencies. */
44
- skipInstall?: boolean;
45
- /** Skip provider connectivity and model availability checks. */
46
- skipHealthCheck?: boolean;
47
- /** Skip the machine-level runtime install (workspace setup only). */
48
- skipRuntime?: boolean;
43
+ /**
44
+ * Skip linking workspace-local plugin dependencies. Commander optional
45
+ * value: `--skip-install`, `--skip-install=false`, `--skip-install off`.
46
+ */
47
+ skipInstall?: boolean | string;
48
+ /**
49
+ * Skip provider connectivity and model availability checks. Commander
50
+ * optional value, like {@link skipInstall}.
51
+ */
52
+ skipHealthCheck?: boolean | string;
53
+ /**
54
+ * Skip the machine-level runtime install (workspace setup only). Commander
55
+ * optional value, like {@link skipInstall}.
56
+ */
57
+ skipRuntime?: boolean | string;
58
+ /** Install the plugin into this workspace instead of the global config. */
59
+ workspacePlugin?: boolean;
60
+ /** Set to `false` by `--no-index`: do not offer to build the index. */
61
+ index?: boolean;
49
62
  }
50
63
  /** Shape of the `package.json` metadata required by CLI helpers. */
51
64
  export interface PackageMetadata {
@@ -22,8 +22,10 @@ export declare function isPlainObject(value: unknown): value is Record<string, u
22
22
  /**
23
23
  * Deep-merge `patch` into `base`, returning a new object.
24
24
  *
25
- * Arrays and scalars replace the base value; plain objects merge recursively.
26
- * `undefined` values are ignored so callers can omit optional keys.
25
+ * Arrays, scalars and `null` replace the base value; a `null` value removes
26
+ * the key instead (used to drop a stale `vectorDimension`). Plain objects
27
+ * merge recursively, and `undefined` values are ignored so callers can omit
28
+ * optional keys.
27
29
  */
28
30
  export declare function mergeConfigObjects(base: Record<string, unknown>, patch: Record<string, unknown>): Record<string, unknown>;
29
31
  /**
@@ -18,14 +18,20 @@ export function isPlainObject(value) {
18
18
  /**
19
19
  * Deep-merge `patch` into `base`, returning a new object.
20
20
  *
21
- * Arrays and scalars replace the base value; plain objects merge recursively.
22
- * `undefined` values are ignored so callers can omit optional keys.
21
+ * Arrays, scalars and `null` replace the base value; a `null` value removes
22
+ * the key instead (used to drop a stale `vectorDimension`). Plain objects
23
+ * merge recursively, and `undefined` values are ignored so callers can omit
24
+ * optional keys.
23
25
  */
24
26
  export function mergeConfigObjects(base, patch) {
25
27
  const next = { ...base };
26
28
  for (const [key, value] of Object.entries(patch)) {
27
29
  if (value === undefined)
28
30
  continue;
31
+ if (value === null) {
32
+ delete next[key];
33
+ continue;
34
+ }
29
35
  const existing = next[key];
30
36
  if (isPlainObject(existing) && isPlainObject(value)) {
31
37
  next[key] = mergeConfigObjects(existing, value);
@@ -58,7 +64,10 @@ export function buildConfigPatch(answers) {
58
64
  baseUrl: answers.embedding.baseUrl,
59
65
  model: answers.embedding.model,
60
66
  apiKey: answers.embedding.apiKey,
61
- vectorDimension: answers.embedding.vectorDimension,
67
+ // `null` removes a stale dimension from the config file. The wizard only
68
+ // omits the key when it could not establish the value for this model —
69
+ // keeping a previous model's dimension would break the store.
70
+ vectorDimension: answers.embedding.vectorDimension ?? null,
62
71
  }),
63
72
  };
64
73
  if (answers.description) {
@@ -8,7 +8,16 @@
8
8
  */
9
9
  import { type ProxyConfig } from "../../core/config.js";
10
10
  import type { Prompter } from "../prompt.js";
11
- import type { WizardAnswers } from "./types.js";
11
+ import { type ModelCatalog, type ModelCapability } from "./model-catalog.js";
12
+ import type { HostChoice, WizardAnswers } from "./types.js";
13
+ /** Provider entries offered by the wizard. */
14
+ export interface ProviderEntry {
15
+ id: string;
16
+ label: string;
17
+ description: string;
18
+ embedding: boolean;
19
+ chat: boolean;
20
+ }
12
21
  /** Flags that pre-fill the wizard and make it scriptable. */
13
22
  export interface WizardFlags {
14
23
  /** Provider id (`ollama`, `openai`, `cohere`, `anthropic`, `google`). */
@@ -59,6 +68,35 @@ export interface WizardRunOptions extends WizardFlags {
59
68
  /** Proxy settings inherited from the current embedding config. */
60
69
  proxy?: ProxyConfig;
61
70
  }
71
+ /** Ask for a provider + base URL + optional API key, then probe its models. */
72
+ export declare function askHost(prompter: Prompter, options: {
73
+ message: string;
74
+ existing: Record<string, unknown>;
75
+ flags: WizardFlags;
76
+ proxy?: ProxyConfig;
77
+ requireEmbedding?: boolean;
78
+ requireChat?: boolean;
79
+ /** Extra entries appended to the built-in list (repair keeps an unlisted provider selectable). */
80
+ extraProviders?: readonly ProviderEntry[];
81
+ /** Ask for a new key even when one is stored (used after an auth failure). */
82
+ forceKeyPrompt?: boolean;
83
+ }): Promise<{
84
+ host: HostChoice;
85
+ catalog: ModelCatalog;
86
+ } | undefined>;
87
+ /**
88
+ * Pick a model from a probed catalog, falling back to free-text entry.
89
+ *
90
+ * `__custom__` is always offered so a model that the provider does not list
91
+ * (or a freshly pulled one) can still be typed.
92
+ */
93
+ export declare function pickModel(prompter: Prompter, options: {
94
+ message: string;
95
+ catalog: ModelCatalog;
96
+ capability: ModelCapability;
97
+ defaultValue?: string;
98
+ allowSkip?: boolean;
99
+ }): Promise<string | undefined>;
62
100
  /**
63
101
  * Whether the caller passed any flag that should override the stored config.
64
102
  *