alineo-cli 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # alineo
2
2
 
3
- CLI for [alineo](https://alineo.tech) — start a local OpenSandbox server, manage saved agent specs, and run/orchestrate `@alineo-labs/agent` sessions.
3
+ CLI for [alineo](https://alineo.tech) — start a local OpenSandbox server, manage saved agent specs, and run/orchestrate `alineo` sessions.
4
4
 
5
5
  ```bash
6
6
  bunx alineo-cli init
@@ -22,7 +22,7 @@ alineo init
22
22
 
23
23
  When using a server started this way, `useServerProxy: true` is written into `alineo.config.json` automatically — sandbox containers run on Docker's bridge network and aren't reachable directly from the host.
24
24
 
25
- OpenSandbox's own snapshot metadata (what makes `Agent.load()`'s cached-snapshot fast path possible) lives in a SQLite db bind-mounted from `~/.config/alineo/opensandbox-data` into the container — so it survives the container being stopped/started, _and_ being fully removed and recreated (a host reboot with no restart policy, `docker system prune`, a stray `docker rm`). It's only lost if that host directory itself is deleted, or you point a different machine/user at a fresh one. If a cached snapshot ever does fail to restore for some other reason, `Agent.load()` now logs the real error (`[agent] snapshot restore failed (<real error>), rebuilding...`) instead of an undiagnosable `snapshot stale, rebuilding...`.
25
+ OpenSandbox's own snapshot metadata (what makes `Alineo.load()`'s cached-snapshot fast path possible) lives in a SQLite db bind-mounted from `~/.config/alineo/opensandbox-data` into the container — so it survives the container being stopped/started, _and_ being fully removed and recreated (a host reboot with no restart policy, `docker system prune`, a stray `docker rm`). It's only lost if that host directory itself is deleted, or you point a different machine/user at a fresh one. If a cached snapshot ever does fail to restore for some other reason, `Alineo.load()` now logs the real error (`[agent] snapshot restore failed (<real error>), rebuilding...`) instead of an undiagnosable `snapshot stale, rebuilding...`.
26
26
 
27
27
  ### `alineo add <url> [--name <n>]`
28
28
 
@@ -62,9 +62,9 @@ Also respects `ALINEO_TELEMETRY_DISABLED=1` and the cross-tool `DO_NOT_TRACK=1`
62
62
 
63
63
  ---
64
64
 
65
- ## Agent — session lifecycle
65
+ ## Alineo — session lifecycle
66
66
 
67
- These wrap `@alineo-labs/agent`'s `Agent.load()`/`Agent.resume()`/`Agent.attach()`/`Agent.spawn()`. Sessions are always addressed by **sandbox ID**, not name — names aren't unique (running `alineo spawn` twice on the same spec produces two sandboxes with the same name), and a name-based lookup can hand back a sandbox that already died ungracefully. `alineo spawn`/`alineo fork` print the sandbox ID; save it.
67
+ These wrap `alineo`'s `Alineo.load()`/`Alineo.resume()`/`Alineo.attach()`/`Alineo.spawn()`. Sessions are always addressed by **sandbox ID**, not name — names aren't unique (running `alineo spawn` twice on the same spec produces two sandboxes with the same name), and a name-based lookup can hand back a sandbox that already died ungracefully. `alineo spawn`/`alineo fork` print the sandbox ID; save it.
68
68
 
69
69
  ### `alineo spawn <spec> [--prompt <msg>] [--rebuild] [--depth <n>] [--max <n>] [--json]`
70
70
 
@@ -3,7 +3,7 @@ import { t as flag } from "./args-BBPtXttx.mjs";
3
3
  import { join } from "path";
4
4
  import { existsSync } from "fs";
5
5
  import { mkdir } from "fs/promises";
6
- import { validateAgentSpec } from "@alineo-labs/agent";
6
+ import { validateAgentSpec } from "alineo";
7
7
  //#region src/commands/add.ts
8
8
  async function add(url, opts = {}) {
9
9
  const log = opts.log ?? console.log;
@@ -20,7 +20,7 @@ async function add(url, opts = {}) {
20
20
  const dest = join(agentsDir, `${name}.json`);
21
21
  await Bun.write(dest, JSON.stringify(spec, null, 2) + "\n");
22
22
  log(`Agent spec saved: ${dest}`);
23
- log(`Load it with: Agent.load("${dest}") from @alineo-labs/agent`);
23
+ log(`Load it with: Alineo.load(await Bun.file("${dest}").json(), { adapter }) from alineo`);
24
24
  }
25
25
  async function fetchSpec(url) {
26
26
  if (url.startsWith("http://") || url.startsWith("https://")) {
@@ -1,4 +1,4 @@
1
- import { n as getSessions, t as formatAge } from "./sessions-data-BYaLq9wh.mjs";
1
+ import { n as getSessions, t as formatAge } from "./sessions-data-SEZBa4Uk.mjs";
2
2
  //#region src/commands/agents.ts
3
3
  async function agents(opts = {}) {
4
4
  const { tracked, untracked } = await getSessions();
@@ -1,26 +1,26 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
2
  import { t as flag } from "./args-BBPtXttx.mjs";
3
3
  import { t as collectReply } from "./agent-prompt-DeTX84DU.mjs";
4
- import { Agent } from "@alineo-labs/agent";
5
- import { Alineo, SandboxStatus } from "alineo";
4
+ import { Alineo } from "alineo";
5
+ import { Sandbox, SandboxStatus } from "@alineo-labs/sandbox";
6
6
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
7
7
  //#region src/commands/fork.ts
8
8
  /**
9
9
  * Fork a running session's own sandbox into a brand-new independent child, per
10
- * `Agent.spawn()`. Meant to be run BY that session's own Pi bash tool — `name` is
11
- * the caller's own running session, not the child's. Uses `Agent.attach()`, not
12
- * `Agent.resume()`, to avoid killing the very bridge process making this call.
10
+ * `Alineo.spawn()`. Meant to be run BY that session's own Pi bash tool — `name` is
11
+ * the caller's own running session, not the child's. Uses `Alineo.attach()`, not
12
+ * `Alineo.resume()`, to avoid killing the very bridge process making this call.
13
13
  *
14
14
  * Resolves the caller's own sandbox ID from `ALINEO_SANDBOX_ID` when present
15
15
  * (written to `/etc/alineo-env` by every agent-creation path, so it's already
16
16
  * in this process's env since it's a descendant of Pi's own bridge process) —
17
17
  * preferred over a ledger lookup when available, since the calling agent may
18
18
  * have been created via an `IStorageAdapter` this CLI invocation has no
19
- * access to (e.g. a host-side ledger for an `Agent.load()` call this
19
+ * access to (e.g. a host-side ledger for an `Alineo.load()` call this
20
20
  * sandbox's own `alineo.config.json` knows nothing about). Falls back to
21
21
  * looking `name` up in the ledger of currently-running sessions when
22
22
  * `ALINEO_SANDBOX_ID` isn't set (e.g. invoked outside a sandbox). `name` also
23
- * always labels the resulting `Agent` object.
23
+ * always labels the resulting `Alineo` object.
24
24
  */
25
25
  async function fork(name, childSpecPath, opts = {}) {
26
26
  if (!name || !childSpecPath) throw new Error("Usage: alineo fork <name> <child-spec> [--prompt <msg>] [--depth N] [--max N] [--timeout SECONDS] [--json]");
@@ -28,7 +28,7 @@ async function fork(name, childSpecPath, opts = {}) {
28
28
  const adapter = new SQLiteAdapter(config.adapterPath);
29
29
  let selfSandboxId = process.env.ALINEO_SANDBOX_ID;
30
30
  if (!selfSandboxId) {
31
- const session = (await new Alineo({
31
+ const session = (await new Sandbox({
32
32
  baseUrl: config.serverUrl,
33
33
  apiKey: config.apiKey,
34
34
  adapter,
@@ -37,7 +37,7 @@ async function fork(name, childSpecPath, opts = {}) {
37
37
  if (!session) throw new Error(`No running session named '${name}'. Run 'alineo agents' to see running sessions.`);
38
38
  selfSandboxId = session.sandboxId;
39
39
  }
40
- const child = await (await Agent.attach(selfSandboxId, {
40
+ const child = await (await Alineo.attach(selfSandboxId, {
41
41
  adapter,
42
42
  name
43
43
  })).spawn(childSpecPath, {
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import { mkdir } from "fs/promises";
10
10
  * imports its implementation. The metadata here is intentionally duplicated from each
11
11
  * command file's own `xCommand` export (e.g. `initCommand` in init.ts) rather than
12
12
  * statically imported — a static import would pull in that command's full dependency
13
- * graph (e.g. spawn.ts drags in `@alineo-labs/agent`, `alineo`, `@alineo-labs/sqlite`) on *every* CLI
13
+ * graph (e.g. spawn.ts drags in `alineo`, `@alineo-labs/sqlite`) on *every* CLI
14
14
  * invocation just to print help text, which measured ~3x slower for something as
15
15
  * trivial as `alineo --version`. Duplicating a couple of plain strings per command is a
16
16
  * much smaller risk than that: a mismatch would show up immediately in the printed
@@ -37,7 +37,7 @@ const commands = [
37
37
  usage: "alineo add <url> [--name <n>]",
38
38
  summary: "Fetch and save an agent spec locally"
39
39
  }],
40
- run: async (argv) => (await import("./add-Dv8ui6gU.mjs")).addCommand.run(argv)
40
+ run: async (argv) => (await import("./add-CmdLjuq_.mjs")).addCommand.run(argv)
41
41
  },
42
42
  {
43
43
  name: "list",
@@ -67,7 +67,7 @@ const commands = [
67
67
  usage: "alineo spawn <spec> --prompt <msg>",
68
68
  summary: "Start it, send one prompt, print the reply, exit"
69
69
  }],
70
- run: async (argv) => (await import("./spawn-CBsNRaLz.mjs")).spawnCommand.run(argv)
70
+ run: async (argv) => (await import("./spawn-C0URxOO5.mjs")).spawnCommand.run(argv)
71
71
  },
72
72
  {
73
73
  name: "prompt",
@@ -76,7 +76,7 @@ const commands = [
76
76
  usage: "alineo prompt <sandbox-id> <msg>",
77
77
  summary: "Send one prompt to a running sandbox, print the reply"
78
78
  }],
79
- run: async (argv) => (await import("./prompt-DN_v5l5u.mjs")).promptCommand.run(argv)
79
+ run: async (argv) => (await import("./prompt-CK2gcAJs.mjs")).promptCommand.run(argv)
80
80
  },
81
81
  {
82
82
  name: "fork",
@@ -85,7 +85,7 @@ const commands = [
85
85
  usage: "alineo fork <name> <child-spec>",
86
86
  summary: "Fork a running session's own live sandbox into a new child"
87
87
  }],
88
- run: async (argv) => (await import("./fork-BSbb54Ba.mjs")).forkCommand.run(argv)
88
+ run: async (argv) => (await import("./fork-CAtxcuwS.mjs")).forkCommand.run(argv)
89
89
  },
90
90
  {
91
91
  name: "agents",
@@ -94,7 +94,7 @@ const commands = [
94
94
  usage: "alineo agents [--json]",
95
95
  summary: "List running agent sessions"
96
96
  }],
97
- run: async (argv) => (await import("./agents-uXEMlj41.mjs")).agentsCommand.run(argv)
97
+ run: async (argv) => (await import("./agents-CEVMF8rH.mjs")).agentsCommand.run(argv)
98
98
  },
99
99
  {
100
100
  name: "kill",
@@ -103,7 +103,7 @@ const commands = [
103
103
  usage: "alineo kill <sandbox-id>",
104
104
  summary: "Stop a sandbox"
105
105
  }],
106
- run: async (argv) => (await import("./kill-CTAbMh-H.mjs")).killCommand.run(argv)
106
+ run: async (argv) => (await import("./kill-D1vvRxxn.mjs")).killCommand.run(argv)
107
107
  },
108
108
  {
109
109
  name: "logs",
@@ -112,7 +112,7 @@ const commands = [
112
112
  usage: "alineo logs <name> [--json]",
113
113
  summary: "Print ledger events for a session"
114
114
  }],
115
- run: async (argv) => (await import("./logs-BkVSXK9O.mjs")).logsCommand.run(argv)
115
+ run: async (argv) => (await import("./logs-D-DUd5Ux.mjs")).logsCommand.run(argv)
116
116
  },
117
117
  {
118
118
  name: "telemetry",
@@ -152,8 +152,8 @@ function fillDefaults(data) {
152
152
  adapterPath: data.adapterPath ?? "./.alineo/ledger.db",
153
153
  agentsDir: data.agentsDir ?? "./agents",
154
154
  defaults: { resources: {
155
- cpu: data.defaults?.resources?.cpu ?? "1000m",
156
- memory: data.defaults?.resources?.memory ?? "1Gi"
155
+ cpu: data.defaults?.resources.cpu ?? "1000m",
156
+ memory: data.defaults?.resources.memory ?? "1Gi"
157
157
  } }
158
158
  };
159
159
  }
@@ -203,7 +203,7 @@ function serverConfigPath() {
203
203
  * only as good as where the db file actually lives: without this mount, it sits in the
204
204
  * `alineo-opensandbox` container's own writable layer, so restart is fine but any time the
205
205
  * container itself is recreated (host reboot with no restart policy, `docker system prune`,
206
- * a stray `docker rm`) silently loses every cached snapshot record — every `Agent.load()`
206
+ * a stray `docker rm`) silently loses every cached snapshot record — every `Alineo.load()`
207
207
  * snapshot fast path pays a full cold rebuild next time, indistinguishable from a genuinely
208
208
  * changed spec (see issue #20). Bind-mounting this directory makes that data outlive the
209
209
  * container's own lifecycle, matching OpenSandbox's own intent.
@@ -219,6 +219,16 @@ function serverDataDir() {
219
219
  * support, >=v1.0.21 is recommended for full functionality -- the "v1.1.0+" the warning
220
220
  * message itself suggests does not exist as a published tag. v1.0.22 is the latest.
221
221
  */
222
+ /**
223
+ * `egress.image`/`egress.mode` are configured unconditionally, not opt-in. Per OpenSandbox's
224
+ * own control flow, a configured `egress.image` is inert for any sandbox created without a
225
+ * `networkPolicy` — no sidecar is attached, no behavior changes for anyone not touching
226
+ * `SandboxOptions.networkPolicy`/`credentialProxy`. Without this block, a fresh `alineo init`
227
+ * server rejects any `networkPolicy`/`credentialProxy` request outright with
228
+ * "egress.image must be configured" — this is what closes that gap (see issue #203,
229
+ * plans/credential-injection.md Phase 4). `dns+nft` (rather than `dns`) is required for
230
+ * `credentialProxy`'s Credential Vault to activate at all.
231
+ */
222
232
  function serverConfigContent() {
223
233
  return `[server]
224
234
  host = "0.0.0.0"
@@ -235,6 +245,10 @@ network_mode = "bridge"
235
245
  [store]
236
246
  type = "sqlite"
237
247
  path = "/data/opensandbox.db"
248
+
249
+ [egress]
250
+ image = "opensandbox/egress:v1.1.7"
251
+ mode = "dns+nft"
238
252
  `;
239
253
  }
240
254
  //#endregion
@@ -402,7 +416,7 @@ async function withTelemetry(commandName, argv, run) {
402
416
  errorClass = errorClassOf(err);
403
417
  throw err;
404
418
  } finally {
405
- const { version } = await import("./package-D-xkbPYh.mjs");
419
+ const { version } = await import("./package-B7vjtb_X.mjs");
406
420
  await sendTelemetryEvent({
407
421
  command: commandName,
408
422
  flags,
@@ -427,7 +441,7 @@ async function recordTuiLaunch() {
427
441
  const config = await readTelemetryConfig();
428
442
  if (!config.enabled) return;
429
443
  await maybePrintFirstRunNotice(config);
430
- const { version } = await import("./package-D-xkbPYh.mjs");
444
+ const { version } = await import("./package-B7vjtb_X.mjs");
431
445
  await sendTelemetryEvent({
432
446
  command: "tui",
433
447
  flags: {},
@@ -458,7 +472,7 @@ const GROUPS = [{
458
472
  label: "SDK — OpenSandbox config and the local spec cache:"
459
473
  }, {
460
474
  key: "agent",
461
- label: "Agent — session lifecycle:"
475
+ label: "Alineo — session lifecycle:"
462
476
  }];
463
477
  function printHelp() {
464
478
  console.log(`alineo — alineo agent registry CLI\n`);
@@ -475,12 +489,12 @@ function printHelp() {
475
489
  async function main() {
476
490
  if (!cmd && process.stdout.isTTY) {
477
491
  await recordTuiLaunch();
478
- const { launchTui } = await import("./tui-mkWqwNZl.mjs");
492
+ const { launchTui } = await import("./tui-BHpM7gtx.mjs");
479
493
  await launchTui();
480
494
  return;
481
495
  }
482
496
  if (cmd === "--version" || cmd === "-v" || cmd === "version") {
483
- const { version } = await import("./package-D-xkbPYh.mjs");
497
+ const { version } = await import("./package-B7vjtb_X.mjs");
484
498
  console.log(version);
485
499
  return;
486
500
  }
@@ -1,5 +1,5 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
- import { Alineo } from "alineo";
2
+ import { Sandbox } from "@alineo-labs/sandbox";
3
3
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
4
4
  //#region src/commands/kill.ts
5
5
  /**
@@ -12,7 +12,7 @@ async function kill(sandboxId) {
12
12
  if (!sandboxId) throw new Error("Usage: alineo kill <sandbox-id>");
13
13
  const config = await readConfig();
14
14
  const adapter = new SQLiteAdapter(config.adapterPath);
15
- await (await new Alineo({
15
+ await (await new Sandbox({
16
16
  baseUrl: config.serverUrl,
17
17
  apiKey: config.apiKey,
18
18
  adapter,
@@ -1,12 +1,12 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
- import { Alineo } from "alineo";
2
+ import { Sandbox } from "@alineo-labs/sandbox";
3
3
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
4
4
  //#region src/commands/logs.ts
5
5
  async function logs(name, opts = {}) {
6
6
  if (!name) throw new Error("Usage: alineo logs <name> [--json]");
7
7
  const config = await readConfig();
8
8
  const adapter = new SQLiteAdapter(config.adapterPath);
9
- const session = (await new Alineo({
9
+ const session = (await new Sandbox({
10
10
  baseUrl: config.serverUrl,
11
11
  apiKey: config.apiKey,
12
12
  adapter,
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.1.2";
2
+ var version = "0.1.4";
3
3
  //#endregion
4
4
  export { version };
@@ -1,7 +1,7 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
2
  import { t as flag } from "./args-BBPtXttx.mjs";
3
3
  import { t as collectReply } from "./agent-prompt-DeTX84DU.mjs";
4
- import { Agent } from "@alineo-labs/agent";
4
+ import { Alineo } from "alineo";
5
5
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
6
6
  //#region src/commands/prompt.ts
7
7
  /**
@@ -9,11 +9,11 @@ import { SQLiteAdapter } from "@alineo-labs/sqlite";
9
9
  * `alineo spawn` on the same spec produces two sandboxes with the same name)
10
10
  * and a name-based ledger lookup can hand back a sandbox that died ungracefully
11
11
  * (crashed before its `close()` ran, expired via OpenSandbox's own TTL) since
12
- * nothing ever told the ledger it stopped. `Agent.resume()`'s own `connect()`
12
+ * nothing ever told the ledger it stopped. `Alineo.resume()`'s own `connect()`
13
13
  * call is the actual authoritative liveness check — addressing by ID means
14
14
  * that's the ONLY check, not a second opinion after an already-stale one.
15
15
  *
16
- * `opts.specPath` lets a caller skip `Agent.resume()`'s own ledger lookup for
16
+ * `opts.specPath` lets a caller skip `Alineo.resume()`'s own ledger lookup for
17
17
  * the spec file entirely — necessary when prompting a sandbox whose
18
18
  * `sandbox_created` event lives in a different ledger than this CLI
19
19
  * invocation's own (e.g. a child spawned via `alineo fork` from inside
@@ -22,7 +22,7 @@ import { SQLiteAdapter } from "@alineo-labs/sqlite";
22
22
  async function prompt(sandboxId, message, opts = {}) {
23
23
  if (!sandboxId || !message) throw new Error("Usage: alineo prompt <sandbox-id> <message> [--spec <path>] [--timeout SECONDS] [--json]");
24
24
  const adapter = new SQLiteAdapter((await readConfig()).adapterPath);
25
- const agent = await Agent.resume(sandboxId, {
25
+ const agent = await Alineo.resume(sandboxId, {
26
26
  adapter,
27
27
  specPath: opts.specPath
28
28
  });
@@ -1,5 +1,5 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
- import { Alineo, SandboxStatus } from "alineo";
2
+ import { Sandbox, SandboxStatus } from "@alineo-labs/sandbox";
3
3
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
4
4
  import { ControlClient, SandboxState } from "@alineo-labs/opensandbox";
5
5
  //#region src/sessions-data.ts
@@ -19,7 +19,7 @@ import { ControlClient, SandboxState } from "@alineo-labs/opensandbox";
19
19
  async function getSessions(config) {
20
20
  const cfg = config ?? await readConfig();
21
21
  const adapter = new SQLiteAdapter(cfg.adapterPath);
22
- const ledgerRunning = await new Alineo({
22
+ const ledgerRunning = await new Sandbox({
23
23
  baseUrl: cfg.serverUrl,
24
24
  apiKey: cfg.apiKey,
25
25
  adapter,
@@ -34,11 +34,16 @@ async function getSessions(config) {
34
34
  const raw = await control.listSandboxes({ state: SandboxState.Running });
35
35
  liveIds = new Set(raw.map((s) => s.id));
36
36
  } catch {}
37
- const tracked = liveIds ? ledgerRunning.filter((s) => liveIds.has(s.sandboxId)) : ledgerRunning;
37
+ let tracked = ledgerRunning;
38
+ if (liveIds) {
39
+ const ids = liveIds;
40
+ tracked = ledgerRunning.filter((s) => ids.has(s.sandboxId));
41
+ }
38
42
  const trackedIds = new Set(tracked.map((s) => s.sandboxId));
43
+ const untracked = liveIds ? [...liveIds].filter((id) => !trackedIds.has(id)) : [];
39
44
  return {
40
45
  tracked,
41
- untracked: liveIds ? [...liveIds].filter((id) => !trackedIds.has(id)) : []
46
+ untracked
42
47
  };
43
48
  }
44
49
  function formatAge(startedAt) {
@@ -1,7 +1,7 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
2
  import { t as flag } from "./args-BBPtXttx.mjs";
3
3
  import { t as collectReply } from "./agent-prompt-DeTX84DU.mjs";
4
- import { Agent } from "@alineo-labs/agent";
4
+ import { Alineo } from "alineo";
5
5
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
6
6
  //#region src/commands/spawn.ts
7
7
  /**
@@ -14,7 +14,8 @@ import { SQLiteAdapter } from "@alineo-labs/sqlite";
14
14
  async function spawn(specPath, opts = {}) {
15
15
  if (!specPath) throw new Error("Usage: alineo spawn <spec> [--prompt <msg>] [--rebuild] [--depth N] [--max N] [--timeout SECONDS] [--run-id ID] [--json]");
16
16
  const adapter = new SQLiteAdapter((await readConfig()).adapterPath);
17
- const agent = await Agent.load(specPath, {
17
+ const spec = await Bun.file(specPath).json();
18
+ const agent = await Alineo.load(spec, {
18
19
  adapter,
19
20
  rebuild: opts.rebuild,
20
21
  spawnDepth: opts.depth,
@@ -1,9 +1,9 @@
1
1
  import { a as readConfig } from "./index.mjs";
2
- import { n as getSessions, t as formatAge } from "./sessions-data-BYaLq9wh.mjs";
2
+ import { n as getSessions, t as formatAge } from "./sessions-data-SEZBa4Uk.mjs";
3
3
  import { join } from "path";
4
4
  import { existsSync, readdirSync } from "fs";
5
- import { Agent } from "@alineo-labs/agent";
6
5
  import { Alineo } from "alineo";
6
+ import { Sandbox } from "@alineo-labs/sandbox";
7
7
  import { SQLiteAdapter } from "@alineo-labs/sqlite";
8
8
  import { BoxRenderable, InputRenderable, InputRenderableEvents, ScrollBoxRenderable, SelectRenderable, SelectRenderableEvents, TextRenderable, createCliRenderer } from "@opentui/core";
9
9
  //#region src/tui/dashboard.ts
@@ -53,7 +53,7 @@ function createDashboardView(renderer, onOpen, onQuit, onNew, onLogs) {
53
53
  status.content = `killing ${session.name}...`;
54
54
  try {
55
55
  const config = await readConfig();
56
- await (await new Alineo({
56
+ await (await new Sandbox({
57
57
  baseUrl: config.serverUrl,
58
58
  apiKey: config.apiKey,
59
59
  adapter: new SQLiteAdapter(config.adapterPath),
@@ -157,7 +157,20 @@ function createChatView(renderer, agent, onBack) {
157
157
  case "extension_error":
158
158
  appendLine(`[extension error] ${ev.extensionPath}: ${ev.error}`);
159
159
  break;
160
- default: break;
160
+ case "agent_start":
161
+ case "agent_end":
162
+ case "tool_update":
163
+ case "compaction_start":
164
+ case "compaction_end":
165
+ case "auto_retry_start":
166
+ case "auto_retry_end":
167
+ case "message_start":
168
+ case "message_update":
169
+ case "message_end":
170
+ case "turn_start":
171
+ case "turn_end":
172
+ case "extension_ui":
173
+ case "queue_update": break;
161
174
  }
162
175
  } catch (err) {
163
176
  appendLine(`[error] ${err instanceof Error ? err.message : String(err)}`);
@@ -279,7 +292,7 @@ function createNewSessionView(renderer, onLaunch, onCancel) {
279
292
  try {
280
293
  let specPath = entry.specPath;
281
294
  if (!specPath && entry.registryUrl) {
282
- const { add } = await import("./add-Dv8ui6gU.mjs");
295
+ const { add } = await import("./add-CmdLjuq_.mjs");
283
296
  await add(entry.registryUrl, { log: (msg) => status.content = msg });
284
297
  specPath = join((await readConfig()).agentsDir, `${entry.name}.json`);
285
298
  }
@@ -335,7 +348,7 @@ function createLogsView(renderer, session, onBack) {
335
348
  async function load() {
336
349
  const config = await readConfig();
337
350
  const adapter = new SQLiteAdapter(config.adapterPath);
338
- await new Alineo({
351
+ await new Sandbox({
339
352
  baseUrl: config.serverUrl,
340
353
  apiKey: config.apiKey,
341
354
  adapter,
@@ -395,21 +408,29 @@ async function launchTui() {
395
408
  process.exit(0);
396
409
  }
397
410
  function showDashboard(initialStatus) {
398
- const view = createDashboardView(renderer, (session) => void openSession(session), quit, showNewSession, (session) => mount(createLogsView(renderer, session, () => showDashboard())));
411
+ const view = createDashboardView(renderer, (session) => void openSession(session), quit, showNewSession, (session) => {
412
+ mount(createLogsView(renderer, session, () => {
413
+ showDashboard();
414
+ }));
415
+ });
399
416
  mount(view);
400
417
  if (initialStatus) view.setStatus(initialStatus);
401
418
  }
402
419
  function showNewSession() {
403
- mount(createNewSessionView(renderer, (specPath) => void launchNewAgent(specPath), () => showDashboard()));
420
+ mount(createNewSessionView(renderer, (specPath) => void launchNewAgent(specPath), () => {
421
+ showDashboard();
422
+ }));
404
423
  }
405
424
  async function openSession(session) {
406
425
  const config = await readConfig();
407
426
  const adapter = new SQLiteAdapter(config.adapterPath);
408
427
  try {
409
- mount(createChatView(renderer, await Agent.resume(session.sandboxId, {
428
+ mount(createChatView(renderer, await Alineo.resume(session.sandboxId, {
410
429
  adapter,
411
430
  specPath: `${config.agentsDir}/${session.name}.json`
412
- }), () => showDashboard()));
431
+ }), () => {
432
+ showDashboard();
433
+ }));
413
434
  } catch (err) {
414
435
  showDashboard(`failed to open '${session.name}': ${err instanceof Error ? err.message : String(err)}`);
415
436
  }
@@ -417,7 +438,10 @@ async function launchTui() {
417
438
  async function launchNewAgent(specPath) {
418
439
  const adapter = new SQLiteAdapter((await readConfig()).adapterPath);
419
440
  try {
420
- mount(createChatView(renderer, await Agent.load(specPath, { adapter }), () => showDashboard()));
441
+ const spec = await Bun.file(specPath).json();
442
+ mount(createChatView(renderer, await Alineo.load(spec, { adapter }), () => {
443
+ showDashboard();
444
+ }));
421
445
  } catch (err) {
422
446
  showDashboard(`failed to start '${specPath}': ${err instanceof Error ? err.message : String(err)}`);
423
447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alineo-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,17 +29,16 @@
29
29
  "test": "bun test"
30
30
  },
31
31
  "dependencies": {
32
- "@alineo-labs/agent": "0.1.1",
33
- "@alineo-labs/opensandbox": "0.1.0",
34
- "@alineo-labs/sqlite": "0.1.2",
32
+ "@alineo-labs/opensandbox": "0.2.0",
33
+ "@alineo-labs/sandbox": "0.3.0",
34
+ "@alineo-labs/sqlite": "0.2.0",
35
35
  "@opentui/core": "^0.4.3",
36
- "alineo": "0.1.0"
36
+ "alineo": "0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@earendil-works/pi-coding-agent": "^0.80.3",
40
40
  "bun-types": "1.3.14",
41
41
  "tsdown": "0.22.3",
42
- "typebox": "^1.3.5",
43
42
  "typescript": "6.0.3"
44
43
  },
45
44
  "pi": {
@@ -35,7 +35,7 @@ export default function (pi: ExtensionAPI) {
35
35
  });
36
36
 
37
37
  // `ALINEO_SANDBOX_ID` is only set inside a sandbox created by an agent-creation
38
- // path (Agent.load()/resume()/spawn(), see packages/agent/src/agent.ts) — its
38
+ // path (Alineo.load()/resume()/spawn(), see packages/agent/src/agent.ts) — its
39
39
  // presence here means THIS Pi process is itself running inside one, so it has
40
40
  // live state (installed packages, a checked-out repo, files on disk) worth
41
41
  // forking into children via `alineo fork`. A host-level session (a user's own
@@ -153,12 +153,12 @@ async function ensureAlineoReady(pi: ExtensionAPI, ctx: ExtensionContext): Promi
153
153
  bootstrapped = true;
154
154
 
155
155
  const check = await execOk(pi, "alineo", ["--version"]);
156
- if (!check || check.code !== 0) {
156
+ if (check?.code !== 0) {
157
157
  ctx.ui.notify("Installing alineo...", "info");
158
158
  const install = await execOk(pi, "npm", ["install", "-g", "alineo-cli"]);
159
- if (!install || install.code !== 0) {
159
+ if (install?.code !== 0) {
160
160
  ctx.ui.notify(
161
- `Failed to install alineo: ${install?.stderr || "npm not available"}. ` +
161
+ `Failed to install alineo: ${install?.stderr ?? "npm not available"}. ` +
162
162
  `RLM flows won't work until this is resolved — install manually with "npm install -g alineo-cli".`,
163
163
  "error",
164
164
  );
@@ -168,9 +168,9 @@ async function ensureAlineoReady(pi: ExtensionAPI, ctx: ExtensionContext): Promi
168
168
  }
169
169
 
170
170
  const init = await execOk(pi, "alineo", ["init"]);
171
- if (!init || init.code !== 0) {
171
+ if (init?.code !== 0) {
172
172
  ctx.ui.notify(
173
- `"alineo init" failed: ${init?.stderr || "unknown error"}. ` +
173
+ `"alineo init" failed: ${init?.stderr ?? "unknown error"}. ` +
174
174
  `RLM flows won't work until OpenSandbox is reachable — see "alineo init" for manual setup.`,
175
175
  "warning",
176
176
  );