alineo-cli 0.1.1 → 0.1.3
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 +4 -4
- package/dist/{add-Dv8ui6gU.mjs → add-CmdLjuq_.mjs} +2 -2
- package/dist/{agents-uXEMlj41.mjs → agents-tlnhpPil.mjs} +1 -1
- package/dist/{fork-BSbb54Ba.mjs → fork-CAtxcuwS.mjs} +9 -9
- package/dist/index.mjs +15 -15
- package/dist/{init-BI4f18xk.mjs → init-BRkdxhkW.mjs} +1 -2
- package/dist/{kill-CTAbMh-H.mjs → kill-D1vvRxxn.mjs} +2 -2
- package/dist/{logs-BkVSXK9O.mjs → logs-D-DUd5Ux.mjs} +2 -2
- package/dist/{package-DDJU-vGq.mjs → package-B8OYcRQI.mjs} +1 -1
- package/dist/{prompt-DN_v5l5u.mjs → prompt-CK2gcAJs.mjs} +4 -4
- package/dist/{sessions-data-BYaLq9wh.mjs → sessions-data-Cm5Fzzmo.mjs} +2 -2
- package/dist/{spawn-CBsNRaLz.mjs → spawn-C0URxOO5.mjs} +3 -2
- package/dist/{tui-mkWqwNZl.mjs → tui-Dqsq6mJj.mjs} +8 -7
- package/package.json +4 -5
- package/pi-extension/alineo.ts +1 -1
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
|
|
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 `
|
|
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
|
-
##
|
|
65
|
+
## Alineo — session lifecycle
|
|
66
66
|
|
|
67
|
-
These wrap
|
|
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 "
|
|
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:
|
|
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-
|
|
1
|
+
import { n as getSessions, t as formatAge } from "./sessions-data-Cm5Fzzmo.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 {
|
|
5
|
-
import {
|
|
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
|
-
* `
|
|
11
|
-
* the caller's own running session, not the child's. Uses `
|
|
12
|
-
* `
|
|
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 `
|
|
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 `
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -28,7 +28,7 @@ const commands = [
|
|
|
28
28
|
usage: "alineo init",
|
|
29
29
|
summary: "Start OpenSandbox locally via Docker"
|
|
30
30
|
}],
|
|
31
|
-
run: async (argv) => (await import("./init-
|
|
31
|
+
run: async (argv) => (await import("./init-BRkdxhkW.mjs")).initCommand.run(argv)
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
name: "add",
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
97
|
+
run: async (argv) => (await import("./agents-tlnhpPil.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-
|
|
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-
|
|
115
|
+
run: async (argv) => (await import("./logs-D-DUd5Ux.mjs")).logsCommand.run(argv)
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
name: "telemetry",
|
|
@@ -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 `
|
|
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.
|
|
@@ -402,7 +402,7 @@ async function withTelemetry(commandName, argv, run) {
|
|
|
402
402
|
errorClass = errorClassOf(err);
|
|
403
403
|
throw err;
|
|
404
404
|
} finally {
|
|
405
|
-
const { version } = await import("./package-
|
|
405
|
+
const { version } = await import("./package-B8OYcRQI.mjs");
|
|
406
406
|
await sendTelemetryEvent({
|
|
407
407
|
command: commandName,
|
|
408
408
|
flags,
|
|
@@ -427,7 +427,7 @@ async function recordTuiLaunch() {
|
|
|
427
427
|
const config = await readTelemetryConfig();
|
|
428
428
|
if (!config.enabled) return;
|
|
429
429
|
await maybePrintFirstRunNotice(config);
|
|
430
|
-
const { version } = await import("./package-
|
|
430
|
+
const { version } = await import("./package-B8OYcRQI.mjs");
|
|
431
431
|
await sendTelemetryEvent({
|
|
432
432
|
command: "tui",
|
|
433
433
|
flags: {},
|
|
@@ -458,7 +458,7 @@ const GROUPS = [{
|
|
|
458
458
|
label: "SDK — OpenSandbox config and the local spec cache:"
|
|
459
459
|
}, {
|
|
460
460
|
key: "agent",
|
|
461
|
-
label: "
|
|
461
|
+
label: "Alineo — session lifecycle:"
|
|
462
462
|
}];
|
|
463
463
|
function printHelp() {
|
|
464
464
|
console.log(`alineo — alineo agent registry CLI\n`);
|
|
@@ -475,12 +475,12 @@ function printHelp() {
|
|
|
475
475
|
async function main() {
|
|
476
476
|
if (!cmd && process.stdout.isTTY) {
|
|
477
477
|
await recordTuiLaunch();
|
|
478
|
-
const { launchTui } = await import("./tui-
|
|
478
|
+
const { launchTui } = await import("./tui-Dqsq6mJj.mjs");
|
|
479
479
|
await launchTui();
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
482
|
if (cmd === "--version" || cmd === "-v" || cmd === "version") {
|
|
483
|
-
const { version } = await import("./package-
|
|
483
|
+
const { version } = await import("./package-B8OYcRQI.mjs");
|
|
484
484
|
console.log(version);
|
|
485
485
|
return;
|
|
486
486
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { c as serverConfigPath, i as configPath, l as serverDataDir, o as serverConfigContent, s as serverConfigDir, u as writeConfig } from "./index.mjs";
|
|
2
|
-
import os from "os";
|
|
3
2
|
import { existsSync } from "fs";
|
|
4
3
|
import { mkdir } from "fs/promises";
|
|
5
4
|
//#region src/docker.ts
|
|
@@ -98,7 +97,7 @@ async function init() {
|
|
|
98
97
|
"-p",
|
|
99
98
|
"8080:8080",
|
|
100
99
|
"-v",
|
|
101
|
-
|
|
100
|
+
"/var/run/docker.sock:/var/run/docker.sock",
|
|
102
101
|
"-v",
|
|
103
102
|
`${serverConfigPath()}:/etc/opensandbox/config.toml:ro`,
|
|
104
103
|
"-v",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as readConfig } from "./index.mjs";
|
|
2
|
-
import {
|
|
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
|
|
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 {
|
|
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
|
|
9
|
+
const session = (await new Sandbox({
|
|
10
10
|
baseUrl: config.serverUrl,
|
|
11
11
|
apiKey: config.apiKey,
|
|
12
12
|
adapter,
|
|
@@ -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 {
|
|
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. `
|
|
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 `
|
|
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
|
|
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 {
|
|
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
|
|
22
|
+
const ledgerRunning = await new Sandbox({
|
|
23
23
|
baseUrl: cfg.serverUrl,
|
|
24
24
|
apiKey: cfg.apiKey,
|
|
25
25
|
adapter,
|
|
@@ -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 {
|
|
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
|
|
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-
|
|
2
|
+
import { n as getSessions, t as formatAge } from "./sessions-data-Cm5Fzzmo.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
|
|
56
|
+
await (await new Sandbox({
|
|
57
57
|
baseUrl: config.serverUrl,
|
|
58
58
|
apiKey: config.apiKey,
|
|
59
59
|
adapter: new SQLiteAdapter(config.adapterPath),
|
|
@@ -279,7 +279,7 @@ function createNewSessionView(renderer, onLaunch, onCancel) {
|
|
|
279
279
|
try {
|
|
280
280
|
let specPath = entry.specPath;
|
|
281
281
|
if (!specPath && entry.registryUrl) {
|
|
282
|
-
const { add } = await import("./add-
|
|
282
|
+
const { add } = await import("./add-CmdLjuq_.mjs");
|
|
283
283
|
await add(entry.registryUrl, { log: (msg) => status.content = msg });
|
|
284
284
|
specPath = join((await readConfig()).agentsDir, `${entry.name}.json`);
|
|
285
285
|
}
|
|
@@ -335,7 +335,7 @@ function createLogsView(renderer, session, onBack) {
|
|
|
335
335
|
async function load() {
|
|
336
336
|
const config = await readConfig();
|
|
337
337
|
const adapter = new SQLiteAdapter(config.adapterPath);
|
|
338
|
-
await new
|
|
338
|
+
await new Sandbox({
|
|
339
339
|
baseUrl: config.serverUrl,
|
|
340
340
|
apiKey: config.apiKey,
|
|
341
341
|
adapter,
|
|
@@ -406,7 +406,7 @@ async function launchTui() {
|
|
|
406
406
|
const config = await readConfig();
|
|
407
407
|
const adapter = new SQLiteAdapter(config.adapterPath);
|
|
408
408
|
try {
|
|
409
|
-
mount(createChatView(renderer, await
|
|
409
|
+
mount(createChatView(renderer, await Alineo.resume(session.sandboxId, {
|
|
410
410
|
adapter,
|
|
411
411
|
specPath: `${config.agentsDir}/${session.name}.json`
|
|
412
412
|
}), () => showDashboard()));
|
|
@@ -417,7 +417,8 @@ async function launchTui() {
|
|
|
417
417
|
async function launchNewAgent(specPath) {
|
|
418
418
|
const adapter = new SQLiteAdapter((await readConfig()).adapterPath);
|
|
419
419
|
try {
|
|
420
|
-
|
|
420
|
+
const spec = await Bun.file(specPath).json();
|
|
421
|
+
mount(createChatView(renderer, await Alineo.load(spec, { adapter }), () => showDashboard()));
|
|
421
422
|
} catch (err) {
|
|
422
423
|
showDashboard(`failed to start '${specPath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
423
424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alineo-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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
32
|
"@alineo-labs/opensandbox": "0.1.0",
|
|
34
|
-
"@alineo-labs/
|
|
33
|
+
"@alineo-labs/sandbox": "0.2.0",
|
|
34
|
+
"@alineo-labs/sqlite": "0.1.3",
|
|
35
35
|
"@opentui/core": "^0.4.3",
|
|
36
|
-
"alineo": "0.
|
|
36
|
+
"alineo": "0.2.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": {
|
package/pi-extension/alineo.ts
CHANGED
|
@@ -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 (
|
|
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
|