synabun 2.3.1 → 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 +24 -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 +1117 -47
- package/neural-interface/i18n/pt-BR.json +1117 -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-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/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/effort-levels.js +10 -1
- 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 +194 -8
- package/neural-interface/lib/native-loop-runtime.js +20 -0
- package/neural-interface/lib/opencode-build-preflight.js +16 -1
- package/neural-interface/lib/opencode-native-boundary.js +83 -13
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- 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 +68 -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/package-lock.json +2 -2
- package/neural-interface/package.json +1 -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/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 +682 -50
- 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-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 +355 -400
- 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 +1050 -140
- 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
|
@@ -21,6 +21,7 @@ export const AGENT_ROLE_DENIED = 'agent_* tools are only available to the SynaBu
|
|
|
21
21
|
export const AGENT_TOOL_NAMES = [
|
|
22
22
|
'agent_catalog', 'agent_list', 'agent_route', 'agent_clarify', 'agent_dispatch', 'agent_status', 'agent_read',
|
|
23
23
|
'agent_send', 'agent_wait', 'agent_stop', 'agent_focus', 'agent_usage',
|
|
24
|
+
'agent_team', // agents-p4
|
|
24
25
|
] as const;
|
|
25
26
|
|
|
26
27
|
// Worker providers. Every one can also be the Assistant's brain; Antigravity (Google's agy CLI) runs both over ACP.
|
|
@@ -30,6 +31,12 @@ export const TASK_CLASSES = ['chat', 'quick', 'code', 'complex', 'review', 'rese
|
|
|
30
31
|
// OpenCode brain) failed a default wait with -32001 before the wait itself returned.
|
|
31
32
|
const DEFAULT_WAIT_SECONDS = 50;
|
|
32
33
|
const MAX_WAIT_SECONDS = 120;
|
|
34
|
+
// The kinds a run's events are logged as (agent_wait until "event"). A copy of RUN_EVENT_KINDS in
|
|
35
|
+
// neural-interface/lib/coordination/service.js; neural-interface/tests/coordination-service.test.mjs fails when one drifts.
|
|
36
|
+
export const RUN_EVENT_KINDS = [
|
|
37
|
+
'run.result', 'run.needs_input', 'run.permission', 'run.failed', 'run.stalled', 'run.stopped', 'run.interrupted',
|
|
38
|
+
'run.completed', 'run.budget', 'run.notice', 'run.message', 'run.progress',
|
|
39
|
+
] as const;
|
|
33
40
|
|
|
34
41
|
const runIdField = (purpose: string) => z.string().min(1).max(200).describe(purpose);
|
|
35
42
|
const optionalId = (purpose: string) => z.string().min(1).max(200).optional().describe(purpose);
|
|
@@ -47,9 +54,15 @@ export const agentRouteSchema = {
|
|
|
47
54
|
'What kind of request this is: chat (conversation; never needs routing), quick (small edit/command/lookup), code (one-repo feature or fix), complex (architecture, cross-file refactor, hard debugging), review, research, browser (web task), computer (operate desktop apps; needs vision), automation (loops/schedules), design (UI/UX research, design systems, mockups, prototypes, redesigns: always one worker whose model can see, with SynaBun\'s design rules; building UI from an agreed design is code), image_gen (create images: always a worker whose model generates them, "image-out" on the sheet), video_gen (create videos: always a worker whose model generates them, "video-out"). Seeing or reading an image is not image_gen.'
|
|
48
55
|
),
|
|
49
56
|
summary: z.string().min(1).max(400).describe('One line describing the task, shown to the user on the route card.'),
|
|
57
|
+
task_key: z.string().min(1).max(100).optional().describe('Only for a genuinely separate subtask of this user request. Omit for the current task. Keep the same key on retries; rewording or changing proposals never needs a new card.'),
|
|
50
58
|
confidence: z.number().min(0).max(1).describe(
|
|
51
59
|
'How sure you are (0-1) that your FIRST proposal is the right model for this task. Be honest: low confidence asks the user in "ask when unsure" mode.'
|
|
52
60
|
),
|
|
61
|
+
planned_split: z.object({
|
|
62
|
+
workers: z.number().int().min(1).max(6),
|
|
63
|
+
slices: z.array(z.string().min(1).max(200)).min(1).max(6),
|
|
64
|
+
reason: z.string().min(1).max(400).optional(),
|
|
65
|
+
}).optional().describe('At Pair/Team/Swarm, plan code/complex/research/review before routing. Give the target 2/4/6 workers and distinct slice titles; fewer requires a reason why it cannot sensibly split further. One approval covers the whole plan.'),
|
|
53
66
|
needs_vision: z.boolean().optional().describe('true when the task needs to see images or the screen (always true for computer).'),
|
|
54
67
|
proposals: z.array(z.object({
|
|
55
68
|
kind: z.enum(['direct', 'dispatch']).describe('"direct" = do it here on your own model (or another model of your own provider); "dispatch" = hand it to a worker.'),
|
|
@@ -57,8 +70,10 @@ export const agentRouteSchema = {
|
|
|
57
70
|
model: z.string().max(200).optional().describe('Model id from the routing sheet / agent_catalog. Omit for the provider default (or a remembered route).'),
|
|
58
71
|
effort: z.string().max(40).optional().describe('Reasoning effort for that model, per agent_catalog (e.g. low…max/ultra; OpenCode uses the model\'s variant names). "none" turns thinking off: kept on Claude Code models that think and on Codex / OpenCode models that list none. Unsupported values are corrected to the nearest level the model runs (never to none).'),
|
|
59
72
|
account_id: z.string().max(64).optional().describe('Claude Code or Codex account id, or "auto" to choose the signed-in subscription with most usage left. API-key accounts are excluded from Auto. A limited pinned/default account falls back within the provider; corrections explain the selection. Another account runs on a worker when the proposal was direct.'),
|
|
73
|
+
agent_ref: z.string().min(1).max(140).optional().describe('A SynaBun agent to hand the task to (an id from agent_catalog agents, as for agent_dispatch): the proposal is then a dispatch, and the provider, model, effort and account you leave out are the agent\'s. Pass the same agent_ref to agent_dispatch with the approved route_id.'),
|
|
60
74
|
reason: z.string().max(240).optional().describe('Why this model (one short clause, shown on the card).'),
|
|
61
75
|
})).min(1).max(3).describe('1-3 candidate routes, best first. The first is your pick.'),
|
|
76
|
+
cwd: z.string().min(1).max(4096).optional().describe('Absolute project directory. Required for code/complex/research/review density planning (git worktree check); also resolves project agent_ref proposals.'),
|
|
62
77
|
independent: z.boolean().optional().describe(
|
|
63
78
|
'true when this task does not depend on questions still waiting for the user (agent_clarify pending). Otherwise agent_route answers "clarifying" until the user answers.'
|
|
64
79
|
),
|
|
@@ -95,8 +110,9 @@ export const agentListSchema = {
|
|
|
95
110
|
|
|
96
111
|
export const agentDispatchSchema = {
|
|
97
112
|
provider: z.enum(PROVIDERS).optional().describe(
|
|
98
|
-
'Worker runtime. "claude-code" (Claude Agent SDK; supports permission_policy "ask"), "codex" (Codex app-server; supports questions and permission_policy "ask"), "opencode" (isolated OpenCode serve), "antigravity" (Google Antigravity\'s agy CLI over ACP; supports "ask"; no accounts; reports tokens, not prices, so it runs only when the session budget is No limit). Required unless route_id is given (the approved route sets it). Reviews should use a different provider than the author.'
|
|
113
|
+
'Worker runtime. "claude-code" (Claude Agent SDK; supports permission_policy "ask"), "codex" (Codex app-server; supports questions and permission_policy "ask"), "opencode" (isolated OpenCode serve), "antigravity" (Google Antigravity\'s agy CLI over ACP; supports "ask"; no accounts; reports tokens, not prices, so it runs only when the session budget is No limit). Required unless route_id is given (the approved route sets it) or agent_ref is (the agent names it). Reviews should use a different provider than the author.'
|
|
99
114
|
),
|
|
115
|
+
worker_index: z.number().int().min(1).max(6).optional().describe('Legacy slot field. New code/complex/research/review splits must use agent_team; do not dispatch individual slices.'),
|
|
100
116
|
route_id: optionalId('The route_id agent_route returned with status "approved": the server applies the approved provider/model/effort. Dispatches without an approved route may be held for the user\'s model choice (status awaiting_route).'),
|
|
101
117
|
task_class: z.enum(TASK_CLASSES).optional().describe('Task class, used when this dispatch has no route_id (with one, it must match the route\'s image_gen / video_gen / design class or neither).'),
|
|
102
118
|
confidence: z.number().min(0).max(1).optional().describe('Your confidence in the model choice, used when this dispatch has no route_id.'),
|
|
@@ -104,6 +120,9 @@ export const agentDispatchSchema = {
|
|
|
104
120
|
'true when the worker must operate desktop apps on this Mac (the computer tools): one computer run at a time, a vision-capable model, capability read-only or workspace. Requires the Computer toggle on.'
|
|
105
121
|
),
|
|
106
122
|
agent: z.string().max(60).optional().describe('OpenCode only: the agent to run (default "build" at every capability, including read-only). Use "plan" only for an explicitly requested planning workflow; capability enforces read-only.'),
|
|
123
|
+
agent_ref: z.string().min(1).max(140).optional().describe(
|
|
124
|
+
'Run the worker as a SynaBun agent: an id from agent_catalog agents ("release-notes"), optionally one revision ("release-notes@3") or one library ("global:release-notes", "project:release-notes"); without a library the project\'s own agent of that id wins over the global one. The agent\'s approved definition fills what you leave out (provider, model, effort, account, tools and MCP servers, capability, permission policy, browser / computer use, MoreLogin profile) and its instructions go to the worker as its role; what you pass yourself wins, and an approved route\'s provider, model, effort and account stay binding. A definition never widens the run: what it asks for beyond the session or this dispatch is taken down and listed in corrections. AGENT_UNKNOWN: no such agent; AGENT_NOT_APPROVED: only the owner approves one (tell the user to review it in Agents). Not the same as `agent` (OpenCode\'s own agent).'
|
|
125
|
+
),
|
|
107
126
|
task: z.string().min(1).max(16000).describe(
|
|
108
127
|
'Self-contained instructions for the worker: goal, constraints, acceptance criteria, and that it must end with a ## Result block. The worker cannot see this conversation.'
|
|
109
128
|
),
|
|
@@ -141,7 +160,7 @@ export const agentDispatchSchema = {
|
|
|
141
160
|
'true when the worker drives the SynaBun browser: it gets a loop browser tab and the browser enforcement block; page content is treated as untrusted data. Design runs default to true; false keeps one off the browser (no tab, no automatic browser group).'
|
|
142
161
|
),
|
|
143
162
|
morelogin_profile: z.string().max(200).optional().describe(
|
|
144
|
-
'With uses_browser: the MoreLogin profile (its id or its name, as the morelogin tool\'s "list" shows it) the worker\'s browser tab opens in, for this run only. Omit it for the default
|
|
163
|
+
'With uses_browser: the MoreLogin profile (its id or its name, as the morelogin tool\'s "list" shows it) the worker\'s browser tab opens in, for this run only. Omit it for the default AI browser (Settings → Connected tools → MoreLogin). Workers on different profiles run side by side; two on the same profile share its browser, each in its own tab. Only a profile the owner allowed agents to choose (the morelogin tool\'s "list" and "status" say which; none until the owner switches one on in SynaBun\'s Settings → Connected tools → MoreLogin): any other is refused with MORELOGIN_PROFILE_NOT_ALLOWED and nothing starts; tell the user which profile to switch on and where, and never dispatch into another profile instead. Only a Chrome-type profile; one that is unknown, Firefox-type or cannot start fails the dispatch by name (never another profile or browser). Use it when the user names a profile or an account for the task: never change the default AI browser for one run.'
|
|
145
164
|
),
|
|
146
165
|
focus: z.boolean().optional().describe(
|
|
147
166
|
'true to bring the worker\'s sidepanel tab to the front on attach. Default false: runs attach without stealing focus.'
|
|
@@ -180,6 +199,9 @@ export const agentReadSchema = {
|
|
|
180
199
|
max_chars: z.number().int().min(200).max(20000).optional().describe(
|
|
181
200
|
'Truncate the output to this many characters (200-20000). Start small; read again if truncated.'
|
|
182
201
|
),
|
|
202
|
+
offset: z.number().int().min(0).optional().describe(
|
|
203
|
+
'For format "text" / "tail": the character the page starts at. Omit it to get the END of the text (the answer says totalChars and the offset that page starts at). To read a long report whole, start at offset 0 and pass each answer\'s nextOffset until it is null.'
|
|
204
|
+
),
|
|
183
205
|
};
|
|
184
206
|
|
|
185
207
|
export const agentSendSchema = {
|
|
@@ -196,19 +218,25 @@ export const agentSendSchema = {
|
|
|
196
218
|
note: z.string().max(2000).optional().describe('Optional message delivered to the worker with the decision.'),
|
|
197
219
|
}).optional().describe('Answer a pending permission or question request instead of (or before) sending text.'),
|
|
198
220
|
queue: z.boolean().optional().describe(
|
|
199
|
-
'true to enqueue text while the worker is still running (delivered at its next idle point). Default: send only when idle.'
|
|
221
|
+
'true to enqueue text while the worker is still running (delivered at its next idle point, in the order sent; it survives a server restart). At most 20 may wait for one run: more is refused with FOLLOW_UP_QUEUE_FULL. Default: send only when idle.'
|
|
200
222
|
),
|
|
201
223
|
};
|
|
202
224
|
|
|
203
225
|
export const agentWaitSchema = {
|
|
204
226
|
run_id: optionalId('Single run to wait for.'),
|
|
205
|
-
run_ids: z.array(z.string().min(1).max(200)).max(
|
|
206
|
-
workflow_id: optionalId('Wait for every run of a workflow instead of listing ids.'),
|
|
227
|
+
run_ids: z.array(z.string().min(1).max(200)).max(50).optional().describe('Up to 50 runs to wait for together (fan-out barrier). For more, give them one workflow_id.'),
|
|
228
|
+
workflow_id: optionalId('Wait for every run of a workflow instead of listing ids. Runs dispatched into the workflow while the wait is open are waited for too.'),
|
|
207
229
|
until: z.enum(['idle', 'terminal', 'event']).optional().describe(
|
|
208
|
-
'"idle" (default): the current turn finished and its result is readable. "terminal": completed, failed, stopped or interrupted. "event": the next
|
|
230
|
+
'"idle" (default): the current turn finished and its result is readable. "terminal": completed, failed, stopped or interrupted. "event": the next typed events of the runs (see kinds); the answer lists them with their seq and a cursor.'
|
|
231
|
+
),
|
|
232
|
+
after_seq: z.number().int().min(0).optional().describe(
|
|
233
|
+
'With until "event": only events after this seq. Pass the cursor of the previous agent_wait answer to continue exactly where it ended (nothing is missed or repeated; the same cursor returns the same events again if an answer was lost). Omit it on the first call: you get what you have not been told yet, then what comes.'
|
|
234
|
+
),
|
|
235
|
+
kinds: z.array(z.enum(RUN_EVENT_KINDS)).max(RUN_EVENT_KINDS.length).optional().describe(
|
|
236
|
+
'With until "event": only these kinds. Default: every kind except run.progress — run.result (a turn ended with its result), run.needs_input (a question), run.permission (a permission request), run.failed, run.stalled, run.stopped, run.interrupted, run.completed, run.budget, run.notice, run.message. Add run.progress to also see turns starting, queued follow-ups and the like.'
|
|
209
237
|
),
|
|
210
238
|
mode: z.enum(['all', 'any']).optional().describe(
|
|
211
|
-
'For run_ids / workflow_id: "all"
|
|
239
|
+
'For run_ids / workflow_id: "all" returns when every run satisfies until (the default for "idle" and "terminal": a barrier); "any" returns on the first one (the default for "event": the next event of any of the runs).'
|
|
212
240
|
),
|
|
213
241
|
timeout_seconds: z.number().int().min(1).max(MAX_WAIT_SECONDS).optional().describe(
|
|
214
242
|
`Max seconds to block per call (1-${MAX_WAIT_SECONDS}, default ${DEFAULT_WAIT_SECONDS}). A timed-out wait says so; call again to keep waiting. Go above 55 only if your MCP client's tool timeout is longer than the wait (OpenCode stops a tool call at 60 s).`
|
|
@@ -237,31 +265,31 @@ export const agentUsageSchema = {
|
|
|
237
265
|
// ── Descriptions (routing instructions) ──
|
|
238
266
|
|
|
239
267
|
export const agentCatalogDescription =
|
|
240
|
-
'Discover what you can route to: providers (claude-code, codex, opencode, antigravity) with models (tier, price per 1M tokens, vision, context, efforts), plus `chat` (chat-only providers such as maritaca: a side panel the user talks to, prices in BRL, never a dispatch target), accounts with subscription usage remaining (or usage unknown; API keys are n/a), registered projects (cwd candidates), SynaBun tool groups and each host\'s effect, rails/limits and
|
|
268
|
+
'Discover what you can route to: providers (claude-code, codex, opencode, antigravity) with models (tier, price per 1M tokens, vision, context, efforts), plus `chat` (chat-only providers such as maritaca: a side panel the user talks to, prices in BRL, never a dispatch target), accounts with subscription usage remaining (or usage unknown; API keys are n/a), registered projects (cwd candidates), SynaBun tool groups and each host\'s effect, rails/limits, active runs, and `agents`: the SynaBun agents the owner approved, which a dispatch names with agent_ref (ref, name, description, provider/model, task classes, scope global or project, revision; provider and search filter them too). Without arguments it returns a compact routing view (OpenCode sampled); pass provider and/or search to list more models. Call it when the routing sheet in your instructions lacks a model, or after a MODEL_UNKNOWN rejection. Returns JSON.';
|
|
241
269
|
|
|
242
270
|
export const agentRouteDescription =
|
|
243
|
-
'Route an actionable task BEFORE starting it (you are the planner). Give task_class, a one-line summary, your honest confidence (0-1) and 1-3 proposals (direct = here on your model; dispatch = a worker provider/model). proposals.account_id accepts an account id or "auto" (most subscription usage left); limited pinned/default accounts fall back within the provider. The returned target.account includes usage and corrections explain the choice. The server applies the session\'s route mode (always ask / ask when unsure / never ask): it approves at once, or shows the user a route card and waits briefly.
|
|
271
|
+
'The runtime taskId owns one card: retries return it even with different wording or proposals. Only a genuinely separate subtask uses its own stable task_key. Plan the whole task before routing it once. At Pair/Team/Swarm, code/complex/research/review target 2/4/6 workers: pass planned_split with that many distinct titles or fewer with a reason. All four require cwd; a non-git project falls back to one worker with a reason. The card shows this split and one approval covers all workers. Follow next: agent_team plan → start for all splits. Research/review pass task_class and empty owned_paths: separate worktrees, no integration or landing; wait and synthesize. Never route individual slices. Other classes and Solo stay single. Route an actionable task BEFORE starting it (you are the planner). Give task_class, a one-line summary, your honest confidence (0-1) and 1-3 proposals (direct = here on your model; dispatch = a worker provider/model). proposals.account_id accepts an account id or "auto" (most subscription usage left); limited pinned/default accounts fall back within the provider. The returned target.account includes usage and corrections explain the choice. The server applies the session\'s route mode (always ask / ask when unsure / never ask): it approves at once, or shows the user a route card and waits briefly. A planned split uses workers; on a single-task route card the user can pick here or a worker: follow the returned target.kind and next, never your proposal. Follow the returned status and next: approved+dispatch → follow next with the approved route_id; approved+direct → do it yourself (a route the user kept here is never dispatched: agent_dispatch refuses it with ROUTE_IS_DIRECT); continuation → end your turn (SynaBun continues on the chosen model); pending → end your turn, the choice arrives as a [SynaBun Mailbox] route_decided event; declined → do not start (reason no_capable_model: no model can make the image or video, or see for design; tell the user which Model routes row needs one); clarifying → end your turn, the user has not answered your agent_clarify questions yet (independent:true for a task that does not depend on them). image_gen / video_gen always route to a worker whose model generates the medium, design to a worker whose model can see. With a session budget, a provider whose share is used up cannot take the task: SynaBun first divides the unspent budget again, then moves the task to the next capable provider with money left (your next proposal, the same tier on another provider, then a free model) and says so in corrections (reason budget_share, "budget: codex share used up -> claude-code/sonnet"); the saved routes yield to this. When no provider can pay it declines with reason budget_exhausted and names the dry providers (dry). The result carries budget: each provider\'s share, spent and left. A proposal may name an agent (agent_ref, with cwd for a project\'s own): it is a dispatch on what the agent runs on, unless the proposal names its own. Never use it for conversation or bookkeeping. Returns JSON.';
|
|
244
272
|
|
|
245
273
|
export const agentClarifyDescription =
|
|
246
274
|
'Ask the user 1-3 targeted questions BEFORE routing a new request that is materially ambiguous: two plausible readings with different results, an unclear target (project, feature, files, audience), destructive or irreversible scope, spend, or memories that conflict with it. Not for clear requests, details a sensible default covers, anything the request, memory or the project answers, or the model (agent_route asks that). Each question gets 2-4 options (recommended first; the user can always type their own); add constraints (what the request fixes) and assumptions (what you will assume for the rest). The card waits briefly. Follow the returned status and next: answered → route, then agent_dispatch with the brief_id (SynaBun adds the user\'s original words, their answers, the constraints and assumptions to the worker\'s context); declined → proceed on your assumptions; pending → end your turn, the answers arrive as a [SynaBun Mailbox] clarify_answered event or as the user\'s next message, and dependent routes and dispatches wait until then. Returns JSON.';
|
|
247
275
|
|
|
248
276
|
export const agentListDescription =
|
|
249
|
-
'List dispatched worker runs with status, state, provider/model, title, elapsed time, work time left (workLeftMs), cost and resumes (how often a server restart cut the run off and it was resumed). Use it before dispatching more work, to recover run ids, or after a mailbox event. Filter with active_only, assistant_session_id (your own session) or workflow_id. Returns JSON.';
|
|
277
|
+
'List dispatched worker runs with status, state, provider/model, the agent a run runs as (agentRef, agentRevision; absent for a plain worker), title, elapsed time, work time left (workLeftMs), cost and resumes (how often a server restart cut the run off and it was resumed). Use it before dispatching more work, to recover run ids, or after a mailbox event. Filter with active_only, assistant_session_id (your own session) or workflow_id. Returns JSON.';
|
|
250
278
|
|
|
251
279
|
export const agentDispatchDescription =
|
|
252
|
-
'Dispatch a task to a worker agent (Claude Code, Codex or OpenCode). Route it first with agent_route and pass the approved route_id (the server applies that provider/model/effort); without one, the dispatch may be held until the user picks a model (awaitingRoute:true — do not dispatch it again; if the user picks "here" instead, the run never starts and a route_decided mailbox event asks you to do the task yourself). A route_id the user decided to keep here is refused (ROUTE_IS_DIRECT): do that task yourself. After agent_clarify, pass its brief_id: the worker gets the user\'s own words and answers; while its questions are open a dependent dispatch is refused (CLARIFICATION_PENDING). The run attaches as a live automation tab in the matching sidepanel without stealing focus. Write a self-contained task that ends with a ## Result block, pass the absolute cwd and your assistant_session_id. Defaults: permission_policy "auto", capability "full", 45 minutes of work time (max_minutes, at least 20), no per-run dollar ceiling (with a budget the run draws from its provider\'s share; a provider whose share is used up and cannot get more is refused with BUDGET_SHARE_EXHAUSTED: route again). Use "ask" only for sensitive scopes (Codex cannot ask: use "restricted"). uses_computer:true for desktop work (one at a time, vision model). uses_browser:true with morelogin_profile (a profile id or name) opens the worker\'s browser tab in that MoreLogin profile for this run only, next to runs in the default or other profiles (only a profile the owner allowed agents to choose; MORELOGIN_PROFILE_NOT_ALLOWED otherwise: tell the user to switch it on in Settings). An image_gen / video_gen run makes the asset with its model\'s own generation tool; SynaBun collects the files into the run\'s result (media: path + url); with no model that generates the medium an un-routed dispatch is refused (NO_CAPABLE_MODEL), and a route_id approved for other work is refused for image_gen / video_gen / design (and the other way round: ROUTE_CLASS_MISMATCH; route the task again with its own class). A design run gets SynaBun\'s design rules and the project\'s style guide, defaults to capability "workspace", uses_browser true, browser, styleguide and image groups, and 60 minutes of work time (explicit values win), runs only on a model confirmed to see (MODEL_CANNOT_SEE otherwise), and its screenshots land in the result\'s media. Group fan-outs with workflow_id, chain with parent_run_id, retry safely with idempotency_key. Over-limit dispatches are queued (queued:true, position). After dispatching, block with agent_wait rather than polling. Returns JSON.';
|
|
280
|
+
'Dispatch a task to a worker agent (Claude Code, Codex or OpenCode). Route it first with agent_route and pass the approved route_id (the server applies that provider/model/effort); without one, the dispatch may be held until the user picks a model (awaitingRoute:true — do not dispatch it again; if the user picks "here" instead, the run never starts and a route_decided mailbox event asks you to do the task yourself). A route_id the user decided to keep here is refused (ROUTE_IS_DIRECT): do that task yourself. After agent_clarify, pass its brief_id: the worker gets the user\'s own words and answers; while its questions are open a dependent dispatch is refused (CLARIFICATION_PENDING). The run attaches as a live automation tab in the matching sidepanel without stealing focus. Write a self-contained task that ends with a ## Result block, pass the absolute cwd and your assistant_session_id. Defaults: permission_policy "auto", capability "full", 45 minutes of work time (max_minutes, at least 20), no per-run dollar ceiling (with a budget the run draws from its provider\'s share; a provider whose share is used up and cannot get more is refused with BUDGET_SHARE_EXHAUSTED: route again). Use "ask" only for sensitive scopes (Codex cannot ask: use "restricted"). uses_computer:true for desktop work (one at a time, vision model). uses_browser:true with morelogin_profile (a profile id or name) opens the worker\'s browser tab in that MoreLogin profile for this run only, next to runs in the default or other profiles (only a profile the owner allowed agents to choose; MORELOGIN_PROFILE_NOT_ALLOWED otherwise: tell the user to switch it on in Settings). An image_gen / video_gen run makes the asset with its model\'s own generation tool; SynaBun collects the files into the run\'s result (media: path + url); with no model that generates the medium an un-routed dispatch is refused (NO_CAPABLE_MODEL), and a route_id approved for other work is refused for image_gen / video_gen / design (and the other way round: ROUTE_CLASS_MISMATCH; route the task again with its own class). A design run gets SynaBun\'s design rules and the project\'s style guide, defaults to capability "workspace", uses_browser true, browser, styleguide and image groups, and 60 minutes of work time (explicit values win), runs only on a model confirmed to see (MODEL_CANNOT_SEE otherwise), and its screenshots land in the result\'s media. agent_ref runs the worker as one of the owner\'s approved agents (agent_catalog agents): its definition fills what you leave out and its instructions become the worker\'s role, the run carries agentRef and agentRevision, and corrections list what the definition was held to. Group fan-outs with workflow_id, chain with parent_run_id, retry safely with idempotency_key. Over-limit dispatches are queued (queued:true, position). After dispatching, block with agent_wait rather than polling. Returns JSON.';
|
|
253
281
|
|
|
254
282
|
export const agentStatusDescription =
|
|
255
|
-
'Get one run\'s current descriptor: status (queued, starting, running, completed, failed, stopped, interrupted), state (the detail: also idle, awaiting_permission, and suspended / resuming while a SynaBun server restart cuts a Claude Code worker off and the next start resumes it as the same run, its Claude session and its tab; resumes counts that, at most 3; a run that could not be resumed ends interrupted, with why in notes), turnState (running, idle, awaiting_permission), provider/model/account, elapsed time (elapsedMs, wall clock), work time used and left of max_minutes (workMs, workLeftMs), cost, the last parsed result summary and any pending permission or question requests. Cheap; use it between agent_wait calls or before agent_send / agent_stop. Returns JSON.';
|
|
283
|
+
'Get one run\'s current descriptor: status (queued, starting, running, completed, failed, stopped, interrupted), state (the detail: also idle, awaiting_permission, and suspended / resuming while a SynaBun server restart cuts a Claude Code worker off and the next start resumes it as the same run, its Claude session and its tab; resumes counts that, at most 3; a run that could not be resumed ends interrupted, with why in notes), turnState (running, idle, awaiting_permission), provider/model/account, the agent it runs as (agentRef, agentRevision, agentPin with what its definition was held to; absent for a plain worker), elapsed time (elapsedMs, wall clock), work time used and left of max_minutes (workMs, workLeftMs), cost, the last parsed result summary and any pending permission or question requests. Cheap; use it between agent_wait calls or before agent_send / agent_stop. Returns JSON.';
|
|
256
284
|
|
|
257
285
|
export const agentReadDescription =
|
|
258
|
-
'Read a run\'s output. format "result" (default) returns the parsed ## Result contract (status, summary, changes, follow_ups, question, json, and media: the images / videos an image_gen or video_gen run generated or a design run captured, each { kind, path, url, mime, bytes } — show one with  plus its path); "tail" returns the last transcript events; "text" the worker\'s assistant text; "files" the files it reported. Call after agent_wait reports idle or terminal; keep max_chars small and read
|
|
286
|
+
'Read a run\'s output. format "result" (default) returns the parsed ## Result contract (status, summary, changes, follow_ups, question, json, and media: the images / videos an image_gen or video_gen run generated or a design run captured, each { kind, path, url, mime, bytes } — show one with  plus its path); "tail" returns the last transcript events (also after the run ended or the server restarted); "text" the worker\'s assistant text; "files" the files it reported. Call after agent_wait reports idle or terminal; keep max_chars small. A text longer than max_chars is read in pages: the answer carries totalChars, offset and nextOffset; pass offset (0 for the start, then each nextOffset) to read the rest. Returns JSON.';
|
|
259
287
|
|
|
260
288
|
export const agentSendDescription =
|
|
261
|
-
'Continue a worker\'s conversation. text sends a follow-up turn (queue:true enqueues it while the worker is still running, or while it is suspended / resuming after a server restart: it goes to the worker once resumed). reply answers a pending permission or question request: decision allow/deny for tools, answer (with answers) for questions, note as an optional message. Obtain request ids from agent_status or agent_wait until="event". A follow-up to a run whose work time (max_minutes) is used up is refused with TIME_CAP: dispatch a new run with its result as context. Returns JSON.';
|
|
289
|
+
'Continue a worker\'s conversation. text sends a follow-up turn (queue:true enqueues it while the worker is still running, or while it is suspended / resuming after a server restart: it goes to the worker once resumed; queued follow-ups keep their order, survive a restart, and at most 20 wait per run). reply answers a pending permission or question request: decision allow/deny for tools, answer (with answers) for questions, note as an optional message. Obtain request ids from agent_status or agent_wait until="event". A follow-up to a run whose work time (max_minutes) is used up is refused with TIME_CAP: dispatch a new run with its result as context. Returns JSON.';
|
|
262
290
|
|
|
263
291
|
export const agentWaitDescription =
|
|
264
|
-
'Blocking barrier for orchestration. Waits up to timeout_seconds (max 120) for one run (run_id), several runs (run_ids with mode all/any) or a whole workflow to reach until="idle" (turn finished; default), "terminal" (completed, failed, stopped, interrupted) or "event" (
|
|
292
|
+
'Blocking barrier for orchestration. Waits up to timeout_seconds (max 120) for one run (run_id), several runs (run_ids with mode all/any) or a whole workflow to reach until="idle" (turn finished; default), "terminal" (completed, failed, stopped, interrupted) or "event" (typed events: by default a result, a question, a permission request, a failure, a stall, a stop; narrow with kinds). An "event" answer lists the events with their seq and a cursor: pass it back as after_seq to go on from there. A workflow wait follows runs added to the workflow while it waits. A run suspended or resuming after a SynaBun server restart is still working: keep waiting (a wait cut off by the restart is simply called again, with the same after_seq). Returns the run descriptors and whether the wait timed out; call again to keep waiting. Prefer this over polling agent_status. Returns JSON.';
|
|
265
293
|
|
|
266
294
|
export const agentStopDescription =
|
|
267
295
|
'Stop work. run_id stops one run; all:true with your assistant_session_id stops every run of this assistant session, workflow_id every run of a workflow (kill-all). Use when the user cancels, a worker misbehaves, or a time/budget rail is at risk. Returns JSON.';
|
|
@@ -272,6 +300,64 @@ export const agentFocusDescription =
|
|
|
272
300
|
export const agentUsageDescription =
|
|
273
301
|
'Get token usage for a task, run, or entire Assistant session. Returns compact JSON. `session` is the headline the panel shows: every task of this session added up (it only grows, and survives a restart), with a per-model breakdown (models: inputTotal, outputTotal, total, costUsd, costBasis). Below it the task asked for: tokens, USD cost, fidelity, unsynced (rows not on disk yet, normally 0), and each agent\'s key, title, provider, model, total, sub-agents total, fidelity and state (partialReason when a count is partial; calls on the Jev judgments row). `budget` is the session budget: mode (limited / unlimited: the user chose No limit), the amount, spent and left, warned / exceeded, how the split was made (source jev | fallback, updatedAt) and each provider\'s share, spent and left (brain marks your own provider; leftUsd is what its workers may still spend), and dry: the providers whose share is used up. Every tokens object has the five additive classes (input = uncached input, cacheWrite, cacheRead, output = visible output, reasoning), total, inputTotal (input + cacheWrite + cacheRead: everything sent to the model) and outputTotal (output + reasoning): the same meaning for every provider, nothing counted twice. costUsd is at API list prices; costBasis says how it is known: reported (the provider reported it), estimated (tokens at list price: Codex and other plan-billed work, where it is the list-price equivalent, not a charge), free, or unpriced (no list price: tokens counted, no dollars). Counts are exact provider counts when fidelity is exact; live marks provisional counts and partial marks incomplete counts. metered:false means this server keeps no usage ledger. No routing is needed.';
|
|
274
302
|
|
|
303
|
+
// ════ agents-p4 BEGIN: agent_team ════
|
|
304
|
+
// One task given to several workers (neural-interface/lib/teams/scheduler.js). The same role gate as every agent_*
|
|
305
|
+
// tool; the Neural Interface enforces the session's Agent density, the plan's rules and the landing rule.
|
|
306
|
+
export const AGENT_TEAM_ACTIONS = ['plan', 'start', 'status', 'integrate', 'land', 'cleanup', 'discard', 'list'] as const;
|
|
307
|
+
/** The most slices any Agent density allows (Swarm). */
|
|
308
|
+
export const AGENT_TEAM_MAX_SLICES = 6;
|
|
309
|
+
|
|
310
|
+
const teamSliceSchema = z.object({
|
|
311
|
+
id: z.string().min(1).max(40).describe('Short lower-case name of the slice, e.g. "api" ("integration" is reserved).'),
|
|
312
|
+
title: z.string().min(1).max(80).describe('What this part is, in a few words.'),
|
|
313
|
+
task: z.string().min(1).max(16000).describe('Self-contained instructions for this slice\'s worker: goal, constraints, acceptance. It sees only its own slice, plus which files the other slices own.'),
|
|
314
|
+
owned_paths: z.array(z.string().min(1).max(300)).max(64).optional().describe('The files this slice may write, as patterns relative to the project ("src/api/**", "docs/guide.md"). No file may be owned by two slices. Research/review omit this or pass [] (read-only).'),
|
|
315
|
+
depends_on: z.array(z.string().min(1).max(40)).max(5).optional().describe('Slices that must be joined before this one starts (it then starts from their finished work).'),
|
|
316
|
+
lockfile_owner: z.boolean().optional().describe('true for the one slice that may change dependency lockfiles and manifests (at most one slice).'),
|
|
317
|
+
agent_ref: z.string().min(1).max(140).optional().describe('Run this slice\'s worker as one of the owner\'s agents (an id from agent_catalog agents).'),
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
export const agentTeamSchema = {
|
|
321
|
+
action: z.enum(AGENT_TEAM_ACTIONS).describe(
|
|
322
|
+
'plan: check a plan (density, overlapping files, dependency cycles) and return it normalized; creates nothing. start: create the worktrees and dispatch the workers. status: slices, runs, claims, the integration branch, the last events. integrate: try again after a needs_attention. land: the integration branch into the user\'s branch. cleanup: after successful land and the user\'s yes, delete finished team worktrees/branches. discard: give the team up. list: this session\'s teams.'
|
|
323
|
+
),
|
|
324
|
+
assistant_session_id: optionalId('Your ASSISTANT_SESSION_ID (plan, start, list).'),
|
|
325
|
+
team_id: z.string().min(1).max(40).optional().describe('status / integrate / land / cleanup (required) / discard: the team. start: the team_id the plan action returned (omitted: one is made from the title).'),
|
|
326
|
+
title: z.string().min(1).max(80).optional().describe('plan / start: the team\'s task in a few words.'),
|
|
327
|
+
project_path: z.string().min(1).max(1024).optional().describe('plan / start: absolute path of the project (a git repository with at least one commit; pick from agent_catalog projects).'),
|
|
328
|
+
base_commit: z.string().min(40).max(64).optional().describe('start: the full commit id the plan action pinned (omitted: the project\'s current commit).'),
|
|
329
|
+
fewer_reason: z.string().min(1).max(400).optional().describe('Required when slices are fewer than density. Must match planned_split.reason on the approved route.'),
|
|
330
|
+
slices: z.array(teamSliceSchema).min(1).max(AGENT_TEAM_MAX_SLICES).optional().describe('plan / start: the parts of the task, one worker each. At most what the session\'s Agent density allows (Pair 2, Team 4, Swarm 6; Solo: no team).'),
|
|
331
|
+
test_command: z.string().min(1).max(600).optional().describe('start: what proves the joined work, run on the integration branch after every join (e.g. "npm test"). Without one nothing is tested and you cannot land.'),
|
|
332
|
+
route_id: optionalId('start: the route_id agent_route returned with status "approved" for this task. One route covers every slice.'),
|
|
333
|
+
task_class: z.enum(TASK_CLASSES).optional().describe('plan/start: code (default), complex, research or review. Research/review have read-only worktrees, no integration branch, tests or landing; the approved route must match.'),
|
|
334
|
+
provider: z.enum(PROVIDERS).optional().describe('start: the worker runtime, when there is no route_id and a slice names no agent_ref.'),
|
|
335
|
+
model: z.string().max(200).optional().describe('start: model id for the workers (the approved route wins).'),
|
|
336
|
+
effort: z.string().max(40).optional().describe('start: reasoning effort for the workers.'),
|
|
337
|
+
account_id: z.string().max(200).optional().describe('start: account profile id, or "auto".'),
|
|
338
|
+
tools: z.array(z.string().min(1).max(72)).max(32).optional().describe('start: SynaBun tool groups for the workers, as for agent_dispatch. The team tool is added by itself.'),
|
|
339
|
+
max_minutes: z.number().int().min(1).max(1440).optional().describe('start: work time per worker, in minutes.'),
|
|
340
|
+
permission_policy: z.enum(['auto', 'ask', 'restricted']).optional().describe('start: as for agent_dispatch (default auto).'),
|
|
341
|
+
context: z.string().max(8000).optional().describe('start: background every worker of the team gets (decisions already taken, conventions).'),
|
|
342
|
+
tags: z.array(z.string().min(1).max(40)).max(6).optional().describe('start: tags for the runs.'),
|
|
343
|
+
brief_id: optionalId('start: the brief_id of a clarification, so every worker gets the user\'s own words and answers.'),
|
|
344
|
+
slice_id: z.string().min(1).max(40).optional().describe('integrate: only this slice (omitted: every slice that is not joined).'),
|
|
345
|
+
target_branch: z.string().min(1).max(200).optional().describe('land: the branch that receives the work (default: the branch checked out in the project).'),
|
|
346
|
+
mode: z.enum(['ff', 'merge']).optional().describe('land: "ff" (default) moves the branch forward to the integration branch; "merge" makes a merge commit.'),
|
|
347
|
+
user_confirmed: z.boolean().optional().describe('cleanup: true only after the user says yes to deleting the landed team worktrees and branches; otherwise refused locally.'),
|
|
348
|
+
reason: z.string().max(240).optional().describe('discard: why.'),
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export const agentTeamDescription =
|
|
352
|
+
'Code/complex/research/review: plan the task first, then target the session density (Pair 2, Team 4, Swarm 6). Fewer slices require fewer_reason matching the approved route. agent_route planned_split must match the project, count and titles. One approved route covers all slices, including replacements; never route a slice. Research/review use task_class and empty owned_paths: every worker gets its own worktree from one pinned commit, removed when it ends. Changes or commits are kept and reported. No integration branch, test_command or landing; wait and synthesize their results. Give ONE task to several workers at once, each in its own git worktree and branch (never the user\'s checkout or branch). Code/complex tasks need file-disjoint parts; research/review need distinct read-only scopes, within the user\'s Agent density (Solo 1: no team; Pair 2; Team 4; Swarm 6): SynaBun refuses a team at Solo (TEAM_DENSITY_SOLO) and a plan with more slices than the level allows (TEAM_TOO_MANY_SLICES), with overlapping files or a dependency cycle. ' +
|
|
353
|
+
'Flow: agent_route the task once → action "plan" (returns the normalized plan with its team_id and base_commit, the density check and any errors; creates nothing) → action "start" with that plan and the approved route_id (returns workflow_id) → agent_wait on the workflow_id → a team_ready mailbox event → action "status" → action "land", or ask the user. ' +
|
|
354
|
+
'SynaBun commits each finished slice\'s own files, joins them on synabun/<team>/integration in dependency order and runs test_command on that exact commit; a conflict or failed tests go back to the slice\'s worker with the report (twice), then a needs_attention event reaches you: read "status", help with agent_send, then "integrate", or "discard". ' +
|
|
355
|
+
'Landing rule: land yourself only when you judge the work ready, the integration tests passed, the user\'s branch has not moved and no file with local changes is touched; land returns SynaBun\'s refusal report unchanged (TESTS_NOT_PASSED, NOT_FAST_FORWARD, OWNER_BRANCH_MOVED, DIRTY_FILES_AFFECTED, TEAM_NOT_READY…). On a refusal do not retry or work around it: ask the user. ' +
|
|
356
|
+
'Cleanup: successful land returns cleanup (worktrees, branches). When the task is fully finished, suggest deleting them with a synabun-followups confirm card. Only after the user says yes call cleanup with team_id and user_confirmed:true. The server requires a landed team, every run ended done, every branch merged into the target and every worktree clean. Refusals CLEANUP_NOT_CONFIRMED, TEAM_NOT_LANDED, TEAM_RUNS_ACTIVE, BRANCH_NOT_MERGED, BRANCH_MOVED (a branch moved after the check), WORKTREE_DIRTY remove nothing: keep them and tell the user which check failed. Never delete team worktrees or branches with git directly. Returns JSON.';
|
|
357
|
+
|
|
358
|
+
export type AgentTeamArgs = z.infer<z.ZodObject<typeof agentTeamSchema>>;
|
|
359
|
+
// ════ agents-p4 END ════
|
|
360
|
+
|
|
275
361
|
// ── Handlers ──
|
|
276
362
|
|
|
277
363
|
type ToolResult = ReturnType<typeof text> & { isError?: boolean };
|
|
@@ -315,11 +401,14 @@ export function handleAgentRoute(args: AgentRouteArgs): Promise<ToolResult> {
|
|
|
315
401
|
return guarded(async () => json(await ni.assistantRoute({
|
|
316
402
|
assistantSessionId: args.assistant_session_id,
|
|
317
403
|
task_class: args.task_class,
|
|
404
|
+
task_key: args.task_key,
|
|
318
405
|
summary: args.summary,
|
|
319
406
|
confidence: args.confidence,
|
|
320
407
|
needs_vision: args.needs_vision,
|
|
408
|
+
planned_split: args.planned_split,
|
|
321
409
|
proposals: args.proposals,
|
|
322
410
|
independent: args.independent,
|
|
411
|
+
cwd: args.cwd,
|
|
323
412
|
})));
|
|
324
413
|
}
|
|
325
414
|
|
|
@@ -346,7 +435,7 @@ export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult
|
|
|
346
435
|
if (Object.hasOwn(args, 'mcp_profile') || Object.hasOwn(args, 'mcpProfile')) {
|
|
347
436
|
return { ...json({ ok: false, code: 'MCP_PROFILE_REMOVED', message: 'MCP profiles were removed; pass tools: [group ids].' }), isError: true };
|
|
348
437
|
}
|
|
349
|
-
if (!args.provider && !args.route_id) return invalid('Provide provider,
|
|
438
|
+
if (!args.provider && !args.route_id && !args.agent_ref) return invalid('Provide provider, the route_id of an approved agent_route, or agent_ref (an agent names its provider).');
|
|
350
439
|
const selection = resolveToolList(args.tools, { source: 'dispatch', provider: args.provider, usesBrowser: args.uses_browser, taskClass: args.task_class });
|
|
351
440
|
if (!selection.ok) return { ...json(selection), isError: true };
|
|
352
441
|
return json(await ni.assistantDispatch({
|
|
@@ -358,10 +447,13 @@ export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult
|
|
|
358
447
|
effort: args.effort,
|
|
359
448
|
tools: args.tools,
|
|
360
449
|
routeId: args.route_id,
|
|
450
|
+
workerIndex: args.worker_index,
|
|
361
451
|
taskClass: args.task_class,
|
|
362
452
|
confidence: args.confidence,
|
|
363
453
|
usesComputer: args.uses_computer,
|
|
364
454
|
agent: args.agent,
|
|
455
|
+
// A SynaBun agent (lib/agents/resolve.js resolves it at the dispatcher's intake); `agent` above is OpenCode's own.
|
|
456
|
+
agentRef: args.agent_ref,
|
|
365
457
|
// One account_id input, provider-specific body keys server-side (with a
|
|
366
458
|
// route_id the provider may be unknown here, so pass it generically too).
|
|
367
459
|
accountId: args.provider ? undefined : args.account_id,
|
|
@@ -395,7 +487,7 @@ export function handleAgentRead(args: AgentReadArgs): Promise<ToolResult> {
|
|
|
395
487
|
return guarded(async () => {
|
|
396
488
|
const format = args.format || 'result';
|
|
397
489
|
if (format === 'result') return json(await ni.assistantResult(args.run_id));
|
|
398
|
-
return json(await ni.assistantTranscript(args.run_id, { format, tail: args.tail, maxChars: args.max_chars }));
|
|
490
|
+
return json(await ni.assistantTranscript(args.run_id, { format, tail: args.tail, maxChars: args.max_chars, offset: args.offset }));
|
|
399
491
|
});
|
|
400
492
|
}
|
|
401
493
|
|
|
@@ -429,15 +521,17 @@ export function handleAgentWait(args: AgentWaitArgs): Promise<ToolResult> {
|
|
|
429
521
|
const multi = runIds.length > 0 || !!args.workflow_id;
|
|
430
522
|
if (!multi) {
|
|
431
523
|
if (!args.run_id) return invalid('Provide run_id, run_ids or workflow_id.');
|
|
432
|
-
return json(await ni.assistantWaitRun(args.run_id, { until, timeoutMs }));
|
|
524
|
+
return json(await ni.assistantWaitRun(args.run_id, { until, timeoutMs, afterSeq: args.after_seq, kinds: args.kinds }));
|
|
433
525
|
}
|
|
434
526
|
if (args.run_id && !runIds.includes(args.run_id)) runIds.unshift(args.run_id);
|
|
435
527
|
return json(await ni.assistantWaitMany({
|
|
436
528
|
runIds: runIds.length ? runIds : undefined,
|
|
437
529
|
workflowId: args.workflow_id,
|
|
438
|
-
mode: args.mode || 'all',
|
|
530
|
+
mode: args.mode || (until === 'event' ? 'any' : 'all'),
|
|
439
531
|
until,
|
|
440
532
|
timeoutMs,
|
|
533
|
+
afterSeq: args.after_seq,
|
|
534
|
+
kinds: args.kinds,
|
|
441
535
|
}));
|
|
442
536
|
});
|
|
443
537
|
}
|
|
@@ -545,6 +639,67 @@ export function handleAgentUsage(args: AgentUsageArgs): Promise<ToolResult> {
|
|
|
545
639
|
});
|
|
546
640
|
}
|
|
547
641
|
|
|
642
|
+
// ════ agents-p4 BEGIN: agent_team ════
|
|
643
|
+
/** A plan in the Neural Interface's spelling (lib/teams/schema.js), from the tool's arguments. */
|
|
644
|
+
function teamPlanBody(args: AgentTeamArgs): Record<string, unknown> {
|
|
645
|
+
return {
|
|
646
|
+
title: args.title,
|
|
647
|
+
taskClass: args.task_class,
|
|
648
|
+
assistantSessionId: args.assistant_session_id,
|
|
649
|
+
plan: {
|
|
650
|
+
teamId: args.team_id,
|
|
651
|
+
projectPath: args.project_path,
|
|
652
|
+
baseCommit: args.base_commit,
|
|
653
|
+
fewerReason: args.fewer_reason,
|
|
654
|
+
slices: (args.slices || []).map((slice) => ({
|
|
655
|
+
id: slice.id, title: slice.title, task: slice.task, ownedPaths: slice.owned_paths || [],
|
|
656
|
+
dependsOn: slice.depends_on || [], lockfileOwner: slice.lockfile_owner === true,
|
|
657
|
+
...(slice.agent_ref ? { agentRef: slice.agent_ref } : {}),
|
|
658
|
+
})),
|
|
659
|
+
},
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export function handleAgentTeam(args: AgentTeamArgs): Promise<ToolResult> {
|
|
664
|
+
return guarded(async () => {
|
|
665
|
+
const needTeam = () => (args.team_id ? null : invalid(`${args.action} needs team_id.`));
|
|
666
|
+
switch (args.action) {
|
|
667
|
+
case 'list':
|
|
668
|
+
return json(await ni.assistantTeamList({ assistantSessionId: args.assistant_session_id }));
|
|
669
|
+
case 'plan':
|
|
670
|
+
case 'start': {
|
|
671
|
+
if (!args.project_path) return invalid(`${args.action} needs project_path: the project's absolute path.`);
|
|
672
|
+
if (!args.slices?.length) return invalid(`${args.action} needs slices: the parts of the task, each with the files it owns.`);
|
|
673
|
+
if (args.action === 'plan') return json(await ni.assistantTeamPlan(teamPlanBody(args)));
|
|
674
|
+
if (args.tools) {
|
|
675
|
+
const selection = resolveToolList(args.tools, { source: 'dispatch', provider: args.provider, taskClass: args.task_class });
|
|
676
|
+
if (!selection.ok) return { ...json(selection), isError: true };
|
|
677
|
+
}
|
|
678
|
+
return json(await ni.assistantTeamStart({
|
|
679
|
+
...teamPlanBody(args),
|
|
680
|
+
testCommand: args.test_command, routeId: args.route_id, taskClass: args.task_class,
|
|
681
|
+
provider: args.provider, model: args.model, effort: args.effort, accountId: args.account_id, tools: args.tools,
|
|
682
|
+
maxMinutes: args.max_minutes, permissionPolicy: args.permission_policy, context: args.context, tags: args.tags, briefId: args.brief_id,
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
case 'status':
|
|
686
|
+
return needTeam() ?? json(await ni.assistantTeamStatus(args.team_id as string));
|
|
687
|
+
case 'integrate':
|
|
688
|
+
return needTeam() ?? json(await ni.assistantTeamIntegrate(args.team_id as string, { sliceId: args.slice_id }));
|
|
689
|
+
case 'land':
|
|
690
|
+
return needTeam() ?? json(await ni.assistantTeamLand(args.team_id as string, { targetBranch: args.target_branch, mode: args.mode }));
|
|
691
|
+
case 'cleanup':
|
|
692
|
+
if (args.user_confirmed !== true) return json({ ok: false, code: 'CLEANUP_NOT_CONFIRMED', message: 'Cleanup requires the user to confirm deleting the team worktrees and branches.' });
|
|
693
|
+
return needTeam() ?? json(await ni.assistantTeamCleanup(args.team_id as string, { targetBranch: args.target_branch, mode: args.mode, user_confirmed: true }));
|
|
694
|
+
case 'discard':
|
|
695
|
+
return needTeam() ?? json(await ni.assistantTeamDiscard(args.team_id as string, { reason: args.reason }));
|
|
696
|
+
default:
|
|
697
|
+
return invalid(`Unknown action. Use one of ${AGENT_TEAM_ACTIONS.join(', ')}.`);
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
// ════ agents-p4 END ════
|
|
702
|
+
|
|
548
703
|
// ── Registration ──
|
|
549
704
|
|
|
550
705
|
/**
|
|
@@ -567,5 +722,6 @@ export function registerAgentTools(server: McpServer) {
|
|
|
567
722
|
server.tool('agent_stop', agentStopDescription, agentStopSchema, (args) => handleAgentStop(args)),
|
|
568
723
|
server.tool('agent_focus', agentFocusDescription, agentFocusSchema, (args) => handleAgentFocus(args)),
|
|
569
724
|
server.tool('agent_usage', agentUsageDescription, agentUsageSchema, (args) => handleAgentUsage(args)),
|
|
725
|
+
server.tool('agent_team', agentTeamDescription, agentTeamSchema, (args) => handleAgentTeam(args)), // agents-p4
|
|
570
726
|
];
|
|
571
727
|
}
|
|
@@ -88,15 +88,15 @@ export async function handleBrowserWait(args: {
|
|
|
88
88
|
// ── browser_session ──
|
|
89
89
|
|
|
90
90
|
export const browserSessionSchema = {
|
|
91
|
-
action: z.enum(['list', 'status', 'create', 'close']).describe('"list" = the open sessions with your own tabs (id, address, title; your current tab marked), "status" = the session and tab your browser calls use now, with its address and whether SynaBun replaced a lost tab, "create" = open a new browser tab of your own (starting the browser if needed) and continue there, "close" = close a session.'),
|
|
91
|
+
action: z.enum(['list', 'status', 'create', 'close']).describe('"list" = the open sessions with your own tabs (id, address, title; your current tab marked), and in the owner\'s everyday browser with full control also the owner\'s open tabs you can take over, "status" = the session and tab your browser calls use now, with its address and whether SynaBun replaced a lost tab, "create" = open a new browser tab of your own (starting the browser if needed) and continue there, "close" = close a session.'),
|
|
92
92
|
url: z.string().optional().describe('Starting URL for "create" action (default: about:blank).'),
|
|
93
93
|
sessionId: z.string().optional().describe('Session ID for "close" action. Required for close when multiple sessions exist (or pass your tabId).'),
|
|
94
|
-
tabId: z.string().optional().describe('Your tab id, as the other browser tools take it. "status" / "list": says whether it is still your current tab (a lost tab names the tab that replaced it). "close": closes only this tab of yours; a tab that is not yours is refused and nothing is closed.
|
|
94
|
+
tabId: z.string().optional().describe('Your tab id, as the other browser tools take it. "status" / "list": says whether it is still your current tab (a lost tab names the tab that replaced it). "close": closes only this tab of yours; a tab that is not yours is refused and nothing is closed. "create": in the owner\'s everyday browser with full control, the id of one of the owner\'s open tabs that "list" shows: you take that tab over (it becomes yours until you close it, and closing it leaves it open for the owner) instead of opening a new one. Otherwise "create" ignores it and opens a new tab of your own.'),
|
|
95
95
|
moreloginProfile: z.string().optional().describe('"create" only: the MoreLogin profile (its id or its name, as the morelogin tool\'s "list" shows it) to work in from now on. The new tab opens in that profile and your later browser calls stay there; the default browser and other sessions are not touched. "default" goes back to the default profile. The same as calling morelogin with action "use" first, with the same rule: only a profile the owner allowed agents to choose (morelogin "list" says which); a refusal for a profile not on that list means tell the user to switch it on in SynaBun\'s Settings, never another profile. Omit it to stay in the profile you work in.'),
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
export const browserSessionDescription =
|
|
99
|
-
'Manage browser sessions — list open sessions and your tabs in them, see which tab you work in ("status"), create a new one, or close one (pass your tabId to close only that tab of yours). Use "status" to find your current tab id. When a browser tool\'s answer starts with "Your tab … was lost; a replacement tab … is open", continue in that tab (no create). Use "create" when your browser session or tab was lost (closed, disconnected, "Session not found", "Tab … not found"): it opens a new tab of your own in the SynaBun browser, starting the browser when it is not running, and in a loop or a dispatched run your next browser calls go to it. Only if create fails too, stop and report it; never switch to another browser. To work in a MoreLogin profile other than the default (a second account, while other automations use the default one), pass moreloginProfile to "create" or call morelogin with action "use": your browser tools then drive that profile in a tab of your own and nobody else is moved (only a profile the owner allowed agents to choose; when it is refused as not on the owner\'s list, tell the user to switch it on in SynaBun\'s Settings and stop). Closing a session other automations still use closes only your own tab in it; the session stays open for them.';
|
|
99
|
+
'Manage browser sessions — list open sessions and your tabs in them, see which tab you work in ("status"), create a new one, or close one (pass your tabId to close only that tab of yours). Use "status" to find your current tab id. When a browser tool\'s answer starts with "Your tab … was lost; a replacement tab … is open", continue in that tab (no create). Use "create" when your browser session or tab was lost (closed, disconnected, "Session not found", "Tab … not found"): it opens a new tab of your own in the SynaBun browser, starting the browser when it is not running, and in a loop or a dispatched run your next browser calls go to it. Only if create fails too, stop and report it; never switch to another browser. To work in a MoreLogin profile other than the default (a second account, while other automations use the default one), pass moreloginProfile to "create" or call morelogin with action "use": your browser tools then drive that profile in a tab of your own and nobody else is moved (only a profile the owner allowed agents to choose; when it is refused as not on the owner\'s list, tell the user to switch it on in SynaBun\'s Settings and stop). Closing a session other automations still use closes only your own tab in it; the session stays open for them. In the owner\'s everyday browser (the extension, full control) "list" also shows the owner\'s open tabs; "create" with one of their ids as tabId takes that tab over.';
|
|
100
100
|
|
|
101
101
|
export async function handleBrowserSession(args: {
|
|
102
102
|
action: string;
|
|
@@ -116,6 +116,29 @@ export async function handleBrowserSession(args: {
|
|
|
116
116
|
return text(note ? `${body}\n${note}` : body);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// Taking over one of the owner's tabs in the everyday browser (the extension bridge in full control): only when the
|
|
120
|
+
// server lists owner tabs. Everywhere else create ignores tabId, as it always did, and opens a tab of the caller's own.
|
|
121
|
+
const takeOver = args.action === 'create' && args.tabId && !args.moreloginProfile ? await ni.browserRouteStatus() : null;
|
|
122
|
+
const listed = takeOver && !takeOver.error ? takeOver.ownerTabs : undefined;
|
|
123
|
+
const target = listed?.find(t => t.id === args.tabId && !t.owner);
|
|
124
|
+
if (listed && !target && !takeOver!.sessions.some(s => s.tabs.some(t => t.id === args.tabId))) {
|
|
125
|
+
return text(`Create refused: tab ${args.tabId} is not one of the owner's open tabs you can take over (browser_session list marks available tabs and their owners). Nothing changed. Call create without tabId to open a new tab of your own.`);
|
|
126
|
+
}
|
|
127
|
+
if (target && args.tabId) {
|
|
128
|
+
const result = await ni.createSession(args.url, args.tabId);
|
|
129
|
+
if (ni.isBrowserStarting(result)) return text(String(result.error || 'The browser is still starting. Call browser_session with action "create" again in a moment.'));
|
|
130
|
+
if (result.error) return text(`Take-over failed: ${result.error}\nNothing of yours changed if the tab was refused. Never switch to another browser or tool.`);
|
|
131
|
+
const sessionId = String(result.sessionId);
|
|
132
|
+
const tabId = typeof result.tabId === 'string' ? result.tabId : args.tabId;
|
|
133
|
+
const at = typeof result.url === 'string' && result.url !== 'about:blank' ? result.url : target.url;
|
|
134
|
+
const lines = [`Took over the owner's tab ${tabId} (session ${sessionId}) at ${at || 'about:blank'}${target.title ? ` "${target.title}"` : ''}. It is yours until you close it; closing it leaves it open for the owner.`];
|
|
135
|
+
lines.push(result.repinned === true
|
|
136
|
+
? `This run's browser now works there: your next browser calls go to it with or without ids (pass sessionId "${sessionId}" and tabId "${tabId}" if you pass ids; never the old ones).`
|
|
137
|
+
: `Continue there: pass sessionId "${sessionId}" and tabId "${tabId}" to your next browser calls.`);
|
|
138
|
+
if (typeof result.navigateError === 'string') lines.push(`Opening ${args.url} in it failed: ${result.navigateError}. Open it with browser_navigate.`);
|
|
139
|
+
return text(lines.join('\n'));
|
|
140
|
+
}
|
|
141
|
+
|
|
119
142
|
if (args.action === 'create') {
|
|
120
143
|
let profileLine: string | null = null;
|
|
121
144
|
if (args.moreloginProfile) {
|
|
@@ -158,8 +181,12 @@ export async function handleBrowserSession(args: {
|
|
|
158
181
|
const resolved = await ni.resolveSession(named);
|
|
159
182
|
if ('error' in resolved) return text(resolved.error);
|
|
160
183
|
|
|
161
|
-
const result = await ni.closeSession(resolved.sessionId);
|
|
184
|
+
const result = await ni.closeSession(resolved.sessionId, args.tabId);
|
|
162
185
|
if (result.error) return text(`Close failed: ${result.error}`);
|
|
186
|
+
if (result.profileMode === 'extension') {
|
|
187
|
+
const count = Array.isArray(result.releasedTabIds) ? result.releasedTabIds.length : result.releasedTabId ? 1 : 0;
|
|
188
|
+
return text(`Released ${count} of your tabs from session ${resolved.sessionId}${args.tabId ? ` (tab ${args.tabId})` : ''}. Agent-opened tabs were closed; taken-over tabs stay open for the owner. Other agents' tabs stay open.`);
|
|
189
|
+
}
|
|
163
190
|
if (result.sessionKept === true) {
|
|
164
191
|
// Other automations (scheduled runs) work in tabs of this browser: the server closed only this caller's tab.
|
|
165
192
|
const others = Number(result.otherOwners) || 0;
|
|
@@ -196,17 +223,32 @@ export function namedTabLine(status: ni.BrowserRouteStatus, tabId: string): stri
|
|
|
196
223
|
}
|
|
197
224
|
|
|
198
225
|
const quoteTitle = (title: string | undefined) => (title ? ` "${title}"` : '');
|
|
226
|
+
/**
|
|
227
|
+
* A tab's address as browser_session list shows it: origin and path, never the query string or fragment, which carry
|
|
228
|
+
* sign-in and challenge tokens (`?jsc_token=…`, `?__cf_chl_rt_tk=…`). Navigate, snapshot and content keep the full URL
|
|
229
|
+
* of the caller's own page; only the listing is cut. Anything that is not an http(s) address shows as itself when it is
|
|
230
|
+
* about:blank, else as nothing.
|
|
231
|
+
*/
|
|
232
|
+
export function listedAddress(url: string | undefined): string {
|
|
233
|
+
if (!url) return 'about:blank';
|
|
234
|
+
if (url === 'about:blank') return url;
|
|
235
|
+
try {
|
|
236
|
+
const u = new URL(url);
|
|
237
|
+
return u.protocol === 'http:' || u.protocol === 'https:' ? `${u.origin}${u.pathname}` : u.protocol === 'about:' ? `about:${u.pathname}` : `${u.protocol}…`;
|
|
238
|
+
} catch { return '(address withheld)'; }
|
|
239
|
+
}
|
|
199
240
|
const otherTabsText = (n: number) => `${n} tab${n === 1 ? '' : 's'} of other automations or the owner`;
|
|
200
241
|
|
|
201
242
|
/** browser_session list: every session the caller can see, with its own tabs only. */
|
|
202
243
|
export function formatSessionList(status: ni.BrowserRouteStatus): string {
|
|
203
|
-
|
|
244
|
+
const owners = ownerTabLines(status);
|
|
245
|
+
if (status.sessions.length === 0) return ['No browser sessions open. browser_navigate opens one by itself.', ...owners].join('\n');
|
|
204
246
|
const lines = [`${status.sessions.length} session(s); only your own tabs are listed:`];
|
|
205
247
|
for (const session of status.sessions) {
|
|
206
248
|
lines.push(` ${session.id}${session.servesDefault ? '' : ` — not ${status.profile ? 'the profile you work in' : 'the default browser'} (${session.profile}); SynaBun's browser tools do not use it`}`);
|
|
207
249
|
for (const tab of session.tabs) {
|
|
208
250
|
const isCurrent = status.current?.open && status.current.sessionId === session.id && status.current.tabId === tab.id;
|
|
209
|
-
lines.push(` tab ${tab.id} — ${tab.url
|
|
251
|
+
lines.push(` tab ${tab.id} — ${listedAddress(tab.url)}${quoteTitle(tab.title)}${isCurrent ? ' ← your current tab' : ''}`);
|
|
210
252
|
}
|
|
211
253
|
if (!session.tabs.length) lines.push(` no tab of yours${session.otherTabs ? ` (+${otherTabsText(session.otherTabs)})` : ''}`);
|
|
212
254
|
else if (session.otherTabs) lines.push(` +${otherTabsText(session.otherTabs)}`);
|
|
@@ -214,9 +256,21 @@ export function formatSessionList(status: ni.BrowserRouteStatus): string {
|
|
|
214
256
|
if (status.current && !status.current.open) lines.push(lostTabLine(status.current));
|
|
215
257
|
else if (!status.current) lines.push('You have no tab of your own yet: browser_navigate opens one.');
|
|
216
258
|
if (status.profile) lines.push(profileLineOf(status.profile));
|
|
259
|
+
lines.push(...owners);
|
|
217
260
|
return lines.join('\n');
|
|
218
261
|
}
|
|
219
262
|
|
|
263
|
+
/** The owner's open tabs in the everyday browser (full control), which create with that tabId takes over. */
|
|
264
|
+
const OWNER_TABS_SHOWN = 200;
|
|
265
|
+
function ownerTabLines(status: ni.BrowserRouteStatus): string[] {
|
|
266
|
+
if (!status.ownerTabs) return [];
|
|
267
|
+
if (!status.ownerTabs.length) return ['The owner\'s everyday browser (full control) has no other open tab you can take over.'];
|
|
268
|
+
const lines = [`The owner's open tabs in the everyday browser (full control); create with an available tabId takes it over:`];
|
|
269
|
+
for (const tab of status.ownerTabs.slice(0, OWNER_TABS_SHOWN)) lines.push(` tab ${tab.id} — ${listedAddress(tab.url)}${quoteTitle(tab.title)} — ${tab.owner === 'you' ? 'yours' : tab.owner ? `held by ${tab.owner}` : 'owner; available'}`);
|
|
270
|
+
if (status.ownerTabs.length > OWNER_TABS_SHOWN) lines.push(` +${status.ownerTabs.length - OWNER_TABS_SHOWN} more`);
|
|
271
|
+
return lines;
|
|
272
|
+
}
|
|
273
|
+
|
|
220
274
|
/** The profile a caller works in when it is not the default. */
|
|
221
275
|
function profileLineOf(profile: NonNullable<ni.BrowserRouteStatus['profile']>): string {
|
|
222
276
|
return `Profile: you work in MoreLogin profile ${profile.name ? `"${profile.name}" (env ${profile.envId})` : `env ${profile.envId}`}, not the default one (morelogin "use" changes it; envId "default" goes back).`;
|