@sulala/agent-os 0.1.6 → 0.1.8

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 CHANGED
@@ -48,6 +48,7 @@ __export(exports_config, {
48
48
  ensureWorkspace: () => ensureWorkspace
49
49
  });
50
50
  import { readFile, writeFile, mkdir } from "fs/promises";
51
+ import { existsSync } from "fs";
51
52
  import { join, resolve, relative } from "path";
52
53
  function getAgentOsHome() {
53
54
  return process.env.AGENT_OS_HOME || DEFAULT_HOME;
@@ -195,7 +196,15 @@ function getSkillsDir() {
195
196
  return process.env.AGENT_OS_SKILLS_DIR || join(getAgentOsHome(), "skills");
196
197
  }
197
198
  function getSeedSkillsDir() {
198
- return process.env.AGENT_OS_SEED_SKILLS_DIR ?? join(process.cwd(), "data", "skills");
199
+ if (process.env.AGENT_OS_SEED_SKILLS_DIR)
200
+ return process.env.AGENT_OS_SEED_SKILLS_DIR;
201
+ const fromDist = join(import.meta.dir, "..", "data", "skills");
202
+ const fromSrc = join(import.meta.dir, "..", "..", "data", "skills");
203
+ if (existsSync(fromDist))
204
+ return fromDist;
205
+ if (existsSync(fromSrc))
206
+ return fromSrc;
207
+ return join(process.cwd(), "data", "skills");
199
208
  }
200
209
  function getWorkspaceDir(agentId) {
201
210
  const safe = agentId.replace(/[^a-z0-9_.-]/gi, "_");
@@ -559,7 +568,7 @@ var init_agent = __esm(() => {
559
568
 
560
569
  // src/core/agent-registry.ts
561
570
  import { readdir, readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, unlink } from "fs/promises";
562
- import { existsSync } from "fs";
571
+ import { existsSync as existsSync2 } from "fs";
563
572
  import { join as join2 } from "path";
564
573
  function setAgentStore(store) {
565
574
  agentStore = store;
@@ -572,9 +581,9 @@ function getSeedAgentsDir() {
572
581
  return process.env.AGENT_OS_SEED_AGENTS_DIR;
573
582
  const fromDist = join2(import.meta.dir, "..", "data", "agents");
574
583
  const fromSrc = join2(import.meta.dir, "..", "..", "data", "agents");
575
- if (existsSync(fromDist))
584
+ if (existsSync2(fromDist))
576
585
  return fromDist;
577
- if (existsSync(fromSrc))
586
+ if (existsSync2(fromSrc))
578
587
  return fromSrc;
579
588
  return join2(process.cwd(), "data", "agents");
580
589
  }
@@ -15571,7 +15580,7 @@ __export(exports_server, {
15571
15580
  startServer: () => startServer
15572
15581
  });
15573
15582
  import { join as join13, dirname, resolve as resolve4 } from "path";
15574
- import { mkdirSync, existsSync as existsSync2 } from "fs";
15583
+ import { mkdirSync, existsSync as existsSync3 } from "fs";
15575
15584
  function broadcastEvent(event) {
15576
15585
  const msg = JSON.stringify(event);
15577
15586
  for (const ws of wsClients) {
@@ -15581,7 +15590,7 @@ function broadcastEvent(event) {
15581
15590
  }
15582
15591
  }
15583
15592
  function serveDashboard(pathname) {
15584
- if (!existsSync2(DASHBOARD_DIST) || !existsSync2(join13(DASHBOARD_DIST, "index.html"))) {
15593
+ if (!existsSync3(DASHBOARD_DIST) || !existsSync3(join13(DASHBOARD_DIST, "index.html"))) {
15585
15594
  return null;
15586
15595
  }
15587
15596
  const decoded = decodeURIComponent(pathname);
@@ -15590,7 +15599,7 @@ function serveDashboard(pathname) {
15590
15599
  }
15591
15600
  const subpath = decoded === "/" ? "index.html" : decoded.slice(1);
15592
15601
  const filePath = join13(DASHBOARD_DIST, subpath);
15593
- if (existsSync2(filePath)) {
15602
+ if (existsSync3(filePath)) {
15594
15603
  const file = Bun.file(filePath);
15595
15604
  const ext = subpath.split(".").pop() ?? "";
15596
15605
  const mime = {
@@ -15611,7 +15620,7 @@ function serveDashboard(pathname) {
15611
15620
  });
15612
15621
  }
15613
15622
  const indexPath = join13(DASHBOARD_DIST, "index.html");
15614
- if (existsSync2(indexPath)) {
15623
+ if (existsSync3(indexPath)) {
15615
15624
  return new Response(Bun.file(indexPath), {
15616
15625
  headers: { "Content-Type": "text/html" }
15617
15626
  });
@@ -16073,7 +16082,7 @@ init_agent_registry();
16073
16082
  init_runtime();
16074
16083
  import { join as join14, dirname as dirname2 } from "path";
16075
16084
  import { readFile as readFile10, writeFile as writeFile6, mkdir as mkdir7, unlink as unlink2 } from "fs/promises";
16076
- import { existsSync as existsSync3, readFileSync } from "fs";
16085
+ import { existsSync as existsSync4, readFileSync } from "fs";
16077
16086
  var PID_FILE = join14(getAgentOsHome(), "sulala.pid");
16078
16087
  var DEFAULT_PORT = 3010;
16079
16088
  function openDashboard() {
@@ -16133,7 +16142,7 @@ async function cmdStart(args) {
16133
16142
  await mkdir7(getAgentOsHome(), { recursive: true });
16134
16143
  const projectRoot = join14(import.meta.dir, "..");
16135
16144
  const distEntry = join14(projectRoot, "dist", "index.js");
16136
- const serverEntry = existsSync3(distEntry) ? "dist/index.js" : "src/index.ts";
16145
+ const serverEntry = existsSync4(distEntry) ? "dist/index.js" : "src/index.ts";
16137
16146
  const child = Bun.spawn(["bun", "run", serverEntry], {
16138
16147
  cwd: projectRoot,
16139
16148
  stdout: "ignore",
@@ -16150,7 +16159,7 @@ async function cmdStart(args) {
16150
16159
  await startServer2();
16151
16160
  }
16152
16161
  async function cmdStop() {
16153
- if (!existsSync3(PID_FILE)) {
16162
+ if (!existsSync4(PID_FILE)) {
16154
16163
  console.error("No PID file found. Is the server running with 'sulala start --daemon'?");
16155
16164
  process.exit(1);
16156
16165
  }
@@ -16178,7 +16187,7 @@ function getMemoryDbPath() {
16178
16187
  return process.env.AGENT_MEMORY_DB_PATH ?? join14(getAgentOsHome(), "database.db");
16179
16188
  }
16180
16189
  async function startServerDaemonIfNeeded() {
16181
- if (existsSync3(PID_FILE)) {
16190
+ if (existsSync4(PID_FILE)) {
16182
16191
  try {
16183
16192
  const pidStr = await readFile10(PID_FILE, "utf-8");
16184
16193
  const pid = parseInt(pidStr.trim(), 10);
@@ -16191,7 +16200,7 @@ async function startServerDaemonIfNeeded() {
16191
16200
  await mkdir7(getAgentOsHome(), { recursive: true });
16192
16201
  const projectRoot = join14(import.meta.dir, "..");
16193
16202
  const distEntry = join14(projectRoot, "dist", "index.js");
16194
- const serverEntry = existsSync3(distEntry) ? "dist/index.js" : "src/index.ts";
16203
+ const serverEntry = existsSync4(distEntry) ? "dist/index.js" : "src/index.ts";
16195
16204
  const child = Bun.spawn(["bun", "run", serverEntry], {
16196
16205
  cwd: projectRoot,
16197
16206
  stdout: "ignore",
@@ -16208,7 +16217,7 @@ async function cmdOnboard() {
16208
16217
  await mkdir7(home, { recursive: true });
16209
16218
  await mkdir7(dirname2(getMemoryDbPath()), { recursive: true });
16210
16219
  const configPath = join14(home, "config.json");
16211
- if (!existsSync3(configPath)) {
16220
+ if (!existsSync4(configPath)) {
16212
16221
  await writeFile6(configPath, JSON.stringify({
16213
16222
  provider: null,
16214
16223
  api_key: null,
@@ -16235,8 +16244,7 @@ async function cmdOnboard() {
16235
16244
  setAgentStore(memoryStore2);
16236
16245
  await seedAgentsIfEmpty();
16237
16246
  const { installed: agentsInstalled } = await installSystemAgents();
16238
- const { installed: skillsInstalled } = await installSystemSkills();
16239
- console.log("Onboard complete. Agents:", agentsInstalled, "Skills:", skillsInstalled);
16247
+ console.log("Onboard complete. Agents:", agentsInstalled, "\u2014 Install default skills from the dashboard.");
16240
16248
  const started = await startServerDaemonIfNeeded();
16241
16249
  if (started) {
16242
16250
  console.log("Server starting in background. Use 'sulala stop' to stop.");
@@ -16263,7 +16271,7 @@ async function cmdUpdate() {
16263
16271
  console.warn("Could not update package from npm (run 'bun install -g @sulala/agent-os@latest' manually):", err.trim() || out.trim());
16264
16272
  }
16265
16273
  const dbPath = getMemoryDbPath();
16266
- if (!existsSync3(dbPath)) {
16274
+ if (!existsSync4(dbPath)) {
16267
16275
  console.log("No database found. Run 'sulala onboard' to set up agents and skills.");
16268
16276
  return;
16269
16277
  }
@@ -16282,7 +16290,7 @@ async function cmdRun(args) {
16282
16290
  process.exit(1);
16283
16291
  }
16284
16292
  const dbPath = getMemoryDbPath();
16285
- if (existsSync3(dbPath)) {
16293
+ if (existsSync4(dbPath)) {
16286
16294
  setAgentStore(new MemoryStore(dbPath));
16287
16295
  }
16288
16296
  const agent = await getAgent(agentId);
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ __export(exports_config, {
48
48
  ensureWorkspace: () => ensureWorkspace
49
49
  });
50
50
  import { readFile, writeFile, mkdir } from "fs/promises";
51
+ import { existsSync } from "fs";
51
52
  import { join, resolve, relative } from "path";
52
53
  function getAgentOsHome() {
53
54
  return process.env.AGENT_OS_HOME || DEFAULT_HOME;
@@ -195,7 +196,15 @@ function getSkillsDir() {
195
196
  return process.env.AGENT_OS_SKILLS_DIR || join(getAgentOsHome(), "skills");
196
197
  }
197
198
  function getSeedSkillsDir() {
198
- return process.env.AGENT_OS_SEED_SKILLS_DIR ?? join(process.cwd(), "data", "skills");
199
+ if (process.env.AGENT_OS_SEED_SKILLS_DIR)
200
+ return process.env.AGENT_OS_SEED_SKILLS_DIR;
201
+ const fromDist = join(import.meta.dir, "..", "data", "skills");
202
+ const fromSrc = join(import.meta.dir, "..", "..", "data", "skills");
203
+ if (existsSync(fromDist))
204
+ return fromDist;
205
+ if (existsSync(fromSrc))
206
+ return fromSrc;
207
+ return join(process.cwd(), "data", "skills");
199
208
  }
200
209
  function getWorkspaceDir(agentId) {
201
210
  const safe = agentId.replace(/[^a-z0-9_.-]/gi, "_");
@@ -11243,7 +11252,7 @@ async function handleMemoryDelete(idRaw, store) {
11243
11252
 
11244
11253
  // src/core/agent-registry.ts
11245
11254
  import { readdir, readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, unlink } from "fs/promises";
11246
- import { existsSync } from "fs";
11255
+ import { existsSync as existsSync2 } from "fs";
11247
11256
  import { join as join2 } from "path";
11248
11257
 
11249
11258
  // src/types/agent.ts
@@ -11331,9 +11340,9 @@ function getSeedAgentsDir() {
11331
11340
  return process.env.AGENT_OS_SEED_AGENTS_DIR;
11332
11341
  const fromDist = join2(import.meta.dir, "..", "data", "agents");
11333
11342
  const fromSrc = join2(import.meta.dir, "..", "..", "data", "agents");
11334
- if (existsSync(fromDist))
11343
+ if (existsSync2(fromDist))
11335
11344
  return fromDist;
11336
- if (existsSync(fromSrc))
11345
+ if (existsSync2(fromSrc))
11337
11346
  return fromSrc;
11338
11347
  return join2(process.cwd(), "data", "agents");
11339
11348
  }
@@ -15469,7 +15478,7 @@ async function loadPlugins() {
15469
15478
  // src/server.ts
15470
15479
  init_config();
15471
15480
  import { join as join13, dirname, resolve as resolve4 } from "path";
15472
- import { mkdirSync, existsSync as existsSync2 } from "fs";
15481
+ import { mkdirSync, existsSync as existsSync3 } from "fs";
15473
15482
  var PORT = parseInt(process.env.PORT ?? "3010", 10);
15474
15483
  var DASHBOARD_DIST = resolve4(join13(import.meta.dir, "..", "dashboard", "dist"));
15475
15484
  var HOST = process.env.HOST ?? "127.0.0.1";
@@ -15497,7 +15506,7 @@ function broadcastEvent(event) {
15497
15506
  }
15498
15507
  }
15499
15508
  function serveDashboard(pathname) {
15500
- if (!existsSync2(DASHBOARD_DIST) || !existsSync2(join13(DASHBOARD_DIST, "index.html"))) {
15509
+ if (!existsSync3(DASHBOARD_DIST) || !existsSync3(join13(DASHBOARD_DIST, "index.html"))) {
15501
15510
  return null;
15502
15511
  }
15503
15512
  const decoded = decodeURIComponent(pathname);
@@ -15506,7 +15515,7 @@ function serveDashboard(pathname) {
15506
15515
  }
15507
15516
  const subpath = decoded === "/" ? "index.html" : decoded.slice(1);
15508
15517
  const filePath = join13(DASHBOARD_DIST, subpath);
15509
- if (existsSync2(filePath)) {
15518
+ if (existsSync3(filePath)) {
15510
15519
  const file = Bun.file(filePath);
15511
15520
  const ext = subpath.split(".").pop() ?? "";
15512
15521
  const mime = {
@@ -15527,7 +15536,7 @@ function serveDashboard(pathname) {
15527
15536
  });
15528
15537
  }
15529
15538
  const indexPath = join13(DASHBOARD_DIST, "index.html");
15530
- if (existsSync2(indexPath)) {
15539
+ if (existsSync3(indexPath)) {
15531
15540
  return new Response(Bun.file(indexPath), {
15532
15541
  headers: { "Content-Type": "text/html" }
15533
15542
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sulala/agent-os",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },