@hydra-acp/cli 0.1.44 → 0.1.46
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 +60 -6
- package/dist/cli.js +5726 -2916
- package/dist/index.d.ts +242 -7
- package/dist/index.js +2271 -182
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -215,7 +215,7 @@ hydra-acp daemon stop # stop running daemon
|
|
|
215
215
|
hydra-acp daemon restart # stop then start the daemon
|
|
216
216
|
hydra-acp daemon logs [-f] [-n N] # tail (default 50) or follow the daemon log
|
|
217
217
|
|
|
218
|
-
hydra-acp session [list
|
|
218
|
+
hydra-acp session [list] # list sessions
|
|
219
219
|
hydra-acp session kill <id> # close a live session (keeps the on-disk record so it can be resurrected)
|
|
220
220
|
hydra-acp session remove <id> # remove a session entirely (live or cold)
|
|
221
221
|
hydra-acp session export <id> [--out <file>|.]
|
|
@@ -235,7 +235,13 @@ hydra-acp extension [list] # list configured extensions and live
|
|
|
235
235
|
hydra-acp extension add <name> # add to config (--command, --args, --env, --disabled)
|
|
236
236
|
hydra-acp extension remove <name> # remove from config
|
|
237
237
|
hydra-acp extension start|stop|restart <n> # lifecycle on a running extension
|
|
238
|
-
hydra-acp extension
|
|
238
|
+
hydra-acp extension log <name> [-f] [-n] # tail (default 50) or follow an extension's log
|
|
239
|
+
|
|
240
|
+
hydra-acp transformer [list] # list configured transformers and live state
|
|
241
|
+
hydra-acp transformer add <name> # add to config (--command, --args, --env, --enabled; disabled by default)
|
|
242
|
+
hydra-acp transformer remove <name> # remove from config
|
|
243
|
+
hydra-acp transformer start|stop|restart <n> # lifecycle on a running transformer
|
|
244
|
+
hydra-acp transformer log <name> [-f] [-n] # tail (default 50) or follow a transformer's log
|
|
239
245
|
|
|
240
246
|
hydra-acp agent [list] # list agents in the registry
|
|
241
247
|
hydra-acp agent install <id> # pre-install an agent (else lazy on first use)
|
|
@@ -342,7 +348,7 @@ Every config-knob flag has an `HYDRA_ACP_FOO_BAR` env-var equivalent. Flag wins
|
|
|
342
348
|
|
|
343
349
|
`--model` is a one-shot override for the per-agent `defaultModels` entry in `~/.hydra-acp/config.json`. It only applies at fresh session creation — resurrect and `/hydra agent` switch ignore it (resurrected sessions stay on whatever model they were last using).
|
|
344
350
|
|
|
345
|
-
Action commands (`init`, `daemon`, `session`, `extension`, `agent`, `auth`, `cat`, `--help`, `--version`, `--rotate-token`) are not config knobs and are flag-only.
|
|
351
|
+
Action commands (`init`, `daemon`, `session`, `extension`, `transformer`, `agent`, `auth`, `cat`, `--help`, `--version`, `--rotate-token`) are not config knobs and are flag-only.
|
|
346
352
|
|
|
347
353
|
### Registry id resolution
|
|
348
354
|
|
|
@@ -425,12 +431,12 @@ While the daemon is running you can manage extensions without bouncing it:
|
|
|
425
431
|
```text
|
|
426
432
|
hydra-acp extension list
|
|
427
433
|
hydra-acp extension restart hydra-acp-slack
|
|
428
|
-
hydra-acp extension
|
|
434
|
+
hydra-acp extension log hydra-acp-slack --follow
|
|
429
435
|
```
|
|
430
436
|
|
|
431
437
|
`stop` suppresses the auto-restart backoff; the extension stays down until the next `start`, `restart`, or daemon bounce. `add`/`remove` are config-only — restart the daemon to apply.
|
|
432
438
|
|
|
433
|
-
**Trust model**:
|
|
439
|
+
**Trust model**: each extension receives its own per-process token scoped to that process's lifetime. The token grants the same read/write access to the daemon's REST and WSS surfaces as a logged-in client. Treat extensions as part of your trusted compute base — review extensions before installing and don't run untrusted code through this mechanism. See `cli/examples/client-observe.mjs` for an annotated reference implementation.
|
|
434
440
|
|
|
435
441
|
#### Optional extensions
|
|
436
442
|
|
|
@@ -484,7 +490,41 @@ hydra-acp extension start hydra-acp-archiver
|
|
|
484
490
|
|
|
485
491
|
See the [package README](https://github.com/smagnuso/hydra-acp-archiver#readme) for backend setup (Drive OAuth, filesystem path).
|
|
486
492
|
|
|
487
|
-
Per-extension config (env vars, args, custom command paths) goes in the same `extensions` block in `~/.hydra-acp/config.json` — see the snippet above. `hydra-acp extension
|
|
493
|
+
Per-extension config (env vars, args, custom command paths) goes in the same `extensions` block in `~/.hydra-acp/config.json` — see the snippet above. `hydra-acp extension log <name> -f` tails an extension's stdout/stderr if you need to debug.
|
|
494
|
+
|
|
495
|
+
### Transformers
|
|
496
|
+
|
|
497
|
+
Transformers are a second kind of daemon-managed process. Where an extension is a *client* — it observes broadcast events and sends prompts — a transformer is *middleware*: it sits inside the daemon's message pipeline and sees every in-flight ACP message before the daemon acts on it, in both directions.
|
|
498
|
+
|
|
499
|
+
```
|
|
500
|
+
client → daemon → [T1 → T2 → … → Tn] → agent
|
|
501
|
+
client ← daemon ← [Tn ← … ← T1] ← agent
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
This means a transformer can inspect every prompt before the LLM sees it and every response before it reaches clients or mutates daemon state (model, mode, history). It cannot do this invisibly — the chain is operator-visible and each transformer's intercepts are declared up front.
|
|
505
|
+
|
|
506
|
+
A transformer is configured in the same way as an extension but under a separate key. ```json
|
|
507
|
+
{
|
|
508
|
+
"transformers": {
|
|
509
|
+
"my-transformer": {
|
|
510
|
+
"command": ["node", "/path/to/my-transformer.mjs"]
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
"defaultTransformers": ["my-transformer"]
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
`defaultTransformers` lists transformer names applied to every new session, **in order** — the array is the pipeline. Each message passes through T1, then T2, then T3 before reaching the agent (or clients on the way back). Order matters when transformers interact: a prompt-rewriting transformer should come before a logging transformer so the logger sees the rewritten prompt, not the original. Individual sessions can override the chain via `_meta["hydra-acp"].transformers` on `session/new`. The daemon resolves names to their live connections at session-creation time; a transformer that is configured but not yet connected is silently skipped (fail-open).
|
|
518
|
+
|
|
519
|
+
Each transformer receives:
|
|
520
|
+
- the same env vars as extensions (`HYDRA_ACP_TOKEN`, `HYDRA_ACP_WS_URL`, etc.)
|
|
521
|
+
- a `HYDRA_ACP_TRANSFORMER_NAME` env var with its config key
|
|
522
|
+
|
|
523
|
+
A transformer process connects using its own token (same mechanism as extensions) and then calls `transformer/initialize` declaring the message kinds it wants to intercept. For each intercepted message the daemon calls `transformer/message` and waits for `{ action: "continue" }`. Future phases will add `stop` (block the message) and `processing` (transformer handles the request itself).
|
|
524
|
+
|
|
525
|
+
See `cli/examples/transformer-observe.mjs` for a working reference that logs all traffic and always continues, `cli/examples/transformer-edit.mjs` for one that modifies prompts before they reach the agent, and `cli/examples/transformer-lifecycle.mjs` for one that reacts to session lifecycle events (`session.opened`, `session.idle`, `session.closed`) and optionally emits a follow-up prompt when a session goes quiet.
|
|
526
|
+
|
|
527
|
+
**Trust model**: transformers receive the same per-process scoped token as extensions, but have structurally more access — they intercept traffic that no client ever sees. `transformer/initialize` and all transformer-specific methods are only callable with a transformer-kind token; an extension process that tries to call them receives `MethodNotFound`. Treat every entry in `transformers` as a higher-trust boundary than `extensions`.
|
|
488
528
|
|
|
489
529
|
The service token (stored at `~/.hydra-acp/auth-token`, mode 0600) is generated on `hydra-acp init` and required as `Authorization: Bearer <token>` for every REST call and as a WebSocket subprotocol or query parameter for `wss://.../acp`. The token never leaves `~/.hydra-acp/`.
|
|
490
530
|
|
|
@@ -593,6 +633,20 @@ GET /v1/agents # list known agents (registry + installed)
|
|
|
593
633
|
POST /v1/agents/:id/install # pre-install an agent
|
|
594
634
|
GET /v1/registry # current cached registry contents
|
|
595
635
|
POST /v1/registry/refresh # force refresh
|
|
636
|
+
|
|
637
|
+
GET /v1/extensions # list configured extensions and live state
|
|
638
|
+
POST /v1/extensions # register a new extension (takes effect immediately)
|
|
639
|
+
DELETE /v1/extensions/:name # unregister and stop an extension
|
|
640
|
+
POST /v1/extensions/:name/start
|
|
641
|
+
POST /v1/extensions/:name/stop
|
|
642
|
+
POST /v1/extensions/:name/restart
|
|
643
|
+
|
|
644
|
+
GET /v1/transformers # list configured transformers and live state
|
|
645
|
+
POST /v1/transformers # register a new transformer (takes effect immediately)
|
|
646
|
+
DELETE /v1/transformers/:name # unregister and stop a transformer
|
|
647
|
+
POST /v1/transformers/:name/start
|
|
648
|
+
POST /v1/transformers/:name/stop
|
|
649
|
+
POST /v1/transformers/:name/restart
|
|
596
650
|
```
|
|
597
651
|
|
|
598
652
|
Sessions are also reachable via `session/list` over ACP itself, for clients that prefer the protocol-native path.
|