@av-pi-studio/server 0.0.10 → 0.0.11
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 +46 -16
- package/dist/.tsbuildinfo +1 -1
- package/dist/agent/agent-service.d.ts +3 -0
- package/dist/agent/agent-service.d.ts.map +1 -1
- package/dist/agent/agent-service.js +13 -1
- package/dist/agent/agent-service.js.map +1 -1
- package/dist/agent/provider-registry.d.ts.map +1 -1
- package/dist/agent/provider-registry.js +2 -0
- package/dist/agent/provider-registry.js.map +1 -1
- package/dist/agent/providers/pi/agent.d.ts +2 -0
- package/dist/agent/providers/pi/agent.d.ts.map +1 -1
- package/dist/agent/providers/pi/agent.js +3 -0
- package/dist/agent/providers/pi/agent.js.map +1 -1
- package/dist/agent/providers/pi/rpc-transport.d.ts +2 -0
- package/dist/agent/providers/pi/rpc-transport.d.ts.map +1 -1
- package/dist/agent/providers/pi/rpc-transport.js +10 -2
- package/dist/agent/providers/pi/rpc-transport.js.map +1 -1
- package/dist/config/daemon-config.d.ts.map +1 -1
- package/dist/config/daemon-config.js +3 -0
- package/dist/config/daemon-config.js.map +1 -1
- package/dist/daemon/bootstrap.d.ts +8 -0
- package/dist/daemon/bootstrap.d.ts.map +1 -1
- package/dist/daemon/bootstrap.js +23 -12
- package/dist/daemon/bootstrap.js.map +1 -1
- package/dist/daemon/dev-bootstrap.d.ts +4 -0
- package/dist/daemon/dev-bootstrap.d.ts.map +1 -1
- package/dist/daemon/dev-bootstrap.js +8 -3
- package/dist/daemon/dev-bootstrap.js.map +1 -1
- package/dist/daemon/dev-main.js +3 -6
- package/dist/daemon/dev-main.js.map +1 -1
- package/dist/daemon/main.js +8 -7
- package/dist/daemon/main.js.map +1 -1
- package/dist/logging/logger.d.ts +10 -4
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +23 -18
- package/dist/logging/logger.js.map +1 -1
- package/dist/terminal/terminal-manager.d.ts +4 -0
- package/dist/terminal/terminal-manager.d.ts.map +1 -1
- package/dist/terminal/terminal-manager.js +20 -8
- package/dist/terminal/terminal-manager.js.map +1 -1
- package/dist/ws/router.d.ts +8 -0
- package/dist/ws/router.d.ts.map +1 -1
- package/dist/ws/router.js +19 -0
- package/dist/ws/router.js.map +1 -1
- package/dist/ws/ws-server.d.ts +3 -0
- package/dist/ws/ws-server.d.ts.map +1 -1
- package/dist/ws/ws-server.js +15 -2
- package/dist/ws/ws-server.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -125,16 +125,34 @@ curl http://127.0.0.1:6767/api/health
|
|
|
125
125
|
|
|
126
126
|
### Dev daemon
|
|
127
127
|
|
|
128
|
-
`src/daemon/dev-main.ts` is a development entry that wires
|
|
129
|
-
`
|
|
128
|
+
`src/daemon/dev-main.ts` is a development entry that wires only a **minimal handler subset**
|
|
129
|
+
(`dev-bootstrap.ts`: agent list/archive/delete, workspaces/projects listing, providers, file
|
|
130
|
+
read/diff, schedule listing — no terminals, git ops, worktrees, chat, loops, or relay), the mock
|
|
131
|
+
provider, and in-memory state, and binds `0.0.0.0` with developer-friendly defaults. From the root:
|
|
130
132
|
|
|
131
133
|
```bash
|
|
132
134
|
npm run dev:daemon
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
>
|
|
136
|
-
>
|
|
137
|
-
> `dev-bootstrap.ts`
|
|
137
|
+
> `bootstrap.ts` (production) registers the **full** RPC surface — agents, terminals, git/worktrees/
|
|
138
|
+
> GitHub, files, service proxy, schedules/chat/loops, rewind, optional outbound relay — with the
|
|
139
|
+
> real provider and disk persistence. `dev-bootstrap.ts` stays intentionally minimal for fast local
|
|
140
|
+
> iteration and **must never grow to duplicate that surface**; `bootstrap.ts` must never import
|
|
141
|
+
> `dev-bootstrap.ts` (the reverse — `dev-bootstrap.ts` importing one shared helper,
|
|
142
|
+
> `wrapSessionEnvelope`, from `bootstrap.ts` — is fine and is what happens today).
|
|
143
|
+
|
|
144
|
+
### Docker
|
|
145
|
+
|
|
146
|
+
A production daemon image (multi-stage, compiles the native `node-pty` addon, ships `git` + the
|
|
147
|
+
bundled `pi` runtime) lives at `docker/daemon.Dockerfile`, with a compose file that also runs the
|
|
148
|
+
relay. From the repo root:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd docker && docker compose up --build # daemon :6767 + relay :7000
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`$PI_STUDIO_HOME` is `/data` (mount a volume); bind-mount your projects at `/workspace`. See
|
|
155
|
+
`docker/README.md` for the full env/volume/auth/security matrix.
|
|
138
156
|
|
|
139
157
|
---
|
|
140
158
|
|
|
@@ -156,6 +174,7 @@ All optional.
|
|
|
156
174
|
| `PI_STUDIO_PASSWORD` | _(unset)_ | Require this password for connections (bcrypt-checked) |
|
|
157
175
|
| `PI_STUDIO_HOSTNAMES` | `localhost,*.localhost` | Allowed `Host` header values (comma-separated, or `true` to allow all) |
|
|
158
176
|
| `PI_STUDIO_SERVER_ID` | _(persisted/generated)_ | Stable server identity |
|
|
177
|
+
| `PI_STUDIO_RELAY_ENABLED` | `false` | Opt into the outbound relay dial (env equivalent of `daemon.relay.enabled`; `1`/`true`/`yes`/`on`) |
|
|
159
178
|
| `PI_STUDIO_RELAY_ENDPOINT` | _(unset)_ | Relay server to dial outbound to when `daemon.relay.enabled` (`host:port`) |
|
|
160
179
|
| `PI_STUDIO_RELAY_USE_TLS` | `false` | Use `wss://` for the outbound relay dial (`1`/`true`/`yes`/`on`) |
|
|
161
180
|
| `PI_STUDIO_RELAY_PUBLIC_ENDPOINT` | _(unset)_ | Client-facing relay address, if different from the daemon's own dial target |
|
|
@@ -301,17 +320,19 @@ All state lives under `$PI_STUDIO_HOME/`. Every write goes through `AtomicStore`
|
|
|
301
320
|
(write-to-temp-then-rename) for crash safety.
|
|
302
321
|
|
|
303
322
|
```
|
|
304
|
-
config.json Daemon config (password hash, provider overrides, service proxy, …)
|
|
305
|
-
|
|
323
|
+
config.json Daemon config (password hash, provider overrides, relay, service proxy, …)
|
|
324
|
+
pi-studio.pid PID lock (prevents a second daemon owning this home)
|
|
325
|
+
server-id Stable server identity (plain UUID via randomUUID())
|
|
326
|
+
daemon-keypair.json Persistent Curve25519 keypair (pairing / outbound relay E2EE)
|
|
306
327
|
logs/ Rotating NDJSON log files (pino)
|
|
307
328
|
agents/
|
|
308
329
|
<sanitized-cwd>/
|
|
309
330
|
<agentId>.json Agent record (status, config, timeline seq, labels, …)
|
|
310
331
|
chat/rooms.json Chat rooms + messages
|
|
311
|
-
loops
|
|
332
|
+
loops/loops.json ALL loop records (single queued-write file, NOT one file per loop)
|
|
312
333
|
schedules/<scheduleId>.json Schedule records
|
|
313
|
-
projects.json
|
|
314
|
-
workspaces.json
|
|
334
|
+
projects/projects.json Project registry
|
|
335
|
+
projects/workspaces.json Workspace registry
|
|
315
336
|
```
|
|
316
337
|
|
|
317
338
|
All entity schemas use `.passthrough()` and optional fields — unknown/future fields from a newer
|
|
@@ -385,16 +406,24 @@ For a deeper subsystem reference, see [`AGENTS.md`](AGENTS.md) in this package a
|
|
|
385
406
|
|
|
386
407
|
## Logging
|
|
387
408
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
409
|
+
The daemon logs its full operational lifecycle through one `pino` logger created in the bootstrap
|
|
410
|
+
(`src/logging/logger.ts`): startup (home, config, serverId), agent recovery, WS client
|
|
411
|
+
connect/disconnect (with close code + duration), upgrade/auth rejections, every RPC (at `debug`,
|
|
412
|
+
with duration; failures at `warn`), agent create/turn lifecycle (prompt *sizes*, never contents),
|
|
413
|
+
terminal open/kill/exit, `pi` provider process spawn/exit, and relay dial events.
|
|
414
|
+
|
|
415
|
+
Output goes to **stdout always** — pretty on a TTY, NDJSON otherwise (so `docker logs` /
|
|
416
|
+
journald / PM2 work out of the box) — **plus** a rotating NDJSON file under
|
|
417
|
+
`$PI_STUDIO_HOME/logs/` in production (both destinations, never either/or). Level comes from
|
|
418
|
+
`PI_STUDIO_LOG_LEVEL` (`trace`|`debug`|`info`|`warn`|`error`|`fatal`|`silent`, default `info`);
|
|
419
|
+
`debug` adds per-RPC request lines, `trace` is the most verbose.
|
|
391
420
|
|
|
392
421
|
---
|
|
393
422
|
|
|
394
423
|
## Development
|
|
395
424
|
|
|
396
425
|
```bash
|
|
397
|
-
|
|
426
|
+
npx vitest run packages/server # run this package's Vitest suite
|
|
398
427
|
npm run typecheck # tsc -b across all packages
|
|
399
428
|
npm run lint # oxlint
|
|
400
429
|
npm run fmt:check # oxfmt --check
|
|
@@ -416,8 +445,9 @@ real wall-clock timers in tests — await real completion signals instead.
|
|
|
416
445
|
4. **All entity + wire schemas use `.passthrough()` and optional fields** — newer data must load on
|
|
417
446
|
older daemons.
|
|
418
447
|
5. **The wire protocol is append-only.** Never remove or narrow a field, never change a discriminant.
|
|
419
|
-
6. **`
|
|
448
|
+
6. **`bootstrap.ts` must never import `dev-bootstrap.ts`.** (The reverse — `dev-bootstrap.ts`
|
|
449
|
+
importing the shared `wrapSessionEnvelope` helper from `bootstrap.ts` — is fine and is what
|
|
450
|
+
happens today.)
|
|
420
451
|
7. **Binary frame codecs are cross-platform** (`Uint8Array`, no Node `Buffer`).
|
|
421
452
|
8. **`~` in `cwd` is expanded server-side** before it reaches a provider.
|
|
422
|
-
```
|
|
423
453
|
|