synabun 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/browser-extension/content.js +169 -0
- package/browser-extension/engine.js +477 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +244 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +165 -0
- package/browser-extension/popup.html +105 -0
- package/browser-extension/popup.js +347 -0
- package/browser-extension/protocol.js +226 -0
- package/browser-extension/service-worker.js +267 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +94 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +91 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +161 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +190 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +175 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1117 -47
- package/neural-interface/i18n/pt-BR.json +1117 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +840 -0
- package/neural-interface/lib/agents/resolve.js +544 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +229 -102
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +384 -42
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +440 -93
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +255 -0
- package/neural-interface/lib/browser-extension-bridge.js +418 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +194 -8
- package/neural-interface/lib/native-loop-runtime.js +20 -0
- package/neural-interface/lib/opencode-build-preflight.js +16 -1
- package/neural-interface/lib/opencode-native-boundary.js +83 -13
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +60 -21
- package/neural-interface/lib/process-identity.js +68 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +52 -12
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +36 -6
- package/neural-interface/public/shared/assistant/asst-route.js +78 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +33 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +682 -50
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +12 -1
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +355 -400
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +5 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +21 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1050 -140
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — Agents Studio: the editor's form
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// One field for every content field of an agent definition, in five sections (who it is, its instructions, what it
|
|
6
|
+
// runs on, what it may touch, where and what for), with the privilege summary beside it: what this agent may do,
|
|
7
|
+
// and what differs from the last approved revision. As the owner types, the server checks the definition
|
|
8
|
+
// (POST /validate, a moment after the last key) and its answer is written under the field it is about: an error
|
|
9
|
+
// in the status' danger colour, a softer finding in its warning colour. Nothing here decides what is valid.
|
|
10
|
+
//
|
|
11
|
+
// Every choice is the app's dropdown, fed from what the app already knows (ax-options.js); the lists arrive after
|
|
12
|
+
// the form is drawn (the model catalog, the tool catalog, the allowed MoreLogin profiles, the skills, the memory
|
|
13
|
+
// categories), and a value that was saved stays in its dropdown until then and after. Typing never redraws the
|
|
14
|
+
// form: only a choice that changes what other fields offer does (the provider, the model, the browser switch), and
|
|
15
|
+
// the keyboard stays where it was.
|
|
16
|
+
|
|
17
|
+
import { html, setHTML, attr, ICONS } from '../../skills/studio/sx-dom.js';
|
|
18
|
+
import { wireDropdowns, controlOf, setDropdownItems } from '../../cc-dropdown.js';
|
|
19
|
+
import { FORM_SECTIONS, applyField, countOf, definitionOf, issuesByField, issueCounts, isDirty } from './ax-form.js';
|
|
20
|
+
import { enumEntries, multiEntries, multiValue, modelEntries, modelRow, effortEntries, accountEntries, scopeEntries, scopeFromValue, profileEntries, profileAllowed, skillEntries, categoryEntries, toolGroupChoices, toolsFromChoice, serverEntries, serversFromChoice } from './ax-options.js';
|
|
21
|
+
import { AGENT_ICONS, COLOR_TOKENS, agentIcon, knownIcon, toneOf } from './ax-icons.js';
|
|
22
|
+
import { field, dropdown, issuesHTML, privilegeHTML, wordsOf, wordOr } from './ax-ui.js';
|
|
23
|
+
|
|
24
|
+
let life = null;
|
|
25
|
+
|
|
26
|
+
export function leaveEditorPanel() {
|
|
27
|
+
life?.abort();
|
|
28
|
+
life = null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const limitOf = (ctx, name) => Number(ctx.info?.limits?.[name]) || null;
|
|
32
|
+
const countText = (value, limit) => { const c = countOf(value, limit); return c.limit ? `${c.length} / ${c.limit}` : String(c.length); };
|
|
33
|
+
|
|
34
|
+
/** The definition the form stands for (an open agent keeps its id and scope whatever the form says). */
|
|
35
|
+
export function formDefinition(ed) {
|
|
36
|
+
const def = definitionOf(ed.form);
|
|
37
|
+
if (ed.mode === 'agent' && ed.key) { def.id = ed.key.id; def.scope = ed.key.scope; }
|
|
38
|
+
return def;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ── Sections ──
|
|
42
|
+
|
|
43
|
+
function identityHTML(ctx, ed, ro) {
|
|
44
|
+
const { t } = ctx;
|
|
45
|
+
const f = ed.form;
|
|
46
|
+
const icons = html`<div class="ax-swatches" role="radiogroup" aria-labelledby="ax-e-icon-label">
|
|
47
|
+
<button type="button" class="ax-swatch ax-swatch--none" role="radio" aria-checked="${f.icon ? 'false' : 'true'}" tabindex="${knownIcon(f.icon) ? '-1' : '0'}" data-act="pick-icon" data-value="" title="${t('agentsStudio.editor.iconDefault')}" aria-label="${t('agentsStudio.editor.iconDefault')}"${attr('disabled', ro)}>${ICONS.off}</button>
|
|
48
|
+
${AGENT_ICONS.map((name) => html`<button type="button" class="ax-swatch" role="radio" aria-checked="${f.icon === name ? 'true' : 'false'}" tabindex="${f.icon === name ? '0' : '-1'}" data-act="pick-icon" data-value="${name}" title="${name}" aria-label="${name}"${attr('disabled', ro)}>${agentIcon(name, 18)}</button>`)}
|
|
49
|
+
</div>${f.icon && !knownIcon(f.icon) ? html`<p class="sx-field-note">${t('agentsStudio.editor.iconUnknown', { name: f.icon })}</p>` : ''}`;
|
|
50
|
+
const colors = html`<div class="ax-swatches" role="radiogroup" aria-labelledby="ax-e-color-label">
|
|
51
|
+
<button type="button" class="ax-swatch ax-swatch--none" role="radio" aria-checked="${f.color ? 'false' : 'true'}" tabindex="${toneOf(f.color) === 'neutral' ? '0' : '-1'}" data-act="pick-color" data-value="" title="${t('agentsStudio.editor.colorDefault')}" aria-label="${t('agentsStudio.editor.colorDefault')}"${attr('disabled', ro)}>${ICONS.off}</button>
|
|
52
|
+
${COLOR_TOKENS.map((c) => html`<button type="button" class="ax-swatch ax-swatch--tone ax-tone--${c.tone}" role="radio" aria-checked="${f.color === c.token ? 'true' : 'false'}" tabindex="${f.color === c.token ? '0' : '-1'}" data-act="pick-color" data-value="${c.token}" title="${wordOr(t, 'agentsStudio.color', c.tone)} (${c.token})" aria-label="${wordOr(t, 'agentsStudio.color', c.tone)}"${attr('disabled', ro)}><span class="ax-swatch-dot" aria-hidden="true"></span></button>`)}
|
|
53
|
+
</div>${f.color && toneOf(f.color) === 'neutral' ? html`<p class="sx-field-note">${t('agentsStudio.editor.colorUnknown', { token: f.color })}</p>` : ''}`;
|
|
54
|
+
return html`
|
|
55
|
+
${field({ id: 'ax-e-name', label: t('agentsStudio.field.name'), field: 'name', required: true, count: countText(f.name, limitOf(ctx, 'name')),
|
|
56
|
+
control: html`<input type="text" class="sx-input" id="ax-e-name" data-form-field="name" value="${f.name}" aria-labelledby="ax-e-name-label" aria-describedby="ax-e-name-issues" autocomplete="off" spellcheck="true"${attr('disabled', ro)}${ed.mode === 'new' ? attr('data-autofocus', true) : ''}>` })}
|
|
57
|
+
${field({ id: 'ax-e-id', label: t('agentsStudio.field.id'), field: 'id', required: true, help: ed.mode === 'new' ? t('agentsStudio.editor.idHelp') : t('agentsStudio.editor.idFixed'),
|
|
58
|
+
control: html`<input type="text" class="sx-input sx-mono" id="ax-e-id" data-form-field="id" value="${f.id}" aria-labelledby="ax-e-id-label" aria-describedby="ax-e-id-help ax-e-id-issues" autocomplete="off" spellcheck="false" autocapitalize="off"${attr('disabled', ro || ed.mode !== 'new')}>` })}
|
|
59
|
+
${field({ id: 'ax-e-description', label: t('agentsStudio.field.description'), field: 'description', wide: true, help: t('agentsStudio.editor.descriptionHelp'), count: countText(f.description, limitOf(ctx, 'description')),
|
|
60
|
+
control: html`<textarea class="sx-input sx-textarea ax-desc" id="ax-e-description" data-form-field="description" rows="2" aria-labelledby="ax-e-description-label" aria-describedby="ax-e-description-help ax-e-description-issues"${attr('disabled', ro)}>${f.description}</textarea>` })}
|
|
61
|
+
${field({ id: 'ax-e-icon', label: t('agentsStudio.field.icon'), field: 'icon', control: icons })}
|
|
62
|
+
${field({ id: 'ax-e-color', label: t('agentsStudio.field.color'), field: 'color', help: t('agentsStudio.editor.colorHelp'), control: colors })}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function instructionsHTML(ctx, ed, ro) {
|
|
66
|
+
const { t } = ctx;
|
|
67
|
+
return field({ id: 'ax-e-instructions', label: t('agentsStudio.field.instructions'), field: 'instructions', wide: true, help: t('agentsStudio.editor.instructionsHelp'), count: countText(ed.form.instructions, limitOf(ctx, 'instructions')),
|
|
68
|
+
control: html`<textarea class="sx-input sx-textarea ax-instructions" id="ax-e-instructions" data-form-field="instructions" rows="14" aria-labelledby="ax-e-instructions-label" aria-describedby="ax-e-instructions-help ax-e-instructions-issues" spellcheck="true"${attr('disabled', ro)}>${ed.form.instructions}</textarea>` });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The fields whose choices arrive after the form is drawn (the model catalog, the tool catalog, the allowed profiles,
|
|
72
|
+
// the skills, the memory categories). Each is made by itself: `{ markup, input, entries, summary, after }`, so a list
|
|
73
|
+
// that arrives updates that field where it is (refreshChoices) and the rest of the form is left alone.
|
|
74
|
+
const LATE_FIELDS = Object.freeze(['model', 'effort', 'accountId', 'tools', 'mcpServers', 'moreloginProfile', 'skills', 'memoryCategory']);
|
|
75
|
+
const LATE = {
|
|
76
|
+
model(ctx, ed, ro) {
|
|
77
|
+
const { t } = ctx;
|
|
78
|
+
const src = ctx.sources;
|
|
79
|
+
const entries = modelEntries(src.models?.[ed.form.provider] || [], ed.form.model, { defaultLabel: t('agentsStudio.editor.modelDefault'), savedLabel: (id) => id, unavailableWord: t('agentsStudio.editor.modelUnavailable') });
|
|
80
|
+
return { input: 'ax-e-model', entries, markup: field({ id: 'ax-e-model', label: t('agentsStudio.field.model'), field: 'model', help: src.modelsState === 'loading' ? t('agentsStudio.editor.modelsLoading') : src.modelsState === 'failed' ? t('agentsStudio.editor.modelsFailed') : t('agentsStudio.editor.modelHelp'),
|
|
81
|
+
control: dropdown('ax-e-model', entries, { labelledBy: 'ax-e-model-label', field: 'model', disabled: ro }) }) };
|
|
82
|
+
},
|
|
83
|
+
effort(ctx, ed, ro) {
|
|
84
|
+
const { t } = ctx;
|
|
85
|
+
const levels = ctx.effortLevels(ed.form.provider, modelRow(ctx.sources.models?.[ed.form.provider] || [], ed.form.model));
|
|
86
|
+
const entries = effortEntries(levels, ed.form.effort, { defaultLabel: t('agentsStudio.editor.effortDefault') });
|
|
87
|
+
return { input: 'ax-e-effort', entries, markup: field({ id: 'ax-e-effort', label: t('agentsStudio.field.effort'), field: 'effort', control: dropdown('ax-e-effort', entries, { labelledBy: 'ax-e-effort-label', field: 'effort', disabled: ro }) }) };
|
|
88
|
+
},
|
|
89
|
+
// Only for a provider whose runs name an account (the app has an account list for it), or an agent that names one.
|
|
90
|
+
accountId(ctx, ed, ro) {
|
|
91
|
+
const { t } = ctx;
|
|
92
|
+
const accounts = ctx.sources.accounts?.[ed.form.provider];
|
|
93
|
+
if (!Array.isArray(accounts) && !ed.form.accountId) return { markup: null, after: 'effort' };
|
|
94
|
+
const entries = accountEntries(accounts || [], ed.form.accountId, { defaultLabel: t('agentsStudio.editor.accountDefault') });
|
|
95
|
+
return { input: 'ax-e-account', entries, after: 'effort', markup: field({ id: 'ax-e-account', label: t('agentsStudio.field.accountId'), field: 'accountId', help: t('agentsStudio.editor.accountHelp'), control: dropdown('ax-e-account', entries, { labelledBy: 'ax-e-account-label', field: 'accountId', disabled: ro }) }) };
|
|
96
|
+
},
|
|
97
|
+
tools(ctx, ed, ro) {
|
|
98
|
+
const { t } = ctx;
|
|
99
|
+
const f = ed.form;
|
|
100
|
+
const src = ctx.sources;
|
|
101
|
+
const tools = toolGroupChoices(src.toolCatalog, f.tools, { provider: f.provider || 'claude-code', usesBrowser: f.usesBrowser, defaultLabel: t('agentsStudio.value.defaultTools'), translate: t });
|
|
102
|
+
return { input: tools ? 'ax-e-tools' : null, entries: tools?.entries || null, summary: tools?.summary || null, markup: field({ id: 'ax-e-tools', label: t('agentsStudio.field.tools'), field: 'tools', wide: true, help: tools ? t('agentsStudio.editor.toolsHelp') : src.toolsState === 'loading' ? t('agentsStudio.editor.toolsLoading') : t('agentsStudio.editor.toolsFailed'),
|
|
103
|
+
control: tools ? dropdown('ax-e-tools', tools.entries, { labelledBy: 'ax-e-tools-label', field: 'tools', multiple: true, summary: tools.summary, disabled: ro })
|
|
104
|
+
: html`<p class="sx-note ax-kept">${f.tools === null ? t('agentsStudio.value.defaultTools') : f.tools.join(', ') || t('agentsStudio.value.alwaysOn')}</p>` }) };
|
|
105
|
+
},
|
|
106
|
+
mcpServers(ctx, ed, ro) {
|
|
107
|
+
const { t } = ctx;
|
|
108
|
+
const f = ed.form;
|
|
109
|
+
const entries = serverEntries(ctx.sources.toolCatalog, f.mcpServers, { provider: f.provider || 'claude-code', allLabel: t('agentsStudio.value.allServers'), words: { blocked: t('agentsStudio.editor.serverBlocked'), unavailable: t('agentsStudio.editor.serverUnavailable'), unknown: t('agentsStudio.editor.serverUnknown'), missing: t('agentsStudio.editor.serverMissing') } });
|
|
110
|
+
const summary = f.mcpServers.includes('*') ? t('agentsStudio.value.allServers') : f.mcpServers.length ? f.mcpServers.join(', ') : t('agentsStudio.editor.serversNone');
|
|
111
|
+
return { input: 'ax-e-servers', entries, summary, markup: field({ id: 'ax-e-servers', label: t('agentsStudio.field.mcpServers'), field: 'mcpServers', wide: true, help: t('agentsStudio.editor.serversHelp'), control: dropdown('ax-e-servers', entries, { labelledBy: 'ax-e-servers-label', field: 'mcpServers', multiple: true, summary, disabled: ro }) }) };
|
|
112
|
+
},
|
|
113
|
+
// A profile is the browser tab's: offered while the browser is on (or while one is still named, so it can be seen).
|
|
114
|
+
moreloginProfile(ctx, ed, ro) {
|
|
115
|
+
const { t } = ctx;
|
|
116
|
+
const f = ed.form;
|
|
117
|
+
const src = ctx.sources;
|
|
118
|
+
if (!f.usesBrowser && !f.moreloginProfile) return { markup: null, after: 'usesBrowser' };
|
|
119
|
+
const entries = profileEntries(src.profiles, f.moreloginProfile, { noneLabel: t('agentsStudio.editor.profileDefault'), notAllowedWord: t('agentsStudio.editor.profileNotAllowedWord') });
|
|
120
|
+
return { input: 'ax-e-profile', entries, after: 'usesBrowser', markup: field({ id: 'ax-e-profile', label: t('agentsStudio.field.moreloginProfile'), field: 'moreloginProfile', wide: true,
|
|
121
|
+
help: src.profilesState === 'failed' ? t('agentsStudio.editor.profilesFailed') : !profileAllowed(src.profiles, f.moreloginProfile) && src.profilesState === 'ready' ? t('agentsStudio.editor.profileNotAllowed') : (src.profiles || []).length ? t('agentsStudio.editor.profileHelp') : t('agentsStudio.editor.profilesNone'),
|
|
122
|
+
control: dropdown('ax-e-profile', entries, { labelledBy: 'ax-e-profile-label', field: 'moreloginProfile', disabled: ro || !f.usesBrowser }) }) };
|
|
123
|
+
},
|
|
124
|
+
skills(ctx, ed, ro) {
|
|
125
|
+
const { t } = ctx;
|
|
126
|
+
const entries = skillEntries(ctx.sources.skills, ed.form.skills);
|
|
127
|
+
const summary = ed.form.skills.length ? ed.form.skills.join(', ') : t('agentsStudio.editor.skillsNone');
|
|
128
|
+
return { input: 'ax-e-skills', entries, summary, markup: field({ id: 'ax-e-skills', label: t('agentsStudio.field.skills'), field: 'skills', wide: true, help: ctx.sources.skillsState === 'failed' ? t('agentsStudio.editor.skillsFailed') : t('agentsStudio.editor.skillsHelp'), control: dropdown('ax-e-skills', entries, { labelledBy: 'ax-e-skills-label', field: 'skills', multiple: true, summary, disabled: ro }) }) };
|
|
129
|
+
},
|
|
130
|
+
memoryCategory(ctx, ed, ro) {
|
|
131
|
+
const { t } = ctx;
|
|
132
|
+
const entries = categoryEntries(ctx.sources.categories, ed.form.memoryCategory, { noneLabel: t('agentsStudio.editor.categoryNone') });
|
|
133
|
+
return { input: 'ax-e-category', entries, markup: field({ id: 'ax-e-category', label: t('agentsStudio.field.memoryCategory'), field: 'memoryCategory', wide: true, help: ctx.sources.categoriesState === 'failed' ? t('agentsStudio.editor.categoriesFailed') : t('agentsStudio.editor.categoryHelp'), control: dropdown('ax-e-category', entries, { labelledBy: 'ax-e-category-label', field: 'memoryCategory', disabled: ro }) }) };
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
const late = (name, ctx, ed, ro) => LATE[name](ctx, ed, ro).markup || '';
|
|
137
|
+
|
|
138
|
+
function runtimeHTML(ctx, ed, ro) {
|
|
139
|
+
const { t } = ctx;
|
|
140
|
+
return html`
|
|
141
|
+
${field({ id: 'ax-e-provider', label: t('agentsStudio.field.provider'), field: 'provider', required: true,
|
|
142
|
+
control: dropdown('ax-e-provider', enumEntries(ctx.info?.providers || [], ed.form.provider, (id) => wordOr(t, 'agentsStudio.provider', id)), { labelledBy: 'ax-e-provider-label', field: 'provider', disabled: ro }) })}
|
|
143
|
+
${late('model', ctx, ed, ro)}${late('effort', ctx, ed, ro)}${late('accountId', ctx, ed, ro)}`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function accessHTML(ctx, ed, ro) {
|
|
147
|
+
const { t } = ctx;
|
|
148
|
+
const f = ed.form;
|
|
149
|
+
const capability = enumEntries(ctx.info?.capabilityLevels || [], f.capability, (id) => wordOr(t, `agentsStudio.capability.${id}`, 'name'), (id) => wordOr(t, `agentsStudio.capability.${id}`, 'help'));
|
|
150
|
+
const policy = enumEntries(ctx.info?.permissionPolicies || [], f.permissionPolicy, (id) => wordOr(t, `agentsStudio.policy.${id}`, 'name'), (id) => wordOr(t, `agentsStudio.policy.${id}`, 'help'));
|
|
151
|
+
return html`
|
|
152
|
+
${field({ id: 'ax-e-capability', label: t('agentsStudio.field.capability'), field: 'capability', help: wordOr(t, `agentsStudio.capability.${f.capability}`, 'help'),
|
|
153
|
+
control: dropdown('ax-e-capability', capability, { labelledBy: 'ax-e-capability-label', field: 'capability', disabled: ro }) })}
|
|
154
|
+
${field({ id: 'ax-e-policy', label: t('agentsStudio.field.permissionPolicy'), field: 'permissionPolicy', help: wordOr(t, `agentsStudio.policy.${f.permissionPolicy}`, 'help'),
|
|
155
|
+
control: dropdown('ax-e-policy', policy, { labelledBy: 'ax-e-policy-label', field: 'permissionPolicy', disabled: ro }) })}
|
|
156
|
+
${late('tools', ctx, ed, ro)}${late('mcpServers', ctx, ed, ro)}
|
|
157
|
+
<div class="sx-field ax-field ax-field--wide" data-field="usesBrowser">
|
|
158
|
+
<label class="sx-choice"><input type="checkbox" class="sx-check" id="ax-e-browser" data-form-field="usesBrowser"${attr('checked', f.usesBrowser)}${attr('disabled', ro)} aria-describedby="ax-e-browser-help ax-e-browser-issues"><span>${t('agentsStudio.field.usesBrowser')}</span></label>
|
|
159
|
+
<p class="sx-field-note" id="ax-e-browser-help">${t('agentsStudio.editor.browserHelp')}</p>
|
|
160
|
+
<div class="ax-issues" data-issues-for="usesBrowser" id="ax-e-browser-issues" role="status"></div>
|
|
161
|
+
</div>
|
|
162
|
+
${late('moreloginProfile', ctx, ed, ro)}
|
|
163
|
+
<div class="sx-field ax-field ax-field--wide" data-field="usesComputer">
|
|
164
|
+
<label class="sx-choice"><input type="checkbox" class="sx-check" id="ax-e-computer" data-form-field="usesComputer"${attr('checked', f.usesComputer)}${attr('disabled', ro)} aria-describedby="ax-e-computer-help ax-e-computer-issues"><span>${t('agentsStudio.field.usesComputer')}</span></label>
|
|
165
|
+
<p class="sx-field-note" id="ax-e-computer-help">${t('agentsStudio.editor.computerHelp')}</p>
|
|
166
|
+
<div class="ax-issues" data-issues-for="usesComputer" id="ax-e-computer-issues" role="status"></div>
|
|
167
|
+
</div>
|
|
168
|
+
${late('skills', ctx, ed, ro)}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function useHTML(ctx, ed, ro) {
|
|
172
|
+
const { t } = ctx;
|
|
173
|
+
const f = ed.form;
|
|
174
|
+
const classSummary = f.taskClasses.length ? f.taskClasses.map((cls) => wordOr(t, 'agentsStudio.taskClass', cls)).join(', ') : t('agentsStudio.editor.classesNone');
|
|
175
|
+
return html`
|
|
176
|
+
${field({ id: 'ax-e-scope', label: t('agentsStudio.field.scope'), field: 'scope', wide: true, help: ed.mode === 'new' ? t('agentsStudio.editor.scopeHelp') : t('agentsStudio.editor.scopeFixed'),
|
|
177
|
+
control: dropdown('ax-e-scope', scopeEntries(ctx.info?.projects || [], f.scope, { globalLabel: t('agentsStudio.scope.globalLibrary'), projectsLabel: t('agentsStudio.scope.pinTo') }), { labelledBy: 'ax-e-scope-label', field: 'scope', disabled: ro || ed.mode !== 'new' }) })}
|
|
178
|
+
${field({ id: 'ax-e-classes', label: t('agentsStudio.field.taskClasses'), field: 'taskClasses', wide: true, help: t('agentsStudio.editor.classesHelp'),
|
|
179
|
+
control: dropdown('ax-e-classes', multiEntries(ctx.info?.taskClasses || [], f.taskClasses, (id) => wordOr(t, 'agentsStudio.taskClass', id)), { labelledBy: 'ax-e-classes-label', field: 'taskClasses', multiple: true, summary: classSummary, disabled: ro }) })}
|
|
180
|
+
${late('memoryCategory', ctx, ed, ro)}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A list arrived (the model catalog, the tool catalog, a profile list…): every field it feeds is updated where it
|
|
185
|
+
* is. A field the keyboard is in, or whose menu is open, only gets its new choices (the focus, the caret and the
|
|
186
|
+
* open menu stay); any other is made again. Nothing else of the form is touched, and no value changes.
|
|
187
|
+
*/
|
|
188
|
+
function refreshChoices(host, ctx, ed) {
|
|
189
|
+
const ro = !ed.editable;
|
|
190
|
+
const active = document.activeElement;
|
|
191
|
+
for (const name of LATE_FIELDS) {
|
|
192
|
+
const made = LATE[name](ctx, ed, ro);
|
|
193
|
+
const el = host.querySelector(`.ax-field[data-field="${name}"]`);
|
|
194
|
+
if (!el) {
|
|
195
|
+
// A field that was not there and now is (the accounts of a provider): put after the field it follows.
|
|
196
|
+
if (made.markup && made.after) host.querySelector(`.ax-field[data-field="${made.after}"]`)?.insertAdjacentHTML('afterend', made.markup.text);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const busy = el.contains(active) || !!el.querySelector('.cc-dropdown.open');
|
|
200
|
+
if (!made.markup) { if (!busy) el.remove(); continue; }
|
|
201
|
+
const input = made.input ? el.querySelector(`#${CSS.escape(made.input)}`) : null;
|
|
202
|
+
if (busy) {
|
|
203
|
+
if (!input || !made.entries) continue;
|
|
204
|
+
setDropdownItems(input, made.entries);
|
|
205
|
+
if (made.summary) { const label = el.querySelector('.cc-dropdown-value'); if (label) { label.textContent = made.summary; label.title = made.summary; } }
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const holder = document.createElement('template');
|
|
209
|
+
setHTML(holder, made.markup);
|
|
210
|
+
el.replaceWith(holder.content);
|
|
211
|
+
}
|
|
212
|
+
paintIssues(host, ctx, ed);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const SECTION_HTML = { identity: identityHTML, instructions: instructionsHTML, runtime: runtimeHTML, access: accessHTML, use: useHTML };
|
|
216
|
+
|
|
217
|
+
function sideHTML(ctx, ed) {
|
|
218
|
+
const { t } = ctx;
|
|
219
|
+
const words = wordsOf(t, { projects: ctx.info?.projects });
|
|
220
|
+
const approved = ed.agent?.approvedDefinition || null;
|
|
221
|
+
const counts = issueCounts(ed.issues?.byField);
|
|
222
|
+
const problems = Object.entries(ed.issues?.byField || {}).flatMap(([name, found]) => [
|
|
223
|
+
...found.errors.map((issue) => ({ name, kind: 'error', message: issue.message })),
|
|
224
|
+
...found.warnings.map((issue) => ({ name, kind: 'warning', message: issue.message })),
|
|
225
|
+
]);
|
|
226
|
+
return html`
|
|
227
|
+
<section class="ax-side-card" aria-labelledby="ax-priv-title">
|
|
228
|
+
<h4 class="sx-section-title" id="ax-priv-title">${t('agentsStudio.privilege.title')}</h4>
|
|
229
|
+
<p class="sx-help">${approved ? t('agentsStudio.privilege.againstApproved', { n: approved.revision }) : t('agentsStudio.privilege.firstRevision')}</p>
|
|
230
|
+
${privilegeHTML(t, formDefinition(ed), approved, ed.delta, words)}
|
|
231
|
+
</section>
|
|
232
|
+
<section class="ax-side-card" aria-labelledby="ax-problems-title">
|
|
233
|
+
<h4 class="sx-section-title" id="ax-problems-title">${t('agentsStudio.editor.checks')}</h4>
|
|
234
|
+
<p class="sx-help" id="ax-check-state" role="status">${ed.checking ? t('agentsStudio.editor.checking') : ed.checkFailed ? t('agentsStudio.editor.checkFailed') : !ed.issues ? t('agentsStudio.editor.notChecked') : !counts.errors && !counts.warnings ? t('agentsStudio.editor.noProblems') : ctx.tp('agentsStudio.editor.problemCount', counts.errors, { warnings: counts.warnings })}</p>
|
|
235
|
+
${problems.length ? html`<ul class="sx-problems">${problems.map((p) => html`<li><button type="button" class="sx-problem sx-problem--${p.kind} ax-problem" data-act="goto-field" data-field="${p.name}">${p.kind === 'error' ? ICONS.err : ICONS.warn}<span class="sx-problem-text">${p.message}</span><span class="sx-problem-tag">${p.name === '_' ? '' : t(`agentsStudio.field.${p.name}`)}</span></button></li>`)}</ul>` : ''}
|
|
236
|
+
</section>`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function formHTML(ctx, ed) {
|
|
240
|
+
const { t } = ctx;
|
|
241
|
+
const ro = !ed.editable;
|
|
242
|
+
const counts = issueCounts(ed.issues?.byField);
|
|
243
|
+
return html`<div class="ax-edit">
|
|
244
|
+
<form class="ax-form" id="ax-form" novalidate autocomplete="off" aria-label="${t('agentsStudio.editor.formLabel')}">
|
|
245
|
+
${FORM_SECTIONS.map((section) => {
|
|
246
|
+
const mark = counts.sections[section.id];
|
|
247
|
+
return html`<fieldset class="ax-section" id="ax-sec-${section.id}">
|
|
248
|
+
<legend class="ax-section-title">${t(`agentsStudio.editor.section.${section.id}`)}${mark?.errors ? html`<span class="ax-section-mark sx-err-text">${ICONS.err}<span class="sx-sr">${ctx.tp('agentsStudio.editor.sectionErrors', mark.errors)}</span></span>` : ''}</legend>
|
|
249
|
+
<div class="ax-fields">${SECTION_HTML[section.id](ctx, ed, ro)}</div>
|
|
250
|
+
</fieldset>`;
|
|
251
|
+
})}
|
|
252
|
+
</form>
|
|
253
|
+
<aside class="ax-side" id="ax-side" aria-label="${t('agentsStudio.privilege.title')}">${sideHTML(ctx, ed)}</aside>
|
|
254
|
+
</div>`;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// ── Updating what is drawn without drawing the form again ──
|
|
258
|
+
|
|
259
|
+
function paintIssues(host, ctx, ed) {
|
|
260
|
+
for (const box of host.querySelectorAll('[data-issues-for]')) setHTML(box, issuesHTML(ed.issues?.byField?.[box.dataset.issuesFor]));
|
|
261
|
+
for (const input of host.querySelectorAll('[data-form-field]')) {
|
|
262
|
+
const bad = !!ed.issues?.byField?.[input.dataset.formField]?.errors.length;
|
|
263
|
+
const control = controlOf(input);
|
|
264
|
+
if (bad) control.setAttribute('aria-invalid', 'true'); else control.removeAttribute('aria-invalid');
|
|
265
|
+
}
|
|
266
|
+
setHTML(host.querySelector('#ax-side'), sideHTML(ctx, ed));
|
|
267
|
+
const counts = issueCounts(ed.issues?.byField);
|
|
268
|
+
for (const section of FORM_SECTIONS) {
|
|
269
|
+
const legend = host.querySelector(`#ax-sec-${section.id} .ax-section-title`);
|
|
270
|
+
if (!legend) continue;
|
|
271
|
+
legend.querySelector('.ax-section-mark')?.remove();
|
|
272
|
+
const mark = counts.sections[section.id];
|
|
273
|
+
if (mark?.errors) legend.insertAdjacentHTML('beforeend', html`<span class="ax-section-mark sx-err-text">${ICONS.err}<span class="sx-sr">${ctx.tp('agentsStudio.editor.sectionErrors', mark.errors)}</span></span>`.text);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function paintCounts(host, ctx, ed) {
|
|
278
|
+
for (const name of ['name', 'description', 'instructions']) {
|
|
279
|
+
const el = host.querySelector(`[data-count-for="${name}"]`);
|
|
280
|
+
if (!el) continue;
|
|
281
|
+
const c = countOf(ed.form[name], limitOf(ctx, name));
|
|
282
|
+
el.textContent = c.limit ? `${c.length} / ${c.limit}` : String(c.length);
|
|
283
|
+
el.classList.toggle('sx-err-text', c.over);
|
|
284
|
+
el.classList.toggle('sx-warn-text', c.near);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Ask the server what it makes of the form, a moment after the last change. The answer is dropped when the form
|
|
290
|
+
* moved on meanwhile, or when the editor closed.
|
|
291
|
+
*/
|
|
292
|
+
export function scheduleCheck(host, ctx, ed, delay = 350) {
|
|
293
|
+
clearTimeout(ed.checkTimer);
|
|
294
|
+
const seq = (ed.checkSeq = (ed.checkSeq || 0) + 1);
|
|
295
|
+
ed.checkTimer = setTimeout(async () => {
|
|
296
|
+
ed.checking = true;
|
|
297
|
+
const state = host.querySelector('#ax-check-state');
|
|
298
|
+
if (state) state.textContent = ctx.t('agentsStudio.editor.checking');
|
|
299
|
+
try {
|
|
300
|
+
const res = await ctx.api.validate(formDefinition(ed));
|
|
301
|
+
if (seq !== ed.checkSeq || ed.closed) return;
|
|
302
|
+
ed.issues = { byField: issuesByField(res.errors, res.warnings), valid: res.valid === true };
|
|
303
|
+
ed.checkFailed = false;
|
|
304
|
+
} catch {
|
|
305
|
+
if (seq !== ed.checkSeq || ed.closed) return;
|
|
306
|
+
ed.checkFailed = true;
|
|
307
|
+
}
|
|
308
|
+
ed.checking = false;
|
|
309
|
+
if (host.isConnected) paintIssues(host, ctx, ed);
|
|
310
|
+
ed.onState?.();
|
|
311
|
+
}, delay);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Draw the form in the tab panel. */
|
|
315
|
+
export function renderEditorPanel(host, ctx, ed) {
|
|
316
|
+
leaveEditorPanel();
|
|
317
|
+
life = new AbortController();
|
|
318
|
+
const { signal } = life;
|
|
319
|
+
const draw = ({ keepFocus = false } = {}) => {
|
|
320
|
+
const active = keepFocus ? document.activeElement : null;
|
|
321
|
+
const id = active && host.contains(active) ? active.id : null;
|
|
322
|
+
const scroll = host.querySelector('.ax-form')?.scrollTop || 0;
|
|
323
|
+
setHTML(host, formHTML(ctx, ed));
|
|
324
|
+
paintIssues(host, ctx, ed);
|
|
325
|
+
paintCounts(host, ctx, ed);
|
|
326
|
+
const form = host.querySelector('.ax-form');
|
|
327
|
+
if (form) form.scrollTop = scroll;
|
|
328
|
+
if (id) host.querySelector(`#${CSS.escape(id)}`)?.focus({ preventScroll: true });
|
|
329
|
+
};
|
|
330
|
+
ed.redraw = draw;
|
|
331
|
+
// A list that arrives while the form is open (the model catalog, the tool catalog…) is taken where it is: the
|
|
332
|
+
// form is not drawn again, so what is being typed, the caret and an open menu are left alone.
|
|
333
|
+
ed.refresh = () => refreshChoices(host, ctx, ed);
|
|
334
|
+
draw();
|
|
335
|
+
wireDropdowns(host, { signal });
|
|
336
|
+
if (!ed.issues) scheduleCheck(host, ctx, ed, 0);
|
|
337
|
+
|
|
338
|
+
const set = (name, value, { structural = false } = {}) => {
|
|
339
|
+
const before = ed.form;
|
|
340
|
+
ed.form = applyField(ed.form, name, value, { idFollowsName: ed.mode === 'new' && !ed.idTouched, idLimit: limitOf(ctx, 'id') || 64 });
|
|
341
|
+
if (name === 'id') ed.idTouched = true;
|
|
342
|
+
if (name === 'name' && ed.form.id !== before.id) { const idInput = host.querySelector('#ax-e-id'); if (idInput) idInput.value = ed.form.id; }
|
|
343
|
+
ed.dirty = ed.mode === 'new' ? true : isDirty(ed.base, ed.form);
|
|
344
|
+
// What the server said about this field was about its earlier value: it goes now, the next check says what holds.
|
|
345
|
+
if (ed.issues?.byField?.[name]) { delete ed.issues.byField[name]; if (!structural) paintIssues(host, ctx, ed); }
|
|
346
|
+
if (structural) draw({ keepFocus: true }); else { paintCounts(host, ctx, ed); setHTML(host.querySelector('#ax-side'), sideHTML(ctx, ed)); }
|
|
347
|
+
scheduleCheck(host, ctx, ed);
|
|
348
|
+
ed.onState?.();
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
host.addEventListener('input', (e) => {
|
|
352
|
+
const el = e.target;
|
|
353
|
+
const name = el.dataset?.formField;
|
|
354
|
+
if (!name || el.type === 'hidden' || el.type === 'checkbox') return;
|
|
355
|
+
set(name, el.value);
|
|
356
|
+
}, { signal });
|
|
357
|
+
host.addEventListener('change', (e) => {
|
|
358
|
+
const el = e.target;
|
|
359
|
+
const name = el.dataset?.formField;
|
|
360
|
+
if (!name) return;
|
|
361
|
+
if (el.type === 'checkbox') { set(name, el.checked, { structural: true }); return; }
|
|
362
|
+
if (el.type !== 'hidden') return;
|
|
363
|
+
if (name === 'tools') set('tools', toolsFromChoice(el.value), { structural: true });
|
|
364
|
+
else if (name === 'mcpServers') set('mcpServers', serversFromChoice(el.value), { structural: true });
|
|
365
|
+
else if (name === 'skills' || name === 'taskClasses') set(name, multiValue(el.value), { structural: true });
|
|
366
|
+
else if (name === 'scope') set('scope', scopeFromValue(el.value), { structural: true });
|
|
367
|
+
else if (['model', 'effort', 'accountId', 'moreloginProfile', 'memoryCategory'].includes(name)) set(name, el.value || null, { structural: name === 'model' });
|
|
368
|
+
else set(name, el.value, { structural: true });
|
|
369
|
+
}, { signal });
|
|
370
|
+
host.addEventListener('click', (e) => {
|
|
371
|
+
const el = e.target.closest?.('[data-act]');
|
|
372
|
+
if (!el || !host.contains(el) || el.disabled) return;
|
|
373
|
+
if (el.dataset.act === 'pick-icon') set('icon', el.dataset.value || null, { structural: true });
|
|
374
|
+
else if (el.dataset.act === 'pick-color') set('color', el.dataset.value || null, { structural: true });
|
|
375
|
+
else if (el.dataset.act === 'goto-field') {
|
|
376
|
+
const target = host.querySelector(`[data-field="${CSS.escape(el.dataset.field)}"] [data-form-field], [data-field="${CSS.escape(el.dataset.field)}"] [role="radio"]`);
|
|
377
|
+
if (target) { const control = controlOf(target); control.scrollIntoView({ block: 'center' }); control.focus({ preventScroll: true }); }
|
|
378
|
+
}
|
|
379
|
+
}, { signal });
|
|
380
|
+
// The icon and colour choices are radio groups: the arrows move the choice.
|
|
381
|
+
host.addEventListener('keydown', (e) => {
|
|
382
|
+
const radio = e.target.closest?.('[role="radio"]');
|
|
383
|
+
if (!radio || !['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp'].includes(e.key)) return;
|
|
384
|
+
const group = [...radio.closest('[role="radiogroup"]').querySelectorAll('[role="radio"]:not(:disabled)')];
|
|
385
|
+
const next = group[(group.indexOf(radio) + (e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : -1) + group.length) % group.length];
|
|
386
|
+
if (!next) return;
|
|
387
|
+
e.preventDefault();
|
|
388
|
+
const act = next.dataset.act;
|
|
389
|
+
next.click();
|
|
390
|
+
host.querySelector(`[data-act="${act}"][aria-checked="true"]`)?.focus({ preventScroll: true });
|
|
391
|
+
}, { signal });
|
|
392
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// The owner's native export dialog. Reading never writes; only Confirm export sends the pinned POST.
|
|
2
|
+
import { html, setHTML } from '../../skills/studio/sx-dom.js';
|
|
3
|
+
import { wireDropdowns } from '../../cc-dropdown.js';
|
|
4
|
+
import { dropdown, field, errorText, loadingHTML } from './ax-ui.js';
|
|
5
|
+
import { canExportNative, nativeHostOptions, nativeExportSession } from './ax-native-export.js';
|
|
6
|
+
|
|
7
|
+
export async function exportToHost(ctx, ed) {
|
|
8
|
+
if (!canExportNative(ctx, ed.agent)) return;
|
|
9
|
+
const { t } = ctx;
|
|
10
|
+
const life = new AbortController();
|
|
11
|
+
const session = nativeExportSession(ctx.api, ed.key, ed.agent.approvedDefinition.revision);
|
|
12
|
+
let open = true, writing = false, written = false, ready = false, ui = null, loadId = 0;
|
|
13
|
+
const extra = document.createElement('div');
|
|
14
|
+
extra.className = 'ax-dlg-form ax-native-export';
|
|
15
|
+
setHTML(extra, loadingHTML(t));
|
|
16
|
+
const sayError = (error) => {
|
|
17
|
+
ready = false;
|
|
18
|
+
ui?.setDisabled('write', true);
|
|
19
|
+
const message = extra.querySelector('#ax-export-preview') || extra;
|
|
20
|
+
setHTML(message, html`<p class="sx-note sx-note--err" role="alert">${errorText(t, error)}</p><button type="button" class="sx-btn" data-export-retry>${t('agentsStudio.state.retry')}</button>`);
|
|
21
|
+
};
|
|
22
|
+
const selection = () => {
|
|
23
|
+
const value = extra.querySelector('#ax-export-target').value;
|
|
24
|
+
return { host: extra.querySelector('#ax-export-host').value, target: value === 'account' ? 'account' : 'project', ...(value !== 'account' ? { targetProject: value.slice(8) } : {}) };
|
|
25
|
+
};
|
|
26
|
+
async function preview() {
|
|
27
|
+
const id = ++loadId;
|
|
28
|
+
ready = false; ui.setDisabled('write', true);
|
|
29
|
+
const target = extra.querySelector('#ax-export-preview');
|
|
30
|
+
setHTML(target, loadingHTML(t));
|
|
31
|
+
try {
|
|
32
|
+
const result = await session.load(selection());
|
|
33
|
+
if (!open || id !== loadId || !result) return;
|
|
34
|
+
const problem = result.targetProblem?.error || result.target?.problem?.error || result.target?.problem?.message || result.target?.problem || result.reason;
|
|
35
|
+
setHTML(target, html`
|
|
36
|
+
<p class="sx-help">${t('agentsStudio.nativeExport.revision', { n: result.revision })}</p>
|
|
37
|
+
${result.target?.path ? html`<p class="ax-export-path">${result.target.path}</p>` : ''}
|
|
38
|
+
${problem ? html`<p class="sx-note sx-note--err" role="alert">${typeof problem === 'string' ? problem : JSON.stringify(problem)}</p>` : ''}
|
|
39
|
+
${result.target?.exists ? html`<p class="sx-note">${t('agentsStudio.nativeExport.replace')}</p>` : ''}
|
|
40
|
+
${result.content !== undefined ? html`<pre class="ax-export-content" tabindex="0">${result.content}</pre>` : ''}
|
|
41
|
+
<h4 class="sx-section-title">${t('agentsStudio.nativeExport.omitted')}</h4>
|
|
42
|
+
${result.unrepresented?.length ? html`<ul>${result.unrepresented.map((row) => html`<li><strong>${row.field}</strong>: ${row.reason}</li>`)}</ul>` : html`<p class="sx-help">${t('agentsStudio.nativeExport.noneOmitted')}</p>`}
|
|
43
|
+
${(result.notes || []).map((note) => html`<p class="sx-help">${note}</p>`)}`);
|
|
44
|
+
ready = result.supported && result.approved && result.writable && result.target?.writable && !!result.digest;
|
|
45
|
+
ui.setDisabled('write', !ready);
|
|
46
|
+
} catch (error) { if (open && id === loadId) sayError(error); }
|
|
47
|
+
}
|
|
48
|
+
async function init() {
|
|
49
|
+
try {
|
|
50
|
+
const { formats, writes } = await ctx.api.nativeFormats();
|
|
51
|
+
if (!open) return;
|
|
52
|
+
const host = formats.find((f) => f.supported && f.host === ed.agent.approvedDefinition.provider)?.host || formats.find((f) => f.supported)?.host;
|
|
53
|
+
const projects = ctx.info?.projects || [];
|
|
54
|
+
const scope = ed.agent.approvedDefinition.scope;
|
|
55
|
+
const projectDefault = scope?.kind === 'project' && projects.some((p) => p.path === scope.path);
|
|
56
|
+
const targets = [{ value: 'account', label: t('agentsStudio.nativeExport.account'), selected: !projectDefault }, ...projects.map((p) => ({ value: `project:${p.path}`, label: p.label || p.path, caption: p.path, selected: projectDefault && p.path === scope.path }))];
|
|
57
|
+
setHTML(extra, html`<div class="ax-fields">
|
|
58
|
+
${field({ id: 'ax-export-host', label: t('agentsStudio.nativeExport.host'), control: dropdown('ax-export-host', nativeHostOptions(formats, host), { label: t('agentsStudio.nativeExport.host') }) })}
|
|
59
|
+
${field({ id: 'ax-export-target', label: t('agentsStudio.nativeExport.target'), control: dropdown('ax-export-target', targets, { label: t('agentsStudio.nativeExport.target') }) })}
|
|
60
|
+
</div><div id="ax-export-preview" aria-live="polite"></div>`);
|
|
61
|
+
wireDropdowns(extra, { signal: life.signal });
|
|
62
|
+
if (!writes || !host) { sayError(new Error(t('agentsStudio.nativeExport.unavailable'))); return; }
|
|
63
|
+
await preview();
|
|
64
|
+
} catch (error) { if (open) sayError(error); }
|
|
65
|
+
}
|
|
66
|
+
extra.addEventListener('change', () => { if (!writing) preview(); }, { signal: life.signal });
|
|
67
|
+
extra.addEventListener('click', (event) => {
|
|
68
|
+
if (!event.target.closest('[data-export-retry]') || writing) return;
|
|
69
|
+
if (extra.querySelector('#ax-export-host')) preview(); else init();
|
|
70
|
+
}, { signal: life.signal });
|
|
71
|
+
try {
|
|
72
|
+
await ctx.ask({
|
|
73
|
+
title: t('agentsStudio.nativeExport.title', { name: ed.agent.name || ed.key.id }),
|
|
74
|
+
lines: [t('agentsStudio.nativeExport.help')], extra, wide: true, className: 'ax-dlg', focus: 'cancel',
|
|
75
|
+
buttons: [{ id: 'cancel', label: t('agentsStudio.action.cancel') }, { id: 'write', label: t('agentsStudio.nativeExport.confirm'), kind: 'primary', disabled: true }],
|
|
76
|
+
onOpen(value) { ui = value; init(); },
|
|
77
|
+
accept(answer, dialog) {
|
|
78
|
+
if (answer !== 'write' || written) return true;
|
|
79
|
+
if (!ready || writing) return false;
|
|
80
|
+
writing = true; ready = false; dialog.setDisabled('write', true);
|
|
81
|
+
for (const button of extra.querySelectorAll('.cc-dropdown-trigger')) button.disabled = true;
|
|
82
|
+
session.write().then(() => {
|
|
83
|
+
written = true;
|
|
84
|
+
ctx.toast(t('agentsStudio.nativeExport.written'));
|
|
85
|
+
if (open) dialog.done('write');
|
|
86
|
+
}, (error) => { if (open) sayError(error); }).finally(() => {
|
|
87
|
+
writing = false;
|
|
88
|
+
for (const button of extra.querySelectorAll('.cc-dropdown-trigger')) button.disabled = false;
|
|
89
|
+
});
|
|
90
|
+
return false;
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
} finally { open = false; ++loadId; session.close(); life.abort(); }
|
|
94
|
+
}
|