synabun 2.4.1 → 2.4.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 +30 -0
- package/README.md +1 -1
- package/browser-extension/content.js +56 -14
- package/browser-extension/engine.js +158 -8
- package/browser-extension/manifest.json +3 -1
- package/browser-extension/protocol.js +91 -6
- package/browser-extension/service-worker.js +13 -5
- package/browser-extension/tokens.css +1 -1
- package/docs/browser-extension-bridge.md +24 -4
- package/lib/data-home-files.js +4 -2
- package/lib/first-launch-protection.js +8 -2
- package/lib/update-snapshot.js +11 -4
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +25 -2
- 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 +62 -17
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-bench.d.ts +22 -22
- package/mcp-server/dist/services/memory-maintenance.d.ts +1 -0
- package/mcp-server/dist/services/memory-maintenance.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-maintenance.js +34 -45
- package/mcp-server/dist/services/memory-maintenance.js.map +1 -1
- package/mcp-server/dist/services/memory-migration-copy.d.ts +144 -0
- package/mcp-server/dist/services/memory-migration-copy.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-migration-copy.js +467 -0
- package/mcp-server/dist/services/memory-migration-copy.js.map +1 -0
- package/mcp-server/dist/services/memory-migration-worker.d.ts +2 -0
- package/mcp-server/dist/services/memory-migration-worker.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-migration-worker.js +60 -0
- package/mcp-server/dist/services/memory-migration-worker.js.map +1 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts +4 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-retrieval.js +188 -40
- package/mcp-server/dist/services/memory-retrieval.js.map +1 -1
- package/mcp-server/dist/services/memory-schema.d.ts +58 -2
- package/mcp-server/dist/services/memory-schema.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-schema.js +190 -13
- package/mcp-server/dist/services/memory-schema.js.map +1 -1
- package/mcp-server/dist/services/memory-sessions.d.ts +19 -1
- package/mcp-server/dist/services/memory-sessions.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-sessions.js +56 -20
- package/mcp-server/dist/services/memory-sessions.js.map +1 -1
- package/mcp-server/dist/services/memory-verification.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-verification.js +8 -5
- package/mcp-server/dist/services/memory-verification.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +5 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +19 -2
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/retrieval-reader-worker.d.ts +2 -0
- package/mcp-server/dist/services/retrieval-reader-worker.d.ts.map +1 -0
- package/mcp-server/dist/services/retrieval-reader-worker.js +76 -0
- package/mcp-server/dist/services/retrieval-reader-worker.js.map +1 -0
- package/mcp-server/dist/services/retrieval-reader.d.ts +38 -0
- package/mcp-server/dist/services/retrieval-reader.d.ts.map +1 -0
- package/mcp-server/dist/services/retrieval-reader.js +145 -0
- package/mcp-server/dist/services/retrieval-reader.js.map +1 -0
- package/mcp-server/dist/services/sqlite-write.d.ts +14 -0
- package/mcp-server/dist/services/sqlite-write.d.ts.map +1 -0
- package/mcp-server/dist/services/sqlite-write.js +94 -0
- package/mcp-server/dist/services/sqlite-write.js.map +1 -0
- package/mcp-server/dist/services/sqlite.d.ts +39 -0
- package/mcp-server/dist/services/sqlite.d.ts.map +1 -1
- package/mcp-server/dist/services/sqlite.js +249 -8
- package/mcp-server/dist/services/sqlite.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.d.ts +1 -1
- package/mcp-server/dist/services/typesafe-config.d.ts +7 -1
- package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
- package/mcp-server/dist/services/typesafe-config.js +32 -10
- package/mcp-server/dist/services/typesafe-config.js.map +1 -1
- package/mcp-server/dist/services/typesafe.d.ts.map +1 -1
- package/mcp-server/dist/services/typesafe.js +9 -7
- package/mcp-server/dist/services/typesafe.js.map +1 -1
- package/mcp-server/dist/services/vector-cache.d.ts +32 -0
- package/mcp-server/dist/services/vector-cache.d.ts.map +1 -1
- package/mcp-server/dist/services/vector-cache.js +161 -8
- package/mcp-server/dist/services/vector-cache.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
- package/mcp-server/dist/tools/agents.d.ts +11 -7
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +27 -9
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +10 -3
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.d.ts +5 -0
- package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-extension-setup.js +23 -0
- package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -0
- package/mcp-server/dist/tools/browser-interact.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-interact.js +6 -1
- package/mcp-server/dist/tools/browser-interact.js.map +1 -1
- package/mcp-server/dist/tools/fb-groups.d.ts +2 -2
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/tool-groups.d.ts +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +20 -2
- package/mcp-server/src/index.ts +59 -17
- package/mcp-server/src/services/memory-maintenance.ts +31 -28
- package/mcp-server/src/services/memory-migration-copy.ts +419 -0
- package/mcp-server/src/services/memory-migration-worker.ts +55 -0
- package/mcp-server/src/services/memory-retrieval.ts +173 -32
- package/mcp-server/src/services/memory-schema.ts +194 -12
- package/mcp-server/src/services/memory-sessions.ts +54 -21
- package/mcp-server/src/services/memory-verification.ts +7 -4
- package/mcp-server/src/services/neural-interface.ts +22 -2
- package/mcp-server/src/services/retrieval-reader-worker.ts +67 -0
- package/mcp-server/src/services/retrieval-reader.ts +131 -0
- package/mcp-server/src/services/sqlite-write.ts +60 -0
- package/mcp-server/src/services/sqlite.ts +246 -8
- package/mcp-server/src/services/typesafe-config.ts +25 -6
- package/mcp-server/src/services/typesafe.ts +9 -7
- package/mcp-server/src/services/vector-cache.ts +154 -9
- package/mcp-server/src/tools/agents.ts +26 -9
- package/mcp-server/src/tools/browser-advanced.ts +10 -3
- package/mcp-server/src/tools/browser-extension-setup.ts +30 -0
- package/mcp-server/src/tools/browser-interact.ts +5 -1
- package/neural-interface/i18n/en.json +263 -1
- package/neural-interface/i18n/pt-BR.json +264 -2
- package/neural-interface/lib/agents/split.js +32 -4
- package/neural-interface/lib/assistant-api.js +19 -8
- package/neural-interface/lib/assistant-brains/claude.js +2 -0
- package/neural-interface/lib/assistant-catalog.js +2 -2
- package/neural-interface/lib/assistant-config.js +0 -7
- package/neural-interface/lib/assistant-dispatch.js +257 -95
- package/neural-interface/lib/assistant-persona.js +16 -4
- package/neural-interface/lib/assistant-pricing.js +65 -14
- package/neural-interface/lib/assistant-router.js +131 -47
- package/neural-interface/lib/assistant-run-wait.js +45 -28
- package/neural-interface/lib/assistant-runtime.js +39 -33
- package/neural-interface/lib/backup-contents.js +158 -0
- package/neural-interface/lib/backup-crypto-io.js +330 -0
- package/neural-interface/lib/backup-crypto-worker.js +130 -0
- package/neural-interface/lib/backup-crypto.js +525 -0
- package/neural-interface/lib/backup-download.js +268 -0
- package/neural-interface/lib/backup-encryption.js +318 -0
- package/neural-interface/lib/backup-groups.js +287 -0
- package/neural-interface/lib/backup-restore-session.js +176 -0
- package/neural-interface/lib/backup-restore-stage.js +60 -0
- package/neural-interface/lib/backup-service.js +788 -233
- package/neural-interface/lib/backup-zip-reader.js +30 -18
- package/neural-interface/lib/backup-zip-writer.js +34 -10
- package/neural-interface/lib/browser-extension-adapter.js +89 -13
- package/neural-interface/lib/browser-extension-bridge.js +18 -7
- package/neural-interface/lib/claude-agent-bridge.js +1 -0
- package/neural-interface/lib/claude-session-cleanup.js +5 -1
- package/neural-interface/lib/cli-update-planner.js +105 -6
- package/neural-interface/lib/client-diagnostics.js +42 -0
- package/neural-interface/lib/confined-fs.js +7 -2
- package/neural-interface/lib/coordination/README.md +8 -2
- package/neural-interface/lib/coordination/contract.js +161 -0
- package/neural-interface/lib/coordination/database.js +999 -0
- package/neural-interface/lib/coordination/operations.js +436 -0
- package/neural-interface/lib/coordination/service.js +68 -537
- package/neural-interface/lib/coordination/storage-worker.js +101 -0
- package/neural-interface/lib/coordination/store.js +219 -1111
- package/neural-interface/lib/db.js +70 -32
- package/neural-interface/lib/health-count.js +37 -0
- package/neural-interface/lib/loop-stall.js +139 -0
- package/neural-interface/lib/maritaca/client.js +2 -2
- package/neural-interface/lib/maritaca/models.js +12 -17
- package/neural-interface/lib/maritaca/opencode.js +4 -2
- package/neural-interface/lib/memory-api.js +9 -1
- package/neural-interface/lib/memory-session-capture.js +42 -10
- package/neural-interface/lib/memory-store-gate.js +313 -0
- package/neural-interface/lib/memory-store-migrate.js +65 -0
- package/neural-interface/lib/memory-timers.js +7 -7
- package/neural-interface/lib/native-loop-providers.js +13 -16
- package/neural-interface/lib/native-loop-runtime.js +28 -7
- package/neural-interface/lib/opencode-build-preflight.js +18 -1
- package/neural-interface/lib/opencode-native-boundary.js +69 -8
- package/neural-interface/lib/opencode-provider-view.js +14 -3
- package/neural-interface/lib/opencode-v2-ws-requests.js +31 -1
- package/neural-interface/lib/opencode2-client.js +2 -1
- package/neural-interface/lib/recall-impact.js +122 -0
- package/neural-interface/lib/scratch-evidence.js +420 -0
- package/neural-interface/lib/scratch-process-guard.js +139 -0
- package/neural-interface/lib/scratch-references.js +279 -0
- package/neural-interface/lib/scratch-retention-core.js +385 -0
- package/neural-interface/lib/scratch-retention-worker.js +37 -0
- package/neural-interface/lib/scratch-retention.js +151 -0
- package/neural-interface/lib/session-cache-builder.js +31 -43
- package/neural-interface/lib/session-cache-worker.js +157 -0
- package/neural-interface/lib/session-indexer.js +28 -21
- package/neural-interface/lib/session-search-index.js +85 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/sqlite-integrity-worker.js +3 -1
- package/neural-interface/lib/style-guide/store.js +43 -3
- package/neural-interface/lib/system-restore.js +50 -0
- package/neural-interface/lib/teams/api.js +15 -6
- package/neural-interface/lib/teams/claims.js +67 -31
- package/neural-interface/lib/teams/index.js +7 -7
- package/neural-interface/lib/teams/integration.js +40 -40
- package/neural-interface/lib/teams/landing.js +6 -6
- package/neural-interface/lib/teams/recovery.js +24 -23
- package/neural-interface/lib/teams/scheduler.js +194 -95
- package/neural-interface/lib/teams/state.js +14 -14
- package/neural-interface/lib/teams/worktrees.js +27 -27
- package/neural-interface/lib/whatsapp/bridge.js +2 -1
- package/neural-interface/lib/worker-confinement.js +47 -2
- package/neural-interface/lib/worker-mcp-channel.js +2 -0
- package/neural-interface/lib/worker-resume.js +5 -0
- package/neural-interface/lib/worker-stop.js +86 -0
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/index.html +233 -24
- package/neural-interface/public/onboarding.html +259 -34
- package/neural-interface/public/shared/agents/studio/ax-library.js +0 -6
- package/neural-interface/public/shared/agents/studio/ax-main.js +14 -7
- package/neural-interface/public/shared/agy/agy-options.js +11 -0
- package/neural-interface/public/shared/agy/agy-panel.js +29 -10
- package/neural-interface/public/shared/agy/agy-styles.js +14 -12
- package/neural-interface/public/shared/agy/agy-tabs-logic.js +4 -1
- package/neural-interface/public/shared/api.js +1 -1
- package/neural-interface/public/shared/assistant/asst-api.js +3 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +13 -6
- package/neural-interface/public/shared/assistant/asst-control.js +2 -0
- package/neural-interface/public/shared/assistant/asst-motion-gate.js +78 -4
- package/neural-interface/public/shared/assistant/asst-panel.js +18 -2
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -0
- package/neural-interface/public/shared/assistant/asst-render.js +105 -38
- package/neural-interface/public/shared/assistant/asst-route.js +100 -21
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +1 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +4 -2
- package/neural-interface/public/shared/assistant/asst-state.js +11 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +10 -23
- package/neural-interface/public/shared/assistant/route-identity.js +2 -1
- package/neural-interface/public/shared/cdx/cdx-render.js +9 -0
- package/neural-interface/public/shared/cdx/cdx-settings.js +3 -1
- package/neural-interface/public/shared/cdx/cdx-styles.js +6 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +29 -9
- package/neural-interface/public/shared/client-diagnostics.js +94 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-styles.js +1 -1
- package/neural-interface/public/shared/effort-i18n.js +118 -0
- package/neural-interface/public/shared/html-shell.js +4 -52
- package/neural-interface/public/shared/loading-diagnostic-entry.js +64 -0
- package/neural-interface/public/shared/memory-store-wait.js +52 -0
- package/neural-interface/public/shared/morelogin-profile-field.js +1 -1
- package/neural-interface/public/shared/mtc/mtc-logic.js +2 -1
- package/neural-interface/public/shared/mtc/mtc-panel.js +8 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +13 -12
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +7 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-location-logic.js +109 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +8 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +118 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +27 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +2 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -93
- package/neural-interface/public/shared/ocp-v2/ocp-v2-variantpicker.js +17 -6
- package/neural-interface/public/shared/output-format.js +294 -0
- package/neural-interface/public/shared/provider-icons.js +6 -0
- package/neural-interface/public/shared/schedules-view.js +2 -1
- package/neural-interface/public/shared/server-presence.js +77 -0
- package/neural-interface/public/shared/settings/settings-backup-contents.js +241 -0
- package/neural-interface/public/shared/settings/settings-backup-download.js +298 -0
- package/neural-interface/public/shared/settings/settings-backup-encryption-pane.js +335 -0
- package/neural-interface/public/shared/settings/settings-backup-encryption.js +545 -0
- package/neural-interface/public/shared/settings/settings-ia.js +1 -1
- package/neural-interface/public/shared/skills/studio/sx-geometry.js +12 -3
- package/neural-interface/public/shared/skills/studio/sx-main.js +14 -7
- package/neural-interface/public/shared/studio-attention.js +6 -0
- package/neural-interface/public/shared/styles.css +341 -437
- package/neural-interface/public/shared/transcript-rows.js +28 -3
- package/neural-interface/public/shared/tray-auto-close.js +18 -5
- package/neural-interface/public/shared/ui-agents.js +1 -2
- package/neural-interface/public/shared/ui-automation-studio.js +168 -108
- package/neural-interface/public/shared/ui-claude-panel.js +42 -65
- package/neural-interface/public/shared/ui-loading.js +124 -17
- package/neural-interface/public/shared/ui-native-loop-router.js +10 -0
- package/neural-interface/public/shared/ui-navbar.js +2 -1
- package/neural-interface/public/shared/ui-output.js +533 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +165 -128
- package/neural-interface/public/shared/ui-scroll-follow.js +97 -6
- package/neural-interface/public/shared/ui-sessions.js +2 -2
- package/neural-interface/public/shared/ui-settings-entry.js +18 -0
- package/neural-interface/public/shared/ui-settings.js +224 -65
- package/neural-interface/public/shared/ui-sidepanel-tray.js +3 -2
- package/neural-interface/public/shared/ui-tooltip.js +16 -0
- package/neural-interface/public/shared/ui-tutorial.js +5 -6
- package/neural-interface/public/shared/ui-worker-end.js +27 -8
- package/neural-interface/public/shared/worker-end.js +9 -4
- package/neural-interface/public/variant/2d/main.js +5 -0
- package/neural-interface/public/variant/3d/app.js +10 -0
- package/neural-interface/public/variant/3d/main.js +5 -1
- package/neural-interface/scripts/scratch-retention.mjs +20 -0
- package/neural-interface/server.js +477 -139
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/scripts/restore-data-home-from-backup.mjs +175 -8
- package/setup.js +18 -4
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// shared allowlist sanitizer before it reaches innerHTML.
|
|
10
10
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
11
|
|
|
12
|
+
import { getProviderMeta, isMaritacaModel } from '../provider-icons.js';
|
|
13
|
+
|
|
12
14
|
import { getDefaultStore } from './ocp-v2-state.js';
|
|
13
15
|
import { hasWorkerQuestions, api, supports, isDescendantSession, isKnownDescendantSession, onEvent } from './ocp-v2-ws.js';
|
|
14
16
|
import {
|
|
@@ -25,7 +27,9 @@ import { messageMetaText } from './ocp-v2-tools-logic.js';
|
|
|
25
27
|
import { createStickyScrollController } from '../ui-scroll-follow.js';
|
|
26
28
|
import { watchTranscriptRows } from '../transcript-rows.js';
|
|
27
29
|
import { sanitizeHtmlString } from '../assistant/asst-sanitize.js';
|
|
30
|
+
import { sanitizeStoredHtml } from '../assistant/asst-sanitize.js';
|
|
28
31
|
import { withCodeCopyButtons } from '../code-copy.js';
|
|
32
|
+
import { withOutputFrames } from '../output-format.js';
|
|
29
33
|
import { openProviderSettings } from './ocp-v2-settings-link.js';
|
|
30
34
|
import {
|
|
31
35
|
visibleParts, partSignature, messageErrorView, retryBannerView, retryPartText,
|
|
@@ -102,7 +106,14 @@ export function mountRenderer(containerEl, store = getDefaultStore(), opts = {})
|
|
|
102
106
|
});
|
|
103
107
|
};
|
|
104
108
|
|
|
109
|
+
let _lastSessionId = store.getState().sessionId;
|
|
105
110
|
const unsubscribe = store.subscribe((event, state) => {
|
|
111
|
+
// Switching to another session in the same container restores bottom-follow intent
|
|
112
|
+
// and cancels any queued scroll frame from the session being left.
|
|
113
|
+
if (event?.type === 'session:set' && event.sessionId !== _lastSessionId) {
|
|
114
|
+
_lastSessionId = event.sessionId;
|
|
115
|
+
scrollController?.setFollowing(true);
|
|
116
|
+
}
|
|
106
117
|
// The server listed this session's open permission requests: a reason
|
|
107
118
|
// typed for one that is no longer among them has no card to come back to.
|
|
108
119
|
if (event?.type === 'permission:set' && event.listed) settlePermissionReasons(state);
|
|
@@ -201,9 +212,20 @@ function _reconcile(container, desired) {
|
|
|
201
212
|
}
|
|
202
213
|
}
|
|
203
214
|
|
|
204
|
-
function _buildEmpty() {
|
|
215
|
+
function _buildEmpty(maritaca) {
|
|
205
216
|
const empty = document.createElement('div');
|
|
206
217
|
empty.className = 'ocpv2-empty ocpv2-empty-brand';
|
|
218
|
+
if (maritaca) {
|
|
219
|
+
// The mark is inline SVG, which the Markdown list flattens: the stored-markup list keeps its shapes.
|
|
220
|
+
const logo = sanitizeStoredHtml(getProviderMeta('maritaca').icon).firstElementChild;
|
|
221
|
+
logo.classList.add('ocpv2-empty-logo');
|
|
222
|
+
logo.setAttribute('aria-hidden', 'true');
|
|
223
|
+
const name = document.createElement('div');
|
|
224
|
+
name.className = 'ocpv2-empty-name';
|
|
225
|
+
name.textContent = 'Maritaca';
|
|
226
|
+
empty.append(logo, name);
|
|
227
|
+
return empty;
|
|
228
|
+
}
|
|
207
229
|
empty.innerHTML =
|
|
208
230
|
'<svg class="ocpv2-empty-logo" viewBox="0 0 240 300" fill="currentColor" aria-hidden="true">'
|
|
209
231
|
+ '<path fill-rule="evenodd" d="M0 0h240v300H0V0zm30 30v240h180V30H30z"/>'
|
|
@@ -235,7 +257,8 @@ function render(_container, store, opts = {}) {
|
|
|
235
257
|
const endCard = typeof opts.endCard === 'function' ? opts.endCard(s) : null;
|
|
236
258
|
const hasInteractiveCards = permissions.length > 0 || questions.length > 0 || !!s.showPostPlanActions || !!endCard;
|
|
237
259
|
if (s.messageOrder.length === 0 && !hasInteractiveCards && !s.errors.length && !retry && !revertBanner) {
|
|
238
|
-
|
|
260
|
+
const maritaca = isMaritacaModel(s.model || s.sessionInfo?.model);
|
|
261
|
+
_reconcile(_container, [{ key: '__empty__', sig: maritaca ? 'maritaca' : 'empty', build: () => _buildEmpty(maritaca) }]);
|
|
239
262
|
// The panel may put SynaBun's greeting in it (ocp-v2-greeting.js).
|
|
240
263
|
try { opts.onEmpty?.(_container.querySelector(':scope > .ocpv2-empty'), s); } catch { /* the empty state stands on its own */ }
|
|
241
264
|
return;
|
|
@@ -1779,7 +1802,8 @@ function renderMarkdown(src) {
|
|
|
1779
1802
|
html = escapeHtml(text).replace(/\n/g, '<br>');
|
|
1780
1803
|
}
|
|
1781
1804
|
// Every code block gets the shared Copy button, written in after the sanitiser (../code-copy.js).
|
|
1782
|
-
|
|
1805
|
+
// And the reading layer all six panels share: a table's frame, task items, a block's language, a diff's lines.
|
|
1806
|
+
const shown = withOutputFrames(withCodeCopyButtons(html));
|
|
1783
1807
|
if (_markdownCache.size >= _markdownCacheLimit) {
|
|
1784
1808
|
// Evict oldest insertion (Map preserves insertion order)
|
|
1785
1809
|
const firstKey = _markdownCache.keys().next().value;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// instance for back-compat with shared bindings.
|
|
7
7
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
8
8
|
|
|
9
|
+
import { getProviderMeta, isMaritacaModel } from '../provider-icons.js';
|
|
10
|
+
|
|
9
11
|
import { api, supports, capabilities, onEvent, sessionWaitsOnUser, onAsksChanged } from './ocp-v2-ws.js';
|
|
10
12
|
import { getDefaultStore, agentForMode } from './ocp-v2-state.js';
|
|
11
13
|
import { mountModelPicker } from './ocp-v2-modelpicker.js';
|
|
@@ -302,7 +304,18 @@ export function mountCompose(rootEl, store = getDefaultStore(), opts = {}) {
|
|
|
302
304
|
_modelPicker = mountModelPicker(footerRight, store);
|
|
303
305
|
}
|
|
304
306
|
|
|
307
|
+
const brandLink = toolbar.querySelector('.ocpv2-brand-link');
|
|
308
|
+
const openCodeMark = brandLink.innerHTML;
|
|
309
|
+
function syncBrand(model) {
|
|
310
|
+
const maritaca = isMaritacaModel(model);
|
|
311
|
+
brandLink.innerHTML = maritaca ? getProviderMeta('maritaca').icon : openCodeMark;
|
|
312
|
+
brandLink.href = maritaca ? 'https://www.maritaca.ai' : 'https://opencode.ai';
|
|
313
|
+
brandLink.dataset.tooltip = maritaca ? 'Maritaca' : 'OpenCode';
|
|
314
|
+
brandLink.setAttribute('aria-label', brandLink.dataset.tooltip);
|
|
315
|
+
}
|
|
316
|
+
syncBrand(store.getState().model || store.getState().sessionInfo?.model);
|
|
305
317
|
const unsubscribe = store.subscribe((event, state) => {
|
|
318
|
+
if (event?.type === 'config:model' || event?.type === 'session:info') syncBrand(state.model || state.sessionInfo?.model);
|
|
306
319
|
// First of all: the panel was bound to another session. What belonged to
|
|
307
320
|
// the binding it left goes before anything below looks at the new one.
|
|
308
321
|
if (_rebind.changed()) onRebound(state);
|
|
@@ -268,7 +268,8 @@ export async function createSessionForNavigation(store, api, { title, cwd, nav }
|
|
|
268
268
|
const at = isBindingToken(nav) ? nav : captureBinding(store);
|
|
269
269
|
const res = await api.sessionCreate(title ? { title } : {}, cwd);
|
|
270
270
|
const session = res?.data;
|
|
271
|
-
|
|
271
|
+
// A refusal says why (a folder that does not exist: "Location not found: …", which the panel recovers from).
|
|
272
|
+
if (!session?.id) throw new Error(replyFailed(res) ? replyError(res, 'session create returned no id') : 'session create returned no id');
|
|
272
273
|
return { session, activate: at.isCurrent() };
|
|
273
274
|
}
|
|
274
275
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
7
|
|
|
8
8
|
import { installCodeCopy } from '../ui-code-copy.js';
|
|
9
|
+
import { installOutput } from '../ui-output.js';
|
|
9
10
|
|
|
10
11
|
const STYLE_ID = 'ocp-v2-styles';
|
|
11
12
|
|
|
@@ -748,99 +749,9 @@ body.ui-interacting .ocpv2-pill-ring > i { animation-play-state: paused; }
|
|
|
748
749
|
.ocpv2-part { display: block; }
|
|
749
750
|
.ocpv2-part + .ocpv2-part { margin-top: 6px; }
|
|
750
751
|
.ocpv2-part-text { white-space: normal; }
|
|
751
|
-
|
|
752
|
-
.
|
|
753
|
-
|
|
754
|
-
.ocpv2-part-text h4, .ocpv2-part-text h5, .ocpv2-part-text h6 {
|
|
755
|
-
margin: 0.75em 0 0.3em;
|
|
756
|
-
line-height: 1.35;
|
|
757
|
-
color: rgba(255,255,255,0.96);
|
|
758
|
-
font-weight: 600;
|
|
759
|
-
}
|
|
760
|
-
.ocpv2-part-text h1 { font-size: 16px; }
|
|
761
|
-
.ocpv2-part-text h2 { font-size: 14px; }
|
|
762
|
-
.ocpv2-part-text h3 { font-size: 13px; }
|
|
763
|
-
.ocpv2-part-text h4 { font-size: 12px; }
|
|
764
|
-
.ocpv2-part-text h5 { font-size: 11.5px; opacity: 0.92; }
|
|
765
|
-
.ocpv2-part-text h6 { font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
766
|
-
.ocpv2-part-text ul, .ocpv2-part-text ol {
|
|
767
|
-
margin: 0 0 8px 18px;
|
|
768
|
-
padding: 0;
|
|
769
|
-
}
|
|
770
|
-
.ocpv2-part-text li + li { margin-top: 4px; }
|
|
771
|
-
.ocpv2-part-text a { color: rgba(151,214,255,0.92); text-decoration: none; }
|
|
772
|
-
.ocpv2-part-text a:hover { text-decoration: underline; }
|
|
773
|
-
.ocpv2-part-text code {
|
|
774
|
-
background: rgba(255,255,255,0.05);
|
|
775
|
-
border: 1px solid rgba(255,255,255,0.06);
|
|
776
|
-
padding: 1px 5px;
|
|
777
|
-
border-radius: 4px;
|
|
778
|
-
font-size: 11.5px;
|
|
779
|
-
font-family: 'JetBrains Mono', ui-monospace, monospace;
|
|
780
|
-
}
|
|
781
|
-
.ocpv2-part-text pre {
|
|
782
|
-
background: rgba(0,0,0,0.28);
|
|
783
|
-
border: 1px solid rgba(255,255,255,0.05);
|
|
784
|
-
border-radius: 8px;
|
|
785
|
-
padding: 10px;
|
|
786
|
-
margin: 8px 0;
|
|
787
|
-
overflow-x: auto;
|
|
788
|
-
font-size: 11px;
|
|
789
|
-
line-height: 1.55;
|
|
790
|
-
white-space: pre-wrap;
|
|
791
|
-
word-break: break-word;
|
|
792
|
-
}
|
|
793
|
-
.ocpv2-part-text pre code {
|
|
794
|
-
background: none;
|
|
795
|
-
border: none;
|
|
796
|
-
padding: 0;
|
|
797
|
-
font-size: inherit;
|
|
798
|
-
}
|
|
799
|
-
.ocpv2-part-text strong { color: rgba(255,255,255,0.95); font-weight: 600; }
|
|
800
|
-
.ocpv2-part-text em { font-style: italic; color: rgba(255,255,255,0.78); }
|
|
801
|
-
.ocpv2-part-text del { opacity: 0.55; text-decoration: line-through; }
|
|
802
|
-
.ocpv2-part-text hr {
|
|
803
|
-
border: none;
|
|
804
|
-
border-top: 1px solid rgba(255,255,255,0.08);
|
|
805
|
-
margin: 12px 0;
|
|
806
|
-
}
|
|
807
|
-
.ocpv2-part-text blockquote {
|
|
808
|
-
margin: 6px 0;
|
|
809
|
-
padding: 4px 12px;
|
|
810
|
-
border-left: 3px solid rgba(232,224,220,0.25);
|
|
811
|
-
color: rgba(255,255,255,0.72);
|
|
812
|
-
background: rgba(255,255,255,0.02);
|
|
813
|
-
border-radius: 0 6px 6px 0;
|
|
814
|
-
}
|
|
815
|
-
.ocpv2-part-text blockquote p { margin: 4px 0; }
|
|
816
|
-
.ocpv2-part-text table {
|
|
817
|
-
border-collapse: collapse;
|
|
818
|
-
margin: 8px 0;
|
|
819
|
-
font-size: 11px;
|
|
820
|
-
width: 100%;
|
|
821
|
-
display: block;
|
|
822
|
-
overflow-x: auto;
|
|
823
|
-
}
|
|
824
|
-
.ocpv2-part-text thead {
|
|
825
|
-
background: rgba(255,255,255,0.04);
|
|
826
|
-
}
|
|
827
|
-
.ocpv2-part-text th,
|
|
828
|
-
.ocpv2-part-text td {
|
|
829
|
-
border: 1px solid rgba(255,255,255,0.08);
|
|
830
|
-
padding: 5px 8px;
|
|
831
|
-
text-align: left;
|
|
832
|
-
vertical-align: top;
|
|
833
|
-
}
|
|
834
|
-
.ocpv2-part-text th { font-weight: 600; color: rgba(255,255,255,0.92); }
|
|
835
|
-
.ocpv2-part-text input[type="checkbox"] {
|
|
836
|
-
margin-right: 4px;
|
|
837
|
-
vertical-align: middle;
|
|
838
|
-
}
|
|
839
|
-
.ocpv2-part-text img {
|
|
840
|
-
max-width: 100%;
|
|
841
|
-
height: auto;
|
|
842
|
-
border-radius: 6px;
|
|
843
|
-
}
|
|
752
|
+
/* An answer's prose, tables and code are the shared reading layer (../ui-output.js): one system for the six
|
|
753
|
+
side panels. A tag is never styled here again; this panel's voice (mono, 12.5px, its link blue, wrapped code)
|
|
754
|
+
is the --sbo-* values that sheet gives .ocpv2-part-text. */
|
|
844
755
|
|
|
845
756
|
/* ── Part: reasoning (CLI-style streaming thinking block) ──────────────── */
|
|
846
757
|
.ocpv2-part-reasoning {
|
|
@@ -2323,6 +2234,13 @@ img.ocpv2-tool-screenshot {
|
|
|
2323
2234
|
opacity: 0.4;
|
|
2324
2235
|
transition: opacity 0.15s;
|
|
2325
2236
|
}
|
|
2237
|
+
.ocpv2-model-mark svg {
|
|
2238
|
+
width: 1em;
|
|
2239
|
+
height: 1em;
|
|
2240
|
+
margin-inline-end: 4px;
|
|
2241
|
+
vertical-align: -0.12em;
|
|
2242
|
+
}
|
|
2243
|
+
.ocpv2-brand-link > svg { width: 14px; height: 14px; }
|
|
2326
2244
|
.ocpv2-brand-link:hover { opacity: 0.85; }
|
|
2327
2245
|
.ocpv2-brand {
|
|
2328
2246
|
width: 14px;
|
|
@@ -3757,11 +3675,27 @@ const PARITY_CSS = `
|
|
|
3757
3675
|
}
|
|
3758
3676
|
.ocpv2-panel.ocp-cli-blocked .ocpv2-compose-btn:not(.ocpv2-compose-abort) { opacity: 0.4; cursor: not-allowed; }
|
|
3759
3677
|
.ocpv2-panel.ocp-cli-blocked .ocpv2-compose-input { opacity: 0.7; }
|
|
3678
|
+
|
|
3679
|
+
/* ── Reading pass (2026-11-21): what the agent did is legible and quiet, what it answered leads ──
|
|
3680
|
+
An answer's prose, tables and code are ../ui-output.js. This block is the rest of the transcript: the labels,
|
|
3681
|
+
the metadata and the tool rows' secondary text were 9.5–10.5px at 22–45% white. They keep their mono voice and
|
|
3682
|
+
their place; the faint text is 55% white (the style guide's muted text). Nothing moved, nothing was removed. */
|
|
3683
|
+
.ocpv2-msg-role { font-size: 10px; color: rgba(255,255,255,0.55); }
|
|
3684
|
+
.ocpv2-msg-meta { font-size: 10.5px; color: rgba(255,255,255,0.55); }
|
|
3685
|
+
.ocpv2-part-step { color: rgba(255,255,255,0.45); }
|
|
3686
|
+
.ocpv2-part-note, .ocpv2-thinking-preview, .ocpv2-tc-summary, .ocpv2-tc-meta { color: rgba(255,255,255,0.55); }
|
|
3687
|
+
.ocpv2-tc-summary, .ocpv2-tc-meta { font-size: 10.5px; }
|
|
3688
|
+
/* What the agent says right before a tool call is secondary text; its answer is primary. Colour only. */
|
|
3689
|
+
.ocpv2-msg-part-text:has(+ .ocpv2-msg-part-tool) .ocpv2-part-text { --sbo-text: rgba(255,255,255,0.72); --sbo-strong: rgba(255,255,255,0.9); }
|
|
3690
|
+
/* A touch screen has no hover: a message's actions (Copy, Undo, Fork, Retry) are always shown there. */
|
|
3691
|
+
@media (hover: none) { .ocpv2-msg-actions, .ocpv2-msg-action { opacity: 1; } }
|
|
3760
3692
|
`;
|
|
3761
3693
|
|
|
3762
3694
|
export function injectStyles() {
|
|
3763
3695
|
// The Copy button of every code block: its stylesheet and its one click listener, in this document.
|
|
3764
3696
|
installCodeCopy(document);
|
|
3697
|
+
// The reading layer of an agent's answer (prose, tables, code): one stylesheet for the six panels.
|
|
3698
|
+
installOutput(document);
|
|
3765
3699
|
const full = CSS + '\n' + PARITY_CSS + '\n' + CHILD_CSS;
|
|
3766
3700
|
const existing = document.getElementById(STYLE_ID);
|
|
3767
3701
|
if (existing) {
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// per-provider config (reasoningEffort / thinking / thinkingConfig / etc).
|
|
11
11
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
12
|
|
|
13
|
+
import { t } from '../i18n.js';
|
|
14
|
+
import { translatedEffortWord } from '../effort-i18n.js';
|
|
13
15
|
import { fetchProvidersFull } from './ocp-v2-providers.js';
|
|
14
16
|
import { getDefaultStore } from './ocp-v2-state.js';
|
|
15
17
|
|
|
@@ -23,6 +25,15 @@ const STOR_VARIANTS = 'ocp-v2-model-variants'; // { "providerID/modelID": "var
|
|
|
23
25
|
const PREFERRED_ORDER = ['none', 'thinking', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra'];
|
|
24
26
|
const ARROW_DOWN = '▾';
|
|
25
27
|
|
|
28
|
+
// Display words (effortUi.variant.*, assistant.routes.effortWord.*). The variant NAME is what is stored and
|
|
29
|
+
// sent; nothing reads these back. A name that is not a standard effort level shows as it is.
|
|
30
|
+
function word(key, english) {
|
|
31
|
+
const path = `effortUi.variant.${key}`;
|
|
32
|
+
const value = t(path);
|
|
33
|
+
return typeof value === 'string' && value && value !== path ? value : english;
|
|
34
|
+
}
|
|
35
|
+
export function variantDisplayName(name) { return translatedEffortWord(name, t) ?? name; }
|
|
36
|
+
|
|
26
37
|
let _root = null;
|
|
27
38
|
let _dd = null;
|
|
28
39
|
let _menu = null;
|
|
@@ -44,8 +55,8 @@ export function mountVariantPicker(rootEl, store = getDefaultStore()) {
|
|
|
44
55
|
_dd = document.createElement('div');
|
|
45
56
|
_dd.id = 'ocpv2-variant-dd';
|
|
46
57
|
_dd.className = 'ocpv2-dropdown ocpv2-variant-dropdown';
|
|
47
|
-
_dd.dataset.placeholder = 'effort';
|
|
48
|
-
_dd.setAttribute('data-tooltip', 'Reasoning effort');
|
|
58
|
+
_dd.dataset.placeholder = word('placeholder', 'effort');
|
|
59
|
+
_dd.setAttribute('data-tooltip', word('tooltip', 'Reasoning effort'));
|
|
49
60
|
_dd.style.display = 'none';
|
|
50
61
|
_dd.innerHTML =
|
|
51
62
|
`<span class="ocpv2-variant-icon" aria-hidden="true">`
|
|
@@ -54,7 +65,7 @@ export function mountVariantPicker(rootEl, store = getDefaultStore()) {
|
|
|
54
65
|
+ `<path d="M9 9h6"/>`
|
|
55
66
|
+ `</svg>`
|
|
56
67
|
+ `</span>`
|
|
57
|
-
+ `<span class="ocpv2-dd-label"
|
|
68
|
+
+ `<span class="ocpv2-dd-label">${escHtml(word('placeholder', 'effort'))}</span>`
|
|
58
69
|
+ `<span class="ocpv2-dd-arrow">${ARROW_DOWN}</span>`
|
|
59
70
|
+ `<div class="ocpv2-dd-menu"></div>`;
|
|
60
71
|
_root.appendChild(_dd);
|
|
@@ -224,7 +235,7 @@ function syncFromState() {
|
|
|
224
235
|
_dd.style.display = '';
|
|
225
236
|
const v = getState().variant;
|
|
226
237
|
if (v && names.includes(v)) {
|
|
227
|
-
_label.textContent = v;
|
|
238
|
+
_label.textContent = variantDisplayName(v);
|
|
228
239
|
_dd.classList.add('has-value');
|
|
229
240
|
} else {
|
|
230
241
|
_label.textContent = _dd.dataset.placeholder || 'effort';
|
|
@@ -264,7 +275,7 @@ function paintMenu() {
|
|
|
264
275
|
// "Default" entry — clears the variant so the SDK uses its built-in default
|
|
265
276
|
const defaultOpt = document.createElement('div');
|
|
266
277
|
defaultOpt.className = 'ocpv2-dd-option' + (!current ? ' selected' : '');
|
|
267
|
-
defaultOpt.innerHTML =
|
|
278
|
+
defaultOpt.innerHTML = `<span class="ocpv2-dd-variant-name">${escHtml(word('default', 'default'))}</span><span class="ocpv2-dd-hint">${escHtml(word('sdkHint', 'SDK'))}</span>`;
|
|
268
279
|
defaultOpt.addEventListener('click', () => {
|
|
269
280
|
selectVariant(null);
|
|
270
281
|
closeMenu();
|
|
@@ -274,7 +285,7 @@ function paintMenu() {
|
|
|
274
285
|
for (const name of ordered) {
|
|
275
286
|
const opt = document.createElement('div');
|
|
276
287
|
opt.className = 'ocpv2-dd-option' + (current === name ? ' selected' : '');
|
|
277
|
-
opt.innerHTML = `<span class="ocpv2-dd-variant-name">${escHtml(name)}</span>`;
|
|
288
|
+
opt.innerHTML = `<span class="ocpv2-dd-variant-name">${escHtml(variantDisplayName(name))}</span>`;
|
|
278
289
|
opt.addEventListener('click', () => {
|
|
279
290
|
selectVariant(name);
|
|
280
291
|
closeMenu();
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — an agent's answer as a readable document: the decisions
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// The six side panels (Assistant, Claude Code, Codex, OpenCode, Antigravity, Maritaca) show an agent's Markdown
|
|
6
|
+
// through the same sanitiser and, since this module, as the same document: one type scale, one spacing rhythm,
|
|
7
|
+
// one table, one code block. This is the part that needs no page: the words, the markup added to a panel's
|
|
8
|
+
// SANITISED Markdown (so a stream, a re-render, a morph and a stored transcript all keep it, exactly like the
|
|
9
|
+
// Copy button of code-copy.js), and what a table copies. ui-output.js gives it the page: the stylesheet, the
|
|
10
|
+
// one click listener per document, the wider view of a table.
|
|
11
|
+
//
|
|
12
|
+
// What it adds, and nothing else:
|
|
13
|
+
// · a frame around every table (it wraps at words to fit the panel, and scrolls sideways inside the frame only
|
|
14
|
+
// when its columns cannot fit), with Copy and, for a table worth it, Expand; a numeric column is
|
|
15
|
+
// right-aligned and a column of sentences keeps a readable width;
|
|
16
|
+
// · a class on a task-list item (the sanitiser turns its checkbox into ☑ / ☐: no bullet beside the box);
|
|
17
|
+
// · the language of a fenced block on its <pre> (drawn as a label) and the lines of a diff as add / remove.
|
|
18
|
+
//
|
|
19
|
+
// Run it on the sanitiser's output, never before: the allowlist takes a model's own div, button and class out,
|
|
20
|
+
// so a reply cannot forge a frame or a button. It never adds a link, a handler or a style.
|
|
21
|
+
//
|
|
22
|
+
// No imports and no `document`: loaded by `node --test` as it is, and by the Markdown renderers.
|
|
23
|
+
|
|
24
|
+
/** The English of `output.*` in i18n/en.json (tests/output-format.test.mjs keeps them equal). */
|
|
25
|
+
export const OUTPUT_COPY = Object.freeze({
|
|
26
|
+
copy: 'Copy',
|
|
27
|
+
copied: 'Copied',
|
|
28
|
+
failed: 'Not copied',
|
|
29
|
+
copyTable: 'Copy table',
|
|
30
|
+
tableCopied: 'Table copied',
|
|
31
|
+
tableFailed: 'Could not copy the table.',
|
|
32
|
+
expand: 'Expand',
|
|
33
|
+
expandTable: 'Open the table in a wider view',
|
|
34
|
+
tableTitle: 'Table',
|
|
35
|
+
tableSize: '{rows} rows · {columns} columns',
|
|
36
|
+
close: 'Close',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const TABLE_FRAME_CLASS = 'sb-table';
|
|
40
|
+
export const TABLE_SCROLL_CLASS = 'sb-table-scroll';
|
|
41
|
+
export const TABLE_TOOLS_CLASS = 'sb-table-tools';
|
|
42
|
+
export const TABLE_BUTTON_CLASS = 'sb-table-btn';
|
|
43
|
+
export const NUMERIC_CLASS = 'sb-num';
|
|
44
|
+
export const LONG_CLASS = 'sb-long';
|
|
45
|
+
/** A column with a cell of at least this many characters in at least LONG_CELL_WORDS words holds sentences. */
|
|
46
|
+
export const LONG_CELL_CHARS = 28;
|
|
47
|
+
export const LONG_CELL_WORDS = 4;
|
|
48
|
+
export const TASK_CLASS = 'sb-task';
|
|
49
|
+
|
|
50
|
+
/** How long "Copied" (and the failure) stays on a table's button: the code block's timing. */
|
|
51
|
+
export const OUTPUT_FEEDBACK_MS = Object.freeze({ copied: 1500, failed: 4000 });
|
|
52
|
+
|
|
53
|
+
let translate = null;
|
|
54
|
+
|
|
55
|
+
/** Where a sentence comes from in the active locale: `fn(key, params)`, or a falsy value for the English. */
|
|
56
|
+
export function setOutputTranslator(fn) { translate = typeof fn === 'function' ? fn : null; }
|
|
57
|
+
|
|
58
|
+
/** An `output.*` sentence in the active locale, else the English. */
|
|
59
|
+
export function outputText(key, params = {}) {
|
|
60
|
+
let text = '';
|
|
61
|
+
try { text = translate?.(key, params) || ''; } catch { text = ''; }
|
|
62
|
+
if (!text || typeof text !== 'string') text = OUTPUT_COPY[key] ?? key;
|
|
63
|
+
return text.replace(/\{(\w+)\}/g, (whole, name) => (params[name] != null ? String(params[name]) : whole));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const escAttr = (value) => String(value ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
67
|
+
|
|
68
|
+
// A number as a reader sees one: an optional sign or comparison, a currency, digits with their separators, and a
|
|
69
|
+
// short unit (%, ms, s, MB, k, ×). A date (2026-11-21) or a time (12:30) is not one: nothing is aligned by it.
|
|
70
|
+
const NUMERIC_RE = /^[+\-−–~≈<>≤≥]?\s?(?:US\$|R\$|[$€£¥])?\s?\d[\d.,\s_]*(?:\s?(?:%|×|[a-zA-Zµ°]{1,5}(?:\/[a-zA-Z]{1,4})?))?$/;
|
|
71
|
+
const BLANK_RE = /^(?:|[-–—]|n\/a|—)$/i;
|
|
72
|
+
|
|
73
|
+
/** True when a cell's text is a number (see above). */
|
|
74
|
+
export function isNumericText(text) { return NUMERIC_RE.test(String(text ?? '').trim()); }
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Which columns of a table hold numbers: every filled cell of the body is one, and at least one is filled.
|
|
78
|
+
* @param {string[][]} bodyRows the body's cells as text
|
|
79
|
+
* @returns {boolean[]} one flag per column
|
|
80
|
+
*/
|
|
81
|
+
export function numericColumns(bodyRows) {
|
|
82
|
+
const rows = Array.isArray(bodyRows) ? bodyRows : [];
|
|
83
|
+
const width = rows.reduce((max, row) => Math.max(max, row.length), 0);
|
|
84
|
+
const flags = [];
|
|
85
|
+
for (let col = 0; col < width; col += 1) {
|
|
86
|
+
let filled = 0;
|
|
87
|
+
let numeric = true;
|
|
88
|
+
for (const row of rows) {
|
|
89
|
+
const text = String(row[col] ?? '').trim();
|
|
90
|
+
if (BLANK_RE.test(text)) continue;
|
|
91
|
+
filled += 1;
|
|
92
|
+
if (!NUMERIC_RE.test(text)) { numeric = false; break; }
|
|
93
|
+
}
|
|
94
|
+
flags.push(numeric && filled > 0);
|
|
95
|
+
}
|
|
96
|
+
return flags;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', '#39': "'", nbsp: ' ' };
|
|
100
|
+
// The text of a serialised cell: its tags out, the few entities a serialiser writes read back.
|
|
101
|
+
const cellText = (html) => String(html).replace(/<[^>]*>/g, '').replace(/&(amp|lt|gt|quot|#39|nbsp);/g, (_, name) => ENTITIES[name]).trim();
|
|
102
|
+
|
|
103
|
+
const ROW_RE = /<tr>([\s\S]*?)<\/tr>/g;
|
|
104
|
+
const CELL_RE = /<(t[hd])((?:\s[^>]*)?)>([\s\S]*?)<\/t[hd]>/g;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Which columns of a table hold sentences: some cell (the header's too) is LONG_CELL_CHARS or longer and has
|
|
108
|
+
* LONG_CELL_WORDS words or more. A long path or identifier is one word: it wraps where it can, and is not one.
|
|
109
|
+
* @param {string[][]} rows every row's cells as text
|
|
110
|
+
* @returns {boolean[]} one flag per column
|
|
111
|
+
*/
|
|
112
|
+
export function longColumns(rows) {
|
|
113
|
+
const flags = [];
|
|
114
|
+
for (const row of Array.isArray(rows) ? rows : []) {
|
|
115
|
+
row.forEach((cell, col) => {
|
|
116
|
+
const text = String(cell ?? '').trim();
|
|
117
|
+
if (text.length >= LONG_CELL_CHARS && text.split(/\s+/).length >= LONG_CELL_WORDS) flags[col] = true;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return Array.from(flags, Boolean);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// A sanitised table with `class="sb-num"` on the cells of its numeric columns and `class="sb-long"` on those of
|
|
124
|
+
// its columns of sentences. A numeric column the writer aligned (`---:` in Markdown: the sanitiser keeps
|
|
125
|
+
// `align`) is left as written, and so is a table that holds a table.
|
|
126
|
+
function markColumns(table) {
|
|
127
|
+
if (table.indexOf('<table', 1) !== -1) return table;
|
|
128
|
+
const bodyStart = table.indexOf('<tbody>');
|
|
129
|
+
const head = bodyStart === -1 ? '' : table.slice(0, bodyStart);
|
|
130
|
+
const body = bodyStart === -1 ? table : table.slice(bodyStart);
|
|
131
|
+
const rows = [];
|
|
132
|
+
for (const row of body.matchAll(ROW_RE)) {
|
|
133
|
+
const cells = [...row[1].matchAll(CELL_RE)];
|
|
134
|
+
if (cells.some((cell) => /\s(?:colspan|rowspan)=/i.test(cell[2]))) return table;
|
|
135
|
+
rows.push(cells.map((cell) => cellText(cell[3])));
|
|
136
|
+
}
|
|
137
|
+
const bodyRows = bodyStart === -1 ? rows.slice(1) : rows.slice();
|
|
138
|
+
if (!bodyRows.length) return table;
|
|
139
|
+
// The header's cells count for a column's width, wherever the header is.
|
|
140
|
+
if (bodyStart !== -1) for (const row of head.matchAll(ROW_RE)) rows.push([...row[1].matchAll(CELL_RE)].map((cell) => cellText(cell[3])));
|
|
141
|
+
const numeric = numericColumns(bodyRows);
|
|
142
|
+
const long = longColumns(rows);
|
|
143
|
+
if (!numeric.some(Boolean) && !long.some(Boolean)) return table;
|
|
144
|
+
const mark = (part) => part.replace(ROW_RE, (whole, inner) => {
|
|
145
|
+
let col = -1;
|
|
146
|
+
return `<tr>${inner.replace(CELL_RE, (cell, tag, attrs, content) => {
|
|
147
|
+
col += 1;
|
|
148
|
+
if (/\sclass=/i.test(attrs)) return cell;
|
|
149
|
+
const cls = numeric[col] && !/\salign=/i.test(attrs) ? NUMERIC_CLASS : long[col] && !numeric[col] ? LONG_CLASS : '';
|
|
150
|
+
return cls ? `<${tag}${attrs} class="${cls}">${content}</${tag}>` : cell;
|
|
151
|
+
})}</tr>`;
|
|
152
|
+
});
|
|
153
|
+
return mark(head) + mark(body);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** How many body rows and columns a serialised table has. */
|
|
157
|
+
export function tableSize(table) {
|
|
158
|
+
const rows = [...String(table).matchAll(ROW_RE)];
|
|
159
|
+
const hasHead = /<thead>/i.test(table);
|
|
160
|
+
const columns = rows.length ? [...rows[0][1].matchAll(CELL_RE)].length : 0;
|
|
161
|
+
return { rows: Math.max(0, rows.length - (hasHead || rows.length > 1 ? 1 : 0)), columns };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function tableButton(action, label, name) {
|
|
165
|
+
return `<button type="button" class="${TABLE_BUTTON_CLASS}" data-sb-act="${action}" data-label="${escAttr(label)}" aria-label="${escAttr(name)}"></button>`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** The strip above a table: its size (drawn by CSS for a table that is worth it), Expand and Copy. */
|
|
169
|
+
export function tableToolsHtml({ rows = 0, columns = 0 } = {}) {
|
|
170
|
+
return `<div class="${TABLE_TOOLS_CLASS}" data-rows="${rows}" data-columns="${columns}" data-label="${escAttr(outputText('tableSize', { rows, columns }))}">`
|
|
171
|
+
+ `${tableButton('expand', outputText('expand'), outputText('expandTable'))}${tableButton('copy', outputText('copy'), outputText('copyTable'))}</div>`;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const FRAME_OPEN = `<div class="${TABLE_SCROLL_CLASS}">`;
|
|
175
|
+
|
|
176
|
+
/** One sanitised `<table>…</table>` inside its frame. */
|
|
177
|
+
export function tableFrameHtml(table) {
|
|
178
|
+
const marked = markColumns(table);
|
|
179
|
+
return `<div class="${TABLE_FRAME_CLASS}">${tableToolsHtml(tableSize(marked))}${FRAME_OPEN}${marked}</div></div>`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Every outermost table of a serialised document through `fn`; one already inside a frame is left alone, so the
|
|
183
|
+
// result is the same however often this runs.
|
|
184
|
+
function mapTables(html, fn) {
|
|
185
|
+
const token = /<table>|<\/table>/gi;
|
|
186
|
+
let out = '';
|
|
187
|
+
let last = 0;
|
|
188
|
+
let depth = 0;
|
|
189
|
+
let start = -1;
|
|
190
|
+
for (let match = token.exec(html); match; match = token.exec(html)) {
|
|
191
|
+
if (match[0][1] !== '/') {
|
|
192
|
+
if (depth === 0) start = match.index;
|
|
193
|
+
depth += 1;
|
|
194
|
+
} else if (depth > 0) {
|
|
195
|
+
depth -= 1;
|
|
196
|
+
if (depth !== 0) continue;
|
|
197
|
+
const end = match.index + match[0].length;
|
|
198
|
+
const framed = html.slice(Math.max(0, start - FRAME_OPEN.length), start) === FRAME_OPEN;
|
|
199
|
+
out += html.slice(last, start) + (framed ? html.slice(start, end) : fn(html.slice(start, end)));
|
|
200
|
+
last = end;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return out + html.slice(last);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const TASK_RE = /<li>(\s*(?:<p>)?)(☑|☐) /g;
|
|
207
|
+
const LANG_RE = /<pre><code class="language-([\w+#.-]{1,40})">/g;
|
|
208
|
+
const DIFF_RE = /(<pre data-lang="diff"><code class="language-diff">)([\s\S]*?)(<\/code>)/g;
|
|
209
|
+
|
|
210
|
+
/** The kind of a diff's line as a class (`sb-diff-add`, `-del`, `-hunk`, `-file`), or '' for a line of context. */
|
|
211
|
+
export function diffLineClass(line) {
|
|
212
|
+
if (/^(?:\+\+\+ |--- |diff |index )/.test(line)) return 'sb-diff-file';
|
|
213
|
+
if (line.startsWith('@@')) return 'sb-diff-hunk';
|
|
214
|
+
if (line.startsWith('+')) return 'sb-diff-add';
|
|
215
|
+
if (line.startsWith('-')) return 'sb-diff-del';
|
|
216
|
+
return '';
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// The lines of a diff block, each added, removed, hunk or file line in a span of its kind. The text is untouched
|
|
220
|
+
// (what the block copies is what was written); a block that already holds markup is left as it is.
|
|
221
|
+
export function markDiffLines(body) {
|
|
222
|
+
if (body.includes('<')) return body;
|
|
223
|
+
return body.split('\n').map((line) => {
|
|
224
|
+
const cls = diffLineClass(line);
|
|
225
|
+
return cls && line ? `<span class="${cls}">${line}</span>` : line;
|
|
226
|
+
}).join('\n');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Sanitised Markdown HTML as a readable document: tables in their frames, task items, code languages, diff lines.
|
|
231
|
+
* Idempotent. `diff: false` leaves a diff block's lines alone (a panel that highlights code itself).
|
|
232
|
+
*/
|
|
233
|
+
export function withOutputFrames(html, { diff = true } = {}) {
|
|
234
|
+
let out = typeof html === 'string' ? html : '';
|
|
235
|
+
if (!out) return out;
|
|
236
|
+
if (/<table>/i.test(out)) out = mapTables(out, tableFrameHtml);
|
|
237
|
+
if (out.includes('☑') || out.includes('☐')) {
|
|
238
|
+
out = out.replace(TASK_RE, (whole, lead, box) => `<li class="${TASK_CLASS}${box === '☑' ? ` ${TASK_CLASS}-done` : ''}">${lead}<span class="${TASK_CLASS}-box">${box}</span> `);
|
|
239
|
+
}
|
|
240
|
+
if (out.includes('<pre><code class="language-')) out = out.replace(LANG_RE, '<pre data-lang="$1"><code class="language-$1">');
|
|
241
|
+
if (diff && out.includes('data-lang="diff"')) out = out.replace(DIFF_RE, (whole, open, body, close) => open + markDiffLines(body) + close);
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const tagOf = (node) => String(node?.localName || node?.nodeName || '').toLowerCase();
|
|
246
|
+
|
|
247
|
+
function nodeText(node) {
|
|
248
|
+
let out = '';
|
|
249
|
+
const walk = (parent) => {
|
|
250
|
+
for (const child of parent.childNodes || []) {
|
|
251
|
+
if (child.nodeType === 3 || child.nodeType === 4) { out += child.data ?? child.nodeValue ?? ''; continue; }
|
|
252
|
+
if (child.nodeType !== 1) continue;
|
|
253
|
+
const tag = tagOf(child);
|
|
254
|
+
if (tag === 'button') continue;
|
|
255
|
+
if (tag === 'br') { out += ' '; continue; }
|
|
256
|
+
walk(child);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
walk(node);
|
|
260
|
+
return out.replace(/\s+/g, ' ').trim();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* A table element's cells as text, row by row (the header first). Works on any DOM, a test's included.
|
|
265
|
+
* @returns {string[][]}
|
|
266
|
+
*/
|
|
267
|
+
export function tableMatrix(table) {
|
|
268
|
+
const rows = [];
|
|
269
|
+
const walk = (node) => {
|
|
270
|
+
for (const child of node?.childNodes || []) {
|
|
271
|
+
if (child.nodeType !== 1) continue;
|
|
272
|
+
const tag = tagOf(child);
|
|
273
|
+
if (tag === 'tr') rows.push([...child.childNodes].filter((cell) => cell.nodeType === 1 && /^t[hd]$/.test(tagOf(cell))).map(nodeText));
|
|
274
|
+
else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') walk(child);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
walk(table);
|
|
278
|
+
return rows;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** A table as tab-separated text: what a spreadsheet, a chat and a terminal all read. */
|
|
282
|
+
export function matrixToTsv(matrix) {
|
|
283
|
+
return (matrix || []).map((row) => row.map((cell) => String(cell ?? '').replace(/[\t\r\n]+/g, ' ')).join('\t')).join('\n');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const escText = (value) => String(value ?? '').replace(/[&<>]/g, (c) => ({ '&': '&', '<': '<', '>': '>' }[c]));
|
|
287
|
+
|
|
288
|
+
/** The same table as plain, unstyled HTML (text only): what a document or a mail pastes as a table. */
|
|
289
|
+
export function matrixToHtml(matrix) {
|
|
290
|
+
const rows = matrix || [];
|
|
291
|
+
if (!rows.length) return '';
|
|
292
|
+
const line = (row, tag) => `<tr>${row.map((cell) => `<${tag}>${escText(cell)}</${tag}>`).join('')}</tr>`;
|
|
293
|
+
return `<table><thead>${line(rows[0], 'th')}</thead><tbody>${rows.slice(1).map((row) => line(row, 'td')).join('')}</tbody></table>`;
|
|
294
|
+
}
|
|
@@ -33,3 +33,9 @@ export function getProviderMeta(providerId = 'claude-code') {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { PROVIDER_META };
|
|
36
|
+
|
|
37
|
+
/** OpenCode stores a model as providerID/modelID or as its serialized string. */
|
|
38
|
+
export function isMaritacaModel(model) {
|
|
39
|
+
const provider = typeof model === 'string' ? model.split('/', 1)[0] : model?.providerID;
|
|
40
|
+
return typeof provider === 'string' && provider.toLowerCase() === 'maritaca';
|
|
41
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPersonalStop } from './worker-end.js';
|
|
1
2
|
import { toolListView } from './tool-list-view.js';
|
|
2
3
|
// SynaBun Neural Interface — what the Schedules window shows, without the page.
|
|
3
4
|
// Which schedules a view lists and in which order, how a schedule's state reads, and the cron
|
|
@@ -230,7 +231,7 @@ export function lastRunState(schedule) {
|
|
|
230
231
|
const head = (colon >= 0 ? text.slice(0, colon) : text).trim();
|
|
231
232
|
const reason = colon >= 0 ? text.slice(colon + 1).trim() : '';
|
|
232
233
|
if (head === 'error') return { kind: 'failed', label: scheduleWord('runFailed'), reason: reason || scheduleWord('runFailedReason') };
|
|
233
|
-
if (head === 'stopped') return { kind: 'stopped', label: scheduleWord('runStopped'), reason: reason === 'user' ? scheduleWord('runStoppedByYou') : reason };
|
|
234
|
+
if (head === 'stopped') return { kind: 'stopped', label: scheduleWord('runStopped'), reason: reason === 'user' ? (isPersonalStop(schedule.lastStopProvenance) ? scheduleWord('runStoppedByYou') : '') : reason };
|
|
234
235
|
if (head === 'interrupted') return { kind: 'interrupted', label: scheduleWord('runInterrupted'), reason };
|
|
235
236
|
return { kind: 'other', label: head.charAt(0).toUpperCase() + head.slice(1), reason };
|
|
236
237
|
}
|