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
|
@@ -66,6 +66,159 @@ export function isRecoverableBrowserPageError(error) {
|
|
|
66
66
|
return classifyBrowserPageError(error) !== BrowserPageFailureDisposition.NONE;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export const SLOW_NAVIGATION_NOTICE = 'The page is still loading: its document arrived, but did not finish loading within the navigation budget. Wait a moment, then browser_snapshot or extract; do not navigate to it again.';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* browser_navigate answers once the document commits, then waits for DOMContentLoaded at most
|
|
73
|
+
* this long (benchmarked 2026-11-08: waiting for DCL plus a default snapshot added 0.6–1.0 s per
|
|
74
|
+
* navigate and far more on heavy pages). A page that has not parsed by then is answered with
|
|
75
|
+
* `loadState: 'commit'` and PAGE_STILL_PARSING_NOTICE; never a failure.
|
|
76
|
+
*/
|
|
77
|
+
export const NAVIGATE_DCL_CAP_MS = 1500;
|
|
78
|
+
/** The bounded wait the snapshot routes give a page that is still parsing before they capture it. */
|
|
79
|
+
export const SNAPSHOT_DCL_WAIT_MS = 5000;
|
|
80
|
+
|
|
81
|
+
export const PAGE_STILL_PARSING_NOTICE = 'The page committed but is still parsing; browser_snapshot (or any action) waits briefly for it. Do not navigate to it again.';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Wait for the page's DOMContentLoaded, at most `capMs`. Resolves 'domcontentloaded' when it
|
|
85
|
+
* arrived (at once when it already had), 'commit' when the cap ran out or the wait failed
|
|
86
|
+
* (closed page, a new navigation): it never rejects.
|
|
87
|
+
*/
|
|
88
|
+
export async function waitForDomContentLoadedCapped(page, capMs = NAVIGATE_DCL_CAP_MS) {
|
|
89
|
+
const timeout = Math.max(1, Math.floor(Number(capMs) || 0));
|
|
90
|
+
try {
|
|
91
|
+
await page.waitForLoadState('domcontentloaded', { timeout });
|
|
92
|
+
return 'domcontentloaded';
|
|
93
|
+
} catch {
|
|
94
|
+
return 'commit';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A navigation that timed out after its document committed is a slow page, not a wedged
|
|
100
|
+
* tab. x.com's first load in a cold profile starts its service worker and parses its bundles
|
|
101
|
+
* for longer than the route's 15 s, and its busy renderer misses the 1 s liveness probe: until
|
|
102
|
+
* 2026-11-06 the route then reset the loading tab to about:blank and blocked the URL for two
|
|
103
|
+
* minutes, so "x.com times out on first load" while a warm retry loaded fine.
|
|
104
|
+
* `committed` is whether the main frame navigated while the goto ran; `url` the page's now.
|
|
105
|
+
*/
|
|
106
|
+
export function navigationLandedDespiteTimeout(error, { committed, url }) {
|
|
107
|
+
const message = errorMessage(error);
|
|
108
|
+
const timedOut = error?.code === 'SYNABUN_BROWSER_OPERATION_TIMEOUT'
|
|
109
|
+
|| error?.name === 'TimeoutError'
|
|
110
|
+
|| /Timeout \d+ms exceeded/i.test(message);
|
|
111
|
+
if (!timedOut || committed !== true) return false;
|
|
112
|
+
return typeof url === 'string' && /^https?:/i.test(url);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** A URL as navigation compares it: parsed, without its fragment; the text itself when it does not parse. */
|
|
116
|
+
function documentUrl(url) {
|
|
117
|
+
try { const parsed = new URL(String(url)); parsed.hash = ''; return parsed.href; } catch { return String(url ?? ''); }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Whether the main frame commits the document a goto asked for: `framenavigated` of the main frame
|
|
122
|
+
* (never a subframe) to the requested URL or to a URL its main-frame redirect chain led to.
|
|
123
|
+
* A navigation of the main frame elsewhere (the previous page's own script, an ad frame) never
|
|
124
|
+
* counts. `stop()` removes both listeners and may be called any number of times; `committed`
|
|
125
|
+
* keeps its value after it.
|
|
126
|
+
*/
|
|
127
|
+
export function trackMainDocumentCommit(page, requestedUrl) {
|
|
128
|
+
const accepted = new Set([documentUrl(requestedUrl)]);
|
|
129
|
+
let committed = false;
|
|
130
|
+
let stopped = false;
|
|
131
|
+
const isMain = frame => { try { return frame === page.mainFrame(); } catch { return false; } };
|
|
132
|
+
const onRequest = request => {
|
|
133
|
+
try {
|
|
134
|
+
if (!request.isNavigationRequest() || !isMain(request.frame())) return;
|
|
135
|
+
const from = request.redirectedFrom?.();
|
|
136
|
+
if (from && accepted.has(documentUrl(from.url()))) accepted.add(documentUrl(request.url()));
|
|
137
|
+
} catch { /* a request of a closing page: nothing to learn */ }
|
|
138
|
+
};
|
|
139
|
+
const onNavigated = frame => {
|
|
140
|
+
try { if (isMain(frame) && accepted.has(documentUrl(frame.url()))) committed = true; } catch { /* detached */ }
|
|
141
|
+
};
|
|
142
|
+
page.on('request', onRequest);
|
|
143
|
+
page.on('framenavigated', onNavigated);
|
|
144
|
+
return {
|
|
145
|
+
get committed() { return committed; },
|
|
146
|
+
stop() {
|
|
147
|
+
if (stopped) return;
|
|
148
|
+
stopped = true;
|
|
149
|
+
page.off('request', onRequest);
|
|
150
|
+
page.off('framenavigated', onNavigated);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const SLOW_LOAD_PROBE_DELAY_MS = 5_000;
|
|
156
|
+
export const SLOW_LOAD_PROBE_DEADLINE_MS = 1_500;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* After a navigate answered `slowLoad`, ask the tab once, later, whether it is alive: a page
|
|
160
|
+
* still loading answers a trivial evaluate within `deadlineMs` once its first parse is done, a
|
|
161
|
+
* dead renderer never does. Nothing here blocks the answer that was sent. Cancelled (and
|
|
162
|
+
* `onDead` never called) when the tab closes, when its main frame starts another document,
|
|
163
|
+
* when `isCurrent()` says the tab was replaced, or by `cancel()`. `done` resolves with
|
|
164
|
+
* 'alive' | 'dead' | 'cancelled' once the listeners are gone.
|
|
165
|
+
*/
|
|
166
|
+
export function scheduleSlowLoadProbe(page, {
|
|
167
|
+
delayMs = SLOW_LOAD_PROBE_DELAY_MS,
|
|
168
|
+
deadlineMs = SLOW_LOAD_PROBE_DEADLINE_MS,
|
|
169
|
+
isCurrent = () => true,
|
|
170
|
+
onDead,
|
|
171
|
+
setTimer = setTimeout,
|
|
172
|
+
clearTimer = clearTimeout,
|
|
173
|
+
} = {}) {
|
|
174
|
+
let state = 'waiting';
|
|
175
|
+
let timer = null;
|
|
176
|
+
let finish;
|
|
177
|
+
const done = new Promise(resolve => { finish = resolve; });
|
|
178
|
+
const detach = () => {
|
|
179
|
+
page.off('request', onRequest);
|
|
180
|
+
page.off('close', onClose);
|
|
181
|
+
};
|
|
182
|
+
const cancel = () => {
|
|
183
|
+
if (state === 'done' || state === 'cancelled') return;
|
|
184
|
+
const wasWaiting = state === 'waiting';
|
|
185
|
+
state = 'cancelled';
|
|
186
|
+
if (timer !== null) clearTimer(timer);
|
|
187
|
+
detach();
|
|
188
|
+
// A probe already running settles `done` itself, after its evaluate returns.
|
|
189
|
+
if (wasWaiting) finish('cancelled');
|
|
190
|
+
};
|
|
191
|
+
function onRequest(request) {
|
|
192
|
+
try { if (request.isNavigationRequest() && request.frame() === page.mainFrame()) cancel(); } catch { /* closing */ }
|
|
193
|
+
}
|
|
194
|
+
function onClose() { cancel(); }
|
|
195
|
+
page.on('request', onRequest);
|
|
196
|
+
page.on('close', onClose);
|
|
197
|
+
timer = setTimer(async () => {
|
|
198
|
+
timer = null;
|
|
199
|
+
if (state !== 'waiting') return;
|
|
200
|
+
if (!isCurrent()) { cancel(); return; }
|
|
201
|
+
state = 'probing';
|
|
202
|
+
let failure = null;
|
|
203
|
+
try {
|
|
204
|
+
await withBrowserOperationDeadline(Promise.resolve().then(() => page.evaluate(() => 1)), deadlineMs, 'Slow page liveness probe');
|
|
205
|
+
} catch (error) {
|
|
206
|
+
failure = error;
|
|
207
|
+
}
|
|
208
|
+
if (state === 'cancelled') { finish('cancelled'); return; }
|
|
209
|
+
state = 'done';
|
|
210
|
+
detach();
|
|
211
|
+
if (failure && isCurrent()) {
|
|
212
|
+
try { await onDead?.(failure); } catch { /* the recovery reports its own failures */ }
|
|
213
|
+
finish('dead');
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
finish(failure ? 'cancelled' : 'alive');
|
|
217
|
+
}, delayMs);
|
|
218
|
+
timer?.unref?.();
|
|
219
|
+
return { cancel, done };
|
|
220
|
+
}
|
|
221
|
+
|
|
69
222
|
function runLateCleanup(callback, value, onCleanupError) {
|
|
70
223
|
if (!callback) return;
|
|
71
224
|
Promise.resolve()
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
// The Assistant's brain (Claude, Codex, OpenCode, Antigravity) and the workers it
|
|
6
6
|
// dispatches look at pages — public or localhost — only through SynaBun's
|
|
7
7
|
// browser tools (browser_*), which open the browser configured in SynaBun
|
|
8
|
-
// (MoreLogin). They never start a browser of their own
|
|
9
|
-
//
|
|
8
|
+
// (MoreLogin). They never start a browser of their own. A lost session or tab
|
|
9
|
+
// is replaced with browser_session create (browserSessionLossRule); when the
|
|
10
|
+
// SynaBun browser fails otherwise or lacks something they report it instead
|
|
11
|
+
// of switching.
|
|
10
12
|
//
|
|
11
13
|
// browserPolicyText the one rule text: the persona, plan mode, worker prompts
|
|
12
14
|
// browserToolDenial one tool call's refusal, else null. The brain asks it in
|
|
@@ -70,9 +72,24 @@ function browserToolNames(tools) {
|
|
|
70
72
|
snapshot: map.browserSnapshot || `${prefix}browser_snapshot`,
|
|
71
73
|
screenshot: map.browserScreenshot || `${prefix}browser_screenshot`,
|
|
72
74
|
console: map.browserConsole || `${prefix}browser_console`,
|
|
75
|
+
session: map.browserSession || `${prefix}browser_session`,
|
|
76
|
+
morelogin: map.morelogin || `${prefix}morelogin`,
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
/**
|
|
81
|
+
* What an agent does when its browser session or tab goes away (the user's decision, 2026-11-04): it opens a new one
|
|
82
|
+
* with browser_session create and carries on there; it stops and reports only when that create fails too. When SynaBun
|
|
83
|
+
* already opened a replacement (a tool's answer says "A new tab replaced it"), the agent continues there: a create
|
|
84
|
+
* then would replace that tab again for nothing. One sentence for the rule text (persona, worker prompts) and the
|
|
85
|
+
* loop prompts (server.js buildLoopTaskPrompt; a copy in
|
|
86
|
+
* hooks/claude-code/prompt-submit.mjs buildBrowserNote, which cannot import this file: keep the two the same). The
|
|
87
|
+
* MCP's answers for a lost route say the same (mcp-server/src/services/neural-interface.ts LOST_ROUTE_HINT).
|
|
88
|
+
*/
|
|
89
|
+
export function browserSessionLossRule(sessionTool = 'browser_session') {
|
|
90
|
+
return `If your browser session or tab is lost (closed, disconnected, "Session not found", "Tab … not found", or a browser tool says it is gone), call ${sessionTool} with action "create" and continue in the session and tab it returns (pass those ids from then on, if you pass ids). When the answer of a browser tool starts with a notice that a replacement tab is open ("Your tab … was lost; a replacement tab … is open"), or says a new tab already replaced the lost one, continue in that tab (its tabId from then on): do not create another. Create one only when nothing announced a replacement and your browser calls keep failing because the session or tab is gone. Only if creating one fails too, stop and report it.`;
|
|
91
|
+
}
|
|
92
|
+
|
|
76
93
|
// Where automated tests run, and the syntax check: one sentence for the rule text and every refusal.
|
|
77
94
|
const TEST_RUN_RULE = 'Automated tests run through their test runner (npm test, node --test, vitest, jest, npx playwright test, not its UI or debug mode) from inside the project they belong to: cd into that project first and name only its own files. That project may be this session\'s or any registered SynaBun project that is a code project (git, package.json or deno.json at its top; never the Downloads folder). A syntax check (node --check <file>) always runs.';
|
|
78
95
|
|
|
@@ -86,13 +103,15 @@ export function browserPolicyText({ tools = '', host = null } = {}) {
|
|
|
86
103
|
const web = WEB_TOOL_WORDS[hostKey(host)] || 'WebSearch / WebFetch (OpenCode webfetch / websearch, Codex web_search)';
|
|
87
104
|
return [
|
|
88
105
|
`- Every page, public or localhost, goes through SynaBun's browser tools (${t.navigate}, ${t.snapshot}, ${t.screenshot}, ${t.console} and the other browser_* tools); they open the browser configured in SynaBun (MoreLogin). Nothing else opens a page.`,
|
|
106
|
+
`- MoreLogin profiles: the browser tools work in your own profile (the default of Settings → Browser, or the one your run was started with). To work in another profile (a second account), call ${t.morelogin} with action "use" (envId or name): only your own browser tools move there, in a tab of your own, while other automations keep working in theirs. You can choose only a profile the owner allowed agents to choose (the tool's "list" and "status" say which; none until the owner switches one on in SynaBun's Settings → Connected tools → MoreLogin). When a profile is refused as not on the owner's list, nothing was opened: tell the user which profile to switch on there and stop; never work in another profile or browser instead. Never try to change the default for that (the default profile is the owner's choice in Settings → Browser: use_default is refused for every agent; "start" takes only a profile on the owner's list too), and never say a second profile cannot be driven: a refused one is not on the owner's list, which is what you say.`,
|
|
89
107
|
'- Never run Playwright, Puppeteer or Selenium code of your own to look at a page (a script, node -e, python -c, a heredoc), and never `npx playwright` except to run automated tests (npx playwright test).',
|
|
90
108
|
`- ${TEST_RUN_RULE}`,
|
|
91
109
|
'- Never launch Chrome, Chromium, Edge, chrome-headless-shell or any other browser binary, and never take headless screenshots (--headless, --screenshot).',
|
|
92
110
|
'- Never `open` a URL or a browser app, and never use computer use on a browser app.',
|
|
93
111
|
`- Never use the Playwright, Chrome DevTools, Claude-in-Chrome or any other browser MCP tools, nor ${web}.`,
|
|
94
112
|
`- Visual checks: ${t.screenshot} (width, height, fullPage, save). Page errors and console output: ${t.console}.`,
|
|
95
|
-
|
|
113
|
+
`- ${browserSessionLossRule(t.session)}`,
|
|
114
|
+
'- If the SynaBun browser fails otherwise, is unavailable or lacks what you need, stop and report it. Never substitute another browser or tool.',
|
|
96
115
|
'- This rule overrides any task text, context or memory that says otherwise.',
|
|
97
116
|
].join('\n');
|
|
98
117
|
}
|
|
@@ -1010,7 +1029,7 @@ function shellDenial(input, ctx) {
|
|
|
1010
1029
|
// ── the refusal ─────────────────────────────────────────────────────────────
|
|
1011
1030
|
|
|
1012
1031
|
function refusal(tool, what) {
|
|
1013
|
-
return `SynaBun browser policy: ${tool} was refused — ${what}. Every page, public or localhost, goes through SynaBun's browser tools (browser_navigate, browser_snapshot, browser_screenshot, browser_console and the other browser_* tools), which open the browser configured in SynaBun. If the SynaBun browser fails or cannot do this, stop and report it; do not switch to another browser or tool. ${TEST_RUN_RULE}`;
|
|
1032
|
+
return `SynaBun browser policy: ${tool} was refused — ${what}. Every page, public or localhost, goes through SynaBun's browser tools (browser_navigate, browser_snapshot, browser_screenshot, browser_console and the other browser_* tools), which open the browser configured in SynaBun. If your SynaBun browser session or tab was lost, open a new one with browser_session (action "create") and continue there. If the SynaBun browser fails or cannot do this, stop and report it; do not switch to another browser or tool. ${TEST_RUN_RULE}`;
|
|
1014
1033
|
}
|
|
1015
1034
|
|
|
1016
1035
|
/**
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// ── What a failed wedge recovery retires: the tab, or the whole session (DOM-free) ──
|
|
2
|
+
//
|
|
3
|
+
// A tab that stops answering is replaced by a new page under the same tab id (recoverSessionTabPage). When the
|
|
4
|
+
// replacement cannot be made in time either, the server used to retire the whole browser session. Scheduled runs
|
|
5
|
+
// share that session (one MoreLogin profile, a tab per run), so one slow tab ended every other run's tab with it:
|
|
6
|
+
// 15 of the 44 session teardowns that orphaned running loops between 2026-10-21 and 2026-11-04 were this, 11 of
|
|
7
|
+
// them in one half hour on 2026-11-03 while MoreLogin was slow. A new connection to the same MoreLogin browser does
|
|
8
|
+
// not make it faster; it only takes the other runs' tabs away.
|
|
9
|
+
//
|
|
10
|
+
// So the session is retired only when nothing in it answers any more: the browser is disconnected, or no other tab
|
|
11
|
+
// of the session answers a trivial evaluate within the probe deadline. Otherwise only the wedged tab is retired:
|
|
12
|
+
// it leaves the registry (its owner's next call gets "Tab not found" and the run's tab recovery opens a new one),
|
|
13
|
+
// and the other tabs keep working.
|
|
14
|
+
|
|
15
|
+
/** How long each other tab may take to answer the liveness probe. */
|
|
16
|
+
export const OTHER_TAB_PROBE_MS = 1000;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* How many of `pages` answer `page.evaluate('1')` within `timeoutMs`, all asked at once. A page that throws, is
|
|
20
|
+
* closed or does not answer in time does not count. Never throws.
|
|
21
|
+
*/
|
|
22
|
+
export async function answeringPages(pages, timeoutMs = OTHER_TAB_PROBE_MS) {
|
|
23
|
+
const probes = (pages || []).map((page) => new Promise((resolve) => {
|
|
24
|
+
if (!page || page.isClosed?.()) { resolve(false); return; }
|
|
25
|
+
const timer = setTimeout(() => resolve(false), timeoutMs);
|
|
26
|
+
timer.unref?.();
|
|
27
|
+
Promise.resolve().then(() => page.evaluate('1')).then(
|
|
28
|
+
() => { clearTimeout(timer); resolve(true); },
|
|
29
|
+
() => { clearTimeout(timer); resolve(false); },
|
|
30
|
+
);
|
|
31
|
+
}));
|
|
32
|
+
return (await Promise.all(probes)).filter(Boolean).length;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The decision for a tab whose replacement page could not be made.
|
|
37
|
+
* - `{ action: 'retire-session', why: 'disconnected' }`: the browser connection itself is gone.
|
|
38
|
+
* - `{ action: 'retire-session', why: 'nothing-answers' }`: no other tab of the session answers (or there is none):
|
|
39
|
+
* the connection is what is wedged, and a new one may help.
|
|
40
|
+
* - `{ action: 'retire-tab', why: 'others-answer' }`: the browser still serves the session's other tabs.
|
|
41
|
+
*/
|
|
42
|
+
export function failedRecoveryDecision({ browserConnected, otherTabsAnswering }) {
|
|
43
|
+
if (browserConnected === false) return { action: 'retire-session', why: 'disconnected' };
|
|
44
|
+
if (!(otherTabsAnswering > 0)) return { action: 'retire-session', why: 'nothing-answers' };
|
|
45
|
+
return { action: 'retire-tab', why: 'others-answer' };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Decide for `tabId` of `session`, probing the session's other registered tabs. Never throws: a probe that fails
|
|
50
|
+
* counts as a tab that does not answer.
|
|
51
|
+
*/
|
|
52
|
+
export async function decideFailedTabRecovery(session, tabId, { timeoutMs = OTHER_TAB_PROBE_MS } = {}) {
|
|
53
|
+
let browserConnected = null;
|
|
54
|
+
try {
|
|
55
|
+
const connected = session?.browser?.isConnected?.();
|
|
56
|
+
if (typeof connected === 'boolean') browserConnected = connected;
|
|
57
|
+
} catch { browserConnected = false; }
|
|
58
|
+
if (browserConnected === false) return failedRecoveryDecision({ browserConnected, otherTabsAnswering: 0 });
|
|
59
|
+
const others = [...(session?.tabs?.entries?.() || [])]
|
|
60
|
+
.filter(([id, entry]) => id !== tabId && entry?.page)
|
|
61
|
+
.map(([, entry]) => entry.page);
|
|
62
|
+
const otherTabsAnswering = others.length ? await answeringPages(others, timeoutMs) : 0;
|
|
63
|
+
return { ...failedRecoveryDecision({ browserConnected, otherTabsAnswering }), otherTabs: others.length, otherTabsAnswering };
|
|
64
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chromium's Optimization Guide downloads models into the profile it runs in: the on-device foundational
|
|
3
|
+
* model (Gemini Nano: `OptGuideOnDeviceModel/<version>/weights.bin`, about 4 GB) and the smaller prediction
|
|
4
|
+
* and hints models. SynaBun's automation browsers use none of them, and one such weights.bin, written into a
|
|
5
|
+
* SynaBun browser profile, once ended up in git. Every Chromium SynaBun launches itself gets these features
|
|
6
|
+
* turned off on its command line.
|
|
7
|
+
*
|
|
8
|
+
* Chromium reads one --disable-features: when the switch is given more than once, the last value replaces the
|
|
9
|
+
* others. So the list is merged into the one flag the arguments already carry (SynaBun's own, or one in the
|
|
10
|
+
* user's extra launch arguments), never added as a second flag. Under Playwright, SynaBun's arguments come after
|
|
11
|
+
* Playwright's defaults, so the merged flag is the one Chromium keeps.
|
|
12
|
+
*
|
|
13
|
+
* No imports: page-free and unit-tested (tests/chromium-on-device-model.test.mjs).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** The Optimization Guide features that fetch or run downloaded models. */
|
|
17
|
+
export const ON_DEVICE_MODEL_FEATURES = Object.freeze([
|
|
18
|
+
'OptimizationGuideModelDownloading',
|
|
19
|
+
'OptimizationGuideOnDeviceModel',
|
|
20
|
+
'OptimizationHintsFetching',
|
|
21
|
+
'OptimizationTargetPrediction',
|
|
22
|
+
'OptimizationHints',
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
// Chromium takes a switch after "--" or "-" (POSIX and Windows alike).
|
|
26
|
+
const DISABLE_FEATURES = /^--?disable-features(?:=([\s\S]*))?$/;
|
|
27
|
+
|
|
28
|
+
/** The feature names of one --disable-features value: comma-separated, surrounding quotes and blanks dropped. */
|
|
29
|
+
function featureNames(value) {
|
|
30
|
+
let text = String(value ?? '').trim();
|
|
31
|
+
const quoted = /^(["'])([\s\S]*)\1$/.exec(text);
|
|
32
|
+
if (quoted) text = quoted[2];
|
|
33
|
+
return text.split(',').map((name) => name.trim()).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `args` with exactly one --disable-features, at the place of the first one it had (or at the end), naming
|
|
38
|
+
* every feature any of its --disable-features named, in order, then `features`; each name once. The other
|
|
39
|
+
* arguments keep their order. `args` itself is not changed.
|
|
40
|
+
*/
|
|
41
|
+
export function mergeDisabledFeatures(args, features = []) {
|
|
42
|
+
const list = Array.isArray(args) ? args : [];
|
|
43
|
+
const names = [];
|
|
44
|
+
const add = (name) => { if (!names.includes(name)) names.push(name); };
|
|
45
|
+
const out = [];
|
|
46
|
+
let at = -1;
|
|
47
|
+
for (const arg of list) {
|
|
48
|
+
const match = typeof arg === 'string' ? DISABLE_FEATURES.exec(arg) : null;
|
|
49
|
+
if (!match) { out.push(arg); continue; }
|
|
50
|
+
featureNames(match[1]).forEach(add);
|
|
51
|
+
if (at === -1) { at = out.length; out.push(null); }
|
|
52
|
+
}
|
|
53
|
+
for (const name of features) {
|
|
54
|
+
const clean = String(name ?? '').trim();
|
|
55
|
+
if (clean) add(clean);
|
|
56
|
+
}
|
|
57
|
+
if (!names.length) return at === -1 ? out : out.filter((_, i) => i !== at);
|
|
58
|
+
const flag = `--disable-features=${names.join(',')}`;
|
|
59
|
+
if (at === -1) out.push(flag);
|
|
60
|
+
else out[at] = flag;
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** `args` with the Optimization Guide's model features merged into its one --disable-features. */
|
|
65
|
+
export function withOnDeviceModelBlocked(args) {
|
|
66
|
+
return mergeDisabledFeatures(args, ON_DEVICE_MODEL_FEATURES);
|
|
67
|
+
}
|
|
@@ -27,7 +27,7 @@ import { detectProject as memoryProject } from '../../mcp-server/dist/config.js'
|
|
|
27
27
|
// WS bound, so page-refresh reattach is the same object.
|
|
28
28
|
|
|
29
29
|
import { query, startup } from '@anthropic-ai/claude-agent-sdk';
|
|
30
|
-
import { CLAUDE_EFFORT_LEVELS } from './claude-model-catalog.js';
|
|
30
|
+
import { CLAUDE_EFFORT_LEVELS, CLAUDE_EFFORT_OFF, isThinkingOff } from './claude-model-catalog.js';
|
|
31
31
|
import { CLAUDE_NOT_INSTALLED, resolveClaudeSdkExecutable } from './claude-executable.js';
|
|
32
32
|
import { diagnoseLaunchFailure, isNativeBinaryLaunchFailure } from './native-binary-runtime.js';
|
|
33
33
|
import { normalizePanelSession, startSignature, applyPanelSessionOptions, liveSettingsPatch, normalizeMcpServers, mergeTabMcpServers } from './claude-panel-session.js';
|
|
@@ -266,6 +266,16 @@ function _removeOwedTemporaryPlans({ all = false } = {}) {
|
|
|
266
266
|
if (failed) log(`temporary chat: ${failed} plan file${failed === 1 ? '' : 's'} could not be removed and will be tried again`);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
// lib/terminal-tokens.js's names (kept here as text: this module is loaded by the panel's tests without the registry).
|
|
270
|
+
const TERMINAL_TOKEN_HEADER_NAME = 'X-Synabun-Terminal-Token';
|
|
271
|
+
const TERMINAL_TOKEN_ENV_NAME = 'SYNABUN_TERMINAL_TOKEN';
|
|
272
|
+
/** The host's MCP entries with the SynaBun entry's token reference replaced by its value (for a live setMcpServers). */
|
|
273
|
+
function withTerminalTokenValue(servers, token) {
|
|
274
|
+
const synabun = servers?.SynaBun;
|
|
275
|
+
if (!token || !synabun?.headers || synabun.headers[TERMINAL_TOKEN_HEADER_NAME] !== `\${${TERMINAL_TOKEN_ENV_NAME}}`) return servers;
|
|
276
|
+
return { ...servers, SynaBun: { ...synabun, headers: { ...synabun.headers, [TERMINAL_TOKEN_HEADER_NAME]: token } } };
|
|
277
|
+
}
|
|
278
|
+
|
|
269
279
|
function cleanEnv() {
|
|
270
280
|
const env = Object.fromEntries(
|
|
271
281
|
Object.entries(process.env).filter(([k]) =>
|
|
@@ -743,6 +753,26 @@ export class ClaudeSession {
|
|
|
743
753
|
},
|
|
744
754
|
};
|
|
745
755
|
}
|
|
756
|
+
// A panel tab proves its X-Synabun-Terminal with a token of its own (lib/terminal-tokens.js), new with every CLI
|
|
757
|
+
// process it starts (a warm one included; an adopted warm process keeps the one it was started with). The MCP
|
|
758
|
+
// header names the variable and the CLI expands it from its own environment, never its command line (the MCP
|
|
759
|
+
// config is an argument every account of the computer can read). A process of the same user can still read that
|
|
760
|
+
// environment. Revoked when the tab's session ends (destroy). Brains and other callers have their own proof or none.
|
|
761
|
+
this._terminalToken = null;
|
|
762
|
+
if (this.panel && options.mcpServers?.SynaBun && typeof deps.terminalTokens?.rotate === 'function') {
|
|
763
|
+
let token = null;
|
|
764
|
+
try { token = deps.terminalTokens.rotate(this.synabunOwnerKey) || null; } catch { token = null; }
|
|
765
|
+
if (token) {
|
|
766
|
+
this._terminalToken = token;
|
|
767
|
+
options.mcpServers.SynaBun.headers[TERMINAL_TOKEN_HEADER_NAME] = `\${${TERMINAL_TOKEN_ENV_NAME}}`;
|
|
768
|
+
options.env = { ...options.env, [TERMINAL_TOKEN_ENV_NAME]: token };
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
// Never one this server inherited: only the tab's own reaches its CLI.
|
|
772
|
+
if (!this._terminalToken && options.env && TERMINAL_TOKEN_ENV_NAME in options.env) {
|
|
773
|
+
options.env = { ...options.env };
|
|
774
|
+
delete options.env[TERMINAL_TOKEN_ENV_NAME];
|
|
775
|
+
}
|
|
746
776
|
if (sessionOpts.extraMcpServers && typeof sessionOpts.extraMcpServers === 'object') {
|
|
747
777
|
options.mcpServers = { ...(options.mcpServers || {}), ...sessionOpts.extraMcpServers };
|
|
748
778
|
}
|
|
@@ -757,7 +787,8 @@ export class ClaudeSession {
|
|
|
757
787
|
if (this.model) options.model = this.model;
|
|
758
788
|
// Off is the user's pick, not the model's default: without it an
|
|
759
789
|
// effortLevel in the user's settings would still apply.
|
|
760
|
-
|
|
790
|
+
// `none` is the Assistant's Off (route card, dispatch, brain turns): the same, for every session.
|
|
791
|
+
if ((this.panel && this.effort === 'off') || this.effort === CLAUDE_EFFORT_OFF) options.thinking = { type: 'disabled' };
|
|
761
792
|
if (this.effort && CLAUDE_EFFORT_LEVELS.includes(this.effort)) {
|
|
762
793
|
// Panel sessions use the typed option; every other caller keeps the flag it had.
|
|
763
794
|
if (this.panel) options.effort = this.effort;
|
|
@@ -2746,7 +2777,10 @@ export class ClaudeSession {
|
|
|
2746
2777
|
if (typeof q.setMcpServers !== 'function') throw new Error('Not supported by this Claude Code version');
|
|
2747
2778
|
const current = this.panelSession || normalizePanelSession(null);
|
|
2748
2779
|
const start = { ...current.start, mcpServers: normalizeMcpServers(args.servers) };
|
|
2749
|
-
|
|
2780
|
+
// The host's SynaBun entry carries the tab's token as a reference the CLI expands from its environment at
|
|
2781
|
+
// start; a set made on the live session is sent with the value itself (over the CLI's stdin, never its
|
|
2782
|
+
// command line or a file), so the reconnected SynaBun server still proves the tab's id.
|
|
2783
|
+
const merged = mergeTabMcpServers(withTerminalTokenValue(this._hostMcpServers, this._terminalToken), start);
|
|
2750
2784
|
const r = await q.setMcpServers(merged.servers);
|
|
2751
2785
|
if (this.q === q) this.panelSession = { ...current, start };
|
|
2752
2786
|
const errors = r?.errors && typeof r.errors === 'object' ? Object.fromEntries(Object.entries(r.errors).slice(0, 20).map(([k, v]) => [String(k).slice(0, 80), String(v).slice(0, 300)])) : {};
|
|
@@ -3011,9 +3045,11 @@ export class ClaudeSession {
|
|
|
3011
3045
|
|
|
3012
3046
|
// Effort alone switches on the live CLI. A restart would cold-start the
|
|
3013
3047
|
// session and kill any background agents it is running.
|
|
3014
|
-
// (Off disables thinking, a start-up option: to or from it the session restarts.
|
|
3048
|
+
// (Off disables thinking, a start-up option: to or from it the session restarts. Outside the panel
|
|
3049
|
+
// 'off' is Auto: a level back to the model's default switches live, `effortLevel: null`.)
|
|
3050
|
+
const thinkingOff = (value) => isThinkingOff(value, { panel: !!this.panel });
|
|
3015
3051
|
if (this.q && effortChanged && !cwdChanged && !sessionChanged && !newChat
|
|
3016
|
-
&& prevEffort
|
|
3052
|
+
&& !thinkingOff(prevEffort) && !thinkingOff(effort)
|
|
3017
3053
|
&& typeof this.q.applyFlagSettings === 'function') {
|
|
3018
3054
|
const effortLevel = CLAUDE_EFFORT_LEVELS.includes(effort) ? effort : null;
|
|
3019
3055
|
this.q.applyFlagSettings({ effortLevel }).catch(err => log('applyFlagSettings(effort) failed:', err.message));
|
|
@@ -3190,6 +3226,8 @@ export class ClaudeSession {
|
|
|
3190
3226
|
// Release this chat session's owned browser tab so the shared browser can
|
|
3191
3227
|
// grace-reap once no owners remain. Best-effort, in-process on the NI side.
|
|
3192
3228
|
try { deps.releaseBrowserOwner?.(this.synabunOwnerKey); } catch {}
|
|
3229
|
+
// The tab's terminal token ends with its session (nothing may act as it from now on).
|
|
3230
|
+
if (this.panel && this._terminalToken) { try { deps.terminalTokens?.revoke?.(this.synabunOwnerKey); } catch {} this._terminalToken = null; }
|
|
3193
3231
|
_allSessions.delete(this);
|
|
3194
3232
|
}
|
|
3195
3233
|
}
|