samagotchi 0.190.1 → 0.192.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -1
- data/docs/architecture.md +13 -11
- data/docs/bundles.md +1 -1
- data/docs/cli.md +17 -6
- data/docs/configuration.md +6 -1
- data/docs/context.md +8 -1
- data/docs/internals/attached-context.md +3 -1
- data/docs/internals/inline-widgets.md +2 -1
- data/docs/internals/participants.md +1 -5
- data/docs/internals/peers.md +15 -3
- data/docs/internals/remote-sessions.md +5 -2
- data/docs/internals/session-lifecycle.md +233 -18
- data/docs/internals/web-frontend.md +107 -9
- data/docs/peers.md +3 -1
- data/docs/plugins.md +2 -1
- data/docs/scheduling.md +31 -7
- data/docs/sessions.md +12 -12
- data/docs/sub-agent.md +1 -1
- data/docs/testing.md +1 -2
- data/docs/thin-clients.md +98 -12
- data/lib/samagotchi/bridge.rb +3 -4
- data/lib/samagotchi/bundles/mcp/manifest.yml +4 -2
- data/lib/samagotchi/bundles/mcp/plugin.rb +7 -398
- data/lib/samagotchi/bundles/mcp/server_config.rb +158 -0
- data/lib/samagotchi/bundles/mcp/sign_in.rb +261 -0
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/client_id.rb +2 -19
- data/lib/samagotchi/compat.rb +1 -7
- data/lib/samagotchi/config.rb +3 -0
- data/lib/samagotchi/context_command.rb +5 -1
- data/lib/samagotchi/context_sources.rb +28 -0
- data/lib/samagotchi/continue_intent.rb +23 -43
- data/lib/samagotchi/delivery.rb +1 -5
- data/lib/samagotchi/hold_stop.rb +5 -2
- data/lib/samagotchi/participants.rb +13 -5
- data/lib/samagotchi/peer_say.rb +29 -14
- data/lib/samagotchi/plugin/sessions.rb +9 -5
- data/lib/samagotchi/schedule_command.rb +6 -1
- data/lib/samagotchi/schedules/prune_part.rb +162 -41
- data/lib/samagotchi/schedules.rb +32 -15
- data/lib/samagotchi/send_command.rb +6 -6
- data/lib/samagotchi/session.rb +7 -0
- data/lib/samagotchi/session_access/ask.rb +9 -3
- data/lib/samagotchi/session_access/exchange.rb +6 -2
- data/lib/samagotchi/session_access/local.rb +103 -32
- data/lib/samagotchi/session_access/remote.rb +10 -9
- data/lib/samagotchi/session_access/remote_peers.rb +2 -2
- data/lib/samagotchi/session_access.rb +17 -7
- data/lib/samagotchi/session_chain/delete.rb +100 -47
- data/lib/samagotchi/session_chain/delete_preview.rb +9 -5
- data/lib/samagotchi/session_chain/successor.rb +78 -0
- data/lib/samagotchi/session_continue.rb +112 -42
- data/lib/samagotchi/session_inbox.rb +1 -1
- data/lib/samagotchi/session_inbox_delivery.rb +111 -25
- data/lib/samagotchi/session_lifecycle/allowed.rb +20 -1
- data/lib/samagotchi/session_lifecycle/reading.rb +9 -3
- data/lib/samagotchi/session_lifecycle.rb +17 -2
- data/lib/samagotchi/session_manager/delivery.rb +61 -29
- data/lib/samagotchi/session_manager/emptiness.rb +5 -2
- data/lib/samagotchi/session_manager/lifecycle.rb +68 -19
- data/lib/samagotchi/session_manager/listing.rb +2 -1
- data/lib/samagotchi/session_manager/removal.rb +67 -13
- data/lib/samagotchi/session_manager/spawn.rb +16 -9
- data/lib/samagotchi/session_manager.rb +4 -0
- data/lib/samagotchi/session_retention.rb +28 -7
- data/lib/samagotchi/session_row.rb +2 -0
- data/lib/samagotchi/session_transition.rb +361 -0
- data/lib/samagotchi/sessions_command.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
- data/lib/samagotchi/tools/cancel_schedule.rb +10 -6
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +13 -3
- data/lib/samagotchi/web/ask_create.rb +138 -0
- data/lib/samagotchi/web/ask_routes.rb +56 -9
- data/lib/samagotchi/web/last_ask.rb +78 -0
- data/lib/samagotchi/web/peer_routes.rb +5 -2
- data/lib/samagotchi/web/public/answer_refs.js +3 -9
- data/lib/samagotchi/web/public/answer_write.js +28 -0
- data/lib/samagotchi/web/public/app.js +72 -96
- data/lib/samagotchi/web/public/block_fix.js +30 -12
- data/lib/samagotchi/web/public/chains.js +3 -1
- data/lib/samagotchi/web/public/command_list.js +5 -3
- data/lib/samagotchi/web/public/composer.js +9 -6
- data/lib/samagotchi/web/public/composer_mount.js +18 -11
- data/lib/samagotchi/web/public/draft_keys.js +10 -0
- data/lib/samagotchi/web/public/drafts.js +278 -0
- data/lib/samagotchi/web/public/owner_claim.js +7 -12
- data/lib/samagotchi/web/public/prompt_history.js +6 -0
- data/lib/samagotchi/web/public/send_turn.js +51 -20
- data/lib/samagotchi/web/public/session_actions.js +80 -16
- data/lib/samagotchi/web/public/session_prefs.js +9 -3
- data/lib/samagotchi/web/public/session_view.js +7 -2
- data/lib/samagotchi/web/public/turn_events.js +0 -2
- data/lib/samagotchi/web/public/unqueue.js +22 -9
- data/lib/samagotchi/web/public/viewer_self.js +1 -6
- data/lib/samagotchi/web/public/views.js +12 -1
- data/lib/samagotchi/web/session_access_routes.rb +11 -5
- data/lib/samagotchi/web/session_control.rb +8 -1
- data/lib/samagotchi/web/session_create.rb +51 -34
- data/lib/samagotchi/web/session_hub.rb +52 -36
- data/lib/samagotchi/web/session_summary.rb +45 -7
- data/lib/samagotchi/web/start_dir.rb +6 -4
- data/lib/samagotchi/worker_boot.rb +28 -6
- data/lib/samagotchi/worker_presence.rb +22 -6
- metadata +10 -1
|
@@ -14,7 +14,7 @@ by `npm run e2e` (`spec/e2e/`). `app.js` has no unit spec of its own; `viewer_bo
|
|
|
14
14
|
**Every module has a size cap, `app.js` its own**: `npm run lint` fails past `max-lines` in `eslint.config.js`
|
|
15
15
|
(counted as `wc -l` counts, comments and blank lines too). Every `public/*.js` module: 1200 (`samagotchi/module-size`,
|
|
16
16
|
about 10% over the largest, `turn_block.js`), so a module near it splits rather than becoming the next `app.js`.
|
|
17
|
-
`app.js` (`samagotchi/app-size`): 1577, its size once the views by hash went into `views.js` and the pages' wiring landed; down from 1637, its size once the diagrams' wiring went into `diagram_wiring.js`, itself down from 1638,
|
|
17
|
+
`app.js` (`samagotchi/app-size`): 1547, its size once the composer's writes went into `drafts.js` and continue →'s draft guess went; down from 1577, its size once the views by hash went into `views.js` and the pages' wiring landed; itself down from 1637, its size once the diagrams' wiring went into `diagram_wiring.js`, itself down from 1638,
|
|
18
18
|
its size once the lightbox went into `picture_viewer.js`, itself down from 1649, its
|
|
19
19
|
size plus 50 once the session-open flow went into `session_sync.js` and `session_view.js`, itself ratcheted down from 2000, itself down from 2250 when the versions, the owner's claim links and
|
|
20
20
|
Verify, the composer's mode and the strip's hide went into modules of their own. A new feature goes into a module of
|
|
@@ -37,7 +37,7 @@ sheet still keeps `isChained` and `format.js deleteConfirmText` that way; and `w
|
|
|
37
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
38
|
`spec/web/public/fixtures/v0.183.0/`). `answer_fold.js`, `quiet_notes.js`, `details_motion.js`,
|
|
39
39
|
`turn_range.js`, `history_reveal.js`, `latest.js`, `session_payload.js`, `method_api.js`, `session_store.js`,
|
|
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), `views.js` (the views by hash, in one place: All sessions at `#/sessions` opened, closed and left; a page at `#/p/NAME`, read before the session intent, `hashIntent` calling it `keep`: `body.page-view`, Back to where it was opened from (kept in the history entry's `history.state.from`, so Back and Forward keep it), the session's hash not written while it is open, a session picked leaving it; the Pages list at `#/pages` the same way, `body.pages-list`, and the pages pill pressed on either; the session's `#/s/<id>` written; a hash change applied and selected; app.js makes it after the lists and hands its functions lazily to what it made before), the page's modules `page_route.js`, `page_view.js`, `page_model.js`, `page_blocks.js`, `page_table.js`, `page_table_model.js`, `pages_model.js` (the page's one list of pages), `pages_list.js` (the Pages list at `#/pages`, read by `views.js` beside a page's hash), `pages_wiring.js` (`wirePages`: the pill, the list, the view and the links, one call in app.js), `pages_group.js` (All sessions' former group, kept for an older cached app.js until after 0.189.0) and `page_links.js` (a page in chi web: [pages.md](pages.md#chi-web)), `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`, `peer_text.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), `peer_mailbox_api.js` (the chip's message and Unpair calls), `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), `views.js` (the views by hash, in one place: All sessions at `#/sessions` opened, closed and left; a page at `#/p/NAME`, read before the session intent, `hashIntent` calling it `keep`: `body.page-view`, Back to where it was opened from (kept in the history entry's `history.state.from`, so Back and Forward keep it), the session's hash not written while it is open, a session picked leaving it; the Pages list at `#/pages` the same way, `body.pages-list`, and the pages pill pressed on either; the session's `#/s/<id>` written; a hash change applied and selected; app.js makes it after the lists and hands its functions lazily to what it made before), the page's modules `page_route.js`, `page_view.js`, `page_model.js`, `page_blocks.js`, `page_table.js`, `page_table_model.js`, `pages_model.js` (the page's one list of pages), `pages_list.js` (the Pages list at `#/pages`, read by `views.js` beside a page's hash), `pages_wiring.js` (`wirePages`: the pill, the list, the view and the links, one call in app.js), `pages_group.js` (All sessions' former group, kept for an older cached app.js until after 0.189.0) and `page_links.js` (a page in chi web: [pages.md](pages.md#chi-web)), `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`, `peer_text.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), `peer_mailbox_api.js` (the chip's message and Unpair calls), `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), `drafts.js` (the composer's drafts: The drafts, below), `draft_keys.js` (their storage keys, so `session_prefs.js` sweeps them without a new export), `answer_write.js` (the answer's live write onto its bubble, kept in its own module so a new `markdown_place.js` or `block_fix.js` importing it never waits on an old `answer_refs.js`) 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).
|
|
41
41
|
|
|
42
42
|
## One page, every viewer
|
|
43
43
|
|
|
@@ -64,6 +64,7 @@ their viewer (The viewer, below), their show and stream are filtered (`Web::Part
|
|
|
64
64
|
| **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 waited when it arrived, an answered question) in the order live left them for the history (`turn_settle.js settleOrder`, pure: from the drawing's `part_settled` and question events, whether the turn was opened, and whether a question had a lead-in) and the 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 |
|
|
65
65
|
| **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 |
|
|
66
66
|
| **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 |
|
|
67
|
+
| **The drafts** (`drafts.js`; app.js `drafts`) | the composer's `{text, chips}` per session window (`""` the start page): `#prompt` and the mount's chips are the one on view, a view `forgetSession` swaps | through it only, by the draft's key (the lint block `samagotchi/prompt-writes`): see The drafts | `show(key)` paints the box; a write to the key on view writes the box |
|
|
67
68
|
| **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) |
|
|
68
69
|
| **SSE** | see Streams | the server | events go into the DOM directly (a participant's through `participant_main.js wrapHandlers` first) |
|
|
69
70
|
|
|
@@ -108,6 +109,15 @@ assignment, `++`, `delete` or `Object.assign` into `current`, `store.current` or
|
|
|
108
109
|
(`spec/web/public/lint_session_writes.test.js` runs it on a sample). An alias (`const st = state(); st.x = …`) isn't
|
|
109
110
|
caught: don't write through one.
|
|
110
111
|
|
|
112
|
+
**One writer of the message box**: `drafts.js` (The drafts, below) is the only module that writes `#prompt`'s value,
|
|
113
|
+
and the mounted composer's chips go through it too. The ESLint block `samagotchi/prompt-writes` flags an assignment to
|
|
114
|
+
the box's value by the names the page gives it (`promptEl.value`, `prompt.value`, `composer.el.value`) in every public
|
|
115
|
+
module but `drafts.js`, and `samagotchi/prompt-writes-app` a `composer.setChips(…)` call in app.js (the drafts get the
|
|
116
|
+
mount itself). A later block's `no-restricted-syntax` replaces an earlier one's, so the nine session-writes modules
|
|
117
|
+
carry both lists in their one block, and app.js all three in its own
|
|
118
|
+
(`spec/web/public/lint_prompt_writes.test.js` lints samples by file path through the whole config, and every real
|
|
119
|
+
module). Name-based: an alias of the box, or a chip list the mount changes in place (paste, ×), isn't caught.
|
|
120
|
+
|
|
111
121
|
**Read `store.current` fresh after every await.** A `const cur = store.current` held across an await pins the object
|
|
112
122
|
from before it, which a session switch (`forgetSession`) may have replaced: app.js's `mergeTurnTiming` and
|
|
113
123
|
`refreshTimingFromSession`, `session_view.js`'s `readTurnEnd` and `session_sync.js`'s `resync` read it again after each await. Keep `store.sessions`
|
|
@@ -231,7 +241,8 @@ The redraws, by their store names:
|
|
|
231
241
|
`forgetSession()` (`session_view.js`) is the one reset: `select` and `clearSelection` both call it, so anything per-session that isn't
|
|
232
242
|
in `store.current` (capabilities, the markdown warning and tip, the init row, the Verify claim, the armed Revise,
|
|
233
243
|
the running turn's DOM) is cleared there, and the feature gates are primed for the empty session. A new per-session holder
|
|
234
|
-
(an armed composer anchor like the Verify claim or the Revise) goes into it. The
|
|
244
|
+
(an armed composer anchor like the Verify claim or the Revise) goes into it. The composer's draft is swapped there,
|
|
245
|
+
not cleared (`drafts.show`: The drafts). The armed Verify claim is
|
|
235
246
|
`owner_verify.js`'s holder (`anchor()`, `set(a)`, `clear(a?)`: `clear(a)` lets go only of `a`). The armed Revise
|
|
236
247
|
(`pendingReviseAnchor`) is set only through `setReviseAnchor`, which redraws its chip and the Revise buttons (a
|
|
237
248
|
redraw only it feeds, not a store field).
|
|
@@ -560,7 +571,7 @@ instead. Nothing is kept across a re-render: a block failing again is posted aga
|
|
|
560
571
|
how it went); only the redraw is counted: an answer is read again at most once per turn and block for the page's life
|
|
561
572
|
(the route's 200 `fixed` or the event's), and a block failing after it says a fix didn't help. The stream's `block_fix` handler
|
|
562
573
|
(`stream_handlers.js`, dep `blockFix`) hands the worker's word over: `fixed` re-reads that turn's answer (`getSession(id,
|
|
563
|
-
{tail, turnId})`) and writes the bubble as `
|
|
574
|
+
{tail, turnId})`) and writes the bubble as `answer_write.js`'s `writeAnswer` writes it, which can't find it by its old text; `failed`
|
|
564
575
|
and `dropped` say a fix didn't help. Both 202 answers carry the block's key (`data-block-fix-key`); a keyed event settles
|
|
565
576
|
only that asked block, leaving another block's give-up timer running. A block is marked asked before its POST, since the
|
|
566
577
|
word can come before the 202 (a quick side answer); an event before the 202 or an older worker's keyless 202 keeps the
|
|
@@ -933,6 +944,90 @@ mailbox message, and `inline` when the note's content holds the peer's text). Th
|
|
|
933
944
|
(`peerLinks.showSend`) after closing the popover. Under 600 px the peer popover is a bottom sheet (`sheetPlace`);
|
|
934
945
|
ordinary chips' popovers stay at their chip.
|
|
935
946
|
|
|
947
|
+
## The drafts
|
|
948
|
+
|
|
949
|
+
`drafts.js` (`createDrafts`, app.js `drafts`) owns what the composer holds: one draft (`{text, chips}`) per session
|
|
950
|
+
window, keyed `""` for the start page, else the session's id (app.js `shownDraft()` is the one on view). It is the
|
|
951
|
+
only writer of `#prompt`'s value and, through the mount it is handed as its `view` (`composer_mount.js`), of the chips.
|
|
952
|
+
Every write goes through it by the draft's key: `setText(key, text, {reveal, focus, caretEnd})` (a pick, a quote, a
|
|
953
|
+
block fix's or a widget's fill, a failed turn's line back, the send's ack, the opener, a recalled ↑/↓ entry through
|
|
954
|
+
the mount's `setText` hook, a `/` pick through `command_list.js`'s `afterPick(text)`), `putBack(key, text)` (into an
|
|
955
|
+
empty draft only: unqueue's), `clear(key)` (the text only: the chips stay), `putChips(key, list)`, `move(from, to)`
|
|
956
|
+
(into an empty draft as it is, else the text under the other's and the chips after; `from` emptied, its saved copy
|
|
957
|
+
gone), `handOver(from, to, opener)` (continue →: below), `drop(key)` (a deleted session's: forgotten, its previews
|
|
958
|
+
freed); reads `text(key)`, `chips(key)`, `has(key)`
|
|
959
|
+
(text or a chip).
|
|
960
|
+
|
|
961
|
+
**The box is a view.** `#prompt` and the mount's chip list are the truth for the painted draft; the others are kept in
|
|
962
|
+
the module's Map (per tab, their text read from storage the first time a key is seen). `show(key)` swaps them: the
|
|
963
|
+
outgoing draft is taken from the box (a copy of the chips: the mount changes its list in place) and saved, the next
|
|
964
|
+
one painted (`setChips(list, {revoke: false})`, `fit()`, the ↑/↓ browsing reset); the same key again is a no-op.
|
|
965
|
+
`session_view.js forgetSession` calls it with `store.selected ?? ""` before `composer.newVisit()` and `applyPrefs()`
|
|
966
|
+
(the grip's draft class and the fit see the new text), so `select` and `clearSelection` (+ new) both swap; app.js
|
|
967
|
+
calls it once at boot, before `selectFromHash()`, which always paints (over a value the browser may have restored) and
|
|
968
|
+
covers a page opened at `/` (the Home Screen app's start URL), where nothing selects. A chip's preview URL is freed on
|
|
969
|
+
its ×, at its send (`chipsAfterSend`) or when its draft is dropped, never on a swap. An older cached `session_view.js`
|
|
970
|
+
calls no `show`: the drafts see the shown key differ from the painted one and take the box as that window's draft
|
|
971
|
+
(today's one box), painting a kept draft only over an empty box.
|
|
972
|
+
|
|
973
|
+
**Saved in this browser**: the text, on every write and every input event (`syncFromView`, the box's input listener;
|
|
974
|
+
no save on leave, nor on `pagehide`: `store.selected` is already the next id by `forgetSession`, and iOS gives no
|
|
975
|
+
reliable leave event), under `chi_composer_draft:<session>` (`session_prefs.js`, the key from `draft_keys.js`) and the
|
|
976
|
+
start page's under `chi_start_draft` (one per browser, not per `?dir`). An empty or white-space draft removes its key.
|
|
977
|
+
Chips live in memory only. While a line is in flight (`sending(key, line)` at the send's `inFlight`, `settle` when it
|
|
978
|
+
is over or failed), the saved copy is `composerAfterAck` of it: a reload or an iOS kill right after Send doesn't bring
|
|
979
|
+
the line back to send again.
|
|
980
|
+
|
|
981
|
+
**Async writers use the key they started in**: `send_turn.js` (`key` at the send's entry, before the pick's await; on
|
|
982
|
+
a create's success `move("", s.id)` and `key = s.id` before `await select(s.id)`; the ack's text and chips, a command
|
|
983
|
+
ack's clear, the reply's clear, an early restore's refill: all to that key, open or not; `openForVisit`, the Verify and
|
|
984
|
+
Revise restores stay gated on the key being on view), `composer.js createComposerCommands` (the equality clear by the
|
|
985
|
+
session's id), `unqueue.js` (`putBackTo(text, id)`: into the draft of the session it was queued in when that is empty,
|
|
986
|
+
"shown" or "stored", the stored case a plain toast naming it). The stream handlers write the open session's
|
|
987
|
+
(synchronous). A gone session (`session_actions.js leaveGoneSession`, the one place: a send's `not_found`, a re-read's
|
|
988
|
+
404, the hub's `session_gone`) moves its draft to the start page's before the start page opens, unless a delete from
|
|
989
|
+
this tab is taking it (the `deleting` set, filled when the sheet's request starts: the open link of a chain deleted
|
|
990
|
+
whole too); `afterDelete` drops the deleted ids' drafts after its `clearSelection`. A gone session that isn't open
|
|
991
|
+
keeps its draft until the sweep.
|
|
992
|
+
|
|
993
|
+
**Continue →** (`session_actions.js continueSelected`): right after the 201 (`addCreatedSession`), before it looks at
|
|
994
|
+
which session is open, `handOverDraft(id, next, created)` = `drafts.handOver(A, A', openerText(created))`: a draft
|
|
995
|
+
with text or chips moves whole to the new link (A's saved copy gone), an empty one leaves the link the opener. On
|
|
996
|
+
another session at the answer: the toast's Open, that session's draft untouched; still on A (or back on it): `await
|
|
997
|
+
select(next)`, then `revealDraft()` (the composer opens, the box takes the focus, the caret at the end). There is no
|
|
998
|
+
Restore draft and no guess of where a draft came from (the old `draftFrom`/`noteDraft` and `chains.js openerFill`'s
|
|
999
|
+
rule). A 409 `continued` hands the draft to the link that continues it only into an empty draft of its own, no opener.
|
|
1000
|
+
Chips moved from A go up again to A' at its send (`images.js uploadChips`, by `chip.session`).
|
|
1001
|
+
|
|
1002
|
+
**Swept** with the view settings (`COMPOSER_DRAFT` is in `PREF_KEYS`): only an unscoped list, ids missing from it,
|
|
1003
|
+
never an empty list (the hub answers its first snapshot empty until its first scan: a page reloaded as chi web
|
|
1004
|
+
restarts). A session the hub holds with no summary yet is left out of a snapshot: its draft can go then (accepted).
|
|
1005
|
+
Not kept or swapped: the Verify claim and the armed Revise (cleared on a switch, as before), ↑/↓ history (shared; its
|
|
1006
|
+
place resets on a swap), the delivery line's armed choice (a switch disarms it: `resetTurnView`'s
|
|
1007
|
+
`setTurnRunning(false)` redraws the composer with no running turn, and the line leaves `running`).
|
|
1008
|
+
|
|
1009
|
+
Two tabs on one session: the last writer wins, no cross-tab refresh. A tab reads a key's saved text once and
|
|
1010
|
+
saves on a switch only what it changed since it last read, painted or saved that key (`base`): a tab that only
|
|
1011
|
+
switches away never writes back an older copy over another tab's newer text.
|
|
1012
|
+
|
|
1013
|
+
The sweep now deletes draft **text**, not only view settings: another chi web on the same origin (the same host and
|
|
1014
|
+
port with another state dir, a smoke run on 4567) lists other sessions, and its page's first load sweeps this
|
|
1015
|
+
browser's drafts of the sessions it doesn't know.
|
|
1016
|
+
|
|
1017
|
+
**A mixed cache**: `send_turn.js` and `composer.js` take an older app.js's bag (`el`, `chips()`, `setChips(list)`,
|
|
1018
|
+
`clear()`: the one box) as well as this one's, and app.js still passes those members for an older cached
|
|
1019
|
+
`send_turn.js` (`drafts_mixed_cache.test.js` loads 0.191.0's from `spec/web/public/fixtures/v0.191.0/`); its `select`
|
|
1020
|
+
dep moves the start page's draft to a created session too (an older `send_turn.js` doesn't). The mount's `onWrite`, a
|
|
1021
|
+
no-argument `afterPick` and send_turn's `noteDraft` are an older module's way to say it wrote the box itself: app.js
|
|
1022
|
+
wires them to `syncFromView`. Beside an older app.js, this mount gets no `setText` (↑/↓ recall nothing until a reload),
|
|
1023
|
+
this command list's `afterPick` writes nothing (a Tab pick does nothing), and `unqueue.js` gets no `putBackTo` (today's
|
|
1024
|
+
toasts). An older cached `composer_mount.js` ignores `{revoke: false}`: a swap frees the chips' previews (broken
|
|
1025
|
+
thumbnails until a reload; the upload still works). An older `session_prefs.js` doesn't sweep the drafts until a
|
|
1026
|
+
reload. app.js still passes `fillOpener` (a shim: the hand-over and the reveal, returning no displaced draft) and a
|
|
1027
|
+
no-op `restoreDraft` for an older cached `session_actions.js`, which calls `fillOpener` after its select (without it
|
|
1028
|
+
its continue would toast "Can't continue" though it succeeded); `chains.js openerFill` and `restoredComposer` stay
|
|
1029
|
+
exported, unused, until after the next release.
|
|
1030
|
+
|
|
936
1031
|
## Stale answers
|
|
937
1032
|
|
|
938
1033
|
The page switches sessions, reopens a popover or asks again while a fetch is out. An answer for the old ask must be
|
|
@@ -948,7 +1043,7 @@ On it: `context_chips.js`, `peer_data.js`, `project_picker.js`, `participants_pa
|
|
|
948
1043
|
turn-end re-reads (`session_view.js` `readTurnEnd`, app.js's `refreshTimingFromSession`, `mergeTurnTiming`) and app.js's init-row timers. Still by hand
|
|
949
1044
|
(the id decides more than "drop it"): `session_sync.js` `resync`/`retryResync` (the re-read budget, `resyncAgain`), the stream's
|
|
950
1045
|
close, `session_actions.js` (a continue opens another session on purpose), `send_turn.js` (a failure for another
|
|
951
|
-
session becomes a toast). A new await in a component
|
|
1046
|
+
session becomes a toast; the drafts it writes are by the key it started in: The drafts). A new await in a component
|
|
952
1047
|
uses `latest.js`.
|
|
953
1048
|
|
|
954
1049
|
## API clients
|
|
@@ -991,17 +1086,20 @@ reach another device or the server.
|
|
|
991
1086
|
| `chi_markdown_tip_dismissed` | `markdown_tip.js` | the markdown tip dismissed |
|
|
992
1087
|
| `chi_update_available_shown` | `version_notices.js` | update notices already shown |
|
|
993
1088
|
| `chi_notify`, `chi_push_device` | `notifications.js` (an injected storage) | the bell's state, this device's push id |
|
|
1089
|
+
| `chi_composer_draft:<session>` | `drafts.js` (through `session_prefs.js`; the key is `draft_keys.js COMPOSER_DRAFT`) | the session's composer draft's text (none while empty; its images are never stored) |
|
|
1090
|
+
| `chi_start_draft` | `drafts.js` (`draft_keys.js START_DRAFT`) | the start page's draft's text, one per browser; outside the sweep |
|
|
994
1091
|
| `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) |
|
|
995
1092
|
|
|
996
|
-
**A session's view settings** (`session_prefs.js`): the five `<key>:<session>` keys above
|
|
997
|
-
defined in `ws_sections.js`,
|
|
1093
|
+
**A session's view settings** (`session_prefs.js`): the five `<key>:<session>` view keys above and the composer's
|
|
1094
|
+
draft (the fifth's name is defined in `ws_sections.js`, the draft's in `draft_keys.js`, new modules, so
|
|
1095
|
+
`session_prefs.js` exports nothing new: the mixed-cache rule). `read(key, session)` is the
|
|
998
1096
|
session's own value, else the page's default (only the stage fold has one: `web.stage_collapsed` on `<body>`), else
|
|
999
1097
|
the module's; `write(key, session, value)` writes the session's key only; with no session (the start page) the value
|
|
1000
1098
|
stays in memory until a reload. Each module reads its value again when a session's view is drawn (`session_view.js
|
|
1001
1099
|
applyPrefs`: at the end of `forgetSession`, so on a select once the new session is set, and at the start of each
|
|
1002
1100
|
`renderSessionView`): `stage_view.js applyPrefs` (the stage's fold, `stage_asking.js reloadChoice`, and the rail's),
|
|
1003
|
-
`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
|
|
1004
|
-
(`sweepSessionPrefs`, app.js `sweepFoldsOnce`, next to `sweepAnswerFolds`): only on an unscoped list, since these keys
|
|
1101
|
+
`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 six
|
|
1102
|
+
(`sweepSessionPrefs`, app.js `sweepFoldsOnce`, next to `sweepAnswerFolds`): only on an unscoped, non-empty list, since these keys
|
|
1005
1103
|
hold no project root. The old page-wide keys (`chi_stage_collapsed`, `chi_composer_floor`, `chi_composer_collapsed`,
|
|
1006
1104
|
`chi_working_set_collapsed`, no `:<session>`) are no longer read or written, and left in storage as they were.
|
|
1007
1105
|
|
data/docs/peers.md
CHANGED
|
@@ -56,7 +56,9 @@ lost: it is a note, and the user's next message lets chi read it. The skills say
|
|
|
56
56
|
`chi send` past it.
|
|
57
57
|
|
|
58
58
|
A say is refused, with nothing written, for: no such session; a session being deleted; a continued one (`this
|
|
59
|
-
session was continued as <id>: say it there`);
|
|
59
|
+
session was continued as <id>: say it there`); one being continued right now (`this session is being continued as
|
|
60
|
+
<id>: say it there in a moment`: its new link is not saved yet); one busy with another change (`this session is busy
|
|
61
|
+
with another change; try again in a moment`); not paired (`not paired: run the pair script`); an older worker
|
|
60
62
|
(`restart the session`); 200 messages chi hasn't read yet.
|
|
61
63
|
|
|
62
64
|
Through `--remote NAME` (or `CHI_REMOTE`) the remote's chi web does the say and the wait, and returns the line.
|
data/docs/plugins.md
CHANGED
|
@@ -1529,7 +1529,8 @@ ctx.sessions.stop(id) # one of this session's own children
|
|
|
1529
1529
|
- `send(id, text)` sends a user message to a session (an id or a unique
|
|
1530
1530
|
prefix); it runs as a turn, and an idle session is woken. A session its
|
|
1531
1531
|
owner stopped or archived is not: `Error` (`session_stopped` /
|
|
1532
|
-
`session_archived`), nothing sent; nor one being deleted (`session_deleting`)
|
|
1532
|
+
`session_archived`), nothing sent; nor one being deleted (`session_deleting`) or held by a transition right now
|
|
1533
|
+
(`link_continued`, `transition_busy`: try again in a moment). It waits up to
|
|
1533
1534
|
5 s for the session's worker, so call it from an anytime command or a
|
|
1534
1535
|
thread of your own, never from a tool or hook of a running turn. A
|
|
1535
1536
|
session a `--non-interactive` one-shot has can't take it.
|
data/docs/scheduling.md
CHANGED
|
@@ -173,8 +173,12 @@ are the refusals that mean "not this moment": `ArchiveRefused` with `busy`, `que
|
|
|
173
173
|
or `offer`, or `busy_child`/`queued_child`/`offer_child` (a chain's own running
|
|
174
174
|
delegate refuses the archive, since `archivable!` walks the whole descendant tree),
|
|
175
175
|
`SessionContinue::Refused(:continued)` (a human continued it while we were
|
|
176
|
-
resolving)
|
|
177
|
-
|
|
176
|
+
resolving), `:open_children` and `:transition_busy` (another continue of the
|
|
177
|
+
chain's end held its transition lock past the continue's 10 s on each of its tries), and a
|
|
178
|
+
same-mode turn its target's transition lock refused (`transition_busy`, or `link_continued` naming a
|
|
179
|
+
continue's new link: the turn's own hold, nothing written).
|
|
180
|
+
So is an archived target that a continue is still
|
|
181
|
+
making the next link of (`session 3f9a1c2e is being continued as 7b2d41aa-…; retry at the next tick`): a
|
|
178
182
|
person's `chi send --new --continues` or web `continue →` archives the link before
|
|
179
183
|
its successor is saved, and a tick in that moment sees an archived end
|
|
180
184
|
(`ContinueIntent.in_flight`: the intent written, its lock held). It is checked before
|
|
@@ -277,8 +281,10 @@ is refused with exit 2, naming the matches.
|
|
|
277
281
|
The tick's lock covers the file only, never the action: the clock advances before
|
|
278
282
|
the work starts — for `every` and `weekday` to the next occurrence, for a `date`
|
|
279
283
|
one-off to none — so a tick killed mid-continue cannot fire the same entry twice.
|
|
280
|
-
If a later tick finds a firing older than
|
|
281
|
-
counts an `interrupted` failure
|
|
284
|
+
If a later tick finds a firing older than 70 seconds without an accepted turn, it
|
|
285
|
+
counts an `interrupted` failure (a chain firing's continue can wait 30 s for the
|
|
286
|
+
recap, 10 s for the transition lock on each of its three tries, 5 s for the
|
|
287
|
+
archive). This 70-second limit covers only the firing
|
|
282
288
|
step, not an accepted turn or its pending question. The action may already have
|
|
283
289
|
taken effect before the process died, so that occurrence is not replayed; a
|
|
284
290
|
`date` one-off stays disabled with the failure visible, and recurring schedules
|
|
@@ -388,8 +394,20 @@ whole subtree only when every session in it is archived and no worker owns any o
|
|
|
388
394
|
it, deepest child first and the link last, oldest link first. The delete itself is
|
|
389
395
|
`SessionManager.delete_ids` (the prune keeps its own checks and log tags): each id
|
|
390
396
|
through `delete_session`, and System 1's saved runs and the candidate log purged once
|
|
391
|
-
per link's batch, not once per session.
|
|
392
|
-
|
|
397
|
+
per link's batch, not once per session. Each link goes under the transition
|
|
398
|
+
locks of it and the link after it (`SessionTransition`, one try, kind `delete`).
|
|
399
|
+
**A link that can't go now holds the prune there**: one not archived (brought back
|
|
400
|
+
by hand), one whose subtree holds a schedule's anchor, head or target (another
|
|
401
|
+
enabled schedule anchored inside the chain, as `schedule_task` from a link does), a
|
|
402
|
+
live worker or an unarchived descendant in its subtree, or its or the next link's
|
|
403
|
+
transition lock held (a send, a continue, a delete). The prune stops below it: that
|
|
404
|
+
link and every newer one stay, and nothing is deleted around it. The entry records
|
|
405
|
+
where it waits (`prune_waiting` in schedules.json: link, reason, since when; no
|
|
406
|
+
history row), `chi schedule list` adds `pruning held at <id>` to the row and `show` a
|
|
407
|
+
line `pruning held at <id>: <reason> (since …)`, the log says `prune_waiting` once
|
|
408
|
+
per link (not every tick), and every tick tries again, not only after a firing; once
|
|
409
|
+
it gets past, the record goes. A schedule anchored inside the chain holds it until
|
|
410
|
+
that schedule is cancelled. Pruning a link alone would leave its finished
|
|
393
411
|
delegates archived forever with a dangling `parent_id`: archiving a session archives
|
|
394
412
|
its descendants, and archived sessions are outside the retention sweep
|
|
395
413
|
([sessions.md](sessions.md)), so the delegate pile is the bulk of the archived
|
|
@@ -398,7 +416,13 @@ the coordinator remember, and `last:<anchor>` must keep resolving. Once the
|
|
|
398
416
|
anchor's successor is gone, nothing continues the anchor; the chain walks for
|
|
399
417
|
`last:`, `chi send` and notes cross that gap to the entry's `head`
|
|
400
418
|
(`SessionChain::Links#anchor_forward`, [sessions.md](sessions.md), *Session chains*
|
|
401
|
-
→ Which link), so the anchor stays the chain's address.
|
|
419
|
+
→ Which link), so the anchor stays the chain's address. Cancelling the schedule
|
|
420
|
+
that bridges that gap ends the bridge: `last:`, sends and notes land in the anchor
|
|
421
|
+
again, so `chi schedule cancel` says so in one more line naming the chain's newest
|
|
422
|
+
link ("3f9a1c2e's chain was pruned; its newest link is 7d2b4e10 — send there from
|
|
423
|
+
now on.", `Schedules::Cancelled`), and the `cancel_schedule` tool's answer adds the
|
|
424
|
+
same line. Another schedule still bridging the gap means no line (cancelling that
|
|
425
|
+
one says it); disabling keeps the bridge. A link a previous prune
|
|
402
426
|
already deleted is skipped, so each later firing prunes the next link behind the
|
|
403
427
|
window.
|
|
404
428
|
|