samagotchi 0.190.1 → 0.192.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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -1
  3. data/docs/architecture.md +13 -11
  4. data/docs/bundles.md +1 -1
  5. data/docs/cli.md +17 -6
  6. data/docs/configuration.md +6 -1
  7. data/docs/context.md +8 -1
  8. data/docs/internals/attached-context.md +3 -1
  9. data/docs/internals/inline-widgets.md +2 -1
  10. data/docs/internals/participants.md +1 -5
  11. data/docs/internals/peers.md +15 -3
  12. data/docs/internals/remote-sessions.md +5 -2
  13. data/docs/internals/session-lifecycle.md +233 -18
  14. data/docs/internals/web-frontend.md +107 -9
  15. data/docs/peers.md +3 -1
  16. data/docs/plugins.md +2 -1
  17. data/docs/scheduling.md +31 -7
  18. data/docs/sessions.md +12 -12
  19. data/docs/sub-agent.md +1 -1
  20. data/docs/testing.md +1 -2
  21. data/docs/thin-clients.md +98 -12
  22. data/lib/samagotchi/bridge.rb +3 -4
  23. data/lib/samagotchi/bundles/mcp/manifest.yml +4 -2
  24. data/lib/samagotchi/bundles/mcp/plugin.rb +7 -398
  25. data/lib/samagotchi/bundles/mcp/server_config.rb +158 -0
  26. data/lib/samagotchi/bundles/mcp/sign_in.rb +261 -0
  27. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  28. data/lib/samagotchi/client_id.rb +2 -19
  29. data/lib/samagotchi/compat.rb +1 -7
  30. data/lib/samagotchi/config.rb +3 -0
  31. data/lib/samagotchi/context_command.rb +5 -1
  32. data/lib/samagotchi/context_sources.rb +28 -0
  33. data/lib/samagotchi/continue_intent.rb +23 -43
  34. data/lib/samagotchi/delivery.rb +1 -5
  35. data/lib/samagotchi/hold_stop.rb +5 -2
  36. data/lib/samagotchi/participants.rb +13 -5
  37. data/lib/samagotchi/peer_say.rb +29 -14
  38. data/lib/samagotchi/plugin/sessions.rb +9 -5
  39. data/lib/samagotchi/schedule_command.rb +6 -1
  40. data/lib/samagotchi/schedules/prune_part.rb +162 -41
  41. data/lib/samagotchi/schedules.rb +32 -15
  42. data/lib/samagotchi/send_command.rb +6 -6
  43. data/lib/samagotchi/session.rb +7 -0
  44. data/lib/samagotchi/session_access/ask.rb +9 -3
  45. data/lib/samagotchi/session_access/exchange.rb +6 -2
  46. data/lib/samagotchi/session_access/local.rb +103 -32
  47. data/lib/samagotchi/session_access/remote.rb +10 -9
  48. data/lib/samagotchi/session_access/remote_peers.rb +2 -2
  49. data/lib/samagotchi/session_access.rb +17 -7
  50. data/lib/samagotchi/session_chain/delete.rb +100 -47
  51. data/lib/samagotchi/session_chain/delete_preview.rb +9 -5
  52. data/lib/samagotchi/session_chain/successor.rb +78 -0
  53. data/lib/samagotchi/session_continue.rb +112 -42
  54. data/lib/samagotchi/session_inbox.rb +1 -1
  55. data/lib/samagotchi/session_inbox_delivery.rb +111 -25
  56. data/lib/samagotchi/session_lifecycle/allowed.rb +20 -1
  57. data/lib/samagotchi/session_lifecycle/reading.rb +9 -3
  58. data/lib/samagotchi/session_lifecycle.rb +17 -2
  59. data/lib/samagotchi/session_manager/delivery.rb +61 -29
  60. data/lib/samagotchi/session_manager/emptiness.rb +5 -2
  61. data/lib/samagotchi/session_manager/lifecycle.rb +68 -19
  62. data/lib/samagotchi/session_manager/listing.rb +2 -1
  63. data/lib/samagotchi/session_manager/removal.rb +67 -13
  64. data/lib/samagotchi/session_manager/spawn.rb +16 -9
  65. data/lib/samagotchi/session_manager.rb +4 -0
  66. data/lib/samagotchi/session_retention.rb +28 -7
  67. data/lib/samagotchi/session_row.rb +2 -0
  68. data/lib/samagotchi/session_transition.rb +361 -0
  69. data/lib/samagotchi/sessions_command.rb +1 -1
  70. data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
  71. data/lib/samagotchi/tools/cancel_schedule.rb +10 -6
  72. data/lib/samagotchi/version.rb +1 -1
  73. data/lib/samagotchi/web/app.rb +13 -3
  74. data/lib/samagotchi/web/ask_create.rb +138 -0
  75. data/lib/samagotchi/web/ask_routes.rb +56 -9
  76. data/lib/samagotchi/web/last_ask.rb +78 -0
  77. data/lib/samagotchi/web/peer_routes.rb +5 -2
  78. data/lib/samagotchi/web/public/answer_refs.js +3 -9
  79. data/lib/samagotchi/web/public/answer_write.js +28 -0
  80. data/lib/samagotchi/web/public/app.js +72 -96
  81. data/lib/samagotchi/web/public/block_fix.js +30 -12
  82. data/lib/samagotchi/web/public/chains.js +3 -1
  83. data/lib/samagotchi/web/public/command_list.js +5 -3
  84. data/lib/samagotchi/web/public/composer.js +9 -6
  85. data/lib/samagotchi/web/public/composer_mount.js +18 -11
  86. data/lib/samagotchi/web/public/draft_keys.js +10 -0
  87. data/lib/samagotchi/web/public/drafts.js +278 -0
  88. data/lib/samagotchi/web/public/owner_claim.js +7 -12
  89. data/lib/samagotchi/web/public/prompt_history.js +6 -0
  90. data/lib/samagotchi/web/public/send_turn.js +51 -20
  91. data/lib/samagotchi/web/public/session_actions.js +80 -16
  92. data/lib/samagotchi/web/public/session_prefs.js +9 -3
  93. data/lib/samagotchi/web/public/session_view.js +7 -2
  94. data/lib/samagotchi/web/public/turn_events.js +0 -2
  95. data/lib/samagotchi/web/public/unqueue.js +22 -9
  96. data/lib/samagotchi/web/public/viewer_self.js +1 -6
  97. data/lib/samagotchi/web/public/views.js +12 -1
  98. data/lib/samagotchi/web/session_access_routes.rb +11 -5
  99. data/lib/samagotchi/web/session_control.rb +8 -1
  100. data/lib/samagotchi/web/session_create.rb +51 -34
  101. data/lib/samagotchi/web/session_hub.rb +52 -36
  102. data/lib/samagotchi/web/session_summary.rb +45 -7
  103. data/lib/samagotchi/web/start_dir.rb +6 -4
  104. data/lib/samagotchi/worker_boot.rb +28 -6
  105. data/lib/samagotchi/worker_presence.rb +22 -6
  106. metadata +10 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77aeed37eaf5c2f38aa322093568ec409ed14b7da71edd1f07ed84f1b0a5895b
4
- data.tar.gz: 0c393097b0e2a9a070bec87976e6e1ab34d81e3bb94c93dbf23e415cff348a5e
3
+ metadata.gz: 228161de4fb614d97b4240e1f62444b5f3cb1cbba6df18cf4477f69d95b96828
4
+ data.tar.gz: '0891bd0649800d9cd0f7c81009c6378a650caff0dccf2a3cd5242fa53a4e1d9b'
5
5
  SHA512:
