samagotchi 0.133.0 → 0.134.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 +68 -1
- data/docs/cli.md +11 -0
- data/docs/configuration.md +8 -4
- data/docs/guardrails.md +102 -13
- data/docs/internals/background-tasks.md +1 -0
- data/docs/internals/participants.md +6 -5
- data/docs/internals/tool-guardrails.md +2 -0
- data/docs/plugins.md +2 -1
- data/docs/sessions.md +3 -2
- data/docs/testing.md +7 -2
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/chi_home.rb +12 -2
- data/lib/samagotchi/desktop/macos.rb +19 -4
- data/lib/samagotchi/engine.rb +13 -0
- data/lib/samagotchi/guardrails/implicit_writers.rb +143 -0
- data/lib/samagotchi/guardrails/pair_boundary.rb +6 -4
- data/lib/samagotchi/guardrails/pair_command.rb +493 -60
- data/lib/samagotchi/guardrails/parent_approvals.rb +1 -1
- data/lib/samagotchi/guardrails/read_only_shell.rb +34 -2
- data/lib/samagotchi/guardrails/shell_git_dirs.rb +6 -1
- data/lib/samagotchi/guardrails/shell_lex.rb +23 -0
- data/lib/samagotchi/guardrails/shell_paths.rb +3 -2
- data/lib/samagotchi/guardrails/targets.rb +8 -3
- data/lib/samagotchi/home_command.rb +22 -6
- data/lib/samagotchi/home_doctor.rb +36 -3
- data/lib/samagotchi/home_notice.rb +8 -1
- data/lib/samagotchi/hooks/loader.rb +5 -0
- data/lib/samagotchi/log_line.rb +12 -0
- data/lib/samagotchi/project_env.rb +3 -11
- data/lib/samagotchi/self_report.rb +3 -1
- data/lib/samagotchi/system_one/self_protect.rb +58 -2
- data/lib/samagotchi/testing/waiting.rb +13 -0
- data/lib/samagotchi/toolkit_binding.rb +16 -0
- data/lib/samagotchi/update_command.rb +7 -3
- data/lib/samagotchi/update_hint.rb +6 -1
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/public/answer_fold.js +262 -0
- data/lib/samagotchi/web/public/answer_refs.js +2 -0
- data/lib/samagotchi/web/public/app.js +18 -1
- data/lib/samagotchi/web/public/cards_place.js +5 -2
- data/lib/samagotchi/web/public/chip_popover.js +73 -11
- data/lib/samagotchi/web/public/claim_link.js +4 -2
- data/lib/samagotchi/web/public/composer.css +3 -1
- data/lib/samagotchi/web/public/history_reveal.js +23 -0
- data/lib/samagotchi/web/public/index.html +44 -28
- data/lib/samagotchi/web/public/llm_context_chip.js +5 -13
- data/lib/samagotchi/web/public/refs.js +6 -7
- data/lib/samagotchi/web/public/review_start.js +1 -1
- data/lib/samagotchi/web/public/start_page.js +4 -4
- data/lib/samagotchi/web/public/start_settings.js +29 -18
- data/lib/samagotchi/web/public/start_toolkit.js +5 -4
- data/lib/samagotchi/web/public/timing.js +5 -1
- data/lib/samagotchi/web/public/turn_html.js +12 -6
- data/lib/samagotchi/web/public/turn_range.js +32 -0
- data/lib/samagotchi/web/public/turn_view.js +21 -11
- data/lib/samagotchi/web/public/verdict_card.js +5 -13
- data/lib/samagotchi/web/public/verify_target.js +7 -10
- metadata +5 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { findClaim, ownerClaimHash } from "./claim_link.js";
|
|
2
|
+
import { revealInHistory } from "./history_reveal.js";
|
|
3
|
+
import { turnElements } from "./turn_range.js";
|
|
2
4
|
|
|
3
5
|
const TYPES = Object.freeze({
|
|
4
6
|
confirmed: { icon: "✅", label: "confirmed" },
|
|
@@ -69,7 +71,7 @@ export function placeVerdict(root, record, {
|
|
|
69
71
|
event.preventDefault();
|
|
70
72
|
const check = [...root.querySelectorAll("[data-turn-id]")]
|
|
71
73
|
.find((element) => element.dataset.turnId === record.check_turn_id);
|
|
72
|
-
if (check) check.scrollIntoView?.({ behavior: "smooth", block: "center" });
|
|
74
|
+
if (check) revealInHistory(check).scrollIntoView?.({ behavior: "smooth", block: "center" });
|
|
73
75
|
else onMissingCheck?.(record);
|
|
74
76
|
});
|
|
75
77
|
card.append(heading, quote, reason, link);
|
|
@@ -93,18 +95,8 @@ function quotedElement(source, quote, selector, opts) {
|
|
|
93
95
|
return element || null;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
// +source+'s turn
|
|
97
|
-
//
|
|
98
|
-
function turnElements(source) {
|
|
99
|
-
const elements = [];
|
|
100
|
-
for (let next = source.nextElementSibling; next; next = next.nextElementSibling) {
|
|
101
|
-
if (next.matches("[data-turn-id]") || next.querySelector("[data-turn-id]")) break;
|
|
102
|
-
elements.push(next);
|
|
103
|
-
}
|
|
104
|
-
while (elements.at(-1)?.classList.contains("time-gap")) elements.pop();
|
|
105
|
-
return elements;
|
|
106
|
-
}
|
|
107
|
-
|
|
98
|
+
// +source+'s turn's last element (turn_range.js: up to the next opening or
|
|
99
|
+
// a context note), else +source+.
|
|
108
100
|
function turnEnd(source) {
|
|
109
101
|
return turnElements(source).at(-1) || source;
|
|
110
102
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// page offers Verify where the server will accept it, and nowhere else.
|
|
10
10
|
//
|
|
11
11
|
// The turn is the page's own grouping (claim_link.js turnIdOf,
|
|
12
|
-
//
|
|
12
|
+
// turn_range.js turnElements): the last turn opening ([data-turn-id]) at
|
|
13
13
|
// or before the selection, and its elements up to the next opening. Its
|
|
14
14
|
// final answer is the last of them matching the page's answer selector.
|
|
15
15
|
//
|
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
// `node --test` with happy-dom. A module of its own: static JS is cached at
|
|
18
18
|
// unversioned URLs, and a new export on an old module would blank the page.
|
|
19
19
|
|
|
20
|
+
import { NOTE_BOUNDARY, turnElements } from "./turn_range.js";
|
|
21
|
+
|
|
20
22
|
const PRECEDING = 2;
|
|
21
23
|
|
|
22
24
|
// The owner's page: an answer bubble (not a delegate report's reply, which
|
|
23
25
|
// a turn shows before its answer); a context note ends a turn's elements
|
|
24
26
|
// (a wake turn starts with one, and its bubble carries no turn id).
|
|
25
|
-
export const OWNER_FINAL = Object.freeze({ answers: ".bubble.output:not(.report-reply)", boundary:
|
|
27
|
+
export const OWNER_FINAL = Object.freeze({ answers: ".bubble.output:not(.report-reply)", boundary: NOTE_BOUNDARY });
|
|
26
28
|
// The participant page: a reply's bubble.
|
|
27
29
|
export const PARTICIPANT_FINAL = Object.freeze({ answers: ".p-msg.reply > .p-bubble", boundary: null });
|
|
28
30
|
|
|
@@ -38,16 +40,11 @@ function openingOf(container, node) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
// The final answer of the turn whose opening is +anchor+: the last element
|
|
41
|
-
// matching +answers+ among
|
|
42
|
-
//
|
|
43
|
+
// matching +answers+ among its turn's elements (turn_range.js, with
|
|
44
|
+
// +boundary+). null when it has none.
|
|
43
45
|
function finalAnswer(container, anchor, { answers, boundary }) {
|
|
44
|
-
let top = anchor;
|
|
45
|
-
while (top && top.parentElement !== container) top = top.parentElement;
|
|
46
|
-
if (!top) return null;
|
|
47
46
|
let final = null;
|
|
48
|
-
for (
|
|
49
|
-
if (el.matches("[data-turn-id]") || el.querySelector("[data-turn-id]")) break;
|
|
50
|
-
if (boundary && el.matches(boundary)) break;
|
|
47
|
+
for (const el of turnElements(anchor, { container, boundary })) {
|
|
51
48
|
const inside = [...el.querySelectorAll(answers)];
|
|
52
49
|
if (inside.length) final = inside[inside.length - 1];
|
|
53
50
|
else if (el.matches(answers)) final = el;
|
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.134.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -350,6 +350,7 @@ files:
|
|
|
350
350
|
- lib/samagotchi/guardrails/context.rb
|
|
351
351
|
- lib/samagotchi/guardrails/data_readers.rb
|
|
352
352
|
- lib/samagotchi/guardrails/gate.rb
|
|
353
|
+
- lib/samagotchi/guardrails/implicit_writers.rb
|
|
353
354
|
- lib/samagotchi/guardrails/load_failures.rb
|
|
354
355
|
- lib/samagotchi/guardrails/model_size.rb
|
|
355
356
|
- lib/samagotchi/guardrails/outside.rb
|
|
@@ -771,6 +772,7 @@ files:
|
|
|
771
772
|
- lib/samagotchi/web/public/annotate_bar.js
|
|
772
773
|
- lib/samagotchi/web/public/annotate_presets.js
|
|
773
774
|
- lib/samagotchi/web/public/annotations.js
|
|
775
|
+
- lib/samagotchi/web/public/answer_fold.js
|
|
774
776
|
- lib/samagotchi/web/public/answer_refs.js
|
|
775
777
|
- lib/samagotchi/web/public/app.js
|
|
776
778
|
- lib/samagotchi/web/public/apple-touch-icon.png
|
|
@@ -803,6 +805,7 @@ files:
|
|
|
803
805
|
- lib/samagotchi/web/public/favicon.svg
|
|
804
806
|
- lib/samagotchi/web/public/format.js
|
|
805
807
|
- lib/samagotchi/web/public/forms.css
|
|
808
|
+
- lib/samagotchi/web/public/history_reveal.js
|
|
806
809
|
- lib/samagotchi/web/public/hold.js
|
|
807
810
|
- lib/samagotchi/web/public/icons/chi-180.png
|
|
808
811
|
- lib/samagotchi/web/public/icons/chi-192.png
|
|
@@ -890,6 +893,7 @@ files:
|
|
|
890
893
|
- lib/samagotchi/web/public/turn_events.js
|
|
891
894
|
- lib/samagotchi/web/public/turn_html.js
|
|
892
895
|
- lib/samagotchi/web/public/turn_model.js
|
|
896
|
+
- lib/samagotchi/web/public/turn_range.js
|
|
893
897
|
- lib/samagotchi/web/public/turn_view.js
|
|
894
898
|
- lib/samagotchi/web/public/unqueue.js
|
|
895
899
|
- lib/samagotchi/web/public/update_notice.js
|