synabun 2.2.0 → 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 +45 -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 +27 -0
- package/neural-interface/i18n/pt-BR.json +27 -0
- package/neural-interface/lib/assistant-api.js +64 -23
- package/neural-interface/lib/assistant-brains/codex.js +6 -1
- package/neural-interface/lib/assistant-catalog.js +20 -2
- package/neural-interface/lib/assistant-dispatch.js +31 -2
- 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 +64 -13
- package/neural-interface/lib/native-loop-providers.js +122 -10
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/opencode-native-boundary.js +155 -21
- 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 +311 -47
- 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-api.js +14 -2
- package/neural-interface/public/shared/assistant/asst-computer.js +73 -4
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +3 -1
- package/neural-interface/public/shared/assistant/asst-motion-gate.js +80 -0
- package/neural-interface/public/shared/assistant/asst-panel.js +8 -4
- package/neural-interface/public/shared/assistant/asst-render.js +72 -11
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +55 -23
- package/neural-interface/public/shared/assistant/asst-scenes.js +225 -79
- package/neural-interface/public/shared/assistant/asst-sidepanel-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-style-cache.js +44 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +26 -5
- 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 +18 -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/loading-teardown.js +34 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +6 -1
- 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 +5 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +16 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +6 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +88 -72
- 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/storage-retry.js +47 -0
- package/neural-interface/public/shared/storage.js +25 -4
- package/neural-interface/public/shared/styles.css +109 -8
- package/neural-interface/public/shared/synabun-mascot.js +27 -8
- package/neural-interface/public/shared/synabun-ticker.js +147 -12
- 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 +238 -90
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-loading.js +5 -4
- 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 +1240 -238
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -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 '';
|
|
@@ -23,6 +23,8 @@ export const TOOL_LIST_COPY = Object.freeze({
|
|
|
23
23
|
noServers: 'No external servers',
|
|
24
24
|
blockedServer: 'Blocked by Agents may use it',
|
|
25
25
|
unavailableServer: 'Unavailable on this provider',
|
|
26
|
+
unknownServer: 'Not checked: the provider\'s MCP configuration could not be read',
|
|
27
|
+
serversUnreadable: 'Could not read the MCP configuration of {providers}; servers configured only there are not listed.',
|
|
26
28
|
agentAccess: 'Agents may use it',
|
|
27
29
|
agentAccessHelp: 'Applies to task workers and automations on Codex, OpenCode and Claude, including FleetView, plus the OpenCode tools picker. Other sessions you drive keep their servers.',
|
|
28
30
|
loadFailed: 'Could not load the tool catalog. Try again.',
|
|
@@ -45,7 +47,20 @@ function groupWord(group, field, translate) {
|
|
|
45
47
|
return group[field];
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
// Product names, never translated.
|
|
51
|
+
const PROVIDER_NAMES = Object.freeze({ codex: 'Codex', opencode: 'OpenCode', 'claude-code': 'Claude Code', antigravity: 'Antigravity' });
|
|
52
|
+
/** Providers whose MCP configuration the server could not read (`externalServerErrors`), for `provider` or every one. */
|
|
53
|
+
export function unreadableProviders(catalog, provider = 'all') {
|
|
54
|
+
const rows = Array.isArray(catalog?.externalServerErrors) ? catalog.externalServerErrors : [];
|
|
55
|
+
return [...new Set(rows.map(row => row?.provider).filter(id => typeof id === 'string' && (!provider || provider === 'all' || id === provider)))];
|
|
56
|
+
}
|
|
57
|
+
/** One sentence naming those providers, or null when every provider was read. */
|
|
58
|
+
export function unreadableServersNote(catalog, provider = 'all', translate) {
|
|
59
|
+
const providers = unreadableProviders(catalog, provider);
|
|
60
|
+
return providers.length ? toolListWord('serversUnreadable', { providers: providers.map(id => PROVIDER_NAMES[id] || id).join(', ') }, translate) : null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const strictToolHost =provider => provider === 'opencode' || provider === 'antigravity';
|
|
49
64
|
export const taskToolHost = provider => strictToolHost(provider) || provider === 'claude-code' || provider === 'codex';
|
|
50
65
|
|
|
51
66
|
/** Hidden-input encoding: inheritance differs from an explicit empty group list. */
|
|
@@ -92,13 +107,17 @@ export function toolListView(catalog, tools, { inheritLabel = null, usesBrowser,
|
|
|
92
107
|
const rows = (catalog.servers || []).filter(row => row.selectable !== false);
|
|
93
108
|
// A saved unavailable ref stays visible and round-trips; loading a catalog never silently clears it.
|
|
94
109
|
for (const ref of refs) if (ref !== 'mcp:*' && !rows.some(row => row.ref === ref)) rows.push({ ref, label: ref.slice(4), providers: {} });
|
|
110
|
+
// A provider the server could not read is `unknown` on every row: disabled like an unavailable one, said apart.
|
|
111
|
+
const unreadable = unreadableServersNote(catalog, provider, translate);
|
|
95
112
|
const options = [
|
|
96
|
-
{ value: 'mcp:*', scope: 'servers', label: word('allServers'), exclusive: true, selected: !inherited && wildcard },
|
|
113
|
+
{ value: 'mcp:*', scope: 'servers', label: word('allServers'), exclusive: true, selected: !inherited && wildcard, ...(unreadable ? { caption: unreadable } : {}) },
|
|
97
114
|
{ value: '__no_servers__', scope: 'servers', label: word('noServers'), exclusive: true, selected: !inherited && !refs.length },
|
|
98
115
|
...rows.map(row => {
|
|
99
116
|
const availability = row.providers?.[provider];
|
|
100
|
-
const
|
|
101
|
-
|
|
117
|
+
const specific = provider && provider !== 'all';
|
|
118
|
+
const unavailable = specific ? availability !== 'deliverable' : !Object.values(row.providers || {}).includes('deliverable');
|
|
119
|
+
const unknown = unavailable && (specific ? availability === 'unknown' : Object.values(row.providers || {}).includes('unknown'));
|
|
120
|
+
return { value: row.ref, scope: 'servers', label: row.label || row.ref.slice(4), selected: !inherited && !wildcard && refs.includes(row.ref), disabled: row.blocked || unavailable, caption: row.blocked ? word('blockedServer') : unknown ? word('unknownServer') : unavailable ? word('unavailableServer') : row.ref };
|
|
102
121
|
}),
|
|
103
122
|
];
|
|
104
123
|
entries.push({ group: word('servers'), options });
|
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
triggerQuickTimerNow,
|
|
77
77
|
} from './api.js';
|
|
78
78
|
import { centeredInFrame, placementArea } from './app-frame.js';
|
|
79
|
+
import { noAccessHTML, refusalOfError } from './ui-owner-access.js';
|
|
79
80
|
|
|
80
81
|
const $ = (id) => document.getElementById(id);
|
|
81
82
|
|
|
@@ -99,6 +100,9 @@ let _prevLoopActive = false;
|
|
|
99
100
|
|
|
100
101
|
// Cleanup: stored references for document-level listeners so closePanel() can remove them
|
|
101
102
|
let _docListeners = [];
|
|
103
|
+
// The server refused this page the studio's lists (no owner access: SynaBun's automation browser opened it): the
|
|
104
|
+
// sidebar says "No access" above the presets, and the poll asks nothing until the studio is opened again.
|
|
105
|
+
let _refusal = null;
|
|
102
106
|
// What the last read found (templates, folders, the active loop, agents): a later open paints from it at once
|
|
103
107
|
// and reads it again behind it.
|
|
104
108
|
let _keptData = null;
|
|
@@ -2349,6 +2353,8 @@ async function loadData() {
|
|
|
2349
2353
|
_templates = templates.status === 'fulfilled' ? migrateLaunchRecords(templates.value) : [];
|
|
2350
2354
|
_folders = folders.status === 'fulfilled' ? folders.value : [];
|
|
2351
2355
|
_activeLoop = active.status === 'fulfilled' ? active.value : null;
|
|
2356
|
+
_refusal = [templates, folders, active].map((r) => (r.status === 'rejected' ? refusalOfError(r.reason) : null)).find(Boolean) || null;
|
|
2357
|
+
if (_refusal) { if (_panel) renderSidebar(); return; }
|
|
2352
2358
|
await refreshAgents();
|
|
2353
2359
|
if (_panel) updateSidebarFooter();
|
|
2354
2360
|
// Kept only when the templates answered (a failed read must not paint an empty studio next time).
|
|
@@ -2359,7 +2365,7 @@ function startPolling() {
|
|
|
2359
2365
|
stopPolling();
|
|
2360
2366
|
_pollTimer = setInterval(async () => {
|
|
2361
2367
|
if (!_panel) { stopPolling(); return; }
|
|
2362
|
-
if (document.hidden) return;
|
|
2368
|
+
if (document.hidden || _refusal) return;
|
|
2363
2369
|
try {
|
|
2364
2370
|
const prev = _activeLoop?.active;
|
|
2365
2371
|
_activeLoop = await fetchActiveLoop();
|
|
@@ -2525,6 +2531,7 @@ function renderSidebar() {
|
|
|
2525
2531
|
}
|
|
2526
2532
|
|
|
2527
2533
|
if (!html) html = '<div class="as-empty">No templates match your filter.</div>';
|
|
2534
|
+
if (_refusal) html = noAccessHTML({ compact: true }) + html;
|
|
2528
2535
|
const scrollTop = list.scrollTop;
|
|
2529
2536
|
list.innerHTML = html;
|
|
2530
2537
|
list.scrollTop = scrollTop;
|