samagotchi 0.153.0 → 0.154.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 +42 -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/bundles.md +9 -12
- data/docs/cli.md +82 -96
- data/docs/configuration.md +27 -26
- data/docs/context.md +3 -3
- data/docs/desktop.md +1 -1
- data/docs/guardrails.md +8 -10
- data/docs/hooks.md +9 -9
- data/docs/internals/attached-context.md +2 -2
- data/docs/internals/background-tasks.md +3 -4
- data/docs/internals/block-renderers.md +4 -0
- data/docs/internals/bridge.md +21 -8
- data/docs/internals/context-telemetry.md +1 -1
- data/docs/internals/engine.md +33 -7
- data/docs/internals/objectives.md +6 -5
- data/docs/internals/participants.md +7 -7
- data/docs/internals/prompt-caching.md +4 -2
- data/docs/internals/remote-sessions.md +7 -7
- data/docs/internals/web-frontend.md +2 -2
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +2 -2
- data/docs/plugins.md +23 -28
- data/docs/sessions.md +24 -24
- data/docs/sub-agent.md +2 -2
- data/docs/system-one.md +1 -1
- data/docs/testing.md +31 -6
- data/lib/samagotchi/answer_text.rb +33 -0
- data/lib/samagotchi/bridge/card_places.rb +56 -7
- data/lib/samagotchi/bridge/card_store.rb +24 -9
- data/lib/samagotchi/bridge.rb +52 -32
- data/lib/samagotchi/bridge_client.rb +19 -14
- 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/try/trace.rb +1 -1
- data/lib/samagotchi/bundle_command.rb +2 -2
- data/lib/samagotchi/bundles/btw/manifest.yml +2 -2
- data/lib/samagotchi/bundles/btw/plugin.rb +1 -1
- data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
- data/lib/samagotchi/bundles/coordinator/plugin.rb +3 -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/github-pr/manifest.yml +2 -2
- data/lib/samagotchi/bundles/github-pr/plugin.rb +3 -3
- data/lib/samagotchi/bundles/skills/manifest.yml +2 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +3 -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/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 +3 -3
- 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 +62 -2646
- data/lib/samagotchi/engine_snapshots.rb +9 -8
- 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/hook_routes.rb +3 -3
- data/lib/samagotchi/idle_recap.rb +7 -6
- data/lib/samagotchi/idle_reminders.rb +3 -4
- data/lib/samagotchi/iteration_limit.rb +2 -2
- data/lib/samagotchi/kernel_loop.rb +13 -13
- data/lib/samagotchi/launch_mode.rb +13 -32
- data/lib/samagotchi/level_setting_command.rb +3 -2
- data/lib/samagotchi/llm/chat_loop.rb +3 -1
- data/lib/samagotchi/llm_context_command.rb +3 -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/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/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 +67 -49
- 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 +27 -7
- data/lib/samagotchi/sessions_command.rb +4 -4
- data/lib/samagotchi/share_command.rb +10 -10
- data/lib/samagotchi/steer.rb +13 -2
- data/lib/samagotchi/stream_event.rb +22 -0
- data/lib/samagotchi/system_prompt.rb +154 -145
- 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 +1 -11
- 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 +17 -22
- data/lib/samagotchi/terminal_ui/join_replay.rb +16 -12
- 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 +2 -12
- data/lib/samagotchi/terminal_ui/status_row.rb +6 -14
- data/lib/samagotchi/terminal_ui.rb +142 -1387
- data/lib/samagotchi/title_command.rb +2 -2
- data/lib/samagotchi/tool_runner.rb +15 -16
- data/lib/samagotchi/toolkit_command.rb +2 -1
- 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/send_note.rb +2 -1
- data/lib/samagotchi/turn_endings.rb +2 -2
- data/lib/samagotchi/turn_flow.rb +11 -7
- data/lib/samagotchi/update_hint.rb +2 -2
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +42 -51
- data/lib/samagotchi/web/message_display.rb +7 -0
- 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/block_host.js +35 -8
- data/lib/samagotchi/web/public/block_renderers.css +9 -5
- data/lib/samagotchi/web/public/card_stamps.js +27 -0
- data/lib/samagotchi/web/public/cards_place.js +5 -3
- 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 +1 -1
- data/lib/samagotchi/web/public/format.js +4 -3
- data/lib/samagotchi/web/public/turn_html.js +8 -4
- data/lib/samagotchi/web/push/store.rb +1 -1
- data/lib/samagotchi/web/session_access_routes.rb +13 -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 +6 -2
- data/lib/samagotchi/web/session_summary.rb +1 -1
- data/lib/samagotchi/worker.rb +103 -9
- data/lib/samagotchi/worker_link.rb +3 -3
- data/lib/samagotchi/working_set_command.rb +3 -2
- data/lib/samagotchi.rb +0 -1
- metadata +31 -7
- data/lib/samagotchi/pending_input_queue.rb +0 -55
- 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,16 +39,11 @@ 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
|
-
# Called with no arguments for each key a read takes (typing is
|
|
48
|
-
# activity for the REPL's idle clock).
|
|
49
|
-
# @return [#call, nil]
|
|
50
|
-
attr_accessor :key_handler
|
|
51
|
-
|
|
52
47
|
# @return [Boolean] a Reline read is open (it owns stdin)
|
|
53
48
|
def reading? = @reading == true
|
|
54
49
|
|
|
@@ -150,11 +145,6 @@ module Samagotchi
|
|
|
150
145
|
@rendered_screen.base_y = 0 if RelineSeam.screen
|
|
151
146
|
end
|
|
152
147
|
|
|
153
|
-
def update(key)
|
|
154
|
-
RelineSeam.key_handler&.call
|
|
155
|
-
super
|
|
156
|
-
end
|
|
157
|
-
|
|
158
148
|
def screen_height
|
|
159
149
|
screen = RelineSeam.screen
|
|
160
150
|
screen ? [super, screen.editor_budget].min : super
|
|
@@ -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,13 +54,6 @@ module Samagotchi
|
|
|
54
54
|
@shown = nil
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
# The surface it draws on (the REPL swaps in a live region): the row
|
|
58
|
-
# is drawn there at the next change.
|
|
59
|
-
def surface=(surface)
|
|
60
|
-
@surface = surface
|
|
61
|
-
@shown = nil
|
|
62
|
-
end
|
|
63
|
-
|
|
64
57
|
def [](field) = @values[field]
|
|
65
58
|
|
|
66
59
|
# Change some fields; the row is redrawn when its text changed.
|
|
@@ -72,8 +65,8 @@ module Samagotchi
|
|
|
72
65
|
refresh
|
|
73
66
|
end
|
|
74
67
|
|
|
75
|
-
# Take a session's state: the
|
|
76
|
-
#
|
|
68
|
+
# Take a session's state: the one a worker sends an attached TUI when
|
|
69
|
+
# it joins (Engine#session_state_snapshot). A key the state
|
|
77
70
|
# lacks (an older worker's) leaves its field as it was; the served pair
|
|
78
71
|
# is cleared without one, and the model is kept without a name.
|
|
79
72
|
# @param default_model [String, nil] the config's default, named beside
|
|
@@ -94,8 +87,7 @@ module Samagotchi
|
|
|
94
87
|
STATE_LISTS = { used_memories: :used_memory_names, preloaded: :preloaded_memory_names,
|
|
95
88
|
muted: :muted_memory_names }.freeze
|
|
96
89
|
|
|
97
|
-
# Take what a turn event says about the row (the
|
|
98
|
-
# the REPL, the Bridge's in attached mode): ctx, the memories used,
|
|
90
|
+
# Take what a turn event says about the row (the Bridge's events): ctx, the memories used,
|
|
99
91
|
# the model the server served, whether a turn runs (the steer
|
|
100
92
|
# hint). Other events change nothing.
|
|
101
93
|
def take_event(event)
|
|
@@ -178,7 +170,7 @@ module Samagotchi
|
|
|
178
170
|
end
|
|
179
171
|
|
|
180
172
|
# `⑂ 2 running · 1 waiting`, the counts there are; "" with neither (no
|
|
181
|
-
# children, or all ended). Not "not reported": a
|
|
173
|
+
# children, or all ended). Not "not reported": a one-shot parent is never
|
|
182
174
|
# given its children's replies (no wakes there), and a worker moves
|
|
183
175
|
# the cursors only after the turn_completed a terminal refreshes on.
|
|
184
176
|
def children_text(counts)
|