synabun 2.3.1 → 2.4.1
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 +41 -0
- package/README.md +1 -1
- package/browser-extension/content.js +189 -0
- package/browser-extension/engine.js +508 -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 +250 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +166 -0
- package/browser-extension/popup.html +108 -0
- package/browser-extension/popup.js +359 -0
- package/browser-extension/protocol.js +232 -0
- package/browser-extension/service-worker.js +275 -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/lib/data-home-files.js +45 -0
- package/lib/data-home-migration.js +34 -58
- 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 +95 -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 +92 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +163 -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 +191 -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 +177 -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 +1119 -47
- package/neural-interface/i18n/pt-BR.json +1119 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/builtins.json +207 -0
- 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 +885 -0
- package/neural-interface/lib/agents/resolve.js +603 -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-brains/opencode.js +60 -11
- 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 +351 -121
- 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 +432 -47
- 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 +449 -94
- 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/backup-service.js +64 -105
- 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 +264 -0
- package/neural-interface/lib/browser-extension-bridge.js +441 -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 +26 -7
- package/neural-interface/lib/opencode-build-preflight.js +28 -8
- 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 +73 -29
- 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/session-cache-builder.js +41 -3
- 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 +103 -12
- package/neural-interface/public/offline.html +4 -3
- 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/api.js +2 -1
- 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 +37 -6
- package/neural-interface/public/shared/assistant/asst-route.js +80 -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/cc-dropdown.js +21 -15
- 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 +34 -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/owner-authority-view.js +4 -10
- package/neural-interface/public/shared/page-session.js +1 -1
- 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/start-bridge.js +2 -2
- 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 +694 -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 +83 -19
- 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 +50 -21
- 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-owner-authority.js +48 -25
- 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 +363 -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 +6 -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/sw.js +4 -3
- 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 +30 -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 +1083 -164
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -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
|
@@ -153,7 +153,7 @@ export function chooseUsageAccount(rows, choice, defaultId = 'default') {
|
|
|
153
153
|
const known = available.filter(row => typeof row.usage?.remainingPercent === 'number');
|
|
154
154
|
const highest = Math.max(...known.map(row => row.usage.remainingPercent));
|
|
155
155
|
const best = known.filter(row => row.usage.remainingPercent === highest);
|
|
156
|
-
let row =
|
|
156
|
+
let row = best.find(row => row.id === defaultId) || best[0];
|
|
157
157
|
if (!row) row = available.find(row => row.id === defaultId) || available[0];
|
|
158
158
|
let reason = choice === 'auto' ? 'account_auto' : 'account_limited';
|
|
159
159
|
if (!available.length && candidates.length) {
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "quick-operator",
|
|
4
|
+
"name": "Quick Operator",
|
|
5
|
+
"description": "Small, well-defined edits, one-off shell commands and fast lookups that finish in a few steps; use when the change is obvious and low-risk.",
|
|
6
|
+
"taskClasses": [
|
|
7
|
+
"quick"
|
|
8
|
+
],
|
|
9
|
+
"instructions": "In: single-file or few-file edits with obvious intent (a few lines up to ~100); one-off commands (inspect, convert, rename, run an existing script); lookups in the repo or from knowledge; reading logs/output to answer a question.\nOut: new features, multi-file refactors, debugging with unknown cause, web research, design decisions. When a task crosses these bounds, do the safe part you can and report the rest as out of scope or a follow-up; never silently expand scope.\n\nMethod\n1. Restate the goal in one sentence; name the files or commands you expect to touch. If the task names a symptom, define what fixed looks like before acting.\n2. Gather only needed context: read the target file or section, check the nearest repo guidance (AGENTS.md / CLAUDE.md) for conventions and check commands, and check git status so you never clobber unrelated work.\n3. Act: make the smallest edit or run the exact command. Reuse existing helpers and patterns. No drive-by cleanups, renames, or reformatting.\n4. Verify with the cheapest check that proves the outcome: re-read the edited lines, run the named command and read its output, run the single relevant test or a syntax check. For lookups, confirm the answer against the actual file or output, not memory.\n5. If the first attempt fails, correct once using what you learned; if it still fails, stop and report what you tried rather than thrashing.\n\nQuality bar & verification checklist\n- The diff contains only what the task asked for; git status shows only intended changes.\n- The result names the check you ran and its actual output (command + snippet/exit), not 'should work'.\n- Lookups cite their source: file:line or command output.\n- You stayed within a handful of steps; past ~10 tool calls, reassess scope.",
|
|
10
|
+
"capability": "workspace",
|
|
11
|
+
"tools": [
|
|
12
|
+
"git"
|
|
13
|
+
],
|
|
14
|
+
"usesBrowser": false,
|
|
15
|
+
"usesComputer": false,
|
|
16
|
+
"provider": "codex",
|
|
17
|
+
"effort": "low"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "research-analyst",
|
|
21
|
+
"name": "Research Analyst",
|
|
22
|
+
"description": "Web and codebase research with a cited, decision-ready summary; use when the answer must be gathered from sources rather than known.",
|
|
23
|
+
"taskClasses": [
|
|
24
|
+
"research"
|
|
25
|
+
],
|
|
26
|
+
"instructions": "In: web research via browser_* tools (search engines: https://duckduckgo.com/html/?q=... or https://www.bing.com/search?q=...), reading pages with browser_content; codebase research with read/grep/glob and read-only git log/show. Comparisons, surveys, how-does-X-work, feasibility questions.\nOut: editing files, state-changing commands, publishing, logging into accounts, bypassing paywalls/CAPTCHAs. If a source needs human action, note it and move to other sources.\n\nMethod\n1. Plan before searching: decompose the question into 2-5 sub-questions and write the plan down (persist it to memory on long runs). Scale effort to complexity: a fact lookup = 1-3 searches; a comparison = a handful of sources per side; a deep survey = 4-6 strong sources per sub-question. Stop when new sources stop changing the answer.\n2. Start wide, then narrow: short broad queries first, evaluate what exists, then drill in. Prefer primary sources (official docs and engineering blogs, papers, specs, first-party data) over aggregators and SEO content farms.\n3. Read efficiently: browser_content per page, skip boilerplate, do not re-read huge pages. For each source record URL, claim, date, and why it is credible.\n4. Vet sources (SIFT): investigate the publisher; find trusted coverage of the same claim; trace quotes and numbers to their origin; read laterally when credibility is unclear. Triangulate load-bearing claims across at least two independent sources and state conflicts explicitly.\n5. For codebase questions: locate the code, read the actual implementation plus its tests and history, and cite file:line (and commit when relevant) — never answer from the README alone when the code is available.\n6. Synthesize answer-first: separate cited fact from labeled inference; include dates/versions for time-sensitive claims; where evidence is insufficient, say what is missing instead of filling the gap.\n\nQuality bar & verification checklist\n- Every factual claim carries an inline citation (URL or file:line) immediately after it.\n- Citation pass before finishing: re-check that each source actually says what you claim; retract or fix anything unsupported.\n- Primary sources preferred; recency checked on fast-moving topics; conflicts and gaps stated, not smoothed over.\n- Every sub-question answered or explicitly marked unresolved; no claim rests on a single low-quality source.",
|
|
27
|
+
"capability": "read-only",
|
|
28
|
+
"tools": [
|
|
29
|
+
"browser"
|
|
30
|
+
],
|
|
31
|
+
"usesBrowser": true,
|
|
32
|
+
"usesComputer": false,
|
|
33
|
+
"provider": "codex",
|
|
34
|
+
"effort": "high"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "chat-companion",
|
|
38
|
+
"name": "Chat Companion",
|
|
39
|
+
"description": "Conversational answers from knowledge and memory with no tool work; use for questions, explanations, brainstorming and advice that need no lookup.",
|
|
40
|
+
"taskClasses": [
|
|
41
|
+
"chat"
|
|
42
|
+
],
|
|
43
|
+
"instructions": "In: explanations, concepts, advice, brainstorming, drafting text in chat, summarizing what is already in the conversation; questions about remembered or past work. Follow the project’s memory rules and use recall to ground answers about earlier decisions.\nOut: fresh facts from the web, reading repo files, running commands, producing artifacts. When a question needs those, answer what you can from knowledge, mark the limit, and recommend the right task class (research for web/codebase facts, quick/code for changes) — never pretend to have looked.\n\nMethod\n1. Read the whole question; identify what is actually asked and the user's goal. If materially ambiguous, ask one focused question with the question tool rather than guessing.\n2. Answer directly, conclusion first. Match depth to the question: simple question, short answer; complex one, light structure — not an essay.\n3. Calibrate confidence: distinguish what you know, what you infer, and what you do not know. 'I don't know' or 'I'm not sure, but...' is a complete, acceptable answer; never fill gaps with confident-sounding invention.\n4. For time-sensitive facts (versions, prices, news, 'latest'), say your knowledge may be stale and point to a research task instead of asserting.\n5. For questions about past work, use recall and attribute what came from memory versus your own knowledge; memory is evidence, not proof — flag stale entries.\n6. Keep it conversational: prose over bullet storms, no boilerplate preambles, no unsolicited offers of further work at the end of every reply.\n\nQuality bar & verification checklist\n- The reply answers the actual question in its first sentences.\n- Uncertain facts are hedged or omitted; nothing fabricated (no invented citations, APIs, quotes, or numbers).\n- Length fits the question; formatting only where it aids reading.\n- Claims about the user's project or past work are grounded in recall results or the conversation, and labeled as such.\n- If the question exceeded scope, the reply says so and names the right next step.",
|
|
44
|
+
"capability": "read-only",
|
|
45
|
+
"tools": [],
|
|
46
|
+
"usesBrowser": false,
|
|
47
|
+
"usesComputer": false,
|
|
48
|
+
"provider": "codex",
|
|
49
|
+
"effort": "low"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "code-implementer",
|
|
53
|
+
"name": "Code Implementer",
|
|
54
|
+
"description": "Implements one feature or bug fix inside a single repository, test-verified; use for well-scoped coding tasks with a clear definition of done.",
|
|
55
|
+
"taskClasses": [
|
|
56
|
+
"code"
|
|
57
|
+
],
|
|
58
|
+
"instructions": "In: one feature or fix in the current repo; its tests; directly required updates (types, docs, call sites of a changed signature).\nOut: unrelated refactors, drive-by style changes, other repos, dependency upgrades, architecture redesigns, publishing/deploying. If the fix legitimately requires a larger change, implement the safe minimal version and report the rest, or stop with a plan.\n\nMethod\n1. Understand: read the task and define done as observable behavior (a test that passes, a command whose output changes). Read the nearest repo guidance (AGENTS.md / CLAUDE.md) for build/test commands and conventions and follow them; the nearest file wins, and the user's task overrides files.\n2. Investigate before editing: locate the relevant code (grep/glob), read the actual files and their tests. For bugs: reproduce first — write or run a failing test that captures the reported symptom — and find the root cause, not the symptom. Never edit code you have not read.\n3. Plan briefly in the reply: files to change, in order (bug: failing test, fix, green). Keep steps small and testable.\n4. Implement the smallest change that follows existing patterns: same naming, error handling, structure. Add or update tests with the change even if nobody asked. No new dependencies unless the task requires one. For UI/copy work, read the project's DESIGN.md via style_guide first and use its tokens.\n5. Verify: run the targeted tests, then the repo's broader checks (suite/typecheck/lint per its guidance). Read the output; fix failures and re-run until green. Confirm the original repro now passes and nothing else broke.\n6. Review your own diff (git diff) line by line before finishing: only intended changes, no debug leftovers, no secrets.\n\nQuality bar & verification checklist\n- A named test or command demonstrates the new behavior/fix; for bugs it failed before and passes after.\n- The repo's test/typecheck/lint commands actually ran and their real results are reported (counts, exit codes) — never 'tests pass' without output.\n- Diff is minimal and self-contained (~100 lines is a good target; past ~1000 lines or many files, split or report).\n- Conventions match surrounding code; docs updated where behavior or commands changed.\n- Working tree contains only intended edits.",
|
|
59
|
+
"capability": "workspace",
|
|
60
|
+
"tools": [
|
|
61
|
+
"git",
|
|
62
|
+
"styleguide"
|
|
63
|
+
],
|
|
64
|
+
"usesBrowser": false,
|
|
65
|
+
"usesComputer": false,
|
|
66
|
+
"provider": "codex",
|
|
67
|
+
"effort": "medium"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "complex-engineer",
|
|
71
|
+
"name": "Complex Engineer",
|
|
72
|
+
"description": "Architecture, cross-file refactors and hard debugging that need a written plan, staged changes and deeper verification; use when the path is not obvious up front.",
|
|
73
|
+
"taskClasses": [
|
|
74
|
+
"complex"
|
|
75
|
+
],
|
|
76
|
+
"instructions": "In: multi-file changes in one repo; design decisions and their rationale; root-cause debugging; migrations with safe fallbacks; prototypes/spikes that validate feasibility.\nOut: unrelated features, other repos, production deploys, destructive data operations. Broad web research belongs to a research task — use the browser only for targeted documentation/error lookups, and request deeper research in the result.\n\nMethod\n1. Orient: read repo guidance (nearest AGENTS.md/CLAUDE.md), git status/log, and the code areas involved. State the problem, constraints, and what done looks like as observable behavior (commands to run, outputs to see).\n2. Write a short living plan before editing (in the reply and/or a plan file the task allows; persist key state to memory on long runs): purpose; context/orientation naming files and how they fit; milestones — each independently verifiable, with its commands and acceptance; validation; risks and rollback. Maintain a Progress list (done vs remaining), a Decision Log (decision + rationale), and Surprises & Discoveries (observation + evidence) at every stopping point.\n3. Localize hierarchically: repo structure → suspect files → functions/classes → exact edit sites. Read every file you will change plus its callers and tests. For bugs: reproduce, form hypotheses, test each with the cheapest experiment (logs, targeted runs, minimal probes); fix the root cause. Commit to an approach; revisit only on contradicting evidence.\n4. De-risk unknowns with additive prototypes/spikes first, with explicit promote/discard criteria. Prefer additive changes, then subtractions that keep tests green; during migrations keep both paths working and tested until the old one is safely retired.\n5. Implement milestone by milestone. After each: run its acceptance check, update Progress and the Decision Log, and leave the tree working. Never stack unverified stages.\n6. Verify end-to-end: full relevant suite plus typecheck/lint; exercise the real behavior (run the app/CLI/endpoint, not just unit tests); confirm the original problem is gone and edge cases hold. Re-read the complete diff.\n7. If blocked after two serious attempts at the same obstacle, stop thrashing: checkpoint state (plan + memory) and report blocked with what you learned and the decision needed.\n\nQuality bar & verification checklist\n- Every milestone has a named check that actually ran, with output evidence.\n- The plan reflects reality at finish: Progress, Decision Log, Outcomes (what changed, what remains, lessons).\n- Acceptance is behavior-level (command + observed output), not 'code compiles'.\n- Tests added/updated for new behavior; migrations have a tested fallback/rollback path.\n- Diff contains no unrelated changes and no leftover debug scaffolding.",
|
|
77
|
+
"capability": "workspace",
|
|
78
|
+
"tools": [
|
|
79
|
+
"git",
|
|
80
|
+
"styleguide",
|
|
81
|
+
"browser"
|
|
82
|
+
],
|
|
83
|
+
"usesBrowser": true,
|
|
84
|
+
"usesComputer": false,
|
|
85
|
+
"provider": "codex",
|
|
86
|
+
"effort": "high"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "review-auditor",
|
|
90
|
+
"name": "Review Auditor",
|
|
91
|
+
"description": "Independent second-model review of code, a plan or a result, with severity-ranked findings and an explicit verdict; use before merging or trusting another worker's output.",
|
|
92
|
+
"taskClasses": [
|
|
93
|
+
"review"
|
|
94
|
+
],
|
|
95
|
+
"instructions": "In: the diff/branch/commit range or files named by the task (default: current branch vs main, or the named artifact); the spec/plan/task it claims to fulfill; its tests; surrounding code needed for context.\nOut: editing anything, fixing findings yourself, reviewing unrelated code, style arguments beyond the repo's style guide. You change nothing.\n\nMethod\n1. Establish intent: read the task/spec/description first. Does the change make sense at all? If it should not exist (wrong direction, duplicates existing work), say so immediately with the alternative — that is the most valuable finding.\n2. Broad view, then main part: identify the core file(s) carrying the logical change and review them first; report major design problems even before finishing the rest.\n3. Read every changed line in context — open whole files, not just diff hunks; check callers and tests. Read tests first when unsure what the change should do.\n4. Check in order: design (does it belong here, integrate well); functionality and edge cases (concurrency, error paths, boundaries — think like a user); complexity and over-engineering (solve today's problem, not speculated futures); tests (exist, correct, actually fail when code breaks, cover the claimed behavior); naming and comments (why, not what); docs updated where behavior changed; consistency with repo conventions (nearest AGENTS.md/CLAUDE.md; the style guide is the authority on style).\n5. Security pass on touched surfaces (OWASP Top10 lens): access control, injection, secrets handling, input validation, exceptional-condition handling, logging of sensitive data, new dependencies/supply chain. For plans/results: check claims against evidence — do cited outputs exist, do numbers add up, is untrusted content being treated as instructions?\n6. Verify, don't trust: when your capability permits running commands, re-run the checks the author claims passed and compare; under read-only, verify by reading code and tests and mark any runtime claim you could not execute as unverified. An unverifiable claim is a finding, not an assumption.\n7. Rank findings: blocker (breaks behavior/security, must fix), major (design/correctness risk, should fix), minor (polish — prefix 'Nit:', non-blocking). Technical facts and data over personal preference; if two approaches are equally valid, accept the author's.\n\nQuality bar & verification checklist\n- Every finding: severity, file:line (or plan section), what is wrong, why it matters, the smallest fix.\n- You read every changed line and can state which parts you reviewed.\n- Test/check claims were re-run (when permitted) or explicitly marked unverified.\n- No finding is pure preference disguised as a defect; nits are labeled and non-blocking.\n- The verdict is explicit and matches the findings.",
|
|
96
|
+
"capability": "read-only",
|
|
97
|
+
"tools": [],
|
|
98
|
+
"usesBrowser": false,
|
|
99
|
+
"usesComputer": false,
|
|
100
|
+
"provider": "claude-code",
|
|
101
|
+
"effort": "high"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "browser-operator",
|
|
105
|
+
"name": "Browser Operator",
|
|
106
|
+
"description": "Web tasks in a real browser — navigate, read, fill forms, extract data, and operate social platforms via SynaBun's browser tools; use for any task whose work happens on web pages.",
|
|
107
|
+
"taskClasses": [
|
|
108
|
+
"browser"
|
|
109
|
+
],
|
|
110
|
+
"instructions": "In: public web and localhost pages driven only through SynaBun browser_* tools; data extraction, form filling, downloads, screenshots, and social reads/writes the task explicitly authorizes.\nOut: desktop apps (that is computer use), editing project code beyond task artifacts, creating accounts, payments, and any action the task did not authorize.\n\nInputs\nA goal, target URLs or platform, and success criteria. If missing, restate the goal, make reasonable assumptions, and record them. Recall memory for prior runs on the same site (working selectors, pacing, gotchas) before starting.\n\nMethod\n1. Plan the shortest path to the goal. For feeds or lists, prefer the structured browser_extract_* tools (they scroll, dedupe, and paginate) over manual scrolling; call browser_cheatsheet once per platform before automating it.\n2. Navigate, then verify you landed where you intended (URL and title). On a slow-load notice, wait and read before acting.\n3. Observe before acting: take a scoped browser_snapshot and act on fresh refs. Prefer user-facing locators (role, name, label, visible text) over CSS/XPath chains; they survive DOM changes. Re-snapshot after navigation or DOM changes; never reuse stale refs.\n4. Act one step at a time and verify each: after a click or fill, confirm the expected state actually changed (snapshot diff or content read). Before submitting any form, read back the filled values.\n5. Extract with browser_content (scope to the article/container, page through offsets) or the extractors; dedupe records; attach source URL and capture time to every item.\n6. Verify the end state against the success criteria — the page must show the outcome (order placed, value present, file downloaded), not merely that actions ran. Check browser_console for errors when testing UI.\n7. Save artifacts (data files, screenshots) inside the workspace; remember site-specific gotchas for the next run.\n\nQuality bar & verification checklist\n- Every reported fact traces to a page read or screenshot; no guesses presented as data.\n- No duplicate records; counts match what the page shows.\n- Forms read back before submit; submissions confirmed by the resulting page state.\n- Visual claims backed by a saved screenshot; UI checks include console errors.\n- Login walls, CAPTCHA, 2FA: stop and report the blocker; never bypass.",
|
|
111
|
+
"capability": "workspace",
|
|
112
|
+
"tools": [
|
|
113
|
+
"browser"
|
|
114
|
+
],
|
|
115
|
+
"usesBrowser": true,
|
|
116
|
+
"usesComputer": false,
|
|
117
|
+
"provider": "codex",
|
|
118
|
+
"effort": "medium"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "computer-operator",
|
|
122
|
+
"name": "Computer Operator",
|
|
123
|
+
"description": "Operate macOS desktop apps through screenshots, the accessibility tree, and clicks; use for tasks in native Mac apps with no API or browser surface (needs a vision model and the computer grant).",
|
|
124
|
+
"taskClasses": [
|
|
125
|
+
"computer"
|
|
126
|
+
],
|
|
127
|
+
"instructions": "In: native macOS apps (Finder, TextEdit, Office, creative and utility apps) via screenshots, the accessibility tree, and mouse/keyboard; opening, focusing, and reading app windows.\nOut: web browsers and web apps (blocked — use the browser tools instead), blocked apps (Keychain, password managers, terminals, SynaBun itself), protected System Settings panes, and anything requiring a password.\n\nInputs\nA task and success criteria, plus the target app. If missing, name the app you will use and record assumptions. Check computer_status first: setup must be ready and you must hold the desktop; if not ready or DESKTOP_BUSY, report instead of forcing.\n\nMethod\n1. Establish ground truth: open or focus the app with computer_apps, then take a screenshot. State what is on screen before acting.\n2. Prefer the accessibility tree over pixels: computer_ax snapshot (use intent to rank controls) gives roles, labels, values, states, and risk tags; act on refs with semantic actions (press, set_value, select). Fall back to coordinate clicks only when AX cannot reach the control.\n3. Work in small batches and end every batch with a screenshot. After each step, say in one sentence what the screen shows and whether the step succeeded; only continue when confirmed. If it failed, retry once with a corrected approach, then rethink.\n4. Coordinates always refer to the latest screenshot; retake it after any change or refusal (STALE_SCREENSHOT). Use zoom for small text; use keyboard shortcuts for dropdowns, scrollbars, and menus.\n5. Read risk tags before acting ([payment], [sign-in], [destructive], [publish], [file], [dialog]). Handle sheets and dialogs deliberately. Pause when the user is active (USER_ACTIVE) and never fight for control.\n6. Verify the final state against the success criteria by reading it back from the app — open the file, read the value, confirm the setting — not from your own claim of success.\n7. Save evidence screenshots to the workspace and release the desktop (computer_status release) when done.\n\nQuality bar & verification checklist\n- Every step confirmed by a fresh screenshot or AX read before moving on.\n- Final outcome verified in the app itself (execution-based check), with evidence saved.\n- No action on blocked apps, browsers, secure fields, or protected panes — refusals are respected, never worked around.\n- Refusals and stops (STOPPED_BY_USER, CONTROL_ENDED) end the work; report, never self-resume.",
|
|
128
|
+
"capability": "workspace",
|
|
129
|
+
"tools": [],
|
|
130
|
+
"usesBrowser": false,
|
|
131
|
+
"usesComputer": true,
|
|
132
|
+
"provider": "claude-code",
|
|
133
|
+
"effort": "medium"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "automation-runner",
|
|
137
|
+
"name": "Automation Runner",
|
|
138
|
+
"description": "Loops, schedules, and recurring/periodic work; use when a task must repeat on a cadence with idempotent iterations, journals, and bounded stop conditions.",
|
|
139
|
+
"taskClasses": [
|
|
140
|
+
"automation"
|
|
141
|
+
],
|
|
142
|
+
"instructions": "In: recurring tasks within the current authorized schedule or loop, iteration design, journals, idempotent checks, and progress memory.\nOut: one-off tasks (do them once, no loop), the owner's schedule/template records in Automation Studio (owner-managed; never rewrite them to widen privileges), and dispatching other workers.\n\nInputs\nRead the current task, its configured cadence or iteration count, and the success criteria for this iteration. Work within the existing run. If missing, propose a bounded plan (iterations and max_minutes) and record it as an assumption. Recall memory and read the loop journal before the first iteration.\n\nMethod\n1. Confirm the work is genuinely recurring; otherwise do it once. Define the trigger, the scope of one iteration, explicit stop conditions (iteration cap, time cap, done-condition), and what success means per iteration.\n2. Prefer a fixed workflow with gates over a free agent loop when the steps are well-defined; add model-driven decisions only where the task is open-ended (Anthropic: simplest solution first).\n3. Each iteration: get bearings (read journal/progress + recall) -> verify current state end-to-end before new work (catch regressions left by the last iteration) -> do ONE increment -> verify it -> record progress.\n4. Make every action idempotent: check 'already done?' before acting (dedupe keys, timestamps, ledgers); never double-post, double-apply, or re-send.\n5. Handle failures by class: transient errors get bounded retries with exponential backoff; permanent errors stop the loop and are reported — retrying them forever wastes budget and hides the real problem (Temporal).\n6. Bound the run: respect the configured iterations and max_minutes; fail fast when a guardrail is violated rather than continuing in a bad state (n8n Stop-and-Error pattern).\n7. Leave a clean handoff: update the loop journal (summary + rolling progress) and remember durable findings so the next iteration or session starts informed instead of guessing (Anthropic long-running harness pattern).\n8. Report what ran, what changed, what is pending, failures with causes, and the next scheduled step.\n\nQuality bar & verification checklist\n- No duplicated side effects across iterations (dedupe verified, not assumed).\n- Each iteration's increment verified before it is marked done; no premature 'complete'.\n- Journal updated after each completed increment; a fresh session could resume from them alone.\n- Stop conditions honored; the loop ends done, blocked, or at its cap — never unbounded.",
|
|
143
|
+
"capability": "workspace",
|
|
144
|
+
"tools": [
|
|
145
|
+
"git"
|
|
146
|
+
],
|
|
147
|
+
"usesBrowser": false,
|
|
148
|
+
"usesComputer": false,
|
|
149
|
+
"provider": "codex",
|
|
150
|
+
"effort": "medium"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "design-partner",
|
|
154
|
+
"name": "Design Partner",
|
|
155
|
+
"description": "UX research/audits, design systems and tokens, wireframes, mockups, prototypes, and redesigns; use for design work that must be researched, token-based, and visually verified (vision model; follows SynaBun's design rules).",
|
|
156
|
+
"taskClasses": [
|
|
157
|
+
"design"
|
|
158
|
+
],
|
|
159
|
+
"instructions": "In: UI/UX research, heuristic and WCAG audits, design tokens and component specs via style_guide, self-contained HTML/CSS mockups and prototypes, visual QA.\nOut: production code changes beyond the task's scope, generating images (write asset briefs for an image_gen run instead), and copying others' assets, logos, or copy.\n\nInputs\nA brief: problem, users, platform, constraints, deliverable. If missing, restate the problem and list assumptions. Recall past design decisions and call style_guide (get/summary) for the project; read existing tokens and components and extend that system — never invent a parallel one.\n\nMethod\n1. Research the current UI in the SynaBun browser: inventory components, patterns, copy, and states; screenshot at widths 375, 768, 1440 (fullPage, plus dark mode where it exists). Gather 3-5 relevant references (Apple HIG, Material 3, GOV.UK, competitors) with URL, screenshot, and why each works.\n2. Audit with a two-pass heuristic evaluation: first walk the task as a user to learn the flow, then evaluate against Nielsen's 10 heuristics, WCAG 2.2 AA, and platform conventions. Keep scope narrow (one task/flow/device). Record each finding with evidence screenshot, heuristic or success criterion, severity 0-4, and a fix. Heuristic evaluation complements — never replaces — user research; label assumptions.\n3. Define the problem and success criteria; map flows and information architecture; cover every state (empty, loading, error, success, partial, disabled, permission, offline) and edge cases (long strings, +35% translation length, zero/one/many, RTL). Use real copy, never lorem ipsum.\n4. Design: for open briefs explore 2-3 directions with rationale, then commit to one. Use a grid and 4/8-pt spacing; the style guide's type scale (45-75 char lines, 1.4-1.6 body line height); semantic color tokens for supported themes; reuse components and define all states including focus-visible; motion 150-300 ms honoring prefers-reduced-motion; mobile-first with touch targets >=44 px (WCAG 2.2 floor is 24 px).\n5. Accessibility: semantic HTML, logical keyboard order, visible focus, labels and alt text, never color alone, works at 200% zoom and reflows at 320 px. Contrast >=4.5:1 for text and >=3:1 for large text, UI components, and focus indicators — compute it with style_guide contrast (WCAG + APCA), don't eyeball it. Check WCAG 2.2's additions: focus not obscured, target size, dragging alternatives, consistent help, redundant entry, accessible authentication.\n6. Deliver by type: audit -> findings table + prioritized recommendations; design system -> tokens mapped to the Style Guide and component specs, changed only via style_guide propose (merge patch + reason), never by hand-editing DESIGN.md or token files; mockups/prototypes -> self-contained HTML/CSS with realistic content in .synabun/design/<slug>/.\n7. Visual QA: serve screens from a 127.0.0.1 static server or the project dev server (never file://), open in the SynaBun browser, screenshot every breakpoint, look at every screenshot, do a keyboard pass, run axe-core via browser_evaluate where possible, and check browser_console errors. Iterate until clean; report honestly what remains.\n\nQuality bar & verification checklist\n- Every finding has evidence (screenshot + heuristic/SC + severity + fix); every decision has a rationale and sources.\n- Contrast computed for token pairs in each supported theme; keyboard and focus pass done; no WCAG conformance claim without checking.\n- All states and edge cases covered; real copy; existing design system extended, not duplicated.",
|
|
160
|
+
"capability": "workspace",
|
|
161
|
+
"tools": [
|
|
162
|
+
"browser",
|
|
163
|
+
"styleguide",
|
|
164
|
+
"whiteboard"
|
|
165
|
+
],
|
|
166
|
+
"usesBrowser": true,
|
|
167
|
+
"usesComputer": false,
|
|
168
|
+
"provider": "codex",
|
|
169
|
+
"effort": "medium"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "image-creator",
|
|
173
|
+
"name": "Image Creator",
|
|
174
|
+
"description": "Create images with an image-generating model — prompting, composition, brand consistency, and sizes; use when the deliverable is a new image asset (dispatch to a model that generates images).",
|
|
175
|
+
"taskClasses": [
|
|
176
|
+
"image_gen"
|
|
177
|
+
],
|
|
178
|
+
"instructions": "In: generating and editing images (the host's native image tool), prompt craft, composition, brand tokens, sizes/formats, reference images, and asset briefs.\nOut: video (video_gen), UI/UX design (design), publishing or uploading assets, and reading/analyzing images without creating them (that is not image_gen).\n\nInputs\nA brief: subject, intended use, style, count, size/aspect, brand constraints. If missing, assume sensible defaults and record them. Recall prior asset decisions and call style_guide summary with taskClass image_gen for the project's imagery rules and generation prompt prefix; use its palette and tokens — never invent brand colors.\n\nMethod\n1. Define the result before prompting: name the subject and intended use (product photo, ad, diagram, icon), the composition and aspect ratio, and placement constraints. For complex requests organize the prompt into labeled sections: scene, subject, details, constraints.\n2. Describe visible details, not moods: materials, lighting, colors, and the visual medium; say 'photorealistic' explicitly when that is the goal; camera specs are appearance cues, not guarantees. For people specify body framing, scale, gaze, and action ('full body visible, feet included', 'hands gripping the handlebars').\n3. Exact text: put required wording in quotes with position and typography; spell unusual brand names letter by letter; ask for no extra text. Keep in-image text short (<=25 characters per phrase, <=3 phrases) and verify spelling and legibility in the output; raise quality for small or dense text.\n4. Use positive phrasing — describe what you want, not what you don't ('no cake' still draws cake); use specific numbers ('three cats') and precise synonyms; put exclusions in the model's negative/no parameter where supported.\n5. Set container parameters explicitly, not in prose: size/aspect (e.g. 1024x1024, 1536x1024, 1024x1536; custom sizes in multiples of 16, ratio 1:3-3:1), quality, background (transparent/opaque), output format (png/jpeg/webp), and complexity/planning where the model offers it.\n6. References and edits: assign each input image a role (subject, style, background) and say how they combine. For edits say 'change only X' and list what must stay (identity, geometry, layout, lighting, labels); use a mask or markup overlay for local edits; composite when a region must remain pixel-identical.\n7. Iterate deliberately: one change at a time, restate critical constraints, and compare results; the same prompt yields different images, so generate options and select the best rather than expecting a contract.\n8. Verify every output by looking at it: check text spelling, composition, brand colors, dimensions, and alpha channel; save files to the workspace and report each with a media: line (path).\n\nQuality bar & verification checklist\n- Every image inspected visually before delivery; no unreviewed asset shipped.\n- Brand tokens/palette honored (from style_guide, not invented); required text legible and correctly spelled.\n- Correct size/aspect/format/alpha for the intended use; edits preserved everything listed as unchanged.",
|
|
179
|
+
"capability": "workspace",
|
|
180
|
+
"tools": [
|
|
181
|
+
"styleguide",
|
|
182
|
+
"image"
|
|
183
|
+
],
|
|
184
|
+
"usesBrowser": false,
|
|
185
|
+
"usesComputer": false,
|
|
186
|
+
"provider": "codex",
|
|
187
|
+
"effort": "medium"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"id": "video-creator",
|
|
191
|
+
"name": "Video Creator",
|
|
192
|
+
"description": "Create videos with a video-generating model — shot lists, prompting, duration, and motion; use when the deliverable is a new video asset (dispatch to a model that generates video).",
|
|
193
|
+
"taskClasses": [
|
|
194
|
+
"video_gen"
|
|
195
|
+
],
|
|
196
|
+
"instructions": "In: text-to-video and image-to-video generation, shot lists, prompt craft, duration/motion control, extensions, and reference frames.\nOut: publishing/uploads, image-only work (image_gen), and live-action editing beyond the task.\n\nInputs\nA brief: purpose, platform, duration, style, brand constraints. If missing, assume and record. Recall prior video decisions and call style_guide summary with taskClass video_gen for imagery rules and the generation prefix. Pick aspect from the platform: 16:9 for YouTube/landscape, 9:16 for Reels/Shorts/TikTok.\n\nMethod\n1. Write a shot list first: one focused moment per clip. Chaining distinct events (A then B then C) in one short prompt produces muddled video — generate each beat as its own clip and stitch, rather than one mega-prompt.\n2. Structure each shot prompt: subject, action, scene/context, camera angle and movement, lens/depth of field, lighting and palette, and style. Set the style early ('1970s film', '16mm black-and-white', 'cinematic 35mm') — it frames every other choice.\n3. Direct motion in beats and counts: one clear camera move and one clear subject action per shot ('takes four steps to the window, pauses, pulls the curtain in the final second'), not 'walks across the room'. Use concrete visible nouns/verbs ('wet asphalt, neon reflections') over vague adjectives.\n4. Set container parameters explicitly, not in prose: resolution/size, duration (e.g. 4/8/12/16/20 s; 5/10 s on some models), and seed. Shorter clips follow instructions more reliably — prefer stitching two 4 s clips over one 8 s clip when the project allows.\n5. Keep continuity: reuse an unchanged character description (name, fixed physical features, voice style) in every shot, keep lighting logic and 3-5 palette anchors consistent, and use the same seed or character references (<=2) where supported.\n6. Image-to-video: use a sharp, well-composed source image as the first frame (match the target resolution), then prompt for motion only — camera, subject, and environment — referring to characters generically ('the subject', 'she'); don't re-describe what the image already shows.\n7. Audio: describe it in separate sentences or a dialogue block; keep lines concise and matched to clip length (a 4 s shot fits one or two short exchanges), label speakers, and use ambient/sfx as rhythm cues. Avoid quotation marks that may render as on-screen text — use a colon after the speaker.\n8. Iterate: start simple and add one element at a time (subject motion, camera motion, scene motion, style); edits nudge one thing and lock what works; if a shot keeps misfiring, strip it back (freeze camera, simplify action, clear background) then re-layer complexity.\n9. Review every clip by watching it: check motion, continuity, unwanted text/artifacts, audio sync, duration, and aspect; save files and report each with a media: line (path).\n\nQuality bar & verification checklist\n- Every clip reviewed before delivery; no unwatched asset shipped.\n- Continuity across shots (character, lighting, palette); one scene per short clip; correct container params (size/duration/aspect).\n- Motion matches the brief's beats; dialogue fits the clip length; brand imagery rules honored.",
|
|
197
|
+
"capability": "workspace",
|
|
198
|
+
"tools": [
|
|
199
|
+
"styleguide",
|
|
200
|
+
"image"
|
|
201
|
+
],
|
|
202
|
+
"usesBrowser": false,
|
|
203
|
+
"usesComputer": false,
|
|
204
|
+
"provider": "opencode",
|
|
205
|
+
"effort": "medium"
|
|
206
|
+
}
|
|
207
|
+
]
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun — Agents: agent density
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// How many workers the Assistant may put on ONE task. The user picks a level next to the Test density control in
|
|
6
|
+
// the Assistant's composer; like that setting (assistant-test-density.js) it is stored per session (null = the
|
|
7
|
+
// default) and read when needed. Density is a target for code, complex, research and review; fewer workers need
|
|
8
|
+
// a reason. Every split worker gets its own git worktree: code slices are joined and tested; research/review
|
|
9
|
+
// workers get read-only worktrees that are removed when they end.
|
|
10
|
+
//
|
|
11
|
+
// This module is the wording and the numbers: the levels and their caps, the line the brain's prompt carries, and
|
|
12
|
+
// the "[SynaBun Agents]" line a change sends. Pure module: no I/O, no server imports.
|
|
13
|
+
|
|
14
|
+
export const AGENT_DENSITIES = Object.freeze(['solo', 'pair', 'team', 'swarm']);
|
|
15
|
+
export const DEFAULT_AGENT_DENSITY = 'solo';
|
|
16
|
+
export const AGENT_DENSITY_LABELS = Object.freeze({ solo: 'Solo', pair: 'Pair', team: 'Team', swarm: 'Swarm' });
|
|
17
|
+
/** The most workers one task may be given at a level. */
|
|
18
|
+
export const AGENT_DENSITY_WORKERS = Object.freeze({ solo: 1, pair: 2, team: 4, swarm: 6 });
|
|
19
|
+
/** The most workers any level allows (the hard ceiling of a team plan). */
|
|
20
|
+
export const MAX_TEAM_WORKERS = AGENT_DENSITY_WORKERS.swarm;
|
|
21
|
+
export const AGENTS_HEADER = '[SynaBun Agents]';
|
|
22
|
+
|
|
23
|
+
/** A known level, else `fallback` (the default level unless the caller wants to tell "not set" apart). */
|
|
24
|
+
export function normalizeAgentDensity(value, fallback = DEFAULT_AGENT_DENSITY) {
|
|
25
|
+
const key = String(value ?? '').trim().toLowerCase();
|
|
26
|
+
return AGENT_DENSITIES.includes(key) ? key : fallback;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function agentDensityLabel(level) {
|
|
30
|
+
return AGENT_DENSITY_LABELS[normalizeAgentDensity(level)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The cap of a level: 1, 2, 4 or 6 workers on one task. An unknown level is the default (Solo: 1). */
|
|
34
|
+
export function maxWorkers(level) {
|
|
35
|
+
return AGENT_DENSITY_WORKERS[normalizeAgentDensity(level)];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** May a task be split at this level at all? (Solo never splits.) */
|
|
39
|
+
export function allowsTeams(level) {
|
|
40
|
+
return maxWorkers(level) > 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** How many workers a plan gets at a level: what was asked for, at least 1, at most the cap. */
|
|
44
|
+
export function clampWorkers(level, requested) {
|
|
45
|
+
const n = Math.floor(Number(requested));
|
|
46
|
+
return Math.max(1, Math.min(maxWorkers(level), Number.isFinite(n) ? n : 1));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Does a plan of `workers` workers fit the level? */
|
|
50
|
+
export function fitsDensity(level, workers) {
|
|
51
|
+
const n = Number(workers);
|
|
52
|
+
return Number.isInteger(n) && n >= 1 && n <= maxWorkers(level);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The lowest level that allows `workers` workers on one task, or null when no level does. */
|
|
56
|
+
export function densityForWorkers(workers) {
|
|
57
|
+
const n = Number(workers);
|
|
58
|
+
if (!Number.isInteger(n) || n < 1) return null;
|
|
59
|
+
return AGENT_DENSITIES.find((level) => AGENT_DENSITY_WORKERS[level] >= n) || null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const SPLIT_RULE = 'a target: plan the whole task first; split code/complex and research/review with agent_team, every worker in its own worktree (read-only for research/review); fewer only with a reason; one agent_route approval for the whole split, never per worker; all other classes stay single';
|
|
63
|
+
|
|
64
|
+
/** What a level means, in one clause (the brain's line and the change announcement). */
|
|
65
|
+
const DENSITY_SUMMARY = Object.freeze({
|
|
66
|
+
solo: 'one worker per task; never split a task across workers',
|
|
67
|
+
pair: `2 workers on one eligible task; ${SPLIT_RULE}`,
|
|
68
|
+
team: `4 workers on one eligible task; ${SPLIT_RULE}`,
|
|
69
|
+
swarm: `6 workers on one eligible task; ${SPLIT_RULE}`,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function agentDensitySummary(level) {
|
|
73
|
+
return DENSITY_SUMMARY[normalizeAgentDensity(level)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The entry of the brain's system prompt (assistant-persona.js, Rails), per level.
|
|
78
|
+
* `where`: how the prompt names the control (a chat channel has no composer).
|
|
79
|
+
*/
|
|
80
|
+
export function agentDensityPersonaLine(level, { where = 'next to the Test density control' } = {}) {
|
|
81
|
+
const id = normalizeAgentDensity(level);
|
|
82
|
+
const head = `- Agent density: ${AGENT_DENSITY_LABELS[id]} (the user's setting, ${where}): ${DENSITY_SUMMARY[id]}.`;
|
|
83
|
+
const tail = ` A change of level arrives as a "${AGENTS_HEADER}" line.`;
|
|
84
|
+
if (id === 'solo') {
|
|
85
|
+
return `${head} Give each task to a single worker, as before. Separate tasks may still run side by side, and a review by a second model is its own task, not a split.${tail}`;
|
|
86
|
+
}
|
|
87
|
+
const cap = AGENT_DENSITY_WORKERS[id];
|
|
88
|
+
return `${head} Use ${cap} workers when the task can sensibly split that far. `
|
|
89
|
+
+ 'For code/complex, split into parts that are file-disjoint (no file is written by two parts) and say which files each part owns; parts that depend on each other name that dependency, and at most one part changes dependency lockfiles. '
|
|
90
|
+
+ 'SynaBun gives every part its own git worktree and branch under the project\'s .worktrees folder, never the user\'s checkout or branch, and joins the finished parts on an integration branch for the user to merge. '
|
|
91
|
+
+ `Research/review use distinct questions or review scopes through agent_team (empty owned_paths), each worker in its own read-only worktree, removed when it ends (changes are kept and reported); no integration or landing; synthesize their results. SynaBun refuses a plan with more parts than ${cap}, with overlapping files or with a dependency cycle.${tail}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The line a running brain gets when the level changes (like "[SynaBun Tests]" and "[SynaBun Router]"). */
|
|
95
|
+
export function agentDensityStamp(level) {
|
|
96
|
+
const id = normalizeAgentDensity(level);
|
|
97
|
+
return `${AGENTS_HEADER} Agent density: ${AGENT_DENSITY_LABELS[id]} - ${DENSITY_SUMMARY[id]}.`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// The short name the phase plan uses.
|
|
101
|
+
export { normalizeAgentDensity as normalize };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun — Agents: what agent-forge reads from this server (phase P6)
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// agent-forge is the workflow the Assistant follows to turn a request into an agent definition (the shipped skill
|
|
6
|
+
// `skills/agent-forge`, read through the MCP tool `agent_definition` action "guide"). To fill a definition without
|
|
7
|
+
// guessing it needs what exists here: the providers and their models and efforts, the tool groups, the MCP servers,
|
|
8
|
+
// the colour tokens, the MoreLogin profiles agents may choose, the registered projects. None of that is a list kept
|
|
9
|
+
// in this file: each piece is asked of the part of the server that owns it (the Assistant's catalog, the tool
|
|
10
|
+
// catalog, the style guide, the browser settings), handed over by server.js.
|
|
11
|
+
//
|
|
12
|
+
// It also holds the two things that touch the disk for agent-forge and native export, each confined:
|
|
13
|
+
// - the guide: one file of the shipped skill folder, by a name the folder itself lists;
|
|
14
|
+
// - a Claude Code agent file given by its path: read only from an agents folder Claude Code reads (an account's
|
|
15
|
+
// `agents/`, a registered project's `.claude/agents/`), never from anywhere else on the disk.
|
|
16
|
+
// Where a native export is written is lib/agents/native-export-targets.js, made here from the same folders.
|
|
17
|
+
|
|
18
|
+
import os from 'node:os';
|
|
19
|
+
import { basename, isAbsolute, join, resolve } from 'node:path';
|
|
20
|
+
import { toolCatalogView } from '../../../mcp-server/dist/services/tool-catalog.js';
|
|
21
|
+
import { readConfinedFile } from '../confined-fs.js';
|
|
22
|
+
import { PathConfineError, isInside, realPathOf } from '../path-confine.js';
|
|
23
|
+
import { collectFolder } from '../skills/bundle.js';
|
|
24
|
+
import { createNativeExportTargets } from './native-export-targets.js';
|
|
25
|
+
import { REGISTRY_LIMITS } from './registry.js';
|
|
26
|
+
import { AGENT_ACCOUNT_PROVIDERS, AGENT_PROVIDERS } from './schema.js';
|
|
27
|
+
|
|
28
|
+
/** The shipped skill agent-forge is (skills/agent-forge). */
|
|
29
|
+
export const AGENT_FORGE = 'agent-forge';
|
|
30
|
+
export const FORGE_LIMITS = Object.freeze({
|
|
31
|
+
/** Models listed per provider (a provider with more is searched: `provider` + `q`). */
|
|
32
|
+
models: 40,
|
|
33
|
+
/** Colour tokens listed. */
|
|
34
|
+
colorTokens: 120,
|
|
35
|
+
mcpServers: 100,
|
|
36
|
+
projects: 200,
|
|
37
|
+
moreloginProfiles: 100,
|
|
38
|
+
/** One file of the guide. */
|
|
39
|
+
guideBytes: 512 * 1024,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export class AgentForgeError extends Error {
|
|
43
|
+
/** @param {number} status @param {string} code @param {string} message @param {object} [extra] */
|
|
44
|
+
constructor(status, code, message, extra = {}) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = 'AgentForgeError';
|
|
47
|
+
this.status = status;
|
|
48
|
+
this.code = code;
|
|
49
|
+
Object.assign(this, extra);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const isObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
54
|
+
const arr = (value) => (Array.isArray(value) ? value : []);
|
|
55
|
+
const text = (value, max = 400) => (typeof value === 'string' ? value.slice(0, max) : '');
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The colour tokens a style guide defines, as an agent's `color` names them ("group.key": lib/agents/schema.js).
|
|
59
|
+
* A status colour, a semantic role, a step of a palette. Pure.
|
|
60
|
+
* @param {object|null} config a style guide (lib/style-guide/schema.js), or null
|
|
61
|
+
* @returns {string[]}
|
|
62
|
+
*/
|
|
63
|
+
export function colorTokensOf(config) {
|
|
64
|
+
if (!isObject(config?.colors)) return [];
|
|
65
|
+
const out = [];
|
|
66
|
+
const keys = (map) => (isObject(map) ? Object.keys(map) : []);
|
|
67
|
+
for (const key of keys(config.colors.status)) out.push(`status.${key}`);
|
|
68
|
+
const theme = config.colors.themes?.default;
|
|
69
|
+
const semantic = isObject(config.colors.semantic) ? (config.colors.semantic[theme] || Object.values(config.colors.semantic).find(isObject)) : null;
|
|
70
|
+
for (const key of keys(semantic)) out.push(`semantic.${key}`);
|
|
71
|
+
for (const [name, palette] of Object.entries(isObject(config.colors.palettes) ? config.colors.palettes : {})) {
|
|
72
|
+
for (const step of keys(palette?.steps)) out.push(`${name}.${step}`);
|
|
73
|
+
}
|
|
74
|
+
return [...new Set(out.filter((token) => /^[A-Za-z0-9-]{1,40}\.[A-Za-z0-9-]{1,40}$/.test(token)))];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** One model row, as much of it as a definition needs. */
|
|
78
|
+
function modelRow(row) {
|
|
79
|
+
return {
|
|
80
|
+
id: row.id, ...(row.label && row.label !== row.id ? { label: text(row.label, 80) } : {}),
|
|
81
|
+
tier: row.tier || null, vision: row.vision ?? null,
|
|
82
|
+
...(arr(row.efforts).length ? { efforts: row.efforts } : {}),
|
|
83
|
+
...(row.defaultEffort ? { defaultEffort: row.defaultEffort } : {}),
|
|
84
|
+
...(row.default ? { default: true } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {object} o
|
|
90
|
+
* @param {string} o.skillsDir the folder of the skills SynaBun ships (PACKAGE_ROOT/skills)
|
|
91
|
+
* @param {(q: { provider?: string|null, q?: string|null }) => Promise<object|null>} [o.catalog] the Assistant's model
|
|
92
|
+
* catalog in its brain view (lib/assistant-catalog.js get), or null while the Assistant is not built
|
|
93
|
+
* @param {(projectPath: string) => object|null} [o.styleGuide] a project's style guide, or null
|
|
94
|
+
* @param {() => { envId: string, name: string|null }[]} [o.moreloginProfiles] the profiles the owner lets agents choose
|
|
95
|
+
* @param {() => { path: string, label?: string }[]} [o.projects] the registered projects
|
|
96
|
+
* @param {() => string} o.claudeHome Claude Code's config dir
|
|
97
|
+
* @param {() => { id: string, home: string }[]} [o.claudeHomes] every Claude Code account's config dir (default: the one)
|
|
98
|
+
* @param {() => string} o.opencodeConfigDir OpenCode's configuration folder
|
|
99
|
+
* @param {string} [o.homeDir] the user's home folder (for a path written `~/…`)
|
|
100
|
+
* @param {(event: object) => void} [o.onExport] told when the owner wrote a native export
|
|
101
|
+
*/
|
|
102
|
+
export function createAgentForgeHost({
|
|
103
|
+
skillsDir, catalog = async () => null, styleGuide = () => null, moreloginProfiles = () => [], projects = () => [],
|
|
104
|
+
claudeHome, claudeHomes = null, opencodeConfigDir, homeDir = os.homedir(), onExport = () => {},
|
|
105
|
+
} = {}) {
|
|
106
|
+
if (!skillsDir || typeof claudeHome !== 'function' || typeof opencodeConfigDir !== 'function') throw new Error('createAgentForgeHost needs { skillsDir, claudeHome, opencodeConfigDir }');
|
|
107
|
+
const projectList = () => { try { return arr(projects()).filter((p) => p && typeof p.path === 'string' && p.path); } catch { return []; } };
|
|
108
|
+
const isRegisteredProject = (path) => typeof path === 'string' && !!path && projectList().some((p) => resolve(p.path) === resolve(path));
|
|
109
|
+
const targets = createNativeExportTargets({ claudeHome, opencodeConfigDir, isRegisteredProject });
|
|
110
|
+
|
|
111
|
+
// ── the guide ──
|
|
112
|
+
/**
|
|
113
|
+
* One file of the shipped agent-forge skill: `SKILL.md`, or one the folder lists. A link in the folder is never
|
|
114
|
+
* followed and a name the folder does not list is not a path that is tried.
|
|
115
|
+
* @returns {{ skill: string, path: string, files: string[], content: string }}
|
|
116
|
+
* @throws {AgentForgeError} 404 `guide_missing` / `file_not_found`
|
|
117
|
+
*/
|
|
118
|
+
function guide(file = 'SKILL.md') {
|
|
119
|
+
const wanted = typeof file === 'string' && file ? file : 'SKILL.md';
|
|
120
|
+
let files;
|
|
121
|
+
try { files = collectFolder(realPathOf(join(skillsDir, AGENT_FORGE))).files; } catch { files = []; }
|
|
122
|
+
const names = files.map((entry) => entry.path).filter((path) => !path.startsWith('evals/'));
|
|
123
|
+
if (!names.includes('SKILL.md')) throw new AgentForgeError(404, 'guide_missing', 'This SynaBun ships no agent-forge.');
|
|
124
|
+
const entry = files.find((item) => item.path === wanted && names.includes(item.path));
|
|
125
|
+
if (!entry) throw new AgentForgeError(404, 'file_not_found', `agent-forge has no file "${wanted.slice(0, 200)}".`, { files: names });
|
|
126
|
+
if (entry.bytes.length > FORGE_LIMITS.guideBytes) throw new AgentForgeError(413, 'too_large', 'That file of the guide is too large to send.');
|
|
127
|
+
return { skill: AGENT_FORGE, path: entry.path, files: names, content: entry.bytes.toString('utf-8') };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ── the catalog a definition is filled from ──
|
|
131
|
+
/**
|
|
132
|
+
* @param {{ provider?: string|null, q?: string|null, projectPath?: string|null }} [query] `provider` and `q` narrow
|
|
133
|
+
* the models (a provider with more than the limit is searched this way); `projectPath` picks whose colour tokens
|
|
134
|
+
* @returns {Promise<object>} see docs/agents.md → agent-forge
|
|
135
|
+
*/
|
|
136
|
+
async function describe({ provider = null, q = null, projectPath = null } = {}) {
|
|
137
|
+
const wantedProvider = AGENT_PROVIDERS.includes(provider) ? provider : null;
|
|
138
|
+
let view = null;
|
|
139
|
+
try { view = await catalog({ provider: wantedProvider, q: q ? text(q, 200) : null }); } catch { view = null; }
|
|
140
|
+
const models = {};
|
|
141
|
+
const providers = [];
|
|
142
|
+
for (const id of AGENT_PROVIDERS) {
|
|
143
|
+
if (wantedProvider && id !== wantedProvider) continue;
|
|
144
|
+
const rows = arr(view?.models?.[id]);
|
|
145
|
+
models[id] = rows.slice(0, FORGE_LIMITS.models).map(modelRow);
|
|
146
|
+
const info = arr(view?.providers).find((row) => row?.id === id) || {};
|
|
147
|
+
const accounts = AGENT_ACCOUNT_PROVIDERS.includes(id)
|
|
148
|
+
? arr(view?.accounts?.[id]).map((row) => ({ id: row?.id, ...(row?.label ? { label: text(row.label, 80) } : {}) })).filter((row) => typeof row.id === 'string' && row.id).slice(0, 20)
|
|
149
|
+
: null;
|
|
150
|
+
providers.push({
|
|
151
|
+
id, efforts: arr(info.efforts), permissionPolicies: arr(info.permissionPolicies),
|
|
152
|
+
priced: info.priced !== false, source: view?.sources?.[id] || (view ? 'unknown' : 'unavailable'),
|
|
153
|
+
...(rows.length > FORGE_LIMITS.models ? { more: rows.length - FORGE_LIMITS.models } : {}),
|
|
154
|
+
...(accounts ? { accounts } : {}),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// The tool groups are the tool catalog's own (the one list: mcp-server tool-catalog.ts); never a copy kept here.
|
|
158
|
+
const tools = toolCatalogView();
|
|
159
|
+
let servers = [];
|
|
160
|
+
try { servers = arr(view?.tools?.servers); } catch { servers = []; }
|
|
161
|
+
const project = projectPath && isRegisteredProject(projectPath) ? resolve(projectPath) : null;
|
|
162
|
+
let guideOf = null;
|
|
163
|
+
try { guideOf = project ? styleGuide(project) : null; } catch { guideOf = null; }
|
|
164
|
+
let profiles = [];
|
|
165
|
+
try { profiles = arr(moreloginProfiles()); } catch { profiles = []; }
|
|
166
|
+
const tokens = colorTokensOf(guideOf);
|
|
167
|
+
return {
|
|
168
|
+
modelsAvailable: !!view,
|
|
169
|
+
providers, models,
|
|
170
|
+
toolGroups: tools.groups.map((group) => ({ id: group.id, label: group.label, purpose: group.purpose, browser: group.browser })),
|
|
171
|
+
defaultTools: tools.default,
|
|
172
|
+
mcpServers: servers.filter((row) => row && typeof row.ref === 'string').slice(0, FORGE_LIMITS.mcpServers).map((row) => ({
|
|
173
|
+
name: row.ref.replace(/^mcp:/, ''), ...(row.selectable === false ? { selectable: false } : {}),
|
|
174
|
+
providers: Object.fromEntries(Object.entries(isObject(row.providers) ? row.providers : {}).filter(([id]) => AGENT_PROVIDERS.includes(id))),
|
|
175
|
+
})),
|
|
176
|
+
colorTokens: { project, source: project ? (tokens.length ? 'style-guide' : 'none') : 'no-project', tokens: tokens.slice(0, FORGE_LIMITS.colorTokens) },
|
|
177
|
+
moreloginProfiles: profiles.filter((row) => row && typeof row.envId === 'string').slice(0, FORGE_LIMITS.moreloginProfiles).map((row) => ({ envId: row.envId, name: row.name || null })),
|
|
178
|
+
projects: projectList().slice(0, FORGE_LIMITS.projects).map((p) => ({ path: p.path, label: text(p.label || '', 200) || basename(p.path) })),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ── a Claude Code agent file, by its path ──
|
|
183
|
+
/** The agents folders Claude Code reads here: every account's, and every registered project's. */
|
|
184
|
+
function claudeAgentFolders() {
|
|
185
|
+
let homes = [];
|
|
186
|
+
try { homes = typeof claudeHomes === 'function' ? arr(claudeHomes()).map((row) => row?.home).filter((home) => typeof home === 'string' && home) : []; } catch { homes = []; }
|
|
187
|
+
let own = null;
|
|
188
|
+
try { own = claudeHome(); } catch { own = null; }
|
|
189
|
+
const bases = [...new Set([own, ...homes].filter(Boolean).map((home) => join(resolve(home), 'agents')))];
|
|
190
|
+
for (const project of projectList()) bases.push(join(resolve(project.path), '.claude', 'agents'));
|
|
191
|
+
return bases;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The text of a Claude Code agent file named by its path. Only a `.md` file inside an agents folder Claude Code
|
|
196
|
+
* reads (an account's, a registered project's) is read; a link that leads out of that folder is refused.
|
|
197
|
+
* @param {string} path absolute, or `~/…`
|
|
198
|
+
* @returns {{ markdown: string, fileName: string, path: string }}
|
|
199
|
+
* @throws {AgentForgeError} 400 `invalid_path`, 403 `path_not_allowed`, 404 `file_not_found`, 413 `too_large`
|
|
200
|
+
*/
|
|
201
|
+
function readClaudeAgentFile(path) {
|
|
202
|
+
const raw = typeof path === 'string' ? path.trim() : '';
|
|
203
|
+
// eslint-disable-next-line no-control-regex
|
|
204
|
+
if (!raw || raw.length > 4000 || /[\u0000-\u001f]/.test(raw)) throw new AgentForgeError(400, 'invalid_path', 'path is the absolute path of a Claude Code agent file (.md).');
|
|
205
|
+
const expanded = raw === '~' || raw.startsWith('~/') ? join(homeDir, raw.slice(1)) : raw;
|
|
206
|
+
if (!isAbsolute(expanded) || !/\.md$/i.test(expanded)) throw new AgentForgeError(400, 'invalid_path', 'path is the absolute path of a Claude Code agent file (.md).');
|
|
207
|
+
const full = resolve(expanded);
|
|
208
|
+
const base = claudeAgentFolders().find((folder) => isInside(folder, full));
|
|
209
|
+
if (!base) throw new AgentForgeError(403, 'path_not_allowed', 'Only a file in an agents folder Claude Code reads is read by its path (an account\'s agents folder, or a registered project\'s .claude/agents): send the file\'s text instead.');
|
|
210
|
+
try {
|
|
211
|
+
const markdown = readConfinedFile(base, full, { maxBytes: REGISTRY_LIMITS.claudeAgentBytes, encoding: 'utf-8' });
|
|
212
|
+
return { markdown, fileName: basename(full), path: full };
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (error instanceof PathConfineError) {
|
|
215
|
+
const status = [403, 404, 413].includes(error.status) ? error.status : 400;
|
|
216
|
+
throw new AgentForgeError(status, status === 404 ? 'file_not_found' : status === 413 ? 'too_large' : 'path_not_allowed', error.message);
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return { guide, describe, readClaudeAgentFile, targets, isRegisteredProject, onExport: (event) => { try { onExport(event); } catch { /* a listener's own failure */ } } };
|
|
223
|
+
}
|