@hydra-acp/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
@@ -209,7 +209,14 @@ hydra-acp daemon stop
209
209
  hydra-acp daemon status
210
210
 
211
211
  hydra-acp sessions # list sessions
212
- hydra-acp sessions kill <id> # terminate a session
212
+ hydra-acp sessions kill <id> # close a live session (keeps the on-disk record so it can be resurrected)
213
+ hydra-acp sessions rm <id> # remove a session entirely (live or cold)
214
+ hydra-acp sessions export <id> [--out <file>|.]
215
+ # write a session bundle (meta + history) to <file>,
216
+ # to a default-named file when --out=., or to stdout
217
+ hydra-acp sessions import <file>|- [--replace]
218
+ # import a bundle from <file> or stdin (-);
219
+ # --replace overwrites an existing lineage match
213
220
 
214
221
  hydra-acp extensions # list configured extensions and live state
215
222
  hydra-acp extensions add <name> # add to config (--command, --args, --env, --disabled)
@@ -264,6 +271,21 @@ Slash commands of the form `/hydra <verb> [args]` are intercepted by hydra befor
264
271
 
265
272
  These work from anywhere a session prompt can be typed — the TUI's input box, agent-shell, the slack thread composer, the browser chat composer. Hydra detects them server-side; clients send them as ordinary `session/prompt` requests.
266
273
 
274
+ ### Exporting and importing sessions
275
+
276
+ `hydra-acp sessions export` writes a session to a `*.hydra` JSON bundle (meta + history + optional prompt history). `hydra-acp sessions import` brings it back into the local daemon as a new cold session. Use this to archive a session before clearing it, share one with a teammate, restore from backup, or move work between machines without running both daemons live.
277
+
278
+ ```text
279
+ hydra-acp sessions export hydra_session_abc --out backup.hydra
280
+ hydra-acp sessions import backup.hydra # → new local id
281
+ hydra-acp sessions import backup.hydra # error: already imported
282
+ hydra-acp sessions import backup.hydra --replace # overwrites in place
283
+ ```
284
+
285
+ Each session carries a stable **`lineageId`** that survives every export/import hop, so the same bundle imported twice is detected as a duplicate — the second import errors with the existing local id. `--replace` overrides that and overwrites the existing local copy, killing any live session first and preserving the local `sessionId` so bookmarks (Slack threads, editor session links) keep resolving.
286
+
287
+ The first attach to an imported session is slow: hydra spawns a fresh agent, runs `session/new`, and feeds the imported history back in as a synthesized takeover transcript (same machinery as `/hydra switch`). Subsequent attaches use the normal `session/load` path. This is a text-level handover — the originating agent's internal state (tool-call chains, compacted earlier turns) isn't preserved, so the resumed conversation may be cognitively shallower than the original.
288
+
267
289
  ### Forwarding agent args (`hydra-acp launch <agent-id> ...`)
268
290
 
269
291
  Anything you put after `<agent-id>` in launcher mode is forwarded to the underlying agent's command. Hydra appends the extra args to the registry-provided spawn plan. Example:
@@ -318,7 +340,7 @@ When you ask hydra to spawn an agent (via `launch <id>`, `--agent-id`, or `HYDRA
318
340
  }
319
341
  ```
320
342
 
321
- `daemon.sessionIdleTimeoutSeconds` (default 30) controls how long a session with zero attached clients stays alive before the daemon closes it. The disk record stays so the session can be resurrected later via `session/load`. Set to `0` to disable.
343
+ `daemon.sessionIdleTimeoutSeconds` (default 3600 — one hour) controls how long a session with no recorded agent or user activity stays alive before the daemon closes it. Snapshot-shaped state pings (model/mode/title/commands) and bare attach/detach don't count as activity — only recordable broadcasts (prompts, agent chunks, tool calls, permission prompts) do, so persistent observer clients like the slack/notifier/approver/browser extensions can't pin a quiet session open. In-flight turns and unresolved permission requests defer the close until they settle. The disk record stays so the session can be resurrected later via `session/load`, at which point extensions re-attach automatically through their poll loops. Set to `0` to disable.
322
344
 
323
345
  `daemon.sessionRecentMinutes` (default 30) controls how far back `hydra-acp sessions` (and the `/v1/sessions` REST endpoint without `?all=true`) looks for cold (disk-only) sessions. Set to `0` to never list cold sessions.
324
346
 
@@ -511,7 +533,11 @@ All REST endpoints require `Authorization: Bearer <token>`.
511
533
  GET /v1/health # liveness
512
534
  GET /v1/sessions # list sessions
513
535
  POST /v1/sessions # create session (alternative to ACP session/new)
514
- DELETE /v1/sessions/:id # terminate
536
+ POST /v1/sessions/:id/kill # demote a live session to cold (keeps the on-disk record); idempotent
537
+ DELETE /v1/sessions/:id # remove a session entirely (live or cold)
538
+ GET /v1/sessions/:id/export # download a session bundle (*.hydra JSON; meta + history)
539
+ POST /v1/sessions/import # body { bundle, replace? } → { sessionId, importedFromSessionId, replaced }
540
+ # 409 with existingSessionId on a lineageId clash unless replace:true
515
541
  GET /v1/agents # list known agents (registry + installed)
516
542
  POST /v1/agents/:id/install # pre-install an agent
517
543
  GET /v1/registry # current cached registry contents