synabun 2.2.1 → 2.2.2
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.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/hooks/claude-code/pre-websearch.mjs +4 -1
- package/hooks/claude-code/prompt-submit.mjs +7 -0
- package/lib/release-scan.mjs +23 -10
- package/lib/virustotal.mjs +143 -39
- package/mcp-server/dist/http.d.ts +19 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +55 -13
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +14 -9
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +118 -0
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-route-flow.js +339 -0
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +2 -2
- package/mcp-server/dist/services/desktop-client.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +66 -3
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +61 -4
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +112 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +555 -61
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/tools/bluesky.d.ts +20 -7
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
- package/mcp-server/dist/tools/bluesky.js +147 -45
- package/mcp-server/dist/tools/bluesky.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +11 -2
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +131 -18
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +4 -2
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +58 -12
- package/mcp-server/src/index.ts +15 -9
- package/mcp-server/src/services/browser-route-flow.ts +402 -0
- package/mcp-server/src/services/desktop-client.ts +2 -2
- package/mcp-server/src/services/identity.ts +80 -4
- package/mcp-server/src/services/neural-interface.ts +572 -70
- package/mcp-server/src/tools/bluesky.ts +164 -51
- package/mcp-server/src/tools/browser-advanced.ts +121 -17
- package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
- package/mcp-server/src/tools/morelogin.ts +4 -2
- package/mcp-server/src/tools/youtube/helpers.ts +2 -2
- package/neural-interface/i18n/en.json +24 -0
- package/neural-interface/i18n/pt-BR.json +24 -0
- package/neural-interface/lib/assistant-api.js +64 -23
- package/neural-interface/lib/assistant-catalog.js +20 -2
- package/neural-interface/lib/assistant-dispatch.js +27 -1
- package/neural-interface/lib/assistant-persona.js +1 -0
- package/neural-interface/lib/assistant-runtime.js +15 -1
- package/neural-interface/lib/assistant-tools.js +10 -1
- package/neural-interface/lib/browser-automation-routes.js +84 -0
- package/neural-interface/lib/browser-execution.js +16 -3
- package/neural-interface/lib/browser-owner.js +48 -0
- package/neural-interface/lib/browser-session-close.js +84 -0
- package/neural-interface/lib/browser-start-handoff.js +202 -0
- package/neural-interface/lib/browser-tool-policy.js +21 -4
- package/neural-interface/lib/browser-wedge-retire.js +64 -0
- package/neural-interface/lib/claude-agent-bridge.js +36 -1
- package/neural-interface/lib/claude-background-hold.js +239 -0
- package/neural-interface/lib/exec-loop-command.js +8 -0
- package/neural-interface/lib/http-guards.js +11 -6
- package/neural-interface/lib/loop-logger.js +6 -1
- package/neural-interface/lib/mcp-external-servers.js +37 -10
- package/neural-interface/lib/native-loop-providers.js +121 -10
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/owner-authority.js +113 -37
- package/neural-interface/lib/page-session.js +81 -23
- package/neural-interface/lib/peer-identity.js +263 -43
- package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
- package/neural-interface/lib/pty-host/core.js +36 -0
- package/neural-interface/lib/pty-host/protocol.js +2 -0
- package/neural-interface/lib/skills/api-v2.js +13 -2
- package/neural-interface/lib/skills/creation-api.js +3 -1
- package/neural-interface/lib/skills/evals-api.js +5 -1
- package/neural-interface/lib/social-write-pacing.js +151 -0
- package/neural-interface/lib/terminal-token-redaction.js +293 -0
- package/neural-interface/lib/terminal-tokens.js +359 -0
- package/neural-interface/lib/worker-mcp-channel.js +45 -10
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/shared/agy/agy-render.js +41 -1
- package/neural-interface/public/shared/agy/agy-styles.js +5 -0
- package/neural-interface/public/shared/api.js +1 -0
- package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +3 -1
- package/neural-interface/public/shared/assistant/asst-panel.js +7 -3
- package/neural-interface/public/shared/assistant/asst-render.js +10 -4
- package/neural-interface/public/shared/assistant/asst-styles.js +2 -1
- package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
- package/neural-interface/public/shared/cp/cp-agents.js +8 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
- package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
- package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
- package/neural-interface/public/shared/judgments-log-origins.js +29 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +4 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
- package/neural-interface/public/shared/owner-access.js +134 -0
- package/neural-interface/public/shared/owner-authority-view.js +92 -0
- package/neural-interface/public/shared/page-session.js +143 -14
- package/neural-interface/public/shared/poll-backoff.js +59 -0
- package/neural-interface/public/shared/settings/settings-data.js +6 -1
- package/neural-interface/public/shared/settings/settings-kit.js +11 -3
- package/neural-interface/public/shared/settings/settings-shell.js +7 -0
- package/neural-interface/public/shared/shown-children.js +72 -0
- package/neural-interface/public/shared/static-bg-state.js +22 -0
- package/neural-interface/public/shared/styles.css +101 -7
- package/neural-interface/public/shared/synabun-tools.js +173 -0
- package/neural-interface/public/shared/tool-heartbeat.js +43 -0
- package/neural-interface/public/shared/tool-list-picker.js +3 -1
- package/neural-interface/public/shared/tool-list-view.js +23 -4
- package/neural-interface/public/shared/ui-automation-studio.js +8 -1
- package/neural-interface/public/shared/ui-claude-panel.js +159 -29
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-navbar.js +6 -0
- package/neural-interface/public/shared/ui-owner-access.js +191 -0
- package/neural-interface/public/shared/ui-owner-authority.js +162 -0
- package/neural-interface/public/shared/ui-sessions.js +45 -16
- package/neural-interface/public/shared/ui-settings.js +86 -15
- package/neural-interface/public/shared/ui-terminal.js +15 -7
- package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
- package/neural-interface/public/shared/ui-update.js +3 -0
- package/neural-interface/public/shared/ui-whiteboard.js +4 -0
- package/neural-interface/public/shared/window-keys.js +38 -0
- package/neural-interface/server.js +1160 -205
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — one gate for a poller that several places share
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// A status poller (the Computer tray's GET /api/desktop/status, asst-computer.js) can run in every Assistant tab at
|
|
6
|
+
// once, each on its own timer. Through one gate they make at most one request at a time and one per interval, and a
|
|
7
|
+
// failure is not asked again at the same pace:
|
|
8
|
+
// • an answer: the next is due one interval later (less a little slack, so the timers that share it do not drift
|
|
9
|
+
// past each other);
|
|
10
|
+
// • a failure: the next is due after an exponential wait, capped (base · factor^failures, at most `maxMs`);
|
|
11
|
+
// • a refusal (the page has no owner access: owner-access.js): no more polling at all until `resume()`, which the
|
|
12
|
+
// page calls when something changed (it got the owner's page secret again, or it became visible again).
|
|
13
|
+
// A request the user asks for (Check again) does not ask the gate; its answer still counts.
|
|
14
|
+
//
|
|
15
|
+
// No DOM: `node --test` loads this file with a test clock (tests/poll-backoff.test.mjs).
|
|
16
|
+
|
|
17
|
+
export const POLL_BACKOFF_DEFAULTS = Object.freeze({ baseMs: 3000, maxMs: 5 * 60_000, factor: 2, slackMs: 250 });
|
|
18
|
+
|
|
19
|
+
/** The wait after `failures` failures in a row: the interval itself for none, then exponential, capped. */
|
|
20
|
+
export function backoffDelay(failures, { baseMs = POLL_BACKOFF_DEFAULTS.baseMs, maxMs = POLL_BACKOFF_DEFAULTS.maxMs, factor = POLL_BACKOFF_DEFAULTS.factor } = {}) {
|
|
21
|
+
const n = Math.max(0, Math.floor(Number(failures) || 0));
|
|
22
|
+
const base = Math.max(0, Number(baseMs) || 0);
|
|
23
|
+
const cap = Math.max(base, Number(maxMs) || 0);
|
|
24
|
+
if (n === 0) return base;
|
|
25
|
+
return Math.min(cap, base * Math.pow(Math.max(1, Number(factor) || 1), n));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function createPollGate({ baseMs = POLL_BACKOFF_DEFAULTS.baseMs, maxMs = POLL_BACKOFF_DEFAULTS.maxMs, factor = POLL_BACKOFF_DEFAULTS.factor, slackMs = POLL_BACKOFF_DEFAULTS.slackMs, now = () => Date.now() } = {}) {
|
|
29
|
+
const opts = { baseMs, maxMs, factor };
|
|
30
|
+
let failures = 0;
|
|
31
|
+
let nextAt = 0;
|
|
32
|
+
let halted = null; // { code, reason } while a refusal stops the polling
|
|
33
|
+
let inFlight = false;
|
|
34
|
+
return {
|
|
35
|
+
/** Whether a timer's tick may send the request now. */
|
|
36
|
+
due() { return !halted && !inFlight && now() >= nextAt; },
|
|
37
|
+
/** A request leaves (timer or user). */
|
|
38
|
+
begin() { inFlight = true; },
|
|
39
|
+
/** It answered. */
|
|
40
|
+
succeed() {
|
|
41
|
+
inFlight = false;
|
|
42
|
+
failures = 0;
|
|
43
|
+
halted = null;
|
|
44
|
+
nextAt = now() + Math.max(0, baseMs - Math.max(0, slackMs));
|
|
45
|
+
},
|
|
46
|
+
/** It failed; `refusal` (owner-access.js) stops the polling until resume(). Returns the wait before the next. */
|
|
47
|
+
fail(refusal = null) {
|
|
48
|
+
inFlight = false;
|
|
49
|
+
failures += 1;
|
|
50
|
+
if (refusal) { halted = { code: refusal.code || null, reason: refusal.reason || null }; return Infinity; }
|
|
51
|
+
const wait = backoffDelay(failures, opts);
|
|
52
|
+
nextAt = now() + wait;
|
|
53
|
+
return wait;
|
|
54
|
+
},
|
|
55
|
+
/** Something changed (owner access back, the page visible again): due at once, from a clean slate. */
|
|
56
|
+
resume() { halted = null; failures = 0; nextAt = 0; },
|
|
57
|
+
snapshot() { return { failures, nextAt, halted, inFlight, waitMs: halted ? Infinity : Math.max(0, nextAt - now()) }; },
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -47,7 +47,12 @@ const caches = Object.fromEntries(Object.entries(SETTINGS_READS).map(([name, spe
|
|
|
47
47
|
load: async () => {
|
|
48
48
|
const res = await fetch(spec.url);
|
|
49
49
|
if (spec.raw) return { status: res.status, body: await res.json().catch(() => null) };
|
|
50
|
-
if (!res.ok)
|
|
50
|
+
if (!res.ok) {
|
|
51
|
+
// The status and the server's code stay with the error: a refusal of the owner's access (403 WORKER_BROWSER…)
|
|
52
|
+
// is "No access" in the modal, never an empty or default setting (owner-access.js refusalOfError).
|
|
53
|
+
const body = await res.json().catch(() => null);
|
|
54
|
+
throw Object.assign(new Error(`${spec.url}: HTTP ${res.status}`), { status: res.status, code: typeof body?.code === 'string' ? body.code : null });
|
|
55
|
+
}
|
|
51
56
|
return res.json();
|
|
52
57
|
},
|
|
53
58
|
accept: spec.raw ? (value) => value?.status >= 200 && value.status < 300 && !!value.body : spec.accept,
|
|
@@ -218,8 +218,14 @@ export function paneActive(overlay, paneId) {
|
|
|
218
218
|
* The status dot on a nav item. Several panes can share a page (WhatsApp and
|
|
219
219
|
* Discord on Messages), so each reports its own status and the page shows
|
|
220
220
|
* "connected" when any of them is. The word is also set for screen readers.
|
|
221
|
-
* @param {'connected'|'disconnected'|''} status
|
|
221
|
+
* @param {'connected'|'disconnected'|'refused'|''} status
|
|
222
222
|
*/
|
|
223
|
+
/** "No access" in the page's language (ownerAccess.navStatus; English when the key is missing). */
|
|
224
|
+
function noAccessWord() {
|
|
225
|
+
const text = t('ownerAccess.navStatus');
|
|
226
|
+
return typeof text === 'string' && text && text !== 'ownerAccess.navStatus' ? text : 'No access';
|
|
227
|
+
}
|
|
228
|
+
|
|
223
229
|
export function setNavStatus(overlay, paneId, status) {
|
|
224
230
|
const page = pageOfPane(paneId);
|
|
225
231
|
const nav = page && overlay.querySelector(`.settings-nav-item[data-tab="${page.id}"]`);
|
|
@@ -227,8 +233,10 @@ export function setNavStatus(overlay, paneId, status) {
|
|
|
227
233
|
const sources = nav._stgStatus || (nav._stgStatus = {});
|
|
228
234
|
if (status) sources[paneId] = status; else delete sources[paneId];
|
|
229
235
|
const values = Object.values(sources);
|
|
230
|
-
|
|
236
|
+
// 'refused': the page has no owner access, so the state is unknown (ui-owner-access.js): "No access", never "Off".
|
|
237
|
+
const next = values.includes('refused') ? 'refused' : values.includes('connected') ? 'connected' : values.includes('disconnected') ? 'disconnected' : '';
|
|
231
238
|
if (next) nav.dataset.status = next; else delete nav.dataset.status;
|
|
232
239
|
const word = nav.querySelector('.stg-nav-status-text');
|
|
233
|
-
|
|
240
|
+
const label = next === 'refused' ? noAccessWord() : next ? t(next === 'connected' ? 'settings.redesign.common.connected' : 'settings.redesign.common.off') : '';
|
|
241
|
+
if (word) word.textContent = label ? ` (${label})` : '';
|
|
234
242
|
}
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
import { sectionOpensByDefault } from './settings-ia.js';
|
|
16
16
|
import { searchSettings, runtimeSearchEntries, highlightParts, SEARCH_LIMIT, SEARCH_QUERY_MAX } from './settings-search.js';
|
|
17
17
|
import { tx, esc } from './settings-kit.js';
|
|
18
|
+
import { watchEmpty } from '../shown-children.js';
|
|
18
19
|
|
|
19
20
|
const TOGGLE_KEYS = new Set(['Enter', ' ']);
|
|
20
21
|
const KEY_ROLES = '[role="button"], [role="radio"], [role="switch"], [role="checkbox"], [role="tab"], [role="option"]';
|
|
21
22
|
const NATIVE_CONTROLS = 'button, a[href], input, select, textarea, summary';
|
|
22
23
|
const STATE_MIRRORS = '[data-stg-pressed], [data-stg-checked], [data-stg-selected]';
|
|
24
|
+
export const COLLAPSIBLE_BODY = '.stg-card[data-collapsible] > .stg-card-body';
|
|
23
25
|
|
|
24
26
|
// ── Sections: which ones the user left open ──
|
|
25
27
|
// One localStorage entry, { "<section id>": true | false }. A section the user never touched
|
|
@@ -217,6 +219,11 @@ export function wireSettingsShell(overlay, { activate }) {
|
|
|
217
219
|
observer.observe(content, { subtree: true, childList: true, attributes: true, attributeFilter: ['class'] });
|
|
218
220
|
overlay.addEventListener('settings-close', () => observer.disconnect());
|
|
219
221
|
|
|
222
|
+
// ── A collapsible card's body with nothing left to show says so (data-empty): styles.css drops its hairline
|
|
223
|
+
// and gap through that, never through a :has() (tests/css-has-performance.test.mjs) ──
|
|
224
|
+
const emptyBodies = watchEmpty(content, COLLAPSIBLE_BODY);
|
|
225
|
+
overlay.addEventListener('settings-close', () => emptyBodies.disconnect());
|
|
226
|
+
|
|
220
227
|
// ── A pane's save bar sits over the bottom of the scroll area: the scroller is told how tall it is,
|
|
221
228
|
// so a control that takes focus (or a deep link) never lands under the bar ──
|
|
222
229
|
const syncBarRoom = () => {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// A container that has nothing left to show says so: data-empty
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// `data-empty` is on a container while none of its element children lacks the `hidden` attribute (no children at
|
|
5
|
+
// all included), and off as soon as one shows. CSS keys on it in place of `.x:not(:has(> :not([hidden])))`: that
|
|
6
|
+
// selector made Chromium re-check the page on every `hidden` toggle anywhere (~12 ms each on Windows), see
|
|
7
|
+
// tests/css-has-performance.test.mjs.
|
|
8
|
+
//
|
|
9
|
+
// syncEmpty(el) is for code that toggles the children itself (call it after the toggles); watchEmpty(root, selector)
|
|
10
|
+
// is for containers whose children many modules fill and toggle: one MutationObserver keeps every matching container
|
|
11
|
+
// true to its children. Mutation callbacks run before the next frame is drawn, so the page never shows a stale state.
|
|
12
|
+
// No imports: it runs under node --test with a stand-in DOM.
|
|
13
|
+
|
|
14
|
+
export const EMPTY_ATTR = 'data-empty';
|
|
15
|
+
|
|
16
|
+
/** Whether one of el's element children lacks the `hidden` attribute. */
|
|
17
|
+
export function hasShownChild(el) {
|
|
18
|
+
for (const child of el?.children || []) {
|
|
19
|
+
if (!child.hasAttribute('hidden')) return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Puts data-empty on el, or takes it off, to match its children. Returns whether it is empty (false for no element). */
|
|
25
|
+
export function syncEmpty(el) {
|
|
26
|
+
if (!el || typeof el.hasAttribute !== 'function') return false;
|
|
27
|
+
const empty = !hasShownChild(el);
|
|
28
|
+
// Written only on a change: an observer of the attribute (or of the page's style) sees nothing otherwise.
|
|
29
|
+
if (el.hasAttribute(EMPTY_ATTR) !== empty) {
|
|
30
|
+
if (empty) el.setAttribute(EMPTY_ATTR, '');
|
|
31
|
+
else el.removeAttribute(EMPTY_ATTR);
|
|
32
|
+
}
|
|
33
|
+
return empty;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Keeps data-empty true on `root` (when it matches `selector`, or always when there is no selector) and on every
|
|
38
|
+
* descendant that matches `selector`, as children come, go and toggle `hidden`.
|
|
39
|
+
* @param {Element} root
|
|
40
|
+
* @param {string|null} [selector] the containers below root; null watches root alone
|
|
41
|
+
* @param {{ Observer?: typeof MutationObserver }} [opts]
|
|
42
|
+
* @returns {{ sync: () => void, disconnect: () => void }}
|
|
43
|
+
*/
|
|
44
|
+
export function watchEmpty(root, selector = null, { Observer = globalThis.MutationObserver } = {}) {
|
|
45
|
+
if (!root) return { sync() {}, disconnect() {} };
|
|
46
|
+
const isContainer = (el) => !!el && el.nodeType === 1
|
|
47
|
+
&& (el === root ? (!selector || el.matches(selector)) : (!!selector && el.matches(selector) && root.contains(el)));
|
|
48
|
+
const syncWithin = (node) => {
|
|
49
|
+
if (!node || node.nodeType !== 1) return;
|
|
50
|
+
if (isContainer(node)) syncEmpty(node);
|
|
51
|
+
if (selector) for (const el of node.querySelectorAll(selector)) syncEmpty(el);
|
|
52
|
+
};
|
|
53
|
+
const sync = () => syncWithin(root);
|
|
54
|
+
sync();
|
|
55
|
+
if (typeof Observer !== 'function') return { sync, disconnect() {} };
|
|
56
|
+
const observer = new Observer((records) => {
|
|
57
|
+
const touched = new Set();
|
|
58
|
+
for (const r of records) {
|
|
59
|
+
if (r.type === 'attributes') {
|
|
60
|
+
// A child's `hidden` changed: its parent is the container to check.
|
|
61
|
+
const parent = r.target.parentNode;
|
|
62
|
+
if (isContainer(parent)) touched.add(parent);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (isContainer(r.target)) touched.add(r.target);
|
|
66
|
+
if (selector) for (const node of r.addedNodes) syncWithin(node);
|
|
67
|
+
}
|
|
68
|
+
for (const el of touched) syncEmpty(el);
|
|
69
|
+
});
|
|
70
|
+
observer.observe(root, { subtree: true, childList: true, attributes: true, attributeFilter: ['hidden'] });
|
|
71
|
+
return { sync, disconnect: () => observer.disconnect() };
|
|
72
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Focus Mode's board (#static-bg) shown or hidden, with the same state on <html> as `static-bg-visible`.
|
|
2
|
+
//
|
|
3
|
+
// Rules outside the board need it (styles.css: the session pills keep clear of the whiteboard rail, the rail's show
|
|
4
|
+
// button exists only in Focus Mode). They used to read it with `:root:has(#static-bg.visible)` and
|
|
5
|
+
// `body:not(:has(#static-bg.visible))`; a :has() anchored on the root makes Chromium check the whole page again on
|
|
6
|
+
// every class change anywhere, which on the Windows desktop app cost tens of ms per change
|
|
7
|
+
// (tests/css-has-performance.test.mjs). No imports: tests/static-bg-state.test.mjs loads it under node.
|
|
8
|
+
|
|
9
|
+
export const STATIC_BG_ROOT_CLASS = 'static-bg-visible';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Show or hide the board and say so on the root. Without a board there is nothing showing, so the root class is
|
|
13
|
+
* cleared then too.
|
|
14
|
+
* @param {Element|null|undefined} staticBg #static-bg
|
|
15
|
+
* @param {boolean} visible
|
|
16
|
+
* @param {Element|null|undefined} [root] <html>
|
|
17
|
+
*/
|
|
18
|
+
export function setStaticBgVisible(staticBg, visible, root = globalThis.document?.documentElement) {
|
|
19
|
+
const on = !!staticBg && !!visible;
|
|
20
|
+
staticBg?.classList.toggle('visible', on);
|
|
21
|
+
root?.classList.toggle(STATIC_BG_ROOT_CLASS, on);
|
|
22
|
+
}
|
|
@@ -6358,7 +6358,7 @@
|
|
|
6358
6358
|
transition: background 0.2s, border-color 0.2s;
|
|
6359
6359
|
}
|
|
6360
6360
|
#toolbar-show-btn[hidden],
|
|
6361
|
-
|
|
6361
|
+
:root:not(.static-bg-visible) #toolbar-show-btn,
|
|
6362
6362
|
body.fe-editor-open #toolbar-show-btn {
|
|
6363
6363
|
display: none;
|
|
6364
6364
|
}
|
|
@@ -6411,7 +6411,10 @@
|
|
|
6411
6411
|
--topright-row: calc(298px + var(--topright-buttons));
|
|
6412
6412
|
--topright-compact: clamp(0, tan(atan2(calc(var(--topright-row) + 45px - var(--topright-band)), 0.01px)), 1);
|
|
6413
6413
|
}
|
|
6414
|
-
|
|
6414
|
+
/* No update button in the row. The state is a class on <html> (ui-update.js applyTopRightButton), not
|
|
6415
|
+
`:root:has(#topright-update-btn[style*="none"])`: a `[style]` test anchored on the root made every inline style
|
|
6416
|
+
change anywhere re-style the whole page (tests/css-has-performance.test.mjs). */
|
|
6417
|
+
:root:not(.topright-update-shown) {
|
|
6415
6418
|
--topright-row: calc(266px + var(--topright-buttons));
|
|
6416
6419
|
}
|
|
6417
6420
|
@container style(--topright-compact: 1) {
|
|
@@ -6431,7 +6434,8 @@
|
|
|
6431
6434
|
:root {
|
|
6432
6435
|
--topright-tray-inset: 0px;
|
|
6433
6436
|
}
|
|
6434
|
-
:
|
|
6437
|
+
/* Focus Mode's board is showing: html.static-bg-visible, set with #static-bg.visible (static-bg-state.js). */
|
|
6438
|
+
:root.static-bg-visible {
|
|
6435
6439
|
--topright-tray-inset: 50px;
|
|
6436
6440
|
}
|
|
6437
6441
|
#topright-controls > #term-minimized-tray {
|
|
@@ -6628,7 +6632,7 @@
|
|
|
6628
6632
|
box-shadow: 0 0 0 2px rgba(18, 18, 22, 0.9);
|
|
6629
6633
|
pointer-events: none;
|
|
6630
6634
|
}
|
|
6631
|
-
#topright-controls.tools-hidden
|
|
6635
|
+
:root.topright-update-shown #topright-controls.tools-hidden .topright-tools-dot {
|
|
6632
6636
|
display: block;
|
|
6633
6637
|
}
|
|
6634
6638
|
|
|
@@ -13830,6 +13834,8 @@
|
|
|
13830
13834
|
.settings-panel .settings-nav-item[data-status="disconnected"]::after { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5); }
|
|
13831
13835
|
.settings-panel .settings-nav-item.active[data-status="connected"]::after { background: #fff; }
|
|
13832
13836
|
.settings-panel .settings-nav-item.active[data-status="disconnected"]::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85); }
|
|
13837
|
+
/* No owner access (ui-owner-access.js): the inline alert's warning tint, a ring like "Off" so it is not a state */
|
|
13838
|
+
.settings-panel .settings-nav-item[data-status="refused"]::after { background: transparent; box-shadow: inset 0 0 0 1.5px #ffb74d; }
|
|
13833
13839
|
|
|
13834
13840
|
.stg-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
|
|
13835
13841
|
.stg-main > .settings-content { flex: 1; min-height: 0; padding: 22px 24px 28px; }
|
|
@@ -13993,7 +13999,9 @@
|
|
|
13993
13999
|
display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center;
|
|
13994
14000
|
}
|
|
13995
14001
|
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > label { grid-column: 1; margin: 0; }
|
|
13996
|
-
|
|
14002
|
+
/* The control itself, named: a subject that matches nearly every element (`> :not(label):not(.stg-help)`) behind a
|
|
14003
|
+
:has() made each whole-page re-style cost tens of ms (tests/css-has-performance.test.mjs). */
|
|
14004
|
+
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle) { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
|
|
13997
14005
|
.settings-panel .stg-field:has(> :is(.cc-dropdown, select, .recall-toggle, input[type="number"], .cc-toggle)) > .stg-help { grid-column: 1; grid-row: 2; }
|
|
13998
14006
|
.settings-panel .stg-toggle-field {
|
|
13999
14007
|
display: flex; align-items: center; gap: 16px;
|
|
@@ -15112,7 +15120,7 @@
|
|
|
15112
15120
|
.settings-panel .stg-card-body > :is(.stg-help, .settings-hint, .cc-hint, .setup-hint, p):first-child { margin-top: 10px !important; }
|
|
15113
15121
|
/* a closed row-card keeps no trace of its body (no stray hairline or gap under the row) */
|
|
15114
15122
|
.settings-panel .stg-card-body .stg-card[data-collapsible].collapsed > .stg-card-body,
|
|
15115
|
-
.settings-panel .stg-card-body .stg-card[data-collapsible] > .stg-card-body
|
|
15123
|
+
.settings-panel .stg-card-body .stg-card[data-collapsible] > .stg-card-body[data-empty] { margin-top: 0; border-top: 0; }
|
|
15116
15124
|
|
|
15117
15125
|
/* ── Chevrons and disclosure triangles: 10px, quiet ── */
|
|
15118
15126
|
.settings-panel :is(.cc-section-chevron, .cc-panel-chevron, .stg-model-expand-icon) { width: 10px !important; height: 10px !important; stroke: rgba(255,255,255,0.45) !important; }
|
|
@@ -29092,8 +29100,94 @@
|
|
|
29092
29100
|
outline: 2px solid var(--stg-focus, #93c5fd);
|
|
29093
29101
|
outline-offset: 2px;
|
|
29094
29102
|
}
|
|
29095
|
-
|
|
29103
|
+
/* Another update toast on the page (both are children of <body>): its sibling, before or after it. Not
|
|
29104
|
+
`body:has(…)`, which re-checks the whole page on every change (tests/css-has-performance.test.mjs). */
|
|
29105
|
+
.update-check-toast:not(.crash-notice) ~ .crash-notice,
|
|
29106
|
+
.crash-notice:has(~ .update-check-toast:not(.crash-notice)) { bottom: auto; top: 64px; }
|
|
29096
29107
|
@media (prefers-reduced-motion: reduce) { .crash-notice { transition: none; } }
|
|
29108
|
+
/* The banner of a degraded owner authority (ui-owner-authority.js): the update toast's glass and type (DESIGN.md
|
|
29109
|
+
`toast`), at the top centre of the page so it never meets the bottom-right toasts, which replace each other (it is
|
|
29110
|
+
not an .update-check-toast for that reason), non-modal (nothing behind it is blocked), with the warning tint of the
|
|
29111
|
+
inline alert (DESIGN.md `alert`: rgba(255,183,77,.22) border, #ffb74d). */
|
|
29112
|
+
.owner-authority-notice {
|
|
29113
|
+
position: fixed;
|
|
29114
|
+
top: 64px;
|
|
29115
|
+
left: 0;
|
|
29116
|
+
right: 0;
|
|
29117
|
+
margin-inline: auto;
|
|
29118
|
+
z-index: 300050;
|
|
29119
|
+
display: flex;
|
|
29120
|
+
gap: 12px;
|
|
29121
|
+
align-items: flex-start;
|
|
29122
|
+
width: max-content;
|
|
29123
|
+
min-width: 240px;
|
|
29124
|
+
max-width: min(520px, calc(100vw - 40px));
|
|
29125
|
+
padding: 12px 14px;
|
|
29126
|
+
border-radius: 14px;
|
|
29127
|
+
background: rgba(20, 20, 24, 0.85);
|
|
29128
|
+
backdrop-filter: blur(20px) saturate(160%);
|
|
29129
|
+
-webkit-backdrop-filter: blur(20px) saturate(160%);
|
|
29130
|
+
border: 1px solid rgba(255, 183, 77, 0.22);
|
|
29131
|
+
color: var(--t-text);
|
|
29132
|
+
font-size: 12px;
|
|
29133
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
29134
|
+
opacity: 0;
|
|
29135
|
+
transform: translateY(-8px);
|
|
29136
|
+
transition: opacity 0.25s ease, transform 0.25s ease;
|
|
29137
|
+
pointer-events: auto;
|
|
29138
|
+
}
|
|
29139
|
+
.owner-authority-notice.show { opacity: 1; transform: translateY(0); }
|
|
29140
|
+
.owner-authority-icon {
|
|
29141
|
+
width: 24px; height: 24px;
|
|
29142
|
+
border-radius: 50%;
|
|
29143
|
+
display: flex; align-items: center; justify-content: center;
|
|
29144
|
+
font-weight: 700; font-size: 14px;
|
|
29145
|
+
flex-shrink: 0;
|
|
29146
|
+
background: rgba(255, 183, 77, 0.18);
|
|
29147
|
+
color: #ffb74d;
|
|
29148
|
+
}
|
|
29149
|
+
.owner-authority-body { flex: 1; min-width: 0; }
|
|
29150
|
+
.owner-authority-title { font-weight: 600; margin-bottom: 4px; }
|
|
29151
|
+
.owner-authority-sub { color: var(--t-muted); overflow-wrap: anywhere; margin-top: 2px; }
|
|
29152
|
+
.owner-authority-reason { font-family: var(--ff-mono, ui-monospace, Menlo, monospace); font-size: 11px; }
|
|
29153
|
+
.owner-authority-hint { color: var(--t-muted); opacity: 0.7; margin-top: 6px; font-size: 11px; overflow-wrap: anywhere; }
|
|
29154
|
+
.owner-authority-notice .action-btn:focus-visible {
|
|
29155
|
+
outline: 2px solid var(--stg-focus, #93c5fd);
|
|
29156
|
+
outline-offset: 2px;
|
|
29157
|
+
}
|
|
29158
|
+
@media (prefers-reduced-motion: reduce) { .owner-authority-notice { transition: none; } }
|
|
29159
|
+
/* The banner of a page without the owner's access (ui-owner-access.js): the same banner, below the one above when
|
|
29160
|
+
both show. A panel whose data was refused shows the "No access" block (the inline alert's warning tint, DESIGN.md
|
|
29161
|
+
`alert`; the card radius and the md spacing) in place of an empty list or default values. */
|
|
29162
|
+
.owner-authority-notice ~ .owner-access-notice { top: 168px; }
|
|
29163
|
+
.owner-no-access {
|
|
29164
|
+
display: flex;
|
|
29165
|
+
gap: 12px;
|
|
29166
|
+
align-items: flex-start;
|
|
29167
|
+
margin: 0 0 12px;
|
|
29168
|
+
padding: 12px 14px;
|
|
29169
|
+
border-radius: 9px;
|
|
29170
|
+
border: 1px solid rgba(255, 183, 77, 0.22);
|
|
29171
|
+
background: rgba(255, 183, 77, 0.06);
|
|
29172
|
+
color: var(--t-text);
|
|
29173
|
+
font-size: 12px;
|
|
29174
|
+
line-height: 1.45;
|
|
29175
|
+
text-align: left;
|
|
29176
|
+
}
|
|
29177
|
+
.owner-no-access--compact { margin: 12px; }
|
|
29178
|
+
.owner-no-access-icon {
|
|
29179
|
+
width: 20px; height: 20px;
|
|
29180
|
+
border-radius: 50%;
|
|
29181
|
+
display: flex; align-items: center; justify-content: center;
|
|
29182
|
+
font-weight: 700; font-size: 12px;
|
|
29183
|
+
flex-shrink: 0;
|
|
29184
|
+
background: rgba(255, 183, 77, 0.18);
|
|
29185
|
+
color: #ffb74d;
|
|
29186
|
+
}
|
|
29187
|
+
.owner-no-access-body { flex: 1; min-width: 0; }
|
|
29188
|
+
.owner-no-access-title { font-weight: 600; margin-bottom: 2px; }
|
|
29189
|
+
.owner-no-access-desc { color: var(--t-muted); overflow-wrap: anywhere; }
|
|
29190
|
+
.owner-access-disabled { cursor: not-allowed; opacity: 0.5; }
|
|
29097
29191
|
|
|
29098
29192
|
.update-channel-pill {
|
|
29099
29193
|
display: inline-block;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun — what a SynaBun MCP tool call is called, one way for every panel
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// Every side panel draws SynaBun's own tools with the SynaBun card (logo, a
|
|
6
|
+
// friendly name, a one-line summary). Which call is SynaBun's, what it is
|
|
7
|
+
// called and what it says on its card are decided here, once:
|
|
8
|
+
//
|
|
9
|
+
// synabunToolKey(name, server?) the bare tool name ('bluesky_post') of a SynaBun call, else null.
|
|
10
|
+
// Claude Code / Codex `mcp__SynaBun__x` (any letter case, also a
|
|
11
|
+
// plugin's `mcp__plugin_<p>_SynaBun__x`), OpenCode `SynaBun_x`, or a
|
|
12
|
+
// tool name with its server given apart (Codex items, Antigravity).
|
|
13
|
+
// isSynabunTool(name, server?) synabunToolKey(...) != null
|
|
14
|
+
// synabunToolGroup(key) what the card's icon is picked by: 'memory' for the memory tools, else
|
|
15
|
+
// the first word of the name (bluesky, browser, gsc, git). Which
|
|
16
|
+
// tool group a tool belongs to is the MCP server's tool catalog
|
|
17
|
+
// (mcp-server/src/services/tool-catalog.ts), never a table here.
|
|
18
|
+
// synabunToolLabel(key) 'Bluesky · Post', 'Recall', 'Search Console · Inspect URL'
|
|
19
|
+
// synabunToolSummary(key, input) one line from the call's input ('' when there is nothing to say)
|
|
20
|
+
//
|
|
21
|
+
// A tool nobody listed still gets a card: its group and action come from its
|
|
22
|
+
// name. No imports and no DOM: node --test, the panels and DOM-free modules
|
|
23
|
+
// (agy-render.js, ocp-v2-*) all load it.
|
|
24
|
+
|
|
25
|
+
const SERVER_RE = /^(?:synabun|plugin_.+_synabun)$/i;
|
|
26
|
+
|
|
27
|
+
/** True when `server` names SynaBun's MCP server (any letter case; a Claude Code plugin's copy too). */
|
|
28
|
+
export function isSynabunServer(server) {
|
|
29
|
+
return SERVER_RE.test(String(server ?? '').trim());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The bare tool name of a SynaBun MCP call, else null.
|
|
34
|
+
* `server`, when the caller knows it apart from the name (Codex item.server, Antigravity ServerName),
|
|
35
|
+
* decides alone: the name is then the tool's own (a prefixed one is unwrapped too).
|
|
36
|
+
*/
|
|
37
|
+
export function synabunToolKey(name, server) {
|
|
38
|
+
const raw = String(name ?? '').trim();
|
|
39
|
+
if (server != null && String(server).trim() !== '') {
|
|
40
|
+
if (!isSynabunServer(server)) return null;
|
|
41
|
+
return unwrap(raw) || raw || null;
|
|
42
|
+
}
|
|
43
|
+
return unwrap(raw);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function unwrap(raw) {
|
|
47
|
+
const mcp = /^mcp__(.+?)__(.+)$/i.exec(raw);
|
|
48
|
+
if (mcp) return isSynabunServer(mcp[1]) ? mcp[2] : null;
|
|
49
|
+
const oc = /^synabun_(.+)$/i.exec(raw);
|
|
50
|
+
return oc ? oc[1] : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** synabunToolKey(name, server) != null */
|
|
54
|
+
export function isSynabunTool(name, server) {
|
|
55
|
+
return synabunToolKey(name, server) != null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ── Names ──
|
|
59
|
+
|
|
60
|
+
// Display names only (what a card says), keyed by the tool's own name.
|
|
61
|
+
// Tools that are one thing, not a group's action:
|
|
62
|
+
const SINGLE = Object.freeze({
|
|
63
|
+
recall: 'Recall', remember: 'Remember', reflect: 'Reflect', forget: 'Forget', restore: 'Restore',
|
|
64
|
+
memories: 'Memories', sync: 'Sync', category: 'Category',
|
|
65
|
+
tool_groups: 'Tool groups', choice: 'Choice', git: 'Git', loop: 'Loop', tictactoe: 'Tic-Tac-Toe',
|
|
66
|
+
style_guide: 'Style Guide', image_staged: 'Staged images', morelogin: 'MoreLogin', skill: 'Skill',
|
|
67
|
+
computer: 'Computer', fb_groups: 'Facebook · Groups', whatsapp_send_file: 'WhatsApp · Send file',
|
|
68
|
+
});
|
|
69
|
+
// The memory tools (their cards share the memory icon).
|
|
70
|
+
const MEMORY = Object.freeze({ recall: 1, remember: 1, reflect: 1, forget: 1, restore: 1, memories: 1, sync: 1, category: 1 });
|
|
71
|
+
// The name a tool's first words stand for; the longest that fits wins.
|
|
72
|
+
const PREFIX_NAMES = Object.freeze({
|
|
73
|
+
browser_extract: 'Extract', browser: 'Browser', bluesky: 'Bluesky', youtube: 'YouTube', gsc: 'Search Console',
|
|
74
|
+
discord: 'Discord', whiteboard: 'Whiteboard', card: 'Cards', agent: 'Agent', computer: 'Computer',
|
|
75
|
+
whatsapp: 'WhatsApp', image: 'Image',
|
|
76
|
+
});
|
|
77
|
+
const PREFIXES = Object.freeze(Object.keys(PREFIX_NAMES).sort((a, b) => b.length - a.length));
|
|
78
|
+
|
|
79
|
+
// Words that are not written in lower case.
|
|
80
|
+
const WORDS = Object.freeze({
|
|
81
|
+
dm: 'DM', ax: 'AX', url: 'URL', urls: 'URLs', id: 'ID', ig: 'IG', li: 'LI', fb: 'FB', wa: 'WA', x: 'X',
|
|
82
|
+
tiktok: 'TikTok', cwv: 'CWV', https: 'HTTPS', api: 'API', ai: 'AI', ui: 'UI', faq: 'FAQ',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Names a reader knows better than the words of the tool's name.
|
|
86
|
+
const ACTION_NAMES = Object.freeze({
|
|
87
|
+
browser_go_back: 'Back',
|
|
88
|
+
browser_go_forward: 'Forward',
|
|
89
|
+
browser_extract_tweets: 'Tweets',
|
|
90
|
+
browser_extract_fb_posts: 'Facebook posts',
|
|
91
|
+
browser_extract_fb_groups: 'Facebook groups',
|
|
92
|
+
browser_fb_composer_state: 'Facebook composer',
|
|
93
|
+
browser_x_compose_state: 'X composer',
|
|
94
|
+
bluesky_search_actors: 'Search users',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
function words(text) {
|
|
98
|
+
const parts = String(text || '').split(/[_\s-]+/).filter(Boolean)
|
|
99
|
+
.map((w) => WORDS[w.toLowerCase()] || w.toLowerCase());
|
|
100
|
+
if (!parts.length) return '';
|
|
101
|
+
const first = parts[0];
|
|
102
|
+
parts[0] = first === first.toLowerCase() ? first.charAt(0).toUpperCase() + first.slice(1) : first;
|
|
103
|
+
return parts.join(' ');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function prefixOf(key) {
|
|
107
|
+
for (const prefix of PREFIXES) {
|
|
108
|
+
if (key === prefix || key.startsWith(`${prefix}_`)) return { prefix, label: PREFIX_NAMES[prefix] };
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** What a SynaBun card's icon is picked by: 'memory', or the first word of the tool's name. */
|
|
114
|
+
export function synabunToolGroup(key) {
|
|
115
|
+
const k = String(key || '').trim().toLowerCase();
|
|
116
|
+
if (!k) return '';
|
|
117
|
+
if (Object.prototype.hasOwnProperty.call(MEMORY, k)) return 'memory';
|
|
118
|
+
return k.split('_')[0];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 'Bluesky · Post', 'Recall', 'Browser · Navigate': the name a SynaBun card shows. */
|
|
122
|
+
export function synabunToolLabel(key) {
|
|
123
|
+
const k = String(key || '').trim().toLowerCase();
|
|
124
|
+
if (!k) return 'SynaBun';
|
|
125
|
+
if (Object.prototype.hasOwnProperty.call(SINGLE, k)) return SINGLE[k];
|
|
126
|
+
const g = prefixOf(k);
|
|
127
|
+
if (!g) return words(k);
|
|
128
|
+
const action = ACTION_NAMES[k] || words(k.slice(g.prefix.length + 1));
|
|
129
|
+
return action ? `${g.label} · ${action}` : g.label;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ── Summaries ──
|
|
133
|
+
|
|
134
|
+
const MAX_SUMMARY = 90;
|
|
135
|
+
|
|
136
|
+
function line(value) {
|
|
137
|
+
if (value == null) return '';
|
|
138
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
139
|
+
if (typeof value !== 'string') return '';
|
|
140
|
+
const s = value.replace(/\s+/g, ' ').trim();
|
|
141
|
+
return s.length > MAX_SUMMARY ? `${s.slice(0, MAX_SUMMARY - 1)}…` : s;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// What a call is about, in the order a reader looks for it. `action` is put in front of it.
|
|
145
|
+
const SUBJECT_FIELDS = ['query', 'q', 'url', 'text', 'content', 'title', 'prompt', 'task', 'message', 'handle', 'actor',
|
|
146
|
+
'uri', 'name', 'property', 'site', 'video_id', 'videoId', 'channel_id', 'selector', 'label', 'key', 'path', 'memory_id', 'id'];
|
|
147
|
+
|
|
148
|
+
const BY_TOOL = Object.freeze({
|
|
149
|
+
remember: (i) => [i.category, i.content].map(line).filter(Boolean).join(': '),
|
|
150
|
+
reflect: (i) => line(i.content) || (i.memory_id ? `Update ${String(i.memory_id).slice(0, 8)}` : ''),
|
|
151
|
+
forget: (i) => line(String(i.memory_id || '').slice(0, 8)),
|
|
152
|
+
restore: (i) => line(String(i.memory_id || '').slice(0, 8)),
|
|
153
|
+
sync: () => '',
|
|
154
|
+
browser_press: (i) => line(i.key),
|
|
155
|
+
browser_scroll: (i) => line(i.direction || i.selector),
|
|
156
|
+
browser_evaluate: (i) => line(i.script || i.expression),
|
|
157
|
+
browser_type: (i) => line(i.text || i.selector),
|
|
158
|
+
browser_fill: (i) => line(i.value || i.text || i.selector),
|
|
159
|
+
browser_select: (i) => line(i.value || i.selector),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/** One line from a SynaBun call's input: what it is about, '' when there is nothing to say. */
|
|
163
|
+
export function synabunToolSummary(key, input) {
|
|
164
|
+
const i = input && typeof input === 'object' && !Array.isArray(input) ? input : {};
|
|
165
|
+
const k = String(key || '').toLowerCase();
|
|
166
|
+
const own = BY_TOOL[k];
|
|
167
|
+
if (own) { try { return own(i) || ''; } catch { return ''; } }
|
|
168
|
+
const action = line(i.action);
|
|
169
|
+
let subject = '';
|
|
170
|
+
for (const f of SUBJECT_FIELDS) { subject = line(i[f]); if (subject) break; }
|
|
171
|
+
if (action && subject) return line(`${action} · ${subject}`);
|
|
172
|
+
return action || subject;
|
|
173
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// ── Claude Code tool heartbeats (DOM-free, no imports) ──
|
|
2
|
+
// A tool call that runs past 30 s gets a heartbeat from the CLI every 30 s:
|
|
3
|
+
//
|
|
4
|
+
// { type: 'tool_progress', tool_use_id: '<call id>-heartbeat-0',
|
|
5
|
+
// parent_tool_use_id: '<call id>', heartbeat: true, elapsed_time_seconds: 30 }
|
|
6
|
+
//
|
|
7
|
+
// Its parent_tool_use_id is the call itself, not a subagent that made it, so it
|
|
8
|
+
// must not be routed the way a subagent's messages are (by parent_tool_use_id):
|
|
9
|
+
// the Claude panel drew a fallback subagent card for it at the root of the
|
|
10
|
+
// transcript (a purple bar between two tool rows, which also split one run of
|
|
11
|
+
// calls into rows), and the Assistant opened a subagent feed inside the call.
|
|
12
|
+
// Both panels read a heartbeat as progress of the call it names instead.
|
|
13
|
+
// (Seen live with Claude Code 2.1.316: Bash and MCP calls alike.)
|
|
14
|
+
|
|
15
|
+
const HEARTBEAT_SUFFIX = /-heartbeat-\d+$/;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The id of the tool call a heartbeat is about, or null when the event is not a
|
|
19
|
+
* heartbeat. The CLI's `heartbeat: true` decides; an id of the `-heartbeat-N`
|
|
20
|
+
* form counts too (a producer that leaves the flag out).
|
|
21
|
+
*/
|
|
22
|
+
export function heartbeatToolId(ev) {
|
|
23
|
+
if (!ev || ev.type !== 'tool_progress') return null;
|
|
24
|
+
const own = typeof ev.tool_use_id === 'string' ? ev.tool_use_id : '';
|
|
25
|
+
const flagged = ev.heartbeat === true;
|
|
26
|
+
if (!flagged && !HEARTBEAT_SUFFIX.test(own)) return null;
|
|
27
|
+
const parent = typeof ev.parent_tool_use_id === 'string' ? ev.parent_tool_use_id : '';
|
|
28
|
+
// The call named in the heartbeat's own id; else its parent.
|
|
29
|
+
const named = own.replace(HEARTBEAT_SUFFIX, '');
|
|
30
|
+
if (named && named !== own) return named;
|
|
31
|
+
return parent || own || null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A heartbeat as the progress of its call, at the level the call was made: the
|
|
36
|
+
* same event with `tool_use_id` set to the call and no parent. Any other event is
|
|
37
|
+
* returned unchanged (the same object).
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeToolHeartbeat(ev) {
|
|
40
|
+
const id = heartbeatToolId(ev);
|
|
41
|
+
if (!id) return ev;
|
|
42
|
+
return { ...ev, tool_use_id: id, parent_tool_use_id: null, heartbeat_of: id };
|
|
43
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Shared cc-dropdown rendering; the pure view owns labels and catalog-derived choices.
|
|
2
2
|
import { dropdownHTML, setDropdownItems, dropdownOf } from './cc-dropdown.js';
|
|
3
|
-
import { toolListView, toolListWord, toolsFromInput, strictToolHost, taskToolHost } from './tool-list-view.js';
|
|
3
|
+
import { toolListView, toolListWord, toolsFromInput, strictToolHost, taskToolHost, unreadableServersNote } from './tool-list-view.js';
|
|
4
4
|
import { getCachedToolCatalog, fetchToolCatalog } from './agent-runtime-options.js';
|
|
5
5
|
let translate;
|
|
6
6
|
export function configureToolPickerTranslation(fn) { if (typeof fn === 'function') translate = fn; }
|
|
7
7
|
export { toolsFromInput, strictToolHost, taskToolHost };
|
|
8
8
|
export const toolWord = (key, params) => toolListWord(key, params, translate);
|
|
9
|
+
/** The sentence naming the providers whose MCP configuration the server could not read, or null. */
|
|
10
|
+
export const toolServersNote = (catalog, provider = 'all') => unreadableServersNote(catalog, provider, translate);
|
|
9
11
|
export function toolPickerHTML(id, tools, options = {}) {
|
|
10
12
|
const catalog = options.catalog || getCachedToolCatalog(options.cwd);
|
|
11
13
|
if (!catalog) return '';
|