@nodetool-ai/cli-providers 0.0.0-stage → 0.8.9-bootstrap.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.
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
- # Temporary Holding Version
1
+ # Command provider adapters
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared provider construction and model discovery for installed command features.
4
+ This library has no command registration or interactive terminal code. Chat and
5
+ model commands reuse it without depending on one another.
6
+
7
+ The WebSocket provider accepts a structural inference client. Its consumer owns
8
+ the WebSocket connection and event transport.
@@ -0,0 +1 @@
1
+ 2026-10-30T19:34:09.589Z
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Provider factory for the chat CLI.
3
+ *
4
+ * Construction and credential wiring are delegated to the runtime provider
5
+ * registry (`@nodetool-ai/runtime`), so every provider registered there is
6
+ * reachable from the CLI without a hand-maintained switch. The curated lists
7
+ * below (`KNOWN_PROVIDERS`, `DEFAULT_MODELS`) only drive the interactive
8
+ * autocomplete and default-model hints for the common chat providers.
9
+ */
10
+ import type { BaseProvider, Message, ProviderStreamItem, ProviderTool } from "@nodetool-ai/runtime";
11
+ import { BaseProvider as BaseProviderClass } from "@nodetool-ai/runtime";
12
+ import { type UnifiedModel } from "@nodetool-ai/protocol";
13
+ export type InferenceEvent = {
14
+ readonly type: "chunk";
15
+ readonly content: string;
16
+ } | {
17
+ readonly type: "tool_call";
18
+ readonly id: string;
19
+ readonly name: string;
20
+ readonly args: Record<string, unknown>;
21
+ } | {
22
+ readonly type: "error";
23
+ readonly message: string;
24
+ } | {
25
+ readonly type: "done";
26
+ };
27
+ export interface InferenceClient {
28
+ readonly inference: (messages: Message[], model: string, provider: string, tools?: ProviderTool[]) => AsyncGenerator<InferenceEvent>;
29
+ }
30
+ /**
31
+ * Chat-capable providers surfaced in interactive autocomplete (`/provider <tab>`)
32
+ * and the `--provider` help text. This is a curated subset of the registry —
33
+ * the well-known LLM chat APIs plus the local servers. Any other registered
34
+ * provider (evolink, vllm, llama_cpp, …) still works when passed explicitly via
35
+ * `--provider <id>`; it just isn't listed here.
36
+ */
37
+ export declare const KNOWN_PROVIDERS: readonly ["anthropic", "claude_agent_sdk", "antigravity", "openai", "codex", "gemini", "xai", "groq", "mistral", "deepseek", "moonshot", "minimax", "cerebras", "gmi", "meta", "alibaba", "together", "openrouter", "requesty", "opper", "api_route", "huggingface", "replicate", "kie", "aki", "ollama", "lmstudio", "mlx", "node_llama_cpp"];
38
+ export type KnownProvider = (typeof KNOWN_PROVIDERS)[number];
39
+ /** Default model shown when switching to a provider in interactive mode. */
40
+ export declare const DEFAULT_MODELS: Record<string, string>;
41
+ /**
42
+ * Stop the Python worker if this process started one. The worker is a child
43
+ * process, so a command that leaves it running never exits.
44
+ */
45
+ export declare function closePythonProviders(): void;
46
+ export declare function ensureCustomProvidersRegistered(): Promise<void>;
47
+ /** Build a registered provider, rejecting unknown ids instead of falling back. */
48
+ export declare function createProviderStrict(providerId: string): Promise<BaseProvider>;
49
+ /** Build a provider, preserving the chat CLI's Ollama fallback for unknown ids. */
50
+ export declare function createProvider(providerId: string): Promise<BaseProvider>;
51
+ /**
52
+ * The secret/env key a provider needs (e.g. `"OPENROUTER_API_KEY"`), or null
53
+ * for local/keyless providers. Used to tell the user which key to set when a
54
+ * provider can't be constructed.
55
+ */
56
+ export declare function providerSecretKey(providerId: string): string | null;
57
+ /**
58
+ * Build a map of `{providerId -> BaseProvider}` for use by the agent's
59
+ * `find_model` tool and media tool dispatch. Includes every registered
60
+ * provider whose required credentials resolve (local providers have none, so
61
+ * they're always present). Construction failures are skipped silently.
62
+ */
63
+ export declare function buildConfiguredProviders(options?: {
64
+ includePython?: boolean;
65
+ }): Promise<Record<string, BaseProvider>>;
66
+ export type ProviderModelKind = "llm" | "image" | "tts" | "asr" | "video" | "embedding";
67
+ export declare function listConfiguredProviderInfo(): Promise<Array<{
68
+ provider: string;
69
+ capabilities: string[];
70
+ }>>;
71
+ export interface ConfiguredLanguageModel {
72
+ readonly id: string;
73
+ readonly name: string;
74
+ readonly provider: string;
75
+ }
76
+ export interface ConfiguredLanguageModelCatalog {
77
+ readonly providers: readonly string[];
78
+ readonly models: readonly ConfiguredLanguageModel[];
79
+ }
80
+ /**
81
+ * Language models exposed by every configured provider. A provider whose
82
+ * catalog is temporarily unavailable remains selectable by an explicit
83
+ * `provider/model` spec, while the other providers still populate the picker.
84
+ */
85
+ export declare function listConfiguredLanguageModels(): Promise<ConfiguredLanguageModelCatalog>;
86
+ export declare function listProviderModels(providerId: string, kind: ProviderModelKind): Promise<UnifiedModel[]>;
87
+ /**
88
+ * The full model catalog assembled locally, mirroring the server's
89
+ * `models.all` endpoint without a running server: the recommended models, the
90
+ * language models of every configured provider (tagged with tool support), and
91
+ * the locally cached HuggingFace repos. Provider and cache failures are skipped
92
+ * so one broken provider never sinks the whole list.
93
+ */
94
+ export declare function listAllModels(): Promise<UnifiedModel[]>;
95
+ /** Ollama's locally installed language models, read straight from the daemon. */
96
+ export declare function listOllamaModels(): Promise<UnifiedModel[]>;
97
+ /**
98
+ * The set of chat providers currently usable: local/keyless providers plus any
99
+ * hosted provider whose key resolves from the encrypted DB or env. Async
100
+ * because it consults the secret store; the interactive picker uses this to
101
+ * disable providers that can't be selected. Mirrors `availableProviders()` but
102
+ * also picks up DB-stored keys (not just env).
103
+ */
104
+ export declare function configuredProviderIds(): Promise<Set<string>>;
105
+ /**
106
+ * Which chat providers have credentials configured (env-only — a fast sync
107
+ * check used by autocomplete). Local providers are always listed, with
108
+ * `ollama` kept last for stable display ordering.
109
+ */
110
+ export declare function availableProviders(): string[];
111
+ /**
112
+ * A provider that routes all inference through the NodeTool WebSocket server.
113
+ * Used in agent mode when --url is passed: the server handles LLM calls,
114
+ * so no local API keys are required.
115
+ */
116
+ export declare class WebSocketProvider extends BaseProviderClass {
117
+ private readonly client;
118
+ private readonly defaultModel;
119
+ private readonly providerId;
120
+ constructor(client: InferenceClient, defaultModel: string, providerId: string);
121
+ generateMessage(args: {
122
+ messages: Message[];
123
+ model: string;
124
+ tools?: ProviderTool[];
125
+ maxTokens?: number;
126
+ }): Promise<Message>;
127
+ generateMessages(args: {
128
+ messages: Message[];
129
+ model: string;
130
+ tools?: ProviderTool[];
131
+ }): AsyncGenerator<ProviderStreamItem>;
132
+ }
133
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,YAAY,EAEZ,OAAO,EACP,kBAAkB,EAClB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,YAAY,IAAI,iBAAiB,EAWlC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAClH;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAA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pB,UAAU,EAAE,MAAM,EAIpC;IAEK,eAAe,CAAC,IAAI,EAAE;QAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQnB;IAEM,gBAAgB,CAAC,IAAI,EAAE;QAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;KACxB,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAgBrC;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,495 @@
1
+ /**
2
+ * Provider factory for the chat CLI.
3
+ *
4
+ * Construction and credential wiring are delegated to the runtime provider
5
+ * registry (`@nodetool-ai/runtime`), so every provider registered there is
6
+ * reachable from the CLI without a hand-maintained switch. The curated lists
7
+ * below (`KNOWN_PROVIDERS`, `DEFAULT_MODELS`) only drive the interactive
8
+ * autocomplete and default-model hints for the common chat providers.
9
+ */
10
+ import { BaseProvider as BaseProviderClass, createPythonBridge, FakeProvider, getProvider, getProviderSecretKey, isProviderConfigured, listRegisteredProviderIds, PythonProvider, registerProvider, syncCustomProviders, RECOMMENDED_MODELS } from "@nodetool-ai/runtime";
11
+ import { initializeInstalledExecutionHost } from "@nodetool-ai/pack-manager";
12
+ import { readCachedHfModels } from "@nodetool-ai/huggingface";
13
+ import { CUSTOM_PROVIDERS_SETTING_KEY, parseCustomProviderCatalog } from "@nodetool-ai/protocol";
14
+ import { getSecret, Setting } from "@nodetool-ai/models";
15
+ import { importPack, MissingPackError } from "@nodetool-ai/node-catalog";
16
+ async function registerPackProvider(pack) {
17
+ if (pack === "transformers-js") {
18
+ const module = await importPack(pack, "@nodetool-ai/transformers-js-provider");
19
+ module.registerTransformersJsProvider();
20
+ }
21
+ else {
22
+ const module = await importPack(pack);
23
+ module.registerWhisperCppProviders();
24
+ }
25
+ }
26
+ async function registerAvailablePackProviders() {
27
+ for (const pack of ["transformers-js", "whisper-cpp"]) {
28
+ try {
29
+ await registerPackProvider(pack);
30
+ }
31
+ catch (error) {
32
+ if (!(error instanceof MissingPackError)) {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ /**
39
+ * Chat-capable providers surfaced in interactive autocomplete (`/provider <tab>`)
40
+ * and the `--provider` help text. This is a curated subset of the registry —
41
+ * the well-known LLM chat APIs plus the local servers. Any other registered
42
+ * provider (evolink, vllm, llama_cpp, …) still works when passed explicitly via
43
+ * `--provider <id>`; it just isn't listed here.
44
+ */
45
+ export const KNOWN_PROVIDERS = [
46
+ "anthropic",
47
+ "claude_agent_sdk",
48
+ "antigravity",
49
+ "openai",
50
+ "codex",
51
+ "gemini",
52
+ "xai",
53
+ "groq",
54
+ "mistral",
55
+ "deepseek",
56
+ "moonshot",
57
+ "minimax",
58
+ "cerebras",
59
+ "gmi",
60
+ "meta",
61
+ "alibaba",
62
+ "together",
63
+ "openrouter",
64
+ "requesty",
65
+ "opper",
66
+ "api_route",
67
+ "huggingface",
68
+ "replicate",
69
+ "kie",
70
+ "aki",
71
+ "ollama",
72
+ "lmstudio",
73
+ "mlx",
74
+ "node_llama_cpp"
75
+ ];
76
+ /**
77
+ * Providers reachable without an API key: the local servers plus the Claude
78
+ * Agent SDK and Antigravity (which authenticate with the machine's logged-in
79
+ * `claude` or `agy` CLI instead of a key).
80
+ */
81
+ const LOCAL_PROVIDERS = [
82
+ "whisper_cpp",
83
+ "whisper_cpp_server",
84
+ "lmstudio",
85
+ "ollama",
86
+ "mlx",
87
+ "claude_agent_sdk",
88
+ "antigravity",
89
+ "node_llama_cpp",
90
+ "stable_diffusion_cpp"
91
+ ];
92
+ /**
93
+ * Providers served only through the local Python worker (no TS implementation).
94
+ * They aren't in the runtime registry until the stdio bridge connects and
95
+ * advertises them, so `createProvider` connects the bridge on demand for these.
96
+ */
97
+ const PYTHON_ONLY_PROVIDERS = ["mlx"];
98
+ /** MLX (and other Python-local models) only run on Apple Silicon. */
99
+ function isAppleSilicon() {
100
+ return process.platform === "darwin" && process.arch === "arm64";
101
+ }
102
+ /** Default model shown when switching to a provider in interactive mode. */
103
+ export const DEFAULT_MODELS = {
104
+ anthropic: "claude-sonnet-4-6",
105
+ claude_agent_sdk: "sonnet",
106
+ antigravity: "gemini-3.1-pro-high",
107
+ openai: "gpt-5.4",
108
+ codex: "gpt-5.5",
109
+ gemini: "gemini-2.5-flash",
110
+ xai: "grok-4",
111
+ groq: "llama-3.3-70b-versatile",
112
+ mistral: "mistral-large-latest",
113
+ deepseek: "deepseek-chat",
114
+ moonshot: "kimi-k2.7",
115
+ minimax: "MiniMax-M2",
116
+ cerebras: "llama-3.3-70b",
117
+ gmi: "meta-llama/Llama-3.3-70B-Instruct",
118
+ meta: "muse-spark-1.2",
119
+ alibaba: "qwen3-max",
120
+ together: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
121
+ openrouter: "openai/gpt-5.4-mini",
122
+ requesty: "openai/gpt-4o-mini",
123
+ opper: "gpt-5.4-mini",
124
+ api_route: "claude-haiku-4-5",
125
+ huggingface: "meta-llama/Llama-3.3-70B-Instruct",
126
+ replicate: "anthropic/claude-4.5-sonnet",
127
+ kie: "gpt-5-5",
128
+ aki: "llama3_chat",
129
+ ollama: "qwen-3.5:4b",
130
+ lmstudio: "qwen/qwen3.5-9b",
131
+ mlx: "mlx-community/Qwen3.5-0.8B-OptiQ-4bit",
132
+ node_llama_cpp: "qwen2.5-3b-instruct-q4_k_m.gguf"
133
+ };
134
+ /** Resolve a secret from the encrypted DB (user "1"); env fallback handled by the registry. */
135
+ const resolveForUser1 = (key) => getSecret(key, "1");
136
+ /**
137
+ * Lazily spawn the local Python worker bridge and register the Python-only
138
+ * providers it advertises (e.g. `mlx`, local HuggingFace) into the runtime
139
+ * registry. Idempotent: the bridge is connected once per process and the
140
+ * promise cached. On failure the cache is cleared so a later call can retry,
141
+ * and the error is rethrown so the caller can explain why the provider is
142
+ * unavailable.
143
+ */
144
+ let pythonProvidersPromise = null;
145
+ let pythonBridge = null;
146
+ async function ensurePythonProvidersRegistered() {
147
+ if (!pythonProvidersPromise) {
148
+ pythonProvidersPromise = (async () => {
149
+ await initializeInstalledExecutionHost(import.meta.url);
150
+ const bridge = createPythonBridge();
151
+ pythonBridge = bridge;
152
+ await bridge.connect();
153
+ for (const info of await bridge.listProviders()) {
154
+ // Don't shadow a TS-native provider that owns the same id (e.g. the
155
+ // hosted HuggingFace provider vs. the Python local one).
156
+ if (listRegisteredProviderIds().includes(info.id))
157
+ continue;
158
+ registerProvider(info.id, PythonProvider, {
159
+ _bridge: bridge,
160
+ _id: info.id,
161
+ _capabilities: info.capabilities
162
+ });
163
+ }
164
+ })().catch((err) => {
165
+ pythonProvidersPromise = null;
166
+ pythonBridge?.close();
167
+ pythonBridge = null;
168
+ throw err;
169
+ });
170
+ }
171
+ return pythonProvidersPromise;
172
+ }
173
+ /**
174
+ * Stop the Python worker if this process started one. The worker is a child
175
+ * process, so a command that leaves it running never exits.
176
+ */
177
+ export function closePythonProviders() {
178
+ pythonBridge?.close();
179
+ pythonBridge = null;
180
+ pythonProvidersPromise = null;
181
+ }
182
+ /**
183
+ * Start the Python worker for a command that lists every provider, so MLX
184
+ * and the other Python providers appear. Without a Python environment the
185
+ * command still lists the rest, with a notice on stderr.
186
+ */
187
+ async function tryPythonProviders() {
188
+ if (PYTHON_ONLY_PROVIDERS.every((id) => listRegisteredProviderIds().includes(id))) {
189
+ return;
190
+ }
191
+ await initializeInstalledExecutionHost(import.meta.url);
192
+ try {
193
+ await ensurePythonProvidersRegistered();
194
+ }
195
+ catch (err) {
196
+ console.error(`Python providers skipped: the Python worker could not start (${err instanceof Error ? err.message : String(err)}).`);
197
+ }
198
+ }
199
+ /**
200
+ * Register the user's OpenAI-compatible endpoints into the runtime registry.
201
+ * The server does this on every request; the CLI has no request, so every
202
+ * entrance that resolves a provider calls it once. Non-fatal: an unreachable
203
+ * database leaves the built-in providers working.
204
+ */
205
+ let customProvidersPromise = null;
206
+ export async function ensureCustomProvidersRegistered() {
207
+ await registerAvailablePackProviders();
208
+ if (!customProvidersPromise) {
209
+ customProvidersPromise = (async () => {
210
+ const setting = await Setting.find("1", CUSTOM_PROVIDERS_SETTING_KEY);
211
+ if (setting) {
212
+ syncCustomProviders(parseCustomProviderCatalog(setting.getValue()));
213
+ }
214
+ })().catch(() => undefined);
215
+ }
216
+ return customProvidersPromise;
217
+ }
218
+ /** Build a registered provider, rejecting unknown ids instead of falling back. */
219
+ export async function createProviderStrict(providerId) {
220
+ const id = providerId.toLowerCase();
221
+ if (id === "transformers_js") {
222
+ await registerPackProvider("transformers-js");
223
+ }
224
+ if (id === "whisper_cpp" || id === "whisper_cpp_server") {
225
+ await registerPackProvider("whisper-cpp");
226
+ }
227
+ await ensureCustomProvidersRegistered();
228
+ if (PYTHON_ONLY_PROVIDERS.includes(id) &&
229
+ !listRegisteredProviderIds().includes(id)) {
230
+ await initializeInstalledExecutionHost(import.meta.url);
231
+ try {
232
+ await ensurePythonProvidersRegistered();
233
+ }
234
+ catch (err) {
235
+ throw new Error(`Provider "${id}" needs the local Python worker, which could not be started ` +
236
+ `(${err instanceof Error ? err.message : String(err)}). Ensure the nodetool ` +
237
+ `Python environment is installed and activated (e.g. \`conda activate nodetool\`).`);
238
+ }
239
+ if (!listRegisteredProviderIds().includes(id)) {
240
+ throw new Error(`Provider "${id}" is not available from the Python worker on this machine` +
241
+ (id === "mlx" && !isAppleSilicon() ? " (MLX requires Apple Silicon)." : "."));
242
+ }
243
+ }
244
+ if (!listRegisteredProviderIds().includes(id)) {
245
+ throw new Error(`Unknown provider "${id}"`);
246
+ }
247
+ return getProvider(id, resolveForUser1);
248
+ }
249
+ /** Build a provider, preserving the chat CLI's Ollama fallback for unknown ids. */
250
+ export async function createProvider(providerId) {
251
+ const id = providerId.toLowerCase();
252
+ if (id === "transformers_js") {
253
+ await registerPackProvider("transformers-js");
254
+ }
255
+ if (id === "whisper_cpp" || id === "whisper_cpp_server") {
256
+ await registerPackProvider("whisper-cpp");
257
+ }
258
+ await ensureCustomProvidersRegistered();
259
+ if (!PYTHON_ONLY_PROVIDERS.includes(id) &&
260
+ !listRegisteredProviderIds().includes(id)) {
261
+ return getProvider("ollama", resolveForUser1);
262
+ }
263
+ return createProviderStrict(id);
264
+ }
265
+ /**
266
+ * The secret/env key a provider needs (e.g. `"OPENROUTER_API_KEY"`), or null
267
+ * for local/keyless providers. Used to tell the user which key to set when a
268
+ * provider can't be constructed.
269
+ */
270
+ export function providerSecretKey(providerId) {
271
+ return getProviderSecretKey(providerId.toLowerCase());
272
+ }
273
+ /**
274
+ * Build a map of `{providerId -> BaseProvider}` for use by the agent's
275
+ * `find_model` tool and media tool dispatch. Includes every registered
276
+ * provider whose required credentials resolve (local providers have none, so
277
+ * they're always present). Construction failures are skipped silently.
278
+ */
279
+ export async function buildConfiguredProviders(options = {}) {
280
+ const result = {};
281
+ await ensureCustomProvidersRegistered();
282
+ if (options.includePython) {
283
+ await tryPythonProviders();
284
+ }
285
+ for (const id of listRegisteredProviderIds()) {
286
+ try {
287
+ if (await isProviderConfigured(id, resolveForUser1)) {
288
+ result[id] = await getProvider(id, resolveForUser1);
289
+ }
290
+ }
291
+ catch {
292
+ // Provider failed to construct (bad/missing config) — skip it.
293
+ }
294
+ }
295
+ return result;
296
+ }
297
+ export async function listConfiguredProviderInfo() {
298
+ const providers = await buildConfiguredProviders({ includePython: true });
299
+ return Object.entries(providers).map(([provider, instance]) => ({
300
+ provider,
301
+ capabilities: instance.getCapabilities()
302
+ }));
303
+ }
304
+ /**
305
+ * Language models exposed by every configured provider. A provider whose
306
+ * catalog is temporarily unavailable remains selectable by an explicit
307
+ * `provider/model` spec, while the other providers still populate the picker.
308
+ */
309
+ export async function listConfiguredLanguageModels() {
310
+ const providers = await buildConfiguredProviders();
311
+ const models = await Promise.all(Object.entries(providers).map(async ([provider, instance]) => {
312
+ try {
313
+ return (await instance.getAvailableLanguageModels()).map((model) => ({
314
+ id: model.id,
315
+ name: model.name,
316
+ provider
317
+ }));
318
+ }
319
+ catch {
320
+ return [];
321
+ }
322
+ }));
323
+ return {
324
+ providers: Object.keys(providers),
325
+ models: models.flat()
326
+ };
327
+ }
328
+ function toUnifiedModel(model, type) {
329
+ return {
330
+ id: model.id,
331
+ type,
332
+ name: model.name,
333
+ provider: model.provider,
334
+ repo_id: null,
335
+ path: null,
336
+ downloaded: model.provider === "ollama" ||
337
+ model.provider === "llama_cpp" ||
338
+ model.provider === "node_llama_cpp" ||
339
+ model.provider === "whisper_cpp" ||
340
+ model.provider === "whisper_cpp_server",
341
+ tags: [model.provider],
342
+ voices: model.voices ?? null,
343
+ supported_tasks: model.supportedTasks ?? null,
344
+ durations: model.durations ?? null,
345
+ resolutions: model.resolutions ?? null,
346
+ aspect_ratios: model.aspectRatios ?? null
347
+ };
348
+ }
349
+ export async function listProviderModels(providerId, kind) {
350
+ // Explicit discovery may show test models without admitting them to automatic selection.
351
+ const provider = providerId === "fake" && kind === "llm"
352
+ ? new FakeProvider()
353
+ : await createProviderStrict(providerId);
354
+ if (kind === "llm") {
355
+ const models = await provider.getAvailableLanguageModels();
356
+ const toolSupport = await Promise.all(models.map((model) => provider.hasToolSupport(model.id).catch(() => null)));
357
+ return models.map((model, index) => ({
358
+ ...toUnifiedModel(model, "language_model"),
359
+ supports_tools: toolSupport[index]
360
+ }));
361
+ }
362
+ switch (kind) {
363
+ case "image":
364
+ return (await provider.getAvailableImageModels()).map((model) => toUnifiedModel(model, "image_model"));
365
+ case "tts":
366
+ return (await provider.getAvailableTTSModels()).map((model) => toUnifiedModel(model, "tts_model"));
367
+ case "asr":
368
+ return (await provider.getAvailableASRModels()).map((model) => toUnifiedModel(model, "asr_model"));
369
+ case "video":
370
+ return (await provider.getAvailableVideoModels()).map((model) => toUnifiedModel(model, "video_model"));
371
+ case "embedding":
372
+ return (await provider.getAvailableEmbeddingModels()).map((model) => toUnifiedModel(model, "embedding_model"));
373
+ }
374
+ }
375
+ /**
376
+ * The full model catalog assembled locally, mirroring the server's
377
+ * `models.all` endpoint without a running server: the recommended models, the
378
+ * language models of every configured provider (tagged with tool support), and
379
+ * the locally cached HuggingFace repos. Provider and cache failures are skipped
380
+ * so one broken provider never sinks the whole list.
381
+ */
382
+ export async function listAllModels() {
383
+ const all = [...RECOMMENDED_MODELS];
384
+ const providers = await buildConfiguredProviders({ includePython: true });
385
+ const perProvider = await Promise.all(Object.values(providers).map(async (instance) => {
386
+ try {
387
+ const models = await instance.getAvailableLanguageModels();
388
+ const toolFlags = await Promise.all(models.map((model) => instance.hasToolSupport(model.id).catch(() => null)));
389
+ return models.map((model, index) => ({
390
+ ...toUnifiedModel(model, "language_model"),
391
+ supports_tools: toolFlags[index]
392
+ }));
393
+ }
394
+ catch {
395
+ // Provider unavailable — skip it.
396
+ return [];
397
+ }
398
+ }));
399
+ for (const models of perProvider)
400
+ all.push(...models);
401
+ try {
402
+ all.push(...(await readCachedHfModels()));
403
+ }
404
+ catch {
405
+ // HuggingFace cache unavailable — continue without it.
406
+ }
407
+ return all;
408
+ }
409
+ /** Ollama's locally installed language models, read straight from the daemon. */
410
+ export async function listOllamaModels() {
411
+ return listProviderModels("ollama", "llm");
412
+ }
413
+ /**
414
+ * The set of chat providers currently usable: local/keyless providers plus any
415
+ * hosted provider whose key resolves from the encrypted DB or env. Async
416
+ * because it consults the secret store; the interactive picker uses this to
417
+ * disable providers that can't be selected. Mirrors `availableProviders()` but
418
+ * also picks up DB-stored keys (not just env).
419
+ */
420
+ export async function configuredProviderIds() {
421
+ await registerAvailablePackProviders();
422
+ const flags = await Promise.all(KNOWN_PROVIDERS.map((id) => {
423
+ // mlx is keyless but registered lazily (via the Python bridge), so
424
+ // isProviderConfigured() reports false until the bridge connects. Treat
425
+ // it as selectable on the only platform that can run it.
426
+ if (id === "mlx")
427
+ return Promise.resolve(isAppleSilicon());
428
+ return isProviderConfigured(id, resolveForUser1);
429
+ }));
430
+ return new Set(KNOWN_PROVIDERS.filter((_, i) => flags[i]));
431
+ }
432
+ /**
433
+ * Which chat providers have credentials configured (env-only — a fast sync
434
+ * check used by autocomplete). Local providers are always listed, with
435
+ * `ollama` kept last for stable display ordering.
436
+ */
437
+ export function availableProviders() {
438
+ const available = [];
439
+ for (const id of KNOWN_PROVIDERS) {
440
+ if (LOCAL_PROVIDERS.includes(id))
441
+ continue;
442
+ const key = getProviderSecretKey(id);
443
+ if (key && process.env[key])
444
+ available.push(id);
445
+ }
446
+ if (isAppleSilicon())
447
+ available.push("mlx");
448
+ // Keyless: surfaced like the local servers (the `claude` CLI carries its own
449
+ // subscription auth).
450
+ available.push("claude_agent_sdk");
451
+ available.push("lmstudio");
452
+ available.push("ollama");
453
+ return available;
454
+ }
455
+ /**
456
+ * A provider that routes all inference through the NodeTool WebSocket server.
457
+ * Used in agent mode when --url is passed: the server handles LLM calls,
458
+ * so no local API keys are required.
459
+ */
460
+ export class WebSocketProvider extends BaseProviderClass {
461
+ client;
462
+ defaultModel;
463
+ providerId;
464
+ constructor(client, defaultModel, providerId) {
465
+ // ProviderId = "openai" | "anthropic" | ... | string, which collapses to string
466
+ super(providerId);
467
+ this.client = client;
468
+ this.defaultModel = defaultModel;
469
+ this.providerId = providerId;
470
+ }
471
+ async generateMessage(args) {
472
+ let content = "";
473
+ for await (const item of this.generateMessages(args)) {
474
+ if ("type" in item && item.type === "chunk") {
475
+ content += item.content ?? "";
476
+ }
477
+ }
478
+ return { role: "assistant", content };
479
+ }
480
+ async *generateMessages(args) {
481
+ const model = args.model || this.defaultModel;
482
+ for await (const event of this.client.inference(args.messages, model, this.providerId, args.tools)) {
483
+ if (event.type === "chunk") {
484
+ yield { type: "chunk", content: event.content };
485
+ }
486
+ else if (event.type === "tool_call") {
487
+ yield { id: event.id, name: event.name, args: event.args };
488
+ }
489
+ else if (event.type === "error") {
490
+ throw new Error(event.message);
491
+ }
492
+ }
493
+ }
494
+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EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAC7C,IAAI,CAAC,QAAQ,EACb,KAAK,EACL,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,KAAK,CACX,EAAE,CAAC;YACF,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC3B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAClD,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBACtC,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YAC7D,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
+ "version": "0.8.9-bootstrap.0",
3
+ "type": "module",
4
+ "engines": {
5
+ "node": ">=22.0.0"
6
+ },
7
+ "license": "MIT",
8
+ "homepage": "https://nodetool.ai",
9
+ "bugs": {
10
+ "url": "https://github.com/nodetool-ai/nodetool/issues"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
2
15
  "name": "@nodetool-ai/cli-providers",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
16
+ "description": "Shared NodeTool command provider adapters",
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "node ../../scripts/build-typescript-workspace.mjs",
25
+ "test": "node ../../scripts/run-vitest.mjs run",
26
+ "lint": "node ../../scripts/run-tsc.mjs --noEmit"
27
+ },
28
+ "dependencies": {
29
+ "@nodetool-ai/huggingface": "0.8.9-bootstrap.0",
30
+ "@nodetool-ai/models": "0.8.9-bootstrap.0",
31
+ "@nodetool-ai/node-catalog": "0.8.9-bootstrap.0",
32
+ "@nodetool-ai/protocol": "0.8.9-bootstrap.0",
33
+ "@nodetool-ai/runtime": "0.8.9-bootstrap.0",
34
+ "@nodetool-ai/pack-manager": "0.8.9-bootstrap.0"
35
+ },
36
+ "devDependencies": {
37
+ "vitest": "^5.0.1",
38
+ "typescript": "npm:@typescript/typescript6@6.0.2"
39
+ },
40
+ "exports": {
41
+ ".": {
42
+ "nodetool-dev": "./src/index.ts",
43
+ "types": "./dist/index.d.ts",
44
+ "import": "./dist/index.js",
45
+ "default": "./dist/index.js"
46
+ }
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/nodetool-ai/nodetool.git",
51
+ "directory": "packages/cli-providers"
52
+ }
53
+ }