@addai/node 0.29.1 → 0.30.0
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 +96 -96
- package/assets/vault-extension/background.js +45 -45
- package/assets/vault-extension/content.js +62 -62
- package/assets/vault-extension/manifest.json +39 -39
- package/dist/autostart-linux.js +20 -20
- package/dist/autostart-mac.js +30 -30
- package/dist/autostart-win.js +50 -50
- package/dist/cli.js +19 -19
- package/dist/desktop/install-engine.js +12 -12
- package/dist/desktop/learn/browser.js +4 -4
- package/dist/desktop/learn/injected.mjs +173 -173
- package/dist/desktop/learn/recorder.mjs +151 -151
- package/dist/desktop/manager.d.ts +15 -2
- package/dist/desktop/manager.js +38 -6
- package/dist/desktop/provider.js +9 -0
- package/dist/desktop/relay-client.js +29 -5
- package/dist/desktop/spec.d.ts +23 -0
- package/dist/desktop/spec.js +24 -1
- package/dist/desktop/vault-seed.mjs +112 -112
- package/package.json +62 -62
- package/scripts/copy-assets.js +18 -18
- package/scripts/fix-pty-helper.js +28 -28
- package/scripts/precompact-capture.js +292 -292
- package/scripts/probe-tui.mjs +122 -122
- package/scripts/smoke-test.sh +74 -74
package/README.md
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
# entities-runtime
|
|
2
|
-
|
|
3
|
-
A standalone Node.js daemon. Install it on any machine, pair with your
|
|
4
|
-
+Ai account, and your account can then run Claude Code / Codex sessions
|
|
5
|
-
on that machine on its behalf — from Vault, from Entity Studio, or from
|
|
6
|
-
anywhere else in +Ai.
|
|
7
|
-
|
|
8
|
-
## Quick start
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npx entities-runtime
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
The first run prints a 5-letter pairing code and a URL:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
Pair this runtime with your +Ai account.
|
|
18
|
-
|
|
19
|
-
https://vault.add.ai/entity/connect/HDXYC
|
|
20
|
-
|
|
21
|
-
Enter this code: HDXYC
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Open the URL while signed into Vault, enter the code, and the runtime
|
|
25
|
-
starts polling for work. Capabilities (claude, codex, git, node) are
|
|
26
|
-
reported every 30 s.
|
|
27
|
-
|
|
28
|
-
## Commands
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
entities-runtime run the daemon (foreground)
|
|
32
|
-
entities-runtime status pairing + capabilities + last-seen
|
|
33
|
-
entities-runtime sessions recent requests handled (--limit N)
|
|
34
|
-
entities-runtime unpair --yes disconnect from +Ai
|
|
35
|
-
entities-runtime version print version
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`status` and `sessions` work without the daemon running — they hit
|
|
39
|
-
Supabase directly using the daemon token in
|
|
40
|
-
`~/.entities-runtime/state.json`.
|
|
41
|
-
|
|
42
|
-
## Architecture
|
|
43
|
-
|
|
44
|
-
See [`docs/architecture.md`](docs/architecture.md) for the full picture:
|
|
45
|
-
Supabase tables, RPC inventory, request lifecycle, and the cancel-watcher
|
|
46
|
-
flow.
|
|
47
|
-
|
|
48
|
-
## DiskGuard — Codex scratch-dir disk protection
|
|
49
|
-
|
|
50
|
-
Each Codex run gets a throwaway `CODEX_HOME` under the OS temp dir
|
|
51
|
-
(`entities-codex-<rand>`). Codex writes its `state_*.sqlite`, logs, caches
|
|
52
|
-
and shell snapshots there — typically 50–350 MB per run. codex-spawn now
|
|
53
|
-
deletes that dir on exit, but a `SIGKILL`, a crash, or an orphan left by a
|
|
54
|
-
previous runtime process can skip that path. On a dedicated host doing
|
|
55
|
-
thousands of runs, those leftovers once grew to ~158 GiB and filled the
|
|
56
|
-
disk (`ENOSPC`, repeated crashes).
|
|
57
|
-
|
|
58
|
-
**DiskGuard** is the safety net. Like a CCTV DVR overwriting the oldest
|
|
59
|
-
footage when the disk fills, it watches free space on the volume holding
|
|
60
|
-
the temp dir and, when usage crosses a high-water mark, deletes the
|
|
61
|
-
**oldest inactive** scratch dirs — oldest first — until usage drops back
|
|
62
|
-
below a low-water mark, leaving a buffer for the OS. It runs at startup, on
|
|
63
|
-
an interval, and opportunistically right before each new Codex run.
|
|
64
|
-
|
|
65
|
-
Safety guarantees: it only touches directories directly under the temp root
|
|
66
|
-
whose names match the configured prefix (realpath-validated); it never
|
|
67
|
-
deletes a dir owned by a live session (in-process, or one whose
|
|
68
|
-
`session.lock` PID is still alive) or one younger than the min-age guard;
|
|
69
|
-
and it removes symlink *entries* without following them, so the durable
|
|
70
|
-
`~/.codex` targets behind `sessions`/`auth.json` are never harmed.
|
|
71
|
-
|
|
72
|
-
Note: DiskGuard can only reclaim space by deleting scratch dirs it owns. If
|
|
73
|
-
a disk is full of *other* data it will evict what it can and log that it
|
|
74
|
-
couldn't reach the target rather than touching anything it doesn't own.
|
|
75
|
-
|
|
76
|
-
Configure via environment variables (defaults shown):
|
|
77
|
-
|
|
78
|
-
| Variable | Default | Meaning |
|
|
79
|
-
|---|---|---|
|
|
80
|
-
| `DISKGUARD_ENABLED` | `true` | Master switch for the sweeper. Cleanup-on-exit still runs when `false`. |
|
|
81
|
-
| `DISKGUARD_HIGH_WATER_PCT` | `90` | Start evicting when volume usage reaches this %. |
|
|
82
|
-
| `DISKGUARD_LOW_WATER_PCT` | `80` | Stop evicting once usage drops below this %. Clamped below high-water. |
|
|
83
|
-
| `DISKGUARD_MIN_AGE_MINUTES` | `30` | Never evict a scratch dir younger than this. |
|
|
84
|
-
| `DISKGUARD_CHECK_INTERVAL_SECONDS` | `60` | Periodic sweep cadence. |
|
|
85
|
-
| `DISKGUARD_DRY_RUN` | `false` | Log what would be evicted without deleting anything. |
|
|
86
|
-
| `DISKGUARD_PREFIXES` | `entities-codex-` | Comma-separated dir-name prefixes eligible for eviction. |
|
|
87
|
-
| `DISKGUARD_TEMP_ROOT` | `os.tmpdir()` | Override the watched temp root (mainly for testing). |
|
|
88
|
-
|
|
89
|
-
## Development
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm install
|
|
93
|
-
npm run build
|
|
94
|
-
node dist/cli.js
|
|
95
|
-
npm test # builds, then runs the node:test suite (see test/)
|
|
96
|
-
```
|
|
1
|
+
# entities-runtime
|
|
2
|
+
|
|
3
|
+
A standalone Node.js daemon. Install it on any machine, pair with your
|
|
4
|
+
+Ai account, and your account can then run Claude Code / Codex sessions
|
|
5
|
+
on that machine on its behalf — from Vault, from Entity Studio, or from
|
|
6
|
+
anywhere else in +Ai.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx entities-runtime
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The first run prints a 5-letter pairing code and a URL:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Pair this runtime with your +Ai account.
|
|
18
|
+
|
|
19
|
+
https://vault.add.ai/entity/connect/HDXYC
|
|
20
|
+
|
|
21
|
+
Enter this code: HDXYC
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Open the URL while signed into Vault, enter the code, and the runtime
|
|
25
|
+
starts polling for work. Capabilities (claude, codex, git, node) are
|
|
26
|
+
reported every 30 s.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
entities-runtime run the daemon (foreground)
|
|
32
|
+
entities-runtime status pairing + capabilities + last-seen
|
|
33
|
+
entities-runtime sessions recent requests handled (--limit N)
|
|
34
|
+
entities-runtime unpair --yes disconnect from +Ai
|
|
35
|
+
entities-runtime version print version
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`status` and `sessions` work without the daemon running — they hit
|
|
39
|
+
Supabase directly using the daemon token in
|
|
40
|
+
`~/.entities-runtime/state.json`.
|
|
41
|
+
|
|
42
|
+
## Architecture
|
|
43
|
+
|
|
44
|
+
See [`docs/architecture.md`](docs/architecture.md) for the full picture:
|
|
45
|
+
Supabase tables, RPC inventory, request lifecycle, and the cancel-watcher
|
|
46
|
+
flow.
|
|
47
|
+
|
|
48
|
+
## DiskGuard — Codex scratch-dir disk protection
|
|
49
|
+
|
|
50
|
+
Each Codex run gets a throwaway `CODEX_HOME` under the OS temp dir
|
|
51
|
+
(`entities-codex-<rand>`). Codex writes its `state_*.sqlite`, logs, caches
|
|
52
|
+
and shell snapshots there — typically 50–350 MB per run. codex-spawn now
|
|
53
|
+
deletes that dir on exit, but a `SIGKILL`, a crash, or an orphan left by a
|
|
54
|
+
previous runtime process can skip that path. On a dedicated host doing
|
|
55
|
+
thousands of runs, those leftovers once grew to ~158 GiB and filled the
|
|
56
|
+
disk (`ENOSPC`, repeated crashes).
|
|
57
|
+
|
|
58
|
+
**DiskGuard** is the safety net. Like a CCTV DVR overwriting the oldest
|
|
59
|
+
footage when the disk fills, it watches free space on the volume holding
|
|
60
|
+
the temp dir and, when usage crosses a high-water mark, deletes the
|
|
61
|
+
**oldest inactive** scratch dirs — oldest first — until usage drops back
|
|
62
|
+
below a low-water mark, leaving a buffer for the OS. It runs at startup, on
|
|
63
|
+
an interval, and opportunistically right before each new Codex run.
|
|
64
|
+
|
|
65
|
+
Safety guarantees: it only touches directories directly under the temp root
|
|
66
|
+
whose names match the configured prefix (realpath-validated); it never
|
|
67
|
+
deletes a dir owned by a live session (in-process, or one whose
|
|
68
|
+
`session.lock` PID is still alive) or one younger than the min-age guard;
|
|
69
|
+
and it removes symlink *entries* without following them, so the durable
|
|
70
|
+
`~/.codex` targets behind `sessions`/`auth.json` are never harmed.
|
|
71
|
+
|
|
72
|
+
Note: DiskGuard can only reclaim space by deleting scratch dirs it owns. If
|
|
73
|
+
a disk is full of *other* data it will evict what it can and log that it
|
|
74
|
+
couldn't reach the target rather than touching anything it doesn't own.
|
|
75
|
+
|
|
76
|
+
Configure via environment variables (defaults shown):
|
|
77
|
+
|
|
78
|
+
| Variable | Default | Meaning |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `DISKGUARD_ENABLED` | `true` | Master switch for the sweeper. Cleanup-on-exit still runs when `false`. |
|
|
81
|
+
| `DISKGUARD_HIGH_WATER_PCT` | `90` | Start evicting when volume usage reaches this %. |
|
|
82
|
+
| `DISKGUARD_LOW_WATER_PCT` | `80` | Stop evicting once usage drops below this %. Clamped below high-water. |
|
|
83
|
+
| `DISKGUARD_MIN_AGE_MINUTES` | `30` | Never evict a scratch dir younger than this. |
|
|
84
|
+
| `DISKGUARD_CHECK_INTERVAL_SECONDS` | `60` | Periodic sweep cadence. |
|
|
85
|
+
| `DISKGUARD_DRY_RUN` | `false` | Log what would be evicted without deleting anything. |
|
|
86
|
+
| `DISKGUARD_PREFIXES` | `entities-codex-` | Comma-separated dir-name prefixes eligible for eviction. |
|
|
87
|
+
| `DISKGUARD_TEMP_ROOT` | `os.tmpdir()` | Override the watched temp root (mainly for testing). |
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install
|
|
93
|
+
npm run build
|
|
94
|
+
node dist/cli.js
|
|
95
|
+
npm test # builds, then runs the node:test suite (see test/)
|
|
96
|
+
```
|