samagotchi 0.187.0 → 0.188.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 +55 -1
- data/bin/chi +2 -0
- data/docs/architecture.md +8 -4
- data/docs/bundles.md +124 -120
- data/docs/cli.md +25 -5
- data/docs/configuration.md +4 -4
- data/docs/context.md +18 -162
- data/docs/guardrails.md +3 -1
- data/docs/hooks.md +2 -1
- data/docs/internals/attached-context.md +19 -37
- data/docs/internals/bridge.md +1 -0
- data/docs/internals/engine.md +2 -2
- data/docs/internals/llm-context-forget.md +5 -6
- data/docs/internals/objectives.md +1 -0
- data/docs/internals/pages.md +6 -3
- data/docs/internals/peers.md +149 -0
- data/docs/internals/remote-sessions.md +7 -4
- data/docs/internals/web-frontend.md +61 -37
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +1 -1
- data/docs/pages.md +2 -1
- data/docs/peers.md +141 -0
- data/docs/plugins.md +52 -27
- data/docs/sessions.md +8 -4
- data/docs/sub-agent.md +5 -5
- data/lib/samagotchi/bridge.rb +3 -3
- data/lib/samagotchi/bundle_command/api_calls.rb +2 -1
- data/lib/samagotchi/bundle_command/check.rb +1 -1
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +11 -18
- data/lib/samagotchi/bundles/claude-peer/plugin.rb +22 -16
- data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +48 -39
- data/lib/samagotchi/bundles/claude-peer/scripts/pair +15 -73
- data/lib/samagotchi/bundles/claude-peer/skill_claude_peer.md +16 -16
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +11 -15
- data/lib/samagotchi/bundles/codex-peer/plugin.rb +35 -24
- data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +51 -40
- data/lib/samagotchi/bundles/codex-peer/scripts/pair +18 -54
- data/lib/samagotchi/bundles/codex-peer/skill_codex_peer.md +16 -16
- data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
- data/lib/samagotchi/bundles/skills/manifest.yml +2 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +14 -8
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/client_id.rb +15 -1
- data/lib/samagotchi/config.rb +8 -7
- data/lib/samagotchi/context_absorber.rb +23 -277
- data/lib/samagotchi/context_sources.rb +17 -69
- data/lib/samagotchi/engine/messages.rb +12 -1
- data/lib/samagotchi/engine/plugins.rb +1 -1
- data/lib/samagotchi/engine.rb +7 -6
- data/lib/samagotchi/engine_peers.rb +0 -3
- data/lib/samagotchi/guardrail_wiring.rb +2 -0
- data/lib/samagotchi/guardrails/chi_dirs.rb +4 -3
- data/lib/samagotchi/guardrails/parent_approvals.rb +6 -5
- data/lib/samagotchi/guardrails/protected_paths.rb +6 -3
- data/lib/samagotchi/inline_widgets.rb +11 -3
- data/lib/samagotchi/log_line.rb +1 -1
- data/lib/samagotchi/note_move.rb +3 -1
- data/lib/samagotchi/page_command.rb +18 -9
- data/lib/samagotchi/pages/builder.rb +7 -8
- data/lib/samagotchi/pages/launch.rb +8 -2
- data/lib/samagotchi/pages/store.rb +11 -2
- data/lib/samagotchi/peer_command.rb +192 -0
- data/lib/samagotchi/peer_continue.rb +99 -0
- data/lib/samagotchi/peer_exchanges.rb +3 -3
- data/lib/samagotchi/peer_mailbox.rb +360 -0
- data/lib/samagotchi/peer_note.rb +208 -0
- data/lib/samagotchi/peer_receipts.rb +247 -0
- data/lib/samagotchi/peer_registry.rb +44 -0
- data/lib/samagotchi/peer_roster.rb +79 -0
- data/lib/samagotchi/peer_say.rb +168 -0
- data/lib/samagotchi/plugin/api.rb +29 -21
- data/lib/samagotchi/plugin/context.rb +7 -0
- data/lib/samagotchi/plugin/loader.rb +3 -3
- data/lib/samagotchi/plugin/peer.rb +175 -64
- data/lib/samagotchi/plugin/peers.rb +70 -0
- data/lib/samagotchi/run_options.rb +2 -1
- data/lib/samagotchi/schedule_command.rb +10 -3
- data/lib/samagotchi/schedule_display.rb +32 -0
- data/lib/samagotchi/session_access/contract.rb +18 -1
- data/lib/samagotchi/session_access/local.rb +132 -14
- data/lib/samagotchi/session_access/remote.rb +4 -2
- data/lib/samagotchi/session_access/remote_peers.rb +75 -0
- data/lib/samagotchi/session_continue.rb +12 -0
- data/lib/samagotchi/session_inbox_delivery.rb +5 -2
- data/lib/samagotchi/session_manager/delivery.rb +5 -3
- data/lib/samagotchi/session_manager/removal.rb +2 -0
- data/lib/samagotchi/session_manager/spawn.rb +2 -1
- data/lib/samagotchi/session_manager.rb +1 -0
- data/lib/samagotchi/session_stores.rb +17 -0
- data/lib/samagotchi/steer.rb +1 -1
- data/lib/samagotchi/system_prompt.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop.rb +1 -1
- data/lib/samagotchi/terminal_ui/formatting.rb +4 -1
- data/lib/samagotchi/testing/boundary.rb +4 -13
- data/lib/samagotchi/testing/bundle.rb +40 -5
- data/lib/samagotchi/testing/install.rb +4 -4
- data/lib/samagotchi/testing/recording_api.rb +2 -1
- data/lib/samagotchi/tools/context_read.rb +0 -14
- data/lib/samagotchi/tools/list_schedules.rb +8 -3
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +2 -13
- data/lib/samagotchi/web/message_display.rb +4 -2
- data/lib/samagotchi/web/peer_routes.rb +133 -0
- data/lib/samagotchi/web/public/app.js +11 -11
- data/lib/samagotchi/web/public/bubbles.js +2 -2
- data/lib/samagotchi/web/public/cards_place.js +20 -1
- data/lib/samagotchi/web/public/context_chips.js +45 -46
- data/lib/samagotchi/web/public/history_reveal.js +4 -1
- data/lib/samagotchi/web/public/history_shape.js +3 -2
- data/lib/samagotchi/web/public/index.html +13 -0
- data/lib/samagotchi/web/public/notify.js +1 -1
- data/lib/samagotchi/web/public/page_view.js +2 -1
- data/lib/samagotchi/web/public/peer_chip.js +60 -74
- data/lib/samagotchi/web/public/peer_data.js +13 -11
- data/lib/samagotchi/web/public/peer_links.js +12 -7
- data/lib/samagotchi/web/public/peer_mailbox_api.js +20 -0
- data/lib/samagotchi/web/public/peer_note.js +7 -3
- data/lib/samagotchi/web/public/peer_text.js +4 -4
- data/lib/samagotchi/web/public/quiet_notes.js +199 -0
- data/lib/samagotchi/web/public/revise_stack.js +4 -3
- data/lib/samagotchi/web/public/session_view.js +2 -2
- data/lib/samagotchi/web/public/stream_handlers.js +3 -2
- data/lib/samagotchi/web/public/turn_block.js +7 -3
- data/lib/samagotchi/web/public/turn_events.js +6 -0
- data/lib/samagotchi/web/push/attention.rb +3 -2
- data/lib/samagotchi/web/session_access_routes.rb +3 -20
- data/lib/samagotchi/worker/leave.rb +3 -0
- data/lib/samagotchi/worker/mail.rb +73 -0
- data/lib/samagotchi/worker/startup.rb +3 -0
- data/lib/samagotchi/worker/wake_turns.rb +20 -5
- data/lib/samagotchi/worker.rb +12 -6
- data/lib/samagotchi/worker_inbound/mail.rb +214 -0
- data/lib/samagotchi/worker_inbound.rb +43 -46
- data/lib/samagotchi/worker_wakes.rb +26 -21
- metadata +19 -2
- data/lib/samagotchi/peer_sources.rb +0 -58
|
@@ -61,9 +61,6 @@ module Samagotchi
|
|
|
61
61
|
@attached = ContextSources.attached(peers.session_id, project_root: root, project_id: id, state_dir: @state_dir)
|
|
62
62
|
@max_chars = [max_chars.to_i, MIN_CHARS].max
|
|
63
63
|
@now = now
|
|
64
|
-
# The peer bundles' declared sources (PeerSources), through the
|
|
65
|
-
# Engine's PeerView.
|
|
66
|
-
@peer_label = peers.respond_to?(:peer_label) ? peers.method(:peer_label) : nil
|
|
67
64
|
end
|
|
68
65
|
|
|
69
66
|
def run(name, offset:, limit:)
|
|
@@ -131,23 +128,12 @@ module Samagotchi
|
|
|
131
128
|
hint = snapshot.hint || source.hint
|
|
132
129
|
header = ["#{source.name}#{" (#{hint})" if hint}"]
|
|
133
130
|
header << "Why: #{source.why}" if source.why
|
|
134
|
-
if (peer = peer_label(attached))
|
|
135
|
-
header << "Peer: your peer agent #{peer}'s answers (its text, not your user's words)"
|
|
136
|
-
end
|
|
137
131
|
header << "Fetched: #{clock(snapshot.fetched_at)} (#{age(snapshot.fetched_at)})" if snapshot.fetched_at
|
|
138
132
|
header << "Summary: #{snapshot.summary}" if snapshot.summary
|
|
139
133
|
header << "Last refresh failed: #{snapshot.error}" if snapshot.error
|
|
140
134
|
header
|
|
141
135
|
end
|
|
142
136
|
|
|
143
|
-
# A pushed source of the session's own that a peer bundle declared
|
|
144
|
-
# (ContextAbsorber#peer_label's rule).
|
|
145
|
-
def peer_label(attached)
|
|
146
|
-
return nil unless @peer_label && attached.source.push? && attached.location.session?
|
|
147
|
-
|
|
148
|
-
@peer_label.call(attached.name)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
137
|
# What the output takes besides the page: the kernel's prefix, the
|
|
152
138
|
# header, its paging line at its longest (every number +count+) and
|
|
153
139
|
# the separator.
|
|
@@ -4,7 +4,8 @@ require_relative "../tool_names"
|
|
|
4
4
|
|
|
5
5
|
module Samagotchi
|
|
6
6
|
module Tools
|
|
7
|
-
# The durable schedules of this session's chain (docs/scheduling.md):
|
|
7
|
+
# The durable schedules of this session's chain (docs/scheduling.md): each
|
|
8
|
+
# line names the schedule (its title, or the start of its prompt), then its
|
|
8
9
|
# mode, recurrence, next due and target. Another session's schedules are
|
|
9
10
|
# out of reach unless the call says `all: true`; `chi schedule list` is the
|
|
10
11
|
# machine-wide view. Schedules is required inside the call, so the testing
|
|
@@ -16,8 +17,11 @@ module Samagotchi
|
|
|
16
17
|
|
|
17
18
|
def self.call(_content, include_disabled: false, all: false, peers: nil)
|
|
18
19
|
# Required here, not at the top of the file: the kit does not pay
|
|
19
|
-
# for the session lifecycle until a schedule is actually used
|
|
20
|
+
# for the session lifecycle until a schedule is actually used
|
|
21
|
+
# (spec/samagotchi/testing/sandbox_spec.rb counts the chi files the
|
|
22
|
+
# kit loads, and schedule_display joins the same require).
|
|
20
23
|
require_relative "../schedules"
|
|
24
|
+
require_relative "../schedule_display"
|
|
21
25
|
wanted = include_disabled == true || include_disabled.to_s.strip.casecmp?("true")
|
|
22
26
|
want_all = all == true || all.to_s.strip.casecmp?("true")
|
|
23
27
|
schedules = Samagotchi::Schedules.new(state_dir: peers&.state_dir)
|
|
@@ -32,7 +36,8 @@ module Samagotchi
|
|
|
32
36
|
flags = []
|
|
33
37
|
flags << "skips #{entry.skips} of #{entry.max_skips}" if entry.skips.positive?
|
|
34
38
|
flags << "disabled after #{entry.failures} failures" unless entry.enabled
|
|
35
|
-
"#{entry.id} #{entry
|
|
39
|
+
"#{entry.id} #{ScheduleDisplay.name(entry)} #{entry.target_words} #{entry.recurrence_words} " \
|
|
40
|
+
"next #{entry.next_due} #{flags.join(", ")}".rstrip
|
|
36
41
|
end
|
|
37
42
|
lines << "These are this session's chain only; `chi schedule list` shows every schedule on this machine." if scoped
|
|
38
43
|
lines.join("\n")
|
data/lib/samagotchi/version.rb
CHANGED
data/lib/samagotchi/web/app.rb
CHANGED
|
@@ -339,7 +339,7 @@ module Samagotchi
|
|
|
339
339
|
["POST", %r{\A/api/sessions/([^/]+)/images\z}, :handle_image_upload, :participant, :session],
|
|
340
340
|
["GET", %r{\A/api/sessions/([^/]+)/images/([^/]+)\z}, :handle_image, :participant, :session],
|
|
341
341
|
["GET", %r{\A/api/sessions/([^/]+)/context\z}, :handle_context_list, :owner, :session],
|
|
342
|
-
|
|
342
|
+
*PeerRoutes::ROUTES,
|
|
343
343
|
["GET", %r{\A/api/sessions/([^/]+)/context/([^/]+)\z}, :handle_context_show, :owner, :session],
|
|
344
344
|
["POST", %r{\A/api/sessions/([^/]+)/context\z}, :handle_context_add, :owner, :session],
|
|
345
345
|
["POST", %r{\A/api/sessions/([^/]+)/context/([^/]+)/push\z}, :handle_context_push, :owner, :session],
|
|
@@ -1126,7 +1126,7 @@ module Samagotchi
|
|
|
1126
1126
|
# delegates: chi --remote sessions delete --dry-run asks for this first.
|
|
1127
1127
|
DELETE_PLAN_FEATURE = "delete_plan_all"
|
|
1128
1128
|
INFO_FEATURES = ["dir", "newest_workers", SessionAccessRoutes::FEATURE, SessionAccessRoutes::ATTACH_FEATURE,
|
|
1129
|
-
BOUND_FEATURE, CHAIN_DELETE_FEATURE, STOP_TASKS_FEATURE, DELETE_PLAN_FEATURE, ASK_FEATURE, McpRoute::FEATURE, Delivery::AGENT_FEATURE, ReplyFor::FEATURE].freeze
|
|
1129
|
+
BOUND_FEATURE, CHAIN_DELETE_FEATURE, STOP_TASKS_FEATURE, DELETE_PLAN_FEATURE, ASK_FEATURE, McpRoute::FEATURE, Delivery::AGENT_FEATURE, ReplyFor::FEATURE, PeerMailbox::FEATURE].freeze
|
|
1130
1130
|
|
|
1131
1131
|
# The models a new session can start on, spelled as chi spells them
|
|
1132
1132
|
# elsewhere: bare for the default host (what default.model holds), and
|
|
@@ -1595,22 +1595,11 @@ module Samagotchi
|
|
|
1595
1595
|
why: source.why, hint: snapshot.hint || source.hint, summary: snapshot.summary, error: snapshot.error,
|
|
1596
1596
|
fetched_at: snapshot.fetched_at, has_text: snapshot.text?, muted: own.muted?(source.name),
|
|
1597
1597
|
unread: snapshot.text? && subs[source.name]&.read != snapshot.revision }
|
|
1598
|
-
row.merge!(context_peer(attached))
|
|
1599
1598
|
return row unless full
|
|
1600
1599
|
|
|
1601
1600
|
row.merge(source: source.to_h, snapshot: snapshot.to_h.except("text", :text), shadowed: attached.shadowed)
|
|
1602
1601
|
end
|
|
1603
1602
|
|
|
1604
|
-
# A pushed session source named <peer>-inbox / -outbox: the pairing's
|
|
1605
|
-
# peer ("claude"), its leg and label, by name (docs/context.md, Peer
|
|
1606
|
-
# sources); {} for any other.
|
|
1607
|
-
def context_peer(attached)
|
|
1608
|
-
return {} unless attached.source.push? && attached.location.session?
|
|
1609
|
-
|
|
1610
|
-
peer, leg = ContextSources.peer_leg(attached.name)
|
|
1611
|
-
peer ? { peer: peer, leg: leg, label: ContextSources.peer_label(peer) } : {}
|
|
1612
|
-
end
|
|
1613
|
-
|
|
1614
1603
|
def handle_stream(req, id)
|
|
1615
1604
|
# Validate session exists
|
|
1616
1605
|
begin
|
|
@@ -4,7 +4,7 @@ require_relative "../session"
|
|
|
4
4
|
require_relative "../answer_refs"
|
|
5
5
|
require_relative "../answer_tail"
|
|
6
6
|
require_relative "../block_fix/stamp"
|
|
7
|
-
require_relative "../
|
|
7
|
+
require_relative "../peer_note"
|
|
8
8
|
require_relative "../context_note"
|
|
9
9
|
require_relative "../image_store"
|
|
10
10
|
require_relative "../message_parts"
|
|
@@ -180,6 +180,8 @@ module Samagotchi
|
|
|
180
180
|
next unless %w[user assistant].include?(norm_role)
|
|
181
181
|
|
|
182
182
|
message = { role: norm_role, content: stripped, **time_of(m) }
|
|
183
|
+
client_id = m[:client_id] || m["client_id"]
|
|
184
|
+
message[:client_id] = client_id.to_s if norm_role == "user" && client_id
|
|
183
185
|
# Merged into the running turn (Steer::INPUT_KIND): part of it,
|
|
184
186
|
# read by step +step+; a wake turn's report starts its turn
|
|
185
187
|
# (Steer.turn_prompt?). Its sender (a delegate report, chi send):
|
|
@@ -254,7 +256,7 @@ module Samagotchi
|
|
|
254
256
|
def peer_text_html(peer, content)
|
|
255
257
|
return nil unless peer.is_a?(Hash) && (peer["inline"] || peer[:inline]) && @markdown_renderer.available?
|
|
256
258
|
|
|
257
|
-
text = Samagotchi::
|
|
259
|
+
text = Samagotchi::PeerNote.text_of(content)
|
|
258
260
|
text && @markdown_renderer.render(text)
|
|
259
261
|
end
|
|
260
262
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "../peer_exchanges"
|
|
5
|
+
require_relative "../peer_mailbox"
|
|
6
|
+
require_relative "../peer_roster"
|
|
7
|
+
require_relative "../peer_say"
|
|
8
|
+
require_relative "request_body"
|
|
9
|
+
|
|
10
|
+
module Samagotchi
|
|
11
|
+
module Web
|
|
12
|
+
# A session's peers, mixed into App, all the owner's: the peers model
|
|
13
|
+
# from the two stores without a worker (GET …/peers), one message's
|
|
14
|
+
# text, Unpair, and a remote's pair and say (SessionAccess::RemotePeers:
|
|
15
|
+
# the say waits here). See docs/internals/peers.md.
|
|
16
|
+
module PeerRoutes
|
|
17
|
+
ROUTES = [
|
|
18
|
+
["GET", %r{\A/api/sessions/([^/]+)/peers\z}, :handle_peers, :owner, :session],
|
|
19
|
+
["GET", %r{\A/api/sessions/([^/]+)/peers/([^/]+)/messages/([^/]+)\z}, :handle_peer_message, :owner, :session],
|
|
20
|
+
["DELETE", %r{\A/api/sessions/([^/]+)/peers/([^/]+)\z}, :handle_peer_unpair, :owner, :session],
|
|
21
|
+
["POST", %r{\A/api/sessions/([^/]+)/peers/([^/]+)/pair\z}, :handle_peer_pair, :owner, :session],
|
|
22
|
+
["POST", %r{\A/api/sessions/([^/]+)/peers/([^/]+)/say\z}, :handle_peer_say, :owner, :session]
|
|
23
|
+
].freeze
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
# GET /api/sessions/:id/peers → {peers: [{name, label, paired_at, from,
|
|
28
|
+
# address, can_send, messages, exchanges}]}: a row per peer with a
|
|
29
|
+
# mailbox folder (the peer chip's only feed). +exchanges+ joins chi's
|
|
30
|
+
# sends (peer_exchanges.jsonl) with the answers: the log's (an older
|
|
31
|
+
# pairing's) and the mailbox's messages (PeerExchanges.joined,
|
|
32
|
+
# unchanged). +messages+: the newest (PeerRoster), with their receipts
|
|
33
|
+
# and the receipt in chi's words (+words+: PeerRoster.state_words,
|
|
34
|
+
# "held · peer turns"); no text anywhere.
|
|
35
|
+
def handle_peers(_req, id)
|
|
36
|
+
@session_class.load(id, state_dir: default_state_dir)
|
|
37
|
+
entries = PeerExchanges.read(id, state_dir: default_state_dir).group_by { |entry| entry["peer"] }
|
|
38
|
+
rows = {}
|
|
39
|
+
entries.each_key { |name| rows[name] ||= peer_row(name) }
|
|
40
|
+
PeerRoster.build(id, state_dir: default_state_dir).each do |peer|
|
|
41
|
+
row = (rows[peer.name] ||= peer_row(peer.name))
|
|
42
|
+
row.merge!(paired_at: peer.paired_at, from: peer.from, address: peer.address,
|
|
43
|
+
can_send: peer.paired? && !peer.address.nil?,
|
|
44
|
+
messages: peer.messages.map { |message| message.to_h.merge("words" => PeerRoster.state_words(message.receipt)) })
|
|
45
|
+
(entries[peer.name] ||= []).concat(answer_entries(peer))
|
|
46
|
+
end
|
|
47
|
+
rows.each_value { |row| row[:exchanges] = PeerExchanges.joined(entries.fetch(row[:name], [])) }
|
|
48
|
+
json_response(200, { peers: rows.values })
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def peer_row(peer)
|
|
52
|
+
{ name: peer, label: PeerMailbox.label(peer), paired_at: nil, from: nil, address: nil, can_send: false, messages: [] }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# A peer's mailbox messages as the exchange log's answer lines.
|
|
56
|
+
def answer_entries(peer)
|
|
57
|
+
peer.messages.reverse.map do |row|
|
|
58
|
+
{ "t" => "answer", "peer" => peer.name, "re" => row.re, "summary" => row.summary, "serial" => row.serial,
|
|
59
|
+
"wake" => row.wake, "at" => row.at }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# GET /api/sessions/:id/peers/:name/messages/:serial → the message
|
|
64
|
+
# (its text) and its receipt; 404 no_message.
|
|
65
|
+
def handle_peer_message(req, id, name, serial)
|
|
66
|
+
@session_class.load(id, state_dir: default_state_dir)
|
|
67
|
+
return invalid_peer(name) unless PeerMailbox.valid_name?(name)
|
|
68
|
+
|
|
69
|
+
box = req.GET["box"].to_s
|
|
70
|
+
expected = PeerReceipts.read(id, state_dir: default_state_dir).peer(name).box
|
|
71
|
+
return error_response(409, "wrong_box", "this message belongs to another session") if !box.empty? && expected != box
|
|
72
|
+
|
|
73
|
+
message = PeerMailbox.message(id, name, serial, state_dir: default_state_dir)
|
|
74
|
+
return error_response(404, "no_message", "no message #{serial.to_s[0, 20]} from #{name}") unless message
|
|
75
|
+
|
|
76
|
+
receipt = PeerReceipts.receipt(id, name, message.serial, state_dir: default_state_dir)
|
|
77
|
+
json_response(200, message.to_h.merge("receipt" => receipt&.to_h))
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# DELETE /api/sessions/:id/peers/:name (Unpair) → {unpaired: whether
|
|
81
|
+
# there was a pairing}; the messages stay.
|
|
82
|
+
def handle_peer_unpair(_req, id, name)
|
|
83
|
+
@session_class.load(id, state_dir: default_state_dir)
|
|
84
|
+
return invalid_peer(name) unless PeerMailbox.valid_name?(name)
|
|
85
|
+
|
|
86
|
+
json_response(200, { unpaired: session_access.peer_unpair(id, name) })
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# POST /api/sessions/:id/peers/:name/pair {address, from} → 200
|
|
90
|
+
# {status: "paired", link}; 409 {status: continued (next_id) |
|
|
91
|
+
# old_worker, detail}.
|
|
92
|
+
def handle_peer_pair(req, id, name)
|
|
93
|
+
body = body_hash(req, RequestBody::CONTEXT_PUSH_BODY_LIMIT) or return error_response(400, "invalid_json", "invalid JSON body")
|
|
94
|
+
return invalid_peer(name) unless PeerMailbox.valid_name?(name)
|
|
95
|
+
|
|
96
|
+
address, from = body.values_at("address", "from")
|
|
97
|
+
unless [address, from].all? { |value| value.nil? || value.is_a?(String) }
|
|
98
|
+
return error_response(400, "invalid_fields", "address and from are strings")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
paired = session_access.peer_pair(id, name, address: address, from: from)
|
|
102
|
+
return json_response(200, { status: "paired", link: paired.link.to_h }) if paired.status == :paired
|
|
103
|
+
|
|
104
|
+
json_response(409, { status: paired.status.to_s, next_id: paired.next_id, detail: paired.refusal }.compact)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# POST /api/sessions/:id/peers/:name/say {text, summary, wake, re,
|
|
108
|
+
# wait} → 200 PeerSay (and its line) once the receipt came or the
|
|
109
|
+
# wait (at most PeerSay::WAIT_MAX) ran out; 409 a refused say, the
|
|
110
|
+
# same shape; 400 a bad name, text or wait.
|
|
111
|
+
def handle_peer_say(req, id, name)
|
|
112
|
+
body = body_hash(req, RequestBody::CONTEXT_PUSH_BODY_LIMIT) or return error_response(400, "invalid_json", "invalid JSON body")
|
|
113
|
+
return invalid_peer(name) unless PeerMailbox.valid_name?(name)
|
|
114
|
+
return error_response(400, "missing_fields", "text is required") unless body["text"].is_a?(String)
|
|
115
|
+
|
|
116
|
+
wait = body["wait"] || 0
|
|
117
|
+
unless wait.is_a?(Numeric) && wait.between?(0, PeerSay::WAIT_MAX)
|
|
118
|
+
return error_response(400, "invalid_wait", "wait takes seconds from 0 to #{PeerSay::WAIT_MAX}")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
said = session_access.peer_say(id, name, text: body["text"], summary: string_or_nil(body["summary"]),
|
|
122
|
+
wake: body["wake"] == true, re: string_or_nil(body["re"]), wait: wait)
|
|
123
|
+
json_response(said.received? ? 200 : 409, said.to_h.merge("line" => said.line(name)))
|
|
124
|
+
rescue PeerMailbox::Invalid => e
|
|
125
|
+
error_response(400, "invalid_text", e.message)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def invalid_peer(name) = error_response(400, "invalid_peer", PeerMailbox.name_problem(name))
|
|
129
|
+
|
|
130
|
+
def string_or_nil(value) = value.is_a?(String) ? value : nil
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -73,6 +73,7 @@ import { wireBlockFix } from "./block_fix.js";
|
|
|
73
73
|
import { createWidgetDrawer } from "./inline_widgets.js";
|
|
74
74
|
import { copyText, installCopy } from "./copy.js";
|
|
75
75
|
import { installAnswerFold, sweepAnswerFolds } from "./answer_fold.js";
|
|
76
|
+
import { installQuietNotes } from "./quiet_notes.js";
|
|
76
77
|
import { sweepSessionPrefs } from "./session_prefs.js";
|
|
77
78
|
import { installDetailsMotion } from "./details_motion.js";
|
|
78
79
|
import { answerLabel, installReviseStacks, reviseChipTemplate, reviseWorkerUnavailable } from "./revise_stack.js";
|
|
@@ -134,6 +135,7 @@ import { createViewer } from "./viewer.js";
|
|
|
134
135
|
import { createPictureViewer, thumbPicture } from "./picture_viewer.js";
|
|
135
136
|
import { createParticipantMain } from "./participant_main.js";
|
|
136
137
|
import { createPeers } from "./peer_data.js";
|
|
138
|
+
import { getPeerMessage, unpairPeer } from "./peer_mailbox_api.js";
|
|
137
139
|
import { peerStatusCommand } from "./peer_chip.js";
|
|
138
140
|
import { createPeerLinks } from "./peer_links.js";
|
|
139
141
|
import { PARTICIPANT_REVISE_UNAVAILABLE, participantMayRevise, participantReviseUnavailable } from "./participant_revise.js";
|
|
@@ -173,7 +175,7 @@ const infoTextEl = $("#infoText");
|
|
|
173
175
|
// (updateInfoBar redraws #infoText every tick; the chips keep their popover).
|
|
174
176
|
const contextChips = viewer.can("context") ? createContextChips({
|
|
175
177
|
el: $("#contextChips"),
|
|
176
|
-
api: { list: listContext, show: getContext, detach: detachContext },
|
|
178
|
+
api: { list: listContext, show: getContext, detach: detachContext, message: getPeerMessage, unpair: unpairPeer },
|
|
177
179
|
toast: (text) => showToast(text),
|
|
178
180
|
// A paired peer's one chip (peer_chip.js): its exchanges are the peers model's (below).
|
|
179
181
|
peers: () => peers,
|
|
@@ -438,8 +440,8 @@ function findInTurnRoots(selector) {
|
|
|
438
440
|
}
|
|
439
441
|
// The open session's peers (peer_data.js, owner only) and their exchange drawn in the conversation (peer_links.js).
|
|
440
442
|
const peers = contextChips ? createPeers({ sessionId: () => store.selected, onChange: () => { peerLinks.draw(); contextChips.peersChanged(); },
|
|
441
|
-
hasPeer: () =>
|
|
442
|
-
const peerLinks = peers && createPeerLinks({ peers, roots: turnRoots, running: () => liveTurn.running, showText: (name) => contextChips.showText?.(name), renderMarkdown });
|
|
443
|
+
hasPeer: () => true }) : null;
|
|
444
|
+
const peerLinks = peers && createPeerLinks({ peers, roots: turnRoots, running: () => liveTurn.running, showText: (name) => contextChips.showText?.(name), showMessage: (name, serial, box) => contextChips.showMessage?.(name, serial, box), renderMarkdown });
|
|
443
445
|
// The running turn as the page follows it (live_turn.js): whether one
|
|
444
446
|
// runs, its timing line and the turns this page saw end (live_timing.js),
|
|
445
447
|
// its merges' bubble flags, its turn-end reads.
|
|
@@ -547,7 +549,7 @@ turnRoots().forEach((root) => root.addEventListener("click", cards.onCardAction)
|
|
|
547
549
|
// take their functions (the session actions, the send, the stream handlers);
|
|
548
550
|
// the ones made later come in as getters, and each reaches the other lazily.
|
|
549
551
|
const sessionView = createSessionView({
|
|
550
|
-
store, historyEl, getSession,
|
|
552
|
+
store, historyEl, getSession, clientId,
|
|
551
553
|
liveTurn, turnDom, questionCards, shownTexts, objectives, featureGates, markdownTip, workingSet, wsPreview, gapClock,
|
|
552
554
|
bubbles, cards, markdown: markdownPlace, cardRegistry, peerLinks, pictures,
|
|
553
555
|
capabilities: () => pageCapabilities,
|
|
@@ -1488,18 +1490,16 @@ const blockFix = wireBlockFix({ viewer, roots: turnRoots(), store, getSession, c
|
|
|
1488
1490
|
// with their height animated (details_motion.js), in the history and on
|
|
1489
1491
|
// the stage.
|
|
1490
1492
|
installDetailsMotion({ root: document.body, selector: ".turn-work, .bubble.thinking, .bubble.recap" });
|
|
1491
|
-
// Long answers fold by hand (answer_fold.js), per viewer and session.
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
projectRoot: () => store.sessions.find((s) => s.id === store.selected)?.project_root ?? null,
|
|
1496
|
-
});
|
|
1493
|
+
// Long answers fold by hand (answer_fold.js), per viewer and session; background items into a notes row (quiet_notes.js).
|
|
1494
|
+
const projectRoot = () => store.sessions.find((s) => s.id === store.selected)?.project_root ?? null;
|
|
1495
|
+
installAnswerFold({ historyEl, sessionId: () => store.selected, projectRoot });
|
|
1496
|
+
installQuietNotes({ historyEl });
|
|
1497
1497
|
// Revise stacks (revise_stack.js): the superseded versions fold to stubs,
|
|
1498
1498
|
// the top answer gets its version chip, a final answer its Revise button.
|
|
1499
1499
|
reviseStacks = viewer.can("revise") || viewer.can("revise_own_turn") ? installReviseStacks({
|
|
1500
1500
|
historyEl,
|
|
1501
1501
|
sessionId: () => store.selected,
|
|
1502
|
-
projectRoot
|
|
1502
|
+
projectRoot,
|
|
1503
1503
|
running: () => (liveTurn.running ? { turnId: liveTurn.timing.turnId || null } : null),
|
|
1504
1504
|
verifyTurn: (turnId) => (store.current.verdicts || []).some((v) => v.check_turn_id === turnId),
|
|
1505
1505
|
unavailable: reviseUnavailable, unavailableText: reviseOffText,
|
|
@@ -17,8 +17,8 @@ import { TIME_GAP_CLASS, timeGapEl } from "./time_gaps.js";
|
|
|
17
17
|
|
|
18
18
|
// What a session's load places at a turn's prompt from the snapshot
|
|
19
19
|
// (cards_place.js placeSnapshotCards): its cards, answered questions,
|
|
20
|
-
// notices and warnings.
|
|
21
|
-
const SNAPSHOT_PLACED = ".plugin-card, .bubble.question, .bubble.hook-notice, .bubble.guardrail-warning";
|
|
20
|
+
// notices and warnings; and the notes rows over its lines (quiet_notes.js).
|
|
21
|
+
const SNAPSHOT_PLACED = ".plugin-card, .bubble.question, .bubble.hook-notice, .bubble.guardrail-warning, .quiet-notes";
|
|
22
22
|
|
|
23
23
|
export function removeQueuedBubble(bubble) {
|
|
24
24
|
if (!bubble) return;
|
|
@@ -122,13 +122,32 @@ export function createCardsPlace({
|
|
|
122
122
|
else if (entry.type === "question") placeResolvedQuestion(entry, before);
|
|
123
123
|
else if (entry.type === "guardrail_warning") bubbles.showGuardrailWarning(entry.message, entry.label || "guardrails", { before });
|
|
124
124
|
else if (entry.in_turn) placeTurnNotice(entry, before);
|
|
125
|
-
else if (entry.type === "hook_notice") bubbles.showHookNotice(entry, { before });
|
|
125
|
+
else if (entry.type === "hook_notice") bubbles.showHookNotice(entry, { before: afterTurnEnd(before) });
|
|
126
126
|
}
|
|
127
127
|
// A drawn turn's question slot whose question never came (CardStore
|
|
128
128
|
// dropped it, a pending one): nothing in its place.
|
|
129
129
|
historyEl.querySelectorAll("[data-question-slot]").forEach((slot) => slot.remove());
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// Where a between-turn line goes, given +before+ (the next opening, or null
|
|
133
|
+
// for the end): right after the turn that just ended, as live (a notice
|
|
134
|
+
// draws no time divider of its own), so above the next opening's divider
|
|
135
|
+
// and the context notes that came between the turns. It walks back over
|
|
136
|
+
// those and their notes rows (quiet_notes.js; never over earlier lines,
|
|
137
|
+
// cards or questions: several lines keep their order) and returns the
|
|
138
|
+
// first one it walked over, else +before+.
|
|
139
|
+
// Assumes the line came right after a turn (an after_turn hook), not after
|
|
140
|
+
// a later note: an anytime command's line between turns moves above the
|
|
141
|
+
// notes before it too (rare; the e2e reload checks cover it).
|
|
142
|
+
function afterTurnEnd(before) {
|
|
143
|
+
let place = before;
|
|
144
|
+
for (let el = before ? before.previousElementSibling : historyEl.lastElementChild; el; el = el.previousElementSibling) {
|
|
145
|
+
if (!el.matches(".time-gap, .bubble.note:not(.turn-start), .quiet-notes")) break;
|
|
146
|
+
place = el;
|
|
147
|
+
}
|
|
148
|
+
return place;
|
|
149
|
+
}
|
|
150
|
+
|
|
132
151
|
// An in-turn entry (not a question) of a turn the history drew from its
|
|
133
152
|
// drawing (its pieces carry data-drawn; the entry's of_turn, CardStore's).
|
|
134
153
|
function drawnEntry(entry) {
|
|
@@ -12,7 +12,7 @@ import { popoverPlace, SHEET_MAX, sheetPlace } from "./chip_popover.js";
|
|
|
12
12
|
import { focusBack, modalDialog } from "./popover_modal.js";
|
|
13
13
|
import { cantText } from "./format.js";
|
|
14
14
|
import { createLatest } from "./latest.js";
|
|
15
|
-
import { peerChipModel, peerGroups, peerKey, peerPopoverTemplate
|
|
15
|
+
import { peerChipModel, peerGroups, peerKey, peerPopoverTemplate } from "./peer_chip.js";
|
|
16
16
|
|
|
17
17
|
// "now", "3m", "2h", "4d" since an ISO time; "" for none.
|
|
18
18
|
export function ageText(iso, now = Date.now()) {
|
|
@@ -90,13 +90,14 @@ export function popoverTemplate(row, { text = null, now = Date.now() } = {}) {
|
|
|
90
90
|
// so focus stays. The
|
|
91
91
|
// popover behaves as every popover does (popover_modal.js): a modal dialog, its chip's
|
|
92
92
|
// aria-expanded, Esc closes it and focus goes back to the chip.
|
|
93
|
-
// A paired peer
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
93
|
+
// A paired peer is one chip (peer_chip.js), drawn first: +peers+() the
|
|
94
|
+
// peers model (peer_data.js createPeers, GET …/peers: the chip's only feed;
|
|
95
|
+
// null: none, no peer chips), read when a session's chips load, and the
|
|
96
|
+
// chips redrawn on its change (peersChanged); +peerActions+: {status(name):
|
|
97
|
+
// the status card's command line ("/claude") when the session has it, else
|
|
98
|
+
// null; run(line); drawn(id): whether that send's row is in the
|
|
99
|
+
// conversation; jump(id): to it}. +api+ also reads a peer's message
|
|
100
|
+
// (message(id, name, serial)) and ends a pairing (unpair(id, name)).
|
|
100
101
|
// +focusAway+(): where focus goes when a detach or Unpair took the last chip
|
|
101
102
|
// (the composer).
|
|
102
103
|
export function createContextChips({ el, api, toast = () => {}, peers = () => null, peerActions = {},
|
|
@@ -108,10 +109,8 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
108
109
|
let openKey = null;
|
|
109
110
|
// Only the newest list read for the open session is drawn (latest.js).
|
|
110
111
|
const latest = createLatest(() => sessionId);
|
|
111
|
-
// The open popover's text once read (view text; a peer's:
|
|
112
|
+
// The open popover's text once read (view text; a peer's: a message's).
|
|
112
113
|
let text = null;
|
|
113
|
-
// The peers the last read named (a new one reads the peers model again).
|
|
114
|
-
let peerNames = "";
|
|
115
114
|
const pop = doc.createElement("div");
|
|
116
115
|
pop.id = "contextPopover";
|
|
117
116
|
pop.className = "ctx-popover";
|
|
@@ -119,14 +118,14 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
119
118
|
doc.body.appendChild(pop);
|
|
120
119
|
modalDialog(pop, { isOpen: () => openKey !== null, doc });
|
|
121
120
|
|
|
122
|
-
const groups = () => peerGroups(
|
|
121
|
+
const groups = () => peerGroups(peers()?.peers?.() || []);
|
|
123
122
|
const groupOf = (key) => groups().find((group) => group.key === key) || null;
|
|
124
123
|
const exchangesOf = (name) => peers()?.peer?.(name)?.exchanges || [];
|
|
125
124
|
const rowOf = (name) => rows.find((r) => r.name === name) || null;
|
|
126
125
|
|
|
127
126
|
function chips(now = Date.now()) {
|
|
128
127
|
const peerChips = groups().map((group) => peerChipModel(group, exchangesOf(group.name), now));
|
|
129
|
-
return [...peerChips, ...chipModel(
|
|
128
|
+
return [...peerChips, ...chipModel(rows, now)];
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
function drawChips() {
|
|
@@ -166,17 +165,14 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
166
165
|
draw();
|
|
167
166
|
// An open popover follows its row, but not while it shows the text.
|
|
168
167
|
follow();
|
|
169
|
-
// The peers
|
|
170
|
-
// conversation's read if loaded or in flight)
|
|
171
|
-
|
|
172
|
-
if (names && (loading || names !== peerNames)) peers()?.refresh?.({ reuse: loading });
|
|
173
|
-
peerNames = names;
|
|
168
|
+
// The peers for their chips: at a session's open (reuse the
|
|
169
|
+
// conversation's read if loaded or in flight).
|
|
170
|
+
if (loading) peers()?.refresh?.({ reuse: true });
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
function load(id) {
|
|
177
174
|
sessionId = id;
|
|
178
175
|
rows = [];
|
|
179
|
-
peerNames = "";
|
|
180
176
|
close();
|
|
181
177
|
return refresh({ loading: true });
|
|
182
178
|
}
|
|
@@ -184,7 +180,6 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
184
180
|
function clear() {
|
|
185
181
|
sessionId = null;
|
|
186
182
|
rows = [];
|
|
187
|
-
peerNames = "";
|
|
188
183
|
close();
|
|
189
184
|
}
|
|
190
185
|
|
|
@@ -259,13 +254,17 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
259
254
|
if (key !== null) back([...el.querySelectorAll(".ctx-chip[data-name]")].find((chip) => chip.dataset.name === key));
|
|
260
255
|
}
|
|
261
256
|
|
|
262
|
-
|
|
257
|
+
// The open popover's text: a source's, or a peer's message (+serial+;
|
|
258
|
+
// default its newest).
|
|
259
|
+
async function viewText(serial = null, box = null) {
|
|
263
260
|
const key = openKey;
|
|
264
261
|
if (!key) return;
|
|
265
|
-
|
|
266
|
-
const
|
|
262
|
+
const peer = groupOf(key);
|
|
263
|
+
const number = peer ? serial ?? peer.peer.messages?.[0]?.serial : null;
|
|
264
|
+
const name = peer ? `${peer.label}'s message #${number}` : key;
|
|
265
|
+
if (peer && (number === null || number === undefined)) return;
|
|
267
266
|
try {
|
|
268
|
-
const data = await api.
|
|
267
|
+
const data = peer ? await api.message(sessionId, peer.name, number, box) : await api.show(sessionId, key);
|
|
269
268
|
if (key !== openKey) return;
|
|
270
269
|
const group = groupOf(key);
|
|
271
270
|
const row = group ? null : rowOf(key);
|
|
@@ -295,25 +294,21 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
295
294
|
}
|
|
296
295
|
}
|
|
297
296
|
|
|
298
|
-
// Unpair: one confirm, then
|
|
299
|
-
//
|
|
300
|
-
// into "answers only" over a half unpair).
|
|
297
|
+
// Unpair: one confirm, then the pairing ends (DELETE …/peers/NAME; its
|
|
298
|
+
// messages stay) and the peers are read again: the chip goes.
|
|
301
299
|
async function unpair() {
|
|
302
300
|
const group = groupOf(openKey);
|
|
303
301
|
if (!group) return;
|
|
304
|
-
|
|
305
|
-
if (!win.confirm(`Unpair ${group.label}? This detaches ${legs.join(" and ")} from this session.`)) return;
|
|
302
|
+
if (!win.confirm(`Unpair ${group.label}? chi stops sending to it; its messages stay.`)) return;
|
|
306
303
|
const id = sessionId;
|
|
307
304
|
close();
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
toast(cantText(`detach ${name}`, e));
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
305
|
+
try {
|
|
306
|
+
await api.unpair(id, group.name);
|
|
307
|
+
} catch (e) {
|
|
308
|
+
toast(cantText(`unpair ${group.label}`, e));
|
|
315
309
|
}
|
|
316
|
-
await refresh();
|
|
310
|
+
await peers()?.refresh?.();
|
|
311
|
+
drawChips();
|
|
317
312
|
focusAfterRemoval();
|
|
318
313
|
}
|
|
319
314
|
|
|
@@ -367,22 +362,26 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
367
362
|
// The ages move on by themselves.
|
|
368
363
|
win.setInterval(() => { if (rows.length) drawChips(); }, 60_000);
|
|
369
364
|
|
|
370
|
-
// +
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
function showText(name) {
|
|
365
|
+
// The popover of chip +key+ on its text (+serial+: a peer's message), at
|
|
366
|
+
// its chip. In a task of its own: the click that asks would close it on
|
|
367
|
+
// its way to the document.
|
|
368
|
+
function showAt(key, serial = null, box = null) {
|
|
375
369
|
setTimeout(() => {
|
|
376
|
-
const leg = rowOf(name);
|
|
377
|
-
const key = leg?.peer && groupOf(peerKey(leg.peer)) ? peerKey(leg.peer) : name;
|
|
378
370
|
const chip = [...el.querySelectorAll(".ctx-chip[data-name]")].find((c) => c.dataset.name === key);
|
|
379
371
|
if (!chip) return;
|
|
380
372
|
chip.scrollIntoView?.({ block: "nearest", inline: "nearest" });
|
|
381
373
|
if (openKey !== key) open(key, chip);
|
|
382
|
-
if (openKey === key && text === null) viewText();
|
|
374
|
+
if (openKey === key && text === null) viewText(serial, box);
|
|
383
375
|
}, 0);
|
|
384
376
|
}
|
|
385
377
|
|
|
378
|
+
// +name+'s popover on its text: an older peer answer's "Read the full
|
|
379
|
+
// answer" (peer_links.js; its context source, an ordinary chip now).
|
|
380
|
+
const showText = (name) => showAt(name);
|
|
381
|
+
// Peer +name+'s chip on its message +serial+ (a mailbox note's "Read the
|
|
382
|
+
// full answer", peer_links.js).
|
|
383
|
+
const showMessage = (name, serial, box) => showAt(peerKey(name), serial, box);
|
|
384
|
+
|
|
386
385
|
// The peers model read again: the chips and an open peer's popover follow it.
|
|
387
386
|
function peersChanged() {
|
|
388
387
|
if (!sessionId) return;
|
|
@@ -390,5 +389,5 @@ export function createContextChips({ el, api, toast = () => {}, peers = () => nu
|
|
|
390
389
|
if (groupOf(openKey)) follow();
|
|
391
390
|
}
|
|
392
391
|
|
|
393
|
-
return { load, clear, refresh, close, showText, peersChanged, get rows() { return rows; } };
|
|
392
|
+
return { load, clear, refresh, close, showText, showMessage, peersChanged, get rows() { return rows; } };
|
|
394
393
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// step, a diff), an answer or a delegate report folded (answer_fold.js: its row follows
|
|
4
4
|
// the bubble's class; the jump's unfold isn't saved), a superseded version
|
|
5
5
|
// of a Revise stack (revise_stack.js: its stub opens, not saved), a drawn
|
|
6
|
-
// block's source (block_source.js).
|
|
6
|
+
// block's source (block_source.js), a closed notes row (quiet_notes.js: it
|
|
7
|
+
// opens, never stored). Every
|
|
7
8
|
// jump goes through it (claim_link.js showClaim, refs.js showRow and so the
|
|
8
9
|
// working set's step tags, verdict_card.js "View check"), so a new way to
|
|
9
10
|
// hide history is opened in one place.
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
|
|
15
16
|
import { revealBlockSource } from "./block_source.js";
|
|
16
17
|
import { openStubOver } from "./revise_stack.js";
|
|
18
|
+
import { revealQuiet } from "./quiet_notes.js";
|
|
17
19
|
|
|
18
20
|
// Opens each closed <details> that holds +el+ (not +el+ itself: a fold the
|
|
19
21
|
// caller means to open it opens itself) and unfolds the folded answer that
|
|
@@ -21,6 +23,7 @@ import { openStubOver } from "./revise_stack.js";
|
|
|
21
23
|
export function revealInHistory(el) {
|
|
22
24
|
if (!el) return null;
|
|
23
25
|
openStubOver(el);
|
|
26
|
+
revealQuiet(el);
|
|
24
27
|
revealBlockSource(el);
|
|
25
28
|
el.closest?.(".bubble.folded")?.classList.remove("folded");
|
|
26
29
|
for (let details = el.parentElement?.closest("details"); details; details = details.parentElement?.closest("details")) {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// notices. Kinds come from KINDS only (the server logs them, nothing else).
|
|
12
12
|
// `cls` is a kind's own modifier (a row's status, a warn notice, a report
|
|
13
13
|
// reply), `text` what it says, whitespace collapsed. Left out: lit's
|
|
14
|
-
// comments, the copy button, the quiet-stretch dividers (`.time-gap`),
|
|
14
|
+
// comments, the copy button, the quiet-stretch dividers (`.time-gap`), the
|
|
15
|
+
// notes rows (`.quiet-notes`, quiet_notes.js: their items are read), and
|
|
15
16
|
// view state (folds, stacks, the motion classes): nothing a reader would
|
|
16
17
|
// call a different turn.
|
|
17
18
|
//
|
|
@@ -133,7 +134,7 @@ function otherItem(el) {
|
|
|
133
134
|
// One child of #history as its items (a turn block's are several; a time
|
|
134
135
|
// divider none).
|
|
135
136
|
function childItems(el) {
|
|
136
|
-
if (el.matches(".time-gap, .copy-btn")) return [];
|
|
137
|
+
if (el.matches(".time-gap, .copy-btn, .quiet-notes")) return [];
|
|
137
138
|
if (el.matches(".turn-work")) {
|
|
138
139
|
return [item("block", textOf(el.querySelector(":scope > summary .turn-steps"))),
|
|
139
140
|
...[...el.querySelectorAll(":scope > .gen")].flatMap(stepItems)];
|