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
|
@@ -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;
|
|
@@ -17,6 +17,7 @@ import { state, emit, on } from './state.js';
|
|
|
17
17
|
import { forgetGreeting, mountGreeting } from './greeting/greeting-card.js';
|
|
18
18
|
import { fetchClaudeSessions, fetchBrowserSessions, searchSessions } from './api.js';
|
|
19
19
|
import { createFrameRenderer } from './utils.js';
|
|
20
|
+
import { refreshPageSession } from './page-session.js';
|
|
20
21
|
import { notify, NOTIF_TYPE } from './ui-notifications.js';
|
|
21
22
|
import { registerSidepanel, setSidepanelVisible, syncSidepanelLayout, focusSidepanel, openAnotherSidepanelSession, isHostedSessionFocused } from './ui-sidepanel-windows.js';
|
|
22
23
|
import { mountCliBanner } from './ui-cli-banner.js';
|
|
@@ -36,7 +37,7 @@ import { buildAgentCard, ensureAgentScope, noteAgentActivity, updateAgentTodoBad
|
|
|
36
37
|
import { renderPermissionCard, renderPlanApprovalCard, renderElicitationCard, decorateAskCard, askAnnotations, markAskAnswered, PERMISSION_MODES, MODE_LABELS } from './cp/cp-permissions.js';
|
|
37
38
|
import { normalizeSession, changedStartSettings, sessionFlags, sessionRows, fastModeSupported, fastModeReason, mergeSessionModels, parseMcpServerLines, formatMcpServerLines } from './cp/cp-session-model.js';
|
|
38
39
|
import { renderSessionSettingsCard } from './cp/cp-session-settings.js';
|
|
39
|
-
import { describeOrigin, reconcileTasks, adoptLiveTasks, describeHistorySystemRow, workEndedByRestart, isTaskRunning } from './cp/cp-tasks-model.js';
|
|
40
|
+
import { describeOrigin, reconcileTasks, adoptLiveTasks, describeHistorySystemRow, workEndedByRestart, isTaskRunning, endRunningTasks, backgroundWaitLine } from './cp/cp-tasks-model.js';
|
|
40
41
|
import { renderTasksCard } from './cp/cp-tasks.js';
|
|
41
42
|
import { sessionListLabel, collectTags, tagSession as tagClaudeSession, sessionActionsAvailable, sessionOpsSupported, labelledSessionIds, mergeSessionSearch, writeSessionTitle, forkSession as forkClaudeSession, deleteSession as deleteClaudeSession, fetchSubagentMessages, forkTitle, entryBefore, promptText, removeFrom, sessionRowParts, fillSelectOptions } from './cp/cp-sessions.js';
|
|
42
43
|
import { contextCard, usageCard, mcpRows, rewindPreviewText, rewindResultText } from './cp/cp-usage-model.js';
|
|
@@ -50,6 +51,8 @@ import { CP_STYLES } from './cp/cp-styles.js';
|
|
|
50
51
|
import { TEMPORARY_CAPABILITY, keepsNothing, chooseTemporary, applyTemporary, temporaryRefusal, endTemporary, leaveTemporary, tabAfterTemporary, persistableTabs, temporaryBlocks, reattaches } from './cp/cp-temporary.js';
|
|
51
52
|
import { paintTemporary } from './cp/cp-temporary-view.js';
|
|
52
53
|
import { renderMarkdown } from './cp/cp-markdown.js';
|
|
54
|
+
import { synabunToolKey, synabunToolLabel, synabunToolSummary, synabunToolGroup } from './synabun-tools.js';
|
|
55
|
+
import { normalizeToolHeartbeat } from './tool-heartbeat.js';
|
|
53
56
|
import { sanitizeStoredHtml } from './assistant/asst-sanitize.js';
|
|
54
57
|
import { escapeHtml, classToken } from './cp/cp-markdown.js';
|
|
55
58
|
import { rehydrateStoredTranscript } from './cp/cp-rehydrate.js';
|
|
@@ -85,9 +88,12 @@ const ICON_CHECK = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" s
|
|
|
85
88
|
const ICON_X = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4l8 8M12 4l-8 8"/></svg>';
|
|
86
89
|
|
|
87
90
|
// ── SynaBun MCP tool registry ──
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
// Which call is SynaBun's, and the name and summary of one this registry does not
|
|
92
|
+
// list, come from synabun-tools.js (every panel's): `mcp__SynaBun__x` in any letter
|
|
93
|
+
// case, a plugin's copy of the server, OpenCode's `SynaBun_x`. Every SynaBun tool
|
|
94
|
+
// gets the branded card; the registry only adds an icon and a summary of its own.
|
|
95
|
+
function isSynaBunTool(name) { return synabunToolKey(name) != null; }
|
|
96
|
+
function synaBunToolKey(name) { return synabunToolKey(name) || ''; }
|
|
91
97
|
|
|
92
98
|
const SB_ICON_RECALL = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2C5.2 2 3 4.2 3 7c0 1.8 1 3.4 2.4 4.2V13h5.2v-1.8C12 10.4 13 8.8 13 7c0-2.8-2.2-5-5-5z"/><path d="M6 13.5h4M6.5 15h3"/><circle cx="11.5" cy="4" r="2.5"/><path d="M10.5 4h2M11.5 3v2"/></svg>';
|
|
93
99
|
const SB_ICON_REMEMBER = '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2C5.2 2 3 4.2 3 7c0 1.8 1 3.4 2.4 4.2V13h5.2v-1.8C12 10.4 13 8.8 13 7c0-2.8-2.2-5-5-5z"/><path d="M6 13.5h4M6.5 15h3"/><path d="M7 6.5h2M8 5.5v2"/></svg>';
|
|
@@ -118,25 +124,17 @@ const SYNABUN_TOOLS = {
|
|
|
118
124
|
loop: { label: 'Loop', group: 'system', icon: SB_ICON_LOOP, detailFn: i => i.action || '' },
|
|
119
125
|
tictactoe: { label: 'Tic-Tac-Toe', group: 'fun', icon: SB_ICON_TICTACTOE, detailFn: i => i.action || '' },
|
|
120
126
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
discord: { label: 'Discord', group: 'discord', icon: SB_ICON_DISCORD, detailFn: i => i.action || i.channel_id || '' },
|
|
124
|
-
whiteboard: { label: 'Whiteboard', group: 'whiteboard', icon: SB_ICON_WHITEBOARD, detailFn: i => i.id || '' },
|
|
125
|
-
card: { label: 'Card', group: 'card', icon: SB_ICON_CARD, detailFn: i => i.card_id || '' },
|
|
126
|
-
browser_extract: { label: 'Extract', group: 'browser', icon: SB_ICON_BROWSER, detailFn: i => i.url || i.selector || '' },
|
|
127
|
-
};
|
|
127
|
+
// The icon of a SynaBun tool the registry does not list, by its group (the logo otherwise).
|
|
128
|
+
const SYNABUN_GROUP_ICONS = { browser: SB_ICON_BROWSER, discord: SB_ICON_DISCORD, whiteboard: SB_ICON_WHITEBOARD, card: SB_ICON_CARD, memory: SB_ICON_MEMORIES };
|
|
128
129
|
|
|
130
|
+
/** The card of a SynaBun tool: { label, group, icon, detailFn }; null only for a call that is not SynaBun's. */
|
|
129
131
|
function getSynaBunMeta(name) {
|
|
130
|
-
const
|
|
132
|
+
const raw = synabunToolKey(name);
|
|
133
|
+
if (raw == null) return null;
|
|
134
|
+
const key = raw.toLowerCase();
|
|
131
135
|
if (Object.prototype.hasOwnProperty.call(SYNABUN_TOOLS, key)) return SYNABUN_TOOLS[key];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const action = key.slice(prefix.length + 1) || '';
|
|
135
|
-
const actionLabel = action.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
|
|
136
|
-
return { ...meta, label: actionLabel ? `${meta.label}: ${actionLabel}` : meta.label };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
136
|
+
const group = synabunToolGroup(key);
|
|
137
|
+
return { label: synabunToolLabel(key), group, icon: SYNABUN_GROUP_ICONS[group] || SYNABUN_LOGO_ICON, detailFn: i => synabunToolSummary(key, i) };
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
function toolIconSvg(name) {
|
|
@@ -1880,7 +1878,9 @@ function injectStyles() {
|
|
|
1880
1878
|
.cp-messages pre code[class*="diff"] {
|
|
1881
1879
|
display: block; white-space: pre;
|
|
1882
1880
|
}
|
|
1883
|
-
|
|
1881
|
+
/* A diff block, as addCopyButtons() found it (data-diff-wrapped, set once). Not :has(code[class*="diff"]): a
|
|
1882
|
+
class test inside :has() re-checked the page on every class change anywhere (css-has-performance test). */
|
|
1883
|
+
.cp-messages pre:has(code[data-diff-wrapped]) {
|
|
1884
1884
|
background: rgba(0,0,0,0.4);
|
|
1885
1885
|
border-color: rgba(140,160,200,0.15);
|
|
1886
1886
|
}
|
|
@@ -1893,6 +1893,7 @@ function injectStyles() {
|
|
|
1893
1893
|
|
|
1894
1894
|
/* ── MCP collapse markers ── */
|
|
1895
1895
|
.tool-mcp-badge {
|
|
1896
|
+
border: none; cursor: pointer; line-height: 1.4;
|
|
1896
1897
|
margin-left: 6px; padding: 1px 6px; border-radius: 4px;
|
|
1897
1898
|
background: rgba(255,195,0,0.14); color: rgba(255,210,60,0.9);
|
|
1898
1899
|
font-size: 9px; font-family: 'JetBrains Mono', monospace; font-weight: 600;
|
|
@@ -4746,6 +4747,28 @@ function _renderHistoryRow(tab, $msgs, m) {
|
|
|
4746
4747
|
return;
|
|
4747
4748
|
}
|
|
4748
4749
|
if (m.role === 'assistant') {
|
|
4750
|
+
// Only calls, right after an assistant row (its words, or the calls before them): the same
|
|
4751
|
+
// row, as the live path shows a run of calls (toolRunRow).
|
|
4752
|
+
const onlyCalls = !m.text && !m.thinking && Array.isArray(m.tools) && m.tools.length > 0
|
|
4753
|
+
&& m.tools.every(t => t && typeof t === 'object' && t.name && t.name !== 'AskUserQuestion' && t.name !== 'ExitPlanMode');
|
|
4754
|
+
const runRow = onlyCalls ? toolRunRowIn($msgs, live ? tab.thinkingEl : null, { afterWords: true }) : null;
|
|
4755
|
+
if (runRow) {
|
|
4756
|
+
const runWrap = runRow.querySelector(':scope > .msg-content');
|
|
4757
|
+
for (const t of m.tools) {
|
|
4758
|
+
const card = buildTool(t, tab);
|
|
4759
|
+
if (!card) continue;
|
|
4760
|
+
if (t.id && $msgs._replayCards instanceof Map) $msgs._replayCards.set(String(t.id), card);
|
|
4761
|
+
runWrap.appendChild(card);
|
|
4762
|
+
}
|
|
4763
|
+
if (m.uuid) runRow.dataset.uuids = [runRow.dataset.uuids, m.uuid].filter(Boolean).join(' ');
|
|
4764
|
+
if (live && tab._pendingResults instanceof Map && tab._pendingResults.size) {
|
|
4765
|
+
for (const t of m.tools) {
|
|
4766
|
+
const ev = t?.id ? takePendingResult(tab, t.id) : null;
|
|
4767
|
+
if (ev) { try { updateToolResult(tab, ev); } catch {} }
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
return;
|
|
4771
|
+
}
|
|
4749
4772
|
const el = document.createElement('div'); el.className = 'msg msg-assistant';
|
|
4750
4773
|
if (m.uuid) el.dataset.uuids = m.uuid;
|
|
4751
4774
|
const avatar = document.createElement('div'); avatar.className = 'msg-avatar';
|
|
@@ -5788,6 +5811,10 @@ function _processTabMsg(tab, msg) {
|
|
|
5788
5811
|
|
|
5789
5812
|
function handleTabEvent(tab, ev) {
|
|
5790
5813
|
if (!ev?.type) return;
|
|
5814
|
+
// A call running past 30 s gets a heartbeat whose parent_tool_use_id is the call
|
|
5815
|
+
// itself, not a subagent: it is progress of that call, never a subagent's card
|
|
5816
|
+
// (tool-heartbeat.js).
|
|
5817
|
+
ev = normalizeToolHeartbeat(ev);
|
|
5791
5818
|
|
|
5792
5819
|
// ── Subagent scope routing (SDK engine) ──
|
|
5793
5820
|
// Messages emitted by a Task subagent carry parent_tool_use_id; route them to
|
|
@@ -6281,6 +6308,13 @@ function handleStreamDelta(tab, apiEvent) {
|
|
|
6281
6308
|
// (with full input) when the complete message arrives. No buildTool side
|
|
6282
6309
|
// effects fire for ghosts.
|
|
6283
6310
|
if (tab._stream.blockType === 'tool_use' && apiEvent.content_block?.id && apiEvent.content_block?.name !== 'AskUserQuestion') {
|
|
6311
|
+
// A message that opens with a tool call, right after a row of tool calls: the same row.
|
|
6312
|
+
const joined = !tab._stream.el ? toolRunRow(tab) : null;
|
|
6313
|
+
if (joined) {
|
|
6314
|
+
tab._stream.el = joined;
|
|
6315
|
+
tab._stream.joined = true;
|
|
6316
|
+
if (tab._stream.msgId) { tab.currentMsgId = tab._stream.msgId; tab.currentMsgEl = joined; tab._joinedMsgId = tab._stream.msgId; }
|
|
6317
|
+
}
|
|
6284
6318
|
if (!tab._stream.el) {
|
|
6285
6319
|
const el = document.createElement('div');
|
|
6286
6320
|
el.className = 'msg msg-assistant';
|
|
@@ -6304,7 +6338,11 @@ function handleStreamDelta(tab, apiEvent) {
|
|
|
6304
6338
|
ghost.className = 'tool-card tool-streaming';
|
|
6305
6339
|
ghost.dataset.toolId = cb.id;
|
|
6306
6340
|
ghost.dataset.toolName = cb.name || '';
|
|
6307
|
-
|
|
6341
|
+
const sbMeta = getSynaBunMeta(cb.name);
|
|
6342
|
+
if (sbMeta) ghost.classList.add('synabun-card');
|
|
6343
|
+
ghost.innerHTML = sbMeta
|
|
6344
|
+
? `<div class="tool-hdr synabun-hdr"><span class="tool-icon synabun-icon">${SYNABUN_LOGO_ICON}</span><span class="tool-name synabun-name">${esc(sbMeta.label)}</span><span class="tool-detail">…</span></div>`
|
|
6345
|
+
: `<div class="tool-hdr"><span class="tool-icon">${toolIconSvg(cb.name)}</span><span class="tool-name">${esc(cb.name || 'tool')}</span><span class="tool-detail">…</span></div>`;
|
|
6308
6346
|
wrapEl.appendChild(ghost);
|
|
6309
6347
|
try { if (!tab._agentScope) setActivity(tab, cpActivityVerb(cb.name, {})); } catch {}
|
|
6310
6348
|
if (tab === activeTab()) scrollEnd();
|
|
@@ -6378,6 +6416,7 @@ function handleStreamDelta(tab, apiEvent) {
|
|
|
6378
6416
|
// Lazy-create row + body on first visible text. Keeps empty/whitespace-only
|
|
6379
6417
|
// text blocks from leaving a blank row next to the avatar.
|
|
6380
6418
|
if (!tab._stream.bodyEl && tab._stream.textBuf.trim()) {
|
|
6419
|
+
if (tab._stream.joined) { tab._stream.el = null; tab._stream.joined = false; tab._joinedMsgId = null; }
|
|
6381
6420
|
if (!tab._stream.el) {
|
|
6382
6421
|
const el = document.createElement('div');
|
|
6383
6422
|
el.className = 'msg msg-assistant';
|
|
@@ -6693,6 +6732,25 @@ function _cleanupEmptyAssistantRow(el) {
|
|
|
6693
6732
|
return false;
|
|
6694
6733
|
}
|
|
6695
6734
|
|
|
6735
|
+
/**
|
|
6736
|
+
* The assistant row a message of tool calls alone continues: the last row of the
|
|
6737
|
+
* transcript (the thinking indicator aside), with an avatar, ending on a tool card.
|
|
6738
|
+
* Anything after it (a note, a permission or question card, a turn footer, a status
|
|
6739
|
+
* line, the user's prompt) ends the run. null when there is none.
|
|
6740
|
+
*/
|
|
6741
|
+
function toolRunRowIn($msgs, skip = null, { afterWords = false } = {}) {
|
|
6742
|
+
if (!$msgs) return null;
|
|
6743
|
+
let prev = $msgs.lastElementChild;
|
|
6744
|
+
if (prev && skip && prev === skip) prev = prev.previousElementSibling;
|
|
6745
|
+
if (!prev?.classList?.contains('msg-assistant') || prev.dataset.workerQuestionId) return null;
|
|
6746
|
+
if (!prev.querySelector(':scope > .msg-avatar')) return null;
|
|
6747
|
+
const last = prev.querySelector(':scope > .msg-content')?.lastElementChild;
|
|
6748
|
+
if (last?.classList?.contains('tool-card')) return prev;
|
|
6749
|
+
// (History: a transcript keeps the words and the calls of one message on two lines.)
|
|
6750
|
+
return afterWords && last?.classList?.contains('msg-body') ? prev : null;
|
|
6751
|
+
}
|
|
6752
|
+
function toolRunRow(tab) { return toolRunRowIn(tab?.messagesEl, tab?.thinkingEl); }
|
|
6753
|
+
|
|
6696
6754
|
function renderAssistant(tab, msg) {
|
|
6697
6755
|
const $msgs = tab.messagesEl;
|
|
6698
6756
|
if (!$msgs) return;
|
|
@@ -6735,6 +6793,14 @@ function renderAssistant(tab, msg) {
|
|
|
6735
6793
|
saveTabs();
|
|
6736
6794
|
}
|
|
6737
6795
|
|
|
6796
|
+
// A message whose cards joined the row before it (toolRunRow) and that now carries words or
|
|
6797
|
+
// thinking: those go in a row of their own, below; its cards stay where they are.
|
|
6798
|
+
let ownRow = false;
|
|
6799
|
+
if (msgId && msgId === tab._joinedMsgId && msgId === tab.currentMsgId && tab.currentMsgEl
|
|
6800
|
+
&& (texts.some(b => (b.text || '').trim()) || thinks.some(b => (b.thinking || '').trim()))) {
|
|
6801
|
+
tab.currentMsgEl = null; tab.currentMsgId = null; tab._joinedMsgId = null; ownRow = true;
|
|
6802
|
+
}
|
|
6803
|
+
|
|
6738
6804
|
// Partial message dedup
|
|
6739
6805
|
if (msgId && msgId === tab.currentMsgId && tab.currentMsgEl) {
|
|
6740
6806
|
const wrap = tab.currentMsgEl.querySelector('.msg-content');
|
|
@@ -6786,7 +6852,10 @@ function renderAssistant(tab, msg) {
|
|
|
6786
6852
|
const existingToolIds = new Set([...wrap.querySelectorAll('.tool-card, .plan-card')].map(c => c.dataset.toolId));
|
|
6787
6853
|
for (const t of regularTools) {
|
|
6788
6854
|
if (!existingToolIds.has(t.id || '')) {
|
|
6789
|
-
|
|
6855
|
+
// (Already shown in another row: the cards of a message split by toolRunRow.)
|
|
6856
|
+
const elsewhere = t.id ? $msgs.querySelector(`.tool-card[data-tool-id="${CSS.escape(t.id)}"], .plan-card[data-tool-id="${CSS.escape(t.id)}"]`) : null;
|
|
6857
|
+
if (!elsewhere) wrap.appendChild(buildTool(t, tab));
|
|
6858
|
+
else if (elsewhere.classList.contains('tool-streaming')) elsewhere.replaceWith(buildTool(t, tab));
|
|
6790
6859
|
} else {
|
|
6791
6860
|
// Backfill streaming ghost stubs with the real card now that full input arrived
|
|
6792
6861
|
const ghost = wrap.querySelector(`.tool-card.tool-streaming[data-tool-id="${CSS.escape(t.id || '')}"]`);
|
|
@@ -6815,7 +6884,23 @@ function renderAssistant(tab, msg) {
|
|
|
6815
6884
|
return;
|
|
6816
6885
|
}
|
|
6817
6886
|
|
|
6818
|
-
// New assistant message
|
|
6887
|
+
// New assistant message. One that is only tool calls, right after a row whose last item is a
|
|
6888
|
+
// tool card, is the same stretch of work: its cards join that row (one avatar for the run of
|
|
6889
|
+
// calls, the way parallel calls share one), instead of a row per call.
|
|
6890
|
+
const shownTools = ownRow ? regularTools.filter(t => !t.id || !$msgs.querySelector(`.tool-card[data-tool-id="${CSS.escape(t.id)}"]`)) : regularTools;
|
|
6891
|
+
const joined = !ownRow && !thinks.length && !texts.some(b => (b.text || '').trim()) && !askTools.length && !extras.any && shownTools.length
|
|
6892
|
+
? toolRunRow(tab) : null;
|
|
6893
|
+
if (joined) {
|
|
6894
|
+
const joinedWrap = joined.querySelector(':scope > .msg-content');
|
|
6895
|
+
for (const t of shownTools) joinedWrap.appendChild(buildTool(t, tab));
|
|
6896
|
+
if (msgId) { tab.currentMsgId = msgId; tab.currentMsgEl = joined; tab._joinedMsgId = msgId; }
|
|
6897
|
+
const postPlanJ = $msgs.querySelector('.post-plan-card')?.closest('.msg');
|
|
6898
|
+
if (postPlanJ && postPlanJ !== $msgs.lastElementChild) $msgs.appendChild(postPlanJ);
|
|
6899
|
+
if (tab.thinkingEl && tab.thinkingEl.parentNode === $msgs && tab.thinkingEl !== $msgs.lastElementChild) $msgs.appendChild(tab.thinkingEl);
|
|
6900
|
+
if (tab === activeTab()) scrollEnd();
|
|
6901
|
+
scheduleSessionSnapshotSave(tab);
|
|
6902
|
+
return;
|
|
6903
|
+
}
|
|
6819
6904
|
const el = document.createElement('div');
|
|
6820
6905
|
el.className = 'msg msg-assistant';
|
|
6821
6906
|
const avatar = document.createElement('div');
|
|
@@ -6847,7 +6932,7 @@ function renderAssistant(tab, msg) {
|
|
|
6847
6932
|
wrap.appendChild(body);
|
|
6848
6933
|
}
|
|
6849
6934
|
}
|
|
6850
|
-
for (const t of
|
|
6935
|
+
for (const t of shownTools) wrap.appendChild(buildTool(t, tab));
|
|
6851
6936
|
for (const t of askTools) wrap.appendChild(buildAskFromToolUse(tab, t));
|
|
6852
6937
|
el.appendChild(wrap);
|
|
6853
6938
|
$msgs.appendChild(el);
|
|
@@ -10121,7 +10206,9 @@ function showBrowserEmbed(sessionId, url) {
|
|
|
10121
10206
|
if (!_cpWsReconnAttempted) {
|
|
10122
10207
|
_cpWsReconnAttempted = true;
|
|
10123
10208
|
console.log('[claude-panel] Browser WS closed, retrying once for', sessionId);
|
|
10124
|
-
setTimeout(() => {
|
|
10209
|
+
setTimeout(async () => {
|
|
10210
|
+
// A socket refused for an earlier boot's page secret never says why: ask for this boot's first.
|
|
10211
|
+
await refreshPageSession(window);
|
|
10125
10212
|
if (_browserEmbed?.sessionId !== sessionId) return;
|
|
10126
10213
|
const proto2 = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
10127
10214
|
const ws2 = new WebSocket(`${proto2}//${location.host}/ws/browser/${sessionId}`);
|
|
@@ -10536,6 +10623,16 @@ function _onMessagesClick(e) {
|
|
|
10536
10623
|
});
|
|
10537
10624
|
return;
|
|
10538
10625
|
}
|
|
10626
|
+
// A run of repeated MCP calls: its badge shows or folds the calls after the first.
|
|
10627
|
+
const mcpBadge = e.target.closest('.tool-mcp-badge');
|
|
10628
|
+
if (mcpBadge) {
|
|
10629
|
+
const first = mcpBadge.closest('.tool-card');
|
|
10630
|
+
if (first) {
|
|
10631
|
+
first.dataset.mcpOpen = first.dataset.mcpOpen === '1' ? '0' : '1';
|
|
10632
|
+
try { collapseAdjacentMcpTools(first.parentElement); } catch {}
|
|
10633
|
+
}
|
|
10634
|
+
return;
|
|
10635
|
+
}
|
|
10539
10636
|
// File links (a.file-link, and the links of a message's Markdown) are taken by _fileLinkOptions below.
|
|
10540
10637
|
const hdr = e.target.closest('.tool-hdr');
|
|
10541
10638
|
if (hdr && !e.target.closest('button, a, input, select, textarea')) {
|
|
@@ -10717,6 +10814,8 @@ export async function attachClaudeAutomation(run, { focus = !!run?.focus, isCanc
|
|
|
10717
10814
|
tab._automationResumes = Math.max(tab._automationResumes || 0, resumes);
|
|
10718
10815
|
if (suspended) _showRunSuspended(tab, run);
|
|
10719
10816
|
else tab._automationSuspendedAt = null;
|
|
10817
|
+
// An ended run's CLI is gone, and every background shell or Monitor with it.
|
|
10818
|
+
if (!running && !suspended) _endRunBackgroundWork(tab);
|
|
10720
10819
|
// (A dispatched worker's failure, with its reason, is on its end card.)
|
|
10721
10820
|
if (run.status === 'failed' && run.error && !isDispatchedRun(run) && tab._automationLifecycleError !== run.error) {
|
|
10722
10821
|
tab._automationLifecycleError = run.error;
|
|
@@ -10768,6 +10867,13 @@ export function handleClaudeAutomationEvent(runId, payload) {
|
|
|
10768
10867
|
appendError(tab, event.message || 'Claude Code automation failed');
|
|
10769
10868
|
return true;
|
|
10770
10869
|
}
|
|
10870
|
+
// The run's turn waits for its own background work (lib/claude-background-hold.js): say so once per change.
|
|
10871
|
+
if (event.type === 'synabun.background_wait') {
|
|
10872
|
+
const line = backgroundWaitLine(event);
|
|
10873
|
+
if (line && line !== tab._backgroundWaitLine) appendStatus(tab, line);
|
|
10874
|
+
tab._backgroundWaitLine = line || null;
|
|
10875
|
+
return true;
|
|
10876
|
+
}
|
|
10771
10877
|
handleTabMsg(tab, { type: 'event', event, fromRun: true });
|
|
10772
10878
|
// Background agents still running keep a warm worker's "Task complete" away.
|
|
10773
10879
|
if (event.type === 'system' || event.type === 'result') updateWorkerEndBusy(runId, hasLiveBackgroundWork(tab));
|
|
@@ -10839,6 +10945,23 @@ function _closeCutOffTools(tab) {
|
|
|
10839
10945
|
_setBackgroundWork(tab, []);
|
|
10840
10946
|
}
|
|
10841
10947
|
|
|
10948
|
+
// A run that ended (completed, stopped, failed): its CLI process is gone, so nothing it ran in the background runs
|
|
10949
|
+
// any more. The tasks it never reported the end of (the run closed its query first) are ended here, or the
|
|
10950
|
+
// Background work card shows them running forever.
|
|
10951
|
+
function _endRunBackgroundWork(tab) {
|
|
10952
|
+
let changed = false;
|
|
10953
|
+
try { changed = endRunningTasks(tab.tasks) > 0; } catch {}
|
|
10954
|
+
let shells = false;
|
|
10955
|
+
for (const task of tab.bgTasks?.values?.() || []) {
|
|
10956
|
+
if (task?.status === 'running') { task.status = 'stopped'; shells = true; }
|
|
10957
|
+
}
|
|
10958
|
+
if (shells) { try { renderBgTray(tab); } catch {} }
|
|
10959
|
+
if ((tab.backgroundWork || []).length) _setBackgroundWork(tab, []);
|
|
10960
|
+
else if (changed || shells) updatePillRunning(tab);
|
|
10961
|
+
// An open tasks card follows along.
|
|
10962
|
+
if ((changed || shells) && tab.messagesEl?.querySelector('.cp-tasks-card')) { try { _openTasks(tab); } catch {} }
|
|
10963
|
+
}
|
|
10964
|
+
|
|
10842
10965
|
// The end of a worker the Assistant dispatched (ui-worker-end.js): one card,
|
|
10843
10966
|
// the last row of its transcript. Its button closes this tab the way the X
|
|
10844
10967
|
// does (a warm worker that finished its task is completed, one still at work
|
|
@@ -11563,11 +11686,18 @@ function collapseAdjacentMcpTools($msgs) {
|
|
|
11563
11686
|
const flush = () => {
|
|
11564
11687
|
if (group.length < 2) { group = []; return; }
|
|
11565
11688
|
const first = group[0];
|
|
11566
|
-
|
|
11689
|
+
// The badge shows the calls it folds away and folds them again (_onMessagesClick):
|
|
11690
|
+
// what each of them did stays one click away.
|
|
11691
|
+
const open = first.dataset.mcpOpen === '1';
|
|
11692
|
+
const badge = document.createElement('button');
|
|
11693
|
+
badge.type = 'button';
|
|
11567
11694
|
badge.className = 'tool-mcp-badge';
|
|
11568
11695
|
badge.textContent = `×${group.length}`;
|
|
11569
|
-
|
|
11570
|
-
|
|
11696
|
+
badge.setAttribute('aria-expanded', open ? 'true' : 'false');
|
|
11697
|
+
badge.title = open ? 'Fold the repeated calls' : `Show all ${group.length} calls`;
|
|
11698
|
+
const hdr = first.querySelector('.tool-hdr');
|
|
11699
|
+
if (hdr) hdr.insertBefore(badge, hdr.querySelector(':scope > .tool-chevron'));
|
|
11700
|
+
if (!open) for (let i = 1; i < group.length; i++) group[i].classList.add('cp-mcp-collapsed');
|
|
11571
11701
|
group = [];
|
|
11572
11702
|
};
|
|
11573
11703
|
// True if `c` is the next tool-card sibling after `prev` (same parent, only
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
import { escapeHtml, debounce } from './utils.js';
|
|
21
21
|
import { storage } from './storage.js';
|
|
22
22
|
import * as kit from './settings/settings-kit.js';
|
|
23
|
+
import { logOriginFilter } from './judgments-log-origins.js';
|
|
24
|
+
import { markNoAccess, noteOwnerAccessRefusal, ownerAccessSay, refusalOfError } from './ui-owner-access.js';
|
|
23
25
|
|
|
24
26
|
// Mirrors ui-settings.js (module-local there; duplicated to avoid an import cycle).
|
|
25
27
|
const CHEVRON_ICON = '<svg class="cc-section-chevron" viewBox="0 0 24 24"><polyline points="9 18 15 12 9 6"/></svg>';
|
|
@@ -47,6 +49,19 @@ const PRE = 'margin:0;white-space:pre-wrap;font-size:11px;max-height:160px;overf
|
|
|
47
49
|
const LINK = 'color:var(--accent);text-decoration:underline dotted;text-underline-offset:2px;cursor:pointer';
|
|
48
50
|
/** A server new enough to attribute log rows to sessions and count from the log. Older ones get the per-process view. */
|
|
49
51
|
const serverV2 = (cfg) => Boolean(cfg && (Array.isArray(cfg.origins) || (cfg.logStats && typeof cfg.logStats === 'object')));
|
|
52
|
+
/** The log's origin options for a config answer (judgments-log-origins.js decides which): the server's own list, with
|
|
53
|
+
* the note on "live" in its tooltip (a select is as wide as its longest option), or an older server's three. */
|
|
54
|
+
function logOriginOptions(cfg) {
|
|
55
|
+
const { listed, values } = logOriginFilter(cfg);
|
|
56
|
+
const all = '<option value="">' + kit.te('settings.redesign.judgments.allOrigins') + '</option>';
|
|
57
|
+
if (!listed) {
|
|
58
|
+
const label = { live: kit.te('settings.redesign.judgments.live'), backfill: kit.te('settings.redesign.judgments.backfill'), bench: kit.te('settings.redesign.judgments.bench') };
|
|
59
|
+
return all + values.map(o => `<option value="${attr(o)}">${label[o] ?? escapeHtml(o)}</option>`).join('');
|
|
60
|
+
}
|
|
61
|
+
return all + values.map(o => o === 'live'
|
|
62
|
+
? '<option value="live" title="' + kit.te('settings.redesign.judgments.everyOriginExceptBackfillAndBench') + '">' + kit.te('settings.redesign.judgments.liveRealTime') + '</option>'
|
|
63
|
+
: `<option value="${attr(o)}">${escapeHtml(o)}</option>`).join('');
|
|
64
|
+
}
|
|
50
65
|
const fin = (v) => v != null && v !== '' && Number.isFinite(Number(v));
|
|
51
66
|
const shortId = (id) => String(id ?? '').slice(0, 8);
|
|
52
67
|
const memLink = (id) => (id == null || id === '') ? '' : `<a href="#" class="jv-entity" data-entity="${attr(id)}" title="${attr(id)}${kit.te('settings.redesign.judgments.showEveryJudgmentAboutThisMemory')}" style="${LINK};font-family:monospace">${escapeHtml(shortId(id))}</a>`;
|
|
@@ -280,7 +295,7 @@ export function buildJudgmentsTab() {
|
|
|
280
295
|
${section({ id: 'jv-sec-log', title: kit.tx('settings.redesign.judgments.judgmentLog'), badgeId: 'jv-log-badge', body: `
|
|
281
296
|
<div class="settings-key-row" style="display:flex;gap:6px;align-items:center;flex-wrap:wrap">
|
|
282
297
|
<select id="jv-log-surface" style="${smallInput};width:auto"><option value="">${kit.te('settings.redesign.judgments.allSurfaces')}</option></select>
|
|
283
|
-
<select id="jv-log-origin" style="${smallInput};width:auto"
|
|
298
|
+
<select id="jv-log-origin" style="${smallInput};width:auto">${logOriginOptions(null)}</select>
|
|
284
299
|
<input type="text" id="jv-log-session" placeholder="${kit.te('settings.redesign.judgments.sessionId')}" title="${kit.te('settings.redesign.judgments.rowsFromOneClaudeCodeSession')}" autocomplete="off" spellcheck="false" style="${smallInput};width:110px;display:none">
|
|
285
300
|
<input type="text" id="jv-log-entity" placeholder="${kit.te('settings.redesign.judgments.memoryId')}" title="${kit.te('settings.redesign.judgments.rowsAboutOneMemory')}" autocomplete="off" spellcheck="false" style="${smallInput};width:110px">
|
|
286
301
|
<input type="text" id="jv-log-project" placeholder="${kit.te('settings.redesign.judgments.project')}" title="${kit.te('settings.redesign.judgments.rowsFromOneProject')}" autocomplete="off" spellcheck="false" style="${smallInput};width:100px;display:none">
|
|
@@ -343,7 +358,7 @@ export function wireJudgmentsTab(overlay, { toast = () => {}, initial = null } =
|
|
|
343
358
|
const text = await res.text();
|
|
344
359
|
let json;
|
|
345
360
|
try { json = JSON.parse(text); } catch { json = { ok: false, error: text.slice(0, 120) || `HTTP ${res.status}` }; }
|
|
346
|
-
if (!res.ok && json.ok !== false) json = { ok: false, error: json.error || `HTTP ${res.status}`, status: res.status };
|
|
361
|
+
if (!res.ok && json.ok !== false) json = { ok: false, error: json.error || `HTTP ${res.status}`, status: res.status, ...(typeof json.code === 'string' ? { code: json.code } : {}) };
|
|
347
362
|
if (json.status === undefined) json.status = res.status;
|
|
348
363
|
return json;
|
|
349
364
|
};
|
|
@@ -389,6 +404,18 @@ export function wireJudgmentsTab(overlay, { toast = () => {}, initial = null } =
|
|
|
389
404
|
// ── Renderers ──
|
|
390
405
|
function setHeader(cfg) {
|
|
391
406
|
const dot = $('jv-status-dot'), line = $('jv-status-line');
|
|
407
|
+
// No owner access (SynaBun's automation browser opened this page): "No access", the pane's controls off and no more
|
|
408
|
+
// polling, never "Off" (ui-owner-access.js).
|
|
409
|
+
const refusal = refusalOfError(cfg);
|
|
410
|
+
if (refusal) {
|
|
411
|
+
dot.className = 'settings-status-dot disconnected';
|
|
412
|
+
line.textContent = ownerAccessSay('panelTitle');
|
|
413
|
+
setNavStatus('refused');
|
|
414
|
+
noteOwnerAccessRefusal(refusal);
|
|
415
|
+
markNoAccess(tabBody);
|
|
416
|
+
stopAll();
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
392
419
|
if (!cfg || cfg.ok === false) {
|
|
393
420
|
dot.className = 'settings-status-dot disconnected';
|
|
394
421
|
line.textContent = cfg?.status === 404 ? kit.tx('settings.redesign.judgments.typesafeSettingsUnavailableTheServerIs') : kit.tx('settings.redesign.judgments.typesafeSettingsUnavailable', { error: cfg?.error || kit.tx('settings.redesign.judgments.noResponse') });
|
|
@@ -901,15 +928,15 @@ export function wireJudgmentsTab(overlay, { toast = () => {}, initial = null } =
|
|
|
901
928
|
const v2 = serverV2(cfg);
|
|
902
929
|
for (const id of ['jv-log-session', 'jv-log-project']) $(id).style.display = v2 ? '' : 'none';
|
|
903
930
|
const origin = $('jv-log-origin');
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
931
|
+
if (document.activeElement === origin) return;
|
|
932
|
+
// The list follows this answer both ways: the tab may have opened from a kept answer of a server that listed
|
|
933
|
+
// more (settings-data.js), and a filter this server cannot apply is not offered.
|
|
934
|
+
const filter = logOriginFilter(cfg);
|
|
935
|
+
if ((origin.dataset.origins || logOriginFilter(null).key) === filter.key) return;
|
|
907
936
|
const value = origin.value;
|
|
908
|
-
|
|
909
|
-
origin.
|
|
910
|
-
|
|
911
|
-
: `<option value="${attr(o)}">${escapeHtml(o)}</option>`).join('');
|
|
912
|
-
origin.value = want.includes(value) ? value : '';
|
|
937
|
+
origin.innerHTML = logOriginOptions(cfg);
|
|
938
|
+
origin.dataset.origins = filter.key;
|
|
939
|
+
origin.value = filter.values.includes(value) ? value : '';
|
|
913
940
|
}
|
|
914
941
|
/** Point the log at one memory or one session, clearing the other filters, and bring it into view. */
|
|
915
942
|
function filterLogBy({ entity = '', session = '' }) {
|
|
@@ -24,6 +24,8 @@ import { toggleScheduleQueue } from './ui-schedule-queue.js';
|
|
|
24
24
|
import { initUpdate } from './ui-update.js';
|
|
25
25
|
import { initToolUpdates } from './ui-tool-updates.js';
|
|
26
26
|
import { initCrashNotice } from './ui-crash-notice.js';
|
|
27
|
+
import { initOwnerAuthorityNotice } from './ui-owner-authority.js';
|
|
28
|
+
import { initOwnerAccessNotice } from './ui-owner-access.js';
|
|
27
29
|
import { initSidepanelTrayPlaceholders } from './ui-sidepanel-tray.js';
|
|
28
30
|
import { initDesktopTitleBar } from './desktop-titlebar.js';
|
|
29
31
|
import { initToprightOverflow } from './ui-topright-overflow.js';
|
|
@@ -405,4 +407,8 @@ export function initNavbar() {
|
|
|
405
407
|
initToolUpdates();
|
|
406
408
|
// ── The notice after an automatic restart (the server crashed and its supervisor started it again) ──
|
|
407
409
|
initCrashNotice();
|
|
410
|
+
// ── The banner while the server cannot identify its callers (macOS: the owner's actions are paused, 503) ──
|
|
411
|
+
initOwnerAuthorityNotice();
|
|
412
|
+
// ── The banner on a page the server refuses the owner's access (SynaBun's automation browser opened it) ──
|
|
413
|
+
initOwnerAccessNotice();
|
|
408
414
|
}
|