synabun 2.2.1 → 2.3.0
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 +53 -0
- package/README.md +1 -1
- package/docs/whatsapp.md +52 -20
- package/hooks/claude-code/pre-websearch.mjs +4 -1
- package/hooks/claude-code/prompt-submit.mjs +7 -0
- package/lib/mcp-build.js +519 -0
- package/lib/mcp-dist.js +10 -4
- package/lib/release-scan.mjs +23 -10
- package/lib/server-supervisor.js +7 -1
- package/lib/virustotal.mjs +146 -40
- package/mcp-server/dist/http.d.ts +57 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +128 -18
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +14 -9
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +119 -0
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-route-flow.js +340 -0
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +2 -2
- package/mcp-server/dist/services/desktop-client.js.map +1 -1
- package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
- package/mcp-server/dist/services/embedding-service.js +2 -1
- package/mcp-server/dist/services/embedding-service.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +66 -3
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +61 -4
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +133 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +630 -64
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +2 -2
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +3 -2
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +6 -4
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/bluesky.d.ts +20 -7
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
- package/mcp-server/dist/tools/bluesky.js +147 -45
- package/mcp-server/dist/tools/bluesky.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +13 -2
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +153 -18
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
- package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.js +19 -16
- package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
- package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
- package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-observe.js +61 -20
- package/mcp-server/dist/tools/browser-observe.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +13 -3
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +82 -19
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.js +225 -88
- package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +135 -17
- package/mcp-server/src/index.ts +15 -9
- package/mcp-server/src/services/browser-route-flow.ts +403 -0
- package/mcp-server/src/services/desktop-client.ts +2 -2
- package/mcp-server/src/services/embedding-service.ts +2 -1
- package/mcp-server/src/services/identity.ts +80 -4
- package/mcp-server/src/services/neural-interface.ts +648 -73
- package/mcp-server/src/services/tool-catalog.ts +2 -2
- package/mcp-server/src/tools/agents.ts +8 -4
- package/mcp-server/src/tools/bluesky.ts +164 -51
- package/mcp-server/src/tools/browser-advanced.ts +142 -17
- package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
- package/mcp-server/src/tools/browser-navigate.ts +19 -16
- package/mcp-server/src/tools/browser-observe.ts +62 -20
- package/mcp-server/src/tools/morelogin.ts +82 -19
- package/mcp-server/src/tools/youtube/helpers.ts +2 -2
- package/mcp-server/src/tools/youtube/upload.ts +218 -99
- package/neural-interface/i18n/en.json +655 -123
- package/neural-interface/i18n/pt-BR.json +542 -10
- package/neural-interface/lib/assistant-api.js +90 -23
- package/neural-interface/lib/assistant-brains/claude.js +5 -0
- package/neural-interface/lib/assistant-catalog.js +134 -3
- package/neural-interface/lib/assistant-dispatch.js +97 -1
- package/neural-interface/lib/assistant-persona.js +15 -7
- package/neural-interface/lib/assistant-router.js +6 -4
- package/neural-interface/lib/assistant-runtime.js +18 -1
- package/neural-interface/lib/assistant-task-prompt.js +5 -0
- package/neural-interface/lib/assistant-tools.js +10 -1
- package/neural-interface/lib/automation-approval.js +249 -0
- package/neural-interface/lib/automation-browser-owner-access.js +82 -0
- package/neural-interface/lib/backup-service.js +16 -1
- package/neural-interface/lib/browser-automation-routes.js +84 -0
- package/neural-interface/lib/browser-background-tab.js +72 -3
- package/neural-interface/lib/browser-execution.js +16 -3
- package/neural-interface/lib/browser-extraction.js +106 -45
- package/neural-interface/lib/browser-owner.js +48 -0
- package/neural-interface/lib/browser-profile-choices.js +143 -0
- package/neural-interface/lib/browser-profiles.js +142 -0
- package/neural-interface/lib/browser-session-close.js +84 -0
- package/neural-interface/lib/browser-start-handoff.js +202 -0
- package/neural-interface/lib/browser-tab-recovery.js +153 -0
- package/neural-interface/lib/browser-tool-policy.js +23 -4
- package/neural-interface/lib/browser-wedge-retire.js +64 -0
- package/neural-interface/lib/chromium-on-device-model.js +67 -0
- package/neural-interface/lib/claude-agent-bridge.js +43 -5
- package/neural-interface/lib/claude-background-hold.js +239 -0
- package/neural-interface/lib/claude-model-catalog.js +12 -0
- package/neural-interface/lib/effort-levels.js +28 -2
- package/neural-interface/lib/exec-loop-command.js +8 -0
- package/neural-interface/lib/http-guards.js +11 -6
- package/neural-interface/lib/local-profile-proxy.js +362 -0
- package/neural-interface/lib/local-profiles.js +929 -0
- package/neural-interface/lib/loop-logger.js +31 -5
- package/neural-interface/lib/maritaca/api.js +179 -0
- package/neural-interface/lib/maritaca/attachments.js +44 -0
- package/neural-interface/lib/maritaca/client.js +362 -0
- package/neural-interface/lib/maritaca/key-store.js +122 -0
- package/neural-interface/lib/maritaca/models.js +181 -0
- package/neural-interface/lib/maritaca/modes.js +39 -0
- package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
- package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
- package/neural-interface/lib/maritaca/opencode.js +218 -0
- package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
- package/neural-interface/lib/maritaca/sessions.js +198 -0
- package/neural-interface/lib/mcp-external-servers.js +37 -10
- package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
- package/neural-interface/lib/morelogin.js +278 -14
- package/neural-interface/lib/native-loop-providers.js +124 -11
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/owner-authority.js +137 -43
- package/neural-interface/lib/page-session.js +111 -27
- package/neural-interface/lib/peer-identity.js +263 -43
- package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
- package/neural-interface/lib/pty-host/core.js +36 -0
- package/neural-interface/lib/pty-host/protocol.js +2 -0
- package/neural-interface/lib/request-gate.js +2 -0
- package/neural-interface/lib/skills/api-v2.js +13 -2
- package/neural-interface/lib/skills/creation-api.js +3 -1
- package/neural-interface/lib/skills/evals-api.js +5 -1
- package/neural-interface/lib/social-write-pacing.js +151 -0
- package/neural-interface/lib/system-activity.js +1 -1
- package/neural-interface/lib/terminal-token-redaction.js +293 -0
- package/neural-interface/lib/terminal-tokens.js +436 -0
- package/neural-interface/lib/worker-mcp-channel.js +45 -10
- package/neural-interface/package-lock.json +3 -2
- package/neural-interface/package.json +2 -1
- package/neural-interface/public/assets/mascot/README.md +11 -0
- package/neural-interface/public/assets/mascot/ask.gif +0 -0
- package/neural-interface/public/assets/mascot/ask.png +0 -0
- package/neural-interface/public/assets/mascot/blocked.gif +0 -0
- package/neural-interface/public/assets/mascot/blocked.png +0 -0
- package/neural-interface/public/assets/mascot/budget.gif +0 -0
- package/neural-interface/public/assets/mascot/budget.png +0 -0
- package/neural-interface/public/assets/mascot/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/computer.png +0 -0
- package/neural-interface/public/assets/mascot/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/edit.png +0 -0
- package/neural-interface/public/assets/mascot/error.gif +0 -0
- package/neural-interface/public/assets/mascot/error.png +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
- package/neural-interface/public/assets/mascot/idle.gif +0 -0
- package/neural-interface/public/assets/mascot/idle.png +0 -0
- package/neural-interface/public/assets/mascot/manifest.json +254 -0
- package/neural-interface/public/assets/mascot/mcp.gif +0 -0
- package/neural-interface/public/assets/mascot/mcp.png +0 -0
- package/neural-interface/public/assets/mascot/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/memory.png +0 -0
- package/neural-interface/public/assets/mascot/offline.gif +0 -0
- package/neural-interface/public/assets/mascot/offline.png +0 -0
- package/neural-interface/public/assets/mascot/pick.gif +0 -0
- package/neural-interface/public/assets/mascot/pick.png +0 -0
- package/neural-interface/public/assets/mascot/plan.gif +0 -0
- package/neural-interface/public/assets/mascot/plan.png +0 -0
- package/neural-interface/public/assets/mascot/present.gif +0 -0
- package/neural-interface/public/assets/mascot/present.png +0 -0
- package/neural-interface/public/assets/mascot/project.gif +0 -0
- package/neural-interface/public/assets/mascot/project.png +0 -0
- package/neural-interface/public/assets/mascot/read.gif +0 -0
- package/neural-interface/public/assets/mascot/read.png +0 -0
- package/neural-interface/public/assets/mascot/runs.gif +0 -0
- package/neural-interface/public/assets/mascot/runs.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
- package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
- package/neural-interface/public/assets/mascot/search.gif +0 -0
- package/neural-interface/public/assets/mascot/search.png +0 -0
- package/neural-interface/public/assets/mascot/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/shell.png +0 -0
- package/neural-interface/public/assets/mascot/skill.gif +0 -0
- package/neural-interface/public/assets/mascot/skill.png +0 -0
- package/neural-interface/public/assets/mascot/sleep.gif +0 -0
- package/neural-interface/public/assets/mascot/sleep.png +0 -0
- package/neural-interface/public/assets/mascot/subagent.gif +0 -0
- package/neural-interface/public/assets/mascot/subagent.png +0 -0
- package/neural-interface/public/assets/mascot/success.gif +0 -0
- package/neural-interface/public/assets/mascot/success.png +0 -0
- package/neural-interface/public/assets/mascot/think.gif +0 -0
- package/neural-interface/public/assets/mascot/think.png +0 -0
- package/neural-interface/public/assets/mascot/wait.gif +0 -0
- package/neural-interface/public/assets/mascot/wait.png +0 -0
- package/neural-interface/public/assets/mascot/watch.gif +0 -0
- package/neural-interface/public/assets/mascot/watch.png +0 -0
- package/neural-interface/public/assets/mascot/web.gif +0 -0
- package/neural-interface/public/assets/mascot/web.png +0 -0
- package/neural-interface/public/onboarding.html +14 -1
- package/neural-interface/public/shared/agent-runtime-options.js +49 -8
- package/neural-interface/public/shared/agy/agy-panel.js +2 -2
- package/neural-interface/public/shared/agy/agy-render.js +41 -1
- package/neural-interface/public/shared/agy/agy-styles.js +5 -0
- package/neural-interface/public/shared/api.js +5 -4
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
- package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
- package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
- package/neural-interface/public/shared/assistant/asst-control.js +1 -1
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +7 -5
- package/neural-interface/public/shared/assistant/asst-panel.js +13 -5
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-render.js +16 -10
- package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
- package/neural-interface/public/shared/assistant/asst-route.js +24 -7
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
- package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
- package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
- package/neural-interface/public/shared/assistant/asst-state.js +72 -2
- package/neural-interface/public/shared/assistant/asst-styles.js +60 -15
- package/neural-interface/public/shared/automation-approval-view.js +75 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
- package/neural-interface/public/shared/context-menu-model.js +2 -0
- package/neural-interface/public/shared/cp/cp-agents.js +8 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
- package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
- package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
- package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
- package/neural-interface/public/shared/editor/editor-panel.js +10 -2
- package/neural-interface/public/shared/html-shell.js +30 -22
- package/neural-interface/public/shared/judgments-log-origins.js +29 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
- package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
- package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
- package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
- package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
- package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
- package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
- package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
- package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +10 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
- package/neural-interface/public/shared/owner-access.js +134 -0
- package/neural-interface/public/shared/owner-authority-view.js +92 -0
- package/neural-interface/public/shared/page-session.js +143 -14
- package/neural-interface/public/shared/poll-backoff.js +59 -0
- package/neural-interface/public/shared/provider-icons.js +3 -0
- package/neural-interface/public/shared/schedules-view.js +7 -0
- package/neural-interface/public/shared/server-back.js +50 -0
- package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
- package/neural-interface/public/shared/settings/settings-data.js +7 -1
- package/neural-interface/public/shared/settings/settings-ia.js +3 -1
- package/neural-interface/public/shared/settings/settings-kit.js +11 -3
- package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
- package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
- package/neural-interface/public/shared/settings/settings-shell.js +7 -0
- package/neural-interface/public/shared/shown-children.js +72 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
- package/neural-interface/public/shared/state.js +1 -1
- package/neural-interface/public/shared/static-bg-state.js +22 -0
- package/neural-interface/public/shared/styles.css +457 -164
- package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
- package/neural-interface/public/shared/synabun-mascot.js +136 -12
- package/neural-interface/public/shared/synabun-ticker.js +3 -0
- package/neural-interface/public/shared/synabun-tools.js +173 -0
- package/neural-interface/public/shared/tool-heartbeat.js +43 -0
- package/neural-interface/public/shared/tool-list-picker.js +3 -1
- package/neural-interface/public/shared/tool-list-view.js +23 -4
- package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
- package/neural-interface/public/shared/ui-automation-approval.js +188 -0
- package/neural-interface/public/shared/ui-automation-studio.js +138 -91
- package/neural-interface/public/shared/ui-claude-panel.js +209 -31
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
- package/neural-interface/public/shared/ui-navbar.js +23 -0
- package/neural-interface/public/shared/ui-owner-access.js +191 -0
- package/neural-interface/public/shared/ui-owner-authority.js +162 -0
- package/neural-interface/public/shared/ui-panels.js +3 -1
- package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
- package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
- package/neural-interface/public/shared/ui-sessions.js +45 -16
- package/neural-interface/public/shared/ui-settings.js +676 -42
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
- package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
- package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
- package/neural-interface/public/shared/ui-terminal.js +15 -7
- package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
- package/neural-interface/public/shared/ui-update.js +3 -0
- package/neural-interface/public/shared/ui-whiteboard.js +4 -0
- package/neural-interface/public/shared/window-keys.js +38 -0
- package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
- package/neural-interface/server.js +2903 -359
- package/npm-shrinkwrap.json +5 -17
- package/package.json +5 -6
- package/postinstall.js +38 -39
- package/setup.js +33 -31
- package/skills/synabun/modules/changelog.md +14 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fetchToolCatalog } from './agent-runtime-options.js';
|
|
2
|
-
import {
|
|
2
|
+
import { reloadAfterRestore } from './server-back.js';
|
|
3
|
+
import { configureToolPickerTranslation, toolPickerHTML, readToolPicker, toolWord, toolServersNote } from './tool-list-picker.js';
|
|
3
4
|
import { mountMemoryMaintenance } from './ui-memory-maintenance.js';
|
|
4
5
|
import { buildJudgmentsTab, wireJudgmentsTab } from './ui-judgments.js';
|
|
5
6
|
import { buildWhatsAppTab, wireWhatsAppTab } from './ui-whatsapp.js';
|
|
@@ -12,15 +13,19 @@ import { skillFoldersHTML, wireSkillFolders, refreshSkillChips, chipState, insta
|
|
|
12
13
|
import { RULES_HOST_LABELS, describeRulesHost, describeRulesInstall, describeRulesInstallAll } from './settings/settings-rules.js';
|
|
13
14
|
import { readUserContextResponse, describeUserContext, describeUserContextSaveFailure } from './settings/settings-user-context.js';
|
|
14
15
|
import { readWorkerGuardResponse, describeWorkerGuard, describeWorkerGuardSaveFailure } from './settings/settings-worker-guard.js';
|
|
16
|
+
import { readOwnerAccessResponse, describeOwnerAccess, describeOwnerAccessSaveFailure } from './settings/settings-browser-owner-access.js';
|
|
15
17
|
import { CLAUDE_HOOK_ROWS, readClaudeHooksResponse, describeClaudeHooks, describeClaudeHooksSaveFailure } from './settings/settings-claude-hooks.js';
|
|
16
18
|
import { readGreetingStatus, describeGreeting, describeGreetingSaveFailure } from './settings/settings-greeting.js';
|
|
17
19
|
import { describeOpencodeInstall } from './settings/settings-opencode.js';
|
|
20
|
+
import { maritacaOpencodeCardView, maritacaOpencodeModelRows, MARITACA_OPENCODE_KEYS, MARITACA_OPENCODE_PROVIDER } from './settings/settings-maritaca-opencode.js';
|
|
18
21
|
import { renderGreeting, clearGreeting } from './greeting/greeting-card.js';
|
|
19
22
|
import { createTunnelCard, drawInto, mcpKeyNeededText, readTunnel } from './ui-tunnel.js';
|
|
20
23
|
import { remoteMcpAddress } from './tunnel-view.js';
|
|
21
24
|
import { recheckCliStatus, getCliStatus, addCliToPath } from './cli-status.js';
|
|
22
25
|
import { cliInstallText, setCliInstallTranslator } from './cli-install-view.js';
|
|
23
26
|
import { dropdownHTML, wireDropdowns, setDropdownItems, setDropdownValue } from './cc-dropdown.js';
|
|
27
|
+
import { PROXY_TYPES, isLocalProfile, proxySummary, defaultCreateWhere, isPlanLimit, formOfProfile, readLocalProfileForm, proxyOfForm, createAction, whereOptions, passwordNeededAgain } from './settings/settings-local-profiles.js';
|
|
28
|
+
import { setStaticBgVisible } from './static-bg-state.js';
|
|
24
29
|
setCliInstallTranslator((key, params) => kit.tx(`cliInstall.${key}`, params));
|
|
25
30
|
import { setGitBashTranslator } from './git-bash-view.js';
|
|
26
31
|
import { gitBashRowHtml, wireGitBashRow } from './ui-git-bash.js';
|
|
@@ -56,6 +61,8 @@ import {
|
|
|
56
61
|
fetchRulesStatus, fetchRulesTextWithFallback, installRules, removeRules, installAllRules, setRulesAutoUpdate, removeLegacyRules,
|
|
57
62
|
} from './api.js';
|
|
58
63
|
import { centeredInFrame } from './app-frame.js';
|
|
64
|
+
import { markNoAccess, noteOwnerAccessRefusal, ownerAccessSay, refusalOfError, refusalOfResponse } from './ui-owner-access.js';
|
|
65
|
+
import { readOwnerAccessRefusal } from './owner-access.js';
|
|
59
66
|
|
|
60
67
|
// ── SVG icon constants ──
|
|
61
68
|
|
|
@@ -253,12 +260,12 @@ export function applyIfaceConfig(cfg, { instant = false } = {}) {
|
|
|
253
260
|
if (instant) {
|
|
254
261
|
// Page load — apply immediately without animation
|
|
255
262
|
if (graphContainer) graphContainer.classList.add('focus-active');
|
|
256
|
-
|
|
263
|
+
setStaticBgVisible(staticBg, true);
|
|
257
264
|
} else {
|
|
258
265
|
// User toggle — stagger: controls fade first, then iris closes
|
|
259
266
|
setTimeout(() => {
|
|
260
267
|
if (graphContainer) graphContainer.classList.add('focus-active');
|
|
261
|
-
|
|
268
|
+
setStaticBgVisible(staticBg, true);
|
|
262
269
|
}, 100);
|
|
263
270
|
}
|
|
264
271
|
// Notify variant-specific cleanup (lasso, context menu, etc.)
|
|
@@ -267,7 +274,7 @@ export function applyIfaceConfig(cfg, { instant = false } = {}) {
|
|
|
267
274
|
// EXITING FOCUS MODE
|
|
268
275
|
// Iris open the graph + close focus bg
|
|
269
276
|
if (graphContainer) graphContainer.classList.remove('focus-active');
|
|
270
|
-
|
|
277
|
+
setStaticBgVisible(staticBg, false);
|
|
271
278
|
// 2D canvases
|
|
272
279
|
for (const id of ['bg-canvas', 'hull-canvas', 'lasso-canvas']) {
|
|
273
280
|
const el = document.getElementById(id);
|
|
@@ -752,7 +759,7 @@ function buildServerTab(settings, connections = []) {
|
|
|
752
759
|
</div>`;
|
|
753
760
|
}
|
|
754
761
|
|
|
755
|
-
function buildBrowserTab() {
|
|
762
|
+
function buildBrowserTab(ownerAccess = null) {
|
|
756
763
|
const b = (key) => kit.te(`settings.redesign.browser.${key}`);
|
|
757
764
|
const SEARCH = '<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>';
|
|
758
765
|
const REFRESH = '<svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>';
|
|
@@ -780,6 +787,24 @@ function buildBrowserTab() {
|
|
|
780
787
|
</div>`;
|
|
781
788
|
const X = '<span class="bc-x" aria-hidden="true">×</span>';
|
|
782
789
|
const unit = (invId) => `<span class="bc-unit">${kit.L(invId)}</span>`;
|
|
790
|
+
// Let the automation browser act as owner (lib/automation-browser-owner-access.js): one switch, off by default.
|
|
791
|
+
// `ownerAccess` is the view of what the server answered (describeOwnerAccess): a server started before the
|
|
792
|
+
// setting shows it off, disabled, under a line that says a restart is missing; while on, a warning line says so.
|
|
793
|
+
const oa = ownerAccess || describeOwnerAccess(null, { tx: kit.tx });
|
|
794
|
+
const oaNotes = [...(oa.note ? [oa.note] : []), ...(oa.warning ? [{ text: oa.warning, tone: 'warn' }] : [])];
|
|
795
|
+
const ownerAccessBlock = `
|
|
796
|
+
<div class="cc-hook-toggles" id="boa-row" data-boa-ready="${oa.ready ? '1' : '0'}">
|
|
797
|
+
<div class="cc-integration-item${oa.on ? ' enabled' : ''}${oa.disabled ? ' uc-disabled' : ''}" data-boa-row>
|
|
798
|
+
<div class="cc-integration-info">
|
|
799
|
+
<div class="cc-integration-label" id="boa-label">${kit.L('BRW087')}</div>
|
|
800
|
+
<div class="cc-integration-path" id="boa-help">${kit.H('BRW087')}</div>
|
|
801
|
+
<div class="uc-layer-notes" id="boa-notes" data-stg-data>${userContextNotesHTML(oaNotes)}</div>
|
|
802
|
+
</div>
|
|
803
|
+
<button type="button" class="cc-toggle${oa.on ? ' on' : ''}" id="boa-toggle" data-boa-toggle ${kit.inv('BRW087')} aria-pressed="${oa.on ? 'true' : 'false'}" aria-labelledby="boa-label" aria-describedby="boa-help boa-notes"${oa.disabled ? ' disabled' : ''}></button>
|
|
804
|
+
</div>
|
|
805
|
+
</div>
|
|
806
|
+
<div class="stg-help uc-save-status" id="boa-save-status" role="alert" data-stg-data hidden></div>
|
|
807
|
+
<div class="stg-help" id="boa-applies">${kit.esc(oa.applies)}</div>`;
|
|
783
808
|
const PERMISSIONS = [
|
|
784
809
|
['BRW050', 'geolocation'], ['BRW051', 'midi'], ['BRW052', 'midi-sysex'], ['BRW053', 'notifications'], ['BRW054', 'camera'],
|
|
785
810
|
['BRW055', 'microphone'], ['BRW056', 'background-sync'], ['BRW057', 'ambient-light-sensor'], ['BRW058', 'accelerometer'],
|
|
@@ -873,6 +898,12 @@ function buildBrowserTab() {
|
|
|
873
898
|
${tog('BRW020', 'bc-stealthFingerprint', true)}`,
|
|
874
899
|
})}
|
|
875
900
|
|
|
901
|
+
${kit.card({
|
|
902
|
+
id: 'bcg-owner-access', section: 'browser.automation_browser_owner_access',
|
|
903
|
+
body: `
|
|
904
|
+
${ownerAccessBlock}`,
|
|
905
|
+
})}
|
|
906
|
+
|
|
876
907
|
${kit.card({
|
|
877
908
|
id: 'bcg-identity', section: 'browser.identity_privacy', collapsible: true, collapsed: true, advanced: true,
|
|
878
909
|
body: `
|
|
@@ -2525,10 +2556,17 @@ function buildMoreLoginTab() {
|
|
|
2525
2556
|
${kit.field('ML004', `
|
|
2526
2557
|
<div class="settings-key-row">
|
|
2527
2558
|
${text('ml-new-name', { ph: m('ph.newName') })}
|
|
2559
|
+
<span id="ml-create-where-slot" ${kit.inv('ML020')} title="${kit.H('ML020')}"></span>
|
|
2528
2560
|
${btn('ML005', 'ml-create-btn')}
|
|
2529
2561
|
${btn('ML006', 'ml-refresh-btn')}
|
|
2530
2562
|
</div>`, { forId: 'ml-new-name' })}
|
|
2531
|
-
<div id="ml-
|
|
2563
|
+
<div class="stg-help" id="ml-local-intro" style="margin:0 0 10px">${m('local.intro')}</div>
|
|
2564
|
+
<div class="stg-help" id="ml-create-note" role="status" hidden style="margin:0 0 10px;color:var(--stg-warn)"></div>
|
|
2565
|
+
<div class="stg-help" id="ml-local-restart" role="status" hidden style="margin:0 0 10px;color:var(--stg-warn)">${m('local.restartServer')}</div>
|
|
2566
|
+
<div class="stg-help" id="ml-agents-help" style="margin:0 0 10px">${m('agentsMayChooseHelp')}</div>
|
|
2567
|
+
<div class="stg-help" id="ml-agents-warning" role="note" style="margin:0 0 10px;color:var(--stg-warn)">${m('agentsMayChooseWarning')}</div>
|
|
2568
|
+
<div class="stg-help" id="ml-agents-restart" role="status" hidden style="margin:0 0 10px;color:var(--stg-warn)">${m('agentsMayChooseRestart')}</div>
|
|
2569
|
+
<div id="ml-profile-list" ${kit.inv('ML016')} role="group" aria-label="${kit.L('ML016')}" aria-describedby="ml-agents-help ml-agents-warning" style="display:flex;flex-direction:column;gap:6px"></div>`,
|
|
2532
2570
|
})}
|
|
2533
2571
|
|
|
2534
2572
|
${kit.card({
|
|
@@ -2563,13 +2601,50 @@ function buildMoreLoginTab() {
|
|
|
2563
2601
|
</div>`;
|
|
2564
2602
|
}
|
|
2565
2603
|
|
|
2566
|
-
function wireMoreLoginTab(overlay) {
|
|
2604
|
+
function wireMoreLoginTab(overlay, signal) {
|
|
2567
2605
|
const $ = (id) => overlay.querySelector('#' + id);
|
|
2568
2606
|
if (!$('ml-status-dot')) return;
|
|
2569
2607
|
let _defaultEnvId = null;
|
|
2608
|
+
// Local profiles (SynaBun's own Chrome on this computer, lib/local-profiles.js): listed with MoreLogin's
|
|
2609
|
+
// (`kind: 'local'`), created by the "Where" popup's Local choice, and edited in a panel under their row.
|
|
2610
|
+
const lp = (key, params) => kit.tx(`settings.redesign.morelogin.local.${key}`, params);
|
|
2611
|
+
let _status = null; // the last GET /api/morelogin/status
|
|
2612
|
+
let _localKnown = false; // the running server knows local profiles
|
|
2613
|
+
let _localDetails = new Map(); // id → the editor's row (GET /api/morelogin/local-profiles)
|
|
2614
|
+
let _editing = null; // the id whose editor is open
|
|
2615
|
+
let _whereTouched = false; // the owner chose "Where" by hand
|
|
2616
|
+
let _limitHit = false; // MoreLogin refused a create for its plan's limit
|
|
2617
|
+
let _moreloginError = ''; // why MoreLogin's own profiles are missing from the list
|
|
2618
|
+
const jsend = (method, u, body) => fetch(u, { method, headers: { 'Content-Type': 'application/json' }, ...(body !== undefined ? { body: JSON.stringify(body) } : {}) })
|
|
2619
|
+
.then(r => r.json()).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
|
|
2620
|
+
// "Where" is drawn here, after the panel's older per-element dropdown wiring ran (wireStgDropdowns): the pane's
|
|
2621
|
+
// dropdowns are driven by cc-dropdown.js alone, as the ones drawn later (the editor's proxy type) are.
|
|
2622
|
+
{ const slot = $('ml-create-where-slot'); if (slot) slot.innerHTML = dropdownHTML('ml-create-where', [
|
|
2623
|
+
{ value: 'local', label: kit.tx('settings.redesign.morelogin.local.whereLocal') },
|
|
2624
|
+
{ value: 'morelogin', label: kit.tx('settings.redesign.morelogin.local.whereMoreLogin'), selected: true },
|
|
2625
|
+
], { classes: 'stg-dropdown', label: kit.tx('settings.redesign.control.ml020.label') }); }
|
|
2626
|
+
{ const card = $('stg-sec-ml-profiles'); if (card) wireDropdowns(card, { signal }); }
|
|
2627
|
+
$('ml-create-where')?.addEventListener('change', () => { _whereTouched = true; });
|
|
2628
|
+
// "Where" follows what MoreLogin can do until the owner picks: Local while MoreLogin is closed, refusing or full.
|
|
2629
|
+
function syncCreateWhere() {
|
|
2630
|
+
const where = $('ml-create-where');
|
|
2631
|
+
if (!where) return;
|
|
2632
|
+
// A server from before local profiles cannot make one: Local cannot be chosen there (settings-local-profiles.js
|
|
2633
|
+
// whereOptions), and Create never turns a Local choice into a MoreLogin profile (createAction).
|
|
2634
|
+
const dd = where.nextElementSibling;
|
|
2635
|
+
for (const option of whereOptions({ localKnown: _localKnown })) {
|
|
2636
|
+
const item = dd?.querySelector(`.cc-dropdown-item[data-value="${option.value}"]`);
|
|
2637
|
+
if (!item) continue;
|
|
2638
|
+
if (option.disabled) item.setAttribute('aria-disabled', 'true'); else item.removeAttribute('aria-disabled');
|
|
2639
|
+
}
|
|
2640
|
+
if (!_localKnown) { setDropdownValue(where, 'morelogin'); return; }
|
|
2641
|
+
if (_whereTouched && !_limitHit) return;
|
|
2642
|
+
setDropdownValue(where, defaultCreateWhere(_status, { limitHit: _limitHit }));
|
|
2643
|
+
}
|
|
2570
2644
|
const okBg = 'rgba(76,175,80,0.12)', errBg = 'rgba(244,67,54,0.12)';
|
|
2571
2645
|
|
|
2572
|
-
|
|
2646
|
+
// The answer's HTTP status rides along (`_status`): a refusal of the owner's access is told apart from a MoreLogin error.
|
|
2647
|
+
const jget = (u) => fetch(u).then(async (r) => { const body = await r.json(); if (body && typeof body === 'object') body._status = r.status; return body; }).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
|
|
2573
2648
|
const jpost = (u, body) => fetch(u, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) }).then(r => r.json()).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
|
|
2574
2649
|
|
|
2575
2650
|
function setStatus(s) {
|
|
@@ -2581,24 +2656,66 @@ function wireMoreLoginTab(overlay) {
|
|
|
2581
2656
|
const hint = $('ml-path-hint');
|
|
2582
2657
|
if (hint) hint.hidden = !!(s.installed && s.running);
|
|
2583
2658
|
_defaultEnvId = s.defaultEnvId || null;
|
|
2659
|
+
_status = s;
|
|
2584
2660
|
const ds = $('ml-default-status');
|
|
2585
2661
|
if (ds) ds.textContent = (s.isDefault && s.defaultEnvId) ? kit.tx('settings.redesign.morelogin.defaultAiBrowserSet') : kit.tx('settings.redesign.morelogin.noDefaultSet');
|
|
2586
2662
|
}
|
|
2587
2663
|
|
|
2588
|
-
|
|
2664
|
+
// `agentProfiles`: the owner's list of profiles agents may choose (GET /api/morelogin/profiles). A server from
|
|
2665
|
+
// before that list sends none: the switches are then left out and the pane says a restart is missing.
|
|
2666
|
+
function renderProfiles(envs, agentProfiles) {
|
|
2589
2667
|
const list = $('ml-profile-list');
|
|
2590
2668
|
if (!list) return;
|
|
2591
|
-
|
|
2592
|
-
|
|
2669
|
+
// The open editor's typed values outlive a redraw of the list (a Start, a switch, the quiet ask again).
|
|
2670
|
+
const keep = _editing && list.querySelector('#ml-local-editor') ? collectEditor() : null;
|
|
2671
|
+
// MoreLogin closed or refusing while local profiles exist: its own profiles are missing from the list, and why.
|
|
2672
|
+
const missing = _moreloginError ? `<div class="settings-hint" id="ml-morelogin-missing" role="status">${escapeHtml(lp('moreloginMissing', { error: String(_moreloginError) }))}</div>` : '';
|
|
2673
|
+
const listKnown = Array.isArray(agentProfiles);
|
|
2674
|
+
const allowed = new Set((listKnown ? agentProfiles : []).map(row => String(row && row.envId)));
|
|
2675
|
+
const restart = $('ml-agents-restart');
|
|
2676
|
+
if (restart) restart.hidden = listKnown;
|
|
2677
|
+
if (!envs || !envs.length) { _editing = null; list.innerHTML = missing + '<div class="settings-hint">' + kit.te('settings.redesign.morelogin.noProfilesCreateOneAboveOr') + '</div>'; return; }
|
|
2678
|
+
list.innerHTML = missing + envs.map(e => {
|
|
2593
2679
|
const id = escapeHtml(String(e.id));
|
|
2594
2680
|
const isDefault = String(e.id) === String(_defaultEnvId);
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2681
|
+
// SynaBun drives a profile over CDP: a Firefox-type one (`browser` from the server; absent = not known) cannot
|
|
2682
|
+
// be the AI browser, so "Use as default" is not offered for it. Start and Stop stay for either kind.
|
|
2683
|
+
const firefox = e.browser === 'firefox';
|
|
2684
|
+
const firefoxNote = `<span class="ml-firefox-note" data-ml-firefox="${id}" title="${kit.te('settings.redesign.morelogin.firefoxNotUsableHelp')}" style="font-size:11px;color:var(${isDefault ? '--stg-warn' : '--t-muted'})">${kit.te(isDefault ? 'settings.redesign.morelogin.firefoxDefault' : 'settings.redesign.morelogin.firefoxNotUsable')}</span>`;
|
|
2685
|
+
// A local profile says so, with its state and its proxy, and has Edit and Delete of its own.
|
|
2686
|
+
const local = isLocalProfile(e);
|
|
2687
|
+
const detail = local ? (_localDetails.get(String(e.id)) || e) : null;
|
|
2688
|
+
const proxyText = local ? proxySummary(detail, lp('proxyLogin')) : '';
|
|
2689
|
+
const localInfo = local
|
|
2690
|
+
? ` <span class="ml-local-tag" style="font-size:11px;color:var(--t-muted);border:1px solid var(--s-medium);padding:1px 5px">${escapeHtml(lp('tag'))}</span>`
|
|
2691
|
+
+ ` <span style="color:var(--t-muted);font-size:11px">(${escapeHtml(lp(e.status === 'running' ? 'running' : 'stopped'))}) · ${escapeHtml(proxyText || lp('noProxy'))}</span>`
|
|
2692
|
+
+ (e.restartNeeded ? ` <span class="ml-local-restart" role="status" style="font-size:11px;color:var(--stg-warn)">${escapeHtml(lp('restartNeeded'))}</span>` : '')
|
|
2693
|
+
: '';
|
|
2694
|
+
const localButtons = local ? `
|
|
2695
|
+
<button type="button" class="conn-add-btn ml-edit" data-env-id="${id}" ${kit.inv('ML021')} title="${kit.H('ML021')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML021')}</button>
|
|
2696
|
+
<button type="button" class="conn-add-btn ml-delete" data-env-id="${id}" data-env-name="${escapeHtml(String(e.name ?? e.id))}" ${kit.inv('ML022')} title="${kit.H('ML022')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML022')}</button>` : '';
|
|
2697
|
+
return `<div data-ml-row="${id}"${local ? ' data-ml-kind="local"' : ''} style="display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 10px;border:1px solid ${isDefault ? 'var(--accent)' : 'var(--s-medium)'};border-radius:8px;background:var(--s-darker)">
|
|
2698
|
+
<span style="flex:1;min-width:140px;font-size:12.5px">${escapeHtml(e.name)}${local ? localInfo : (e.status ? ` <span style="color:var(--t-muted);font-size:11px">(${escapeHtml(String(e.status))})</span>` : '')}</span>
|
|
2699
|
+
${listKnown && !firefox ? `<span class="ml-agents" style="display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--t-muted)"><span aria-hidden="true">${kit.te('settings.redesign.morelogin.agentsMayChoose')}</span>${kit.switchInput(`ml-agents-${id}`, { checked: allowed.has(String(e.id)), className: 'ml-agents-toggle', described: false, attrs: `data-env-id="${id}" data-env-name="${escapeHtml(String(e.name ?? e.id))}" aria-label="${escapeHtml(kit.tx('settings.redesign.morelogin.agentsMayChooseAria', { name: String(e.name ?? e.id) }))}" aria-describedby="ml-agents-help"` })}</span>` : ''}
|
|
2700
|
+
${firefox ? firefoxNote : (isDefault ? '<span style="font-size:11px;color:var(--accent)">' + kit.te('settings.redesign.morelogin.default') + '</span>' : `<button type="button" class="conn-add-btn ml-use" data-env-id="${id}" ${kit.inv('ML019')} title="${kit.H('ML019')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML019')}</button>`)}
|
|
2598
2701
|
<button type="button" class="conn-add-btn ml-start" data-env-id="${id}" ${kit.inv('ML017')} title="${kit.H('ML017')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML017')}</button>
|
|
2599
|
-
<button type="button" class="conn-add-btn ml-stop" data-env-id="${id}" ${kit.inv('ML018')} title="${kit.H('ML018')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML018')}</button
|
|
2702
|
+
<button type="button" class="conn-add-btn ml-stop" data-env-id="${id}" ${kit.inv('ML018')} title="${kit.H('ML018')}" style="margin:0;width:auto;padding:3px 8px">${kit.L('ML018')}</button>${localButtons}
|
|
2600
2703
|
</div>`;
|
|
2601
2704
|
}).join('');
|
|
2705
|
+
if (_editing && !envs.some(e => String(e.id) === _editing && isLocalProfile(e))) _editing = null;
|
|
2706
|
+
if (_editing) openEditor(_editing, keep);
|
|
2707
|
+
// One profile per request (PUT /api/morelogin/agent-profiles, the owner's page only). A refused or failed change
|
|
2708
|
+
// puts the switch back, so it never shows what the server does not hold.
|
|
2709
|
+
list.querySelectorAll('.ml-agents-toggle').forEach(box => box.addEventListener('change', async () => {
|
|
2710
|
+
const want = box.checked;
|
|
2711
|
+
const name = box.dataset.envName || box.dataset.envId;
|
|
2712
|
+
box.disabled = true;
|
|
2713
|
+
const r = await fetch('/api/morelogin/agent-profiles', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ envId: box.dataset.envId, name, allowed: want }) })
|
|
2714
|
+
.then(x => x.json()).catch(() => ({ ok: false, error: kit.tx('settings.redesign.morelogin.networkError') }));
|
|
2715
|
+
box.disabled = false;
|
|
2716
|
+
if (r && r.ok) showCCToast(kit.tx(want ? 'settings.redesign.morelogin.agentsMayChooseOn' : 'settings.redesign.morelogin.agentsMayChooseOff', { name }));
|
|
2717
|
+
else { box.checked = !want; showCCToast(kit.tx('settings.redesign.morelogin.agentsMayChooseFailed', { error: (r && r.error) || kit.tx('settings.redesign.morelogin.failed') })); }
|
|
2718
|
+
}));
|
|
2602
2719
|
list.querySelectorAll('.ml-use').forEach(b => b.addEventListener('click', async () => {
|
|
2603
2720
|
const r = await jpost('/api/morelogin/use-default', { envId: b.dataset.envId });
|
|
2604
2721
|
showCCToast(r.ok ? kit.tx('settings.redesign.morelogin.moreloginSetAsDefaultAiBrowser') : (r.error || kit.tx('settings.redesign.morelogin.failed')));
|
|
@@ -2614,10 +2731,164 @@ function wireMoreLoginTab(overlay) {
|
|
|
2614
2731
|
await jpost('/api/morelogin/stop', { envId: b.dataset.envId });
|
|
2615
2732
|
reload();
|
|
2616
2733
|
}));
|
|
2734
|
+
list.querySelectorAll('.ml-edit').forEach(b => b.addEventListener('click', () => {
|
|
2735
|
+
if (_editing === b.dataset.envId) { closeEditor(); return; }
|
|
2736
|
+
openEditor(b.dataset.envId);
|
|
2737
|
+
}));
|
|
2738
|
+
list.querySelectorAll('.ml-delete').forEach(b => b.addEventListener('click', async () => {
|
|
2739
|
+
const name = b.dataset.envName || b.dataset.envId;
|
|
2740
|
+
if (!confirm(lp('deleteConfirm', { name }))) return;
|
|
2741
|
+
b.disabled = true;
|
|
2742
|
+
const r = await jsend('DELETE', `/api/morelogin/local-profiles/${encodeURIComponent(b.dataset.envId)}`);
|
|
2743
|
+
b.disabled = false;
|
|
2744
|
+
if (r && r.ok) { if (_editing === b.dataset.envId) _editing = null; showCCToast(lp('deleted', { name })); }
|
|
2745
|
+
else showCCToast(lp('deleteFailed', { error: (r && r.error) || kit.tx('settings.redesign.morelogin.failed') }));
|
|
2746
|
+
reload();
|
|
2747
|
+
}));
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
// ── The editor of a local profile: a panel under its row ──
|
|
2751
|
+
const editorField = (name) => overlay.querySelector(`#ml-local-editor [data-lp-field="${name}"]`);
|
|
2752
|
+
/** The editor's fields as typed (settings-local-profiles.js readLocalProfileForm takes them). */
|
|
2753
|
+
function collectEditor() {
|
|
2754
|
+
const value = (name) => editorField(name)?.value ?? '';
|
|
2755
|
+
return {
|
|
2756
|
+
name: value('name'), proxyType: $('ml-lp-proxy-type')?.value || 'none', host: value('host'), port: value('port'), username: value('username'),
|
|
2757
|
+
password: value('password'), passwordTouched: editorField('password')?.dataset.touched === '1', hasPassword: editorField('password')?.dataset.saved === '1',
|
|
2758
|
+
language: value('language'), timezone: value('timezone'), width: value('width'), height: value('height'), notes: value('notes'),
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2761
|
+
function closeEditor() {
|
|
2762
|
+
_editing = null;
|
|
2763
|
+
overlay.querySelector('#ml-local-editor')?.remove();
|
|
2764
|
+
}
|
|
2765
|
+
function editorStatus(message, warn = false) {
|
|
2766
|
+
const line = overlay.querySelector('#ml-lp-status');
|
|
2767
|
+
if (!line) return;
|
|
2768
|
+
line.hidden = !message;
|
|
2769
|
+
line.textContent = message || '';
|
|
2770
|
+
line.style.color = warn ? 'var(--stg-warn)' : '';
|
|
2771
|
+
}
|
|
2772
|
+
/** Draws the editor under the profile's row. `values`: what was typed before a redraw, else the saved settings. */
|
|
2773
|
+
function openEditor(id, values = null) {
|
|
2774
|
+
const row = [...overlay.querySelectorAll('#ml-profile-list [data-ml-row]')].find(el => el.dataset.mlRow === id);
|
|
2775
|
+
const detail = _localDetails.get(id);
|
|
2776
|
+
if (!row || !detail) return;
|
|
2777
|
+
overlay.querySelector('#ml-local-editor')?.remove();
|
|
2778
|
+
_editing = id;
|
|
2779
|
+
const v = values || formOfProfile(detail);
|
|
2780
|
+
const input = (name, invId, { ph = '', type = 'text', width = '' } = {}) =>
|
|
2781
|
+
`<input type="${type}" id="ml-lp-${name}" data-lp-field="${name}" ${kit.inv(invId)} value="${escapeHtml(String(v[name] ?? ''))}"${ph ? ` placeholder="${escapeHtml(ph)}"` : ''}${width ? ` style="max-width:${width}"` : ''} autocomplete="off" spellcheck="false" aria-describedby="ml-lp-${name}-help">`;
|
|
2782
|
+
const fieldRow = (invId, name, control) => kit.field(invId, `<div class="settings-key-row">${control}</div>`, { forId: `ml-lp-${name}` });
|
|
2783
|
+
const proxyTypes = PROXY_TYPES.map(type => ({ value: type, label: lp(`proxyType.${type}`), selected: type === v.proxyType }));
|
|
2784
|
+
const panel = document.createElement('div');
|
|
2785
|
+
panel.id = 'ml-local-editor';
|
|
2786
|
+
panel.dataset.envId = id;
|
|
2787
|
+
panel.setAttribute('role', 'group');
|
|
2788
|
+
panel.setAttribute('aria-label', lp('editorTitle', { name: detail.name }));
|
|
2789
|
+
panel.style.cssText = 'padding:12px;border:1px solid var(--s-medium);border-radius:8px;background:var(--s-darker)';
|
|
2790
|
+
panel.innerHTML = `
|
|
2791
|
+
${fieldRow('ML023', 'name', input('name', 'ML023'))}
|
|
2792
|
+
${kit.field('ML024', dropdownHTML('ml-lp-proxy-type', proxyTypes, { classes: 'stg-dropdown', label: kit.tx('settings.redesign.control.ml024.label') }))}
|
|
2793
|
+
<div id="ml-lp-proxy-fields"${v.proxyType === 'none' ? ' hidden' : ''}>
|
|
2794
|
+
${fieldRow('ML025', 'host', input('host', 'ML025', { ph: lp('ph.host') }))}
|
|
2795
|
+
${fieldRow('ML026', 'port', input('port', 'ML026', { ph: lp('ph.port'), width: '120px' }))}
|
|
2796
|
+
${fieldRow('ML027', 'username', input('username', 'ML027'))}
|
|
2797
|
+
${fieldRow('ML028', 'password', `${input('password', 'ML028', { type: 'password', ph: v.hasPassword ? lp('passwordKept') : '' })}
|
|
2798
|
+
<button type="button" class="stg-action-btn compact" id="ml-lp-password-eye" ${kit.inv('ML029')} aria-label="${kit.L('ML029')}" title="${kit.L('ML029')}">${eyeClosed}</button>`)}
|
|
2799
|
+
<div class="stg-field" ${kit.inv('ML030')}>
|
|
2800
|
+
<div class="stg-action-row">
|
|
2801
|
+
<button type="button" class="stg-action-btn compact" id="ml-lp-check" aria-describedby="ml-lp-check-help">${kit.L('ML030')}</button>
|
|
2802
|
+
<span class="stg-help" id="ml-lp-check-result" role="status" aria-live="polite"></span>
|
|
2803
|
+
</div>
|
|
2804
|
+
${kit.help('ML030', { forId: 'ml-lp-check' })}
|
|
2805
|
+
</div>
|
|
2806
|
+
</div>
|
|
2807
|
+
${fieldRow('ML031', 'language', input('language', 'ML031', { ph: lp('ph.language'), width: '160px' }))}
|
|
2808
|
+
${fieldRow('ML032', 'timezone', input('timezone', 'ML032', { ph: lp('ph.timezone'), width: '260px' }))}
|
|
2809
|
+
${kit.field('ML033', `<div class="settings-key-row">
|
|
2810
|
+
${input('width', 'ML033', { ph: '1280', width: '90px' })}
|
|
2811
|
+
<span aria-hidden="true" style="color:var(--t-muted)">×</span>
|
|
2812
|
+
<input type="text" id="ml-lp-height" data-lp-field="height" value="${escapeHtml(String(v.height ?? ''))}" placeholder="800" style="max-width:90px" autocomplete="off" spellcheck="false" aria-label="${escapeHtml(lp('windowHeight'))}">
|
|
2813
|
+
</div>`, { forId: 'ml-lp-width' })}
|
|
2814
|
+
${fieldRow('ML034', 'notes', input('notes', 'ML034'))}
|
|
2815
|
+
<div class="stg-help" id="ml-lp-restart" role="status"${detail.status === 'running' ? '' : ' hidden'} style="margin:0 0 10px;color:var(--stg-warn)">${escapeHtml(lp('restartNeeded'))}</div>
|
|
2816
|
+
<div class="stg-action-row">
|
|
2817
|
+
<button type="button" class="stg-action-btn compact" id="ml-lp-save" ${kit.inv('ML035')} title="${kit.H('ML035')}">${kit.L('ML035')}</button>
|
|
2818
|
+
<button type="button" class="stg-action-btn compact" id="ml-lp-cancel" ${kit.inv('ML036')} title="${kit.H('ML036')}">${kit.L('ML036')}</button>
|
|
2819
|
+
<span class="stg-help" id="ml-lp-status" role="status" aria-live="polite" hidden></span>
|
|
2820
|
+
</div>`;
|
|
2821
|
+
row.after(panel);
|
|
2822
|
+
const password = editorField('password');
|
|
2823
|
+
if (password) {
|
|
2824
|
+
password.dataset.saved = v.hasPassword ? '1' : '0';
|
|
2825
|
+
if (v.passwordTouched) password.dataset.touched = '1';
|
|
2826
|
+
password.addEventListener('input', () => { password.dataset.touched = '1'; syncPasswordAsk(); });
|
|
2827
|
+
}
|
|
2828
|
+
// The saved password belongs to the saved proxy and login: once one of them is changed here, the field asks for
|
|
2829
|
+
// the password again (the server drops the saved one then, lib/local-profiles.js normalizeProxy).
|
|
2830
|
+
function syncPasswordAsk() {
|
|
2831
|
+
if (!password) return false;
|
|
2832
|
+
const again = passwordNeededAgain(collectEditor(), detail);
|
|
2833
|
+
password.placeholder = again ? lp('passwordAgain') : (v.hasPassword ? lp('passwordKept') : '');
|
|
2834
|
+
if (again) password.setAttribute('aria-invalid', 'true'); else password.removeAttribute('aria-invalid');
|
|
2835
|
+
return again;
|
|
2836
|
+
}
|
|
2837
|
+
for (const name of ['host', 'port', 'username']) editorField(name)?.addEventListener('input', syncPasswordAsk);
|
|
2838
|
+
panel.querySelector('#ml-lp-proxy-type')?.addEventListener('change', syncPasswordAsk);
|
|
2839
|
+
syncPasswordAsk();
|
|
2840
|
+
panel.querySelector('#ml-lp-proxy-type')?.addEventListener('change', (event) => {
|
|
2841
|
+
const fields = panel.querySelector('#ml-lp-proxy-fields');
|
|
2842
|
+
if (fields) fields.hidden = event.target.value === 'none';
|
|
2843
|
+
});
|
|
2844
|
+
panel.querySelector('#ml-lp-password-eye')?.addEventListener('click', () => { if (password) password.type = password.type === 'password' ? 'text' : 'password'; });
|
|
2845
|
+
panel.querySelector('#ml-lp-cancel')?.addEventListener('click', closeEditor);
|
|
2846
|
+
panel.querySelector('#ml-lp-check')?.addEventListener('click', async (event) => {
|
|
2847
|
+
const button = event.currentTarget;
|
|
2848
|
+
const result = panel.querySelector('#ml-lp-check-result');
|
|
2849
|
+
const typed = collectEditor();
|
|
2850
|
+
const proxy = proxyOfForm(typed);
|
|
2851
|
+
if (!proxy) { if (result) { result.textContent = lp('invalid.host'); result.style.color = 'var(--stg-warn)'; } return; }
|
|
2852
|
+
if (syncPasswordAsk()) { if (result) { result.textContent = lp('passwordAgain'); result.style.color = 'var(--stg-warn)'; } password?.focus(); return; }
|
|
2853
|
+
button.disabled = true;
|
|
2854
|
+
if (result) { result.textContent = lp('checking'); result.style.color = ''; }
|
|
2855
|
+
const r = await jsend('POST', `/api/morelogin/local-profiles/${encodeURIComponent(id)}/check-proxy`, { proxy });
|
|
2856
|
+
button.disabled = false;
|
|
2857
|
+
if (!result || !result.isConnected) return;
|
|
2858
|
+
result.style.color = r && r.ok ? '' : 'var(--stg-warn)';
|
|
2859
|
+
result.textContent = r && r.ok
|
|
2860
|
+
? (r.via === 'direct' ? lp('checkDirect', { ip: r.ip }) : lp('checkOk', { ip: r.ip, via: String(r.via).toUpperCase(), ms: r.ms }))
|
|
2861
|
+
: lp('checkFailed', { error: (r && r.error) || kit.tx('settings.redesign.morelogin.failed') });
|
|
2862
|
+
});
|
|
2863
|
+
panel.querySelector('#ml-lp-save')?.addEventListener('click', async (event) => {
|
|
2864
|
+
const button = event.currentTarget;
|
|
2865
|
+
const read = readLocalProfileForm(collectEditor());
|
|
2866
|
+
if (!read.ok) {
|
|
2867
|
+
const first = Object.keys(read.errors)[0];
|
|
2868
|
+
editorStatus(lp(`invalid.${read.errors[first]}`), true);
|
|
2869
|
+
(editorField(first === 'window' ? 'width' : first) || panel).focus?.();
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
if (syncPasswordAsk()) { editorStatus(lp('passwordAgain'), true); password?.focus(); return; }
|
|
2873
|
+
button.disabled = true;
|
|
2874
|
+
const r = await jsend('PUT', `/api/morelogin/local-profiles/${encodeURIComponent(id)}`, read.body);
|
|
2875
|
+
button.disabled = false;
|
|
2876
|
+
if (!r || !r.ok) { editorStatus(lp('saveFailed', { error: (r && r.error) || kit.tx('settings.redesign.morelogin.failed') }), true); return; }
|
|
2877
|
+
showCCToast(lp(r.restartNeeded ? 'savedRestart' : 'saved'));
|
|
2878
|
+
closeEditor();
|
|
2879
|
+
reload();
|
|
2880
|
+
});
|
|
2617
2881
|
}
|
|
2618
2882
|
|
|
2619
2883
|
async function reload() {
|
|
2620
2884
|
const s = await jget('/api/morelogin/status');
|
|
2885
|
+
// No owner access (SynaBun's automation browser opened this page): "No access", never "not installed" or defaults.
|
|
2886
|
+
if (markPaneRefused(overlay, 'morelogin', refusalOfError({ status: s._status, code: s.code }))) {
|
|
2887
|
+
const dot = $('ml-status-dot'), line = $('ml-status-line');
|
|
2888
|
+
if (dot) dot.className = 'settings-status-dot disconnected';
|
|
2889
|
+
if (line) line.textContent = ownerAccessSay('panelTitle');
|
|
2890
|
+
return;
|
|
2891
|
+
}
|
|
2621
2892
|
if (s.ok) setStatus(s);
|
|
2622
2893
|
const cfg = await jget('/api/morelogin/config');
|
|
2623
2894
|
if (cfg.ok) {
|
|
@@ -2625,13 +2896,32 @@ function wireMoreLoginTab(overlay) {
|
|
|
2625
2896
|
if ($('ml-api-id') && !$('ml-api-id').value) $('ml-api-id').value = cfg.config.apiId || '';
|
|
2626
2897
|
}
|
|
2627
2898
|
const p = await jget('/api/morelogin/profiles');
|
|
2899
|
+
// `local`: the running server knows local profiles. One from before them cannot create one: said, not hidden.
|
|
2900
|
+
_localKnown = !!p && typeof p.local === 'object' && p.local !== null;
|
|
2901
|
+
{ const note = $('ml-local-restart'); if (note) note.hidden = _localKnown || p._status === 403; }
|
|
2902
|
+
syncCreateWhere();
|
|
2628
2903
|
if (p.ok === false && p.error) {
|
|
2629
2904
|
const list = $('ml-profile-list');
|
|
2905
|
+
_editing = null;
|
|
2630
2906
|
if (list) list.innerHTML = '<div class="settings-hint" role="status">' + escapeHtml(String(p.error)) + '</div>';
|
|
2631
2907
|
return;
|
|
2632
2908
|
}
|
|
2633
|
-
|
|
2909
|
+
// What the editor and the rows show of each local profile (never its proxy password).
|
|
2910
|
+
if ((p.envs || []).some(isLocalProfile)) {
|
|
2911
|
+
const d = await jget('/api/morelogin/local-profiles');
|
|
2912
|
+
if (d && d.ok && Array.isArray(d.profiles)) _localDetails = new Map(d.profiles.map(row => [String(row.id), row]));
|
|
2913
|
+
} else _localDetails = new Map();
|
|
2914
|
+
_moreloginError = p.moreloginError || '';
|
|
2915
|
+
renderProfiles(p.envs || [], p.agentProfiles);
|
|
2916
|
+
// The server is still asking MoreLogin which browser some profiles run: ask again quietly, a few times.
|
|
2917
|
+
clearTimeout(_browsersTimer);
|
|
2918
|
+
if (Number(p.browsersPending) > 0 && _browsersTries < 8 && $('ml-profile-list')?.isConnected) {
|
|
2919
|
+
_browsersTries += 1;
|
|
2920
|
+
_browsersTimer = setTimeout(reload, 2500);
|
|
2921
|
+
} else _browsersTries = 0;
|
|
2634
2922
|
}
|
|
2923
|
+
let _browsersTimer = null;
|
|
2924
|
+
let _browsersTries = 0;
|
|
2635
2925
|
|
|
2636
2926
|
const saveCfg = (key, value) => fetch('/api/morelogin/config', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ key, value }) });
|
|
2637
2927
|
|
|
@@ -2640,9 +2930,49 @@ function wireMoreLoginTab(overlay) {
|
|
|
2640
2930
|
$('ml-secret-save')?.addEventListener('click', async () => { await saveCfg('secret', $('ml-secret').value || ''); showCCToast(kit.tx('settings.redesign.morelogin.secretSaved')); });
|
|
2641
2931
|
$('ml-secret-eye')?.addEventListener('click', () => { const i = $('ml-secret'); if (i) i.type = i.type === 'password' ? 'text' : 'password'; });
|
|
2642
2932
|
$('ml-refresh-btn')?.addEventListener('click', reload);
|
|
2933
|
+
/** A new local profile under `name`; its editor opens, since a name is all it has yet. */
|
|
2934
|
+
async function createLocal(name) {
|
|
2935
|
+
const r = await jsend('POST', '/api/morelogin/local-profiles', { name: name || lp('defaultName', { n: _localDetails.size + 1 }) });
|
|
2936
|
+
if (!r || !r.ok) { showCCToast(lp('createFailed', { error: (r && r.error) || kit.tx('settings.redesign.morelogin.createFailed') })); return false; }
|
|
2937
|
+
showCCToast(lp('created'));
|
|
2938
|
+
_editing = String(r.profile.id);
|
|
2939
|
+
if ($('ml-new-name')) $('ml-new-name').value = '';
|
|
2940
|
+
const note = $('ml-create-note'); if (note) { note.hidden = true; note.textContent = ''; }
|
|
2941
|
+
await reload();
|
|
2942
|
+
overlay.querySelector('#ml-local-editor [data-lp-field="name"]')?.focus();
|
|
2943
|
+
return true;
|
|
2944
|
+
}
|
|
2643
2945
|
$('ml-create-btn')?.addEventListener('click', async () => {
|
|
2644
|
-
const
|
|
2946
|
+
const typed = ($('ml-new-name')?.value || '').trim();
|
|
2947
|
+
const action = createAction({ where: $('ml-create-where')?.value || 'morelogin', localKnown: _localKnown });
|
|
2948
|
+
if (action === 'local') { await createLocal(typed); return; }
|
|
2949
|
+
if (action === 'restart') {
|
|
2950
|
+
// Local was asked of a server older than local profiles: nothing is created (never a MoreLogin profile, which
|
|
2951
|
+
// would take one of the plan's slots), and the restart note says why.
|
|
2952
|
+
const restart = $('ml-local-restart'); if (restart) restart.hidden = false;
|
|
2953
|
+
showCCToast(lp('restartServer'));
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
const name = typed || 'SynaBun';
|
|
2645
2957
|
const r = await jpost('/api/morelogin/profiles', { name });
|
|
2958
|
+
// MoreLogin's plan holds no more profiles: said, with the way on. A local profile needs no MoreLogin slot.
|
|
2959
|
+
if (isPlanLimit(r) && _localKnown) {
|
|
2960
|
+
_limitHit = true;
|
|
2961
|
+
syncCreateWhere();
|
|
2962
|
+
const note = $('ml-create-note');
|
|
2963
|
+
if (note) {
|
|
2964
|
+
note.hidden = false;
|
|
2965
|
+
note.textContent = `${String(r.error || lp('planLimit'))} `;
|
|
2966
|
+
const offer = document.createElement('button');
|
|
2967
|
+
offer.type = 'button';
|
|
2968
|
+
offer.className = 'stg-action-btn compact';
|
|
2969
|
+
offer.id = 'ml-create-local-offer';
|
|
2970
|
+
offer.textContent = lp('planLimitCreateLocal');
|
|
2971
|
+
offer.addEventListener('click', () => createLocal(typed));
|
|
2972
|
+
note.appendChild(offer);
|
|
2973
|
+
}
|
|
2974
|
+
return;
|
|
2975
|
+
}
|
|
2646
2976
|
showCCToast(r.ok ? kit.tx('settings.redesign.morelogin.profileCreated') : (r.error || kit.tx('settings.redesign.morelogin.createFailed')));
|
|
2647
2977
|
if ($('ml-new-name')) $('ml-new-name').value = '';
|
|
2648
2978
|
reload();
|
|
@@ -3374,18 +3704,28 @@ async function openSettingsModalNow(options = {}) {
|
|
|
3374
3704
|
let userContextReading = readUserContextResponse({ status: 0 });
|
|
3375
3705
|
// Protect workers (lib/worker-guard-setting.js): what its endpoint answered, as a reading.
|
|
3376
3706
|
let workerGuardReading = readWorkerGuardResponse({ status: 0 });
|
|
3707
|
+
// Let the automation browser act as owner (lib/automation-browser-owner-access.js): what its endpoint answered.
|
|
3708
|
+
let ownerAccessReading = readOwnerAccessResponse({ status: 0 });
|
|
3377
3709
|
// SynaBun's Claude Code hooks (lib/claude-hooks-status.js): the `claudeHooks` of the integrations read, as a reading.
|
|
3378
3710
|
let claudeHooksReading = readClaudeHooksResponse({ status: 0 });
|
|
3711
|
+
// The reads the server refused this page (it has no owner access: SynaBun's automation browser opened it). The panes
|
|
3712
|
+
// they feed say "No access" with their Save and actions off, and their nav item "(No access)", never "(Off)".
|
|
3713
|
+
const refusedReads = new Set();
|
|
3379
3714
|
|
|
3380
3715
|
try {
|
|
3381
3716
|
// Read through the page's data cache (settings/settings-data.js): kept answers at once (each open its own
|
|
3382
3717
|
// copy; read again in the background when old), so Settings waits only the first time.
|
|
3383
3718
|
const reads = await readSettingsData();
|
|
3719
|
+
for (const [name, entry] of Object.entries(reads)) {
|
|
3720
|
+
const refusal = settingsReadRefusal(entry);
|
|
3721
|
+
if (refusal) { refusedReads.add(name); noteOwnerAccessRefusal(refusal); }
|
|
3722
|
+
}
|
|
3384
3723
|
// The greeting and the user context are readings of what their endpoints answered (no answer is a reading too).
|
|
3385
3724
|
const readingOf = (entry, make) => ({ status: 'fulfilled', value: entry?.status === 'fulfilled' ? make(entry.value) : make({ status: 0, error: entry?.reason?.message }) });
|
|
3386
3725
|
const greetRes = readingOf(reads.greeting, readGreetingStatus);
|
|
3387
3726
|
const userContextRes = readingOf(reads.userContext, readUserContextResponse);
|
|
3388
3727
|
const workerGuardRes = readingOf(reads.workerGuard, readWorkerGuardResponse);
|
|
3728
|
+
const ownerAccessRes = readingOf(reads.browserOwnerAccess, readOwnerAccessResponse);
|
|
3389
3729
|
const settingsRes = reads.settings, connRes = reads.connections, ccRes = reads.integrations, skillsRes = reads.skills;
|
|
3390
3730
|
const tunnelRes = reads.tunnel, keyRes = reads.mcpKey, bridgeRes = reads.openclaw, setupRes = reads.setup, cliRes = reads.cli;
|
|
3391
3731
|
const toolPermsRes = reads.toolPermissions, toolCatsRes = reads.toolCategories, discordRes = reads.discord, skinsRes = reads.skins;
|
|
@@ -3393,6 +3733,7 @@ async function openSettingsModalNow(options = {}) {
|
|
|
3393
3733
|
if (typesafeRes.status === 'fulfilled' && typesafeRes.value.ok) typesafeConfig = typesafeRes.value;
|
|
3394
3734
|
if (userContextRes.status === 'fulfilled') userContextReading = userContextRes.value;
|
|
3395
3735
|
if (workerGuardRes.status === 'fulfilled') workerGuardReading = workerGuardRes.value;
|
|
3736
|
+
if (ownerAccessRes.status === 'fulfilled') ownerAccessReading = ownerAccessRes.value;
|
|
3396
3737
|
if (settingsRes.status === 'fulfilled') settings = settingsRes.value;
|
|
3397
3738
|
if (connRes.status === 'fulfilled' && connRes.value.connections) connections = connRes.value.connections;
|
|
3398
3739
|
// Read as it came (status and body): a refusal or an old server is said as what it is, never as hooks that are off.
|
|
@@ -3470,7 +3811,7 @@ async function openSettingsModalNow(options = {}) {
|
|
|
3470
3811
|
terminal: buildTerminalTab(cliConfig),
|
|
3471
3812
|
opencode: buildOpencodeTab(),
|
|
3472
3813
|
notifications: buildNotificationsTab(),
|
|
3473
|
-
browser: buildBrowserTab(),
|
|
3814
|
+
browser: buildBrowserTab(describeOwnerAccess(ownerAccessReading, { tx: kit.tx })),
|
|
3474
3815
|
mcp: buildMcpTab(),
|
|
3475
3816
|
setup: buildSetupTab(setupStatus),
|
|
3476
3817
|
collections: buildCollectionsTab(connections, settings),
|
|
@@ -3510,10 +3851,10 @@ async function openSettingsModalNow(options = {}) {
|
|
|
3510
3851
|
overlay.setAttribute('aria-labelledby', 'stg-title');
|
|
3511
3852
|
|
|
3512
3853
|
// ── Nav status dots (Judgments and WhatsApp update theirs as they wire) ──
|
|
3513
|
-
kit.setNavStatus(overlay, 'server', settings.storage === 'sqlite' ? 'connected' : 'disconnected');
|
|
3514
|
-
kit.setNavStatus(overlay, 'setup', (setupStatus.claude?.connected || setupStatus.antigravity?.connected || setupStatus.codex?.connected || setupStatus.opencode?.connected) ? 'connected' : 'disconnected');
|
|
3515
|
-
kit.setNavStatus(overlay, 'discord', discordConfig.botToken ? 'connected' : 'disconnected');
|
|
3516
|
-
kit.setNavStatus(overlay, 'judgments', (typesafeConfig && typesafeConfig.enabled) ? 'connected' : 'disconnected');
|
|
3854
|
+
kit.setNavStatus(overlay, 'server', refusedReads.has('settings') ? 'refused' : settings.storage === 'sqlite' ? 'connected' : 'disconnected');
|
|
3855
|
+
kit.setNavStatus(overlay, 'setup', refusedReads.has('setup') ? 'refused' : (setupStatus.claude?.connected || setupStatus.antigravity?.connected || setupStatus.codex?.connected || setupStatus.opencode?.connected) ? 'connected' : 'disconnected');
|
|
3856
|
+
kit.setNavStatus(overlay, 'discord', refusedReads.has('discord') ? 'refused' : discordConfig.botToken ? 'connected' : 'disconnected');
|
|
3857
|
+
kit.setNavStatus(overlay, 'judgments', refusedReads.has('typesafe') ? 'refused' : (typesafeConfig && typesafeConfig.enabled) ? 'connected' : 'disconnected');
|
|
3517
3858
|
|
|
3518
3859
|
// ── Open animation (matches Skills/Automation Studio) ──
|
|
3519
3860
|
requestAnimationFrame(() => { backdrop.classList.add('open'); overlay.classList.add('open'); });
|
|
@@ -4033,7 +4374,18 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4033
4374
|
progressText.textContent = kit.tx('settings.redesign.server.doneFilesRestored', { restoredFileCount: restoredFileCount });
|
|
4034
4375
|
confirmBtn.textContent = kit.tx('settings.redesign.server.done');
|
|
4035
4376
|
|
|
4036
|
-
|
|
4377
|
+
// A restore that built a new MCP server restarts the server: reload only once a new one answers.
|
|
4378
|
+
await reloadAfterRestore(result, {
|
|
4379
|
+
reload: () => { confirmOverlay.remove(); location.reload(); },
|
|
4380
|
+
onRestarting: () => {
|
|
4381
|
+
progressDot.className = 'wiz-status-dot spin';
|
|
4382
|
+
progressText.textContent = kit.tx('settings.redesign.server.restartingAfterRestore');
|
|
4383
|
+
},
|
|
4384
|
+
onNotBack: () => {
|
|
4385
|
+
progressDot.className = 'wiz-status-dot red';
|
|
4386
|
+
progressText.textContent = kit.tx('settings.redesign.server.serverNotBackAfterRestore');
|
|
4387
|
+
},
|
|
4388
|
+
});
|
|
4037
4389
|
} catch (err) {
|
|
4038
4390
|
progressDot.className = 'wiz-status-dot red';
|
|
4039
4391
|
progressText.textContent = err.message;
|
|
@@ -4383,12 +4735,16 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4383
4735
|
}
|
|
4384
4736
|
|
|
4385
4737
|
// Load impact data + current settings
|
|
4386
|
-
|
|
4738
|
+
// A refused read (no owner access) is "No access" on the pane, never the defaults (ui-owner-access.js).
|
|
4739
|
+
const readOrRefuse = async (r) => (markPaneRefused(overlay, 'memory', await refusalOfResponse(r)) ? null : r.json());
|
|
4740
|
+
fetch('/api/recall-impact').then(readOrRefuse).then(data => {
|
|
4741
|
+
if (!Array.isArray(data?.rows)) return;
|
|
4387
4742
|
_recallImpactData = data;
|
|
4388
4743
|
updateImpactIndicator();
|
|
4389
4744
|
}).catch(() => {});
|
|
4390
4745
|
|
|
4391
|
-
fetch('/api/display-settings').then(
|
|
4746
|
+
fetch('/api/display-settings').then(readOrRefuse).then(data => {
|
|
4747
|
+
if (!data) return;
|
|
4392
4748
|
const profile = data.profile || 'balanced';
|
|
4393
4749
|
const d = data.recallDefaults;
|
|
4394
4750
|
if (d) {
|
|
@@ -4573,7 +4929,7 @@ async function openSettingsModalNow(options = {}) {
|
|
|
4573
4929
|
});
|
|
4574
4930
|
|
|
4575
4931
|
// ── MoreLogin tab handlers (self-loads status/profiles async) ──
|
|
4576
|
-
wireMoreLoginTab(overlay);
|
|
4932
|
+
wireMoreLoginTab(overlay, panelLife.signal);
|
|
4577
4933
|
|
|
4578
4934
|
// ── Judgments tab (TypeSafe / Jev) — self-loads and polls while active ──
|
|
4579
4935
|
wireJudgmentsTab(overlay, { toast: showCCToast, initial: typesafeConfig });
|
|
@@ -5121,6 +5477,47 @@ async function openSettingsModalNow(options = {}) {
|
|
|
5121
5477
|
if (!link) return;
|
|
5122
5478
|
try { applySettingsOpenOptions(overlay, JSON.parse(link.dataset.ucGoto)); } catch { /* a malformed target goes nowhere */ }
|
|
5123
5479
|
});
|
|
5480
|
+
// Let the automation browser act as owner: the switch moves at once and follows the server's answer; a save
|
|
5481
|
+
// that failed puts it back where it was, with the reason under it (a page open in the automation browser itself
|
|
5482
|
+
// is told it may never change this: 403 WORKER_BROWSER). Saves go one after the other, in the order of the clicks.
|
|
5483
|
+
{
|
|
5484
|
+
const btn = overlay.querySelector('#boa-toggle');
|
|
5485
|
+
const row = overlay.querySelector('[data-boa-row]');
|
|
5486
|
+
const status = overlay.querySelector('#boa-save-status');
|
|
5487
|
+
const notes = overlay.querySelector('#boa-notes');
|
|
5488
|
+
const setStatus = (text) => { if (status) { status.textContent = text; status.hidden = !text; } };
|
|
5489
|
+
const paint = (on) => { if (btn) { btn.classList.toggle('on', on); btn.setAttribute('aria-pressed', on ? 'true' : 'false'); } row?.classList.toggle('enabled', on); };
|
|
5490
|
+
const show = () => {
|
|
5491
|
+
const view = describeOwnerAccess(ownerAccessReading, { tx: kit.tx });
|
|
5492
|
+
paint(view.on);
|
|
5493
|
+
if (btn) btn.disabled = view.disabled;
|
|
5494
|
+
row?.classList.toggle('uc-disabled', view.disabled);
|
|
5495
|
+
if (notes) notes.innerHTML = userContextNotesHTML([...(view.note ? [view.note] : []), ...(view.warning ? [{ text: view.warning, tone: 'warn' }] : [])]);
|
|
5496
|
+
};
|
|
5497
|
+
let saves = Promise.resolve();
|
|
5498
|
+
btn?.addEventListener('click', () => {
|
|
5499
|
+
if (ownerAccessReading.state !== 'ready') return;
|
|
5500
|
+
const enabled = !ownerAccessReading.enabled;
|
|
5501
|
+
setStatus('');
|
|
5502
|
+
paint(enabled);
|
|
5503
|
+
btn.style.opacity = '0.4';
|
|
5504
|
+
saves = saves.then(async () => {
|
|
5505
|
+
let failure = null;
|
|
5506
|
+
try {
|
|
5507
|
+
const res = await fetch('/api/assistant/automation-browser-owner-access', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ enabled }) });
|
|
5508
|
+
const body = await res.json().catch(() => null);
|
|
5509
|
+
const reading = readOwnerAccessResponse({ status: res.status, body });
|
|
5510
|
+
if (res.ok && reading.state === 'ready') ownerAccessReading = reading;
|
|
5511
|
+
else failure = { status: res.status, body };
|
|
5512
|
+
} catch (err) {
|
|
5513
|
+
failure = { status: 0, error: err?.message };
|
|
5514
|
+
}
|
|
5515
|
+
btn.style.opacity = '';
|
|
5516
|
+
show();
|
|
5517
|
+
if (failure) setStatus(describeOwnerAccessSaveFailure({ ...failure, enabled }, { tx: kit.tx }));
|
|
5518
|
+
});
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5124
5521
|
// Protect workers: the choice is saved at once and follows the server's answer; a save that failed puts the
|
|
5125
5522
|
// dropdown back where it was, with the reason under it. Saves go one after the other, in the order of the picks.
|
|
5126
5523
|
{
|
|
@@ -6060,7 +6457,11 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6060
6457
|
|
|
6061
6458
|
// ── Connection mode (mirror / attach / MoreLogin) ──
|
|
6062
6459
|
let _moreloginDesiredEnvId = '';
|
|
6063
|
-
|
|
6460
|
+
let _moreloginBrowsersTimer = null;
|
|
6461
|
+
let _moreloginBrowsersTries = 0;
|
|
6462
|
+
// keepShown: a redraw of the list (the quiet ask again, a change of the choice) keeps what the picker shows;
|
|
6463
|
+
// without it the saved default is put back, as on open and on Refresh.
|
|
6464
|
+
async function loadMoreLoginEnvs(keepShown = false) {
|
|
6064
6465
|
const sel = overlay.querySelector('#bc-morelogin-env-id');
|
|
6065
6466
|
// A placeholder choice (loading / error / not running) keeps its reason visible in the closed dropdown.
|
|
6066
6467
|
const only = (key) => setDropdownItems(sel, [{ value: '', label: kit.tx(key), selected: true }]);
|
|
@@ -6069,12 +6470,24 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6069
6470
|
try {
|
|
6070
6471
|
const r = await fetch('/api/browser/morelogin-envs');
|
|
6071
6472
|
const d = await r.json();
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6473
|
+
// SynaBun's own local profiles (`kind: 'local'`) are in every answer, whatever MoreLogin does: with one or
|
|
6474
|
+
// more, the picker lists them and the line under it says why MoreLogin's are missing.
|
|
6475
|
+
const localEnvs = (d && Array.isArray(d.envs) ? d.envs : []).filter(e => e && e.kind === 'local');
|
|
6476
|
+
let moreloginNote = '';
|
|
6477
|
+
// With a local profile to list, MoreLogin's state is a note under the picker; without one it is the picker's
|
|
6478
|
+
// only choice, as before. → true when the picker was filled with the reason (nothing more to draw).
|
|
6479
|
+
const without = (message, placeholder) => {
|
|
6480
|
+
if (localEnvs.length) { moreloginNote = message; return false; }
|
|
6481
|
+
placeholder();
|
|
6482
|
+
if (statusEl) statusEl.textContent = message;
|
|
6483
|
+
return true;
|
|
6484
|
+
};
|
|
6485
|
+
if (!d || d.ok === false) { if (without((d && d.error) || kit.tx('settings.redesign.browser.failedToLoadMoreloginProfiles'), () => only('settings.redesign.browser.error'))) return; }
|
|
6486
|
+
else if (!d.installed) { if (without(kit.tx('settings.redesign.browser.moreloginDesktopAppIsNotInstalled') + ' ' + kit.tx('settings.redesign.browser.moreloginCustomPathHint'), () => only('settings.redesign.browser.moreloginNotInstalled'))) return; }
|
|
6487
|
+
else if (!d.running) { if (without(kit.tx('settings.redesign.browser.moreloginNotRunningOpenTheApp', { port: d.port }) + (d.error ? ' ' + String(d.error) : ''), () => only('settings.redesign.browser.startMorelogin'))) return; }
|
|
6488
|
+
const envs = moreloginNote ? localEnvs : (d.envs || []);
|
|
6076
6489
|
if (!envs.length) { only('settings.redesign.browser.noProfiles'); if (statusEl) statusEl.textContent = kit.tx('settings.redesign.browser.noMoreloginProfilesYetOneIs'); return; }
|
|
6077
|
-
const want = _moreloginDesiredEnvId || sel.value || '';
|
|
6490
|
+
const want = (keepShown === true && sel.value) || _moreloginDesiredEnvId || sel.value || '';
|
|
6078
6491
|
// Show each env's proxy — without it there is no way to tell from SynaBun
|
|
6079
6492
|
// whether a profile's traffic leaves the machine.
|
|
6080
6493
|
const proxyLabel = (p) => {
|
|
@@ -6082,11 +6495,27 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6082
6495
|
const where = [p.host, p.port].filter(Boolean).join(':');
|
|
6083
6496
|
return ` · ${[p.type, where, p.country].filter(Boolean).join(' ')}`;
|
|
6084
6497
|
};
|
|
6498
|
+
// SynaBun drives the profile over CDP, so a Firefox-type one (`browser` from the server; absent = not known)
|
|
6499
|
+
// is listed, said as such and cannot be picked. One already saved as the default stays shown, with a warning.
|
|
6085
6500
|
// dropdownHTML escapes the labels itself.
|
|
6086
|
-
setDropdownItems(sel, envs.map(e => (
|
|
6501
|
+
setDropdownItems(sel, envs.map(e => (e.browser === 'firefox'
|
|
6502
|
+
? { value: String(e.id), label: kit.tx('settings.redesign.browser.moreloginFirefoxOption', { name: String(e.name ?? e.id) }), disabled: true }
|
|
6503
|
+
: { value: String(e.id), label: `${e.kind === 'local' ? kit.tx('settings.redesign.browser.moreloginLocalOption', { name: String(e.name ?? e.id) }) : (e.name ?? '')}${e.status ? ` (${String(e.status)})` : ''}${proxyLabel(e.proxy)}` })));
|
|
6087
6504
|
if (want && envs.some(e => String(e.id) === String(want))) setDropdownValue(sel, String(want));
|
|
6505
|
+
const chosenFirefox = envs.some(e => String(e.id) === String(sel.value) && e.browser === 'firefox');
|
|
6506
|
+
if (statusEl) statusEl.style.color = chosenFirefox ? 'var(--stg-warn)' : '';
|
|
6507
|
+
// The server is still asking MoreLogin which browser some profiles run: ask again quietly, a few times.
|
|
6508
|
+
clearTimeout(_moreloginBrowsersTimer);
|
|
6509
|
+
if (Number(d.browsersPending) > 0 && _moreloginBrowsersTries < 8 && sel.isConnected) {
|
|
6510
|
+
_moreloginBrowsersTries += 1;
|
|
6511
|
+
_moreloginBrowsersTimer = setTimeout(() => loadMoreLoginEnvs(true), 2500);
|
|
6512
|
+
} else _moreloginBrowsersTries = 0;
|
|
6088
6513
|
if (statusEl) {
|
|
6089
|
-
let msg =
|
|
6514
|
+
let msg = chosenFirefox
|
|
6515
|
+
? kit.tx('settings.redesign.browser.moreloginFirefoxDefault')
|
|
6516
|
+
: (moreloginNote
|
|
6517
|
+
? kit.tx('settings.redesign.browser.localProfilesOnly', { count: envs.length }) + ' ' + moreloginNote
|
|
6518
|
+
: kit.tx('settings.redesign.browser.profileSApiPort', { count: envs.length, port: d.port }));
|
|
6090
6519
|
// MoreLogin silently redirects a navigation it refuses to its stop page: a
|
|
6091
6520
|
// localhost port missing from the profile's Port scan protection list, or a
|
|
6092
6521
|
// host its website blacklist/whitelist refuses. Surface it; nothing else in
|
|
@@ -6148,6 +6577,8 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6148
6577
|
});
|
|
6149
6578
|
}
|
|
6150
6579
|
{ const mlRow = overlay.querySelector('#bc-morelogin-row'); if (mlRow) wireDropdowns(mlRow, { signal: panelLife.signal }); }
|
|
6580
|
+
// Another profile chosen: the line under the picker says what holds for that one (the Firefox warning goes).
|
|
6581
|
+
overlay.querySelector('#bc-morelogin-env-id')?.addEventListener('change', () => loadMoreLoginEnvs(true), { signal: panelLife.signal });
|
|
6151
6582
|
overlay.querySelector('#bc-morelogin-refresh')?.addEventListener('click', (e) => { e.preventDefault(); loadMoreLoginEnvs(); });
|
|
6152
6583
|
const attachSeedDd = overlay.querySelector('.bc-dropdown[data-for="bc-attachSeed"]');
|
|
6153
6584
|
if (attachSeedDd) {
|
|
@@ -6693,8 +7124,12 @@ async function openSettingsModalNow(options = {}) {
|
|
|
6693
7124
|
}
|
|
6694
7125
|
}
|
|
6695
7126
|
|
|
6696
|
-
// Load config on open, then auto-detect profiles
|
|
6697
|
-
fetch('/api/browser/config').then(
|
|
7127
|
+
// Load config on open, then auto-detect profiles. A refused read (no owner access) is "No access", never defaults.
|
|
7128
|
+
fetch('/api/browser/config').then(async (r) => {
|
|
7129
|
+
if (markPaneRefused(overlay, 'browser', await refusalOfResponse(r))) return null;
|
|
7130
|
+
return r.json();
|
|
7131
|
+
}).then(async (data) => {
|
|
7132
|
+
if (!data) return;
|
|
6698
7133
|
if (data.config) { applyBrowserConfig(data.config); syncBcDropdowns(); }
|
|
6699
7134
|
// Show detected path
|
|
6700
7135
|
const hint = overlay.querySelector('#bc-detected-path');
|
|
@@ -7597,6 +8032,10 @@ async function openSettingsModalNow(options = {}) {
|
|
|
7597
8032
|
let _ollamaPollTimer = null;
|
|
7598
8033
|
let _ollamaLastModelNames = '';
|
|
7599
8034
|
let _ollamaConfigureError = '';
|
|
8035
|
+
// ── Maritaca as an OpenCode provider (settings/settings-maritaca-opencode.js decides; this draws) ──
|
|
8036
|
+
let _mtcOcpStatus = null; // the last answer of GET /api/maritaca/opencode/status (null: not asked or failed)
|
|
8037
|
+
let _mtcOcpConfiguring = false; // a configure request in flight
|
|
8038
|
+
let _mtcOcpError = ''; // the message of the last failed configure
|
|
7600
8039
|
let _ocpHistoryStats = null;
|
|
7601
8040
|
|
|
7602
8041
|
function formatBytes(bytes) {
|
|
@@ -7825,6 +8264,153 @@ async function openSettingsModalNow(options = {}) {
|
|
|
7825
8264
|
});
|
|
7826
8265
|
}
|
|
7827
8266
|
|
|
8267
|
+
function renderMaritacaOcpCard() {
|
|
8268
|
+
if (!ocpProvidersEl) return;
|
|
8269
|
+
let card = ocpProvidersEl.querySelector('.stg-maritaca-card');
|
|
8270
|
+
if (!card) {
|
|
8271
|
+
card = document.createElement('div');
|
|
8272
|
+
card.className = 'stg-maritaca-card';
|
|
8273
|
+
const ollama = ocpProvidersEl.querySelector('.stg-ollama-card');
|
|
8274
|
+
if (ollama) ollama.after(card); else ocpProvidersEl.prepend(card);
|
|
8275
|
+
}
|
|
8276
|
+
const K = MARITACA_OPENCODE_KEYS;
|
|
8277
|
+
const tr = (key, vars) => kit.tx(`settings.redesign.opencode.${key}`, vars);
|
|
8278
|
+
const view = maritacaOpencodeCardView(_mtcOcpStatus, tr, { configuring: _mtcOcpConfiguring, error: _mtcOcpError });
|
|
8279
|
+
const count = view.modelCount;
|
|
8280
|
+
// Per-model visibility: the same denylist and markup as the other provider cards (ocp-hidden-models.js).
|
|
8281
|
+
const wasOpen = card.querySelector('.stg-model-list')?.style.display === '';
|
|
8282
|
+
const ocMaritaca = (Array.isArray(_ocpProviders) ? _ocpProviders : []).find((p) => p?.id === MARITACA_OPENCODE_PROVIDER);
|
|
8283
|
+
const modelRows = maritacaOpencodeModelRows(_mtcOcpStatus, getOcpHiddenModels(), ocMaritaca ? extractModels(ocMaritaca) : []);
|
|
8284
|
+
const expandHtml = modelRows.total ? `<button type="button" class="stg-model-expand-btn" data-provider="${MARITACA_OPENCODE_PROVIDER}" aria-expanded="${wasOpen ? 'true' : 'false'}">
|
|
8285
|
+
<svg class="stg-model-expand-icon" viewBox="0 0 24 24" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>
|
|
8286
|
+
<span class="stg-model-count-badge">${esc(modelsShownLabel(modelRows.enabled, modelRows.total))}</span>
|
|
8287
|
+
</button>` : '';
|
|
8288
|
+
const toolsLabel = kit.tx('settings.redesign.opencode.tools');
|
|
8289
|
+
const modelListHtml = modelRows.total ? `<div class="stg-model-list" data-provider="${MARITACA_OPENCODE_PROVIDER}" style="${wasOpen ? '' : 'display:none'}">
|
|
8290
|
+
<div class="stg-model-list-actions">
|
|
8291
|
+
<span class="stg-model-list-count">${esc(kit.tx(modelRows.total === 1 ? 'settings.redesign.opencode.modelCount.one' : 'settings.redesign.opencode.modelCount.other', { count: modelRows.total }))}</span>
|
|
8292
|
+
<button type="button" class="stg-action-btn compact stg-text-btn stg-model-all-btn" data-provider="${MARITACA_OPENCODE_PROVIDER}">${kit.te('settings.redesign.opencode.enableAll')}</button>
|
|
8293
|
+
<button type="button" class="stg-action-btn compact stg-text-btn stg-model-none-btn" data-provider="${MARITACA_OPENCODE_PROVIDER}">${kit.te('settings.redesign.opencode.disableAll')}</button>
|
|
8294
|
+
</div>
|
|
8295
|
+
${modelRows.rows.map((r) => `<label class="stg-model-toggle${r.hidden ? ' disabled' : ''}" data-full-id="${esc(r.fullId)}" title="${esc(r.name)}">
|
|
8296
|
+
<input type="checkbox" ${r.hidden ? '' : 'checked'} data-model-full-id="${esc(r.fullId)}">
|
|
8297
|
+
<span class="stg-model-toggle-name">${esc(r.id)}</span>
|
|
8298
|
+
${r.tools ? `<span class="stg-model-toggle-caps"><span class="stg-cap">${esc(toolsLabel)}</span></span>` : ''}
|
|
8299
|
+
</label>`).join('')}
|
|
8300
|
+
</div>` : '';
|
|
8301
|
+
const bodyHtml = view.state === 'registered'
|
|
8302
|
+
? `${expandHtml}<div class="stg-provider-toolbar"><span class="stg-provider-tag">${esc(view.tag)}</span><span class="stg-provider-sep">·</span><span class="stg-provider-submeta">${count} ${kit.te('settings.redesign.opencode.model')}${count !== 1 ? 's' : ''}</span></div>`
|
|
8303
|
+
: `${expandHtml}<div class="stg-provider-note">${esc(view.note)}</div>`;
|
|
8304
|
+
const actionHtml = view.actions.map((action) => {
|
|
8305
|
+
if (action === 'open-panel') return `<button type="button" class="stg-action-btn compact stg-text-btn stg-maritaca-open-panel" data-action="open-panel">${esc(tr(K.openPanel))}</button>`;
|
|
8306
|
+
if (action === 'configure') return `<button type="button" class="stg-action-btn compact stg-maritaca-configure" data-action="configure">${esc(tr(K.configure))}</button>`;
|
|
8307
|
+
if (action === 'resync') return `<button type="button" class="stg-action-btn compact stg-maritaca-configure" data-action="resync">${esc(tr(K.resync))}</button>`;
|
|
8308
|
+
return `<button type="button" class="stg-action-btn compact stg-text-btn stg-text-btn-danger stg-maritaca-remove stg-ocp-remove-btn" data-action="remove">${esc(tr(K.remove))}</button>`;
|
|
8309
|
+
}).join('');
|
|
8310
|
+
card.dataset.state = view.state;
|
|
8311
|
+
card.innerHTML = `<div class="stg-provider-card" style="--prov-accent:${view.dot}">
|
|
8312
|
+
<div class="stg-provider-head">
|
|
8313
|
+
<div class="stg-provider-ident">
|
|
8314
|
+
<span class="stg-provider-name">Maritaca <span class="stg-provider-subname">${esc(tr(K.subname))}</span></span>
|
|
8315
|
+
${bodyHtml}
|
|
8316
|
+
</div>
|
|
8317
|
+
<div class="stg-provider-side">
|
|
8318
|
+
<span class="stg-provider-status ${view.statusCls}">${esc(view.statusText)}</span>
|
|
8319
|
+
${actionHtml}
|
|
8320
|
+
</div>
|
|
8321
|
+
</div>
|
|
8322
|
+
${modelListHtml}
|
|
8323
|
+
</div>`;
|
|
8324
|
+
card.querySelector('.stg-maritaca-open-panel')?.addEventListener('click', () => {
|
|
8325
|
+
// The key is saved in the Maritaca panel (its cog): the toolbar button opens it.
|
|
8326
|
+
document.getElementById('topright-maritaca-panel-btn')?.click();
|
|
8327
|
+
});
|
|
8328
|
+
card.querySelector('.stg-maritaca-configure')?.addEventListener('click', () => configureMaritacaOcp());
|
|
8329
|
+
// Model toggles: the same save and event as the other cards; hidden ids are "maritaca/<id>".
|
|
8330
|
+
const updateMaritacaBadge = () => {
|
|
8331
|
+
const boxes = [...card.querySelectorAll('.stg-model-toggle input[type="checkbox"]')];
|
|
8332
|
+
const badge = card.querySelector('.stg-model-count-badge');
|
|
8333
|
+
if (badge) badge.textContent = modelsShownLabel(boxes.filter((c) => c.checked).length, boxes.length);
|
|
8334
|
+
};
|
|
8335
|
+
card.querySelectorAll('.stg-model-toggle input[type="checkbox"]').forEach((cb) => {
|
|
8336
|
+
cb.addEventListener('change', () => {
|
|
8337
|
+
const fullId = cb.dataset.modelFullId;
|
|
8338
|
+
if (!fullId) return;
|
|
8339
|
+
const hidden = getOcpHiddenModels();
|
|
8340
|
+
if (cb.checked) hidden.delete(fullId); else hidden.add(fullId);
|
|
8341
|
+
saveOcpHiddenModels(hidden);
|
|
8342
|
+
cb.closest('.stg-model-toggle')?.classList.toggle('disabled', !cb.checked);
|
|
8343
|
+
updateMaritacaBadge();
|
|
8344
|
+
document.dispatchEvent(new CustomEvent('ocp-hidden-models-changed'));
|
|
8345
|
+
});
|
|
8346
|
+
});
|
|
8347
|
+
for (const [sel, show] of [['.stg-model-all-btn', true], ['.stg-model-none-btn', false]]) {
|
|
8348
|
+
card.querySelector(sel)?.addEventListener('click', () => {
|
|
8349
|
+
const hidden = getOcpHiddenModels();
|
|
8350
|
+
card.querySelectorAll('.stg-model-toggle input[type="checkbox"]').forEach((cb) => {
|
|
8351
|
+
const fullId = cb.dataset.modelFullId;
|
|
8352
|
+
if (fullId) { if (show) hidden.delete(fullId); else hidden.add(fullId); }
|
|
8353
|
+
cb.checked = show;
|
|
8354
|
+
cb.closest('.stg-model-toggle')?.classList.toggle('disabled', !show);
|
|
8355
|
+
});
|
|
8356
|
+
saveOcpHiddenModels(hidden);
|
|
8357
|
+
updateMaritacaBadge();
|
|
8358
|
+
document.dispatchEvent(new CustomEvent('ocp-hidden-models-changed'));
|
|
8359
|
+
});
|
|
8360
|
+
}
|
|
8361
|
+
if (modelRows.total) card.querySelector('.stg-provider-card').style.cursor = 'pointer';
|
|
8362
|
+
card.querySelector('.stg-maritaca-remove')?.addEventListener('click', async () => {
|
|
8363
|
+
const btn = card.querySelector('.stg-maritaca-remove');
|
|
8364
|
+
if (btn) { btn.disabled = true; btn.textContent = tr(K.removing); }
|
|
8365
|
+
try {
|
|
8366
|
+
const resp = await fetch('/api/maritaca/opencode/configure', { method: 'DELETE' });
|
|
8367
|
+
const data = await resp.json().catch(() => ({}));
|
|
8368
|
+
if (!resp.ok || data.ok === false) throw new Error(data.error || `HTTP ${resp.status}`);
|
|
8369
|
+
_mtcOcpStatus = data; _mtcOcpError = '';
|
|
8370
|
+
renderMaritacaOcpCard();
|
|
8371
|
+
showCCToast(tr(K.removedToast));
|
|
8372
|
+
await refreshOcpProviders();
|
|
8373
|
+
document.dispatchEvent(new CustomEvent('ocp-providers-changed'));
|
|
8374
|
+
} catch (e) {
|
|
8375
|
+
showCCToast(tr(K.error, { message: e.message }));
|
|
8376
|
+
if (btn) { btn.disabled = false; btn.textContent = tr(K.remove); }
|
|
8377
|
+
}
|
|
8378
|
+
});
|
|
8379
|
+
}
|
|
8380
|
+
|
|
8381
|
+
async function configureMaritacaOcp() {
|
|
8382
|
+
if (_mtcOcpConfiguring) return;
|
|
8383
|
+
_mtcOcpConfiguring = true; _mtcOcpError = '';
|
|
8384
|
+
renderMaritacaOcpCard();
|
|
8385
|
+
try {
|
|
8386
|
+
const resp = await fetch('/api/maritaca/opencode/configure', { method: 'POST' });
|
|
8387
|
+
const data = await resp.json().catch(() => ({}));
|
|
8388
|
+
_mtcOcpConfiguring = false;
|
|
8389
|
+
if (!resp.ok || data.ok === false) throw new Error(data.error || `HTTP ${resp.status}`);
|
|
8390
|
+
_mtcOcpStatus = data;
|
|
8391
|
+
renderMaritacaOcpCard();
|
|
8392
|
+
showCCToast(kit.tx(`settings.redesign.opencode.${MARITACA_OPENCODE_KEYS.registeredToast}`, { count: data.modelsConfigured ?? data.modelCount ?? 0 }));
|
|
8393
|
+
// OpenCode reads the provider at once: its models are listed now.
|
|
8394
|
+
await refreshOcpProviders();
|
|
8395
|
+
document.dispatchEvent(new CustomEvent('ocp-providers-changed'));
|
|
8396
|
+
} catch (e) {
|
|
8397
|
+
_mtcOcpConfiguring = false;
|
|
8398
|
+
_mtcOcpError = e.message || 'error';
|
|
8399
|
+
renderMaritacaOcpCard();
|
|
8400
|
+
}
|
|
8401
|
+
}
|
|
8402
|
+
|
|
8403
|
+
async function refreshMaritacaOcp() {
|
|
8404
|
+
try {
|
|
8405
|
+
const resp = await fetch('/api/maritaca/opencode/status');
|
|
8406
|
+
const data = await resp.json().catch(() => null);
|
|
8407
|
+
_mtcOcpStatus = resp.ok && data && data.ok !== false ? data : null;
|
|
8408
|
+
} catch {
|
|
8409
|
+
_mtcOcpStatus = null;
|
|
8410
|
+
}
|
|
8411
|
+
if (!_mtcOcpConfiguring) renderMaritacaOcpCard();
|
|
8412
|
+
}
|
|
8413
|
+
|
|
7828
8414
|
async function ollamaDetectAndConfigure() {
|
|
7829
8415
|
try {
|
|
7830
8416
|
// Fetch status, models, and config state in parallel
|
|
@@ -7886,7 +8472,8 @@ async function openSettingsModalNow(options = {}) {
|
|
|
7886
8472
|
function startOllamaPoll() {
|
|
7887
8473
|
stopOllamaPoll();
|
|
7888
8474
|
ollamaDetectAndConfigure();
|
|
7889
|
-
|
|
8475
|
+
refreshMaritacaOcp();
|
|
8476
|
+
_ollamaPollTimer = setInterval(() => { ollamaDetectAndConfigure(); refreshMaritacaOcp(); }, 10000);
|
|
7890
8477
|
}
|
|
7891
8478
|
|
|
7892
8479
|
function stopOllamaPoll() {
|
|
@@ -8030,8 +8617,8 @@ async function openSettingsModalNow(options = {}) {
|
|
|
8030
8617
|
return;
|
|
8031
8618
|
}
|
|
8032
8619
|
|
|
8033
|
-
// Exclude Ollama —
|
|
8034
|
-
const filtered = providerCatalog.filter(p => p.id !== 'ollama');
|
|
8620
|
+
// Exclude Ollama and Maritaca — each has its own dedicated card (renderOllamaCard, renderMaritacaOcpCard)
|
|
8621
|
+
const filtered = providerCatalog.filter(p => p.id !== 'ollama' && p.id !== 'maritaca');
|
|
8035
8622
|
|
|
8036
8623
|
// Sort: connected first, then stored-key, then alphabetical
|
|
8037
8624
|
const sorted = [...filtered].sort((a, b) => {
|
|
@@ -8223,6 +8810,8 @@ async function openSettingsModalNow(options = {}) {
|
|
|
8223
8810
|
} else {
|
|
8224
8811
|
ocpProvidersEl.innerHTML = cardsHtml || emptyHtml;
|
|
8225
8812
|
}
|
|
8813
|
+
// The list was rebuilt: the Maritaca card is drawn again at once (the Ollama card returns with its poll).
|
|
8814
|
+
if (_mtcOcpStatus || _mtcOcpConfiguring || _mtcOcpError) renderMaritacaOcpCard();
|
|
8226
8815
|
|
|
8227
8816
|
// Wire model capability tooltips
|
|
8228
8817
|
ocpProvidersEl.querySelectorAll('.stg-model-hover[data-model-id]').forEach(span => {
|
|
@@ -8523,7 +9112,7 @@ async function openSettingsModalNow(options = {}) {
|
|
|
8523
9112
|
if (ocpProvidersEl) {
|
|
8524
9113
|
ocpProvidersEl.addEventListener('click', (e) => {
|
|
8525
9114
|
// Skip clicks on action buttons, inputs, expanded content
|
|
8526
|
-
if (e.target.closest('.stg-ocp-remove-btn, .stg-ocp-apikey-btn, .stg-ocp-oauth-btn, .stg-model-all-btn, .stg-model-none-btn, input, label, .stg-model-list, .stg-ocp-key-form, .stg-ocp-oauth-wait, .stg-ocp-toggle-all')) return;
|
|
9115
|
+
if (e.target.closest('.stg-ocp-remove-btn, .stg-ocp-apikey-btn, .stg-ocp-oauth-btn, .stg-model-all-btn, .stg-model-none-btn, input, label, .stg-model-list, .stg-ocp-key-form, .stg-ocp-oauth-wait, .stg-ocp-toggle-all, .stg-maritaca-configure, .stg-maritaca-open-panel')) return;
|
|
8527
9116
|
const card = e.target.closest('.stg-provider-card');
|
|
8528
9117
|
if (!card) return;
|
|
8529
9118
|
const list = card.querySelector('.stg-model-list');
|
|
@@ -8639,11 +9228,14 @@ async function openSettingsModalNow(options = {}) {
|
|
|
8639
9228
|
const servers = { ...(_mcpRegistry.servers || {}) };
|
|
8640
9229
|
for (const row of _settingsToolCatalog?.servers || []) { const name = row.ref.slice(4); if (!servers[name]) servers[name] = { type: toolWord('configuredExternally'), discovered: true }; }
|
|
8641
9230
|
const entries = Object.entries(servers).filter(([, info]) => !info.builtin);
|
|
9231
|
+
// A provider whose MCP configuration could not be read is named, never shown as having no servers.
|
|
9232
|
+
const unreadable = toolServersNote(_settingsToolCatalog);
|
|
9233
|
+
const unreadableNote = unreadable ? `<div class="stg-mcp-empty-note" role="status" data-mcp-unreadable>${esc(unreadable)}</div>` : '';
|
|
8642
9234
|
if (!entries.length) {
|
|
8643
|
-
el.innerHTML = '<div class="stg-mcp-empty-note">' + kit.te('settings.redesign.mcp.noExternalServersConfigured') + '</div>';
|
|
9235
|
+
el.innerHTML = unreadableNote + '<div class="stg-mcp-empty-note">' + kit.te('settings.redesign.mcp.noExternalServersConfigured') + '</div>';
|
|
8644
9236
|
return;
|
|
8645
9237
|
}
|
|
8646
|
-
el.innerHTML = entries.map(([name, info]) =>
|
|
9238
|
+
el.innerHTML = unreadableNote + entries.map(([name, info]) =>
|
|
8647
9239
|
`<div class="stg-mx-ext-row">
|
|
8648
9240
|
<div class="stg-mx-ext-main">
|
|
8649
9241
|
<span class="stg-mx-ext-dot"></span>
|
|
@@ -9589,10 +10181,52 @@ async function openSettingsModalNow(options = {}) {
|
|
|
9589
10181
|
sources: SEARCH_ROW_SOURCES,
|
|
9590
10182
|
off: SEARCH_OFF,
|
|
9591
10183
|
});
|
|
10184
|
+
// ── No owner access: the panes whose reads were refused say so (after they wired, which may enable controls) ──
|
|
10185
|
+
markRefusedPanes(overlay, refusedReads);
|
|
9592
10186
|
// A deep link's `expand` wins over anything a pane collapsed while it wired itself.
|
|
9593
10187
|
applySettingsOpenOptions(overlay, options, { quiet: true });
|
|
9594
10188
|
}
|
|
9595
10189
|
|
|
10190
|
+
// ── No owner access (ui-owner-access.js) ──
|
|
10191
|
+
// Which panes each of Settings' reads (settings/settings-data.js SETTINGS_READS) fills. A pane whose read the server
|
|
10192
|
+
// refused this page shows "No access" on top and its Save and actions disabled, instead of defaults that look saved.
|
|
10193
|
+
const SETTINGS_READ_PANES = Object.freeze({
|
|
10194
|
+
settings: ['server'],
|
|
10195
|
+
connections: ['collections'],
|
|
10196
|
+
integrations: ['projects'],
|
|
10197
|
+
skills: ['skills'],
|
|
10198
|
+
setup: ['setup'],
|
|
10199
|
+
cli: ['terminal'],
|
|
10200
|
+
toolPermissions: ['permissions', 'social'],
|
|
10201
|
+
discord: ['discord'],
|
|
10202
|
+
youtube: ['youtube'],
|
|
10203
|
+
typesafe: ['judgments'],
|
|
10204
|
+
});
|
|
10205
|
+
|
|
10206
|
+
/** The owner refusal one of Settings' reads stands for (a rejected read, or a raw read's 403 body), or null. */
|
|
10207
|
+
function settingsReadRefusal(entry) {
|
|
10208
|
+
if (!entry) return null;
|
|
10209
|
+
if (entry.status === 'rejected') return refusalOfError(entry.reason);
|
|
10210
|
+
const value = entry.value;
|
|
10211
|
+
if (value && typeof value === 'object' && 'status' in value && 'body' in value) return readOwnerAccessRefusal(value.status, value.body);
|
|
10212
|
+
return null;
|
|
10213
|
+
}
|
|
10214
|
+
|
|
10215
|
+
function markRefusedPanes(overlay, refusedReads) {
|
|
10216
|
+
for (const name of refusedReads) {
|
|
10217
|
+
for (const paneId of SETTINGS_READ_PANES[name] || []) markNoAccess(kit.paneOf(overlay, paneId));
|
|
10218
|
+
}
|
|
10219
|
+
}
|
|
10220
|
+
|
|
10221
|
+
/** A pane that loads itself (Browser, MoreLogin): its read refused → "No access" and the nav item says so. */
|
|
10222
|
+
function markPaneRefused(overlay, paneId, refusal) {
|
|
10223
|
+
if (!refusal) return false;
|
|
10224
|
+
noteOwnerAccessRefusal(refusal);
|
|
10225
|
+
markNoAccess(kit.paneOf(overlay, paneId));
|
|
10226
|
+
kit.setNavStatus(overlay, paneId, 'refused');
|
|
10227
|
+
return true;
|
|
10228
|
+
}
|
|
10229
|
+
|
|
9596
10230
|
|
|
9597
10231
|
// ═══════════════════════════════════════════
|
|
9598
10232
|
// MEMORY SYNC
|