synabun 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +1 -1
- package/browser-extension/content.js +189 -0
- package/browser-extension/engine.js +508 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +250 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +166 -0
- package/browser-extension/popup.html +108 -0
- package/browser-extension/popup.js +359 -0
- package/browser-extension/protocol.js +232 -0
- package/browser-extension/service-worker.js +275 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/lib/data-home-files.js +45 -0
- package/lib/data-home-migration.js +34 -58
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +95 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +92 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +163 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +191 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +177 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1119 -47
- package/neural-interface/i18n/pt-BR.json +1119 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/builtins.json +207 -0
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +885 -0
- package/neural-interface/lib/agents/resolve.js +603 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-brains/opencode.js +60 -11
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +351 -121
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +432 -47
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +449 -94
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/backup-service.js +64 -105
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +264 -0
- package/neural-interface/lib/browser-extension-bridge.js +441 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +194 -8
- package/neural-interface/lib/native-loop-runtime.js +26 -7
- package/neural-interface/lib/opencode-build-preflight.js +28 -8
- package/neural-interface/lib/opencode-native-boundary.js +83 -13
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +73 -29
- package/neural-interface/lib/process-identity.js +68 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/session-cache-builder.js +41 -3
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +103 -12
- package/neural-interface/public/offline.html +4 -3
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/api.js +2 -1
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +37 -6
- package/neural-interface/public/shared/assistant/asst-route.js +80 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cc-dropdown.js +21 -15
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +34 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/owner-authority-view.js +4 -10
- package/neural-interface/public/shared/page-session.js +1 -1
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/start-bridge.js +2 -2
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +694 -50
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +83 -19
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +50 -21
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-owner-authority.js +48 -25
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +363 -400
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +6 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/sw.js +4 -3
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +30 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1083 -164
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// What Settings → Connected tools → MoreLogin says about MoreLogin's daily start limit, without the page.
|
|
2
|
+
// No imports: `node --test` loads it (tests/morelogin-start-cooldown.test.mjs).
|
|
3
|
+
//
|
|
4
|
+
// When MoreLogin refuses to start a profile because its plan's daily launches are used up, SynaBun holds every
|
|
5
|
+
// further start of that profile until MoreLogin's day resets (lib/morelogin-start-cooldown.js) and lists the held
|
|
6
|
+
// profiles as `startCooldowns` in GET /api/browser/morelogin-envs and GET /api/morelogin/status:
|
|
7
|
+
// [{ envId, name, resetAt (ISO), resetLocal, since, apiCode }]. The page shows one line per profile:
|
|
8
|
+
// "Start limit reached for <profile name>, resets <local time>".
|
|
9
|
+
|
|
10
|
+
/** The reset time in the viewer's own time zone: the time alone when it is today, else with the day. */
|
|
11
|
+
export function formatResetTime(resetAt, { now = Date.now(), locale = undefined } = {}) {
|
|
12
|
+
const at = new Date(resetAt);
|
|
13
|
+
if (Number.isNaN(at.getTime())) return '';
|
|
14
|
+
const today = new Date(now);
|
|
15
|
+
const sameDay = at.getFullYear() === today.getFullYear() && at.getMonth() === today.getMonth() && at.getDate() === today.getDate();
|
|
16
|
+
const options = sameDay
|
|
17
|
+
? { hour: '2-digit', minute: '2-digit' }
|
|
18
|
+
: { weekday: 'short', day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' };
|
|
19
|
+
try { return new Intl.DateTimeFormat(locale, options).format(at); }
|
|
20
|
+
catch { return at.toLocaleString(); }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The held profiles still in force at `now`, each with the name to show and its reset time:
|
|
25
|
+
* [{ envId, name, resetAt, time }]. The name is the server's, else the one in `envs` (the picker's list), else the id.
|
|
26
|
+
*/
|
|
27
|
+
export function startLimitNotes(cooldowns, envs = [], { now = Date.now(), locale = undefined } = {}) {
|
|
28
|
+
if (!Array.isArray(cooldowns)) return [];
|
|
29
|
+
const names = new Map((Array.isArray(envs) ? envs : []).filter((e) => e && e.id != null && e.name).map((e) => [String(e.id), String(e.name)]));
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const c of cooldowns) {
|
|
32
|
+
if (!c || !c.envId) continue;
|
|
33
|
+
const until = Date.parse(c.resetAt);
|
|
34
|
+
if (!Number.isFinite(until) || until <= now) continue;
|
|
35
|
+
out.push({ envId: String(c.envId), name: c.name || names.get(String(c.envId)) || String(c.envId), resetAt: c.resetAt, time: formatResetTime(c.resetAt, { now, locale }) });
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// A profile closed outside SynaBun (lib/morelogin-outside-close.js): SynaBun does not start it again for any session,
|
|
41
|
+
// run, agent or script until the owner starts it (MoreLogin, or Start here), a new scheduled run fires, or MoreLogin's
|
|
42
|
+
// daily reset (`holdUntil`). Listed as `closedOutside` in the same answers:
|
|
43
|
+
// [{ envId, name, closedAt (ISO), closedLocal, holdUntil (ISO), holdUntilLocal, runs }]. The page shows one line per
|
|
44
|
+
// profile: "Closed outside SynaBun at <local time>; SynaBun won't reopen <profile name> until you start it".
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The closes still in force at `now`, each with the name to show and the close time:
|
|
48
|
+
* [{ envId, name, closedAt, time }]. The name is the server's, else the one in `envs`, else the id.
|
|
49
|
+
*/
|
|
50
|
+
export function closedOutsideNotes(closes, envs = [], { now = Date.now(), locale = undefined } = {}) {
|
|
51
|
+
if (!Array.isArray(closes)) return [];
|
|
52
|
+
const names = new Map((Array.isArray(envs) ? envs : []).filter((e) => e && e.id != null && e.name).map((e) => [String(e.id), String(e.name)]));
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const c of closes) {
|
|
55
|
+
if (!c || !c.envId) continue;
|
|
56
|
+
const until = Date.parse(c.holdUntil);
|
|
57
|
+
if (Number.isFinite(until) && until <= now) continue;
|
|
58
|
+
const at = Date.parse(c.closedAt);
|
|
59
|
+
if (!Number.isFinite(at)) continue;
|
|
60
|
+
out.push({ envId: String(c.envId), name: c.name || names.get(String(c.envId)) || String(c.envId), closedAt: c.closedAt, time: formatResetTime(c.closedAt, { now, locale }) });
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — Settings → Tool permissions: the switch for every tool
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// The section's header has one switch for all of its groups, next to the total
|
|
5
|
+
// (ui-settings.js draws it and sends what this module says). It has three
|
|
6
|
+
// states, read from the tool switches themselves:
|
|
7
|
+
//
|
|
8
|
+
// on every tool is on a click switches them all off
|
|
9
|
+
// off every tool is off a click switches them all on
|
|
10
|
+
// mixed some are on a click switches them all on
|
|
11
|
+
//
|
|
12
|
+
// The groups of this section only: the social tools have their own section and
|
|
13
|
+
// their own "All". One request when the server takes several groups at once
|
|
14
|
+
// (`capabilities` of GET /api/claude-code/tool-permissions has `categories`);
|
|
15
|
+
// one request per group, in order, for a server from before that (public/ is
|
|
16
|
+
// reloaded at any time, the server only on a restart).
|
|
17
|
+
// No DOM, no imports: runs under node --test as well.
|
|
18
|
+
|
|
19
|
+
const K = 'settings.redesign.permissions.master';
|
|
20
|
+
|
|
21
|
+
/** 'on' | 'off' | 'mixed', or 'none' when the section has no tools. */
|
|
22
|
+
export function masterState(on, total) {
|
|
23
|
+
const all = Number(total) || 0;
|
|
24
|
+
const count = Math.max(0, Math.min(all, Number(on) || 0));
|
|
25
|
+
if (all <= 0) return 'none';
|
|
26
|
+
if (count === all) return 'on';
|
|
27
|
+
return count === 0 ? 'off' : 'mixed';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* What the switch shows and what a click asks for.
|
|
32
|
+
* @param {{ on: number, total: number }} counts
|
|
33
|
+
* @param {{ tx: (key: string, params?: object) => string }} o
|
|
34
|
+
* @returns {{ state: string, checked: 'true' | 'false' | 'mixed', enable: boolean, title: string, shown: boolean }}
|
|
35
|
+
*/
|
|
36
|
+
export function masterView({ on = 0, total = 0 } = {}, { tx = (key) => key } = {}) {
|
|
37
|
+
const state = masterState(on, total);
|
|
38
|
+
const shown = state !== 'none';
|
|
39
|
+
return {
|
|
40
|
+
state,
|
|
41
|
+
shown,
|
|
42
|
+
checked: state === 'on' ? 'true' : state === 'mixed' ? 'mixed' : 'false',
|
|
43
|
+
// Everything on is the only state a click switches off: a mixed list is completed, never emptied.
|
|
44
|
+
enable: state !== 'on',
|
|
45
|
+
title: shown ? tx(`${K}.${state}`, { on: Math.max(0, Number(on) || 0), total: Number(total) || 0 }) : '',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** How many tools of these groups are on: `{ on, total }`. A tool the server did not answer for counts as on, as its row is drawn. */
|
|
50
|
+
export function countTools(categories, perms) {
|
|
51
|
+
let on = 0, total = 0;
|
|
52
|
+
for (const cat of Array.isArray(categories) ? categories : []) {
|
|
53
|
+
for (const tool of Array.isArray(cat?.tools) ? cat.tools : []) {
|
|
54
|
+
total++;
|
|
55
|
+
if ((perms || {})[tool.key] !== false) on++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { on, total };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The bodies of the PUT /api/claude-code/tool-permissions requests that switch every tool of `categories`.
|
|
63
|
+
* @param {{ categories: string[], enabled: boolean, capabilities?: string[] }} o
|
|
64
|
+
*/
|
|
65
|
+
export function masterRequests({ categories, enabled, capabilities } = {}) {
|
|
66
|
+
const ids = [...new Set((Array.isArray(categories) ? categories : []).filter((id) => typeof id === 'string' && id))];
|
|
67
|
+
if (!ids.length || typeof enabled !== 'boolean') return [];
|
|
68
|
+
if (Array.isArray(capabilities) && capabilities.includes('categories')) return [{ categories: ids, enabled }];
|
|
69
|
+
return ids.map((category) => ({ category, enabled }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SynaBun — the five agent side panels (Claude Code, Codex, OpenCode, Antigravity, Maritaca), loaded on first use
|
|
2
|
+
// instead of at boot (lazy-module.js says how). Everything outside a panel reaches it through its facade:
|
|
3
|
+
// claude-panel-lazy.js, ui-codex-panel.js, ui-opencode-panel-v2.js, ui-antigravity-panel.js, ui-maritaca-panel.js.
|
|
4
|
+
// A detached session window (ui-sidepanel-session-entry.js) still imports the implementations by address.
|
|
5
|
+
//
|
|
6
|
+
// Module-level listeners kept working before the load (forwardEvents): the Claude panel's `claude-panel:show`
|
|
7
|
+
// (a notification's click-through) and OpenCode's `opencode-panel:show` / `request-show` / `request-new-session`.
|
|
8
|
+
// Codex, Antigravity and Maritaca register their show listeners when their panel is built, as before.
|
|
9
|
+
//
|
|
10
|
+
// Each panel is also a launch step (launch-prefetch.js: after the first paint, in idle time, one step at a time),
|
|
11
|
+
// so its module-level work (forking a duplicated window's tabs, pruning closed windows' keys) still runs in every
|
|
12
|
+
// session, as it did when the boot loaded it, and the first open does not wait for the download.
|
|
13
|
+
|
|
14
|
+
import { on, emit } from './state.js';
|
|
15
|
+
import { registerLaunchPrefetch } from './launch-prefetch.js';
|
|
16
|
+
import { createLazyModule, forwardEvents } from './lazy-module.js';
|
|
17
|
+
|
|
18
|
+
export const claudePanelModule = createLazyModule(() => import('./ui-claude-panel.js'), { name: 'Claude panel' });
|
|
19
|
+
export const codexPanelModule = createLazyModule(() => import('./cdx/cdx-panel.js'), { name: 'Codex panel' });
|
|
20
|
+
// cdx-panel.js imports cdx-tabs.js: one load brings both.
|
|
21
|
+
export const codexTabsModule = createLazyModule(() => codexPanelModule.load().then(() => import('./cdx/cdx-tabs.js')), { name: 'Codex tabs' });
|
|
22
|
+
export const opencodePanelModule = createLazyModule(() => import('./ocp-v2/ocp-v2-panel.js'), { name: 'OpenCode panel' });
|
|
23
|
+
export const antigravityPanelModule = createLazyModule(() => import('./agy/agy-panel.js'), { name: 'Antigravity panel' });
|
|
24
|
+
export const maritacaPanelModule = createLazyModule(() => import('./mtc/mtc-panel.js'), { name: 'Maritaca panel' });
|
|
25
|
+
|
|
26
|
+
const bus = { on, emit };
|
|
27
|
+
forwardEvents(claudePanelModule, ['claude-panel:show'], bus);
|
|
28
|
+
forwardEvents(opencodePanelModule, ['opencode-panel:show', 'opencode-panel:request-show', 'opencode-panel:request-new-session'], bus);
|
|
29
|
+
|
|
30
|
+
/** The launch steps, in the order the boot used to evaluate the panels (after Settings and the studios). */
|
|
31
|
+
export const SIDEPANEL_LAUNCH_STEPS = [
|
|
32
|
+
['sidepanel-module:claude', claudePanelModule],
|
|
33
|
+
['sidepanel-module:codex', codexPanelModule],
|
|
34
|
+
['sidepanel-module:opencode', opencodePanelModule],
|
|
35
|
+
['sidepanel-module:antigravity', antigravityPanelModule],
|
|
36
|
+
['sidepanel-module:maritaca', maritacaPanelModule],
|
|
37
|
+
];
|
|
38
|
+
SIDEPANEL_LAUNCH_STEPS.forEach(([name, lazy], index) => {
|
|
39
|
+
registerLaunchPrefetch(name, () => lazy.load(), { order: 80 + index });
|
|
40
|
+
});
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
//
|
|
2
|
-
// pill the main window shows for it. It is read from the window's own tray
|
|
3
|
-
// pills, the ones its provider panel paints from its sessions' state: Claude
|
|
4
|
-
// (tabWorking: a turn or background agents and shells; tabNeedsYou: a
|
|
5
|
-
// permission or a question waiting), Codex (a turn or a thread being made; an
|
|
6
|
-
// approval or a question card waiting), OpenCode (tabPillState: a turn, an
|
|
7
|
-
// automation's turn, a sub-agent's, one waiting on you) and the SynaBun
|
|
8
|
-
// Assistant (sessionStatus); Maritaca (a reply streaming: mtc-pill-running, it never waits on you). The same source as the tray pills, never a second
|
|
9
|
-
// guess. DOM-free.
|
|
1
|
+
// The detached host pill follows the state signals painted by the window's own tray pills.
|
|
10
2
|
|
|
11
|
-
const WORKING =
|
|
12
|
-
const NEEDS_YOU =
|
|
3
|
+
const WORKING = /-pill-running$/;
|
|
4
|
+
const NEEDS_YOU = /-pill-(attention|waiting)$/;
|
|
13
5
|
|
|
14
6
|
/** The states a detached window's pill shows: a session in it needs you > one works > none. */
|
|
15
7
|
export const SESSION_WINDOW_STATES = Object.freeze(['action', 'working', 'idle']);
|
|
16
8
|
|
|
17
9
|
/**
|
|
18
10
|
* 'action' when a session in the window waits on you, 'working' when one works,
|
|
19
|
-
* else 'idle'.
|
|
11
|
+
* else 'idle'. Each pill supplies its classes and optional pill and badge statuses.
|
|
20
12
|
*/
|
|
21
13
|
export function sessionWindowStatus(pills) {
|
|
22
14
|
let working = false;
|
|
23
|
-
for (const
|
|
24
|
-
|
|
15
|
+
for (const pill of pills || []) {
|
|
16
|
+
if (pill?.status === 'action' || pill?.badgeStatus === 'action') return 'action';
|
|
17
|
+
if (pill?.status === 'working' || pill?.badgeStatus === 'working') working = true;
|
|
18
|
+
for (const cls of (Array.isArray(pill) ? pill : pill?.classes) || []) {
|
|
25
19
|
if (NEEDS_YOU.test(cls)) return 'action';
|
|
26
20
|
if (WORKING.test(cls)) working = true;
|
|
27
21
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — "is this inside a closed side panel?", and "run this when it is shown"
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// A closed side panel stays in the page, hidden and skipped (ui-sidepanel-windows.js: data-sp-visible="false",
|
|
5
|
+
// content-visibility: hidden). Work that reads layout in there (getClientRects, scrollHeight, a focus) makes
|
|
6
|
+
// the engine lay the hidden panel out for nothing, and Chrome says so in the console ("Rendering was
|
|
7
|
+
// performed in a subtree hidden by content-visibility"). Such work asks here first: inside a closed panel it
|
|
8
|
+
// is held, and done once, right after the task that shows the panel. Outside one it runs at once, as before.
|
|
9
|
+
//
|
|
10
|
+
// No layout is read here: `closest()` and one attribute. tests/sidepanel-shown.test.mjs.
|
|
11
|
+
|
|
12
|
+
const VISIBLE_ATTR = 'data-sp-visible';
|
|
13
|
+
const CLOSED_PANEL = `.sp-sidepanel[${VISIBLE_ATTR}="false"]`;
|
|
14
|
+
|
|
15
|
+
/** The closed side panel `el` is inside, or null (not in a side panel, or in one that is on screen). */
|
|
16
|
+
export function closedSidepanelOf(el) {
|
|
17
|
+
return el && typeof el.closest === 'function' ? el.closest(CLOSED_PANEL) : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Hold `run` while `el` is inside a closed side panel.
|
|
22
|
+
*
|
|
23
|
+
* const gate = createShownGate(el, run);
|
|
24
|
+
* gate.request(); // runs `run` now, or once when the panel is shown (many requests while closed: one run)
|
|
25
|
+
* gate.pending(); // a request is waiting for the panel
|
|
26
|
+
* gate.cancel(); // forget a waiting request (teardown)
|
|
27
|
+
*
|
|
28
|
+
* `request()` returns true when `run` ran in the call. Without a MutationObserver (an old engine, a test
|
|
29
|
+
* without one) nothing can be awaited, so `run` runs at once: what the caller did before there was a gate.
|
|
30
|
+
*/
|
|
31
|
+
export function createShownGate(el, run, { MutationObserver: Observer } = {}) {
|
|
32
|
+
let host = null;
|
|
33
|
+
let observer = null;
|
|
34
|
+
|
|
35
|
+
const stop = () => {
|
|
36
|
+
try { observer?.disconnect(); } catch { /* already gone */ }
|
|
37
|
+
observer = null;
|
|
38
|
+
host = null;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const wait = (panel) => {
|
|
42
|
+
if (host === panel) return true;
|
|
43
|
+
const Ctor = Observer || el?.ownerDocument?.defaultView?.MutationObserver || globalThis.MutationObserver;
|
|
44
|
+
if (typeof Ctor !== 'function') return false;
|
|
45
|
+
stop();
|
|
46
|
+
host = panel;
|
|
47
|
+
try {
|
|
48
|
+
observer = new Ctor(() => {
|
|
49
|
+
// Still closed, and still around it: keep waiting. Shown, or the element left it: now.
|
|
50
|
+
if (panel.getAttribute(VISIBLE_ATTR) === 'false' && panel.contains(el)) return;
|
|
51
|
+
stop();
|
|
52
|
+
run();
|
|
53
|
+
});
|
|
54
|
+
observer.observe(panel, { attributes: true, attributeFilter: [VISIBLE_ATTR] });
|
|
55
|
+
} catch {
|
|
56
|
+
stop();
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
request() {
|
|
64
|
+
const panel = closedSidepanelOf(el);
|
|
65
|
+
if (panel && wait(panel)) return false;
|
|
66
|
+
if (host) stop(); // it left the closed panel (a detached window), or the panel was shown meanwhile
|
|
67
|
+
run();
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
pending: () => host !== null,
|
|
71
|
+
cancel: stop,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -266,7 +266,7 @@ export function fetchStartBeacon(target, { fetchImpl, timeoutMs = START_LIMITS.b
|
|
|
266
266
|
* launch() → hand START_LINK to the OS
|
|
267
267
|
* beacon() → Promise<object|null> the launch's raw report (optional)
|
|
268
268
|
* port → the server's port (what a beacon must be about)
|
|
269
|
-
* onState(state, detail) on every change of state
|
|
269
|
+
* onState(state, detail) on every change of state; online includes the answering server's boot id
|
|
270
270
|
* onUpdate(snapshot) whenever what there is to show changed: the
|
|
271
271
|
* state, what the launch reported, or the second
|
|
272
272
|
*
|
|
@@ -456,7 +456,7 @@ export function createStartBridge({
|
|
|
456
456
|
if (!up && !stopped && state !== 'refused') await listen();
|
|
457
457
|
probing = false;
|
|
458
458
|
if (stopped) return;
|
|
459
|
-
if (up) { set('online'); update(); return; }
|
|
459
|
+
if (up) { set('online', { boot: seen.boot }); update(); return; }
|
|
460
460
|
if (state === 'refused') { update(); return; }
|
|
461
461
|
if (state === 'launching' || state === 'waiting') {
|
|
462
462
|
const waited = now() - askedAt;
|
|
@@ -62,7 +62,12 @@ export function isShowcaseMode() {
|
|
|
62
62
|
async function _hydrate() {
|
|
63
63
|
let serverData = null;
|
|
64
64
|
try {
|
|
65
|
-
|
|
65
|
+
// index.html asks for it before any module loads (window.__synPrefetch.early): the graph no longer waits
|
|
66
|
+
// for its last module to be fetched before this request goes out. Taken once.
|
|
67
|
+
const early = globalThis.__synPrefetch?.early;
|
|
68
|
+
const pending = early?.['/api/ui-state'];
|
|
69
|
+
if (early) early['/api/ui-state'] = null;
|
|
70
|
+
const res = await (pending || fetch('/api/ui-state'));
|
|
66
71
|
if (res.ok) serverData = await res.json();
|
|
67
72
|
} catch { /* server unreachable */ }
|
|
68
73
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Refresh only the sources a sync event invalidated. Serialize overlapping reads so an older snapshot
|
|
2
|
+
// cannot clear a newer decision, and discard reads belonging to a previous owner session.
|
|
3
|
+
const SOURCES = ['drafts', 'teams', 'skills', 'automations', 'schedules', 'workers', 'runs'];
|
|
4
|
+
|
|
5
|
+
export function watchStudioAttention({ read, paint }) {
|
|
6
|
+
let owner = false;
|
|
7
|
+
let session = 0;
|
|
8
|
+
let state = {};
|
|
9
|
+
let reading = false;
|
|
10
|
+
let timer, overdue, retry;
|
|
11
|
+
let retried = false;
|
|
12
|
+
const dirty = new Set();
|
|
13
|
+
|
|
14
|
+
function render() {
|
|
15
|
+
paint(state.drafts || 0, {
|
|
16
|
+
agents: Boolean(state.drafts || state.teams || state.workers),
|
|
17
|
+
skills: Boolean(state.skills),
|
|
18
|
+
automations: Boolean(state.automations || state.runs?.automations),
|
|
19
|
+
schedules: Boolean(state.schedules?.waiting || state.runs?.schedules),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function refresh(...sources) {
|
|
24
|
+
if (!owner) return;
|
|
25
|
+
for (const key of sources.length ? sources : SOURCES) dirty.add(key);
|
|
26
|
+
if (!reading && timer == null) timer = setTimeout(flush, 250);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function flush() {
|
|
30
|
+
timer = null;
|
|
31
|
+
const keys = [...dirty];
|
|
32
|
+
dirty.clear();
|
|
33
|
+
const generation = session;
|
|
34
|
+
reading = true;
|
|
35
|
+
let incomplete = false;
|
|
36
|
+
try {
|
|
37
|
+
const next = await read(keys);
|
|
38
|
+
if (generation !== session) return;
|
|
39
|
+
for (const key of keys) {
|
|
40
|
+
if (next[key] == null) { incomplete = true; continue; }
|
|
41
|
+
state[key] = next[key];
|
|
42
|
+
if (key === 'schedules') {
|
|
43
|
+
clearTimeout(overdue);
|
|
44
|
+
const delay = next.schedules.recheckInMs;
|
|
45
|
+
if (delay != null) overdue = setTimeout(() => refresh('schedules'), Math.min(2 ** 31 - 1, delay));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
render();
|
|
49
|
+
} catch {
|
|
50
|
+
incomplete = true;
|
|
51
|
+
} finally {
|
|
52
|
+
if (generation === session) {
|
|
53
|
+
reading = false;
|
|
54
|
+
// Keep successful flags through a failure. Retry once, then let focus or reconnect resync.
|
|
55
|
+
if (incomplete && !retried && retry == null) {
|
|
56
|
+
retried = true;
|
|
57
|
+
retry = setTimeout(() => { retry = null; refresh(); }, 3000);
|
|
58
|
+
} else if (!incomplete) {
|
|
59
|
+
retried = false;
|
|
60
|
+
}
|
|
61
|
+
if (dirty.size) refresh(...dirty);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function setOwner(value) {
|
|
67
|
+
owner = value;
|
|
68
|
+
session++;
|
|
69
|
+
reading = false;
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
clearTimeout(overdue);
|
|
72
|
+
clearTimeout(retry);
|
|
73
|
+
timer = retry = null;
|
|
74
|
+
retried = false;
|
|
75
|
+
dirty.clear();
|
|
76
|
+
if (owner) refresh();
|
|
77
|
+
else {
|
|
78
|
+
state = {};
|
|
79
|
+
render();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { refresh, setOwner };
|
|
83
|
+
}
|