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
|
@@ -28,7 +28,7 @@ import { cliInstallText, setCliInstallTranslator } from './cli-install-view.js';
|
|
|
28
28
|
import { dropdownHTML, wireDropdowns, setDropdownItems, setDropdownValue } from './cc-dropdown.js';
|
|
29
29
|
import { PROXY_TYPES, isLocalProfile, proxySummary, defaultCreateWhere, isPlanLimit, formOfProfile, readLocalProfileForm, proxyOfForm, createAction, whereOptions, passwordNeededAgain } from './settings/settings-local-profiles.js';
|
|
30
30
|
import { startLimitNotes, closedOutsideNotes } from './settings/settings-morelogin-cooldown.js';
|
|
31
|
-
import { AI_BROWSER_EVENT, aiBrowserOf, aiBrowserOfStatus, localConnectModeOf, browserSaveFields, switchRequest, pickRequest, aiBrowserLine, profileOf, aiBrowserDetail } from './settings/settings-ai-browser.js';
|
|
31
|
+
import { AI_BROWSER_EVENT, LOCAL_CONNECT_OPTIONS, LOCAL_DEFAULT_MODE, aiBrowserOf, aiBrowserOfStatus, localConnectModeOf, browserSaveFields, switchRequest, pickRequest, aiBrowserLine, profileOf, aiBrowserDetail } from './settings/settings-ai-browser.js';
|
|
32
32
|
import { IFACE_DEFAULTS, loadIfaceConfig, saveIfaceConfig, applyIfaceConfig, restoreInterfaceConfig, loadSkinStylesheet, removeSkinStylesheet, restoreSkin, setSkinsTabRefresher } from './iface-config.js';
|
|
33
33
|
// The interface config and the skin, for the modules that import them from here.
|
|
34
34
|
export { loadIfaceConfig, saveIfaceConfig, applyIfaceConfig, restoreInterfaceConfig, restoreSkin };
|
|
@@ -43,6 +43,10 @@ import { initI18n, isReady as i18nReady, SUPPORTED_LOCALES, LOCALE_NAMES, SYSTEM
|
|
|
43
43
|
import { wireSettingsShell, wireSettingsSearch, collectSearchRows, revealSettingsTarget, followSettingsTarget, onSettingsTakeover, applyStoredSections, storeSectionState } from './settings/settings-shell.js';
|
|
44
44
|
import { buildSettingsSearchIndex } from './settings/settings-search.js';
|
|
45
45
|
import { prefetchSettingsData, readSettingsData, refreshSettingsData } from './settings/settings-data.js';
|
|
46
|
+
import { BACKUP_BROWSER_URL, createBackupDownloadController, createBackupEndWatcher, describeBackupDownload } from './settings/settings-backup-download.js';
|
|
47
|
+
import { createBackupContentsController, describeBackupContents, describeRestoreContents } from './settings/settings-backup-contents.js';
|
|
48
|
+
import { applyEncryptedRestore, clearRestoreOutcome, describeEncryptedRestore, describeRestoreCreated, discardEncryptedRestore, previewErrorMessage, restoreErrorMessage, restorePartialCodes, saveRestoreOutcome } from './settings/settings-backup-encryption.js';
|
|
49
|
+
import { askRestorePassword, backupEncryptionHTML, backupHistoryHTML, openRestoreOutcomeDialog, RESTORE_DIALOG_CLASS, wireBackupEncryption } from './settings/settings-backup-encryption-pane.js';
|
|
46
50
|
import { registerLaunchPrefetch } from './launch-prefetch.js';
|
|
47
51
|
// ═══════════════════════════════════════════
|
|
48
52
|
// UI-SETTINGS — Settings modal with shared tabs + variant tab injection
|
|
@@ -511,13 +515,40 @@ function buildServerTab(settings, connections = []) {
|
|
|
511
515
|
id: 'stg-sec-backups', section: 'memory_backups.backups',
|
|
512
516
|
status: kit.pill('', { id: 'auto-backup-pill', state: 'off' }),
|
|
513
517
|
body: `
|
|
518
|
+
${kit.subhead(kit.te('settings.redesign.server.backupContentsTitle'), { id: 'sys-backup-contents-title' })}
|
|
519
|
+
<div class="stg-help" id="sys-backup-contents-help">${kit.te('settings.redesign.server.backupContentsHelp')}</div>
|
|
520
|
+
<div id="sys-backup-contents-rows" role="group" aria-labelledby="sys-backup-contents-title"></div>
|
|
521
|
+
<div class="stg-field" id="sys-backup-contents-summary" style="display:none">
|
|
522
|
+
<div class="stg-help" id="sys-backup-contents-total" role="status" aria-live="polite"></div>
|
|
523
|
+
<div class="stg-help" id="sys-backup-contents-warning" role="alert" style="display:none;color:var(--stg-warn)"></div>
|
|
524
|
+
<div class="stg-help" id="sys-backup-contents-never"></div>
|
|
525
|
+
<div class="stg-action-row">
|
|
526
|
+
<button type="button" class="cc-copy-btn stg-text-btn" id="sys-backup-contents-refresh">${kit.te('settings.redesign.server.backupContentsRefresh')}</button>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
<div class="stg-help" id="sys-backup-contents-note" role="status" aria-live="polite" style="display:none;color:var(--accent-dim)"></div>
|
|
530
|
+
|
|
531
|
+
${backupEncryptionHTML(kit)}
|
|
532
|
+
|
|
514
533
|
${kit.subhead(kit.te('settings.redesign.server.fullBackup'))}
|
|
534
|
+
<div class="stg-field stg-inline-field">
|
|
535
|
+
<label for="sys-backup-folder">${kit.te('settings.redesign.server.backupFolderLabel')}</label>
|
|
536
|
+
<div class="stg-input-row">
|
|
537
|
+
<input type="text" id="sys-backup-folder" placeholder="${kit.te('settings.redesign.server.folderPlaceholder')}" readonly autocomplete="off" spellcheck="false" aria-describedby="sys-backup-folder-help">
|
|
538
|
+
<button type="button" class="stg-action-btn compact" id="sys-backup-browse" disabled>${kit.te('settings.redesign.server.backupFolderChoose')}</button>
|
|
539
|
+
</div>
|
|
540
|
+
<div class="stg-help" id="sys-backup-folder-help">${kit.te('settings.redesign.server.backupFolderHelp')}</div>
|
|
541
|
+
<div class="stg-help" id="sys-backup-folder-note" role="status" aria-live="polite" style="display:none;color:var(--accent-dim)"></div>
|
|
542
|
+
</div>
|
|
515
543
|
<div class="stg-field" ${kit.inv('GEN007')}>
|
|
516
544
|
<div class="stg-action-row">
|
|
517
545
|
<button type="button" class="stg-action-btn" id="sys-backup-btn" aria-describedby="sys-backup-btn-help">
|
|
518
546
|
${buttonIcon('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>')}
|
|
519
547
|
${kit.L('GEN007')}
|
|
520
548
|
</button>
|
|
549
|
+
<button type="button" class="stg-action-btn compact" id="sys-backup-cancel" style="display:none">${kit.te('settings.redesign.server.backupCancel')}</button>
|
|
550
|
+
<button type="button" class="stg-action-btn compact" id="sys-backup-reveal" style="display:none">${kit.te('settings.redesign.server.backupReveal')}</button>
|
|
551
|
+
<button type="button" class="cc-copy-btn stg-text-btn" id="sys-backup-browser" title="${kit.te('settings.redesign.server.backupBrowserDownloadHelp')}" style="display:none">${kit.te('settings.redesign.server.backupBrowserDownload')}</button>
|
|
521
552
|
</div>
|
|
522
553
|
${kit.help('GEN007', { forId: 'sys-backup-btn' })}
|
|
523
554
|
</div>
|
|
@@ -527,7 +558,7 @@ function buildServerTab(settings, connections = []) {
|
|
|
527
558
|
${buttonIcon('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/>')}
|
|
528
559
|
${kit.L('GEN008')}
|
|
529
560
|
</button>
|
|
530
|
-
<input type="file" id="sys-restore-file" ${kit.inv('GEN009')} accept=".zip" style="display:none" aria-label="${kit.L('GEN009')}" title="${kit.H('GEN009')}">
|
|
561
|
+
<input type="file" id="sys-restore-file" ${kit.inv('GEN009')} accept=".zip,.enc" style="display:none" aria-label="${kit.L('GEN009')}" title="${kit.H('GEN009')}">
|
|
531
562
|
</div>
|
|
532
563
|
${kit.help('GEN008', { forId: 'sys-restore-btn' })}
|
|
533
564
|
</div>
|
|
@@ -536,6 +567,8 @@ function buildServerTab(settings, connections = []) {
|
|
|
536
567
|
<span id="sys-backup-text"></span>
|
|
537
568
|
</div>
|
|
538
569
|
|
|
570
|
+
${backupHistoryHTML(kit)}
|
|
571
|
+
|
|
539
572
|
${kit.subhead(kit.te('settings.redesign.server.autoBackup'))}
|
|
540
573
|
${kit.toggleField('GEN010', kit.switchInput('auto-backup-toggle'), { forId: 'auto-backup-toggle' })}
|
|
541
574
|
<div id="auto-backup-options" style="display:none">
|
|
@@ -654,7 +687,7 @@ function buildBrowserTab(ownerAccess = null) {
|
|
|
654
687
|
id: 'bcg-profiles', section: 'browser.browser_profiles',
|
|
655
688
|
body: `
|
|
656
689
|
<input type="hidden" id="bc-userDataDir" value="">
|
|
657
|
-
${kit.field('BRW011', `${dd('BRW011', 'bc-connectMode', 'connect',
|
|
690
|
+
${kit.field('BRW011', `${dd('BRW011', 'bc-connectMode', 'connect', LOCAL_CONNECT_OPTIONS)}
|
|
658
691
|
<div class="stg-help" id="bc-connectMode-ai-note" style="display:none">${b('aiBrowser.connectionNote')}</div>`)}
|
|
659
692
|
${extensionSettingsHTML(kit)}
|
|
660
693
|
${kit.field('BRW012', dd('BRW012', 'bc-attachSeed', 'seed', ['real', 'fresh']), { attrs: 'id="bc-attachSeed-row" style="display:none"' })}
|
|
@@ -4249,54 +4282,132 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4249
4282
|
});
|
|
4250
4283
|
}
|
|
4251
4284
|
|
|
4285
|
+
// Password protection and the list of recent backups (settings/settings-backup-encryption*.js). The list is read
|
|
4286
|
+
// again when a backup made from this page ends (below) and when the password protection changes (in the pane).
|
|
4287
|
+
const backupEncryption = wireBackupEncryption(overlay, kit);
|
|
4288
|
+
const backupEnded = createBackupEndWatcher();
|
|
4289
|
+
|
|
4252
4290
|
// ── System Backup & Restore handlers ──
|
|
4253
4291
|
|
|
4254
4292
|
const backupBtn = overlay.querySelector('#sys-backup-btn');
|
|
4255
4293
|
const restoreBtn = overlay.querySelector('#sys-restore-btn');
|
|
4256
4294
|
const restoreFileInput = overlay.querySelector('#sys-restore-file');
|
|
4257
4295
|
|
|
4296
|
+
// Download full backup: the server builds the archive in the chosen folder and this row follows it
|
|
4297
|
+
// (settings/settings-backup-download.js decides, lib/backup-download.js does). Nothing of it passes through the page.
|
|
4258
4298
|
if (backupBtn) {
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
const blob = await res.blob();
|
|
4279
|
-
const disposition = res.headers.get('content-disposition') || '';
|
|
4280
|
-
const filenameMatch = disposition.match(/filename="?([^"]+)"?/);
|
|
4281
|
-
const filename = filenameMatch ? filenameMatch[1] : 'synabun-backup.zip';
|
|
4282
|
-
|
|
4283
|
-
// Trigger download
|
|
4284
|
-
const url = URL.createObjectURL(blob);
|
|
4299
|
+
const folderInput = overlay.querySelector('#sys-backup-folder');
|
|
4300
|
+
const folderNote = overlay.querySelector('#sys-backup-folder-note');
|
|
4301
|
+
const browseBtn = overlay.querySelector('#sys-backup-browse');
|
|
4302
|
+
const revealBtn = overlay.querySelector('#sys-backup-reveal');
|
|
4303
|
+
const cancelBtn = overlay.querySelector('#sys-backup-cancel');
|
|
4304
|
+
const browserBtn = overlay.querySelector('#sys-backup-browser');
|
|
4305
|
+
const statusEl = overlay.querySelector('#sys-backup-status');
|
|
4306
|
+
const statusDot = overlay.querySelector('#sys-backup-dot');
|
|
4307
|
+
const statusText = overlay.querySelector('#sys-backup-text');
|
|
4308
|
+
const origHTML = backupBtn.innerHTML;
|
|
4309
|
+
// A page opened on another computer than the server cannot reach the folder: it keeps the browser's download.
|
|
4310
|
+
const pageHost = String(typeof location !== 'undefined' && location ? location.hostname || '' : '').replace(/^\[|\]$/g, '');
|
|
4311
|
+
const remotePage = !!pageHost && !['localhost', '127.0.0.1', '::1'].includes(pageHost);
|
|
4312
|
+
|
|
4313
|
+
const backupDownload = createBackupDownloadController({
|
|
4314
|
+
fetch: (...args) => fetch(...args),
|
|
4315
|
+
alive: () => overlay.isConnected !== false,
|
|
4316
|
+
// The browser's own download manager writes the response to disk as it arrives; no Blob in the page.
|
|
4317
|
+
browserDownload: () => {
|
|
4285
4318
|
const a = document.createElement('a');
|
|
4286
|
-
a.href =
|
|
4319
|
+
a.href = BACKUP_BROWSER_URL; a.download = '';
|
|
4287
4320
|
document.body.appendChild(a); a.click(); a.remove();
|
|
4288
|
-
|
|
4321
|
+
},
|
|
4322
|
+
render: (model) => {
|
|
4323
|
+
const row = describeBackupDownload(model, { tx: kit.tx });
|
|
4324
|
+
if (folderInput) folderInput.value = row.folder;
|
|
4325
|
+
if (folderNote) { folderNote.textContent = row.folderNote || ''; folderNote.style.display = row.folderNote ? '' : 'none'; }
|
|
4326
|
+
if (browseBtn) browseBtn.disabled = !row.canChoose || row.waiting;
|
|
4327
|
+
if (cancelBtn) cancelBtn.style.display = row.canCancel ? '' : 'none';
|
|
4328
|
+
if (revealBtn) revealBtn.style.display = row.canReveal ? '' : 'none';
|
|
4329
|
+
if (browserBtn) browserBtn.style.display = remotePage && !row.viaBrowser ? '' : 'none';
|
|
4330
|
+
backupBtn.disabled = row.waiting;
|
|
4331
|
+
if (row.running) backupBtn.textContent = kit.tx('settings.redesign.server.creatingBackup');
|
|
4332
|
+
else backupBtn.innerHTML = origHTML;
|
|
4333
|
+
if (row.status) {
|
|
4334
|
+
statusEl.style.display = 'flex';
|
|
4335
|
+
statusDot.className = row.status.dot ? `wiz-status-dot ${row.status.dot}` : 'wiz-status-dot';
|
|
4336
|
+
statusText.textContent = row.status.text;
|
|
4337
|
+
}
|
|
4338
|
+
// The backup that just ended is in the folder now: Recent backups shows it without Settings being reopened.
|
|
4339
|
+
if (backupEnded(model)) backupEncryption.refreshHistory();
|
|
4340
|
+
},
|
|
4341
|
+
});
|
|
4289
4342
|
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4343
|
+
backupBtn.addEventListener('click', () => backupDownload.start());
|
|
4344
|
+
if (browseBtn) browseBtn.addEventListener('click', () => backupDownload.choose(kit.tx('settings.redesign.server.backupFolderPrompt')));
|
|
4345
|
+
if (revealBtn) revealBtn.addEventListener('click', () => backupDownload.reveal());
|
|
4346
|
+
if (cancelBtn) cancelBtn.addEventListener('click', () => backupDownload.cancel());
|
|
4347
|
+
if (browserBtn) browserBtn.addEventListener('click', () => backupDownload.downloadInBrowser());
|
|
4348
|
+
backupDownload.load();
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
// What to back up: one switch per group with its size (settings/settings-backup-contents.js decides,
|
|
4352
|
+
// lib/backup-contents.js keeps the choice and measures on a worker thread). The rows are drawn from the server's
|
|
4353
|
+
// answer; a server from before these routes gets no rows and one line that says a restart is missing.
|
|
4354
|
+
const contentsRows = overlay.querySelector('#sys-backup-contents-rows');
|
|
4355
|
+
if (contentsRows) {
|
|
4356
|
+
const summary = overlay.querySelector('#sys-backup-contents-summary');
|
|
4357
|
+
const totalEl = overlay.querySelector('#sys-backup-contents-total');
|
|
4358
|
+
const warningEl = overlay.querySelector('#sys-backup-contents-warning');
|
|
4359
|
+
const neverEl = overlay.querySelector('#sys-backup-contents-never');
|
|
4360
|
+
const noteEl = overlay.querySelector('#sys-backup-contents-note');
|
|
4361
|
+
const refreshBtn = overlay.querySelector('#sys-backup-contents-refresh');
|
|
4362
|
+
const helpEl = overlay.querySelector('#sys-backup-contents-help');
|
|
4363
|
+
const kindState = { irreplaceable: 'ok', regenerable: 'off', temporary: 'off' };
|
|
4364
|
+
let drawn = '';
|
|
4365
|
+
|
|
4366
|
+
const backupContents = createBackupContentsController({
|
|
4367
|
+
fetch: (...args) => fetch(...args),
|
|
4368
|
+
alive: () => overlay.isConnected !== false,
|
|
4369
|
+
render: (model) => {
|
|
4370
|
+
const list = describeBackupContents(model, { tx: kit.tx });
|
|
4371
|
+
if (helpEl) helpEl.style.display = list.available ? '' : 'none';
|
|
4372
|
+
// The rows are built once per set of groups; after that only what changed is written, so a switch that has
|
|
4373
|
+
// the keyboard keeps it while the sizes arrive.
|
|
4374
|
+
const shape = list.rows.map(row => row.id).join(',');
|
|
4375
|
+
if (shape !== drawn) {
|
|
4376
|
+
drawn = shape;
|
|
4377
|
+
contentsRows.innerHTML = list.rows.map((row) => {
|
|
4378
|
+
const id = `sys-backup-group-${row.id}`;
|
|
4379
|
+
return `
|
|
4380
|
+
<div class="stg-toggle-field" data-backup-group="${kit.esc(row.id)}">
|
|
4381
|
+
<div class="stg-toggle-text">
|
|
4382
|
+
<label class="stg-toggle-label" for="${id}" id="${id}-label">${kit.esc(row.label)} ${kit.pill(kit.esc(row.kindLabel), { state: kindState[row.kind] || 'off' })}</label>
|
|
4383
|
+
<div class="stg-help" id="${id}-help">${kit.esc(row.help)}</div>
|
|
4384
|
+
<div class="stg-help" data-backup-size aria-live="polite"></div>
|
|
4385
|
+
</div>
|
|
4386
|
+
<div class="stg-toggle-control">${kit.switchInput(id, { checked: row.enabled, attrs: `data-backup-group="${kit.esc(row.id)}"` })}</div>
|
|
4387
|
+
</div>`;
|
|
4388
|
+
}).join('');
|
|
4389
|
+
}
|
|
4390
|
+
for (const row of list.rows) {
|
|
4391
|
+
const field = contentsRows.querySelector(`.stg-toggle-field[data-backup-group="${row.id}"]`);
|
|
4392
|
+
const input = field?.querySelector('input[type="checkbox"]');
|
|
4393
|
+
if (input) { input.checked = row.enabled; input.disabled = row.busy; }
|
|
4394
|
+
const size = field?.querySelector('[data-backup-size]');
|
|
4395
|
+
if (size) size.textContent = row.size || (list.measuring ? kit.tx('settings.redesign.server.backupContentsMeasuring') : '');
|
|
4396
|
+
}
|
|
4397
|
+
if (summary) summary.style.display = list.available ? '' : 'none';
|
|
4398
|
+
if (totalEl) totalEl.textContent = list.total ? [list.total, list.everything].filter(Boolean).join(' ') : (list.measuring ? kit.tx('settings.redesign.server.backupContentsMeasuring') : '');
|
|
4399
|
+
if (warningEl) { warningEl.textContent = list.warning || ''; warningEl.style.display = list.warning ? '' : 'none'; }
|
|
4400
|
+
if (neverEl) neverEl.textContent = list.never || '';
|
|
4401
|
+
if (refreshBtn) refreshBtn.disabled = list.measuring;
|
|
4402
|
+
if (noteEl) { noteEl.textContent = list.note || ''; noteEl.style.display = list.note ? '' : 'none'; }
|
|
4403
|
+
},
|
|
4299
4404
|
});
|
|
4405
|
+
contentsRows.addEventListener('change', (e) => {
|
|
4406
|
+
const input = e.target.closest?.('input[data-backup-group]');
|
|
4407
|
+
if (input) backupContents.toggle(input.dataset.backupGroup, input.checked);
|
|
4408
|
+
});
|
|
4409
|
+
if (refreshBtn) refreshBtn.addEventListener('click', () => backupContents.refresh());
|
|
4410
|
+
backupContents.load();
|
|
4300
4411
|
}
|
|
4301
4412
|
|
|
4302
4413
|
if (restoreBtn && restoreFileInput) {
|
|
@@ -4325,32 +4436,55 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4325
4436
|
body: file,
|
|
4326
4437
|
});
|
|
4327
4438
|
if (!previewRes.ok) {
|
|
4328
|
-
let
|
|
4329
|
-
try {
|
|
4330
|
-
|
|
4439
|
+
let body = null;
|
|
4440
|
+
try { body = await previewRes.json(); } catch {}
|
|
4441
|
+
// Told by the refusal's code in this page's language, never by the server's sentence (English, and it can hold a path).
|
|
4442
|
+
throw Object.assign(new Error(previewErrorMessage(body, { tx: kit.tx, fallback: kit.tx('settings.redesign.server.invalidBackup2') })), { translated: true });
|
|
4331
4443
|
}
|
|
4332
|
-
|
|
4333
|
-
|
|
4444
|
+
let preview = await previewRes.json();
|
|
4334
4445
|
statusEl.style.display = 'none';
|
|
4335
4446
|
|
|
4336
|
-
|
|
4447
|
+
// An encrypted backup says nothing of what it holds until its password opened it. The file stays staged on
|
|
4448
|
+
// the server, so a mistyped password costs no second upload.
|
|
4449
|
+
let stagedUploadId = null;
|
|
4450
|
+
if (preview.encrypted && preview.locked) {
|
|
4451
|
+
preview = await askRestorePassword(preview, { kit });
|
|
4452
|
+
if (!preview) return;
|
|
4453
|
+
stagedUploadId = preview.uploadId;
|
|
4454
|
+
}
|
|
4455
|
+
const { manifest: m, contents } = preview;
|
|
4456
|
+
const closeConfirm = () => {
|
|
4457
|
+
if (stagedUploadId) discardEncryptedRestore((...args) => fetch(...args), stagedUploadId);
|
|
4458
|
+
confirmOverlay.remove();
|
|
4459
|
+
};
|
|
4460
|
+
|
|
4461
|
+
// A server from before the groups sends the whole manifest (its file list) and says nothing of groups.
|
|
4462
|
+
const fileCount = Number.isFinite(m.fileCount) ? m.fileCount : (m.files || []).length;
|
|
4337
4463
|
const hasDb = !!m.database;
|
|
4464
|
+
// What this backup holds, by group, and what a restore of it therefore leaves as it is now.
|
|
4465
|
+
const holds = describeRestoreContents(contents, { tx: kit.tx });
|
|
4466
|
+
const holdsLines = holds ? [holds.stateOnly, holds.contains, holds.missing].filter(Boolean) : [];
|
|
4467
|
+
// An encrypted backup: the date its header carries, which the password's keys vouched for. An older backup of
|
|
4468
|
+
// the owner's opens just as well, so the date is what says which one this is.
|
|
4469
|
+
const madeLine = describeEncryptedRestore(preview, { tx: kit.tx });
|
|
4470
|
+
// When it was made and, only when the backup says so, on which computer.
|
|
4471
|
+
const createdLine = describeRestoreCreated(m, { tx: kit.tx });
|
|
4338
4472
|
|
|
4339
4473
|
const confirmOverlay = document.createElement('div');
|
|
4340
4474
|
confirmOverlay.className = 'tag-delete-overlay';
|
|
4341
4475
|
confirmOverlay.style.zIndex = '300100';
|
|
4342
4476
|
confirmOverlay.innerHTML = `
|
|
4343
|
-
<div class="tag-delete-modal settings-modal" style="max-width:500px;text-align:left">
|
|
4344
|
-
<h3 style="margin-bottom:4px">${kit.te('settings.redesign.server.restoreBackup')}</h3>
|
|
4345
|
-
|
|
4346
|
-
${kit.th('settings.redesign.server.createdOn', { value: new Date(m.created).toLocaleString() })} ${escapeHtml(m.hostname || kit.tx('settings.redesign.server.unknown'))}
|
|
4347
|
-
</p>
|
|
4477
|
+
<div class="tag-delete-modal settings-modal ${RESTORE_DIALOG_CLASS}" role="dialog" aria-modal="true" aria-labelledby="sys-restore-confirm-title" style="max-width:500px;text-align:left">
|
|
4478
|
+
<h3 id="sys-restore-confirm-title" style="margin-bottom:4px">${kit.te('settings.redesign.server.restoreBackup')}</h3>
|
|
4479
|
+
${createdLine ? `<p id="sys-restore-created" style="font-size:11px;color:var(--t-muted);margin-bottom:12px">${escapeHtml(createdLine)}</p>` : ''}
|
|
4348
4480
|
<div style="font-size:12px;margin-bottom:8px">
|
|
4349
4481
|
<strong>${fileCount}</strong> ${kit.te('settings.redesign.server.configFiles')}
|
|
4350
4482
|
${hasDb ? `<br><strong>${kit.te('settings.redesign.server.database')}</strong> ${kit.te('settings.redesign.server.memoryDbIncluded')}` : ''}
|
|
4351
4483
|
</div>
|
|
4484
|
+
${madeLine ? `<div id="sys-restore-encrypted-made" style="font-size:12px;margin-bottom:8px">${escapeHtml(madeLine)}</div>` : ''}
|
|
4485
|
+
${holdsLines.length ? `<div id="sys-restore-contents" style="font-size:12px;margin-bottom:8px">${holdsLines.map(line => `<div>${escapeHtml(line)}</div>`).join('')}</div>` : ''}
|
|
4352
4486
|
<p style="font-size:11px;color:var(--accent-dim);margin-bottom:12px">
|
|
4353
|
-
${kit.te('settings.redesign.server.thisWillOverwriteYourCurrentEnv')}
|
|
4487
|
+
${holds ? kit.te('settings.redesign.server.restoreOverwritesContained') : kit.te('settings.redesign.server.thisWillOverwriteYourCurrentEnv')}
|
|
4354
4488
|
</p>
|
|
4355
4489
|
<div class="tag-delete-modal-actions">
|
|
4356
4490
|
<button class="action-btn action-btn--ghost" id="sys-restore-cancel">${kit.te('settings.redesign.server.cancel')}</button>
|
|
@@ -4366,9 +4500,9 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4366
4500
|
</div>`;
|
|
4367
4501
|
document.body.appendChild(confirmOverlay);
|
|
4368
4502
|
|
|
4369
|
-
confirmOverlay.querySelector('#sys-restore-cancel').addEventListener('click',
|
|
4503
|
+
confirmOverlay.querySelector('#sys-restore-cancel').addEventListener('click', closeConfirm);
|
|
4370
4504
|
confirmOverlay.addEventListener('click', (ev) => {
|
|
4371
|
-
if (ev.target === confirmOverlay
|
|
4505
|
+
if (ev.target === confirmOverlay && !confirmOverlay.querySelector('#sys-restore-confirm').disabled) closeConfirm();
|
|
4372
4506
|
});
|
|
4373
4507
|
|
|
4374
4508
|
confirmOverlay.querySelector('#sys-restore-confirm').addEventListener('click', async () => {
|
|
@@ -4384,17 +4518,39 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4384
4518
|
progressText.textContent = kit.tx('settings.redesign.server.applyingBackup');
|
|
4385
4519
|
|
|
4386
4520
|
try {
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4521
|
+
let result;
|
|
4522
|
+
if (stagedUploadId) {
|
|
4523
|
+
// The staged file is used once: whatever the answer, the server has let go of it.
|
|
4524
|
+
const uploadId = stagedUploadId;
|
|
4525
|
+
stagedUploadId = null;
|
|
4526
|
+
const answer = await applyEncryptedRestore((...args) => fetch(...args), uploadId, 'full');
|
|
4527
|
+
if (!answer.ok) throw Object.assign(new Error(restoreErrorMessage(answer.body, { tx: kit.tx })), { translated: true });
|
|
4528
|
+
result = answer.body;
|
|
4529
|
+
} else {
|
|
4530
|
+
const restoreRes = await fetch('/api/system/restore?mode=full', {
|
|
4531
|
+
method: 'POST',
|
|
4532
|
+
headers: { 'Content-Type': 'application/zip' },
|
|
4533
|
+
body: file,
|
|
4534
|
+
});
|
|
4535
|
+
if (!restoreRes.ok) {
|
|
4536
|
+
// By the refusal's code, in this page's language: the server's sentence can hold a path. An old server sends none: the generic sentence.
|
|
4537
|
+
let body = null;
|
|
4538
|
+
try { body = await restoreRes.json(); } catch {}
|
|
4539
|
+
throw Object.assign(new Error(restoreErrorMessage(body, { tx: kit.tx })), { translated: true });
|
|
4540
|
+
}
|
|
4541
|
+
// A 200 that cannot be read may still have written: it counts as a restore with problems, below.
|
|
4542
|
+
try { result = await restoreRes.json(); } catch { result = null; }
|
|
4543
|
+
}
|
|
4544
|
+
// A 200 can carry problems (results.errors): never "Done". Kept in this tab, because a restart reloads the page.
|
|
4545
|
+
const partialCodes = restorePartialCodes(result);
|
|
4546
|
+
if (partialCodes) {
|
|
4547
|
+
const outcome = { codes: partialCodes, restart: result?.restart === true };
|
|
4548
|
+
saveRestoreOutcome(outcome);
|
|
4549
|
+
confirmOverlay.remove();
|
|
4550
|
+
openRestoreOutcomeDialog(outcome, { tx: kit.tx, restarting: outcome.restart, offerReload: !outcome.restart });
|
|
4551
|
+
return;
|
|
4396
4552
|
}
|
|
4397
|
-
|
|
4553
|
+
clearRestoreOutcome();
|
|
4398
4554
|
const restoredFileCount = result.results?.files?.length || 0;
|
|
4399
4555
|
|
|
4400
4556
|
progressDot.className = 'wiz-status-dot green';
|
|
@@ -4415,14 +4571,17 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4415
4571
|
});
|
|
4416
4572
|
} catch (err) {
|
|
4417
4573
|
progressDot.className = 'wiz-status-dot red';
|
|
4418
|
-
progressText.textContent = err.message;
|
|
4574
|
+
progressText.textContent = err.translated ? err.message : restoreErrorMessage(null, { tx: kit.tx });
|
|
4419
4575
|
confirmBtn.textContent = kit.tx('settings.redesign.server.restore');
|
|
4420
|
-
|
|
4576
|
+
// An encrypted upload was used by that attempt: another one starts from choosing the file.
|
|
4577
|
+
confirmBtn.disabled = !!preview.encrypted;
|
|
4421
4578
|
}
|
|
4422
4579
|
});
|
|
4423
4580
|
} catch (err) {
|
|
4581
|
+
statusEl.style.display = 'flex';
|
|
4424
4582
|
statusDot.className = 'wiz-status-dot red';
|
|
4425
|
-
|
|
4583
|
+
// A server from before the finished encryption: the file is not at fault, a restart is missing.
|
|
4584
|
+
statusText.textContent = err.needsRestart || err.translated ? err.message : kit.tx('settings.redesign.server.invalidBackup2');
|
|
4426
4585
|
}
|
|
4427
4586
|
});
|
|
4428
4587
|
}
|
|
@@ -6357,6 +6516,9 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6357
6516
|
const label = dd.querySelector('.cc-dropdown-value');
|
|
6358
6517
|
const menu = dd.querySelector('.cc-dropdown-menu');
|
|
6359
6518
|
if (!menu) return;
|
|
6519
|
+
if (label && hiddenId === 'bc-connectMode' && val === LOCAL_DEFAULT_MODE) {
|
|
6520
|
+
label.textContent = kit.tx('settings.redesign.browser.opt.connect.mirror');
|
|
6521
|
+
}
|
|
6360
6522
|
menu.querySelectorAll('.cc-dropdown-item').forEach(item => {
|
|
6361
6523
|
const isMatch = item.dataset.value === val;
|
|
6362
6524
|
item.classList.toggle('active', isMatch);
|
|
@@ -7095,6 +7257,11 @@ async function openSettingsModalNow(options = {}) {
|
|
|
7095
7257
|
}
|
|
7096
7258
|
}
|
|
7097
7259
|
|
|
7260
|
+
// Keep the local default in the form until the saved config arrives.
|
|
7261
|
+
const connectModeInput = overlay.querySelector('#bc-connectMode');
|
|
7262
|
+
if (connectModeInput) connectModeInput.value = LOCAL_DEFAULT_MODE;
|
|
7263
|
+
syncBcDropdowns();
|
|
7264
|
+
|
|
7098
7265
|
// Load config on open, then auto-detect profiles. A refused read (no owner access) is "No access", never defaults.
|
|
7099
7266
|
fetch('/api/browser/config').then(async (r) => {
|
|
7100
7267
|
if (markPaneRefused(overlay, 'browser', await refusalOfResponse(r))) return null;
|
|
@@ -262,6 +262,7 @@ function readPayload(key, meta = null) {
|
|
|
262
262
|
const automation = automationBySession.get(sid);
|
|
263
263
|
return {
|
|
264
264
|
sessionId: sid,
|
|
265
|
+
modelBrand: tab.modelBrand,
|
|
265
266
|
needsYou: needsYou(tab),
|
|
266
267
|
automationRunId: automation?.runId || null,
|
|
267
268
|
automationActive: !!automation?.running,
|
|
@@ -579,7 +580,7 @@ function createPlaceholder(provider, payload, tab, index) {
|
|
|
579
580
|
const tray = document.getElementById('term-minimized-tray');
|
|
580
581
|
const meta = PROVIDERS[provider];
|
|
581
582
|
if (!tray || !meta) return null;
|
|
582
|
-
const providerMeta = getProviderMeta(meta.providerId);
|
|
583
|
+
const providerMeta = getProviderMeta(provider === 'opencode' && tab.modelBrand === 'maritaca' ? 'maritaca' : meta.providerId);
|
|
583
584
|
const id = tabId(provider, tab, index);
|
|
584
585
|
const pill = document.createElement('div');
|
|
585
586
|
pill.className = `term-minimized-pill ${meta.pillClass} ${PLACEHOLDER_CLASS}`;
|
|
@@ -604,7 +605,7 @@ function createPlaceholder(provider, payload, tab, index) {
|
|
|
604
605
|
fetch('/api/loop/stop', {
|
|
605
606
|
method: 'POST',
|
|
606
607
|
headers: { 'Content-Type': 'application/json' },
|
|
607
|
-
body: JSON.stringify({ runId: tab.automationRunId }),
|
|
608
|
+
body: JSON.stringify({ runId: tab.automationRunId, action: 'tab_close' }),
|
|
608
609
|
}).catch(() => {});
|
|
609
610
|
} else {
|
|
610
611
|
killBackendSession(provider, tab, payload.key);
|
|
@@ -283,6 +283,7 @@ function connect() {
|
|
|
283
283
|
_ws.onclose = () => {
|
|
284
284
|
console.log('[sync-ws] Disconnected, will reconnect in 5s');
|
|
285
285
|
_ws = null;
|
|
286
|
+
emit('sync:disconnected');
|
|
286
287
|
if (!_reconnectTimer) {
|
|
287
288
|
_reconnectTimer = setInterval(connect, RECONNECT_INTERVAL);
|
|
288
289
|
}
|
|
@@ -17,6 +17,16 @@ export function scrollCanMove(scroller, control) {
|
|
|
17
17
|
try { return scroller.contains(control); } catch { return true; }
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Whether the control a tooltip is for can no longer be hovered: it left the document, or it (or a parent) was
|
|
22
|
+
* hidden, e.g. a side panel switched away by a shortcut. No mouseout or pointerdown comes for those.
|
|
23
|
+
*/
|
|
24
|
+
export function triggerGone(control) {
|
|
25
|
+
if (!control) return true;
|
|
26
|
+
if (control.isConnected === false) return true;
|
|
27
|
+
try { return typeof control.getClientRects === 'function' && control.getClientRects().length === 0; } catch { return false; }
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
/**
|
|
21
31
|
* Initialize the tooltip system.
|
|
22
32
|
* Creates a body-appended tooltip element and delegates
|
|
@@ -42,6 +52,7 @@ export function initTooltip() {
|
|
|
42
52
|
let repositionRunHandler = null;
|
|
43
53
|
let repositionEndHandler = null;
|
|
44
54
|
let repositionRafId = 0;
|
|
55
|
+
let goneTimer = null; // while a tooltip is up: is its control still there?
|
|
45
56
|
|
|
46
57
|
// Dropdowns that keep their open menu inside the [data-tooltip] control
|
|
47
58
|
// (the sidepanels' cp/cx/ocpv2 project-bar, model and mode controls). Hovering
|
|
@@ -177,6 +188,9 @@ export function initTooltip() {
|
|
|
177
188
|
tip.style.display = 'block';
|
|
178
189
|
const { rect: initialRect, width: initialWidth } = positionTip(el);
|
|
179
190
|
tip.classList.add('visible');
|
|
191
|
+
clearInterval(goneTimer);
|
|
192
|
+
goneTimer = setInterval(() => { if (triggerGone(currentTarget)) hide(); }, 200);
|
|
193
|
+
goneTimer.unref?.(); // node tests only: never keeps a process alive
|
|
180
194
|
|
|
181
195
|
// Follow targets that actually animate their geometry on hover (via transitionrun),
|
|
182
196
|
// without polling static targets across multiple rAFs.
|
|
@@ -240,6 +254,8 @@ export function initTooltip() {
|
|
|
240
254
|
clearTimeout(hideTimer);
|
|
241
255
|
showTimer = null;
|
|
242
256
|
pendingTarget = null;
|
|
257
|
+
clearInterval(goneTimer);
|
|
258
|
+
goneTimer = null;
|
|
243
259
|
if (repositionRafId) {
|
|
244
260
|
cancelAnimationFrame(repositionRafId);
|
|
245
261
|
repositionRafId = 0;
|
|
@@ -21,7 +21,6 @@ import { CLI_PROFILES, ensureModelsForProfile, modelSelectorValue, formatModelOp
|
|
|
21
21
|
import { beginAssistantTour } from './assistant/asst-sidepanel.js';
|
|
22
22
|
import { dropdownHTML, setDropdownDisabled, setDropdownItems, setDropdownValue, wireDropdowns } from './cc-dropdown.js';
|
|
23
23
|
import { showGuestToast } from './ui-sync.js';
|
|
24
|
-
import { BEATS, beatsFor, resumeBeat } from './tour/tour-beats.js';
|
|
25
24
|
import { markTourSeen, tourReturning } from './tour/tour-state.js';
|
|
26
25
|
|
|
27
26
|
let initialized = false;
|
|
@@ -93,7 +92,7 @@ async function startTour({ host = null, from = 'help' } = {}) {
|
|
|
93
92
|
try {
|
|
94
93
|
await loadStyles();
|
|
95
94
|
let sent = null; // what the user sent from a session-free preview's composer
|
|
96
|
-
const presentation = host ? null : beginAssistantTour({ onPreviewSend: (text) => { sent = text; tour?.engine.close('sent'); } });
|
|
95
|
+
const presentation = host ? null : await beginAssistantTour({ onPreviewSend: (text) => { sent = text; tour?.engine.close('sent'); } });
|
|
97
96
|
const stage = host || presentation?.host;
|
|
98
97
|
if (!stage?.root || !stage.renderer) {
|
|
99
98
|
presentation?.restore({ reason: 'skip' });
|
|
@@ -102,8 +101,10 @@ async function startTour({ host = null, from = 'help' } = {}) {
|
|
|
102
101
|
}
|
|
103
102
|
const returning = from === 'help' && tourReturning(storage);
|
|
104
103
|
const saved = storage.getItem(KEYS.TUTORIAL_STEP);
|
|
105
|
-
const
|
|
106
|
-
|
|
104
|
+
const resumable = saved != null && !storage.getItem(KEYS.TUTORIAL_COMPLETED);
|
|
105
|
+
// The storyboard loads with the engine, when a tour opens: the page is shown without them.
|
|
106
|
+
const [{ createTour }, { beatsFor, resumeBeat }] = await Promise.all([import('./tour/tour-engine.js'), import('./tour/tour-beats.js')]);
|
|
107
|
+
const resumeAt = resumable ? resumeBeat(saved) : -1;
|
|
107
108
|
storage.setItem(KEYS.TUTORIAL_STARTED, 'true');
|
|
108
109
|
const env = { computer: stage.computer !== false };
|
|
109
110
|
const engine = createTour({
|
|
@@ -147,8 +148,6 @@ async function startTour({ host = null, from = 'help' } = {}) {
|
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
export { BEATS as TOUR_BEATS };
|
|
151
|
-
|
|
152
151
|
/** The tour on screen (its engine: play, next, prev, close, index…), or null. For tests and devtools. */
|
|
153
152
|
export function currentTour() {
|
|
154
153
|
return tour?.engine || null;
|
|
@@ -72,6 +72,8 @@ function paint(entry) {
|
|
|
72
72
|
const sig = view?.sig || '';
|
|
73
73
|
if (sig === entry.sig) return;
|
|
74
74
|
entry.sig = sig;
|
|
75
|
+
const tray = globalThis.document?.getElementById?.('term-minimized-tray');
|
|
76
|
+
tray?.dispatchEvent(new CustomEvent('worker-end-changed', { detail: { runId: entry.run.runId } }));
|
|
75
77
|
try { entry.apply(view); } catch (error) { console.warn('[worker-end] a panel failed to draw the end of a run', error); }
|
|
76
78
|
}
|
|
77
79
|
|
|
@@ -169,14 +171,31 @@ export function isFinishedWarmWorker(runId, { busy = false } = {}) {
|
|
|
169
171
|
export function endWorkerRunOnClose(runId, stop, { busy = false } = {}) {
|
|
170
172
|
const stopped = () => { stop(); return 'stopped'; };
|
|
171
173
|
if (!isFinishedWarmWorker(runId, { busy })) return Promise.resolve(stopped());
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
return completeWorkerTab(runId, 'tab_close').then(ok => ok ? 'completed' : stopped());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** The tray timer may detach an ended tab, or one the dispatcher agrees to complete.
|
|
178
|
+
* Missing or stale evidence leaves the tab and its follow-up channel open. */
|
|
179
|
+
export async function mayAutoCloseWorkerTab(run) {
|
|
180
|
+
if (!run) return false;
|
|
181
|
+
// Suspended for a server restart: it resumes by itself, and a timer is never what ends it.
|
|
182
|
+
if (run.status === 'suspended') return false;
|
|
183
|
+
if (TERMINAL_STATES.has(run.status)) return true;
|
|
184
|
+
if (!isDispatchedRun(run) || run.turnState !== 'idle' || (run.outcome && run.outcome !== 'done')) return false;
|
|
185
|
+
if (!isFinishedWarmWorker(run.runId)) return false;
|
|
186
|
+
return completeWorkerTab(run.runId, 'tray_auto_close');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** The dispatcher owns the final decision, including a follow-up that just began. */
|
|
190
|
+
async function completeWorkerTab(runId, action) {
|
|
191
|
+
try {
|
|
192
|
+
const response = await fetch(`/api/assistant/runs/${encodeURIComponent(runId)}/tab-closed`, {
|
|
193
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
194
|
+
body: JSON.stringify({ action }),
|
|
195
|
+
});
|
|
196
|
+
const result = response.ok ? await response.json() : null;
|
|
197
|
+
return result?.ok === true && (action === 'tab_close' || result.completed === true || result.alreadyTerminal === true);
|
|
198
|
+
} catch { return false; }
|
|
180
199
|
}
|
|
181
200
|
|
|
182
201
|
/**
|