@moxxy/cli 0.9.0 → 0.11.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/dist/bin.js +426 -12
- package/dist/bin.js.map +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { z as z$1, defineProvider, definePlugin, defineTool, MoxxyError, writeFileAtomic, asTurnId, defineMode, asPluginId, defineChannel, defineTunnelProvider, spawnCliTunnel, isCliTunnelAvailable, createMutex, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, emitRequestsAndDetectStuck, executeToolUses, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, moxxyPath, zodToJsonSchema, runSingleShotTurn, bearerTokenMatches, resolveChannelToken, rotateChannelToken, estimateContextTokens as estimateContextTokens$1, readRequestBody, MOXXY_WS_SUBPROTOCOL, defineEmbedder, bearerGuard, tokenFromWsProtocolHeader, skillFrontmatterSchema, asSkillId, getInstallHint, moxxyHome, defineTranscriber, summarizeTokensByModel,
|
|
3
|
+
import { z as z$1, defineProvider, definePlugin, defineTool, MoxxyError, writeFileAtomic, asTurnId, defineMode, asPluginId, defineChannel, defineTunnelProvider, spawnCliTunnel, isCliTunnelAvailable, createMutex, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, emitRequestsAndDetectStuck, executeToolUses, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, moxxyPath, zodToJsonSchema, runSingleShotTurn, bearerTokenMatches, resolveChannelToken, rotateChannelToken, estimateContextTokens as estimateContextTokens$1, readRequestBody, MOXXY_WS_SUBPROTOCOL, defineEmbedder, migrateModeName, bearerGuard, tokenFromWsProtocolHeader, skillFrontmatterSchema, asSkillId, getInstallHint, moxxyHome, defineTranscriber, summarizeTokensByModel, createDeferredPermissionResolver, classifyNetworkError, addModelTotals, ISOLATION_RANK, moxxyPackageSchema, defineCommand, createCallbackResolver, autoAllowResolver, asSessionId, asToolCallId, defineViewRenderer, DEFAULT_VIEW_TAGS, isSafeViewUrl, evaluateToolRule, summarizeSessionTokensFromEvents, computeElisionState, toolResultStubbed, toolResultStub, toolResultBytes, conversationalStubbed, conversationalStub, asEventId } from '@moxxy/sdk';
|
|
4
4
|
import * as fs27 from 'fs';
|
|
5
5
|
import fs27__default, { existsSync, promises, ReadStream, readFileSync, statSync, readdirSync, mkdirSync, writeFileSync, unlinkSync, renameSync, watch, createReadStream } from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
@@ -1376,6 +1376,13 @@ var init_providers = __esm({
|
|
|
1376
1376
|
defs = /* @__PURE__ */ new Map();
|
|
1377
1377
|
instances = /* @__PURE__ */ new Map();
|
|
1378
1378
|
active = null;
|
|
1379
|
+
/**
|
|
1380
|
+
* Names the user disabled. Kept name-based (not def-based) so it can be
|
|
1381
|
+
* seeded from preferences BEFORE the plugins register their defs — boot
|
|
1382
|
+
* order doesn't matter. A disabled provider stays registered/listable but
|
|
1383
|
+
* can't be activated.
|
|
1384
|
+
*/
|
|
1385
|
+
disabled = /* @__PURE__ */ new Set();
|
|
1379
1386
|
/**
|
|
1380
1387
|
* Register a provider def. Throws on duplicate — use `replace()` for
|
|
1381
1388
|
* explicit overwrite. Matches the semantics of `tools` and `channels`.
|
|
@@ -1404,10 +1411,32 @@ var init_providers = __esm({
|
|
|
1404
1411
|
list() {
|
|
1405
1412
|
return [...this.defs.values()];
|
|
1406
1413
|
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Enable/disable a provider by name. Disabling the ACTIVE provider is
|
|
1416
|
+
* refused — switch first, then disable — so a session never ends up with an
|
|
1417
|
+
* active-but-disabled provider. Unknown names are accepted (the set seeds
|
|
1418
|
+
* from preferences before plugins register), except when disabling via a
|
|
1419
|
+
* live toggle is meaningless because the provider is active.
|
|
1420
|
+
*/
|
|
1421
|
+
setEnabled(name, enabled) {
|
|
1422
|
+
if (!enabled && this.active === name) {
|
|
1423
|
+
throw new Error(`Cannot disable the active provider "${name}" \u2014 switch providers first.`);
|
|
1424
|
+
}
|
|
1425
|
+
if (enabled)
|
|
1426
|
+
this.disabled.delete(name);
|
|
1427
|
+
else
|
|
1428
|
+
this.disabled.add(name);
|
|
1429
|
+
}
|
|
1430
|
+
isEnabled(name) {
|
|
1431
|
+
return !this.disabled.has(name);
|
|
1432
|
+
}
|
|
1407
1433
|
setActive(name, config) {
|
|
1408
1434
|
const def = this.defs.get(name);
|
|
1409
1435
|
if (!def)
|
|
1410
1436
|
throw new Error(`Provider not registered: ${name}`);
|
|
1437
|
+
if (this.disabled.has(name)) {
|
|
1438
|
+
throw new Error(`Provider "${name}" is disabled \u2014 enable it first.`);
|
|
1439
|
+
}
|
|
1411
1440
|
let instance = this.instances.get(name);
|
|
1412
1441
|
if (!instance) {
|
|
1413
1442
|
instance = def.createClient(config ?? {});
|
|
@@ -3081,6 +3110,7 @@ var init_session = __esm({
|
|
|
3081
3110
|
readyProviders;
|
|
3082
3111
|
credentialResolver;
|
|
3083
3112
|
mcpAdmin;
|
|
3113
|
+
providerAdmin;
|
|
3084
3114
|
workflows;
|
|
3085
3115
|
pluginsAdmin;
|
|
3086
3116
|
dispatcher;
|
|
@@ -3262,7 +3292,8 @@ var init_session = __esm({
|
|
|
3262
3292
|
// are the ones the desktop's "Fetch live" affordance targets;
|
|
3263
3293
|
// they advertise this via the provider-admin factory by
|
|
3264
3294
|
// setting `supportsLiveModelDiscovery: true` on their def.
|
|
3265
|
-
supportsLiveModelDiscovery: p3.supportsLiveModelDiscovery === true
|
|
3295
|
+
supportsLiveModelDiscovery: p3.supportsLiveModelDiscovery === true,
|
|
3296
|
+
enabled: this.providers.isEnabled(p3.name)
|
|
3266
3297
|
})),
|
|
3267
3298
|
activeMode,
|
|
3268
3299
|
activeModeBadge,
|
|
@@ -119366,13 +119397,16 @@ function toAnthropicTools(tools, opts = {}) {
|
|
|
119366
119397
|
|
|
119367
119398
|
// ../plugin-provider-anthropic/dist/provider.js
|
|
119368
119399
|
var anthropicModels = [
|
|
119400
|
+
{ id: "claude-fable-5", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
119401
|
+
{ id: "claude-opus-4-8", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
119369
119402
|
{ id: "claude-opus-4-7", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
119403
|
+
{ id: "claude-opus-4-6", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
119370
119404
|
{ id: "claude-sonnet-4-6", contextWindow: 1e6, maxOutputTokens: 64e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
119371
119405
|
{ id: "claude-haiku-4-5-20251001", contextWindow: 2e5, maxOutputTokens: 64e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true }
|
|
119372
119406
|
];
|
|
119373
119407
|
var AnthropicProvider = class {
|
|
119374
119408
|
name;
|
|
119375
|
-
models
|
|
119409
|
+
models;
|
|
119376
119410
|
// Mutable so OAuth-mode refresh can swap in a client carrying the new
|
|
119377
119411
|
// bearer token; the plain apiKey client never changes after construction.
|
|
119378
119412
|
client;
|
|
@@ -119384,6 +119418,7 @@ var AnthropicProvider = class {
|
|
|
119384
119418
|
oauthExpiresAt;
|
|
119385
119419
|
constructor(config = {}) {
|
|
119386
119420
|
this.name = config.name ?? "anthropic";
|
|
119421
|
+
this.models = config.models ?? anthropicModels;
|
|
119387
119422
|
this.defaultModel = config.defaultModel ?? "claude-sonnet-4-6";
|
|
119388
119423
|
if (config.baseURL)
|
|
119389
119424
|
this.baseURL = config.baseURL;
|
|
@@ -127441,6 +127476,15 @@ function noteTemperatureUnsupported() {
|
|
|
127441
127476
|
console.debug("[openai-codex] ProviderRequest.temperature is not supported by the Codex Responses backend (gpt-5 reasoning models reject sampling params); ignoring it.");
|
|
127442
127477
|
}
|
|
127443
127478
|
}
|
|
127479
|
+
var maxTokensNoteShown = false;
|
|
127480
|
+
function noteMaxTokensUnsupported() {
|
|
127481
|
+
if (maxTokensNoteShown)
|
|
127482
|
+
return;
|
|
127483
|
+
maxTokensNoteShown = true;
|
|
127484
|
+
if (process.env.MOXXY_DEBUG) {
|
|
127485
|
+
console.debug("[openai-codex] ProviderRequest.maxTokens is not supported by the Codex Responses backend (400 Unsupported parameter: max_output_tokens); ignoring it.");
|
|
127486
|
+
}
|
|
127487
|
+
}
|
|
127444
127488
|
function toResponsesBody(req, opts = {}) {
|
|
127445
127489
|
const instructions = extractSystemText(req.messages, req.system) || DEFAULT_INSTRUCTIONS;
|
|
127446
127490
|
const body = {
|
|
@@ -127458,7 +127502,7 @@ function toResponsesBody(req, opts = {}) {
|
|
|
127458
127502
|
if (opts.sessionHint)
|
|
127459
127503
|
body.prompt_cache_key = opts.sessionHint;
|
|
127460
127504
|
if (req.maxTokens !== void 0)
|
|
127461
|
-
|
|
127505
|
+
noteMaxTokensUnsupported();
|
|
127462
127506
|
if (req.temperature !== void 0)
|
|
127463
127507
|
noteTemperatureUnsupported();
|
|
127464
127508
|
return body;
|
|
@@ -128208,6 +128252,186 @@ var claudeCodePlugin = definePlugin({
|
|
|
128208
128252
|
version: "0.0.0",
|
|
128209
128253
|
providers: [claudeCodeProviderDef]
|
|
128210
128254
|
});
|
|
128255
|
+
|
|
128256
|
+
// ../plugin-provider-zai/dist/models.js
|
|
128257
|
+
var glmModels = [
|
|
128258
|
+
// GLM-5 family: coding-first frontier. 5.2 carries a usable 1M context.
|
|
128259
|
+
{ id: "glm-5.2", contextWindow: 1e6, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true },
|
|
128260
|
+
{ id: "glm-5.1", contextWindow: 2e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true },
|
|
128261
|
+
{ id: "glm-5", contextWindow: 2e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true },
|
|
128262
|
+
// GLM-4.6: prior flagship, 200k context, strong agentic-coding scores.
|
|
128263
|
+
{ id: "glm-4.6", contextWindow: 2e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true },
|
|
128264
|
+
// GLM-4.5 tier: general (4.5), lightweight (-air), free/fast (-flash).
|
|
128265
|
+
{ id: "glm-4.5", contextWindow: 131072, maxOutputTokens: 98304, supportsTools: true, supportsStreaming: true },
|
|
128266
|
+
{ id: "glm-4.5-air", contextWindow: 131072, maxOutputTokens: 98304, supportsTools: true, supportsStreaming: true },
|
|
128267
|
+
{ id: "glm-4.5-flash", contextWindow: 131072, maxOutputTokens: 98304, supportsTools: true, supportsStreaming: true },
|
|
128268
|
+
// Vision-capable variant.
|
|
128269
|
+
{ id: "glm-4.5v", contextWindow: 65536, maxOutputTokens: 16384, supportsTools: true, supportsStreaming: true, supportsImages: true }
|
|
128270
|
+
];
|
|
128271
|
+
|
|
128272
|
+
// ../plugin-provider-zai/dist/index.js
|
|
128273
|
+
var ZAI_OPENAI_BASE_URL = "https://api.z.ai/api/paas/v4";
|
|
128274
|
+
var ZAI_ANTHROPIC_BASE_URL = "https://api.z.ai/api/anthropic";
|
|
128275
|
+
var ZAI_DEFAULT_MODEL = "glm-4.6";
|
|
128276
|
+
var zaiProviderDef = defineProvider({
|
|
128277
|
+
name: "zai",
|
|
128278
|
+
models: [...glmModels],
|
|
128279
|
+
createClient: (config) => {
|
|
128280
|
+
const cfg = config;
|
|
128281
|
+
return new OpenAIProvider({
|
|
128282
|
+
...cfg,
|
|
128283
|
+
name: "zai",
|
|
128284
|
+
baseURL: cfg.baseURL ?? ZAI_OPENAI_BASE_URL,
|
|
128285
|
+
defaultModel: cfg.defaultModel ?? ZAI_DEFAULT_MODEL,
|
|
128286
|
+
models: glmModels
|
|
128287
|
+
});
|
|
128288
|
+
},
|
|
128289
|
+
validateKey: (key) => validateKey2(key, { baseURL: ZAI_OPENAI_BASE_URL }),
|
|
128290
|
+
auth: {
|
|
128291
|
+
kind: "apiKey",
|
|
128292
|
+
hint: "z.ai API key (pay-as-you-go) from https://z.ai/manage-apikey/apikey-list"
|
|
128293
|
+
}
|
|
128294
|
+
});
|
|
128295
|
+
var zaiCodingPlanProviderDef = defineProvider({
|
|
128296
|
+
name: "zai-coding-plan",
|
|
128297
|
+
models: [...glmModels],
|
|
128298
|
+
createClient: (config) => {
|
|
128299
|
+
const cfg = config;
|
|
128300
|
+
return new AnthropicProvider({
|
|
128301
|
+
...cfg,
|
|
128302
|
+
name: "zai-coding-plan",
|
|
128303
|
+
baseURL: cfg.baseURL ?? ZAI_ANTHROPIC_BASE_URL,
|
|
128304
|
+
defaultModel: cfg.defaultModel ?? ZAI_DEFAULT_MODEL,
|
|
128305
|
+
models: glmModels
|
|
128306
|
+
});
|
|
128307
|
+
},
|
|
128308
|
+
auth: {
|
|
128309
|
+
kind: "apiKey",
|
|
128310
|
+
hint: "z.ai GLM Coding Plan key (Anthropic-compatible endpoint, like Claude Code)"
|
|
128311
|
+
}
|
|
128312
|
+
});
|
|
128313
|
+
var zaiPlugin = definePlugin({
|
|
128314
|
+
name: "@moxxy/plugin-provider-zai",
|
|
128315
|
+
version: "0.0.0",
|
|
128316
|
+
providers: [zaiProviderDef, zaiCodingPlanProviderDef]
|
|
128317
|
+
});
|
|
128318
|
+
|
|
128319
|
+
// ../plugin-provider-xai/dist/models.js
|
|
128320
|
+
var grokModels = [
|
|
128321
|
+
// grok-4 family: current frontier. 4.3 is the flagship (1M context).
|
|
128322
|
+
{ id: "grok-4.3", contextWindow: 1e6, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128323
|
+
{ id: "grok-4", contextWindow: 256e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128324
|
+
{ id: "grok-4-fast", contextWindow: 256e3, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128325
|
+
// grok-code-fast-1: agentic-coding specialist (text-only).
|
|
128326
|
+
{ id: "grok-code-fast-1", contextWindow: 256e3, supportsTools: true, supportsStreaming: true },
|
|
128327
|
+
// grok-3 tier: prior generation, still served.
|
|
128328
|
+
{ id: "grok-3", contextWindow: 131072, supportsTools: true, supportsStreaming: true },
|
|
128329
|
+
{ id: "grok-3-mini", contextWindow: 131072, supportsTools: true, supportsStreaming: true }
|
|
128330
|
+
];
|
|
128331
|
+
|
|
128332
|
+
// ../plugin-provider-xai/dist/index.js
|
|
128333
|
+
var XAI_BASE_URL = "https://api.x.ai/v1";
|
|
128334
|
+
var XAI_DEFAULT_MODEL = "grok-4";
|
|
128335
|
+
var xaiProviderDef = defineProvider({
|
|
128336
|
+
name: "xai",
|
|
128337
|
+
models: [...grokModels],
|
|
128338
|
+
createClient: (config) => {
|
|
128339
|
+
const cfg = config;
|
|
128340
|
+
return new OpenAIProvider({
|
|
128341
|
+
...cfg,
|
|
128342
|
+
name: "xai",
|
|
128343
|
+
baseURL: cfg.baseURL ?? XAI_BASE_URL,
|
|
128344
|
+
defaultModel: cfg.defaultModel ?? XAI_DEFAULT_MODEL,
|
|
128345
|
+
models: grokModels
|
|
128346
|
+
});
|
|
128347
|
+
},
|
|
128348
|
+
validateKey: (key) => validateKey2(key, { baseURL: XAI_BASE_URL }),
|
|
128349
|
+
auth: {
|
|
128350
|
+
kind: "apiKey",
|
|
128351
|
+
hint: "xAI API key (starts with `xai-`) from https://console.x.ai"
|
|
128352
|
+
}
|
|
128353
|
+
});
|
|
128354
|
+
var xaiPlugin = definePlugin({
|
|
128355
|
+
name: "@moxxy/plugin-provider-xai",
|
|
128356
|
+
version: "0.0.0",
|
|
128357
|
+
providers: [xaiProviderDef]
|
|
128358
|
+
});
|
|
128359
|
+
|
|
128360
|
+
// ../plugin-provider-google/dist/models.js
|
|
128361
|
+
var geminiModels = [
|
|
128362
|
+
// Gemini 3 family: current frontier.
|
|
128363
|
+
{ id: "gemini-3-pro", contextWindow: 1e6, maxOutputTokens: 65536, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128364
|
+
{ id: "gemini-3-flash", contextWindow: 1e6, maxOutputTokens: 65536, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128365
|
+
// Gemini 2.5 family: widely available, strong price/performance.
|
|
128366
|
+
{ id: "gemini-2.5-pro", contextWindow: 1e6, maxOutputTokens: 65536, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true },
|
|
128367
|
+
{ id: "gemini-2.5-flash", contextWindow: 1e6, maxOutputTokens: 65536, supportsTools: true, supportsStreaming: true, supportsImages: true },
|
|
128368
|
+
{ id: "gemini-2.5-flash-lite", contextWindow: 1e6, maxOutputTokens: 65536, supportsTools: true, supportsStreaming: true, supportsImages: true }
|
|
128369
|
+
];
|
|
128370
|
+
|
|
128371
|
+
// ../plugin-provider-google/dist/index.js
|
|
128372
|
+
var GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/";
|
|
128373
|
+
var GEMINI_DEFAULT_MODEL = "gemini-2.5-flash";
|
|
128374
|
+
var googleProviderDef = defineProvider({
|
|
128375
|
+
name: "google",
|
|
128376
|
+
models: [...geminiModels],
|
|
128377
|
+
createClient: (config) => {
|
|
128378
|
+
const cfg = config;
|
|
128379
|
+
return new OpenAIProvider({
|
|
128380
|
+
...cfg,
|
|
128381
|
+
name: "google",
|
|
128382
|
+
baseURL: cfg.baseURL ?? GEMINI_BASE_URL,
|
|
128383
|
+
defaultModel: cfg.defaultModel ?? GEMINI_DEFAULT_MODEL,
|
|
128384
|
+
models: geminiModels
|
|
128385
|
+
});
|
|
128386
|
+
},
|
|
128387
|
+
validateKey: (key) => validateKey2(key, { baseURL: GEMINI_BASE_URL }),
|
|
128388
|
+
auth: {
|
|
128389
|
+
kind: "apiKey",
|
|
128390
|
+
hint: "Google AI Studio (Gemini) API key from https://aistudio.google.com/apikey"
|
|
128391
|
+
}
|
|
128392
|
+
});
|
|
128393
|
+
var googlePlugin = definePlugin({
|
|
128394
|
+
name: "@moxxy/plugin-provider-google",
|
|
128395
|
+
version: "0.0.0",
|
|
128396
|
+
providers: [googleProviderDef]
|
|
128397
|
+
});
|
|
128398
|
+
var DEFAULT_LOCAL_BASE_URL = "http://localhost:11434/v1";
|
|
128399
|
+
var LOCAL_DEFAULT_MODEL = "llama3.3";
|
|
128400
|
+
var LOCAL_PLACEHOLDER_KEY = "local";
|
|
128401
|
+
var localModels = [
|
|
128402
|
+
{ id: "llama3.3", contextWindow: 131072, supportsTools: true, supportsStreaming: true },
|
|
128403
|
+
{ id: "qwen3", contextWindow: 131072, supportsTools: true, supportsStreaming: true },
|
|
128404
|
+
{ id: "qwen2.5-coder", contextWindow: 131072, supportsTools: true, supportsStreaming: true },
|
|
128405
|
+
{ id: "deepseek-r1", contextWindow: 131072, supportsTools: true, supportsStreaming: true },
|
|
128406
|
+
{ id: "gpt-oss", contextWindow: 131072, supportsTools: true, supportsStreaming: true }
|
|
128407
|
+
];
|
|
128408
|
+
var localProviderDef = defineProvider({
|
|
128409
|
+
name: "local",
|
|
128410
|
+
models: [...localModels],
|
|
128411
|
+
createClient: (config) => {
|
|
128412
|
+
const cfg = config;
|
|
128413
|
+
return new OpenAIProvider({
|
|
128414
|
+
...cfg,
|
|
128415
|
+
name: "local",
|
|
128416
|
+
apiKey: cfg.apiKey ?? process.env.LOCAL_API_KEY ?? LOCAL_PLACEHOLDER_KEY,
|
|
128417
|
+
baseURL: cfg.baseURL ?? process.env.LOCAL_MODEL_BASE_URL ?? DEFAULT_LOCAL_BASE_URL,
|
|
128418
|
+
defaultModel: cfg.defaultModel ?? LOCAL_DEFAULT_MODEL,
|
|
128419
|
+
models: localModels
|
|
128420
|
+
});
|
|
128421
|
+
},
|
|
128422
|
+
// No validateKey: there is no key to validate, and probing a local server
|
|
128423
|
+
// that may be offline would surface confusing errors during setup.
|
|
128424
|
+
auth: {
|
|
128425
|
+
kind: "apiKey",
|
|
128426
|
+
envVar: "LOCAL_API_KEY",
|
|
128427
|
+
hint: "optional \u2014 local servers need no key; set LOCAL_MODEL_BASE_URL for a non-Ollama endpoint"
|
|
128428
|
+
}
|
|
128429
|
+
});
|
|
128430
|
+
var localPlugin = definePlugin({
|
|
128431
|
+
name: "@moxxy/plugin-provider-local",
|
|
128432
|
+
version: "0.0.0",
|
|
128433
|
+
providers: [localProviderDef]
|
|
128434
|
+
});
|
|
128211
128435
|
var WHISPER_PROVIDER_ID = "openai";
|
|
128212
128436
|
var DEFAULT_FILENAMES = {
|
|
128213
128437
|
"audio/ogg": "audio.ogg",
|
|
@@ -134757,7 +134981,7 @@ function isRunnerUp(socketPath = runnerSocketPath()) {
|
|
|
134757
134981
|
|
|
134758
134982
|
// ../runner/dist/server.js
|
|
134759
134983
|
init_dist();
|
|
134760
|
-
var RUNNER_PROTOCOL_VERSION =
|
|
134984
|
+
var RUNNER_PROTOCOL_VERSION = 7;
|
|
134761
134985
|
var MIN_COMPATIBLE_PROTOCOL_VERSION = 1;
|
|
134762
134986
|
var RunnerMethod = {
|
|
134763
134987
|
/** client->server: handshake; returns the initial info snapshot. */
|
|
@@ -134782,6 +135006,12 @@ var RunnerMethod = {
|
|
|
134782
135006
|
ModeSetActive: "mode.setActive",
|
|
134783
135007
|
/** client->server: switch the active provider (server resolves credentials). */
|
|
134784
135008
|
ProviderSetActive: "provider.setActive",
|
|
135009
|
+
/** client->server: enable/disable a provider (v7; persists to preferences). */
|
|
135010
|
+
ProviderSetEnabled: "provider.setEnabled",
|
|
135011
|
+
/** client->server: re-probe every provider's credentials → readyProviders (v7). */
|
|
135012
|
+
ProviderRefreshReady: "provider.refreshReady",
|
|
135013
|
+
/** client->server: patch a stored (runtime-registered) provider's config (v7). */
|
|
135014
|
+
ProviderConfigure: "provider.configure",
|
|
134785
135015
|
/** client->server: persist an allow-always permission rule. */
|
|
134786
135016
|
PermissionAddAllow: "permission.addAllow",
|
|
134787
135017
|
/** client->server: run a registered slash command on the runner. */
|
|
@@ -134877,6 +135107,19 @@ var providerSetActiveParamsSchema = z.object({
|
|
|
134877
135107
|
name: z.string(),
|
|
134878
135108
|
config: z.record(z.unknown()).optional()
|
|
134879
135109
|
});
|
|
135110
|
+
var providerSetEnabledParamsSchema = z.object({
|
|
135111
|
+
name: z.string().min(1),
|
|
135112
|
+
enabled: z.boolean()
|
|
135113
|
+
});
|
|
135114
|
+
var providerConfigureParamsSchema = z.object({
|
|
135115
|
+
name: z.string().min(1),
|
|
135116
|
+
patch: z.object({
|
|
135117
|
+
baseURL: z.string().url().optional(),
|
|
135118
|
+
defaultModel: z.string().min(1).optional(),
|
|
135119
|
+
envVar: z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),
|
|
135120
|
+
models: z.array(z.object({ id: z.string().min(1), contextWindow: z.number() }).passthrough()).min(1).optional()
|
|
135121
|
+
})
|
|
135122
|
+
});
|
|
134880
135123
|
var permissionAddAllowParamsSchema = z.object({
|
|
134881
135124
|
name: z.string(),
|
|
134882
135125
|
reason: z.string().optional()
|
|
@@ -134983,6 +135226,9 @@ var RunnerServer = class {
|
|
|
134983
135226
|
peer.handle(RunnerMethod.SetResolver, (raw) => this.handleSetResolver(client, raw));
|
|
134984
135227
|
peer.handle(RunnerMethod.ModeSetActive, (raw) => this.handleModeSetActive(raw));
|
|
134985
135228
|
peer.handle(RunnerMethod.ProviderSetActive, (raw) => this.handleProviderSetActive(raw));
|
|
135229
|
+
peer.handle(RunnerMethod.ProviderSetEnabled, (raw) => this.handleProviderSetEnabled(raw));
|
|
135230
|
+
peer.handle(RunnerMethod.ProviderRefreshReady, () => this.handleProviderRefreshReady());
|
|
135231
|
+
peer.handle(RunnerMethod.ProviderConfigure, (raw) => this.handleProviderConfigure(raw));
|
|
134986
135232
|
peer.handle(RunnerMethod.PermissionAddAllow, (raw) => this.handlePermissionAddAllow(raw));
|
|
134987
135233
|
peer.handle(RunnerMethod.CommandRun, (raw) => this.handleCommandRun(raw));
|
|
134988
135234
|
peer.handle(RunnerMethod.Transcribe, (raw) => this.handleTranscribe(raw));
|
|
@@ -135058,6 +135304,7 @@ var RunnerServer = class {
|
|
|
135058
135304
|
turnId,
|
|
135059
135305
|
...error2 ? { error: error2 } : {}
|
|
135060
135306
|
});
|
|
135307
|
+
this.broadcastInfo();
|
|
135061
135308
|
}
|
|
135062
135309
|
});
|
|
135063
135310
|
return { turnId };
|
|
@@ -135122,6 +135369,54 @@ var RunnerServer = class {
|
|
|
135122
135369
|
this.broadcastInfo();
|
|
135123
135370
|
return {};
|
|
135124
135371
|
}
|
|
135372
|
+
async handleProviderSetEnabled(raw) {
|
|
135373
|
+
const { name, enabled } = providerSetEnabledParamsSchema.parse(raw);
|
|
135374
|
+
if (!this.session.providers.list().some((p3) => p3.name === name)) {
|
|
135375
|
+
throw new Error(`Provider not registered: ${name}`);
|
|
135376
|
+
}
|
|
135377
|
+
this.session.providers.setEnabled(name, enabled);
|
|
135378
|
+
void (async () => {
|
|
135379
|
+
const prefs = await loadPreferences();
|
|
135380
|
+
const current = new Set(prefs.disabledProviders ?? []);
|
|
135381
|
+
if (enabled)
|
|
135382
|
+
current.delete(name);
|
|
135383
|
+
else
|
|
135384
|
+
current.add(name);
|
|
135385
|
+
await savePreferences({ disabledProviders: [...current] });
|
|
135386
|
+
})();
|
|
135387
|
+
this.broadcastInfo();
|
|
135388
|
+
return {};
|
|
135389
|
+
}
|
|
135390
|
+
async handleProviderRefreshReady() {
|
|
135391
|
+
const resolver2 = this.session.credentialResolver;
|
|
135392
|
+
if (resolver2) {
|
|
135393
|
+
const ready = /* @__PURE__ */ new Set();
|
|
135394
|
+
const active = this.session.providers.getActiveName();
|
|
135395
|
+
if (active)
|
|
135396
|
+
ready.add(active);
|
|
135397
|
+
for (const p3 of this.session.providers.list()) {
|
|
135398
|
+
if (ready.has(p3.name))
|
|
135399
|
+
continue;
|
|
135400
|
+
try {
|
|
135401
|
+
await resolver2(p3.name);
|
|
135402
|
+
ready.add(p3.name);
|
|
135403
|
+
} catch {
|
|
135404
|
+
}
|
|
135405
|
+
}
|
|
135406
|
+
this.session.readyProviders = ready;
|
|
135407
|
+
}
|
|
135408
|
+
this.broadcastInfo();
|
|
135409
|
+
return {};
|
|
135410
|
+
}
|
|
135411
|
+
async handleProviderConfigure(raw) {
|
|
135412
|
+
const { name, patch } = providerConfigureParamsSchema.parse(raw);
|
|
135413
|
+
const admin = this.session.providerAdmin;
|
|
135414
|
+
if (!admin)
|
|
135415
|
+
throw new Error("provider admin not supported on this runner");
|
|
135416
|
+
await admin.configure(name, patch);
|
|
135417
|
+
this.broadcastInfo();
|
|
135418
|
+
return {};
|
|
135419
|
+
}
|
|
135125
135420
|
async handlePermissionAddAllow(raw) {
|
|
135126
135421
|
const { name, reason } = permissionAddAllowParamsSchema.parse(raw);
|
|
135127
135422
|
await this.session.permissions.addAllow({ name, ...reason ? { reason } : {} });
|
|
@@ -135397,6 +135692,7 @@ var RemoteSession = class {
|
|
|
135397
135692
|
requirements;
|
|
135398
135693
|
permissions;
|
|
135399
135694
|
mcpAdmin;
|
|
135695
|
+
providerAdmin;
|
|
135400
135696
|
workflows;
|
|
135401
135697
|
/**
|
|
135402
135698
|
* Turns that completed before their `runTurn` stream was registered. A fast
|
|
@@ -135410,6 +135706,8 @@ var RemoteSession = class {
|
|
|
135410
135706
|
permissionResolver = null;
|
|
135411
135707
|
approvalResolver = null;
|
|
135412
135708
|
info = null;
|
|
135709
|
+
/** Subscribers to `info.changed` pushes (see {@link onInfoChanged}). */
|
|
135710
|
+
infoListeners = /* @__PURE__ */ new Set();
|
|
135413
135711
|
/**
|
|
135414
135712
|
* The protocol version the SERVER reported at attach. Defaults to our own
|
|
135415
135713
|
* version until the handshake resolves. Version-specific client methods (the
|
|
@@ -135435,6 +135733,12 @@ var RemoteSession = class {
|
|
|
135435
135733
|
});
|
|
135436
135734
|
this.peer.on(RunnerNotification.InfoChanged, (params) => {
|
|
135437
135735
|
this.info = params.info;
|
|
135736
|
+
for (const fn of this.infoListeners) {
|
|
135737
|
+
try {
|
|
135738
|
+
fn(this.info);
|
|
135739
|
+
} catch {
|
|
135740
|
+
}
|
|
135741
|
+
}
|
|
135438
135742
|
});
|
|
135439
135743
|
this.peer.on(RunnerNotification.ReplayStart, (params) => {
|
|
135440
135744
|
const { fromSeq } = params;
|
|
@@ -135472,6 +135776,7 @@ var RemoteSession = class {
|
|
|
135472
135776
|
this.requirements = { check: () => ({ ready: false, issues: [] }) };
|
|
135473
135777
|
this.permissions = this.makePermissionsView();
|
|
135474
135778
|
this.mcpAdmin = this.makeMcpAdminView();
|
|
135779
|
+
this.providerAdmin = this.makeProviderAdminView();
|
|
135475
135780
|
this.workflows = this.makeWorkflowsView();
|
|
135476
135781
|
}
|
|
135477
135782
|
/**
|
|
@@ -135537,6 +135842,16 @@ var RemoteSession = class {
|
|
|
135537
135842
|
getInfo() {
|
|
135538
135843
|
return this.requireInfo();
|
|
135539
135844
|
}
|
|
135845
|
+
/**
|
|
135846
|
+
* Subscribe to runner `info.changed` pushes (registry snapshot changes —
|
|
135847
|
+
* provider/mode/MCP/workflow mutations, including ones made by tools inside
|
|
135848
|
+
* a turn). Fires after the local `getInfo()` mirror has been updated, so a
|
|
135849
|
+
* listener can re-read it synchronously. Returns an unsubscribe fn.
|
|
135850
|
+
*/
|
|
135851
|
+
onInfoChanged(fn) {
|
|
135852
|
+
this.infoListeners.add(fn);
|
|
135853
|
+
return () => this.infoListeners.delete(fn);
|
|
135854
|
+
}
|
|
135540
135855
|
async *runTurn(prompt, opts = {}) {
|
|
135541
135856
|
const result = await this.peer.request(RunnerMethod.RunTurn, {
|
|
135542
135857
|
prompt,
|
|
@@ -135740,6 +136055,27 @@ var RemoteSession = class {
|
|
|
135740
136055
|
detach: (name) => this.peer.request(RunnerMethod.McpDetach, { name })
|
|
135741
136056
|
};
|
|
135742
136057
|
}
|
|
136058
|
+
// Provider management (protocol v7): backs the desktop's interactive
|
|
136059
|
+
// Settings → Providers tab. Gated on the SERVER's reported version so a v7
|
|
136060
|
+
// client attached to an older runner (a desktop whose JS hot-update outran
|
|
136061
|
+
// its bundled CLI) gets a clear "update the CLI" error instead of a raw
|
|
136062
|
+
// method-not-found.
|
|
136063
|
+
makeProviderAdminView() {
|
|
136064
|
+
return {
|
|
136065
|
+
setEnabled: async (name, enabled) => {
|
|
136066
|
+
this.requireServerProtocol(7, "Enabling/disabling a provider");
|
|
136067
|
+
await this.peer.request(RunnerMethod.ProviderSetEnabled, { name, enabled });
|
|
136068
|
+
},
|
|
136069
|
+
refreshReady: async () => {
|
|
136070
|
+
this.requireServerProtocol(7, "Re-probing provider credentials");
|
|
136071
|
+
await this.peer.request(RunnerMethod.ProviderRefreshReady, {});
|
|
136072
|
+
},
|
|
136073
|
+
configure: async (name, patch) => {
|
|
136074
|
+
this.requireServerProtocol(7, "Configuring a provider");
|
|
136075
|
+
await this.peer.request(RunnerMethod.ProviderConfigure, { name, patch });
|
|
136076
|
+
}
|
|
136077
|
+
};
|
|
136078
|
+
}
|
|
135743
136079
|
makeWorkflowsView() {
|
|
135744
136080
|
return {
|
|
135745
136081
|
list: () => this.peer.request(RunnerMethod.WorkflowList),
|
|
@@ -136058,6 +136394,7 @@ var ipcInputSchemas = {
|
|
|
136058
136394
|
"app.updateInfo": z.undefined(),
|
|
136059
136395
|
"app.checkUpdate": z.undefined(),
|
|
136060
136396
|
"app.updateDashboard": z.undefined(),
|
|
136397
|
+
"app.updateShell": z.undefined(),
|
|
136061
136398
|
"app.relaunch": z.undefined(),
|
|
136062
136399
|
"app.appBooted": z.undefined(),
|
|
136063
136400
|
"app.updateDiagnostics": z.undefined(),
|
|
@@ -138037,6 +138374,51 @@ var testProviderInput = z$1.object({
|
|
|
138037
138374
|
baseURL: z$1.string().url().describe("Vendor API base URL to probe, e.g. https://api.deepseek.com."),
|
|
138038
138375
|
keyName: z$1.string().regex(/^[A-Z][A-Z0-9_]*$/).describe("NAME of the vault secret holding the API key (e.g. DEEPSEEK_API_KEY). The key is resolved from the vault inside the tool \u2014 never ask the user for the plaintext key and never pass one as a tool argument. Have them store it first: /vault set <NAME> <key>.")
|
|
138039
138376
|
});
|
|
138377
|
+
function buildProviderAdminPluginWithApi(opts) {
|
|
138378
|
+
const { providerRegistry, configPath } = opts;
|
|
138379
|
+
const api = {
|
|
138380
|
+
configure: async (name, patch) => {
|
|
138381
|
+
const cfg = await readProvidersConfig(configPath);
|
|
138382
|
+
const entry = cfg.providers.find((p3) => p3.name === name);
|
|
138383
|
+
if (!entry) {
|
|
138384
|
+
throw new MoxxyError({
|
|
138385
|
+
code: "CONFIG_INVALID",
|
|
138386
|
+
message: `provider-admin: no stored provider named "${name}" \u2014 only runtime-registered (providers.json) providers are configurable; built-ins are code.`
|
|
138387
|
+
});
|
|
138388
|
+
}
|
|
138389
|
+
const next = {
|
|
138390
|
+
...entry,
|
|
138391
|
+
...patch.baseURL ? { baseURL: patch.baseURL } : {},
|
|
138392
|
+
...patch.defaultModel ? { defaultModel: patch.defaultModel } : {},
|
|
138393
|
+
...patch.envVar ? { envVar: patch.envVar } : {},
|
|
138394
|
+
...patch.models && patch.models.length > 0 ? { models: patch.models } : {}
|
|
138395
|
+
};
|
|
138396
|
+
if (!next.models.some((m3) => m3.id === next.defaultModel)) {
|
|
138397
|
+
throw new MoxxyError({
|
|
138398
|
+
code: "CONFIG_INVALID",
|
|
138399
|
+
message: `provider-admin: defaultModel "${next.defaultModel}" is not in the models list (${next.models.map((m3) => m3.id).join(", ")}).`
|
|
138400
|
+
});
|
|
138401
|
+
}
|
|
138402
|
+
const def = buildProviderDef(next);
|
|
138403
|
+
const hadDef = providerRegistry.list().some((p3) => p3.name === name);
|
|
138404
|
+
if (hadDef)
|
|
138405
|
+
providerRegistry.replace(def);
|
|
138406
|
+
else
|
|
138407
|
+
providerRegistry.register(def);
|
|
138408
|
+
try {
|
|
138409
|
+
await upsertStoredProvider(next, configPath);
|
|
138410
|
+
} catch (err) {
|
|
138411
|
+
const prev = buildProviderDef(entry);
|
|
138412
|
+
if (hadDef)
|
|
138413
|
+
providerRegistry.replace(prev);
|
|
138414
|
+
else
|
|
138415
|
+
providerRegistry.unregister(name);
|
|
138416
|
+
throw err;
|
|
138417
|
+
}
|
|
138418
|
+
}
|
|
138419
|
+
};
|
|
138420
|
+
return { plugin: buildProviderAdminPlugin(opts), api };
|
|
138421
|
+
}
|
|
138040
138422
|
function buildProviderAdminPlugin(opts) {
|
|
138041
138423
|
const { providerRegistry, configPath } = opts;
|
|
138042
138424
|
return definePlugin({
|
|
@@ -144027,20 +144409,25 @@ function formatCatalog(entries, emptyLabel) {
|
|
|
144027
144409
|
}
|
|
144028
144410
|
async function draftWorkflow(provider, model, intent, signal, opts = {}) {
|
|
144029
144411
|
let accumulated = "";
|
|
144412
|
+
let truncated = false;
|
|
144413
|
+
const ceiling = provider.models.find((m3) => m3.id === model)?.maxOutputTokens;
|
|
144414
|
+
const budget = Math.min(opts.maxTokens ?? DEFAULT_MAX_TOKENS, ceiling ?? Number.POSITIVE_INFINITY);
|
|
144030
144415
|
for await (const event of provider.stream({
|
|
144031
144416
|
model,
|
|
144032
144417
|
system: buildSystemPrompt(opts),
|
|
144033
144418
|
messages: [{ role: "user", content: [{ type: "text", text: `Build a workflow for: ${intent}` }] }],
|
|
144034
|
-
maxTokens:
|
|
144419
|
+
maxTokens: budget,
|
|
144035
144420
|
signal
|
|
144036
144421
|
})) {
|
|
144037
144422
|
if (event.type === "text_delta")
|
|
144038
144423
|
accumulated += event.delta;
|
|
144424
|
+
if (event.type === "message_end")
|
|
144425
|
+
truncated = event.stopReason === "max_tokens";
|
|
144039
144426
|
if (event.type === "error")
|
|
144040
144427
|
throw new Error(`workflow_create: provider error: ${event.message}`);
|
|
144041
144428
|
}
|
|
144042
144429
|
const raw = extractYamlBlock(accumulated);
|
|
144043
|
-
return { raw, parse: parseWorkflowYaml(raw) };
|
|
144430
|
+
return { raw, parse: parseWorkflowYaml(raw), truncated };
|
|
144044
144431
|
}
|
|
144045
144432
|
function extractYamlBlock(s2) {
|
|
144046
144433
|
const fence = /```(?:ya?ml)?\n([\s\S]*?)```/.exec(s2);
|
|
@@ -144119,7 +144506,7 @@ function createTool(deps) {
|
|
|
144119
144506
|
if (!drafted.parse.ok || !drafted.parse.workflow) {
|
|
144120
144507
|
throw new MoxxyError({
|
|
144121
144508
|
code: "TOOL_ERROR",
|
|
144122
|
-
message: `workflow_create: the model did not produce a valid workflow (${drafted.parse.errors.join("; ")}). Try a more specific intent.`
|
|
144509
|
+
message: drafted.truncated ? "workflow_create: the draft hit the output-token limit before the YAML was complete. Try a simpler intent, or split the workflow into smaller ones." : `workflow_create: the model did not produce a valid workflow (${drafted.parse.errors.join("; ")}). Try a more specific intent.`
|
|
144123
144510
|
});
|
|
144124
144511
|
}
|
|
144125
144512
|
const created = await deps.store.create(drafted.parse.workflow, scope);
|
|
@@ -145076,6 +145463,14 @@ function buildBuiltinsCore(args) {
|
|
|
145076
145463
|
{ name: "@moxxy/plugin-provider-openai", plugin: openaiPlugin },
|
|
145077
145464
|
{ name: "@moxxy/plugin-provider-openai-codex", plugin: openaiCodexPlugin },
|
|
145078
145465
|
{ name: "@moxxy/plugin-provider-claude-code", plugin: claudeCodePlugin },
|
|
145466
|
+
// OpenAI-compatible vendors (z.ai api-key mode, xAI, Google Gemini, local
|
|
145467
|
+
// servers) + z.ai's GLM Coding Plan (Anthropic-compatible). Each reuses the
|
|
145468
|
+
// shared OpenAIProvider/AnthropicProvider with its own slug + base URL +
|
|
145469
|
+
// model catalog; see the respective plugin packages.
|
|
145470
|
+
{ name: "@moxxy/plugin-provider-zai", plugin: zaiPlugin },
|
|
145471
|
+
{ name: "@moxxy/plugin-provider-xai", plugin: xaiPlugin },
|
|
145472
|
+
{ name: "@moxxy/plugin-provider-google", plugin: googlePlugin },
|
|
145473
|
+
{ name: "@moxxy/plugin-provider-local", plugin: localPlugin },
|
|
145079
145474
|
{ name: "@moxxy/tools-builtin", plugin: builtinToolsPlugin },
|
|
145080
145475
|
{ name: "@moxxy/mode-default", plugin: defaultModePlugin },
|
|
145081
145476
|
{ name: "@moxxy/mode-goal", plugin: goalModePlugin },
|
|
@@ -145292,10 +145687,11 @@ function buildBuiltinsCore(args) {
|
|
|
145292
145687
|
// ~/.moxxy/providers.json; the plugin's onInit re-registers them on
|
|
145293
145688
|
// every boot. Pairs with the `add-provider` skill which walks the
|
|
145294
145689
|
// model through gathering baseURL + models + key.
|
|
145295
|
-
{
|
|
145296
|
-
|
|
145297
|
-
|
|
145298
|
-
|
|
145690
|
+
(() => {
|
|
145691
|
+
const { plugin: plugin4, api } = buildProviderAdminPluginWithApi({ providerRegistry: session.providers });
|
|
145692
|
+
session.providerAdmin = api;
|
|
145693
|
+
return { name: "@moxxy/plugin-provider-admin", plugin: plugin4 };
|
|
145694
|
+
})(),
|
|
145299
145695
|
// Admin tools (mcp_add_server, mcp_list_servers, mcp_remove_server,
|
|
145300
145696
|
// mcp_test_server) plus the boot-time lazy attach. Passing the
|
|
145301
145697
|
// session's live tool registry enables both hot-attach for runtime
|
|
@@ -145722,6 +146118,13 @@ async function defaultPrompt2(label3) {
|
|
|
145722
146118
|
async function resolveProviderCredentials(providerName2, vault, opts = {}) {
|
|
145723
146119
|
if (providerName2 === "openai-codex") return resolveOAuthCodex(vault, opts);
|
|
145724
146120
|
if (providerName2 === CLAUDE_CODE_PROVIDER_ID) return resolveClaudeCode(vault);
|
|
146121
|
+
if (providerName2 === "local") {
|
|
146122
|
+
return {
|
|
146123
|
+
...opts.providerConfig ?? {},
|
|
146124
|
+
apiKey: process.env.LOCAL_API_KEY ?? "local",
|
|
146125
|
+
...process.env.LOCAL_MODEL_BASE_URL ? { baseURL: process.env.LOCAL_MODEL_BASE_URL } : {}
|
|
146126
|
+
};
|
|
146127
|
+
}
|
|
145725
146128
|
const storedKeyName = await storedProviderApiKeyName(providerName2).catch(() => null);
|
|
145726
146129
|
const { providerConfig } = await resolveProviderApiKey(providerName2, vault, {
|
|
145727
146130
|
...opts,
|
|
@@ -145794,6 +146197,10 @@ async function activateProvider(args) {
|
|
|
145794
146197
|
} else {
|
|
145795
146198
|
for (let i2 = 0; i2 < candidates.length; i2++) {
|
|
145796
146199
|
const candidate = candidates[i2];
|
|
146200
|
+
if (!session.providers.isEnabled(candidate)) {
|
|
146201
|
+
logger.warn("skipping disabled provider", { provider: candidate });
|
|
146202
|
+
continue;
|
|
146203
|
+
}
|
|
145797
146204
|
const interactive = i2 === 0 && !skipKeyPrompt && process.stdin.isTTY === true;
|
|
145798
146205
|
try {
|
|
145799
146206
|
const resolved = await resolveProviderCredentials(candidate, vault, {
|
|
@@ -146002,6 +146409,13 @@ async function setupSessionWithConfig(opts) {
|
|
|
146002
146409
|
});
|
|
146003
146410
|
await selectEmbedder(session, rawConfig.embeddings, logger);
|
|
146004
146411
|
for (const iso2 of session.isolators.list()) security.registry.register(iso2);
|
|
146412
|
+
try {
|
|
146413
|
+
const bootPrefs = await loadPreferences();
|
|
146414
|
+
for (const name of bootPrefs.disabledProviders ?? []) {
|
|
146415
|
+
session.providers.setEnabled(name, false);
|
|
146416
|
+
}
|
|
146417
|
+
} catch {
|
|
146418
|
+
}
|
|
146005
146419
|
const { credentialResolver } = await activateProvider({
|
|
146006
146420
|
session,
|
|
146007
146421
|
config,
|