openbot 0.2.6 → 0.2.7
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.js +1 -1
- package/dist/registry/plugin-loader.js +4 -4
- package/dist/server.js +13 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ checkNodeVersion();
|
|
|
26
26
|
program
|
|
27
27
|
.name("openbot")
|
|
28
28
|
.description("OpenBot CLI - Secure and easy configuration")
|
|
29
|
-
.version("0.2.
|
|
29
|
+
.version("0.2.7");
|
|
30
30
|
async function installPlugin(source, id, quiet = false) {
|
|
31
31
|
try {
|
|
32
32
|
const parsed = parsePluginInstallSource(source);
|
|
@@ -145,7 +145,7 @@ async function loadToolPluginsFromDir(dir) {
|
|
|
145
145
|
if (!indexPath)
|
|
146
146
|
continue;
|
|
147
147
|
try {
|
|
148
|
-
const module = await import(pathToFileURL(indexPath).href);
|
|
148
|
+
const module = await import(pathToFileURL(indexPath).href + `?update=${Date.now()}`);
|
|
149
149
|
const entryData = module.plugin || module.default || module.entry;
|
|
150
150
|
if (entryData && typeof entryData.factory === "function") {
|
|
151
151
|
plugins.push({
|
|
@@ -219,7 +219,7 @@ export async function discoverPlugins(dir, registry, defaultModel, options) {
|
|
|
219
219
|
if (!indexPath)
|
|
220
220
|
continue;
|
|
221
221
|
try {
|
|
222
|
-
const module = await import(pathToFileURL(indexPath).href);
|
|
222
|
+
const module = await import(pathToFileURL(indexPath).href + `?update=${Date.now()}`);
|
|
223
223
|
const codeAgentDef = module.agent;
|
|
224
224
|
const entryData = module.plugin || module.default || module.entry;
|
|
225
225
|
if (codeAgentDef && typeof codeAgentDef.factory === "function") {
|
|
@@ -277,7 +277,7 @@ export async function discoverPlugins(dir, registry, defaultModel, options) {
|
|
|
277
277
|
const indexPath = await findIndexFile(agentDir);
|
|
278
278
|
if (!indexPath)
|
|
279
279
|
continue;
|
|
280
|
-
const module = await import(pathToFileURL(indexPath).href);
|
|
280
|
+
const module = await import(pathToFileURL(indexPath).href + `?update=${Date.now()}`);
|
|
281
281
|
const definition = module.agent || module.plugin || module.default || module.entry;
|
|
282
282
|
if (definition && typeof definition.factory === "function") {
|
|
283
283
|
const config = await readAgentConfig(agentDir);
|
|
@@ -387,7 +387,7 @@ export async function listPlugins(dir) {
|
|
|
387
387
|
continue;
|
|
388
388
|
}
|
|
389
389
|
try {
|
|
390
|
-
const module = await import(pathToFileURL(indexPath).href);
|
|
390
|
+
const module = await import(pathToFileURL(indexPath).href + `?update=${Date.now()}`);
|
|
391
391
|
const codeAgentDef = module.agent;
|
|
392
392
|
const toolEntry = module.plugin || module.default || module.entry;
|
|
393
393
|
if (codeAgentDef && typeof codeAgentDef.factory === "function") {
|
package/dist/server.js
CHANGED
|
@@ -22,6 +22,8 @@ import { getMarketplaceRegistry, installMarketplaceAgent, installMarketplacePlug
|
|
|
22
22
|
import { getVersionStatus } from "./version.js";
|
|
23
23
|
export async function startServer(options = {}) {
|
|
24
24
|
const config = loadConfig();
|
|
25
|
+
const baseDir = config.baseDir || DEFAULT_BASE_DIR;
|
|
26
|
+
const resolvedBaseDir = resolvePath(baseDir);
|
|
25
27
|
const PORT = Number(options.port ?? config.port ?? process.env.PORT ?? 4001);
|
|
26
28
|
const app = express();
|
|
27
29
|
const createRuntime = () => createOpenBot({
|
|
@@ -62,12 +64,16 @@ export async function startServer(options = {}) {
|
|
|
62
64
|
void reloadRuntime();
|
|
63
65
|
}, 800);
|
|
64
66
|
};
|
|
65
|
-
const openBotDir =
|
|
67
|
+
const openBotDir = resolvedBaseDir;
|
|
68
|
+
const agentsDir = path.join(openBotDir, "agents");
|
|
69
|
+
const pluginsDir = path.join(openBotDir, "plugins");
|
|
70
|
+
await fs.mkdir(agentsDir, { recursive: true });
|
|
71
|
+
await fs.mkdir(pluginsDir, { recursive: true });
|
|
66
72
|
const watcher = chokidar.watch([
|
|
67
73
|
path.join(openBotDir, "config.json"),
|
|
68
74
|
path.join(openBotDir, "AGENT.md"),
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
agentsDir,
|
|
76
|
+
pluginsDir,
|
|
71
77
|
], {
|
|
72
78
|
ignoreInitial: true,
|
|
73
79
|
awaitWriteFinish: {
|
|
@@ -413,6 +419,7 @@ export async function startServer(options = {}) {
|
|
|
413
419
|
updates.anthropicApiKey = anthropic_api_key.trim();
|
|
414
420
|
if (Object.keys(updates).length > 0) {
|
|
415
421
|
saveConfig(updates);
|
|
422
|
+
scheduleReload();
|
|
416
423
|
}
|
|
417
424
|
res.json({ success: true });
|
|
418
425
|
});
|
|
@@ -524,6 +531,7 @@ export async function startServer(options = {}) {
|
|
|
524
531
|
}
|
|
525
532
|
try {
|
|
526
533
|
const result = await installMarketplaceAgent(id.trim());
|
|
534
|
+
scheduleReload();
|
|
527
535
|
res.json({ success: true, installedName: result.installedName, item: result.agent });
|
|
528
536
|
}
|
|
529
537
|
catch (error) {
|
|
@@ -538,6 +546,7 @@ export async function startServer(options = {}) {
|
|
|
538
546
|
}
|
|
539
547
|
try {
|
|
540
548
|
const result = await installMarketplacePlugin(id.trim());
|
|
549
|
+
scheduleReload();
|
|
541
550
|
res.json({ success: true, installedName: result.installedName, item: result.plugin });
|
|
542
551
|
}
|
|
543
552
|
catch (error) {
|
|
@@ -605,6 +614,7 @@ export async function startServer(options = {}) {
|
|
|
605
614
|
}
|
|
606
615
|
const consolidated = matter.stringify(md, frontmatter);
|
|
607
616
|
await fs.writeFile(mdPath, consolidated, "utf-8");
|
|
617
|
+
scheduleReload();
|
|
608
618
|
res.json({ success: true });
|
|
609
619
|
}
|
|
610
620
|
catch (err) {
|