samagotchi 0.171.0 → 0.172.1
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 +46 -1
- data/bin/chi +6 -4
- data/docs/architecture.md +24 -7
- data/docs/bundles.md +4 -21
- data/docs/cli.md +50 -80
- data/docs/configuration.md +11 -13
- data/docs/context.md +5 -6
- data/docs/guardrails.md +57 -96
- data/docs/hooks.md +3 -4
- data/docs/internals/attached-context.md +6 -7
- data/docs/internals/background-tasks.md +4 -3
- data/docs/internals/bridge.md +29 -3
- data/docs/internals/engine.md +21 -9
- data/docs/internals/objectives.md +3 -5
- data/docs/internals/participants.md +118 -143
- data/docs/internals/prompt-caching.md +4 -5
- data/docs/internals/web-frontend.md +70 -27
- data/docs/internals/working-set.md +7 -5
- data/docs/memory.md +1 -1
- data/docs/plugins.md +2 -16
- data/docs/scheduling.md +1 -1
- data/docs/sessions.md +15 -49
- data/docs/sub-agent.md +2 -2
- data/docs/system-one.md +2 -2
- data/docs/testing.md +81 -8
- data/lib/samagotchi/bridge/card_store.rb +1 -0
- data/lib/samagotchi/bridge/sse_writer.rb +1 -0
- data/lib/samagotchi/bridge/turn_accumulator.rb +0 -1
- data/lib/samagotchi/bridge.rb +26 -9
- data/lib/samagotchi/bridge_client/event_stream.rb +2 -0
- data/lib/samagotchi/bundle_command/test_run.rb +1 -0
- data/lib/samagotchi/bundle_command/try/run.rb +1 -0
- data/lib/samagotchi/bundles/coordinator/manifest.yml +4 -5
- data/lib/samagotchi/bundles/coordinator/plugin.rb +6 -79
- data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +1 -16
- data/lib/samagotchi/bundles/github-pr/manifest.yml +2 -2
- data/lib/samagotchi/bundles/github-pr/plugin.rb +0 -1
- data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
- data/lib/samagotchi/bundles/inline-widgets/plugin.rb +4 -5
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/client_id.rb +126 -67
- data/lib/samagotchi/command_intake.rb +15 -3
- data/lib/samagotchi/compat.rb +6 -1
- data/lib/samagotchi/context_candidate_choice.rb +1 -3
- data/lib/samagotchi/context_candidates.rb +3 -4
- data/lib/samagotchi/continue_offer.rb +9 -2
- data/lib/samagotchi/delivery.rb +23 -12
- data/lib/samagotchi/empty_answer_error.rb +5 -0
- data/lib/samagotchi/engine/cards.rb +3 -0
- data/lib/samagotchi/engine/context_judge.rb +5 -3
- data/lib/samagotchi/engine/events.rb +4 -0
- data/lib/samagotchi/engine/hooks.rb +3 -0
- data/lib/samagotchi/engine/messages.rb +5 -0
- data/lib/samagotchi/engine/model_settings.rb +2 -0
- data/lib/samagotchi/engine/models.rb +10 -0
- data/lib/samagotchi/engine/objectives.rb +6 -0
- data/lib/samagotchi/engine/participants.rb +18 -14
- data/lib/samagotchi/engine/plugins.rb +8 -0
- data/lib/samagotchi/engine/questions.rb +3 -0
- data/lib/samagotchi/engine/recap.rb +1 -0
- data/lib/samagotchi/engine/session.rb +4 -0
- data/lib/samagotchi/engine/side_requests.rb +9 -0
- data/lib/samagotchi/engine/steering.rb +2 -0
- data/lib/samagotchi/engine/toolkit.rb +5 -0
- data/lib/samagotchi/engine/turn_end.rb +7 -0
- data/lib/samagotchi/engine/turn_helpers.rb +8 -0
- data/lib/samagotchi/engine/verify.rb +2 -0
- data/lib/samagotchi/engine.rb +3 -2
- data/lib/samagotchi/grants.rb +28 -22
- data/lib/samagotchi/guardrail_wiring.rb +23 -18
- data/lib/samagotchi/guardrails/approval_use.rb +59 -0
- data/lib/samagotchi/guardrails/approvals.rb +9 -11
- data/lib/samagotchi/guardrails/child_boundary.rb +1 -0
- data/lib/samagotchi/guardrails/gate.rb +10 -5
- data/lib/samagotchi/guardrails/implicit_writers.rb +1 -0
- data/lib/samagotchi/guardrails/pair_boundary.rb +6 -6
- data/lib/samagotchi/guardrails/participant_refusal.rb +33 -0
- data/lib/samagotchi/guardrails/review_paths.rb +2 -3
- data/lib/samagotchi/guardrails.rb +1 -1
- data/lib/samagotchi/llm_context_strategy.rb +2 -0
- data/lib/samagotchi/objectives.rb +1 -4
- data/lib/samagotchi/objectives_audit.rb +1 -1
- data/lib/samagotchi/objectives_track.rb +1 -1
- data/lib/samagotchi/owner_prompt.rb +3 -6
- data/lib/samagotchi/parent_report.rb +1 -0
- data/lib/samagotchi/participant_messages.rb +9 -4
- data/lib/samagotchi/participant_turn_mode.rb +50 -0
- data/lib/samagotchi/participants.rb +21 -12
- data/lib/samagotchi/participants_watch.rb +2 -2
- data/lib/samagotchi/plugin/api.rb +2 -2
- data/lib/samagotchi/plugin/attached_context.rb +1 -1
- data/lib/samagotchi/plugin/context.rb +0 -4
- data/lib/samagotchi/plugin/sessions.rb +1 -25
- data/lib/samagotchi/run_options.rb +2 -3
- data/lib/samagotchi/send_command.rb +10 -10
- data/lib/samagotchi/session.rb +0 -3
- data/lib/samagotchi/session_access/contract.rb +1 -10
- data/lib/samagotchi/session_access/local.rb +10 -23
- data/lib/samagotchi/session_access/remote.rb +9 -20
- data/lib/samagotchi/session_access.rb +12 -16
- data/lib/samagotchi/session_chain.rb +4 -6
- data/lib/samagotchi/session_commands.rb +6 -3
- data/lib/samagotchi/session_continue.rb +1 -2
- data/lib/samagotchi/session_manager/delivery.rb +25 -5
- data/lib/samagotchi/session_manager/lifecycle.rb +12 -0
- data/lib/samagotchi/session_manager/listing.rb +5 -0
- data/lib/samagotchi/session_manager/spawn.rb +2 -2
- data/lib/samagotchi/session_manager/worker_command.rb +9 -0
- data/lib/samagotchi/session_participants.rb +12 -8
- data/lib/samagotchi/session_review.rb +5 -7
- data/lib/samagotchi/session_stores.rb +3 -3
- data/lib/samagotchi/share_command.rb +10 -12
- data/lib/samagotchi/share_terms.rb +41 -0
- data/lib/samagotchi/steer.rb +8 -14
- data/lib/samagotchi/system_prompt.rb +16 -25
- data/lib/samagotchi/terminal_ui/attach_launcher.rb +2 -1
- data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -0
- data/lib/samagotchi/terminal_ui/attached_loop/queueing.rb +1 -0
- data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -0
- data/lib/samagotchi/terminal_ui/formatting.rb +15 -17
- data/lib/samagotchi/terminal_ui/participant_commands.rb +2 -2
- data/lib/samagotchi/terminal_ui/status_row.rb +2 -2
- data/lib/samagotchi/terminal_ui.rb +1 -2
- data/lib/samagotchi/testing/sessions.rb +2 -10
- data/lib/samagotchi/tool_runner.rb +8 -9
- data/lib/samagotchi/toolkit.rb +4 -22
- data/lib/samagotchi/toolkit_suggest.rb +3 -3
- data/lib/samagotchi/tools/deferred_tools.rb +1 -0
- data/lib/samagotchi/tools/execute.rb +11 -45
- data/lib/samagotchi/tools/leftovers.rb +126 -0
- data/lib/samagotchi/tools/memory.rb +70 -26
- data/lib/samagotchi/tools/task_get.rb +1 -0
- data/lib/samagotchi/tools/task_list.rb +3 -2
- data/lib/samagotchi/tools/task_record.rb +6 -4
- data/lib/samagotchi/tools/task_runtime.rb +199 -20
- data/lib/samagotchi/tools/task_wait.rb +4 -3
- data/lib/samagotchi/turn_context.rb +1 -1
- data/lib/samagotchi/turn_origin.rb +1 -1
- data/lib/samagotchi/turn_stages/context_judge.rb +4 -4
- data/lib/samagotchi/turn_stages/objectives.rb +2 -2
- data/lib/samagotchi/turn_stages/toolkit_suggestion.rb +2 -2
- data/lib/samagotchi/update_hint.rb +3 -1
- data/lib/samagotchi/verify_fresh.rb +1 -1
- data/lib/samagotchi/verify_fresh_origin.rb +13 -11
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +3 -5
- data/lib/samagotchi/web/participant_access.rb +14 -18
- data/lib/samagotchi/web/participant_review.rb +3 -4
- data/lib/samagotchi/web/participant_show.rb +4 -3
- data/lib/samagotchi/web/participant_view.rb +3 -3
- data/lib/samagotchi/web/participants_admin.rb +21 -40
- data/lib/samagotchi/web/public/app.js +7 -48
- data/lib/samagotchi/web/public/card_kinds.js +51 -0
- data/lib/samagotchi/web/public/cards_place.js +13 -2
- data/lib/samagotchi/web/public/data.js +2 -10
- data/lib/samagotchi/web/public/delivery_line.js +17 -60
- data/lib/samagotchi/web/public/index.html +10 -30
- data/lib/samagotchi/web/public/live_turn.js +1 -1
- data/lib/samagotchi/web/public/owner_claim.js +2 -2
- data/lib/samagotchi/web/public/participant_bar.js +4 -5
- data/lib/samagotchi/web/public/participant_names.js +14 -10
- data/lib/samagotchi/web/public/participants_panel.js +29 -62
- data/lib/samagotchi/web/public/question_cards.js +29 -14
- data/lib/samagotchi/web/public/reload_check.js +2 -3
- data/lib/samagotchi/web/public/send_turn.js +4 -23
- data/lib/samagotchi/web/public/session_actions.js +4 -45
- data/lib/samagotchi/web/public/session_fields.js +0 -1
- data/lib/samagotchi/web/public/session_state.js +0 -3
- data/lib/samagotchi/web/public/session_sync.js +4 -2
- data/lib/samagotchi/web/public/session_view.js +2 -3
- data/lib/samagotchi/web/public/settings_panel.js +4 -18
- data/lib/samagotchi/web/public/stage_answer.js +56 -0
- data/lib/samagotchi/web/public/stage_asking.js +30 -11
- data/lib/samagotchi/web/public/stage_cloud.js +93 -0
- data/lib/samagotchi/web/public/stage_dom.js +100 -0
- data/lib/samagotchi/web/public/stage_handoff.js +154 -0
- data/lib/samagotchi/web/public/stage_pager.js +59 -0
- data/lib/samagotchi/web/public/stage_place.js +144 -0
- data/lib/samagotchi/web/public/stage_probe.js +64 -0
- data/lib/samagotchi/web/public/stage_quiet_clock.js +52 -0
- data/lib/samagotchi/web/public/stage_view.js +133 -506
- data/lib/samagotchi/web/public/stage_waiting.js +30 -13
- data/lib/samagotchi/web/public/start_page.js +12 -33
- data/lib/samagotchi/web/public/start_settings.js +24 -78
- data/lib/samagotchi/web/public/start_toolkit.js +6 -10
- data/lib/samagotchi/web/public/stream_handlers.js +1 -9
- data/lib/samagotchi/web/public/turn_block.js +3 -7
- data/lib/samagotchi/web/public/turn_events.js +15 -6
- data/lib/samagotchi/web/public/turn_pieces.js +3 -4
- data/lib/samagotchi/web/public/viewer_self.js +8 -2
- data/lib/samagotchi/web/qr.rb +1 -1
- data/lib/samagotchi/web/session_control.rb +3 -1
- data/lib/samagotchi/web/session_create.rb +5 -71
- data/lib/samagotchi/web/session_summary.rb +1 -4
- data/lib/samagotchi/web/verify_fresh_routes.rb +8 -7
- data/lib/samagotchi/web/viewer.rb +3 -3
- data/lib/samagotchi/worker.rb +16 -14
- data/lib/samagotchi/worker_inbound.rb +4 -3
- data/lib/samagotchi/worker_link.rb +17 -0
- data/lib/samagotchi/working_set.rb +87 -28
- metadata +16 -8
- data/lib/samagotchi/guardrails/review_boundary.rb +0 -99
- data/lib/samagotchi/participant_mode.rb +0 -86
- data/lib/samagotchi/review_apply.rb +0 -131
- data/lib/samagotchi/review_command.rb +0 -123
- data/lib/samagotchi/review_start.rb +0 -196
- data/lib/samagotchi/web/public/review_apply.js +0 -34
- data/lib/samagotchi/web/public/review_start.js +0 -55
data/docs/sub-agent.md
CHANGED
|
@@ -69,9 +69,9 @@ Exit codes, both commands:
|
|
|
69
69
|
| 0 | `command` | (`chi send`) the message was a session command (`/model x`): it ran as one, no reply comes |
|
|
70
70
|
| 0 | `not_continued` | (`chi answer`) a Stop answered the step-limit question; the turn's work so far stays |
|
|
71
71
|
| 3 | `question` | chi waits for an answer: `question`, `answer_with` |
|
|
72
|
-
| 3 | `waiting_for_owner` | (a participant's wait, `chi --remote NAME send --wait` with their link's token) their
|
|
72
|
+
| 3 | `waiting_for_owner` | (a participant's wait, `chi --remote NAME send --wait` with their link's token) their turn waits on the session's owner: a question or an approval it raised, or the owner's step-limit Continue; wait again |
|
|
73
73
|
| 4 | `running` | `--timeout` passed; the turn goes on, wait again |
|
|
74
|
-
| 1 | `refused` | (a participant's wait) their queued
|
|
74
|
+
| 1 | `refused` | (a participant's wait) their queued turn was refused before it ran: `cancel_reason` `revoked` (their link was revoked or expired), `outdated` (their link is an older chi's read-only one) or `cap_reached` (they spent their cap); no turn ran for it |
|
|
75
75
|
| 1 | `failed`, `canceled`, `limit`, `removed`, `no_answer`, `error`, `worker_gone`, `stopped` | `detail` says what happened (`limit`: the turn ran out of steps and nobody can be asked, e.g. an older worker; `chi send ID -m '/continue yes'` continues it, except under `guardrails.parent_answers: hard`, where a parent's `/continue yes` is refused as its `chi answer --option Continue` is; `removed`: the `--queue` message waited for was taken back before it ran, no turn ran for it). `failed` adds `error_kind` (the provider error's kind: `credits`, `credits_held`, `rate_limited`, `server`, `auth`, `connection`, …) and `retryable` when known; `canceled` adds `cancel_reason` (`user`: a Stop in the web; `session_stopped`: a session stop, `chi sessions stop` or the web's; `worker_stopped`: the turn waited for (a `--queue` message's, a message's to an idle session, the running turn a message merged into or a plain `--wait` saw running) died with its worker (detail "its worker exited mid-turn"), settled by the next one; `hook`; `ctrl_c`; `manual`) and `stopped_by` (the hook that stopped it, e.g. `loop-guard`) when known |
|
|
76
76
|
| 2 | (no JSON) | usage error, or an option the question doesn't offer |
|
|
77
77
|
| 130 | `running` | Ctrl-C; the turn goes on |
|
data/docs/system-one.md
CHANGED
|
@@ -26,7 +26,7 @@ one warn and never changes the answer. A use that needs the run's id at once pas
|
|
|
26
26
|
|
|
27
27
|
Not saved: a toolkit warm-up (it goes straight to the backend), `chi guardrails replay`,
|
|
28
28
|
chi web's availability check, a scratch session's asks or anything about them, and a participant's turn (never judged by core; a bundle's ask there still goes, unsaved).
|
|
29
|
-
|
|
29
|
+
Test runs are saved with `test_run: true`.
|
|
30
30
|
|
|
31
31
|
## Bundles' judgments
|
|
32
32
|
|
|
@@ -54,7 +54,7 @@ per-message judge on an objective didn't work as a gate on the pod (AUC about .5
|
|
|
54
54
|
into the conversation (not the list's own, nor a continue's carry note: `Objectives.outside_note?`). A steer isn't asked about.
|
|
55
55
|
- `objectives.outgoing`: a finished answer of the owner's turn of 400 characters or more, not a cancelled or exhausted one.
|
|
56
56
|
- The state: `objective` (its text and done-when, no id or status) and `message` (2000 characters: a message's head, an answer's tail).
|
|
57
|
-
**That text goes to the System 1 host**, a hosted one too, and into the run. A participant's turn
|
|
57
|
+
**That text goes to the System 1 host**, a hosted one too, and into the run. A participant's turn and a scratch session are never asked about.
|
|
58
58
|
- At most 6 objectives per message. Each direction has one ask running: what comes meanwhile is a run with `asked: false`, `skipped: busy`.
|
|
59
59
|
- The asks run on `SideJudgments`' threads beside the turn, so a turn doesn't wait; on a one-slot server shared with the session's model, a request can still queue behind or ahead of them. They share `/v1/systemone` with approvals: on a slow one-slot host an approval can wait behind up to 2 in-flight asks and time out to the user. A failed ask is a run with its `failure` and one log line (`system_one_failed`).
|
|
60
60
|
|
data/docs/testing.md
CHANGED
|
@@ -8,7 +8,7 @@ npm test # web frontend specs
|
|
|
8
8
|
npm run lint # web frontend: undefined names and unused imports (ESLint; CI runs it)
|
|
9
9
|
npm run e2e # web UI happy paths in Chromium, fake model (once: npx playwright install chromium)
|
|
10
10
|
npx playwright test spec/e2e/stage.spec.js # one e2e file (the root playwright.config.js is the suite's)
|
|
11
|
-
bundle exec rake lint # RuboCop: no offenses (CI runs it)
|
|
11
|
+
bundle exec rake lint # RuboCop and script/load-check --strict: no offenses, no findings (CI runs it)
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Run `bundle exec rubocop -a` on the files you changed before committing: every enabled style cop follows the
|
|
@@ -20,7 +20,7 @@ bug) or a broken spec: fix it, or disable that line with the reason (`# rubocop:
|
|
|
20
20
|
with two rules only, `no-undef` (a name used but never imported or declared: a dropped import) and `no-unused-vars`
|
|
21
21
|
(an import or variable left over), over the browser's globals (`eslint.config.js`). It is a missing-name guard, not a
|
|
22
22
|
style pass: add a rule only for a bug class it would have caught. It runs in about 2 s, in CI's `npm test` job and in
|
|
23
|
-
`rake release:check`; `rake lint` stays RuboCop
|
|
23
|
+
`rake release:check`; `rake lint` stays Ruby only (RuboCop and the load check: CI's rubocop job has no node). A name that is also a browser
|
|
24
24
|
global (`name`, `status`, `open`…) passes even when its import is gone: give an export such a name only with care.
|
|
25
25
|
It also caps every web module's size and `app.js`'s own, lower (`max-lines`; see docs/internals/web-frontend.md).
|
|
26
26
|
It also checks `spec/e2e/` for two things: `no-unused-vars`, and the Playwright twin of `Samagotchi/SpecSleep`: no `page.waitForTimeout`.
|
|
@@ -64,8 +64,8 @@ The whole-turn goldens (`spec/engine_turn_golden_spec.rb`, `spec/fixtures/turn_g
|
|
|
64
64
|
`Engine#run_turn` (its own KernelLoop, ChatLoop, ToolRunner, Gate and GuardrailWiring) over `FakeProviderServer` on
|
|
65
65
|
the native (llama.cpp `/completion`, Qwen tool calls), `api: openai` and `api: anthropic` wires: a turn of two tool
|
|
66
66
|
iterations (a muted `memory_read` and a `read`, then a `write` a config rule asks about, allowed through the question
|
|
67
|
-
flow), a `before_turn` hook switching the model (the request names the new model with the old one's sampling), and
|
|
68
|
-
|
|
67
|
+
flow), a `before_turn` hook switching the model (the request names the new model with the old one's sampling), and an
|
|
68
|
+
older chi's read-only participant's turn whose `read` and `write` the participant seat refuses (`ParticipantRefusal`). Each golden pins every request (the chi-set
|
|
69
69
|
headers, the body in its key order, the native prompt as text), the turn's events (keys sorted; the context-status
|
|
70
70
|
estimates and clock values masked), each `before_tool_call` payload, the approval asked and the session's messages.
|
|
71
71
|
System 1, the toolkit suggestion, the context judge, the recap and the warm-up are off by config, so the order is the
|
|
@@ -84,11 +84,16 @@ next round folds the first three into one wiring example each in `effective_mode
|
|
|
84
84
|
`session_model_settings_spec.rb` and `session_setting_spec.rb`, and the ladders the round after into the setting
|
|
85
85
|
modules' and `model_lookup_spec.rb`.
|
|
86
86
|
|
|
87
|
+
The sender rows (`ClientId::ROWS`) have three pins: `spec/client_id_characterization_spec.rb` (what every id chi
|
|
88
|
+
makes, a sample per prefix, nil, "" and unknown ids get from `human?`, `owner?`, `interactive?`, `wake_kind`, `origin`
|
|
89
|
+
and `Steer.source_for_client`: a row change shows up there), `spec/client_id_spec.rb` (every String constant of
|
|
90
|
+
`ClientId` has a row) and `spec/shared/labels_matrix.json` (a client case per row, both UIs' labels).
|
|
91
|
+
|
|
87
92
|
The session file goldens (`spec/session_file_goldens_spec.rb`, `spec/fixtures/session_goldens/`) pin the bytes `Session#save`
|
|
88
93
|
writes: every field away from its default, a new session, a newer chi's file, an old chi's file in a git repo, every key
|
|
89
94
|
present as `null`, the plain writers' raw values, a running turn's checkpoint and the scrub (the `*_in.json` files are
|
|
90
95
|
hand-written inputs, never regenerated); and the file each path that makes or rewrites a session writes (a fork, a
|
|
91
|
-
continue, a delegate child, a plain spawn, a
|
|
96
|
+
continue, a delegate child, a plain spawn, a Verify fresh child, a respawn; a resume and an archive leave the bytes as they were), with
|
|
92
97
|
`carry_matrix.json`, what each keeps of its source. They are pinned before Session's fields became one table and are kept
|
|
93
98
|
as the file format's pins, not retired: a diff is a change to every session file on disk, so only a commit that means to
|
|
94
99
|
change the format regenerates them (`UPDATE_GOLDENS=1 bundle exec rspec spec/session_file_goldens_spec.rb`).
|
|
@@ -190,7 +195,9 @@ registered in `Compat::SHIMS` (`lib/samagotchi/compat.rb`): an id, the release
|
|
|
190
195
|
that added it, `remove_after` (nil: the owner hasn't dated it) and its files,
|
|
191
196
|
each Ruby one naming it in a comment (`compat shim <id>`). `spec/compat_spec.rb`
|
|
192
197
|
fails once `Samagotchi::VERSION` passes a shim's `remove_after`, naming it:
|
|
193
|
-
remove the shim, or move its date with the owner's OK. A new shim gets a row
|
|
198
|
+
remove the shim, or move its date with the owner's OK. A new shim gets a row
|
|
199
|
+
(`review_client_id`: a participant's `review:<id>` from 0.171 and before, until 0.173; its old-shape samples are
|
|
200
|
+
hand-made in `spec/fixtures/compat_review_client_id/`, as no corpus recorded one).
|
|
194
201
|
|
|
195
202
|
## Levels
|
|
196
203
|
|
|
@@ -228,7 +235,12 @@ Each level owns its own share; a detail is asserted once, at the lowest level th
|
|
|
228
235
|
its cards, the docked ones, the lead-in bubbles, the card in front, the one that shows and the pager, the fold) and
|
|
229
236
|
the history compared; a known difference is listed in its `EXPECTED`, by scenario, cut and field (one gone fails
|
|
230
237
|
too; none today), and on both pages `stage_waiting.js`'s cards agree with the slots, one docked card showing. `STAGE_CUTS_DEBUG=1` prints each cut's differences. Both
|
|
231
|
-
harnesses build their page with `spec/web/public/live_page.js`.
|
|
238
|
+
harnesses build their page with `spec/web/public/live_page.js`. The stage's drift check (`<body
|
|
239
|
+
data-stage-check="1">`, `stage_asking.js reconcileWaiting`) and the data-vs-node cross-check (`card_kinds.js
|
|
240
|
+
warnDiffers`) warn "stage: waiting …": `spec/web/public/waiting_warnings.js` (`failOnWaitingWarnings`, called by
|
|
241
|
+
`stage_view.test.js` and `stage_cuts_parity.test.js`; under `npm test`'s one process it covers the files loaded
|
|
242
|
+
after them too) turns the check on and fails a test that warned, and `stage.spec.js` does the same in the browser
|
|
243
|
+
(`test.use({ stageCheck: true })`, a fixture in `spec/e2e/support/fixtures.js`).
|
|
232
244
|
`spec/shared/turn_ranges.json` (`UPDATE_TURN_RANGES=1 bundle exec rspec spec/bridge/turn_ranges_spec.rb`) pins
|
|
233
245
|
`Bridge::TurnRanges`' turns, their record pairing, the items as the show stamps them and each turn's drawing end;
|
|
234
246
|
timing.test.js checks `turnGroups` (stamps only) against it. Each scenario's
|
|
@@ -242,7 +254,7 @@ Each level owns its own share; a detail is asserted once, at the lowest level th
|
|
|
242
254
|
its items into turns and gives each a minimal drawing (not the synthesizer: what a real drawing holds is the
|
|
243
255
|
fixtures'). The
|
|
244
256
|
`lan` project's chi web is on the LAN only
|
|
245
|
-
when the machine has a private IPv4: without one its LAN tests skip and the participant
|
|
257
|
+
when the machine has a private IPv4: without one its LAN tests skip and the participant journey runs on
|
|
246
258
|
loopback.
|
|
247
259
|
|
|
248
260
|
## Waiting and time
|
|
@@ -538,6 +550,25 @@ runs its code only on small synthetic sessions, never on yours. See
|
|
|
538
550
|
[internals/llm-context-bench.md](internals/llm-context-bench.md). `script/llm_context_live.rb` runs chi itself on
|
|
539
551
|
real tasks under each strategy (needs a model; costs tokens): [internals/llm-context-live.md](internals/llm-context-live.md).
|
|
540
552
|
|
|
553
|
+
## The stage perf probe
|
|
554
|
+
|
|
555
|
+
`script/stage-perf-probe` (`PROBE_MACHINE=<label>` names the machine; `--keep` leaves its folder, `--headed` shows
|
|
556
|
+
the browser) times the web page's stage on a big session: `script/stage_perf_probe/session.rb` writes 300 finished
|
|
557
|
+
turns with 60 plugin cards and 40 answered questions through chi's own writers (TurnAccumulator's drawings, CardStore,
|
|
558
|
+
`Session#save`; CardStore keeps its cap of 20, the rest are in the drawings), then `probe.js` opens it in chi web
|
|
559
|
+
(the e2e fake model, isolated `HOME` and `XDG_*` under `tmp/stage-probe-*`) at `/?stage_probe=1` (`stage_probe.js`:
|
|
560
|
+
the flag is kept for the tab in sessionStorage, `chi_stage_probe`, so a reload or a hash jump keeps it;
|
|
561
|
+
`?stage_probe=0` drops it; `<body data-stage-probe="1">` works too, for that page only), runs one turn that asks a question and an approval, reloads while the question waits and answers
|
|
562
|
+
both. It prints JSON: `stage:refresh` n/p50/p95/max (ms), the session's open (the hash to the last answer drawn),
|
|
563
|
+
tap→settled per card, reload→card drawn and the JS heap after a GC before the open, after it and after the turn. Its
|
|
564
|
+
`session.drawn` counts what the open drew: all 300 answers and 60 cards, but only the answered questions CardStore
|
|
565
|
+
still lists (8: its cap keeps the newest 20 cards and questions together, and a finished turn's question is drawn from
|
|
566
|
+
that list alone). Bounded:
|
|
567
|
+
the session within 60 s, the browser run within 180 s, cut at 300 s; it stops only what it started (chi web and the
|
|
568
|
+
fake by their handles, the worker through chi web's stop route) and says when anything still names its folder. Not
|
|
569
|
+
part of any suite. On an iPhone: open the page once with `?stage_probe=1` (the Home Screen app: in Safari Web
|
|
570
|
+
Inspector's console, `location.search = "?stage_probe=1"`), run a turn, then `chiStageProbe.report()` there.
|
|
571
|
+
|
|
541
572
|
## The model notes report
|
|
542
573
|
|
|
543
574
|
`ruby script/model_notes_report.rb` reads a sessions folder (`--sessions DIR`, else chi's own) and groups the
|
|
@@ -588,3 +619,45 @@ The code is `script/deps/deps_check.rb`; its spec stubs every request and comman
|
|
|
588
619
|
names (Prism; `be_foo`/`have_foo` count for `foo?`/`has_foo?`), as `path:line name [notes]` with a count; a note says
|
|
589
620
|
what may explain a row (a doc, a name built at run time, a framework hook). Advisory: it always exits 0, CI doesn't
|
|
590
621
|
run it. Its spec is `spec/script/dead_code_spec.rb`.
|
|
622
|
+
|
|
623
|
+
## The load check
|
|
624
|
+
|
|
625
|
+
`script/load-check` reads every file under `lib/samagotchi/` (the shipped bundles under
|
|
626
|
+
`lib/samagotchi/bundles/` apart) and `bin/chi` with Prism and **never loads them**, then checks three rules:
|
|
627
|
+
|
|
628
|
+
1. **call-time reference** — a constant a method body names is defined in the file or reached by its
|
|
629
|
+
`require`/`require_relative`/`autoload` lines, transitively (a `require` inside a method counts here only);
|
|
630
|
+
2. **load-time reference** — a constant evaluated while the file loads (a superclass, `include`/`extend`/
|
|
631
|
+
`prepend`, a class body) comes from a file required above that line, and a require cycle does not
|
|
632
|
+
guarantee it;
|
|
633
|
+
3. **autoload** — an `autoload` may name a constant defined in one file; one that names a namespace
|
|
634
|
+
reopened in several files is a finding. A dynamically named autoload is reported unread, since its name
|
|
635
|
+
cannot be checked.
|
|
636
|
+
|
|
637
|
+
A name that resolves to nothing of chi's (a stdlib or gem constant) is out of scope, and lexical scope is
|
|
638
|
+
mimicked: a bare `Log` inside `module Samagotchi` is `Samagotchi::Log`. Each line is
|
|
639
|
+
`RULE file:line Constant — why`; the summary counts findings per rule, per `lib/samagotchi/<dir or file>`,
|
|
640
|
+
and the files scanned. Report mode exits 0; `--strict` exits 1 when findings remain, and `rake lint` (so
|
|
641
|
+
CI) runs `--strict`: the tree reports none. Its spec is `spec/script/load_check_spec.rb`.
|
|
642
|
+
|
|
643
|
+
**Reading a finding.** `1 lib/samagotchi/engine/models.rb:63 Samagotchi::Log — no require or autoload here
|
|
644
|
+
reaches lib/samagotchi/log.rb, which defines it` says that a method in `models.rb` names `Log` and that the
|
|
645
|
+
file works today only because someone else required `log.rb` first. The fix is the require the line names,
|
|
646
|
+
at the top of the file (`require_relative "../log"`): a require only adds what the file already gets through
|
|
647
|
+
its loaders, so the processes' loaded files don't change (`spec/require_cycle_spec.rb`'s budgets say if they
|
|
648
|
+
do). Prefer an existing door when there is one: `LLM::ChatLoop` is `llm/backend.rb`'s autoload, so a file
|
|
649
|
+
naming it requires `llm/backend`. When the file is needed only on one path a thin process never takes,
|
|
650
|
+
require it inside that method (a method-body require satisfies rule 1). When the require would close a cycle
|
|
651
|
+
(the defining file requires this one: a part naming its host's constants), the finding goes in the
|
|
652
|
+
allow-list. A rule 2 finding is a load-order bug and is fixed, not allow-listed. A rule 3 finding is fixed
|
|
653
|
+
by pointing the autoload at the namespace's base file, or allow-listed when that file requires every file
|
|
654
|
+
that reopens the namespace and nothing else does (then firing the autoload loads it whole).
|
|
655
|
+
|
|
656
|
+
**The allow-list.** `script/load_check/allow.yml` (`--allow FILE` reads another): each entry matches on
|
|
657
|
+
`rule`, `file` and `constant`, with `*` and `[A-Z]` globs, and says why in `reason`. Its entries are of
|
|
658
|
+
four kinds: a part naming its host's value constants (`Samagotchi::Engine::[A-Z][A-Z_]*` in
|
|
659
|
+
`engine/*.rb`: the host requires the part, so a require back is a cycle; the glob leaves classes a part
|
|
660
|
+
names from elsewhere checked), one-off host pairs (`ToolRun` in `tool_response.rb`), the namespace
|
|
661
|
+
autoloads that load whole (`SessionManager`, `Objectives`, `Config`), and `Plugin::Http`'s (its base file
|
|
662
|
+
loads the reopening file only inside a method, and that file requires the base file first). The summary counts the entries that
|
|
663
|
+
matched and those that match nothing: delete a stale one.
|
data/lib/samagotchi/bridge.rb
CHANGED
|
@@ -118,6 +118,11 @@ module Samagotchi
|
|
|
118
118
|
MAX_BODY_BYTES = 1_000_000
|
|
119
119
|
# A request's deadline (see #handle_post_turn) that isn't epoch seconds.
|
|
120
120
|
BAD_DEADLINE = [{ "Allow" => "POST" }, 400, { error: "bad_deadline", detail: "deadline must be epoch seconds" }].freeze
|
|
121
|
+
# A POST /command that names no sender: every sender names itself
|
|
122
|
+
# (ClientId::NONE is never the owner's), so it runs nothing.
|
|
123
|
+
UNNAMED_COMMAND = "a session command must name its sender: send client_id (a web tab's web:<id>, a chi TUI's " \
|
|
124
|
+
"tui:<pid>, chi send's cli:send)"
|
|
125
|
+
UNNAMED_COMMAND_REPLY = [{ "Allow" => "POST" }, 400, { error: "missing_client_id", detail: UNNAMED_COMMAND }].freeze
|
|
121
126
|
# The request header that names the Bridge's secret, lowercased as #read_request keeps it.
|
|
122
127
|
SECRET_HEADER = BridgeSecret::HEADER.downcase
|
|
123
128
|
# Bytes of randomness in a Bridge's secret (hex in bridge.json: twice as many characters).
|
|
@@ -773,12 +778,12 @@ module Samagotchi
|
|
|
773
778
|
# Stop's last_turn carry the turn's enqueued_id (ReplyWait.own_turn).
|
|
774
779
|
# unqueue: POST turn/dequeue (#handle_dequeue_turn) takes a queued
|
|
775
780
|
# message back before it runs.
|
|
776
|
-
# review_turns: a participant's turn runs as its own, inside
|
|
777
|
-
# boundary
|
|
778
|
-
#
|
|
779
|
-
# pair_turns: a participant's turn
|
|
780
|
-
#
|
|
781
|
-
#
|
|
781
|
+
# review_turns: a participant's turn runs as its own, inside a
|
|
782
|
+
# boundary; kept for an older chi web, which sends no participant's turn
|
|
783
|
+
# to a worker without it (Delivery::REVIEW_FEATURE).
|
|
784
|
+
# pair_turns: a participant's turn runs under the owner's guardrails
|
|
785
|
+
# (Guardrails::PairBoundary); chi web sends no participant's turn to a
|
|
786
|
+
# worker without it, nor invites anyone to its session (Delivery::PAIR_FEATURE).
|
|
782
787
|
# participant_steer: a participant's message sent while their own turn
|
|
783
788
|
# runs goes in at its next step (a worker without it queues it); only
|
|
784
789
|
# what the page's delivery line and chi web's ack say depends on it
|
|
@@ -791,11 +796,14 @@ module Samagotchi
|
|
|
791
796
|
# to pass one on (ReviseAnchor::PARTICIPANT_FEATURE).
|
|
792
797
|
# activity: GET /activity answers with Worker#activity_snapshot, so
|
|
793
798
|
# `chi schedule tick` can ask a live worker what it is busy with.
|
|
799
|
+
# participant_client_id: it reads a participant's client id as
|
|
800
|
+
# participant:<id>; chi web sends a worker without it review:<id>
|
|
801
|
+
# (Delivery::PARTICIPANT_ID_FEATURE).
|
|
794
802
|
FEATURES = ["restart", "task_stop", "reparent", Delivery::QUEUE_FEATURE, ReplyWait::TURN_IDS_FEATURE,
|
|
795
803
|
VerifyAnchor::FEATURE, ReviseAnchor::FEATURE,
|
|
796
804
|
SessionInbox::UNQUEUE_FEATURE, Delivery::REVIEW_FEATURE, Delivery::PAIR_FEATURE, TurnDrawings::FEATURE,
|
|
797
805
|
WorkerLink::ACTIVITY_FEATURE, ObjectivesTrack::FEATURE, Delivery::OWN_TURN_STEER_FEATURE,
|
|
798
|
-
Delivery::CANCEL_TURN_ID_FEATURE, ReviseAnchor::PARTICIPANT_FEATURE].freeze
|
|
806
|
+
Delivery::CANCEL_TURN_ID_FEATURE, ReviseAnchor::PARTICIPANT_FEATURE, Delivery::PARTICIPANT_ID_FEATURE].freeze
|
|
799
807
|
|
|
800
808
|
# The routes, by method and what follows /session/:id/: a handler takes
|
|
801
809
|
# the session id and the request body and returns [headers, status, body].
|
|
@@ -1073,11 +1081,20 @@ module Samagotchi
|
|
|
1073
1081
|
return [{ "Allow" => "POST" }, 400, { error: "unknown_command", detail: detail }]
|
|
1074
1082
|
end
|
|
1075
1083
|
|
|
1084
|
+
client_id = fetched(parsed, "client_id")
|
|
1085
|
+
return UNNAMED_COMMAND_REPLY if client_id.to_s.strip.empty?
|
|
1086
|
+
|
|
1087
|
+
# Only the owner's senders and chi answer's (CommandIntake.allowed?),
|
|
1088
|
+
# as for a command sent as a message.
|
|
1089
|
+
unless CommandIntake.allowed?(client_id)
|
|
1090
|
+
Log.warn(:bridge, "command_refused", client_id: client_id)
|
|
1091
|
+
return [{}, 403, { error: CommandIntake::REFUSED_ERROR, detail: CommandIntake.refusal(line) }]
|
|
1092
|
+
end
|
|
1093
|
+
|
|
1076
1094
|
deadline = fetched(parsed, "deadline")
|
|
1077
1095
|
return BAD_DEADLINE unless deadline_valid?(deadline)
|
|
1078
1096
|
|
|
1079
|
-
queue_command_request(session_id, line, client_id: fetched(parsed, "
|
|
1080
|
-
card: fetched(parsed, "card") == true)
|
|
1097
|
+
queue_command_request(session_id, line, client_id: client_id, deadline: deadline, card: fetched(parsed, "card") == true)
|
|
1081
1098
|
end
|
|
1082
1099
|
|
|
1083
1100
|
# Queues +line+ (a session command) for the worker and announces its
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coordinator
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.9.0
|
|
4
4
|
scope: system
|
|
5
|
-
description: "Coordinate parallel work: the coordinator skill (split the work, one worktree and child session per task, check each report, merges under a guardrail approval (the git-merge rule) or a question, a handoff memory to resume from), /coordinate <goal>, /coordinate resume, /coordinate end
|
|
5
|
+
description: "Coordinate parallel work: the coordinator skill (split the work, one worktree and child session per task, check each report, merges under a guardrail approval (the git-merge rule) or a question, a handoff memory to resume from), /coordinate <goal>, /coordinate resume, /coordinate end and /children; the coordinator toolkit (lean + delegate, delegate_result, list_sessions, objectives) and the coding toolkit for build children (child + be concise)"
|
|
6
6
|
trust_level: reviewed
|
|
7
7
|
files:
|
|
8
8
|
skill_coordinator.md:
|
|
9
|
-
sha256: sha256:
|
|
9
|
+
sha256: sha256:21a56711f4ac1252ff6012a6ed0a743cb90732939abed406a9b8753a755c8d0c
|
|
10
10
|
description: "Coordinate parallel work: split it, delegate each task wait:false in its own worktree (cwd:), check each report, merge under the git-merge approval or ask the user; resume from a handoff_* memory"
|
|
11
11
|
plugin:
|
|
12
12
|
file: plugin.rb
|
|
13
|
-
sha256: sha256:
|
|
13
|
+
sha256: sha256:406b9827485535a8be17d4f1b291997ebf5c3f7d5616d20812c53b4ea153f601
|
|
14
14
|
# the coordinator toolkit needs chi.toolkit and ctx.use_toolkit (0.66.0); the
|
|
15
15
|
# coding toolkit (chi.toolkit prompt:) and the skill's delegate toolkit: need
|
|
16
16
|
# the next chi.
|
|
17
17
|
requires_chi: ">= 0.107.0"
|
|
18
|
-
# /coordinate review uses ctx.sessions.review (the next chi).
|
|
19
18
|
# No requires_chi_next for guardrails/merge.yml: its keys are long supported, and first-ever too-new rules would make a
|
|
20
19
|
# live older worker deny every call. A chi without `chi guardrails rule` gives a usage error, and the skill then asks.
|
|
21
20
|
# Nor for the objectives tool in the kit and the skill: on an older chi the kit's add names nothing (it declares only what
|
|
@@ -27,14 +27,6 @@
|
|
|
27
27
|
# (/coordinate resume <name>); none: says so. It reads the project's
|
|
28
28
|
# memories folder, nothing else.
|
|
29
29
|
#
|
|
30
|
-
# /coordinate review [handoff] (experimental) opens a sprint review: a review
|
|
31
|
-
# session of this one (ctx.sessions.review: its recap, never its transcript;
|
|
32
|
-
# this session keeps running), seeded with the open handoff's body (the one
|
|
33
|
-
# named, the only one open, or a card with a Review action each when several
|
|
34
|
-
# are), for participants (chi share): its model answers their new context
|
|
35
|
-
# with a hand-off diff and the owner applies it (the skill's Sprint review).
|
|
36
|
-
# With none open it starts from the recap alone and says so.
|
|
37
|
-
#
|
|
38
30
|
# /coordinate end ends the day: the model is asked to follow the skill's End
|
|
39
31
|
# of day (bring its handoff up to date, keep it OPEN unless all is done, give
|
|
40
32
|
# a short report). It reads nothing itself; "end" with more words is a goal.
|
|
@@ -64,21 +56,9 @@ class Plugin
|
|
|
64
56
|
TEXT_CHARS = 80
|
|
65
57
|
USAGE = "usage: /children [all] | /children stop <id>"
|
|
66
58
|
COORDINATE_USAGE = "usage: /coordinate <goal> — chi splits it into tasks, one child session and worktree each; " \
|
|
67
|
-
"/coordinate resume [name] — pick up an open handoff; /coordinate end — save the handoff, end-of-day report
|
|
68
|
-
"/coordinate review [name] — a sprint review session to share (experimental)"
|
|
59
|
+
"/coordinate resume [name] — pick up an open handoff; /coordinate end — save the handoff, end-of-day report"
|
|
69
60
|
RESUME_CARD_ID = "coordinate-resume"
|
|
70
|
-
|
|
71
|
-
# The seed's note: what to do (the skill's Sprint review section, copied:
|
|
72
|
-
# a participant's turn may read project memories only, and the skill is
|
|
73
|
-
# where its bundle was installed, usually system) and the handoff's body.
|
|
74
|
-
REVIEW_SEED = "This is a sprint review of the coordinator session %<source>s (experimental). The " \
|
|
75
|
-
"skill_coordinator memory's Sprint review section, which you follow here:"
|
|
76
|
-
SKILL = "skill_coordinator"
|
|
77
|
-
SPRINT_REVIEW_HEADING = /^## Sprint review\b.*$/
|
|
78
|
-
# The section's gist when the skill's file can't be read.
|
|
79
|
-
SPRINT_REVIEW_FALLBACK = "A participant's turn may only read. Answer new context with a hand-off diff (the " \
|
|
80
|
-
"handoff's lines as they would change, in a diff block) and what it means per branch. When " \
|
|
81
|
-
"the owner applies it, update the handoff and re-plan in words; start, stop or merge nothing here."
|
|
61
|
+
REVIEW_GONE = "/coordinate review is gone (coordinator 0.9.0): chi has no review sessions; invite someone with chi share"
|
|
82
62
|
# A card takes 6 actions.
|
|
83
63
|
MAX_RESUMES = 6
|
|
84
64
|
HANDOFF_LINE = /^- \*\*(handoff_[^*\s]+)\*\*(.*)$/
|
|
@@ -98,8 +78,7 @@ class Plugin
|
|
|
98
78
|
children_command(args.to_s.strip, ctx)
|
|
99
79
|
end
|
|
100
80
|
chi.command "/coordinate", "run work in parallel: chi splits <goal> into tasks, each in a child session and worktree; " \
|
|
101
|
-
"resume: pick up an open handoff; end: save the handoff, end-of-day report
|
|
102
|
-
"review: a sprint review session to share (experimental)",
|
|
81
|
+
"resume: pick up an open handoff; end: save the handoff, end-of-day report",
|
|
103
82
|
anytime: true do |args, ctx|
|
|
104
83
|
coordinate(args.to_s.strip, ctx)
|
|
105
84
|
end
|
|
@@ -163,8 +142,9 @@ class Plugin
|
|
|
163
142
|
verb, rest = goal.split(/\s+/, 2)
|
|
164
143
|
# "resume" and at most a name; "resume the old work" is a goal.
|
|
165
144
|
return resume(rest.to_s.strip, ctx) if verb == "resume" && !rest.to_s.strip.match?(/\s/)
|
|
166
|
-
# "review" and at most a name
|
|
167
|
-
|
|
145
|
+
# "review" and at most a name (an old card's action, a habit): gone, said
|
|
146
|
+
# once rather than run as a goal; "review the specs" is a goal.
|
|
147
|
+
return REVIEW_GONE if verb == "review" && !rest.to_s.strip.match?(/\s/)
|
|
168
148
|
# A bare "end" only; "end the flaky specs" is a goal.
|
|
169
149
|
return end_of_day(ctx) if verb == "end" && rest.to_s.strip.empty?
|
|
170
150
|
|
|
@@ -198,59 +178,6 @@ class Plugin
|
|
|
198
178
|
"asked chi to end the day; a running turn gets it at its next step")
|
|
199
179
|
end
|
|
200
180
|
|
|
201
|
-
# /coordinate review [name]
|
|
202
|
-
def review(name, ctx)
|
|
203
|
-
open = open_handoffs(ctx)
|
|
204
|
-
if name.empty?
|
|
205
|
-
return handoff_card(open, ctx, verb: "review", id: REVIEW_CARD_ID) if open.size > 1
|
|
206
|
-
|
|
207
|
-
name = open.first&.dig(:name)
|
|
208
|
-
else
|
|
209
|
-
name = "handoff_#{name}" unless name.start_with?("handoff_")
|
|
210
|
-
unless open.any? { |handoff| handoff[:name] == name }
|
|
211
|
-
return "/coordinate review: no open handoff #{name} in this project (#{open.empty? ? "none is open" : "open: #{open.map { |h| h[:name] }.join(", ")}"})"
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
|
-
start_review(name, ctx)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def start_review(name, ctx)
|
|
218
|
-
seed = "#{format(REVIEW_SEED, source: ctx.session_id.to_s[0, 8])}\n\n#{sprint_review_section(ctx)}"
|
|
219
|
-
seed += "\n\nThe coordinator's handoff #{name} as of now (memory_read it, scope: project, for the latest):\n\n#{handoff_body(name, ctx)}" if name
|
|
220
|
-
id = ctx.sessions.review(seed: seed)
|
|
221
|
-
short = id.to_s[0, 8]
|
|
222
|
-
["sprint review #{short} started from this session (experimental), #{name ? "seeded with #{name}" : "from its recap alone: no open handoff"}; " \
|
|
223
|
-
"this session keeps running.",
|
|
224
|
-
"invite someone: chi share #{short} --name NAME (or the participants chip on its page); their new context comes " \
|
|
225
|
-
"back as a hand-off diff; Apply under it (on its page) puts the change in your composer there."].join("\n")
|
|
226
|
-
rescue Samagotchi::Plugin::Sessions::Error => e
|
|
227
|
-
"/coordinate review: #{e.message}"
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
# The skill's Sprint review section as installed (system scope, else the
|
|
231
|
-
# project's), heading to the next heading; the fallback without one.
|
|
232
|
-
def sprint_review_section(ctx)
|
|
233
|
-
%w[system project].each do |scope|
|
|
234
|
-
file = File.join(Samagotchi::MemoryPaths.scope_dir(scope, cwd: ctx.cwd).to_s, "#{SKILL}.md")
|
|
235
|
-
next unless File.file?(file)
|
|
236
|
-
|
|
237
|
-
text = File.read(file, encoding: "UTF-8")
|
|
238
|
-
start = text.index(SPRINT_REVIEW_HEADING) or next
|
|
239
|
-
rest = text[start..]
|
|
240
|
-
stop = rest.index(/^## /, 1)
|
|
241
|
-
return (stop ? rest[0...stop] : rest).strip
|
|
242
|
-
end
|
|
243
|
-
SPRINT_REVIEW_FALLBACK
|
|
244
|
-
rescue SystemCallError
|
|
245
|
-
SPRINT_REVIEW_FALLBACK
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
def handoff_body(name, ctx)
|
|
249
|
-
File.read(File.join(Samagotchi::MemoryPaths.scope_dir("project", cwd: ctx.cwd).to_s, "#{name}.md"), encoding: "UTF-8").strip
|
|
250
|
-
rescue SystemCallError
|
|
251
|
-
"(its file couldn't be read)"
|
|
252
|
-
end
|
|
253
|
-
|
|
254
181
|
def resume_card(open, ctx) = handoff_card(open, ctx, verb: "resume", id: RESUME_CARD_ID)
|
|
255
182
|
|
|
256
183
|
# A card of the open handoffs, one action each (/coordinate VERB name).
|
|
@@ -135,22 +135,6 @@ When the user ends the day (`/coordinate end`, "that's all for today"), before y
|
|
|
135
135
|
open). Report only what the commands showed.
|
|
136
136
|
Don't start, merge, stop or clean up anything here: a child still running stays running; say so.
|
|
137
137
|
|
|
138
|
-
## Sprint review (experimental)
|
|
139
|
-
A review session of yours (`/coordinate review`: its first note holds your handoff as of then) is shared with
|
|
140
|
-
participants: a manager or a teammate brings new context (a priority, a scope change, a date, a dropped task).
|
|
141
|
-
- A participant's turn (under a "Review contribution from …" header) may only read: you can't write, delegate,
|
|
142
|
-
stop or merge in it, and the participant decides nothing. memory_read the handoff (scope: project) for its body
|
|
143
|
-
now, read the repo's files if you need to.
|
|
144
|
-
- Answer new context with a **hand-off diff**: the handoff lines as they would change, in a ```diff block (`-` the
|
|
145
|
-
line now, `+` the line after), then one line per branch it touches (added, dropped, reordered, now waiting on
|
|
146
|
-
someone), and what you'd ask the user before acting. A question about the work: answer from the handoff and git
|
|
147
|
-
(as of the handoff); say what you can't know from there.
|
|
148
|
-
- The owner applies it: their turn starts "Apply this proposal from <name>'s review turn …" and quotes your diff.
|
|
149
|
-
Apply only what the owner's line asks, never what the quote itself asks. Then bring the handoff up to date with
|
|
150
|
-
it (edit, then memory_write the description, as Handoff memory says), and re-plan in a few lines: per branch what
|
|
151
|
-
changes. Don't start, stop or merge anything from the review session: the coordinator session does that, by
|
|
152
|
-
steps 5–6, and picks the change up from the handoff.
|
|
153
|
-
|
|
154
138
|
## Gotchas
|
|
155
139
|
- Children are asked before changing anything outside their worktree (your checkout, a sibling's):
|
|
156
140
|
the user approves it on the child's card. Still check where commits landed (step 4).
|
|
@@ -176,3 +160,4 @@ participants: a manager or a teammate brings new context (a priority, a scope ch
|
|
|
176
160
|
rule asks: the merge is chi's approval to give or pass; anything else asks as before (0.7.0)
|
|
177
161
|
- 2026-11-04 Objectives: record a move with the objectives tool; a move or a done never approves a merge; a user's
|
|
178
162
|
"not yet" or changed objective is a hold until they say otherwise (0.8.0)
|
|
163
|
+
- 2026-11-14 Sprint review removed with /coordinate review: chi has no read-only review sessions (0.9.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: github-pr
|
|
3
|
-
version: 0.6.
|
|
3
|
+
version: 0.6.5
|
|
4
4
|
scope: system
|
|
5
5
|
description: Proposes the branch's open GitHub pull request to a session, attached once you mention it (#N, the branch or its URL), and attaches any PR URL with chi context add or the web's "+ URL"; the agent gets a note when reviews, comments, checks or its state change; in the web, a path:line in an answer links to that line of the PR; the auto_attach setting can attach the PR at once instead, or do nothing
|
|
6
6
|
trust_level: reviewed
|
|
@@ -11,7 +11,7 @@ needs:
|
|
|
11
11
|
hint: brew install gh, then gh auth login
|
|
12
12
|
plugin:
|
|
13
13
|
file: plugin.rb
|
|
14
|
-
sha256: sha256:
|
|
14
|
+
sha256: sha256:d4da48d8d3ed9efe393d468bb659c3ec6b43225a20efa06fa9ee6482eaaf0791
|
|
15
15
|
scripts:
|
|
16
16
|
pr_context.rb: sha256:a883d2780e89c68c0d7b6d5e0fcb22c273f17bb167e79064e0e99db6bd2ee6f0
|
|
17
17
|
context_providers:
|
|
@@ -96,7 +96,6 @@ class Plugin
|
|
|
96
96
|
mode = auto_attach_mode(ctx)
|
|
97
97
|
return "auto_attach: off" if mode == :off
|
|
98
98
|
return "skipped: a delegate child" if mode == :attach && ctx.delegate?
|
|
99
|
-
return "skipped: a review session" if mode == :propose && ctx.review?
|
|
100
99
|
|
|
101
100
|
branch = run(ctx, "git", "branch", "--show-current").to_s.strip
|
|
102
101
|
return "not on a branch" if branch.empty?
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: inline-widgets
|
|
3
|
-
version: 0.1.
|
|
3
|
+
version: 0.1.2
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Teaches the model the chi-ui blocks chi web draws: picks (rows of options that fill your reply) and walk (a scenario stepped through)"
|
|
6
6
|
trust_level: reviewed
|
|
7
7
|
plugin:
|
|
8
8
|
file: plugin.rb
|
|
9
|
-
sha256: sha256:
|
|
9
|
+
sha256: sha256:b68599ba9e61004b8090ec0d317f6b4a5ba0042ca54a9b35fbe1a39539e1f03f
|
|
10
10
|
# chi.prompt_section is 0.132.0's; the web draws chi-ui blocks only from the next release
|
|
11
11
|
requires_chi: ">= 0.155.0"
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
# The text is eval 0013's round-2 hint, split in two. It is static, so the
|
|
11
11
|
# prompt cache keeps: same text at every build. A delegate child's answer is
|
|
12
12
|
# read by its parent, not drawn for a user, a one-shot (-p --non-interactive)
|
|
13
|
-
# prints to a terminal
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# and a participant invited later mustn't change the prompt (the cache).
|
|
13
|
+
# prints to a terminal: neither gets a section. A session with participants
|
|
14
|
+
# keeps them: its pages draw them, and a participant invited later mustn't
|
|
15
|
+
# change the prompt (the cache).
|
|
17
16
|
class Plugin
|
|
18
17
|
PICKS = <<~TEXT
|
|
19
18
|
The web UI draws fenced ```chi-ui code blocks (YAML inside) as interactive widgets; the terminal shows their source. Use one whenever it helps the user more than prose: a widget replaces the long explanation, it doesn't sit beside one. Never use one for what markdown shows well (tables, lists, key-value). At most one widget per answer; keep the prose around it to a few sentences and don't repeat the widget's content.
|
|
@@ -76,5 +75,5 @@ class Plugin
|
|
|
76
75
|
|
|
77
76
|
# Whether the session's answers reach a web page that draws them. Decided by
|
|
78
77
|
# the session's kind, so the same at every build.
|
|
79
|
-
def drawn?(ctx) = ctx.frontend != :one_shot && !ctx.delegate?
|
|
78
|
+
def drawn?(ctx) = ctx.frontend != :one_shot && !ctx.delegate?
|
|
80
79
|
end
|