samagotchi 0.162.0 → 0.164.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 +42 -1
- data/docs/architecture.md +2 -2
- data/docs/bundles.md +4 -2
- data/docs/cli.md +7 -2
- data/docs/configuration.md +1 -1
- data/docs/internals/block-renderers.md +3 -1
- data/docs/internals/bridge.md +37 -24
- data/docs/internals/inline-widgets.md +5 -2
- data/docs/internals/remote-sessions.md +7 -2
- data/docs/internals/web-frontend.md +1 -1
- data/docs/memory.md +8 -2
- data/docs/sessions.md +3 -2
- data/docs/sub-agent.md +11 -0
- data/docs/testing.md +8 -2
- data/lib/samagotchi/block_renderers.rb +14 -4
- data/lib/samagotchi/bridge/turn_drawings/synth.rb +7 -3
- data/lib/samagotchi/bridge/turn_drawings.rb +45 -30
- data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
- data/lib/samagotchi/bundles/inline-widgets/plugin.rb +8 -4
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/cli/parent_wait.rb +5 -1
- data/lib/samagotchi/continue_intent.rb +48 -0
- data/lib/samagotchi/message_parts.rb +13 -0
- data/lib/samagotchi/note_command.rb +3 -6
- data/lib/samagotchi/parent_report.rb +3 -2
- data/lib/samagotchi/project_command.rb +74 -6
- data/lib/samagotchi/project_subfolders.rb +188 -0
- data/lib/samagotchi/send_command/parent_gate.rb +8 -5
- data/lib/samagotchi/send_command.rb +139 -34
- data/lib/samagotchi/session_access/local.rb +6 -0
- data/lib/samagotchi/session_access/remote.rb +25 -0
- data/lib/samagotchi/session_continue.rb +5 -3
- data/lib/samagotchi/session_inbox_delivery.rb +54 -7
- data/lib/samagotchi/session_manager/delivery.rb +3 -1
- data/lib/samagotchi/terminal_ui/join_replay.rb +2 -2
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/message_display.rb +45 -36
- data/lib/samagotchi/web/public/app.js +8 -7
- data/lib/samagotchi/web/public/apple-touch-icon.png +0 -0
- data/lib/samagotchi/web/public/data.js +4 -6
- data/lib/samagotchi/web/public/favicon.svg +1 -1
- data/lib/samagotchi/web/public/icons/chi-180.png +0 -0
- data/lib/samagotchi/web/public/icons/chi-192.png +0 -0
- data/lib/samagotchi/web/public/icons/chi-512.png +0 -0
- data/lib/samagotchi/web/public/inline_widgets.js +4 -1
- data/lib/samagotchi/web/public/reload_check.js +7 -4
- data/lib/samagotchi/web/public/time_gaps.js +1 -2
- data/lib/samagotchi/web/public/timing.js +49 -224
- data/lib/samagotchi/web/public/turn_block.js +40 -122
- data/lib/samagotchi/web/public/turn_html.js +3 -2
- data/lib/samagotchi/web/public/widget_walk.js +14 -4
- data/lib/samagotchi/web/reload_check_route.rb +6 -3
- data/lib/samagotchi/web/session_access_routes.rb +8 -1
- data/lib/samagotchi/web/session_show.rb +8 -24
- metadata +3 -1
|
@@ -76,12 +76,19 @@ module Samagotchi
|
|
|
76
76
|
# GET /api/sessions/resolve?id=PREFIX: the full id of the session an id
|
|
77
77
|
# or a unique prefix names (SessionAccess::Local#resolve). 200 {id};
|
|
78
78
|
# 404 not_found; 400 ambiguous_id with ids (the sessions it names).
|
|
79
|
+
# With head=1 (the owner's alone: a participant's answer stays {id}),
|
|
80
|
+
# where input for it goes (SessionAccess::Local#head): 200 {id, asked,
|
|
81
|
+
# via}, id the chain's newest link of a continued one.
|
|
79
82
|
def handle_resolve(req)
|
|
80
83
|
given = req.params["id"].to_s
|
|
81
84
|
return session_not_found(given) unless Session.valid_id?(given)
|
|
82
85
|
return participant_resolve(principal(req).grant, given) unless principal(req).owner?
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
id = session_access.resolve(given)
|
|
88
|
+
return json_response(200, { id: id }) unless truthy_param?(req.params["head"])
|
|
89
|
+
|
|
90
|
+
head = session_access.head(id)
|
|
91
|
+
json_response(200, { id: head.id, asked: head.asked, via: head.via.to_s })
|
|
85
92
|
rescue Session::AmbiguousId => e
|
|
86
93
|
refusal_response(400, "ambiguous_id", e, ids: e.ids)
|
|
87
94
|
rescue ArgumentError # NotFound, a file that won't load
|
|
@@ -69,22 +69,13 @@ module Samagotchi
|
|
|
69
69
|
session_json = shown_session_json(session, snapshot, owner, persisted)
|
|
70
70
|
raw_messages = live_or_saved(turn_snapshot, "messages") { session.messages }
|
|
71
71
|
timing = timing_payload(id, live_metrics: snapshot && snapshot["metrics"], persisted: persisted)
|
|
72
|
-
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
# parts. An older page (no drawings=1) reads what it always did.
|
|
76
|
-
# A live worker from before turn drawings lists no of_turn on its
|
|
77
|
-
# cards: its turns all draw as before.
|
|
78
|
-
drawings = parts && req.params["drawings"] == "1" && (!live || worker_draws?(id))
|
|
72
|
+
# Every finished turn is drawn from a line (a real one, else one
|
|
73
|
+
# made from its messages): its items are stamped, and its drawing
|
|
74
|
+
# goes in turn_drawings. The running turn has none yet.
|
|
79
75
|
raw_cards = live_or_saved(turn_snapshot, "cards") { saved_cards(id, messages: raw_messages) }
|
|
80
|
-
drawn =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
else
|
|
84
|
-
[]
|
|
85
|
-
end
|
|
86
|
-
messages = messages_for_display(raw_messages, parts: parts, cwd: session.working_directory,
|
|
87
|
-
drawings: drawn, strip_drawn: true)
|
|
76
|
+
drawn = drawn_lines(id, raw_messages, timing: timing, entries: raw_cards, cwd: session.working_directory,
|
|
77
|
+
skip_turn_id: current_turn.is_a?(Hash) ? current_turn["turn_id"] : nil)
|
|
78
|
+
messages = messages_for_display(raw_messages, cwd: session.working_directory, drawings: drawn)
|
|
88
79
|
json_response(200, {
|
|
89
80
|
session: session_json,
|
|
90
81
|
history: read_history(id),
|
|
@@ -145,21 +136,14 @@ module Samagotchi
|
|
|
145
136
|
started_at: active.is_a?(Hash) ? active["started_at"] : nil)
|
|
146
137
|
end
|
|
147
138
|
|
|
148
|
-
# Whether the session's live worker names turn drawings in its
|
|
149
|
-
# sidecar's features (Bridge::TurnDrawings::FEATURE); false when its
|
|
150
|
-
# link can't be read as live.
|
|
151
|
-
def worker_draws?(id)
|
|
152
|
-
link = worker_link(id)
|
|
153
|
-
link.live? && Array(link.sidecar.features).include?(Bridge::TurnDrawings::FEATURE)
|
|
154
|
-
end
|
|
155
|
-
|
|
156
139
|
# The lines the show draws +messages+' turns from (the live snapshot's
|
|
157
140
|
# messages, else the file's), one per finished turn:
|
|
158
141
|
# Bridge::TurnDrawings.cover over the session's file (.read, cached by
|
|
159
142
|
# its size and mtime), the turns no line covers made from their
|
|
160
143
|
# messages with the show's +timing+ records and CardStore +entries+.
|
|
161
144
|
# A file that can't be read gives no lines: every turn is made. Should
|
|
162
|
-
# the cover itself fail,
|
|
145
|
+
# the cover itself fail, no turn has a line: the page draws each item
|
|
146
|
+
# as a plain row (turn_block.js, the fallback).
|
|
163
147
|
def drawn_lines(id, messages, timing:, entries:, cwd:, skip_turn_id:)
|
|
164
148
|
dir = @session_class.session_dir(id, state_dir: default_state_dir)
|
|
165
149
|
lines = Degrade.call(:web, "turn_drawings_unreadable", fallback: []) { Bridge::TurnDrawings.read(dir) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: samagotchi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.164.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -341,6 +341,7 @@ files:
|
|
|
341
341
|
- lib/samagotchi/context_status.rb
|
|
342
342
|
- lib/samagotchi/context_usage.rb
|
|
343
343
|
- lib/samagotchi/context_window.rb
|
|
344
|
+
- lib/samagotchi/continue_intent.rb
|
|
344
345
|
- lib/samagotchi/continue_offer.rb
|
|
345
346
|
- lib/samagotchi/cut.rb
|
|
346
347
|
- lib/samagotchi/cut_policy.rb
|
|
@@ -604,6 +605,7 @@ files:
|
|
|
604
605
|
- lib/samagotchi/project_id_clash.rb
|
|
605
606
|
- lib/samagotchi/project_init.rb
|
|
606
607
|
- lib/samagotchi/project_scope.rb
|
|
608
|
+
- lib/samagotchi/project_subfolders.rb
|
|
607
609
|
- lib/samagotchi/prompt.rb
|
|
608
610
|
- lib/samagotchi/prompt_files.rb
|
|
609
611
|
- lib/samagotchi/prompt_history.rb
|