samagotchi 0.175.0 → 0.177.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 +50 -1
- data/bin/chi +1 -0
- data/docs/architecture.md +1 -1
- data/docs/cli.md +11 -4
- data/docs/configuration.md +1 -0
- data/docs/internals/bridge.md +2 -2
- data/docs/internals/engine.md +2 -2
- data/docs/internals/participants.md +13 -6
- data/docs/internals/prompt-caching.md +3 -0
- data/docs/internals/web-frontend.md +38 -11
- data/docs/internals/working-set.md +77 -6
- data/docs/sessions.md +3 -2
- data/lib/samagotchi/bridge.rb +11 -4
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/config.rb +3 -0
- data/lib/samagotchi/engine/models.rb +11 -0
- data/lib/samagotchi/engine/session.rb +9 -0
- data/lib/samagotchi/engine.rb +1 -0
- data/lib/samagotchi/engine_snapshots.rb +3 -0
- data/lib/samagotchi/participant_uploads.rb +14 -1
- data/lib/samagotchi/prompt_part.rb +66 -0
- data/lib/samagotchi/session.rb +10 -1
- data/lib/samagotchi/system_prompt.rb +191 -12
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +15 -2
- data/lib/samagotchi/web/participant_images.rb +16 -12
- data/lib/samagotchi/web/participant_show.rb +1 -1
- data/lib/samagotchi/web/participant_view.rb +27 -1
- data/lib/samagotchi/web/public/app.js +7 -2
- data/lib/samagotchi/web/public/composer_fold.js +3 -1
- data/lib/samagotchi/web/public/composer_grip.js +18 -10
- data/lib/samagotchi/web/public/composer_mount.js +17 -6
- data/lib/samagotchi/web/public/ctx_tokens.js +33 -0
- data/lib/samagotchi/web/public/index.html +43 -9
- data/lib/samagotchi/web/public/restore.js +3 -1
- data/lib/samagotchi/web/public/session_fields.js +10 -4
- data/lib/samagotchi/web/public/session_prefs.js +92 -0
- data/lib/samagotchi/web/public/session_state.js +14 -1
- data/lib/samagotchi/web/public/session_store.js +1 -1
- data/lib/samagotchi/web/public/session_sync.js +3 -0
- data/lib/samagotchi/web/public/session_view.js +33 -3
- data/lib/samagotchi/web/public/stage_asking.js +20 -11
- data/lib/samagotchi/web/public/stage_cloud.js +3 -2
- data/lib/samagotchi/web/public/stage_missing.js +3 -5
- data/lib/samagotchi/web/public/stage_model.js +2 -1
- data/lib/samagotchi/web/public/stage_view.js +6 -1
- data/lib/samagotchi/web/public/stage_view_memory.js +76 -0
- data/lib/samagotchi/web/public/stream_handlers.js +10 -5
- data/lib/samagotchi/web/public/tokens.css +2 -2
- data/lib/samagotchi/web/public/turn_events.js +1 -1
- data/lib/samagotchi/web/public/working_set.js +51 -7
- data/lib/samagotchi/web/public/working_set_rail.js +22 -7
- data/lib/samagotchi/web/public/working_set_view.js +188 -58
- data/lib/samagotchi/web/public/ws_reader.js +2 -0
- data/lib/samagotchi/web/public/ws_sections.js +251 -0
- data/lib/samagotchi/web/server.rb +6 -2
- data/lib/samagotchi/web/session_show.rb +13 -2
- data/lib/samagotchi/worker/child_side.rb +123 -0
- data/lib/samagotchi/worker/command_queue.rb +350 -0
- data/lib/samagotchi/worker/leave.rb +286 -0
- data/lib/samagotchi/worker/scratch.rb +99 -0
- data/lib/samagotchi/worker/signal_grace.rb +96 -0
- data/lib/samagotchi/worker/startup.rb +92 -0
- data/lib/samagotchi/worker/wake_turns.rb +190 -0
- data/lib/samagotchi/worker.rb +25 -1065
- data/lib/samagotchi/worker_exit_claim.rb +12 -0
- data/lib/samagotchi/working_set.rb +32 -4
- data/lib/samagotchi/working_set_command.rb +3 -2
- data/lib/samagotchi/working_set_steer.rb +21 -3
- metadata +13 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90399195c08d46ac5fa722766255c24686b727cad1201a90aef486112d4c1143
|
|
4
|
+
data.tar.gz: bb77da3a5486da4fc03f9d81def5a1e12423a831316873ac8bc7c6a907b376aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c26233ce726fb6f646c1e6f3895d9d5f3df9e86a39e81e54a747684b44ba1286a5c59885fbf3f08eac728bcb6a9eb3e5a086eeb0b294ba313c2179401483221e
|
|
7
|
+
data.tar.gz: 2f8c68f82e0a3ea4ab4646f3d37e567fed8c33c1f03404a22c377425058fd2a06632adfcf734a461213ac86180f4299913fba07eb9bae284139e417e624b687f
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,53 @@ and commands may change between minor versions. How releases are made:
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.177.0] - 2026-11-17
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- chi web: the working-set list is now a view of what is in chi's head, in three groups: **From the start** (every
|
|
16
|
+
part of the system prompt, with its size: tools, the base prompt, the identity memory, model notes, preloaded
|
|
17
|
+
memories, AGENTS.md, plugin sections, the memory indexes), **Read in this session** (files, memories and URLs) and
|
|
18
|
+
**Conversation** (the rest of the context). The line under the header says how much is in chi's head now. Each
|
|
19
|
+
group folds, and the fold is kept per session.
|
|
20
|
+
- chi web: the list's turn picker is a lens. Picking a turn (the arrows, a footprint, the rail) keeps the whole list
|
|
21
|
+
and lights the rows that turn touched with its step tags; the rest dim. The line under the header says what the
|
|
22
|
+
turn touched and how many items were new.
|
|
23
|
+
- chi web: a memory that is in the system prompt and was also read again shows "held twice", with the extra size.
|
|
24
|
+
- Sessions record the sizes of their system prompt's parts (`prompt_parts`), which the list above reads.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- chi web: the working-set list's header no longer shows "N items · ctx %"; the line under it does. On the phone the
|
|
29
|
+
header fits on one line, and the list's rows and buttons are 44 px tall.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- chi web: the working-set list includes model notes in the system prompt and redraws an open list when notes change.
|
|
34
|
+
- /working-set add: refuse to re-read a memory already in the system prompt unless its output is in the working set.
|
|
35
|
+
- chi web: a project memory and a system memory with the same name are no longer shown as one row.
|
|
36
|
+
|
|
37
|
+
Update with `chi update`.
|
|
38
|
+
|
|
39
|
+
## [0.176.0] - 2026-11-16
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- chi web: `web.stage_collapsed` (off by default) starts every session's stage folded to its status row, a
|
|
44
|
+
participant's page too; a session you fold or unfold by hand keeps its own.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- chi web: the stage's fold, the working-set rail's, the composer's fold and its dragged height are kept per
|
|
49
|
+
session (per browser): what you do in one session no longer shows in another, and coming back finds it as you
|
|
50
|
+
left it. A running turn's opened cloud, the steps opened in it and the working-set reader come back too when you
|
|
51
|
+
switch away and back during the same turn (this tab only). The old page-wide choices are not carried over.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- chi web: a participant's failed turn puts their text and images back in their composer (it gave them nothing
|
|
56
|
+
back before); only their own turn does, never the owner's or another participant's.
|
|
57
|
+
|
|
11
58
|
## [0.175.0] - 2026-11-16
|
|
12
59
|
|
|
13
60
|
### Added
|
|
@@ -6433,7 +6480,9 @@ and long-lived sessions.
|
|
|
6433
6480
|
- A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
|
|
6434
6481
|
hotkey panel that send selected text or the clipboard to your sessions.
|
|
6435
6482
|
|
|
6436
|
-
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.
|
|
6483
|
+
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.177.0...HEAD
|
|
6484
|
+
[0.177.0]: https://github.com/dm1try/samagotchi/compare/v0.176.0...v0.177.0
|
|
6485
|
+
[0.176.0]: https://github.com/dm1try/samagotchi/compare/v0.175.0...v0.176.0
|
|
6437
6486
|
[0.175.0]: https://github.com/dm1try/samagotchi/compare/v0.174.0...v0.175.0
|
|
6438
6487
|
[0.174.0]: https://github.com/dm1try/samagotchi/compare/v0.173.0...v0.174.0
|
|
6439
6488
|
[0.173.0]: https://github.com/dm1try/samagotchi/compare/v0.172.1...v0.173.0
|
data/bin/chi
CHANGED
|
@@ -267,6 +267,7 @@ if options[:web]
|
|
|
267
267
|
exit Samagotchi::Web::Server.launch(port: port, scope: options[:scope] || "project", open_browser: options[:web_open],
|
|
268
268
|
markdown: markdown, new_token: options[:new_token], tunnel: options[:tunnel],
|
|
269
269
|
working_set: Samagotchi::Config.get("web.working_set"),
|
|
270
|
+
stage_collapsed: Samagotchi::Config.get("web.stage_collapsed"),
|
|
270
271
|
reload_check: Samagotchi::Config.get("web.reload_check"),
|
|
271
272
|
annotate_presets: Samagotchi::Config.get("web.annotate_presets"),
|
|
272
273
|
editor: Samagotchi::Config.get("web.editor"),
|
data/docs/architecture.md
CHANGED
|
@@ -651,7 +651,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
|
|
|
651
651
|
|
|
652
652
|
| Component | Main file(s) | What it is |
|
|
653
653
|
|---|---|---|
|
|
654
|
-
| Worker | `worker.rb` (`worker_boot.rb`, `worker_idle_exit.rb`, `worker_inbound.rb`, `worker_signals.rb`, `worker_wakes.rb`, `worker_task_wakes.rb`, `task_watch.rb`, `worker_participant_gate.rb`, `worker_exit_claim.rb`) | A session's background process: builds the `Engine` and `Bridge`, runs queued turns and the wake turns nobody typed (delegate reports, a background task that finished unseen: [Finish wake](internals/background-tasks.md#finish-wake), attached context), exits when idle. A spawned one traps TERM, HUP and INT (`WorkerSignals`, installed by `WorkerBoot.run_session_loop` when `SAMAGOTCHI_WORKER_PROCESS=1`): the running turn stops as a Stop with reason `signal`, is saved, and the worker leaves (`:signal`, exit 0; a new worker only for input already queued). A running turn is checkpointed at its iteration boundaries (`TurnCheckpoint`, the `interrupted_turn` mark), and the next worker settles a turn its predecessor died in (`TurnCheckpoint.settle`). The session is saved from the turn's thread, Bridge threads and a signal's thread; `Session#save` takes a per-session lock around its snapshot and write, so an older snapshot never lands over a newer one. `WorkerParticipantGate` is the one seat for "may this participant act" (a queued turn as it starts, the drain, the mid-turn stop, the Continue: [internals/participants.md](internals/participants.md)); `WorkerExitClaim` is the exit claim (`POST /exit`): one lock for the kind being taken and the exit taken. Threads: the gate is loop-thread only (a turn runs on the loop; no lock), the claim is safe from any thread (its own mutex, taken after the event lock). |
|
|
654
|
+
| Worker | `worker.rb` (`worker_boot.rb`, `worker_idle_exit.rb`, `worker_inbound.rb`, `worker_signals.rb`, `worker_wakes.rb`, `worker_task_wakes.rb`, `task_watch.rb`, `worker_participant_gate.rb`, `worker_exit_claim.rb`) | A session's background process: builds the `Engine` and `Bridge`, runs queued turns and the wake turns nobody typed (delegate reports, a background task that finished unseen: [Finish wake](internals/background-tasks.md#finish-wake), attached context), exits when idle. A spawned one traps TERM, HUP and INT (`WorkerSignals`, installed by `WorkerBoot.run_session_loop` when `SAMAGOTCHI_WORKER_PROCESS=1`): the running turn stops as a Stop with reason `signal`, is saved, and the worker leaves (`:signal`, exit 0; a new worker only for input already queued). A running turn is checkpointed at its iteration boundaries (`TurnCheckpoint`, the `interrupted_turn` mark), and the next worker settles a turn its predecessor died in (`TurnCheckpoint.settle`). The session is saved from the turn's thread, Bridge threads and a signal's thread; `Session#save` takes a per-session lock around its snapshot and write, so an older snapshot never lands over a newer one. `WorkerParticipantGate` is the one seat for "may this participant act" (a queued turn as it starts, the drain, the mid-turn stop, the Continue: [internals/participants.md](internals/participants.md)); `WorkerExitClaim` is the exit claim (`POST /exit`): one lock for the kind being taken and the exit taken. Threads: the gate is loop-thread only (a turn runs on the loop; no lock), the claim is safe from any thread (its own mutex, taken after the event lock). The concerns are `include`d parts in `lib/samagotchi/worker/` (`Worker::LeavePart`: exit and leave; `Worker::WakeTurnsPart`: the turns nobody typed; `Worker::StartupPart`: the start-up settle; `Worker::SignalGracePart`: a signal's grace; `Worker::ScratchPart`: a scratch worker whose terminal left; `Worker::ChildSidePart`: a delegate child's rings, Verify fresh verdicts; `Worker::CommandQueuePart`: session commands between turns). `worker.rb` keeps the loop, the wiring, the prompt turns and the drain. They share Worker's ivars, and each header says what it writes and reads. |
|
|
655
655
|
| Config | `config.rb`, `config/restart_watch.rb` | Every setting as an `Entry`: env, config.yml and CLI layers ([configuration.md](configuration.md)); the notice a worker or chi web gets when config.yml changes a setting it reads only at its start. With `log.rb` it is the bottom layer: nothing it references reaches back to it, so `hosts:` and `models:` entries parse next to their types (`HostConfig.all`, `ModelSettings.all`). |
|
|
656
656
|
| Paths | `paths.rb` (`Paths`) | The XDG base dirs chi's files live under, read from the env on every call: `Paths.state_home` (`$XDG_STATE_HOME`, else `~/.local/state`) and `Paths.config_home` (`$XDG_CONFIG_HOME`, else `~/.config`), both defaults under `Dir.home`; a blank variable counts as unset, a relative one is made absolute from the current directory. `Paths.tilde` shows a path with `~` for the home folder. `SessionManager` hands a spawned worker the spawner's `XDG_STATE_HOME` / `XDG_CONFIG_HOME`, when set, made absolute, so a relative one isn't read from the session's folder. |
|
|
657
657
|
| MemoryBundle | `memory_bundle.rb`, `memory_bundle/{installer,builder,installed_bundle,plugin_ref,bundle_hook}.rb` (`Installer`, `Builder`, `InstalledBundle`, `PluginRef`, `BundleHook`) | Installing, building and reading bundles of memories, rules, plugins and scripts (`BundleHook`: an older record's retired class-file hook). |
|
data/docs/cli.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
- `chi web push ls [--format json]`, `chi web push rm ID`, `chi web push test [ID]` — the phones chi web pushes to (see [Phone notifications](configuration.md#phone-notifications-web-push)): list them (short id, label, origin, added, last delivery, done turns, last error; `stale` for one made on another public URL than chi web's now: never sent to), remove one, or send a test notification to ID or to every device not stale. chi web need not run; nothing printed holds a device's push address or keys. A usage error exits 2; a store others can read, a corrupt one, an unknown device or a failed test push exit 1. This machine only: `chi --remote X web push` exits 2
|
|
18
18
|
- `chi web --web-markdown` / `--no-web-markdown` — opt in to, or opt out of, sanitized Markdown rendering for completed assistant messages, the stage's asking text and a resolved question card's reply (`web.markdown`, off by default; `--no-web-markdown` turns a config's `web.markdown: true` off for this run)
|
|
19
19
|
- `chi web --no-web-working-set` — turns the stage view's working set off (on by default; `--web-working-set` turns a config's `web.working_set: false` back on): what each turn brought into the model's context, in the stage and under each finished turn; `?working_set=1|0` on the page URL overrides it (see [The working set](#the-working-set))
|
|
20
|
+
- `chi web --web-stage-collapsed` / `--no-web-stage-collapsed` — every session's stage starts folded to its status row, or not (`web.stage_collapsed`, off by default); a session folded or unfolded by hand keeps its own fold in that browser
|
|
20
21
|
- `chi sessions list|stop|restart|archive|unarchive|delete|prune|clean|stats` — manage persisted sessions; `list` shows this git project's, `list --scope=all` every one, a delegated session with `↳ <parent>`, `list --archived` the archived ones too (see [Sessions](sessions.md)); one line per session (`<id> <state> <ctx> <updated_at> <text> [flags] ↳ … ↪ …`) and one footer (`N session(s) (sort=… order=…)`, or the project note) for the plain list, the `--live`/`--cwd` text and `--remote`. `stats ID` prints a session's cost, tokens and progress, and its own settings (`--set`; a `settings:` line), from a live worker's `GET stats`, else its saved `analytics.json` (`--format json` one object, with `settings`), without running a model turn. A usage error (an unknown subcommand or flag, a flag missing its value, `stop`, `restart` or `delete` with no ids, a bad `list --format`, `--scope`, `--sort` or `--order`, a `--days`, `--keep` or `--limit` that isn't a whole number) exits 2; an unknown or refused session exits 1
|
|
21
22
|
- `chi note [--source NAME] [-m TEXT] (ID|PREFIX)... | --all` — add a context note (TEXT or stdin) to sessions: background the model sees on its next turn; it starts no turn (see [Sessions: Context notes](sessions.md#context-notes))
|
|
22
23
|
- `chi broadcast [-m TEXT] [--all] [--dry-run]`, `chi broadcast log [--last N] [--format json]`, `chi broadcast deliver BROADCAST_ID (ID|PREFIX)...` — share one piece of information (TEXT or stdin) with every session it may concern, as a context note from `broadcast` (see [Broadcast](broadcast.md))
|
|
@@ -1386,11 +1387,15 @@ session bar shows the `mem N` chip again.
|
|
|
1386
1387
|
tooltip goes too): the session's whole set, preloaded (`--memory`) and muted
|
|
1387
1388
|
(`--mute`) memories included; its dot lights when the set changed since you
|
|
1388
1389
|
last opened it.
|
|
1389
|
-
- **The list** the three open (a bottom sheet on a phone):
|
|
1390
|
-
|
|
1390
|
+
- **The list** the three open (a bottom sheet on a phone): always the whole
|
|
1391
|
+
session's set, files grouped by folder (a group opens in place), memories
|
|
1391
1392
|
(used, preloaded, muted) and URLs, each with what was done to it (`read ×2`,
|
|
1392
|
-
`read, edited`, `preloaded`) and a step tag (`s3`, `
|
|
1393
|
-
|
|
1393
|
+
`read, edited`, `preloaded`) and a step tag (`t2·s3`, `prompt` for a preloaded
|
|
1394
|
+
memory) that goes to the call. The header's `session | ‹ turn N ›` is a lens:
|
|
1395
|
+
the chip opens the session, a footprint or the rail opens a turn, and `‹` `›`
|
|
1396
|
+
step through the turns. In a turn's lens the rows that turn touched are lit,
|
|
1397
|
+
with that turn's words and step tag (`s3`), the others dimmed; the line under
|
|
1398
|
+
the header says `turn 2 touched 3 · 1 new`; a folded group still shows its lit rows. A file opens
|
|
1394
1399
|
as its row's title does, a URL in a new tab. A row (on hover or keyboard
|
|
1395
1400
|
focus) and a folded group offer `drop`, which runs `/working-set drop` (see
|
|
1396
1401
|
`/working-set` above); a dropped row offers `undrop`, and so does one whose
|
|
@@ -1627,6 +1632,8 @@ CHI_REMOTE=studio chi context push claude-outbox ab12 < answer.json
|
|
|
1627
1632
|
project's sessions there (`--scope=project --cwd DIR` one project's), each
|
|
1628
1633
|
on the same line a list here prints. `context` takes the session ids (no default session),
|
|
1629
1634
|
and a URL resolves through that machine's bundles.
|
|
1635
|
+
- A participant token can send `--image` too: each file uploads to that grant's
|
|
1636
|
+
participant image route before the turn is sent.
|
|
1630
1637
|
- That machine's config.yml decides what it checks for `send` and `answer`:
|
|
1631
1638
|
a parent agent's `/continue yes` and options (`guardrails.parent_answers`),
|
|
1632
1639
|
a loosening `/parent-answers`, images to a model that can't see them. Each
|
data/docs/configuration.md
CHANGED
|
@@ -2383,6 +2383,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
|
|
|
2383
2383
|
| `web.host` | `127.0.0.1` | yes | `127.0.0.1`, `::1` or `localhost`; `lan` (this machine's private IPv4 address) or one of its IPv4 addresses also opens `chi web` to the network, with an access token, asked of this machine's 127.0.0.1 too (its `Local:` link carries a one-time code; `chi web --new-token` replaces the token; it is chi web's one access token, also used by `--tunnel` and `web.public_url`/a proxy). Anything else binds `127.0.0.1` with a warning. See [CLI: chi web on your phone](cli.md#chi-web-on-your-phone). |
|
|
2384
2384
|
| `web.markdown` | `false` | yes | Render answers as Markdown in `chi web`. |
|
|
2385
2385
|
| `web.working_set` | `true` | yes | The stage view's working set: the files, memories and URLs a turn brought into the model's context, in a rail in the stage, a footprint as each finished turn's block summary and a `set N` chip in place of the mem chip; `false` brings the mem chip back. `?working_set=1` or `?working_set=0` on the page URL overrides it for that page load. See [CLI: the working set](cli.md#the-working-set). |
|
|
2386
|
+
| `web.stage_collapsed` | `false` | yes | Every session's stage in `chi web` starts folded to its status row (the running turn's prompt, steps and cloud behind ▴), a participant's page too. A session you fold or unfold by hand keeps its own fold in that browser (`chi_stage_collapsed:<session>`), whatever this says; one never touched follows it. Read when `chi web` starts: restart it after a change. |
|
|
2386
2387
|
| `web.reload_check` | `false` | yes | Opt-in: once each finished turn has moved into the history, the page reads the session again (one full read per turn end), draws that turn as a reload would and compares the two, strictly: a known divergence counts as a mismatch too. `chi web` logs one `reload_checked` line per check and a `reload_mismatch` line naming the kinds that differed, `excused` (the known divergences, `history_shape.js` `ACCEPTED`, that would explain them) and `explained` (all of them had one), with `turn_id`, `drawn` (the turn came back from its drawing, so a mismatch with `drawn: true` is a drawing bug), `undrawn` (how many of the reload's rows came without their turn's drawing, the page's plain fallback: 0 unless chi web missed a turn) and the worker's version: counts only, never content. The count is `grep -c reload_mismatch` over `grep -c reload_checked` in chi web's log, split by `excused`. The turn's own cards and questions are compared as data, apart from the history: what the page's stream said (`card_registry.js`) against what the read lists (CardStore), each card or question of this turn (`of_turn`) by its id, its kind, its status (answered, cancelled, still asking) and its summary line (a card's title); a difference counts as `card` or `question`. Bodies, buttons, folds, the tag a card is drawn in and where it sits are ignored (the history's compare leaves cards and questions out on both sides; their place is the specs'). A read that lists CardStore's cap of cards and questions may have lost an older one: a card the page has and such a read doesn't is no difference. A question the read gives no turn and no opening stamp for (an older worker) leaves the questions out. A page whose `app.js` is older than its `reload_check.js` (a mixed cache) compares no cards: its `reload_checked` line says `cards_compared: false`. Between-turn cards and notices stay with the e2e reload checks. Every open owner tab runs the check; `chi web` logs a turn's first report only, and starts over when it restarts. |
|
|
2387
2388
|
| `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). |
|
|
2388
2389
|
| `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). |
|
data/docs/internals/bridge.md
CHANGED
|
@@ -455,14 +455,14 @@ The Bridge exposes:
|
|
|
455
455
|
`:command_ran` names, `400` when the line isn't one. `client_id` is required: without one (or a blank one) `400
|
|
456
456
|
missing_client_id` (`Bridge::UNNAMED_COMMAND`); from a sender that may not send commands (`CommandIntake.allowed?`:
|
|
457
457
|
only the owner's senders, `web:`, `tui:`, `cli:send`, and chi answer's `cli:answer`) `403 command_not_permitted`, its
|
|
458
|
-
detail `CommandIntake::COMMAND_REFUSED` (`CommandIntake::REFUSED` for a `!` line), nothing queued. A `:command_ran`'s `output` is the command's, up to `Worker::COMMAND_OUTPUT_LIMIT` (64 KiB of chars; past it
|
|
458
|
+
detail `CommandIntake::COMMAND_REFUSED` (`CommandIntake::REFUSED` for a `!` line), nothing queued. A `:command_ran`'s `output` is the command's, up to `Worker::CommandQueuePart::COMMAND_OUTPUT_LIMIT` (64 KiB of chars; past it
|
|
459
459
|
the text ends with a `[cut: N of M chars: …]` line, which the UIs print as they print the rest). It carries `thinking`, `reasoning_history` and `llm_context`
|
|
460
460
|
(the summaries the next turn runs under) when the command changed them or the model, and
|
|
461
461
|
`confirm: {line, text}` when a `/thinking` or `/reasoning-history` change from a `web:` or `tui:`
|
|
462
462
|
client asks first (`CacheConfirm`; nothing changed, `line` applies it).
|
|
463
463
|
- `POST /session/:id/exit` — ask the worker to exit now (`{client_id:, delete?, restart?, deadline?}`; `delete`:
|
|
464
464
|
`/exit --delete`, no recap written; `restart: true`: hand the session to a new worker on the newest chi
|
|
465
|
-
installed, `200 {status: "restarting"}`; an empty session's `exiting` carries `discard: true`). The worker checks with
|
|
465
|
+
installed, `200 {status: "restarting"}`; an empty session's `exiting` carries `discard: true`; a `stop: "all"` exit's `exiting` carries `stopped`, read with the event log held right after the accept, so a later exit's list is never its own). The worker checks with
|
|
466
466
|
the event log held (`WorkerIdleExit#hold_for_request`): `200 {status: "exiting"}` and it leaves
|
|
467
467
|
like an idle exit, or `409 {status: "held", reason:}` with `turn_running`, `input_queued`,
|
|
468
468
|
`continue_offered`, `client_connected` (a stream not named by the asker), `reminders`,
|
data/docs/internals/engine.md
CHANGED
|
@@ -131,10 +131,10 @@ A Stop (Engine#cancel_current_turn!, the Bridge's POST cancel) or a hook's stop_
|
|
|
131
131
|
A worker's TERM, HUP or INT (WorkerSignals, a spawned worker only):
|
|
132
132
|
→ a Stop with reason :signal (Worker#signalled, off the trap, retried until the loop leaves); saved as after any
|
|
133
133
|
turn; Worker#run returns :signal (:stopped with the stop marker) and takes no new work
|
|
134
|
-
→ not ended within Worker::SIGNAL_GRACE (a turn already in its after_turn hooks gets SIGNAL_HARD_EXIT more,
|
|
134
|
+
→ not ended within Worker::SignalGracePart::SIGNAL_GRACE (a turn already in its after_turn hooks gets SIGNAL_HARD_EXIT more,
|
|
135
135
|
uncanceled): the session saved as it is, SignalException raised in the loop's thread, only while the loop runs
|
|
136
136
|
(never into start, serve or the teardown, which runs whole)
|
|
137
|
-
→ exit! Worker::SIGNAL_HARD_EXIT (10 s) after that at the latest; a signal after the loop left brings only that
|
|
137
|
+
→ exit! Worker::SignalGracePart::SIGNAL_HARD_EXIT (10 s) after that at the latest; a signal after the loop left brings only that
|
|
138
138
|
hard exit
|
|
139
139
|
→ WorkerBoot.run_session_loop restores the default handlers; exit 0, no discard; input queued behind the stopped turn
|
|
140
140
|
wakes a new worker
|
|
@@ -452,8 +452,9 @@ is still downscaled by `ImageStore.fit`, so the tool does read their bytes: thei
|
|
|
452
452
|
magick reading the sniffed format's coder under `-limit memory 256MiB -limit disk 1GiB -limit area 64MP`. An
|
|
453
453
|
upload that raises is audited (`internal_error`) before chi web's 500. The quota is checked under `@participant_images_mutex`, the
|
|
454
454
|
image ingested, then checked again and recorded under it (a race past it is refused there; the stored file may stay
|
|
455
|
-
in `images/`, unreachable to them).
|
|
456
|
-
`
|
|
455
|
+
in `images/`, unreachable to them). The first upload past the attempts cap is audited; later uploads are not, even
|
|
456
|
+
when another refusal takes precedence, so uploads add at most `MAX_IMAGE_ATTEMPTS + 1` audit lines per grant. The
|
|
457
|
+
reply is the ref without `source`, `mime` or `bytes`.
|
|
457
458
|
|
|
458
459
|
**Read back** (`GET …/images/<name>`, `SessionControl#handle_image`): a participant gets the file only when
|
|
459
460
|
`ParticipantUploads.owned?` says they uploaded it (the record proves they had the bytes), with `Cache-Control:
|
|
@@ -462,8 +463,8 @@ headers alike. A revoked or expired grant is refused by the gate (401) as on eve
|
|
|
462
463
|
|
|
463
464
|
**Their turn** takes only refs they uploaded ([Turns](#turns)); **what they see** is their own images as thumbnails
|
|
464
465
|
and anyone else's as "N images" ([What a participant sees](#what-a-participant-sees)). A corrupt or unreadable
|
|
465
|
-
record fails closed (every grant at quota, owning nothing, `Log.warn`); the owner can delete the file.
|
|
466
|
-
|
|
466
|
+
record fails closed (every grant at quota, owning nothing, `Log.warn`); the owner can delete the file. A failed turn
|
|
467
|
+
of theirs gives the text back with its chips (`prompt_restored`, below).
|
|
467
468
|
|
|
468
469
|
## What a participant sees
|
|
469
470
|
|
|
@@ -490,6 +491,10 @@ fields: a field added to an event later reaches nobody until it is named there.
|
|
|
490
491
|
`enqueued_id`, `client_id`, `prompt`, `delivery`, `author`, their image refs; `turn_dequeued`: its `enqueued_id`, never
|
|
491
492
|
the client that took it back, the filter knowing their ids from the `turn_enqueued` it sent them and from
|
|
492
493
|
`ParticipantAccess#own_turn?`; `input_merged`: the count and origins of their own lines only), anyone else's bare;
|
|
494
|
+
`prompt_restored` (a failed turn's prompt handed back, **their own turn only**: the origin's server-stamped author
|
|
495
|
+
is theirs; another person's, the owner's and an author-less one's give nothing; carries `prompt`, `images` as their
|
|
496
|
+
own refs (`.image_refs`), `revises: {turn_id}` and `origin: {client_id, enqueued_id, author}`, never `source`, the
|
|
497
|
+
error, a Verify claim's quote or any other field; the page refills its composer as the owner's, `restore.js`);
|
|
493
498
|
`question_requested` and `continue_offered` with one derived `kind` (`.waiting_kind`: `approval` for a guardrail's
|
|
494
499
|
approval or a relayed one, `continue` for the step-limit question and every offer, `question` else); the main
|
|
495
500
|
page's numbers (`context_status`: usage's `estimated_pct` and token counts, `bucket`, a switch's
|
|
@@ -532,7 +537,8 @@ fields: a field added to an event later reaches nobody until it is named there.
|
|
|
532
537
|
- **The queue.** Their own queued turns (enqueued id and text, for Take back) and how many others wait.
|
|
533
538
|
- **The working set** (`.working_set`: the event and `GET …/working_set`): the file items inside the project, the
|
|
534
539
|
key made relative, with `state`, `tokens`, `ops`, `count`, `pinned`, and the set's `at`. Never a memory or URL
|
|
535
|
-
item, a path outside the project, `first_id`, `has_drop` or the pending `adds`.
|
|
540
|
+
item, a path outside the project, `first_id`, `has_drop` or the pending `adds`. A memory item's `scope` and the
|
|
541
|
+
prompt parts' `scope` reach no participant either: memory items are dropped and their `prompt_parts` is `[]`.
|
|
536
542
|
|
|
537
543
|
### The main page's show
|
|
538
544
|
|
|
@@ -567,7 +573,8 @@ verdicts' (`fresh_running`, `session.verify_unavailable`).
|
|
|
567
573
|
the editor.
|
|
568
574
|
|
|
569
575
|
The main page's `<body>` for a participant (`App#participant_index_data`): `version`, `session`,
|
|
570
|
-
`session-title`, the Annotate presets, the viewer
|
|
576
|
+
`session-title`, the Annotate presets, the viewer, `working-set` (the owner's `web.working_set`) and
|
|
577
|
+
`stage-collapsed` (the owner's `web.stage_collapsed`: a layout default, not a secret); nothing of the
|
|
571
578
|
owner's machine (`home`, the folders, `project-*`, `back-*`).
|
|
572
579
|
- **Their usage** (`viewer.usage`, `ParticipantReview#review_usage`, built from named fields by the exposure policy
|
|
573
580
|
beside `ParticipantView`'s): the fields their grant's exposure shows
|
|
@@ -63,6 +63,9 @@ right-hand column happens.
|
|
|
63
63
|
└──────────────────────────────────────────────────────────────────────────┘
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
- The sections above are recorded as `prompt_parts` (`SystemPrompt#prompt_parts`, `PromptPart`: kind, label, chars,
|
|
67
|
+
tokens at `TokenUsage::CHARS_PER_TOKEN`, ref, a memory part's scope; one per memory, file and plugin section, plus a
|
|
68
|
+
`tools` part): sizes only, worked out once with the build and saved on the session; the prompt's text is unchanged.
|
|
66
69
|
- The system prompt is built **once per key** and kept (`SystemPrompt#build`, keyed by `[chat, thinking, layers]`:
|
|
67
70
|
the loop, the thinking level, the turn's LLM context layers; a `/thinking` change builds under another key). All
|
|
68
71
|
of them are dropped only on `@prompt_builder.reset!`: a model switch (`Engine#switch_model!`), a plugin's
|
|
@@ -29,7 +29,7 @@ page. A factory dep a new version stops passing is the same hazard the other way
|
|
|
29
29
|
out of `send_turn.js`, `session_actions.js` and `lists_view.js`); a page loaded before keeps all its old modules
|
|
30
30
|
until a reload, so the risk is a mixed cache, not an open tab. `answer_fold.js`, `details_motion.js`,
|
|
31
31
|
`turn_range.js`, `history_reveal.js`, `latest.js`, `session_payload.js`, `method_api.js`, `session_store.js`,
|
|
32
|
-
`session_fields.js`, `feature_gates.js`, `revise_stack.js`, `revise_switch.js`, `shell_command.js`, `stale_params.js`, `popover_modal.js`, `more_sheet.js`, `delete_sheet.js` (Deleting a chained session, below), `hash_intent.js` (what the hash asks for: session, all, start or keep), `worker_features.js`, `version_notices.js`, `owner_claim.js`, `owner_verify.js`, `composer_mode.js`, `strip_hidden.js`, `block_open.js`, `text_roots.js`, `block_source.js`, `block_frame.js`, `block_host.js`, `block_watch.js`, `card_stamps.js`, `recap_stamp.js` (a saved recap's place by its `opening_id` stamp, else its count), `inline_widgets.js`, `widget_walk.js`, `widget_picks.js`, `history_shape.js` (the history's shape, live against a reload: the e2e reload checks and the opt-in reload check share its normalizer and its `ACCEPTED` allowlist), `turn_pieces.js` (a finished turn's one order and its answer rule: the live hand-off's `handOffOrder` and `turnEnded`, and a reload's `turnHistoryNodes`), `reload_check.js` (the opt-in `web.reload_check`: after the stage's hand-off, the turn against a reload of it, the counts posted; the history without its cards and questions, and those as data: the page's `card_registry.js` against one seeded from the read, this turn's entries, a capped read's missing keys skipped), `turn_drawing.js` (a finished turn's drawing, `turn_drawings` in the show: its fold into steps and its end kind; `turn_block.js` draws it), `stage_stall.js` (the stage's quiet signal), `stage_quiet_clock.js`, `stage_dom.js`, `stage_answer.js`, `stage_pager.js`, `stage_cloud.js`, `stage_handoff.js`, `stage_place.js`, `stage_probe.js` (the stage's features: below, The stage's modules), `card_kinds.js` (what a card waits as, from its data: the kind, approval and folded-row text the stage's registry takes; the node's read is its cross-check), `card_registry.js` (the open session's cards as data, an observer of the stream's card events and a read's seed: Where state lives), `history_end.js` (the stage's one move of pieces to the history's end), `stage_opened.js` (a running turn opened in the history while a card waits: the lead-in bubble, the moves, the end fold), `stage_asking.js` (the stage's docked card and its fold: the docking and lead-in rules, the opening, a waiting card's own toggle, the folded row's text per kind, the fold's choice, reveal and the docked card's fold; `stage_view.js` wires it), `stage_waiting.js` (the stage's waiting cards as data, keyed by `data-qid` / `data-card-id`: kind, docked, approval, the stage's order, the shown card and its pager, the docked card's fold, kept for this tab in `chi_asking_fold:<session>`; `front`, `count`, `shown`, `blocking`), `stage_cards.js` (the cards that wait in the stage: `PENDING`, `ASKS`, `waitsInStage`, read by `stage_model.js placeKind`), `resync_reach.js` (a re-read that can't reach chi web keeps the drawn history; the status chip says retrying / offline, outside a turn), `session_sync.js` (the open session's sync: `select`, `resync` and its retries, the stream's life; the stream handle and the re-read bookkeeping are its own), `session_view.js` (the open session's view: `renderSessionView` draws a read, `forgetSession` resets the page for another session, `readTurnEnd`, `endTurnView`; app.js makes both right after the cards, each reaching the other and the later views through getters), `participant_main.js`, `participant_bar.js`, `viewer_self.js`, `participant_history.js` (a participant's ↑/↓ list), `stage_owner_wait.js`, `participant_revise.js` (a participant's page: The participant's page, below), `ws_timeline.js`, `ws_cards.js`, `ws_peek.js`, `ws_reader.js`, `ws_way_in.js` (what chi has of a working-set item: below, The working set's reader), `no_contact_fill.js` (a text field that isn't a contact form: autocomplete off and a name with no contact word, against iOS Safari's AutoFill Contact bar; a template's fields carry the same attributes, and its spec checks the page's markup for them) and the `objectives_*.js` modules are new modules for that reason. The last four `block_*` draw fenced blocks (`block_watch.js` finds and watches them, `block_host.js` is its frame drawer for a bundle's renderers): [block-renderers.md](block-renderers.md). `inline_widgets.js` is its core drawer for `chi-ui` blocks, drawing `widget_walk.js`'s and `widget_picks.js`'s widgets in a shadow root styled by `widgets.css`: [inline-widgets.md](inline-widgets.md).
|
|
32
|
+
`session_fields.js`, `feature_gates.js`, `revise_stack.js`, `revise_switch.js`, `shell_command.js`, `stale_params.js`, `popover_modal.js`, `more_sheet.js`, `delete_sheet.js` (Deleting a chained session, below), `hash_intent.js` (what the hash asks for: session, all, start or keep), `worker_features.js`, `version_notices.js`, `owner_claim.js`, `owner_verify.js`, `composer_mode.js`, `strip_hidden.js`, `block_open.js`, `text_roots.js`, `block_source.js`, `block_frame.js`, `block_host.js`, `block_watch.js`, `card_stamps.js`, `recap_stamp.js` (a saved recap's place by its `opening_id` stamp, else its count), `inline_widgets.js`, `widget_walk.js`, `widget_picks.js`, `history_shape.js` (the history's shape, live against a reload: the e2e reload checks and the opt-in reload check share its normalizer and its `ACCEPTED` allowlist), `turn_pieces.js` (a finished turn's one order and its answer rule: the live hand-off's `handOffOrder` and `turnEnded`, and a reload's `turnHistoryNodes`), `reload_check.js` (the opt-in `web.reload_check`: after the stage's hand-off, the turn against a reload of it, the counts posted; the history without its cards and questions, and those as data: the page's `card_registry.js` against one seeded from the read, this turn's entries, a capped read's missing keys skipped), `turn_drawing.js` (a finished turn's drawing, `turn_drawings` in the show: its fold into steps and its end kind; `turn_block.js` draws it), `stage_stall.js` (the stage's quiet signal), `stage_quiet_clock.js`, `stage_dom.js`, `stage_answer.js`, `stage_pager.js`, `stage_cloud.js`, `stage_handoff.js`, `stage_place.js`, `stage_probe.js` (the stage's features: below, The stage's modules), `card_kinds.js` (what a card waits as, from its data: the kind, approval and folded-row text the stage's registry takes; the node's read is its cross-check), `card_registry.js` (the open session's cards as data, an observer of the stream's card events and a read's seed: Where state lives), `history_end.js` (the stage's one move of pieces to the history's end), `stage_opened.js` (a running turn opened in the history while a card waits: the lead-in bubble, the moves, the end fold), `stage_asking.js` (the stage's docked card and its fold: the docking and lead-in rules, the opening, a waiting card's own toggle, the folded row's text per kind, the fold's choice, reveal and the docked card's fold; `stage_view.js` wires it), `stage_waiting.js` (the stage's waiting cards as data, keyed by `data-qid` / `data-card-id`: kind, docked, approval, the stage's order, the shown card and its pager, the docked card's fold, kept for this tab in `chi_asking_fold:<session>`; `front`, `count`, `shown`, `blocking`), `stage_cards.js` (the cards that wait in the stage: `PENDING`, `ASKS`, `waitsInStage`, read by `stage_model.js placeKind`), `resync_reach.js` (a re-read that can't reach chi web keeps the drawn history; the status chip says retrying / offline, outside a turn), `session_sync.js` (the open session's sync: `select`, `resync` and its retries, the stream's life; the stream handle and the re-read bookkeeping are its own), `session_view.js` (the open session's view: `renderSessionView` draws a read, `forgetSession` resets the page for another session, `readTurnEnd`, `endTurnView`; app.js makes both right after the cards, each reaching the other and the later views through getters), `participant_main.js`, `participant_bar.js`, `viewer_self.js`, `participant_history.js` (a participant's ↑/↓ list), `stage_owner_wait.js`, `participant_revise.js` (a participant's page: The participant's page, below), `ws_timeline.js`, `ws_cards.js`, `ws_peek.js`, `ws_reader.js`, `ws_way_in.js` (what chi has of a working-set item: below, The working set's reader), `session_prefs.js` (a session's own view settings, `<key>:<session>`: Storage keys, below), `ws_sections.js` (the working set's head view: its sections from the prompt's parts, [working-set.md](working-set.md), The head view), `ctx_tokens.js` (the context's token count beside its %: `ctxTokens`, below), `stage_view_memory.js` (what was opened of a running turn, per session, in memory: Where state lives), `no_contact_fill.js` (a text field that isn't a contact form: autocomplete off and a name with no contact word, against iOS Safari's AutoFill Contact bar; a template's fields carry the same attributes, and its spec checks the page's markup for them) and the `objectives_*.js` modules are new modules for that reason. The last four `block_*` draw fenced blocks (`block_watch.js` finds and watches them, `block_host.js` is its frame drawer for a bundle's renderers): [block-renderers.md](block-renderers.md). `inline_widgets.js` is its core drawer for `chi-ui` blocks, drawing `widget_walk.js`'s and `widget_picks.js`'s widgets in a shadow root styled by `widgets.css`: [inline-widgets.md](inline-widgets.md).
|
|
33
33
|
|
|
34
34
|
## One page, every viewer
|
|
35
35
|
|
|
@@ -55,7 +55,8 @@ their viewer (The viewer, below), their show and stream are filtered (`Web::Part
|
|
|
55
55
|
| **The history DOM** | the conversation as drawn (a running turn's reason bubble, `.bubble.said`, is live only: see A turn opened in the history): which turn a bubble belongs to (`data-turn-id`, `data-answer-turn`), what opens a turn (`TURN_PROMPT`, `bubbles.js`: a prompt or a wake's note, the same turns `Steer.turn_opening?` counts for a card's `turns_since`), an opening's id for a card's and the saved recap's stamp (`data-turn-id` on a prompt, `data-opening-id` on a wake's note or `/continue no`'s reason line; `card_stamps.js` places a snapshot's card after the stamped opening, `recap_stamp.js` the saved recap after the last turn it covers, each by its count (`turns_since`) only without one), kept command bubbles, which texts were shown, unnamed badges, folded answers and long prompts (`.folded`), Revise stamps (`data-revises` on a prompt; a Verify turn's `data-verify`) and the stacks' folded versions (`.stack-hidden`, `.stack-stub.open`); the switcher's version on view is `revise_stack.js`'s own (a copy `.stack-view` before the top answer, the top `.stack-swapped`; never stored) | `bubbles.js`, `cards_place.js`, `question_cards.js`, `turn_block.js`/`stage_view.js`, `answer_fold.js`, `revise_stack.js`, `stream_handlers.js` (a live `turn_completed`'s `revises` and `verify` onto its prompt) | read back as state: `turn_range.js turnElements` (one walker for a turn's elements), `keptCommandBubbles`, `seedSeenFromDom`, `nameUnnamedBadges`/`nameVerdictCards`, `answer_fold.js` and `revise_stack.js` (their observers decorate every path that fills `#history`; the stacks are `stacks()` of the stamps, read again on each change, never a store field), `history_reveal.js revealInHistory` (the one way a jump unfolds what hides its target) |
|
|
56
56
|
| **A drawn turn** (`turn_drawings` of the full read) | every finished turn, as live drew it: `turnGroups` groups by the stamps only, a turn's stamped items (`drawn: <turn_id>`) one group, and `turnHistoryNodes` draws it by feeding its drawing's events to a live turn block offscreen (`turn_block.js drawnTurnNodes`: the block's own handlers, as the stage's), the stage's extras (a reminder, merged lines, a card that asks or warns) and end as live, then the answer, the merged lines and the steps' texts from their saved items (markdown, refs). Each of its top-level elements carries `data-drawn`: `cards_place.js` leaves that turn's in-turn CardStore entries (`of_turn`) to it, and a kept reminder bubble of that turn (`data-turn-id`) stays out after a resync. chi web sends a drawing for every finished turn (one made from its messages where live wrote none): `drawnGroup` pairs the record the end names (`end.record_id`, by place for a turn saved before turn ids), else by the turn's id, and the answer's `data-answer-turn` is the end's own `turn_id` only (a made-up id, `m…` or `…~N`, keys none: no Revise). Nothing is rebuilt from messages: an item that comes unstamped is a `plain` group drawn as a plain row of its text (its prompt or answer bubble, no steps), the running turn's as expected (`runningTurnId`, the show's `current_turn`: it has no line yet), any other a miss, marked `data-undrawn`, logged once per render (`console.warn`) and counted by the reload check (`undrawn`), never a throw; a drawing with no parts (a minimal line) draws its prompt, answer and end | chi web (the show) | `renderHistory`, the reload check's render |
|
|
57
57
|
| **The cards as data** (`card_registry.js`; app.js `cardRegistry`) | every question, continue offer and plugin card of the open session, keyed as `stage_waiting.js` keys them (`q:<id>`, `c:<id>`, `continue`): its kind and folded text (`card_kinds.js`), status (pending, answered, cancelled; resolved or dropped for the continue offer; asks or shown for a plugin card), `of_turn`, `opening_id`, step, `relayed_to` | `observeCards` around the stream handlers (outside the participant wrap: the page's handler first, then `apply`), so a read's replay feeds it too; `session_view.js renderSessionView` seeds it from the read right before the replay (`seed`: CardStore's listing, the pending question, the continue offer; it replaces), `forgetSession` resets it. Idempotent: a merge per key, a final status never back to pending, the first `of_turn`/`opening_id`/step kept, so seed then replay is what live holds. A question still pending at its turn's end is cancelled (the page cancels the card, no event comes) | an observer: nothing on the page draws from it; its one reader is the opt-in reload check (`reload_check.js`: this turn's entries against a registry seeded from a fresh read). `stage_cuts_parity.test.js` checks it against the stage's waiting cards at each cut, `card_registry.test.js` the events against each cut's seed and replay |
|
|
58
|
-
| **
|
|
58
|
+
| **What was opened of a running turn** (`stage_view_memory.js`, in `session_view.js`) | per session, for this tab: the cloud open, the steps opened in it, the working set's reader on an item; a Map of at most 20 sessions, nothing stored or sent (the peek isn't kept: it closes with its popover) | `session_view.js leaveSession`, from `session_sync.js select` and from `forgetSession` itself for the session it drew last (so the start page, `clearSelection`, keeps it too) before its reset (`captureView`); dropped by `endTurnView` | `renderSessionView`, once the read is drawn: put back (`applyView`) only when the read's running turn (`current_turn.turn_id`) is the one saved; taken either way |
|
|
59
|
+
| **localStorage** (`storage.js` `readStored`/`writeStored`, guarded) | per-browser choices only; a session's view settings per session (`session_prefs.js`) | the module that owns the choice | read at start, a session's view settings again when its view is drawn (see Storage keys) |
|
|
59
60
|
| **SSE** | see Streams | the server | events go into the DOM directly (a participant's through `participant_main.js wrapHandlers` first) |
|
|
60
61
|
|
|
61
62
|
The objectives' strip keeps the list in its own closure (`objectives_strip.js`, seeded by `renderSessionView`, reset by
|
|
@@ -96,12 +97,22 @@ field only when the payload carries it: `session_payload.js` reads its sources f
|
|
|
96
97
|
(`fieldsFromCard`: owner, workerVersion, workerFeatures, bridgeUp; never status), its redraws (store `ORDER` names)
|
|
97
98
|
and its writers. A new field starts in `emptySessionState` and gets an entry (its spec checks both).
|
|
98
99
|
|
|
100
|
+
A source's `undefined` means "this payload doesn't say", never "none": `promptParts` (the show's `prompt_parts`)
|
|
101
|
+
is the case to copy. A turn end's `?tail=1` re-read from an older live worker leaves the key out, so the page keeps
|
|
102
|
+
the parts it has; only a list (`[]` too) replaces them. `ctxTokens` is the context's token count next to `ctxPct`
|
|
103
|
+
(the working set's "in chi's head now · ~X of Y" and its Conversation row): from the same data (`ctx_tokens.js
|
|
104
|
+
ctxTokensOf`: a `context_status`'s `usage.estimated_used_tokens`, a chunk's `counts.total_tokens`), cleared where
|
|
105
|
+
`ctxPct` is (`usage: null`); on load `loadedCtxTokens` turns the live worker's % back into tokens (against the
|
|
106
|
+
window, or the smaller budget), else the saved `timing.context.used_tokens`. It changes with almost every chunk, so it
|
|
107
|
+
has a redraw of its own, `workingSetTokens` (with `ctxWindow`, the line's "of Y"): `workingSet.tokensChanged()` draws
|
|
108
|
+
the open list only when the text it shows of them changes (the head line, the Conversation row's tokens).
|
|
109
|
+
|
|
99
110
|
A changed value (`!==`) marks its field's redraws; `sessions` marks `lists` and `infoBar` (the bar reads the list:
|
|
100
111
|
the chain's ← → links, the children chip, the archived button, the card's title, the fresh link's picker); `selected`
|
|
101
112
|
marks `paintActive`, `composer` and `infoBar`; `touch(name)` marks one redraw for an input the store doesn't hold
|
|
102
113
|
(the clock, versions, the stream, `liveTurn.running`). They run synchronously, once each, at the end of the outermost
|
|
103
114
|
`batch()` (at once for a bare write), in one `ORDER`: `lists`, `paintActive`, the open panels (`settingsPanel`,
|
|
104
|
-
`workingSetStrategy`), `featureGates`, `composer`, `infoBar`. `lists` comes before
|
|
115
|
+
`workingSetStrategy`, `workingSet`, `workingSetTokens`), `featureGates`, `composer`, `infoBar`. `lists` comes before
|
|
105
116
|
the bar because `updateSessionTitle` reads the strip's active card; `composer` before the bar as `setTurnRunning`
|
|
106
117
|
runs them. Not a rAF (a background tab runs none, and the title badge tests run there; the e2e per-frame checks would
|
|
107
118
|
see the composer move a frame late) and not a microtask (code that reads the page right after a write would see it
|
|
@@ -109,7 +120,8 @@ stale).
|
|
|
109
120
|
|
|
110
121
|
**The redraws are registered, not called.** app.js registers each name once (`store.on`, at the bottom, once every
|
|
111
122
|
piece a redraw calls exists): `lists` → `lists.render()`, `paintActive` → `lists.paintActive()`, `settingsPanel` →
|
|
112
|
-
`settingsControl.refresh()`, `workingSetStrategy` → `workingSet.strategyChanged()`, `
|
|
123
|
+
`settingsControl.refresh()`, `workingSetStrategy` → `workingSet.strategyChanged()`, `workingSet` →
|
|
124
|
+
`workingSet.sessionChanged()`, `workingSetTokens` → `workingSet.tokensChanged()`, `featureGates` (below), `composer` →
|
|
113
125
|
`composerMode.update()` (`composer_mode.js`), `infoBar` → `updateInfoBar()`. A writer writes and stops there: no `updateInfoBar()` after
|
|
114
126
|
a store write. A value written unchanged redraws nothing (a chunk with the same ctx %).
|
|
115
127
|
|
|
@@ -470,8 +482,10 @@ edge, with **a shrink for each asking form and after an answer** (`forgetContent
|
|
|
470
482
|
|
|
471
483
|
**The stage's fold** (`stage_model.js stageCollapsed`, `stage_asking.js`): collapsed to its status row the stage holds no
|
|
472
484
|
frame (`frameTarget` returns null) and an unfold refits to what shows. Three things decide it, kept apart: the user's
|
|
473
|
-
**choice** (the ▾ by hand, in memory, written to `chi_stage_collapsed
|
|
474
|
-
|
|
485
|
+
**choice** (the ▾ by hand, in memory, written to the session's `chi_stage_collapsed:<session>`; read again only when
|
|
486
|
+
a session's view is drawn, `stage_asking.js reloadChoice` from `session_view.js applyPrefs`, never to decide
|
|
487
|
+
meanwhile, so another tab's write doesn't apply live; a session never folded by hand takes the page's default,
|
|
488
|
+
`web.stage_collapsed`), **revealed** (a ref's "show in turn" opened it for this turn; the choice stays)
|
|
475
489
|
and **the docked card's fold** (the waiting card the user folded, by its key, held in `chi_asking_fold:<session>`
|
|
476
490
|
in sessionStorage: this tab's own, so a reload or a resync mid-turn draws it folded as it was — `stage_waiting.js`
|
|
477
491
|
writes it on the fold and reads it back in `trackFold` once the replay has drawn the card; it goes when that card is
|
|
@@ -480,7 +494,7 @@ fold that names that card, so a replay or a history question answering another c
|
|
|
480
494
|
when the turn hands off (`clearFold`), and when the page opens another session (`session_sync.js select`, only when a
|
|
481
495
|
session was open); `reset` clears the memory only, so the replay can take the fold back). In the
|
|
482
496
|
asking form only that fold counts: the ▾ and a tap on the folded row set or clear it and write nothing to
|
|
483
|
-
`chi_stage_collapsed
|
|
497
|
+
`chi_stage_collapsed:<session>` (another blocking card that comes to wait meanwhile
|
|
484
498
|
drops it, so the stage opens on the front card), so a card always arrives open (in the card's task, before
|
|
485
499
|
`question_cards.js focusWhenIdle` focuses it) and a new one never matches an old fold; the same card drawn again with its
|
|
486
500
|
id keeps it. The fold reads the registry, which every answer settles in its own task, so a card answered in the same
|
|
@@ -685,16 +699,29 @@ reach another device or the server.
|
|
|
685
699
|
| Key | Module | What |
|
|
686
700
|
|---|---|---|
|
|
687
701
|
| `chi_model`, `chi_model_recent` | `model_pick.js`, `model_picker.js`, `start_page.js` | the start page's model and its recent list |
|
|
688
|
-
| `chi_composer_collapsed
|
|
689
|
-
| `chi_composer_floor
|
|
702
|
+
| `chi_composer_collapsed:<session>` | `composer_grip.js` (through `session_prefs.js`) | the session's composer folded (a card's text field folds it for the time it has the focus on a narrow or touch screen, `composer_grip.js watchCardField`, on top of this and of the visit's state: neither is written) |
|
|
703
|
+
| `chi_composer_floor:<session>` | `composer_grip.js`, `composer_mount.js` (through `session_prefs.js`) | the session's composer's dragged height (the start page's: in memory) |
|
|
690
704
|
| `chi_strip_hidden` (`chi_zen`: the old name, read once) | `strip_hidden.js` | the session strip hidden |
|
|
691
|
-
| `chi_stage_collapsed
|
|
692
|
-
| `chi_working_set_collapsed
|
|
705
|
+
| `chi_stage_collapsed:<session>` | `stage_asking.js` (through `session_prefs.js`) | the session's stage collapsed or opened by hand (not written from the asking form, whose fold is that question's only); none: the page's default, `<body data-stage-collapsed="1">` (`web.stage_collapsed`), else open |
|
|
706
|
+
| `chi_working_set_collapsed:<session>` | `working_set_rail.js` (through `session_prefs.js`) | the session's working set rail collapsed |
|
|
707
|
+
| `chi_ws_sections_folded:<session>` | `working_set_view.js` (through `session_prefs.js`; the key is `ws_sections.js WS_SECTION_FOLD`) | the working-set list's sections folded by hand, a JSON list of keys (`start`, `read`, `talk`); none: all open |
|
|
693
708
|
| `chi_markdown_tip_dismissed` | `markdown_tip.js` | the markdown tip dismissed |
|
|
694
709
|
| `chi_update_available_shown` | `version_notices.js` | update notices already shown |
|
|
695
710
|
| `chi_notify`, `chi_push_device` | `notifications.js` (an injected storage) | the bell's state, this device's push id |
|
|
696
711
|
| `chi_answer_fold:<session>` | `answer_fold.js`, `revise_stack.js` | the answers and long prompts (`<turn id>:prompt`) folded by hand, and the Revise stubs unfolded by hand (`stub:<turn id>`) (swept with the session list) |
|
|
697
712
|
|
|
713
|
+
**A session's view settings** (`session_prefs.js`): the five `<key>:<session>` keys above (the fifth's name is
|
|
714
|
+
defined in `ws_sections.js`, a new module, so `session_prefs.js` exports nothing new: the mixed-cache rule). `read(key, session)` is the
|
|
715
|
+
session's own value, else the page's default (only the stage fold has one: `web.stage_collapsed` on `<body>`), else
|
|
716
|
+
the module's; `write(key, session, value)` writes the session's key only; with no session (the start page) the value
|
|
717
|
+
stays in memory until a reload. Each module reads its value again when a session's view is drawn (`session_view.js
|
|
718
|
+
applyPrefs`: at the end of `forgetSession`, so on a select once the new session is set, and at the start of each
|
|
719
|
+
`renderSessionView`): `stage_view.js applyPrefs` (the stage's fold, `stage_asking.js reloadChoice`, and the rail's),
|
|
720
|
+
`composer_mount.js applyPrefs` (the floor; the fold is read at each call). The list's section folds are read at each draw. One sweep for the five
|
|
721
|
+
(`sweepSessionPrefs`, app.js `sweepFoldsOnce`, next to `sweepAnswerFolds`): only on an unscoped list, since these keys
|
|
722
|
+
hold no project root. The old page-wide keys (`chi_stage_collapsed`, `chi_composer_floor`, `chi_composer_collapsed`,
|
|
723
|
+
`chi_working_set_collapsed`, no `:<session>`) are no longer read or written, and left in storage as they were.
|
|
724
|
+
|
|
698
725
|
sessionStorage (this tab only, `storage.js` `readSession`/`writeSession`/`removeSession`, guarded the same way):
|
|
699
726
|
`chi_client_id` (`turn_events.js`: this tab's client id, kept over a reload mid-turn),
|
|
700
727
|
`chi_asking_fold:<session>` (`stage_waiting.js`: the docked card the user folded and how many cards waited at the
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# The working set: what the model really has
|
|
2
2
|
|
|
3
3
|
The stage view's working set (`web.working_set`, [cli.md](../cli.md#the-working-set)) shows the files, memories
|
|
4
|
-
and URLs a session's tool runs brought into the model's context
|
|
4
|
+
and URLs a session's tool runs brought into the model's context, and model notes carried in the system prompt as
|
|
5
|
+
`prompt` rows. The page builds the set itself from its tool rows
|
|
5
6
|
(`working_set.js`, phase 1). The server says what the model still has of each item: **live**, **stale** (a file
|
|
6
7
|
changed since the model last saw it) or **forgotten** (nothing of it is still sent), and its size in tokens. This
|
|
7
8
|
page covers the server's side and how the page overlays it.
|
|
@@ -49,8 +50,13 @@ is pure and returns a `WorkingSet::Snapshot` (`items`, `at`: the conversation's
|
|
|
49
50
|
key). Each `WorkingSet::Item` is `kind` (`file`, `memory`, `url`), `key`, `state` (`live`, `stale`, `forgotten`,
|
|
50
51
|
`dropped`), `tokens`, `ops`, `count`,
|
|
51
52
|
`first_id` (the first run's ToolIds id), `pinned` (the session's `working_set_pins` name it, whatever the
|
|
52
|
-
strategy: the page shows the mark only under forget, so a switch shows it at once)
|
|
53
|
-
outputs holds the user's applied drop, whatever the state: an undrop has something to take back)
|
|
53
|
+
strategy: the page shows the mark only under forget, so a switch shows it at once), `has_drop` (any of its content
|
|
54
|
+
outputs holds the user's applied drop, whatever the state: an undrop has something to take back) and, for a memory,
|
|
55
|
+
`scope`: the scope its latest `memory_read` answered from (the memory stamp's file, as `MemoryPart#scope` reads it;
|
|
56
|
+
`memory_item_scope`, no text read), in `to_h` only when known (nil for a memory only written, or read before memory
|
|
57
|
+
stamps). Cost: one field per memory item, from the stamp lookup the stale check makes anyway. Known limit: the set
|
|
58
|
+
has one item per memory name, so a session that read both a project `x` and a system `x` has one item carrying the
|
|
59
|
+
latest read's scope. The Engine's event and the GET
|
|
54
60
|
both pass the session's pins.
|
|
55
61
|
|
|
56
62
|
**Runs.** It pairs the runs twice with `LLMContextStale.paired_runs`: once on the stored conversation, once on what
|
|
@@ -220,9 +226,11 @@ projection), on both loops. It costs one model step; a model may skip it (the no
|
|
|
220
226
|
- **`WorkingSetSteer.add`** refuses an item already added (pending), a URL not http(s) (`web_fetch` fetches only
|
|
221
227
|
those), what the caller's `found` look says can't be read (`WorkingSetCommand#missing`: a file not there or a
|
|
222
228
|
directory; a memory name `memory_read` rejects or that neither scope holds), an item holding the user's drop
|
|
223
|
-
(`undrop_first`: undrop brings it back without a step),
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
(`undrop_first`: undrop brings it back without a step), one already in the system prompt and with no working-set
|
|
230
|
+
output (`in_prompt`: nothing to add), and one the model has whole (`already_sent`: live, a read of it sent). The
|
|
231
|
+
prompt-only refusal doesn't apply when the set holds a read of that memory: a stale or forgotten item may still be
|
|
232
|
+
added as the web row's `refresh`. **`unadd`** takes a pending add back (free); without one it is refused
|
|
233
|
+
(`not_added`).
|
|
226
234
|
- **The note**: an add always joins it (`the user added lib/tax.rb, memory style to your context: before anything
|
|
227
235
|
else, load them with read "/abs/lib/tax.rb", memory_read "style"`); a file is named by its absolute path in the
|
|
228
236
|
call, since a `read` resolves a relative path against the process's folder. An unadd cancels its add there.
|
|
@@ -316,6 +324,69 @@ passes `working_set_updated` to it, and does nothing when the flag is off. A new
|
|
|
316
324
|
`details_motion.js` skips `.ws-foot`, and `footClick` cancels the click;
|
|
317
325
|
- the rail (`onServer`, the stage's `scheduleRefresh`).
|
|
318
326
|
|
|
327
|
+
**The list's lens.** The expanded list is always the session's set (`sessionSet()`), seen through a lens: `null`
|
|
328
|
+
(the session) or a turn's index (`createWorkingSet`'s `lens`). The chip (and the reader's `‹ Set`, `openList`) opens the
|
|
329
|
+
session lens; a footprint (`footClick`) and the rail (`openTurn`) open the lens on their turn. In a turn lens
|
|
330
|
+
(`working_set.js turnLens`, `lensItem`) the rows the turn touched are `lit` and the rest `dim` (`opacity:
|
|
331
|
+
var(--ws-lens-dim)`, a `:root` token in both palettes). A lit row is the session item's state, tokens and actions with
|
|
332
|
+
the turn item's `at`, ops and count (its step tag is the turn's, `s3`; a dimmed row keeps the session's, `t1·s3`): the
|
|
333
|
+
turn item is passed through, the session item is never overwritten. The header's `session | ‹ turn N ›` steps over the
|
|
334
|
+
finished turns and the running one (`lastTurn()`), `‹` and `›` disabled at the ends; the line under it reads "turn N
|
|
335
|
+
touched A · B new" (new: the session set's first `at` is this turn's, a prompt memory never). A folded inner group
|
|
336
|
+
(`labelsTemplate`) shows its lit members while folded. A new seed that leaves the lens past the last turn, or a reset
|
|
337
|
+
that drops the running turn, puts it back to the session.
|
|
338
|
+
|
|
339
|
+
**The head view: sections** (`ws_sections.js headSections`, drawn by `working_set_view.js headTemplate`). With the
|
|
340
|
+
session's `prompt_parts` (the worker's sizes of its system prompt; `promptParts` on the page) the list is what is in
|
|
341
|
+
chi's head, in three sections:
|
|
342
|
+
- **From the start** (`start`): every part in prompt order, the tools part first. A memory part (identity, a model
|
|
343
|
+
note, a preload) IS a memory row: merged with the session set's rows of the same memory, else a row of its own
|
|
344
|
+
(identity: the set never lists it). **The match is scope + name** (`same`): the names match (`memoryName`, which
|
|
345
|
+
also reads an older page's preloaded `system/x` as `x`) and so do the scopes (the part's `scope`, the item's from the
|
|
346
|
+
server, `overlay`); a scope either side lacks (an older worker's part or item, an item the server hasn't stamped)
|
|
347
|
+
matches by name alone, as before scopes. So a project `x` read beside a system `x` in the prompt is two rows: the
|
|
348
|
+
read stays in Read as a plain read (not "prompt", never held twice), and the part's own row gets the key `x@system`
|
|
349
|
+
(no collision with the read's `x`), its words its scope ("preloaded · system") and, like identity's, no actions or
|
|
350
|
+
peek. A note and a preload of one name and scope stay one row with both sizes; of two scopes, two rows. The start
|
|
351
|
+
section tracks the items it shows by identity, not by key. It keeps the memory row's peek, state and the drop/pin rules of a preloaded memory (not
|
|
352
|
+
droppable or pinnable until read). Its tokens are the part's, plus `+X` for the read's (the item's server tokens: a
|
|
353
|
+
preloaded row carries none of its own, so the two never double-count). Other parts are read-only `part` rows: a
|
|
354
|
+
label, a sub (the tools part's "N declared"; dropped on a phone), `~tokens`, no actions, no peek; a turn lens dims
|
|
355
|
+
them.
|
|
356
|
+
- **Read in this session** (`read`): today's files / memories / urls folds (`bodySections`), minus the memories the
|
|
357
|
+
start section shows. Its meta: held (not struck) and out (forgotten or dropped); its tokens the held items'.
|
|
358
|
+
- **Conversation** (`talk`): one row at section level, "Conversation · N turns ~X" (`headSections` still returns the
|
|
359
|
+
section; `headTemplate` draws it headerless, no fold; never lit, so dim in a turn lens),
|
|
360
|
+
`ctxTokens − Σ parts − Σ held items' tokens` (the read
|
|
361
|
+
section's and the start memories' reads), shown only when `ctxTokens` is known and the rest is > 0. Mixed units,
|
|
362
|
+
accepted: parts and items are chars/4, `ctxTokens` the server's count or chi's estimate (which on a chat host leaves
|
|
363
|
+
the tool schemas out, so without server usage the rest can go negative and the row hides); the "~" says so.
|
|
364
|
+
|
|
365
|
+
**Held twice.** A start memory row whose ops include `read` is held twice: in the prompt and in a read's output. The
|
|
366
|
+
session lens tags it `held twice` (warn tokens); a turn lens whose items read it lights it amber with a note under it:
|
|
367
|
+
"read again in this turn: already in the prompt, held twice (+X)". A lens lights a merged row by any of its merged
|
|
368
|
+
keys (`lensTouched`), and a part-only start row (no merged item, e.g. `x@system`) by its bare name too: a turn's rows
|
|
369
|
+
come from tool titles, which carry no scope, so in a turn lens a project `x` read lights a system `x`'s own row (lit,
|
|
370
|
+
not held twice: that row holds no read). A row with a merged item lights by its items' keys only. A turn lens counts
|
|
371
|
+
new over `headItems` (the set as the head view sees it: another scope's read is a plain read, not the prompt's), so a
|
|
372
|
+
project `x` first read beside a system `x` preload is new. It never counts a prompt memory as new (`promptKeys`, out of `turnLens`'s list). A forget or a
|
|
373
|
+
drop strikes the row where it stands (today's state words); the server knows an item's state now, not the turn that
|
|
374
|
+
changed it, so a turn lens has no forget count.
|
|
375
|
+
|
|
376
|
+
**Section folds.** Each section header folds (`data-ws="section"`), per session (`chi_ws_sections_folded:<session>`,
|
|
377
|
+
`session_prefs.js`); none stored: all open. Conversation has no header to fold: a stored `talk` (an older page's) is
|
|
378
|
+
ignored (`foldedSections`) and the next toggle writes the list without it. Folded, a section shows only the rows the lens lights (the read section's
|
|
379
|
+
lit members flat, without their inner groups). The header carries no size (the name, the lens, the ring
|
|
380
|
+
and ×: one line on a phone at 390 px); the line under it does. The session lens's: "in chi's head now · ~X of Y"
|
|
381
|
+
(`headLine`: X `ctxTokens`, Y the window; no "of Y" without one). Without parts or without `ctxTokens` that line is
|
|
382
|
+
the size line instead, "N items · ctx N %" (`.ws-size-line`), so the list never lacks a size; a turn lens has its
|
|
383
|
+
touched line only. The tokens-change check (`tokenText`) compares both lines' text. On a phone's sheet rows, section
|
|
384
|
+
headers and the lens buttons are 44 px targets.
|
|
385
|
+
|
|
386
|
+
**No parts** (an old session file, a worker before `prompt_parts`, a participant's list: `[]`): `headSections` is
|
|
387
|
+
null and the list is the flat files / memories / urls one with the lens unchanged. A turn end's `?tail=1` from an
|
|
388
|
+
older live worker leaves the key out: the page keeps the parts it has (`session_fields.js`: unknown is not none).
|
|
389
|
+
|
|
319
390
|
A state is the item's state now, not when its turn ran. A state change never refolds and never moves a line: the
|
|
320
391
|
rail's line key carries the label's state and its forgotten count, which are patched in place.
|
|
321
392
|
|