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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRouteReplayGuard } from './route-identity.js';
|
|
1
2
|
import { fetchToolCatalog } from '../agent-runtime-options.js';
|
|
2
3
|
// ═══════════════════════════════════════════
|
|
3
4
|
// SynaBun Assistant — panel (mount / lifecycle)
|
|
@@ -44,6 +45,7 @@ import { injectAssistantStyles } from './asst-styles.js';
|
|
|
44
45
|
import { tipsSeen, tourOffered } from '../tour/tour-state.js';
|
|
45
46
|
import { createAssistantSocket } from './asst-ws.js';
|
|
46
47
|
import { createRenderer, ICON_ASSISTANT, mdInto } from './asst-render.js';
|
|
48
|
+
import { createLimitDismissals } from './asst-limit-dismissals.js';
|
|
47
49
|
import { createMascotDirector, MASCOT_TIMING, turnEndPose } from './asst-mascot.js';
|
|
48
50
|
import { lastInputAt, onKey, onPointer } from '../synabun-ticker.js';
|
|
49
51
|
import { buildControlResponse, closedControlState, normalizeControlRequest, renderControlCard } from './asst-control.js';
|
|
@@ -52,6 +54,8 @@ import { buildDispatchSpec, parseSlashCommand, slashHelpMarkdown } from './asst-
|
|
|
52
54
|
import { resolveStopTarget } from './asst-stop.js';
|
|
53
55
|
import { plural } from './asst-tool-kinds.js';
|
|
54
56
|
import { cachedProjects, createBrainPicker, openModelMenu, testDensityLabel } from './asst-brain-picker.js';
|
|
57
|
+
import { agentDensityCap, agentDensityLabel } from './asst-brain-picker.js'; // agents-p4
|
|
58
|
+
import { normalizeAgentDensity } from './asst-state.js'; // agents-p4
|
|
55
59
|
import { createRovingToolbar } from './asst-roving.js';
|
|
56
60
|
import { openAccountsManager } from './asst-accounts.js';
|
|
57
61
|
import { createAgentsDock } from './asst-agents-dock.js';
|
|
@@ -65,8 +69,10 @@ import { computerRemoteView, createComputerPanel, createComputerToggle, normaliz
|
|
|
65
69
|
import {
|
|
66
70
|
applyLimit, applyLimitPacket, applyUsagePacket, BRAIN_PROVIDERS, brainLabel, createRenameWriter, createTabState, DEFAULT_ROUTE_MODE, deserializeTabState, fmtCost, fmtRunLine, limitExpiresIn, limitNoticeText, modelShortName,
|
|
67
71
|
brainModePatch, isBrainProvider, normalizeBrain, normalizeComputerMode, permissionModeLabel, normalizeRouteMode, normalizeTestDensity, projectLabel, providerMeta, providerShortLabel, readStoredBrain, runFromPayload,
|
|
68
|
-
serializeTabState, sessionStatus, slashBrainEffort, tabStorageKey, userSessionTitle,
|
|
72
|
+
serializeTabState, sessionStatus, slashBrainEffort, tabStorageKey, userSessionTitle, conversationCanWait,
|
|
69
73
|
} from './asst-state.js';
|
|
74
|
+
import { idleQueue } from '../idle-queue.js';
|
|
75
|
+
import { watchTranscriptRows } from '../transcript-rows.js';
|
|
70
76
|
import {
|
|
71
77
|
closeAssistantSession, dispatchAssistantRun, escalateAssistantRun, focusAssistantRun, getAssistantRun,
|
|
72
78
|
fetchManageCatalog, getAssistantRunResult, getAssistantSession, getAssistantSessionUsage, getRouting, killAllAssistantRuns, removeAssistantRun, clearFinishedAssistantRuns,
|
|
@@ -152,6 +158,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
152
158
|
routeMode: saved?.routeMode ?? null,
|
|
153
159
|
computerUse: saved?.computerUse ?? null,
|
|
154
160
|
testDensity: saved?.testDensity ?? null,
|
|
161
|
+
agentDensity: saved?.agentDensity ?? null, // agents-p4
|
|
155
162
|
usageView: saved?.usageView || null,
|
|
156
163
|
});
|
|
157
164
|
Object.assign(st, {
|
|
@@ -165,6 +172,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
165
172
|
routing: null, // server view { mode, effectiveMode, defaultMode, askBelow }
|
|
166
173
|
features: { routing: null, computer: null, testDensity: null, rename: null, adminSandbox: null }, // null = unknown yet
|
|
167
174
|
testDensityEffective: null, // server view: the level in effect
|
|
175
|
+
agentDensityEffective: null, // agents-p4: server view: the Agent density in effect
|
|
168
176
|
adminSandbox: null, // server view: the global Admin sandbox setting (every agent)
|
|
169
177
|
brainCapabilities: null,
|
|
170
178
|
computerEffective: st.computerUse === true,
|
|
@@ -184,6 +192,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
184
192
|
// arrived (control_cancelled after it) says so instead of keeping "Allowed".
|
|
185
193
|
const answeredCards = new Map();
|
|
186
194
|
const routeCards = new Map(); // routeId → route card entry
|
|
195
|
+
const routeReplay = createRouteReplayGuard(); // late control replays must not reopen an answered card
|
|
187
196
|
const clarifyCards = new Set(); // requestIds of clarify cards shown here (the card records their outcome)
|
|
188
197
|
// Prompts this panel sent (request_id → { payload, row }): one the server refuses comes back to the composer.
|
|
189
198
|
const sentQueries = new Map();
|
|
@@ -196,6 +205,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
196
205
|
let replaying = false;
|
|
197
206
|
const unsubs = [];
|
|
198
207
|
let destroyed = false;
|
|
208
|
+
let brainChange = null;
|
|
209
|
+
let confirmedBrain = st.brain;
|
|
199
210
|
let persistTimer = null;
|
|
200
211
|
let helpModal = null;
|
|
201
212
|
let director = null; // the mascot on screen (asst-mascot.js), made once the renderer and the composer exist
|
|
@@ -499,6 +510,17 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
499
510
|
if (data?.session) st.budget = data.session;
|
|
500
511
|
renderCost();
|
|
501
512
|
} });
|
|
513
|
+
// Rows far from the screen are skipped by the engine, at their exact size (transcript-rows.js). Left
|
|
514
|
+
// alone whatever their place: a row that is being written, a rack that still works, the open cards at the
|
|
515
|
+
// bottom, the "Working…" row, the empty state and the limit dock (it sticks to the transcript's edge).
|
|
516
|
+
const rowWatcher = watchTranscriptRows(transcriptEl, {
|
|
517
|
+
skip: (row) => {
|
|
518
|
+
const c = row.classList;
|
|
519
|
+
return c.contains('streaming') || c.contains('asst-ask-tail') || c.contains('asst-limit-dock')
|
|
520
|
+
|| c.contains('asst-working') || c.contains('asst-empty')
|
|
521
|
+
|| (c.contains('asst-rack') && row.dataset.state !== 'settled');
|
|
522
|
+
},
|
|
523
|
+
});
|
|
502
524
|
const renderer = createRenderer(transcriptEl, {
|
|
503
525
|
t,
|
|
504
526
|
providerIcon,
|
|
@@ -543,6 +565,9 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
543
565
|
onLimitRetry: (text) => { submit(clickPayload(text)); },
|
|
544
566
|
onSwitchProvider: (anchor, meta) => continueOnAnotherProvider(anchor, meta),
|
|
545
567
|
limitInfo: () => st.limit,
|
|
568
|
+
// The limit card's × hides that limit's countdown for this conversation, across reloads (storage.js).
|
|
569
|
+
limitScope: () => st.sessionId || sessionId || '',
|
|
570
|
+
limitDismissals: createLimitDismissals({ storage }),
|
|
546
571
|
brainProvider: () => st.brain.provider,
|
|
547
572
|
heroOrigin: () => { try { return host.takeHeroOrigin?.() || null; } catch { return null; } },
|
|
548
573
|
onMascotChange: () => director?.retarget(),
|
|
@@ -633,7 +658,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
633
658
|
onShowWaiting: () => sock.send({ type: 'reattach' }),
|
|
634
659
|
});
|
|
635
660
|
|
|
636
|
-
const accountHooks = () => ({ t, onChanged: () => picker.refresh(true), onSelect: (id) => applyBrain({ ...st.brain, accountId: id }, { requiresSwitch: true, field: 'account' }) });
|
|
661
|
+
const accountHooks = () => ({ t, onChanged: () => picker.refresh(true), onSelect: (id) => applyBrain({ ...st.brain, accountId: id, accountPolicy: id === 'auto' ? 'auto' : 'manual' }, { requiresSwitch: true, field: 'account' }) });
|
|
637
662
|
// Model · effort · permission mode · account sit in the composer row next to attach; project and MCP in the toolbar.
|
|
638
663
|
const picker = createBrainPicker({ brain: composer.el.querySelector('.asst-composer-brain'), context: barGroups.context }, {
|
|
639
664
|
getSessionId: () => st.sessionId,
|
|
@@ -652,6 +677,9 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
652
677
|
// Test density sits right after the permission mode; hidden on a server that does not know it.
|
|
653
678
|
getTestDensity: () => testDensityView(),
|
|
654
679
|
onTestDensity: (level) => setTestDensity(level),
|
|
680
|
+
// agents-p4: Agent density sits right after Test density; hidden on a server that does not know it.
|
|
681
|
+
getAgentDensity: () => agentDensityView(),
|
|
682
|
+
onAgentDensity: (level) => setAgentDensity(level),
|
|
655
683
|
// The global Admin sandbox switch, in the permission menu; hidden on a server that does not serve it.
|
|
656
684
|
getAdminSandbox: () => adminSandboxView(),
|
|
657
685
|
onAdminSandbox: (enabled) => changeAdminSandbox(enabled),
|
|
@@ -774,11 +802,13 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
774
802
|
limitEl.setAttribute('aria-live', 'polite');
|
|
775
803
|
root.querySelector('.asst-usage-host').after(limitEl);
|
|
776
804
|
let limitTimer = null;
|
|
777
|
-
function renderLimit() {
|
|
805
|
+
function renderLimit({ expired = false } = {}) {
|
|
778
806
|
clearTimeout(limitTimer);
|
|
779
807
|
limitTimer = null;
|
|
780
808
|
const limit = st.limit;
|
|
781
|
-
|
|
809
|
+
// The waiting card of this turn's limit error counts to the reported reset; a report the runtime cleared
|
|
810
|
+
// (another provider or account) takes it away, one whose reset passed leaves it to say so.
|
|
811
|
+
renderer.noteLimit(limit, { expired });
|
|
782
812
|
limitEl.hidden = !limit;
|
|
783
813
|
limitEl.dataset.status = limit?.status || '';
|
|
784
814
|
const text = limitNoticeText(limit, tt);
|
|
@@ -789,7 +819,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
789
819
|
if (destroyed) return;
|
|
790
820
|
if (limitExpiresIn(st.limit) > 0) { renderLimit(); return; } // a wait longer than one timer can hold
|
|
791
821
|
st.limit = null;
|
|
792
|
-
renderLimit();
|
|
822
|
+
renderLimit({ expired: true });
|
|
793
823
|
}, Math.min(wait + 250, 2 ** 31 - 1));
|
|
794
824
|
}
|
|
795
825
|
|
|
@@ -993,8 +1023,18 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
993
1023
|
if (ev.runId) dock.patchRun(ev.runId, { turnState: 'running' });
|
|
994
1024
|
return;
|
|
995
1025
|
case 'synabun.mailbox':
|
|
1026
|
+
// The runtime starts a turn of its own right after this (a decided route card, a worker's
|
|
1027
|
+
// result): the panel works with it, or the brain's last line ("waiting for your choice")
|
|
1028
|
+
// reads as the end. A refused turn ends it again (error, or reattach_result running:false).
|
|
1029
|
+
if (!replaying && !st.running) setRunning(true);
|
|
996
1030
|
renderer.appendMailbox(ev.items || ev.events || []);
|
|
997
1031
|
return;
|
|
1032
|
+
case 'synabun.continuation':
|
|
1033
|
+
// A "do it here" pick on another model: its turn starts now. Running first, so the
|
|
1034
|
+
// renderer binds the approved route's scene to this turn.
|
|
1035
|
+
if (!replaying && !st.running) setRunning(true);
|
|
1036
|
+
draw(ev);
|
|
1037
|
+
return;
|
|
998
1038
|
case 'synabun.clarify':
|
|
999
1039
|
if (settleClarifyCard(ev)) return;
|
|
1000
1040
|
draw(ev);
|
|
@@ -1028,14 +1068,16 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1028
1068
|
if (meta.chatStartedAt || Number(meta.turns) > 0) st.chatStarted = true;
|
|
1029
1069
|
if (meta.brain && typeof meta.brain === 'object') {
|
|
1030
1070
|
const next = normalizeBrain({ ...st.brain, ...meta.brain, provider: meta.brain.provider || meta.brain.brain || st.brain.provider });
|
|
1071
|
+
confirmedBrain = next;
|
|
1031
1072
|
if (JSON.stringify(next) !== JSON.stringify(st.brain)) { st.brain = next; picker.render(); host.setBrain?.(next); persist(); }
|
|
1032
1073
|
} else if (typeof meta.brain === 'string') {
|
|
1033
1074
|
const next = normalizeBrain({ ...st.brain, provider: meta.brain, model: meta.model ?? st.brain.model, effort: meta.effort ?? st.brain.effort, accountId: meta.accountId ?? st.brain.accountId, tools: meta.tools ?? st.brain.tools, project: meta.cwd ?? st.brain.project });
|
|
1075
|
+
confirmedBrain = next;
|
|
1034
1076
|
if (JSON.stringify(next) !== JSON.stringify(st.brain)) { st.brain = next; picker.render(); host.setBrain?.(next); persist(); }
|
|
1035
1077
|
}
|
|
1036
1078
|
if (meta.budget && typeof meta.budget === 'object') budgetController.receiveSession(meta.budget);
|
|
1037
1079
|
if (Number.isFinite(Number(meta.costUsd))) { st.costUsd = Number(meta.costUsd); renderCost(); }
|
|
1038
|
-
if (meta
|
|
1080
|
+
if (Object.hasOwn(meta, 'providerSessionId')) st.providerSessionId = meta.providerSessionId || null;
|
|
1039
1081
|
if (meta.routing && typeof meta.routing === 'object') {
|
|
1040
1082
|
st.routing = {
|
|
1041
1083
|
mode: normalizeRouteMode(meta.routing.mode, null),
|
|
@@ -1051,12 +1093,16 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1051
1093
|
if (st.features.routing === true) prewarmRoutesEditor();
|
|
1052
1094
|
if (typeof meta.features.computer === 'boolean') st.features.computer = meta.features.computer;
|
|
1053
1095
|
if (typeof meta.features.testDensity === 'boolean') st.features.testDensity = meta.features.testDensity;
|
|
1096
|
+
if (typeof meta.features.agentDensity === 'boolean') st.features.agentDensity = meta.features.agentDensity; // agents-p4
|
|
1054
1097
|
if (typeof meta.features.rename === 'boolean') st.features.rename = meta.features.rename;
|
|
1055
1098
|
if (typeof meta.features.adminSandbox === 'boolean') st.features.adminSandbox = meta.features.adminSandbox;
|
|
1056
1099
|
}
|
|
1057
1100
|
if (typeof meta.adminSandbox === 'boolean') st.adminSandbox = meta.adminSandbox;
|
|
1058
1101
|
if ('testDensityExplicit' in meta) st.testDensity = normalizeTestDensity(meta.testDensityExplicit, null);
|
|
1059
1102
|
if (meta.testDensity) st.testDensityEffective = normalizeTestDensity(meta.testDensity);
|
|
1103
|
+
// agents-p4: the session's own Agent density (null: not set) and the level in effect.
|
|
1104
|
+
if ('agentDensityExplicit' in meta) st.agentDensity = normalizeAgentDensity(meta.agentDensityExplicit, null);
|
|
1105
|
+
if (meta.agentDensity) st.agentDensityEffective = normalizeAgentDensity(meta.agentDensity);
|
|
1060
1106
|
if (typeof meta.computerUse === 'boolean') st.computerEffective = meta.computerUse;
|
|
1061
1107
|
if ('computerUseExplicit' in meta) st.computerUse = normalizeComputerMode(meta.computerUseExplicit, null);
|
|
1062
1108
|
// A WhatsApp conversation: what is in effect and why (not a per-conversation switch). null on the desktop.
|
|
@@ -1170,6 +1216,32 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1170
1216
|
if (!quiet) renderer.appendStatus(tt('assistant.status.testDensity', 'Test density: {level}', { level: testDensityLabel(next, t) }));
|
|
1171
1217
|
}
|
|
1172
1218
|
|
|
1219
|
+
// ── agents-p4: Agent density (the twin of Test density above) ──
|
|
1220
|
+
/** The level the composer shows: this session's, else the server's; null while the server does not know the setting. */
|
|
1221
|
+
function agentDensityView() {
|
|
1222
|
+
if (st.features.agentDensity !== true) return null;
|
|
1223
|
+
return normalizeAgentDensity(st.agentDensity || st.agentDensityEffective);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
function setAgentDensity(level, { quiet = false } = {}) {
|
|
1227
|
+
const next = normalizeAgentDensity(level);
|
|
1228
|
+
st.agentDensity = next;
|
|
1229
|
+
st.agentDensityEffective = next;
|
|
1230
|
+
picker.render();
|
|
1231
|
+
persist();
|
|
1232
|
+
sock.send({ type: 'set_agent_density', level: next });
|
|
1233
|
+
try { storage.setItem(KEYS.ASSISTANT_AGENT_DENSITY, next); } catch { /* storage unavailable */ }
|
|
1234
|
+
if (!quiet) renderer.appendStatus(tt('assistant.status.agentDensity', 'Agent density: {level} ({cap})', { level: agentDensityLabel(next, t), cap: agentDensityCap(next, t) }));
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/** Fresh tabs inherit the last-used Agent density (like the Test density). */
|
|
1238
|
+
function applyLastUsedAgentDensity() {
|
|
1239
|
+
if (saved || st.features.agentDensity !== true || st.agentDensity != null) return;
|
|
1240
|
+
let last = null;
|
|
1241
|
+
try { last = normalizeAgentDensity(storage.getItem(KEYS.ASSISTANT_AGENT_DENSITY), null); } catch { last = null; }
|
|
1242
|
+
if (last && last !== agentDensityView()) setAgentDensity(last, { quiet: true });
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1173
1245
|
/** The global Admin sandbox setting (true / false), or null while the server does not serve it. */
|
|
1174
1246
|
function adminSandboxView() {
|
|
1175
1247
|
if (st.features.adminSandbox !== true || typeof st.adminSandbox !== 'boolean') return null;
|
|
@@ -1275,6 +1347,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1275
1347
|
const normalized = normalizeControlRequest({ ...packet, provider: packet.provider || (origin ? origin.provider : st.brain.provider) }, { origin });
|
|
1276
1348
|
if (!normalized) return;
|
|
1277
1349
|
if (controls.has(normalized.requestId)) return;
|
|
1350
|
+
if (normalized.kind === 'route' && routeReplay.has(normalized.route)) return;
|
|
1278
1351
|
renderer.hideWorking();
|
|
1279
1352
|
const entry = renderControlCard(null, normalized, {
|
|
1280
1353
|
t,
|
|
@@ -1298,6 +1371,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1298
1371
|
}
|
|
1299
1372
|
|
|
1300
1373
|
function mountRouteCard(n) {
|
|
1374
|
+
const routeId = n.routeId || n.route?.routeId || n.request?.routeId;
|
|
1375
|
+
if (routeId && routeCards.has(routeId)) return routeCards.get(routeId);
|
|
1301
1376
|
const card = renderRouteCard(null, n, {
|
|
1302
1377
|
t,
|
|
1303
1378
|
providerIcon,
|
|
@@ -1323,6 +1398,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1323
1398
|
if (!card) return null;
|
|
1324
1399
|
renderer.removeRouteLine(card.routeId);
|
|
1325
1400
|
renderer.appendNode(card.el);
|
|
1401
|
+
routeReplay.record(n.route || n);
|
|
1326
1402
|
routeCards.set(card.routeId, card);
|
|
1327
1403
|
routeChip.render();
|
|
1328
1404
|
tip('route', () => card.el);
|
|
@@ -1334,8 +1410,9 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1334
1410
|
function handleRouteCardEvent(ev) {
|
|
1335
1411
|
const routeId = ev?.route?.routeId;
|
|
1336
1412
|
const card = routeId ? routeCards.get(routeId) : null;
|
|
1337
|
-
if (!card) return false;
|
|
1338
1413
|
const phase = ev.phase || 'decided';
|
|
1414
|
+
if (routeId && phase !== 'card' && phase !== 'pending') routeReplay.record(ev.route);
|
|
1415
|
+
if (!card) return false;
|
|
1339
1416
|
if (phase === 'card' || phase === 'pending') return true;
|
|
1340
1417
|
card.settle(phase, ev.route);
|
|
1341
1418
|
card.destroy();
|
|
@@ -1456,6 +1533,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1456
1533
|
|
|
1457
1534
|
async function submit(payload) {
|
|
1458
1535
|
if (guestBlocked()) return false;
|
|
1536
|
+
while (brainChange) { if (await brainChange === false) return false; }
|
|
1537
|
+
if (destroyed) return false;
|
|
1459
1538
|
const parsed = parseSlashCommand(payload.text);
|
|
1460
1539
|
if (parsed && !parsed.passthrough) {
|
|
1461
1540
|
const handled = await runSlash(parsed, payload);
|
|
@@ -1660,29 +1739,42 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1660
1739
|
if (meta.silent) return;
|
|
1661
1740
|
if (meta.requiresSwitch) {
|
|
1662
1741
|
const b = st.brain;
|
|
1663
|
-
|
|
1742
|
+
// One acknowledged PATCH owns a switch; a second socket write could resolve Auto twice.
|
|
1664
1743
|
renderer.appendDivider(`${tt('assistant.status.brain', 'brain')} → ${brainLabel(b)}`);
|
|
1665
1744
|
renderer.forgetSeen(); // the new brain's ids start over
|
|
1666
1745
|
} else if (before.permissionMode !== st.brain.permissionMode || !!before.planMode !== !!st.brain.planMode) {
|
|
1667
1746
|
sock.send({ type: 'set_permission_mode', mode: st.brain.permissionMode, planMode: st.brain.planMode === true });
|
|
1668
1747
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1748
|
+
const previousChange = brainChange;
|
|
1749
|
+
const patch = { brain: applied, ...(meta.restartBrain ? { restartBrain: true } : {}) };
|
|
1750
|
+
// Another model, provider or account: the brain's usage-limit countdown was the old one's. It goes once
|
|
1751
|
+
// the switch is acknowledged; a limit the new brain hits brings its own card.
|
|
1752
|
+
const leavesLimit = ['provider', 'model', 'accountId'].some((field) => (before[field] || '') !== (applied[field] || ''));
|
|
1753
|
+
const change = Promise.resolve(previousChange).then(() => patchAssistantSession(sessionId, patch)).then((result) => {
|
|
1754
|
+
const record = result.session || result;
|
|
1755
|
+
if (record.brain) confirmedBrain = normalizeBrain(record.brain);
|
|
1756
|
+
if (!destroyed && brainChange === change) applySessionMeta(record);
|
|
1757
|
+
if (!destroyed && leavesLimit) renderer.clearLimitWait?.();
|
|
1758
|
+
return true;
|
|
1759
|
+
}).catch((err) => {
|
|
1760
|
+
// A refused switch keeps the old conversation and account on screen.
|
|
1761
|
+
if (destroyed) return false;
|
|
1762
|
+
renderer.appendError(err.message || String(err));
|
|
1763
|
+
if (st.brain !== applied) return false;
|
|
1764
|
+
st.brain = confirmedBrain;
|
|
1675
1765
|
picker.render();
|
|
1676
|
-
if (applied.project !==
|
|
1677
|
-
host.setBrain?.(
|
|
1766
|
+
if (applied.project !== confirmedBrain.project) renderer.refreshEmpty();
|
|
1767
|
+
host.setBrain?.(confirmedBrain);
|
|
1678
1768
|
persist();
|
|
1679
|
-
|
|
1680
|
-
});
|
|
1769
|
+
return false;
|
|
1770
|
+
}).finally(() => { if (brainChange === change) brainChange = null; });
|
|
1771
|
+
brainChange = change;
|
|
1772
|
+
return change;
|
|
1681
1773
|
}
|
|
1682
1774
|
|
|
1683
1775
|
// "Continue with another provider" on the Assistant's own limit-wait card: the same model menu
|
|
1684
1776
|
// the toolbar's model field opens (never a native select), minus the limited provider, then the
|
|
1685
|
-
// existing switch (applyBrain →
|
|
1777
|
+
// existing switch (applyBrain → acknowledged PATCH) and, where the blocked prompt is known, Retry now's
|
|
1686
1778
|
// own resend (submit) — in that order, so the server sees the switch before the retried prompt.
|
|
1687
1779
|
function continueOnAnotherProvider(anchor, { excludeProvider = '', retryText = '' } = {}) {
|
|
1688
1780
|
if (!anchor) return;
|
|
@@ -1699,7 +1791,8 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
1699
1791
|
onManageModels: () => openModels(),
|
|
1700
1792
|
onSelect: async (target) => {
|
|
1701
1793
|
if (!target?.provider) return;
|
|
1702
|
-
await picker.switchProvider(target.provider, target.model || '');
|
|
1794
|
+
const switched = await picker.switchProvider(target.provider, target.model || '');
|
|
1795
|
+
if (switched === false) return;
|
|
1703
1796
|
if (destroyed) return;
|
|
1704
1797
|
renderer.clearLimitWait();
|
|
1705
1798
|
if (retryText) submit(clickPayload(retryText));
|
|
@@ -2138,7 +2231,15 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2138
2231
|
unsubs.push(on('sync:assistant:budget', (msg) => { if ((msg?.assistantSessionId || msg?.sessionId) === sessionId) budgetController.receiveSession(msg.budget); }));
|
|
2139
2232
|
unsubs.push(on('sync:assistant:budget-changed', () => budgetController.load()));
|
|
2140
2233
|
unsubs.push(on('sync:assistant:cost', (msg) => { if (!msg?.assistantSessionId || msg.assistantSessionId === sessionId) applyCost(msg); }));
|
|
2141
|
-
unsubs.push(on('sync:assistant:mailbox', (msg) => {
|
|
2234
|
+
unsubs.push(on('sync:assistant:mailbox', (msg) => {
|
|
2235
|
+
if (msg?.assistantSessionId !== sessionId) return;
|
|
2236
|
+
const draw = () => renderer.appendMailbox(msg.items || msg.events || []);
|
|
2237
|
+
// Something happened in a tab whose conversation still waited for idle time: it loads now, and the
|
|
2238
|
+
// mailbox goes under its history (loadConversation, below).
|
|
2239
|
+
loadConversation();
|
|
2240
|
+
if (afterLoad) afterLoad.push(draw);
|
|
2241
|
+
else draw();
|
|
2242
|
+
}));
|
|
2142
2243
|
unsubs.push(on('sync:assistant:permission-request', (msg) => {
|
|
2143
2244
|
const run = runFromPayload(msg);
|
|
2144
2245
|
const runId = msg?.runId || run?.runId || null;
|
|
@@ -2234,13 +2335,48 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2234
2335
|
host.setBrain?.(st.brain);
|
|
2235
2336
|
if (session && typeof session === 'object') applySessionMeta(session);
|
|
2236
2337
|
else applyFeatures();
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2338
|
+
// The conversation: read, drawn, then connected. At once for the tab that is on screen and for a session
|
|
2339
|
+
// that is at work; a quiet tab nobody looks at (a restored tab behind the one showing, every tab of a closed
|
|
2340
|
+
// panel) waits for its turn in the page's idle time, or for being shown, whichever is first. All of them
|
|
2341
|
+
// used to do it in the page's start, one transcript after another in the same tasks (95 ms of them).
|
|
2342
|
+
// The order inside is what it always was (rehydrate, then the socket), so nothing is drawn before the
|
|
2343
|
+
// history; only when it starts changed.
|
|
2344
|
+
let loadStarted = false;
|
|
2345
|
+
let cancelIdleLoad = null;
|
|
2346
|
+
// While a conversation that waited is being read: what was asked of the tab meanwhile and draws a row (a
|
|
2347
|
+
// prompt handed to it as it is shown). It runs after the history, never above it. null otherwise: a tab
|
|
2348
|
+
// that loaded at once takes a prompt at once, as it always did.
|
|
2349
|
+
let afterLoad = null;
|
|
2350
|
+
function loadConversation() {
|
|
2351
|
+
if (loadStarted || destroyed) return;
|
|
2352
|
+
loadStarted = true;
|
|
2353
|
+
if (cancelIdleLoad) afterLoad = [];
|
|
2354
|
+
cancelIdleLoad?.();
|
|
2355
|
+
cancelIdleLoad = null;
|
|
2356
|
+
rehydrate().finally(() => {
|
|
2357
|
+
const held = afterLoad;
|
|
2358
|
+
afterLoad = null;
|
|
2359
|
+
if (destroyed || gone) return;
|
|
2360
|
+
probeFeatures();
|
|
2361
|
+
applyLastUsedRouteMode();
|
|
2362
|
+
applyLastUsedTestDensity();
|
|
2363
|
+
applyLastUsedAgentDensity(); // agents-p4
|
|
2364
|
+
sock.connect();
|
|
2365
|
+
for (const run of held || []) {
|
|
2366
|
+
try { run(); } catch (err) { console.error('[assistant] a request held for the conversation failed', err); }
|
|
2367
|
+
}
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
if (conversationCanWait({ visible: visible(), session })) {
|
|
2371
|
+
cancelIdleLoad = idleQueue().add(loadConversation);
|
|
2372
|
+
// A quiet session whose agents are still at work is not quiet: the tray knows once it has read its runs.
|
|
2373
|
+
dock.ready.then(() => {
|
|
2374
|
+
const counts = dock.counts();
|
|
2375
|
+
if (Number(counts?.active) > 0 || Number(counts?.attention) > 0) loadConversation();
|
|
2376
|
+
}).catch(() => {});
|
|
2377
|
+
} else {
|
|
2378
|
+
loadConversation();
|
|
2379
|
+
}
|
|
2244
2380
|
fetchUsage();
|
|
2245
2381
|
budgetController.load();
|
|
2246
2382
|
|
|
@@ -2261,7 +2397,12 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2261
2397
|
},
|
|
2262
2398
|
isRunning: () => st.running,
|
|
2263
2399
|
isConnected: () => st.connected,
|
|
2264
|
-
send: (text, extra = {}) =>
|
|
2400
|
+
send: (text, extra = {}) => {
|
|
2401
|
+
const go = () => submit({ text: String(text ?? ''), images: extra.images || [], files: extra.files || [], uploads: extra.uploads || [], memories: extra.memories || [] });
|
|
2402
|
+
loadConversation();
|
|
2403
|
+
if (afterLoad) { afterLoad.push(go); return undefined; } // its history is on its way: the prompt goes under it
|
|
2404
|
+
return go();
|
|
2405
|
+
},
|
|
2265
2406
|
abort,
|
|
2266
2407
|
compact,
|
|
2267
2408
|
newSession,
|
|
@@ -2294,12 +2435,16 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2294
2435
|
/** The session's status as its host shows it: the brain's own with its dispatched agents' (sessionStatus). */
|
|
2295
2436
|
getStatus: () => st.shownStatus || 'idle',
|
|
2296
2437
|
focus: () => composer.focus(),
|
|
2297
|
-
onShown: () => { syncTabLabel(); renderer.scrollEnd(true); if (visible()) composer.focus(); director.touch(); },
|
|
2438
|
+
onShown: () => { loadConversation(); syncTabLabel(); renderer.scrollEnd(true); if (visible()) composer.focus(); director.touch(); },
|
|
2439
|
+
/** The tab is wanted (shown, or about to be used): its conversation loads now instead of in idle time. */
|
|
2440
|
+
wake: () => loadConversation(),
|
|
2298
2441
|
onHidden: () => { closeMenu(); picker.close(); director.stopTyping(); },
|
|
2299
2442
|
counts: () => dock.counts(),
|
|
2300
2443
|
destroy: ({ closeServer = false } = {}) => {
|
|
2301
2444
|
if (destroyed) return;
|
|
2302
2445
|
destroyed = true;
|
|
2446
|
+
cancelIdleLoad?.();
|
|
2447
|
+
cancelIdleLoad = null;
|
|
2303
2448
|
if (persistTimer) { clearTimeout(persistTimer); persistTimer = null; }
|
|
2304
2449
|
clearTimeout(announceTimer);
|
|
2305
2450
|
if (replay) { clearTimeout(replay.timer); replay = null; }
|
|
@@ -2320,6 +2465,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2320
2465
|
if (helpModal) { helpModal.remove(); helpModal = null; }
|
|
2321
2466
|
for (const card of routeCards.values()) card.destroy();
|
|
2322
2467
|
routeCards.clear();
|
|
2468
|
+
routeReplay.clear();
|
|
2323
2469
|
sock.close();
|
|
2324
2470
|
roving.destroy();
|
|
2325
2471
|
picker.destroy();
|
|
@@ -2328,6 +2474,7 @@ export function mountAssistant(viewport, { sessionId, brain, host = {}, session
|
|
|
2328
2474
|
computerPanel.destroy();
|
|
2329
2475
|
dock.destroy();
|
|
2330
2476
|
composer.destroy();
|
|
2477
|
+
rowWatcher.disconnect();
|
|
2331
2478
|
renderer.destroy();
|
|
2332
2479
|
barEmpty.disconnect();
|
|
2333
2480
|
barEl.remove(); // it may live in the host's header
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
// without) them. Focus rings are the panel's one recipe (asst-styles.js), none
|
|
20
20
|
// of the rack's own. Every control reaches 24×24 (an ::after margin).
|
|
21
21
|
|
|
22
|
+
import { installInteractionHold } from './asst-interaction-hold.js';
|
|
23
|
+
|
|
22
24
|
export const RACK_STYLE_ID = 'asst-rack-styles';
|
|
23
25
|
|
|
24
26
|
export const RACK_CSS = `
|
|
@@ -51,8 +53,8 @@ export const RACK_CSS = `
|
|
|
51
53
|
grid-template-rows: 0fr;
|
|
52
54
|
grid-auto-rows: auto;
|
|
53
55
|
min-width: 0;
|
|
54
|
-
/*
|
|
55
|
-
|
|
56
|
+
/* Full width, like the other turn blocks. */
|
|
57
|
+
width: 100%;
|
|
56
58
|
border-radius: 10px;
|
|
57
59
|
color: var(--rk-text-2);
|
|
58
60
|
font-size: 12.5px;
|
|
@@ -278,7 +280,7 @@ export const RACK_CSS = `
|
|
|
278
280
|
a rounded rectangle at one line or two. */
|
|
279
281
|
.asst-rack-receipt {
|
|
280
282
|
grid-row: 2;
|
|
281
|
-
justify-self:
|
|
283
|
+
justify-self: stretch;
|
|
282
284
|
position: relative;
|
|
283
285
|
isolation: isolate;
|
|
284
286
|
display: inline-flex;
|
|
@@ -307,7 +309,7 @@ export const RACK_CSS = `
|
|
|
307
309
|
.asst-rack-receipt-face { flex: none; align-self: stretch; display: inline-flex; align-items: center; justify-content: center; width: 46px; box-shadow: inset -1px 0 0 var(--rk-line); color: var(--rk-text-2); line-height: 0; }
|
|
308
310
|
.asst-rack-receipt-face svg { display: block; width: 64px; height: 32px; }
|
|
309
311
|
.asst-rack-receipt-text {
|
|
310
|
-
flex:
|
|
312
|
+
flex: 1 1 auto;
|
|
311
313
|
min-width: 0;
|
|
312
314
|
overflow: hidden;
|
|
313
315
|
display: -webkit-box;
|
|
@@ -596,9 +598,12 @@ export const RACK_CSS = `
|
|
|
596
598
|
@keyframes asst-rk-caret { 0% { opacity: 1; } 50% { opacity: 0; } }
|
|
597
599
|
@keyframes asst-rk-sweep { from { transform: translateX(-100%); } to { transform: translateX(270%); } }
|
|
598
600
|
@keyframes asst-rk-tick { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
|
|
599
|
-
body.ui-interacting
|
|
600
|
-
|
|
601
|
-
|
|
601
|
+
/* Dragging or resizing (body.ui-interacting): asst-interaction-hold.js marks each rack with data-ui-held for
|
|
602
|
+
as long as the class is on <body>. A rule that ends in a universal selector behind a class on the root
|
|
603
|
+
would restyle the whole page every time that class changes; this one restyles the racks. */
|
|
604
|
+
.asst-rack[data-ui-held] *,
|
|
605
|
+
.asst-rack[data-ui-held] *::before,
|
|
606
|
+
.asst-rack[data-ui-held] *::after { animation-play-state: paused !important; }
|
|
602
607
|
@media (prefers-reduced-motion: reduce) {
|
|
603
608
|
.asst-rack,
|
|
604
609
|
.asst-rack *,
|
|
@@ -611,7 +616,9 @@ export const RACK_CSS = `
|
|
|
611
616
|
|
|
612
617
|
/** Add the rack stylesheet once, right after the main assistant styles when they are in the page. */
|
|
613
618
|
export function injectRackStyles(doc = globalThis.document) {
|
|
614
|
-
if (!doc
|
|
619
|
+
if (!doc) return;
|
|
620
|
+
installInteractionHold(doc); // the sheet's data-ui-held rule does nothing without it
|
|
621
|
+
if (doc.getElementById(RACK_STYLE_ID)) return;
|
|
615
622
|
const style = doc.createElement('style');
|
|
616
623
|
style.id = RACK_STYLE_ID;
|
|
617
624
|
style.textContent = RACK_CSS;
|
|
@@ -59,6 +59,7 @@ import { createMotionGate } from './asst-motion-gate.js';
|
|
|
59
59
|
import { createStyleCache } from './asst-style-cache.js';
|
|
60
60
|
import { formatRunTokens } from './asst-usage.js';
|
|
61
61
|
import { sanitizeHtmlString, sanitizeInto } from './asst-sanitize.js';
|
|
62
|
+
import { decorateCodeBlocks } from '../ui-code-copy.js';
|
|
62
63
|
import { renderStreamingMarkdown } from '../streaming-markdown.js';
|
|
63
64
|
import { automationView } from './asst-automation.js';
|
|
64
65
|
import { guessFollowups, splitFollowups } from './asst-followups.js';
|
|
@@ -69,6 +70,7 @@ import { createLimitDock } from './asst-limit-dock.js';
|
|
|
69
70
|
import { createLimitWait } from './asst-limit-wait.js';
|
|
70
71
|
import { synabunToolKey, synabunToolLabel } from '../synabun-tools.js';
|
|
71
72
|
import { normalizeToolHeartbeat } from '../tool-heartbeat.js';
|
|
73
|
+
import { closedSidepanelOf, createShownGate } from '../sidepanel-shown.js';
|
|
72
74
|
|
|
73
75
|
// ── Markdown (lazy marked, the vendored build the sidepanels use too) ───────────────
|
|
74
76
|
let _marked = null;
|
|
@@ -618,6 +620,9 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
618
620
|
let snapshot = null;
|
|
619
621
|
|
|
620
622
|
$msgs.addEventListener('scroll', () => {
|
|
623
|
+
// Inside a closed side panel nobody scrolls: the follow stays what it was, and no height is read
|
|
624
|
+
// (reading it lays the hidden panel out; sidepanel-shown.js).
|
|
625
|
+
if (closedSidepanelOf($msgs)) return;
|
|
621
626
|
followTail = isNearBottom();
|
|
622
627
|
}, { passive: true });
|
|
623
628
|
|
|
@@ -638,7 +643,13 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
638
643
|
if (step.ghost && step.type === 'call' && !Object.keys(step.input || {}).length) { say.text = '…'; say.detail = '…'; say.segments = null; say.mono = false; say.meta = []; }
|
|
639
644
|
return say;
|
|
640
645
|
};
|
|
641
|
-
|
|
646
|
+
// The dock's dismissals (the card's ×) belong to this conversation and survive a reload when the host
|
|
647
|
+
// keeps them (asst-panel.js: storage.js); without one they last as long as the page.
|
|
648
|
+
const limitDock = createLimitDock($msgs, {
|
|
649
|
+
t,
|
|
650
|
+
scope: () => (typeof hooks.limitScope === 'function' ? hooks.limitScope() : ''),
|
|
651
|
+
...(hooks.limitDismissals ? { dismissals: hooks.limitDismissals } : {}),
|
|
652
|
+
});
|
|
642
653
|
const nowMs = () => (clockAt ?? Date.now());
|
|
643
654
|
const isTimed = () => !muted || clockAt != null;
|
|
644
655
|
const locale = () => (typeof document !== 'undefined' && document.documentElement?.lang) || 'en';
|
|
@@ -653,10 +664,22 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
653
664
|
return $msgs.scrollHeight - $msgs.scrollTop - $msgs.clientHeight < 48;
|
|
654
665
|
}
|
|
655
666
|
|
|
667
|
+
// The scroll to the newest row, on the next frame. A transcript inside a closed side panel has no layout:
|
|
668
|
+
// scrolling it there read its height, which made the engine lay the whole hidden panel out, at every load
|
|
669
|
+
// and for every row a session added meanwhile. The scroll is kept and made when the panel is shown.
|
|
670
|
+
const endGate = createShownGate($msgs, () => {
|
|
671
|
+
if (scrollFrame) return;
|
|
672
|
+
scrollFrame = requestAnimationFrame(() => {
|
|
673
|
+
scrollFrame = 0;
|
|
674
|
+
if (closedSidepanelOf($msgs)) { endGate.request(); return; } // closed again before the frame
|
|
675
|
+
$msgs.scrollTop = $msgs.scrollHeight;
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
|
|
656
679
|
function scrollEnd(force = false) {
|
|
657
680
|
if (!force && !followTail) return;
|
|
658
681
|
if (scrollFrame) return;
|
|
659
|
-
|
|
682
|
+
endGate.request();
|
|
660
683
|
}
|
|
661
684
|
|
|
662
685
|
function root() { return { container: $msgs, stream: null, key: null, msgId: null, lastAt: 0 }; }
|
|
@@ -949,6 +972,8 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
949
972
|
|
|
950
973
|
function renderMarkdownInto(body, text) {
|
|
951
974
|
mdInto(body, text);
|
|
975
|
+
// Every code block gets the shared Copy button (../ui-code-copy.js), also each piece a stream draws.
|
|
976
|
+
decorateCodeBlocks(body);
|
|
952
977
|
body.querySelectorAll('pre code').forEach((code) => {
|
|
953
978
|
const lang = (code.className || '').replace('language-', '').trim();
|
|
954
979
|
if (lang) code.parentElement.dataset.lang = lang;
|
|
@@ -1075,10 +1100,15 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
1075
1100
|
});
|
|
1076
1101
|
}
|
|
1077
1102
|
|
|
1078
|
-
/**
|
|
1079
|
-
|
|
1103
|
+
/**
|
|
1104
|
+
* The session's limit report changed (assistant:limit): this turn's waiting card counts to its reset time.
|
|
1105
|
+
* A report that no longer blocks takes the card away: a warning, or none at all (`null`: the runtime
|
|
1106
|
+
* cleared it, as it does when the brain moves to another provider or account). `expired`: the report went
|
|
1107
|
+
* because its reset time passed, which the card shows by itself ("Usage limit restored", Retry now): kept.
|
|
1108
|
+
*/
|
|
1109
|
+
function noteLimit(limit, { expired = false } = {}) {
|
|
1080
1110
|
if (limit?.status === 'rejected') offerLimitWait('', { brainError: true, limit });
|
|
1081
|
-
else if (
|
|
1111
|
+
else if (!expired) limitDock.set('brain', null);
|
|
1082
1112
|
}
|
|
1083
1113
|
|
|
1084
1114
|
function copyText(text) {
|
|
@@ -4183,7 +4213,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
|
|
|
4183
4213
|
return {
|
|
4184
4214
|
el: $msgs,
|
|
4185
4215
|
clear,
|
|
4186
|
-
destroy: () => { clear(); stageResizes?.disconnect(); limitDock.destroy(); stopFontWatch(); },
|
|
4216
|
+
destroy: () => { clear(); endGate.cancel(); stageResizes?.disconnect(); limitDock.destroy(); stopFontWatch(); },
|
|
4187
4217
|
appendUser,
|
|
4188
4218
|
appendAssistantMarkdown,
|
|
4189
4219
|
appendStatus,
|