samagotchi 0.142.0 → 0.144.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 +112 -7
- data/README.md +1 -0
- data/docs/architecture.md +13 -6
- data/docs/bundle-authoring.md +7 -7
- data/docs/bundles.md +1232 -0
- data/docs/cli.md +56 -9
- data/docs/configuration.md +11 -12
- data/docs/context.md +10 -10
- data/docs/guardrails.md +13 -12
- data/docs/hooks.md +24 -3
- data/docs/internals/attached-context.md +2 -3
- data/docs/internals/bridge.md +2 -1
- data/docs/internals/bundles.md +5 -3
- data/docs/internals/engine.md +10 -4
- data/docs/internals/prompt-caching.md +12 -12
- data/docs/internals/web-frontend.md +38 -1
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +2 -2
- data/docs/plugins.md +29 -1252
- data/docs/releasing.md +3 -2
- data/docs/sessions.md +2 -2
- data/docs/sub-agent.md +6 -6
- data/docs/system-one.md +2 -2
- data/docs/testing.md +1 -1
- data/lib/samagotchi/bridge/sse_writer.rb +11 -1
- data/lib/samagotchi/bundle_command/api_calls.rb +132 -0
- data/lib/samagotchi/bundle_command/check.rb +63 -36
- data/lib/samagotchi/bundle_command/installed_check.rb +86 -0
- data/lib/samagotchi/bundle_command/scaffold.rb +1 -0
- data/lib/samagotchi/bundle_settings_check.rb +91 -0
- data/lib/samagotchi/bundles/agents-md/manifest.yml +4 -2
- data/lib/samagotchi/bundles/agents-md/plugin.rb +1 -1
- data/lib/samagotchi/bundles/btw/manifest.yml +4 -2
- data/lib/samagotchi/bundles/btw/plugin.rb +1 -1
- data/lib/samagotchi/bundles/check-in/manifest.yml +7 -6
- data/lib/samagotchi/bundles/check-in/plugin.rb +19 -19
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +3 -3
- data/lib/samagotchi/bundles/claude-peer/plugin.rb +1 -1
- data/lib/samagotchi/bundles/claude-peer/scripts/pair +1 -1
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +2 -2
- data/lib/samagotchi/bundles/codex-peer/plugin.rb +1 -1
- data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
- data/lib/samagotchi/bundles/coordinator/plugin.rb +1 -1
- data/lib/samagotchi/bundles/core/manifest.yml +2 -2
- data/lib/samagotchi/bundles/cost-cap/manifest.yml +6 -3
- data/lib/samagotchi/bundles/cost-cap/plugin.rb +8 -7
- data/lib/samagotchi/bundles/github-pr/manifest.yml +4 -2
- data/lib/samagotchi/bundles/github-pr/plugin.rb +4 -2
- data/lib/samagotchi/bundles/known-names/manifest.yml +3 -1
- data/lib/samagotchi/bundles/loop-guard/manifest.yml +4 -2
- data/lib/samagotchi/bundles/loop-guard/plugin.rb +1 -1
- data/lib/samagotchi/bundles/mcp/manifest.yml +4 -2
- data/lib/samagotchi/bundles/mcp/plugin.rb +2 -2
- data/lib/samagotchi/bundles/ruby/manifest.yml +2 -2
- data/lib/samagotchi/bundles/ruby/plugin.rb +1 -1
- data/lib/samagotchi/bundles/skills/manifest.yml +4 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +1 -1
- data/lib/samagotchi/bundles/slow-commands/manifest.yml +4 -2
- data/lib/samagotchi/bundles/slow-commands/plugin.rb +1 -1
- data/lib/samagotchi/bundles/source-links/hooks/source_links.rb +4 -2
- data/lib/samagotchi/bundles/source-links/manifest.yml +4 -2
- data/lib/samagotchi/bundles/system/config_modification_protocol.md +1 -1
- data/lib/samagotchi/bundles/system/manifest.yml +3 -3
- data/lib/samagotchi/bundles/system/self_map.md +2 -2
- data/lib/samagotchi/bundles/work-cap/manifest.yml +6 -3
- data/lib/samagotchi/bundles/work-cap/plugin.rb +27 -20
- data/lib/samagotchi/context_candidate_choice.rb +12 -3
- data/lib/samagotchi/context_candidates.rb +4 -1
- data/lib/samagotchi/context_candidates_log.rb +11 -0
- data/lib/samagotchi/context_status.rb +2 -3
- data/lib/samagotchi/engine.rb +45 -70
- data/lib/samagotchi/extension_load.rb +8 -2
- data/lib/samagotchi/hook_routes.rb +37 -2
- data/lib/samagotchi/hooks/bundle_loader.rb +20 -4
- data/lib/samagotchi/hooks/registry.rb +23 -5
- data/lib/samagotchi/host_model.rb +3 -3
- data/lib/samagotchi/host_registry.rb +14 -7
- data/lib/samagotchi/kernel_loop.rb +14 -2
- data/lib/samagotchi/live_versions.rb +28 -2
- data/lib/samagotchi/llm/chat_loop.rb +10 -0
- data/lib/samagotchi/llm/stray_tool_call.rb +23 -16
- data/lib/samagotchi/llm/utf8_scrub.rb +5 -3
- data/lib/samagotchi/memory_bundle/builder.rb +4 -2
- data/lib/samagotchi/memory_bundle/installed_bundle.rb +9 -2
- data/lib/samagotchi/memory_bundle/installed_copy.rb +92 -0
- data/lib/samagotchi/memory_bundle/installer.rb +2 -0
- data/lib/samagotchi/memory_bundle/manifest.rb +23 -13
- data/lib/samagotchi/memory_bundle/provenance.rb +4 -1
- data/lib/samagotchi/memory_bundle/shipped_update.rb +13 -1
- data/lib/samagotchi/model_catalog.rb +3 -2
- data/lib/samagotchi/models_command.rb +1 -1
- data/lib/samagotchi/plugin/api.rb +14 -11
- data/lib/samagotchi/plugin/context.rb +11 -0
- data/lib/samagotchi/plugin/loader.rb +4 -2
- data/lib/samagotchi/plugin/peer.rb +17 -22
- data/lib/samagotchi/plugin_session_state.rb +35 -5
- data/lib/samagotchi/prompt_warmup.rb +1 -9
- data/lib/samagotchi/self_report.rb +15 -13
- data/lib/samagotchi/session_access/local.rb +8 -11
- data/lib/samagotchi/session_access/remote.rb +3 -3
- data/lib/samagotchi/session_archive_command.rb +3 -3
- data/lib/samagotchi/session_commands.rb +6 -5
- data/lib/samagotchi/session_config.rb +9 -3
- data/lib/samagotchi/session_continue.rb +1 -1
- data/lib/samagotchi/session_manager.rb +15 -6
- data/lib/samagotchi/system_one/answer.rb +8 -5
- data/lib/samagotchi/system_one/client.rb +17 -0
- data/lib/samagotchi/system_one/http_backend.rb +23 -10
- data/lib/samagotchi/system_one/judgments.rb +8 -25
- data/lib/samagotchi/system_one/log.rb +21 -0
- data/lib/samagotchi/system_one/recording.rb +1 -1
- data/lib/samagotchi/terminal_ui/attach_link.rb +2 -2
- data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop.rb +1 -1
- data/lib/samagotchi/terminal_ui/local_link.rb +1 -1
- data/lib/samagotchi/terminal_ui/remote_link.rb +1 -2
- data/lib/samagotchi/testing/boundary.rb +76 -0
- data/lib/samagotchi/testing/env_not_shown.rb +17 -0
- data/lib/samagotchi/testing/judgments.rb +0 -9
- data/lib/samagotchi/testing.rb +1 -0
- data/lib/samagotchi/update_command.rb +57 -23
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +1 -0
- data/lib/samagotchi/web/auto_update.rb +79 -49
- data/lib/samagotchi/web/auto_update_record.rb +59 -0
- data/lib/samagotchi/web/public/annotate_bar.js +1 -1
- data/lib/samagotchi/web/public/app.js +17 -5
- data/lib/samagotchi/web/public/chip_popover.js +14 -4
- data/lib/samagotchi/web/public/copy.js +1 -1
- data/lib/samagotchi/web/public/hash_intent.js +24 -0
- data/lib/samagotchi/web/public/index.html +74 -35
- data/lib/samagotchi/web/public/more_sheet.js +212 -0
- data/lib/samagotchi/web/public/ref_scan.js +4 -2
- data/lib/samagotchi/web/public/revise_stack.js +14 -5
- data/lib/samagotchi/web/public/stage_frame.js +39 -6
- data/lib/samagotchi/web/public/stage_view.js +17 -0
- data/lib/samagotchi/web/public/turn_block.js +43 -9
- data/lib/samagotchi/web/session_control.rb +3 -3
- data/lib/samagotchi/web/update_check.rb +7 -6
- data/lib/samagotchi/web/update_ops.rb +80 -25
- data/lib/samagotchi/worker.rb +21 -4
- metadata +10 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e6a9b3aacbab7f8ce2c03c1bf67ba3b37ba647db975b340b6e146ee544de0d4
|
|
4
|
+
data.tar.gz: 65346bf0d90d4355f7d47e7760d952624cd13b02f2e324ec834649c4a2e12e1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 536a9cc745170f15f8b52806bc91fa53fc5faa5e0864aa783d8508142ece75626f589fc62974a0883df922671a1543f02cd5c0c8e16d094fd8e8fb3ce94bdd56
|
|
7
|
+
data.tar.gz: '06086d99f2b967fff766b9b29dbaae5792450276ef655f3822c58d6d1c844f84cb77737c99ef0b1eeec0ea80316533900d491624450379f9b2100b8f01d39584'
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,109 @@ and commands may change between minor versions. How releases are made:
|
|
|
7
7
|
[docs/releasing.md](docs/releasing.md).
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.144.0] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `chi update`'s re-check of the bundles chi doesn't ship warns about a reference to chi's internals only when this chi
|
|
15
|
+
no longer has it: the constant doesn't resolve, or the method the name gives isn't there. The row reads
|
|
16
|
+
`warn boundary plugin.rb: Samagotchi::OldInternal::Thing is gone from this chi, so this bundle may fail`; a name that
|
|
17
|
+
still works (`Samagotchi::Log`) gets no row, so the table stops repeating warnings about bundles that load fine.
|
|
18
|
+
`chi bundle check` (the author's own run) stays strict.
|
|
19
|
+
- The web's session bar on a phone no longer swipes: id, status, model and ⚙ stay on the row, and ⋯ opens a bottom sheet with the
|
|
20
|
+
rest (toolkit, working set, participants, chain links, delegates, the telemetry, Continue, Archive, Stop, Delete). A dot on ⋯ says
|
|
21
|
+
when something there needs a look. See [docs/cli.md](docs/cli.md#the-session-bar-on-a-phone).
|
|
22
|
+
- chi web uses much less CPU during a turn: about a fifth of a core less on a Mac Studio while a question waits or the model
|
|
23
|
+
is silent, and less while text streams. The stage's dot and running tick are now a slow opacity blink instead of a pulsing
|
|
24
|
+
ring, the spinners turn in small steps, and while a question or an approval blocks the turn they stand still, so movement
|
|
25
|
+
means chi is working. An in-turn card like check-in's keeps its dot blinking, as that turn goes on.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- An event with bytes JSON can't take (a plugin's card, say) no longer ends every stream that reaches it: it goes out scrubbed.
|
|
30
|
+
- A waiting approval on the web page opens at its question and command, on a phone and on a desktop, when it arrives and when the page
|
|
31
|
+
loads on it. A card too tall for the stage showed its options with what it asks scrolled out of sight; the options are now a scroll
|
|
32
|
+
down the stage's one scroll.
|
|
33
|
+
- `chi update` tells you a `chi web` started with `--port` runs old code; it only looked on `web.port`.
|
|
34
|
+
- `chi self` finds a `chi web` started with `--port`; it said `not running on port N` for `web.port`.
|
|
35
|
+
- `/guardrails` in chi web or an attached terminal shows all of its listing: a command's reply was cut at 4 KB, so with the core
|
|
36
|
+
bundle's rules System 1's section never showed and the text stopped mid-word. A reply now goes up to 64 KB, and a longer one ends
|
|
37
|
+
with a line saying it was cut.
|
|
38
|
+
- A `!` command that prints bytes that aren't valid UTF-8 no longer breaks the session's page and attached terminals: its output
|
|
39
|
+
stopped every stream that reached it, on each reconnect. The bad bytes show as `?`, as they do in the saved conversation.
|
|
40
|
+
- `/guardrails` no longer shows `System 1 (on):` when the settings mean nothing can be judged: it reads
|
|
41
|
+
`System 1 (on, but nothing is judged: system_one.host is not set):`, and likewise for a host that isn't in `hosts:`,
|
|
42
|
+
isn't `api: openai` or names no model.
|
|
43
|
+
- A `bundles:` entry in config.yml for a bundle that isn't installed (or a key it doesn't take) warns once, not in every new session,
|
|
44
|
+
respawn and delegate; a changed finding warns again, as does one fixed and then back.
|
|
45
|
+
- An answer with a line that opens and closes backticks itself (```` ```foo``` first ````) no longer loses every link after it: the source-links
|
|
46
|
+
and github-pr bundles and the web's file refs read it as inline code, not as a code block left open.
|
|
47
|
+
- A session whose cost-cap, work-cap or check-in saved nothing no longer leaves an empty folder under `plugins/<bundle>/sessions/`.
|
|
48
|
+
`ctx.session_dir(create: false)` is the path with no folder made, for a bundle that only reads. `chi update` gets them
|
|
49
|
+
(cost-cap 0.2.5, work-cap 0.1.5, check-in 0.3.3).
|
|
50
|
+
- A Stop that arrives on an empty reply ends the turn cancelled. It used to end
|
|
51
|
+
as "no answer: the model returned nothing".
|
|
52
|
+
|
|
53
|
+
Update with `chi update` (the core profile 0.4.3): check-in 0.3.3, cost-cap 0.2.5 and work-cap 0.1.5 (these three need this chi), github-pr 0.6.2 and source-links 0.6.2.
|
|
54
|
+
|
|
55
|
+
## [0.143.0] - 2026-11-01
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- `chi update` checks the bundles chi doesn't ship, such as one from GitHub, against the new chi, and adds a row for each warning or error: a `requires_chi` it fails, a plugin or
|
|
60
|
+
hook that no longer loads, a `ctx` call the API lacks, a reference to chi's internals. It never changes them, and these rows don't fail the update (`--json`: a new `level` field). `--no-bundles` skips
|
|
61
|
+
it, and `--dry-run` with a newer gem to install says `not checked`, as only that chi could answer. See [docs/cli.md](docs/cli.md#updating).
|
|
62
|
+
- `chi bundle check` warns (`api`) on a `ctx.*` or `chi.*` call, or a keyword, that this chi's API lacks, at its line:
|
|
63
|
+
`ctx.settingz`, `ctx.sessions.nope`, `ctx.card(titel:)`. It reads the plugin's source, so a path no test runs counts too.
|
|
64
|
+
- `ctx.session_dir`: a session's own folder for a bundle, created on use, removed with the session, so a bundle no longer
|
|
65
|
+
builds that path itself. cost-cap, work-cap and check-in now keep their state there (`state.json`); a running session's
|
|
66
|
+
file moves in by itself. `chi update` gets them (cost-cap 0.2.4, work-cap 0.1.4, check-in 0.3.1).
|
|
67
|
+
- A manifest may list `settings:`, the keys config.yml's `bundles: <name>:` takes, with `session_settings:`' types. A key it rules out warns
|
|
68
|
+
when a session starts, in every UI, and so does a `bundles:` name no installed bundle has. Only a warning: the session goes on.
|
|
69
|
+
The shipped bundles with settings list theirs (`chi update`).
|
|
70
|
+
- A plugin's `chi.on` handler that raises now tells you, once per event in a worker, in the TUI and the web
|
|
71
|
+
(`plugins> plugin.rb (bundle x) before_turn hook failed (…)`). Before, only the log knew. The hook is still skipped, and the log
|
|
72
|
+
still has each failure.
|
|
73
|
+
- A bundle's `hooks/*.rb` file that raises now tells you the same way, once per hook in a worker, whatever its `on_error` —
|
|
74
|
+
including the default `skip`, which logged nothing at all. A guard bundle that broke (`chi-nah`, say) used to fail quietly;
|
|
75
|
+
now `plugins> guard.rb (bundle chi-nah) before_tool_call hook failed (…)` says so. `on_error` still decides logging and
|
|
76
|
+
the deny; the notice is only added, and config.yml's own hooks are unchanged.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- With System 1 on the model's own local server, its asks now run during your turn as on any other host: toolkit suggestions (audit, the
|
|
81
|
+
deferred switch and the worker's warm-up, all skipped there before), context candidates (held to the turn's end before) and bundles' judgments (skipped before).
|
|
82
|
+
Measured on Splash, they don't push out the session's cached prompt. Each costs the running generation about 0.15 s.
|
|
83
|
+
|
|
84
|
+
### Removed
|
|
85
|
+
|
|
86
|
+
- `shared_host:` on `chi.judgment`, the `:shared_host` reason, and `shared_host_busy` in the bundle test kit: a bundle still passing `shared_host:` fails to load, with an
|
|
87
|
+
`ArgumentError`. check-in 0.3.1 no longer passes it, so run `chi update`.
|
|
88
|
+
|
|
89
|
+
### Fixed
|
|
90
|
+
|
|
91
|
+
- `chi sessions delete` now also drops the session's lines from `context_candidates.jsonl` (its `judged` lines keep 200
|
|
92
|
+
characters of its prompts), as it already purges that session's System 1 runs.
|
|
93
|
+
- A reply that is only a tool call the host could not read is now caught when the block has nothing inside it
|
|
94
|
+
(`<function=task_list></function>`, `<tool_call>{"name":"x"}</tool_call>`), and its close must be the tag that opened it.
|
|
95
|
+
- A Stop that arrives on a reply that is only a tool call the host could not read ends the turn cancelled. It used to fail
|
|
96
|
+
it with "the reply came back as a ... block the host could not read, twice in a row".
|
|
97
|
+
- With `update.auto: install`, "chi updated to X" counts the sessions the old chi web restarted (it said 0 of them), and a run
|
|
98
|
+
chi web is restarted in the middle of still tries the sessions it had left.
|
|
99
|
+
- With `update.auto: install`, an error in one step (a full disk, a hiccup reading the sessions) no longer stops automatic updates until
|
|
100
|
+
chi web restarts: the step is tried again 5 minutes later.
|
|
101
|
+
- With `update.auto: install` and `update.restart: idle`, sessions that were busy or recently used at the update really are tried again for
|
|
102
|
+
a day, as documented. They used to stay on the old chi once chi web had restarted. The extra tries respect the idle rule, and the page only hears of one that restarts a session.
|
|
103
|
+
- A hung `chi update` run by chi web (the **Update** button, `update.auto: install`) is stopped after 30 minutes and reported as failed. It used to answer "update running" to every later update until chi web restarted.
|
|
104
|
+
- Web: a hash that names no session (`#/`, or none) while one is open now leaves it, as the **+** button does. It used to change
|
|
105
|
+
only the URL: the page kept showing that session, and Send went into it.
|
|
106
|
+
- `chi bundle check`'s `requires-chi-floor` knows the calls and keywords it was missing: `ctx.context.propose`, `candidates`, `withdraw` and
|
|
107
|
+
`left_behind`, `ctx.review?`, `ctx.continues`, `ctx.context.attach(movable:)` and others, so a bundle using them with a lower `requires_chi` is told.
|
|
108
|
+
- `/context attach` and `/context decline`, typed in or from audit or off mode, no longer show a "closed" card when no offer card was open.
|
|
109
|
+
- Web: on a phone, a Revise stub's "superseded by vN" stays readable, so two stubs that open with the same line can be told apart.
|
|
110
|
+
|
|
111
|
+
Update with `chi update` (the core profile 0.4.2): check-in 0.3.1, cost-cap 0.2.4 and work-cap 0.1.4 keep their state in `ctx.session_dir`, and check-in no longer passes `shared_host:` (the older check-in 0.3.0 fails to load on this chi until it is updated). btw, agents-md, claude-peer, codex-peer, coordinator, github-pr, known-names, loop-guard, mcp, ruby, skills, slow-commands and source-links only list their settings or have small fixes.
|
|
112
|
+
|
|
10
113
|
## [0.142.0] - 2026-11-01
|
|
11
114
|
|
|
12
115
|
### Added
|
|
@@ -1011,7 +1114,7 @@ Update with `chi update` (the system bundle 0.118.0), then restart `chi web`.
|
|
|
1011
1114
|
- `/exit` in an attached terminal **asks what to do with what still runs** when only things you can stop keep the
|
|
1012
1115
|
worker up (reminders, a watched background task, a delegate with a live worker): keep running in the background,
|
|
1013
1116
|
stop them and exit, or go back. Anything else that holds the worker (a running turn, queued prompts, another UI)
|
|
1014
|
-
still refuses as before, and a delegate never holds the idle exit. See [cli.md](docs/cli.md#
|
|
1117
|
+
still refuses as before, and a delegate never holds the idle exit. See [cli.md](docs/cli.md#sharing-a-session).
|
|
1015
1118
|
- The web's `stop session` asks the same first: a sheet (a bottom sheet on a phone) counts what still runs and offers
|
|
1016
1119
|
**Stop all**, **Stop session only** (the stop as it was: background tasks and delegates keep running) or
|
|
1017
1120
|
**Cancel**; with nothing to stop it is one tap as before. See [Sessions](docs/sessions.md).
|
|
@@ -1650,7 +1753,7 @@ Update with `chi update`.
|
|
|
1650
1753
|
and active minutes across turns, the bound a session whose step-limit Continue keeps being answered otherwise
|
|
1651
1754
|
lacks. At a cap the turn pauses on Continue / Stop, the question naming the session's totals; `/workcap` shows or
|
|
1652
1755
|
sets it, `chi send --new --set work-cap.tool_calls=400` caps a child. Inert until a cap is set. See
|
|
1653
|
-
[docs/
|
|
1756
|
+
[docs/bundles.md](docs/bundles.md#the-work-cap-bundle).
|
|
1654
1757
|
|
|
1655
1758
|
### Fixed
|
|
1656
1759
|
|
|
@@ -1786,7 +1889,7 @@ Update with `chi update` (the system bundle 0.95.0), then restart `chi web`.
|
|
|
1786
1889
|
- The `model-notes` bundle (0.1.0, in the `dev` profile, now 0.7.0): reviewed model notes, for now
|
|
1787
1890
|
`model_notes_deepseek` for DeepSeek V4 / V4.1 (`models: *deepseek-v4*`). A same-name note you already have is
|
|
1788
1891
|
skipped and keeps loading; to take the bundle's, remove yours and install again. See
|
|
1789
|
-
[docs/
|
|
1892
|
+
[docs/bundles.md](docs/bundles.md#the-model-notes-bundle).
|
|
1790
1893
|
|
|
1791
1894
|
### Changed
|
|
1792
1895
|
|
|
@@ -3610,7 +3713,7 @@ Update with `chi update` (mcp 0.6.1).
|
|
|
3610
3713
|
instructions. Guardrail rules on `mcp_<server>_<tool>` names still match (`mcp_call` acts as that tool), and the
|
|
3611
3714
|
question names `<server>: <tool>`; approvals stored under the old names don't carry over. Hooks and loop-guard's
|
|
3612
3715
|
`ignore_tools` see `mcp_call`. `/mcp` lists the tools as `<server>/<tool>` and says what every request carries.
|
|
3613
|
-
Needs chi 0.37.0. See [docs/
|
|
3716
|
+
Needs chi 0.37.0. See [docs/bundles.md](docs/bundles.md#the-mcp-bundle).
|
|
3614
3717
|
|
|
3615
3718
|
### Fixed
|
|
3616
3719
|
|
|
@@ -3662,7 +3765,7 @@ Update with `chi update` (mcp 0.5.1).
|
|
|
3662
3765
|
rebuild (the split, your decisions, its verdicts, follow-ups), its status in the index description, and resumes
|
|
3663
3766
|
from it in a new session after checking git and the session list; `/coordinate resume` picks up an open handoff.
|
|
3664
3767
|
When the work is done it marks the handoff DONE and asks whether to remove it. See
|
|
3665
|
-
[docs/
|
|
3768
|
+
[docs/bundles.md](docs/bundles.md#the-coordinator-bundle).
|
|
3666
3769
|
- The guardrails bundle (0.8.0) asks before every memory removal (`memory-remove`, once at a time). Guardrail rules
|
|
3667
3770
|
take `memory: remove`.
|
|
3668
3771
|
- In the web, a file reference in an answer (`lib/foo.rb:28`, `lib/foo.rb:28-34`, in inline code too) links to that
|
|
@@ -3671,7 +3774,7 @@ Update with `chi update` (mcp 0.5.1).
|
|
|
3671
3774
|
at the PR's head. Display only; `bundles: github-pr: line_links: false` turns it off (github-pr 0.2.0; run
|
|
3672
3775
|
`chi update`). See [docs/context.md](docs/context.md#line-links).
|
|
3673
3776
|
- `/mcp` shows roughly how many tokens each MCP server's tool definitions take in every request, and the total
|
|
3674
|
-
(mcp 0.5.0; run `chi update`). See [docs/
|
|
3777
|
+
(mcp 0.5.0; run `chi update`). See [docs/bundles.md](docs/bundles.md#the-mcp-bundle).
|
|
3675
3778
|
|
|
3676
3779
|
### Fixed
|
|
3677
3780
|
|
|
@@ -5423,7 +5526,9 @@ and long-lived sessions.
|
|
|
5423
5526
|
- A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
|
|
5424
5527
|
hotkey panel that send selected text or the clipboard to your sessions.
|
|
5425
5528
|
|
|
5426
|
-
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.
|
|
5529
|
+
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.144.0...HEAD
|
|
5530
|
+
[0.144.0]: https://github.com/dm1try/samagotchi/compare/v0.143.0...v0.144.0
|
|
5531
|
+
[0.143.0]: https://github.com/dm1try/samagotchi/compare/v0.142.0...v0.143.0
|
|
5427
5532
|
[0.142.0]: https://github.com/dm1try/samagotchi/compare/v0.141.0...v0.142.0
|
|
5428
5533
|
[0.141.0]: https://github.com/dm1try/samagotchi/compare/v0.140.0...v0.141.0
|
|
5429
5534
|
[0.140.0]: https://github.com/dm1try/samagotchi/compare/v0.139.1...v0.140.0
|
data/README.md
CHANGED
|
@@ -218,6 +218,7 @@ once, for the session, for the repo, or for the whole rule in the repo.
|
|
|
218
218
|
- [Guardrails](docs/guardrails.md): allow / ask / deny for tool calls, rules, approvals
|
|
219
219
|
- [Hooks](docs/hooks.md): plugin hooks and bundle hooks
|
|
220
220
|
- [Plugins](docs/plugins.md): bundle plugins (commands, tools, hooks)
|
|
221
|
+
- [Bundles](docs/bundles.md): what each shipped bundle does (btw, mcp, cost-cap, claude-peer, skills…), its commands and settings
|
|
221
222
|
- [Writing a bundle](docs/bundle-authoring.md): `chi bundle new`, `test`, `check`, `try`, `install --dev`
|
|
222
223
|
- [Testing](docs/testing.md): specs, affected specs, lint, worktrees
|
|
223
224
|
- [Architecture](docs/architecture.md): Engine, TerminalUI, bridge, web
|
data/docs/architecture.md
CHANGED
|
@@ -365,7 +365,8 @@ The owner's update routes publish progress and results as `chi_update` events wi
|
|
|
365
365
|
`version` and may include a progress line. The hub retains the latest event for a reconnecting
|
|
366
366
|
tab's snapshot. `POST /api/update` decides itself whether this install can take a gem
|
|
367
367
|
(`UpdateCheck.blocked_reason`: a checkout, Bundler, an unwritable gem dir → 409 `update_blocked`), so
|
|
368
|
-
it holds with `update.notify: off`; a child that prints no rows fails with its own last line,
|
|
368
|
+
it holds with `update.notify: off`; a child that prints no rows fails with its own last line, a child still running after
|
|
369
|
+
30 minutes (`UpdateOps::UPDATE_TIMEOUT`; it has a process group of its own) is stopped with what it started and fails the same way, and a
|
|
369
370
|
done install refreshes the hub's installed version (`SessionHub#refresh_installed`) before its `done`.
|
|
370
371
|
Worker restarts target every worker older than the version installed now (refreshed the same way)
|
|
371
372
|
and publish per-session results. Only one of an install, a worker restart pass and a web restart runs
|
|
@@ -385,17 +386,23 @@ and installs it through `UpdateOps#install(wait: true, auto: true)` when the ins
|
|
|
385
386
|
runs, no hub summary has `status: running` or a `pending_question`, and the version isn't in `auto_failed` or
|
|
386
387
|
already in the `auto` record (one automatic try per version). Its frames carry `auto: true` (the page: "Automatic
|
|
387
388
|
chi update in progress", "(automatic)" in the sheet's title). Its record is `update_check.json`'s `auto`:
|
|
388
|
-
`{version, from, at, kept, phase: installed|workers|web|done|failed, workers: {restarted, left}, detail, pushed}
|
|
389
|
+
`{version, from, at, kept, phase: installed|workers|web|retrying|done|failed, workers: {restarted, left}, detail, pushed}`,
|
|
390
|
+
in Ruby the value object `Web::AutoUpdateRecord`, which owns that shape (`from_h`, `to_store`).
|
|
389
391
|
With `update.restart: never` the run ends at the install (`chi_notice` `installed`). With `idle` it goes on
|
|
390
|
-
(`phase` `installed` → `workers` → `web` → `done`): `UpdateOps#restart_workers(select:)` over the stale workers whose
|
|
392
|
+
(`phase` `installed` → `workers` → `web` → `retrying` → `done`): `UpdateOps#restart_workers(select:)` over the stale workers whose
|
|
391
393
|
summary is idle with no question and `updated_at` at least 10 minutes old (`QUIET`; the others are `skipped` rows;
|
|
392
|
-
the worker's own atomic refusal still applies)
|
|
394
|
+
the worker's own atomic refusal still applies); then, with no
|
|
393
395
|
turn running, `Server.restart_preflight` (the restart's command with `--version`, 20 s, killed on a timeout; it must
|
|
394
396
|
print a chi at least the release) and, if it passes, the record's `phase: web` is written **before**
|
|
395
397
|
`UpdateOps#restart_web`. A failed preflight, or a refused restart, publishes `restart_failed` and ends the run
|
|
396
398
|
(`failed`). `AutoUpdate#stop` waits `STOP_WAIT` (25 s, longer than the preflight's timeout) for its thread, and a
|
|
397
399
|
preflight that ends after a stop leads to nothing (no `web`, no exec): the next start takes the run up again. The restarted chi web's AutoUpdate (first step after 5 s) finds `phase: web`, checks it runs the
|
|
398
|
-
release, counts the workers once more and publishes `updated`, then `done
|
|
400
|
+
release, counts the workers once more and publishes `updated`, then `done`, or `retrying` while workers are left. Those are
|
|
401
|
+
retried each step until none is left or 24 h (`RETRY_FOR`) have passed since the install, under the same filter, and from
|
|
402
|
+
whichever chi web is up (`workers` before the restart, `retrying` after it, and a restart mid-retry reads it from the
|
|
403
|
+
record). The time is checked before each pass, so a run always ends. A later pass is `quiet:`: no `chi_update` frames (each
|
|
404
|
+
is a sticky toast) unless a worker restarts, and no further `chi_notice`. `retrying` isn't an open phase for the install
|
|
405
|
+
gate: a newer release installs under its usual gate, and its record replaces this one, its own passes taking the workers over. A step that raises is logged (`auto_update_failed`) and taken again at the next poll; each one saves the record before it publishes, so the owner hears it once. Results reach the phone as `chi_notice`
|
|
399
406
|
hub events (`SessionHub#publish_notice`), see [internals/web-push.md](internals/web-push.md).
|
|
400
407
|
|
|
401
408
|
The page's scope is in its URL, and the server picks the default: `?dir=<folder>` is that folder's
|
|
@@ -602,7 +609,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
|
|
|
602
609
|
| Bundle authoring | `bundle_command.rb` (`BundleCommand`), `bundle_command/{scaffold,check,test_run}.rb`, `bundle_command/try/{run,sandbox,trace}.rb`, `testing.rb` + `testing/` (the test kit) | `chi bundle new`, `check`, `test` and `try`, and the kit a bundle's tests load it with ([bundle-authoring.md](bundle-authoring.md), [internals/bundles.md](internals/bundles.md)). |
|
|
603
610
|
| Session config (`--set`) | `session_config.rb` (`SessionConfig`, `SessionConfig::Settings`) | A session's own settings as one value (`Session#settings`, `SessionSetup#settings`): `core`, the `--set KEY=VALUE` values of the core keys marked `session: true` (`Config::Entry`), typed by `Config.coerce!` and read first through `Config.get(key, session:)` (`RecapSetup`; `Engine#session=` rebuilds the recap job, `IdleScheduler#replace_job`), file key `config_settings`; `bundles`, the `--set BUNDLE.KEY=VALUE` values, checked against the manifest's `session_settings:`, laid over `bundles: <name>:` in `ctx.settings` ([plugins.md](plugins.md)), file key `bundle_settings`. `SessionConfig.clash` refuses a bundle setting named like a core one (install, `chi bundle check`). See [configuration.md](configuration.md#per-session-settings). |
|
|
604
611
|
| Plugin API | `plugin/api.rb` (`Plugin::Api`), `plugin/tool_spec.rb` (`Plugin::ToolSpec`: a checked tool declaration, how it is registered), `plugin/loader.rb`, `plugin/context.rb` (`ctx`), `plugin/http.rb` + `plugin/http_transport.rb` (`ctx.http`), `plugin/card.rb` (`Plugin::Card`) | What a bundle's plugin registers: tools, commands, annotation actions, hooks, services, toolkits, peer sources; what its handlers get as `ctx` ([plugins.md](plugins.md)). |
|
|
605
|
-
| Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`) | What claude-peer and codex-peer share (the send tool, the command, the cards, payloads); each bundle's subclass sets its strings and transport ([
|
|
612
|
+
| Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`) | What claude-peer and codex-peer share (the send tool, the command, the cards, payloads); each bundle's subclass sets its strings and transport ([bundles.md](bundles.md#the-claude-peer-bundle)). |
|
|
606
613
|
| Shipped bundles | `bundles/` (`mcp`, `github-pr`, `loop-guard`, `skills`, `source-links`, …) | Bundles that ship with chi. |
|
|
607
614
|
| Hooks | `hooks/registry.rb` (`Hooks::Registry`), `hooks/loader.rb`, `hook_routes.rb` (`HookRoutes`), `event_routes.rb` (`EventRoutes`) | Hook registration and dispatch; what a hook or plugin does beyond reading its event (notice, question, stop, steer) routed to the UIs (cards and notices through one set of routes) ([hooks.md](hooks.md)). |
|
|
608
615
|
| Guardrails | `guardrails.rb`, `guardrails/shell_lex.rb`, `guardrails/data_readers.rb`, `guardrails/rules.rb`, `guardrails/protected_paths.rb`, `guardrails/parent_policy.rb` + `guardrails/parent_approvals.rb`, `guardrail_wiring.rb` | The gate before every tool call: shell lexing (and the commands that only read a heredoc as data), YAML rules, the core checks on chi's own files, approvals, what a parent agent may answer (`guardrails.parent_answers`) ([guardrails.md](guardrails.md)). |
|
data/docs/bundle-authoring.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Read this first when someone asks for new chi functionality "as a bundle". It is the short path: the loop, the
|
|
4
4
|
files, what a hook sees, how to test, and what goes wrong. The full references are in this same `docs/` folder:
|
|
5
|
-
[plugins.md](plugins.md) (the
|
|
5
|
+
[plugins.md](plugins.md) (the API), [hooks.md](hooks.md) (event fields), [bundles.md](bundles.md) (shipped bundles).
|
|
6
6
|
|
|
7
7
|
## The loop
|
|
8
8
|
|
|
@@ -59,8 +59,8 @@ plugin:
|
|
|
59
59
|
`plugin.rb` defines `class Plugin` with `register(chi)`; `initialize(settings)` (optional) gets config.yml
|
|
60
60
|
`bundles: my-bundle:` as a Hash with string keys, once, when the plugin loads. A value a session may set
|
|
61
61
|
(`chi --set my-bundle.KEY=V`, listed in the manifest's `session_settings:`, typed with `{KEY: number}` so a
|
|
62
|
-
value of another type is refused) is read from `ctx.settings` at call
|
|
63
|
-
|
|
62
|
+
value of another type is refused) is read from `ctx.settings` at call time. List what config.yml may set in `settings:`
|
|
63
|
+
(`[greeting]`, or `{greeting: string}`): a typo there then warns. `chi bundle check --set KEY=VALUE` gives the sandboxed load a setting.
|
|
64
64
|
|
|
65
65
|
## What a hook sees
|
|
66
66
|
|
|
@@ -89,7 +89,7 @@ Match on `result:`, not `output:`. An execute's result is its `stdout:` and `std
|
|
|
89
89
|
empty), then `exit: N` (`exit: 0 (no output)` when both were empty); a non-zero exit makes `status:` `"error"`.
|
|
90
90
|
Act through `ctx`: `ctx.notify(text, level: :warn)`, `ctx.steer(text)` (a line the model reads before its next
|
|
91
91
|
step), `ctx.card(…)`, `ctx.stop_turn(reason)`, `ctx.ask_user(…)`, `ctx.data_dir` (the bundle's state folder),
|
|
92
|
-
`ctx.cwd`, `ctx.log`. In a test, each recorded notice, steer or stop names its hook as `"plugin.rb (bundle
|
|
92
|
+
`ctx.session_dir` (this session's, removed with it), `ctx.cwd`, `ctx.log`. In a test, each recorded notice, steer or stop names its hook as `"plugin.rb (bundle
|
|
93
93
|
my-bundle)"`, the plugin's label (a `hooks/x.rb` file's is `"x.rb (bundle my-bundle)"`).
|
|
94
94
|
|
|
95
95
|
## Testing it
|
|
@@ -121,7 +121,7 @@ end
|
|
|
121
121
|
`bundle.http.stub` stubs `ctx.http`; `bundle.question_asked(text, question:)` fires `:question_asked` and returns
|
|
122
122
|
the refs; `sandbox.config`, `sandbox.fake_executable` and `bundle.install` cover setup.
|
|
123
123
|
The full list is in [plugins.md, Testing a bundle](plugins.md#testing-a-bundle-experimental). The kit is
|
|
124
|
-
experimental (it may change before chi 1.0). If a test needs a fake of chi's own (a stub of a `Samagotchi::`
|
|
124
|
+
experimental (it may change before chi 1.0). A failing matcher that meets `ENV` prints `#<the process ENV, contents not shown>`, not your keys. If a test needs a fake of chi's own (a stub of a `Samagotchi::`
|
|
125
125
|
class, a hand-built `ctx`), that is a gap in the kit: say so to the user rather than reaching into chi.
|
|
126
126
|
|
|
127
127
|
## Pitfalls
|
|
@@ -133,14 +133,14 @@ class, a hand-built `ctx`), that is a gap in the kit: say so to the user rather
|
|
|
133
133
|
newer than the floor (`ctx.http` needs 0.80.0, `ctx.cost` 0.83.0, `ctx.usage` 0.100.0, `ctx.sessions.children` 0.34.0). A keyword added
|
|
134
134
|
later counts too (`ctx.ask_model(model:)` 0.80.0, `ctx.sessions.send(delivery:)` 0.64.0, `chi.toolkit(prompt:)`
|
|
135
135
|
0.72.0, `chi.toolkit(groups:)` 0.121.0), when the call is written on `ctx` / `chi` itself (not through a variable).
|
|
136
|
+
- **A typo in an API call.** `check` warns (`api`) on a call or keyword this chi lacks, on any path; for a newer chi on purpose, guard it with `ctx.respond_to?(:name)`.
|
|
136
137
|
- **trust_level.** Leave it out. `reviewed` / `trusted` are for someone who reviewed the bundle, not its author.
|
|
137
138
|
- **Restart.** A session loads bundles when it starts: after an install or a settings change, the user starts a
|
|
138
139
|
new session (or `chi sessions restart ID`).
|
|
139
140
|
- **chi's internals.** A bundle may use `chi.*`, `ctx` and the names
|
|
140
141
|
[plugins.md, Stable for bundles](plugins.md#stable-for-bundles) lists; any other `Samagotchi::` name may change
|
|
141
142
|
in any release (`check` warns: `boundary`).
|
|
142
|
-
- **Load errors.** A plugin that raises at load is skipped and the session goes on: `check` shows the error at its
|
|
143
|
-
`plugin.rb:LINE`.
|
|
143
|
+
- **Load errors.** A plugin that raises at load is skipped and the session goes on: `check` shows the error at its `plugin.rb:LINE`.
|
|
144
144
|
|
|
145
145
|
## Verifying it live
|
|
146
146
|
|