samagotchi 0.152.0 → 0.154.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 +45 -1
- data/README.md +2 -3
- data/bin/chi +23 -24
- data/docs/architecture.md +30 -33
- data/docs/broadcast.md +5 -5
- data/docs/bundle-authoring.md +1 -1
- data/docs/bundles.md +93 -12
- data/docs/cli.md +83 -99
- data/docs/configuration.md +46 -40
- data/docs/context.md +3 -3
- data/docs/desktop.md +1 -1
- data/docs/guardrails.md +15 -15
- data/docs/hooks.md +13 -12
- data/docs/internals/anthropic.md +3 -3
- data/docs/internals/attached-context.md +5 -2
- data/docs/internals/background-tasks.md +3 -4
- data/docs/internals/block-renderers.md +4 -0
- data/docs/internals/bridge.md +3 -3
- data/docs/internals/context-telemetry.md +1 -1
- data/docs/internals/engine.md +42 -12
- data/docs/internals/objectives.md +6 -5
- data/docs/internals/participants.md +8 -8
- data/docs/internals/prompt-caching.md +8 -4
- data/docs/internals/remote-sessions.md +7 -7
- data/docs/internals/web-frontend.md +20 -17
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +2 -2
- data/docs/plugins.md +52 -43
- data/docs/releasing.md +1 -1
- data/docs/sessions.md +25 -25
- data/docs/sub-agent.md +2 -2
- data/docs/system-one.md +1 -1
- data/docs/testing.md +18 -8
- data/lib/samagotchi/answer_text.rb +34 -0
- data/lib/samagotchi/bridge.rb +43 -32
- data/lib/samagotchi/bridge_client.rb +10 -9
- data/lib/samagotchi/broadcast/recipients.rb +2 -2
- data/lib/samagotchi/broadcast/triage.rb +1 -1
- data/lib/samagotchi/broadcast_command.rb +5 -5
- data/lib/samagotchi/bundle_command/try/command.rb +1 -1
- data/lib/samagotchi/bundle_command/try/run.rb +1 -1
- data/lib/samagotchi/bundle_command.rb +2 -2
- data/lib/samagotchi/bundles/decision-card/manifest.yml +4 -4
- data/lib/samagotchi/bundles/decision-card/plugin.rb +1 -9
- data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
- data/lib/samagotchi/bundles/system/config_modification_protocol.md +3 -4
- data/lib/samagotchi/bundles/system/manifest.yml +3 -3
- data/lib/samagotchi/bundles/system/self_map.md +1 -1
- data/lib/samagotchi/bundles/web-search/manifest.yml +13 -0
- data/lib/samagotchi/bundles/web-search/plugin.rb +174 -0
- data/lib/samagotchi/child_move.rb +3 -3
- data/lib/samagotchi/commands/registry.rb +6 -6
- data/lib/samagotchi/composer_route.rb +4 -5
- data/lib/samagotchi/config.rb +14 -12
- data/lib/samagotchi/context_candidate_choice.rb +1 -1
- data/lib/samagotchi/context_candidates.rb +4 -3
- data/lib/samagotchi/continue_offer.rb +1 -1
- data/lib/samagotchi/debug_log.rb +1 -1
- data/lib/samagotchi/degrade.rb +75 -0
- data/lib/samagotchi/desktop/macos/ChiRunner.swift +2 -2
- data/lib/samagotchi/engine/cards.rb +87 -0
- data/lib/samagotchi/engine/context_judge.rb +138 -0
- data/lib/samagotchi/engine/events.rb +131 -0
- data/lib/samagotchi/engine/guardrails.rb +87 -0
- data/lib/samagotchi/engine/hooks.rb +119 -0
- data/lib/samagotchi/engine/messages.rb +124 -0
- data/lib/samagotchi/engine/model_settings.rb +127 -0
- data/lib/samagotchi/engine/models.rb +261 -0
- data/lib/samagotchi/engine/objectives.rb +116 -0
- data/lib/samagotchi/engine/participants.rb +86 -0
- data/lib/samagotchi/engine/plugins.rb +208 -0
- data/lib/samagotchi/engine/questions.rb +98 -0
- data/lib/samagotchi/engine/recap.rb +130 -0
- data/lib/samagotchi/engine/session.rb +131 -0
- data/lib/samagotchi/engine/side_requests.rb +135 -0
- data/lib/samagotchi/engine/steering.rb +134 -0
- data/lib/samagotchi/engine/toolkit.rb +269 -0
- data/lib/samagotchi/engine/turn_end.rb +180 -0
- data/lib/samagotchi/engine/turn_helpers.rb +160 -0
- data/lib/samagotchi/engine/verify.rb +153 -0
- data/lib/samagotchi/engine.rb +63 -2642
- data/lib/samagotchi/grants.rb +575 -0
- data/lib/samagotchi/guardrail_wiring.rb +2 -2
- data/lib/samagotchi/guardrails/context.rb +2 -3
- data/lib/samagotchi/guardrails/parent_approvals.rb +2 -2
- data/lib/samagotchi/guardrails/parent_policy.rb +2 -2
- data/lib/samagotchi/guardrails/review_boundary.rb +4 -3
- data/lib/samagotchi/hook_routes.rb +3 -3
- data/lib/samagotchi/idle_recap.rb +4 -5
- data/lib/samagotchi/idle_reminders.rb +3 -4
- data/lib/samagotchi/iteration_limit.rb +2 -2
- data/lib/samagotchi/kernel_loop.rb +10 -11
- data/lib/samagotchi/launch_mode.rb +13 -32
- data/lib/samagotchi/level_setting_command.rb +3 -2
- data/lib/samagotchi/llm_context_command.rb +3 -2
- data/lib/samagotchi/llm_context_stale.rb +2 -2
- data/lib/samagotchi/log.rb +7 -7
- data/lib/samagotchi/log_line.rb +1 -1
- data/lib/samagotchi/log_path.rb +1 -1
- data/lib/samagotchi/message_parts.rb +3 -2
- data/lib/samagotchi/note_command.rb +1 -1
- data/lib/samagotchi/note_delivery.rb +18 -8
- data/lib/samagotchi/objectives.rb +24 -3
- data/lib/samagotchi/objectives_check.rb +8 -27
- data/lib/samagotchi/objectives_command.rb +4 -69
- data/lib/samagotchi/objectives_edit.rb +87 -0
- data/lib/samagotchi/output_formatter.rb +7 -1
- data/lib/samagotchi/owner_lock.rb +7 -1
- data/lib/samagotchi/parent_answers_command.rb +5 -4
- data/lib/samagotchi/participant_exposure.rb +42 -0
- data/lib/samagotchi/participant_mode.rb +1 -1
- data/lib/samagotchi/participant_name.rb +1 -1
- data/lib/samagotchi/participants.rb +17 -17
- data/lib/samagotchi/participants_watch.rb +1 -1
- data/lib/samagotchi/pending_input_queue.rb +2 -2
- data/lib/samagotchi/plugin/api.rb +3 -2
- data/lib/samagotchi/plugin/context.rb +21 -7
- data/lib/samagotchi/plugin/peer.rb +2 -1
- data/lib/samagotchi/plugin/sessions.rb +6 -4
- data/lib/samagotchi/plugin_tasks.rb +1 -2
- data/lib/samagotchi/private_files.rb +29 -0
- data/lib/samagotchi/project_env.rb +2 -2
- data/lib/samagotchi/question_desk.rb +8 -7
- data/lib/samagotchi/recap_command.rb +2 -1
- data/lib/samagotchi/recap_setup.rb +1 -1
- data/lib/samagotchi/recap_store.rb +1 -1
- data/lib/samagotchi/redact.rb +86 -0
- data/lib/samagotchi/reminder_queue.rb +2 -2
- data/lib/samagotchi/remote_attach_command.rb +1 -1
- data/lib/samagotchi/reply_wait/poll.rb +2 -2
- data/lib/samagotchi/review_start.rb +1 -1
- data/lib/samagotchi/run_options.rb +6 -6
- data/lib/samagotchi/self_report.rb +42 -39
- data/lib/samagotchi/send_command/busy.rb +1 -1
- data/lib/samagotchi/send_command.rb +4 -1
- data/lib/samagotchi/session.rb +11 -2
- data/lib/samagotchi/session_access/contract.rb +3 -3
- data/lib/samagotchi/session_access/local.rb +9 -9
- data/lib/samagotchi/session_access/remote.rb +17 -7
- data/lib/samagotchi/session_access.rb +4 -4
- data/lib/samagotchi/session_archive_command.rb +2 -2
- data/lib/samagotchi/session_chain.rb +8 -6
- data/lib/samagotchi/session_commands.rb +45 -48
- data/lib/samagotchi/session_continue.rb +1 -1
- data/lib/samagotchi/session_delete_command.rb +4 -4
- data/lib/samagotchi/session_manager.rb +59 -36
- data/lib/samagotchi/session_metrics.rb +2 -2
- data/lib/samagotchi/session_model_settings.rb +3 -2
- data/lib/samagotchi/session_participants.rb +1 -1
- data/lib/samagotchi/session_retention.rb +3 -3
- data/lib/samagotchi/sessions_command.rb +4 -4
- data/lib/samagotchi/share_command.rb +10 -10
- data/lib/samagotchi/steer.rb +1 -1
- data/lib/samagotchi/system_prompt.rb +102 -109
- data/lib/samagotchi/task_watch.rb +1 -1
- data/lib/samagotchi/terminal_ui/attach_launcher.rb +72 -10
- data/lib/samagotchi/terminal_ui/attached_loop/composer.rb +12 -9
- data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +16 -0
- data/lib/samagotchi/terminal_ui/attached_loop/questions.rb +2 -3
- data/lib/samagotchi/terminal_ui/attached_loop.rb +17 -8
- data/lib/samagotchi/terminal_ui/attached_view.rb +2 -3
- data/lib/samagotchi/terminal_ui/event_renderer.rb +3 -5
- data/lib/samagotchi/terminal_ui/formatting.rb +7 -7
- data/lib/samagotchi/terminal_ui/input_support.rb +1 -7
- data/lib/samagotchi/terminal_ui/line_reader.rb +2 -2
- data/lib/samagotchi/terminal_ui/live_region.rb +2 -2
- data/lib/samagotchi/terminal_ui/log_tail.rb +135 -0
- data/lib/samagotchi/terminal_ui/one_shot_sink.rb +2 -2
- data/lib/samagotchi/terminal_ui/plain_surface.rb +1 -1
- data/lib/samagotchi/terminal_ui/question_prompt.rb +4 -5
- data/lib/samagotchi/terminal_ui/reline_seam.rb +3 -3
- data/lib/samagotchi/terminal_ui/status_row.rb +7 -8
- data/lib/samagotchi/terminal_ui.rb +142 -1387
- data/lib/samagotchi/title_command.rb +2 -2
- data/lib/samagotchi/tool_runner.rb +14 -16
- data/lib/samagotchi/toolkit.rb +8 -5
- data/lib/samagotchi/toolkit_binding.rb +30 -5
- data/lib/samagotchi/toolkit_command.rb +2 -1
- data/lib/samagotchi/toolkit_report_command.rb +9 -5
- data/lib/samagotchi/toolkit_suggest.rb +12 -6
- data/lib/samagotchi/tools/builtin_calls.rb +14 -10
- data/lib/samagotchi/tools/deferred_tools.rb +2 -2
- data/lib/samagotchi/tools/delegate.rb +3 -1
- data/lib/samagotchi/tools/delegate_cursor.rb +3 -3
- data/lib/samagotchi/tools/delegate_wait.rb +1 -1
- data/lib/samagotchi/tools/objectives_tool.rb +2 -2
- data/lib/samagotchi/tools/registry.rb +44 -20
- data/lib/samagotchi/tools/send_note.rb +2 -1
- data/lib/samagotchi/tools/tool_index.rb +27 -21
- data/lib/samagotchi/turn_endings.rb +2 -2
- data/lib/samagotchi/turn_flow.rb +4 -5
- data/lib/samagotchi/update_hint.rb +2 -2
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +39 -50
- data/lib/samagotchi/web/participant_access.rb +2 -2
- data/lib/samagotchi/web/participant_review.rb +5 -5
- data/lib/samagotchi/web/participant_stream_filter.rb +8 -8
- data/lib/samagotchi/web/participant_view.rb +2 -82
- data/lib/samagotchi/web/participants_admin.rb +1 -1
- data/lib/samagotchi/web/public/app.js +61 -357
- data/lib/samagotchi/web/public/block_host.js +35 -8
- data/lib/samagotchi/web/public/block_renderers.css +9 -5
- data/lib/samagotchi/web/public/chains.js +2 -2
- data/lib/samagotchi/web/public/claim_link.js +4 -4
- data/lib/samagotchi/web/public/composer_mode.js +110 -0
- data/lib/samagotchi/web/public/format.js +3 -3
- data/lib/samagotchi/web/public/owner_claim.js +81 -0
- data/lib/samagotchi/web/public/owner_verify.js +112 -0
- data/lib/samagotchi/web/public/session_fields.js +3 -3
- data/lib/samagotchi/web/public/strip_grip.js +3 -3
- data/lib/samagotchi/web/public/strip_hidden.js +65 -0
- data/lib/samagotchi/web/public/version_notices.js +132 -0
- data/lib/samagotchi/web/push/store.rb +1 -1
- data/lib/samagotchi/web/session_access_routes.rb +5 -4
- data/lib/samagotchi/web/session_control.rb +12 -8
- data/lib/samagotchi/web/session_create.rb +1 -1
- data/lib/samagotchi/web/session_hub.rb +2 -2
- data/lib/samagotchi/web/session_show.rb +2 -2
- data/lib/samagotchi/web/session_summary.rb +1 -1
- data/lib/samagotchi/worker.rb +106 -9
- data/lib/samagotchi/worker_link.rb +3 -3
- data/lib/samagotchi/working_set_command.rb +3 -2
- metadata +36 -6
- data/lib/samagotchi/terminal_ui/between_turns.rb +0 -138
- data/lib/samagotchi/terminal_ui/repl_input.rb +0 -152
- data/lib/samagotchi/web/grants.rb +0 -575
- data/lib/samagotchi/web/participant_exposure.rb +0 -44
- data/lib/samagotchi/web/private_files.rb +0 -31
|
@@ -10,7 +10,7 @@ module Samagotchi
|
|
|
10
10
|
# stderr. stdout is the answer's alone, printed after the turn: a
|
|
11
11
|
# script or a parent agent reads it.
|
|
12
12
|
#
|
|
13
|
-
# It prints the retry lines the
|
|
13
|
+
# It prints the retry lines the attached terminal shows: the loop asking again after
|
|
14
14
|
# an empty answer (:empty_answer_retry), and a generation retried after
|
|
15
15
|
# a failed request (:generation_retrying). And the hooks' notices
|
|
16
16
|
# (:hook_notice): one during the turn as it comes, one the after_turn
|
|
@@ -18,7 +18,7 @@ module Samagotchi
|
|
|
18
18
|
# #flush, which the caller runs after it has printed the answer. And
|
|
19
19
|
# the load warnings the first turn announces (:guardrail_warning: the
|
|
20
20
|
# guardrails, the plugins, an orphaned project memory folder), as the
|
|
21
|
-
#
|
|
21
|
+
# attached terminal's "<label>> …" lines.
|
|
22
22
|
class OneShotSink
|
|
23
23
|
include Formatting
|
|
24
24
|
|
|
@@ -12,7 +12,7 @@ module Samagotchi
|
|
|
12
12
|
# print as lines. The activity slot is dropped, because redrawing it in
|
|
13
13
|
# place needs cursor movement (the turn's lines still print as they end).
|
|
14
14
|
# The prompt is Reline's own, so output may cross it; the editor slot
|
|
15
|
-
# prints the prompt of a plain read (
|
|
15
|
+
# prints the prompt of a plain read (a question's ? off a terminal).
|
|
16
16
|
class PlainSurface
|
|
17
17
|
include Surface
|
|
18
18
|
|
|
@@ -11,8 +11,7 @@ module Samagotchi
|
|
|
11
11
|
# slot content (#slot), the line it leaves (#summary) and the parsing of
|
|
12
12
|
# a typed answer ("2", "1,3", "1 3; text", option labels). No I/O:
|
|
13
13
|
# callers draw the slot and print the messages, and
|
|
14
|
-
# record the answer (the
|
|
15
|
-
# Bridge). An approval (kind "approval") takes only a number, an exact
|
|
14
|
+
# record the answer (an attached UI over the Bridge). An approval (kind "approval") takes only a number, an exact
|
|
16
15
|
# label, y (the first option, Allow once) or n (the last, Deny), plus
|
|
17
16
|
# an optional "; reason"; a substring would pick the wrong one ("y" is
|
|
18
17
|
# in "Deny"). The step-limit question (kind "continue") reads the
|
|
@@ -86,8 +85,8 @@ module Samagotchi
|
|
|
86
85
|
end
|
|
87
86
|
|
|
88
87
|
# The line a question dismissed in a --non-interactive run leaves (no
|
|
89
|
-
# one could answer it there): the
|
|
90
|
-
# its cancel (QuestionDesk::UNANSWERABLE_REASON).
|
|
88
|
+
# one could answer it there): the one-shot's own, and an attached UI's
|
|
89
|
+
# on its cancel (QuestionDesk::UNANSWERABLE_REASON).
|
|
91
90
|
UNANSWERABLE_TEXT = "(dismissed: no one to answer in a non-interactive run)"
|
|
92
91
|
|
|
93
92
|
# What a question closed with no answer here says: a relayed approval
|
|
@@ -220,7 +219,7 @@ module Samagotchi
|
|
|
220
219
|
end
|
|
221
220
|
|
|
222
221
|
# The continue words, or an option's number. Empty is Continue (Enter
|
|
223
|
-
# alone
|
|
222
|
+
# alone).
|
|
224
223
|
def parse_continue(raw)
|
|
225
224
|
text = raw.to_s.strip
|
|
226
225
|
if text.match?(/\A\d+\z/)
|
|
@@ -39,13 +39,13 @@ module Samagotchi
|
|
|
39
39
|
attr_reader :screen
|
|
40
40
|
|
|
41
41
|
# Asked first on Ctrl-C during a read, with or without a screen: a
|
|
42
|
-
# truthy answer means it handled the key (the
|
|
43
|
-
# turn) and the read goes on with the typed text as it is.
|
|
42
|
+
# truthy answer means it handled the key (the attached loop cancelled a
|
|
43
|
+
# running turn) and the read goes on with the typed text as it is.
|
|
44
44
|
# @return [#call, nil]
|
|
45
45
|
attr_accessor :interrupt_handler
|
|
46
46
|
|
|
47
47
|
# Called with no arguments for each key a read takes (typing is
|
|
48
|
-
# activity for
|
|
48
|
+
# activity for an idle clock; nobody sets it now).
|
|
49
49
|
# @return [#call, nil]
|
|
50
50
|
attr_accessor :key_handler
|
|
51
51
|
|
|
@@ -6,8 +6,8 @@ module Samagotchi
|
|
|
6
6
|
class TerminalUI
|
|
7
7
|
# The status row under the prompt, the same for both TUIs:
|
|
8
8
|
# `status> Title | model=… | ↳ parent | ⑂ 2 running · 1 waiting | 2 participants | ctx=12.3% (under20) | mem: … | muted: …`.
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# The attached TUI feeds it what it learns from the Bridge's events
|
|
10
|
+
# through #update, and the row is redrawn in
|
|
11
11
|
# the surface's status slot only when its text changes.
|
|
12
12
|
class StatusRow
|
|
13
13
|
include Formatting
|
|
@@ -54,7 +54,7 @@ module Samagotchi
|
|
|
54
54
|
@shown = nil
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
# The surface it draws on (
|
|
57
|
+
# The surface it draws on (no caller since the REPL went): the row
|
|
58
58
|
# is drawn there at the next change.
|
|
59
59
|
def surface=(surface)
|
|
60
60
|
@surface = surface
|
|
@@ -72,8 +72,8 @@ module Samagotchi
|
|
|
72
72
|
refresh
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
# Take a session's state: the
|
|
76
|
-
#
|
|
75
|
+
# Take a session's state: the one a worker sends an attached TUI when
|
|
76
|
+
# it joins (Engine#session_state_snapshot). A key the state
|
|
77
77
|
# lacks (an older worker's) leaves its field as it was; the served pair
|
|
78
78
|
# is cleared without one, and the model is kept without a name.
|
|
79
79
|
# @param default_model [String, nil] the config's default, named beside
|
|
@@ -94,8 +94,7 @@ module Samagotchi
|
|
|
94
94
|
STATE_LISTS = { used_memories: :used_memory_names, preloaded: :preloaded_memory_names,
|
|
95
95
|
muted: :muted_memory_names }.freeze
|
|
96
96
|
|
|
97
|
-
# Take what a turn event says about the row (the
|
|
98
|
-
# the REPL, the Bridge's in attached mode): ctx, the memories used,
|
|
97
|
+
# Take what a turn event says about the row (the Bridge's events): ctx, the memories used,
|
|
99
98
|
# the model the server served, whether a turn runs (the steer
|
|
100
99
|
# hint). Other events change nothing.
|
|
101
100
|
def take_event(event)
|
|
@@ -178,7 +177,7 @@ module Samagotchi
|
|
|
178
177
|
end
|
|
179
178
|
|
|
180
179
|
# `⑂ 2 running · 1 waiting`, the counts there are; "" with neither (no
|
|
181
|
-
# children, or all ended). Not "not reported": a
|
|
180
|
+
# children, or all ended). Not "not reported": a one-shot parent is never
|
|
182
181
|
# given its children's replies (no wakes there), and a worker moves
|
|
183
182
|
# the cursors only after the turn_completed a terminal refreshes on.
|
|
184
183
|
def children_text(counts)
|