synabun 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/browser-extension/content.js +169 -0
- package/browser-extension/engine.js +477 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +244 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +165 -0
- package/browser-extension/popup.html +105 -0
- package/browser-extension/popup.js +347 -0
- package/browser-extension/protocol.js +226 -0
- package/browser-extension/service-worker.js +267 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +94 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +91 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +161 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +190 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +175 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1174 -47
- package/neural-interface/i18n/pt-BR.json +1174 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +840 -0
- package/neural-interface/lib/agents/resolve.js +544 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +229 -102
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +384 -42
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +440 -93
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +255 -0
- package/neural-interface/lib/browser-extension-bridge.js +418 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-profiles.js +1 -1
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/cli-install-api.js +23 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/editor-completion-opencode.js +4 -3
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/maritaca/opencode-proxy.js +7 -2
- package/neural-interface/lib/maritaca/opencode.js +35 -0
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +219 -7
- package/neural-interface/lib/native-loop-runtime.js +24 -1
- package/neural-interface/lib/opencode-build-preflight.js +116 -0
- package/neural-interface/lib/opencode-launch-error.js +13 -0
- package/neural-interface/lib/opencode-native-boundary.js +800 -84
- package/neural-interface/lib/opencode-serve-probe.js +426 -0
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/opencode-serve-scan.js +108 -0
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +60 -21
- package/neural-interface/lib/process-identity.js +235 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/lib/worker-mcp-channel.js +38 -1
- package/neural-interface/package-lock.json +4 -2
- package/neural-interface/package.json +3 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +52 -12
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +36 -6
- package/neural-interface/public/shared/assistant/asst-route.js +78 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +33 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/opencode-verify-view.js +175 -0
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +713 -61
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +12 -1
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-opencode-verify.js +120 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +372 -402
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +5 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +21 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1164 -157
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -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
|
|
|
@@ -327,11 +330,229 @@ export async function readProcessParentAsync(pid, { platform = process.platform,
|
|
|
327
330
|
}
|
|
328
331
|
}
|
|
329
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Every TCP address a process listens on, as the OS reports its sockets: `[{ host, port }]` (host without brackets:
|
|
335
|
+
* `127.0.0.1`, `::1`, `*` for every address), an empty list when it listens on none, or null when the OS could not be
|
|
336
|
+
* asked. macOS and Linux: `lsof -nP -a -p <pid> -iTCP -sTCP:LISTEN -Fn` (exit 1 with nothing printed is "none");
|
|
337
|
+
* Windows: Get-NetTCPConnection by its owning process. What the serve's command line says is never read here: the
|
|
338
|
+
* sockets are what a page could reach.
|
|
339
|
+
* @param {number} pid
|
|
340
|
+
* @param {{ platform?: string, run?: (file: string, args: string[], options: object) => Promise<string> }} [o]
|
|
341
|
+
*/
|
|
342
|
+
export async function listListenAddressesAsync(pid, { platform = process.platform, run = runFile } = {}) {
|
|
343
|
+
const n = pidOf(pid);
|
|
344
|
+
if (!n) return null;
|
|
345
|
+
const parse = (lines) => {
|
|
346
|
+
const out = [];
|
|
347
|
+
for (const raw of lines) {
|
|
348
|
+
const text = raw.trim();
|
|
349
|
+
if (!text) continue;
|
|
350
|
+
// "[::1]:4096", "127.0.0.1:4096", "*:4096" (lsof); "::1 4096" or "0.0.0.0 4096" (PowerShell below).
|
|
351
|
+
const m = /^\[?([^\]\s]*?)\]?[:\s](\d{1,5})$/.exec(text);
|
|
352
|
+
if (!m || !m[1]) return null;
|
|
353
|
+
out.push({ host: m[1].toLowerCase(), port: Number(m[2]) });
|
|
354
|
+
}
|
|
355
|
+
return out;
|
|
356
|
+
};
|
|
357
|
+
if (platform === 'win32') {
|
|
358
|
+
const query = powershell(`Get-NetTCPConnection -OwningProcess ${n} -State Listen -ErrorAction SilentlyContinue | ForEach-Object { "$($_.LocalAddress) $($_.LocalPort)" }`);
|
|
359
|
+
try { return parse(String(await run(query.file, query.args, query.options)).split(/\r?\n/)); } catch { return null; }
|
|
360
|
+
}
|
|
361
|
+
const names = (out) => String(out ?? '').split(/\r?\n/).filter((l) => l.startsWith('n')).map((l) => l.slice(1));
|
|
362
|
+
try {
|
|
363
|
+
return parse(names(await run('lsof', ['-nP', '-a', '-p', String(n), '-iTCP', '-sTCP:LISTEN', '-Fn'], { encoding: 'utf8', timeout: 5000, env: C_ENV() })));
|
|
364
|
+
} catch (error) {
|
|
365
|
+
// lsof exits 1 when nothing matched, and for errors too. Only a clean "nothing" (no output at all) is "listens on
|
|
366
|
+
// none"; sockets printed next to an error, or an error alone, are a partial answer: unknown, refused by callers.
|
|
367
|
+
if (error?.code !== 1) return null;
|
|
368
|
+
if (String(error.stdout ?? '').trim() || String(error.stderr ?? '').trim()) return null;
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* `readProcessIdentityAsync` for many pids in one question to the OS: a Map pid → `{ pid, startedAt, command }`; a
|
|
375
|
+
* pid the OS did not report (gone, or unreadable) is absent. null when the OS could not be asked at all.
|
|
376
|
+
* @param {number[]} pids
|
|
377
|
+
*/
|
|
378
|
+
export async function readProcessIdentitiesAsync(pids, { platform = process.platform, run = runFile } = {}) {
|
|
379
|
+
const list = [...new Set((pids || []).map(pidOf).filter(Boolean))];
|
|
380
|
+
const out = new Map();
|
|
381
|
+
if (!list.length) return out;
|
|
382
|
+
if (platform === 'win32') {
|
|
383
|
+
const filter = list.map((n) => `ProcessId=${n}`).join(' or ');
|
|
384
|
+
const query = powershell(`Get-CimInstance Win32_Process -Filter "${filter}" | ForEach-Object { [pscustomobject]@{ pid = $_.ProcessId; name = $_.Name; startedAt = $(if ($_.CreationDate) { $_.CreationDate.ToUniversalTime().ToString('o') } else { '' }); command = $_.CommandLine } } | ConvertTo-Json -Compress`);
|
|
385
|
+
try {
|
|
386
|
+
const text = String(await run(query.file, query.args, query.options)).trim();
|
|
387
|
+
const rows = text ? JSON.parse(text) : [];
|
|
388
|
+
for (const row of Array.isArray(rows) ? rows : [rows]) {
|
|
389
|
+
const n = pidOf(row?.pid);
|
|
390
|
+
// A protected system process has no command line for another user: its name is all there is ('' command).
|
|
391
|
+
if (n && (row.command || row.name)) out.set(n, { pid: n, startedAt: String(row.startedAt || ''), command: String(row.command || '').trim(), name: String(row.name || '') });
|
|
392
|
+
}
|
|
393
|
+
return out;
|
|
394
|
+
} catch { return null; }
|
|
395
|
+
}
|
|
396
|
+
let text;
|
|
397
|
+
try {
|
|
398
|
+
text = await run('ps', ['-ww', '-o', 'pid=', '-o', 'lstart=', '-o', 'command=', '-p', list.join(',')], { encoding: 'utf8', timeout: 5000, env: C_ENV() });
|
|
399
|
+
} catch (error) {
|
|
400
|
+
// ps exits 1 when some pid ran nothing: what it printed for the others still stands.
|
|
401
|
+
if (error?.code !== 1) return null;
|
|
402
|
+
text = error.stdout;
|
|
403
|
+
}
|
|
404
|
+
for (const line of String(text ?? '').split(/\r?\n/)) {
|
|
405
|
+
const m = PS_LINE.exec(line.trim());
|
|
406
|
+
const n = pidOf(m?.[1]);
|
|
407
|
+
if (m && n) out.set(n, { pid: n, startedAt: m[2].replace(/\s+/g, ' '), command: m[3].trim() });
|
|
408
|
+
}
|
|
409
|
+
return out;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Every process listening on TCP, as the OS reports its sockets: `[{ pid, name, addresses: [{ host, port }] }]` (an
|
|
414
|
+
* empty list when nothing listens), or null when the OS could not be asked or answered only in part. macOS and Linux:
|
|
415
|
+
* `lsof -nP -iTCP -sTCP:LISTEN -F pcn` (the user's own processes; exit 1 with nothing printed at all is "none", any
|
|
416
|
+
* other exit or any output next to an error is null); Windows: Get-NetTCPConnection as JSON. `selfPid` is left out.
|
|
417
|
+
* @param {{ platform?: string, run?: (file: string, args: string[], options: object) => Promise<string>, selfPid?: number }} [o]
|
|
418
|
+
*/
|
|
419
|
+
export async function listTcpListenersAsync({ platform = process.platform, run = runFile, selfPid = process.pid } = {}) {
|
|
420
|
+
const byPid = new Map();
|
|
421
|
+
const add = (pid, name, host, port) => {
|
|
422
|
+
const n = pidOf(pid);
|
|
423
|
+
const p = Number(port);
|
|
424
|
+
if (!n || !Number.isInteger(p) || p <= 0 || p > 65535 || !host) return false;
|
|
425
|
+
if (n === selfPid) return true;
|
|
426
|
+
const entry = byPid.get(n) || { pid: n, name: name || '', addresses: [] };
|
|
427
|
+
if (!entry.addresses.some((a) => a.host === host && a.port === p)) entry.addresses.push({ host, port: p });
|
|
428
|
+
byPid.set(n, entry);
|
|
429
|
+
return true;
|
|
430
|
+
};
|
|
431
|
+
if (platform === 'win32') {
|
|
432
|
+
const query = powershell('Get-NetTCPConnection -State Listen -ErrorAction Stop | ForEach-Object { [pscustomobject]@{ pid = $_.OwningProcess; host = $_.LocalAddress; port = $_.LocalPort } } | ConvertTo-Json -Compress');
|
|
433
|
+
let rows;
|
|
434
|
+
try {
|
|
435
|
+
const text = String(await run(query.file, query.args, query.options)).trim();
|
|
436
|
+
rows = text ? JSON.parse(text) : [];
|
|
437
|
+
} catch { return null; }
|
|
438
|
+
for (const row of Array.isArray(rows) ? rows : [rows]) {
|
|
439
|
+
// pid 0 / 4 are the kernel's own listeners (System Idle, System): never OpenCode.
|
|
440
|
+
if (row && (Number(row.pid) === 0 || Number(row.pid) === 4)) continue;
|
|
441
|
+
if (!row || !add(row.pid, '', String(row.host ?? '').toLowerCase(), row.port)) return null;
|
|
442
|
+
}
|
|
443
|
+
return [...byPid.values()];
|
|
444
|
+
}
|
|
445
|
+
let out;
|
|
446
|
+
try {
|
|
447
|
+
out = await run('lsof', ['-nP', '-iTCP', '-sTCP:LISTEN', '-F', 'pcn'], { encoding: 'utf8', timeout: 5000, env: C_ENV(), maxBuffer: 16 * 1024 * 1024 });
|
|
448
|
+
} catch (error) {
|
|
449
|
+
if (error?.code !== 1) return null;
|
|
450
|
+
if (String(error.stdout ?? '').trim() || String(error.stderr ?? '').trim()) return null;
|
|
451
|
+
return [];
|
|
452
|
+
}
|
|
453
|
+
let pid = null;
|
|
454
|
+
let name = '';
|
|
455
|
+
for (const raw of String(out ?? '').split(/\r?\n/)) {
|
|
456
|
+
if (!raw) continue;
|
|
457
|
+
const tag = raw[0];
|
|
458
|
+
const value = raw.slice(1);
|
|
459
|
+
if (tag === 'p') { pid = pidOf(value); name = ''; if (!pid) return null; continue; }
|
|
460
|
+
if (tag === 'c') { name = value; continue; }
|
|
461
|
+
if (tag === 'f') continue;
|
|
462
|
+
if (tag === 'n') {
|
|
463
|
+
const m = /^\[?([^\]\s]*?)\]?:(\d{1,5})$/.exec(value.trim());
|
|
464
|
+
if (!m || !m[1] || !pid || !add(pid, name, m[1].toLowerCase(), m[2])) return null;
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
// A field SynaBun did not ask for: the output is not the one this parser knows.
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
return [...byPid.values()];
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* The executable file a running process was started from, as the OS maps it (a symbolic link already followed):
|
|
475
|
+
* a path, or null when it cannot be read. macOS: the first `txt` file lsof reports for the pid; Linux:
|
|
476
|
+
* /proc/<pid>/exe; Windows: the process's ExecutablePath.
|
|
477
|
+
* @param {number} pid
|
|
478
|
+
*/
|
|
479
|
+
export async function readProcessExecutableAsync(pid, { platform = process.platform, run = runFile, readlink = null } = {}) {
|
|
480
|
+
const n = pidOf(pid);
|
|
481
|
+
if (!n) return null;
|
|
482
|
+
if (platform === 'linux') {
|
|
483
|
+
try {
|
|
484
|
+
const link = readlink || (await import('node:fs/promises')).readlink;
|
|
485
|
+
const target = String(await link(`/proc/${n}/exe`));
|
|
486
|
+
return target && !target.endsWith(' (deleted)') ? target : null;
|
|
487
|
+
} catch { return null; }
|
|
488
|
+
}
|
|
489
|
+
if (platform === 'win32') {
|
|
490
|
+
const query = powershell(`(Get-CimInstance Win32_Process -Filter "ProcessId=${n}").ExecutablePath`);
|
|
491
|
+
try { return firstLine(await run(query.file, query.args, query.options)) || null; } catch { return null; }
|
|
492
|
+
}
|
|
493
|
+
try {
|
|
494
|
+
const out = String(await run('lsof', ['-nP', '-a', '-p', String(n), '-d', 'txt', '-F', 'n'], { encoding: 'utf8', timeout: 5000, env: C_ENV() }));
|
|
495
|
+
const first = out.split(/\r?\n/).find((l) => l.startsWith('n'));
|
|
496
|
+
return first ? first.slice(1) : null;
|
|
497
|
+
} catch { return null; }
|
|
498
|
+
}
|
|
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
|
+
|
|
330
551
|
/**
|
|
331
552
|
* The pids that listen on a local TCP port: a list (empty: nothing listens that the user may see), or null when the
|
|
332
553
|
* OS could not be asked. macOS and Linux: lsof (exit 1 with nothing printed is "none"; no lsof is null); Windows:
|
|
333
|
-
* Get-NetTCPConnection,
|
|
334
|
-
*
|
|
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).
|
|
335
556
|
* @param {number} port
|
|
336
557
|
* @param {{ platform?: string, run?: (file: string, args: string[], options: object) => Promise<string> }} [o]
|
|
337
558
|
*/
|
|
@@ -341,10 +562,17 @@ export async function listPortListenersAsync(port, { platform = process.platform
|
|
|
341
562
|
const pidsIn = (out) => [...new Set(String(out ?? '').split(/\r?\n/).map((l) => l.trim()).filter((l) => /^\d+$/.test(l)).map(Number))]
|
|
342
563
|
.filter((n) => n > 0 && n !== selfPid);
|
|
343
564
|
if (platform === 'win32') {
|
|
344
|
-
|
|
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 } }`);
|
|
345
568
|
try {
|
|
346
|
-
const pids =
|
|
347
|
-
|
|
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);
|
|
348
576
|
} catch {
|
|
349
577
|
return null;
|
|
350
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
|
+
}
|