samagotchi 0.183.0 → 0.184.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 +40 -1
- data/docs/architecture.md +11 -10
- data/docs/bundles.md +1 -1
- data/docs/configuration.md +2 -1
- data/docs/internals/bridge.md +1 -1
- data/docs/internals/bundles.md +6 -2
- data/docs/internals/engine.md +2 -1
- data/docs/internals/participants.md +1 -1
- data/docs/internals/prompt-caching.md +8 -1
- data/docs/internals/remote-sessions.md +19 -3
- data/docs/internals/web-frontend.md +15 -10
- data/docs/internals/web-push.md +11 -0
- data/docs/internals/working-set.md +238 -6
- data/docs/mcp-server.md +5 -1
- data/docs/memory.md +2 -1
- data/docs/plugins.md +6 -6
- data/docs/scheduling.md +14 -0
- data/docs/sessions.md +1 -1
- data/docs/thin-clients.md +29 -10
- data/lib/samagotchi/bridge_client.rb +12 -4
- data/lib/samagotchi/bundle_command/check.rb +20 -2
- data/lib/samagotchi/bundle_manifest.rb +5 -1
- data/lib/samagotchi/bundles/mcp/http_client.rb +79 -54
- data/lib/samagotchi/bundles/mcp/manifest.yml +2 -2
- data/lib/samagotchi/bundles/system/manifest.yml +2 -2
- data/lib/samagotchi/bundles/system/self_map.md +7 -2
- data/lib/samagotchi/engine/session.rb +14 -6
- data/lib/samagotchi/engine/turn_helpers.rb +4 -3
- data/lib/samagotchi/mcp_server/http.rb +3 -3
- data/lib/samagotchi/mcp_server/protocol.rb +23 -4
- data/lib/samagotchi/mcp_server/stdio.rb +1 -0
- data/lib/samagotchi/mcp_server/tools.rb +2 -1
- data/lib/samagotchi/model_notes.rb +34 -12
- data/lib/samagotchi/prompt_files.rb +11 -4
- data/lib/samagotchi/prompt_layout.rb +88 -0
- data/lib/samagotchi/prompt_part.rb +82 -20
- data/lib/samagotchi/reply_wait.rb +6 -3
- data/lib/samagotchi/schedule_command.rb +18 -4
- data/lib/samagotchi/schedules.rb +40 -8
- data/lib/samagotchi/session_access/ask.rb +53 -12
- data/lib/samagotchi/session_access/exchange.rb +5 -2
- data/lib/samagotchi/session_access/local.rb +11 -2
- data/lib/samagotchi/session_inbox.rb +15 -0
- data/lib/samagotchi/session_manager/delivery.rb +8 -4
- data/lib/samagotchi/system_prompt.rb +196 -161
- data/lib/samagotchi/tools/memory.rb +11 -3
- data/lib/samagotchi/turn_stages/warmup.rb +2 -2
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +1 -2
- data/lib/samagotchi/web/ask_routes.rb +89 -19
- data/lib/samagotchi/web/mcp_route.rb +7 -4
- data/lib/samagotchi/web/public/delete_sheet.js +20 -18
- data/lib/samagotchi/web/public/removal_sheet_model.js +3 -4
- data/lib/samagotchi/web/public/running_tasks.js +0 -16
- data/lib/samagotchi/web/public/session_actions.js +0 -9
- data/lib/samagotchi/web/public/working_set_view.js +167 -21
- data/lib/samagotchi/web/public/ws_part_peek.js +277 -0
- data/lib/samagotchi/web/public/ws_peek.js +3 -1
- data/lib/samagotchi/web/public/ws_preview.css +30 -0
- data/lib/samagotchi/web/public/ws_reader.js +7 -3
- data/lib/samagotchi/web/public/ws_sections.js +37 -7
- data/lib/samagotchi/web/push/notifier.rb +33 -6
- data/lib/samagotchi/web/server.rb +1 -1
- data/lib/samagotchi/web/session_hub.rb +26 -4
- data/lib/samagotchi/web/working_set_routes.rb +93 -5
- data/lib/samagotchi/worker_link.rb +2 -2
- data/lib/samagotchi/working_set.rb +162 -90
- data/lib/samagotchi/working_set_locator.rb +221 -0
- data/lib/samagotchi/working_set_own_changes.rb +221 -0
- data/lib/samagotchi/working_set_part.rb +281 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4fa7ea0128fca17683c36d4351d46709ad875b456ec70f654c32ea5cd03ae195
|
|
4
|
+
data.tar.gz: df253a823daf0b25c60eac2feadde85d42f0be804a3af01baf334c690971c5f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 516793e450b783e6adb6ebb3b12b35f47562e32ebb31684b050da2ab8c489fe137e7429806506b25213897773aef64645c60cacf912cb82c212b211408a5ef2c
|
|
7
|
+
data.tar.gz: a12c2786b0df4ce77496b4721a21591f330dc66929b853fcfc0a83f5e5c9fd35b8379b2890c70c1d28a07d3129b0a49134d0f86ff8ca10b7d2e9d4ae6153ea4e
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,44 @@ and commands may change between minor versions. How releases are made:
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.184.0] - 2026-11-22
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- The web's working set: every "From the start" row has a ▸ that shows the text chi was sent for that part of its
|
|
16
|
+
prompt (a memory, AGENTS.md, the base prompt, the tools' names and sizes), with a tab per hold when a memory is in
|
|
17
|
+
the prompt twice or was also read. The list is 520 wide always, so opening a row no longer moves the others.
|
|
18
|
+
- The web's working set: a "From the start" row whose memory or AGENTS.md changed after chi was sent it says `stale`,
|
|
19
|
+
and its "now · changed" tab shows the difference and when chi gets the new text (a stopped session too). When chi
|
|
20
|
+
changed it itself, the row says `✎ edited` and links the call instead: chi has the new text in its conversation.
|
|
21
|
+
- The phone gets a notification when chi web's schedule tick turns off a recurring schedule that kept failing or
|
|
22
|
+
being skipped, with the last reason and the `chi schedule enable` that turns it back on.
|
|
23
|
+
- A thin client's ask takes an optional `request_id`: the same ask sent again (a retry after a dropped connection)
|
|
24
|
+
answers the first one's turn instead of running it twice.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- An ask of `/continue yes` (a thin client's `POST …/ask`, an MCP host's `chi_ask`) waits for the continued turn and
|
|
29
|
+
answers its reply, or a wait token while it runs, instead of `status: command`.
|
|
30
|
+
- The web's working set: a memory chi read and then edited itself no longer says `read · stale`.
|
|
31
|
+
- For bundle authors, nested plugin-part names say how to list the file; `chi bundle check` warns when an unlisted
|
|
32
|
+
`.rb` under a subdirectory won't be installed (but not under `spec/` or `test/`).
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- A thin client's ask and an MCP host's `chi_ask` over `POST /api/mcp` answer within about 45 s even when the
|
|
37
|
+
session's worker hangs taking the message in (it could take more than a minute, past Claude Code's 60 s limit).
|
|
38
|
+
- The mcp bundle: concurrent tool calls whose remote session expired wait for one new session instead of failing with
|
|
39
|
+
"the session expired (404)" or sending a half-initialized request.
|
|
40
|
+
- chi as an MCP server refuses a request id that is an object, an array or a boolean (JSON-RPC -32600) instead of
|
|
41
|
+
echoing it, and answers a message with an id but no method with -32600 instead of leaving the host waiting.
|
|
42
|
+
- The web's delete sheet: closing it during "Stop its worker, then delete" no longer leaves the worker stopped and the
|
|
43
|
+
session in place; the delete goes on and a toast says how it went.
|
|
44
|
+
- `chi schedule enable` resets a schedule's skip and failure counts, so its next skip no longer turns it off again;
|
|
45
|
+
`chi schedule list --all` says whether skips or failures turned a schedule off.
|
|
46
|
+
|
|
47
|
+
Update with `chi update` (the mcp bundle is now 0.9.1).
|
|
48
|
+
|
|
11
49
|
## [0.183.0] - 2026-11-22
|
|
12
50
|
|
|
13
51
|
### Added
|
|
@@ -6710,7 +6748,8 @@ and long-lived sessions.
|
|
|
6710
6748
|
- A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
|
|
6711
6749
|
hotkey panel that send selected text or the clipboard to your sessions.
|
|
6712
6750
|
|
|
6713
|
-
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.
|
|
6751
|
+
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.184.0...HEAD
|
|
6752
|
+
[0.184.0]: https://github.com/dm1try/samagotchi/compare/v0.183.0...v0.184.0
|
|
6714
6753
|
[0.183.0]: https://github.com/dm1try/samagotchi/compare/v0.182.0...v0.183.0
|
|
6715
6754
|
[0.182.0]: https://github.com/dm1try/samagotchi/compare/v0.181.0...v0.182.0
|
|
6716
6755
|
[0.181.0]: https://github.com/dm1try/samagotchi/compare/v0.180.0...v0.181.0
|
data/docs/architecture.md
CHANGED
|
@@ -338,20 +338,21 @@ The full request layout, what breaks the cache and the rules for changes:
|
|
|
338
338
|
|
|
339
339
|
#### Subscribing to the live stream (and the bridge)
|
|
340
340
|
|
|
341
|
-
For an **always-on** consumer (an external SSE client, a second UI),
|
|
342
|
-
`Engine#
|
|
341
|
+
For an **always-on** worker-side consumer (an external SSE client, a second UI), take the
|
|
342
|
+
Worker's `Engine#event_log` and subscribe directly to that `SessionObserver`. It is a thread-safe,
|
|
343
343
|
error-isolated fan-out with a monotonic `event_seq` on every event:
|
|
344
344
|
|
|
345
345
|
```ruby
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
log = engine.event_log
|
|
347
|
+
handle = log.subscribe(observer: ->(event) { ... }) # observer receives {..., event_seq:}
|
|
348
|
+
log.unsubscribe(handle: handle)
|
|
348
349
|
engine.session_state_snapshot # => { status:, message_count:, last_prompt:, event_seq: }
|
|
349
350
|
```
|
|
350
351
|
|
|
351
|
-
`Engine#subscribe` forwards to the Engine's
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
352
|
+
`Engine#subscribe` forwards to this event log for the Engine's own parts and the one-shot host, but worker hosts hold
|
|
353
|
+
`Engine#event_log` directly. The Worker reads it once after it built the Engine and hands it to the Bridge and to its
|
|
354
|
+
own collaborators (`ContinueOffer`, `WorkerParticipantGate`, `WorkerTaskWakes`, `WorkerInbound`), which subscribe,
|
|
355
|
+
announce and take the event lock on it directly. The same goes for the turn state,
|
|
355
356
|
the question desk and the steer cut (`Engine#turn_state`, `#question_desk`, `#steer_cut`): the Worker hands them to the
|
|
356
357
|
Bridge (which hands the desk on to `RelayVerifier` and `RelayWatcher`) and to `WorkerInbound`, `WorkerIdleExit` and
|
|
357
358
|
`ContinueOffer`, which call them directly instead of the Engine's forwards. The bridge
|
|
@@ -508,7 +509,7 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
|
|
|
508
509
|
| `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` |
|
|
509
510
|
| `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`) |
|
|
510
511
|
| `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` |
|
|
511
|
-
| `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`) | 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
|
|
512
|
+
| `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` |
|
|
512
513
|
| `POST /api/mcp` (`GET`, `DELETE`) | owner | one JSON-RPC message of MCP (112 KiB: a 16 KiB prompt JSON-escaped), either revision: the current one with `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers matching the body, the earlier one with the `Mcp-Session-Id` its `initialize` handed out (and an `MCP-Protocol-Version`, if any, that chi serves) | 200 the JSON-RPC answer (a tool's refusal is a result with `isError`), 202 for a notification; `GET` 405 (`Allow: POST, DELETE`, no stream), `DELETE` 200. Each call within `McpServer::Tools::SLICE` (25 s) (`Web::McpRoute`, `McpServer::Http`, [mcp-server.md](mcp-server.md)) | 400 `-32020` (headers unlike the body), `-32022` (an unsupported revision), `-32700` (not JSON or not UTF-8; with the request's id when one can be read)/`-32600` (not an object: a batch is one), `Missing session ID`, an unsupported legacy `MCP-Protocol-Version`; 404 `-32601`; the gate's 401 adds `WWW-Authenticate: Bearer` here |
|
|
513
514
|
| `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 |
|
|
514
515
|
| `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` |
|
|
@@ -670,7 +671,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
|
|
|
670
671
|
| Bundle authoring | `bundle_command.rb` (`BundleCommand`), `bundle_command/{scaffold,check,test_run}.rb`, `bundle_command/try/{run,sandbox,trace}.rb`, `testing.rb` + `testing/` (the test kit) | `chi bundle new`, `check`, `test` and `try`, and the kit a bundle's tests load it with ([bundle-authoring.md](bundle-authoring.md), [internals/bundles.md](internals/bundles.md)). |
|
|
671
672
|
| Session file | `session.rb` (`Session`, `Session::FIELDS`), `session_field.rb` (`SessionField`), `session_paths.rb` (`SessionPaths`), `session_setup.rb` (`SessionSetup`) | A session's `<uuid>.json`: one `SessionField` row per key (default, cast, what the file gets; the codec on its type), from which `Session.new`, `.from_h` and `#to_h` are built; `SessionPaths` is where the file and the session's dir are and the id rule, a leaf `Session` extends (so `ArchiveStore` and `ContextSources` name no `Session` constant; both still require session.rb at load); `SessionSetup` the settings a fork and a continue carry (`.of`), applied by member name; every new-session request (chi's run flags, the one-shot, `chi send --new`, chi web's create) builds its setup with `SessionSetup.from_request`, and `spec/session_setup_entrypoints_spec.rb` holds each entrypoint's cell for each member. See [sessions.md](sessions.md#session-file). |
|
|
672
673
|
| Session config (`--set`) | `session_config.rb` (`SessionConfig`, `SessionConfig::Settings`) | A session's own settings as one value (`Session#settings`, `SessionSetup#settings`): `core`, the `--set KEY=VALUE` values of the core keys marked `session: true` (`Config::Entry`), typed by `Config.coerce!` and read first through `Config.get(key, session:)` (`RecapSetup`; `Engine#session=` rebuilds the recap job, `IdleScheduler#replace_job`), file key `config_settings`; `bundles`, the `--set BUNDLE.KEY=VALUE` values, checked against the manifest's `session_settings:`, laid over `bundles: <name>:` in `ctx.settings` ([plugins.md](plugins.md)), file key `bundle_settings`. `SessionConfig.clash` refuses a bundle setting named like a core one (install, `chi bundle check`). See [configuration.md](configuration.md#per-session-settings). |
|
|
673
|
-
| Plugin API | `plugin/api.rb` (`Plugin::Api`), `plugin/tool_spec.rb` (`Plugin::ToolSpec`: a checked tool declaration, how it is registered), `plugin/loader.rb`, `plugin/context.rb` (`ctx`), `plugin/http.rb` + `plugin/http_transport.rb` (`ctx.http`), `plugin/card.rb` (`Plugin::Card`) | What a bundle's plugin registers: tools, commands, annotation actions, hooks, services, toolkits, peer sources; what its handlers get as `ctx` ([plugins.md](plugins.md)). |
|
|
674
|
+
| Plugin API | `plugin/api.rb` (`Plugin::Api`), `plugin/tool_spec.rb` (`Plugin::ToolSpec`: a checked tool declaration, how it is registered), `plugin/loader.rb`, `plugin/context.rb` (`ctx`), `plugin/http.rb` + `plugin/http_transport.rb` (`ctx.http`), `plugin/http_stream.rb` (`ctx.http.stream`) + `plugin/sse_reader.rb`, `plugin/http_errors.rb`, `plugin/secrets.rb` (`Plugin::Secrets`, `ctx.secrets`) + `plugin/sign_in.rb` (`Plugin::SignIn`, `ctx.sign_in`), `plugin/card.rb` (`Plugin::Card`) | What a bundle's plugin registers: tools, commands, annotation actions, hooks, services, toolkits, peer sources; what its handlers get as `ctx` ([plugins.md](plugins.md)). |
|
|
674
675
|
| Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`) | What claude-peer and codex-peer share (the send tool, the command, the cards, payloads); each bundle's subclass sets its strings and transport ([bundles.md](bundles.md#the-claude-peer-bundle)). |
|
|
675
676
|
| Shipped bundles | `bundles/` (`mcp`, `github-pr`, `loop-guard`, `skills`, `source-links`, …) | Bundles that ship with chi. |
|
|
676
677
|
| Hooks | `hooks/registry.rb` (`Hooks::Registry`), `hooks/loader.rb`, `hook_routes.rb` (`HookRoutes`), `event_routes.rb` (`EventRoutes`) | Hook registration and dispatch; what a hook or plugin does beyond reading its event (notice, question, stop, steer) routed to the UIs (cards and notices through one set of routes) ([hooks.md](hooks.md)). |
|
data/docs/bundles.md
CHANGED
|
@@ -41,7 +41,7 @@ only against this API (`lib/samagotchi/bundles/btw/plugin.rb`).
|
|
|
41
41
|
server](mcp-server.md).)
|
|
42
42
|
|
|
43
43
|
`chi bundle install mcp` (or the `dev` profile) installs the bundle shipped with chi. It is written
|
|
44
|
-
only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `tools.rb`, `content.rb`), and gives
|
|
44
|
+
only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `oauth.rb`, `tools.rb`, `content.rb`), and gives
|
|
45
45
|
the model the tools of [MCP](https://modelcontextprotocol.io) servers. It
|
|
46
46
|
has no memory file, and the servers' tools aren't declared to the model one
|
|
47
47
|
by one: the bundle publishes them into chi's tool index
|
data/docs/configuration.md
CHANGED
|
@@ -2123,7 +2123,8 @@ Tailnet Lock is off: a device Tailscale's servers add to your tailnet could reac
|
|
|
2123
2123
|
|
|
2124
2124
|
chi web as an app on your iPhone's Home Screen that buzzes (the Watch too) when a session needs you: an
|
|
2125
2125
|
**approval**, a **question**, a **step-limit** question, a **card** that asks (check-in's Nudge / Keep going / Stop),
|
|
2126
|
-
or a **failed turn**, also while the app is closed
|
|
2126
|
+
or a **failed turn**, also while the app is closed; chi web's schedule tick also says when it turned off a
|
|
2127
|
+
recurring schedule that kept failing or being skipped ([docs/scheduling.md](scheduling.md#skip-not-failure)). A tap opens that session; once it is answered anywhere (the Mac,
|
|
2127
2128
|
the phone, `chi answer`), its notification goes when you open the app (or swipe it away; a failed turn's stays until
|
|
2128
2129
|
you do). Every push shows a notification: iOS turns off an app's pushes after a few that show none.
|
|
2129
2130
|
|
data/docs/internals/bridge.md
CHANGED
|
@@ -27,7 +27,7 @@ rescues its own errors: an observer must never break the running turn.
|
|
|
27
27
|
| `CardStore` | `card_store.rb` | The last cards and notices, saved in `cards.json`, each anchored to its turn. |
|
|
28
28
|
| `TurnDrawings` | `turn_drawings.rb` | Each finished turn as live drew it (`turn_drawings.jsonl`): written by the accumulator's `on_turn_end` hook, read by chi web's show. |
|
|
29
29
|
| `CardPlaces` | `card_places.rb` | Pure: where `CardStore`'s entries sit in the messages the page draws (`turns_since`, and the `opening_id` stamp). |
|
|
30
|
-
| `PendingCard` | `pending_card.rb` | `pending_card.json` `{id:, bundle:}`: the running turn's open card with actions (check-in's Nudge)
|
|
30
|
+
| `PendingCard` | `pending_card.rb` | `pending_card.json` `{id:, bundle:}`: the running turn's open card with command actions (check-in's Nudge); a URL-only card does not ask (`CardWait`), so it writes no pending card, and it is removed with the card, for chi web's file-watching hub. |
|
|
31
31
|
|
|
32
32
|
Per connection there is an `SSEWriter` (with a `BoundedQueue`); `ClientEvent` and `EventId` are pure helpers. The
|
|
33
33
|
Bridge also owns its **epoch** (`SecureRandom.hex(4)`: `event_seq` starts over in each worker, so the epoch says
|
data/docs/internals/bundles.md
CHANGED
|
@@ -142,7 +142,7 @@ one ordered list (parts as listed, then the file; nothing sorts it: not the pars
|
|
|
142
142
|
builder). The record keeps them under its plugin, `{"file": …, "sha256": …, "parts": {"client.rb": "sha256:…"}}`
|
|
143
143
|
(`PluginRef#parts`, `{}` without; `Record#plugin_shas` has every file, so `AssetInstaller`, the `Uninstaller` and
|
|
144
144
|
`ShippedUpdate#trash_bound` treat parts as recorded files), each with a base at `bases/plugin/<part>`.
|
|
145
|
-
`BundleManifest::SINCE` has `"plugin.parts"` (
|
|
145
|
+
`BundleManifest::SINCE` has `"plugin.parts"` (0.183.0). What other chis do:
|
|
146
146
|
- The previous release ignores `parts:` in a manifest and in a record. It installs a too-new plugin with only a
|
|
147
147
|
warning, copying the plugin file alone; after `chi update` this chi refuses that record: `Dir#plugin_refusal`'s
|
|
148
148
|
`:parts_missing` (`bundle X's plugin parts aren't installed (reinstall the bundle)`, status `[parts missing]`), read
|
|
@@ -251,7 +251,11 @@ summarised by `#summary` by word: a file that already holds the bundle's bytes (
|
|
|
251
251
|
rule/plugin/script, in a dry run as in the real run) is listed as `Up to date:`, and only the files really left
|
|
252
252
|
out (`:kept_own`, a memory's dry-run `:would_skip`) as `Skipped:`. A memory's dry-run word is its action's through
|
|
253
253
|
`Installer::DRY_WORDS`. A dry run's `would_update` (a plugin or script an upgrade would change) is `Would update:`; an asset
|
|
254
|
-
row is never `would_skip`.
|
|
254
|
+
row is never `would_skip`.
|
|
255
|
+
`BundleCommand#version_line` heads the summary. It reads the old version from the installed record before the run and
|
|
256
|
+
the new one from the manifest: `NAME OLD → NEW` for a change, `NAME VER` otherwise, or `NAME VER (already current)` when
|
|
257
|
+
nothing changed and `Installer#current?` is true. In that case `Installer#summary(current: true)` leaves out `Up to date:`.
|
|
258
|
+
A plain install over a bundle already installed from the same source ends with `NAME was already
|
|
255
259
|
installed from SOURCE: its rules, plugin and scripts now match it and its record was rewritten`, plus
|
|
256
260
|
`; your own copies of its memories were kept (chi bundle upgrade NAME merges the bundle's changes into them)` when
|
|
257
261
|
a memory was left out as the user's (`:kept_own`: an edited one, or one the bundle doesn't own; a never-edited one takes the new text and isn't named there). An upgrade with conflicts keeps an
|
data/docs/internals/engine.md
CHANGED
|
@@ -784,7 +784,7 @@ are in [architecture.md](../architecture.md)'s file table.
|
|
|
784
784
|
| `engine/models.rb` | `Engine::ModelsPart`: model names, identity, notes, `switch_model!`, the profile, `backend` |
|
|
785
785
|
| `engine/model_settings.rb` | `Engine::ModelSettingsPart`: SessionModelSettings and EngineSnapshots, forwarded |
|
|
786
786
|
| `engine/events.rb` | `Engine::EventsPart`: observers, `#announce`, the event lock, held announcements |
|
|
787
|
-
| `engine/cards.rb` | `Engine::CardsPart`: `#show_card
|
|
787
|
+
| `engine/cards.rb` | `Engine::CardsPart`: `#show_card` (and `between_turns:`), anytime commands |
|
|
788
788
|
| `engine/objectives.rb` | `Engine::ObjectivesPart`: the objectives stage's builder and forwards (`announce_objectives`, `show_objective_proposals`, `track_objectives_after`), Check this's and the tracker's side requests (`ask_objective_check`, `ask_objective_track`) |
|
|
789
789
|
| `engine/messages.rb` | `Engine::MessagesPart`: out-of-turn message edits, checkpoints, the live conversation |
|
|
790
790
|
| `engine/plugins.rb` | `Engine::PluginsPart`: plugins, init tasks, staged tools, `Plugin::Host` |
|
|
@@ -794,6 +794,7 @@ are in [architecture.md](../architecture.md)'s file table.
|
|
|
794
794
|
| `engine/session.rb` | `Engine::SessionPart`: `#session=`, the state dir, the relay's view, the system prompt |
|
|
795
795
|
| `engine/verify.rb` | `Engine::VerifyPart`: the Verify/Revise anchors' stage builder |
|
|
796
796
|
| `engine/questions.rb` | `Engine::QuestionsPart`: ask-user-question (QuestionDesk, forwarded: the hosts hold `Engine#question_desk`; the forwards stay for the Engine's parts, the one-shot and Engine-only specs) |
|
|
797
|
+
| `engine/sign_in.rb` | `Engine::SignInPart`: `ctx.sign_in` flows and cards, `/callback`, and ending flows at shutdown (idle exit waits for a waiting flow) |
|
|
797
798
|
| `engine/toolkit.rb` | `Engine::ToolkitPart`: the toolkit, `ctx.load_tools`, the toolkit suggestion's builder |
|
|
798
799
|
| `engine/context_judge.rb` | `Engine::ContextJudgePart`: the candidate judge's builder and `judge_late_candidates` |
|
|
799
800
|
| `engine/turn_helpers.rb` | `Engine::TurnHelpersPart`: turn settings, images, model ref, used memories, the warm-up's builder |
|
|
@@ -201,7 +201,7 @@ row answers another session's id 404, so a new route is covered without a new ex
|
|
|
201
201
|
| `POST /api/sessions/:id/turn/:eid/dequeue` | participant | their own queued turn back; another's (the owner's included) is 403 `not_permitted` |
|
|
202
202
|
| `POST /api/sessions/:id/verdicts/:check_turn_id/fresh` | participant | a fresh child to check an unclear verdict, running as the requester under pair rules and counted toward their cap ([Verify fresh](#what-a-participant-sees)) |
|
|
203
203
|
| `GET /api/sessions/resolve?id=` | participant | their session for its id or a prefix of it; anything else 404 as no session (never an ambiguity listing others) |
|
|
204
|
-
| `POST /api/sessions/:id/wait/prepare`, `…/wait` | participant | only for a turn of theirs (`turn`: the enqueued id `POST …/turn` answered; else 403); `wait/prepare` answers only what that wait needs, `{session_id, baseline: {last_turn}, known_turn, live, last_turn_id}` (`last_turn_id` only when it is their turn), never the owner's cursor, message count, question or running turn; the answer trimmed to `{status, text, turn_id, outcome, cancel_reason}`, the reply's `text` through `ParticipantView.reply` (no thinking or tool call, redacted) and any other text (an error's exception, a failed turn's summary) `ParticipantMessages::TURN_FAILED`; a question or approval their turn raised, or their turn held by the owner's step-limit Continue offer ([Turns](#turns)), is `{status: "waiting_for_owner", detail: "waiting for the session's owner"}` with nothing of it; a revoke or the expiry ends a `wait` already running (401 `token_revoked` / `token_expired`), as it ends their stream |
|
|
204
|
+
| `POST /api/sessions/:id/wait/prepare`, `…/wait` | participant | only for a turn of theirs (`turn`: the enqueued id `POST …/turn` answered; else 403); a wait token (`{token}`) is the owner's: a participant's token wait is 400 `invalid_wait` (`a participant's wait takes a turn, not a token`); `wait/prepare` answers only what that wait needs, `{session_id, baseline: {last_turn}, known_turn, live, last_turn_id}` (`last_turn_id` only when it is their turn), never the owner's cursor, message count, question or running turn; the answer trimmed to `{status, text, turn_id, outcome, cancel_reason}`, the reply's `text` through `ParticipantView.reply` (no thinking or tool call, redacted) and any other text (an error's exception, a failed turn's summary) `ParticipantMessages::TURN_FAILED`; a question or approval their turn raised, or their turn held by the owner's step-limit Continue offer ([Turns](#turns)), is `{status: "waiting_for_owner", detail: "waiting for the session's owner"}` with nothing of it; a revoke or the expiry ends a `wait` already running (401 `token_revoked` / `token_expired`), as it ends their stream |
|
|
205
205
|
| `GET /` | participant | the main page (`index.html`) stamped for them (`App#participant_index_data`: their viewer, the grant's session and its title; [web-frontend.md](web-frontend.md#the-participants-page)); the page reads the rest through the show and the stream below |
|
|
206
206
|
| `POST /api/token` | participant | trade a link's one-time code or a pasted token for the `chi_token` cookie (the token is not left in the page URL) |
|
|
207
207
|
| `GET /api/sessions/:id/stream` | participant | the session's stream through `ParticipantStreamFilter` (only `from_seq` and `snapshot` reach the Bridge); it ends within a poll of a revoke or the expiry |
|
|
@@ -65,7 +65,14 @@ right-hand column happens.
|
|
|
65
65
|
|
|
66
66
|
- The sections above are recorded as `prompt_parts` (`SystemPrompt#prompt_parts`, `PromptPart`: kind, label, chars,
|
|
67
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
|
|
68
|
+
`tools` part): sizes, and each part's place in the built prompt (`at`, `len`, `lead`, a 12-hex `digest` of its own
|
|
69
|
+
text, the prompt's 16-hex `head` digest, `params` to fetch it again), worked out once with the build
|
|
70
|
+
(`PromptLayout`) and saved on the session; the prompt's text is unchanged. Each builder returns its `Section` with
|
|
71
|
+
its `Item`s (lead and text) where it renders them; the parts derive from the items, so their places can't drift
|
|
72
|
+
from the bytes. `spec/prompt_parts_spec.rb` holds today's parts to a golden and every slice to its item. The text
|
|
73
|
+
itself is not copied: the head is the session's `messages[0]`, which a part's place points into
|
|
74
|
+
([working-set.md](working-set.md#prompt-parts-as-sent)). `Engine#system_prompt` reads prompt, parts, notes and
|
|
75
|
+
index from the one `Built` (`SystemPrompt#built_for`), and the turn-end warm-up builds with `record: false`.
|
|
69
76
|
- The system prompt is built **once per key** and kept (`SystemPrompt#build`, keyed by `[chat, thinking, layers]`:
|
|
70
77
|
the loop, the thinking level, the turn's LLM context layers; a `/thinking` change builds under another key). All
|
|
71
78
|
of them are dropped only on `@prompt_builder.reset!`: a model switch (`Engine#switch_model!`), a plugin's
|
|
@@ -90,11 +90,27 @@ specs' stubs); `CLI::ParentWait` (chi send's and chi answer's wait) calls `wait`
|
|
|
90
90
|
(`session_access/ask.rb`) is its own short loop over the same pieces for one message and one wait slice on one
|
|
91
91
|
deadline (chi web's starts with the request: `locate`'s `deadline:` and `relocate`'s `bounded: true` end the continue
|
|
92
92
|
waits `Ask::MIN_SLICE` before it, a continue that takes the link after it gets no second delivery, and the Bridge wait
|
|
93
|
-
of a worker starting draws on it too
|
|
93
|
+
of a worker starting draws on it too, as does the post to a live worker: `AskRoutes#ask_bridge`, used by `POST …/ask`
|
|
94
|
+
and `POST /api/mcp` (one deadline per POST, `Tools::CAP`), gives the BridgeClient a read of what is left but
|
|
95
|
+
`MIN_SLICE`, within `POST_FLOOR` (8 s, so a loaded worker still reads it) and `READ_TIMEOUT`; the body's `deadline`
|
|
96
|
+
is a `DEADLINE_SHARE` of that read and at least `POST_MARGIN` (2.5 s) short of it (BridgeClient's `deadline_margin`,
|
|
97
|
+
so a worker that took the turn just in time still answers its 202 before the client gives up), so a worker that reads the turn late drops it (408 `deadline_passed`, the route's
|
|
98
|
+
504 `worker_timeout`) rather than run it after the call gave up: about 44 s at worst; chi web stopping cuts the continue waits at the next look, `Refused :canceled`,
|
|
94
99
|
503 `server_stopping`; a client that goes away is not seen (WEBrick), so its handler runs on to that deadline),
|
|
95
|
-
answering `Reply` (with an `Exchange::Token` on timeout), `Ran` or `Refused
|
|
100
|
+
answering `Reply` (with an `Exchange::Token` on timeout), `Ran` or `Refused` (a `/continue yes` the worker ran as a
|
|
101
|
+
command, on an idle session with its offer standing and a live worker, is bound with `ReplyWait::Target.answer(start)`
|
|
102
|
+
instead, the offer's turn id from `ReplyWait.own_turn`, as chi answer follows it; the worker's ack is not read): chi web's `POST …/ask`
|
|
96
103
|
builds one per request over a `Local` that delivers through chi web's own manager and Bridge (`Web::AskRoutes::
|
|
97
|
-
AskAccess`), and
|
|
104
|
+
AskAccess`), and `McpServer::Tools` reuses `SessionAccess::Ask` / `Exchange` through the MCP server without chi web.
|
|
105
|
+
An ask's `request_id` becomes its turn's enqueued id (`SessionInbox.enqueued_id_for("ask:" + it)`, a UUID v5 shape a
|
|
106
|
+
Bridge keeps): `Ask#call` first reads `prepare_wait(turn: E)`, and a `known_turn` (running, a queued input file, the
|
|
107
|
+
last to end, a reply file, settled, merged) is waited on again with `Target.wait_only(start, requested: E).with(queued:)`, nothing
|
|
108
|
+
sent (`Reply#rebound`, so the route skips the history line), unless E only waits as an input file and no worker runs
|
|
109
|
+
(`Local#waiting_turn?`): then it is sent again with E, which wakes one (the worker runs an id once: `input_taken?`,
|
|
110
|
+
`TurnState#claim_enqueued_id`); else `Exchange#attempt(enqueued_id: E)` carries it to
|
|
111
|
+
`deliver_turn`, and the Bridge's H6 dedupe answers a copy it still remembers with the original ack (409
|
|
112
|
+
`enqueued_id_conflict` for another prompt; a known turn is rebound without a prompt check). A retry on a newer link (a continue) is not deduped.
|
|
113
|
+
The routes: [thin-clients.md](../thin-clients.md); the MCP protocol: [mcp-server.md](../mcp-server.md).
|
|
98
114
|
|
|
99
115
|
## One request, end to end
|
|
100
116
|
|
|
@@ -32,13 +32,12 @@ page. A factory dep a new version stops passing is the same hazard the other way
|
|
|
32
32
|
out of `send_turn.js`, `session_actions.js` and `lists_view.js`); a page loaded before keeps all its old modules
|
|
33
33
|
until a reload, so the risk is a mixed cache, not an open tab. An export a new version stops importing stays until
|
|
34
34
|
the next release (its baseline refresh) for the same reason, marked as kept for an older cached module (the delete
|
|
35
|
-
sheet
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`
|
|
39
|
-
each pair, the old file from `spec/web/public/fixtures/v0.182.0/`). `answer_fold.js`, `details_motion.js`,
|
|
35
|
+
sheet still keeps `isChained` and `format.js deleteConfirmText` that way; and `ws_peek.js`'s `PEEK_WIDTH`, which 0.183.0's
|
|
36
|
+
`working_set_view.js` imports though the view is 520 wide always now: `ws_part_peek_mixed_cache.test.js` loads this view
|
|
37
|
+
with 0.183.0's `ws_reader.js` and `ws_peek.js`, and 0.183.0's view with this `ws_reader.js`, from
|
|
38
|
+
`spec/web/public/fixtures/v0.183.0/`). `answer_fold.js`, `details_motion.js`,
|
|
40
39
|
`turn_range.js`, `history_reveal.js`, `latest.js`, `session_payload.js`, `method_api.js`, `session_store.js`,
|
|
41
|
-
`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` (The delete sheet, below), `removal_sheet_model.js` (its words: rows, button words, the archive model, the toast; DOM-free), `running_tasks.js` (a delete's or archive's tasks: their line and the toast's suffix; DOM-free, so `stop_sheet.js` and the delete sheet share its cut), `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`, `ws_item_sig.js`, `ws_markdown.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), `ws_order.js` (the working-set list's order: last touched first, held while it is open, [working-set.md](working-set.md), The list's order), `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), `peer_data.js`, `peer_exchange.js`, `peer_note.js`, `peer_links.js` (a peer's send and answer in the conversation: The peer exchange, below), `peer_chip.js` (a paired peer's one chip in the session bar: The peer exchange), `picture_viewer.js` (the picture viewer, `#lightbox`: below, Picture viewer), `pan_zoom.js` (its maths, pure), `diagram_wiring.js` (`wireDiagrams`: the block host with the viewer as its `openPicture`, the viewer closed on a theme change, the regions' layer given to the viewer; the viewer itself stays made in app.js, which `createSessionView` reads first), `block_regions.js` (a renderer's regions cleaned, pure: [block-renderers.md](block-renderers.md#regions)), `region_hit.js` (their hit test, the arrow keys' nearest region and the reveal under the card, pure), `picture_regions.js` (the regions' layer over the viewer: below, Picture viewer), `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).
|
|
40
|
+
`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` (The delete sheet, below), `removal_sheet_model.js` (its words: rows, button words, the archive model, the toast; DOM-free), `running_tasks.js` (a delete's or archive's tasks: their line and the toast's suffix; DOM-free, so `stop_sheet.js` and the delete sheet share its cut), `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_part_peek.js`, `ws_reader.js`, `ws_way_in.js`, `ws_item_sig.js`, `ws_markdown.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), `ws_order.js` (the working-set list's order: last touched first, held while it is open, [working-set.md](working-set.md), The list's order), `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), `peer_data.js`, `peer_exchange.js`, `peer_note.js`, `peer_links.js` (a peer's send and answer in the conversation: The peer exchange, below), `peer_chip.js` (a paired peer's one chip in the session bar: The peer exchange), `picture_viewer.js` (the picture viewer, `#lightbox`: below, Picture viewer), `pan_zoom.js` (its maths, pure), `diagram_wiring.js` (`wireDiagrams`: the block host with the viewer as its `openPicture`, the viewer closed on a theme change, the regions' layer given to the viewer; the viewer itself stays made in app.js, which `createSessionView` reads first), `block_regions.js` (a renderer's regions cleaned, pure: [block-renderers.md](block-renderers.md#regions)), `region_hit.js` (their hit test, the arrow keys' nearest region and the reveal under the card, pure), `picture_regions.js` (the regions' layer over the viewer: below, Picture viewer), `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).
|
|
42
41
|
|
|
43
42
|
## One page, every viewer
|
|
44
43
|
|
|
@@ -423,7 +422,9 @@ it says what goes, what is stopped first and what stays, with one button that na
|
|
|
423
422
|
A `409 plan_changed` and a `409 tasks_running` (a task that started since) both re-read the plan and show it with
|
|
424
423
|
"What this deletes changed; check again." Any other refusal `runDeleteFlow` shows in the sheet (`refusalModel`: a
|
|
425
424
|
moved delegate that can't go back offers "Stop its worker, then delete" only when the 409 says `stoppable`; it stops
|
|
426
|
-
each, retries only once the stop answers `released`, and says so otherwise, never looping, one stop at a time).
|
|
425
|
+
each, retries only once the stop answers `released`, and says so otherwise, never looping, one stop at a time). While
|
|
426
|
+
it stops, the refusal view says `Stopping…` with the stop choice and Cancel off; if the sheet closes meanwhile, it
|
|
427
|
+
goes on with the delete and puts the delete toast or a sticky `failed` refusal in a toast.
|
|
427
428
|
- **Archive** stays one tap and the Undo toast when nothing is in the way. Its 409 opens the same sheet
|
|
428
429
|
(`session_actions.js setArchived` → `runDeleteFlow` with `archive: {refusal}`): `tasks_running` is
|
|
429
430
|
`archiveSheetModel` (Hidden: it and the 409's `sessions` − 1 delegates; Stopped first: the tasks; `Stop them and
|
|
@@ -793,9 +794,13 @@ What chi has of one working-set item ([working-set.md](working-set.md#timeline-w
|
|
|
793
794
|
`ws_timeline.js` is the pure part (the server's events into cards newest first, reads merged by state, and between the same edits, into line
|
|
794
795
|
slices, the file strip, the peek's pick, the step tags from the item's `runs`: working_set.js `itemsOfTurn` keeps each
|
|
795
796
|
row's `tool_id` with its place), `ws_cards.js` the cards' templates (`diff_view.js` for diffs, `.read-line` for lines),
|
|
796
|
-
`ws_peek.js` the popover's peek (one row at a time; working_set_view.js draws it under the row
|
|
797
|
-
|
|
798
|
-
placing), `
|
|
797
|
+
`ws_peek.js` the popover's peek (one row at a time; working_set_view.js draws it under the row; the popover is 520 wide
|
|
798
|
+
open or closed, so no row moves sideways, and a peek grows a phone's sheet to `SHEET_TALL`: `chip_popover.js` reads
|
|
799
|
+
`width`/`sheetShare` as functions per placing), `ws_part_peek.js` the "From the start" rows' prompt peek (the part
|
|
800
|
+
route's text as sent, the tools' names and sizes, a tab per hold with the item peek as a read's tab; one peek open at a
|
|
801
|
+
time across both; [working-set.md](working-set.md#prompt-parts-as-sent)), `ws_reader.js` the reader and the wiring
|
|
802
|
+
(`createWorkingSetPreview`: the peek, with the prompt peek as its `part` (no new export: a view without it, an older
|
|
803
|
+
cached one, draws today's rows), the reader, `attach(workingSet)`
|
|
799
804
|
for the set, its jumps and its list, and `whatChiHas` for refs.js), `ws_way_in.js` a tool row's `timeline` button (a
|
|
800
805
|
flag turn_html.js reads; on only once the reader is attached). State: the reader's own closure (the open item, its
|
|
801
806
|
answer, the tab), never `store.current`. The reader is a `section` in `#center` over the history and the composer
|
data/docs/internals/web-push.md
CHANGED
|
@@ -186,6 +186,17 @@ from saying it twice across restarts). The key's `chi:` prefix keeps sw.js from
|
|
|
186
186
|
| `updated` | `chi:updated:<X>` | "chi updated to X" / "chi web and 3 sessions restarted; 1 restarts when idle." + the edited files |
|
|
187
187
|
| `restart_failed` | `chi:restart_failed:<X>` | "chi X is installed; chi web didn't restart" / why (a failed `--version` preflight, no wrapper), "Restart chi web in its terminal." |
|
|
188
188
|
|
|
189
|
+
**A disabled schedule's show.** `SessionHub#run_schedule_tick` emits one `schedule_disabled` hub event per
|
|
190
|
+
`Schedules::Outcome#disabled` of its tick (`#publish_disabled`, under `@monitor` like `publish_notice`): `{id, title,
|
|
191
|
+
kind: skipped|failed, count, reason, session_id, at}`, `session_id` being `Schedules#session_of` (the resolved
|
|
192
|
+
target, else the head) and `at` the tick's wall time. The page's event stream passes it to the tabs, which have no
|
|
193
|
+
listener. The Notifier shows it with reason `schedule`, key and tag `chi:schedule_disabled:<id>:<at>` (`chi:`: not
|
|
194
|
+
a waiting key; `<at>`: a later disable shows again; the same event twice shows once, `@updates_seen`), title
|
|
195
|
+
"Schedule disabled: <title or the id's first 8>", body "skipped 12 times: <reason>" + a line `chi schedule enable
|
|
196
|
+
<short id>`, url `Notifier.session_url` of the session's summary, `/` when it has none. Two exceptions to the rules
|
|
197
|
+
above: it is pushed with a page in front (`UNSEEN_ON_PAGE`: the page has no schedules view), and it gets
|
|
198
|
+
`UPDATE_TTL` (24 h) like an update. A cron tick or `chi schedule run-now` emits nothing (no hub).
|
|
199
|
+
|
|
189
200
|
`updated` is sent by the **restarted** chi web (its AutoUpdate finds the run at `phase: web`): the exec ends the
|
|
190
201
|
old process, and `Notifier#stop` does not flush the shows still in their hold, so a push queued just before it would
|
|
191
202
|
be lost. Sending from the new process also proves it came up. The workers left then restart without another show.
|