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
|
@@ -19,6 +19,8 @@ import { getSessionPolicy, requiresHumanApproval } from './remote-policy.js';
|
|
|
19
19
|
import { clampPlanDispatch, PLAN_DISPATCH_NOTE, runCanChangeCode } from './assistant-plan-permissions.js';
|
|
20
20
|
import { noStore, requireJson, requireLocal, requireLocalHost, sendGuardError } from './http-guards.js';
|
|
21
21
|
import { setUntrustedFileHeaders } from './untrusted-file-headers.js';
|
|
22
|
+
import { PEER_VERDICT, peerAuthority } from './peer-identity.js';
|
|
23
|
+
import { sendPeerUnavailable } from './owner-authority.js';
|
|
22
24
|
|
|
23
25
|
/** The header whatsapp_send_file's caller proves it is the WhatsApp conversation's own brain with (assistant-runtime.js BRAIN_CREDENTIAL_RE). */
|
|
24
26
|
export const BRAIN_CREDENTIAL_HEADER = 'x-synabun-brain-token';
|
|
@@ -157,9 +159,16 @@ export function createAssistantApi({
|
|
|
157
159
|
adminSandbox = null,
|
|
158
160
|
// Protect workers (lib/worker-guard-setting.js): what capability read-only / workspace means for every worker.
|
|
159
161
|
workerGuard = null,
|
|
162
|
+
// Let the automation browser act as owner (lib/automation-browser-owner-access.js): the owner's page only.
|
|
163
|
+
automationBrowserOwnerAccess = null,
|
|
160
164
|
// The page secret (lib/page-session.js): a request without an agent pin is the owner's page only when it carries
|
|
161
165
|
// this boot's cookie; a local process that merely sends no headers is nobody (never 'ui').
|
|
162
166
|
pageSession = null,
|
|
167
|
+
// Whether a pin counts (lib/terminal-tokens.js verdict, server.js): (pin, req) → { accepted, code, error, httpStatus }.
|
|
168
|
+
// A pin SynaBun gave a proof to (a run's terminal token, a brain's launch credential) counts only with it: a request
|
|
169
|
+
// that names a worker's run, or a brain's id, without it is refused (403 TERMINAL_TOKEN_REQUIRED / _INVALID) instead
|
|
170
|
+
// of reading that run as its own worker. Without it (a test, an older host) every pin is taken as it is said.
|
|
171
|
+
terminalVerdict = null,
|
|
163
172
|
} = {}) {
|
|
164
173
|
if (!dispatcher) throw new Error('createAssistantApi requires a dispatcher');
|
|
165
174
|
const router = Router();
|
|
@@ -182,10 +191,18 @@ export function createAssistantApi({
|
|
|
182
191
|
const bodySession = req.body?.assistantSessionId || req.body?.assistant_session_id || req.query?.assistantSessionId || null;
|
|
183
192
|
if (!pin) {
|
|
184
193
|
// The page: this boot's page secret cookie (the browser sends it by itself). Without a page session wired
|
|
185
|
-
// (a test, an older host) every pinless request is the page, as before.
|
|
194
|
+
// (a test, an older host) every pinless request is the page, as before. A request whose peer could not be
|
|
195
|
+
// identified (macOS, the lookup failed) never verifies: it is nobody here, and its refusals say 503
|
|
196
|
+
// PEER_UNAVAILABLE (uiOnly, refuseRunRead) rather than a 403 the page could not cure.
|
|
186
197
|
if (pageSession && typeof pageSession.verify === 'function' && !pageSession.verify(req)) return { kind: 'unknown', assistantSessionId: bodySession ? String(bodySession) : null, pin: '', pageless: true };
|
|
187
198
|
return { kind: 'ui', assistantSessionId: bodySession ? String(bodySession) : null };
|
|
188
199
|
}
|
|
200
|
+
// The pin counts only with its proof: a forged one names nobody here, not even for attribution.
|
|
201
|
+
let verdict = null;
|
|
202
|
+
try { verdict = typeof terminalVerdict === 'function' ? terminalVerdict(pin, req) : null; } catch { verdict = { accepted: false, code: 'TERMINAL_TOKEN_INVALID', error: 'The run this request names could not be checked.', httpStatus: 403 }; }
|
|
203
|
+
if (verdict && verdict.accepted === false) {
|
|
204
|
+
return { kind: 'refused', forbidden: true, pin, refusal: { status: Number(verdict.httpStatus) || 403, code: String(verdict.code || 'TERMINAL_TOKEN_INVALID'), error: String(verdict.error || 'This request names a run it cannot prove it is.') } };
|
|
205
|
+
}
|
|
189
206
|
if (dispatcher.get(pin)) return { kind: 'worker', forbidden: true, pin };
|
|
190
207
|
// The session a request claims, for attribution once a credential has proven it a brain: a Claude brain's
|
|
191
208
|
// pin resolves to its session; the OpenCode brain pins assistant-oc-<24> (never taken as an id) and names
|
|
@@ -229,6 +246,7 @@ export function createAssistantApi({
|
|
|
229
246
|
}
|
|
230
247
|
function orchestrationGuard(req, res, next) {
|
|
231
248
|
const caller = callerContext(req);
|
|
249
|
+
if (caller.refusal) return refusePin(res, caller.refusal);
|
|
232
250
|
if (caller.forbidden) return res.status(403).json({ ok: false, code: 'AGENTS_NOT_PERMITTED', error: 'Dispatched workers cannot orchestrate other agents.' });
|
|
233
251
|
// The user's own page (this boot's page secret cookie): the only caller that orchestrates without being a brain.
|
|
234
252
|
if (caller.kind === 'ui') { req.assistantCaller = caller; return next(); }
|
|
@@ -238,7 +256,7 @@ export function createAssistantApi({
|
|
|
238
256
|
// `X-Synabun-Terminal: assistant-*` header, or a real live session id, used to pass here as the brain.
|
|
239
257
|
const brain = brainCaller(req);
|
|
240
258
|
if (brain) { req.assistantCaller = brain; return next(); }
|
|
241
|
-
return
|
|
259
|
+
return uiOnly(req, res, 'Orchestration is the user\'s (from SynaBun\'s own page) and the Assistant\'s brain\'s: this request is neither (no page secret, no brain launch credential a live session knows).');
|
|
242
260
|
}
|
|
243
261
|
/**
|
|
244
262
|
* The caller when it is an assistant brain, else null. The one proof is the per-launch credential
|
|
@@ -255,6 +273,8 @@ export function createAssistantApi({
|
|
|
255
273
|
try { session = runtime?.sessionForBrainCredential?.(req.get('x-synabun-brain-token')) || null; } catch { session = null; }
|
|
256
274
|
if (!session) return null;
|
|
257
275
|
const caller = req.assistantCaller || callerContext(req);
|
|
276
|
+
// A pin the request cannot prove (another brain's, a worker's, an ended one) is refused, credential or not.
|
|
277
|
+
if (caller.refusal) return null;
|
|
258
278
|
return { ...caller, kind: 'assistant', assistantSessionId: String(session), credentialed: true };
|
|
259
279
|
}
|
|
260
280
|
/**
|
|
@@ -278,9 +298,34 @@ export function createAssistantApi({
|
|
|
278
298
|
if (caller.kind === 'worker' && caller.pin && String(caller.pin) === String(runId)) return true;
|
|
279
299
|
return false;
|
|
280
300
|
}
|
|
281
|
-
|
|
301
|
+
/**
|
|
302
|
+
* The request's peer could not be identified (lib/peer-identity.js, macOS: the lookup failed), so neither the page
|
|
303
|
+
* secret nor a brain credential could count: the peer verdict's own reading (peerAuthority), or the page session's
|
|
304
|
+
* (a request that carries the secret and was never identified). → { retryable, reason } or null.
|
|
305
|
+
*/
|
|
306
|
+
function peerDown(req) {
|
|
307
|
+
const auth = peerAuthority(req?.[PEER_VERDICT]);
|
|
308
|
+
if (auth.decision === 'unavailable') return auth;
|
|
309
|
+
try { return typeof pageSession?.peerUnavailable === 'function' ? (pageSession.peerUnavailable(req) || null) : null; } catch { return null; }
|
|
310
|
+
}
|
|
311
|
+
/** "Only the owner's page": 403 UI_ONLY, or 503 PEER_UNAVAILABLE when the caller could not be identified (a reload,
|
|
312
|
+
* or the brain's retry, may cure that; a refusal would not). */
|
|
313
|
+
function uiOnly(req, res, error) {
|
|
314
|
+
const down = peerDown(req);
|
|
315
|
+
if (down) return sendPeerUnavailable(res, req, down);
|
|
316
|
+
return res.status(403).json({ ok: false, code: 'UI_ONLY', error });
|
|
317
|
+
}
|
|
318
|
+
function refuseRunRead(req, res) {
|
|
319
|
+
const down = peerDown(req);
|
|
320
|
+
if (down) return sendPeerUnavailable(res, req, down);
|
|
321
|
+
const refused = callerContext(req).refusal;
|
|
322
|
+
if (refused) return refusePin(res, refused);
|
|
282
323
|
return res.status(403).json({ ok: false, code: 'RUN_FORBIDDEN', error: 'This run is readable by the owner (from SynaBun\'s own page), its own worker and the Assistant brain of its session only.' });
|
|
283
324
|
}
|
|
325
|
+
/** A request that names a run or a brain it cannot prove it is: 403 TERMINAL_TOKEN_REQUIRED / _INVALID (never a token). */
|
|
326
|
+
function refusePin(res, refusal) {
|
|
327
|
+
return res.status(refusal.status || 403).json({ ok: false, code: refusal.code, error: refusal.error });
|
|
328
|
+
}
|
|
284
329
|
/** A remote session whose workers only a person may answer (strict worker approvals below autonomous). */
|
|
285
330
|
function humanApprovalRequired(assistantSessionId) {
|
|
286
331
|
if (!assistantSessionId) return false;
|
|
@@ -423,6 +468,8 @@ export function createAssistantApi({
|
|
|
423
468
|
maxMinutes: body.maxMinutes ?? body.max_minutes,
|
|
424
469
|
budgetUsd: body.budgetUsd ?? body.budget_usd,
|
|
425
470
|
usesBrowser: body.usesBrowser ?? body.uses_browser,
|
|
471
|
+
// The MoreLogin profile of the worker's browser tab (an id or a name); none = the default browser.
|
|
472
|
+
moreloginProfile: body.moreloginProfile ?? body.morelogin_profile ?? null,
|
|
426
473
|
workflowId: body.workflowId || body.workflow_id,
|
|
427
474
|
parentRunId: body.parentRunId || body.parent_run_id,
|
|
428
475
|
outputSchema: body.outputSchema || body.output_schema,
|
|
@@ -514,7 +561,7 @@ export function createAssistantApi({
|
|
|
514
561
|
router.put('/routing', async (req, res) => {
|
|
515
562
|
if (!requireRouter(res)) return;
|
|
516
563
|
if (!configStore?.patchRouting) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'Routing settings are read-only' });
|
|
517
|
-
if (callerContext(req).kind !== 'ui') return
|
|
564
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Routing settings are changed from the assistant panel only.');
|
|
518
565
|
try {
|
|
519
566
|
const body = req.body || {};
|
|
520
567
|
const patch = body.routing && typeof body.routing === 'object' ? body.routing : body;
|
|
@@ -555,7 +602,7 @@ export function createAssistantApi({
|
|
|
555
602
|
});
|
|
556
603
|
router.delete('/routing/preferences/:key', (req, res) => {
|
|
557
604
|
if (!requireRouter(res)) return;
|
|
558
|
-
if (callerContext(req).kind !== 'ui') return
|
|
605
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Routing settings are changed from the assistant panel only.');
|
|
559
606
|
try {
|
|
560
607
|
configStore.patchRouting({ preferences: { [req.params.key]: null } }, { taskClasses: [...Object.keys(taskClasses || {}), 'vision'] });
|
|
561
608
|
broadcastSync({ type: 'assistant:routing-changed', version: configStore.version() });
|
|
@@ -600,7 +647,7 @@ export function createAssistantApi({
|
|
|
600
647
|
router.put('/user-context', (req, res) => {
|
|
601
648
|
if (!userContextReady(res)) return;
|
|
602
649
|
if (!configStore.patchUserContext) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'User context settings are read-only' });
|
|
603
|
-
if (callerContext(req).kind !== 'ui') return
|
|
650
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'User context settings are changed from Settings only.');
|
|
604
651
|
try {
|
|
605
652
|
const body = req.body || {};
|
|
606
653
|
const { project: _project, ...patch } = body.settings && typeof body.settings === 'object' ? body.settings : body;
|
|
@@ -620,7 +667,7 @@ export function createAssistantApi({
|
|
|
620
667
|
});
|
|
621
668
|
router.put('/budget', (req, res) => {
|
|
622
669
|
if (!configStore?.patchBudget) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'Budget settings are read-only' });
|
|
623
|
-
if (callerContext(req).kind !== 'ui') return
|
|
670
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Budget settings are changed from the assistant panel only.');
|
|
624
671
|
try {
|
|
625
672
|
const body = req.body || {};
|
|
626
673
|
const patch = body.budget && typeof body.budget === 'object' && !Array.isArray(body.budget) ? body.budget : null;
|
|
@@ -738,7 +785,7 @@ export function createAssistantApi({
|
|
|
738
785
|
}
|
|
739
786
|
router.post('/clarify/:requestId/answer', (req, res) => {
|
|
740
787
|
if (!requireClarifier(res)) return;
|
|
741
|
-
if (callerContext(req).kind !== 'ui') return
|
|
788
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Clarify cards are answered by the user.');
|
|
742
789
|
try { res.json(clarifier.answer(req.params.requestId, cardAnswer(req), { origin: 'rest' })); } catch (error) { sendError(res, error); }
|
|
743
790
|
});
|
|
744
791
|
router.get('/briefs/:briefId', (req, res) => {
|
|
@@ -760,7 +807,7 @@ export function createAssistantApi({
|
|
|
760
807
|
});
|
|
761
808
|
router.post('/routes/:routeId/answer', async (req, res) => {
|
|
762
809
|
if (!requireRouter(res)) return;
|
|
763
|
-
if (callerContext(req).kind !== 'ui') return
|
|
810
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Route cards are answered by the user.');
|
|
764
811
|
try { res.json(await assistantRouter.answer(req.params.routeId, cardAnswer(req), { origin: 'rest' })); } catch (error) { sendError(res, error); }
|
|
765
812
|
});
|
|
766
813
|
router.get('/sessions/:id/routes', (req, res) => {
|
|
@@ -780,7 +827,7 @@ export function createAssistantApi({
|
|
|
780
827
|
// Listing is owner-or-brain only: a worker reads its own run by id, never the roster of every run.
|
|
781
828
|
const caller = callerContext(req);
|
|
782
829
|
const brain = brainCaller(req);
|
|
783
|
-
if (caller.kind !== 'ui' && !brain) return refuseRunRead(res);
|
|
830
|
+
if (caller.kind !== 'ui' && !brain) return refuseRunRead(req, res);
|
|
784
831
|
try {
|
|
785
832
|
const active = req.query.active === '1' || req.query.activeOnly === '1';
|
|
786
833
|
// A brain sees only its OWN session's runs (its session id forced over whatever the query asks); the owner's
|
|
@@ -840,7 +887,7 @@ export function createAssistantApi({
|
|
|
840
887
|
});
|
|
841
888
|
|
|
842
889
|
router.get('/runs/:runId', (req, res) => {
|
|
843
|
-
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
|
|
890
|
+
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
|
|
844
891
|
const run = dispatcher.get(req.params.runId);
|
|
845
892
|
if (!run) return res.status(404).json({ ok: false, code: 'RUN_NOT_FOUND', error: `Unknown run ${req.params.runId}` });
|
|
846
893
|
const brain = brainCaller(req);
|
|
@@ -848,7 +895,7 @@ export function createAssistantApi({
|
|
|
848
895
|
res.json({ ok: true, run: brain ? slimRunView(run) : run });
|
|
849
896
|
});
|
|
850
897
|
router.get('/runs/:runId/result', (req, res) => {
|
|
851
|
-
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
|
|
898
|
+
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
|
|
852
899
|
try {
|
|
853
900
|
const out = dispatcher.transcript(req.params.runId, { format: 'result' });
|
|
854
901
|
if (out?.result) {
|
|
@@ -859,7 +906,7 @@ export function createAssistantApi({
|
|
|
859
906
|
} catch (error) { sendError(res, error); }
|
|
860
907
|
});
|
|
861
908
|
router.get('/runs/:runId/transcript', (req, res) => {
|
|
862
|
-
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
|
|
909
|
+
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
|
|
863
910
|
try {
|
|
864
911
|
const format = req.query.format || 'tail';
|
|
865
912
|
const out = dispatcher.transcript(req.params.runId, {
|
|
@@ -880,7 +927,7 @@ export function createAssistantApi({
|
|
|
880
927
|
// path from the request; owner-only like everything here. sendFile answers
|
|
881
928
|
// Range requests, so a video seeks.
|
|
882
929
|
router.get('/runs/:runId/media/:n', async (req, res) => {
|
|
883
|
-
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
|
|
930
|
+
if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
|
|
884
931
|
const notFound = () => res.status(404).json({ ok: false, code: 'MEDIA_NOT_FOUND', error: `No media ${req.params.n} for run ${req.params.runId}` });
|
|
885
932
|
if (!/^\d{1,4}$/.test(String(req.params.n))) return notFound();
|
|
886
933
|
let file = null;
|
|
@@ -975,7 +1022,7 @@ export function createAssistantApi({
|
|
|
975
1022
|
router.delete('/runs/:runId', async (req, res) => {
|
|
976
1023
|
const caller = callerContext(req);
|
|
977
1024
|
const brain = brainCaller(req);
|
|
978
|
-
if (caller.kind !== 'ui' && !brain) return
|
|
1025
|
+
if (caller.kind !== 'ui' && !brain) return uiOnly(req, res, 'Finished runs are removed by the owner (from SynaBun\'s own page) or the Assistant brain of the run\'s session.');
|
|
979
1026
|
if (brain && caller.kind !== 'ui') {
|
|
980
1027
|
// A brain removes only the runs of its own session: another session's run is left untouched.
|
|
981
1028
|
const runSession = dispatcher.get(req.params.runId)?.assistantSessionId || null;
|
|
@@ -989,7 +1036,7 @@ export function createAssistantApi({
|
|
|
989
1036
|
try { res.json(await dispatcher.remove(req.params.runId, { assistantSessionId })); } catch (error) { sendError(res, error); }
|
|
990
1037
|
});
|
|
991
1038
|
router.post('/runs/clear-finished', async (req, res) => {
|
|
992
|
-
if (callerContext(req).kind !== 'ui') return
|
|
1039
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Finished runs are removed from the assistant panel only.');
|
|
993
1040
|
const body = req.body || {};
|
|
994
1041
|
const assistantSessionId = body.assistantSessionId || body.assistant_session_id || null;
|
|
995
1042
|
const workflowId = body.workflowId || body.workflow_id || null;
|
|
@@ -1003,7 +1050,7 @@ export function createAssistantApi({
|
|
|
1003
1050
|
// The user closed the sidepanel tab of a worker that finished its task: completed, never "stopped
|
|
1004
1051
|
// by the user" (409 RUN_NOT_FINISHED for any other run, which the tab then stops as before).
|
|
1005
1052
|
router.post('/runs/:runId/tab-closed', (req, res) => {
|
|
1006
|
-
if (callerContext(req).kind !== 'ui') return
|
|
1053
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the sidepanel that closed the tab reports it.');
|
|
1007
1054
|
try { res.json(dispatcher.completeClosedTab(req.params.runId)); } catch (error) { sendError(res, error); }
|
|
1008
1055
|
});
|
|
1009
1056
|
router.post('/runs/:runId/focus', (req, res) => {
|
|
@@ -1338,9 +1385,8 @@ export function createAssistantApi({
|
|
|
1338
1385
|
});
|
|
1339
1386
|
router.put('/admin-sandbox', requireJson, (req, res) => {
|
|
1340
1387
|
if (!adminSandbox) return res.status(503).json({ ok: false, code: 'ADMIN_SANDBOX_UNAVAILABLE', error: 'The Admin sandbox setting is not available on this server' });
|
|
1341
|
-
if (
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1388
|
+
if (req.get('x-synabun-desktop-grant')) return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change the Admin sandbox.' });
|
|
1389
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can change the Admin sandbox.');
|
|
1344
1390
|
const value = req.body?.adminSandbox;
|
|
1345
1391
|
if (typeof value !== 'boolean') return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: 'adminSandbox must be true or false.' });
|
|
1346
1392
|
try { res.json({ ok: true, ...adminSandbox.set(value) }); } catch (error) { sendError(res, error); }
|
|
@@ -1355,9 +1401,8 @@ export function createAssistantApi({
|
|
|
1355
1401
|
});
|
|
1356
1402
|
router.put('/worker-guard', requireJson, (req, res) => {
|
|
1357
1403
|
if (!workerGuard) return res.status(503).json({ ok: false, code: 'WORKER_GUARD_UNAVAILABLE', error: 'The Protect workers setting is not available on this server' });
|
|
1358
|
-
if (
|
|
1359
|
-
|
|
1360
|
-
}
|
|
1404
|
+
if (req.get('x-synabun-desktop-grant') || req.get('x-synabun-role')) return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change Protect workers.' });
|
|
1405
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can change Protect workers.');
|
|
1361
1406
|
const value = req.body?.mode;
|
|
1362
1407
|
if (typeof value !== 'string' || !workerGuard.view().modes.includes(value)) return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: `mode must be one of ${workerGuard.view().modes.join(', ')}.` });
|
|
1363
1408
|
try { res.json({ ok: true, ...workerGuard.set(value) }); } catch (error) { sendError(res, error); }
|
|
@@ -1381,6 +1426,28 @@ export function createAssistantApi({
|
|
|
1381
1426
|
if (uiTabs.size > 50) uiTabs.delete(uiTabs.keys().next().value);
|
|
1382
1427
|
res.json({ ok: true, windows: uiTabs.size });
|
|
1383
1428
|
});
|
|
1429
|
+
|
|
1430
|
+
// ── Let the automation browser act as owner (lib/automation-browser-owner-access.js) ──────────────────
|
|
1431
|
+
// The read is any local caller's (the page draws it; an agent may know it). The write is the owner's page alone:
|
|
1432
|
+
// this boot's page secret, no agent header of any kind, and never SynaBun's automation browser (its marker or its
|
|
1433
|
+
// peer process), whatever the setting says: a browser worker must not be able to grant itself the owner's powers.
|
|
1434
|
+
router.get('/automation-browser-owner-access', (req, res) => {
|
|
1435
|
+
if (!automationBrowserOwnerAccess) return res.status(503).json({ ok: false, code: 'OWNER_ACCESS_UNAVAILABLE', error: 'The automation-browser owner access setting is not available on this server' });
|
|
1436
|
+
res.json({ ok: true, ...automationBrowserOwnerAccess.view() });
|
|
1437
|
+
});
|
|
1438
|
+
router.put('/automation-browser-owner-access', requireJson, (req, res) => {
|
|
1439
|
+
if (!automationBrowserOwnerAccess) return res.status(503).json({ ok: false, code: 'OWNER_ACCESS_UNAVAILABLE', error: 'The automation-browser owner access setting is not available on this server' });
|
|
1440
|
+
if (['x-synabun-desktop-grant', 'x-synabun-role', 'x-synabun-terminal', 'x-synabun-assistant', 'x-synabun-brain-token'].some((name) => req.get(name))) {
|
|
1441
|
+
return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can let the automation browser act as owner.' });
|
|
1442
|
+
}
|
|
1443
|
+
let fromAutomationBrowser = false;
|
|
1444
|
+
try { fromAutomationBrowser = typeof pageSession?.isAutomationBrowser === 'function' && pageSession.isAutomationBrowser(req) === true; } catch { fromAutomationBrowser = true; }
|
|
1445
|
+
if (fromAutomationBrowser) return res.status(403).json({ ok: false, code: 'WORKER_BROWSER', error: 'This setting is changed from the owner\'s own browser or the app, never from SynaBun\'s automation browser.' });
|
|
1446
|
+
if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can let the automation browser act as owner.');
|
|
1447
|
+
const value = req.body?.enabled;
|
|
1448
|
+
if (typeof value !== 'boolean') return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: 'enabled must be true or false.' });
|
|
1449
|
+
try { res.json({ ok: true, ...automationBrowserOwnerAccess.set(value) }); } catch (error) { sendError(res, error); }
|
|
1450
|
+
});
|
|
1384
1451
|
router.get('/ui/tabs', (req, res) => res.json({ ok: true, windows: listTabs() }));
|
|
1385
1452
|
router.post('/ui/focus', (req, res) => {
|
|
1386
1453
|
const body = req.body || {};
|
|
@@ -190,6 +190,11 @@ export function createClaudeBrain({ session, sink, deps = {}, persona = '', hook
|
|
|
190
190
|
if (providerSessionId) query.sessionId = providerSessionId;
|
|
191
191
|
if (cwd) query.cwd = cwd;
|
|
192
192
|
if (effort) query.effort = effort;
|
|
193
|
+
// A turn with no effort of its own (the picker's Auto, or after a routed "here" turn) runs on the
|
|
194
|
+
// model's default. The process may still hold a level or Off (`none`) from before: 'off' (Auto
|
|
195
|
+
// outside the panel) takes it back, live for a level (applyFlagSettings, effortLevel null) and by
|
|
196
|
+
// a resumed restart from Off (thinking is a start-up option). The conversation continues either way.
|
|
197
|
+
else if (inner.effort && inner.effort !== 'off') query.effort = 'off';
|
|
193
198
|
if ((mode && PERMISSION_MODES.has(mode)) || typeof plan === 'boolean') query.permissionMode = applyModes(mode, plan);
|
|
194
199
|
await handle(query);
|
|
195
200
|
return true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EXTERNAL_SERVER_LIMITATIONS } from './mcp-external-servers.js';
|
|
1
|
+
import { EXTERNAL_SERVER_LIMITATIONS, externalDiscoveryError } from './mcp-external-servers.js';
|
|
2
2
|
import { toolCatalogView } from '../../mcp-server/dist/services/tool-catalog.js';
|
|
3
3
|
// ═══════════════════════════════════════════
|
|
4
4
|
// SynaBun — Assistant model catalog (providers · models · tier · price · vision)
|
|
@@ -30,6 +30,12 @@ import { sortEfforts, variantNames } from './effort-levels.js';
|
|
|
30
30
|
import { listPrice } from './assistant-pricing.js';
|
|
31
31
|
|
|
32
32
|
export const CATALOG_PROVIDERS = ['claude-code', 'codex', 'opencode', 'antigravity'];
|
|
33
|
+
/**
|
|
34
|
+
* Chat-only providers: a side panel of their own and a `chat` section of the catalog, never a worker or a brain
|
|
35
|
+
* (nothing dispatches to them, the router never picks them). Maritaca AI (lib/maritaca/*) is a plain chat API:
|
|
36
|
+
* its rows carry prices in BRL (`price.unit` 'brl_per_mtok') and are listed for the record, `chat: true`.
|
|
37
|
+
*/
|
|
38
|
+
export const CHAT_PROVIDERS = Object.freeze(['maritaca']);
|
|
33
39
|
/** The providers an Assistant brain can run on (every provider of the catalog: each is a worker too). */
|
|
34
40
|
export const BRAIN_PROVIDERS = Object.freeze(['claude-code', 'codex', 'opencode', 'antigravity']);
|
|
35
41
|
export const TIERS = ['small', 'medium', 'large'];
|
|
@@ -367,6 +373,93 @@ export function normalizeAntigravityRows(rows, { via = null } = {}) {
|
|
|
367
373
|
return out;
|
|
368
374
|
}
|
|
369
375
|
|
|
376
|
+
/**
|
|
377
|
+
* Maritaca's model list (GET /api/maritaca/models: lib/maritaca/models.js rows, the API's list merged over the table)
|
|
378
|
+
* → catalog rows of the `chat` section. Prices stay in BRL (never converted into the USD sheet); `vision` is false
|
|
379
|
+
* (text only), `outputs` none, `toolcall` what the table says. A row the API lists and the table does not know keeps
|
|
380
|
+
* what the API said and `tier` null.
|
|
381
|
+
*/
|
|
382
|
+
export function normalizeMaritacaRows(rows) {
|
|
383
|
+
const seen = new Set();
|
|
384
|
+
const out = [];
|
|
385
|
+
for (const raw of arr(rows)) {
|
|
386
|
+
const m = typeof raw === 'string' ? { id: raw } : raw;
|
|
387
|
+
const id = typeof m?.id === 'string' ? m.id.trim() : '';
|
|
388
|
+
if (!id || seen.has(id.toLowerCase())) continue;
|
|
389
|
+
seen.add(id.toLowerCase());
|
|
390
|
+
const price = m.price && typeof m.price === 'object' && (num(m.price.input) !== null || num(m.price.output) !== null)
|
|
391
|
+
? { input: num(m.price.input) ?? 0, output: num(m.price.output) ?? 0, cacheRead: num(m.price.cacheRead), unit: 'brl_per_mtok', basis: m.free === true ? 'free' : 'list' }
|
|
392
|
+
: null;
|
|
393
|
+
out.push({
|
|
394
|
+
provider: 'maritaca', id, upstream: id, label: String(m.label || id), family: m.family || null,
|
|
395
|
+
tier: ['small', 'medium', 'large'].includes(m.tier) ? m.tier : null, tierSource: m.tier ? 'table' : 'unknown',
|
|
396
|
+
vision: false, visionSource: 'table', outputs: { image: false, video: false }, outputsSource: 'table',
|
|
397
|
+
reasoning: typeof m.reasoning === 'boolean' ? m.reasoning : null, toolcall: typeof m.toolcall === 'boolean' ? m.toolcall : null,
|
|
398
|
+
contextWindow: num(m.contextWindow), maxOutput: num(m.maxOutput), price,
|
|
399
|
+
efforts: arr(m.efforts).map(String), defaultEffort: m.defaultEffort || null,
|
|
400
|
+
isDefault: m.isDefault === true, status: m.listed === false ? 'unlisted' : 'active', chat: true, region: m.region || null,
|
|
401
|
+
description: m.description ? String(m.description) : null,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
return out;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** The OpenCode provider id Maritaca is registered under (lib/maritaca/opencode.js): its rows are `maritaca/<id>`. */
|
|
408
|
+
export const MARITACA_OPENCODE_PREFIX = 'maritaca/';
|
|
409
|
+
export const MARITACA_UNAVAILABLE_HINT = 'Register Maritaca under Settings → OpenCode → Providers';
|
|
410
|
+
|
|
411
|
+
/** True for an OpenCode row (or id) that is one of Maritaca's models run through OpenCode. */
|
|
412
|
+
export function isMaritacaOpenCodeId(id) { return String(id || '').toLowerCase().startsWith(MARITACA_OPENCODE_PREFIX); }
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* The Maritaca group of every Assistant model picker. Maritaca is chat-only by itself (CHAT_PROVIDERS); what runs is
|
|
416
|
+
* the OpenCode rows `maritaca/<id>`. The group shows those rows under their own heading: each one names the runnable
|
|
417
|
+
* spec it stands for (`target: { provider: 'opencode', model: 'maritaca/<id>' }`, `via: 'opencode'`), so a pick, a
|
|
418
|
+
* saved route and a dispatch keep the OpenCode spec unchanged. Order and labels / tier / BRL price are the Maritaca
|
|
419
|
+
* panel's (`chatRows`); efforts and context are OpenCode's (what a run can use). Rows the user hid in OpenCode stay
|
|
420
|
+
* out (`hiddenRows`: counted). While OpenCode lists no Maritaca model at all, the group keeps Maritaca's models
|
|
421
|
+
* marked `status: 'unavailable'` with a hint, never an empty or missing group.
|
|
422
|
+
*/
|
|
423
|
+
export function maritacaRouteGroup({ chatRows = [], opencodeRows = [], hiddenRows = [] } = {}) {
|
|
424
|
+
const visible = arr(opencodeRows).filter((row) => isMaritacaOpenCodeId(row?.id));
|
|
425
|
+
const hidden = arr(hiddenRows).filter((row) => isMaritacaOpenCodeId(row?.id));
|
|
426
|
+
const available = visible.length + hidden.length > 0;
|
|
427
|
+
const bare = (id) => String(id).slice(MARITACA_OPENCODE_PREFIX.length);
|
|
428
|
+
const byBare = new Map(visible.map((row) => [bare(row.id).toLowerCase(), row]));
|
|
429
|
+
const hiddenBare = new Set(hidden.map((row) => bare(row.id).toLowerCase()));
|
|
430
|
+
const models = [];
|
|
431
|
+
const taken = new Set();
|
|
432
|
+
const make = (chat, oc) => {
|
|
433
|
+
const model = chat?.id || bare(oc.id);
|
|
434
|
+
const id = `${MARITACA_OPENCODE_PREFIX}${oc ? bare(oc.id) : model}`;
|
|
435
|
+
return {
|
|
436
|
+
provider: 'maritaca', via: 'opencode', id, model, target: { provider: 'opencode', model: id },
|
|
437
|
+
label: chat?.label || oc?.label || model, family: chat?.family || oc?.family || null,
|
|
438
|
+
tier: chat?.tier || oc?.tier || null, vision: false, outputs: { image: false, video: false },
|
|
439
|
+
contextWindow: oc?.contextWindow ?? chat?.contextWindow ?? null,
|
|
440
|
+
// BRL, the Maritaca panel's price (never converted into the USD sheet).
|
|
441
|
+
price: chat?.price || null,
|
|
442
|
+
efforts: oc ? arr(oc.efforts) : arr(chat?.efforts), defaultEffort: oc ? oc.defaultEffort || null : chat?.defaultEffort || null,
|
|
443
|
+
isDefault: chat?.isDefault === true,
|
|
444
|
+
status: oc ? (oc.status || 'active') : 'unavailable',
|
|
445
|
+
...(oc ? {} : { hint: MARITACA_UNAVAILABLE_HINT }),
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
for (const chat of arr(chatRows)) {
|
|
449
|
+
const key = String(chat?.id || '').toLowerCase();
|
|
450
|
+
if (!key || taken.has(key)) continue;
|
|
451
|
+
taken.add(key);
|
|
452
|
+
if (hiddenBare.has(key)) continue;
|
|
453
|
+
const oc = byBare.get(key) || null;
|
|
454
|
+
// OpenCode lists Maritaca but not this model: it cannot run, so it is not offered.
|
|
455
|
+
if (available && !oc) continue;
|
|
456
|
+
models.push(make(chat, oc));
|
|
457
|
+
}
|
|
458
|
+
// OpenCode rows the Maritaca table does not know (a model added upstream) are listed after, as OpenCode names them.
|
|
459
|
+
for (const oc of visible) if (!taken.has(bare(oc.id).toLowerCase())) { taken.add(bare(oc.id).toLowerCase()); models.push(make(null, oc)); }
|
|
460
|
+
return { id: 'maritaca', label: 'Maritaca', via: 'opencode', available, hint: available ? null : MARITACA_UNAVAILABLE_HINT, hiddenCount: hidden.length, currency: 'BRL', models };
|
|
461
|
+
}
|
|
462
|
+
|
|
370
463
|
/** The ids the user hid for `provider` (catalog.hidden, else the older opencodeHidden). */
|
|
371
464
|
function hiddenList(catalog, provider) {
|
|
372
465
|
const map = catalog?.hidden;
|
|
@@ -429,6 +522,8 @@ export function hiddenModelId(catalog, provider, id, { row = null } = {}) {
|
|
|
429
522
|
* anything when the user hid every model of a provider that listed some.
|
|
430
523
|
*/
|
|
431
524
|
export function findModel(catalog, provider, id) {
|
|
525
|
+
// A chat-only provider is never a dispatch target: nothing resolves there (the router never asks, the brain cannot route to it).
|
|
526
|
+
if (CHAT_PROVIDERS.includes(provider)) return null;
|
|
432
527
|
if (!id) return null;
|
|
433
528
|
if (hiddenModelId(catalog, provider, id)) return null;
|
|
434
529
|
const rows = arr(catalog?.models?.[provider]);
|
|
@@ -681,6 +776,21 @@ export function createAssistantCatalog({
|
|
|
681
776
|
let epoch = 0; // bumped by invalidate(): a build that began before it is not kept
|
|
682
777
|
let lastListed = null; // provider → signature of the rows the last build listed
|
|
683
778
|
|
|
779
|
+
// External servers are read degraded here (the catalog only lists): a provider whose MCP configuration
|
|
780
|
+
// cannot be read is reported in `errors`, its rows say `unknown`, and every other provider's servers and
|
|
781
|
+
// every model stay listed. Dispatch and worker launch read their own strict inventories and refuse.
|
|
782
|
+
// getExternalServers answers { servers, errors } or plain rows (older form).
|
|
783
|
+
function externalServersReport(projectRows) {
|
|
784
|
+
try {
|
|
785
|
+
const answer = getExternalServers(projectRows);
|
|
786
|
+
if (Array.isArray(answer)) return { servers: answer, errors: [] };
|
|
787
|
+
return { servers: Array.isArray(answer?.servers) ? answer.servers : [], errors: Array.isArray(answer?.errors) ? answer.errors : [] };
|
|
788
|
+
} catch (error) {
|
|
789
|
+
log('catalog:external-servers-error', error?.code || error?.message || String(error));
|
|
790
|
+
return { servers: [], errors: [externalDiscoveryError(error?.provider || null, error)] };
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
684
794
|
const pickArray = (value, keys = []) => {
|
|
685
795
|
if (Array.isArray(value)) return value;
|
|
686
796
|
for (const key of keys) if (Array.isArray(value?.[key])) return value[key];
|
|
@@ -721,11 +831,13 @@ export function createAssistantCatalog({
|
|
|
721
831
|
async function build({ deep = false } = {}) {
|
|
722
832
|
// `deep` also drops the providers' own discovery caches (a CLI or app-server round trip).
|
|
723
833
|
const fresh = deep ? '?refresh=1' : '';
|
|
724
|
-
const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects] = await Promise.all([
|
|
834
|
+
const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects, maritacaModels] = await Promise.all([
|
|
725
835
|
fetchJson(`/api/claude/models${fresh}`), fetchJson(`/api/codex/models${fresh}`), fetchJson('/api/opencode/providers/full'),
|
|
726
836
|
// A provider that does not answer is unavailable for this build, never a failed build.
|
|
727
837
|
Promise.resolve().then(() => fetchJson(`/api/antigravity/models${fresh}`)).catch(() => null),
|
|
728
838
|
fetchJson('/api/projects'),
|
|
839
|
+
// The chat-only provider (its own section): a server from before it answers nothing, and the section is empty.
|
|
840
|
+
Promise.resolve().then(() => fetchJson('/api/maritaca/models')).catch(() => null),
|
|
729
841
|
]);
|
|
730
842
|
const filter = (() => { try { return readFilter() || {}; } catch { return {}; } })();
|
|
731
843
|
let accounts = {};
|
|
@@ -748,7 +860,10 @@ export function createAssistantCatalog({
|
|
|
748
860
|
codex: codex.state,
|
|
749
861
|
opencode: opencodeProviders && opencodeProviders.ok !== false ? 'live' : 'unavailable',
|
|
750
862
|
antigravity: antigravity.state,
|
|
863
|
+
// Maritaca: 'live' when its API listed the models, 'table' when the shipped table answered, else unavailable.
|
|
864
|
+
maritaca: maritacaModels && maritacaModels.ok !== false ? (maritacaModels.source === 'live' ? 'live' : 'fallback') : 'unavailable',
|
|
751
865
|
};
|
|
866
|
+
const chat = { maritaca: maritacaModels && maritacaModels.ok !== false ? normalizeMaritacaRows(pickArray(maritacaModels, ['models'])) : [] };
|
|
752
867
|
for (const p of ['claude-code', 'codex']) if (sources[p] !== 'live') log('catalog:source', `${p}: ${sources[p]}`);
|
|
753
868
|
const all = {
|
|
754
869
|
'claude-code': withClaudeContextVariants(normalizeClaudeRows(claude.list, { pricing: claudePricing })),
|
|
@@ -783,11 +898,22 @@ export function createAssistantCatalog({
|
|
|
783
898
|
const listedNow = Object.fromEntries(CATALOG_PROVIDERS.map((p) => [p, listedSignature(all[p])]));
|
|
784
899
|
const changed = lastListed ? CATALOG_PROVIDERS.filter((p) => listedNow[p] !== lastListed[p]) : [];
|
|
785
900
|
lastListed = listedNow;
|
|
901
|
+
const external = externalServersReport(pickArray(projects, ['projects']));
|
|
902
|
+
// Maritaca's models run through OpenCode: its rows are marked with their picker group, and the group itself is
|
|
903
|
+
// built for the pickers and the routing sheet (routeGroups.maritaca).
|
|
904
|
+
for (const row of [...models.opencode, ...hiddenRows.opencode]) if (isMaritacaOpenCodeId(row.id)) row.group = 'maritaca';
|
|
905
|
+
const maritacaGroup = maritacaRouteGroup({ chatRows: chat.maritaca, opencodeRows: models.opencode, hiddenRows: hiddenRows.opencode });
|
|
786
906
|
return {
|
|
787
907
|
generatedAt: new Date(now()).toISOString(),
|
|
908
|
+
// Providers whose MCP server list could not be checked: { provider, code, reason, errno? }, no paths.
|
|
909
|
+
externalServerErrors: external.errors,
|
|
788
910
|
// Providers whose listed models differ from the build before (not part of the value's meaning: full() reports it).
|
|
789
911
|
changedProviders: changed,
|
|
790
912
|
models,
|
|
913
|
+
// Chat-only providers (CHAT_PROVIDERS): listed, never routed to. `chat.maritaca` rows carry BRL prices.
|
|
914
|
+
chat,
|
|
915
|
+
// Picker groups that run through another provider: { maritaca: maritacaRouteGroup(...) }.
|
|
916
|
+
routeGroups: { maritaca: maritacaGroup },
|
|
791
917
|
hidden,
|
|
792
918
|
// provider → { hidden id (lower-case) → { model, variant, label, at, … } }: the entries that hide one row only.
|
|
793
919
|
hiddenPins,
|
|
@@ -801,7 +927,7 @@ export function createAssistantCatalog({
|
|
|
801
927
|
opencodeListed: listedCounts.opencode,
|
|
802
928
|
opencodeHidden: hidden.opencode,
|
|
803
929
|
projects: pickArray(projects, ['projects']),
|
|
804
|
-
tools: { ...toolCatalogView(), servers:
|
|
930
|
+
tools: { ...toolCatalogView(), servers: external.servers, externalServerErrors: external.errors, externalServerLimitations: EXTERNAL_SERVER_LIMITATIONS },
|
|
805
931
|
accounts,
|
|
806
932
|
// Efforts are per model (row.efforts); a provider's list is the union of its rows'.
|
|
807
933
|
providers: [
|
|
@@ -811,6 +937,11 @@ export function createAssistantCatalog({
|
|
|
811
937
|
// A brain and a worker. No accounts (Antigravity signs in with Google in its own CLI: `signedIn` and `tier`
|
|
812
938
|
// say what its last model listing found) and unpriced (tokens, not prices).
|
|
813
939
|
{ id: 'antigravity', brain: true, efforts: providerEfforts(models.antigravity), permissionPolicies: ['auto', 'ask'], accounts: false, priced: false, signedIn: antigravity.signedIn, tier: antigravity.tier },
|
|
940
|
+
// Chat only: a side panel, no worker, no brain, no dispatch. Prices in BRL on its rows; the key is one per SynaBun
|
|
941
|
+
// (`configured` says whether it is saved).
|
|
942
|
+
{ id: 'maritaca', brain: false, worker: false, chat: true, efforts: providerEfforts(chat.maritaca), permissionPolicies: [], accounts: false, priced: true, currency: 'BRL', configured: maritacaModels?.configured === true,
|
|
943
|
+
// Its OpenCode-backed rows run (provider opencode, model maritaca/<id>); a direct chat pick never does.
|
|
944
|
+
via: 'opencode', runnable: maritacaGroup.available },
|
|
814
945
|
],
|
|
815
946
|
};
|
|
816
947
|
}
|