@sulala/agent-os 0.1.1 → 0.1.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.
- package/dist/cli.js +51 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16101,7 +16101,7 @@ Commands:
|
|
|
16101
16101
|
start [--daemon] Start the server (default: foreground)
|
|
16102
16102
|
stop Stop the server (when started with --daemon)
|
|
16103
16103
|
onboard First-time setup: create config, seed agents & skills, open dashboard
|
|
16104
|
-
update Update
|
|
16104
|
+
update Update package from npm and system agents/skills
|
|
16105
16105
|
run <agent_id> <task> Run an agent with a one-off task
|
|
16106
16106
|
|
|
16107
16107
|
Examples:
|
|
@@ -16168,6 +16168,32 @@ async function cmdStop() {
|
|
|
16168
16168
|
function getMemoryDbPath() {
|
|
16169
16169
|
return process.env.AGENT_MEMORY_DB_PATH ?? join14(getAgentOsHome(), "database.db");
|
|
16170
16170
|
}
|
|
16171
|
+
async function startServerDaemonIfNeeded() {
|
|
16172
|
+
if (existsSync2(PID_FILE)) {
|
|
16173
|
+
try {
|
|
16174
|
+
const pidStr = await readFile10(PID_FILE, "utf-8");
|
|
16175
|
+
const pid = parseInt(pidStr.trim(), 10);
|
|
16176
|
+
if (!Number.isNaN(pid)) {
|
|
16177
|
+
process.kill(pid, 0);
|
|
16178
|
+
return false;
|
|
16179
|
+
}
|
|
16180
|
+
} catch {}
|
|
16181
|
+
}
|
|
16182
|
+
await mkdir7(getAgentOsHome(), { recursive: true });
|
|
16183
|
+
const projectRoot = join14(import.meta.dir, "..");
|
|
16184
|
+
const distEntry = join14(projectRoot, "dist", "index.js");
|
|
16185
|
+
const serverEntry = existsSync2(distEntry) ? "dist/index.js" : "src/index.ts";
|
|
16186
|
+
const child = Bun.spawn(["bun", "run", serverEntry], {
|
|
16187
|
+
cwd: projectRoot,
|
|
16188
|
+
stdout: "ignore",
|
|
16189
|
+
stderr: "ignore",
|
|
16190
|
+
stdin: "ignore",
|
|
16191
|
+
detached: true
|
|
16192
|
+
});
|
|
16193
|
+
child.unref();
|
|
16194
|
+
await writeFile6(PID_FILE, String(child.pid), "utf-8");
|
|
16195
|
+
return true;
|
|
16196
|
+
}
|
|
16171
16197
|
async function cmdOnboard() {
|
|
16172
16198
|
const home = getAgentOsHome();
|
|
16173
16199
|
await mkdir7(home, { recursive: true });
|
|
@@ -16202,13 +16228,35 @@ async function cmdOnboard() {
|
|
|
16202
16228
|
const { installed: agentsInstalled } = await installSystemAgents();
|
|
16203
16229
|
const { installed: skillsInstalled } = await installSystemSkills();
|
|
16204
16230
|
console.log("Onboard complete. Agents:", agentsInstalled, "Skills:", skillsInstalled);
|
|
16231
|
+
const started = await startServerDaemonIfNeeded();
|
|
16232
|
+
if (started) {
|
|
16233
|
+
console.log("Server starting in background. Use 'sulala stop' to stop.");
|
|
16234
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
16235
|
+
}
|
|
16205
16236
|
openDashboard();
|
|
16206
16237
|
}
|
|
16238
|
+
var NPM_PACKAGE = "@sulala/agent-os";
|
|
16207
16239
|
async function cmdUpdate() {
|
|
16240
|
+
console.log(`Checking npm for latest ${NPM_PACKAGE}...`);
|
|
16241
|
+
const proc = Bun.spawn(["bun", "install", "-g", `${NPM_PACKAGE}@latest`], {
|
|
16242
|
+
stdout: "pipe",
|
|
16243
|
+
stderr: "pipe",
|
|
16244
|
+
stdin: "ignore"
|
|
16245
|
+
});
|
|
16246
|
+
const exit = await proc.exited;
|
|
16247
|
+
const out = await new Response(proc.stdout).text();
|
|
16248
|
+
const err = await new Response(proc.stderr).text();
|
|
16249
|
+
if (exit === 0) {
|
|
16250
|
+
console.log("Package updated to latest from npm.");
|
|
16251
|
+
if (out.trim())
|
|
16252
|
+
console.log(out.trim());
|
|
16253
|
+
} else {
|
|
16254
|
+
console.warn("Could not update package from npm (run 'bun install -g @sulala/agent-os@latest' manually):", err.trim() || out.trim());
|
|
16255
|
+
}
|
|
16208
16256
|
const dbPath = getMemoryDbPath();
|
|
16209
16257
|
if (!existsSync2(dbPath)) {
|
|
16210
|
-
console.
|
|
16211
|
-
|
|
16258
|
+
console.log("No database found. Run 'sulala onboard' to set up agents and skills.");
|
|
16259
|
+
return;
|
|
16212
16260
|
}
|
|
16213
16261
|
const memoryStore2 = new MemoryStore(dbPath);
|
|
16214
16262
|
setAgentStore(memoryStore2);
|