samagotchi 0.174.0 → 0.176.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 +38 -1
- data/bin/chi +1 -0
- data/docs/architecture.md +1 -1
- data/docs/cli.md +3 -0
- data/docs/configuration.md +1 -0
- data/docs/internals/bridge.md +10 -3
- data/docs/internals/engine.md +2 -2
- data/docs/internals/participants.md +11 -5
- data/docs/internals/web-frontend.md +44 -11
- data/docs/sessions.md +2 -2
- data/docs/testing.md +25 -3
- data/lib/samagotchi/answer_text.rb +4 -2
- data/lib/samagotchi/bridge.rb +11 -4
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/config.rb +3 -0
- data/lib/samagotchi/llm/stray_tool_call.rb +7 -4
- data/lib/samagotchi/llm_context_stale.rb +2 -1
- data/lib/samagotchi/message_parts.rb +5 -2
- data/lib/samagotchi/model_markup.rb +22 -0
- data/lib/samagotchi/model_profile.rb +8 -7
- data/lib/samagotchi/participant_uploads.rb +14 -1
- data/lib/samagotchi/prompt_literal_guard.rb +7 -6
- data/lib/samagotchi/task_transcript.rb +10 -5
- data/lib/samagotchi/tool_call_parser.rb +6 -5
- data/lib/samagotchi/turn_note.rb +2 -1
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +15 -2
- data/lib/samagotchi/web/participant_images.rb +16 -12
- data/lib/samagotchi/web/participant_show.rb +1 -0
- data/lib/samagotchi/web/participant_view.rb +31 -3
- data/lib/samagotchi/web/public/app.js +18 -4
- data/lib/samagotchi/web/public/composer_fold.js +3 -1
- data/lib/samagotchi/web/public/composer_grip.js +18 -10
- data/lib/samagotchi/web/public/composer_mount.js +17 -6
- data/lib/samagotchi/web/public/reload_check.js +0 -3
- data/lib/samagotchi/web/public/restore.js +3 -1
- data/lib/samagotchi/web/public/session_prefs.js +89 -0
- data/lib/samagotchi/web/public/session_sync.js +3 -0
- data/lib/samagotchi/web/public/session_view.js +41 -3
- data/lib/samagotchi/web/public/stage_asking.js +21 -18
- data/lib/samagotchi/web/public/stage_cloud.js +3 -2
- data/lib/samagotchi/web/public/stage_missing.js +148 -0
- data/lib/samagotchi/web/public/stage_model.js +2 -1
- data/lib/samagotchi/web/public/stage_view.js +14 -4
- data/lib/samagotchi/web/public/stage_view_memory.js +76 -0
- data/lib/samagotchi/web/public/stream_handlers.js +3 -2
- data/lib/samagotchi/web/public/turn_events.js +1 -1
- data/lib/samagotchi/web/public/working_set_rail.js +22 -7
- data/lib/samagotchi/web/public/ws_reader.js +2 -0
- data/lib/samagotchi/web/server.rb +6 -2
- data/lib/samagotchi/web/session_show.rb +42 -4
- data/lib/samagotchi/worker/child_side.rb +123 -0
- data/lib/samagotchi/worker/command_queue.rb +346 -0
- data/lib/samagotchi/worker/leave.rb +286 -0
- data/lib/samagotchi/worker/scratch.rb +99 -0
- data/lib/samagotchi/worker/signal_grace.rb +96 -0
- data/lib/samagotchi/worker/startup.rb +92 -0
- data/lib/samagotchi/worker/wake_turns.rb +190 -0
- data/lib/samagotchi/worker.rb +24 -1065
- data/lib/samagotchi/worker_exit_claim.rb +12 -0
- metadata +12 -2
- data/lib/samagotchi/web/public/cards_offscreen.js +0 -69
|
@@ -20,6 +20,15 @@ module Samagotchi
|
|
|
20
20
|
# (accepted) is told apart from "claimed".
|
|
21
21
|
Refused = Data.define(:value)
|
|
22
22
|
|
|
23
|
+
# #accept with no claim held: a caller that skipped #claim (a bug, never
|
|
24
|
+
# a request). Worker#exit_request releases and re-raises it, so the
|
|
25
|
+
# Bridge answers 500 rather than a silent exit of no kind.
|
|
26
|
+
class NotClaimed < StandardError
|
|
27
|
+
def initialize(msg = "no exit claimed: #accept follows a #claim that returned nil")
|
|
28
|
+
super
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
23
32
|
# The exit taken: its +kind+ (:exit, :delete, :restart) and the client
|
|
24
33
|
# that asked (+by+).
|
|
25
34
|
Taken = Data.define(:kind, :by) do
|
|
@@ -54,8 +63,11 @@ module Samagotchi
|
|
|
54
63
|
|
|
55
64
|
# The claimed exit goes through: it is taken by +by+ (a client id), and
|
|
56
65
|
# a plain one (no +stop+) drops the last stop-all's list.
|
|
66
|
+
# @raise [NotClaimed] when no claim is held
|
|
57
67
|
def accept(by:, stop:)
|
|
58
68
|
@mutex.synchronize do
|
|
69
|
+
raise NotClaimed unless @claim
|
|
70
|
+
|
|
59
71
|
@stopped = nil unless stop
|
|
60
72
|
@taken = Taken.new(kind: @claim, by: by)
|
|
61
73
|
end
|
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.176.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -553,6 +553,7 @@ files:
|
|
|
553
553
|
- lib/samagotchi/model_catalog.rb
|
|
554
554
|
- lib/samagotchi/model_list_store.rb
|
|
555
555
|
- lib/samagotchi/model_lookup.rb
|
|
556
|
+
- lib/samagotchi/model_markup.rb
|
|
556
557
|
- lib/samagotchi/model_match.rb
|
|
557
558
|
- lib/samagotchi/model_notes.rb
|
|
558
559
|
- lib/samagotchi/model_overlay.rb
|
|
@@ -944,7 +945,6 @@ files:
|
|
|
944
945
|
- lib/samagotchi/web/public/card_kinds.js
|
|
945
946
|
- lib/samagotchi/web/public/card_registry.js
|
|
946
947
|
- lib/samagotchi/web/public/card_stamps.js
|
|
947
|
-
- lib/samagotchi/web/public/cards_offscreen.js
|
|
948
948
|
- lib/samagotchi/web/public/cards_place.js
|
|
949
949
|
- lib/samagotchi/web/public/chains.js
|
|
950
950
|
- lib/samagotchi/web/public/chip_popover.js
|
|
@@ -1051,6 +1051,7 @@ files:
|
|
|
1051
1051
|
- lib/samagotchi/web/public/session_actions.js
|
|
1052
1052
|
- lib/samagotchi/web/public/session_fields.js
|
|
1053
1053
|
- lib/samagotchi/web/public/session_payload.js
|
|
1054
|
+
- lib/samagotchi/web/public/session_prefs.js
|
|
1054
1055
|
- lib/samagotchi/web/public/session_rename.js
|
|
1055
1056
|
- lib/samagotchi/web/public/session_state.js
|
|
1056
1057
|
- lib/samagotchi/web/public/session_store.js
|
|
@@ -1069,6 +1070,7 @@ files:
|
|
|
1069
1070
|
- lib/samagotchi/web/public/stage_dom.js
|
|
1070
1071
|
- lib/samagotchi/web/public/stage_frame.js
|
|
1071
1072
|
- lib/samagotchi/web/public/stage_handoff.js
|
|
1073
|
+
- lib/samagotchi/web/public/stage_missing.js
|
|
1072
1074
|
- lib/samagotchi/web/public/stage_model.js
|
|
1073
1075
|
- lib/samagotchi/web/public/stage_opened.js
|
|
1074
1076
|
- lib/samagotchi/web/public/stage_owner_wait.js
|
|
@@ -1079,6 +1081,7 @@ files:
|
|
|
1079
1081
|
- lib/samagotchi/web/public/stage_slots.js
|
|
1080
1082
|
- lib/samagotchi/web/public/stage_stall.js
|
|
1081
1083
|
- lib/samagotchi/web/public/stage_view.js
|
|
1084
|
+
- lib/samagotchi/web/public/stage_view_memory.js
|
|
1082
1085
|
- lib/samagotchi/web/public/stage_waiting.js
|
|
1083
1086
|
- lib/samagotchi/web/public/stage_watch.js
|
|
1084
1087
|
- lib/samagotchi/web/public/stale_params.js
|
|
@@ -1171,6 +1174,13 @@ files:
|
|
|
1171
1174
|
- lib/samagotchi/web/viewer.rb
|
|
1172
1175
|
- lib/samagotchi/web/working_set_routes.rb
|
|
1173
1176
|
- lib/samagotchi/worker.rb
|
|
1177
|
+
- lib/samagotchi/worker/child_side.rb
|
|
1178
|
+
- lib/samagotchi/worker/command_queue.rb
|
|
1179
|
+
- lib/samagotchi/worker/leave.rb
|
|
1180
|
+
- lib/samagotchi/worker/scratch.rb
|
|
1181
|
+
- lib/samagotchi/worker/signal_grace.rb
|
|
1182
|
+
- lib/samagotchi/worker/startup.rb
|
|
1183
|
+
- lib/samagotchi/worker/wake_turns.rb
|
|
1174
1184
|
- lib/samagotchi/worker_boot.rb
|
|
1175
1185
|
- lib/samagotchi/worker_exit_claim.rb
|
|
1176
1186
|
- lib/samagotchi/worker_idle_exit.rb
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// A snapshot's cards placed into a holder that is not the page (cards_offscreen.js):
|
|
2
|
-
// the old reload check's placer. Nothing imports it now (reload_check.js compares
|
|
3
|
-
// the turn's cards as data, card_registry.js); it stays one release for a stale
|
|
4
|
-
// app.js that still imports it (a 404 would blank the page), then it goes.
|
|
5
|
-
//
|
|
6
|
-
// It is the real placer, not a copy: createCardsPlace, createBubbles and
|
|
7
|
-
// createQuestionCards over a detached holder, with every page hook made inert:
|
|
8
|
-
// no stage (turnDom answers "nothing holds it", and has no settleFold/settleWaiting
|
|
9
|
-
// — cards_place.js calls those with `?.`), no scroll, no hint, no info bar, no
|
|
10
|
-
// session id, no api. Nothing outside +holder+ is read or written; the page's
|
|
11
|
-
// questionCards, its turnDom and its appendToHistory are never touched.
|
|
12
|
-
import { createBubbles } from "./bubbles.js";
|
|
13
|
-
import { createCardsPlace } from "./cards_place.js";
|
|
14
|
-
import { createQuestionCards } from "./question_cards.js";
|
|
15
|
-
import { splitSnapshotCards } from "./card.js";
|
|
16
|
-
|
|
17
|
-
// +cards+ the read's snapshot (data.cards); +capabilities+ the page's, for the
|
|
18
|
-
// notices it shows elsewhere (splitSnapshotCards); +answers+ whether this viewer
|
|
19
|
-
// may answer cards at all (viewer.js answer_cards).
|
|
20
|
-
export function placeCardsOffscreen(holder, cards, { capabilities = null, answers = true, doc = globalThis.document } = {}) {
|
|
21
|
-
const shared = {
|
|
22
|
-
historyEl: holder,
|
|
23
|
-
findInTurnRoots: (selector) => [...holder.querySelectorAll(selector)],
|
|
24
|
-
isNearBottom: () => false,
|
|
25
|
-
selected: () => null,
|
|
26
|
-
clientId: null,
|
|
27
|
-
};
|
|
28
|
-
// No running turn here: nothing holds a piece, nothing takes a card or a steer.
|
|
29
|
-
const turnDom = { card: () => false, steer: () => false, holds: () => false };
|
|
30
|
-
const bubbles = createBubbles({
|
|
31
|
-
...shared,
|
|
32
|
-
appendToHistory: (el) => holder.appendChild(el),
|
|
33
|
-
turnDom,
|
|
34
|
-
shownTexts: { shows: () => false },
|
|
35
|
-
liveTurn: { timing: { el: null } },
|
|
36
|
-
});
|
|
37
|
-
const questionCards = createQuestionCards({
|
|
38
|
-
...shared,
|
|
39
|
-
sessionId: () => null,
|
|
40
|
-
place: (card) => { holder.appendChild(card); return false; },
|
|
41
|
-
scrollToEnd: () => {},
|
|
42
|
-
removeHintIfEmpty: () => {},
|
|
43
|
-
askingText: () => "",
|
|
44
|
-
renderMarkdown: () => Promise.resolve(null),
|
|
45
|
-
onPending: () => {},
|
|
46
|
-
onSettled: () => {},
|
|
47
|
-
answers,
|
|
48
|
-
doc,
|
|
49
|
-
// A card's button is inert here: a placed card is a comparison, not a live ask.
|
|
50
|
-
api: {
|
|
51
|
-
sendAnswer: () => Promise.reject(new Error("offscreen card")),
|
|
52
|
-
dismissQuestion: () => Promise.reject(new Error("offscreen card")),
|
|
53
|
-
sendCommand: () => Promise.reject(new Error("offscreen card")),
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
const place = createCardsPlace({
|
|
57
|
-
...shared,
|
|
58
|
-
turnDom,
|
|
59
|
-
questionCards,
|
|
60
|
-
bubbles,
|
|
61
|
-
followWokenWorker: () => {},
|
|
62
|
-
api: {
|
|
63
|
-
getSession: () => Promise.reject(new Error("offscreen card")),
|
|
64
|
-
sendCommand: () => Promise.reject(new Error("offscreen card")),
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
place.placeSnapshotCards(splitSnapshotCards(cards, capabilities).placed, { before: null });
|
|
68
|
-
return holder;
|
|
69
|
-
}
|