nextclaw 0.2.9 → 0.3.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/cli/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
MessageBus,
|
|
34
34
|
AgentLoop,
|
|
35
35
|
LiteLLMProvider,
|
|
36
|
+
ProviderManager,
|
|
36
37
|
ChannelManager,
|
|
37
38
|
SessionManager,
|
|
38
39
|
CronService,
|
|
@@ -180,9 +181,10 @@ program.command("agent").description("Interact with the agent directly").option(
|
|
|
180
181
|
const config = loadConfig();
|
|
181
182
|
const bus = new MessageBus();
|
|
182
183
|
const provider = makeProvider(config);
|
|
184
|
+
const providerManager = new ProviderManager(provider);
|
|
183
185
|
const agentLoop = new AgentLoop({
|
|
184
186
|
bus,
|
|
185
|
-
|
|
187
|
+
providerManager,
|
|
186
188
|
workspace: getWorkspacePath(config.agents.defaults.workspace),
|
|
187
189
|
braveApiKey: config.tools.web.search.apiKey || void 0,
|
|
188
190
|
execConfig: config.tools.exec,
|
|
@@ -344,6 +346,7 @@ async function startGateway(options = {}) {
|
|
|
344
346
|
const config = loadConfig();
|
|
345
347
|
const bus = new MessageBus();
|
|
346
348
|
const provider = options.allowMissingProvider === true ? makeProvider(config, { allowMissing: true }) : makeProvider(config);
|
|
349
|
+
const providerManager = provider ? new ProviderManager(provider) : null;
|
|
347
350
|
const sessionManager = new SessionManager(getWorkspacePath(config.agents.defaults.workspace));
|
|
348
351
|
const cronStorePath = join(getDataDir(), "cron", "jobs.json");
|
|
349
352
|
const cron2 = new CronService(cronStorePath);
|
|
@@ -373,7 +376,7 @@ async function startGateway(options = {}) {
|
|
|
373
376
|
}
|
|
374
377
|
const agent = new AgentLoop({
|
|
375
378
|
bus,
|
|
376
|
-
provider,
|
|
379
|
+
providerManager: providerManager ?? new ProviderManager(provider),
|
|
377
380
|
workspace: getWorkspacePath(config.agents.defaults.workspace),
|
|
378
381
|
model: config.agents.defaults.model,
|
|
379
382
|
maxIterations: config.agents.defaults.maxToolIterations,
|
|
@@ -426,6 +429,29 @@ async function startGateway(options = {}) {
|
|
|
426
429
|
reloadTask = null;
|
|
427
430
|
}
|
|
428
431
|
};
|
|
432
|
+
let providerReloadTask = null;
|
|
433
|
+
const reloadProvider = async (nextConfig) => {
|
|
434
|
+
if (!providerManager) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (providerReloadTask) {
|
|
438
|
+
await providerReloadTask;
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
providerReloadTask = (async () => {
|
|
442
|
+
const nextProvider = makeProvider(nextConfig, { allowMissing: true });
|
|
443
|
+
if (!nextProvider) {
|
|
444
|
+
console.warn("Provider reload skipped: missing API key.");
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
providerManager.set(nextProvider);
|
|
448
|
+
})();
|
|
449
|
+
try {
|
|
450
|
+
await providerReloadTask;
|
|
451
|
+
} finally {
|
|
452
|
+
providerReloadTask = null;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
429
455
|
const applyReloadPlan = async (nextConfig) => {
|
|
430
456
|
const changedPaths = diffConfigPaths(currentConfig, nextConfig);
|
|
431
457
|
if (!changedPaths.length) {
|
|
@@ -436,6 +462,9 @@ async function startGateway(options = {}) {
|
|
|
436
462
|
if (plan.restartChannels) {
|
|
437
463
|
await reloadChannels(nextConfig);
|
|
438
464
|
}
|
|
465
|
+
if (plan.reloadProviders) {
|
|
466
|
+
await reloadProvider(nextConfig);
|
|
467
|
+
}
|
|
439
468
|
if (plan.restartRequired.length > 0) {
|
|
440
469
|
console.warn(`Config changes require restart: ${plan.restartRequired.join(", ")}`);
|
|
441
470
|
}
|
|
@@ -803,7 +832,8 @@ function makeProvider(config, options) {
|
|
|
803
832
|
apiBase: getApiBase(config),
|
|
804
833
|
defaultModel: model,
|
|
805
834
|
extraHeaders: provider?.extraHeaders ?? null,
|
|
806
|
-
providerName: getProviderName(config)
|
|
835
|
+
providerName: getProviderName(config),
|
|
836
|
+
wireApi: provider?.wireApi ?? null
|
|
807
837
|
});
|
|
808
838
|
}
|
|
809
839
|
function createWorkspaceTemplates(workspace) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"chokidar": "^3.6.0",
|
|
39
39
|
"commander": "^12.1.0",
|
|
40
|
-
"nextclaw-core": "^0.
|
|
41
|
-
"nextclaw-server": "^0.
|
|
40
|
+
"nextclaw-core": "^0.3.0",
|
|
41
|
+
"nextclaw-server": "^0.3.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.17.6",
|