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
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
// A new native attachment still waits for every actual serve's process-bound probe, including startup races.
|
|
17
17
|
// - A serve that fails its check is stopped: SIGTERM, then SIGKILL after a bounded wait, until the OS confirms its
|
|
18
18
|
// process and its listener are gone. Until then (and for good when that cannot be confirmed) every native
|
|
19
|
-
// attachment is refused, and contexts already attached are revoked (
|
|
20
|
-
//
|
|
21
|
-
// held; otherwise it blocks native
|
|
19
|
+
// attachment is refused, and contexts already attached are revoked (one page emptied to about:blank, every other
|
|
20
|
+
// page closed, the browser disconnected: the profile's window is kept, revokeNativeContext). A failure that is only
|
|
21
|
+
// a missing answer (a timeout) stops the serve when a native context is held; otherwise it blocks native
|
|
22
|
+
// attachment and is asked again.
|
|
22
23
|
// - Serves SynaBun did not start (a terminal, another app, an earlier SynaBun), on any port: found by the processes
|
|
23
24
|
// listening on TCP (lib/opencode-serve-scan.js) whenever a context is attached and every NATIVE_WATCH_MS while one
|
|
24
25
|
// is. SynaBun holds no password for them, so the probe asks them as `foreign`: loopback only, every route of the
|
|
@@ -44,6 +45,8 @@ export const NATIVE_SERVE_VERSIONS = NATIVE_SERVE_KNOWN_GOOD;
|
|
|
44
45
|
export const NATIVE_SERVE_MIN_VERSION = '2.1.0';
|
|
45
46
|
// How often the OpenCode serves of this computer are looked at again while a native context is attached.
|
|
46
47
|
export const NATIVE_WATCH_MS = 15_000;
|
|
48
|
+
// How long a watch pass waits for a foreign serve that failed only by not answering to be confirmed gone (ensureWatch).
|
|
49
|
+
export const NATIVE_EXIT_GRACE_MS = 3_000;
|
|
47
50
|
|
|
48
51
|
/** "2.3.0", "v2.3.0", "opencode v2.3.0" → "2.3.0"; null for anything else (a prerelease, four parts, extra words). */
|
|
49
52
|
export function nativeServeVersionOf(version) {
|
|
@@ -242,16 +245,44 @@ export async function readServeGeneration(pid, { identity = readProcessIdentityA
|
|
|
242
245
|
return { pid, startedAt: id.startedAt, executable: exe || null, addresses: socks, key: listenerGenerationKey({ pid, startedAt: id.startedAt, addresses: socks }) };
|
|
243
246
|
}
|
|
244
247
|
|
|
248
|
+
// Contexts this process revoked: context → { at, why }. server.js reads it when the context's close event comes, so a
|
|
249
|
+
// revocation is never reported as a profile "closed outside SynaBun" and never blocks the runs that worked there.
|
|
250
|
+
const _revoked = new WeakMap();
|
|
251
|
+
|
|
252
|
+
/** When and why SynaBun revoked `context` ({ at, why }), or null. */
|
|
253
|
+
export function nativeContextRevocation(context) {
|
|
254
|
+
if (!context || (typeof context !== 'object' && typeof context !== 'function')) return null;
|
|
255
|
+
return _revoked.get(context) || null;
|
|
256
|
+
}
|
|
257
|
+
|
|
245
258
|
/**
|
|
246
|
-
* Take a native context's pages away from a serve that failed:
|
|
247
|
-
*
|
|
248
|
-
*
|
|
259
|
+
* Take a native context's pages away from a serve that failed: no page of it runs a site's script any more, then the
|
|
260
|
+
* browser connection is closed, so SynaBun's session must attach again (through the boundary). Bounded; never throws.
|
|
261
|
+
*
|
|
262
|
+
* The browser's window is kept (2026-11-15). Before, every page was closed: closing the last tab of a MoreLogin
|
|
263
|
+
* profile closes its window, MoreLogin then closes the whole profile (envkit log: close_click + CloseBrowser), and the
|
|
264
|
+
* runs' next browser call started it again, which spends one of the plan's daily launches. On 2026-11-15 at 21:13:30
|
|
265
|
+
* one revocation (a foreign OpenCode serve, pid 21487, failed "http-anonymous" while it was exiting) closed P-1 and P-4
|
|
266
|
+
* 37 ms apart, and one at 21:14:22 (pid 54472, exiting too) closed P-1 again. Now one page is emptied
|
|
267
|
+
* (about:blank: the page that was there runs no more script) and every other page is closed; only when the emptying
|
|
268
|
+
* fails is that page closed too (the window may then go: the boundary's protection comes first).
|
|
249
269
|
*/
|
|
250
|
-
export async function revokeNativeContext(context, { timeoutMs = 5_000 } = {}) {
|
|
270
|
+
export async function revokeNativeContext(context, { timeoutMs = 5_000, why = null, stepMs = 2_000 } = {}) {
|
|
271
|
+
try { if (context && typeof context === 'object') _revoked.set(context, { at: Date.now(), why: why ? String(why).slice(0, 500) : null }); } catch { /* not markable */ }
|
|
251
272
|
const work = (async () => {
|
|
252
273
|
let pages = [];
|
|
253
|
-
try { pages = context?.pages?.() || []; } catch { pages = []; }
|
|
254
|
-
|
|
274
|
+
try { pages = (context?.pages?.() || []).filter((page) => !page?.isClosed?.()); } catch { pages = []; }
|
|
275
|
+
const [keep, ...rest] = pages;
|
|
276
|
+
const close = (page) => Promise.resolve().then(() => page.close({ runBeforeUnload: false })).catch(() => {});
|
|
277
|
+
// The kept page: emptied within `stepMs`, else (an error, no answer) closed after all.
|
|
278
|
+
const empty = async (page) => {
|
|
279
|
+
let timer;
|
|
280
|
+
const late = new Promise((resolve) => { timer = setTimeout(() => resolve('late'), stepMs); timer.unref?.(); });
|
|
281
|
+
const done = await Promise.race([Promise.resolve().then(() => page.goto('about:blank')).then(() => 'empty', () => 'failed'), late])
|
|
282
|
+
.finally(() => clearTimeout(timer));
|
|
283
|
+
if (done !== 'empty') await close(page);
|
|
284
|
+
};
|
|
285
|
+
await Promise.all([...rest.map(close), keep ? empty(keep) : null]);
|
|
255
286
|
try { await context?.browser?.()?.close?.(); } catch { /* already gone */ }
|
|
256
287
|
})();
|
|
257
288
|
await within(work, timeoutMs);
|
|
@@ -283,7 +314,7 @@ export function createNativeServeBoundary({ probe = probeOpencodeServe, identify
|
|
|
283
314
|
scan = scanOpencodeServes, readGeneration = readServeGeneration, portListeners = listPortListenersAsync, pidAlive = pidExists,
|
|
284
315
|
signalPid = (pid, signal) => process.kill(pid, signal), revoke = revokeNativeContext, platform = process.platform,
|
|
285
316
|
now = Date.now, retryMs = 5_000, termMs = 3_000, killMs = 3_000, gonePollMs = 100, refreshMs = 8_000, foreignTtlMs = 5 * 60_000,
|
|
286
|
-
watchMs = NATIVE_WATCH_MS, preflight = null, log = () => {} } = {}) {
|
|
317
|
+
watchMs = NATIVE_WATCH_MS, exitGraceMs = NATIVE_EXIT_GRACE_MS, exitPollMs = 250, preflight = null, log = () => {} } = {}) {
|
|
287
318
|
const processes = new Map();
|
|
288
319
|
// Process-local admission evidence: persisted diagnostic verdicts and ordinary runtime passes cannot grant it.
|
|
289
320
|
const builds = new Map(), buildChecks = new Map();
|
|
@@ -314,7 +345,7 @@ export function createNativeServeBoundary({ probe = probeOpencodeServe, identify
|
|
|
314
345
|
if (rec.revoking) continue;
|
|
315
346
|
rec.revoking = true;
|
|
316
347
|
log(`revoking a native browser context: ${why}`);
|
|
317
|
-
Promise.resolve().then(() => revoke(context)).catch(() => {}).finally(() => rec.release());
|
|
348
|
+
Promise.resolve().then(() => revoke(context, { why })).catch(() => {}).finally(() => rec.release());
|
|
318
349
|
}
|
|
319
350
|
}
|
|
320
351
|
|
|
@@ -577,13 +608,52 @@ export function createNativeServeBoundary({ probe = probeOpencodeServe, identify
|
|
|
577
608
|
await within(Promise.allSettled(jobs), refreshMs);
|
|
578
609
|
}
|
|
579
610
|
|
|
611
|
+
// ── A foreign serve that is going away ──
|
|
612
|
+
// On 2026-11-15 two revocations (21:13:30, 21:14:22 local) came from foreign serves that were exiting: the probe got no
|
|
613
|
+
// answer (pid 21487: "GET /api/session did not answer", its exit handler ran at 21:13:29.03) or a reset (pid 54472:
|
|
614
|
+
// ECONNRESET, exit handler at 21:14:22.60). A serve that answered nothing gave nothing away; once the OS confirms its
|
|
615
|
+
// process ended, or that it no longer listens on that port, no page can reach it. So when EVERY offender of a watch
|
|
616
|
+
// pass is such a failure (a foreign serve, `transient`, nothing `exposed`), the pass waits up to `exitGraceMs` for the
|
|
617
|
+
// OS to confirm them gone, and revokes only for those that are not. Anything else (an exposed answer, a serve still
|
|
618
|
+
// being checked, a scan that failed, a serve SynaBun started) is revoked at once, as before.
|
|
619
|
+
const foreignVerdictOf = (o) => {
|
|
620
|
+
const serve = (foreign.result?.serves || []).find((s) => s.pid === o.pid);
|
|
621
|
+
return serve ? foreign.verdicts.get(listenerGenerationKey(serve))?.verdict || null : null;
|
|
622
|
+
};
|
|
623
|
+
const settlingForeign = (o) => {
|
|
624
|
+
if (o?.reason !== 'foreign' || !Number.isInteger(o.pid) || !(o.pid > 0) || !(Number(o.port) > 0)) return false;
|
|
625
|
+
const v = foreignVerdictOf(o);
|
|
626
|
+
return !!v && !v.ok && v.transient === true && v.exposed !== true;
|
|
627
|
+
};
|
|
628
|
+
async function foreignGone(o) {
|
|
629
|
+
let alive;
|
|
630
|
+
try { alive = pidAlive(o.pid); } catch { alive = null; }
|
|
631
|
+
if (alive === false) return true;
|
|
632
|
+
let pids;
|
|
633
|
+
try { pids = await portListeners(Number(o.port)); } catch { pids = null; }
|
|
634
|
+
return Array.isArray(pids) && !pids.includes(o.pid);
|
|
635
|
+
}
|
|
636
|
+
async function withoutExitingForeign(bad) {
|
|
637
|
+
if (!(exitGraceMs > 0) || !bad.length || !bad.every(settlingForeign)) return bad;
|
|
638
|
+
const end = now() + exitGraceMs;
|
|
639
|
+
let left = bad;
|
|
640
|
+
for (;;) {
|
|
641
|
+
const gone = await Promise.all(left.map((o) => foreignGone(o).catch(() => false)));
|
|
642
|
+
const settled = left.filter((_, i) => gone[i]);
|
|
643
|
+
for (const o of settled) log(`OpenCode serve pid ${o.pid} port ${o.port}, not started by SynaBun, failed "${o.check}" while it was going away and is gone now: no browser context revoked for it`);
|
|
644
|
+
left = left.filter((_, i) => !gone[i]);
|
|
645
|
+
if (!left.length || now() >= end) return left;
|
|
646
|
+
await defaultSleep(Math.max(1, Math.min(exitPollMs, end - now())));
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
580
650
|
function ensureWatch() {
|
|
581
651
|
if (watchTimer || !(watchMs > 0)) return;
|
|
582
652
|
watchTimer = setInterval(() => {
|
|
583
653
|
if (!attachedContexts().length) { clearInterval(watchTimer); watchTimer = null; return; }
|
|
584
|
-
refresh().then(() => {
|
|
654
|
+
refresh().then(async () => {
|
|
585
655
|
if (!foreign.result?.ok) { revokeAll('the OpenCode listening processes could not be verified'); return; }
|
|
586
|
-
const bad = foreignOffenders(new Set());
|
|
656
|
+
const bad = await withoutExitingForeign(foreignOffenders(new Set()));
|
|
587
657
|
if (bad.length) revokeAll(`an OpenCode serve SynaBun did not start could not be verified (pid ${bad[0].pid || '?'}, port ${bad[0].port || '?'}, check "${bad[0].check || bad[0].reason}")`);
|
|
588
658
|
}).catch(() => {});
|
|
589
659
|
}, watchMs);
|
|
@@ -429,29 +429,32 @@ export function createServeRecords({
|
|
|
429
429
|
* not carry this start's token (macOS, Linux), or whose start time is not to the fraction of a second (Windows);
|
|
430
430
|
* nor while the machine, the user or the boot cannot be told. A live record of another start under the same pid
|
|
431
431
|
* is never written over. Resolves the record or null.
|
|
432
|
+
* `quiet`: why nothing was recorded is not logged. For the try right after the spawn, which can come before the
|
|
433
|
+
* process shows its environment, when a second try follows once it answers (and logs if that one fails too).
|
|
432
434
|
*/
|
|
433
|
-
async function record({ kind, id = null, port, pid, token } = {}) {
|
|
435
|
+
async function record({ kind, id = null, port, pid, token, quiet = false } = {}) {
|
|
434
436
|
const n = Number(pid);
|
|
435
437
|
if (!kinds.includes(kind) || !isPid(n) || !isPort(Number(port)) || !TOKEN.test(str(token))) return null;
|
|
438
|
+
const say = quiet ? () => {} : log;
|
|
436
439
|
const at = await scopeLater();
|
|
437
|
-
if (!at) {
|
|
440
|
+
if (!at) { say(`no record for the ${kind} ${noun} on port ${port}: the machine, the user or the boot could not be read`); return null; }
|
|
438
441
|
const identity = await readIdentityAsync(n);
|
|
439
|
-
if (!identity) {
|
|
442
|
+
if (!identity) { say(`no record for the ${kind} ${noun} on port ${port}: the identity of process ${n} could not be read`); return null; }
|
|
440
443
|
const entry = {
|
|
441
444
|
v: RECORD_VERSION, kind, id: id == null ? null : String(id), port: Number(port),
|
|
442
445
|
pid: n, startedAt: identity.startedAt, command: identity.command, token,
|
|
443
446
|
scope: { ...at }, owner: owner(), recordedAt: new Date(now()).toISOString(),
|
|
444
447
|
};
|
|
445
|
-
if (!whole(entry)) {
|
|
448
|
+
if (!whole(entry)) { say(`no record for the ${kind} ${noun} on port ${port}: process ${n} is not a ${noun} on that port (${identity.command})`); return null; }
|
|
446
449
|
if (platform === 'win32') {
|
|
447
|
-
if (!FINE_START.test(entry.startedAt)) {
|
|
450
|
+
if (!FINE_START.test(entry.startedAt)) { say(`no record for the ${kind} ${noun} on port ${port}: the start time of process ${n} is not precise enough to tell it apart`); return null; }
|
|
448
451
|
} else {
|
|
449
|
-
if (String(identity.uid ?? '') !== at.uid) {
|
|
450
|
-
if (await readTokenAsync(n, token, identity.command) !== true) {
|
|
452
|
+
if (String(identity.uid ?? '') !== at.uid) { say(`no record for the ${kind} ${noun} on port ${port}: process ${n} is not this user's`); return null; }
|
|
453
|
+
if (await readTokenAsync(n, token, identity.command) !== true) { say(`no record for the ${kind} ${noun} on port ${port}: process ${n} does not carry this start's token`); return null; }
|
|
451
454
|
}
|
|
452
455
|
const onFile = readFile(`${n}.json`);
|
|
453
456
|
if (onFile && str(onFile.token) && onFile.token !== token && !issued.has(onFile.token) && await verify(onFile) === 'same') {
|
|
454
|
-
|
|
457
|
+
say(`no record for the ${kind} ${noun} on port ${port}: process ${n} is on record for another start`);
|
|
455
458
|
return null;
|
|
456
459
|
}
|
|
457
460
|
if (!write(entry)) return null;
|
|
@@ -521,7 +524,9 @@ export function createServeRecords({
|
|
|
521
524
|
const pids = await listeners(Number(port));
|
|
522
525
|
if (exited()) return { state: 'foreign' };
|
|
523
526
|
if (!Array.isArray(pids)) return { state: 'unknown' };
|
|
524
|
-
|
|
527
|
+
// Windows can miss a listener that just answered. This is not evidence of a competing process; the native
|
|
528
|
+
// boundary still consumes [] directly when confirming that a stopped listener is gone.
|
|
529
|
+
if (!pids.length) return { state: platform === 'win32' ? 'unknown' : 'foreign' };
|
|
525
530
|
let ours = null;
|
|
526
531
|
for (const listener of pids) {
|
|
527
532
|
if (listener !== n && await descendsFrom(listener, n) !== true) return { state: 'foreign', pids };
|
|
@@ -142,7 +142,7 @@ export function isLocalMarkerHost(hostname, extraNames = []) {
|
|
|
142
142
|
* The pages the cookie is set on: the app's shells and the detached side panel's window, each the first page a
|
|
143
143
|
* browser window loads. The Studio's library read sets it too (server.js), as does GET /api/page-session.
|
|
144
144
|
*/
|
|
145
|
-
export const PAGE_SECRET_PATHS = Object.freeze(['/', '/index.html', '/index2d.html', '/onboarding.html', '/sidepanel-session.html']);
|
|
145
|
+
export const PAGE_SECRET_PATHS = Object.freeze(['/', '/index.html', '/index2d.html', '/onboarding.html', '/sidepanel-session.html', '/extension-setup']);
|
|
146
146
|
/** The route an open tab asks for this boot's cookie after a restart (public/shared/page-session.js). */
|
|
147
147
|
export const PAGE_SECRET_REFRESH_PATH = '/api/page-session';
|
|
148
148
|
/** The app's service worker (public/sw.js): a browser that may not hold the secret gets SERVICE_WORKER_NOOP instead. */
|
|
@@ -582,6 +582,23 @@ function failureText(error) {
|
|
|
582
582
|
return String(error?.code || error?.message || error || 'failed');
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
+
const STDERR_NOTE_MAX = 200;
|
|
586
|
+
/**
|
|
587
|
+
* What a program wrote to stderr, for a failure's reason: ` (netstat said: "…")`, on one line and at most
|
|
588
|
+
* STDERR_NOTE_MAX characters, or '' when it wrote nothing.
|
|
589
|
+
*/
|
|
590
|
+
export function stderrNote(text, program = 'netstat') {
|
|
591
|
+
const said = String(text ?? '').replace(/\s+/g, ' ').trim();
|
|
592
|
+
if (!said) return '';
|
|
593
|
+
return ` (${program} said: "${said.length > STDERR_NOTE_MAX ? `${said.slice(0, STDERR_NOTE_MAX - 1)}…` : said}")`;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** A run's answer as `{ stdout, stderr }`: a run may answer stdout alone (a string) or both (`{ stdout, stderr }`). */
|
|
597
|
+
function outputOf(answer) {
|
|
598
|
+
if (answer && typeof answer === 'object' && 'stdout' in answer) return { stdout: String(answer.stdout ?? ''), stderr: String(answer.stderr ?? '') };
|
|
599
|
+
return { stdout: String(answer ?? ''), stderr: '' };
|
|
600
|
+
}
|
|
601
|
+
|
|
585
602
|
/**
|
|
586
603
|
* What a request's peer verdict means for the owner's authority: the one reading lib/page-session.js,
|
|
587
604
|
* lib/owner-authority.js and lib/assistant-api.js share. Pure, never throws.
|
|
@@ -615,11 +632,16 @@ export function peerAuthority(verdict) {
|
|
|
615
632
|
|
|
616
633
|
// ── The reader ───────────────────────────────────────────────────────────────
|
|
617
634
|
|
|
618
|
-
|
|
635
|
+
// `stderr: true` answers `{ stdout, stderr }` instead of stdout alone; a failure always carries what the program wrote
|
|
636
|
+
// to stderr (`error.stderr`).
|
|
637
|
+
function defaultRun(file, args, { timeout, stderr: withStderr = false }) {
|
|
619
638
|
return new Promise((resolve, reject) => {
|
|
620
639
|
try {
|
|
621
|
-
execFile(file, args, { encoding: 'utf8', timeout, maxBuffer: 64 * 1024 * 1024, windowsHide: true, env: { PATH: '/usr/bin:/bin:/usr/sbin:/sbin', LANG: 'C', LC_ALL: 'C' } }, (error, stdout) => {
|
|
622
|
-
if (error)
|
|
640
|
+
execFile(file, args, { encoding: 'utf8', timeout, maxBuffer: 64 * 1024 * 1024, windowsHide: true, env: { PATH: '/usr/bin:/bin:/usr/sbin:/sbin', LANG: 'C', LC_ALL: 'C' } }, (error, stdout, stderr) => {
|
|
641
|
+
if (error) {
|
|
642
|
+
if (error && typeof error === 'object' && error.stderr === undefined) { try { error.stderr = String(stderr || ''); } catch { /* frozen */ } }
|
|
643
|
+
reject(error);
|
|
644
|
+
} else resolve(withStderr ? { stdout: String(stdout || ''), stderr: String(stderr || '') } : String(stdout || ''));
|
|
623
645
|
});
|
|
624
646
|
} catch (error) { reject(error); }
|
|
625
647
|
});
|
|
@@ -671,7 +693,7 @@ export function createPeerIdentity({ platform = process.platform, selfPid = proc
|
|
|
671
693
|
return typeof real === 'string' && real !== written ? [written, real] : [written];
|
|
672
694
|
}))];
|
|
673
695
|
const logged = new Map(); // key → last time
|
|
674
|
-
const stats = { lookups: 0, tableReads: 0, psReads: 0, envReads: 0, refused: 0, unknown: 0, failed: 0, retries: 0, gone: 0, totalMs: 0, maxMs: 0 };
|
|
696
|
+
const stats = { lookups: 0, tableReads: 0, tableRetries: 0, psReads: 0, envReads: 0, refused: 0, unknown: 0, failed: 0, retries: 0, gone: 0, totalMs: 0, maxMs: 0 };
|
|
675
697
|
let addrCache = null;
|
|
676
698
|
let addrAt = 0;
|
|
677
699
|
|
|
@@ -738,11 +760,10 @@ export function createPeerIdentity({ platform = process.platform, selfPid = proc
|
|
|
738
760
|
probed = (async () => {
|
|
739
761
|
const failures = [];
|
|
740
762
|
let retryable = false;
|
|
741
|
-
try {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
} catch (error) { failures.push(`netstat: ${failureText(error)}`); retryable = retryable || isTransientLookupError(error); }
|
|
763
|
+
try { await readNetstat(); } catch (error) {
|
|
764
|
+
failures.push(error?.netstatTable ? error.message : netstatFailure(error));
|
|
765
|
+
retryable = retryable || isTransientLookupError(error);
|
|
766
|
+
}
|
|
746
767
|
try {
|
|
747
768
|
const parents = parsePsParents(await run(PS, ['-Ao', 'pid=,ppid=,ucomm='], { timeout: PS_TIMEOUT_MS }));
|
|
748
769
|
if (!parents.size) failures.push('ps listed no processes');
|
|
@@ -763,6 +784,34 @@ export function createPeerIdentity({ platform = process.platform, selfPid = proc
|
|
|
763
784
|
return addrCache.has(addr);
|
|
764
785
|
};
|
|
765
786
|
|
|
787
|
+
/**
|
|
788
|
+
* netstat's TCP table: `{ rows, listening, startedAt }` (when the read that gave it started). A table that lists no
|
|
789
|
+
* socket at all is read again once, at once: a busy system can answer one read with nothing (seen at a cold start,
|
|
790
|
+
* right after login), and that is not worth the owner's 503s. What netstat wrote to stderr is kept in the reason of a
|
|
791
|
+
* table that stays unreadable. Rejects with the reason (`error.netstatTable`: the table, not the program, failed);
|
|
792
|
+
* a program that cannot run rejects with its own error (netstatFailure).
|
|
793
|
+
*/
|
|
794
|
+
async function readNetstat() {
|
|
795
|
+
let said = '';
|
|
796
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
797
|
+
if (attempt) stats.tableRetries++;
|
|
798
|
+
const startedAt = now();
|
|
799
|
+
// -l: full IPv6 addresses (without it macOS cuts a long one, fe80::105e:de82:…, and the client's row would not
|
|
800
|
+
// be found: a connection taken for one that closed, refused).
|
|
801
|
+
const out = outputOf(await run(NETSTAT, NETSTAT_ARGS, { timeout: TABLE_TIMEOUT_MS, stderr: true }));
|
|
802
|
+
if (out.stderr.trim()) said = out.stderr;
|
|
803
|
+
const table = parseNetstatTcp(out.stdout);
|
|
804
|
+
if (!table.rows.length) continue;
|
|
805
|
+
// A layout this parser does not read gives no process at all: that is a lookup that cannot run (the rules from
|
|
806
|
+
// before), never "every client left". Not read again: the layout does not change between two reads.
|
|
807
|
+
if (!table.rows.some((r) => r.pid > 0)) throw Object.assign(new Error(`netstat named no processes (an unknown output layout)${stderrNote(said)}`), { netstatTable: true });
|
|
808
|
+
return { ...table, startedAt };
|
|
809
|
+
}
|
|
810
|
+
throw Object.assign(new Error(`netstat listed no TCP sockets${stderrNote(said)}`), { netstatTable: true });
|
|
811
|
+
}
|
|
812
|
+
/** The reason of a netstat that failed as a program: `netstat: <why>`, with what it wrote to stderr. */
|
|
813
|
+
const netstatFailure = (error) => `netstat: ${failureText(error)}${error && typeof error === 'object' && !error.netstatTable ? stderrNote(error.stderr) : ''}`;
|
|
814
|
+
|
|
766
815
|
// One TCP table read serves every lookup that was waiting when it STARTED (a socket accepted after a read began
|
|
767
816
|
// may not be in it, so its lookup waits for the next read).
|
|
768
817
|
let tableRunning = null;
|
|
@@ -773,17 +822,7 @@ export function createPeerIdentity({ platform = process.platform, selfPid = proc
|
|
|
773
822
|
tableNext = after.catch(() => {}).then(() => {
|
|
774
823
|
tableNext = null;
|
|
775
824
|
stats.tableReads++;
|
|
776
|
-
const
|
|
777
|
-
// -l: full IPv6 addresses (without it macOS cuts a long one, fe80::105e:de82:…, and the client's row would not
|
|
778
|
-
// be found: a connection taken for one that closed, refused).
|
|
779
|
-
const read = run(NETSTAT, NETSTAT_ARGS, { timeout: TABLE_TIMEOUT_MS }).then((text) => {
|
|
780
|
-
const table = parseNetstatTcp(text);
|
|
781
|
-
if (!table.rows.length) throw new Error('netstat listed no TCP sockets');
|
|
782
|
-
// A layout this parser does not read gives no process at all: that is a lookup that cannot run (the rules from
|
|
783
|
-
// before), never "every client left".
|
|
784
|
-
if (!table.rows.some((r) => r.pid > 0)) throw new Error('netstat named no processes (an unknown output layout)');
|
|
785
|
-
return { ...table, startedAt };
|
|
786
|
-
});
|
|
825
|
+
const read = readNetstat();
|
|
787
826
|
tableRunning = read;
|
|
788
827
|
read.catch(() => {}).then(() => { if (tableRunning === read) tableRunning = null; });
|
|
789
828
|
return read;
|
|
@@ -875,7 +914,7 @@ export function createPeerIdentity({ platform = process.platform, selfPid = proc
|
|
|
875
914
|
if (!isThisMachine(remote)) return { status: 'remote' };
|
|
876
915
|
if (!supported) return unsupportedPeerVerdict(unsupportedReason);
|
|
877
916
|
let table;
|
|
878
|
-
try { table = await tcpTable(); } catch (error) { return failedPeerVerdict(
|
|
917
|
+
try { table = await tcpTable(); } catch (error) { return failedPeerVerdict(netstatFailure(error), { retryable: isTransientLookupError(error) }); }
|
|
879
918
|
const row = table.rows.find((r) => r.local.port === remotePort && r.local.addr === remote && r.foreign.port === localPort && (r.foreign.addr === local || !local));
|
|
880
919
|
if (!row || !row.pid) return { status: 'gone', reason: 'the connection closed before its request was identified', ms: now() - started };
|
|
881
920
|
if (row.pid === selfPid) return { status: 'ok', self: true, pid: row.pid, name: row.name, chain: [], refuse: null, ms: now() - started };
|
|
@@ -119,9 +119,12 @@ export async function readProcessIdentityAsync(pid, { platform = process.platfor
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
function runFile(file, args, options) {
|
|
122
|
+
function runFile(file, args, { rejectStderr = false, ...options }) {
|
|
123
123
|
return new Promise((resolve, reject) => {
|
|
124
|
-
execFile(file, args, options, (error, stdout, stderr) =>
|
|
124
|
+
execFile(file, args, options, (error, stdout, stderr) => {
|
|
125
|
+
if (error || (rejectStderr && String(stderr || '').trim())) reject(Object.assign(error || new Error('OS query warning'), { stdout, stderr }));
|
|
126
|
+
else resolve(stdout);
|
|
127
|
+
});
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
130
|
|
|
@@ -494,11 +497,62 @@ export async function readProcessExecutableAsync(pid, { platform = process.platf
|
|
|
494
497
|
} catch { return null; }
|
|
495
498
|
}
|
|
496
499
|
|
|
500
|
+
// Evidence: peer-identity.js / peer-identity.test.mjs identify MoreLogin.app and MoreLogin Helper under
|
|
501
|
+
// Application Support/MoreLogin/env-kit/Core/chrome_64_*. morelogin-kernel.test.mjs also records Windows
|
|
502
|
+
// AppData/Roaming/MoreLogin/env-kit/Core/{chrome,firefox}_64_* driver paths. isMoreLoginInstalled uses the
|
|
503
|
+
// MoreLogin directory on Linux. Match those directory components and kernel names, never arbitrary arguments
|
|
504
|
+
// (a node test runner's arguments often contain "morelogin"). Include the desktop/helpers conservatively.
|
|
505
|
+
const MORELOGIN_EXECUTABLE = /(?:^|\/)morelogin(?: [^/]*)?\.app(?:\/|$)|(?:^|\/)morelogin(?:\/|$)|\/env-kit\/core\/(?:chrome|firefox)_/i;
|
|
506
|
+
const MORELOGIN_NAME = /^morelogin(?:[ ._-]|$)/i;
|
|
507
|
+
const POSSIBLE_PROFILE_BROWSER = /^(?:chrome|chromium|firefox|morelogin)(?:[ ._-]|$)/i;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* true when a MoreLogin process survives its API, false only after a readable process snapshot excludes it,
|
|
511
|
+
* null on unreadable/partial output. No process is signalled. macOS reports full executable paths via ps;
|
|
512
|
+
* Windows uses CIM Name/ExecutablePath; Linux resolves browser names through /proc/<pid>/exe because ps comm
|
|
513
|
+
* may be only a basename. Missing paths for a possible profile browser are unknown, never evidence of absence.
|
|
514
|
+
*/
|
|
515
|
+
export async function moreLoginProcessesRunning({ platform = process.platform, run = runFile,
|
|
516
|
+
executable = (pid) => readProcessExecutableAsync(pid, { platform, run }) } = {}) {
|
|
517
|
+
if (!['darwin', 'linux', 'win32'].includes(platform)) return null;
|
|
518
|
+
let rows;
|
|
519
|
+
try {
|
|
520
|
+
if (platform === 'win32') {
|
|
521
|
+
const query = powershell("$WarningPreference = 'Stop'; try { $rows = @(Get-CimInstance Win32_Process -ErrorAction Stop | Select-Object ProcessId,Name,ExecutablePath); ConvertTo-Json -Compress -InputObject $rows } catch { exit 1 }");
|
|
522
|
+
const data = JSON.parse(await run(query.file, query.args, { ...query.options, rejectStderr: true, maxBuffer: 16 * 1024 * 1024 }));
|
|
523
|
+
if (!Array.isArray(data) || !data.length || data.some(p => !Number.isInteger(p?.ProcessId) || p.ProcessId < 0
|
|
524
|
+
|| typeof p.Name !== 'string' || !p.Name.trim() || (p.ExecutablePath != null && typeof p.ExecutablePath !== 'string'))) return null;
|
|
525
|
+
rows = data.map(p => ({ pid: p.ProcessId, name: p.Name.trim(), path: p.ExecutablePath?.trim() || '' }));
|
|
526
|
+
} else {
|
|
527
|
+
const out = await run('ps', ['-A', '-ww', '-o', 'pid=', '-o', 'comm='],
|
|
528
|
+
{ encoding: 'utf8', timeout: 5000, env: C_ENV(), rejectStderr: true, maxBuffer: 16 * 1024 * 1024 });
|
|
529
|
+
const lines = String(out ?? '').trim().split(/\r?\n/);
|
|
530
|
+
rows = [];
|
|
531
|
+
for (const line of lines) {
|
|
532
|
+
const m = /^\s*(\d+)\s+(\S.*)$/.exec(line);
|
|
533
|
+
if (!m || !pidOf(m[1])) return null;
|
|
534
|
+
const path = m[2].trim();
|
|
535
|
+
rows.push({ pid: Number(m[1]), name: path.split('/').at(-1), path: path.startsWith('/') ? path : '' });
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
let unknown = false;
|
|
539
|
+
for (const row of rows) {
|
|
540
|
+
if (MORELOGIN_NAME.test(row.name) || MORELOGIN_EXECUTABLE.test(row.path.replaceAll('\\', '/'))) return true;
|
|
541
|
+
if (!POSSIBLE_PROFILE_BROWSER.test(row.name)) continue;
|
|
542
|
+
let path = row.path;
|
|
543
|
+
if (!path && platform === 'linux') path = await executable(row.pid);
|
|
544
|
+
if (!path) { unknown = true; continue; }
|
|
545
|
+
if (MORELOGIN_EXECUTABLE.test(path.replaceAll('\\', '/'))) return true;
|
|
546
|
+
}
|
|
547
|
+
return unknown ? null : false;
|
|
548
|
+
} catch { return null; }
|
|
549
|
+
}
|
|
550
|
+
|
|
497
551
|
/**
|
|
498
552
|
* The pids that listen on a local TCP port: a list (empty: nothing listens that the user may see), or null when the
|
|
499
553
|
* OS could not be asked. macOS and Linux: lsof (exit 1 with nothing printed is "none"; no lsof is null); Windows:
|
|
500
|
-
* Get-NetTCPConnection,
|
|
501
|
-
*
|
|
554
|
+
* Get-NetTCPConnection, with an explicit JSON array after a successful query. [] confirms the listener is gone;
|
|
555
|
+
* missing output, a failed query or malformed data is still unknown (null).
|
|
502
556
|
* @param {number} port
|
|
503
557
|
* @param {{ platform?: string, run?: (file: string, args: string[], options: object) => Promise<string> }} [o]
|
|
504
558
|
*/
|
|
@@ -508,10 +562,17 @@ export async function listPortListenersAsync(port, { platform = process.platform
|
|
|
508
562
|
const pidsIn = (out) => [...new Set(String(out ?? '').split(/\r?\n/).map((l) => l.trim()).filter((l) => /^\d+$/.test(l)).map(Number))]
|
|
509
563
|
.filter((n) => n > 0 && n !== selfPid);
|
|
510
564
|
if (platform === 'win32') {
|
|
511
|
-
|
|
565
|
+
// Filter in CIM: querying all TCP connections on every gone() poll is expensive on a busy machine. Only
|
|
566
|
+
// the cmdlet's specific CIM "no matching objects" error proves absence. Denials/timeouts/warnings do not.
|
|
567
|
+
const query = powershell(`$WarningPreference = 'Stop'; try { $listeners = @(Get-NetTCPConnection -LocalPort ${p} -State Listen -ErrorAction Stop); ConvertTo-Json -Compress -InputObject @($listeners | ForEach-Object { $_.OwningProcess }) } catch { ConvertTo-Json -Compress -InputObject @{ category = [string]$_.CategoryInfo.Category; reason = [string]$_.CategoryInfo.Reason; id = [string]$_.FullyQualifiedErrorId } }`);
|
|
512
568
|
try {
|
|
513
|
-
const pids =
|
|
514
|
-
|
|
569
|
+
const pids = JSON.parse(await run(query.file, query.args, { ...query.options, rejectStderr: true }));
|
|
570
|
+
// Get-NetTCPConnection's no-match exception is CimJobException (some CIM versions report CimException).
|
|
571
|
+
// Do not use localized error text or a generic ObjectNotFound: a missing command/module is not absence.
|
|
572
|
+
if (pids?.category === 'ObjectNotFound' && ['CimJobException', 'CimException'].includes(pids.reason)
|
|
573
|
+
&& /^CmdletizationQuery_NotFound(?:_[A-Za-z]+)?,Get-NetTCPConnection$/.test(pids.id)) return [];
|
|
574
|
+
if (!Array.isArray(pids) || pids.some(n => !Number.isSafeInteger(n) || n <= 0)) return null;
|
|
575
|
+
return [...new Set(pids)].filter(n => n !== selfPid);
|
|
515
576
|
} catch {
|
|
516
577
|
return null;
|
|
517
578
|
}
|
|
@@ -79,6 +79,9 @@ export const ADMIN_ONLY_PREFIXES = Object.freeze([
|
|
|
79
79
|
// The Skills Service's installs, rollbacks and removals, the move of the old bridges, and its settings: the
|
|
80
80
|
// owner's, from the app's own page (lib/skills/api-v2.js refuses guests and agents on its own too).
|
|
81
81
|
'/api/skills-studio/v2/installations', '/api/skills-studio/v2/migrations', '/api/skills-studio/v2/config',
|
|
82
|
+
// Agent definitions (their instructions, what they may touch) and their runs: the owner's (lib/agents-studio-api.js
|
|
83
|
+
// refuses guests on every route on its own too). The Assistant and agents reach it with their own headers.
|
|
84
|
+
'/api/agents-studio',
|
|
82
85
|
'/api/tunnel/start', '/api/tunnel/stop',
|
|
83
86
|
'/api/bridges', '/api/keybinds',
|
|
84
87
|
'/api/cli',
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Where macOS saves screenshots, for the screenshot watcher (server.js: a new screenshot is pasted on the whiteboard).
|
|
2
|
+
//
|
|
3
|
+
// The folder chosen in the Screenshot app is `defaults read com.apple.screencapture location`. When none was ever
|
|
4
|
+
// chosen (the usual case), `defaults` exits 1 and writes "Could not find key 'location' in domain
|
|
5
|
+
// 'com.apple.screencapture'" to stderr: that is the default (~/Desktop), not an error, so its stderr is never passed
|
|
6
|
+
// through to SynaBun's own output (it used to show up in the boot log as a bare "Error: …" line).
|
|
7
|
+
|
|
8
|
+
import { execFileSync } from 'node:child_process';
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
|
|
13
|
+
export const DEFAULTS = '/usr/bin/defaults';
|
|
14
|
+
export const SCREENCAPTURE_LOCATION_ARGS = Object.freeze(['read', 'com.apple.screencapture', 'location']);
|
|
15
|
+
const READ_TIMEOUT_MS = 5000;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The folder macOS saves screenshots in: the one set in the Screenshot app when it exists, else ~/Desktop.
|
|
19
|
+
* Never throws and never writes to the console.
|
|
20
|
+
* @param {{ run?: typeof execFileSync, exists?: (path: string) => boolean, home?: string }} [o] tests inject these.
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
export function macScreenshotDir({ run = execFileSync, exists = existsSync, home = homedir() } = {}) {
|
|
24
|
+
let dir = '';
|
|
25
|
+
try {
|
|
26
|
+
dir = String(run(DEFAULTS, [...SCREENCAPTURE_LOCATION_ARGS], {
|
|
27
|
+
encoding: 'utf8', timeout: READ_TIMEOUT_MS, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'],
|
|
28
|
+
}) ?? '').trim();
|
|
29
|
+
} catch { dir = ''; } // never set (exit 1), or `defaults` could not run: the default
|
|
30
|
+
let found = false;
|
|
31
|
+
try { found = !!dir && exists(dir) === true; } catch { found = false; }
|
|
32
|
+
return found ? dir : join(home, 'Desktop');
|
|
33
|
+
}
|
|
@@ -216,7 +216,7 @@ export function createSkillCreations({
|
|
|
216
216
|
if (!ok) throw new CreationError(400, problems.length === 1 ? `The request is not valid (${problems[0].field}: ${problems[0].code}).` : `${problems.length} problems with the request.`, 'invalid_request', { problems });
|
|
217
217
|
const missing = request.sources.find((s) => typeof gather[s.kind === 'import' ? 'importSource' : s.kind] !== 'function');
|
|
218
218
|
if (missing) throw new CreationError(409, `This server cannot read a ${missing.kind} source.`, 'source_unavailable', { problems: [{ field: 'sources', code: `${missing.kind}-unavailable` }] });
|
|
219
|
-
if (request.sources.some((s) => s.kind === 'url') && !canBrowse()) throw new CreationError(409, 'A web page is read with the SynaBun browser, which cannot open pages now (Settings → Browser).', 'needs_browser');
|
|
219
|
+
if (request.sources.some((s) => s.kind === 'url') && !canBrowse()) throw new CreationError(409, 'A web page is read with the SynaBun browser, which cannot open pages now (Settings → Browser, or the profile chosen in Settings → Connected tools → MoreLogin (Default AI browser)).', 'needs_browser');
|
|
220
220
|
// A project target is one of the registered projects (the install plan reads its folders).
|
|
221
221
|
const registered = new Set(safeList(projects).map((p) => resolve(String(p))));
|
|
222
222
|
const strange = request.targets.map((t, i) => ({ t, i })).filter(({ t }) => t.scope === 'project' && !registered.has(resolve(t.projectPath)));
|
|
@@ -24,6 +24,32 @@
|
|
|
24
24
|
],
|
|
25
25
|
"bridges": {
|
|
26
26
|
"codex": {
|
|
27
|
+
"agent-forge": [
|
|
28
|
+
{
|
|
29
|
+
"digest": "55c19a925599f4e5f93c45b52eabeaa8a9b72f70c8b1aa30055cd45ecc45188c",
|
|
30
|
+
"sep": "\\",
|
|
31
|
+
"generators": [
|
|
32
|
+
"g3"
|
|
33
|
+
],
|
|
34
|
+
"skillMd": [
|
|
35
|
+
"f307dffbdeb0"
|
|
36
|
+
],
|
|
37
|
+
"firstCommit": "28fd65720aa8",
|
|
38
|
+
"firstDate": "2026-11-15"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"digest": "efe8e3151f97e31a09cc9ba52635da53eb55d79c3341856b99769f17795352fd",
|
|
42
|
+
"sep": "/",
|
|
43
|
+
"generators": [
|
|
44
|
+
"g3"
|
|
45
|
+
],
|
|
46
|
+
"skillMd": [
|
|
47
|
+
"f307dffbdeb0"
|
|
48
|
+
],
|
|
49
|
+
"firstCommit": "28fd65720aa8",
|
|
50
|
+
"firstDate": "2026-11-15"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
27
53
|
"leonardo": [
|
|
28
54
|
{
|
|
29
55
|
"digest": "7865862f6cb04aba6b68641bfa5d308b16c9c78ac3bbc7f486a8d12d0094724b",
|
|
@@ -212,6 +238,20 @@
|
|
|
212
238
|
]
|
|
213
239
|
},
|
|
214
240
|
"opencode": {
|
|
241
|
+
"agent-forge": [
|
|
242
|
+
{
|
|
243
|
+
"digest": "6d42616e24a211f48b06ea8a35ed17913395c7c3b06a4b079e9c6c01c73ce3b6",
|
|
244
|
+
"sep": "any",
|
|
245
|
+
"generators": [
|
|
246
|
+
"g3"
|
|
247
|
+
],
|
|
248
|
+
"skillMd": [
|
|
249
|
+
"f307dffbdeb0"
|
|
250
|
+
],
|
|
251
|
+
"firstCommit": "28fd65720aa8",
|
|
252
|
+
"firstDate": "2026-11-15"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
215
255
|
"leonardo": [
|
|
216
256
|
{
|
|
217
257
|
"digest": "64b005834dd226dfc4287e2b27e8a6931a386268a5907494c30ccbaec4aeab32",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Source-scoped reads let run events update their labels without rereading unrelated Studios.
|
|
2
|
+
import { reviewCountOf } from '../public/shared/agents/studio/ax-library.js';
|
|
3
|
+
import { needsAttention, OVERDUE_AFTER } from '../public/shared/schedules-view.js';
|
|
4
|
+
import { runAwaitsAnswer } from '../public/shared/sidepanel-session-status.js';
|
|
5
|
+
import { scheduleMarked, templateMarked } from './automation-approval.js';
|
|
6
|
+
|
|
7
|
+
// The scheduler stamps scheduleId even for Run now and quick timers. Older descriptors can
|
|
8
|
+
// still identify a scheduler launch by its source (resolveScheduleRunPresentation).
|
|
9
|
+
const SCHEDULE_SOURCES = new Set(['schedule', 'schedule-manual', 'quick-timer', 'quick-timer-manual']);
|
|
10
|
+
|
|
11
|
+
function loopAttention(runs) {
|
|
12
|
+
const waiting = { automations: false, schedules: false };
|
|
13
|
+
for (const run of runs) {
|
|
14
|
+
// The dispatcher owns task runs, including their route/permission cards and removal.
|
|
15
|
+
if (!runAwaitsAnswer(run) || run.runMode === 'task' || run.source === 'assistant') continue;
|
|
16
|
+
if (run.scheduleId || SCHEDULE_SOURCES.has(run.source)) waiting.schedules = true;
|
|
17
|
+
else if (run.source === 'manual') waiting.automations = true;
|
|
18
|
+
}
|
|
19
|
+
return waiting;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function scheduleAttention(rows, now) {
|
|
23
|
+
let recheckInMs = null;
|
|
24
|
+
for (const schedule of rows) {
|
|
25
|
+
if (scheduleMarked(schedule) || needsAttention(schedule, now)) return { waiting: true, recheckInMs: null };
|
|
26
|
+
// A missed fire can become actionable without any record changing. The view uses a strict inequality.
|
|
27
|
+
const delay = Date.parse(schedule.nextRun) + OVERDUE_AFTER + 1 - now;
|
|
28
|
+
if (schedule.enabled && delay > 0 && (recheckInMs === null || delay < recheckInMs)) recheckInMs = delay;
|
|
29
|
+
}
|
|
30
|
+
return { waiting: false, recheckInMs };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function registerStudioAttention(app, { ownerPage, agents, teams, reviews, templates, schedules, workers, nativeRuns }) {
|
|
34
|
+
const readers = {
|
|
35
|
+
drafts: () => reviewCountOf({ agents: agents() }),
|
|
36
|
+
teams: () => teams().some(team => team.status === 'needs_attention' || team.status === 'ready'),
|
|
37
|
+
skills: () => reviews().some(review => review.state === 'pending' && !review.supersededBy),
|
|
38
|
+
automations: () => templates().some(templateMarked),
|
|
39
|
+
schedules: () => scheduleAttention(schedules(), Date.now()),
|
|
40
|
+
workers,
|
|
41
|
+
runs: () => loopAttention(nativeRuns()),
|
|
42
|
+
};
|
|
43
|
+
app.get('/api/studio-attention', ownerPage, (req, res) => {
|
|
44
|
+
const sources = req.query.sources === undefined ? Object.keys(readers) : String(req.query.sources).split(',');
|
|
45
|
+
if (!sources.every(key => Object.hasOwn(readers, key))) return res.sendStatus(400);
|
|
46
|
+
const answer = {};
|
|
47
|
+
for (const key of new Set(sources)) {
|
|
48
|
+
try { answer[key] = readers[key](); }
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.warn(`[studio-attention] ${key} unavailable:`, error.message);
|
|
51
|
+
answer[key] = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
res.set('Cache-Control', 'no-store').json(answer);
|
|
55
|
+
});
|
|
56
|
+
}
|