synabun 2.4.0 → 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 +47 -0
- package/README.md +1 -1
- package/browser-extension/content.js +73 -11
- package/browser-extension/engine.js +196 -15
- package/browser-extension/manifest.json +4 -2
- package/browser-extension/popup-strings.js +10 -4
- package/browser-extension/popup-view.js +1 -1
- package/browser-extension/popup.css +1 -0
- package/browser-extension/popup.html +4 -1
- package/browser-extension/popup.js +22 -10
- package/browser-extension/protocol.js +102 -11
- package/browser-extension/service-worker.js +20 -4
- package/browser-extension/tokens.css +1 -1
- package/docs/browser-extension-bridge.md +25 -5
- package/lib/data-home-files.js +47 -0
- package/lib/data-home-migration.js +34 -58
- 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 +6 -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 +13 -8
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +35 -15
- 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 +23 -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 +33 -14
- 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 +266 -2
- package/neural-interface/i18n/pt-BR.json +267 -3
- package/neural-interface/lib/agents/builtins.json +207 -0
- package/neural-interface/lib/agents/registry.js +60 -15
- package/neural-interface/lib/agents/resolve.js +69 -10
- 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-brains/opencode.js +60 -11
- 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 +384 -119
- package/neural-interface/lib/assistant-persona.js +17 -5
- package/neural-interface/lib/assistant-pricing.js +65 -14
- package/neural-interface/lib/assistant-router.js +181 -54
- package/neural-interface/lib/assistant-run-wait.js +45 -28
- package/neural-interface/lib/assistant-runtime.js +48 -34
- 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 +836 -322
- 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 +109 -24
- package/neural-interface/lib/browser-extension-bridge.js +42 -8
- 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 +34 -14
- package/neural-interface/lib/opencode-build-preflight.js +30 -8
- 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/peer-identity.js +13 -8
- 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 +70 -44
- 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 +196 -97
- package/neural-interface/lib/teams/schema.js +1 -1
- 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 +260 -0
- package/neural-interface/public/offline.html +4 -3
- package/neural-interface/public/onboarding.html +259 -34
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +2 -2
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +1 -1
- 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/agents/studio/ax-ui.js +2 -2
- 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 +3 -2
- 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 +106 -38
- package/neural-interface/public/shared/assistant/asst-route.js +102 -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/cc-dropdown.js +21 -15
- 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 -51
- 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/owner-authority-view.js +4 -10
- package/neural-interface/public/shared/page-session.js +1 -1
- 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-ai-browser.js +5 -5
- 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/start-bridge.js +2 -2
- package/neural-interface/public/shared/studio-attention.js +6 -0
- package/neural-interface/public/shared/styles.css +354 -438
- 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 +185 -25
- package/neural-interface/public/shared/ui-native-loop-router.js +59 -20
- 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-owner-authority.js +48 -25
- 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 +234 -67
- package/neural-interface/public/shared/ui-sidepanel-tray.js +3 -2
- package/neural-interface/public/shared/ui-sync.js +1 -0
- 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/sw.js +4 -3
- 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 +17 -4
- package/neural-interface/scripts/scratch-retention.mjs +20 -0
- package/neural-interface/server.js +507 -160
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
- package/scripts/restore-data-home-from-backup.mjs +175 -8
- package/setup.js +18 -4
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { syncOpenCodeWorkerQuestions, forgetWorkerQuestions } from './ocp-v2-ws.js';
|
|
2
|
+
import { getProviderMeta, isMaritacaModel } from '../provider-icons.js';
|
|
3
|
+
|
|
2
4
|
import { workerRestart } from '../worker-restart.js';
|
|
3
5
|
import { t } from '../i18n.js';
|
|
4
6
|
import { hostedSidepanelId, sidepanelHost } from '../ui-sidepanel-runtime.js';
|
|
@@ -37,6 +39,7 @@ import { closeWithPromptsConfirm, prefilledDraft, samePrompts } from './ocp-v2-c
|
|
|
37
39
|
import { setSelectOptions, projectOptionRows } from './ocp-v2-select.js';
|
|
38
40
|
import { replyFailed, replyError } from './ocp-v2-caps.js';
|
|
39
41
|
import { rehydratePanelSession, recoveredErrorSweep } from './ocp-v2-rehydrate.js';
|
|
42
|
+
import { missingLocationOf, missingPanelLocation, planLocationRecovery, sameFolder } from './ocp-v2-location-logic.js';
|
|
40
43
|
import { headerStatus } from './ocp-v2-render-logic.js';
|
|
41
44
|
import { runTurnLive } from '../sidepanel-session-status.js';
|
|
42
45
|
import {
|
|
@@ -104,6 +107,7 @@ let _statusEl = null;
|
|
|
104
107
|
let _titleEl = null;
|
|
105
108
|
let _tabSessionIds = []; // ordered session IDs that own a tray pill
|
|
106
109
|
let _tabPills = new Map(); // sessionId -> pill element
|
|
110
|
+
const maritacaTabs = new Set();
|
|
107
111
|
let _tabInfoCache = new Map(); // sessionId -> last-known session info (title, etc.)
|
|
108
112
|
const _automationRunIds = new Map(); // sessionId -> native loop runId
|
|
109
113
|
// The sessions whose automation run is live. The ownership module keeps the set, so that the socket layer
|
|
@@ -140,6 +144,9 @@ let _docClickWired = false;
|
|
|
140
144
|
let _healTimer = null;
|
|
141
145
|
let _healingPromise = null;
|
|
142
146
|
let _healRetryCount = 0;
|
|
147
|
+
// Folders OpenCode said are gone ("Location not found"), and the move away from one that is under way.
|
|
148
|
+
const _goneLocations = new Set();
|
|
149
|
+
let _locationRecovery = null;
|
|
143
150
|
const _sessionTitleState = new Map(); // sessionId -> { state, title, requestId, controller }
|
|
144
151
|
const _titleReassertTimers = new Map();
|
|
145
152
|
// Renames whose request is out. Until the server has answered, the title a
|
|
@@ -635,7 +642,7 @@ function buildPanel() {
|
|
|
635
642
|
(runId) => fetch('/api/loop/stop', {
|
|
636
643
|
method: 'POST',
|
|
637
644
|
headers: { 'Content-Type': 'application/json' },
|
|
638
|
-
body: JSON.stringify({ runId }),
|
|
645
|
+
body: JSON.stringify({ runId, action: 'stop' }),
|
|
639
646
|
}).catch(() => {}),
|
|
640
647
|
);
|
|
641
648
|
if (stopped) saveAutomationTabs();
|
|
@@ -719,10 +726,12 @@ function handleStoreEvent(event, stateSnapshot) {
|
|
|
719
726
|
if (event?.type === 'running:set' && !nextState.running && nextState.sessionId) {
|
|
720
727
|
_titleNeedsReassert(nextState.sessionId);
|
|
721
728
|
}
|
|
729
|
+
if (event?.type === 'config:model') rememberTabBrand(nextState.sessionId, nextState.model);
|
|
722
730
|
if (event?.type === 'session:info') keepOwnSessionTitle(nextState);
|
|
723
731
|
if (TRANSCRIPT_EVENTS.has(event?.type)) queueHeaderSync();
|
|
724
732
|
else syncHeader();
|
|
725
733
|
maybeScheduleAutoHeal(event, nextState);
|
|
734
|
+
maybeRecoverMissingLocation(event, nextState);
|
|
726
735
|
}
|
|
727
736
|
|
|
728
737
|
// A message, a part or a streamed chunk changes nothing the header or the pills show (headerStatus and the tab
|
|
@@ -877,9 +886,86 @@ function isRecoverablePanelError(err) {
|
|
|
877
886
|
const msg = String(err?.message || err?.error || err || '').trim();
|
|
878
887
|
if (!msg) return true;
|
|
879
888
|
if (/choose continue|question reply failed|plan action failed|could not create plan file|could not read the plan|rename failed|could not delete|could not unarchive|not queued/i.test(msg)) return false;
|
|
889
|
+
// A folder that is gone is not a lost connection: maybeRecoverMissingLocation moves the panel on.
|
|
890
|
+
if (missingLocationOf(msg)) return false;
|
|
880
891
|
return /websocket|closed|disconnect|offline|reconnect|request timeout|timeout|network|failed|server|session|opencode|send|boot|no session|not connected/i.test(msg);
|
|
881
892
|
}
|
|
882
893
|
|
|
894
|
+
// ── A session whose folder is gone ───────────────────────────────────────────
|
|
895
|
+
// OpenCode binds a session to the folder it was created in and refuses every
|
|
896
|
+
// prompt of one whose folder no longer exists ("Location not found: …"): a
|
|
897
|
+
// worktree that was removed, a project that was moved. Nothing repairs such a
|
|
898
|
+
// session, so the panel moves on by itself: a new session in the registered
|
|
899
|
+
// project the folder was inside (else with no project), and a notice that says
|
|
900
|
+
// so. The prompt that failed is back in the box by then, and the box is the
|
|
901
|
+
// panel's: it stays. ocp-v2-location-logic.js decides; this is the panel's own
|
|
902
|
+
// rebinding (repair), so a choice the user makes meanwhile still wins.
|
|
903
|
+
function isGoneLocation(folder) {
|
|
904
|
+
for (const gone of _goneLocations) if (sameFolder(gone, folder)) return true;
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function maybeRecoverMissingLocation(event, s) {
|
|
909
|
+
if (event?.type !== 'error:push' || !_panelEl || _locationRecovery) return;
|
|
910
|
+
const last = s.errors[s.errors.length - 1];
|
|
911
|
+
if (!last || last.notice) return;
|
|
912
|
+
const missing = missingPanelLocation({
|
|
913
|
+
message: last.message, cwd: s.cwd || '', sessionDirectory: s.sessionInfo?.directory || '',
|
|
914
|
+
});
|
|
915
|
+
if (!missing) return;
|
|
916
|
+
const at = captureBinding(getDefaultStore());
|
|
917
|
+
_locationRecovery = recoverMissingLocation(missing, at)
|
|
918
|
+
.catch((err) => console.warn('[ocp-v2-panel] missing-folder recovery failed', err))
|
|
919
|
+
.finally(() => { _locationRecovery = null; });
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
async function recoverMissingLocation(missing, at) {
|
|
923
|
+
// The send that failed settles first (its text and attachments return to the box).
|
|
924
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
925
|
+
const projects = await loadProjectsOnce();
|
|
926
|
+
// The user went somewhere else meanwhile: that choice stands.
|
|
927
|
+
if (!at.isCurrent()) return;
|
|
928
|
+
_goneLocations.add(missing);
|
|
929
|
+
// A folder the panel moves to may be gone as well (a registered project that was deleted): the next one, then none.
|
|
930
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
931
|
+
const plan = planLocationRecovery({ missing, cwd: getState().cwd || '', projects, avoid: [..._goneLocations] });
|
|
932
|
+
if (!plan) return;
|
|
933
|
+
const moved = await moveToFolder(plan.fallback);
|
|
934
|
+
if (moved.ok) {
|
|
935
|
+
pushError({ message: plan.notice, notice: true });
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
if (!moved.missing || !sameFolder(moved.missing, plan.fallback)) {
|
|
939
|
+
pushError({ message: moved.error });
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
_goneLocations.add(moved.missing);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// The panel on `folder` ('' for no project) with a new session, leaving the one on screen.
|
|
947
|
+
async function moveToFolder(folder) {
|
|
948
|
+
const next = String(folder || '');
|
|
949
|
+
const nav = _nav.repair();
|
|
950
|
+
setCwd(next);
|
|
951
|
+
if (next) storage.setItem(STOR_PROJECT, next);
|
|
952
|
+
else storage.removeItem(STOR_PROJECT);
|
|
953
|
+
if (nav.sessionId) {
|
|
954
|
+
nav.apply(() => {
|
|
955
|
+
clearMessages();
|
|
956
|
+
setSession(null, null);
|
|
957
|
+
bindPrimarySession(getDefaultStore(), null);
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
try {
|
|
961
|
+
await startFreshSession({ cwd: next || undefined, nav });
|
|
962
|
+
return { ok: true };
|
|
963
|
+
} catch (err) {
|
|
964
|
+
const error = err?.message || 'New session failed';
|
|
965
|
+
return { ok: false, error, missing: missingLocationOf(error) };
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
883
969
|
// ── Session picker + rename ─────────────────────────────────────────────────
|
|
884
970
|
|
|
885
971
|
function sessionTitleFor(stateOrSession) {
|
|
@@ -1471,7 +1557,8 @@ async function switchToSession(sid, info = null, { nav } = {}) {
|
|
|
1471
1557
|
const dirFromInfo = info?.directory;
|
|
1472
1558
|
if (dirFromInfo && dirFromInfo !== getState().cwd) {
|
|
1473
1559
|
setCwd(dirFromInfo);
|
|
1474
|
-
|
|
1560
|
+
// (Not a folder OpenCode said is gone: the next new session would start there.)
|
|
1561
|
+
if (!isGoneLocation(dirFromInfo)) storage.setItem(STOR_PROJECT, dirFromInfo);
|
|
1475
1562
|
}
|
|
1476
1563
|
});
|
|
1477
1564
|
if (!bound) { ensureTab(sid, info); renderPill(); return; }
|
|
@@ -1498,8 +1585,9 @@ async function restoreSessionSelections(sid, info) {
|
|
|
1498
1585
|
const dir = full.directory;
|
|
1499
1586
|
if (dir && dir !== getState().cwd) {
|
|
1500
1587
|
setCwd(dir);
|
|
1501
|
-
storage.setItem(STOR_PROJECT, dir);
|
|
1588
|
+
if (!isGoneLocation(dir)) storage.setItem(STOR_PROJECT, dir);
|
|
1502
1589
|
}
|
|
1590
|
+
rememberTabBrand(sid, full.model);
|
|
1503
1591
|
applySessionSelections(getDefaultStore(), full);
|
|
1504
1592
|
// Fresh metadata too: keeps the title right after a switch.
|
|
1505
1593
|
getDefaultStore().setSessionInfo(full);
|
|
@@ -1625,6 +1713,10 @@ async function boot() {
|
|
|
1625
1713
|
for (const sid of savedTabs) {
|
|
1626
1714
|
const info = byId.get(sid);
|
|
1627
1715
|
if (info) {
|
|
1716
|
+
if (info.model) {
|
|
1717
|
+
if (isMaritacaModel(info.model)) maritacaTabs.add(sid);
|
|
1718
|
+
else maritacaTabs.delete(sid);
|
|
1719
|
+
}
|
|
1628
1720
|
liveTabs.push(sid);
|
|
1629
1721
|
_tabInfoCache.set(sid, info);
|
|
1630
1722
|
ensureOpenCodeTitleState(sid, info, { manual: true });
|
|
@@ -2152,7 +2244,9 @@ function loadTabSessions() {
|
|
|
2152
2244
|
try {
|
|
2153
2245
|
const raw = storage.getItem(STOR_TABS);
|
|
2154
2246
|
if (!raw) return [];
|
|
2155
|
-
|
|
2247
|
+
const tabs = readSavedTabs(JSON.parse(raw));
|
|
2248
|
+
for (const tab of tabs) if (tab.modelBrand === 'maritaca') maritacaTabs.add(tab.sessionId);
|
|
2249
|
+
return tabs
|
|
2156
2250
|
.map(({ sessionId }) => sessionId)
|
|
2157
2251
|
.filter((sessionId) => !_foreignActiveAutomationSessions.has(sessionId));
|
|
2158
2252
|
} catch { return []; }
|
|
@@ -2169,7 +2263,7 @@ function saveTabSessions() {
|
|
|
2169
2263
|
.map((row) => row.sessionId));
|
|
2170
2264
|
const preserved = existing.filter(({ sessionId }) => foreignSessionIds.has(sessionId) && !_tabSessionIds.includes(sessionId));
|
|
2171
2265
|
const tabs = _tabSessionIds.map((sessionId) => ({
|
|
2172
|
-
...savedById.get(sessionId), sessionId, needsYou: tabNeedsYou(sessionId),
|
|
2266
|
+
...savedById.get(sessionId), sessionId, modelBrand: maritacaTabs.has(sessionId) ? 'maritaca' : undefined, needsYou: tabNeedsYou(sessionId),
|
|
2173
2267
|
}));
|
|
2174
2268
|
storage.setItem(STOR_TABS, JSON.stringify([...tabs, ...preserved]));
|
|
2175
2269
|
_savedTabWaiting = new Map(tabs.map(({ sessionId, needsYou }) => [sessionId, needsYou]));
|
|
@@ -2198,10 +2292,20 @@ function syncSavedTabWaiting() {
|
|
|
2198
2292
|
if (_tabSessionIds.some((sid) => _savedTabWaiting.get(sid) !== tabNeedsYou(sid))) saveTabSessions();
|
|
2199
2293
|
}
|
|
2200
2294
|
|
|
2295
|
+
function rememberTabBrand(sessionId, model) {
|
|
2296
|
+
if (!sessionId || !model) return;
|
|
2297
|
+
const maritaca = isMaritacaModel(model);
|
|
2298
|
+
if (maritaca === maritacaTabs.has(sessionId)) return;
|
|
2299
|
+
if (maritaca) maritacaTabs.add(sessionId);
|
|
2300
|
+
else maritacaTabs.delete(sessionId);
|
|
2301
|
+
if (_tabSessionIds.includes(sessionId)) saveTabSessions();
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2201
2304
|
function ensureTab(sessionId, info = null) {
|
|
2202
2305
|
if (!sessionId) return;
|
|
2203
2306
|
if (info) _tabInfoCache.set(sessionId, info);
|
|
2204
2307
|
if (!_tabSessionIds.includes(sessionId)) {
|
|
2308
|
+
rememberTabBrand(sessionId, info?.model || (sessionId === getState().sessionId && getState().model));
|
|
2205
2309
|
_tabSessionIds.push(sessionId);
|
|
2206
2310
|
saveTabSessions();
|
|
2207
2311
|
}
|
|
@@ -2216,7 +2320,7 @@ function dismissAutomationSession(sessionId) {
|
|
|
2216
2320
|
endWorkerRunOnClose(runId, () => fetch('/api/loop/stop', {
|
|
2217
2321
|
method: 'POST',
|
|
2218
2322
|
headers: { 'Content-Type': 'application/json' },
|
|
2219
|
-
body: JSON.stringify({ runId }),
|
|
2323
|
+
body: JSON.stringify({ runId, action: 'tab_close' }),
|
|
2220
2324
|
}).catch(() => {}));
|
|
2221
2325
|
}
|
|
2222
2326
|
return true;
|
|
@@ -2285,6 +2389,7 @@ function removeTab(sessionId, { byUser = false } = {}) {
|
|
|
2285
2389
|
_tabSessionIds = _tabSessionIds.filter((s) => s !== sessionId);
|
|
2286
2390
|
if (_tabSessionIds.length !== before) saveTabSessions();
|
|
2287
2391
|
_tabInfoCache.delete(sessionId);
|
|
2392
|
+
maritacaTabs.delete(sessionId);
|
|
2288
2393
|
const titleState = _sessionTitleState.get(sessionId);
|
|
2289
2394
|
titleState?.controller?.abort();
|
|
2290
2395
|
_sessionTitleState.delete(sessionId);
|
|
@@ -2326,6 +2431,8 @@ function createTabPill(sessionId) {
|
|
|
2326
2431
|
pill.className = 'term-minimized-pill ocpv2-session-pill';
|
|
2327
2432
|
pill.dataset.owner = PANEL_OWNER;
|
|
2328
2433
|
pill.dataset.sessionId = sessionId;
|
|
2434
|
+
pill.getAutomationRunId = () => _automationRunIds.get(sessionId);
|
|
2435
|
+
pill.hasQueuedWorkerPrompts = () => _automationRunIds.has(sessionId) && promptsWaitingFor(sessionId).length > 0;
|
|
2329
2436
|
pill.innerHTML = `
|
|
2330
2437
|
<span class="ocpv2-pill-ring" aria-hidden="true"><i></i></span>
|
|
2331
2438
|
<span class="term-minimized-pill-icon">${OPENCODE_ICON}</span>
|
|
@@ -2425,6 +2532,11 @@ function renderPill() {
|
|
|
2425
2532
|
if (!pill) continue;
|
|
2426
2533
|
_tabPills.set(sid, pill);
|
|
2427
2534
|
}
|
|
2535
|
+
const brand = maritacaTabs.has(sid) ? 'maritaca' : 'opencode';
|
|
2536
|
+
if (pill.dataset.modelBrand !== brand) {
|
|
2537
|
+
pill.querySelector('.term-minimized-pill-icon').innerHTML = brand === 'maritaca' ? getProviderMeta(brand).icon : OPENCODE_ICON;
|
|
2538
|
+
pill.dataset.modelBrand = brand;
|
|
2539
|
+
}
|
|
2428
2540
|
const labelEl = pill.querySelector('.term-minimized-pill-label');
|
|
2429
2541
|
// Written only when it changed: the same text again is still a new text node, which the tray's
|
|
2430
2542
|
// observer (ui-navbar.js) answers by going through every pill.
|
|
@@ -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();
|