synabun 2.2.1 → 2.3.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 +53 -0
- package/README.md +1 -1
- package/docs/whatsapp.md +52 -20
- package/hooks/claude-code/pre-websearch.mjs +4 -1
- package/hooks/claude-code/prompt-submit.mjs +7 -0
- package/lib/mcp-build.js +519 -0
- package/lib/mcp-dist.js +10 -4
- package/lib/release-scan.mjs +23 -10
- package/lib/server-supervisor.js +7 -1
- package/lib/virustotal.mjs +146 -40
- package/mcp-server/dist/http.d.ts +57 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +128 -18
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +14 -9
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +119 -0
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
- package/mcp-server/dist/services/browser-route-flow.js +340 -0
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
- package/mcp-server/dist/services/desktop-client.js +2 -2
- package/mcp-server/dist/services/desktop-client.js.map +1 -1
- package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
- package/mcp-server/dist/services/embedding-service.js +2 -1
- package/mcp-server/dist/services/embedding-service.js.map +1 -1
- package/mcp-server/dist/services/identity.d.ts +66 -3
- package/mcp-server/dist/services/identity.d.ts.map +1 -1
- package/mcp-server/dist/services/identity.js +61 -4
- package/mcp-server/dist/services/identity.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +133 -1
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +630 -64
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +2 -2
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +3 -2
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +6 -4
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/bluesky.d.ts +20 -7
- package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
- package/mcp-server/dist/tools/bluesky.js +147 -45
- package/mcp-server/dist/tools/bluesky.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +13 -2
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +153 -18
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
- package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
- package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
- package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-navigate.js +19 -16
- package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
- package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
- package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-observe.js +61 -20
- package/mcp-server/dist/tools/browser-observe.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +13 -3
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +82 -19
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
- package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js +1 -1
- package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
- package/mcp-server/dist/tools/youtube/upload.js +225 -88
- package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +135 -17
- package/mcp-server/src/index.ts +15 -9
- package/mcp-server/src/services/browser-route-flow.ts +403 -0
- package/mcp-server/src/services/desktop-client.ts +2 -2
- package/mcp-server/src/services/embedding-service.ts +2 -1
- package/mcp-server/src/services/identity.ts +80 -4
- package/mcp-server/src/services/neural-interface.ts +648 -73
- package/mcp-server/src/services/tool-catalog.ts +2 -2
- package/mcp-server/src/tools/agents.ts +8 -4
- package/mcp-server/src/tools/bluesky.ts +164 -51
- package/mcp-server/src/tools/browser-advanced.ts +142 -17
- package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
- package/mcp-server/src/tools/browser-navigate.ts +19 -16
- package/mcp-server/src/tools/browser-observe.ts +62 -20
- package/mcp-server/src/tools/morelogin.ts +82 -19
- package/mcp-server/src/tools/youtube/helpers.ts +2 -2
- package/mcp-server/src/tools/youtube/upload.ts +218 -99
- package/neural-interface/i18n/en.json +655 -123
- package/neural-interface/i18n/pt-BR.json +542 -10
- package/neural-interface/lib/assistant-api.js +90 -23
- package/neural-interface/lib/assistant-brains/claude.js +5 -0
- package/neural-interface/lib/assistant-catalog.js +134 -3
- package/neural-interface/lib/assistant-dispatch.js +97 -1
- package/neural-interface/lib/assistant-persona.js +15 -7
- package/neural-interface/lib/assistant-router.js +6 -4
- package/neural-interface/lib/assistant-runtime.js +18 -1
- package/neural-interface/lib/assistant-task-prompt.js +5 -0
- package/neural-interface/lib/assistant-tools.js +10 -1
- package/neural-interface/lib/automation-approval.js +249 -0
- package/neural-interface/lib/automation-browser-owner-access.js +82 -0
- package/neural-interface/lib/backup-service.js +16 -1
- package/neural-interface/lib/browser-automation-routes.js +84 -0
- package/neural-interface/lib/browser-background-tab.js +72 -3
- package/neural-interface/lib/browser-execution.js +16 -3
- package/neural-interface/lib/browser-extraction.js +106 -45
- package/neural-interface/lib/browser-owner.js +48 -0
- package/neural-interface/lib/browser-profile-choices.js +143 -0
- package/neural-interface/lib/browser-profiles.js +142 -0
- package/neural-interface/lib/browser-session-close.js +84 -0
- package/neural-interface/lib/browser-start-handoff.js +202 -0
- package/neural-interface/lib/browser-tab-recovery.js +153 -0
- package/neural-interface/lib/browser-tool-policy.js +23 -4
- package/neural-interface/lib/browser-wedge-retire.js +64 -0
- package/neural-interface/lib/chromium-on-device-model.js +67 -0
- package/neural-interface/lib/claude-agent-bridge.js +43 -5
- package/neural-interface/lib/claude-background-hold.js +239 -0
- package/neural-interface/lib/claude-model-catalog.js +12 -0
- package/neural-interface/lib/effort-levels.js +28 -2
- package/neural-interface/lib/exec-loop-command.js +8 -0
- package/neural-interface/lib/http-guards.js +11 -6
- package/neural-interface/lib/local-profile-proxy.js +362 -0
- package/neural-interface/lib/local-profiles.js +929 -0
- package/neural-interface/lib/loop-logger.js +31 -5
- package/neural-interface/lib/maritaca/api.js +179 -0
- package/neural-interface/lib/maritaca/attachments.js +44 -0
- package/neural-interface/lib/maritaca/client.js +362 -0
- package/neural-interface/lib/maritaca/key-store.js +122 -0
- package/neural-interface/lib/maritaca/models.js +181 -0
- package/neural-interface/lib/maritaca/modes.js +39 -0
- package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
- package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
- package/neural-interface/lib/maritaca/opencode.js +218 -0
- package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
- package/neural-interface/lib/maritaca/sessions.js +198 -0
- package/neural-interface/lib/mcp-external-servers.js +37 -10
- package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
- package/neural-interface/lib/morelogin.js +278 -14
- package/neural-interface/lib/native-loop-providers.js +124 -11
- package/neural-interface/lib/native-loop-runtime.js +112 -11
- package/neural-interface/lib/owner-authority.js +137 -43
- package/neural-interface/lib/page-session.js +111 -27
- package/neural-interface/lib/peer-identity.js +263 -43
- package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
- package/neural-interface/lib/pty-host/core.js +36 -0
- package/neural-interface/lib/pty-host/protocol.js +2 -0
- package/neural-interface/lib/request-gate.js +2 -0
- package/neural-interface/lib/skills/api-v2.js +13 -2
- package/neural-interface/lib/skills/creation-api.js +3 -1
- package/neural-interface/lib/skills/evals-api.js +5 -1
- package/neural-interface/lib/social-write-pacing.js +151 -0
- package/neural-interface/lib/system-activity.js +1 -1
- package/neural-interface/lib/terminal-token-redaction.js +293 -0
- package/neural-interface/lib/terminal-tokens.js +436 -0
- package/neural-interface/lib/worker-mcp-channel.js +45 -10
- package/neural-interface/package-lock.json +3 -2
- package/neural-interface/package.json +2 -1
- package/neural-interface/public/assets/mascot/README.md +11 -0
- package/neural-interface/public/assets/mascot/ask.gif +0 -0
- package/neural-interface/public/assets/mascot/ask.png +0 -0
- package/neural-interface/public/assets/mascot/blocked.gif +0 -0
- package/neural-interface/public/assets/mascot/blocked.png +0 -0
- package/neural-interface/public/assets/mascot/budget.gif +0 -0
- package/neural-interface/public/assets/mascot/budget.png +0 -0
- package/neural-interface/public/assets/mascot/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/computer.png +0 -0
- package/neural-interface/public/assets/mascot/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/edit.png +0 -0
- package/neural-interface/public/assets/mascot/error.gif +0 -0
- package/neural-interface/public/assets/mascot/error.png +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
- package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
- package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
- package/neural-interface/public/assets/mascot/idle.gif +0 -0
- package/neural-interface/public/assets/mascot/idle.png +0 -0
- package/neural-interface/public/assets/mascot/manifest.json +254 -0
- package/neural-interface/public/assets/mascot/mcp.gif +0 -0
- package/neural-interface/public/assets/mascot/mcp.png +0 -0
- package/neural-interface/public/assets/mascot/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/memory.png +0 -0
- package/neural-interface/public/assets/mascot/offline.gif +0 -0
- package/neural-interface/public/assets/mascot/offline.png +0 -0
- package/neural-interface/public/assets/mascot/pick.gif +0 -0
- package/neural-interface/public/assets/mascot/pick.png +0 -0
- package/neural-interface/public/assets/mascot/plan.gif +0 -0
- package/neural-interface/public/assets/mascot/plan.png +0 -0
- package/neural-interface/public/assets/mascot/present.gif +0 -0
- package/neural-interface/public/assets/mascot/present.png +0 -0
- package/neural-interface/public/assets/mascot/project.gif +0 -0
- package/neural-interface/public/assets/mascot/project.png +0 -0
- package/neural-interface/public/assets/mascot/read.gif +0 -0
- package/neural-interface/public/assets/mascot/read.png +0 -0
- package/neural-interface/public/assets/mascot/runs.gif +0 -0
- package/neural-interface/public/assets/mascot/runs.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
- package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
- package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
- package/neural-interface/public/assets/mascot/search.gif +0 -0
- package/neural-interface/public/assets/mascot/search.png +0 -0
- package/neural-interface/public/assets/mascot/shell.gif +0 -0
- package/neural-interface/public/assets/mascot/shell.png +0 -0
- package/neural-interface/public/assets/mascot/skill.gif +0 -0
- package/neural-interface/public/assets/mascot/skill.png +0 -0
- package/neural-interface/public/assets/mascot/sleep.gif +0 -0
- package/neural-interface/public/assets/mascot/sleep.png +0 -0
- package/neural-interface/public/assets/mascot/subagent.gif +0 -0
- package/neural-interface/public/assets/mascot/subagent.png +0 -0
- package/neural-interface/public/assets/mascot/success.gif +0 -0
- package/neural-interface/public/assets/mascot/success.png +0 -0
- package/neural-interface/public/assets/mascot/think.gif +0 -0
- package/neural-interface/public/assets/mascot/think.png +0 -0
- package/neural-interface/public/assets/mascot/wait.gif +0 -0
- package/neural-interface/public/assets/mascot/wait.png +0 -0
- package/neural-interface/public/assets/mascot/watch.gif +0 -0
- package/neural-interface/public/assets/mascot/watch.png +0 -0
- package/neural-interface/public/assets/mascot/web.gif +0 -0
- package/neural-interface/public/assets/mascot/web.png +0 -0
- package/neural-interface/public/onboarding.html +14 -1
- package/neural-interface/public/shared/agent-runtime-options.js +49 -8
- package/neural-interface/public/shared/agy/agy-panel.js +2 -2
- package/neural-interface/public/shared/agy/agy-render.js +41 -1
- package/neural-interface/public/shared/agy/agy-styles.js +5 -0
- package/neural-interface/public/shared/api.js +5 -4
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
- package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
- package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
- package/neural-interface/public/shared/assistant/asst-control.js +1 -1
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +7 -5
- package/neural-interface/public/shared/assistant/asst-panel.js +13 -5
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
- package/neural-interface/public/shared/assistant/asst-render.js +16 -10
- package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
- package/neural-interface/public/shared/assistant/asst-route.js +24 -7
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
- package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
- package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
- package/neural-interface/public/shared/assistant/asst-state.js +72 -2
- package/neural-interface/public/shared/assistant/asst-styles.js +60 -15
- package/neural-interface/public/shared/automation-approval-view.js +75 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
- package/neural-interface/public/shared/context-menu-model.js +2 -0
- package/neural-interface/public/shared/cp/cp-agents.js +8 -0
- package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
- package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
- package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
- package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
- package/neural-interface/public/shared/editor/editor-panel.js +10 -2
- package/neural-interface/public/shared/html-shell.js +30 -22
- package/neural-interface/public/shared/judgments-log-origins.js +29 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
- package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
- package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
- package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
- package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
- package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
- package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
- package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
- package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +10 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
- package/neural-interface/public/shared/owner-access.js +134 -0
- package/neural-interface/public/shared/owner-authority-view.js +92 -0
- package/neural-interface/public/shared/page-session.js +143 -14
- package/neural-interface/public/shared/poll-backoff.js +59 -0
- package/neural-interface/public/shared/provider-icons.js +3 -0
- package/neural-interface/public/shared/schedules-view.js +7 -0
- package/neural-interface/public/shared/server-back.js +50 -0
- package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
- package/neural-interface/public/shared/settings/settings-data.js +7 -1
- package/neural-interface/public/shared/settings/settings-ia.js +3 -1
- package/neural-interface/public/shared/settings/settings-kit.js +11 -3
- package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
- package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
- package/neural-interface/public/shared/settings/settings-shell.js +7 -0
- package/neural-interface/public/shared/shown-children.js +72 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
- package/neural-interface/public/shared/state.js +1 -1
- package/neural-interface/public/shared/static-bg-state.js +22 -0
- package/neural-interface/public/shared/styles.css +457 -164
- package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
- package/neural-interface/public/shared/synabun-mascot.js +136 -12
- package/neural-interface/public/shared/synabun-ticker.js +3 -0
- package/neural-interface/public/shared/synabun-tools.js +173 -0
- package/neural-interface/public/shared/tool-heartbeat.js +43 -0
- package/neural-interface/public/shared/tool-list-picker.js +3 -1
- package/neural-interface/public/shared/tool-list-view.js +23 -4
- package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
- package/neural-interface/public/shared/ui-automation-approval.js +188 -0
- package/neural-interface/public/shared/ui-automation-studio.js +138 -91
- package/neural-interface/public/shared/ui-claude-panel.js +209 -31
- package/neural-interface/public/shared/ui-judgments.js +37 -10
- package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
- package/neural-interface/public/shared/ui-navbar.js +23 -0
- package/neural-interface/public/shared/ui-owner-access.js +191 -0
- package/neural-interface/public/shared/ui-owner-authority.js +162 -0
- package/neural-interface/public/shared/ui-panels.js +3 -1
- package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
- package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
- package/neural-interface/public/shared/ui-sessions.js +45 -16
- package/neural-interface/public/shared/ui-settings.js +676 -42
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
- package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
- package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
- package/neural-interface/public/shared/ui-terminal.js +15 -7
- package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
- package/neural-interface/public/shared/ui-update.js +3 -0
- package/neural-interface/public/shared/ui-whiteboard.js +4 -0
- package/neural-interface/public/shared/window-keys.js +38 -0
- package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
- package/neural-interface/server.js +2903 -359
- package/npm-shrinkwrap.json +5 -17
- package/package.json +5 -6
- package/postinstall.js +38 -39
- package/setup.js +33 -31
- package/skills/synabun/modules/changelog.md +14 -0
|
@@ -196,8 +196,8 @@ const DEFINITIONS: readonly ToolGroupDefinition[] = [
|
|
|
196
196
|
{
|
|
197
197
|
id: 'morelogin', label: 'MoreLogin', section: 'browser', browser: false, gate: null,
|
|
198
198
|
purpose: 'Manage MoreLogin anti-detect browser profiles and pick the browser the browser tools drive',
|
|
199
|
-
instructions: '- MoreLogin (anti-detect browser): morelogin (action: status/list/create/start/stop/use_default).
|
|
200
|
-
deferredGuidance: '- MoreLogin: profile management;
|
|
199
|
+
instructions: '- MoreLogin (anti-detect browser): morelogin (action: status/list/create/start/stop/use/use_default). To work in a profile other than the default, call action "use" with its envId or name: your own browser_* tools then drive that profile in a tab of your own, while other sessions keep theirs (several profiles can be driven at once). Only a profile the owner allowed agents to choose can be used ("list" says which; none until the owner switches one on in Settings → Connected tools → MoreLogin): when "use" or "start" is refused for that, tell the user and stop. use_default is always refused: the default profile is the owner\'s choice in Settings → Browser. Needs the MoreLogin desktop app running.',
|
|
200
|
+
deferredGuidance: '- MoreLogin: profile management; action "use" picks the profile your own browser_* tools drive, among the profiles the owner allowed agents to choose (other sessions unaffected). Requires the desktop app.',
|
|
201
201
|
tools: ['morelogin'],
|
|
202
202
|
},
|
|
203
203
|
{
|
|
@@ -55,7 +55,7 @@ export const agentRouteSchema = {
|
|
|
55
55
|
kind: z.enum(['direct', 'dispatch']).describe('"direct" = do it here on your own model (or another model of your own provider); "dispatch" = hand it to a worker.'),
|
|
56
56
|
provider: z.enum(PROVIDERS).optional().describe('Worker provider for "dispatch" (ignored for "direct").'),
|
|
57
57
|
model: z.string().max(200).optional().describe('Model id from the routing sheet / agent_catalog. Omit for the provider default (or a remembered route).'),
|
|
58
|
-
effort: z.string().max(40).optional().describe('Reasoning effort for that model, per agent_catalog (e.g. low…max/ultra; OpenCode uses the model\'s variant names). Unsupported values are corrected to the nearest level the model runs.'),
|
|
58
|
+
effort: z.string().max(40).optional().describe('Reasoning effort for that model, per agent_catalog (e.g. low…max/ultra; OpenCode uses the model\'s variant names). "none" turns thinking off: kept on Claude Code models that think and on Codex / OpenCode models that list none. Unsupported values are corrected to the nearest level the model runs (never to none).'),
|
|
59
59
|
account_id: z.string().max(64).optional().describe('Claude Code or Codex account id, or "auto" to choose the signed-in subscription with most usage left. API-key accounts are excluded from Auto. A limited pinned/default account falls back within the provider; corrections explain the selection. Another account runs on a worker when the proposal was direct.'),
|
|
60
60
|
reason: z.string().max(240).optional().describe('Why this model (one short clause, shown on the card).'),
|
|
61
61
|
})).min(1).max(3).describe('1-3 candidate routes, best first. The first is your pick.'),
|
|
@@ -117,7 +117,7 @@ export const agentDispatchSchema = {
|
|
|
117
117
|
'Provider model id from agent_catalog (Claude id or alias, a Codex model, or OpenCode "providerID/modelID"). "auto" or omitted = the approved route, a remembered route, or the provider default. Unknown ids are rejected with MODEL_UNKNOWN and suggestions.'
|
|
118
118
|
),
|
|
119
119
|
effort: z.string().max(40).optional().describe(
|
|
120
|
-
'Reasoning effort for the chosen model, per agent_catalog (e.g. low…max/ultra; OpenCode uses the model\'s variant names). Unsupported values are corrected to the nearest level the model runs. Omit for the default.'
|
|
120
|
+
'Reasoning effort for the chosen model, per agent_catalog (e.g. low…max/ultra; OpenCode uses the model\'s variant names). "none" turns thinking off: kept on Claude Code models that think and on Codex / OpenCode models that list none. Unsupported values are corrected to the nearest level the model runs (never to none). Omit for the default.'
|
|
121
121
|
),
|
|
122
122
|
tools: z.array(z.string().min(1).max(72)).max(32).optional().describe(
|
|
123
123
|
'SynaBun group ids plus mcp:<exact server name> or mcp:* from agent_catalog.tools.servers. Omitted = core with no external servers; [] = always-on only. Unnamed external servers are off on Codex, OpenCode, Claude and Antigravity. Browser use adds browser; design adds browser, styleguide and image. OpenCode loads the list strictly; Claude Code and Codex keep every SynaBun tool on demand and group choices set focus only; external-server selection is strict.'
|
|
@@ -140,6 +140,9 @@ export const agentDispatchSchema = {
|
|
|
140
140
|
uses_browser: z.boolean().optional().describe(
|
|
141
141
|
'true when the worker drives the SynaBun browser: it gets a loop browser tab and the browser enforcement block; page content is treated as untrusted data. Design runs default to true; false keeps one off the browser (no tab, no automatic browser group).'
|
|
142
142
|
),
|
|
143
|
+
morelogin_profile: z.string().max(200).optional().describe(
|
|
144
|
+
'With uses_browser: the MoreLogin profile (its id or its name, as the morelogin tool\'s "list" shows it) the worker\'s browser tab opens in, for this run only. Omit it for the default profile of Settings → Browser. Workers on different profiles run side by side; two on the same profile share its browser, each in its own tab. Only a profile the owner allowed agents to choose (the morelogin tool\'s "list" and "status" say which; none until the owner switches one on in SynaBun\'s Settings → Connected tools → MoreLogin): any other is refused with MORELOGIN_PROFILE_NOT_ALLOWED and nothing starts; tell the user which profile to switch on and where, and never dispatch into another profile instead. Only a Chrome-type profile; one that is unknown, Firefox-type or cannot start fails the dispatch by name (never another profile or browser). Use it when the user names a profile or an account for the task: never change the default AI browser for one run.'
|
|
145
|
+
),
|
|
143
146
|
focus: z.boolean().optional().describe(
|
|
144
147
|
'true to bring the worker\'s sidepanel tab to the front on attach. Default false: runs attach without stealing focus.'
|
|
145
148
|
),
|
|
@@ -234,7 +237,7 @@ export const agentUsageSchema = {
|
|
|
234
237
|
// ── Descriptions (routing instructions) ──
|
|
235
238
|
|
|
236
239
|
export const agentCatalogDescription =
|
|
237
|
-
'Discover what you can route to: providers (claude-code, codex, opencode, antigravity) with models (tier, price per 1M tokens, vision, context, efforts), accounts with subscription usage remaining (or usage unknown; API keys are n/a), registered projects (cwd candidates), SynaBun tool groups and each host\'s effect, rails/limits and active runs. Without arguments it returns a compact routing view (OpenCode sampled); pass provider and/or search to list more models. Call it when the routing sheet in your instructions lacks a model, or after a MODEL_UNKNOWN rejection. Returns JSON.';
|
|
240
|
+
'Discover what you can route to: providers (claude-code, codex, opencode, antigravity) with models (tier, price per 1M tokens, vision, context, efforts), plus `chat` (chat-only providers such as maritaca: a side panel the user talks to, prices in BRL, never a dispatch target), accounts with subscription usage remaining (or usage unknown; API keys are n/a), registered projects (cwd candidates), SynaBun tool groups and each host\'s effect, rails/limits and active runs. Without arguments it returns a compact routing view (OpenCode sampled); pass provider and/or search to list more models. Call it when the routing sheet in your instructions lacks a model, or after a MODEL_UNKNOWN rejection. Returns JSON.';
|
|
238
241
|
|
|
239
242
|
export const agentRouteDescription =
|
|
240
243
|
'Route an actionable task BEFORE starting it (you are the planner). Give task_class, a one-line summary, your honest confidence (0-1) and 1-3 proposals (direct = here on your model; dispatch = a worker provider/model). proposals.account_id accepts an account id or "auto" (most subscription usage left); limited pinned/default accounts fall back within the provider. The returned target.account includes usage and corrections explain the choice. The server applies the session\'s route mode (always ask / ask when unsure / never ask): it approves at once, or shows the user a route card and waits briefly. On a route card the user can always pick here or a worker, whatever you proposed: follow the returned target.kind and next, never your proposal. Follow the returned status and next: approved+dispatch → agent_dispatch with route_id; approved+direct → do it yourself (a route the user kept here is never dispatched: agent_dispatch refuses it with ROUTE_IS_DIRECT); continuation → end your turn (SynaBun continues on the chosen model); pending → end your turn, the choice arrives as a [SynaBun Mailbox] route_decided event; declined → do not start (reason no_capable_model: no model can make the image or video, or see for design; tell the user which Model routes row needs one); clarifying → end your turn, the user has not answered your agent_clarify questions yet (independent:true for a task that does not depend on them). image_gen / video_gen always route to a worker whose model generates the medium, design to a worker whose model can see. With a session budget, a provider whose share is used up cannot take the task: SynaBun first divides the unspent budget again, then moves the task to the next capable provider with money left (your next proposal, the same tier on another provider, then a free model) and says so in corrections (reason budget_share, "budget: codex share used up -> claude-code/sonnet"); the saved routes yield to this. When no provider can pay it declines with reason budget_exhausted and names the dry providers (dry). The result carries budget: each provider\'s share, spent and left. Never use it for conversation or bookkeeping. Returns JSON.';
|
|
@@ -246,7 +249,7 @@ export const agentListDescription =
|
|
|
246
249
|
'List dispatched worker runs with status, state, provider/model, title, elapsed time, work time left (workLeftMs), cost and resumes (how often a server restart cut the run off and it was resumed). Use it before dispatching more work, to recover run ids, or after a mailbox event. Filter with active_only, assistant_session_id (your own session) or workflow_id. Returns JSON.';
|
|
247
250
|
|
|
248
251
|
export const agentDispatchDescription =
|
|
249
|
-
'Dispatch a task to a worker agent (Claude Code, Codex or OpenCode). Route it first with agent_route and pass the approved route_id (the server applies that provider/model/effort); without one, the dispatch may be held until the user picks a model (awaitingRoute:true — do not dispatch it again; if the user picks "here" instead, the run never starts and a route_decided mailbox event asks you to do the task yourself). A route_id the user decided to keep here is refused (ROUTE_IS_DIRECT): do that task yourself. After agent_clarify, pass its brief_id: the worker gets the user\'s own words and answers; while its questions are open a dependent dispatch is refused (CLARIFICATION_PENDING). The run attaches as a live automation tab in the matching sidepanel without stealing focus. Write a self-contained task that ends with a ## Result block, pass the absolute cwd and your assistant_session_id. Defaults: permission_policy "auto", capability "full", 45 minutes of work time (max_minutes, at least 20), no per-run dollar ceiling (with a budget the run draws from its provider\'s share; a provider whose share is used up and cannot get more is refused with BUDGET_SHARE_EXHAUSTED: route again). Use "ask" only for sensitive scopes (Codex cannot ask: use "restricted"). uses_computer:true for desktop work (one at a time, vision model). An image_gen / video_gen run makes the asset with its model\'s own generation tool; SynaBun collects the files into the run\'s result (media: path + url); with no model that generates the medium an un-routed dispatch is refused (NO_CAPABLE_MODEL), and a route_id approved for other work is refused for image_gen / video_gen / design (and the other way round: ROUTE_CLASS_MISMATCH; route the task again with its own class). A design run gets SynaBun\'s design rules and the project\'s style guide, defaults to capability "workspace", uses_browser true, browser, styleguide and image groups, and 60 minutes of work time (explicit values win), runs only on a model confirmed to see (MODEL_CANNOT_SEE otherwise), and its screenshots land in the result\'s media. Group fan-outs with workflow_id, chain with parent_run_id, retry safely with idempotency_key. Over-limit dispatches are queued (queued:true, position). After dispatching, block with agent_wait rather than polling. Returns JSON.';
|
|
252
|
+
'Dispatch a task to a worker agent (Claude Code, Codex or OpenCode). Route it first with agent_route and pass the approved route_id (the server applies that provider/model/effort); without one, the dispatch may be held until the user picks a model (awaitingRoute:true — do not dispatch it again; if the user picks "here" instead, the run never starts and a route_decided mailbox event asks you to do the task yourself). A route_id the user decided to keep here is refused (ROUTE_IS_DIRECT): do that task yourself. After agent_clarify, pass its brief_id: the worker gets the user\'s own words and answers; while its questions are open a dependent dispatch is refused (CLARIFICATION_PENDING). The run attaches as a live automation tab in the matching sidepanel without stealing focus. Write a self-contained task that ends with a ## Result block, pass the absolute cwd and your assistant_session_id. Defaults: permission_policy "auto", capability "full", 45 minutes of work time (max_minutes, at least 20), no per-run dollar ceiling (with a budget the run draws from its provider\'s share; a provider whose share is used up and cannot get more is refused with BUDGET_SHARE_EXHAUSTED: route again). Use "ask" only for sensitive scopes (Codex cannot ask: use "restricted"). uses_computer:true for desktop work (one at a time, vision model). uses_browser:true with morelogin_profile (a profile id or name) opens the worker\'s browser tab in that MoreLogin profile for this run only, next to runs in the default or other profiles (only a profile the owner allowed agents to choose; MORELOGIN_PROFILE_NOT_ALLOWED otherwise: tell the user to switch it on in Settings). An image_gen / video_gen run makes the asset with its model\'s own generation tool; SynaBun collects the files into the run\'s result (media: path + url); with no model that generates the medium an un-routed dispatch is refused (NO_CAPABLE_MODEL), and a route_id approved for other work is refused for image_gen / video_gen / design (and the other way round: ROUTE_CLASS_MISMATCH; route the task again with its own class). A design run gets SynaBun\'s design rules and the project\'s style guide, defaults to capability "workspace", uses_browser true, browser, styleguide and image groups, and 60 minutes of work time (explicit values win), runs only on a model confirmed to see (MODEL_CANNOT_SEE otherwise), and its screenshots land in the result\'s media. Group fan-outs with workflow_id, chain with parent_run_id, retry safely with idempotency_key. Over-limit dispatches are queued (queued:true, position). After dispatching, block with agent_wait rather than polling. Returns JSON.';
|
|
250
253
|
|
|
251
254
|
export const agentStatusDescription =
|
|
252
255
|
'Get one run\'s current descriptor: status (queued, starting, running, completed, failed, stopped, interrupted), state (the detail: also idle, awaiting_permission, and suspended / resuming while a SynaBun server restart cuts a Claude Code worker off and the next start resumes it as the same run, its Claude session and its tab; resumes counts that, at most 3; a run that could not be resumed ends interrupted, with why in notes), turnState (running, idle, awaiting_permission), provider/model/account, elapsed time (elapsedMs, wall clock), work time used and left of max_minutes (workMs, workLeftMs), cost, the last parsed result summary and any pending permission or question requests. Cheap; use it between agent_wait calls or before agent_send / agent_stop. Returns JSON.';
|
|
@@ -369,6 +372,7 @@ export function handleAgentDispatch(args: AgentDispatchArgs): Promise<ToolResult
|
|
|
369
372
|
maxMinutes: args.max_minutes,
|
|
370
373
|
budgetUsd: args.budget_usd,
|
|
371
374
|
usesBrowser: args.uses_browser,
|
|
375
|
+
moreloginProfile: args.morelogin_profile,
|
|
372
376
|
focus: args.focus,
|
|
373
377
|
title: args.title,
|
|
374
378
|
context: args.context,
|
|
@@ -207,7 +207,10 @@ const HELPERS = [BSKY_SESSION_JS, BSKY_XRPC_JS, BSKY_NORMURI_JS, BSKY_UPLOAD_JS,
|
|
|
207
207
|
interface SessionArgs { sessionId?: string; tabId?: string }
|
|
208
208
|
interface CursorArgs extends SessionArgs { limit?: number; cursor?: string; maxItems?: number }
|
|
209
209
|
/** `expired`: the server rejected the token; `wrote`: a write had already landed in that script. */
|
|
210
|
-
type
|
|
210
|
+
type PacedWrite = { retryAfterMs: number; waitedMs: number; gapMinMs: number; gapMaxMs: number };
|
|
211
|
+
/** `missingRoute`: the script did not run, because its session or tab was gone. */
|
|
212
|
+
type BskyRead = { data: any } | { error: string; expired?: boolean; wrote?: boolean; missingRoute?: true };
|
|
213
|
+
type BskyResult = BskyRead | { paced: PacedWrite };
|
|
211
214
|
|
|
212
215
|
const BSKY_APP_URL = 'https://bsky.app/';
|
|
213
216
|
const BSKY_TARGET_PROBE_JS = `(() => {
|
|
@@ -241,9 +244,34 @@ function isSafeBlankTarget(target: BskyPageTarget): boolean {
|
|
|
241
244
|
return href === '' || /^about:blank(?:[?#].*)?$/.test(href);
|
|
242
245
|
}
|
|
243
246
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
/**
|
|
248
|
+
* The session and tab one tool call works in. When the session or tab a step names is gone, the Neural Interface
|
|
249
|
+
* client may run that step on the run's replacement tab instead and say so (`rerouted`); every later step of the
|
|
250
|
+
* call then follows it. Keeping the old id is what failed on 2026-11-04: the probe read the replacement tab
|
|
251
|
+
* (about:blank), the navigation went to the closed session and answered "Session not found".
|
|
252
|
+
*/
|
|
253
|
+
type PageRoute = { sessionId: string; tabId?: string };
|
|
254
|
+
/** A step that failed because its session or tab is gone, before anything ran: the call may find its tab again once. */
|
|
255
|
+
type StepError = { error: string; missingRoute?: true };
|
|
256
|
+
|
|
257
|
+
function follow(route: PageRoute, res: ni.NiResponse | null | undefined): void {
|
|
258
|
+
const next = res?.rerouted;
|
|
259
|
+
if (next && typeof next.sessionId === 'string' && next.sessionId) {
|
|
260
|
+
route.sessionId = next.sessionId;
|
|
261
|
+
route.tabId = next.tabId || undefined;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Same test as the client's isMissingRoute: the server refused before starting anything (SESSION_NOT_FOUND / TAB_NOT_FOUND). */
|
|
266
|
+
function missingRoute(res: ni.NiResponse | null | undefined): boolean {
|
|
267
|
+
return !!res && res.actionStarted === false && (res.code === 'SESSION_NOT_FOUND' || res.code === 'TAB_NOT_FOUND');
|
|
268
|
+
}
|
|
269
|
+
const stepError = (error: string, res?: ni.NiResponse | null): StepError => (missingRoute(res) ? { error, missingRoute: true } : { error });
|
|
270
|
+
|
|
271
|
+
async function inspectBlueskyTarget(route: PageRoute): Promise<BskyPageTarget | StepError> {
|
|
272
|
+
const inspected = await ni.evaluate(route.sessionId, BSKY_TARGET_PROBE_JS, route.tabId);
|
|
273
|
+
follow(route, inspected);
|
|
274
|
+
if (inspected.error) return stepError(`Could not inspect the assigned BlueSky tab: ${inspected.error}`, inspected);
|
|
247
275
|
const target = inspected.result as Partial<BskyPageTarget> | null;
|
|
248
276
|
if (!target || typeof target.href !== 'string') {
|
|
249
277
|
return { error: 'Could not inspect the assigned BlueSky tab: invalid page context response.' };
|
|
@@ -265,10 +293,11 @@ async function inspectBlueskyTarget(sessionId: string, tabId?: string): Promise<
|
|
|
265
293
|
export async function ensureBlueskyPageTarget(
|
|
266
294
|
sessionId: string,
|
|
267
295
|
tabId?: string,
|
|
268
|
-
|
|
269
|
-
|
|
296
|
+
route: PageRoute = { sessionId, tabId },
|
|
297
|
+
): Promise<{ ok: true; target: BskyPageTarget; route: PageRoute } | StepError> {
|
|
298
|
+
const inspected = await inspectBlueskyTarget(route);
|
|
270
299
|
if ('error' in inspected) return inspected;
|
|
271
|
-
if (isBlueskyTarget(inspected)) return { ok: true, target: inspected };
|
|
300
|
+
if (isBlueskyTarget(inspected)) return { ok: true, target: inspected, route };
|
|
272
301
|
|
|
273
302
|
const pageLabel = inspected.href || '(empty URL)';
|
|
274
303
|
if (!inspected.topLevel) {
|
|
@@ -280,17 +309,18 @@ export async function ensureBlueskyPageTarget(
|
|
|
280
309
|
};
|
|
281
310
|
}
|
|
282
311
|
|
|
283
|
-
const navigated = await ni.navigate(sessionId, BSKY_APP_URL, tabId, undefined, 'none');
|
|
312
|
+
const navigated = await ni.navigate(route.sessionId, BSKY_APP_URL, route.tabId, undefined, 'none');
|
|
313
|
+
follow(route, navigated);
|
|
284
314
|
if (navigated.error) {
|
|
285
|
-
return
|
|
315
|
+
return stepError(`Could not initialize the blank BlueSky tab at ${BSKY_APP_URL}: ${navigated.error}`, navigated);
|
|
286
316
|
}
|
|
287
317
|
|
|
288
|
-
const verified = await inspectBlueskyTarget(
|
|
318
|
+
const verified = await inspectBlueskyTarget(route);
|
|
289
319
|
if ('error' in verified) return verified;
|
|
290
320
|
if (!isBlueskyTarget(verified)) {
|
|
291
321
|
return { error: `BlueSky tab initialization ended at ${verified.href || '(empty URL)'} instead of ${BSKY_APP_URL}.` };
|
|
292
322
|
}
|
|
293
|
-
return { ok: true, target: verified };
|
|
323
|
+
return { ok: true, target: verified, route };
|
|
294
324
|
}
|
|
295
325
|
|
|
296
326
|
// JSON literal safe to embed inside JS source (escape the two line separators
|
|
@@ -306,14 +336,22 @@ function clampLimit(n?: number, def = 50, max = 100): number {
|
|
|
306
336
|
return Math.min(n, max);
|
|
307
337
|
}
|
|
308
338
|
|
|
309
|
-
async function evalBsky(sessionId: string, tabId: string | undefined, body: string): Promise<BskyResult> {
|
|
339
|
+
async function evalBsky(sessionId: string, tabId: string | undefined, body: string, pace?: ni.SocialWritePace): Promise<BskyResult> {
|
|
310
340
|
// The Neural Interface runs this via page.evaluate(string), which compiles the
|
|
311
341
|
// whole string as ONE expression — so the helper function declarations must
|
|
312
342
|
// live INSIDE the IIFE, not before it (a leading `function ...` is not an
|
|
313
343
|
// expression and throws "Unexpected token").
|
|
314
344
|
const script = `(async () => {\n${HELPERS}\n${body}\n})()`;
|
|
315
|
-
|
|
316
|
-
|
|
345
|
+
// Never run on a replacement tab the client picks by itself: that tab is about:blank, not the bsky.app page this
|
|
346
|
+
// call prepared. A gone session or tab comes back as missingRoute, and runPrepared prepares the run's new tab first.
|
|
347
|
+
const res = await ni.evaluate(sessionId, script, tabId, { recover: false, ...(pace && { pace }) });
|
|
348
|
+
if (res.error) return { error: `BlueSky call failed: ${res.error}`, ...(missingRoute(res) && { missingRoute: true as const }) };
|
|
349
|
+
// An automation's write waits out the account's gap inside the Neural Interface; when more of it is left than
|
|
350
|
+
// this call may wait, nothing ran and the answer says how much is left (the next call waits the rest).
|
|
351
|
+
const paced = res.paced as (Partial<PacedWrite> & { pending?: boolean }) | undefined;
|
|
352
|
+
if (paced?.pending) {
|
|
353
|
+
return { paced: { retryAfterMs: Number(paced.retryAfterMs) || 0, waitedMs: Number(paced.waitedMs) || 0, gapMinMs: Number(paced.gapMinMs) || 0, gapMaxMs: Number(paced.gapMaxMs) || 0 } };
|
|
354
|
+
}
|
|
317
355
|
const r = res.result as any;
|
|
318
356
|
if (r && r.__bskyError) return { error: r.__bskyError, expired: r.__bskyExpired === true, wrote: r.__bskyWrote === true };
|
|
319
357
|
return { data: r };
|
|
@@ -341,8 +379,9 @@ type TokenState = {
|
|
|
341
379
|
error?: string;
|
|
342
380
|
expiresAt?: number;
|
|
343
381
|
pageAgeMs?: number | null;
|
|
382
|
+
missingRoute?: true;
|
|
344
383
|
};
|
|
345
|
-
type FreshSession = { ok: true; reloaded: boolean } |
|
|
384
|
+
type FreshSession = { ok: true; reloaded: boolean } | StepError;
|
|
346
385
|
type OutOfTime = { error: string; timedOut: true };
|
|
347
386
|
|
|
348
387
|
const NOT_LOGGED_IN = 'Not logged in to BlueSky (no session token found on this page). Open a bsky.app tab, sign in, then retry.';
|
|
@@ -360,10 +399,11 @@ function beforeDeadline<T>(work: Promise<T>, deadlineAt: number, what: string):
|
|
|
360
399
|
}
|
|
361
400
|
const timedOut = (value: unknown): value is OutOfTime => !!value && typeof value === 'object' && (value as OutOfTime).timedOut === true;
|
|
362
401
|
|
|
363
|
-
async function readTokenState(
|
|
364
|
-
const res = await beforeDeadline(ni.evaluate(sessionId, TOKEN_STATE_SCRIPT, tabId), deadlineAt, 'reading the BlueSky session token');
|
|
402
|
+
async function readTokenState(route: PageRoute, deadlineAt: number): Promise<TokenState> {
|
|
403
|
+
const res = await beforeDeadline(ni.evaluate(route.sessionId, TOKEN_STATE_SCRIPT, route.tabId), deadlineAt, 'reading the BlueSky session token');
|
|
365
404
|
if (timedOut(res)) return { state: 'error', error: res.error };
|
|
366
|
-
|
|
405
|
+
follow(route, res);
|
|
406
|
+
if (res.error) return { state: 'error', error: `BlueSky call failed: ${res.error}`, ...(missingRoute(res) && { missingRoute: true as const }) };
|
|
367
407
|
const r = res.result as TokenState | null;
|
|
368
408
|
if (!r || typeof r.state !== 'string') return { state: 'error', error: 'BlueSky call failed: invalid session probe response.' };
|
|
369
409
|
return r;
|
|
@@ -371,10 +411,12 @@ async function readTokenState(sessionId: string, tabId: string | undefined, dead
|
|
|
371
411
|
|
|
372
412
|
/** Poll until the page holds a usable token (or none at all), the wait ends, or the
|
|
373
413
|
* call's deadline passes. `staleExpiresAt` names a token the server already rejected. */
|
|
374
|
-
async function waitForToken(
|
|
414
|
+
async function waitForToken(route: PageRoute, timeoutMs: number, deadlineAt: number, staleExpiresAt?: number): Promise<TokenState> {
|
|
375
415
|
const waitUntil = Math.min(Date.now() + timeoutMs, deadlineAt);
|
|
376
416
|
for (;;) {
|
|
377
|
-
const st = await readTokenState(
|
|
417
|
+
const st = await readTokenState(route, deadlineAt);
|
|
418
|
+
// The tab is gone: polling it again cannot help (the caller finds it again).
|
|
419
|
+
if (st.missingRoute) return st;
|
|
378
420
|
const renewed = staleExpiresAt === undefined || st.expiresAt !== staleExpiresAt;
|
|
379
421
|
// A page mid-reload can fail to evaluate for a moment; keep polling.
|
|
380
422
|
if (st.state === 'none' || (tokenUsable(st) && renewed)) return st;
|
|
@@ -392,52 +434,90 @@ async function waitForToken(sessionId: string, tabId: string | undefined, timeou
|
|
|
392
434
|
export async function ensureFreshBlueskySession(
|
|
393
435
|
sessionId: string,
|
|
394
436
|
tabId: string | undefined,
|
|
395
|
-
opts: { forceReload?: boolean; deadlineAt?: number } = {},
|
|
437
|
+
opts: { forceReload?: boolean; deadlineAt?: number; route?: PageRoute } = {},
|
|
396
438
|
): Promise<FreshSession> {
|
|
397
439
|
const by = opts.deadlineAt ?? Date.now() + BSKY_CALL_BUDGET_MS - BSKY_SCRIPT_RESERVE_MS;
|
|
398
|
-
const
|
|
440
|
+
const route = opts.route || { sessionId, tabId };
|
|
441
|
+
const first = await readTokenState(route, by);
|
|
399
442
|
if (first.state === 'none') return { error: first.error || NOT_LOGGED_IN };
|
|
400
|
-
if (first.state === 'error') return { error: first.error || 'BlueSky call failed.' };
|
|
443
|
+
if (first.state === 'error') return { error: first.error || 'BlueSky call failed.', ...(first.missingRoute && { missingRoute: true as const }) };
|
|
401
444
|
if (!opts.forceReload) {
|
|
402
445
|
if (tokenUsable(first)) return { ok: true, reloaded: false };
|
|
403
446
|
const pageAge = typeof first.pageAgeMs === 'number' ? first.pageAgeMs : Infinity;
|
|
404
447
|
if (pageAge < TOKEN_BOOT_WINDOW_MS) {
|
|
405
|
-
const booted = await waitForToken(
|
|
448
|
+
const booted = await waitForToken(route, TOKEN_BOOT_WAIT_MS, by);
|
|
406
449
|
if (booted.state === 'none') return { error: booted.error || NOT_LOGGED_IN };
|
|
450
|
+
if (booted.missingRoute) return { error: booted.error || 'BlueSky call failed.', missingRoute: true };
|
|
407
451
|
if (tokenUsable(booted)) return { ok: true, reloaded: false };
|
|
408
452
|
}
|
|
409
453
|
}
|
|
410
454
|
// Reload this bsky.app tab once so the app resumes its session and renews the token.
|
|
411
|
-
const reloaded = await beforeDeadline(ni.reload(sessionId, tabId), by, 'reloading the bsky.app tab to renew the session');
|
|
455
|
+
const reloaded = await beforeDeadline(ni.reload(route.sessionId, route.tabId), by, 'reloading the bsky.app tab to renew the session');
|
|
412
456
|
if (timedOut(reloaded)) return { error: `BlueSky token expired, and this call ran out of its ${BSKY_CALL_BUDGET_MS / 1000} s time limit while reloading the bsky.app tab to renew it. Try again; the next call starts with a fresh time limit.` };
|
|
413
|
-
|
|
414
|
-
|
|
457
|
+
follow(route, reloaded);
|
|
458
|
+
if (reloaded.error) return stepError(`BlueSky token expired, and reloading the bsky.app tab to renew it failed: ${reloaded.error}`, reloaded);
|
|
459
|
+
const after = await waitForToken(route, TOKEN_RELOAD_WAIT_MS, by, opts.forceReload ? first.expiresAt : undefined);
|
|
415
460
|
if (after.state === 'none') {
|
|
416
461
|
return { error: 'Not logged in to BlueSky: after reloading the bsky.app tab the page holds no session (the account was signed out). Sign in again in this browser profile, then retry.' };
|
|
417
462
|
}
|
|
418
463
|
if (tokenUsable(after)) return { ok: true, reloaded: true };
|
|
419
|
-
if (after.state === 'error') return { error: `BlueSky token expired, and the bsky.app tab could not be read after reloading it: ${after.error}
|
|
464
|
+
if (after.state === 'error') return { error: `BlueSky token expired, and the bsky.app tab could not be read after reloading it: ${after.error}`, ...(after.missingRoute && { missingRoute: true as const }) };
|
|
420
465
|
if (Date.now() >= by) return { error: 'BlueSky token was still expired when this call\'s time limit ran out (the bsky.app tab was reloaded once). Try again; the next call starts with a fresh time limit.' };
|
|
421
466
|
return { error: 'BlueSky token is still expired after waiting for bsky.app to renew it and reloading the tab once, so the saved session could not be renewed. Open bsky.app in this browser profile and sign in again if it asks.' };
|
|
422
467
|
}
|
|
423
468
|
|
|
424
|
-
type BskyRoute = { sessionId: string; tabId?: string; reloaded: boolean; deadlineAt: number };
|
|
469
|
+
type BskyRoute = { sessionId: string; tabId?: string; reloaded: boolean; deadlineAt: number; args: SessionArgs };
|
|
425
470
|
|
|
426
471
|
/** Resolve the caller's tab in the default browser, make sure it is a
|
|
427
472
|
* top-level bsky.app page, and make sure it holds a usable session token — all
|
|
428
|
-
* before the call's deadline minus the time kept for the tool's own request.
|
|
429
|
-
|
|
473
|
+
* before the call's deadline minus the time kept for the tool's own request.
|
|
474
|
+
* `refresh`: the route this caller had is gone; resolve it again without the cache (a pinned run gets its
|
|
475
|
+
* replacement tab, the one the next calls use too). */
|
|
476
|
+
async function prepareOnce(args: SessionArgs, deadlineAt: number, refresh: boolean): Promise<BskyRoute | StepError> {
|
|
430
477
|
const prepBy = deadlineAt - BSKY_SCRIPT_RESERVE_MS;
|
|
431
|
-
const
|
|
478
|
+
const find = refresh ? ni.refreshSession : ni.resolveSession;
|
|
479
|
+
const resolved = await beforeDeadline(find(args.sessionId, undefined, args.tabId, { platform: true }), prepBy, 'finding the bsky.app tab');
|
|
432
480
|
if ('error' in resolved) return { error: resolved.error };
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
|
|
481
|
+
const route: PageRoute = { sessionId: resolved.sessionId, tabId: resolved.tabId };
|
|
482
|
+
const ready = await beforeDeadline(ensureBlueskyPageTarget(route.sessionId, route.tabId, route), prepBy, 'opening bsky.app');
|
|
483
|
+
if ('error' in ready) return ready;
|
|
484
|
+
const fresh = await ensureFreshBlueskySession(route.sessionId, route.tabId, { deadlineAt: prepBy, route });
|
|
436
485
|
if ('error' in fresh) return fresh;
|
|
437
|
-
return { sessionId:
|
|
486
|
+
return { sessionId: route.sessionId, tabId: route.tabId, reloaded: fresh.reloaded, deadlineAt, args };
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Time enough before the script's reserve to find the run's tab again and prepare it. */
|
|
490
|
+
const canFindAgain = (deadlineAt: number) => deadlineAt - BSKY_SCRIPT_RESERVE_MS - Date.now() >= BSKY_RENEW_MIN_MS;
|
|
491
|
+
|
|
492
|
+
async function prepareBsky(args: SessionArgs, deadlineAt = Date.now() + BSKY_CALL_BUDGET_MS): Promise<BskyRoute | StepError> {
|
|
493
|
+
const first = await prepareOnce(args, deadlineAt, false);
|
|
494
|
+
// The session or tab this caller had is gone (another automation closed the browser, a wedged session was
|
|
495
|
+
// retired) and the client could not move the step by itself: find the run's tab again, once.
|
|
496
|
+
if ('error' in first && first.missingRoute && canFindAgain(deadlineAt)) {
|
|
497
|
+
const again = await prepareOnce(args, deadlineAt, true);
|
|
498
|
+
if ('error' in again) return { error: `${ROUTE_GONE} Finding this run's tab again failed: ${again.error}` };
|
|
499
|
+
return again;
|
|
500
|
+
}
|
|
501
|
+
return first;
|
|
438
502
|
}
|
|
439
503
|
|
|
504
|
+
/** What a call says when the browser tab it used went away under it. */
|
|
505
|
+
const ROUTE_GONE = 'The browser tab this BlueSky call used was closed (its browser session ended or was replaced).';
|
|
506
|
+
|
|
440
507
|
const UNCERTAIN = 'It may still finish in the page, so check the account before repeating a post, like, follow or message.';
|
|
508
|
+
const UNCERTAIN_PACED = 'It may still be waiting for its pacing gap and then finish in the page, so check the account before repeating it.';
|
|
509
|
+
|
|
510
|
+
/** Bluesky writes of an automation are spaced by SynaBun: what a write tool's description says about it. */
|
|
511
|
+
const PACING_NOTE = ' In a scheduled automation SynaBun spaces Bluesky writes (posts, replies, likes, reposts, follows and their undos, DMs) a minute or two apart inside this call: never sleep, start a background shell or a Monitor, or end your turn to wait between writes. When the gap needs longer than one call, the call writes nothing, says so, and the next identical call waits the rest.';
|
|
512
|
+
|
|
513
|
+
function pacedText(tool: string, paced: PacedWrite) {
|
|
514
|
+
const secs = (ms: number) => Math.max(1, Math.ceil((Number(ms) || 0) / 1000));
|
|
515
|
+
const range = paced.gapMinMs && paced.gapMaxMs ? ` ${secs(paced.gapMinMs)}-${secs(paced.gapMaxMs)} s apart` : '';
|
|
516
|
+
return text(`Not written yet: SynaBun spaces this automation's Bluesky writes${range}`
|
|
517
|
+
+ `${paced.waitedMs > 0 ? `, and this call waited ${secs(paced.waitedMs)} s of the gap` : ''}; about ${secs(paced.retryAfterMs)} s are left. `
|
|
518
|
+
+ `Call ${tool} again now with the same arguments: the call itself waits out the rest, then writes. `
|
|
519
|
+
+ 'Do not sleep, start a background shell or a Monitor, or end your turn to wait.');
|
|
520
|
+
}
|
|
441
521
|
|
|
442
522
|
/**
|
|
443
523
|
* Run a script on a prepared tab, within the call's deadline. When the server still
|
|
@@ -445,30 +525,58 @@ const UNCERTAIN = 'It may still finish in the page, so check the account before
|
|
|
445
525
|
* once more — only if nothing was written yet, the tab was not already reloaded
|
|
446
526
|
* for this call, and there is time left — so no post, like or message can repeat.
|
|
447
527
|
*/
|
|
448
|
-
async function runPrepared(route: BskyRoute, body: string): Promise<BskyResult> {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
528
|
+
async function runPrepared(route: BskyRoute, body: string, opts: { write?: boolean } = {}): Promise<BskyResult> {
|
|
529
|
+
// A write may wait for the account's pacing gap with whatever this call's budget leaves after the script's own
|
|
530
|
+
// reserve; the Neural Interface paces only an automation's writes (an interactive call never waits).
|
|
531
|
+
const paceNow = () => (opts.write ? { platform: 'bluesky' as const, maxWaitMs: Math.max(0, route.deadlineAt - BSKY_SCRIPT_RESERVE_MS - Date.now()) } : undefined);
|
|
532
|
+
let pace = paceNow();
|
|
533
|
+
let first = await beforeDeadline(evalBsky(route.sessionId, route.tabId, body, pace), route.deadlineAt, 'waiting for BlueSky to answer');
|
|
534
|
+
if (timedOut(first)) return { error: `${first.error} ${pace ? UNCERTAIN_PACED : UNCERTAIN}` };
|
|
535
|
+
if ('error' in first && first.missingRoute) {
|
|
536
|
+
// The script never ran (and took no pacing slot): its tab was closed before it started, or while the write
|
|
537
|
+
// waited for its gap. Find the run's tab again (a replacement starts blank: it is opened at bsky.app and its
|
|
538
|
+
// token checked), then run the script there once. Never more than once, so nothing can repeat.
|
|
539
|
+
const nothing = opts.write ? 'Nothing was written' : 'Nothing was read';
|
|
540
|
+
if (!canFindAgain(route.deadlineAt)) return { error: `${ROUTE_GONE} ${nothing}; call it again now: the next call finds the run's tab first.` };
|
|
541
|
+
const again = await prepareOnce(route.args, route.deadlineAt, true);
|
|
542
|
+
if ('error' in again) return { error: `${ROUTE_GONE} ${nothing}, and finding this run's tab again failed: ${again.error}` };
|
|
543
|
+
Object.assign(route, again);
|
|
544
|
+
pace = paceNow();
|
|
545
|
+
first = await beforeDeadline(evalBsky(route.sessionId, route.tabId, body, pace), route.deadlineAt, 'waiting for BlueSky to answer');
|
|
546
|
+
if (timedOut(first)) return { error: `${first.error} ${pace ? UNCERTAIN_PACED : UNCERTAIN}` };
|
|
547
|
+
if ('error' in first && first.missingRoute) return { error: `${ROUTE_GONE} ${nothing}; the replacement tab closed too. ${first.error}` };
|
|
548
|
+
}
|
|
549
|
+
if ('paced' in first || !('error' in first) || !first.expired) return first;
|
|
452
550
|
if (first.wrote || route.reloaded) {
|
|
453
551
|
return { error: `${first.error} The bsky.app tab was ${route.reloaded ? 'already reloaded once for this call' : 'not retried because part of this action was already written'}; check the account before trying again.`, expired: true, wrote: first.wrote };
|
|
454
552
|
}
|
|
455
553
|
if (route.deadlineAt - Date.now() < BSKY_SCRIPT_RESERVE_MS + BSKY_RENEW_MIN_MS) {
|
|
456
554
|
return { error: `${first.error} Not enough of this call's time limit is left to renew the session and try again; the next BlueSky call renews it first.`, expired: true, wrote: false };
|
|
457
555
|
}
|
|
458
|
-
const renewed = await ensureFreshBlueskySession(route.sessionId, route.tabId, { forceReload: true, deadlineAt: route.deadlineAt - BSKY_SCRIPT_RESERVE_MS });
|
|
459
|
-
if ('error' in renewed) return renewed;
|
|
460
|
-
|
|
556
|
+
const renewed = await ensureFreshBlueskySession(route.sessionId, route.tabId, { forceReload: true, deadlineAt: route.deadlineAt - BSKY_SCRIPT_RESERVE_MS, route });
|
|
557
|
+
if ('error' in renewed) return { error: renewed.error };
|
|
558
|
+
// The first attempt wrote nothing (it took no pacing slot): the retry goes through the same queue, at once.
|
|
559
|
+
const second = await beforeDeadline(evalBsky(route.sessionId, route.tabId, body, pace ? { platform: 'bluesky', maxWaitMs: 0 } : undefined), route.deadlineAt, 'waiting for BlueSky to answer the retry');
|
|
461
560
|
if (timedOut(second)) return { error: `${second.error} ${UNCERTAIN}` };
|
|
561
|
+
if ('paced' in second) return second;
|
|
462
562
|
if ('error' in second && second.expired) {
|
|
463
563
|
return { error: `${second.error} It was still rejected after the bsky.app tab renewed its session; sign in again in this browser profile if bsky.app asks.`, expired: true, wrote: second.wrote };
|
|
464
564
|
}
|
|
465
565
|
return second;
|
|
466
566
|
}
|
|
467
567
|
|
|
468
|
-
|
|
568
|
+
/** A read: never paced. */
|
|
569
|
+
async function runBsky(args: SessionArgs, body: string): Promise<BskyRead> {
|
|
570
|
+
const route = await prepareBsky(args);
|
|
571
|
+
if ('error' in route) return route;
|
|
572
|
+
return runPrepared(route, body) as Promise<BskyRead>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** A write (post, reply, like, follow, DM…): an automation's waits out the account's pacing gap. */
|
|
576
|
+
async function runBskyWrite(args: SessionArgs, body: string): Promise<BskyResult> {
|
|
469
577
|
const route = await prepareBsky(args);
|
|
470
578
|
if ('error' in route) return route;
|
|
471
|
-
return runPrepared(route, body);
|
|
579
|
+
return runPrepared(route, body, { write: true });
|
|
472
580
|
}
|
|
473
581
|
|
|
474
582
|
// ── Trimmers: shrink verbose AT Proto views to the useful, token-cheap fields ──
|
|
@@ -849,7 +957,7 @@ const blueskyPostSchema = {
|
|
|
849
957
|
...sessionFields,
|
|
850
958
|
};
|
|
851
959
|
const blueskyPostDescription =
|
|
852
|
-
'BlueSky: publish a post. Supports plain text with auto-facets (@mentions, links, #hashtags), replies (replyTo), quote-posts (quote), and up to 4 images (by url or local path, each with alt text). A link card (OG preview with thumbnail) is auto-generated for the first URL when the post has no images and no quote. Returns the new post uri+cid.';
|
|
960
|
+
'BlueSky: publish a post. Supports plain text with auto-facets (@mentions, links, #hashtags), replies (replyTo), quote-posts (quote), and up to 4 images (by url or local path, each with alt text). A link card (OG preview with thumbnail) is auto-generated for the first URL when the post has no images and no quote. Returns the new post uri+cid.' + PACING_NOTE;
|
|
853
961
|
async function handleBlueskyPost(args: {
|
|
854
962
|
text: string; replyTo?: string; quote?: string;
|
|
855
963
|
images?: Array<{ url?: string; path?: string; alt?: string }>; langs?: string[];
|
|
@@ -971,7 +1079,8 @@ async function handleBlueskyPost(args: {
|
|
|
971
1079
|
if (cr.__bskyError) return cr;
|
|
972
1080
|
return { uri: cr.uri, cid: cr.cid };`;
|
|
973
1081
|
|
|
974
|
-
const r = await runPrepared(resolved, body);
|
|
1082
|
+
const r = await runPrepared(resolved, body, { write: true });
|
|
1083
|
+
if ('paced' in r) return pacedText('bluesky_post', r.paced);
|
|
975
1084
|
if ('error' in r) return text(r.error);
|
|
976
1085
|
return text(`Posted to BlueSky: ${JSON.stringify({ uri: r.data.uri, cid: r.data.cid })}`);
|
|
977
1086
|
}
|
|
@@ -987,7 +1096,8 @@ const blueskyActionSchema = {
|
|
|
987
1096
|
...sessionFields,
|
|
988
1097
|
};
|
|
989
1098
|
const blueskyActionDescription =
|
|
990
|
-
'BlueSky: act on a post or actor. Post: like/unlike, repost/unrepost, delete (your own). Actor: follow/unfollow, mute/unmute, block/unblock. Undo actions resolve the record key automatically — never pass rkeys.';
|
|
1099
|
+
'BlueSky: act on a post or actor. Post: like/unlike, repost/unrepost, delete (your own). Actor: follow/unfollow, mute/unmute, block/unblock. Undo actions resolve the record key automatically — never pass rkeys.' + PACING_NOTE;
|
|
1100
|
+
const PACED_ACTIONS = new Set(['like', 'unlike', 'repost', 'unrepost', 'follow', 'unfollow']);
|
|
991
1101
|
async function handleBlueskyAction(args: { action: string; target: string } & SessionArgs) {
|
|
992
1102
|
const body = `
|
|
993
1103
|
var ACTION = ${jsLit(args.action)};
|
|
@@ -1064,7 +1174,9 @@ async function handleBlueskyAction(args: { action: string; target: string } & Se
|
|
|
1064
1174
|
return { ok:true, action:'delete', uri: uri };
|
|
1065
1175
|
}
|
|
1066
1176
|
return { __bskyError: 'Unknown action: ' + ACTION };`;
|
|
1067
|
-
|
|
1177
|
+
// Engagement and its undos are spaced like posts; moderation and deleting one's own record are not.
|
|
1178
|
+
const r = PACED_ACTIONS.has(args.action) ? await runBskyWrite(args, body) : await runBsky(args, body);
|
|
1179
|
+
if ('paced' in r) return pacedText('bluesky_action', r.paced);
|
|
1068
1180
|
if ('error' in r) return text(r.error);
|
|
1069
1181
|
return text(`BlueSky action: ${JSON.stringify(r.data)}`);
|
|
1070
1182
|
}
|
|
@@ -1104,7 +1216,7 @@ const blueskyDmSchema = {
|
|
|
1104
1216
|
...cursorFields, ...sessionFields,
|
|
1105
1217
|
};
|
|
1106
1218
|
const blueskyDmDescription =
|
|
1107
|
-
'BlueSky DMs (chat.bsky.*): list_convos, read messages in a convo, send a message (by convoId or members), or mark_read. Returns compact JSON.';
|
|
1219
|
+
'BlueSky DMs (chat.bsky.*): list_convos, read messages in a convo, send a message (by convoId or members), or mark_read. Returns compact JSON.' + PACING_NOTE;
|
|
1108
1220
|
async function handleBlueskyDm(args: { action: string; convoId?: string; members?: string[]; text?: string } & CursorArgs) {
|
|
1109
1221
|
const proxy = jsLit(CHAT_PROXY);
|
|
1110
1222
|
if (args.action === 'list_convos') {
|
|
@@ -1145,7 +1257,8 @@ async function handleBlueskyDm(args: { action: string; convoId?: string; members
|
|
|
1145
1257
|
var sm = await __bskyXrpc('chat.bsky.convo.sendMessage', { verb:'POST', proxy: ${proxy}, body:{ convoId: convoId, message: { text: ${jsLit(args.text)} } } });
|
|
1146
1258
|
if (sm.__bskyError) return sm;
|
|
1147
1259
|
return { ok:true, convoId: convoId, messageId: sm.id, sentAt: sm.sentAt };`;
|
|
1148
|
-
const r = await
|
|
1260
|
+
const r = await runBskyWrite(args, body);
|
|
1261
|
+
if ('paced' in r) return pacedText('bluesky_dm', r.paced);
|
|
1149
1262
|
if ('error' in r) return text(r.error);
|
|
1150
1263
|
return text(`DM sent: ${JSON.stringify(r.data)}`);
|
|
1151
1264
|
}
|