synabun 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/browser-extension/content.js +169 -0
- package/browser-extension/engine.js +477 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +244 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +165 -0
- package/browser-extension/popup.html +105 -0
- package/browser-extension/popup.js +347 -0
- package/browser-extension/protocol.js +226 -0
- package/browser-extension/service-worker.js +267 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +94 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +91 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +161 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +190 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +175 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1174 -47
- package/neural-interface/i18n/pt-BR.json +1174 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +840 -0
- package/neural-interface/lib/agents/resolve.js +544 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +229 -102
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +384 -42
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +440 -93
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +255 -0
- package/neural-interface/lib/browser-extension-bridge.js +418 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-profiles.js +1 -1
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/cli-install-api.js +23 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/editor-completion-opencode.js +4 -3
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/maritaca/opencode-proxy.js +7 -2
- package/neural-interface/lib/maritaca/opencode.js +35 -0
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +219 -7
- package/neural-interface/lib/native-loop-runtime.js +24 -1
- package/neural-interface/lib/opencode-build-preflight.js +116 -0
- package/neural-interface/lib/opencode-launch-error.js +13 -0
- package/neural-interface/lib/opencode-native-boundary.js +800 -84
- package/neural-interface/lib/opencode-serve-probe.js +426 -0
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/opencode-serve-scan.js +108 -0
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +60 -21
- package/neural-interface/lib/process-identity.js +235 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/lib/worker-mcp-channel.js +38 -1
- package/neural-interface/package-lock.json +4 -2
- package/neural-interface/package.json +3 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +52 -12
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +36 -6
- package/neural-interface/public/shared/assistant/asst-route.js +78 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +33 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/opencode-verify-view.js +175 -0
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +713 -61
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +12 -1
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-opencode-verify.js +120 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +372 -402
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +5 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +21 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1164 -157
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# Git teams: managed worktrees, path claims, integration and landing (Agents system, phase P3)
|
|
2
|
+
|
|
3
|
+
One task given to several workers at once, with git doing the isolation: every slice of the task gets its own worktree and branch, slices hold the files they own while they work, finished slices are joined on an integration branch and tested there, and the user's branch receives the result only through a separate landing step.
|
|
4
|
+
|
|
5
|
+
This is a library with injected dependencies: a coordination store (`lib/coordination/store.js`), a git runner and a test-command runner. Phase P4 wired it: `scheduler.js` owns a team's life on top of it (the section [The scheduler](#the-scheduler-phase-p4) below; `docs/agents.md` → Teams is the reference for the tools and the routes), and `server.js` makes the one `createTeams(...)` and the one scheduler in its `agents-p4` block.
|
|
6
|
+
|
|
7
|
+
The contracts it builds on are phase P0's, documented in `lib/coordination/README.md`: the team plan (`lib/teams/schema.js`) and the store's claims and journal.
|
|
8
|
+
|
|
9
|
+
| Module | What it is | Tests |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `index.js` | `createTeams(deps)`: the one object a scheduler uses | all of the below |
|
|
12
|
+
| `worktrees.js` | create a team, list, inspect, start a slice, remove, prune; the dependency setup step | `tests/teams-worktrees.test.mjs` |
|
|
13
|
+
| `claims.js` | path claims in the store, `checkWrite`, the context for the worker guard, the ownership check after the fact | `tests/teams-claims.test.mjs` |
|
|
14
|
+
| `integration.js` | finish a slice (server-managed commit), join it on the integration branch, run the tests, conflict reports | `tests/teams-integration.test.mjs` |
|
|
15
|
+
| `landing.js` | `land`: the integration branch into the user's branch | `tests/teams-landing.test.mjs` |
|
|
16
|
+
| `recovery.js` | `recover`: after a crash, a record that matches git and the disk | `tests/teams-recovery.test.mjs` |
|
|
17
|
+
| `state.js` | a team's record, folded from the store's journal | used by all |
|
|
18
|
+
| `git.js` | the git runner, the readers of git's answers, the locks | `tests/teams-worktrees.test.mjs`, `tests/git-read-safety.test.mjs` |
|
|
19
|
+
| `test-runner.js` | the default test-command runner | `tests/teams-integration.test.mjs` |
|
|
20
|
+
| `scheduler.js` | phase P4: `createTeamScheduler(deps)`, a team's life over the dispatcher, the density check, the events, the channel | `tests/teams-scheduler.test.mjs`, `tests/teams-channel.test.mjs` |
|
|
21
|
+
| `brief.js` | phase P4: the TEAM block of a slice's brief, the follow-ups, the untrusted-peer wrapper | `tests/teams-channel.test.mjs` |
|
|
22
|
+
| `api.js` | phase P4: the routes (`/api/assistant/teams/*`, `/api/assistant/team/*`, `/api/agents-studio/v1/teams*`) | `tests/teams-api.test.mjs` |
|
|
23
|
+
| `test-sandbox.js` | phase P4: the integration tests under the worker sandbox (macOS) | `tests/teams-test-sandbox.test.mjs` |
|
|
24
|
+
| `../worker-confinement.js` | the team-slice rule of the worker guard | `tests/teams-claims.test.mjs`, `tests/worker-confinement*.test.mjs` |
|
|
25
|
+
|
|
26
|
+
Run one with `node --test tests/<name>.test.mjs` from `neural-interface/`. The tests work on real git repositories in a temporary folder (`tests/helpers/team-repo.mjs`).
|
|
27
|
+
|
|
28
|
+
## Owner rules these modules encode
|
|
29
|
+
|
|
30
|
+
Taken with the owner on 2026-11-15. They are binding; a later phase follows them.
|
|
31
|
+
|
|
32
|
+
- **Agents never work in the user's checkout or on the user's branch.** Every slice worker gets its own worktree and branch, cut from one pinned base commit. The user's uncommitted files are never touched, stashed, committed or seen: a worktree is a checkout of a commit, and nothing here writes the user's checkout, index, stash or branch before a landing.
|
|
33
|
+
- **Everything lives under the project's own `.worktrees` folder**: `<project>/.worktrees/<team>/<slice>`, the integration worktree at `<project>/.worktrees/<team>/integration`; branches `synabun/<team>/<slice>` and `synabun/<team>/integration` (the schema's helpers). `.worktrees/` is added to the repository's `.git/info/exclude` when the project does not ignore it yet, never to `.gitignore`.
|
|
34
|
+
- **The combined result goes to the integration branch.** The user's branch receives it only through `land`, a step somebody asks for.
|
|
35
|
+
|
|
36
|
+
## A team's life
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { createTeams, cloneNodeModules } from './lib/teams/index.js';
|
|
40
|
+
|
|
41
|
+
const teams = createTeams({ store }); // + git, runTests, setup, identity when not the defaults
|
|
42
|
+
await teams.recover(); // once, at start-up, before anything else
|
|
43
|
+
|
|
44
|
+
const made = await teams.create(plan, { density: 'team', testCommand: 'npm test', createdBy: sessionId });
|
|
45
|
+
// made.team.worktrees: [{ sliceId, path, branch }], made.team.baseCommit: the pinned commit
|
|
46
|
+
|
|
47
|
+
const started = await teams.startSlice(teamId, 'api', { runId });
|
|
48
|
+
// dispatch the worker with cwd = started.worktree and capability workspace; the worker guard knows the slice
|
|
49
|
+
// by that folder (no adapter change needed), or pass started.context as resolveWorkerConfinement({ team })
|
|
50
|
+
|
|
51
|
+
const finished = await teams.finishSlice(teamId, 'api', { runId, message }); // SynaBun commits the slice's own files
|
|
52
|
+
const joined = await teams.integrate(teamId, 'api'); // cherry-pick + tests on that commit
|
|
53
|
+
// …or teams.integrateAll(teamId): every finished slice, in dependency order
|
|
54
|
+
|
|
55
|
+
const landed = await teams.land(teamId, { targetBranch: 'main', mode: 'ff' }); // only when asked for
|
|
56
|
+
await teams.remove(teamId); // worktrees and branches, after the landing
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Every function answers `{ ok: true, … }` or a refusal `{ ok: false, code, message, … }`. None throws for something a caller can act on (a git that cannot be started throws `TeamGitError`).
|
|
60
|
+
|
|
61
|
+
States (the journal's; `TEAM_STATES` / `SLICE_STATES` in `schema.js`):
|
|
62
|
+
|
|
63
|
+
- team: `creating` → `planned` → `running` ⇄ `integrating` → `ready` → `landing` → `merged`; or `failed` (creation), `cancelled` (discarded). `removed: true` on the record once its worktrees and branches are gone.
|
|
64
|
+
- slice: `planned` (its task is recorded) → `pending` → `running` → `done` or `rejected` → `integrating` → `integrated`, `conflict` or `tests-failed`; or `failed`, `cancelled`.
|
|
65
|
+
|
|
66
|
+
`creating`, `integrating` and `landing` are written before the step they name runs. A team found in one of them after a restart was interrupted: every function refuses it (`TEAM_NEEDS_RECOVERY`) until `recover()` ran.
|
|
67
|
+
|
|
68
|
+
## `createTeams(deps)` (`index.js`)
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
createTeams({ store, git, runTests, setup, identity, isIgnored, registry, now, log })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Dependency | Default | |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `store` | required | a coordination store. Claims, the journal and the event log are its |
|
|
77
|
+
| `git` | `createGitRunner()` | `(args, { cwd, input, env, timeoutMs }) => Promise<{ ok, status, stdout, stderr }>` |
|
|
78
|
+
| `runTests` | `createTestRunner()` | `({ cwd, command, commit, teamId, sliceId, projectPath }) => Promise<{ ok, exitCode?, output?, durationMs?, timedOut? }>` |
|
|
79
|
+
| `setup` | none | the dependency setup step of every new team (below) |
|
|
80
|
+
| `identity` | the repository's own | `{ name, email }` for SynaBun's commits |
|
|
81
|
+
| `isIgnored` | `git check-ignore` | `(worktree, relPath) => boolean` |
|
|
82
|
+
| `registry` | `lib/worker-confinement.js` | `{ register, unregister }`: where slices are registered for the worker guard |
|
|
83
|
+
|
|
84
|
+
It returns: `create`, `get`, `plan`, `list`, `inspect`, `startSlice`, `finishSlice`, `integrate`, `integrateAll`, `testIntegration`, `resolveInSlice`, `acceptIntegrationHead`, `land`, `remove`, `prune`, `recover`, `checkWrite`, `verifyOwnership`, `context`, and `modules` (`state`, `worktrees`, `claims`, `integration`, `landing`, `recovery`) for a caller that needs one module's own functions.
|
|
85
|
+
|
|
86
|
+
## Worktrees (`worktrees.js`)
|
|
87
|
+
|
|
88
|
+
**`create(plan, { density, maxSlices, testCommand, setup, createdBy })`** → `{ ok, team, setup, excluded, claims }`
|
|
89
|
+
|
|
90
|
+
- `plan` is a team plan. `baseCommit` may be left out: the project's HEAD is pinned. One it names must be a commit of the repository (a plan made earlier keeps its base).
|
|
91
|
+
- `density` / `maxSlices` are `validateTeamPlan`'s (the cap on slices). With neither, Solo applies: one slice.
|
|
92
|
+
- `testCommand`: text (run through the shell) or a list of arguments. Stored on the team; `integrate` runs it.
|
|
93
|
+
- Makes every slice's worktree and branch and the integration ones from the base, records the team (`creating`, then `planned`), and takes every slice's claims.
|
|
94
|
+
- The plan is stored whole (tasks included) and comes back from `plan(teamId)`.
|
|
95
|
+
|
|
96
|
+
Refusals: `NOT_A_GIT_REPOSITORY` (the message says to `git init` and commit, or use one worker), `PROJECT_NOT_REPO_ROOT`, `NO_COMMITS`, `PROJECT_NOT_FOUND`, `BASE_NOT_FOUND`, `INVALID_PLAN` (`errors`: `validateTeamPlan`'s), `INVALID_TEST_COMMAND`, `TEAM_EXISTS` (`existing`: what is in the way), `WORKTREE_FAILED` (what was made is taken back), `CLAIM_CONFLICT`.
|
|
97
|
+
|
|
98
|
+
`TEAM_EXISTS` is answered when the team's folder exists (`.worktrees/` also holds worktrees people make by hand, such as this repository's `.worktrees/agents-system`), when a `synabun/<team>/…` branch exists, when a worktree is registered under the team's folder, when a branch named `synabun` or `synabun/<team>` blocks the names, and when the journal already has the team. A team id is used once: also after the team is removed.
|
|
99
|
+
|
|
100
|
+
**Read-only plans.** The scheduler derives `readOnly: true` from `task_class: research|review`. Such slices have no owned paths, lockfile ownership or dependencies. `create` makes only slice worktrees from the pinned base; it skips integration, test commands and dependency setup. `finishSlice`, `integrate` and `land` refuse them with `TEAM_READ_ONLY`.
|
|
101
|
+
|
|
102
|
+
**`finishReadOnlySlice(teamId, sliceId, { failed })`** is called after the worker ends. It verifies the registered worktree, branch, pinned HEAD and clean status (including ignored files). Clean worktrees and their branches are removed; changes, commits, unknown state or removal failures are kept and reported in `cleanup`. Each slice ends as `completed` or `failed`; once all ended, the journal team is `completed`. Recovery never recreates finished worktrees. Read-only `remove` uses the same conservative check, even on discard.
|
|
103
|
+
|
|
104
|
+
**`startSlice(teamId, sliceId, { runId })`** → `{ ok, sliceId, worktree, branch, startCommit, rework, context }`
|
|
105
|
+
|
|
106
|
+
- A slice starts once the slices it depends on are `integrated` (`DEPENDENCIES_NOT_INTEGRATED`, with `waiting`). A slice with dependencies is first brought up to the integration branch by a fast-forward, so its dependencies' work is in its worktree; a slice without stays on the base.
|
|
107
|
+
- `startCommit` is where the slice's own work begins.
|
|
108
|
+
- Starting a slice that a worker has been at (`running`, `done`, `rejected`, `conflict`, `tests-failed`) is a rework: nothing moves, the slice is `running` again and holds its claims again.
|
|
109
|
+
- `context` is the slice's context for the worker guard.
|
|
110
|
+
|
|
111
|
+
**`inspect(teamId)`** → per slice: `path`, `branch`, `exists`, `registered`, `onBranch`, `head`, `base: { ahead, behind }`, `integration: { ahead, behind }`, `unintegrated` (commits whose change is not on the integration branch), `dirty`, `changes`, `lastCommit`, `state`; the integration branch (`head`, `recordedHead`, `moved`, `lastGood`, `tests`); the target branch (`head`, `fastForward`).
|
|
112
|
+
|
|
113
|
+
**`list({ projectPath, states, includeRemoved })`** → the teams the journal knows, oldest first.
|
|
114
|
+
|
|
115
|
+
**`remove(teamId, { discard, force })`** → `{ ok, complete, landed, removed, kept }`
|
|
116
|
+
|
|
117
|
+
- Only after a landing, or with `discard: true` (`TEAM_NOT_LANDED` otherwise).
|
|
118
|
+
- A worktree with uncommitted changes and a branch with commits that are nowhere else are kept and listed in `kept` (`reason: 'uncommitted_changes' | 'unintegrated_commits'`, with `files` or `commits`), unless `force: true`. So is a plain folder that sits where a worktree should be (`folder_is_not_a_worktree`): what is in it is unknown. After a landing a slice is measured against the integration branch; in a discard, against the user's branch.
|
|
119
|
+
- What is removed is written to the journal with the commit each branch pointed at (`removal.removed[].head`): until git's own garbage collection, `git branch <name> <head>` brings one back.
|
|
120
|
+
- The team is then `merged` or `cancelled`, with `removed: true` when nothing was kept. Its claims are given back.
|
|
121
|
+
|
|
122
|
+
**`prune({ projectPath })`** → clears worktree registrations whose folder is gone (`git worktree prune`) and empty folders of teams the journal knows. A branch is never pruned; a folder somebody made by hand is never touched.
|
|
123
|
+
|
|
124
|
+
### Dependency setup
|
|
125
|
+
|
|
126
|
+
Dependencies are not installed per worktree. `setup` is a step the caller supplies, called once per worktree with `{ projectPath, worktree, teamId, sliceId, git }`; a failure is reported in `create`'s `setup` list and is not fatal. The default is none.
|
|
127
|
+
|
|
128
|
+
`cloneNodeModules({ paths, limit })` is one such step: a copy-on-write clone of the project's `node_modules` folders (the ones beside a tracked `package.json`, or `paths`) into the worktree. Only folders git ignores, and only where the file system can clone (APFS, Btrfs, XFS with reflinks): elsewhere nothing is copied and the answer says `clone_not_supported`.
|
|
129
|
+
|
|
130
|
+
Changing dependencies is the lockfile-owner slice's: lockfiles belong to it by rule (`pathOwner`), and a manifest (`package.json`, `Cargo.toml`, `pyproject.toml`, …) changed by another slice is reported as a `manifest_changed` warning when that slice finishes. Give manifests to the lockfile owner in the plan.
|
|
131
|
+
|
|
132
|
+
## Claims and what a slice may write (`claims.js`)
|
|
133
|
+
|
|
134
|
+
Each slice holds its claimable paths (`claimablePaths(plan, sliceId)`) in the store from the moment the team is created; `startSlice` puts them in the run's name; `finishSlice` gives a finished slice's back; a landing or a removal gives the team's back.
|
|
135
|
+
|
|
136
|
+
**`checkWrite(teamId, sliceId, path)`** → `{ allow, decision: 'allow' | 'deny', owner, relPath, code, message }`
|
|
137
|
+
|
|
138
|
+
`path` is relative to the project (a slice's worktree is a checkout of it) or absolute inside the slice's own worktree.
|
|
139
|
+
|
|
140
|
+
| `code` | | |
|
|
141
|
+
|---|---|---|
|
|
142
|
+
| `owned` | allow | the slice's file, and its claim is held |
|
|
143
|
+
| `lockfile_owner` | allow | a dependency lockfile, and this slice is the plan's lockfile owner |
|
|
144
|
+
| `ignored` | allow | git ignores the file (build output, `node_modules`): it is never committed |
|
|
145
|
+
| `other_slice` | deny | `owner` is the slice that has it |
|
|
146
|
+
| `unowned` | deny | no slice owns it |
|
|
147
|
+
| `lockfile` | deny | a lockfile, and this slice is not the lockfile owner (`owner`: who is, or null) |
|
|
148
|
+
| `claim_released` | deny | the slice's own file, but the slice finished |
|
|
149
|
+
| `reserved_path` | deny | `.git` or `.worktrees` |
|
|
150
|
+
| `outside_worktree` | deny | an absolute path outside the slice's worktree (the user's checkout, another slice's worktree, anywhere) |
|
|
151
|
+
| `invalid_path`, `unknown_slice` | deny | |
|
|
152
|
+
|
|
153
|
+
A denial's `message` names the owner and says to ask over the team channel.
|
|
154
|
+
|
|
155
|
+
**`context(teamId, sliceId)`** → what the worker guard needs: `{ teamId, sliceId, worktree, projectPath, ownedPaths, lockfileOwner, channel, check(relPath) }`. `channel` is `teamRecipient(teamId)`.
|
|
156
|
+
|
|
157
|
+
**`verifyOwnership(teamId, sliceId)`** → `{ ok, head, reference, changed, violations, uncommitted, stray, warnings }`: what the slice's branch changed since it parted from the integration branch (`git diff` from their merge base), against what the slice owns. `violations` are committed changes to files that are not the slice's; `stray` are uncommitted ones. `finishSlice` runs it.
|
|
158
|
+
|
|
159
|
+
### The worker guard (`lib/worker-confinement.js`)
|
|
160
|
+
|
|
161
|
+
A run that works a team slice is confined to the slice's own worktree **and** its owned paths:
|
|
162
|
+
|
|
163
|
+
- `resolveWorkerConfinement({ …, team })` takes the slice's context. Without `team`, a working directory inside a registered slice's worktree makes the run that slice's: `claims.js` registers every slice of a team under way (`registerTeamSlice`), so an adapter that knows nothing about teams confines a slice all the same. The scheduler only has to start the worker in `started.worktree`.
|
|
164
|
+
- A team slice is **always guarded**: capability `full` is read as `workspace`, and the Protect workers setting does not turn the rule off or down to a warning. `confinement.team` carries the slice.
|
|
165
|
+
- A write to a file that is not the slice's is refused with rule `team-ownership`. The refusal names the owner and tells the worker to ask it over the team channel. This holds for Claude Code's file tools, redirections and writing programs in the shell, OpenCode's edit asks and Antigravity's edit / delete / move calls. The temp folder and the run's scratch folder stay writable; the rest of the project (the user's checkout, the other slices' worktrees) never is, also for a project kept under a folder a workspace run may write.
|
|
166
|
+
- git is for reading (rule `team-git`): `status`, `diff`, `log`, `show`, `blame`… run; `add`, `commit`, `stash`, `switch`, `push`, `merge` and the rest are refused, and so is the git tool's `commit` action. SynaBun commits the slice's work. `git stash` is shared by every worktree of a repository: a worker's `pop` would take the user's own stash.
|
|
167
|
+
- Runs with no team context are confined exactly as before.
|
|
168
|
+
|
|
169
|
+
**The limit, stated plainly.** The guard reads tool calls and command lines. A program a worker runs (a script, a build, a test runner, a formatter, `node -e`) writes what it writes without being seen, and Codex's sandbox confines a slice to its worktree but knows nothing of owned paths. What catches such a write is the check after the fact: `finishSlice` compares what the slice's branch changed with what it owns and rejects the slice. Under the macOS sandbox of a protected worker, the repository's own data is outside the worktree and not writable, so a worker cannot commit there in any case.
|
|
170
|
+
|
|
171
|
+
## Finishing and joining (`integration.js`)
|
|
172
|
+
|
|
173
|
+
**`finishSlice(teamId, sliceId, { message, allowStray, runId })`** → `{ ok, sliceId, head, committed, changed, stray, warnings, ignored }`
|
|
174
|
+
|
|
175
|
+
- Commits the files the slice owns that are changed in its worktree, on the slice's branch. A file that is not the slice's and was staged already (a program the worker ran staged it) is taken out of the index first; the file itself stays as it is. The commit uses the repository's own identity (`user.name` / `user.email`, as the user's commits do; `identity` when given; `SynaBun Agents <agents@synabun.invalid>` for a repository that has none), a subject from `message` or the slice's title, and the trailers `SynaBun-Team`, `SynaBun-Slice` and `SynaBun-Run`. It is not signed and runs no hook.
|
|
176
|
+
- Then checks the branch (`verifyOwnership`):
|
|
177
|
+
- `OWNERSHIP_VIOLATION`: the slice's own commits touch a file it does not own (`violations`). The slice is `rejected`, whatever is passed.
|
|
178
|
+
- `STRAY_CHANGES`: files it does not own are changed in the worktree (`stray`). They are left there, uncommitted; the slice's own files are committed; the slice is `rejected`. With `allowStray: true` the slice is `done` and the leftovers are reported: they never reach the integration branch.
|
|
179
|
+
- Ignored folders:
|
|
180
|
+
- A file git tracks is committed even inside a folder the `.gitignore` covers (a force-tracked build output such as `mcp-server/dist`). Tracked paths are staged with `git add -u`, new ones with a plain `git add`, never `-f`.
|
|
181
|
+
- A new file the `.gitignore` covers is never committed. It is named in `ignored` (`[{ path }]`; a wholly untracked ignored folder is one entry with a trailing `/`), which is also kept on the slice's record.
|
|
182
|
+
- Other refusals: `SLICE_NOT_STARTED`, `SLICE_ALREADY_INTEGRATED`, `SLICE_WORKTREE_MISSING`, `SLICE_BRANCH_MOVED` (the worktree is not on the slice's branch: nothing is committed), `SLICE_WORKTREE_BUSY`, `UNRESOLVED_CONFLICTS` (`files`), `GIT_FAILED`, `COMMIT_FAILED`.
|
|
183
|
+
- When staging or the commit fails (`GIT_FAILED`, `COMMIT_FAILED`), the answer carries:
|
|
184
|
+
- `git: { command, status, output }`, where `output` is everything git said: stderr, then stdout, at most 4 KB, with both ends kept.
|
|
185
|
+
- `indexRestored`: the index entries of the slice's own paths are put back exactly as they were before the attempt, unmerged stages included, so a failed attempt leaves nothing staged.
|
|
186
|
+
- A finished slice gives its claims back.
|
|
187
|
+
|
|
188
|
+
**`integrate(teamId, sliceId, { test, testCommand })`** → `{ ok, sliceId, method, commit, before, tests, ready }`
|
|
189
|
+
|
|
190
|
+
- Only a `done` slice, and only after the slices it depends on (`SLICE_NOT_DONE`, `DEPENDENCIES_NOT_INTEGRATED`).
|
|
191
|
+
- The slice's commits since its last join are cherry-picked onto the integration branch in the integration worktree (`method: 'cherry-pick'`). A slice that carries the integration branch in it (after `resolveInSlice`) is joined by fast-forward, or by a merge when the integration branch moved meanwhile. A slice with nothing new is `method: 'none'`.
|
|
192
|
+
- The test command (the team's, or `testCommand` for this join) runs on exactly the resulting commit: the runner gets `commit`, the worktree is on it with nothing uncommitted, and a run that moves the branch does not count. With `test: false` or no command, nothing runs and the head counts as untested.
|
|
193
|
+
- One join at a time per team.
|
|
194
|
+
|
|
195
|
+
It answers a refusal, and changes nothing on the integration branch, for:
|
|
196
|
+
|
|
197
|
+
- **`CONFLICT`**: the cherry-pick is aborted and the integration worktree is exactly as before. The slice is `conflict`. `report`:
|
|
198
|
+
```js
|
|
199
|
+
{ teamId, sliceId, method, integrationBranch, integrationHead, sliceBranch, sliceHead, stoppedAt, clean,
|
|
200
|
+
files: [{ path, owner,
|
|
201
|
+
ours: { side: 'integration', commit, subject, slice, blob }, // what is on the integration branch
|
|
202
|
+
theirs: { side: 'slice', commit, subject, slice, blob }, // the slice's commit
|
|
203
|
+
base, excerpt }] } // the common version; the first conflict, markers included
|
|
204
|
+
```
|
|
205
|
+
Route it to the slice's owner or to an integrator worker. Nothing is ever resolved by force. An `integration.conflict` event is appended to the store's log.
|
|
206
|
+
- **`TESTS_FAILED`**: the integration branch is taken back to the commit before the join, the last good one. The slice is `tests-failed`. `report: { teamId, sliceId, candidate, before, tests: { ok, exitCode, timedOut, output, … }, clean }`; `candidate` is the commit that failed (it stays in the repository until git collects it).
|
|
207
|
+
- `SLICE_MOVED` (the slice's branch moved since it was finished: finish it again), `INTEGRATION_MOVED` (the integration branch is not where SynaBun left it), `INTEGRATION_FAILED`, `INTEGRATION_WORKTREE_MISSING`.
|
|
208
|
+
|
|
209
|
+
When the last slice is joined the team is `ready` and an `integration.ready` event is appended.
|
|
210
|
+
|
|
211
|
+
**`integrateAll(teamId, options)`** → `{ ok, ready, results }`: every finished slice in `integrationOrder(plan)`; a slice that is not finished or waits for one that is not joined is skipped; a failure does not stop the slices that do not depend on it.
|
|
212
|
+
|
|
213
|
+
**`testIntegration(teamId, { testCommand })`**: runs the tests on the integration head as it is and records the answer for that commit. Nothing is taken back when they fail.
|
|
214
|
+
|
|
215
|
+
**`resolveInSlice(teamId, sliceId, { runId })`** → `{ ok, worktree, integrationHead, conflicts }`: for a slice in `conflict`. Brings the integration branch into the slice's worktree (a merge left open) with the conflicts in the slice's own files, for its owner. The slice is `running` again. `finishSlice` refuses while conflict markers are left (`UNRESOLVED_CONFLICTS`) and then commits the result; `integrate` joins it without a cherry-pick.
|
|
216
|
+
|
|
217
|
+
**`acceptIntegrationHead(teamId)`**: somebody committed on the integration branch itself, in its worktree (an integrator worker fixing what the slices together broke). Takes its head as the team's: only commits added on top of the recorded head (`INTEGRATION_REWOUND` otherwise), only a clean worktree. The new head counts as untested.
|
|
218
|
+
|
|
219
|
+
### The test command and its runner (`test-runner.js`)
|
|
220
|
+
|
|
221
|
+
`createTestRunner({ env, timeoutMs, outputBytes })`. Text is run through the shell, a list of arguments directly, in the integration worktree, 30 minutes at most, the end of its output kept. It runs with the server's rights and is **not sandboxed**: the code it runs is the team's work. A scheduler that wants the tests confined injects its own `runTests`. What the default keeps away is SynaBun's own environment: every `SYNABUN_*` and `TYPESAFE_*` variable, and anything that aims git at another repository.
|
|
222
|
+
|
|
223
|
+
## Landing (`landing.js`)
|
|
224
|
+
|
|
225
|
+
**`land(teamId, { targetBranch, mode, allowUntested, allowPartial })`** → `{ ok, landed, changed }`
|
|
226
|
+
|
|
227
|
+
- `targetBranch`: default, the branch the project was on when the team was created.
|
|
228
|
+
- `mode: 'ff'` (default) moves the target forward to the integration branch. `mode: 'merge'` makes a merge commit of the two (always, also when a fast-forward would do), computed without a checkout (`git merge-tree`, git 2.38 or newer), and moves the target to it.
|
|
229
|
+
- Where the target is checked out (the user's own checkout, usually), the branch, the index and the files are updated together by a fast-forward of that checkout. Every uncommitted change of a file the landing does not touch comes through unchanged, staged or not; nothing is stashed; no hook runs. Where the target is checked out nowhere, only the branch moves (compare-and-swap on its old commit).
|
|
230
|
+
- The team is then `merged` (`landed: { targetBranch, mode, from, to, mergeCommit, checkout, files, tested, partial }`) and its claims are given back.
|
|
231
|
+
|
|
232
|
+
A landing changes nothing, and answers with a `report`, for:
|
|
233
|
+
|
|
234
|
+
| Code | |
|
|
235
|
+
|---|---|
|
|
236
|
+
| `NOT_FAST_FORWARD` | `mode: 'ff'` and the target has commits the integration branch lacks (`targetOnly`, `integrationOnly`) |
|
|
237
|
+
| `MERGE_CONFLICT` | `mode: 'merge'` and the two do not merge cleanly (`files`). Never resolved |
|
|
238
|
+
| `TESTS_NOT_PASSED` | the tests have not passed on the integration head: no test command, not run on this commit, or failed. `allowUntested: true` lands on the caller's word |
|
|
239
|
+
| `TEAM_NOT_READY` | a slice is not joined (`slices`). `allowPartial: true` lands what is joined |
|
|
240
|
+
| `DIRTY_FILES_AFFECTED` | the landing would change a file that has uncommitted changes in the checkout that has the target, or write over a file that is there untracked or ignored (`files`) |
|
|
241
|
+
| `CHECKOUT_BUSY` | that checkout is in the middle of a merge, rebase, cherry-pick, revert or bisect |
|
|
242
|
+
| `CHECKOUT_REFUSED` | git would not update that checkout (it checks again as it starts) |
|
|
243
|
+
| `TARGET_MOVED` | the target moved while the landing was prepared |
|
|
244
|
+
| `INTEGRATION_MOVED`, `TARGET_NOT_FOUND`, `TARGET_REQUIRED`, `TARGET_IS_TEAM_BRANCH`, `NOTHING_TO_LAND`, `ALREADY_LANDED`, `INVALID_MODE`, `MERGE_UNAVAILABLE` | |
|
|
245
|
+
|
|
246
|
+
Where it applies, `report.userShouldRun` is what the user can run themselves (`git checkout <target>`, `git merge --ff-only synabun/<team>/integration`).
|
|
247
|
+
|
|
248
|
+
## Recovery (`recovery.js`)
|
|
249
|
+
|
|
250
|
+
**`recover({ teamId })`** → `{ ok, teams: [{ teamId, was, state, actions, attention }], claims }`. Call it once at start-up, before anything else. Safe to call again.
|
|
251
|
+
|
|
252
|
+
| Found | Done |
|
|
253
|
+
|---|---|
|
|
254
|
+
| `creating` | what is half-made is taken apart and made again (no worker had started: there is no work in it); the team is `planned`, or `failed` when it cannot be made |
|
|
255
|
+
| `integrating` | a cherry-pick or merge under way is aborted; the integration branch goes back to the commit before the join; the slice is `done` again. Also for a crash while the tests ran |
|
|
256
|
+
| `landing` | the target branch at the landing's commit: `merged`. Where it was: the team is as before. Anywhere else: reported |
|
|
257
|
+
| a worktree's folder gone | put back from its branch (what was uncommitted in the folder went with the folder) |
|
|
258
|
+
| a slice's branch and folder gone | the slice is `failed` |
|
|
259
|
+
|
|
260
|
+
It also takes the claims of every team under way again and registers every slice with the worker guard again (the guard's registry is in memory).
|
|
261
|
+
|
|
262
|
+
Recovery never deletes work. It removes only what a stopped creation left, and moves only the integration branch, back to a commit SynaBun recorded, when everything after that commit is a copy of commits a slice still has. What it does not understand it leaves alone and lists under `attention`: `branch_has_commits`, `unexpected_changes`, `integration_has_other_commits`, `integration_worktree_not_on_its_branch`, `integration_moved`, `folder_is_not_a_worktree`, `not_on_its_branch`, `target_moved`, `checkout_may_be_half_updated`, `slice_operation_under_way`.
|
|
263
|
+
|
|
264
|
+
## How git is run (`git.js`)
|
|
265
|
+
|
|
266
|
+
`createGitRunner({ binary, env, timeoutMs, maxBuffer, onCommand })`. Every command is an argument array, never a command line. A command that only asks goes through `lib/git-read.js`. A command that writes is given: no hook (`core.hooksPath` is the null device), no file system monitor program, no signing, no remote (`GIT_ALLOW_PROTOCOL` empty), no recorded conflict resolution (`rerere` off), no editor or prompt, no automatic garbage collection. Clean and smudge filters and custom merge drivers still run: a checkout or a merge without them is not the project's.
|
|
267
|
+
|
|
268
|
+
One thing every module checks before it writes in a folder: that the folder is a worktree of its own, on the branch it should be on (`branchAt` in `worktrees.js`). Asked inside a plain folder, git answers for the repository around it, which for a team's folders is the user's checkout. The reset that settles the integration worktree runs in a linked worktree only.
|
|
269
|
+
|
|
270
|
+
Operations on one repository's worktrees and branches take turns (`createLocks`): creation, removal, pruning and landing per repository; joins and tests per team; finishing per slice.
|
|
271
|
+
|
|
272
|
+
## The journal (`state.js`)
|
|
273
|
+
|
|
274
|
+
A team's record is its journal entries folded, oldest first: the newest entry's state is the state, and each entry's data lies over what came before. `teams.get(teamId)` returns it:
|
|
275
|
+
|
|
276
|
+
```js
|
|
277
|
+
{ teamId, state, plan, projectPath, baseCommit, baseBranch, headAtCreate, testCommand, createdBy,
|
|
278
|
+
integration: { head, lastGood, tests: { ok, commit, command, at, exitCode, output } | null },
|
|
279
|
+
integrating: { sliceId, before, sliceHead, method, phase: 'applying' | 'testing', candidate } | null,
|
|
280
|
+
landing: { targetBranch, mode, from, to, checkout } | null, landed, removed, removal,
|
|
281
|
+
slices: { [id]: { state, runId, task, ownedPaths, path, branch, startCommit, head, changed, stray, violations,
|
|
282
|
+
integrationCommit, integratedHead, method, conflict, tests } },
|
|
283
|
+
createdAt, updatedAt }
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Every entry is announced on the store's event log (kind `team.state` or `slice.state`, addressed to nobody, id `team:<team>:journal:<entry id>`, payload `{ teamId, sliceId, state, journalId }`), and `integration.conflict`, `integration.ready` and `claim.conflict` events are appended as they happen. A scheduler wakes on `store.subscribe({ teamId }, fn)` or `store.waitFor({ teamId, afterSeq })` and reads the record; nothing here addresses a recipient, so nothing waits in a mailbox.
|
|
287
|
+
|
|
288
|
+
A team id is the store's key: one store, one team of a name, whatever the project.
|
|
289
|
+
|
|
290
|
+
## The git tool (`mcp-server/src/tools/git-tools.ts`)
|
|
291
|
+
|
|
292
|
+
Two read-only actions for a worker or the Assistant, from git alone:
|
|
293
|
+
|
|
294
|
+
- `worktrees`: the repository's worktrees with their branch, head and uncommitted count; a team's are marked (`team <id> · slice <id>`).
|
|
295
|
+
- `team`: with `team`, the team's branches, how far each slice is joined on the integration branch, and whether the main checkout's branch can be fast-forwarded to it; without, the teams the repository has.
|
|
296
|
+
|
|
297
|
+
They ask git under the rules of a read and change nothing. The tool has no action that creates, joins, lands or removes: those are the scheduler's, through this library. Conflicts, test results and whether a team has landed are in the journal, not in git.
|
|
298
|
+
|
|
299
|
+
## The scheduler (phase P4)
|
|
300
|
+
|
|
301
|
+
`createTeamScheduler({ teams, coordination, dispatcher, density, router, session, git, dataDir, broadcast, limits })` (`scheduler.js`). `docs/agents.md` → Teams says what it does for the Assistant and the workers; this is what a caller of the library needs to know about it.
|
|
302
|
+
|
|
303
|
+
- **It is the only caller of the library in the server.** `server.js` shares it (`shareTeamScheduler`); the Assistant's API and the Agents Studio routes ask `sharedTeamScheduler()` when a request arrives. A test passes its own.
|
|
304
|
+
- **Its own record** is one JSON file per team in `<dataDir>/teams/<teamId>.json` (the session, the route, the dispatch settings, each slice's runs and retry counts, its status). Everything about git is read from the journal through the library, never kept twice.
|
|
305
|
+
- **A team's steps never overlap**: every step of one team runs after the one before it (`inTurn`), and none runs before the library's `recover()` has.
|
|
306
|
+
- **The run id comes first.** `dispatchSlice` makes the run id, calls `startSlice(teamId, sliceId, { runId })` (or `resolveInSlice`), and only then dispatches with that id (`dispatcher.dispatch(spec, { team, runId })`): the claims are in the run's name before the worker exists. The dispatcher takes `team` and `runId` from the scheduler alone; no request body reaches them.
|
|
307
|
+
- **What it decides that the library leaves open** (the list below this section, as it was written for this phase): workers run with capability `workspace`; `STRAY_CHANGES` is answered with `allowStray: true` (the files stay out, the event names them); a conflict goes to the slice's own worker through `resolveInSlice`; `land` is never called because a team became ready; the workers are stopped before `remove`; the tests run through `test-sandbox.js`; the setup step is `cloneNodeModules()`; a team id is `<title>-<6 hex>`.
|
|
308
|
+
- **Limits** (`TEAM_SCHEDULER_LIMITS`): `maxRetries` 2 per slice and kind, `maxPeerDeferrals` 4, 40 posts per worker in 10 minutes, 4,000 characters a message, waits of at most 50 s.
|
|
309
|
+
- **Not done**: an integrator worker (somebody committing on the integration branch and `acceptIntegrationHead`) is not something the scheduler starts; an escalated run (`dispatcher.escalate`) of a slice is not its slice's run for the scheduler.
|
|
310
|
+
|
|
311
|
+
## For the scheduler phase
|
|
312
|
+
|
|
313
|
+
- Create one `createTeams({ store })` beside the store in `server.js`, call `await teams.recover()` before the first use, and nothing else needs wiring for the guard: dispatch a slice's worker with `cwd: started.worktree`. The store is the server's one coordination service's own (`_assistantCoordination.store` in `server.js`, `sharedCoordinationService().store` elsewhere; phase P2): never open a second one on the file. `service.team.members(teamId)` then reads the runs out of the journal these modules write, and `service.team.post / read / wait / ack` is the team channel (`tests/agents-integration-seams.test.mjs` runs both on one file).
|
|
314
|
+
- Dispatch slices with capability `workspace`. `full` is read as `workspace` for a slice, and the Protect workers setting does not apply to a team: tell the user so where the setting is shown.
|
|
315
|
+
- A worker of a slice cannot commit. Tell it to leave its changes in the working tree and to report; then call `finishSlice` and `integrate`.
|
|
316
|
+
- The refusals a worker reads say "ask over the team channel (`team:<id>`)". That channel is the scheduler's to provide (the store's events and mailbox, phase P2).
|
|
317
|
+
- `finishSlice` → `rejected` is the scheduler's to route: the report has the files and their owners. A worker cannot undo a stray change itself (the guard refuses writes to files it does not own). Either pass `allowStray: true` (the files stay out), or have the owning slice or the Assistant decide.
|
|
318
|
+
- `integrate` → `CONFLICT`: route the report; then either `resolveInSlice` (the slice's owner resolves in its own files) or an integrator worker in the integration worktree followed by `acceptIntegrationHead`.
|
|
319
|
+
- `land` is never called because a team became `ready`. It is the owner's step, or the Assistant's when the owner said so.
|
|
320
|
+
- Before `remove` or a discard, stop the team's runs.
|
|
321
|
+
- The default test runner is unsandboxed and the default dependency setup is none: decide both when wiring.
|
|
322
|
+
- One team id per store: derive it so two projects never ask for the same one.
|
|
323
|
+
- The MCP `git` tool's catalog line (`mcp-server/src/services/tool-catalog.ts`: `status/diff/commit/log/branches`) does not name the two new actions yet; the tool's own schema and description do.
|
|
324
|
+
|
|
325
|
+
## Confirmed cleanup after landing
|
|
326
|
+
|
|
327
|
+
Scheduler `land` retains the worktrees and branches and returns
|
|
328
|
+
`cleanup: { available: true, worktrees: [absolutePath], branches: [branchName], next }`.
|
|
329
|
+
The Assistant suggests cleanup once the task is finished and asks the owner to confirm.
|
|
330
|
+
`POST /api/assistant/teams/:id/cleanup` uses the land route's orchestration and session guards;
|
|
331
|
+
its body adds the strict boolean `user_confirmed`. No Studio cleanup route is registered.
|
|
332
|
+
|
|
333
|
+
`scheduler.cleanup(teamId, { sessionId, userConfirmed })` checks confirmation, landed status,
|
|
334
|
+
every historical team run (including removed runs and integrators), that every branch is merged
|
|
335
|
+
into the landing target, and clean, unlocked linked worktrees. Missing run evidence fails closed.
|
|
336
|
+
|
|
337
|
+
A branch is merged (`mergedInto` in `worktrees.js`) in one of two cases:
|
|
338
|
+
- `ancestor`: its head is an ancestor of the target.
|
|
339
|
+
- `patch-equivalent`: every commit it has beyond the team's base commit that the target cannot reach
|
|
340
|
+
has a patch-equivalent commit the target reaches (`git cherry <target> <branch> <base>` prints no `+` line).
|
|
341
|
+
This is the usual case for a slice, because `integrate` cherry-picks the slice's commits onto the
|
|
342
|
+
integration branch and so only copies of them land.
|
|
343
|
+
|
|
344
|
+
Merge commits: a merge commit the target cannot reach is never patch-equivalent. It has no single patch, and
|
|
345
|
+
`git cherry` skips merges silently, so the check lists such commits from `git rev-list --merges <branch>
|
|
346
|
+
--not <target> <base>`. A slice that contains merges is joined by a merge or a fast-forward, which makes the
|
|
347
|
+
slice branch an ancestor of the target after the landing. Anything else is `BRANCH_NOT_MERGED`; the failing
|
|
348
|
+
`merged` check names the branch in `detail` and lists the commits that have no equivalent in `commits`.
|
|
349
|
+
|
|
350
|
+
All checks precede removal, under the library repository lock. Removal goes in this order:
|
|
351
|
+
1. Each patch-equivalent branch's worktree gets its HEAD detached at the checked commit
|
|
352
|
+
(`update-ref --no-deref HEAD`; files and index are untouched).
|
|
353
|
+
2. One atomic `git update-ref --stdin` transaction runs: `verify` for every ancestor branch at its checked
|
|
354
|
+
head, and `delete <ref> <checked head>` for every patch-equivalent branch. `git branch -d` would refuse
|
|
355
|
+
these, and `-D` / `--force` is never used.
|
|
356
|
+
3. If the transaction fails, every detached HEAD is put back (`symbolic-ref`), nothing is removed, and
|
|
357
|
+
cleanup refuses with `BRANCH_MOVED`.
|
|
358
|
+
4. Otherwise each worktree goes with `git worktree remove` (no force), and each ancestor branch with
|
|
359
|
+
`git branch -d`. Then `git worktree prune` runs and the empty team folder is removed.
|
|
360
|
+
|
|
361
|
+
The legacy discard/removal behavior is separate from this guarded removal option.
|
|
362
|
+
|
|
363
|
+
Success is `{ ok: true, teamId, removed: [{ sliceId, path, branch }] }`, with
|
|
364
|
+
`confirmation: "unverified"` when no owner-turn dependency is configured. A repeated cleanup
|
|
365
|
+
returns `{ ok: true, teamId, alreadyClean: true, removed: [] }`. Refusals return
|
|
366
|
+
`{ ok: false, code, message, checks: [{ name, ok, detail }] }`; codes are
|
|
367
|
+
`CLEANUP_NOT_CONFIRMED`, `TEAM_NOT_LANDED`, `TEAM_RUNS_ACTIVE`, `BRANCH_NOT_MERGED`,
|
|
368
|
+
`WORKTREE_DIRTY`, and `BRANCH_MOVED` (a branch moved between the merged check and its deletion;
|
|
369
|
+
nothing removed, and a new cleanup checks it again), plus ordinary unknown-team/session errors. Successful cleanup persists
|
|
370
|
+
`cleanedAt` and emits `team_cleaned` (`team.cleaned`) through `assistant:team-changed`.
|
|
371
|
+
|
|
372
|
+
The optional scheduler dependency `lastOwnerTurnAt(sessionId)` must return the last trusted
|
|
373
|
+
UI user turn's epoch milliseconds or ISO timestamp. The runtime exposes this getter and stores
|
|
374
|
+
the timestamp in its session record. Add this property to `createTeamScheduler` in server.js:
|
|
375
|
+
|
|
376
|
+
```js
|
|
377
|
+
lastOwnerTurnAt: (sessionId) => _assistantRuntime?.lastOwnerTurnAt?.(sessionId) ?? null,
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
With that dependency present, absent, equal or earlier timestamps refuse cleanup. Without it,
|
|
381
|
+
confirmation timing is explicitly reported as unverified. Git failures during removal throw;
|
|
382
|
+
external concurrent filesystem changes cannot be made transactional across Git commands.
|