synabun 2.3.0 → 2.4.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 +38 -0
- package/README.md +1 -1
- package/browser-extension/content.js +169 -0
- package/browser-extension/engine.js +477 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +244 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +165 -0
- package/browser-extension/popup.html +105 -0
- package/browser-extension/popup.js +347 -0
- package/browser-extension/protocol.js +226 -0
- package/browser-extension/service-worker.js +267 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +94 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +91 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +161 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +190 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +175 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1174 -47
- package/neural-interface/i18n/pt-BR.json +1174 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +840 -0
- package/neural-interface/lib/agents/resolve.js +544 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +229 -102
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +384 -42
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +440 -93
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +255 -0
- package/neural-interface/lib/browser-extension-bridge.js +418 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-profiles.js +1 -1
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/cli-install-api.js +23 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/editor-completion-opencode.js +4 -3
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/maritaca/opencode-proxy.js +7 -2
- package/neural-interface/lib/maritaca/opencode.js +35 -0
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +219 -7
- package/neural-interface/lib/native-loop-runtime.js +24 -1
- package/neural-interface/lib/opencode-build-preflight.js +116 -0
- package/neural-interface/lib/opencode-launch-error.js +13 -0
- package/neural-interface/lib/opencode-native-boundary.js +800 -84
- package/neural-interface/lib/opencode-serve-probe.js +426 -0
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/opencode-serve-scan.js +108 -0
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +60 -21
- package/neural-interface/lib/process-identity.js +235 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/lib/worker-mcp-channel.js +38 -1
- package/neural-interface/package-lock.json +4 -2
- package/neural-interface/package.json +3 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +52 -12
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +36 -6
- package/neural-interface/public/shared/assistant/asst-route.js +78 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +33 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/opencode-verify-view.js +175 -0
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +713 -61
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +12 -1
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-opencode-verify.js +120 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +372 -402
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +5 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +21 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1164 -157
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -32,6 +32,16 @@ export function isBrowserStarting(result) {
|
|
|
32
32
|
* "Failed to auto-create session: …" and agents gave up or reached for another browser.
|
|
33
33
|
*/
|
|
34
34
|
export const AUTO_CREATE_STARTING = 'The browser is still starting (a cold MoreLogin start can take about two minutes); nothing failed. Call browser_navigate again in a moment: it opens the page in that browser as soon as it is ready and never starts a second one.';
|
|
35
|
+
/**
|
|
36
|
+
* A browser start the server refused because the user has to act first (`needsUser`: a MoreLogin profile closed outside
|
|
37
|
+
* SynaBun, MORELOGIN_CLOSED_OUTSIDE; a start MoreLogin refused for its plan): its sentence as it is, with no "call
|
|
38
|
+
* browser_session create" after it (a create is refused the same way) and never announced as a replacement tab.
|
|
39
|
+
*/
|
|
40
|
+
export function userBlockedStart(result) {
|
|
41
|
+
if (!result || result.needsUser !== true || typeof result.error !== 'string' || !result.error)
|
|
42
|
+
return null;
|
|
43
|
+
return { error: result.error, ...(typeof result.code === 'string' ? { code: result.code } : {}), needsUser: true };
|
|
44
|
+
}
|
|
35
45
|
// Existing engagement spacing can consume 90 seconds before the click begins.
|
|
36
46
|
const CLICK_TIMEOUT = 120_000;
|
|
37
47
|
export function isBrowserV2Enabled() {
|
|
@@ -93,7 +103,7 @@ export function isBrowserFastMode() {
|
|
|
93
103
|
export function isBrowserCompactMode() {
|
|
94
104
|
return process.env.SYNABUN_BROWSER_COMPACT === '1' || isBrowserFastMode();
|
|
95
105
|
}
|
|
96
|
-
async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraHeaders = {}) {
|
|
106
|
+
async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraHeaders = {}, preserveJson = false) {
|
|
97
107
|
const cancellation = browserCancellation.getStore();
|
|
98
108
|
const callerSignal = cancellation?.signal;
|
|
99
109
|
const cancellationCode = cancellation?.scope === 'batch' ? 'BATCH_CANCELLED' : 'BROWSER_CANCELLED';
|
|
@@ -165,7 +175,7 @@ async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraH
|
|
|
165
175
|
const { image: _image, screenshot: _screenshot, data: _data, ...textFields } = data;
|
|
166
176
|
estimatedTextTokens = Math.ceil(JSON.stringify(textFields).length / 4);
|
|
167
177
|
}
|
|
168
|
-
if (!res.ok && !data.error) {
|
|
178
|
+
if (!res.ok && !data.error && !preserveJson) {
|
|
169
179
|
data.error = `HTTP ${res.status}`;
|
|
170
180
|
}
|
|
171
181
|
return data;
|
|
@@ -211,7 +221,7 @@ async function request(method, path, body, timeout = DEFAULT_TIMEOUT, opts = {})
|
|
|
211
221
|
const guarded = !!flow && flow.policy !== 'follow' && !!match;
|
|
212
222
|
if (guarded && flow.loss)
|
|
213
223
|
throw new BrowserRouteLost(flow.loss);
|
|
214
|
-
const result = await requestOnce(method, path, body, timeout);
|
|
224
|
+
const result = await requestOnce(method, path, body, timeout, {}, opts.preserveJson);
|
|
215
225
|
const context = batchContext.getStore();
|
|
216
226
|
const missingRoute = isMissingRoute(result);
|
|
217
227
|
const routeOf = () => {
|
|
@@ -276,15 +286,18 @@ async function request(method, path, body, timeout = DEFAULT_TIMEOUT, opts = {})
|
|
|
276
286
|
// Recovery failed: report why (e.g. "MoreLogin connect failed: …"), not the
|
|
277
287
|
// bare "Session not found" that triggered it. Nothing was started.
|
|
278
288
|
const starting = refreshed.starting === true;
|
|
289
|
+
// Refused until the user acts (a MoreLogin profile closed outside SynaBun): no replacement, no create advice.
|
|
290
|
+
const needsUser = refreshed.needsUser === true;
|
|
291
|
+
const refusedCode = needsUser ? refreshed.code : undefined;
|
|
279
292
|
if (guarded) {
|
|
280
293
|
// Every later step of this tool would find the same dead route: the call stops here and says what happened
|
|
281
|
-
// (routeLossMessage: still starting, or create a tab of your own).
|
|
294
|
+
// (routeLossMessage: still starting, refused until the user acts, or create a tab of your own).
|
|
282
295
|
// The loss message says what to do; the hint the recovery's error carries would say it twice.
|
|
283
296
|
const why = refreshed.error.replace(`\n${LOST_ROUTE_HINT}`, '').trim();
|
|
284
|
-
flow.loss = { reason: 'gone', step: stepOf(), from: routeOf(), recovery: { error: why, ...(starting && { starting: true }) } };
|
|
297
|
+
flow.loss = { reason: 'gone', step: stepOf(), from: routeOf(), recovery: { error: why, ...(starting && { starting: true }), ...(needsUser && { needsUser: true, ...(refusedCode && { code: refusedCode }) }) } };
|
|
285
298
|
throw new BrowserRouteLost(flow.loss);
|
|
286
299
|
}
|
|
287
|
-
return { ...result, error: refreshed.error, recoveryFailed: true, ...(starting && { starting: true }) };
|
|
300
|
+
return { ...result, error: refreshed.error, recoveryFailed: true, ...(starting && { starting: true }), ...(needsUser && { needsUser: true, ...(refusedCode && { code: refusedCode }) }) };
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
if (guarded && !context && missingRoute && opts.recover !== false) {
|
|
@@ -394,17 +407,22 @@ export async function reportRuntimeTools(groups, options) {
|
|
|
394
407
|
// of cross-automation tab collisions: every HTTP caller shared them.
|
|
395
408
|
// Join the ONE shared browser with a dedicated, owned tab (instead of launching a
|
|
396
409
|
// second browser on a persistent profile, which fails with "profile is locked").
|
|
397
|
-
async function acquireInteractive(id, url) {
|
|
410
|
+
async function acquireInteractive(id, url, takeOverTab) {
|
|
398
411
|
// The tab is owned by the id this caller routes as (X-Synabun-Terminal): the server checks an explicit tab against
|
|
399
412
|
// that header, so a tab filed under the process's client id was refused to a run with a terminal pin and no browser
|
|
400
413
|
// pin (a native run without a browser, a brain's MCP child) as "another owner's".
|
|
401
414
|
const resp = await request('POST', '/api/browser/acquire', {
|
|
402
415
|
clientId: terminalIdFor(id),
|
|
403
416
|
url: url || 'about:blank',
|
|
417
|
+
...(takeOverTab && { takeOverTab }),
|
|
404
418
|
}, SESSION_CREATE_TIMEOUT);
|
|
405
419
|
// Still starting (a cold MoreLogin start): nothing failed, and the tab is kept for this caller's next request.
|
|
406
420
|
if (isBrowserStarting(resp))
|
|
407
421
|
return { error: String(resp.error || 'The browser is still starting. Call the browser tool again in a moment.'), starting: true };
|
|
422
|
+
// Refused until the user acts (a profile closed outside SynaBun): said as it is, and no replacement is announced.
|
|
423
|
+
const blocked = userBlockedStart(resp);
|
|
424
|
+
if (blocked)
|
|
425
|
+
return blocked;
|
|
408
426
|
if (resp.error || !resp.sessionId) {
|
|
409
427
|
return { error: `Failed to acquire a shared browser tab: ${resp.error || 'no session returned'}` };
|
|
410
428
|
}
|
|
@@ -414,7 +432,7 @@ async function acquireInteractive(id, url) {
|
|
|
414
432
|
// A tab of its own again, after the one it had went away: the call says so.
|
|
415
433
|
if (id.state.lostRoute)
|
|
416
434
|
announceReplacement(id, { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId });
|
|
417
|
-
return { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId || undefined };
|
|
435
|
+
return { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId || undefined, ...(resp.profileMode === 'extension' && typeof resp.url === 'string' ? { openedUrl: resp.url } : {}) };
|
|
418
436
|
}
|
|
419
437
|
function adoptCreatedSession(id, created, tabId) {
|
|
420
438
|
const sessionId = created.sessionId;
|
|
@@ -497,7 +515,9 @@ function ownedTabIn(listing, sessionId, id, tabId) {
|
|
|
497
515
|
if (!session || !servesDefault(session))
|
|
498
516
|
return null;
|
|
499
517
|
const owners = session.tabOwners || {};
|
|
500
|
-
const mine =
|
|
518
|
+
const mine = session.profileMode === 'extension' && session.ownTabsOnly === true
|
|
519
|
+
? (session.tabs || []).map(t => t.id)
|
|
520
|
+
: [owners[terminalIdFor(id)], owners[id.clientId]].filter((t) => typeof t === 'string' && t.length > 0);
|
|
501
521
|
const open = (t) => !session.tabs || session.tabs.some(x => x.id === t);
|
|
502
522
|
if (tabId && mine.includes(tabId) && open(tabId))
|
|
503
523
|
return tabId;
|
|
@@ -526,7 +546,7 @@ async function recordOwnRoute(id, listing, sessionId, tabId) {
|
|
|
526
546
|
* open, e.g. after another MCP process of the run recovered first). `reason: 'create'`: the run's own
|
|
527
547
|
* browser_session create, always a new tab. The server records the move on the run (state file, run record).
|
|
528
548
|
*/
|
|
529
|
-
async function recoverRunBrowser(id, lost, reason) {
|
|
549
|
+
async function recoverRunBrowser(id, lost, reason, takeOverTab) {
|
|
530
550
|
const pins = effectivePins(id);
|
|
531
551
|
const terminalSessionId = pins.terminalSessionId || id.state.ancestorPinnedTerminal || undefined;
|
|
532
552
|
const body = {};
|
|
@@ -534,6 +554,9 @@ async function recoverRunBrowser(id, lost, reason) {
|
|
|
534
554
|
body.terminalSessionId = terminalSessionId;
|
|
535
555
|
if (reason)
|
|
536
556
|
body.reason = reason;
|
|
557
|
+
// A create that takes over one of the owner's tabs in the everyday browser (extension mode, full control).
|
|
558
|
+
if (reason === 'create' && takeOverTab)
|
|
559
|
+
body.takeOverTab = takeOverTab;
|
|
537
560
|
if (lost?.sessionId)
|
|
538
561
|
body.lost = { sessionId: lost.sessionId, tabId: lost.tabId || null };
|
|
539
562
|
const recovered = await request('POST', '/api/loop/recover-browser', body, SESSION_CREATE_TIMEOUT);
|
|
@@ -743,6 +766,25 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
743
766
|
// this caller to a specific browser session (multi-session isolation).
|
|
744
767
|
// If pinned session died, check recovery cache first, then auto-create.
|
|
745
768
|
const pinnedSession = pins.browserSessionId || id.state.ancestorPinnedSession || undefined;
|
|
769
|
+
// Extension ownership is per tab, even for a pinned run. Reuse its normal liveness read to verify explicit ids.
|
|
770
|
+
const explicitExtensionTab = async (listing) => {
|
|
771
|
+
if (!pinnedSession || !tabId)
|
|
772
|
+
return null;
|
|
773
|
+
const targetSession = sessionId || id.state.recoveredSessionId || pinnedSession;
|
|
774
|
+
const target = (listing.sessions || []).find(s => s.id === targetSession);
|
|
775
|
+
if (target?.profileMode !== 'extension' || target.ownTabsOnly !== true)
|
|
776
|
+
return null;
|
|
777
|
+
if (!target.tabs?.some(t => t.id === tabId))
|
|
778
|
+
return { error: 'NOT_OWNED: This is not an open tab owned by this caller.' };
|
|
779
|
+
repin(id, targetSession, tabId);
|
|
780
|
+
await recordOwnRoute(id, listing, targetSession, tabId);
|
|
781
|
+
return { sessionId: targetSession, tabId };
|
|
782
|
+
};
|
|
783
|
+
if (namedListing) {
|
|
784
|
+
const explicit = await explicitExtensionTab(namedListing);
|
|
785
|
+
if (explicit)
|
|
786
|
+
return explicit;
|
|
787
|
+
}
|
|
746
788
|
// A pinned run that names a session of its own by hand (the one its browser_session create returned, or one it
|
|
747
789
|
// recovered into in an earlier process): that session and its own open tab there, never the dead pinned tab paired
|
|
748
790
|
// with it. The run's route moves there, here and on the server (recordOwnRoute). A session that is not the run's
|
|
@@ -772,6 +814,9 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
772
814
|
// Return the RECOVERED tab, never the stale pinned tab (which 404s).
|
|
773
815
|
if (id.state.recoveredSessionId) {
|
|
774
816
|
const recheck = await request('GET', '/api/browser/sessions');
|
|
817
|
+
const explicit = await explicitExtensionTab(recheck);
|
|
818
|
+
if (explicit)
|
|
819
|
+
return explicit;
|
|
775
820
|
const alive = (recheck.sessions || []).find(s => s.id === id.state.recoveredSessionId);
|
|
776
821
|
// The recovered TAB must still be there too: one closed while its session lives was returned forever
|
|
777
822
|
// ("Tab … not found in session" on every call, 2026-10-04).
|
|
@@ -783,7 +828,14 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
783
828
|
id.state.recoveredTabId = null;
|
|
784
829
|
}
|
|
785
830
|
const check = await request('GET', '/api/browser/sessions');
|
|
831
|
+
const explicit = await explicitExtensionTab(check);
|
|
832
|
+
if (explicit)
|
|
833
|
+
return explicit;
|
|
786
834
|
const listed = (check.sessions || []);
|
|
835
|
+
// Extension tabs are never silently replaced after close/revoke/browser restart. The adapter returns TAB_CLOSED.
|
|
836
|
+
if (check.defaultBrowser?.connectMode === 'extension') {
|
|
837
|
+
return { sessionId: id.state.recoveredSessionId || pinnedSession, tabId: id.state.recoveredTabId || resolvedTabId };
|
|
838
|
+
}
|
|
787
839
|
// The route the server recorded for this run (yourRoute): where a recovery or the run's own browser_session
|
|
788
840
|
// create moved it, also when that happened in an earlier MCP process of the run (a Codex turn, a restarted
|
|
789
841
|
// stdio child) that this one never heard of. Used while its tab is open; the pin otherwise.
|
|
@@ -820,6 +872,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
820
872
|
const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
|
|
821
873
|
if (isBrowserStarting(recovered))
|
|
822
874
|
return { error: String(recovered.error), starting: true };
|
|
875
|
+
if (userBlockedStart(recovered))
|
|
876
|
+
return userBlockedStart(recovered);
|
|
823
877
|
if (!recovered.error && recovered.sessionId) {
|
|
824
878
|
return { sessionId: recovered.sessionId, tabId: recovered.tabId || undefined };
|
|
825
879
|
}
|
|
@@ -838,6 +892,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
838
892
|
const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
|
|
839
893
|
if (isBrowserStarting(recovered))
|
|
840
894
|
return { error: String(recovered.error), starting: true };
|
|
895
|
+
if (userBlockedStart(recovered))
|
|
896
|
+
return userBlockedStart(recovered);
|
|
841
897
|
if (!recovered.error && recovered.sessionId) {
|
|
842
898
|
return { sessionId: recovered.sessionId, tabId: recovered.tabId || undefined };
|
|
843
899
|
}
|
|
@@ -852,6 +908,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
852
908
|
const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
|
|
853
909
|
if (isBrowserStarting(recovered))
|
|
854
910
|
return { error: String(recovered.error), starting: true };
|
|
911
|
+
if (userBlockedStart(recovered))
|
|
912
|
+
return userBlockedStart(recovered);
|
|
855
913
|
if (recovered.error || !recovered.sessionId) {
|
|
856
914
|
return { error: `Pinned browser session ${pinnedSession} is no longer available and recovery failed: ${recovered.error || 'no session returned'}\n${LOST_ROUTE_HINT}` };
|
|
857
915
|
}
|
|
@@ -888,6 +946,9 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
888
946
|
}
|
|
889
947
|
const check = await request('GET', '/api/browser/sessions');
|
|
890
948
|
const alive = (check.sessions || []).find(s => s.id === id.state.interactiveSessionId);
|
|
949
|
+
if (check.defaultBrowser?.connectMode === 'extension') {
|
|
950
|
+
return { sessionId: id.state.interactiveSessionId, tabId: resolvedTabId || id.state.interactiveTabId || undefined };
|
|
951
|
+
}
|
|
891
952
|
if (alive && servesDefault(alive))
|
|
892
953
|
return { sessionId: id.state.interactiveSessionId, tabId: resolvedTabId || id.state.interactiveTabId || undefined };
|
|
893
954
|
id.state.lostRoute = { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId };
|
|
@@ -905,6 +966,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
905
966
|
// Still starting: not a failure (the server keeps the start for this caller's next call).
|
|
906
967
|
if (isBrowserStarting(created))
|
|
907
968
|
return { error: AUTO_CREATE_STARTING, starting: true };
|
|
969
|
+
if (userBlockedStart(created))
|
|
970
|
+
return userBlockedStart(created);
|
|
908
971
|
if (created.error) {
|
|
909
972
|
if (/lock/i.test(created.error))
|
|
910
973
|
return acquireInteractive(id, autoCreate.url);
|
|
@@ -944,6 +1007,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
|
|
|
944
1007
|
// Still starting: not a failure (the server keeps the start for this caller's next call).
|
|
945
1008
|
if (isBrowserStarting(created))
|
|
946
1009
|
return { error: AUTO_CREATE_STARTING, starting: true };
|
|
1010
|
+
if (userBlockedStart(created))
|
|
1011
|
+
return userBlockedStart(created);
|
|
947
1012
|
if (created.error) {
|
|
948
1013
|
if (/lock/i.test(created.error))
|
|
949
1014
|
return acquireInteractive(id, autoCreate?.url);
|
|
@@ -1044,7 +1109,9 @@ export async function resolveBatchRoute(sessionId, tabId) {
|
|
|
1044
1109
|
return { error: result.error };
|
|
1045
1110
|
const session = result.sessions?.find(s => s.id === resolved.sessionId);
|
|
1046
1111
|
const id = getIdentity();
|
|
1047
|
-
const ownedTabs =
|
|
1112
|
+
const ownedTabs = session?.profileMode === 'extension' && session.ownTabsOnly === true
|
|
1113
|
+
? (session.tabs || []).map(t => t.id)
|
|
1114
|
+
: [session?.tabOwners?.[terminalIdFor(id)], session?.tabOwners?.[id.clientId]].filter(Boolean);
|
|
1048
1115
|
const ownedTab = resolved.tabId || ownedTabs[0];
|
|
1049
1116
|
if (!ownedTab || !ownedTabs.includes(ownedTab)) {
|
|
1050
1117
|
return { error: 'browser_batch requires a tab owned by this caller. Use browser_navigate to acquire a tab first.' };
|
|
@@ -1081,12 +1148,16 @@ export async function browserRouteStatus() {
|
|
|
1081
1148
|
if (listing.error)
|
|
1082
1149
|
return { ...empty, error: listing.error };
|
|
1083
1150
|
const raw = (listing.sessions || []);
|
|
1151
|
+
const extensionTabs = listing.extensionTabs;
|
|
1152
|
+
const ownerTabs = Array.isArray(extensionTabs?.tabs)
|
|
1153
|
+
? extensionTabs.tabs.filter(t => typeof t?.id === 'string').map(t => ({ id: t.id, url: typeof t.url === 'string' ? t.url : '', title: typeof t.title === 'string' ? t.title : '', ...(t.owner === null || typeof t.owner === 'string' ? { owner: t.owner } : {}) }))
|
|
1154
|
+
: undefined;
|
|
1084
1155
|
const keys = [terminalIdFor(id), id.clientId];
|
|
1085
1156
|
const sessions = raw.map((s) => {
|
|
1086
1157
|
const owners = s.tabOwners || {};
|
|
1087
1158
|
const mine = new Set(keys.map(k => owners[k]).filter((t) => typeof t === 'string' && t.length > 0));
|
|
1088
1159
|
const all = s.tabs || [];
|
|
1089
|
-
const tabs = all.filter(t => mine.has(t.id)).map(t => ({ id: t.id, url: t.url || '', title: t.title || '' }));
|
|
1160
|
+
const tabs = all.filter(t => s.ownTabsOnly === true || mine.has(t.id)).map(t => ({ id: t.id, url: t.url || '', title: t.title || '' }));
|
|
1090
1161
|
const otherTabs = typeof s.otherTabs === 'number' ? s.otherTabs : all.length - tabs.length;
|
|
1091
1162
|
return { id: s.id, tabs, otherTabs, servesDefault: servesDefault(s), profile: describeSession(s) };
|
|
1092
1163
|
});
|
|
@@ -1145,7 +1216,7 @@ export async function browserRouteStatus() {
|
|
|
1145
1216
|
const yourProfile = listing.yourProfile;
|
|
1146
1217
|
const profile = yourProfile && typeof yourProfile.envId === 'string'
|
|
1147
1218
|
? { envId: yourProfile.envId, name: typeof yourProfile.name === 'string' ? yourProfile.name : null } : null;
|
|
1148
|
-
return { sessions, current, replacedTabs, lost: id.state.lostRoute, movedFromPin, movedFrom, profile };
|
|
1219
|
+
return { sessions, current, replacedTabs, lost: id.state.lostRoute, movedFromPin, movedFrom, profile, ...(ownerTabs && { ownerTabs }) };
|
|
1149
1220
|
}
|
|
1150
1221
|
/**
|
|
1151
1222
|
* browser_session create: a new browser tab of this caller's own, where it continues.
|
|
@@ -1158,7 +1229,11 @@ export async function browserRouteStatus() {
|
|
|
1158
1229
|
* A url other than about:blank is opened in the new tab. A start the server is still running answers
|
|
1159
1230
|
* BROWSER_STARTING (isBrowserStarting): the next create gets that same start, never a second browser.
|
|
1160
1231
|
*/
|
|
1161
|
-
|
|
1232
|
+
/**
|
|
1233
|
+
* `takeOverTab`: the id of one of the owner's open tabs in the everyday browser (browser_session list shows them in
|
|
1234
|
+
* full control). The new route is that tab instead of a new one; the server refuses it in any other setup.
|
|
1235
|
+
*/
|
|
1236
|
+
export async function createSession(url, takeOverTab) {
|
|
1162
1237
|
const id = getIdentity();
|
|
1163
1238
|
const pins = effectivePins(id);
|
|
1164
1239
|
const target = url || 'about:blank';
|
|
@@ -1170,7 +1245,7 @@ export async function createSession(url) {
|
|
|
1170
1245
|
let created;
|
|
1171
1246
|
let opened = false; // the new tab is already at `target`
|
|
1172
1247
|
if (pinned) {
|
|
1173
|
-
created = await recoverRunBrowser(id, null, 'create');
|
|
1248
|
+
created = await recoverRunBrowser(id, null, 'create', takeOverTab);
|
|
1174
1249
|
if (created.error || isBrowserStarting(created) || typeof created.sessionId !== 'string')
|
|
1175
1250
|
return created;
|
|
1176
1251
|
created = { ...created, repinned: true };
|
|
@@ -1184,7 +1259,7 @@ export async function createSession(url) {
|
|
|
1184
1259
|
let shared = lockRisk;
|
|
1185
1260
|
created = {};
|
|
1186
1261
|
if (!lockRisk) {
|
|
1187
|
-
created = await request('POST', '/api/browser/sessions', { url: target }, SESSION_CREATE_TIMEOUT);
|
|
1262
|
+
created = await request('POST', '/api/browser/sessions', { url: target, ...(takeOverTab && { takeOverTab }) }, SESSION_CREATE_TIMEOUT);
|
|
1188
1263
|
if (isBrowserStarting(created))
|
|
1189
1264
|
return created;
|
|
1190
1265
|
if (created.error && /lock/i.test(created.error))
|
|
@@ -1203,11 +1278,12 @@ export async function createSession(url) {
|
|
|
1203
1278
|
}
|
|
1204
1279
|
}
|
|
1205
1280
|
if (shared) {
|
|
1206
|
-
const acquired = await acquireInteractive(id, target);
|
|
1281
|
+
const acquired = await acquireInteractive(id, target, takeOverTab);
|
|
1207
1282
|
if ('error' in acquired)
|
|
1208
1283
|
return { error: acquired.error, ...(acquired.starting && { starting: true, code: 'BROWSER_STARTING' }) };
|
|
1209
1284
|
resolvedRoutes.delete(id);
|
|
1210
|
-
|
|
1285
|
+
opened = typeof acquired.openedUrl === 'string';
|
|
1286
|
+
created = { ok: true, sessionId: acquired.sessionId, tabId: acquired.tabId || null, shared: true, ...(opened ? { url: acquired.openedUrl } : {}) };
|
|
1211
1287
|
}
|
|
1212
1288
|
}
|
|
1213
1289
|
const sessionId = created.sessionId;
|
|
@@ -1225,13 +1301,17 @@ export async function createSession(url) {
|
|
|
1225
1301
|
* caller's own tab there (`sessionKept`). Either way this caller's cached route to it is forgotten: the next call
|
|
1226
1302
|
* resolves again (a pinned run gets a tab back through its recovery).
|
|
1227
1303
|
*/
|
|
1228
|
-
export async function closeSession(sessionId) {
|
|
1229
|
-
const
|
|
1304
|
+
export async function closeSession(sessionId, tabId) {
|
|
1305
|
+
const qs = tabId ? `?tabId=${encodeURIComponent(tabId)}` : '';
|
|
1306
|
+
const result = await request('DELETE', `/api/browser/sessions/${sessionId}${qs}`);
|
|
1230
1307
|
if (!result.error) {
|
|
1231
1308
|
const id = getIdentity();
|
|
1232
1309
|
// The tab that went (the server's releasedTabId, else the one this caller routed to there): the next call that
|
|
1233
1310
|
// opens a tab for this caller says it replaced this one.
|
|
1234
1311
|
const cachedRoute = resolvedRoutes.get(id)?.route;
|
|
1312
|
+
const currentTab = cachedRoute?.tabId || id.state.recoveredTabId || id.state.interactiveTabId;
|
|
1313
|
+
if (tabId && result.releasedTabId === tabId && result.sessionKept === true && currentTab && currentTab !== tabId)
|
|
1314
|
+
return result;
|
|
1235
1315
|
const closedTab = typeof result.releasedTabId === 'string' ? result.releasedTabId
|
|
1236
1316
|
: cachedRoute?.sessionId === sessionId ? cachedRoute.tabId || null
|
|
1237
1317
|
: id.state.recoveredSessionId === sessionId ? id.state.recoveredTabId
|
|
@@ -1632,7 +1712,7 @@ export async function moreloginStop(envId) {
|
|
|
1632
1712
|
}
|
|
1633
1713
|
/**
|
|
1634
1714
|
* This caller works in a MoreLogin profile of its own from now on (POST /api/morelogin/use): `envId`, `name` or
|
|
1635
|
-
* `profile` (either) of a profile MoreLogin lists, or `default: true` for the default
|
|
1715
|
+
* `profile` (either) of a profile MoreLogin lists, or `default: true` for the default AI browser (Settings → Connected tools → MoreLogin). Only this
|
|
1636
1716
|
* caller moves: the default AI browser and every other session stay where they are. The server releases what the
|
|
1637
1717
|
* caller owned in the browser it leaves; here every route this process knew is forgotten, so its next browser call
|
|
1638
1718
|
* resolves again and gets a tab of its own in the new profile (started then). The route it left is kept as its lost
|
|
@@ -1684,6 +1764,15 @@ export async function skillsV2(method, path, body, timeout = LONG_TIMEOUT) {
|
|
|
1684
1764
|
const credential = callerBrainCredential();
|
|
1685
1765
|
return requestOnce(method, `/api/skills-studio/v2${path}`, body, timeout, credential ? { 'X-Synabun-Brain-Token': credential } : {});
|
|
1686
1766
|
}
|
|
1767
|
+
// ── agents-p6 BEGIN: agent definitions (the `agent_definition` tool of the role-gated `skills` group) ──
|
|
1768
|
+
// One thin call over /api/agents-studio/v1 (neural-interface/lib/agents-studio-api.js), which owns every rule: the
|
|
1769
|
+
// Assistant reads, drafts, checks and submits for review; approving, deleting and writing a native export are the
|
|
1770
|
+
// owner's, from the app's own page, and those routes refuse a request that carries the agent headers requestOnce
|
|
1771
|
+
// sends. The brain credential rides along as for skillsV2: the server knows the Assistant by it, never by the role.
|
|
1772
|
+
export async function agentsStudio(method, path, body, timeout = LONG_TIMEOUT) {
|
|
1773
|
+
const credential = callerBrainCredential();
|
|
1774
|
+
return requestOnce(method, `/api/agents-studio/v1${path}`, body, timeout, credential ? { 'X-Synabun-Brain-Token': credential } : {});
|
|
1775
|
+
}
|
|
1687
1776
|
// A dispatch may acquire a browser tab before the run is accepted.
|
|
1688
1777
|
const ASSISTANT_DISPATCH_TIMEOUT = 90_000;
|
|
1689
1778
|
// Long-poll waits block server-side for up to timeoutMs; the HTTP deadline
|
|
@@ -1737,7 +1826,7 @@ export async function assistantResult(runId) {
|
|
|
1737
1826
|
return request('GET', assistantRunPath(runId, '/result'));
|
|
1738
1827
|
}
|
|
1739
1828
|
export async function assistantTranscript(runId, opts = {}) {
|
|
1740
|
-
return request('GET', assistantRunPath(runId, `/transcript${queryString({ format: opts.format, tail: opts.tail, maxChars: opts.maxChars })}`), undefined, LONG_TIMEOUT);
|
|
1829
|
+
return request('GET', assistantRunPath(runId, `/transcript${queryString({ format: opts.format, tail: opts.tail, maxChars: opts.maxChars, offset: opts.offset })}`), undefined, LONG_TIMEOUT);
|
|
1741
1830
|
}
|
|
1742
1831
|
export async function assistantSend(runId, body) {
|
|
1743
1832
|
return request('POST', assistantRunPath(runId, '/send'), body, LONG_TIMEOUT);
|
|
@@ -1746,7 +1835,8 @@ export async function assistantPermission(runId, body) {
|
|
|
1746
1835
|
return request('POST', assistantRunPath(runId, '/permission'), body, LONG_TIMEOUT);
|
|
1747
1836
|
}
|
|
1748
1837
|
export async function assistantWaitRun(runId, opts) {
|
|
1749
|
-
|
|
1838
|
+
const query = queryString({ until: opts.until, timeout: opts.timeoutMs, afterSeq: opts.afterSeq, kinds: opts.kinds && opts.kinds.length ? opts.kinds.join(',') : undefined });
|
|
1839
|
+
return request('GET', assistantRunPath(runId, `/wait${query}`), undefined, opts.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
|
|
1750
1840
|
}
|
|
1751
1841
|
export async function assistantWaitMany(body) {
|
|
1752
1842
|
return request('POST', '/api/assistant/wait', body, body.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
|
|
@@ -1760,6 +1850,61 @@ export async function assistantKillAll(body = {}) {
|
|
|
1760
1850
|
export async function assistantFocus(runId, focus) {
|
|
1761
1851
|
return request('POST', assistantRunPath(runId, '/focus'), { focus });
|
|
1762
1852
|
}
|
|
1853
|
+
// ── agents-p4: teams ──
|
|
1854
|
+
// agent_team (the Assistant's own: /api/assistant/teams/*) and a worker's `team` tool (/api/assistant/team/*, where
|
|
1855
|
+
// the Neural Interface takes the team from the caller's proven run, never from the request).
|
|
1856
|
+
const ASSISTANT_TEAM_TIMEOUT = 120_000;
|
|
1857
|
+
function assistantTeamPath(teamId, suffix = '') {
|
|
1858
|
+
return `/api/assistant/teams/${encodeURIComponent(teamId)}${suffix}`;
|
|
1859
|
+
}
|
|
1860
|
+
export async function assistantTeamList(opts = {}) {
|
|
1861
|
+
return request('GET', `/api/assistant/teams${queryString({ assistantSessionId: opts.assistantSessionId, open: opts.open ? '1' : undefined })}`, undefined, LONG_TIMEOUT);
|
|
1862
|
+
}
|
|
1863
|
+
export async function assistantTeamPlan(body) {
|
|
1864
|
+
return request('POST', '/api/assistant/teams/plan', body, LONG_TIMEOUT);
|
|
1865
|
+
}
|
|
1866
|
+
/** Creates the worktrees and dispatches the first workers: as long as a dispatch may take, and more. */
|
|
1867
|
+
export async function assistantTeamStart(body) {
|
|
1868
|
+
return request('POST', '/api/assistant/teams/start', body, ASSISTANT_TEAM_TIMEOUT);
|
|
1869
|
+
}
|
|
1870
|
+
export async function assistantTeamStatus(teamId) {
|
|
1871
|
+
return request('GET', assistantTeamPath(teamId), undefined, LONG_TIMEOUT);
|
|
1872
|
+
}
|
|
1873
|
+
/** A join runs the team's test command on the integration branch: the answer may take as long as the tests. */
|
|
1874
|
+
export async function assistantTeamIntegrate(teamId, body = {}) {
|
|
1875
|
+
return request('POST', assistantTeamPath(teamId, '/integrate'), body, ASSISTANT_TEAM_TIMEOUT);
|
|
1876
|
+
}
|
|
1877
|
+
export async function assistantTeamLand(teamId, body = {}) {
|
|
1878
|
+
return request('POST', assistantTeamPath(teamId, '/land'), body, ASSISTANT_TEAM_TIMEOUT);
|
|
1879
|
+
}
|
|
1880
|
+
export async function assistantTeamCleanup(teamId, body) {
|
|
1881
|
+
return request('POST', assistantTeamPath(teamId, '/cleanup'), body, ASSISTANT_TEAM_TIMEOUT, { preserveJson: true });
|
|
1882
|
+
}
|
|
1883
|
+
export async function assistantTeamDiscard(teamId, body = {}) {
|
|
1884
|
+
return request('POST', assistantTeamPath(teamId, '/discard'), body, ASSISTANT_TEAM_TIMEOUT);
|
|
1885
|
+
}
|
|
1886
|
+
/** Does the calling run work a team slice now? `{ ok: true, team: true, teamId, sliceId }`, or a refusal. */
|
|
1887
|
+
export async function teamContext(timeoutMs = 2500) {
|
|
1888
|
+
return requestOnce('GET', '/api/assistant/team/context', undefined, timeoutMs);
|
|
1889
|
+
}
|
|
1890
|
+
export async function teamPost(body) {
|
|
1891
|
+
return request('POST', '/api/assistant/team/post', body, LONG_TIMEOUT);
|
|
1892
|
+
}
|
|
1893
|
+
export async function teamRead(body) {
|
|
1894
|
+
return request('POST', '/api/assistant/team/read', body, LONG_TIMEOUT);
|
|
1895
|
+
}
|
|
1896
|
+
export async function teamWait(body) {
|
|
1897
|
+
return request('POST', '/api/assistant/team/wait', body, body.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
|
|
1898
|
+
}
|
|
1899
|
+
export async function teamAck(body) {
|
|
1900
|
+
return request('POST', '/api/assistant/team/ack', body, LONG_TIMEOUT);
|
|
1901
|
+
}
|
|
1902
|
+
export async function teamClaims(body = {}) {
|
|
1903
|
+
return request('POST', '/api/assistant/team/claims', body, LONG_TIMEOUT);
|
|
1904
|
+
}
|
|
1905
|
+
export async function teamRequest(body) {
|
|
1906
|
+
return request('POST', '/api/assistant/team/request', body, LONG_TIMEOUT);
|
|
1907
|
+
}
|
|
1763
1908
|
// whatsapp_send_file: the server's own deadline for the send is 120 s (lib/whatsapp/manager.js); this
|
|
1764
1909
|
// one outlives it so a server timeout is reported as the server's.
|
|
1765
1910
|
const WHATSAPP_SEND_FILE_TIMEOUT = 130_000;
|