Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

resolve data-voice-guard from the nearest ancestor and name every gated tool in the prompt

[._.]/ Adam Eivy2347d0e2dbdf
diff --git a/client/src/services/domIndex.js b/client/src/services/domIndex.js
index 1aa130e9da..a15cd51aee 100644
--- a/client/src/services/domIndex.js
+++ b/client/src/services/domIndex.js
@@ -213,10 +213,13 @@ export const buildIndex = ({ includeText = false } = {}) => {
for (const el of raw) {
if (elements.length >= MAX_ELEMENTS) break;
- // A control marked `exclude` never reaches the voice index at all — the
- // one way to keep something out of it (issue #5907). Checked before
- // classify/visibility so an excluded control costs nothing else below.
- const guard = el.getAttribute('data-voice-guard');
+ // `data-voice-guard` resolves from the nearest annotated ancestor, not
+ // just the element itself, so marking a container covers every control
+ // inside it (issue #5907) — otherwise excluding a widget would mean
+ // annotating each of its buttons and missing the next one added. A
+ // control marked `exclude` never reaches the voice index at all; checked
+ // before classify/visibility so it costs nothing else below.
+ const guard = el.closest('[data-voice-guard]')?.getAttribute('data-voice-guard');
if (guard === 'exclude') continue;
const kind = classify(el);
if (!kind) continue;
diff --git a/client/src/services/domIndex.test.jsx b/client/src/services/domIndex.test.jsx
index e3a3dd0cd1..6e8d2fd698 100644
--- a/client/src/services/domIndex.test.jsx
+++ b/client/src/services/domIndex.test.jsx
@@ -90,3 +90,44 @@ describe('domIndex buildIndex — data-voice-guard', () => {
expect(save.guard).toBeUndefined();
});
});
+
+// The annotation resolves from the nearest annotated ancestor so a container
+// covers everything inside it — annotating each descendant by hand would miss
+// whichever control gets added next.
+describe('domIndex buildIndex — data-voice-guard on a container', () => {
+ beforeEach(() => {
+ document.body.innerHTML = `
+ <main>
+ <div data-voice-guard="exclude">
+ <button>Widget stop</button>
+ </div>
+ <div data-voice-guard="confirm">
+ <button>Publish</button>
+ <div data-voice-guard="exclude"><button>Nested opt-out</button></div>
+ </div>
+ <button>Save</button>
+ </main>
+ `;
+ makeVisible();
+ });
+
+ it('excludes every control inside an exclude-marked container', () => {
+ const idx = buildIndex();
+ expect(idx.elements.some((e) => e.label === 'Widget stop')).toBe(false);
+ });
+
+ it('carries guard: "confirm" onto a control inside a confirm-marked container', () => {
+ const idx = buildIndex();
+ expect(idx.elements.find((e) => e.label === 'Publish').guard).toBe('confirm');
+ });
+
+ it('lets a nested annotation win over its ancestor', () => {
+ const idx = buildIndex();
+ expect(idx.elements.some((e) => e.label === 'Nested opt-out')).toBe(false);
+ });
+
+ it('leaves a control outside every annotated container unguarded', () => {
+ const idx = buildIndex();
+ expect(idx.elements.find((e) => e.label === 'Save').guard).toBeUndefined();
+ });
+});
diff --git a/server/services/voice/pipeline.js b/server/services/voice/pipeline.js
index 0bdc90793d..59c272e26b 100644
--- a/server/services/voice/pipeline.js
+++ b/server/services/voice/pipeline.js
@@ -233,7 +233,7 @@ const buildSystemPrompt = (cfg) => {
'"save"/"capture"/"add"/"remember"/"note"/"file"/"log it" → matching capture tool (e.g., brain_capture, meatspace_log_*, daily_log_append, goal_log_note). ' +
'"start dictation"/"dictate"/"record my log" → daily_log_start_dictation. ' +
'"what does this say"/"read this aloud"/"read the page to me"/"what\'s on this page" → ui_read, then speak the returned `content` verbatim (do NOT paraphrase or summarize unless the user asked "what is this page about?"). ' +
- 'DESTRUCTIVE-ACTION FLOW: when ui_click returns `confirmation_required: true` the gate has fired — speak the returned `summary` (it tells the user how to confirm) and STOP. The user\'s next utterance ("yes"/"confirm"/"cancel") is handled BY THE SERVER, not by you — do not re-issue ui_click on the same target unless the user rephrases the request after cancelling. ' +
+ 'DESTRUCTIVE-ACTION FLOW: when a UI tool (ui_click, ui_check, ui_fill) returns `confirmation_required: true` the gate has fired — speak the returned `summary` (it tells the user how to confirm) and STOP. The user\'s next utterance ("yes"/"confirm"/"cancel") is handled BY THE SERVER, not by you — do not re-issue that tool on the same target unless the user rephrases the request after cancelling. ' +
'"what time"/"what day"/"what date" → time_now. ' +
'"what are my goals"/"my goals" → goal_list. ' +
'"is anything crashed"/"pm2 status"/"are services up" → pm2_status. ' +