samagotchi 0.166.0 → 0.168.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 +89 -1
- data/docs/architecture.md +1 -0
- data/docs/cli.md +24 -15
- data/docs/configuration.md +1 -0
- data/docs/guardrails.md +5 -5
- data/docs/hooks.md +4 -6
- data/docs/internals/bundles.md +2 -4
- data/docs/internals/engine.md +4 -5
- data/docs/internals/objectives.md +141 -9
- data/docs/internals/remote-sessions.md +5 -6
- data/docs/internals/web-frontend.md +85 -40
- data/docs/memory.md +1 -2
- data/docs/sessions.md +20 -2
- data/docs/testing.md +3 -3
- data/lib/samagotchi/bridge.rb +1 -1
- data/lib/samagotchi/bundle_command/installed_check.rb +2 -14
- data/lib/samagotchi/bundle_command.rb +35 -12
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/cli/command.rb +10 -0
- data/lib/samagotchi/compat.rb +1 -13
- data/lib/samagotchi/config.rb +3 -0
- data/lib/samagotchi/context_command.rb +2 -1
- data/lib/samagotchi/engine/objectives.rb +20 -1
- data/lib/samagotchi/engine/side_requests.rb +3 -2
- data/lib/samagotchi/engine/turn_end.rb +4 -1
- data/lib/samagotchi/engine.rb +3 -0
- data/lib/samagotchi/extension_load.rb +2 -26
- data/lib/samagotchi/guardrails/approvals.rb +15 -16
- data/lib/samagotchi/jsonl_store.rb +61 -0
- data/lib/samagotchi/memory_bundle/status.rb +3 -15
- data/lib/samagotchi/memory_bundle/system_bundle.rb +16 -10
- data/lib/samagotchi/memory_command.rb +4 -2
- data/lib/samagotchi/objectives.rb +43 -14
- data/lib/samagotchi/objectives_backing.rb +124 -0
- data/lib/samagotchi/objectives_check.rb +19 -126
- data/lib/samagotchi/objectives_command.rb +14 -7
- data/lib/samagotchi/objectives_record.rb +104 -0
- data/lib/samagotchi/objectives_track.rb +353 -0
- data/lib/samagotchi/push_command.rb +2 -1
- data/lib/samagotchi/remote_command.rb +2 -1
- data/lib/samagotchi/reply_wait/poll.rb +6 -6
- data/lib/samagotchi/reply_wait.rb +4 -24
- data/lib/samagotchi/schedule_command.rb +6 -0
- data/lib/samagotchi/schedules.rb +1 -1
- data/lib/samagotchi/session_access/remote.rb +3 -5
- data/lib/samagotchi/session_commands.rb +1 -1
- data/lib/samagotchi/sessions_command.rb +12 -6
- data/lib/samagotchi/share_command.rb +2 -1
- data/lib/samagotchi/tool_activity.rb +11 -1
- data/lib/samagotchi/tool_declarations.rb +5 -1
- data/lib/samagotchi/tools/objectives_tool.rb +19 -2
- data/lib/samagotchi/turn_stages/objectives.rb +46 -3
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/participant_access.rb +1 -1
- data/lib/samagotchi/web/public/app.js +52 -424
- data/lib/samagotchi/web/public/copy.js +2 -1
- data/lib/samagotchi/web/public/dock_reserve.js +12 -2
- data/lib/samagotchi/web/public/history_end.js +16 -0
- data/lib/samagotchi/web/public/index.html +74 -22
- data/lib/samagotchi/web/public/info_bar_model.js +3 -1
- data/lib/samagotchi/web/public/no_contact_fill.js +29 -0
- data/lib/samagotchi/web/public/objectives.css +14 -0
- data/lib/samagotchi/web/public/objectives_moves.js +82 -9
- data/lib/samagotchi/web/public/objectives_state.js +42 -0
- data/lib/samagotchi/web/public/objectives_strip.js +33 -9
- data/lib/samagotchi/web/public/objectives_track.js +52 -0
- data/lib/samagotchi/web/public/objectives_wiring.js +16 -1
- data/lib/samagotchi/web/public/participant.html +1 -1
- data/lib/samagotchi/web/public/participants_panel.js +14 -7
- data/lib/samagotchi/web/public/question_cards.js +8 -13
- data/lib/samagotchi/web/public/refs.js +4 -1
- data/lib/samagotchi/web/public/reload_check.js +5 -4
- data/lib/samagotchi/web/public/resync_reach.js +10 -6
- data/lib/samagotchi/web/public/scope.js +3 -3
- data/lib/samagotchi/web/public/session_rename.js +6 -2
- data/lib/samagotchi/web/public/session_state.js +1 -1
- data/lib/samagotchi/web/public/session_sync.js +249 -0
- data/lib/samagotchi/web/public/session_view.js +279 -0
- data/lib/samagotchi/web/public/stage_cards.js +20 -0
- data/lib/samagotchi/web/public/stage_frame.js +14 -16
- data/lib/samagotchi/web/public/stage_model.js +11 -4
- data/lib/samagotchi/web/public/stage_opened.js +229 -0
- data/lib/samagotchi/web/public/stage_slots.js +2 -3
- data/lib/samagotchi/web/public/stage_view.js +219 -147
- data/lib/samagotchi/web/public/stage_watch.js +8 -4
- data/lib/samagotchi/web/public/stream_handlers.js +1 -1
- data/lib/samagotchi/web/public/tokens.css +2 -2
- data/lib/samagotchi/web/public/turn_block.js +22 -2
- data/lib/samagotchi/web/public/turn_html.js +1 -1
- data/lib/samagotchi/web/public/widget_picks.js +3 -0
- data/lib/samagotchi/web/public/working_set_view.js +1 -1
- data/lib/samagotchi/web/session_access_routes.rb +4 -15
- metadata +13 -1
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
// closed with text keeps its chrome: a line steered in after it left it alone
|
|
24
24
|
// in the block when the answer went, and its summary is the way to its text.
|
|
25
25
|
import { authorBadge, PAIR } from "./participant_names.js";
|
|
26
|
+
import { isParticipantAuthor } from "./participant_model.js";
|
|
26
27
|
import { applyRowTemplate } from "./review_apply.js";
|
|
27
28
|
import { html, nothing, render } from "./vendor/lit-html.js";
|
|
28
29
|
import { answerRefsOf, setAnswerRefs } from "./answer_refs.js";
|
|
@@ -203,7 +204,8 @@ export function outlineBlock(blockEl, gens) {
|
|
|
203
204
|
// taskStop the page's stopper (task_stop.js): a running task_wait
|
|
204
205
|
// row gets its stop-task button (none: no button).
|
|
205
206
|
// A new step goes on top of the block while the turn runs (chronological()
|
|
206
|
-
// restores the order at its end)
|
|
207
|
+
// restores the order at its end), or last once inOrder() was called (the
|
|
208
|
+
// block went into the history mid-turn).
|
|
207
209
|
export function createTurnBlock({
|
|
208
210
|
historyEl, isNearBottom, sawText, sessionId, blockHost, follow, placeAnswer,
|
|
209
211
|
onChange = () => {},
|
|
@@ -226,6 +228,9 @@ export function createTurnBlock({
|
|
|
226
228
|
let flushTimer = null;
|
|
227
229
|
// When the last flush wrote something (performance.now()).
|
|
228
230
|
let lastFlushAt = -Infinity;
|
|
231
|
+
// New steps go last, not on top (inOrder: the block left the stage's
|
|
232
|
+
// cloud for the history, stage_opened.js).
|
|
233
|
+
let inOrder = false;
|
|
229
234
|
|
|
230
235
|
function removeHint() {
|
|
231
236
|
const hint = historyEl.querySelector(".hint");
|
|
@@ -317,7 +322,8 @@ export function createTurnBlock({
|
|
|
317
322
|
draw(entry);
|
|
318
323
|
entry.el = entry.end.previousElementSibling || entry.frag.querySelector("details.gen");
|
|
319
324
|
const stick = isNearBottom();
|
|
320
|
-
blockEl.
|
|
325
|
+
if (inOrder) blockEl.appendChild(entry.frag);
|
|
326
|
+
else blockEl.insertBefore(entry.frag, blockSummaryEl.nextSibling);
|
|
321
327
|
if (stick) follow();
|
|
322
328
|
return entry;
|
|
323
329
|
}
|
|
@@ -502,6 +508,8 @@ export function createTurnBlock({
|
|
|
502
508
|
el = document.createElement("div");
|
|
503
509
|
el.className = "activity-row";
|
|
504
510
|
el.dataset.key = r.row.key;
|
|
511
|
+
// What the row ran, for what reads a finished block (objectives_moves.js).
|
|
512
|
+
if (r.row.tool) el.dataset.tool = r.row.tool;
|
|
505
513
|
entry.rows.set(r.row.key, el);
|
|
506
514
|
drawRow(el, r.row);
|
|
507
515
|
addItem(entry, el);
|
|
@@ -653,6 +661,8 @@ export function createTurnBlock({
|
|
|
653
661
|
if (blockEl) {
|
|
654
662
|
updateBlockSummary();
|
|
655
663
|
blockEl.classList.add("done");
|
|
664
|
+
// How it ended (completed, canceled, failed), live and reloaded alike.
|
|
665
|
+
blockEl.dataset.end = kind;
|
|
656
666
|
// The outline (turn_model.js outlineRuns), for when it is opened. Closed
|
|
657
667
|
// as a reload draws it, unless the turn was cut short (block_open.js).
|
|
658
668
|
// The stage decides again as the block reaches the history.
|
|
@@ -694,6 +704,7 @@ export function createTurnBlock({
|
|
|
694
704
|
pendingSteers = [];
|
|
695
705
|
cancelFlush();
|
|
696
706
|
lastFlushAt = -Infinity;
|
|
707
|
+
inOrder = false;
|
|
697
708
|
}
|
|
698
709
|
|
|
699
710
|
return {
|
|
@@ -701,6 +712,8 @@ export function createTurnBlock({
|
|
|
701
712
|
reset();
|
|
702
713
|
turn = model.newTurn();
|
|
703
714
|
createBlock();
|
|
715
|
+
// A participant's turn says so on its block (a reload's: drawnGroupPieces).
|
|
716
|
+
if (isParticipantAuthor(data.author || data.origin?.author)) blockEl.dataset.participant = "1";
|
|
704
717
|
const r = model.turnStarted(turn);
|
|
705
718
|
apply(r);
|
|
706
719
|
if (data.prompt) {
|
|
@@ -791,6 +804,12 @@ export function createTurnBlock({
|
|
|
791
804
|
return entry ? { el: entry.el, summary: entry.el.querySelector(":scope > summary"), thinkingWrap: thinkingWrap(entry) } : null;
|
|
792
805
|
},
|
|
793
806
|
chronological,
|
|
807
|
+
// From now on the steps are in order: the ones so far, and each new
|
|
808
|
+
// one last.
|
|
809
|
+
inOrder() {
|
|
810
|
+
chronological();
|
|
811
|
+
inOrder = true;
|
|
812
|
+
},
|
|
794
813
|
};
|
|
795
814
|
}
|
|
796
815
|
|
|
@@ -1002,6 +1021,7 @@ export function turnHistoryNodes(items, timing, { thumbs, workingSet = false, no
|
|
|
1002
1021
|
const prompt = group.user != null ? items[group.user] : null;
|
|
1003
1022
|
const drawn = drawnTurnNodes(group, items, { thumbs, capabilities, cards });
|
|
1004
1023
|
if (drawn.block) {
|
|
1024
|
+
if (isParticipantAuthor(prompt?.author)) drawn.block.dataset.participant = "1";
|
|
1005
1025
|
if (workingSet) drawn.block.querySelector(":scope > summary > .tw-sum")?.prepend(nodesOf(footprintTemplate(groupItems(group, ordinal), ordinal)));
|
|
1006
1026
|
blockTurns.push(ordinal);
|
|
1007
1027
|
}
|
|
@@ -149,7 +149,7 @@ function tailClip(text) {
|
|
|
149
149
|
// +stop+: the live row's stop-task button (a node), after the title.
|
|
150
150
|
export function toolRowTemplate(row, opts = {}) {
|
|
151
151
|
const wrong = row.guardrail?.should_have_asked ? " guardrail-wrong" : "";
|
|
152
|
-
return html`<div class=${`activity-row${wrong}`} data-key=${row.key}>${toolRowInnerTemplate(row, opts)}</div>`;
|
|
152
|
+
return html`<div class=${`activity-row${wrong}`} data-key=${row.key} data-tool=${row.tool || nothing}>${toolRowInnerTemplate(row, opts)}</div>`;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
export function toolRowInnerTemplate(row, { thumbs = () => nothing, stop = nothing } = {}) {
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
//
|
|
12
12
|
// A module of its own: static JS is cached at unversioned URLs.
|
|
13
13
|
|
|
14
|
+
import { noContactFill } from "./no_contact_fill.js";
|
|
15
|
+
|
|
14
16
|
// What a row starts with: its recommended option picked, no note.
|
|
15
17
|
export function initialPicks(rows) {
|
|
16
18
|
return (rows || []).map((r) => ({ pick: r.recommended != null ? String(r.recommended) : null, note: "" }));
|
|
@@ -91,6 +93,7 @@ export function drawPicks(picks, { fill, doc = document }) {
|
|
|
91
93
|
add.addEventListener("click", () => {
|
|
92
94
|
const input = el(doc, "input", "wp-note");
|
|
93
95
|
input.type = "text";
|
|
96
|
+
noContactFill(input, "chi-pick-note", { prose: true });
|
|
94
97
|
input.placeholder = "a word for this row";
|
|
95
98
|
input.setAttribute("aria-label", `Note for ${id}`);
|
|
96
99
|
input.addEventListener("input", () => { state[k].note = input.value; });
|
|
@@ -344,7 +344,7 @@ export function createWorkingSet({ historyEl, stageRoot = () => null, state, ses
|
|
|
344
344
|
${urls.length ? html`<div class="ctx-pop-meta">urls · ${urls.length}</div>${labelsTemplate(fold(urls, POP_BUDGET).labels, opts)}` : nothing}
|
|
345
345
|
${added.length ? html`<div class="ctx-pop-meta">adding · ${added.length}</div>${added.map((it) => rowTemplate(it, opts))}` : nothing}
|
|
346
346
|
${pend.size ? html`<div class="ws-pending" role="status"><span class="ws-pending-t">${pend.size} change${pend.size === 1 ? "" : "s"} pending<span class="ws-pending-when"> · apply at the next turn's start</span></span><button type="button" class="ws-act-b" data-ws="undo-all">undo all</button></div>` : nothing}
|
|
347
|
-
${sendLine ? html`<form class="ws-add" data-ws="add-form"><input class="ws-add-in" type="text" name="key" placeholder="+ path, memory:
|
|
347
|
+
${sendLine ? html`<form class="ws-add" data-ws="add-form"><input class="ws-add-in" type="text" name="key" placeholder="+ path, memory:ENTRY or URL" aria-label="Add to the working set: a path, memory:ENTRY or a URL" autocomplete="off" autocapitalize="off" spellcheck="false" enterkeyhint="go"><button type="submit" class="ws-act-b">add</button></form>` : nothing}
|
|
348
348
|
<div class="ctx-pop-meta ws-hint">A file opens its ref; a step tag goes to the call.${sendLine ? " Drop sends stubs instead of an item's reads from the next turn; add asks the model to read one first." : ""}${sendLine && forget ? " Pin keeps an item from the model's forget." : ""} Esc closes.</div>`;
|
|
349
349
|
render(tpl, popover.pop);
|
|
350
350
|
}
|
|
@@ -188,16 +188,13 @@ module Samagotchi
|
|
|
188
188
|
# (SessionAccess::Local#wait_reply). Body: cursor, baseline
|
|
189
189
|
# ({messages, question_id, last_turn}, as the prepare route gave it),
|
|
190
190
|
# turn, queued, ended_before, owner_grace (seconds, null: wait for
|
|
191
|
-
# whatever wakes a worker), timeout (seconds, capped)
|
|
192
|
-
#
|
|
191
|
+
# whatever wakes a worker), timeout (seconds, capped); a 0.165
|
|
192
|
+
# client's running_look is ignored. 200: the ReplyWait::Result's
|
|
193
193
|
# fields (status: done, waiting_for_answer, no_reply, error, stopped,
|
|
194
194
|
# timeout or worker_gone; text, file, question, outcome, …; never the
|
|
195
195
|
# Session) and parent_strategy, what a parent may pick on the
|
|
196
196
|
# session's questions here (ParentReport.strategy_for). A timeout
|
|
197
|
-
# status: ask again
|
|
198
|
-
# null: the running turn this slice saw, so a settle between two
|
|
199
|
-
# slices still ends the wait). 503 server_stopping when chi web stops
|
|
200
|
-
# mid-wait.
|
|
197
|
+
# status: ask again. 503 server_stopping when chi web stops mid-wait.
|
|
201
198
|
def handle_wait(req, id)
|
|
202
199
|
body = body_hash(req) or return error_response(400, "invalid_json", "invalid JSON body")
|
|
203
200
|
options, error = wait_options(body)
|
|
@@ -229,15 +226,8 @@ module Samagotchi
|
|
|
229
226
|
end
|
|
230
227
|
|
|
231
228
|
timeout = [numbers["timeout"] || WAIT_MAX_SECONDS, WAIT_MAX_SECONDS].min
|
|
232
|
-
look = body["running_look"]
|
|
233
|
-
running_look = look.nil? ? nil : ReplyWait::RunningLook.from_h(look)
|
|
234
|
-
if !look.nil? && running_look.nil?
|
|
235
|
-
return [nil, error_response(400, "invalid_wait", "running_look is {last_end, claimed: [file names]}")]
|
|
236
|
-
end
|
|
237
|
-
|
|
238
229
|
[{ cursor: strings["cursor"], turn: strings["turn"], baseline: baseline, timeout: timeout,
|
|
239
|
-
owner_grace: numbers["owner_grace"], queued: body["queued"] == true, ended_before: body["ended_before"] == true,
|
|
240
|
-
running_look: running_look }, nil]
|
|
230
|
+
owner_grace: numbers["owner_grace"], queued: body["queued"] == true, ended_before: body["ended_before"] == true }, nil]
|
|
241
231
|
end
|
|
242
232
|
|
|
243
233
|
def wait_baseline(raw)
|
|
@@ -258,7 +248,6 @@ module Samagotchi
|
|
|
258
248
|
RESULT_FIELDS.each { |key| json[key] = result[key] }
|
|
259
249
|
json[:text] = json[:text]&.dup&.force_encoding(Encoding::UTF_8)&.scrub
|
|
260
250
|
json[:question] = result.question&.to_file
|
|
261
|
-
json[:running_look] = result.running_look&.to_h
|
|
262
251
|
json[:parent_strategy] = strategy_json(strategy)
|
|
263
252
|
json
|
|
264
253
|
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.168.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -460,6 +460,7 @@ files:
|
|
|
460
460
|
- lib/samagotchi/installed_versions.rb
|
|
461
461
|
- lib/samagotchi/interrupted_turn.rb
|
|
462
462
|
- lib/samagotchi/iteration_limit.rb
|
|
463
|
+
- lib/samagotchi/jsonl_store.rb
|
|
463
464
|
- lib/samagotchi/judgments_command.rb
|
|
464
465
|
- lib/samagotchi/kernel_loop.rb
|
|
465
466
|
- lib/samagotchi/last_turn.rb
|
|
@@ -563,9 +564,12 @@ files:
|
|
|
563
564
|
- lib/samagotchi/note_move.rb
|
|
564
565
|
- lib/samagotchi/objectives.rb
|
|
565
566
|
- lib/samagotchi/objectives_audit.rb
|
|
567
|
+
- lib/samagotchi/objectives_backing.rb
|
|
566
568
|
- lib/samagotchi/objectives_check.rb
|
|
567
569
|
- lib/samagotchi/objectives_command.rb
|
|
568
570
|
- lib/samagotchi/objectives_edit.rb
|
|
571
|
+
- lib/samagotchi/objectives_record.rb
|
|
572
|
+
- lib/samagotchi/objectives_track.rb
|
|
569
573
|
- lib/samagotchi/output_formatter.rb
|
|
570
574
|
- lib/samagotchi/owner_lock.rb
|
|
571
575
|
- lib/samagotchi/owner_prompt.rb
|
|
@@ -952,6 +956,7 @@ files:
|
|
|
952
956
|
- lib/samagotchi/web/public/format.js
|
|
953
957
|
- lib/samagotchi/web/public/forms.css
|
|
954
958
|
- lib/samagotchi/web/public/hash_intent.js
|
|
959
|
+
- lib/samagotchi/web/public/history_end.js
|
|
955
960
|
- lib/samagotchi/web/public/history_reveal.js
|
|
956
961
|
- lib/samagotchi/web/public/history_shape.js
|
|
957
962
|
- lib/samagotchi/web/public/icons/chi-180.png
|
|
@@ -978,6 +983,7 @@ files:
|
|
|
978
983
|
- lib/samagotchi/web/public/model_pick.js
|
|
979
984
|
- lib/samagotchi/web/public/model_picker.js
|
|
980
985
|
- lib/samagotchi/web/public/more_sheet.js
|
|
986
|
+
- lib/samagotchi/web/public/no_contact_fill.js
|
|
981
987
|
- lib/samagotchi/web/public/notice_links.js
|
|
982
988
|
- lib/samagotchi/web/public/notifications.js
|
|
983
989
|
- lib/samagotchi/web/public/notify.js
|
|
@@ -985,7 +991,9 @@ files:
|
|
|
985
991
|
- lib/samagotchi/web/public/objectives_entry.js
|
|
986
992
|
- lib/samagotchi/web/public/objectives_model.js
|
|
987
993
|
- lib/samagotchi/web/public/objectives_moves.js
|
|
994
|
+
- lib/samagotchi/web/public/objectives_state.js
|
|
988
995
|
- lib/samagotchi/web/public/objectives_strip.js
|
|
996
|
+
- lib/samagotchi/web/public/objectives_track.js
|
|
989
997
|
- lib/samagotchi/web/public/objectives_wiring.js
|
|
990
998
|
- lib/samagotchi/web/public/owner_claim.js
|
|
991
999
|
- lib/samagotchi/web/public/owner_verify.js
|
|
@@ -1028,14 +1036,18 @@ files:
|
|
|
1028
1036
|
- lib/samagotchi/web/public/session_rename.js
|
|
1029
1037
|
- lib/samagotchi/web/public/session_state.js
|
|
1030
1038
|
- lib/samagotchi/web/public/session_store.js
|
|
1039
|
+
- lib/samagotchi/web/public/session_sync.js
|
|
1031
1040
|
- lib/samagotchi/web/public/session_title.js
|
|
1041
|
+
- lib/samagotchi/web/public/session_view.js
|
|
1032
1042
|
- lib/samagotchi/web/public/sessions_list.js
|
|
1033
1043
|
- lib/samagotchi/web/public/settings_chip.js
|
|
1034
1044
|
- lib/samagotchi/web/public/settings_panel.js
|
|
1035
1045
|
- lib/samagotchi/web/public/shell_command.js
|
|
1036
1046
|
- lib/samagotchi/web/public/shown_texts.js
|
|
1047
|
+
- lib/samagotchi/web/public/stage_cards.js
|
|
1037
1048
|
- lib/samagotchi/web/public/stage_frame.js
|
|
1038
1049
|
- lib/samagotchi/web/public/stage_model.js
|
|
1050
|
+
- lib/samagotchi/web/public/stage_opened.js
|
|
1039
1051
|
- lib/samagotchi/web/public/stage_slots.js
|
|
1040
1052
|
- lib/samagotchi/web/public/stage_stall.js
|
|
1041
1053
|
- lib/samagotchi/web/public/stage_view.js
|