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
|
@@ -40,6 +40,7 @@ import { accountChoiceItems, accountManageItem, accountMenuRow, accountModeItem,
|
|
|
40
40
|
import { closeMenu, currentMenu, isMenuOpen, openMenu } from './asst-menu.js';
|
|
41
41
|
import { createMascotControl } from './asst-mascot.js';
|
|
42
42
|
import { modelChipForms, modelChipName, modelChipTag } from './asst-model-chip.js';
|
|
43
|
+
import { closedSidepanelOf, createShownGate } from '../sidepanel-shown.js';
|
|
43
44
|
import {
|
|
44
45
|
ACCOUNT_PROVIDERS,
|
|
45
46
|
BRAIN_PROVIDERS,
|
|
@@ -59,6 +60,10 @@ import {
|
|
|
59
60
|
TEST_DENSITIES,
|
|
60
61
|
normalizeTestDensity,
|
|
61
62
|
testDensityBars,
|
|
63
|
+
// agents-p4: Agent density
|
|
64
|
+
AGENT_DENSITIES,
|
|
65
|
+
agentDensityFigures,
|
|
66
|
+
normalizeAgentDensity,
|
|
62
67
|
} from './asst-state.js';
|
|
63
68
|
|
|
64
69
|
let _projectsCache = null;
|
|
@@ -92,6 +97,48 @@ const TEST_DENSITY_COPY = {
|
|
|
92
97
|
thorough: ['Thorough', 'Full coverage, whole suite, live checks.'],
|
|
93
98
|
};
|
|
94
99
|
|
|
100
|
+
// ── agents-p4: Agent density (how many workers ONE task may get) ──
|
|
101
|
+
// Four figures in the 24 box, `filled` of them at full strength: solo 1 · pair 2 · team 3 · swarm 4.
|
|
102
|
+
function agentsIcon(filled) {
|
|
103
|
+
const figure = (index, head, body) => `<g${index < filled ? '' : ' opacity=".3"'}><circle cx="${head[0]}" cy="${head[1]}" r="2"/><path d="${body}"/></g>`;
|
|
104
|
+
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${
|
|
105
|
+
figure(0, [8, 8], 'M4.5 12.5a3.5 3.5 0 0 1 7 0')}${figure(1, [16, 8], 'M12.5 12.5a3.5 3.5 0 0 1 7 0')}${
|
|
106
|
+
figure(2, [8, 15.5], 'M4.5 20a3.5 3.5 0 0 1 7 0')}${figure(3, [16, 15.5], 'M12.5 20a3.5 3.5 0 0 1 7 0')}</svg>`;
|
|
107
|
+
}
|
|
108
|
+
// English copy of the Agent density menu (i18n: assistant.agentDensity.levels.* / .cap.* / .desc.*): the level's
|
|
109
|
+
// name, its cap as the menu's tag, and one sentence.
|
|
110
|
+
const AGENT_DENSITY_COPY = {
|
|
111
|
+
solo: ['Solo', '1 worker', 'One worker per task. A task is never split.'],
|
|
112
|
+
pair: ['Pair', '2 workers', '2 workers on code, complex, research or review tasks. Fewer only with a reason.'],
|
|
113
|
+
team: ['Team', '4 workers', '4 workers on code, complex, research or review tasks. Fewer only with a reason.'],
|
|
114
|
+
swarm: ['Swarm', '6 workers', '6 workers on code, complex, research or review tasks. Fewer only with a reason.'],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** "Team" — the level's name (a missing or unknown level is the default one, Solo). */
|
|
118
|
+
export function agentDensityLabel(level, t) {
|
|
119
|
+
const id = normalizeAgentDensity(level);
|
|
120
|
+
return tf(t)(`assistant.agentDensity.levels.${id}`, AGENT_DENSITY_COPY[id][0]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** "up to 4" — the most workers one task gets at the level, as the menu and the status line say it. */
|
|
124
|
+
export function agentDensityCap(level, t) {
|
|
125
|
+
const id = normalizeAgentDensity(level);
|
|
126
|
+
return tf(t)(`assistant.agentDensity.cap.${id}`, AGENT_DENSITY_COPY[id][1]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The rows of the Agent density menu, as openMenu takes them (without their handlers): one radio row per level
|
|
131
|
+
* with its cap as the tag. DOM-free, so the menu's content is tested without a page.
|
|
132
|
+
*/
|
|
133
|
+
export function agentDensityMenuItems(current, t) {
|
|
134
|
+
const now = normalizeAgentDensity(current);
|
|
135
|
+
return AGENT_DENSITIES.map((id) => ({
|
|
136
|
+
kind: 'radio', id, label: agentDensityLabel(id, t), tag: agentDensityCap(id, t),
|
|
137
|
+
desc: tf(t)(`assistant.agentDensity.desc.${id}`, AGENT_DENSITY_COPY[id][2]),
|
|
138
|
+
selected: id === now,
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
|
|
95
142
|
// English copy of the Admin sandbox row (i18n: assistant.adminSandbox.hint). Names only Codex: the
|
|
96
143
|
// one provider it changes (lib/agent-sandbox-elevation.js; Claude Code and OpenCode are no-ops).
|
|
97
144
|
export const ADMIN_SANDBOX_HINT = 'Only changes anything when SynaBun runs on Windows. On: Codex can set up its strongest sandbox, which asks for administrator approval once per account. Off: no admin prompt; Codex uses a sandbox that needs no admin, with weaker isolation.';
|
|
@@ -753,12 +800,13 @@ function menuItemsSignature(items) {
|
|
|
753
800
|
|
|
754
801
|
// ── Picker ──────────────────────────────────────────────────────────────────
|
|
755
802
|
|
|
756
|
-
// Creation order is DOM order within a slot: model · effort · variant · mode · tests · account in the composer.
|
|
803
|
+
// Creation order is DOM order within a slot: model · effort · variant · mode · tests · agents · account in the composer.
|
|
757
804
|
// `effort` is the OpenCode agent for OpenCode; `variant` is OpenCode's effort (the model's variants).
|
|
758
805
|
// `tests` is the session's Test density, not a brain field: it shows only while the host supplies a level.
|
|
759
|
-
|
|
806
|
+
// `agents` (agents-p4) is the session's Agent density, next to it, under the same rule.
|
|
807
|
+
const FIELDS = ['model', 'effort', 'variant', 'mode', 'tests', 'agents', 'account', 'project'];
|
|
760
808
|
// Slot of each field: the composer row (the brain and how it acts) · the toolbar (where it works).
|
|
761
|
-
const FIELD_GROUP = { model: 'brain', effort: 'brain', variant: 'brain', mode: 'brain', tests: 'brain', account: 'brain', project: 'context', mcp: 'context' };
|
|
809
|
+
const FIELD_GROUP = { model: 'brain', effort: 'brain', variant: 'brain', mode: 'brain', tests: 'brain', agents: 'brain', account: 'brain', project: 'context', mcp: 'context' };
|
|
762
810
|
|
|
763
811
|
/**
|
|
764
812
|
* createBrainPicker(host, hooks) — `host` is either one element (all fields in
|
|
@@ -768,6 +816,7 @@ const FIELD_GROUP = { model: 'brain', effort: 'brain', variant: 'brain', mode: '
|
|
|
768
816
|
* getMenuAnchor() → fallback anchor (the toolbar "⋯"),
|
|
769
817
|
* menuPlacement: 'below' (default) | 'above' | 'auto',
|
|
770
818
|
* getTestDensity() → level | null (null hides the field), onTestDensity(level),
|
|
819
|
+
* getAgentDensity() → level | null (null hides the field), onAgentDensity(level),
|
|
771
820
|
* onProjects(projects) — the registered projects were (re)loaded }
|
|
772
821
|
*/
|
|
773
822
|
export function createBrainPicker(host, hooks = {}) {
|
|
@@ -885,7 +934,7 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
885
934
|
const acc = accountOf(brain);
|
|
886
935
|
if (!acc) return brain.accountId === 'auto' ? autoAccountLabel(hooks.t) : (brain.accountId || t('assistant.brain.accountDefault', 'Default'));
|
|
887
936
|
const row = accountMenuRow(acc, { provider: accountProvider(brain), t: hooks.t });
|
|
888
|
-
return [row.name, row.badge.text].filter(Boolean).join(' · ');
|
|
937
|
+
return [brain.accountPolicy === 'auto' ? t('assistant.brain.accountAutoShort', 'Auto') : '', row.name, row.badge.text].filter(Boolean).join(' · ');
|
|
889
938
|
}
|
|
890
939
|
|
|
891
940
|
// The model menu's own row first: it also names the "[1m]" / "[extended]" variants the provider list lacks.
|
|
@@ -904,7 +953,7 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
904
953
|
// Antigravity signed out: a warning cue on the chip (its words are the tooltip's and the Model menu's).
|
|
905
954
|
if (brain.provider === 'antigravity') return catalogProviderInfo('antigravity')?.signedIn === false ? { text: '!', tone: 'warn' } : null;
|
|
906
955
|
if (!ACCOUNT_PROVIDERS.has(brain.provider)) return null;
|
|
907
|
-
if (brain.accountId === 'auto') return { text: t('assistant.brain.accountAutoShort', 'Auto'), tone: 'muted' };
|
|
956
|
+
if (brain.accountId === 'auto' || brain.accountPolicy === 'auto') return { text: t('assistant.brain.accountAutoShort', 'Auto'), tone: 'muted' };
|
|
908
957
|
const accounts = brain.provider === 'codex' ? getCachedCodexAccounts() : getCachedClaudeAccounts();
|
|
909
958
|
const acc = accountOf(brain);
|
|
910
959
|
const signedOut = acc?.signedIn === false;
|
|
@@ -966,6 +1015,12 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
966
1015
|
return level ? normalizeTestDensity(level) : null;
|
|
967
1016
|
}
|
|
968
1017
|
|
|
1018
|
+
/** agents-p4: the session's Agent density, or null while the host has none to show (a server that does not know it). */
|
|
1019
|
+
function agentDensity() {
|
|
1020
|
+
const level = typeof hooks.getAgentDensity === 'function' ? hooks.getAgentDensity() : null;
|
|
1021
|
+
return level ? normalizeAgentDensity(level) : null;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
969
1024
|
function setBtn(field, { label, icon, color, hidden, disabled, tooltip, aria }) {
|
|
970
1025
|
const btn = buttons[field];
|
|
971
1026
|
if (!btn) return;
|
|
@@ -1048,6 +1103,10 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1048
1103
|
btn.removeAttribute('data-squeezed');
|
|
1049
1104
|
const label = btn.querySelector('.asst-dd-label');
|
|
1050
1105
|
const slot = btn.parentElement;
|
|
1106
|
+
// Inside a closed side panel there is nothing to fit and nobody to see it: the whole chip, and the fit
|
|
1107
|
+
// when the panel is shown. Asking whether the button is rendered is itself a layout read, and in there it
|
|
1108
|
+
// made the engine lay the hidden panel out (sidepanel-shown.js).
|
|
1109
|
+
if (closedSidepanelOf(btn)) { drawChipForm(chipForms[0]); fitGate.request(); return; }
|
|
1051
1110
|
// Nothing to measure (not on screen, no layout): the whole chip, until the row has a width.
|
|
1052
1111
|
if (chipForms.length === 1 || !isRendered(btn) || !slot || typeof label?.getBoundingClientRect !== 'function') { drawChipForm(chipForms[0]); return; }
|
|
1053
1112
|
const row = slot.parentElement || null;
|
|
@@ -1080,6 +1139,8 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1080
1139
|
if (fitFrame || destroyed || typeof requestAnimationFrame !== 'function') return;
|
|
1081
1140
|
fitFrame = requestAnimationFrame(() => { fitFrame = 0; fitModelChip(); });
|
|
1082
1141
|
};
|
|
1142
|
+
// The fit a closed side panel put off (fitModelChip): on the frame after the panel is shown.
|
|
1143
|
+
const fitGate = createShownGate(buttons.model, scheduleFit);
|
|
1083
1144
|
const fitObserver = typeof ResizeObserver === 'function' && fitHost ? new ResizeObserver((entries) => {
|
|
1084
1145
|
const w = Math.round(entries[entries.length - 1]?.contentRect?.width || 0);
|
|
1085
1146
|
if (w !== fitWidth) { fitWidth = w; scheduleFit(); }
|
|
@@ -1111,6 +1172,11 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1111
1172
|
const testsLabel = tests ? testDensityLabel(tests, hooks.t) : '';
|
|
1112
1173
|
setBtn('tests', { label: testsLabel, icon: testsIcon(testDensityBars(tests)), hidden: !tests, tooltip: `${t('assistant.tests.title', 'Test density')}: ${testsLabel}` });
|
|
1113
1174
|
if (tests) buttons.tests.dataset.level = tests; else delete buttons.tests.dataset.level;
|
|
1175
|
+
// agents-p4: Agent density, right after Test density: the level's name, the cap in the tooltip.
|
|
1176
|
+
const agents = agentDensity();
|
|
1177
|
+
const agentsLabel = agents ? agentDensityLabel(agents, hooks.t) : '';
|
|
1178
|
+
setBtn('agents', { label: agentsLabel, icon: agentsIcon(agentDensityFigures(agents)), hidden: !agents, tooltip: agents ? `${t('assistant.agentDensity.title', 'Agent density')}: ${agentsLabel} (${agentDensityCap(agents, hooks.t)})` : '' });
|
|
1179
|
+
if (agents) buttons.agents.dataset.level = agents; else delete buttons.agents.dataset.level;
|
|
1114
1180
|
renderTools(brain);
|
|
1115
1181
|
renderEmptyProject(brain);
|
|
1116
1182
|
}
|
|
@@ -1178,13 +1244,15 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1178
1244
|
{ field: 'project', label: t('assistant.brain.project', 'Working project'), value: brain.project || v.project, icon: ICON_FOLDER, hidden: false },
|
|
1179
1245
|
{ field: 'mode', label: t('assistant.brain.mode', 'Permission mode'), value: v.mode, icon: ICON_SHIELD, hidden: false },
|
|
1180
1246
|
{ field: 'tests', label: t('assistant.tests.title', 'Test density'), value: testDensity() ? testDensityLabel(testDensity(), hooks.t) : '', icon: testsIcon(testDensityBars(testDensity())), hidden: !testDensity() },
|
|
1247
|
+
// agents-p4
|
|
1248
|
+
{ field: 'agents', label: t('assistant.agentDensity.title', 'Agent density'), value: agentDensity() ? `${agentDensityLabel(agentDensity(), hooks.t)} (${agentDensityCap(agentDensity(), hooks.t)})` : '', icon: agentsIcon(agentDensityFigures(agentDensity())), hidden: !agentDensity() },
|
|
1181
1249
|
{ field: 'account', label: t('assistant.brain.accountShort', 'Account'), value: accountValue(brain), icon: ICON_ACCOUNT, hidden: !ACCOUNT_PROVIDERS.has(brain.provider) },
|
|
1182
1250
|
];
|
|
1183
1251
|
}
|
|
1184
1252
|
|
|
1185
1253
|
function commit(patch, field) {
|
|
1186
1254
|
const before = currentBrain();
|
|
1187
|
-
const draft = { ...before, ...patch };
|
|
1255
|
+
const draft = { ...before, ...patch, ...(field === 'account' ? { accountPolicy: patch.accountId === 'auto' ? 'auto' : 'manual' } : {}) };
|
|
1188
1256
|
const next = resolveBrainDefaults(draft, snapshot(normalizeBrain(draft)));
|
|
1189
1257
|
const requiresSwitch = brainRequiresSwitch(before, next);
|
|
1190
1258
|
hooks.onChange?.(next, { requiresSwitch, field, previous: before });
|
|
@@ -1279,6 +1347,17 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1279
1347
|
});
|
|
1280
1348
|
return;
|
|
1281
1349
|
}
|
|
1350
|
+
// agents-p4: the session's own setting too: nothing to load. A radio menu, each level with its cap.
|
|
1351
|
+
if (field === 'agents') {
|
|
1352
|
+
const current = agentDensity();
|
|
1353
|
+
if (!current) return;
|
|
1354
|
+
openMenu(anchor, {
|
|
1355
|
+
title: t('assistant.agentDensity.title', 'Agent density'),
|
|
1356
|
+
items: agentDensityMenuItems(current, hooks.t).map((item) => ({ ...item, onSelect: () => { hooks.onAgentDensity?.(item.id); render(); } })),
|
|
1357
|
+
placement, role: 'menu', className: 'asst-tests-menu asst-agents-menu',
|
|
1358
|
+
});
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1282
1361
|
// The account menu reads the kept rows and asks again by itself (asst-account-menu.js).
|
|
1283
1362
|
if (field === 'account') {
|
|
1284
1363
|
if (!ACCOUNT_PROVIDERS.has(brain.provider)) return;
|
|
@@ -1408,6 +1487,7 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1408
1487
|
read: () => ({
|
|
1409
1488
|
accounts: codex ? getCachedCodexAccounts() : getCachedClaudeAccounts(),
|
|
1410
1489
|
currentId: currentBrain().accountId,
|
|
1490
|
+
accountPolicy: currentBrain().accountPolicy,
|
|
1411
1491
|
workerId: codex ? getCodexWorkerAccountId() : getClaudeWorkerAccountId(),
|
|
1412
1492
|
running: hooks.getRunning?.() === true,
|
|
1413
1493
|
}),
|
|
@@ -1446,6 +1526,7 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1446
1526
|
t: hooks.t,
|
|
1447
1527
|
rows: accounts.map((a) => accountMenuRow(a, { provider: p, t: hooks.t })),
|
|
1448
1528
|
currentId: brain.accountId,
|
|
1529
|
+
accountPolicy: brain.accountPolicy,
|
|
1449
1530
|
onAuto: () => commit({ accountId: 'auto' }, 'account'),
|
|
1450
1531
|
onPick: (id) => commit({ accountId: id }, 'account'),
|
|
1451
1532
|
onSignIn: (id) => hooks.onManageAccounts?.(brain.provider, id),
|
|
@@ -1470,7 +1551,7 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1470
1551
|
if (provider === before.provider) return;
|
|
1471
1552
|
await ensureLoaded(provider);
|
|
1472
1553
|
if (destroyed) return;
|
|
1473
|
-
const draft = { ...before, provider, model: model || '', effort: null, agent: null, accountId: null, tools: null };
|
|
1554
|
+
const draft = { ...before, provider, model: model || '', effort: null, agent: null, accountId: null, accountPolicy: 'manual', tools: null };
|
|
1474
1555
|
// resolveBrainDefaults reads the new provider's catalog.
|
|
1475
1556
|
const next = resolveBrainDefaults(draft, {
|
|
1476
1557
|
models: { [provider]: resolvableModels(provider, draft.model) },
|
|
@@ -1481,7 +1562,8 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1481
1562
|
projects: _projectsCache || [],
|
|
1482
1563
|
});
|
|
1483
1564
|
if (model && !next.model) next.model = model;
|
|
1484
|
-
hooks.onChange?.(next, { requiresSwitch: true, field: 'provider', previous: before });
|
|
1565
|
+
const applied = await hooks.onChange?.(next, { requiresSwitch: true, field: 'provider', previous: before });
|
|
1566
|
+
if (applied === false) return false;
|
|
1485
1567
|
render();
|
|
1486
1568
|
}
|
|
1487
1569
|
|
|
@@ -1511,6 +1593,6 @@ export function createBrainPicker(host, hooks = {}) {
|
|
|
1511
1593
|
mountEmptyProject,
|
|
1512
1594
|
setBrain() { render(); },
|
|
1513
1595
|
close: closeMenu,
|
|
1514
|
-
destroy() { toolsLife.abort(); toolsSlot.remove(); destroyed = true; fitObserver?.disconnect(); if (fitFrame && typeof cancelAnimationFrame === 'function') cancelAnimationFrame(fitFrame); for (const off of offAccounts) { try { off?.(); } catch {} } closeMenu(); heroProjectMascot?.destroy(); Object.values(buttons).forEach((b) => b.remove()); heroProject?.remove(); heroProject = null; root.remove(); },
|
|
1596
|
+
destroy() { toolsLife.abort(); toolsSlot.remove(); destroyed = true; fitGate.cancel(); fitObserver?.disconnect(); if (fitFrame && typeof cancelAnimationFrame === 'function') cancelAnimationFrame(fitFrame); for (const off of offAccounts) { try { off?.(); } catch {} } closeMenu(); heroProjectMascot?.destroy(); Object.values(buttons).forEach((b) => b.remove()); heroProject?.remove(); heroProject = null; root.remove(); },
|
|
1515
1597
|
};
|
|
1516
1598
|
}
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
import { normalizeProvider } from './asst-state.js';
|
|
39
39
|
import { sanitizeInto } from './asst-sanitize.js';
|
|
40
|
+
import { decorateCodeBlocks } from '../ui-code-copy.js';
|
|
40
41
|
import { fill, maskEcho, redactInput } from './asst-tool-kinds.js';
|
|
41
42
|
import { mascotSvg, paintMascot, stillFrame } from '../synabun-mascot.js';
|
|
42
43
|
import { splitRecommended } from './asst-followups.js';
|
|
@@ -1068,6 +1069,8 @@ function renderPlanBody(body, n, hooks) {
|
|
|
1068
1069
|
// The plan is the brain's text: whatever hooks.md returns, only the allowlist reaches the page.
|
|
1069
1070
|
try { sanitizeInto(planEl, typeof hooks.md === 'function' ? hooks.md(n.plan) : escapeHtml(n.plan).replace(/\n/g, '<br>')); }
|
|
1070
1071
|
catch { planEl.textContent = n.plan; } // no DOM to parse into (a test DOM): the plain text
|
|
1072
|
+
// A block of the plan gets the shared Copy button (../ui-code-copy.js).
|
|
1073
|
+
try { decorateCodeBlocks(planEl); } catch { /* a test DOM without selectors */ }
|
|
1071
1074
|
body.appendChild(planEl);
|
|
1072
1075
|
}
|
|
1073
1076
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Assistant — loops hold still while the UI is dragged
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// While a window or a panel is dragged or resized the page carries
|
|
5
|
+
// `body.ui-interacting`, and every loop under a rack or a scene holds still
|
|
6
|
+
// (asst-rack-styles.js, asst-scene-styles.js). The sheets used to say so with
|
|
7
|
+
// `body.ui-interacting .asst-rack *` and `body.ui-interacting .asst-scene *`:
|
|
8
|
+
// a selector that ends in `*` behind a class on <body> gives the engine no
|
|
9
|
+
// class or id to look for, so each change of the class restyled the WHOLE
|
|
10
|
+
// page: 8-10 ms for 8.4k elements and 30-55 ms for 15.7k in the SynaBun
|
|
11
|
+
// browser (2026-11-15), twice per drag, 0.5-0.7 ms with the flag below.
|
|
12
|
+
//
|
|
13
|
+
// The racks and scenes carry the flag themselves instead: `data-ui-held`, set
|
|
14
|
+
// here whenever the class is on <body> and taken off when it goes. Only what
|
|
15
|
+
// is under them is restyled, which is exactly what the old rule changed. One
|
|
16
|
+
// observer on <body>'s class; while the flag is up, a second one marks a rack
|
|
17
|
+
// or a scene that is added meanwhile, so nothing loops through a drag.
|
|
18
|
+
//
|
|
19
|
+
// installInteractionHold(doc?) → { sync(), held(), disconnect() }
|
|
20
|
+
//
|
|
21
|
+
// Idempotent per document. No observer (an old engine, a test without one):
|
|
22
|
+
// nothing is marked and every loop runs through a drag, as it did before the
|
|
23
|
+
// rule existed. DOM-light on purpose: tests/assistant-interaction-hold.test.mjs
|
|
24
|
+
// drives it with a stand-in document.
|
|
25
|
+
|
|
26
|
+
export const HELD_ATTR = 'data-ui-held';
|
|
27
|
+
export const HOLD_CLASS = 'ui-interacting';
|
|
28
|
+
export const HOLD_TARGETS = '.asst-rack, .asst-scene';
|
|
29
|
+
|
|
30
|
+
const installed = new WeakMap();
|
|
31
|
+
|
|
32
|
+
export function installInteractionHold(doc = globalThis.document) {
|
|
33
|
+
if (!doc?.body) return null;
|
|
34
|
+
const existing = installed.get(doc);
|
|
35
|
+
if (existing) return existing;
|
|
36
|
+
|
|
37
|
+
const body = doc.body;
|
|
38
|
+
const Observer = doc.defaultView?.MutationObserver || globalThis.MutationObserver;
|
|
39
|
+
let held = false;
|
|
40
|
+
let additions = null;
|
|
41
|
+
|
|
42
|
+
function mark(el, on) {
|
|
43
|
+
try {
|
|
44
|
+
if (on) { if (!el.hasAttribute(HELD_ATTR)) el.setAttribute(HELD_ATTR, ''); }
|
|
45
|
+
else if (el.hasAttribute(HELD_ATTR)) el.removeAttribute(HELD_ATTR);
|
|
46
|
+
} catch { /* not an element */ }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function markUnder(node, on) {
|
|
50
|
+
if (!node || node.nodeType !== 1) return;
|
|
51
|
+
if (node.matches?.(HOLD_TARGETS)) mark(node, on);
|
|
52
|
+
const inner = node.querySelectorAll?.(HOLD_TARGETS);
|
|
53
|
+
if (inner) for (const el of inner) mark(el, on);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function watchAdditions(on) {
|
|
57
|
+
if (!on) { try { additions?.disconnect(); } catch { /* already gone */ } additions = null; return; }
|
|
58
|
+
if (additions || typeof Observer !== 'function') return;
|
|
59
|
+
additions = new Observer((records) => {
|
|
60
|
+
if (!held) return;
|
|
61
|
+
for (const record of records) for (const node of record.addedNodes || []) markUnder(node, true);
|
|
62
|
+
});
|
|
63
|
+
try { additions.observe(body, { childList: true, subtree: true }); } catch { additions = null; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function sync() {
|
|
67
|
+
if (!classes) return false;
|
|
68
|
+
const on = !!body.classList?.contains(HOLD_CLASS);
|
|
69
|
+
if (on === held) return held;
|
|
70
|
+
held = on;
|
|
71
|
+
// Taking the flag off reads the marked ones, so a rack that left its class meanwhile is cleared too.
|
|
72
|
+
const targets = doc.querySelectorAll(on ? HOLD_TARGETS : `[${HELD_ATTR}]`);
|
|
73
|
+
for (const el of targets) mark(el, on);
|
|
74
|
+
watchAdditions(on);
|
|
75
|
+
return held;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let classes = null;
|
|
79
|
+
if (typeof Observer === 'function') {
|
|
80
|
+
classes = new Observer(sync);
|
|
81
|
+
try { classes.observe(body, { attributes: true, attributeFilter: ['class'] }); } catch { classes = null; }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const api = {
|
|
85
|
+
sync,
|
|
86
|
+
held: () => held,
|
|
87
|
+
disconnect() {
|
|
88
|
+
try { classes?.disconnect(); } catch { /* already gone */ }
|
|
89
|
+
classes = null;
|
|
90
|
+
if (held) { held = false; for (const el of doc.querySelectorAll(`[${HELD_ATTR}]`)) mark(el, false); }
|
|
91
|
+
watchAdditions(false);
|
|
92
|
+
installed.delete(doc);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
installed.set(doc, api);
|
|
96
|
+
// No observer: nothing would ever take the flag off again, so nothing is marked at all.
|
|
97
|
+
if (classes) sync();
|
|
98
|
+
return api;
|
|
99
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Assistant — dismissed usage-limit countdowns
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// The × on a limit-wait card (asst-limit-wait.js, shown by the conversation's
|
|
5
|
+
// one dock, asst-limit-dock.js) hides that card for the limit episode it
|
|
6
|
+
// counts down: the session, the dock entry (`brain` or `run:<id>`) and the
|
|
7
|
+
// reset time. The same episode reported again (a reattach, a replayed error,
|
|
8
|
+
// a run card that refreshes, a reload) stays hidden; a new one shows: a later
|
|
9
|
+
// reset time, another run, another session. A dismissal ends with its episode
|
|
10
|
+
// (the reset time passing) and is pruned then.
|
|
11
|
+
//
|
|
12
|
+
// No DOM and no imports but asst-limit.js: the store is injected
|
|
13
|
+
// ({ getItem, setItem, removeItem }: storage.js in the panel, a Map in tests),
|
|
14
|
+
// so it runs under node.
|
|
15
|
+
|
|
16
|
+
import { resetMs } from './asst-limit.js';
|
|
17
|
+
|
|
18
|
+
export const LIMIT_DISMISSALS_KEY = 'synabun-assistant-limit-dismissed';
|
|
19
|
+
/**
|
|
20
|
+
* A reset reported up to this much later is the same episode: a structured report refining the words' time, or
|
|
21
|
+
* the same limit hit again a few minutes on, whose "try again in 2 hours" is read from a later moment. Two real
|
|
22
|
+
* limit windows are hours apart (a 5-hour window, a weekly one), so a later one is never mistaken for this one.
|
|
23
|
+
*/
|
|
24
|
+
export const SAME_EPISODE_SLACK_MS = 15 * 60_000;
|
|
25
|
+
/** A card whose reset time is unknown stays dismissed this long, then shows again if the limit still holds. */
|
|
26
|
+
export const UNKNOWN_RESET_HOLD_MS = 5 * 3_600_000;
|
|
27
|
+
const MAX_RECORDS = 200;
|
|
28
|
+
|
|
29
|
+
/** A record's reset: stored already in epoch ms by dismiss() (never normalized twice). */
|
|
30
|
+
function recordReset(record) {
|
|
31
|
+
const n = record?.resetsAt == null ? NaN : Number(record.resetsAt);
|
|
32
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function idOf(scope, key) {
|
|
36
|
+
return `${String(scope || '')}|${String(key || '')}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** When a dismissal stops mattering: its reset time, or (reset unknown) the hold after it was made. */
|
|
40
|
+
export function dismissalExpiresAt(record) {
|
|
41
|
+
if (!record || typeof record !== 'object') return 0;
|
|
42
|
+
const reset = recordReset(record);
|
|
43
|
+
if (reset !== null) return reset;
|
|
44
|
+
const at = Number(record.at);
|
|
45
|
+
return Number.isFinite(at) ? at + UNKNOWN_RESET_HOLD_MS : 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Whether a dismissal still hides a card that counts to `resetsAt` (null: unknown). Pure.
|
|
50
|
+
* Hidden: the dismissal's episode has not ended, and the card's reset is not later than the dismissed one
|
|
51
|
+
* (beyond the slack): a later reset is a new limit. A card with no known reset is hidden by any live
|
|
52
|
+
* dismissal of the same entry (it adds nothing the dismissed card did not say).
|
|
53
|
+
*/
|
|
54
|
+
export function dismissalHides(record, resetsAt, now = Date.now()) {
|
|
55
|
+
if (!record) return false;
|
|
56
|
+
if (dismissalExpiresAt(record) <= now) return false;
|
|
57
|
+
const dismissed = recordReset(record);
|
|
58
|
+
const shown = resetMs(resetsAt);
|
|
59
|
+
if (shown === null) return true;
|
|
60
|
+
if (dismissed === null) return true;
|
|
61
|
+
return shown <= dismissed + SAME_EPISODE_SLACK_MS;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The records still in force, newest kept when there are too many. Pure. */
|
|
65
|
+
export function pruneDismissals(records, now = Date.now()) {
|
|
66
|
+
const live = Object.entries(records && typeof records === 'object' ? records : {})
|
|
67
|
+
.filter(([, record]) => dismissalExpiresAt(record) > now)
|
|
68
|
+
.sort((a, b) => (Number(b[1].at) || 0) - (Number(a[1].at) || 0))
|
|
69
|
+
.slice(0, MAX_RECORDS);
|
|
70
|
+
return Object.fromEntries(live);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* createLimitDismissals({ storage, key, now }) → { hides(scope, key, resetsAt), dismiss(scope, key, resetsAt), forget(scope, key) }
|
|
75
|
+
* `storage`: { getItem, setItem, removeItem } (strings). Without one, dismissals live in memory only.
|
|
76
|
+
*/
|
|
77
|
+
export function createLimitDismissals({ storage = null, key = LIMIT_DISMISSALS_KEY, now = () => Date.now() } = {}) {
|
|
78
|
+
let memory = {};
|
|
79
|
+
function read() {
|
|
80
|
+
if (!storage) return memory;
|
|
81
|
+
try {
|
|
82
|
+
const parsed = JSON.parse(storage.getItem(key) || '{}');
|
|
83
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
84
|
+
} catch { return {}; }
|
|
85
|
+
}
|
|
86
|
+
function write(records) {
|
|
87
|
+
if (!storage) { memory = records; return; }
|
|
88
|
+
try {
|
|
89
|
+
if (Object.keys(records).length) storage.setItem(key, JSON.stringify(records));
|
|
90
|
+
else storage.removeItem(key);
|
|
91
|
+
} catch { /* a refused write keeps the card hidden for this page only */ memory = records; }
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
hides(scope, entryKey, resetsAt) {
|
|
95
|
+
return dismissalHides(read()[idOf(scope, entryKey)], resetsAt, now());
|
|
96
|
+
},
|
|
97
|
+
dismiss(scope, entryKey, resetsAt) {
|
|
98
|
+
const at = now();
|
|
99
|
+
const records = pruneDismissals(read(), at);
|
|
100
|
+
records[idOf(scope, entryKey)] = { resetsAt: resetMs(resetsAt), at };
|
|
101
|
+
write(pruneDismissals(records, at));
|
|
102
|
+
},
|
|
103
|
+
forget(scope, entryKey) {
|
|
104
|
+
const records = read();
|
|
105
|
+
const id = idOf(scope, entryKey);
|
|
106
|
+
if (!(id in records)) return;
|
|
107
|
+
delete records[id];
|
|
108
|
+
write(pruneDismissals(records, now()));
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
// One countdown owner per mounted conversation. Transcript replay and run-card
|
|
2
2
|
// refreshes update keyed records; they never allocate their own waiting cards.
|
|
3
|
+
//
|
|
4
|
+
// Every card it shows can be dismissed (the card's ×, Esc inside it): the
|
|
5
|
+
// entry stays registered, since a run card re-registers its limit on every
|
|
6
|
+
// refresh and a reattach reports the brain's again, but the dismissal
|
|
7
|
+
// (asst-limit-dismissals.js: this conversation, the entry, its reset time)
|
|
8
|
+
// keeps that episode's card hidden. The next newest entry that is not
|
|
9
|
+
// dismissed takes the dock; a new episode (a later reset, another run) shows.
|
|
3
10
|
import { createLimitWait } from './asst-limit-wait.js';
|
|
11
|
+
import { createLimitDismissals } from './asst-limit-dismissals.js';
|
|
4
12
|
|
|
5
|
-
export function createLimitDock(transcript, {
|
|
13
|
+
export function createLimitDock(transcript, {
|
|
14
|
+
t,
|
|
15
|
+
createWait = createLimitWait,
|
|
16
|
+
createElement = () => document.createElement('div'),
|
|
17
|
+
// The conversation the dismissals belong to (its session id); '' keeps them to this dock's page.
|
|
18
|
+
scope = () => '',
|
|
19
|
+
dismissals = createLimitDismissals(),
|
|
20
|
+
} = {}) {
|
|
6
21
|
const host = createElement();
|
|
7
22
|
host.className = 'asst-limit-dock';
|
|
8
23
|
host.hidden = true;
|
|
@@ -12,8 +27,23 @@ export function createLimitDock(transcript, { t, createWait = createLimitWait, c
|
|
|
12
27
|
let wait = null;
|
|
13
28
|
let provider = null;
|
|
14
29
|
let destroyed = false;
|
|
30
|
+
const scopeId = () => { try { return String(scope() || ''); } catch { return ''; } };
|
|
31
|
+
const hidden = (key, info) => { try { return !!dismissals.hides(scopeId(), key, info?.resetsAt ?? null); } catch { return false; } };
|
|
32
|
+
|
|
33
|
+
function dismiss(key) {
|
|
34
|
+
if (destroyed) return;
|
|
35
|
+
const info = entries.get(key);
|
|
36
|
+
if (!info) return;
|
|
37
|
+
try { dismissals.dismiss(scopeId(), key, info.resetsAt ?? null); } catch { /* hidden for this render at least */ }
|
|
38
|
+
// The host's own close (the brain's drops its entry); the dock's render below hides the rest.
|
|
39
|
+
try { info.onClose?.(); } catch { /* the host reports its own failure */ }
|
|
40
|
+
render();
|
|
41
|
+
}
|
|
42
|
+
|
|
15
43
|
function render() {
|
|
16
|
-
const next = [...entries.entries()]
|
|
44
|
+
const next = [...entries.entries()]
|
|
45
|
+
.filter(([key, info]) => !hidden(key, info))
|
|
46
|
+
.sort((a, b) => (b[1].since || 0) - (a[1].since || 0))[0];
|
|
17
47
|
const key = next?.[0] || null;
|
|
18
48
|
if (key !== active || next?.[1].provider !== provider) {
|
|
19
49
|
wait?.destroy();
|
|
@@ -24,7 +54,7 @@ export function createLimitDock(transcript, { t, createWait = createLimitWait, c
|
|
|
24
54
|
t, ...next[1],
|
|
25
55
|
onRetry: next[1].onRetry ? () => entries.get(key)?.onRetry?.() : null,
|
|
26
56
|
onSwitchProvider: next[1].onSwitchProvider ? (anchor) => entries.get(key)?.onSwitchProvider?.(anchor) : null,
|
|
27
|
-
onClose:
|
|
57
|
+
onClose: () => dismiss(key),
|
|
28
58
|
}) : null;
|
|
29
59
|
if (wait) host.appendChild(wait.el);
|
|
30
60
|
} else if (wait) wait.update({ resetsAt: next[1].resetsAt });
|
|
@@ -39,6 +69,10 @@ export function createLimitDock(transcript, { t, createWait = createLimitWait, c
|
|
|
39
69
|
else entries.delete(key);
|
|
40
70
|
return render();
|
|
41
71
|
},
|
|
72
|
+
/** Hide `key`'s card for its current limit episode (what the card's × does). */
|
|
73
|
+
dismiss,
|
|
74
|
+
/** Whether `key` is registered but dismissed for its episode (tests, diagnostics). */
|
|
75
|
+
isDismissed(key) { const info = entries.get(key); return !!info && hidden(key, info); },
|
|
42
76
|
clear() { if (destroyed) return; entries.clear(); render(); },
|
|
43
77
|
destroy() { destroyed = true; entries.clear(); wait?.destroy(); wait = null; active = null; host.remove(); },
|
|
44
78
|
};
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
// waits with "Reset time unknown" and offers the retry at once. While it
|
|
10
10
|
// blocks, a host that passes onSwitchProvider also offers "Continue with
|
|
11
11
|
// another provider" (the host owns the picker and what a pick does); a host
|
|
12
|
-
// that passes onClose always offers
|
|
13
|
-
//
|
|
14
|
-
//
|
|
12
|
+
// that passes onClose always offers the × in the card's corner (Dismiss),
|
|
13
|
+
// which only dismisses the card — the limit itself is untouched; the dock
|
|
14
|
+
// keeps that episode's card hidden, asst-limit-dismissals.js — and Esc does
|
|
15
|
+
// the same while focus is inside. The clock is the shared ticker at 1 fps, only while it counts and
|
|
15
16
|
// only while the card is on the page; under prefers-reduced-motion the mascot
|
|
16
17
|
// is a still and nothing eases. Its sheet is its own (injectLimitWaitStyles),
|
|
17
18
|
// like the rack's.
|
|
@@ -22,6 +23,7 @@ import { syncEmpty } from '../shown-children.js';
|
|
|
22
23
|
import { limitCountdown, resetMs } from './asst-limit.js';
|
|
23
24
|
|
|
24
25
|
const RING_R = 24;
|
|
26
|
+
const ICON_X = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M18 6 6 18M6 6l12 12"/></svg>';
|
|
25
27
|
const DAY_MS = 86_400_000;
|
|
26
28
|
|
|
27
29
|
function el(tag, className, text) {
|
|
@@ -48,7 +50,7 @@ function localTime(ms, now) {
|
|
|
48
50
|
* `resetsAt`: epoch ms / s or ISO, or null (unknown). `since`: when the wait began (the ring's start).
|
|
49
51
|
* `provider`: the name in the meta line ("Codex"). `onRetry()`: Retry now; null: no button.
|
|
50
52
|
* `onSwitchProvider(anchorEl)`: Continue with another provider, while blocking; null: no button.
|
|
51
|
-
* `onClose()`:
|
|
53
|
+
* `onClose()`: the × Dismiss button in the corner (and Esc, while focus is inside); null: no button.
|
|
52
54
|
*/
|
|
53
55
|
export function createLimitWait(opts = {}) {
|
|
54
56
|
injectLimitWaitStyles();
|
|
@@ -114,13 +116,21 @@ export function createLimitWait(opts = {}) {
|
|
|
114
116
|
actions.appendChild(retryBtn);
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
// Dismisses the card only; the limit itself is untouched (the host decides how it resurfaces).
|
|
119
|
+
// Dismisses the card only; the limit itself is untouched (the host decides how it resurfaces). An icon
|
|
120
|
+
// button in the card's corner, named for screen readers and tooltips; it never sits in the actions row,
|
|
121
|
+
// so a settled card with no action left still has it.
|
|
118
122
|
let closeBtn = null;
|
|
119
123
|
if (typeof opts.onClose === 'function') {
|
|
120
|
-
|
|
124
|
+
const label = t('assistant.limitWait.dismiss', 'Dismiss');
|
|
125
|
+
closeBtn = el('button', 'asst-iconbtn asst-limit-wait-close');
|
|
121
126
|
closeBtn.type = 'button';
|
|
127
|
+
closeBtn.innerHTML = ICON_X;
|
|
128
|
+
closeBtn.setAttribute('aria-label', label);
|
|
129
|
+
closeBtn.dataset.tooltip = label;
|
|
130
|
+
closeBtn.dataset.tooltipPos = 'left';
|
|
122
131
|
closeBtn.addEventListener('click', () => { if (!destroyed) opts.onClose(); });
|
|
123
|
-
|
|
132
|
+
card.classList.add('has-close');
|
|
133
|
+
card.appendChild(closeBtn);
|
|
124
134
|
// Not a dialog (role="group"): Esc closes it only while focus is inside.
|
|
125
135
|
card.addEventListener('keydown', (e) => {
|
|
126
136
|
if (e.key !== 'Escape' || destroyed) return;
|
|
@@ -261,6 +271,7 @@ export function createLimitWait(opts = {}) {
|
|
|
261
271
|
const CSS = `
|
|
262
272
|
.asst-limit-wait {
|
|
263
273
|
--lw-tone: var(--asst-brand);
|
|
274
|
+
position: relative;
|
|
264
275
|
display: grid;
|
|
265
276
|
grid-template-columns: 56px minmax(0, 1fr);
|
|
266
277
|
align-items: center;
|
|
@@ -304,6 +315,18 @@ const CSS = `
|
|
|
304
315
|
.asst-limit-wait-meta { color: var(--asst-text-3); font-size: 11.5px; overflow-wrap: anywhere; }
|
|
305
316
|
.asst-limit-wait-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
|
|
306
317
|
.asst-limit-wait-actions[data-empty] { display: none; }
|
|
318
|
+
.asst-limit-wait.has-close { padding-right: 36px; }
|
|
319
|
+
.asst-limit-wait-close.asst-iconbtn {
|
|
320
|
+
--cap-h: var(--asst-pill-h-sm);
|
|
321
|
+
--cap-r: var(--asst-pill-r-sm);
|
|
322
|
+
--cap-icon: 12px;
|
|
323
|
+
position: absolute;
|
|
324
|
+
top: 6px;
|
|
325
|
+
right: 6px;
|
|
326
|
+
height: var(--cap-h);
|
|
327
|
+
color: var(--asst-text-3);
|
|
328
|
+
}
|
|
329
|
+
.asst-limit-wait-close.asst-iconbtn:is(:hover, :focus-visible):not(:disabled) { color: var(--asst-text); }
|
|
307
330
|
.asst-limit-wait-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
308
331
|
.asst-limit-row .asst-msg-content { width: 100%; }
|
|
309
332
|
.asst-run .asst-limit-wait { grid-column: 2 / span 2; margin-top: 8px; padding: 10px 12px; }
|