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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sessionProjectItems } from './session-project-items.js';
|
|
2
2
|
import { t } from './i18n.js';
|
|
3
|
+
import { thinkToggleText } from './effort-i18n.js';
|
|
3
4
|
import { answerWorkerQuestion, syncWorkerQuestionQueue } from './worker-questions.js';
|
|
4
5
|
import { providerAuthSnapshot } from './ui-provider-auth.js';
|
|
5
6
|
import { mountProviderTerminalAuth, providerApiKeyRequest, startProviderTerminalLogin } from './ui-provider-terminal-auth.js';
|
|
@@ -29,6 +30,7 @@ import { isFarRowStyleRecord, watchTranscriptRows } from './transcript-rows.js';
|
|
|
29
30
|
import { requestGeneratedSessionTitle } from './session-title.js';
|
|
30
31
|
import { wireFileLinks } from './ui-file-links.js';
|
|
31
32
|
import { decorateCodeBlocks, installCodeCopy } from './ui-code-copy.js';
|
|
33
|
+
import { decorateOutput, installOutput } from './ui-output.js';
|
|
32
34
|
import { WORKER_END_CLASS, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, leaveWorkerTab, trackWorkerEnd, updateWorkerEndBusy } from './ui-worker-end.js';
|
|
33
35
|
import { isDispatchedRun, isEndOfRunAbort, workerEndView } from './worker-end.js';
|
|
34
36
|
import { runAwaitsAnswer, runTurnLive } from './sidepanel-session-status.js';
|
|
@@ -673,67 +675,9 @@ function injectStyles() {
|
|
|
673
675
|
}
|
|
674
676
|
.cp-messages .msg-avatar svg { width: 14px; height: 14px; }
|
|
675
677
|
.cp-messages .msg-content { flex: 1; min-width: 0; }
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
font-family: 'Inter', -apple-system, sans-serif;
|
|
680
|
-
}
|
|
681
|
-
.cp-messages .msg-body p { margin: 0 0 0.5em; }
|
|
682
|
-
.cp-messages .msg-body p:last-child { margin-bottom: 0; }
|
|
683
|
-
.cp-messages .msg-body h1,.cp-messages .msg-body h2,.cp-messages .msg-body h3 {
|
|
684
|
-
color: var(--t-bright); margin: 0.7em 0 0.25em; font-weight: 600;
|
|
685
|
-
}
|
|
686
|
-
.cp-messages .msg-body h1 { font-size: 14px; }
|
|
687
|
-
.cp-messages .msg-body h2 { font-size: 13px; }
|
|
688
|
-
.cp-messages .msg-body h3 { font-size: 12px; }
|
|
689
|
-
.cp-messages .msg-body code:not(pre code) {
|
|
690
|
-
background: var(--s-subtle); border: 1px solid var(--b-subtle);
|
|
691
|
-
border-radius: 4px; padding: 1px 5px; font-family: 'JetBrains Mono', monospace;
|
|
692
|
-
font-size: 0.88em; color: var(--t-bright);
|
|
693
|
-
}
|
|
694
|
-
.cp-messages .msg-body pre {
|
|
695
|
-
background: rgba(0,0,0,0.3); border: 1px solid var(--b-subtle);
|
|
696
|
-
border-radius: 8px; padding: 10px; overflow-x: auto; margin: 0.5em 0;
|
|
697
|
-
position: relative;
|
|
698
|
-
}
|
|
699
|
-
.cp-messages .msg-body pre code {
|
|
700
|
-
font-family: 'JetBrains Mono', monospace; font-size: 11px;
|
|
701
|
-
color: var(--t-primary); background: none; border: none; padding: 0;
|
|
702
|
-
}
|
|
703
|
-
/* A block's Copy button is the shared one (../code-copy.js, ui-code-copy.js): its styles come with it. */
|
|
704
|
-
.cp-messages .msg-body a { color: var(--t-bright); text-decoration: none; }
|
|
705
|
-
.cp-messages .msg-body a:hover { text-decoration: underline; }
|
|
706
|
-
.cp-messages .msg-body strong { color: var(--t-bright); }
|
|
707
|
-
.cp-messages .msg-body ul, .cp-messages .msg-body ol { padding-left: 1.3em; margin: 0.3em 0; }
|
|
708
|
-
.cp-messages .msg-body ul { list-style: none; }
|
|
709
|
-
.cp-messages .msg-body ul li { position: relative; }
|
|
710
|
-
.cp-messages .msg-body ul li::before {
|
|
711
|
-
content: ''; position: absolute; left: -1em; top: 0.6em;
|
|
712
|
-
width: 4px; height: 4px; border-radius: 50%;
|
|
713
|
-
background: rgba(255,255,255,0.2);
|
|
714
|
-
}
|
|
715
|
-
.cp-messages .msg-body ol li { color: var(--t-primary); }
|
|
716
|
-
.cp-messages .msg-body ol li::marker { color: var(--t-faint); font-size: 11px; }
|
|
717
|
-
.cp-messages .msg-body blockquote {
|
|
718
|
-
margin: 0.5em 0; padding: 4px 0 4px 12px;
|
|
719
|
-
border-left: 2px solid rgba(200,160,80,0.3);
|
|
720
|
-
color: var(--t-secondary); font-style: italic;
|
|
721
|
-
}
|
|
722
|
-
.cp-messages .msg-body hr {
|
|
723
|
-
border: none; height: 1px; margin: 0.8em 0;
|
|
724
|
-
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08) 20%, rgba(255,255,255,0.08) 80%, transparent);
|
|
725
|
-
}
|
|
726
|
-
.cp-messages .msg-body table {
|
|
727
|
-
width: 100%; border-collapse: collapse; margin: 0.5em 0; font-size: 11px;
|
|
728
|
-
}
|
|
729
|
-
.cp-messages .msg-body th {
|
|
730
|
-
text-align: left; padding: 4px 8px; font-weight: 600; color: var(--t-bright);
|
|
731
|
-
background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.08);
|
|
732
|
-
}
|
|
733
|
-
.cp-messages .msg-body td {
|
|
734
|
-
padding: 3px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--t-primary);
|
|
735
|
-
}
|
|
736
|
-
.cp-messages .msg-body tr:hover td { background: rgba(255,255,255,0.02); }
|
|
678
|
+
/* An answer's prose, tables and code are the shared reading layer (./ui-output.js): one system for the six
|
|
679
|
+
side panels. A tag is never styled here again; this panel's own voice is its font. */
|
|
680
|
+
.cp-messages .msg-body { font-family: 'Inter', -apple-system, sans-serif; }
|
|
737
681
|
|
|
738
682
|
/* ── Tool cards ── */
|
|
739
683
|
.cp-messages .tool-card {
|
|
@@ -2664,10 +2608,39 @@ function injectStyles() {
|
|
|
2664
2608
|
/* Queue send icon */
|
|
2665
2609
|
.cp-send.queue-mode { }
|
|
2666
2610
|
.cp-send.queue-mode svg { opacity: 0.9; }
|
|
2611
|
+
|
|
2612
|
+
/* ── Reading pass (2026-11-21): what the agent did is legible and quiet, what it answered leads ──
|
|
2613
|
+
An answer's prose, tables and code are ./ui-output.js. This block is the rest of the transcript: tool rows,
|
|
2614
|
+
thinking, notices and the turn's footer were 8.5–10.5px at 20–30% white. They keep their mono voice, their
|
|
2615
|
+
place and every control; the sizes are 11px (9.5px for the small-caps label) and the faint text is the
|
|
2616
|
+
secondary token. Nothing moved and nothing was removed. */
|
|
2617
|
+
.cp-messages .msg-bubble { font-size: 13px; }
|
|
2618
|
+
.cp-messages .tool-name { font-size: 11px; }
|
|
2619
|
+
.cp-messages .tool-detail { font-size: 11px; color: var(--t-secondary); }
|
|
2620
|
+
.cp-messages .tool-section-label { font-size: 9.5px; color: var(--t-secondary); letter-spacing: 0.08em; }
|
|
2621
|
+
.cp-messages .tool-section { font-size: 11px; color: var(--t-primary); word-break: normal; overflow-wrap: anywhere; }
|
|
2622
|
+
.cp-messages .cp-bash-cmd, .cp-messages .cp-bash-out, .cp-messages .cp-result-text { font-size: 11px; word-break: normal; overflow-wrap: anywhere; }
|
|
2623
|
+
.msg-thinking-content { font-size: 11px; color: var(--t-secondary); line-height: 1.6; }
|
|
2624
|
+
.cp-messages .msg-status { font-size: 11px; color: var(--t-secondary); }
|
|
2625
|
+
.cp-messages .msg-error, .cp-messages .msg-warn { font-size: 11px; }
|
|
2626
|
+
.cp-messages .msg-tools-summary { font-size: 10.5px; color: var(--t-secondary); }
|
|
2627
|
+
.cp-messages .cp-turn-footer { font-size: 10.5px; color: var(--t-secondary); }
|
|
2628
|
+
.cp-messages .cp-msg-note { font-size: 11px; color: var(--t-secondary); }
|
|
2629
|
+
.cp-messages .cp-tool-group-text { color: var(--t-primary); }
|
|
2630
|
+
/* What the agent says while it works (a reply with tool calls under it) is secondary text; its answer is
|
|
2631
|
+
primary. Colour only: nothing moves when a tool call joins a reply. */
|
|
2632
|
+
.cp-messages .msg-content:has(> .tool-card, > .cp-tool-group) > .msg-body { --sbo-text: var(--t-primary); --sbo-strong: var(--t-bright); }
|
|
2633
|
+
/* The answer after the work: a hairline at the top of its row, drawn when the turn's footer lands. It is a
|
|
2634
|
+
background, so it takes no room and nothing moves when it appears. */
|
|
2635
|
+
.cp-messages .msg-assistant:has(.tool-card, .cp-tool-group) + .msg-assistant:has(+ .cp-turn-footer) {
|
|
2636
|
+
background: linear-gradient(var(--b-light), var(--b-light)) no-repeat 48px 0 / calc(100% - 62px) 1px;
|
|
2637
|
+
}
|
|
2667
2638
|
`;
|
|
2668
2639
|
document.head.appendChild(style);
|
|
2669
2640
|
// The Copy button of every code block: its stylesheet and its one click listener, in this document.
|
|
2670
2641
|
installCodeCopy(document);
|
|
2642
|
+
// The reading layer of an agent's answer (prose, tables, code): one stylesheet for the six panels.
|
|
2643
|
+
installOutput(document);
|
|
2671
2644
|
}
|
|
2672
2645
|
|
|
2673
2646
|
// ── Custom dropdown helpers ──
|
|
@@ -2807,10 +2780,10 @@ function _setEffort(btn, level) {
|
|
|
2807
2780
|
if (!btn) return;
|
|
2808
2781
|
btn.dataset.effort = level;
|
|
2809
2782
|
const label = btn.querySelector('.cp-think-label');
|
|
2810
|
-
if (label) label.textContent =
|
|
2783
|
+
if (label) label.textContent = thinkToggleText('label', level, t);
|
|
2811
2784
|
// On a model that always thinks the first stop is the model's default, never "Thinking off".
|
|
2812
2785
|
const view = thinkToggleView(level, _getSelectedModel());
|
|
2813
|
-
btn.setAttribute('data-tooltip', view.corrected ? view.title : (
|
|
2786
|
+
btn.setAttribute('data-tooltip', view.corrected ? view.title : thinkToggleText('title', level, t));
|
|
2814
2787
|
// Light up dots based on level
|
|
2815
2788
|
const dots = btn.querySelectorAll('.cp-think-dots i');
|
|
2816
2789
|
const count = { off: 0, low: 1, medium: 2, high: 3, xhigh: 4, max: 5 }[level] || 0;
|
|
@@ -3213,7 +3186,7 @@ function closeTab(idx, { detachAutomation = false } = {}) {
|
|
|
3213
3186
|
endWorkerRunOnClose(runId, () => fetch('/api/loop/stop', {
|
|
3214
3187
|
method: 'POST',
|
|
3215
3188
|
headers: { 'Content-Type': 'application/json' },
|
|
3216
|
-
body: JSON.stringify({ runId }),
|
|
3189
|
+
body: JSON.stringify({ runId, action: 'tab_close' }),
|
|
3217
3190
|
}).catch(() => {}), { busy: hasLiveBackgroundWork(tab) });
|
|
3218
3191
|
}
|
|
3219
3192
|
if (tab.automationRunId) forgetWorkerEnd(tab.automationRunId);
|
|
@@ -3276,6 +3249,7 @@ function _createTrayPill(tab) {
|
|
|
3276
3249
|
const pill = document.createElement('div');
|
|
3277
3250
|
pill.className = 'term-minimized-pill cp-session-pill';
|
|
3278
3251
|
pill.dataset.tabId = tab.id;
|
|
3252
|
+
pill.getAutomationRunId = () => tab.automationRunId;
|
|
3279
3253
|
pill.innerHTML = `
|
|
3280
3254
|
<span class="cp-pill-ring" aria-hidden="true"><i></i></span>
|
|
3281
3255
|
<span class="term-minimized-pill-icon">${_CP_ICON_SVG}</span>
|
|
@@ -5311,6 +5285,9 @@ async function _loadSessionHistoryNow(sid, $msgs, ownerTab, stale, ticket) {
|
|
|
5311
5285
|
// from a snapshot works as it is.
|
|
5312
5286
|
function addCopyButtons(el) {
|
|
5313
5287
|
decorateCodeBlocks(el);
|
|
5288
|
+
// An answer put back from a snapshot saved before the reading layer gets its tables framed (ui-output.js).
|
|
5289
|
+
// Markdown bodies only; a diff's lines are coloured just below.
|
|
5290
|
+
(el.matches?.('.msg-body') ? [el] : el.querySelectorAll?.('.msg-body') || []).forEach((body) => decorateOutput(body, { diff: false }));
|
|
5314
5291
|
el.querySelectorAll('pre').forEach(pre => {
|
|
5315
5292
|
// Colorize diff lines inline when the code block is a diff
|
|
5316
5293
|
const code = pre.querySelector('code');
|
|
@@ -9785,7 +9762,7 @@ function send({ shift = false } = {}) {
|
|
|
9785
9762
|
fetch('/api/loop/stop', {
|
|
9786
9763
|
method: 'POST',
|
|
9787
9764
|
headers: { 'Content-Type': 'application/json' },
|
|
9788
|
-
body: JSON.stringify({ runId: tab.automationRunId }),
|
|
9765
|
+
body: JSON.stringify({ runId: tab.automationRunId, action: 'stop' }),
|
|
9789
9766
|
}).then(async (res) => {
|
|
9790
9767
|
if (res.ok) { setRunning(tab, false); return; }
|
|
9791
9768
|
let reason = '';
|
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
// nothing more can be fetched, and that is exactly when the overlay wants it.
|
|
17
17
|
import { createMascot } from './synabun-mascot.js';
|
|
18
18
|
import { isDesktopApp } from './desktop-bridge.js';
|
|
19
|
+
import { createServerPresence, probeFailureKind } from './server-presence.js';
|
|
19
20
|
|
|
20
21
|
const $ = (id) => document.getElementById(id);
|
|
22
|
+
const diagnose = (event, data) => window.synabunLoadingDiagnostics?.record(event, data);
|
|
21
23
|
|
|
22
24
|
// ── Internal refs (resolved once on init) ──
|
|
23
25
|
let _statusDot = null;
|
|
@@ -84,6 +86,12 @@ export function showLoadingError(title, sub, canStart, serverOffline) {
|
|
|
84
86
|
const $overlay = $('loading-overlay');
|
|
85
87
|
if (!$overlay) return;
|
|
86
88
|
|
|
89
|
+
if (window.synabunLoadingDiagnostics) {
|
|
90
|
+
// A title from any other caller stays out of diagnostics, as do all subtitles.
|
|
91
|
+
const known = ['loading.serverOffline', 'loading.connectionFailed', 'loading.health.databaseUnreachable.title',
|
|
92
|
+
'loading.health.remoteUnreachable.title', 'loading.health.authError.title', 'loading.health.connectionError.title'];
|
|
93
|
+
diagnose('overlay-error', { title: known.find(key => t(key) === title) || 'other', serverOffline: !!serverOffline });
|
|
94
|
+
}
|
|
87
95
|
$overlay.classList.add('error');
|
|
88
96
|
if (serverOffline) $overlay.classList.add('server-offline');
|
|
89
97
|
else $overlay.classList.remove('server-offline');
|
|
@@ -132,12 +140,27 @@ export function showLoadingError(title, sub, canStart, serverOffline) {
|
|
|
132
140
|
export function hideLoading(delay = 400) {
|
|
133
141
|
const $overlay = $('loading-overlay');
|
|
134
142
|
if ($overlay) setTimeout(() => {
|
|
135
|
-
if (_offlineBridge)
|
|
143
|
+
if (_offlineBridge) {
|
|
144
|
+
diagnose('hide-skipped', { state: _offlineBridge.state });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
diagnose('overlay-conceal', { reason: 'hide' });
|
|
136
148
|
markOnce(OVERLAY_HIDDEN_MARK);
|
|
149
|
+
dropOtherOverlays($overlay);
|
|
137
150
|
concealOverlay($overlay);
|
|
138
151
|
}, delay);
|
|
139
152
|
}
|
|
140
153
|
|
|
154
|
+
/**
|
|
155
|
+
* The page has one loading overlay, the one this module drives (the first in the document). A first frame and a
|
|
156
|
+
* shell of different versions (one of them from a cache) can leave a second one over the app: it goes.
|
|
157
|
+
*/
|
|
158
|
+
function dropOtherOverlays($overlay) {
|
|
159
|
+
const others = [...document.querySelectorAll('[id="loading-overlay"]')].filter(el => el !== $overlay);
|
|
160
|
+
for (const el of others) el.remove();
|
|
161
|
+
if (others.length) diagnose('overlay-dedupe', { removed: Math.min(others.length, 20) });
|
|
162
|
+
}
|
|
163
|
+
|
|
141
164
|
/** The moment the overlay started to fade for the first time on this page (the time the user waited). */
|
|
142
165
|
export const OVERLAY_HIDDEN_MARK = 'synabun:overlay-hidden';
|
|
143
166
|
|
|
@@ -154,7 +177,10 @@ function markOnce(name) {
|
|
|
154
177
|
*/
|
|
155
178
|
export function showLoading() {
|
|
156
179
|
const $overlay = $('loading-overlay');
|
|
157
|
-
if ($overlay)
|
|
180
|
+
if ($overlay) {
|
|
181
|
+
diagnose('overlay-reveal', { reason: 'show' });
|
|
182
|
+
revealOverlay($overlay);
|
|
183
|
+
}
|
|
158
184
|
}
|
|
159
185
|
|
|
160
186
|
/**
|
|
@@ -195,7 +221,10 @@ function resetLoadingToConnecting() {
|
|
|
195
221
|
*/
|
|
196
222
|
export function rememberHealth(health) {
|
|
197
223
|
if (!health) return;
|
|
198
|
-
if (!currentBoot && health.bootId)
|
|
224
|
+
if (!currentBoot && health.bootId) {
|
|
225
|
+
currentBoot = health.bootId;
|
|
226
|
+
window.synabunLoadingDiagnostics?.setBoot(currentBoot);
|
|
227
|
+
}
|
|
199
228
|
try {
|
|
200
229
|
if (health.projectDir) {
|
|
201
230
|
localStorage.setItem('synabun-project-dir', health.projectDir);
|
|
@@ -258,7 +287,10 @@ function updateCmdText(projectDir) {
|
|
|
258
287
|
// ═══════════════════════════════════════════
|
|
259
288
|
|
|
260
289
|
function stopWatchingForServer() {
|
|
261
|
-
if (_offlineBridge)
|
|
290
|
+
if (_offlineBridge) {
|
|
291
|
+
diagnose('bridge-stopped', { state: _offlineBridge.state });
|
|
292
|
+
_offlineBridge.stop();
|
|
293
|
+
}
|
|
262
294
|
_offlineBridge = null;
|
|
263
295
|
poseMascot('asleep');
|
|
264
296
|
}
|
|
@@ -419,50 +451,76 @@ function watchForServer() {
|
|
|
419
451
|
* Is the server answering, which server is it (`bootId`), and does it say it
|
|
420
452
|
* is on its way out for a restart. One that predates those two says neither.
|
|
421
453
|
*/
|
|
422
|
-
async function probeServer() {
|
|
423
|
-
|
|
424
|
-
|
|
454
|
+
async function probeServer(observe) {
|
|
455
|
+
let health;
|
|
456
|
+
try { health = await fetchHealth(); }
|
|
457
|
+
catch (error) { observe?.('unreachable', ''); throw error; }
|
|
458
|
+
const seen = {
|
|
425
459
|
up: health?.ok === true,
|
|
426
460
|
boot: typeof health?.bootId === 'string' ? health.bootId : '',
|
|
427
461
|
stopping: health?.restarting === true,
|
|
428
462
|
};
|
|
463
|
+
observe?.(!seen.up ? 'unhealthy' : seen.stopping ? 'stopping' : 'healthy', seen.boot);
|
|
464
|
+
return seen;
|
|
429
465
|
}
|
|
430
466
|
|
|
431
467
|
/** The bridge behind the overlay, for either reason it is up: the server is offline, or it is being restarted. */
|
|
432
468
|
function openBridge() {
|
|
433
469
|
mountMascot();
|
|
434
470
|
const beaconAt = startBeaconTarget(window.location);
|
|
471
|
+
let lastProbe;
|
|
472
|
+
function observeProbe(result, boot) {
|
|
473
|
+
if (_offlineBridge !== bridge || (lastProbe?.result === result && lastProbe.boot === boot)) return;
|
|
474
|
+
lastProbe = { result, boot };
|
|
475
|
+
diagnose('bridge-probe', { result, seenBoot: boot });
|
|
476
|
+
}
|
|
477
|
+
let previousRestart = '';
|
|
478
|
+
function observeRestart({ restart }) {
|
|
479
|
+
if (!restart) return;
|
|
480
|
+
const flags = { asked: restart.asked, accepted: restart.acceptedAt !== null, down: restart.downAt !== null, refused: !!restart.refused };
|
|
481
|
+
const key = JSON.stringify(flags);
|
|
482
|
+
if (key !== previousRestart) diagnose('restart-snapshot', flags);
|
|
483
|
+
previousRestart = key;
|
|
484
|
+
}
|
|
435
485
|
const bridge = createStartBridge({
|
|
436
|
-
probe: probeServer,
|
|
486
|
+
probe: () => probeServer(observeProbe),
|
|
437
487
|
launch: () => openStartLink({ document, location: window.location, userAgent: navigator.userAgent }),
|
|
438
488
|
beacon: beaconAt ? () => fetchStartBeacon(beaconAt) : null,
|
|
439
489
|
port: beaconAt ? beaconAt.port : 0,
|
|
440
490
|
onUpdate(snap) {
|
|
441
491
|
if (_offlineBridge !== bridge) return;
|
|
492
|
+
observeRestart(snap);
|
|
442
493
|
renderStart(snap);
|
|
443
494
|
},
|
|
444
495
|
onState(state, { boot }) {
|
|
445
|
-
if (_offlineBridge
|
|
496
|
+
if (_offlineBridge !== bridge) return;
|
|
497
|
+
diagnose('bridge-state', { state });
|
|
498
|
+
observeRestart(bridge.snapshot());
|
|
499
|
+
if (state === 'online') recoverConnection(boot);
|
|
446
500
|
},
|
|
447
501
|
});
|
|
448
502
|
_offlineBridge = bridge;
|
|
503
|
+
diagnose('bridge-created', { reason: _restartShown ? 'restart' : 'offline', state: bridge.state });
|
|
449
504
|
return bridge;
|
|
450
505
|
}
|
|
451
506
|
|
|
452
507
|
/** Complete a healthy retry, whether the person pressed Retry or the bridge saw it first. */
|
|
453
508
|
function recoverConnection(boot) {
|
|
454
|
-
if (reloadPending) return;
|
|
455
509
|
// Older servers have no boot ID. A running page then needs a fresh session
|
|
456
510
|
// after an outage, while an unfinished first boot can retry initialization.
|
|
457
511
|
const needsReload = currentBoot && boot ? currentBoot !== boot : appWasVisible;
|
|
512
|
+
diagnose('recover', { seenBoot: boot, needsReload, appWasVisible, restartShown: _restartShown, reloadPending });
|
|
513
|
+
if (reloadPending) return;
|
|
458
514
|
if (_restartShown || needsReload) {
|
|
459
515
|
reloadPending = true;
|
|
516
|
+
diagnose('reload-scheduled', { reason: _restartShown ? 'restart' : currentBoot && boot ? 'boot-changed' : 'unknown-boot' });
|
|
460
517
|
setTimeout(() => window.location.reload(), START_LIMITS.reloadDelayMs);
|
|
461
518
|
return;
|
|
462
519
|
}
|
|
463
520
|
resetLoadingToConnecting();
|
|
464
521
|
if (appWasVisible) {
|
|
465
522
|
appWasVisible = false;
|
|
523
|
+
diagnose('overlay-conceal', { reason: 'recovered' });
|
|
466
524
|
concealOverlay($('loading-overlay'));
|
|
467
525
|
return;
|
|
468
526
|
}
|
|
@@ -503,6 +561,7 @@ async function postRestart() {
|
|
|
503
561
|
* every window that it is restarting (`announced`, over the sync socket).
|
|
504
562
|
*/
|
|
505
563
|
function beginRestart({ request = null, announced = false, boot = '' } = {}) {
|
|
564
|
+
diagnose('restart-request', { asked: !!request, announced, restartShown: _restartShown, hasBridge: !!_offlineBridge });
|
|
506
565
|
// Already on screen (this window asked, and here is the server saying so too).
|
|
507
566
|
if (_restartShown && _offlineBridge) {
|
|
508
567
|
_offlineBridge.restart({ announced, boot });
|
|
@@ -519,6 +578,7 @@ function beginRestart({ request = null, announced = false, boot = '' } = {}) {
|
|
|
519
578
|
_offlineTitle = t('loading.serverOffline');
|
|
520
579
|
// `over-app`: no fade-in and above whatever is open. The screen is there in the frame of the click.
|
|
521
580
|
$overlay.classList.add('over-app', 'error', 'server-offline');
|
|
581
|
+
diagnose('overlay-reveal', { reason: 'restart' });
|
|
522
582
|
revealOverlay($overlay);
|
|
523
583
|
// Nothing behind the screen keeps the keyboard (a terminal, an editor).
|
|
524
584
|
try { document.activeElement?.blur?.(); } catch {}
|
|
@@ -543,7 +603,10 @@ function dismissRestart() {
|
|
|
543
603
|
if (_restartTitle !== null) document.title = _restartTitle;
|
|
544
604
|
_restartTitle = null;
|
|
545
605
|
const $overlay = $('loading-overlay');
|
|
546
|
-
if ($overlay)
|
|
606
|
+
if ($overlay) {
|
|
607
|
+
diagnose('overlay-conceal', { reason: 'dismissed' });
|
|
608
|
+
concealOverlay($overlay);
|
|
609
|
+
}
|
|
547
610
|
}
|
|
548
611
|
|
|
549
612
|
// ═══════════════════════════════════════════
|
|
@@ -651,6 +714,8 @@ async function handleRetryConnection() {
|
|
|
651
714
|
export function initLoading({ onInit } = {}) {
|
|
652
715
|
_initCallback = onInit || null;
|
|
653
716
|
_statusDot = $('status-dot');
|
|
717
|
+
diagnose('overlay-reveal', { reason: 'init' });
|
|
718
|
+
if ($('loading-overlay')) dropOtherOverlays($('loading-overlay'));
|
|
654
719
|
|
|
655
720
|
// ── Populate command with cached path ──
|
|
656
721
|
const cached = localStorage.getItem('synabun-project-dir');
|
|
@@ -668,24 +733,64 @@ export function initLoading({ onInit } = {}) {
|
|
|
668
733
|
const retryBtn = $('loading-retry-btn');
|
|
669
734
|
if (retryBtn) retryBtn.addEventListener('click', handleRetryConnection);
|
|
670
735
|
|
|
736
|
+
// Not answering in time is not being gone (server-presence.js): a refused
|
|
737
|
+
// connection is offline after one confirmation, an unanswered one only once
|
|
738
|
+
// it has lasted, and never in a hidden tab.
|
|
739
|
+
const presence = createServerPresence();
|
|
671
740
|
let probing = false;
|
|
741
|
+
let heldSaid = '';
|
|
672
742
|
async function checkConnection() {
|
|
673
743
|
if (probing || _offlineBridge) return;
|
|
674
744
|
probing = true;
|
|
675
745
|
try {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
746
|
+
const hidden = () => document.visibilityState === 'hidden';
|
|
747
|
+
let kind = '';
|
|
748
|
+
const ask = () => probeServer().catch((error) => { kind = probeFailureKind(error); return null; });
|
|
749
|
+
let seen = await ask();
|
|
750
|
+
let verdict = '';
|
|
751
|
+
let confirm = false;
|
|
752
|
+
if (!seen) {
|
|
753
|
+
diagnose('probe-miss', { reason: 'unreachable', confirmation: false });
|
|
754
|
+
verdict = presence.missed(kind, { hidden: hidden() });
|
|
755
|
+
// A close or a refused request after sleep can precede a healthy
|
|
756
|
+
// answer. Confirm the miss immediately, without waiting for another interval.
|
|
757
|
+
if (verdict === 'confirm' && !_offlineBridge) {
|
|
758
|
+
confirm = true;
|
|
759
|
+
seen = await ask();
|
|
760
|
+
if (!seen) {
|
|
761
|
+
diagnose('probe-miss', { reason: 'unreachable', confirmation: true });
|
|
762
|
+
verdict = presence.missed(kind, { hidden: hidden(), confirmed: kind !== 'timeout' });
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (_offlineBridge) { presence.reset(); return; }
|
|
767
|
+
if (!seen && verdict !== 'offline') {
|
|
768
|
+
// Slow, or a hidden tab that cannot tell: nothing is shown. Said once per row and again when its reason changes.
|
|
769
|
+
const row = presence.snapshot();
|
|
770
|
+
if (row && heldSaid !== `${row.held}`) { heldSaid = `${row.held}`; diagnose('probe-held', { reason: row.held === 'hidden' ? 'hidden' : 'slow', misses: Math.min(20, row.misses) }); }
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
if (seen) {
|
|
774
|
+
const row = presence.answered();
|
|
775
|
+
if (row.recovered && heldSaid) diagnose('probe-answered', { misses: Math.min(20, row.misses), seconds: Math.min(3600, Math.round(row.ms / 1000)) });
|
|
776
|
+
heldSaid = '';
|
|
777
|
+
} else {
|
|
778
|
+
presence.reset();
|
|
779
|
+
heldSaid = '';
|
|
780
|
+
}
|
|
681
781
|
if (seen?.up && !seen.stopping && !(currentBoot && seen.boot && currentBoot !== seen.boot)) {
|
|
682
|
-
currentBoot
|
|
782
|
+
if (!currentBoot) {
|
|
783
|
+
currentBoot = seen.boot;
|
|
784
|
+
window.synabunLoadingDiagnostics?.setBoot(currentBoot);
|
|
785
|
+
}
|
|
683
786
|
return;
|
|
684
787
|
}
|
|
788
|
+
if (seen) diagnose('probe-miss', { reason: !seen.up ? 'unhealthy' : seen.stopping ? 'stopping' : 'boot-changed', confirmation: confirm });
|
|
685
789
|
// Preserve a specific startup database error until the app actually ran.
|
|
686
790
|
const overlay = $('loading-overlay');
|
|
687
791
|
if (!overlay || (seen && !seen.up && overlay.classList.contains('error') && !overlay.classList.contains('hidden'))) return;
|
|
688
792
|
appWasVisible = overlay.classList.contains('hidden');
|
|
793
|
+
diagnose('overlay-reveal', { reason: 'probe' });
|
|
689
794
|
revealOverlay(overlay);
|
|
690
795
|
showLoadingError(t('loading.serverOffline'), t('loading.serverNotRunning'), false, true);
|
|
691
796
|
if (appWasVisible) overlay.classList.add('over-app');
|
|
@@ -693,6 +798,8 @@ export function initLoading({ onInit } = {}) {
|
|
|
693
798
|
}
|
|
694
799
|
setInterval(checkConnection, 3000);
|
|
695
800
|
on('sync:disconnected', checkConnection);
|
|
801
|
+
// A tab that was hidden could not tell slow from gone; it looks the moment it is shown.
|
|
802
|
+
document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') checkConnection(); });
|
|
696
803
|
|
|
697
804
|
// ── The server says it is restarting (ui-sync.js): every window shows it ──
|
|
698
805
|
on('server:restarting', (msg) => beginRestart({ announced: true, boot: typeof msg?.bootId === 'string' ? msg.bootId : '' }));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { forgetWorkerEnd, mayAutoCloseWorkerTab } from './ui-worker-end.js';
|
|
1
2
|
import { on } from './state.js';
|
|
2
3
|
import { attachClaudeAutomation, detachClaudeAutomation, handleClaudeAutomationEvent } from './claude-panel-lazy.js';
|
|
3
4
|
import { attachCodexAutomation, detachCodexAutomation, handleCodexAutomationEvent } from './ui-codex-panel.js';
|
|
@@ -293,6 +294,15 @@ async function routeLatest(runId) {
|
|
|
293
294
|
return false;
|
|
294
295
|
}
|
|
295
296
|
|
|
297
|
+
/** Tray timer: a missing descriptor, unfinished task or refused completion keeps its tab. */
|
|
298
|
+
export async function autoCloseNativeLoopTab(runId) {
|
|
299
|
+
const run = getNativeLoopRun(runId);
|
|
300
|
+
if (!(await mayAutoCloseWorkerTab(run)) || _dismissed.has(runId)) return;
|
|
301
|
+
forgetWorkerEnd(runId);
|
|
302
|
+
window.dispatchEvent(new CustomEvent('native-loop:dismissed', { detail: { runId } }));
|
|
303
|
+
await detachProviderRun(runId, run.provider);
|
|
304
|
+
}
|
|
305
|
+
|
|
296
306
|
/** Latest known descriptor for a run this router has seen (null when unknown). */
|
|
297
307
|
export function getNativeLoopRun(runId) {
|
|
298
308
|
if (!runId) return null;
|
|
@@ -30,6 +30,7 @@ import { initOwnerAccessNotice } from './ui-owner-access.js';
|
|
|
30
30
|
import { initSidepanelTrayPlaceholders } from './ui-sidepanel-tray.js';
|
|
31
31
|
import { initDesktopTitleBar } from './desktop-titlebar.js';
|
|
32
32
|
import { initToprightOverflow } from './ui-topright-overflow.js';
|
|
33
|
+
import { autoCloseNativeLoopTab } from './ui-native-loop-router.js';
|
|
33
34
|
import { initTrayAutoClose } from './tray-auto-close.js';
|
|
34
35
|
import { initTrayColumns } from './ui-tray-columns.js';
|
|
35
36
|
|
|
@@ -398,7 +399,7 @@ export function initNavbar() {
|
|
|
398
399
|
const tray = $('term-minimized-tray');
|
|
399
400
|
if (controls && tray?.parentElement === controls) {
|
|
400
401
|
initTrayColumns(tray, storage);
|
|
401
|
-
initTrayAutoClose(tray, $('topright-auto-close-btn'), storage, t);
|
|
402
|
+
initTrayAutoClose(tray, $('topright-auto-close-btn'), storage, t, autoCloseNativeLoopTab);
|
|
402
403
|
const nameTips = (records) => {
|
|
403
404
|
if (records && !records.some(({ target }) => {
|
|
404
405
|
const element = target.nodeType === 1 ? target : target.parentElement;
|