6
- metadata.gz: 26f9472dbc97b6cdda56c4fcac3446275b8f97d8677b2bc6f753f621d590f0ec56057a01dff03ae5472110868369fcb0dd33c285e871b3216424285fa32a8da2
7
- data.tar.gz: d86525428d4e6a6fcc78cbb08ce6f695766d4b849b7f01fc9b3e9bf33526f29d40a1766bcc2a417ddb7b6622a80255fe234c359f2f2ac189a6f68f9c472d9bd4
6
+ metadata.gz: 62f39f21d2daf2dd9af94c3ef70bfd6bdad52202add14653b0013a407974556a66517a2dd492a4e14d9624c2d88f234fe36401eba35604da2aa2ad8f604f76fe
7
+ data.tar.gz: eb2f2a67cd5b5422280650c68d8fb706d3b98cdd828777688004e78ca8170f8d9145ba833e4f4cf212a97577291b1a57dee51dc92b04a1548b5aca54f9632bd7
data/CHANGELOG.md CHANGED
@@ -8,6 +8,64 @@ and commands may change between minor versions. How releases are made:
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.192.0] - 2026-11-28
12
+
13
+ ### Added
14
+
15
+ - Phone Shortcuts get three flows: a new session answered in one call (`POST /api/sessions` with `reply_for`,
16
+ `timeout` or `request_id`; set `web.ask_dir` and the Shortcut can leave out the folder), `POST
17
+ /api/sessions/last/ask` for the session you last asked from your phone (following continues), and a recent-sessions
18
+ list without delegates (`GET /api/sessions/summaries?delegates=0`). docs/thin-clients.md has an iOS Shortcut recipe
19
+ with a New / Last / Pick menu.
20
+
21
+ ### Changed
22
+
23
+ - Each session keeps its own draft in the web composer: text typed in one session no longer shows in another, a pick or
24
+ quote goes into the open session's draft, and + new has its own. The draft's text survives a reload in this browser;
25
+ attached images don't.
26
+ - Continuing a session moves its draft to the new link, even if you are in another session when it finishes; the new
27
+ link gets the opener only when there was no draft. The "Restore draft" button is gone.
28
+ - Stopping a session that is being continued, deleted or archived is refused right away and says what to do
29
+ ("session ab12cd34 is being continued as 7b2d41aa-…: stop that one") instead of waiting 10 seconds; in the web the
30
+ toast offers Open on the new link. A refused stop no longer ends the running turn.
31
+ - A participant's client id from chi 0.171 and before (`review:<id>`) is no longer read as a participant's; such turns in
32
+ old sessions show as automatic.
33
+
34
+ ### Fixed
35
+
36
+ - `chi send --new --continues last:<id>` (or a chain schedule's firing) racing another continue of the same chain no
37
+ longer fails with "was continued as …"; it follows to the new link.
38
+ - chi web no longer shows a session as stopped while a one-turn `chi -p` run or a delete holds it, and a worker being
39
+ stopped no longer shows as connected (its worker badge, open card and question go as the stop lands).
40
+ - `chi schedule cancel` (and the `cancel_schedule` tool) says when the schedule it removes was what kept a pruned chain
41
+ reachable from its first session, and names the newest link to send to; before, later sends to the first session
42
+ landed there silently.
43
+ - A block fixed in an answer that a hook's display replaced is redrawn right away, not on the next reload; a live
44
+ answer's bubble shows its time on hover like a reloaded one.
45
+ - A failed block whose fix couldn't be shown no longer stays at "asking for a fix…": it offers Ask in chat.
46
+
47
+ Update with `chi update` (mcp 0.9.3).
48
+
49
+ ## [0.191.0] - 2026-11-27
50
+
51
+ ### Changed
52
+
53
+ - Continuing, deleting, pruning, stopping and archiving a session no longer race each other: each waits briefly for
54
+ the other change to finish, then goes on or is refused, naming what holds the session ("session ab12cd34 is being
55
+ deleted; try again in a moment").
56
+ - A message sent while its session is being continued is no longer lost: `chi send` and thin-client asks retry and
57
+ reach the new link; a schedule's firing skips that tick; `chi peer say`/`pair` and `chi context push` are refused,
58
+ naming the new link to send to.
59
+
60
+ ### Fixed
61
+
62
+ - Schedule pruning no longer stalls partway down a chain when one session can't go yet: it stops there, shows
63
+ `pruning held at …` in `chi schedule list` (and why in `show`), and tries again on the next tick.
64
+ - A child's report waking its parent no longer undoes a stop of that parent that is in progress.
65
+ - A stop or an archive no longer slips into the middle of a continue or a delete: `chi sessions stop`, the web's
66
+ stop and an archive wait (up to 10 s) for the change to finish, then go on or are refused in its words.
67
+ - Retention and a scratch session's cleanup no longer delete a session in the middle of a continue.
68
+
11
69
  ## [0.190.1] - 2026-11-26
12
70
 
13
71
  ### Fixed
@@ -6966,7 +7024,9 @@ and long-lived sessions.
6966
7024
  - A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
6967
7025
  hotkey panel that send selected text or the clipboard to your sessions.
6968
7026
 
6969
- [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.190.1...HEAD
7027
+ [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.192.0...HEAD
7028
+ [0.192.0]: https://github.com/dm1try/samagotchi/compare/v0.191.0...v0.192.0
7029
+ [0.191.0]: https://github.com/dm1try/samagotchi/compare/v0.190.1...v0.191.0
6970
7030
  [0.190.1]: https://github.com/dm1try/samagotchi/compare/v0.190.0...v0.190.1
6971
7031
  [0.190.0]: https://github.com/dm1try/samagotchi/compare/v0.189.0...v0.190.0
6972
7032
  [0.189.0]: https://github.com/dm1try/samagotchi/compare/v0.188.0...v0.189.0
data/docs/architecture.md CHANGED
@@ -247,7 +247,7 @@ agent logic and can be used without any terminal rendering; the UI is a thin lay
247
247
  | UI | `Samagotchi::TerminalUI`, `TerminalUI::AttachLauncher` / `AttachedLoop` | The attached TUI: rendering (ANSI, spinner, status line) and the terminal's own commands over the worker's Bridge. `TerminalUI`: the `--non-interactive` one-shot host, which delegates all core work to its `Engine`. |
248
248
  | Model loops and adapters | `KernelLoop`, `LLM::ChatLoop`, `Samagotchi::Client`, `LLM::OpenAIChat`, `LLM::AnthropicMessages`, `LLM::HTTP` | The model↔tool loops and the HTTP adapters they talk through (see "Model loops and adapters"). |
249
249
  | Bridge (SSE/HTTP) ([internals/bridge.md](internals/bridge.md)) | `Samagotchi::Bridge`, `SessionManager` | The **single live client transport**: an SSE read stream + HTTP POST turn/cancel/answer surface that attaches to a worker's existing `Engine` through its event log, turn state, question desk and steer cut (`Engine#event_log`, `#turn_state`, `#question_desk`, `#steer_cut`, which the Worker hands it). Every session worker starts it (bound `127.0.0.1`, localhost-only), and it answers only a request that names its secret (`X-Chi-Bridge`, from the worker's 0600 `bridge.json`). |
250
- | Web (Rack) | `Samagotchi::Web::App`, `SessionManager` | Single-port `127.0.0.1:4567` control plane via `rack`+`webrick` (serve `index.html` + `/api/*`). With `web.host: lan` (or one of this machine's IPv4 addresses) the server also listens on that address, where every request needs the access token, this machine's on loopback too (`App#token_gate`: the `chi_token` cookie, on loopback a value derived from the token (`Token.loopback_cookie`), or `Authorization: Bearer`; chi web prints a `Local:` link with a one-time code; [CLI](cli.md#chi-web-on-your-phone)). Experimental: behind an auth proxy (`web.public_url`, `Web::ProxyGate`) every request needs the token, this machine's too, and one that came through the proxy also the configured identity header for the owner ([configuration.md](configuration.md#behind-an-auth-proxy)). A request goes through, in order: the Host check (`local_host_header?`: loopback names, the LAN address, the public host), the cross-site check (`cross_site?`: Origin this server's or the public origin, no `Sec-Fetch-Site` cross-site/same-site on a POST or `/api`), the frame check (`framed?`: a frame/embed/object load from another origin, 403 `framed`; every HTML answer carries `X-Frame-Options: DENY` and `frame-ancestors 'none'; frame-src 'none'`, so a page's own frames can't navigate either), the token gate (`token_gate` → `principal_for`, `proxied_principal` for a proxied request; the `?token=` / `POST /api/token` trade sets the cookie, `__Host-chi_token` through the proxy; with `web.public_url` a direct request takes Bearer only, and with it or LAN mode chi's token-less `/api/info` probe gets `probe_info`), then the route's permission (`Principal#permits?`). It talks to each worker's Bridge (`App#relay`, `bridge_get`; `/stream` proxies it) and reads the session files; no `Engine` of its own. Markdown (`web.markdown`) is rendered here only (`Web::MarkdownRenderer`): the answers it serves, card bodies, and `POST /api/render` for a text the page already shows. `App` keeps the gate, `ROUTES` and the helpers the handlers share; its handlers live in mixins it includes, each a `Web::` module with private methods: `SessionAccessRoutes` (`web/session_access_routes.rb`), `ParticipantAccess` (`web/participant_access.rb`), `ParticipantsAdmin` (`web/participants_admin.rb`), `ParticipantReview` (`web/participant_review.rb`), `MessageDisplay` (`web/message_display.rb`), `SessionShow` (`web/session_show.rb`), `SessionCreate` (`web/session_create.rb`), `SessionControl` (`web/session_control.rb`), `PushRoutes` (`web/push_routes.rb`) and `ProxyGate` (`web/proxy_gate.rb`). Exact paths in `GATE_FREE_PATHS` are served before the token gate (the fragment trade's script, and the Home Screen app's manifest, service worker and icons). `bin/chi web` entrypoint. |
250
+ | Web (Rack) | `Samagotchi::Web::App`, `SessionManager` | Single-port `127.0.0.1:4567` control plane via `rack`+`webrick` (serve `index.html` + `/api/*`). With `web.host: lan` (or one of this machine's IPv4 addresses) the server also listens on that address, where every request needs the access token, this machine's on loopback too (`App#token_gate`: the `chi_token` cookie, on loopback a value derived from the token (`Token.loopback_cookie`), or `Authorization: Bearer`; chi web prints a `Local:` link with a one-time code; [CLI](cli.md#chi-web-on-your-phone)). Experimental: behind an auth proxy (`web.public_url`, `Web::ProxyGate`) every request needs the token, this machine's too, and one that came through the proxy also the configured identity header for the owner ([configuration.md](configuration.md#behind-an-auth-proxy)). A request goes through, in order: the Host check (`local_host_header?`: loopback names, the LAN address, the public host), the cross-site check (`cross_site?`: Origin this server's or the public origin, no `Sec-Fetch-Site` cross-site/same-site on a POST or `/api`), the frame check (`framed?`: a frame/embed/object load from another origin, 403 `framed`; every HTML answer carries `X-Frame-Options: DENY` and `frame-ancestors 'none'; frame-src 'none'`, so a page's own frames can't navigate either), the token gate (`token_gate` → `principal_for`, `proxied_principal` for a proxied request; the `?token=` / `POST /api/token` trade sets the cookie, `__Host-chi_token` through the proxy; with `web.public_url` a direct request takes Bearer only, and with it or LAN mode chi's token-less `/api/info` probe gets `probe_info`), then the route's permission (`Principal#permits?`). It talks to each worker's Bridge (`App#relay`, `bridge_get`; `/stream` proxies it) and reads the session files; no `Engine` of its own. Markdown (`web.markdown`) is rendered here only (`Web::MarkdownRenderer`): the answers it serves, card bodies, and `POST /api/render` for a text the page already shows. `App` keeps the gate, `ROUTES` and the helpers the handlers share; its handlers live in mixins it includes, each a `Web::` module with private methods: `SessionAccessRoutes` (`web/session_access_routes.rb`), `ParticipantAccess` (`web/participant_access.rb`), `ParticipantsAdmin` (`web/participants_admin.rb`), `ParticipantReview` (`web/participant_review.rb`), `MessageDisplay` (`web/message_display.rb`), `SessionShow` (`web/session_show.rb`), `SessionCreate` (`web/session_create.rb`), `AskCreate` (`web/ask_create.rb`: a create that answers its first turn), `SessionControl` (`web/session_control.rb`), `PushRoutes` (`web/push_routes.rb`) and `ProxyGate` (`web/proxy_gate.rb`). Exact paths in `GATE_FREE_PATHS` are served before the token gate (the fragment trade's script, and the Home Screen app's manifest, service worker and icons). `bin/chi web` entrypoint. |
251
251
  | Sessions | `Samagotchi::Session`, `SessionManager` | File-based `~/.local/state/samagotchi/sessions/<uuid>.json` + sidecar `input/`/`output/`; retention (14d/500) + ordering (`updated_at desc`). |
252
252
 
253
253
  - `bin/chi` in one-shot mode (`--non-interactive`, see `LaunchMode` above) builds `TerminalUI`.
@@ -504,23 +504,24 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
504
504
  | Route | Permission | Body / params | Answer | Refusals |
505
505
  |---|---|---|---|---|
506
506
  | `GET /api/sessions/resolve?id=` | owner | an id or a unique prefix | 200 `{id}` | 404 `not_found`; 400 `ambiguous_id` with `ids` |
507
- | `GET /api/sessions/summaries` | owner | `dir` (a folder: its project; none: every project), `cwd`, `live=1`, `archived=1`, `tests=0`, `sort`, `order`, `limit` | 200: the rows `chi sessions list` prints (`SessionRow#to_summary_h`, 28 keys in a fixed order: `status`, `live`, `busy`, `owner`, `recap`, `ctx_pct`, `waiting`, `waiting_id`, `title`, `preview`, …) | 400 `invalid_dir`, `invalid_cwd` |
507
+ | `GET /api/sessions/summaries` | owner | `dir` (a folder: its project; none: every project), `cwd`, `live=1`, `archived=1`, `tests=0`, `delegates=0` (no delegates or `chi scratch` sessions, counted before `limit`), `sort`, `order`, `limit` | 200: the rows `chi sessions list` prints (`SessionRow#to_summary_h`, 28 keys in a fixed order: `status`, `live`, `busy`, `owner`, `recap`, `ctx_pct`, `waiting`, `waiting_id`, `title`, `preview`, …) | 400 `invalid_dir`, `invalid_cwd` |
508
508
  | `GET /api/projects?dir=` | owner | optional page-scope folder | 200: project rows (`Web::ProjectList`: the hub's projects plus the start project and current project, even without sessions) with counts, roots, default/current marks; no `dir`: no current project | 400 `invalid_dir`; 503 `no_hub` |
509
509
  | `POST /api/projects` | owner | `{dir}` (absolute folder; `~` and `~/` expand against the server's home) | 200 `{outcome, root, dir}` (`created`, `already_marked`, or `git`) | 400 `invalid_json`, `invalid_dir`; 422 `above_home`, `write_failed` |
510
510
  | `POST /api/sessions` (more fields) | owner | `toolkit`, `tools`, `no_tools`, `parent_answers`; `driver` (`agent:<name>`, the new session's driver); `client_id` (`cli:send`/`cli:answer`/`agent:<name>`: the first line is checked as chi send checks it); `check_vision: true` (images follow) | 201 adds `model_warning`, `parent_answers_warning` (a level looser than config.yml's, capped) and `first_turn_id` (the id the prompt it starts with gets for its turn; null for an `idle` create); with a `first_turn_id`, a wait `token` for that turn (none for an `idle` create) | 400 `invalid_toolkit`, `invalid_parent_answers`, `invalid_continues` (beside `continues`); 403 `parent_answers_refused`, `parent_continue_refused`; 422 `no_vision` |
511
- | `POST /api/sessions/:id/turn` (more fields) | owner | `client_id` as above; `check_vision: true` with `images` | as before | 403 `parent_answers_refused`, `parent_continue_refused`; 422 `no_vision` |
511
+ | `POST /api/sessions` (answered: any of `reply_for`, `timeout`, `request_id`) | owner | the ask's fields (`prompt`, `timeout`, `client_id`, `request_id`, `reply_for`) and the create's; `dir` optional: else `web.ask_dir` (`Config.get` per create, `StartDir.resolve(from: :ask_config)`), else the start folder. A `request_id` names the session (`SessionInbox.enqueued_id_for("create:" + key)`, `AskCreate::LOCKS` per id): a retry spawns nothing | 201: the ask's answer (as `POST …/ask`'s 200) + `session_id`, `created` (false: a retry's), `model_warning`, `parent_answers_warning`; the session spawns idle with the prompt as its preview, then `AskRoutes#run_ask`; records `last` (`Web::LastAsk`) unless a parent's line ([thin-clients.md](thin-clients.md#a-new-session-in-one-call)) | 400 `invalid_ask` (also beside `idle` or `continues`), `invalid_dir` (`web.ask_dir` not a folder), the ask's and the create's 400s, nothing spawned; after the spawn the ask's refusals keep their code and carry `session_id`, `created` |
512
+ | `POST /api/sessions/:id/turn` (more fields) | owner | `client_id` as above; `check_vision: true` with `images` | as before | 403 `parent_answers_refused`, `parent_continue_refused`; 422 `no_vision`; 409 `link_continued` (`successor_id`) or `transition_busy` while a transition holds the session's lock (every sender: `SessionInbox::Hold`, internals/session-lifecycle.md) |
512
513
  | `POST /api/sessions/:id/wait/prepare` | owner | `question_id` (absent: the pending one; `null`: none), `turn`, `created`, `busy` (+ `queue`) | 200 `{session_id, cursor, baseline: {messages, question_id, last_turn}, own_turn, known_turn, running, live, settled, last_turn_id}` (`WaitStart`) | 409 `busy`, `waiting` (`SendCommand::Busy`'s words, and its fields: `question`, `parent_strategy`) |
513
514
  | `POST /api/sessions/:id/wait` | owner | `cursor`, `baseline`, `turn`, `queued`, `ended_before`, `owner_grace`, `timeout` (capped at 30 s); or `{token, timeout}` (a wait token, `SessionAccess::Exchange::Token`: the answer adds `session_id`, and `token` again while the status is `timeout`; a token beside the other fields, another session's, one that isn't one or a participant's: 400 `invalid_wait`) | 200: `ReplyWait::Result`'s fields (`status`: `done`, `waiting_for_answer`, `no_reply`, `error`, `stopped`, `worker_gone`, or `timeout`: ask again; `text`, `file`, `question` as `PendingQuestion#to_file`, `outcome`, `limit`, `error_kind`, `retryable`, `cancel_reason`, `stopped_by`, `kept_steps`, `turn_id`, `origin`; never the session) and `parent_strategy` `{name, allowed, origin}` (`ParentReport.strategy_for`, this server's config.yml) | 400 `invalid_wait`; 503 `server_stopping` |
514
- | `POST /api/sessions/:id/ask` | owner | `prompt` (16 KiB), `timeout` (default and most 30 s), `queue` (default `true`: a running session queues it as its own turn; `false` refuses it), `client_id` (absent: `web:unnamed`; `cli:send`'s `/continue yes` goes in as `cli:answer` and is parent-gated as on `…/turn`), `request_id` (optional, 1-128 printable ASCII, messages only: a retry with it answers the first ask's turn, `SessionInbox.enqueued_id_for`) | 200: the wait's fields + `session_id` (where it ran), `asked` (the id given, when another link ran it), `token` when the status is `timeout`, `request_id` echoed when given; 200 `{status: command, session_id}` for a session command (`/continue yes` with an offer standing answers the continued turn's fields instead). The whole call answers within `AskRoutes::ASK_MAX_SECONDS` (35) (`Web::AskRoutes`, `SessionAccess::Ask`, [thin-clients.md](thin-clients.md)) | 404 `not_found`; 400 `ambiguous_id`, `missing_fields`, `invalid_prompt`, `local_command`, `invalid_ask` (also a `request_id` on a session command); 403 `parent_continue_refused`, `parent_answers_refused`; 409 `busy`, `waiting` (neutral words, Busy's fields), `continuing`, `owned_by_tui`, `enqueued_id_conflict` (the same `request_id`, another prompt, a turn the session no longer names but the worker remembers), the turn route's delivery refusals (`queue_unavailable`, …); 504 `worker_timeout`; 503 `server_stopping` |
515
+ | `POST /api/sessions/:id/ask` | owner | `:id` may be `last` (`Web::LastAsk.target`: the session the owner's last answered ask or answered create went to, kept in `last_ask.json` beside the sessions folder, following continues; gone or archived with no successor: the newest not scratch, delegate, `driver`, test run or archived; none: 404 `not_found`; a participant's: 404 at the gate; no `…/last/wait`); `prompt` (16 KiB), `timeout` (default and most 30 s), `queue` (default `true`: a running session queues it as its own turn; `false` refuses it), `client_id` (absent: `web:unnamed`; `cli:send`'s `/continue yes` goes in as `cli:answer` and is parent-gated as on `…/turn`), `request_id` (optional, 1-128 printable ASCII, messages only: a retry with it answers the first ask's turn, `SessionInbox.enqueued_id_for`) | 200: the wait's fields + `session_id` (where it ran), `asked` (the id given, when another link ran it), `token` when the status is `timeout`, `request_id` echoed when given; 200 `{status: command, session_id}` for a session command (`/continue yes` with an offer standing answers the continued turn's fields instead). The whole call answers within `AskRoutes::ASK_MAX_SECONDS` (35) (`Web::AskRoutes`, `SessionAccess::Ask`, [thin-clients.md](thin-clients.md)) | 404 `not_found`; 400 `ambiguous_id`, `missing_fields`, `invalid_prompt`, `local_command`, `invalid_ask` (also a `request_id` on a session command); 403 `parent_continue_refused`, `parent_answers_refused`; 409 `busy`, `waiting` (neutral words, Busy's fields), `continuing`, `owned_by_tui`, `enqueued_id_conflict` (the same `request_id`, another prompt, a turn the session no longer names but the worker remembers), the turn route's delivery refusals (`queue_unavailable`, …); 504 `worker_timeout`; 503 `server_stopping` |
515
516
  | `POST /api/mcp` (`GET`, `DELETE`) | owner | one JSON-RPC message of MCP (112 KiB: a 16 KiB prompt JSON-escaped), either revision: the current one with `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers matching the body, the earlier one with the `Mcp-Session-Id` its `initialize` handed out (and an `MCP-Protocol-Version`, if any, that chi serves) | 200 the JSON-RPC answer (a tool's refusal is a result with `isError`), 202 for a notification; `GET` 405 (`Allow: POST, DELETE`, no stream), `DELETE` 200. Each call within `McpServer::Tools::SLICE` (25 s) (`Web::McpRoute`, `McpServer::Http`, [mcp-server.md](mcp-server.md)) | 400 `-32020` (headers unlike the body), `-32022` (an unsupported revision), `-32700` (not JSON or not UTF-8; with the request's id when one can be read)/`-32600` (not an object: a batch is one), `Missing session ID`, an unsupported legacy `MCP-Protocol-Version`; 404 `-32601`; the gate's 401 adds `WWW-Authenticate: Bearer` here |
516
517
  | `POST /api/sessions/:id/answer` (`wait`) | owner | `wait: N` (seconds, at most 30) beside `id`, `selected`, `freeform` | 200 `{status: answered, session_id, id, reply: {the wait's fields, token while it is timeout}}`; a question answered elsewhere first: 200 `{status: not_pending, answered_here: false, …, reply}` (as `chi answer` still waits); a wait that fails after the answer went in: 200 with that `status` and `wait_error` `{error: server_stopping \| not_found \| wait_failed, detail}` in place of `reply`; without `wait` every answer is as before | 400 `invalid_wait`; 404 |
517
518
  | `POST /api/sessions/:id/notes` | owner | `text`, `source` (default `cli`, never `broadcast`) | 200 `{status: queued \| waits, session_id, queued}` (`NoteDelivery`) | 409 `owned_by_tui` (`status: refused`); 400 `note_rejected`, `missing_fields`, `invalid_source` |
518
519
  | `POST /api/sessions/:id/context` (more bodies) | owner | `{name, push: true, why, hint}` or `{name, cmd, every, why, hint}` beside the page's `{url, why, hint}`; `added_by` `cli`/`agent` (else `web`); `movable` (any body) | 201 `{status: attached, name, movable}` | 400 `invalid_source`; 409 `exists` |
519
- | `POST /api/sessions/:id/context/:name/push` | owner | `text`, `summary`, `wake`, `hint` (a source's JSON output, checked the same way) | 200 `{status: pushed, name, before, revision, changed}` | 404 `not_found`; 409 `not_push`; 410 `context_continued` (`next_id`); 400 `invalid_text` |
520
+ | `POST /api/sessions/:id/context/:name/push` | owner | `text`, `summary`, `wake`, `hint` (a source's JSON output, checked the same way) | 200 `{status: pushed, name, before, revision, changed}` | 404 `not_found`; 409 `not_push`; 410 `context_continued` (`next_id`, `in_flight` while its continue runs); 423 `context_busy` (another change holds its transition lock); 400 `invalid_text` |
520
521
  | `GET /api/sessions/:id/peers` | owner | | 200 `{peers: [{name, label, paired_at, from, address, can_send, messages, exchanges}]}`: one row per mailbox folder, its newest 20 messages with their receipts and `words`, last 20 joined exchanges, newest first; no text; files only ([internals/peers.md](internals/peers.md)) | 404 `not_found` |
521
522
  | `GET /api/sessions/:id/peers/:name/messages/:serial` | owner | | 200 the message (its text) and its receipt | 404 `no_message`; 400 `invalid_peer` |
522
523
  | `DELETE /api/sessions/:id/peers/:name` | owner | | 200 `{unpaired}`: the pairing ends, its messages stay | 400 `invalid_peer` |
523
- | `POST /api/sessions/:id/peers/:name/pair`, `…/say` | owner | pair: `address`, `from`; say: `text`, `summary`, `wake`, `re`, `wait` (≤ 30: the server waits for the receipt) | pair 200 `{status: paired, link}`; say 200 `PeerSay` and its `line` | 409 refused (`continued` + `next_id`, `old_worker`, …, the same shape); 400 bad name, text or wait |
524
+ | `POST /api/sessions/:id/peers/:name/pair`, `…/say` | owner | pair: `address`, `from`; say: `text`, `summary`, `wake`, `re`, `wait` (≤ 30: the server waits for the receipt) | pair 200 `{status: paired, link}`; say 200 `PeerSay` and its `line` | 409 refused (`continued` + `next_id` and `in_flight` while its continue runs, `busy` (a say adds `detail`), `old_worker`, …, the same shape); 400 bad name, text or wait |
524
525
  | `DELETE /api/sessions/:id/context/:name?own=1` | owner | | 200 `{status: detached}`: the session's own only | 409 `project_source` (chi context rm's words); 404 |
525
526
  | `POST /api/sessions/:id/stop` | owner | `wait?` (seconds, capped at `SessionManager::STOP_WAIT`, 10: `chi --remote NAME sessions stop` sends it) | 200 `{status: stopped, session_id, released}`: `released`, whether the worker let go within the wait (without one `STOP_WAIT_SECONDS`, 2 s: the page's Stop) | 409 `owned_by_tui` |
526
527
  | `DELETE /api/sessions/:id?force=` | owner | `force=true` stops a live worker first (the page sends it) | as before | 409 `worker_running` without it |
@@ -551,10 +552,11 @@ past its deadline) is sent once more, as `SessionAccess::Local#answer` does, and
551
552
 
552
553
  A refusal an exception raises carries, next to `error` and `detail` (the page's words), `message` (the exception's own,
553
554
  verbatim) and the fields its class is built from, so a remote client raises the same class with the same text:
554
- `owned_by_tui` (`session_id`), `worker_running`/`still_stopping` (`DeleteRefused`: `session_id`, `reason`), `busy`/
555
- `scratch` (`ArchiveRefused`: `session_id`, `reason`, `busy_id`), a restart's `held`/`not_running`/`unsupported`/
556
- `failed` (`RestartRefused`: `session_id`, `reason`, `version`), a continue's `continued`/`open_children`/`folder_gone`
557
- (`SessionContinue::Refused`: `session_id`, `reason`, `ids`) and `ambiguous_id` (`Session::AmbiguousId`: `ids`).
555
+ `owned_by_tui` (`session_id`), `worker_running`/`still_stopping`/`transition_held` (`DeleteRefused`: `session_id`, `reason`), `busy`/
556
+ `scratch` (`ArchiveRefused`: `session_id`, `reason`, `busy_id`; reason `transition_held`'s `message` names the holder), a stop's
557
+ `stop_held` (`SessionTransition::Busy`: `session_id`, `kind`, `successor_id`), a restart's `held`/`not_running`/`unsupported`/
558
+ `failed` (`RestartRefused`: `session_id`, `reason`, `version`), a continue's `continued`/`open_children`/`folder_gone`/`transition_busy`
559
+ (`SessionContinue::Refused`: `session_id`, `reason`, `ids`; `transition_busy`'s `message` names the holder) and `ambiguous_id` (`Session::AmbiguousId`: `ids`).
558
560
  A session an id names none of is `404 not_found` with `Session::NotFound`'s words (`no session X`, `#session_not_found`):
559
561
  every lookup goes through `Session.resolve!` (an id or a unique prefix), and every surface shows that one message.
560
562
 
@@ -695,7 +697,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
695
697
  | LLM context strategies | `llm_context_strategy.rb`, `llm_context_view.rb`, `llm_context_stale.rb`, `llm_context_forget.rb` | What a request sends of the history (none, stale, forget) ([internals/llm-context-forget.md](internals/llm-context-forget.md)). |
696
698
  | Session chains | `session_continue.rb` (`SessionContinue`), `session_chain.rb` (`SessionChain`), `session_chain/links.rb` (`SessionChain::Links`), `session_chain/delete.rb` (`SessionChain::Delete`), `session_chain/delete_preview.rb` (`SessionChain::Delete::Preview`), `continued_from.rb` (`ContinuedFrom`) | A session that continues an earlier one. `SessionChain::Links` is the one chain walker (one listing; `latest`, `first_live`, `root`, `next_of`): `SessionChain.latest`/`.next_of`, `SessionInbox::Head` and the schedule tick all ask it. `SessionChain.opener_for` gives the text web `continue →` prefills in the new link: the previous link's own first typed message when that link continues one itself, else nil (the 201's `opener`; not saved). `SessionChain::Delete` plans and deletes a link or its chain; `Delete::Preview` supplies the web delete sheet, and `ContinuedFrom` records what a continue must undo ([sessions.md](sessions.md)). |
697
699
  | MCP server | `mcp_server/protocol.rb` (`McpServer::Protocol`: JSON-RPC in both revisions, no transport, no chi), `mcp_server/tools.rb` (`McpServer::Tools`: `chi_sessions`, `chi_ask`, `chi_wait`, `chi_answer` over a SessionAccess backend through `SessionAccess::Ask` and `Exchange`), `mcp_server/text.rb` (`McpServer::Text`: the results' words), `mcp_server/stdio.rb` (`McpServer::Stdio`), `mcp_server/http.rb` (`McpServer::Http`), `mcp_command.rb` (`chi mcp serve`), `web/mcp_route.rb` (`Web::McpRoute`: `POST /api/mcp`, included through SessionAccessRoutes) | chi as an MCP server ([mcp-server.md](mcp-server.md)); not the `mcp` bundle (chi as a client). Only `tools.rb` names `SessionAccess`: another front builds `Protocol.new(tools: Tools.new(access))`. The caller is a parent agent (`cli:send` / `cli:answer`, `SessionAccess::Ask#agent_line`). |
698
- | chi web's routes | `web/app.rb` (`Web::App`: the gate, `ROUTES`, the shared helpers), `web/request_body.rb` (`Web::RequestBody`: bounded body reads), `web/message_display.rb` (`Web::MessageDisplay`: saved messages and cards as display items, the owner show's stamped with their turns' drawings and carrying no parts (a step's ✂ marks only), the participant show's with their parts, `POST /api/render`), `web/session_show.rb` (`Web::SessionShow`: `GET /api/sessions/:id` with its `cards`, `tail` and `timing` re-reads, `GET …/output`, the timing payload), `web/session_create.rb` (`Web::SessionCreate`: `POST /api/sessions`, a continue), `web/session_control.rb` (`Web::SessionControl`: answer, command, turn and images, cancel, stop, restart, archive, delete), `web/session_access_routes.rb` (`Web::SessionAccessRoutes`: the session-command routes), `web/ask_routes.rb` (`Web::AskRoutes`: ask, wait tokens, the answer's wait, included through SessionAccessRoutes), `web/verify_fresh_routes.rb` (`Web::VerifyFreshRoutes`: Verify fresh children), `web/working_set_routes.rb` (`Web::WorkingSetRoutes`: the working set routes), `web/viewer.rb` (`Web::Viewer`: page capabilities), `web/push_routes.rb` (`Web::PushRoutes`: `/api/push`, its subscriptions, prefs, test and presence), `web/block_renderer_routes.rb` (`Web::BlockRendererRoutes`: `GET /api/block_renderers` and one renderer's file, [internals/block-renderers.md](internals/block-renderers.md)), `web/reload_check_route.rb` (`Web::ReloadCheckRoute`: `POST /api/sessions/:id/reload_check`, the opt-in `web.reload_check`'s counts from the page's `reload_check.js`, 204 and one `reload_checked` log line, with `reload_mismatch`, its `kinds`, `excused` (ACCEPTED ids) and `explained` when the turn read otherwise after a reload; the worker's version is chi web's own view, its sidecar) | The handlers `App`'s `ROUTES` name, in the file that holds their kind; each mixin is included in `App` and reads its helpers and ivars, so `app.send(:handle_show, …)` and the specs that stub `App` methods work as before. The shared body reader caps incoming requests. |
700
+ | chi web's routes | `web/app.rb` (`Web::App`: the gate, `ROUTES`, the shared helpers), `web/request_body.rb` (`Web::RequestBody`: bounded body reads), `web/message_display.rb` (`Web::MessageDisplay`: saved messages and cards as display items, the owner show's stamped with their turns' drawings and carrying no parts (a step's ✂ marks only), the participant show's with their parts, `POST /api/render`), `web/session_show.rb` (`Web::SessionShow`: `GET /api/sessions/:id` with its `cards`, `tail` and `timing` re-reads, `GET …/output`, the timing payload), `web/session_create.rb` (`Web::SessionCreate`: `POST /api/sessions`, a continue), `web/session_control.rb` (`Web::SessionControl`: answer, command, turn and images, cancel, stop, restart, archive, delete), `web/session_access_routes.rb` (`Web::SessionAccessRoutes`: the session-command routes), `web/ask_routes.rb` (`Web::AskRoutes`: ask, wait tokens, the answer's wait, included through SessionAccessRoutes), `web/ask_create.rb` (`Web::AskCreate`: a create that answers its first turn), `web/last_ask.rb` (`Web::LastAsk`: the owner's `last`, `last_ask.json`), `web/verify_fresh_routes.rb` (`Web::VerifyFreshRoutes`: Verify fresh children), `web/working_set_routes.rb` (`Web::WorkingSetRoutes`: the working set routes), `web/viewer.rb` (`Web::Viewer`: page capabilities), `web/push_routes.rb` (`Web::PushRoutes`: `/api/push`, its subscriptions, prefs, test and presence), `web/block_renderer_routes.rb` (`Web::BlockRendererRoutes`: `GET /api/block_renderers` and one renderer's file, [internals/block-renderers.md](internals/block-renderers.md)), `web/reload_check_route.rb` (`Web::ReloadCheckRoute`: `POST /api/sessions/:id/reload_check`, the opt-in `web.reload_check`'s counts from the page's `reload_check.js`, 204 and one `reload_checked` log line, with `reload_mismatch`, its `kinds`, `excused` (ACCEPTED ids) and `explained` when the turn read otherwise after a reload; the worker's version is chi web's own view, its sidecar) | The handlers `App`'s `ROUTES` name, in the file that holds their kind; each mixin is included in `App` and reads its helpers and ivars, so `app.send(:handle_show, …)` and the specs that stub `App` methods work as before. The shared body reader caps incoming requests. |
699
701
  | Web Push | `web/push.rb` (`Web::Push`: `Runtime`, `preflight!`, the `web.push.*` settings), `web/push/crypto.rb` (`Push::Crypto`: RFC 8291 aes128gcm, RFC 8292 VAPID), `web/push/store.rb` (`Push::Store`, `Store::Sub`: `web-push/vapid.pem`, `subscriptions.json`), `web/push/client.rb` (`Push::Client`, `Client::Result`), `web/push/attention.rb` (`Push::Attention`: notify.js's rules in Ruby, shared cases in `spec/fixtures/attention_cases.json`), `web/push/presence.rb` (`Push::Presence`: the pages' "in front" reports), `web/push/notifier.rb` (`Push::Notifier`, a hub subscriber with a sender thread), `web/push_routes.rb` (`Web::PushRoutes`), `private_files.rb` (`PrivateFiles`, shared with the grants), `public/sw.js`, `public/push.js`, `public/manifest.webmanifest` | chi web pushes what the tab notifies for (approvals, questions, step-limit questions, cards, failed turns; done turns to a device that asks) to the owner's Home Screen app over an https public URL: the Notifier turns the hub's new attentions into show pushes after a hold, unless a chi web page is in front, at most 30 an hour, with one retry and a restart catch-up (`sent.json`) (each carries the keys still open, and the badge; no close push: every push shows a notification); the bell (`notifications.js`) subscribes the device, and the service worker and the page close the answered ones. See [internals/web-push.md](internals/web-push.md). |
700
702
  | chi web's updates | `web/update_check.rb` (`Web::UpdateCheck`), `web/update_ops.rb` (`Web::UpdateOps`), `web/auto_update.rb` (`Web::AutoUpdate`) | The RubyGems checker and its `update_check.json`; the install, worker-restart and chi-web-restart operations (one at a time) the owner's routes and AutoUpdate share; `update.auto: install`'s thread (install when no turn runs, then idle workers and chi web). See [configuration](configuration.md#unattended-updates-updateauto). |
701
703
  | Behind an auth proxy | `web/public_url.rb` (`Web::PublicUrl`: `web.public_url`, `web.proxy.identity_header`, `web.proxy.owner`), `web/proxy_gate.rb` (`Web::ProxyGate`, mixed into App; `RawHeaderNames`, prepended to WEBrick's request by `Web::Server`), `web/link_codes.rb` (`Web::LinkCodes`: the links' one-time codes), `proxy_trace.rb` (`ProxyTrace`), `web/public/token_fragment.js`, `web/public/auth_lost.js`, `web/tunnel.rb` + `web/tunnel/tailscale.rb` (`Web::Tunnel`, `Web::Tunnel::Tailscale`: `chi web --tunnel tailscale`, Tailscale Serve set for one run and the PublicUrl it makes) | Experimental: chi web behind an auth proxy. Every request needs the token; a proxied one's owner also needs the identity header (one clean value under one name); the `__Host-` cookie, an absolute `Location` from the public URL, https links with a one-time code in the fragment; the page's lost-sign-in banner. Bridges refuse proxy traces ([configuration.md](configuration.md#behind-an-auth-proxy)). |
data/docs/bundles.md CHANGED
@@ -41,7 +41,7 @@ only against this API (`lib/samagotchi/bundles/btw/plugin.rb`).
41
41
  server](mcp-server.md).)
42
42
 
43
43
  `chi bundle install mcp` (or the `dev` profile) installs the bundle shipped with chi. It is written
44
- only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `oauth.rb`, `tools.rb`, `content.rb`), and gives
44
+ only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `oauth.rb`, `sign_in.rb`, `server_config.rb`, `tools.rb`, `content.rb`), and gives
45
45
  the model the tools of [MCP](https://modelcontextprotocol.io) servers. It
46
46
  has no memory file, and the servers' tools aren't declared to the model one
47
47
  by one: the bundle publishes them into chi's tool index
data/docs/cli.md CHANGED
@@ -24,7 +24,7 @@
24
24
  - `chi context <add|push|ls|show|refresh|rm|mute|unmute> …` — attach live external text to sessions (a command chi runs every so often, or text pushed in); the model gets a short note when it changes and reads it with `context_read`; `chi context add <URL>` attaches a GitHub PR with the github-pr bundle; `chi context push NAME -m TEXT` (the long form is `--message TEXT`) gives a `--push` source its new text, read from stdin when no `-m` is given (see [Attached context](context.md))
25
25
  - `chi peer pair|unpair|say|ls …` — a peer agent's side of a session (a Claude Code or Codex session paired with it; see [Peers](peers.md)): `pair NAME ID [--address ADDR] [--from TEXT]` pairs (refused for a continued session, naming its next id, and for a live worker older than the mailbox: restart it), `unpair NAME ID` ends the pairing (its messages stay), `say NAME ID (--wake|--nowake) [--summary TEXT] [--re REF] [-m TEXT] [--wait SECONDS]` leaves a message and prints what chi did with it (`#12 received · woke chi`, `held: … · waits for the user's next message`, `noted`, or why it can't say yet), `ls ID [--format json]` the session's peers, their messages and receipts. A refusal exits 1 (nothing written), a usage error 2; `--remote` runs it through that machine's chi web, which waits for the say
26
26
  - `chi context report [--days N]` — the candidate judge's counts from `context_candidates.jsonl`: candidates proposed, mentioned, attached or declined by you; the judge's asks; what it would attach per threshold, and how that agrees with what you did (this machine only; see [The log and the report](context.md#the-log-and-the-report))
27
- - `chi send [-m TEXT] [--image PATH]... [--cut | --queue] [--as NAME] (ID|PREFIX)...` — send a message to sessions as if typed there (from an agent, as that agent: `--as NAME` or its marker, see [An agent's messages](sub-agent.md#an-agents-messages-driver-and-visitor); `--new --driver NAME` names a new session's driver): a turn starts (or a running one takes it at its next step; `--cut` asks it to cut long thinking for it; `--queue` runs it as a turn of its own after the running one, and `--queue --wait` waits for that turn's own answer); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); to a session that was continued it goes to its chain's newest link (`3f9a1c2e → 7b2d41aa (continued) sent`; the old link stays archived; one being continued right now waits up to 10 s for its new link, then `refused: being continued as 7b2d41aa; send again in a moment`), so a chain's first id is a stable address; `--new` starts a session with it instead (`--new --continues ID|last:ID` the next link of that session's chain, see [Session chains](sessions.md#session-chains)), and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending — to an idle session whose last turn already ended, that ended turn's reply or end comes back; `--wait --turn T ID` with no message waits for exactly turn T, whether running, queued or last ended; `--format json` includes its `turn_id` when known, for waiting again after exit 3 or 4; exit 3 a question waits, its options on stderr; exit 4 `--timeout` passed with the turn still running; see [Starting a session](sessions.md#starting-a-session))
27
+ - `chi send [-m TEXT] [--image PATH]... [--cut | --queue] [--as NAME] (ID|PREFIX)...` — send a message to sessions as if typed there (from an agent, as that agent: `--as NAME` or its marker, see [An agent's messages](sub-agent.md#an-agents-messages-driver-and-visitor); `--new --driver NAME` names a new session's driver): a turn starts (or a running one takes it at its next step; `--cut` asks it to cut long thinking for it; `--queue` runs it as a turn of its own after the running one, and `--queue --wait` waits for that turn's own answer); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); to a session that was continued it goes to its chain's newest link (`3f9a1c2e → 7b2d41aa (continued) sent`; the old link stays archived; one being continued right now waits up to 10 s for its new link, then `refused: session 3f9a1c2e is being continued as 7b2d41aa-…; send again in a moment`), so a chain's first id is a stable address; `--new` starts a session with it instead (`--new --continues ID|last:ID` the next link of that session's chain, see [Session chains](sessions.md#session-chains)), and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending — to an idle session whose last turn already ended, that ended turn's reply or end comes back; `--wait --turn T ID` with no message waits for exactly turn T, whether running, queued or last ended; `--format json` includes its `turn_id` when known, for waiting again after exit 3 or 4; exit 3 a question waits, its options on stderr; exit 4 `--timeout` passed with the turn still running; see [Starting a session](sessions.md#starting-a-session))
28
28
  - `chi answer ID --question QID (--option N|LABEL)... [--text T] [--timeout S] [--format json]` (or `--dismiss`) — answer the question a session waits on (the one `chi send --wait` exited 3 with), then wait and print what comes next as `chi send --wait` does: the reply (0), the next question (3), still running after `--timeout` (4). `--option` is 1-based or the label, repeated on a multi-select question; `--text` is free text, or a Deny's reason; `--dismiss` leaves it unanswered and the model finishes its reply. A question no longer open (the web answered first) isn't answered again: it waits for that turn's reply. An option the question doesn't offer exits 2; a worker that is gone exits 1 (`send the task again: chi send --wait -m "…" ID`). What a parent may pick follows `guardrails.parent_answers`, or the session's own `parent_answers` when stricter (`soft`, the default: a deny, a plain answer, Continue and "Allow once"; `standard`: no allow; `hard`: no Continue either), never a wider scope or an allow on chi's own config; a refused pick exits 1 with what to answer instead (a convention, not a security boundary; see [Guardrails](guardrails.md#answers-from-a-parent-agent))
29
29
  - `chi schedule <add|edit|list|show|tick|run-now|enable|disable|cancel>` — durable schedules on this machine: a prompt with a clock that fires out of no worker (cron, systemd, or chi web's hub with `schedule.auto_tick`), as the next link of a session's chain or as a turn in the session itself (see [Scheduling](scheduling.md) and [Durable schedules](#durable-schedules-chi-schedule)). A usage error exits 2, an unknown session or schedule 1; `chi --remote X schedule list` exits 2
30
30
  - `chi remote add NAME URL [--token-file F | --token-stdin]`, `chi remote ls`, `chi remote rm NAME` — the other machines whose chi web the session commands reach with `--remote NAME` (see [Remote sessions](#remote-sessions))
@@ -457,7 +457,7 @@ chi schedule add --continues 3f9a1c2e --every 30m --mode same -m "Check the buil
457
457
 
458
458
  chi schedule list # id name mode recurrence next due target [skips 3 of 12 (≈1 h at a 5 min tick)]
459
459
  chi schedule list --all --format json # the disabled ones and the fired one-offs too
460
- chi schedule show 4b7e9a # the entry in full: anchor, head, prompt, counters, its last 20 outcomes
460
+ chi schedule show 4b7e9a # the entry in full: anchor, head, prompt, counters, where its prune waits, its last 20 outcomes
461
461
  chi schedule tick # fire everything due; quiet when nothing is
462
462
  chi schedule tick --dry-run # print what would fire, change nothing
463
463
  chi schedule run-now 4b7e9a # fire it now, whatever its next_due says
@@ -470,6 +470,10 @@ chi schedule add --session 3f9a1c2e --every 5m -m "Check in" --if "$HOME/.local/
470
470
  chi schedule edit 4b7e9a --no-if # fire at every occurrence again
471
471
  ```
472
472
 
473
+ When the schedule a cancel removes was what kept a pruned chain reachable from its first
474
+ session, `cancel` prints one more line on stdout naming the chain's newest link to send to
475
+ from then on, and still exits 0 ([scheduling.md](scheduling.md#keeping-the-chain-short)).
476
+
473
477
  Every `list` row names its schedule: the `--title` it was given, or, when it has
474
478
  none, the first 30 characters of its prompt in quotes with `…` where it is cut
475
479
  (newlines and runs of spaces become one space). The name column is padded to the
@@ -764,7 +768,11 @@ note or image) is deleted as its worker exits, and `/exit` says so; set
764
768
  [Sessions](sessions.md).
765
769
 
766
770
  `chi sessions stop ID...` stops each session's worker and waits for it to exit, so
767
- a `chi --resume ID` after it starts a fresh one. A worker still running an
771
+ a `chi --resume ID` after it starts a fresh one. A session being continued,
772
+ deleted or archived refuses the stop at once, saying so ("session ab12cd34 is
773
+ being deleted", "session ab12cd34 is being continued as 7b2d41aa-…: stop that
774
+ one"); a short hold (a send) is waited for up to 10 s, then refused ("…; try
775
+ again in a moment"). Either way the running turn goes on and that id exits 1. A worker still running an
768
776
  older chi (from before an upgrade) takes turns, but not commands, or not the
769
777
  ones newer than it (`/llm-context`, `--llm-context` on `--attach`); the attached
770
778
  terminal and the Web UI say so, with that restart line.
@@ -1182,9 +1190,12 @@ The prompt stays open while a turn runs in an attached terminal:
1182
1190
  running turn's card with the commands queued for its end, until its turn
1183
1191
  starts; its **×** (`Remove from queue`, once the worker acked it) takes it
1184
1192
  back before it runs, in every tab (a toast says why when it can't: it
1185
- already started, it is gone, no live worker), and puts its text back into an
1186
- empty composer to change and send again (a draft stays: the text is then in
1187
- the toast; images don't come back); `cut in now` cuts, like `/cut TEXT` (by click only: it throws the
1193
+ already started, it is gone, no live worker), and puts its text back into
1194
+ the session's draft when that is empty, to change and send again (a draft
1195
+ stays: the text is then in the toast; after a switch to another session
1196
+ meanwhile it goes into the left session's empty draft, a toast says
1197
+ `Removed: back in <id>'s draft`, else a sticky toast with Copy; images don't
1198
+ come back); `cut in now` cuts, like `/cut TEXT` (by click only: it throws the
1188
1199
  thinking away). Cut is enabled only while the step has streamed nothing but
1189
1200
  thinking and cutting is on for the model (the line says `cuts at about 0:25
1190
1201
  if you choose cut in now` until the thinking passes `steer_cut_after`, and
@@ -163,6 +163,7 @@ or `chi web` restart.
163
163
  | `memories` | Worker start | The running engine holds its preload list. The config list is not saved in the session file, so a respawn reads the current list. |
164
164
  | `append_system_prompt` | Worker start for the file list | The config list is not saved in the session file. File text is read when the prompt is built; `/model` rebuilds it, while an already-built prompt is cached. CLI `--append-system-prompt` files are saved in the session. |
165
165
  | `toolkit.default`, `toolkit.child` | Session creation | The chosen toolkit is saved; changing the defaults does not move existing sessions. |
166
+ | `web.ask_dir` | Session creation | Read at each thin-client create that names no folder; existing sessions keep their folder. |
166
167
  | `toolkit.kits`, `execute.description`, `llm_context.policy` | Worker start | These are held by the engine's toolkit or tool registry. |
167
168
  | `toolkit.suggest.mode`, `toolkit.suggest.threshold`, `toolkit.suggest.defer_turns`, `toolkit.suggest.defer_tokens` | Worker start | Suggestion settings are config-only and are resolved when the worker runs its audit or on-mode ask. |
168
169
  | `skip_agents_md` | Prompt rebuild | A running engine caches its built prompt; a new worker or `/model` rebuild uses the changed value. |
@@ -175,7 +176,7 @@ or `chi web` restart.
175
176
  | `session.idle_exit_minutes`, `session.project_env`, `session.carry_last_answer`, `session.keep_empty`, `session.max_children`, `session.delegate_reports`, `session.task_wakes`, `session.max_wakes` | Worker start or next matching lifecycle decision | Existing workers keep their idle-exit timer and project env; the other values are read for the next corresponding decision. |
176
177
  | `session.retention_*`, `session.max_count`, `session.keep_status`, `session.sweep_interval_hours` | Next retention sweep | `chi web` sweeps on its configured schedule and on `GET /api/sessions`; `chi sessions prune` uses the values for that invocation. The sweep interval is checked on the next hub tick. |
177
178
  | `schedule.*` | Next CLI run | `chi schedule add` and `chi schedule tick` read them for that run; with `schedule.auto_tick` on, `chi web`'s hub ticks on `schedule.tick_interval_minutes`. |
178
- | `web.*` except `web.participants.*` | `chi web` start | Restart `chi web` to change its bind address, port or page settings. |
179
+ | `web.*` except `web.participants.*` and except `web.ask_dir` | `chi web` start | Restart `chi web` to change its bind address, port or page settings. |
179
180
  | `log.*` | Process start | Each process holds its configured log sink and level after first use; restart that process. |
180
181
  | `history.file` | Next history access | The TUI and web composer resolve its path when they read or append history. |
181
182
  | `broadcast.*` | Next `chi broadcast` | Each broadcast invocation reads its targeting and triage settings. |
@@ -2063,6 +2064,9 @@ name doesn't load. By hand, on the Mac that runs chi web (or steps 1–2, then
2063
2064
  AirDrop or type it). The code works once, within 10 minutes (`chi web` again prints a new one); the phone then
2064
2065
  keeps the `__Host-chi_token` cookie.
2065
2066
 
2067
+ A phone Shortcut talks to the same address with the token ([thin clients](thin-clients.md)); set `web.ask_dir` so its
2068
+ new sessions need no folder ([A new session in one call](thin-clients.md#a-new-session-in-one-call)).
2069
+
2066
2070
  #### `chi web --tunnel tailscale`
2067
2071
 
2068
2072
  Steps 3–5 in one command, after steps 1–2 (Tailscale signed in, HTTPS certificates on):
@@ -2430,6 +2434,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2430
2434
  | `web.annotate_presets` | `Agreed\|Could you please elaborate?` | yes | Quick replies next to Annotate in `chi web`, `\|`-separated (a YAML list works too); `""` in the file or on the CLI leaves only Annotate (an empty env value means the default). See [CLI](cli.md#web-annotate-presets). |
2431
2435
  | `web.editor` | `vscode` | yes | What a file ref in `chi web` (a file tool row's title, a diff line) opens, for a viewer on this machine: a preset (`vscode`, `vscode-insiders`, `cursor`, `zed`) or a URL template with `{path}` and an optional `{line}`; `none` turns refs off. See [Opening files from chi web](#opening-files-from-chi-web). |
2432
2436
  | `web.start_dir` | the folder `chi web` runs in | | The folder `chi web` starts in (`chi web --start-dir DIR` for one run): its page (the printed link, a bare `/`, the LAN link and QR code, the Home Screen app) opens on that folder's project, outside a project (no repository or marked folder) on every session, and a new session from the all view starts there; the header's project picker switches projects. `~` and a relative path (resolved from your home folder) work; one that isn't a folder stops `chi web` from starting. `chi web` never changes its own folder. See [CLI](cli.md). |
2437
+ | `web.ask_dir` | the `web.start_dir` folder | | The folder a thin client's one-call create (`POST /api/sessions` with `reply_for`, `timeout` or `request_id`, such as a phone Shortcut's) starts in when it names no `dir`, so the Shortcut can leave the folder out. `~` and a relative path (resolved from your home folder) work; one that isn't a folder refuses that create (400 `invalid_dir`), nothing started. Read at each create; a plain create without those fields never uses it. Only the owner's token creates sessions. See [A new session in one call](thin-clients.md#a-new-session-in-one-call). |
2433
2438
  | `web.participants.expires` | `7d` | | How long a participant's link lasts unless `chi share --expires` says otherwise: `Nh` or `Nd`, 1h to 30d. See [participants](internals/participants.md). |
2434
2439
  | `web.participants.cap` | `2.0` | | What a participant's turns, and the side calls they cause, may cost you in dollars unless `chi share --cap` says otherwise ($0 to $1000); at the cap their next comment is refused (429 `cap_reached`) and you get a notice. `chi share cap ID P DOLLARS` changes one grant's. |
2435
2440
  | `web.participants.queue` | `3` | | How many of a participant's turns may wait behind their running one (0 to 20); one more is refused (429 `too_many_turns`). |
data/docs/context.md CHANGED
@@ -331,9 +331,16 @@ link's id (`chi context push` exits 1; chi web answers 410
331
331
  `context_continued`):
332
332
 
333
333
  ```
334
- chi context push: 3f2a9c1e was continued as 7b1d…: notes stays with the session it was attached to; attach it to 7b1d… (or pair again with 7b1d…) and push there
334
+ chi context push: session 3f2a9c1e was continued as 7b1d…: notes stays with the session it was attached to; attach it to 7b1d… (or pair again with 7b1d…) and push there
335
335
  ```
336
336
 
337
+ A session being continued right now (its new link not saved yet) is refused the same way, `is being continued as`
338
+ and `… push there in a moment`; one busy with another change (its transition lock held) is refused with `chi context
339
+ push: session 3f2a9c1e is busy with another change; try again in a moment` (chi web answers 423 `context_busy`).
340
+ `chi context add` and `chi context rm` of a session's own source (and the page's attach and ×) are refused the same
341
+ way while a transition holds the session (a continue copies its sources to the new link): nothing changes, try again
342
+ in a moment.
343
+
337
344
  An archived session that nobody continued takes pushes as before; a schedule's anchor whose successor a prune deleted counts as continued by the schedule's head ([sessions.md](sessions.md), *Session chains* → Which link).
338
345
 
339
346
  ### Peers and a continue
@@ -207,7 +207,9 @@ second note; `words` is the few words `chi send --new --continues` prints; `to_h
207
207
  [peers.md](peers.md), A continue.)
208
208
 
209
209
  The refusal side: a push into a session that has been continued is refused with the next link's id
210
- (`context_continued`, chi web 410, `chi context push` exit 1), from `SessionAccess` (`session_access.rb`) and chi web's push route (`web/session_access_routes.rb`).
210
+ (`context_continued`, chi web 410, `chi context push` exit 1; `in_flight` when a continue holding its transition lock
211
+ names it), or busy while another change holds that lock (423 `context_busy`); the check and the write run under a
212
+ shared hold of it (`SessionAccess::Local#context_push`). From `SessionAccess` (`session_access.rb`) and chi web's push route (`web/session_access_routes.rb`).
211
213
 
212
214
  ## Gates and config
213
215
 
@@ -149,7 +149,8 @@ session switch, a turn's end, Revise's clones, the stage's hand-off to `#history
149
149
 
150
150
  **The only way out is composer text.** Fill reply builds `id: option (note) · …` from the picked rows (a row with no
151
151
  pick is left out) and hands it to app.js's `fillComposer`, after a typed draft on a new line (`withDraft`; the draft
152
- is kept). It never sends: the owner reads the text and sends it or not. `replyText` drops a leading `!` or `/` from
152
+ is kept). Both act on the open session's draft (`drafts.js`, [web-frontend.md](web-frontend.md#the-drafts)): a pick in
153
+ one session never lands in another's text. It never sends: the owner reads the text and sends it or not. `replyText` drops a leading `!` or `/` from
153
154
  an id too (an id of only those is its row's number), so the filled text never starts a shell line or a session command
154
155
  even from data the normaliser didn't mend; the draft before it is the owner's own. The row's `wp-id` chip shows that
155
156
  same cleaned id (`rowId`, one rule for both), so what is drawn is what fills. A walk has no way out at all. The model's
@@ -264,11 +264,7 @@ of its own after it.
264
264
 
265
265
  **chi web.** The author is the grant's (`p:<id>`) and the client id `participant:<id>` (`ClientId.participant`, its
266
266
  `ClientId::Sender` row: a human's input, never the owner's, origin `participant`, source `participant`, labelled
267
- `invited`; not the author, which says who wrote it). A `review:<id>` from chi 0.171 and before (in
268
- `turn_drawings.jsonl`, input files, an older chi web still running) reads the same (`ClientId::LEGACY_REVIEW_PREFIX`,
269
- compat shim `review_client_id`, until 0.173), and a live worker that doesn't name `participant_client_id`
270
- (`Delivery::PARTICIPANT_ID_FEATURE`) is sent `review:<id>` (`SessionManager` delivery; a dequeue's id, only echoed
271
- back, is left as it is); the body's `client_id`, `author` and
267
+ `invited`; not the author, which says who wrote it). The body's `client_id`, `author` and
272
268
  `no_interrupt` never count, its `images` only as refs to their own uploads, and its `delivery` only as `queue` or
273
269
  next step (none: next step).
274
270
  Refused before delivery, each audited:
@@ -56,14 +56,26 @@ which posts `…/peers/NAME/say` with its `wait`: chi web waits, and its read ti
56
56
  1. Refused before anything is written: no session, continued (with the next id), no `link.json`, a live worker
57
57
  without the `peer_mail` Bridge feature (`WorkerLink.live_features`, read only), `UNTAKEN_MAX` (200) untaken
58
58
  messages or noted receipts.
59
- 2. `SessionInbox.deliver(:peer)` (`WakePolicy::ROWS[:peer]`, the push row; `START_EVENTS[:peer] =
59
+ 2. Under a shared hold of the session's transition lock (`SessionTransition.shared`, `Local#moved_on`), the
60
+ continued check again, then the delivery (step 3): a continue holding the lock (from after its recap through
61
+ `PeerContinue`'s carry) refuses the say `:continued` naming its new link (`SessionChain::Successor.of` with
62
+ `in_flight: true`; the line `this session is being continued as <id>: say it there in a moment`, `in_flight`
63
+ on the wire), or `:busy` (`SessionTransition::Busy`'s words) when the holder names none. So a say never lands
64
+ in a mailbox the carry already read (N1). The feature probe before and the receipt wait after stay outside the
65
+ hold; the delivery's worker start (`resume_session`, a spawn) is inside it.
66
+ 3. `SessionInbox.deliver(:peer)` (`WakePolicy::ROWS[:peer]`, the push row; `START_EVENTS[:peer] =
60
67
  :peer_woke_session`): a session gone or being deleted refuses before its block writes. Inside the block:
61
68
  the lock, the serial, the write, the trim. The block's "asks for a worker" is the message's own `wake`: no
62
69
  `context.wake`, no 10-minute window.
63
- 3. The line (`PeerSay`): what the say saw at once (a running turn, a stopped or archived session, a one-turn run,
70
+ 4. The line (`PeerSay`): what the say saw at once (a running turn, a stopped or archived session, a one-turn run,
64
71
  a failed start), else a receipt read every 250 ms within the wait, then the peer's other held receipts.
65
72
 
66
- `chi peer pair` makes the old-worker and continued checks too, with the same sentences (`PeerPaired`).
73
+ `chi peer pair` makes the old-worker and continued checks too, with the same sentences (`PeerPaired`), and writes
74
+ `link.json` under the same shared hold (`:continued` in flight, `:busy`). A context push into the session's own
75
+ source does too (`Local#context_push`: 410 `context_continued` with `in_flight`, 423 `context_busy`). The continued
76
+ words are `SessionChain::Continued`'s, one wording for every refusal of a continued link ("this session" in a
77
+ peer's line: the installed skills look for `this session was continued as <id>`). Wire: an older chi `--remote`
78
+ reads a busy say or pair as a refusal with its detail, a busy push as `answered 423 context_busy: …`.
67
79
 
68
80
  ## The worker's mail path
69
81
 
@@ -102,6 +102,9 @@ command, on an idle session with its offer standing and a live worker, is bound
102
102
  instead, the offer's turn id from `ReplyWait.own_turn`, as chi answer follows it; the worker's ack is not read): chi web's `POST …/ask`
103
103
  builds one per request over a `Local` that delivers through chi web's own manager and Bridge (`Web::AskRoutes::
104
104
  AskAccess`), and `McpServer::Tools` reuses `SessionAccess::Ask` / `Exchange` through the MCP server without chi web.
105
+ chi web's create that answers its first turn (`Web::AskCreate`) spawns the session idle, its prompt as the preview,
106
+ then runs the same `SessionAccess::Ask` through `AskRoutes#run_ask`; a `request_id` names the session itself
107
+ (`SessionInbox.enqueued_id_for("create:" + key)`), so a retry finds it and the Ask rebinds to the first turn.
105
108
  The ask chain carries a turn's anchors (`Ask#call` → `Exchange#attempt` → `Local#deliver_turn` → the manager's
106
109
  `deliver_turn`, `anchors:` passed only when given): chi web's `/ask` puts a message's `reply_for` there
107
110
  (`TurnAnchors`). `SessionAccess::Remote#deliver_turn` refuses a non-empty one (local only, exit 2), and neither
@@ -193,7 +196,7 @@ the session commands*. Keep that table in step with `SessionAccessRoutes`.
193
196
  A per-method mapping covers the rest (`Remote#deliver_turn`, `#note`, `#context_push`, `#context_remove`,
194
197
  `#bridge_reply` for answer/dismiss: chi web's 503 `not_live` or 404 `not_found` → nil, i.e. no worker; 504 → the
195
198
  Bridge's 408; 501 → its 404). `#context_push` maps 409 to `:not_push` and 410 `context_continued` (a continued
196
- session, its `next_id`) to `:continued`: a new refusal there gets a status and code of its own, as an older client
199
+ session, its `next_id`, `in_flight`) to `:continued`, and 423 `context_busy` to `:busy`: a new refusal there gets a status and code of its own, as an older client
197
200
  reads every 409 as `not_push` and `continued` as a continue's refusal. `#context_add` sends `movable` and reports it
198
201
  dropped when the 201 doesn't echo it (an older chi web; `chi context add` warns). Anything unmapped becomes `RemoteFailed` "remote NAME (URL) answered STATUS code:
199
202
  message".
@@ -234,7 +237,7 @@ the session commands*. Keep that table in step with `SessionAccessRoutes`.
234
237
  (`force` from `req.GET`, no body read) and declared before the plain `/api/sessions/:id` rows. The plain delete
235
238
  needs no feature: an older chi web deletes the link plainly (no revive, no undo) and its 200 has no
236
239
  `unarchived`/`moved_back` (read as `[]`). The delete refusals reach the CLI with their own reason and message
237
- (`continuing`, `delegate_unmovable`, `scheduled`, `chain_scheduled`, `worker_running`, `still_stopping`:
240
+ (`continuing`, `transition_held`, `delegate_unmovable`, `scheduled`, `chain_scheduled`, `worker_running`, `still_stopping`:
238
241
  `Remote#raise_refusal` raises `DeleteRefused` with `ids` and `schedule_id`).
239
242
  - **A route that answers more.** `GET /api/sessions/:id/delete_plan` answering for every session (`{chained: false,
240
243
  session_id, link}` for one in no chain, and a file-less folder), together with a plain delete that takes the