samagotchi 0.190.0 → 0.191.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -1
- data/docs/architecture.md +8 -7
- data/docs/cli.md +6 -3
- data/docs/context.md +9 -2
- data/docs/guardrails.md +5 -1
- data/docs/internals/attached-context.md +3 -1
- data/docs/internals/peers.md +15 -3
- data/docs/internals/remote-sessions.md +2 -2
- data/docs/internals/session-lifecycle.md +213 -12
- data/docs/peers.md +3 -1
- data/docs/plugins.md +2 -1
- data/docs/scheduling.md +31 -7
- data/docs/sessions.md +11 -11
- data/docs/sub-agent.md +1 -1
- data/lib/samagotchi/bridge.rb +1 -1
- data/lib/samagotchi/bundles/known-names/manifest.yml +2 -2
- data/lib/samagotchi/bundles/known-names/plugin.rb +17 -1
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/context_command.rb +5 -1
- data/lib/samagotchi/context_sources.rb +28 -0
- data/lib/samagotchi/continue_intent.rb +23 -43
- data/lib/samagotchi/hold_stop.rb +5 -2
- data/lib/samagotchi/participants.rb +13 -5
- data/lib/samagotchi/peer_say.rb +29 -14
- data/lib/samagotchi/plugin/sessions.rb +9 -5
- data/lib/samagotchi/schedule_command.rb +5 -1
- data/lib/samagotchi/schedules/prune_part.rb +138 -38
- data/lib/samagotchi/schedules.rb +29 -6
- data/lib/samagotchi/send_command.rb +6 -6
- data/lib/samagotchi/session_access/ask.rb +9 -3
- data/lib/samagotchi/session_access/exchange.rb +6 -2
- data/lib/samagotchi/session_access/local.rb +104 -31
- data/lib/samagotchi/session_access/remote.rb +10 -9
- data/lib/samagotchi/session_access/remote_peers.rb +2 -2
- data/lib/samagotchi/session_access.rb +17 -7
- data/lib/samagotchi/session_chain/delete.rb +100 -47
- data/lib/samagotchi/session_chain/delete_preview.rb +9 -5
- data/lib/samagotchi/session_chain/links.rb +68 -9
- data/lib/samagotchi/session_chain/successor.rb +78 -0
- data/lib/samagotchi/session_continue.rb +108 -40
- data/lib/samagotchi/session_inbox.rb +1 -1
- data/lib/samagotchi/session_inbox_delivery.rb +113 -26
- data/lib/samagotchi/session_lifecycle/allowed.rb +20 -1
- data/lib/samagotchi/session_lifecycle/reading.rb +9 -3
- data/lib/samagotchi/session_lifecycle.rb +13 -2
- data/lib/samagotchi/session_manager/delivery.rb +61 -23
- data/lib/samagotchi/session_manager/emptiness.rb +5 -2
- data/lib/samagotchi/session_manager/lifecycle.rb +50 -14
- data/lib/samagotchi/session_manager/removal.rb +65 -13
- data/lib/samagotchi/session_manager/spawn.rb +14 -6
- data/lib/samagotchi/session_retention.rb +28 -7
- data/lib/samagotchi/session_transition.rb +315 -0
- data/lib/samagotchi/sessions_command.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +10 -2
- data/lib/samagotchi/web/peer_routes.rb +5 -2
- data/lib/samagotchi/web/session_access_routes.rb +5 -2
- data/lib/samagotchi/web/session_control.rb +6 -1
- data/lib/samagotchi/web/session_create.rb +1 -1
- data/lib/samagotchi/worker_boot.rb +28 -6
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2e3f365d9e072d6e62259794b8b820eadfbad98191b52950bd500c3a719cdc6
|
|
4
|
+
data.tar.gz: 8f464ea54361dd666264cd430fe51d7f9af6cad6fac31612a1c3fe2f80aacbd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0ff226bcf7c80d9a2c7d1838da6c456fb971c9f681c4480837908c95abe5e7c82411342f4738864eb8a31411eb6c6ba93f96e2078d72cb48e0aa3ffeebdf60c
|
|
7
|
+
data.tar.gz: 1192fbb01bd6a56d59269430db8a3aa0da8523a6ac566c687ad37b0a14c7243dfb60935d134dcc4d9b0bee4b4613efb551ffca238667f71138d26c24d127cc30
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,41 @@ and commands may change between minor versions. How releases are made:
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.191.0] - 2026-11-27
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Continuing, deleting, pruning, stopping and archiving a session no longer race each other: each waits briefly for
|
|
16
|
+
the other change to finish, then goes on or is refused, naming what holds the session ("session ab12cd34 is being
|
|
17
|
+
deleted; try again in a moment").
|
|
18
|
+
- A message sent while its session is being continued is no longer lost: `chi send` and thin-client asks retry and
|
|
19
|
+
reach the new link; a schedule's firing skips that tick; `chi peer say`/`pair` and `chi context push` are refused,
|
|
20
|
+
naming the new link to send to.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Schedule pruning no longer stalls partway down a chain when one session can't go yet: it stops there, shows
|
|
25
|
+
`pruning held at …` in `chi schedule list` (and why in `show`), and tries again on the next tick.
|
|
26
|
+
- A child's report waking its parent no longer undoes a stop of that parent that is in progress.
|
|
27
|
+
- A stop or an archive no longer slips into the middle of a continue or a delete: `chi sessions stop`, the web's
|
|
28
|
+
stop and an archive wait (up to 10 s) for the change to finish, then go on or are refused in its words.
|
|
29
|
+
- Retention and a scratch session's cleanup no longer delete a session in the middle of a continue.
|
|
30
|
+
|
|
31
|
+
## [0.190.1] - 2026-11-26
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- known-names no longer blocks a folder or ticket id that differs from a protected name only in its digits
|
|
36
|
+
(`~/projects/ISSUE-8932` while in a repo named `ISSUE-8926`); a letter typo next to the digits is still caught
|
|
37
|
+
(known-names 0.2.2).
|
|
38
|
+
- A pruned schedule's first session keeps working as the chain's address: once `keep_links` pruning had deleted
|
|
39
|
+
the session after it, `chi send <its id>` from another agent was refused as archived, a person's send brought
|
|
40
|
+
that old session back beside the chain, and `last:<its id>` named it instead of the newest link. These now reach
|
|
41
|
+
the schedule's newest link, and continuing that first session directly is refused, naming the newest link.
|
|
42
|
+
- Schedule pruning no longer stops for good after its first deletion; a chain stays at its `keep_links` length.
|
|
43
|
+
|
|
44
|
+
Update with `chi update` (known-names 0.2.2).
|
|
45
|
+
|
|
11
46
|
## [0.190.0] - 2026-11-26
|
|
12
47
|
|
|
13
48
|
### Added
|
|
@@ -6951,7 +6986,9 @@ and long-lived sessions.
|
|
|
6951
6986
|
- A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
|
|
6952
6987
|
hotkey panel that send selected text or the clipboard to your sessions.
|
|
6953
6988
|
|
|
6954
|
-
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.
|
|
6989
|
+
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.191.0...HEAD
|
|
6990
|
+
[0.191.0]: https://github.com/dm1try/samagotchi/compare/v0.190.1...v0.191.0
|
|
6991
|
+
[0.190.1]: https://github.com/dm1try/samagotchi/compare/v0.190.0...v0.190.1
|
|
6955
6992
|
[0.190.0]: https://github.com/dm1try/samagotchi/compare/v0.189.0...v0.190.0
|
|
6956
6993
|
[0.189.0]: https://github.com/dm1try/samagotchi/compare/v0.188.0...v0.189.0
|
|
6957
6994
|
[0.188.0]: https://github.com/dm1try/samagotchi/compare/v0.187.0...v0.188.0
|
data/docs/architecture.md
CHANGED
|
@@ -508,7 +508,7 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
|
|
|
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/: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
512
|
| `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
513
|
| `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
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` |
|
|
@@ -516,11 +516,11 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
|
|
|
516
516
|
| `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
517
|
| `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
518
|
| `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` |
|
|
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`, `in_flight` while its continue runs); 423 `context_busy` (another change holds its transition lock); 400 `invalid_text` |
|
|
520
520
|
| `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
521
|
| `GET /api/sessions/:id/peers/:name/messages/:serial` | owner | | 200 the message (its text) and its receipt | 404 `no_message`; 400 `invalid_peer` |
|
|
522
522
|
| `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
|
|
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` and `in_flight` while its continue runs, `busy` (a say adds `detail`), `old_worker`, …, the same shape); 400 bad name, text or wait |
|
|
524
524
|
| `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
525
|
| `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
526
|
| `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 +551,11 @@ past its deadline) is sent once more, as `SessionAccess::Local#answer` does, and
|
|
|
551
551
|
|
|
552
552
|
A refusal an exception raises carries, next to `error` and `detail` (the page's words), `message` (the exception's own,
|
|
553
553
|
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
|
|
556
|
-
`
|
|
557
|
-
(`
|
|
554
|
+
`owned_by_tui` (`session_id`), `worker_running`/`still_stopping`/`transition_held` (`DeleteRefused`: `session_id`, `reason`), `busy`/
|
|
555
|
+
`scratch` (`ArchiveRefused`: `session_id`, `reason`, `busy_id`; reason `transition_held`'s `message` names the holder), a stop's
|
|
556
|
+
`stop_held` (`SessionTransition::Busy`: `session_id`, `kind`, `successor_id`), a restart's `held`/`not_running`/`unsupported`/
|
|
557
|
+
`failed` (`RestartRefused`: `session_id`, `reason`, `version`), a continue's `continued`/`open_children`/`folder_gone`/`transition_busy`
|
|
558
|
+
(`SessionContinue::Refused`: `session_id`, `reason`, `ids`; `transition_busy`'s `message` names the holder) and `ambiguous_id` (`Session::AmbiguousId`: `ids`).
|
|
558
559
|
A session an id names none of is `404 not_found` with `Session::NotFound`'s words (`no session X`, `#session_not_found`):
|
|
559
560
|
every lookup goes through `Session.resolve!` (an id or a unique prefix), and every surface shows that one message.
|
|
560
561
|
|
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
|
|
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
|
|
@@ -764,7 +764,10 @@ note or image) is deleted as its worker exits, and `/exit` says so; set
|
|
|
764
764
|
[Sessions](sessions.md).
|
|
765
765
|
|
|
766
766
|
`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.
|
|
767
|
+
a `chi --resume ID` after it starts a fresh one. While another change holds the
|
|
768
|
+
session (a continue, a delete, an archive) for longer than 10 s, the stop is
|
|
769
|
+
refused in its words ("session ab12cd34 is being deleted; try again in a
|
|
770
|
+
moment") and that id exits 1. A worker still running an
|
|
768
771
|
older chi (from before an upgrade) takes turns, but not commands, or not the
|
|
769
772
|
ones newer than it (`/llm-context`, `--llm-context` on `--attach`); the attached
|
|
770
773
|
terminal and the Web UI say so, with that restart line.
|
data/docs/context.md
CHANGED
|
@@ -331,10 +331,17 @@ 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
|
-
|
|
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
|
+
|
|
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
|
|
340
347
|
|
data/docs/guardrails.md
CHANGED
|
@@ -1447,7 +1447,11 @@ edit of a known name shorter than 10 characters, or two edits of a longer
|
|
|
1447
1447
|
one, is a near miss. Tokens and names shorter than `min_length` (6) are
|
|
1448
1448
|
skipped, as is a token that equals another known name. A token with a shell
|
|
1449
1449
|
glob (`*?[]{}`, as in `ls -d samagotchi*`) is not checked. In `~name` (that
|
|
1450
|
-
user's home folder) the name after `~` is what is checked.
|
|
1450
|
+
user's home folder) the name after `~` is what is checked. For a name with a
|
|
1451
|
+
digit, a token that differs from it only in digits (`ISSUE-8932` next to a
|
|
1452
|
+
repo named `ISSUE-8926`, `run-3` for `run-2`) is a numbered sibling, not a
|
|
1453
|
+
near miss. A name without digits still catches a digit typo (`j0hndoe` or
|
|
1454
|
+
`johndoe2` for `johndoe`).
|
|
1451
1455
|
|
|
1452
1456
|
By default (`mode: reject`) the call is denied with advice in place of the
|
|
1453
1457
|
usual tail, so the model retries it corrected:
|
|
@@ -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
|
|
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
|
|
data/docs/internals/peers.md
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
|
|
@@ -193,7 +193,7 @@ the session commands*. Keep that table in step with `SessionAccessRoutes`.
|
|
|
193
193
|
A per-method mapping covers the rest (`Remote#deliver_turn`, `#note`, `#context_push`, `#context_remove`,
|
|
194
194
|
`#bridge_reply` for answer/dismiss: chi web's 503 `not_live` or 404 `not_found` → nil, i.e. no worker; 504 → the
|
|
195
195
|
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
|
|
196
|
+
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
197
|
reads every 409 as `not_push` and `continued` as a continue's refusal. `#context_add` sends `movable` and reports it
|
|
198
198
|
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
199
|
message".
|
|
@@ -234,7 +234,7 @@ the session commands*. Keep that table in step with `SessionAccessRoutes`.
|
|
|
234
234
|
(`force` from `req.GET`, no body read) and declared before the plain `/api/sessions/:id` rows. The plain delete
|
|
235
235
|
needs no feature: an older chi web deletes the link plainly (no revive, no undo) and its 200 has no
|
|
236
236
|
`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`:
|
|
237
|
+
(`continuing`, `transition_held`, `delegate_unmovable`, `scheduled`, `chain_scheduled`, `worker_running`, `still_stopping`:
|
|
238
238
|
`Remote#raise_refusal` raises `DeleteRefused` with `ids` and `schedule_id`).
|
|
239
239
|
- **A route that answers more.** `GET /api/sessions/:id/delete_plan` answering for every session (`{chained: false,
|
|
240
240
|
session_id, link}` for one in no chain, and a file-less folder), together with a plain delete that takes the
|