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 { sessionProjectItems } from '../session-project-items.js';
|
|
1
2
|
import { t } from '../i18n.js';
|
|
2
3
|
import { migrateStoredTools } from '../tool-list-storage.js';
|
|
3
4
|
import { wireDropdowns, closeDropdowns, setDropdownDisabled, dropdownOf } from '../cc-dropdown.js';
|
|
@@ -307,12 +308,8 @@ function wireProjectDd() {
|
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
function paintProjectMenu() {
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
const path = (p && (p.path || p)) || '';
|
|
313
|
-
const label = typeof path === 'string' ? path.split('/').filter(Boolean).pop() : '';
|
|
314
|
-
return { value: String(path), label: label || String(path), title: String(path) };
|
|
315
|
-
}).filter((it) => it.value);
|
|
311
|
+
const items = sessionProjectItems(_ctx.getProjects?.() || [], getState().cwd || '')
|
|
312
|
+
.map(item => ({ ...item, title: item.value }));
|
|
316
313
|
|
|
317
314
|
ddPopulate(_projectDd, items, getState().cwd || '', (value) => {
|
|
318
315
|
_ctx.setActiveProject?.(value);
|
|
@@ -23,7 +23,9 @@ import { TOOL_ICONS } from './ocp-v2-icons.js';
|
|
|
23
23
|
import { renderToolCard } from './ocp-v2-tools.js';
|
|
24
24
|
import { messageMetaText } from './ocp-v2-tools-logic.js';
|
|
25
25
|
import { createStickyScrollController } from '../ui-scroll-follow.js';
|
|
26
|
+
import { watchTranscriptRows } from '../transcript-rows.js';
|
|
26
27
|
import { sanitizeHtmlString } from '../assistant/asst-sanitize.js';
|
|
28
|
+
import { withCodeCopyButtons } from '../code-copy.js';
|
|
27
29
|
import { openProviderSettings } from './ocp-v2-settings-link.js';
|
|
28
30
|
import {
|
|
29
31
|
visibleParts, partSignature, messageErrorView, retryBannerView, retryPartText,
|
|
@@ -82,6 +84,10 @@ export function mountRenderer(containerEl, store = getDefaultStore(), opts = {})
|
|
|
82
84
|
let _container = containerEl;
|
|
83
85
|
let _renderScheduled = false;
|
|
84
86
|
const scrollController = createStickyScrollController(_container);
|
|
87
|
+
// Rows far from the screen are skipped by the engine, at their exact size (transcript-rows.js). The rows
|
|
88
|
+
// are the keyed children _reconcile keeps; the declarations are inline, so a kept row keeps them and a
|
|
89
|
+
// rebuilt one starts plain.
|
|
90
|
+
const rowWatcher = watchTranscriptRows(_container);
|
|
85
91
|
|
|
86
92
|
const doRender = () => {
|
|
87
93
|
render(_container, store, opts);
|
|
@@ -108,6 +114,7 @@ export function mountRenderer(containerEl, store = getDefaultStore(), opts = {})
|
|
|
108
114
|
unmount: () => {
|
|
109
115
|
try { unsubscribe(); } catch {}
|
|
110
116
|
scrollController?.destroy();
|
|
117
|
+
rowWatcher.disconnect();
|
|
111
118
|
_activeRenderers.delete(instance);
|
|
112
119
|
_container = null;
|
|
113
120
|
},
|
|
@@ -124,7 +131,18 @@ export function unmountRenderer() {
|
|
|
124
131
|
for (const r of _activeRenderers) { try { r.unmount(); } catch {} }
|
|
125
132
|
}
|
|
126
133
|
|
|
127
|
-
|
|
134
|
+
// A part's signature, kept per part object. The store never changes a part in place (an update or a streamed
|
|
135
|
+
// chunk puts a new object in its place: ocp-v2-state.js upsertPart / appendPartDelta), so one object has one
|
|
136
|
+
// signature. A render pass signs every part of the transcript, and a tool part's signature serialises its
|
|
137
|
+
// input, output and metadata to measure them: without this, every frame of a stream did that again for every
|
|
138
|
+
// tool call the session ever made.
|
|
139
|
+
const _partSigs = new WeakMap();
|
|
140
|
+
function _partSig(part) {
|
|
141
|
+
if (!part || typeof part !== 'object') return partSignature(part);
|
|
142
|
+
let sig = _partSigs.get(part);
|
|
143
|
+
if (sig === undefined) { sig = partSignature(part); _partSigs.set(part, sig); }
|
|
144
|
+
return sig;
|
|
145
|
+
}
|
|
128
146
|
|
|
129
147
|
function _msgSig(msg) {
|
|
130
148
|
let sig = `m:${msg.role || 'assistant'}`;
|
|
@@ -647,28 +665,11 @@ function renderPart(part, store) {
|
|
|
647
665
|
function renderTextPart(part) {
|
|
648
666
|
const el = document.createElement('div');
|
|
649
667
|
el.className = 'ocpv2-part ocpv2-part-text';
|
|
668
|
+
// Every fenced block carries the shared Copy button: renderMarkdown writes it in (../code-copy.js).
|
|
650
669
|
el.innerHTML = renderMarkdown(part.text || '');
|
|
651
|
-
decorateCodeBlocks(el);
|
|
652
670
|
return el;
|
|
653
671
|
}
|
|
654
672
|
|
|
655
|
-
// A Copy button on every fenced block.
|
|
656
|
-
function decorateCodeBlocks(root) {
|
|
657
|
-
for (const pre of root.querySelectorAll('pre')) {
|
|
658
|
-
const btn = document.createElement('button');
|
|
659
|
-
btn.type = 'button';
|
|
660
|
-
btn.className = 'ocpv2-code-copy';
|
|
661
|
-
btn.textContent = 'Copy';
|
|
662
|
-
btn.addEventListener('click', (event) => {
|
|
663
|
-
event.stopPropagation();
|
|
664
|
-
const code = pre.querySelector('code');
|
|
665
|
-
copyText((code || pre).textContent || '', btn).catch(() => {});
|
|
666
|
-
});
|
|
667
|
-
pre.classList.add('ocpv2-code-block');
|
|
668
|
-
pre.appendChild(btn);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
673
|
function renderReasoningPart(part) {
|
|
673
674
|
const streaming = !part?.time?.end;
|
|
674
675
|
// While streaming → single thin row with an animated "Thinking…" label
|
|
@@ -1777,13 +1778,15 @@ function renderMarkdown(src) {
|
|
|
1777
1778
|
} else {
|
|
1778
1779
|
html = escapeHtml(text).replace(/\n/g, '<br>');
|
|
1779
1780
|
}
|
|
1781
|
+
// Every code block gets the shared Copy button, written in after the sanitiser (../code-copy.js).
|
|
1782
|
+
const shown = withCodeCopyButtons(html);
|
|
1780
1783
|
if (_markdownCache.size >= _markdownCacheLimit) {
|
|
1781
1784
|
// Evict oldest insertion (Map preserves insertion order)
|
|
1782
1785
|
const firstKey = _markdownCache.keys().next().value;
|
|
1783
1786
|
if (firstKey !== undefined) _markdownCache.delete(firstKey);
|
|
1784
1787
|
}
|
|
1785
|
-
_markdownCache.set(text,
|
|
1786
|
-
return
|
|
1788
|
+
_markdownCache.set(text, shown);
|
|
1789
|
+
return shown;
|
|
1787
1790
|
}
|
|
1788
1791
|
|
|
1789
1792
|
function escapeHtml(s) {
|
|
@@ -196,8 +196,8 @@ function applyAskEvent(open, eventType, ev) {
|
|
|
196
196
|
return known?.owner !== owner;
|
|
197
197
|
}
|
|
198
198
|
if (ANSWERED.has(eventType)) return open.delete(askIdOf(ev));
|
|
199
|
-
if (eventType === 'session.idle' || eventType === 'session.error') {
|
|
200
|
-
const sid = String(ev?.sessionID || ev?.sessionId || '');
|
|
199
|
+
if (eventType === 'session.idle' || eventType === 'session.error' || eventType === 'session.deleted') {
|
|
200
|
+
const sid = String(ev?.sessionID || ev?.sessionId || ev?.info?.id || '');
|
|
201
201
|
let gone = false;
|
|
202
202
|
for (const [id, entry] of open) if (entry.owner === sid) { open.delete(id); gone = true; }
|
|
203
203
|
return gone;
|
|
@@ -249,6 +249,15 @@ export function createAskTracker({ parentOf = new Map(), attempts = ASK_READ_ATT
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
const under = (owner, root) => owner === root || knownDescendant(owner, root, parentOf);
|
|
252
|
+
const openAsksOf = (sid) => {
|
|
253
|
+
const requests = [];
|
|
254
|
+
if (sid) for (const [id, ask] of open) if (under(ask.owner, sid)) requests.push({ id, ...ask });
|
|
255
|
+
return requests;
|
|
256
|
+
};
|
|
257
|
+
const hasOpenAsks = (sid) => {
|
|
258
|
+
if (sid) for (const { owner } of open.values()) if (under(owner, sid)) return true;
|
|
259
|
+
return false;
|
|
260
|
+
};
|
|
252
261
|
const expect = (sessionId, kinds) => {
|
|
253
262
|
let set = pending.get(sessionId);
|
|
254
263
|
if (!set) pending.set(sessionId, (set = new Set()));
|
|
@@ -274,15 +283,17 @@ export function createAskTracker({ parentOf = new Map(), attempts = ASK_READ_ATT
|
|
|
274
283
|
return {
|
|
275
284
|
note(eventType, ev) {
|
|
276
285
|
replay?.push([eventType, ev]);
|
|
277
|
-
if (applyAskEvent(open, eventType, ev)
|
|
286
|
+
if (applyAskEvent(open, eventType, ev)) changed();
|
|
278
287
|
},
|
|
288
|
+
// Pills need a concrete request. A reconnect can pause a turn clock while lists are still out.
|
|
289
|
+
hasOpenAsks,
|
|
290
|
+
openAsksOf,
|
|
279
291
|
waits(sessionId) {
|
|
280
292
|
const sid = String(sessionId || '');
|
|
281
293
|
if (!sid) return false;
|
|
282
294
|
if (held) return true;
|
|
283
295
|
for (const [root, kinds] of pending) if (kinds.size && under(sid, root)) return true;
|
|
284
|
-
|
|
285
|
-
return false;
|
|
296
|
+
return hasOpenAsks(sid);
|
|
286
297
|
},
|
|
287
298
|
hold() {
|
|
288
299
|
generation += 1;
|
|
@@ -254,19 +254,33 @@ export function automationTurnPhase(run) {
|
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* A tab's tray pill: 'waiting' while its session waits on the user, 'working'
|
|
257
|
-
* while a turn of it runs, else 'idle'.
|
|
257
|
+
* while a turn of it runs, else 'idle'. Pending asks take priority over turn state.
|
|
258
|
+
* A live automation run's own phase
|
|
258
259
|
* (`automation`, automationTurnPhase) decides: an idle warm worker rests,
|
|
259
260
|
* whatever its run (and the store of the session on screen, which follows the
|
|
260
261
|
* run) says; nobody else can start a turn in it meanwhile (canSend). Otherwise
|
|
261
262
|
* the session on screen reads its store (`running`) and another tab what
|
|
262
263
|
* OpenCode said of it (`busy`).
|
|
263
264
|
*/
|
|
264
|
-
export function tabPillState({
|
|
265
|
+
export function tabPillState({
|
|
266
|
+
sessionId, activeSessionId, running = false, busy = false, automation = null,
|
|
267
|
+
pendingPermissions = [], pendingQuestions = [], familyWaiting = false,
|
|
268
|
+
} = {}) {
|
|
269
|
+
if (pendingPermissions.length || pendingQuestions.length || familyWaiting) return 'waiting';
|
|
265
270
|
if (automation === 'working' || automation === 'waiting' || automation === 'idle') return automation;
|
|
266
271
|
const turn = sessionId && sessionId === activeSessionId ? !!running : !!busy;
|
|
267
272
|
return turn ? 'working' : 'idle';
|
|
268
273
|
}
|
|
269
274
|
|
|
275
|
+
/** OpenCode stored bare session IDs before tab records included attention state. */
|
|
276
|
+
export function readSavedTabs(value) {
|
|
277
|
+
if (!Array.isArray(value)) return [];
|
|
278
|
+
return value
|
|
279
|
+
.map((row) => typeof row === 'string' ? { sessionId: row } : row)
|
|
280
|
+
.filter((row) => typeof row?.sessionId === 'string' && row.sessionId)
|
|
281
|
+
.map((row) => ({ ...row, needsYou: row.needsYou === true }));
|
|
282
|
+
}
|
|
283
|
+
|
|
270
284
|
// ── Renames that are waiting for their answer ───────────────────────────────
|
|
271
285
|
|
|
272
286
|
/**
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// so the renderer doesn't change.
|
|
6
6
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
7
|
|
|
8
|
+
import { installCodeCopy } from '../ui-code-copy.js';
|
|
9
|
+
|
|
8
10
|
const STYLE_ID = 'ocp-v2-styles';
|
|
9
11
|
|
|
10
12
|
const CSS = `
|
|
@@ -45,10 +47,6 @@ const CSS = `
|
|
|
45
47
|
opacity: 1;
|
|
46
48
|
overflow: visible;
|
|
47
49
|
}
|
|
48
|
-
/* Windows: the shell is 92% opaque, so the blur behind it barely shows, yet Chromium recomputes it on every
|
|
49
|
-
repaint inside the panel (a transcript rendering, a stream). There it goes; the colour stays. */
|
|
50
|
-
html.platform-win32 .ocpv2-panel,
|
|
51
|
-
html.desktop-titlebar--win32 .ocpv2-panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
|
|
52
50
|
/* Keep footer menus above focused floating terminal windows. */
|
|
53
51
|
.ocpv2-panel:has(.ocpv2-dropdown.open) {
|
|
54
52
|
z-index: 99999;
|
|
@@ -469,18 +467,8 @@ html.desktop-titlebar--win32 .ocpv2-panel { backdrop-filter: none; -webkit-backd
|
|
|
469
467
|
rgba(232,224,220,0.0) 100%
|
|
470
468
|
);
|
|
471
469
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
border-color: rgba(232, 224, 220, 0.38);
|
|
475
|
-
}
|
|
476
|
-
html.platform-win32 .ocpv2-session-pill.ocpv2-pill-running:hover,
|
|
477
|
-
html.desktop-titlebar--win32 .ocpv2-session-pill.ocpv2-pill-running:hover {
|
|
478
|
-
border-color: rgba(232, 224, 220, 0.58);
|
|
479
|
-
}
|
|
480
|
-
html.platform-win32 .ocpv2-session-pill.ocpv2-pill-running .ocpv2-pill-ring,
|
|
481
|
-
html.desktop-titlebar--win32 .ocpv2-session-pill.ocpv2-pill-running .ocpv2-pill-ring {
|
|
482
|
-
display: none;
|
|
483
|
-
}
|
|
470
|
+
/* The ring turns on Windows as everywhere (it was a still border there until 2026-11-15): the turn is the
|
|
471
|
+
compositor's, nothing is restyled or repainted per frame (tests/windows-visuals.test.mjs). */
|
|
484
472
|
body.ui-interacting .ocpv2-pill-ring > i { animation-play-state: paused; }
|
|
485
473
|
.ocpv2-session-pill.ocpv2-pill-running .term-minimized-pill-label::before {
|
|
486
474
|
content: '';
|
|
@@ -2073,7 +2061,7 @@ body.ui-interacting .ocpv2-spin-ring > i { animation-play-state: paused !importa
|
|
|
2073
2061
|
.ocpv2-image-chip img {
|
|
2074
2062
|
width: 100%;
|
|
2075
2063
|
height: 100%;
|
|
2076
|
-
object-fit:
|
|
2064
|
+
object-fit: contain;
|
|
2077
2065
|
display: block;
|
|
2078
2066
|
}
|
|
2079
2067
|
.ocpv2-image-chip-remove {
|
|
@@ -2104,7 +2092,8 @@ body.ui-interacting .ocpv2-spin-ring > i { animation-play-state: paused !importa
|
|
|
2104
2092
|
}
|
|
2105
2093
|
.ocpv2-part-image-wrap img,
|
|
2106
2094
|
img.ocpv2-part-image {
|
|
2107
|
-
|
|
2095
|
+
box-sizing: border-box;
|
|
2096
|
+
max-width: min(240px, 100%);
|
|
2108
2097
|
max-height: 200px;
|
|
2109
2098
|
width: auto;
|
|
2110
2099
|
height: auto;
|
|
@@ -2116,7 +2105,7 @@ img.ocpv2-part-image {
|
|
|
2116
2105
|
}
|
|
2117
2106
|
.ocpv2-msg-user .ocpv2-part-image-wrap { margin-top: 6px; }
|
|
2118
2107
|
.ocpv2-msg-user img.ocpv2-part-image {
|
|
2119
|
-
max-width: 240px;
|
|
2108
|
+
max-width: min(240px, 100%);
|
|
2120
2109
|
max-height: 200px;
|
|
2121
2110
|
}
|
|
2122
2111
|
|
|
@@ -2127,6 +2116,7 @@ img.ocpv2-part-image {
|
|
|
2127
2116
|
}
|
|
2128
2117
|
img.ocpv2-tool-screenshot {
|
|
2129
2118
|
display: block;
|
|
2119
|
+
box-sizing: border-box;
|
|
2130
2120
|
max-width: 100%;
|
|
2131
2121
|
max-height: 320px;
|
|
2132
2122
|
width: auto;
|
|
@@ -2906,6 +2896,11 @@ const CHILD_CSS = `
|
|
|
2906
2896
|
display: flex;
|
|
2907
2897
|
flex-direction: column;
|
|
2908
2898
|
align-items: flex-end;
|
|
2899
|
+
align-self: start;
|
|
2900
|
+
justify-self: stretch;
|
|
2901
|
+
box-sizing: border-box;
|
|
2902
|
+
min-width: 0;
|
|
2903
|
+
max-width: 100%;
|
|
2909
2904
|
gap: 4px;
|
|
2910
2905
|
max-height: min(310px, 45vh);
|
|
2911
2906
|
overflow-y: auto;
|
|
@@ -2919,12 +2914,18 @@ const CHILD_CSS = `
|
|
|
2919
2914
|
margin-top: -5px;
|
|
2920
2915
|
padding-top: 0;
|
|
2921
2916
|
}
|
|
2922
|
-
.ocpv2-subagent-pills > .term-minimized-pill {
|
|
2917
|
+
.ocpv2-subagent-pills > .term-minimized-pill {
|
|
2918
|
+
flex-shrink: 0;
|
|
2919
|
+
box-sizing: border-box;
|
|
2920
|
+
min-width: 0;
|
|
2921
|
+
max-width: calc(100% - var(--ocpv2-child-inset, 0px));
|
|
2922
|
+
margin-right: var(--ocpv2-child-inset, 0px);
|
|
2923
|
+
}
|
|
2923
2924
|
.ocpv2-subagent-pills .ocpv2-session-pill-child:hover { transform: none; }
|
|
2924
2925
|
/* A sub-agent of a sub-agent sits a step in from the edge. */
|
|
2925
|
-
.ocpv2-session-pill-child[data-depth="1"] {
|
|
2926
|
-
.ocpv2-session-pill-child[data-depth="2"] {
|
|
2927
|
-
.ocpv2-session-pill-child[data-depth="3"] {
|
|
2926
|
+
.ocpv2-session-pill-child[data-depth="1"] { --ocpv2-child-inset: 10px; }
|
|
2927
|
+
.ocpv2-session-pill-child[data-depth="2"] { --ocpv2-child-inset: 20px; }
|
|
2928
|
+
.ocpv2-session-pill-child[data-depth="3"] { --ocpv2-child-inset: 30px; }
|
|
2928
2929
|
/* How many there are and how many need attention: shown once the group scrolls. */
|
|
2929
2930
|
.ocpv2-subagent-summary {
|
|
2930
2931
|
position: sticky;
|
|
@@ -3223,26 +3224,7 @@ const PARITY_CSS = `
|
|
|
3223
3224
|
.ocpv2-msg-action:disabled { opacity: 0.4; cursor: default; }
|
|
3224
3225
|
.ocpv2-msg-action[data-action="delete"]:hover:not(:disabled) { color: rgba(255,166,166,0.92); }
|
|
3225
3226
|
|
|
3226
|
-
/*
|
|
3227
|
-
.ocpv2-code-block { position: relative; }
|
|
3228
|
-
.ocpv2-code-copy {
|
|
3229
|
-
position: absolute;
|
|
3230
|
-
top: 4px;
|
|
3231
|
-
right: 4px;
|
|
3232
|
-
background: rgba(22, 22, 26, 0.95);
|
|
3233
|
-
border: 1px solid rgba(255,255,255,0.08);
|
|
3234
|
-
color: rgba(255,255,255,0.55);
|
|
3235
|
-
border-radius: 6px;
|
|
3236
|
-
padding: 1px 6px;
|
|
3237
|
-
font-family: 'JetBrains Mono', ui-monospace, monospace;
|
|
3238
|
-
font-size: 9px;
|
|
3239
|
-
cursor: pointer;
|
|
3240
|
-
opacity: 0;
|
|
3241
|
-
transition: opacity 0.15s, color 0.15s;
|
|
3242
|
-
}
|
|
3243
|
-
.ocpv2-code-block:hover .ocpv2-code-copy,
|
|
3244
|
-
.ocpv2-code-copy:focus { opacity: 1; }
|
|
3245
|
-
.ocpv2-code-copy:hover { color: rgba(255,255,255,0.9); }
|
|
3227
|
+
/* A code block's Copy button is the shared one (../code-copy.js, ../ui-code-copy.js), styled there. */
|
|
3246
3228
|
|
|
3247
3229
|
/* ── Reverted (undone) banner: the retry banner in neutral tones ──────── */
|
|
3248
3230
|
.ocpv2-revert-banner {
|
|
@@ -3778,6 +3760,8 @@ const PARITY_CSS = `
|
|
|
3778
3760
|
`;
|
|
3779
3761
|
|
|
3780
3762
|
export function injectStyles() {
|
|
3763
|
+
// The Copy button of every code block: its stylesheet and its one click listener, in this document.
|
|
3764
|
+
installCodeCopy(document);
|
|
3781
3765
|
const full = CSS + '\n' + PARITY_CSS + '\n' + CHILD_CSS;
|
|
3782
3766
|
const existing = document.getElementById(STYLE_ID);
|
|
3783
3767
|
if (existing) {
|
|
@@ -13,8 +13,8 @@ import { getDefaultStore } from './ocp-v2-state.js';
|
|
|
13
13
|
import { notify as uiNotify, NOTIF_TYPE } from '../ui-notifications.js';
|
|
14
14
|
import { nativeLoopWindowId } from '../ui-native-window-id.js';
|
|
15
15
|
import { registerAutomationSession, automationRunAnswersAsks } from './ocp-v2-automation-ownership.js';
|
|
16
|
-
import { applyEvent, resolveEventTargets, askNotifies } from './ocp-v2-events.js';
|
|
17
|
-
import { createCapabilities, gatedRequest } from './ocp-v2-caps.js';
|
|
16
|
+
import { applyEvent, resolveEventTargets, askNotifies, eventSessionId, permissionRequestId } from './ocp-v2-events.js';
|
|
17
|
+
import { createCapabilities, gatedRequest, replyFailed } from './ocp-v2-caps.js';
|
|
18
18
|
import { shouldAutoAccept, autoAcceptRequest, autoAcceptInherited } from './ocp-v2-approvals.js';
|
|
19
19
|
import { verifyDescendant, descendantState, knownDescendant, createReconnectNotifier, requestOwner } from './ocp-v2-rehydrate.js';
|
|
20
20
|
import { createAskTracker, createTurnClock, readOpenAsks, unreadAsksNotice, TURN_LIMIT_MS } from './ocp-v2-send-logic.js';
|
|
@@ -246,6 +246,10 @@ function handleMessage(msg) {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
function handleEvent(eventType, ev) {
|
|
249
|
+
if (eventType === 'session.idle' || eventType === 'session.error' || eventType === 'session.deleted') {
|
|
250
|
+
const sessionId = eventSessionId(ev);
|
|
251
|
+
if (sessionId) clearStoredAsks((owner) => owner === sessionId);
|
|
252
|
+
}
|
|
249
253
|
// session.created → broadcast to manager listeners (child-panel spawning).
|
|
250
254
|
// Don't dispatch as a state mutation — the spawned panel's own subscribeSession
|
|
251
255
|
// call will catch its own subsequent message events.
|
|
@@ -285,9 +289,28 @@ const _parentOf = new Map();
|
|
|
285
289
|
const _asks = createAskTracker({ parentOf: _parentOf });
|
|
286
290
|
/** True while `sessionId`, or a sub-agent below it, waits on a permission or a question. */
|
|
287
291
|
export const sessionWaitsOnUser = (sessionId) => _asks.waits(sessionId);
|
|
292
|
+
export const sessionHasOpenAsks = (sessionId) => _asks.hasOpenAsks(sessionId);
|
|
288
293
|
/** `listener()` whenever what waits on the user may have changed; returns an unsubscribe. */
|
|
289
294
|
export const onAsksChanged = (listener) => _asks.subscribe(listener);
|
|
290
295
|
|
|
296
|
+
function storedAsks(belongsTo) {
|
|
297
|
+
const asks = [];
|
|
298
|
+
for (const store of _allStores) {
|
|
299
|
+
const state = store.getState();
|
|
300
|
+
for (const req of state.pendingPermissions || []) {
|
|
301
|
+
if (belongsTo(requestOwner(req) || state.sessionId)) asks.push([store, 'removePendingPermission', permissionRequestId(req)]);
|
|
302
|
+
}
|
|
303
|
+
for (const req of state.pendingQuestions || []) {
|
|
304
|
+
if (belongsTo(requestOwner(req) || state.sessionId)) asks.push([store, 'removePendingQuestion', req.id]);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return asks;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function clearStoredAsks(belongsTo) {
|
|
311
|
+
for (const [store, remove, id] of storedAsks(belongsTo)) store[remove](id);
|
|
312
|
+
}
|
|
313
|
+
|
|
291
314
|
function rememberParent(ev) {
|
|
292
315
|
const info = ev?.info || ev?.session || ev || {};
|
|
293
316
|
const childId = info.id || ev?.sessionID || ev?.sessionId;
|
|
@@ -382,6 +405,7 @@ function underSession(sessionId, isAncestor) {
|
|
|
382
405
|
|
|
383
406
|
// The sessions whose lists were read (or are out) since the socket opened.
|
|
384
407
|
const _asksRead = new Set();
|
|
408
|
+
let _askTabs = new Map(); // session ID → cwd, including tabs with no bound panel
|
|
385
409
|
// Bound sessions waiting for the socket to say what it serves before their lists are read.
|
|
386
410
|
const _asksUnread = new Set();
|
|
387
411
|
let _asksReady = false;
|
|
@@ -389,9 +413,20 @@ let _asksReadyTimer = null;
|
|
|
389
413
|
let _asksFlushTimer = null;
|
|
390
414
|
const asksKnown = (sessionId) => _asksRead.has(sessionId) || underSession(sessionId, (id) => _asksRead.has(id));
|
|
391
415
|
|
|
416
|
+
export function trackTabAsks(tabs) {
|
|
417
|
+
for (const sessionId of _askTabs.keys()) {
|
|
418
|
+
if (tabs.has(sessionId) || hasSessionStore(sessionId)) continue;
|
|
419
|
+
_asksRead.delete(sessionId);
|
|
420
|
+
_asksUnread.delete(sessionId);
|
|
421
|
+
_asks.release([sessionId]);
|
|
422
|
+
}
|
|
423
|
+
_askTabs = tabs;
|
|
424
|
+
for (const sessionId of tabs.keys()) readAsksOf(sessionId);
|
|
425
|
+
}
|
|
426
|
+
|
|
392
427
|
function askSession(sessionId, kinds) {
|
|
393
428
|
const s = [...(_storesBySession.get(sessionId) || [])][0]?.getState?.() || {};
|
|
394
|
-
return { sessionId, cwd: s.cwd || s.sessionInfo?.directory ||
|
|
429
|
+
return { sessionId, cwd: s.cwd || s.sessionInfo?.directory || _askTabs.get(sessionId), ...(kinds ? { kinds } : {}) };
|
|
395
430
|
}
|
|
396
431
|
|
|
397
432
|
// `want`: null for every bound session (not one under another), else the sessions (and lists) to read.
|
|
@@ -400,7 +435,7 @@ function askSession(sessionId, kinds) {
|
|
|
400
435
|
// learned (a list holding a request whose place is not known yet is unresolved meanwhile: its session waits).
|
|
401
436
|
// After a reconnect the tree is known; only a sub-agent spawned during the outage is looked up.
|
|
402
437
|
function readAsks(want, { attempt = 1, partial = false } = {}) {
|
|
403
|
-
const bound = new Set(_storesBySession.keys());
|
|
438
|
+
const bound = new Set([..._storesBySession.keys(), ..._askTabs.keys()]);
|
|
404
439
|
const sessions = want
|
|
405
440
|
? want.filter(({ sessionId }) => bound.has(sessionId)).map(({ sessionId, kinds }) => askSession(sessionId, kinds))
|
|
406
441
|
: [...bound].filter((sessionId) => !underSession(sessionId, (id) => bound.has(id))).map((sessionId) => askSession(sessionId));
|
|
@@ -450,7 +485,7 @@ function flushAsksSoon() {
|
|
|
450
485
|
// A sub-agent read in the same go as its parent is read with it.
|
|
451
486
|
const batch = [..._asksUnread];
|
|
452
487
|
const known = batch.filter((sessionId) => _storesBySession.has(sessionId)
|
|
453
|
-
&& (asksKnown(sessionId) || underSession(sessionId, (id) => id !== sessionId && batch.includes(id) &&
|
|
488
|
+
&& (asksKnown(sessionId) || underSession(sessionId, (id) => id !== sessionId && batch.includes(id) && (hasSessionStore(id) || _askTabs.has(id)))));
|
|
454
489
|
const sessions = batch.filter((sessionId) => !known.includes(sessionId));
|
|
455
490
|
_asksUnread.clear();
|
|
456
491
|
if (known.length) _asks.release(known);
|
|
@@ -673,6 +708,28 @@ async function answerOpenCodeWorker({ sessionId, requestId, answers }, reject =
|
|
|
673
708
|
return { ok: true, data: true };
|
|
674
709
|
}
|
|
675
710
|
|
|
711
|
+
async function settleAsk(eventType, sessionId, requestId, response) {
|
|
712
|
+
const result = await response;
|
|
713
|
+
if (!replyFailed(result)) {
|
|
714
|
+
const event = { sessionID: sessionId, requestID: requestId };
|
|
715
|
+
_asks.note(eventType, event);
|
|
716
|
+
handleEvent(eventType, event);
|
|
717
|
+
}
|
|
718
|
+
return result;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
async function abortSession(sessionId) {
|
|
722
|
+
const pending = _asks.openAsksOf(sessionId);
|
|
723
|
+
const stored = storedAsks((owner) => owner === sessionId || knownDescendant(owner, sessionId, _parentOf));
|
|
724
|
+
const result = await request({ type: 'message:abort', sessionId });
|
|
725
|
+
if (!replyFailed(result)) {
|
|
726
|
+
// Stop can finish after a new turn has started. Clear only the requests seen when Stop was pressed.
|
|
727
|
+
for (const ask of pending) _asks.note(`${ask.kind}.replied`, { requestID: ask.id, sessionID: ask.owner });
|
|
728
|
+
for (const [store, remove, id] of stored) store[remove](id);
|
|
729
|
+
}
|
|
730
|
+
return result;
|
|
731
|
+
}
|
|
732
|
+
|
|
676
733
|
export const api = {
|
|
677
734
|
init: () => request({ type: 'init', windowId: nativeLoopWindowId }),
|
|
678
735
|
// options: { search, archived, roots, limit }. A server without
|
|
@@ -687,13 +744,20 @@ export const api = {
|
|
|
687
744
|
// `human` / `greetingId`: lib/greeting/ (a server that does not know them ignores them).
|
|
688
745
|
send: ({ sessionId, parts, model, agent, mode, variant, cwd, tools, noAbortPrev, human, greetingId }) =>
|
|
689
746
|
request({ type: 'message:send', sessionId, parts, model, agent, mode, variant, cwd, tools, noAbortPrev: !!noAbortPrev, ...(human ? { human: true } : {}), ...(greetingId ? { greetingId } : {}) }, TURN_LIMIT_MS, { turnOf: sessionId }),
|
|
690
|
-
abort:
|
|
747
|
+
abort: abortSession,
|
|
691
748
|
compact: ({ sessionId, cwd, tools } = {}) => request({ type: 'session:compact', sessionId, cwd, tools }, 5 * 60 * 1000),
|
|
692
749
|
permissionReply: ({ sessionId, permissionId, response, cwd, message }) =>
|
|
693
|
-
|
|
750
|
+
settleAsk('permission.replied', sessionId, permissionId,
|
|
751
|
+
request({ type: 'permission:reply', sessionId, permissionId, response, cwd, message })),
|
|
694
752
|
questionList: ({ cwd, sessionId } = {}) => workerQuestionRuns.has(sessionId) ? Promise.resolve({ data: workerQuestions(workerQuestionRuns.get(sessionId)) }) : request({ type: 'question:list', cwd, sessionId }),
|
|
695
|
-
questionReply:
|
|
696
|
-
|
|
753
|
+
questionReply: ({ requestId, answers, cwd, sessionId }) =>
|
|
754
|
+
settleAsk('question.replied', sessionId, requestId, workerQuestionRuns.has(sessionId)
|
|
755
|
+
? answerOpenCodeWorker({ requestId, answers, sessionId })
|
|
756
|
+
: request({ type: 'question:reply', requestId, answers, cwd, sessionId })),
|
|
757
|
+
questionReject: ({ requestId, sessionId }) =>
|
|
758
|
+
settleAsk('question.rejected', sessionId, requestId, workerQuestionRuns.has(sessionId)
|
|
759
|
+
? answerOpenCodeWorker({ requestId, sessionId }, true)
|
|
760
|
+
: request({ type: 'question:reject', requestId, sessionId })),
|
|
697
761
|
toolsGet: (sessionId) => gated({ type: 'mcp:tools:get', sessionId }),
|
|
698
762
|
toolsSet: (sessionId, tools) => gated({ type: 'mcp:tools:set', sessionId, tools }, 45_000),
|
|
699
763
|
|