synabun 2.0.10 → 2.1.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 +86 -0
- package/README.md +25 -2
- package/THIRD-PARTY-LICENSES.md +22 -0
- package/bin/synabun.js +71 -24
- package/docs/whatsapp.md +2 -2
- package/hooks/claude-code/pre-websearch.mjs +12 -1
- package/hooks/claude-code/shared.mjs +5 -0
- package/hooks/claude-code/stop.mjs +1 -1
- package/lib/claude-hooks.js +172 -18
- package/lib/client-config-repair.js +17 -8
- package/lib/desktop-app.js +7 -1
- package/lib/external-tools.js +1 -1
- package/lib/first-launch-protection.js +57 -12
- package/lib/mcp-dist.js +176 -0
- package/lib/release-npm-ci.mjs +138 -0
- package/lib/release-publish.mjs +91 -0
- package/lib/release-scan.mjs +50 -0
- package/lib/server-crash-record.js +123 -0
- package/lib/server-exit.js +318 -0
- package/lib/server-supervisor.js +508 -0
- package/lib/start-launcher.js +37 -4
- package/lib/tools-cli.js +45 -0
- package/lib/update-snapshot.js +228 -0
- package/lib/virustotal.mjs +192 -0
- package/lib/windows-crash-event.js +269 -0
- package/mcp-server/dist/http.d.ts +20 -1
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +59 -12
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +33 -27
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +128 -143
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/preload.js +1 -1
- package/mcp-server/dist/preload.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts +6 -2
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +81 -28
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/memory-judge-backfill.d.ts +6 -0
- package/mcp-server/dist/services/memory-judge-backfill.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-judge-backfill.js +7 -1
- package/mcp-server/dist/services/memory-judge-backfill.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +16 -10
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +67 -11
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/server-instructions.d.ts +7 -2
- package/mcp-server/dist/services/server-instructions.d.ts.map +1 -1
- package/mcp-server/dist/services/server-instructions.js +20 -62
- package/mcp-server/dist/services/server-instructions.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.d.ts +120 -0
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -0
- package/mcp-server/dist/services/tool-catalog.js +339 -0
- package/mcp-server/dist/services/tool-catalog.js.map +1 -0
- package/mcp-server/dist/services/tool-list-refresh-barrier.d.ts +12 -0
- package/mcp-server/dist/services/tool-list-refresh-barrier.d.ts.map +1 -0
- package/mcp-server/dist/services/tool-list-refresh-barrier.js +40 -0
- package/mcp-server/dist/services/tool-list-refresh-barrier.js.map +1 -0
- package/mcp-server/dist/services/tool-list.d.ts +108 -0
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -0
- package/mcp-server/dist/services/tool-list.js +334 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -0
- package/mcp-server/dist/services/tool-runtime.d.ts +161 -0
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -0
- package/mcp-server/dist/services/tool-runtime.js +400 -0
- package/mcp-server/dist/services/tool-runtime.js.map +1 -0
- package/mcp-server/dist/services/whiteboard-geometry.d.ts +26 -2
- package/mcp-server/dist/services/whiteboard-geometry.d.ts.map +1 -1
- package/mcp-server/dist/services/whiteboard-geometry.js +91 -8
- package/mcp-server/dist/services/whiteboard-geometry.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +10 -10
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +22 -13
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-batch.d.ts +3 -3
- package/mcp-server/dist/tools/image-tools.d.ts +1 -1
- package/mcp-server/dist/tools/image-tools.js +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +505 -0
- package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -0
- package/mcp-server/dist/tools/skill-tools.js +639 -0
- package/mcp-server/dist/tools/skill-tools.js.map +1 -0
- package/mcp-server/dist/tools/skill.d.ts +7 -0
- package/mcp-server/dist/tools/skill.d.ts.map +1 -0
- package/mcp-server/dist/tools/skill.js +11 -0
- package/mcp-server/dist/tools/skill.js.map +1 -0
- package/mcp-server/dist/tools/tool-groups.d.ts +68 -0
- package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -0
- package/mcp-server/dist/tools/tool-groups.js +147 -0
- package/mcp-server/dist/tools/tool-groups.js.map +1 -0
- package/mcp-server/dist/tools/whiteboard-format.d.ts.map +1 -1
- package/mcp-server/dist/tools/whiteboard-format.js +7 -4
- package/mcp-server/dist/tools/whiteboard-format.js.map +1 -1
- package/mcp-server/dist/tools/whiteboard-tools.d.ts +64 -13
- package/mcp-server/dist/tools/whiteboard-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/whiteboard-tools.js +30 -5
- package/mcp-server/dist/tools/whiteboard-tools.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 +75 -12
- package/mcp-server/src/index.ts +147 -154
- package/mcp-server/src/preload.ts +12 -12
- package/mcp-server/src/services/codex-config-heal.ts +80 -29
- package/mcp-server/src/services/memory-judge-backfill.ts +7 -1
- package/mcp-server/src/services/neural-interface.ts +79 -20
- package/mcp-server/src/services/server-instructions.ts +27 -63
- package/mcp-server/src/services/tool-catalog.ts +403 -0
- package/mcp-server/src/services/tool-list-refresh-barrier.ts +33 -0
- package/mcp-server/src/services/tool-list.ts +410 -0
- package/mcp-server/src/services/tool-runtime.ts +457 -0
- package/mcp-server/src/services/whiteboard-geometry.ts +94 -9
- package/mcp-server/src/tools/agents.ts +22 -14
- package/mcp-server/src/tools/image-tools.ts +1 -1
- package/mcp-server/src/tools/skill-tools.ts +589 -0
- package/mcp-server/src/tools/skill.ts +13 -0
- package/mcp-server/src/tools/tool-groups.ts +164 -0
- package/mcp-server/src/tools/whiteboard-format.ts +9 -3
- package/mcp-server/src/tools/whiteboard-tools.ts +39 -5
- package/neural-interface/i18n/en.json +3463 -200
- package/neural-interface/i18n/pt-BR.json +3411 -151
- package/neural-interface/lib/assistant-api.js +127 -28
- package/neural-interface/lib/assistant-brains/claude.js +4 -3
- package/neural-interface/lib/assistant-brains/codex-browser-policy-hook.mjs +12 -2
- package/neural-interface/lib/assistant-brains/codex-route-gate-hook.mjs +32 -9
- package/neural-interface/lib/assistant-brains/codex.js +9 -5
- package/neural-interface/lib/assistant-brains/opencode.js +120 -54
- package/neural-interface/lib/assistant-brains/opencode2-browser-policy/index.js +28 -13
- package/neural-interface/lib/assistant-brains/opencode2-route-gate/index.js +59 -19
- package/neural-interface/lib/assistant-catalog.js +6 -7
- package/neural-interface/lib/assistant-dispatch.js +871 -156
- package/neural-interface/lib/assistant-envelope.js +3 -1
- package/neural-interface/lib/assistant-persona.js +80 -11
- package/neural-interface/lib/assistant-plan-permissions.js +10 -9
- package/neural-interface/lib/assistant-route-gate-codex.js +3 -0
- package/neural-interface/lib/assistant-route-gate.js +6 -4
- package/neural-interface/lib/assistant-router.js +13 -8
- package/neural-interface/lib/assistant-runtime.js +56 -18
- package/neural-interface/lib/assistant-task-prompt.js +78 -14
- package/neural-interface/lib/assistant-tools.js +51 -0
- package/neural-interface/lib/backup-service.js +620 -3
- package/neural-interface/lib/backup-zip-reader.js +10 -5
- package/neural-interface/lib/backup-zip-writer.js +257 -0
- package/neural-interface/lib/browser-execution.js +10 -2
- package/neural-interface/lib/browser-guard-cdp.js +83 -0
- package/neural-interface/lib/browser-network-guard.js +284 -0
- package/neural-interface/lib/browser-policy-roots.js +64 -0
- package/neural-interface/lib/browser-tool-policy.js +186 -31
- package/neural-interface/lib/claude-agent-bridge.js +4 -2
- package/neural-interface/lib/claude-hooks-status.js +103 -0
- package/neural-interface/lib/claude-temporary.js +5 -11
- package/neural-interface/lib/cli-install.js +18 -138
- package/neural-interface/lib/cli-resolver.js +4 -1
- package/neural-interface/lib/cli-update-planner.js +32 -31
- package/neural-interface/lib/cloudflared/tunnel.js +42 -2
- package/neural-interface/lib/codex-mcp-approvals.js +11 -0
- package/neural-interface/lib/codex-worker-app-server.js +172 -0
- package/neural-interface/lib/confined-fs.js +30 -3
- package/neural-interface/lib/crash-notice-api.js +98 -0
- package/neural-interface/lib/editor-completion-opencode.js +68 -68
- package/neural-interface/lib/exec-loop-command.js +4 -8
- package/neural-interface/lib/http-guards.js +8 -2
- package/neural-interface/lib/install-details.js +4 -1
- package/neural-interface/lib/mcp-agent-servers.js +67 -0
- package/neural-interface/lib/mcp-client-config.js +0 -29
- package/neural-interface/lib/mcp-external-servers.js +323 -0
- package/neural-interface/lib/{mcp-profile-refresh-coordinator.js → mcp-tools-refresh-coordinator.js} +4 -4
- package/neural-interface/lib/morelogin.js +30 -0
- package/neural-interface/lib/native-loop-providers.js +547 -47
- package/neural-interface/lib/native-loop-runtime.js +268 -41
- package/neural-interface/lib/opencode-config.js +557 -0
- package/neural-interface/lib/opencode-db-schema.js +17 -34
- package/neural-interface/lib/opencode-history.js +48 -218
- package/neural-interface/lib/opencode-mcp-ready.js +108 -0
- package/neural-interface/lib/opencode-native-boundary.js +44 -0
- package/neural-interface/lib/opencode-protocol.js +249 -112
- package/neural-interface/lib/opencode-runtime-config.js +32 -22
- package/neural-interface/lib/opencode-serve-records.js +39 -21
- package/neural-interface/lib/opencode-v2-client.js +48 -153
- package/neural-interface/lib/opencode-v2-ws-requests.js +36 -210
- package/neural-interface/lib/opencode-worker-data.js +27 -0
- package/neural-interface/lib/opencode2-client.js +73 -37
- package/neural-interface/lib/opencode2-proxy.js +23 -63
- package/neural-interface/lib/opencode2-translate.js +51 -2
- package/neural-interface/lib/owner-authority.js +249 -0
- package/neural-interface/lib/page-session.js +275 -0
- package/neural-interface/lib/peer-identity.js +763 -0
- package/neural-interface/lib/request-gate.js +17 -2
- package/neural-interface/lib/rulesets/api.js +1 -1
- package/neural-interface/lib/rulesets/fs-safe.js +1 -1
- package/neural-interface/lib/rulesets/installer.js +92 -27
- package/neural-interface/lib/rulesets/json-edit.js +1 -1
- package/neural-interface/lib/session-cache-builder.js +17 -30
- package/neural-interface/lib/session-title-generator.js +58 -36
- package/neural-interface/lib/skills/api-v2.js +495 -0
- package/neural-interface/lib/skills/bundle.js +418 -0
- package/neural-interface/lib/skills/catalog.js +294 -0
- package/neural-interface/lib/skills/creation-api.js +191 -0
- package/neural-interface/lib/skills/creation-brief.js +247 -0
- package/neural-interface/lib/skills/creation-sources.js +267 -0
- package/neural-interface/lib/skills/creation.js +843 -0
- package/neural-interface/lib/skills/deploy.js +564 -0
- package/neural-interface/lib/skills/digest.js +119 -0
- package/neural-interface/lib/skills/discover.js +111 -0
- package/neural-interface/lib/skills/draft-confinement.js +214 -0
- package/neural-interface/lib/skills/eval-confinement.js +397 -0
- package/neural-interface/lib/skills/eval-sandbox.js +280 -0
- package/neural-interface/lib/skills/eval-trace.js +119 -0
- package/neural-interface/lib/skills/evals-api.js +212 -0
- package/neural-interface/lib/skills/evals.js +1573 -0
- package/neural-interface/lib/skills/export.js +200 -0
- package/neural-interface/lib/skills/frontmatter.js +64 -0
- package/neural-interface/lib/skills/health.js +75 -0
- package/neural-interface/lib/skills/json-edit.js +165 -0
- package/neural-interface/lib/skills/known-bridge-digests.json +387 -0
- package/neural-interface/lib/skills/known-bridges.js +96 -0
- package/neural-interface/lib/skills/library.js +823 -0
- package/neural-interface/lib/skills/local-store.js +21 -0
- package/neural-interface/lib/skills/migration.js +433 -0
- package/neural-interface/lib/skills/operations.js +45 -0
- package/neural-interface/lib/skills/ownership.js +427 -0
- package/neural-interface/lib/skills/packages.js +88 -0
- package/neural-interface/lib/skills/reviews.js +212 -0
- package/neural-interface/lib/skills/revision.js +80 -0
- package/neural-interface/lib/skills/roots.js +262 -0
- package/neural-interface/lib/skills/runtime-checks.js +355 -0
- package/neural-interface/lib/skills/scan-assets.js +252 -0
- package/neural-interface/lib/skills/scan-context.js +26 -0
- package/neural-interface/lib/skills/scan-shell.js +324 -0
- package/neural-interface/lib/skills/scan.js +364 -0
- package/neural-interface/lib/skills/scanners.js +54 -0
- package/neural-interface/lib/skills/service.js +522 -0
- package/neural-interface/lib/skills/telemetry.js +113 -0
- package/neural-interface/lib/sqlite-integrity-worker.js +22 -0
- package/neural-interface/lib/tool-lists.js +124 -0
- package/neural-interface/lib/whatsapp/bridge.js +6 -3
- package/neural-interface/lib/worker-confinement.js +1192 -0
- package/neural-interface/lib/worker-guard-setting.js +56 -0
- package/neural-interface/lib/worker-mcp-channel.js +175 -0
- package/neural-interface/lib/worker-relay-ports.js +227 -0
- package/neural-interface/lib/worker-resume.js +229 -0
- package/neural-interface/lib/worker-sandbox.js +299 -0
- package/neural-interface/package-lock.json +18 -12
- package/neural-interface/package.json +2 -2
- package/neural-interface/public/index.html +3 -1
- package/neural-interface/public/index2d.html +19 -11
- package/neural-interface/public/onboarding.html +2 -2
- package/neural-interface/public/shared/account-menu.js +8 -5
- package/neural-interface/public/shared/agent-runtime-options.js +35 -19
- package/neural-interface/public/shared/api.js +1527 -1336
- package/neural-interface/public/shared/app-frame.js +192 -0
- package/neural-interface/public/shared/assistant/asst-agents-dock.js +33 -2
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +270 -0
- package/neural-interface/public/shared/assistant/asst-ask-tail.js +118 -0
- package/neural-interface/public/shared/assistant/asst-ask.js +397 -0
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +49 -35
- package/neural-interface/public/shared/assistant/asst-control.js +157 -26
- package/neural-interface/public/shared/assistant/asst-followups-card.js +383 -0
- package/neural-interface/public/shared/assistant/asst-followups.js +417 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +40 -0
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +294 -0
- package/neural-interface/public/shared/assistant/asst-limit.js +168 -0
- package/neural-interface/public/shared/assistant/asst-mascot.js +49 -12
- package/neural-interface/public/shared/assistant/asst-menu.js +7 -6
- package/neural-interface/public/shared/assistant/asst-panel.js +106 -11
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +66 -49
- package/neural-interface/public/shared/assistant/asst-render.js +401 -77
- package/neural-interface/public/shared/assistant/asst-route.js +83 -12
- package/neural-interface/public/shared/assistant/asst-scenes.js +2 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +67 -4
- package/neural-interface/public/shared/assistant/asst-slash.js +9 -7
- package/neural-interface/public/shared/assistant/asst-state.js +11 -15
- package/neural-interface/public/shared/assistant/asst-stop.js +127 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +59 -21
- package/neural-interface/public/shared/assistant/asst-tool-kinds.js +156 -16
- package/neural-interface/public/shared/automation-context.js +5 -2
- package/neural-interface/public/shared/cc-dropdown.js +89 -19
- package/neural-interface/public/shared/cdx/cdx-context-menu.js +10 -9
- package/neural-interface/public/shared/cdx/cdx-copy.js +16 -0
- package/neural-interface/public/shared/cdx/cdx-output-model.js +22 -1
- package/neural-interface/public/shared/cdx/cdx-output.js +8 -7
- package/neural-interface/public/shared/cdx/cdx-panel.js +45 -149
- package/neural-interface/public/shared/cdx/cdx-protocol.js +28 -1
- package/neural-interface/public/shared/cdx/cdx-render.js +47 -29
- package/neural-interface/public/shared/cdx/cdx-requests.js +3 -3
- package/neural-interface/public/shared/cdx/cdx-skill-hints.js +54 -0
- package/neural-interface/public/shared/cdx/cdx-styles.js +11 -3
- package/neural-interface/public/shared/cdx/cdx-tabs.js +52 -39
- package/neural-interface/public/shared/cdx/cdx-ws.js +0 -1
- package/neural-interface/public/shared/cli-install-view.js +4 -8
- package/neural-interface/public/shared/cli-status.js +2 -2
- package/neural-interface/public/shared/constants.js +2 -2
- package/neural-interface/public/shared/context-menu-areas.js +34 -0
- package/neural-interface/public/shared/context-menu-logic.js +243 -0
- package/neural-interface/public/shared/context-menu-model.js +366 -0
- package/neural-interface/public/shared/context-menu.js +372 -0
- package/neural-interface/public/shared/cp/cp-context-menu.js +10 -9
- package/neural-interface/public/shared/crash-notice-view.js +168 -0
- package/neural-interface/public/shared/desktop-update-view.js +20 -0
- package/neural-interface/public/shared/editor/editor-panel-logic.js +2 -2
- package/neural-interface/public/shared/html-shell.js +9 -11
- package/neural-interface/public/shared/i18n.js +2 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-approvals.js +7 -7
- package/neural-interface/public/shared/ocp-v2/ocp-v2-binding.js +4 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-changes-logic.js +3 -101
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +2 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-compact-button.js +1 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-composer-logic.js +2 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-context-menu.js +11 -11
- package/neural-interface/public/shared/ocp-v2/ocp-v2-context-model.js +0 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +8 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +7 -7
- package/neural-interface/public/shared/ocp-v2/ocp-v2-outcome-notifications.js +16 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +47 -252
- package/neural-interface/public/shared/ocp-v2/ocp-v2-plan.js +1 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +95 -202
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +4 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +8 -61
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +2 -91
- package/neural-interface/public/shared/ocp-v2/ocp-v2-slash-hints.js +16 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +8 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-status-logic.js +1 -99
- package/neural-interface/public/shared/ocp-v2/ocp-v2-status.js +5 -35
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +0 -21
- package/neural-interface/public/shared/ocp-v2/{ocp-v2-profile-inheritance.js → ocp-v2-tools-inheritance.js} +16 -16
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +14 -47
- package/neural-interface/public/shared/page-session.js +96 -0
- package/neural-interface/public/shared/registry.js +5 -3
- package/neural-interface/public/shared/retired-2d.js +3 -0
- package/neural-interface/public/shared/schedules-view.js +195 -61
- package/neural-interface/public/shared/settings/settings-claude-hooks.js +135 -0
- package/neural-interface/public/shared/settings/settings-data.js +3 -1
- package/neural-interface/public/shared/settings/settings-ia.js +6 -6
- package/neural-interface/public/shared/settings/settings-opencode.js +89 -0
- package/neural-interface/public/shared/settings/settings-skill-folders-pane.js +265 -0
- package/neural-interface/public/shared/settings/settings-skill-folders.js +130 -0
- package/neural-interface/public/shared/settings/settings-worker-guard.js +72 -0
- package/neural-interface/public/shared/skills/ss-args.js +96 -0
- package/neural-interface/public/shared/skills/ss-creation.js +219 -0
- package/neural-interface/public/shared/skills/ss-dialog.js +130 -0
- package/neural-interface/public/shared/skills/ss-doc.js +173 -0
- package/neural-interface/public/shared/skills/ss-eval-adapters.js +269 -0
- package/neural-interface/public/shared/skills/ss-eval-grade.js +359 -0
- package/neural-interface/public/shared/skills/ss-eval-optimise.js +153 -0
- package/neural-interface/public/shared/skills/ss-eval-plan.js +315 -0
- package/neural-interface/public/shared/skills/ss-evals.js +417 -0
- package/neural-interface/public/shared/skills/ss-form.js +159 -0
- package/neural-interface/public/shared/skills/ss-frontmatter.js +376 -0
- package/neural-interface/public/shared/skills/ss-ids.js +32 -0
- package/neural-interface/public/shared/skills/ss-lint.js +141 -0
- package/neural-interface/public/shared/skills/ss-presets.js +117 -0
- package/neural-interface/public/shared/skills/ss-profiles.js +475 -0
- package/neural-interface/public/shared/skills/ss-resources.js +165 -0
- package/neural-interface/public/shared/skills/ss-review-view.js +190 -0
- package/neural-interface/public/shared/skills/ss-tabs.js +79 -0
- package/neural-interface/public/shared/skills/ss-unicode.js +135 -0
- package/neural-interface/public/shared/skills/studio/sx-actions.js +222 -0
- package/neural-interface/public/shared/skills/studio/sx-cm.js +101 -0
- package/neural-interface/public/shared/skills/studio/sx-create-ai-view.js +749 -0
- package/neural-interface/public/shared/skills/studio/sx-create-ai.js +236 -0
- package/neural-interface/public/shared/skills/studio/sx-create-view.js +254 -0
- package/neural-interface/public/shared/skills/studio/sx-create.js +126 -0
- package/neural-interface/public/shared/skills/studio/sx-diff-view.js +43 -0
- package/neural-interface/public/shared/skills/studio/sx-diff.js +133 -0
- package/neural-interface/public/shared/skills/studio/sx-docs.js +480 -0
- package/neural-interface/public/shared/skills/studio/sx-dom.js +229 -0
- package/neural-interface/public/shared/skills/studio/sx-edit-view.js +848 -0
- package/neural-interface/public/shared/skills/studio/sx-editor-model.js +193 -0
- package/neural-interface/public/shared/skills/studio/sx-errors.js +22 -0
- package/neural-interface/public/shared/skills/studio/sx-geometry.js +82 -0
- package/neural-interface/public/shared/skills/studio/sx-import.js +262 -0
- package/neural-interface/public/shared/skills/studio/sx-inspector.js +308 -0
- package/neural-interface/public/shared/skills/studio/sx-install-flow.js +279 -0
- package/neural-interface/public/shared/skills/studio/sx-install.js +296 -0
- package/neural-interface/public/shared/skills/studio/sx-library-view.js +639 -0
- package/neural-interface/public/shared/skills/studio/sx-library.js +475 -0
- package/neural-interface/public/shared/skills/studio/sx-main.js +681 -0
- package/neural-interface/public/shared/skills/studio/sx-operations-view.js +98 -0
- package/neural-interface/public/shared/skills/studio/sx-operations.js +11 -0
- package/neural-interface/public/shared/skills/studio/sx-plan.js +158 -0
- package/neural-interface/public/shared/skills/studio/sx-publish-view.js +621 -0
- package/neural-interface/public/shared/skills/studio/sx-review-view.js +369 -0
- package/neural-interface/public/shared/skills/studio/sx-review.js +148 -0
- package/neural-interface/public/shared/skills/studio/sx-scan.js +35 -0
- package/neural-interface/public/shared/skills/studio/sx-snippets.js +96 -0
- package/neural-interface/public/shared/skills/studio/sx-subject.js +248 -0
- package/neural-interface/public/shared/skills/studio/sx-test-view.js +994 -0
- package/neural-interface/public/shared/skills/studio/sx-test.js +328 -0
- package/neural-interface/public/shared/skills/studio/sx-versions-view.js +241 -0
- package/neural-interface/public/shared/skills/studio/sx-workspace-view.js +425 -0
- package/neural-interface/public/shared/styleguide/sg-panel.js +4 -2
- package/neural-interface/public/shared/styles.css +1525 -1779
- package/neural-interface/public/shared/synabun-mascot.js +1115 -9
- package/neural-interface/public/shared/tool-list-picker.js +55 -0
- package/neural-interface/public/shared/tool-list-storage.js +24 -0
- package/neural-interface/public/shared/tool-list-view.js +112 -0
- package/neural-interface/public/shared/tour/tour-actor.js +268 -0
- package/neural-interface/public/shared/tour/tour-beats.js +336 -0
- package/neural-interface/public/shared/tour/tour-engine.js +884 -0
- package/neural-interface/public/shared/tour/tour-ink.js +390 -0
- package/neural-interface/public/shared/tour/tour-stage.js +440 -0
- package/neural-interface/public/shared/tour/tour-state.js +40 -0
- package/neural-interface/public/shared/tour/tour-tips.js +99 -0
- package/neural-interface/public/shared/tour/tour.css +144 -0
- package/neural-interface/public/shared/ui-automation-studio.js +91 -128
- package/neural-interface/public/shared/ui-claude-panel.js +77 -5
- package/neural-interface/public/shared/ui-command-runner.js +6 -3
- package/neural-interface/public/shared/ui-context-menu.js +295 -0
- package/neural-interface/public/shared/ui-cost-widget.js +57 -59
- package/neural-interface/public/shared/ui-crash-notice.js +187 -0
- package/neural-interface/public/shared/ui-detail.js +15 -3
- package/neural-interface/public/shared/ui-image-gallery.js +50 -47
- package/neural-interface/public/shared/ui-keybinds.js +26 -1
- package/neural-interface/public/shared/ui-menubar.js +8 -18
- package/neural-interface/public/shared/ui-native-loop-router-state.js +5 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +7 -1
- package/neural-interface/public/shared/ui-navbar.js +4 -24
- package/neural-interface/public/shared/ui-panels.js +96 -65
- package/neural-interface/public/shared/ui-schedules-studio.js +507 -423
- package/neural-interface/public/shared/ui-sessions.js +5 -3
- package/neural-interface/public/shared/ui-settings.js +594 -462
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +1 -1
- package/neural-interface/public/shared/ui-sidepanel-state.js +23 -12
- package/neural-interface/public/shared/ui-sidepanel-windows.js +16 -11
- package/neural-interface/public/shared/ui-skills.js +33 -2830
- package/neural-interface/public/shared/ui-styleguide.js +5 -2
- package/neural-interface/public/shared/ui-sync.js +15 -5
- package/neural-interface/public/shared/ui-terminal.js +124 -180
- package/neural-interface/public/shared/ui-tool-updates.js +3 -1
- package/neural-interface/public/shared/ui-tooltip.js +10 -5
- package/neural-interface/public/shared/ui-trash.js +6 -4
- package/neural-interface/public/shared/ui-tutorial-layout.js +3 -117
- package/neural-interface/public/shared/ui-tutorial-preview.js +103 -0
- package/neural-interface/public/shared/ui-tutorial-steps.js +3 -65
- package/neural-interface/public/shared/ui-tutorial.css +47 -100
- package/neural-interface/public/shared/ui-tutorial.js +285 -509
- package/neural-interface/public/shared/ui-update.js +38 -2
- package/neural-interface/public/shared/ui-whiteboard.js +311 -58
- package/neural-interface/public/shared/ui-worker-end.js +4 -0
- package/neural-interface/public/shared/ui-workspaces.js +3 -2
- package/neural-interface/public/shared/view-variant.js +66 -0
- package/neural-interface/public/shared/whatsapp/wa-view.js +1 -1
- package/neural-interface/public/shared/whiteboard-list.js +172 -0
- package/neural-interface/public/shared/worker-end.js +10 -3
- package/neural-interface/public/shared/worker-restart.js +12 -0
- package/neural-interface/public/sidepanel-session.html +1 -1
- package/neural-interface/public/variant/2d/background.js +2 -1
- package/neural-interface/public/variant/2d/context-menu.js +8 -2
- package/neural-interface/public/variant/2d/graph.js +42 -20
- package/neural-interface/public/variant/2d/hulls.js +14 -9
- package/neural-interface/public/variant/2d/lasso.js +11 -7
- package/neural-interface/public/variant/2d/main.js +32 -1
- package/neural-interface/public/variant/2d/minimap.js +11 -13
- package/neural-interface/public/variant/3d/main.js +69 -6
- package/neural-interface/public/variant/3d/map-controls.js +24 -9
- package/neural-interface/public/vendor/caveat/OFL.txt +93 -0
- package/neural-interface/public/vendor/caveat/caveat-latin-400-normal.woff2 +0 -0
- package/neural-interface/public/vendor/caveat/caveat-latin-700-normal.woff2 +0 -0
- package/neural-interface/public/vendor/caveat/caveat.css +17 -0
- package/neural-interface/public/vendor/caveat/manifest.json +12 -0
- package/neural-interface/public/vendor/yaml/LICENSE +13 -0
- package/neural-interface/public/vendor/yaml/manifest.json +4 -0
- package/neural-interface/public/vendor/yaml/yaml-2.9.1.min.js +137 -0
- package/neural-interface/scripts/build-vendor.mjs +32 -0
- package/neural-interface/server.js +3934 -2454
- package/neural-interface/templates/rulesets/core.md +1 -1
- package/neural-interface/templates/rulesets/legacy-hashes.json +18 -0
- package/neural-interface/templates/rulesets/manifest.json +8 -8
- package/npm-shrinkwrap.json +18 -12
- package/package.json +16 -3
- package/postinstall.js +9 -4
- package/preuninstall.js +1 -1
- package/setup.js +97 -322
- package/skills/skill-forge/SKILL.md +177 -0
- package/skills/skill-forge/evals/evals.json +54 -0
- package/skills/skill-forge/references/package.md +105 -0
- package/skills/skill-forge/references/review-and-recovery.md +63 -0
- package/skills/skill-forge/references/runtime-profiles.md +20 -0
- package/skills/skill-forge/references/sources-and-capabilities.md +51 -0
- package/skills/synabun/SKILL.md +10 -7
- package/skills/synabun/modules/audit.md +1 -5
- package/skills/synabun/modules/changelog.md +1 -5
- package/skills/synabun/modules/idea.md +1 -1
- package/skills/synabun/modules/memorize.md +6 -9
- package/skills/synabun/modules/schedule.md +4 -4
- package/mcp-server/dist/services/profiles.d.ts +0 -120
- package/mcp-server/dist/services/profiles.d.ts.map +0 -1
- package/mcp-server/dist/services/profiles.js +0 -387
- package/mcp-server/dist/services/profiles.js.map +0 -1
- package/mcp-server/dist/tools/leonardo-browser-tools.d.ts +0 -97
- package/mcp-server/dist/tools/leonardo-browser-tools.d.ts.map +0 -1
- package/mcp-server/dist/tools/leonardo-browser-tools.js +0 -228
- package/mcp-server/dist/tools/leonardo-browser-tools.js.map +0 -1
- package/mcp-server/dist/tools/leonardo.d.ts +0 -13
- package/mcp-server/dist/tools/leonardo.d.ts.map +0 -1
- package/mcp-server/dist/tools/leonardo.js +0 -21
- package/mcp-server/dist/tools/leonardo.js.map +0 -1
- package/mcp-server/dist/tools/profile.d.ts +0 -17
- package/mcp-server/dist/tools/profile.d.ts.map +0 -1
- package/mcp-server/dist/tools/profile.js +0 -114
- package/mcp-server/dist/tools/profile.js.map +0 -1
- package/mcp-server/src/services/profiles.ts +0 -428
- package/mcp-server/src/tools/leonardo-browser-tools.ts +0 -291
- package/mcp-server/src/tools/leonardo.ts +0 -30
- package/mcp-server/src/tools/profile.ts +0 -122
- package/neural-interface/lib/assistant-brains/opencode-browser-policy.js +0 -47
- package/neural-interface/lib/assistant-brains/opencode-route-gate.js +0 -62
- package/neural-interface/lib/mcp-profile-servers.js +0 -120
- package/neural-interface/public/shared/ui-tutorial-draw.js +0 -311
- package/skills/leonardo/SKILL.md +0 -168
- package/skills/leonardo/icon.svg +0 -1
- package/skills/leonardo/modules/browser-guide.md +0 -378
- package/skills/leonardo/modules/image-prompter.md +0 -283
- package/skills/leonardo/modules/model-advisor.md +0 -100
- package/skills/leonardo/modules/prompt-library.md +0 -110
- package/skills/leonardo/modules/style-guide.md +0 -186
- package/skills/leonardo/modules/video-prompter.md +0 -317
|
@@ -41,6 +41,14 @@
|
|
|
41
41
|
// for the next look. Nothing else is looked for: the machine's processes are
|
|
42
42
|
// never listed and searched for OpenCode, and a process SynaBun did not record
|
|
43
43
|
// is never signalled.
|
|
44
|
+
//
|
|
45
|
+
// The same records keep SynaBun's quick tunnel (lib/cloudflared/tunnel.js): a
|
|
46
|
+
// second set of them, in DATA_HOME/runtime/tunnels, whose kind is 'quick' and
|
|
47
|
+
// whose command line is a cloudflared tunnel to this server's port
|
|
48
|
+
// (createServeRecords `kinds` / `matchesCommand`: lib/cloudflared/tunnel.js
|
|
49
|
+
// tunnelsToPort over commandArgs). A server that ends without its exit handlers (a native crash)
|
|
50
|
+
// leaves its cloudflared running, the public address still pointing at the port
|
|
51
|
+
// the next server takes: the next server ends it by these same rules.
|
|
44
52
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
45
53
|
|
|
46
54
|
import { mkdirSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
@@ -196,13 +204,14 @@ const sameScope = (a, b) => wholeScope(a) && wholeScope(b) && a.machine === b.ma
|
|
|
196
204
|
|
|
197
205
|
/**
|
|
198
206
|
* A record that proves which process it names: its identity whole, its port, the token of its spawn, where it was
|
|
199
|
-
* written (machine, user, boot), and a command line that serves on its port.
|
|
207
|
+
* written (machine, user, boot), and a command line that serves on its port. `kinds` and `matches` are another set
|
|
208
|
+
* of records' own (the tunnel's: lib/cloudflared/tunnel.js tunnelsToPort).
|
|
200
209
|
*/
|
|
201
|
-
export function wholeRecord(record, platform = process.platform) {
|
|
210
|
+
export function wholeRecord(record, platform = process.platform, { kinds = SERVE_KINDS, matches = servesOnPort } = {}) {
|
|
202
211
|
if (!record || typeof record !== 'object') return false;
|
|
203
|
-
if (!
|
|
212
|
+
if (!kinds.includes(record.kind) || !isPid(record.pid) || !isPort(record.port)) return false;
|
|
204
213
|
if (!str(record.startedAt) || !str(record.command) || !TOKEN.test(str(record.token)) || !wholeScope(record.scope)) return false;
|
|
205
|
-
return
|
|
214
|
+
return matches(record.command, record.port, platform);
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
/** An owner that can be told apart from any other process: its pid, start time and command line. */
|
|
@@ -223,9 +232,16 @@ const wholeOwner = (owner) => !!owner && isPid(owner.pid) && !!str(owner.started
|
|
|
223
232
|
* @param {(pid: number) => boolean | null} [o.exists] does a process run under the pid (null: cannot be told)
|
|
224
233
|
* @param {(pid: number, signal: string) => void} [o.kill] the signal itself (Windows: taskkill /T /F, any signal)
|
|
225
234
|
* @param {number} [o.selfPid] process.pid
|
|
235
|
+
* @param {string[]} [o.kinds] the kinds these records hold (SERVE_KINDS; the tunnel's: ['quick'])
|
|
236
|
+
* @param {(command: string, port: number, platform: string) => boolean} [o.matchesCommand] is a command line one of
|
|
237
|
+
* theirs on `port`? (servesOnPort; the tunnel's: lib/cloudflared/tunnel.js tunnelsToPort)
|
|
238
|
+
* @param {string} [o.noun] what one is called in the log ('serve', 'tunnel')
|
|
226
239
|
*/
|
|
227
240
|
export function createServeRecords({
|
|
228
241
|
dir,
|
|
242
|
+
kinds = SERVE_KINDS,
|
|
243
|
+
matchesCommand = servesOnPort,
|
|
244
|
+
noun = 'serve',
|
|
229
245
|
selfPid = process.pid,
|
|
230
246
|
self = () => readProcessIdentity(selfPid),
|
|
231
247
|
scope = null,
|
|
@@ -248,6 +264,7 @@ export function createServeRecords({
|
|
|
248
264
|
log = () => {},
|
|
249
265
|
} = {}) {
|
|
250
266
|
if (!dir) throw new Error('createServeRecords requires dir');
|
|
267
|
+
const whole = (record) => wholeRecord(record, platform, { kinds, matches: matchesCommand });
|
|
251
268
|
const readScope = scope || (() => readHostScope());
|
|
252
269
|
const readScopeAsync = scopeAsync || (scope ? async () => scope() : () => readHostScopeAsync());
|
|
253
270
|
const signal = kill || ((pid, sig) => {
|
|
@@ -338,7 +355,7 @@ export function createServeRecords({
|
|
|
338
355
|
}
|
|
339
356
|
if (current.uid == null || current.uid === '') return 'unknown';
|
|
340
357
|
if (String(current.uid) !== record.scope.uid) return 'gone';
|
|
341
|
-
if (!
|
|
358
|
+
if (!matchesCommand(current.command, record.port, platform)) return 'gone';
|
|
342
359
|
return 'token';
|
|
343
360
|
}
|
|
344
361
|
const tokenVerdict = (has) => (has === true ? 'same' : has === false ? 'gone' : 'unknown');
|
|
@@ -349,7 +366,7 @@ export function createServeRecords({
|
|
|
349
366
|
* record stays). Read in full each time, right before a signal included.
|
|
350
367
|
*/
|
|
351
368
|
function verifySync(record) {
|
|
352
|
-
if (!
|
|
369
|
+
if (!whole(record)) return 'unknown';
|
|
353
370
|
const where = whereVerdict(record);
|
|
354
371
|
if (where !== 'here') return where;
|
|
355
372
|
const current = readIdentity(record.pid);
|
|
@@ -360,7 +377,7 @@ export function createServeRecords({
|
|
|
360
377
|
}
|
|
361
378
|
/** verifySync without holding the event loop while the OS answers. */
|
|
362
379
|
async function verify(record) {
|
|
363
|
-
if (!
|
|
380
|
+
if (!whole(record)) return 'unknown';
|
|
364
381
|
await scopeLater();
|
|
365
382
|
const where = whereVerdict(record);
|
|
366
383
|
if (where !== 'here') return where;
|
|
@@ -398,7 +415,7 @@ export function createServeRecords({
|
|
|
398
415
|
* another live SynaBun's, one whose owner was never recorded or cannot be read, one of another machine or user.
|
|
399
416
|
*/
|
|
400
417
|
function claimable(record) {
|
|
401
|
-
if (!
|
|
418
|
+
if (!whole(record) || whereVerdict(record) !== 'here') return false;
|
|
402
419
|
return ownedHere(record) || ownerEndedSync(record.owner) === 'ended';
|
|
403
420
|
}
|
|
404
421
|
|
|
@@ -415,26 +432,26 @@ export function createServeRecords({
|
|
|
415
432
|
*/
|
|
416
433
|
async function record({ kind, id = null, port, pid, token } = {}) {
|
|
417
434
|
const n = Number(pid);
|
|
418
|
-
if (!
|
|
435
|
+
if (!kinds.includes(kind) || !isPid(n) || !isPort(Number(port)) || !TOKEN.test(str(token))) return null;
|
|
419
436
|
const at = await scopeLater();
|
|
420
|
-
if (!at) { log(`no record for the ${kind}
|
|
437
|
+
if (!at) { log(`no record for the ${kind} ${noun} on port ${port}: the machine, the user or the boot could not be read`); return null; }
|
|
421
438
|
const identity = await readIdentityAsync(n);
|
|
422
|
-
if (!identity) { log(`no record for the ${kind}
|
|
439
|
+
if (!identity) { log(`no record for the ${kind} ${noun} on port ${port}: the identity of process ${n} could not be read`); return null; }
|
|
423
440
|
const entry = {
|
|
424
441
|
v: RECORD_VERSION, kind, id: id == null ? null : String(id), port: Number(port),
|
|
425
442
|
pid: n, startedAt: identity.startedAt, command: identity.command, token,
|
|
426
443
|
scope: { ...at }, owner: owner(), recordedAt: new Date(now()).toISOString(),
|
|
427
444
|
};
|
|
428
|
-
if (!
|
|
445
|
+
if (!whole(entry)) { log(`no record for the ${kind} ${noun} on port ${port}: process ${n} is not a ${noun} on that port (${identity.command})`); return null; }
|
|
429
446
|
if (platform === 'win32') {
|
|
430
|
-
if (!FINE_START.test(entry.startedAt)) { log(`no record for the ${kind}
|
|
447
|
+
if (!FINE_START.test(entry.startedAt)) { log(`no record for the ${kind} ${noun} on port ${port}: the start time of process ${n} is not precise enough to tell it apart`); return null; }
|
|
431
448
|
} else {
|
|
432
|
-
if (String(identity.uid ?? '') !== at.uid) { log(`no record for the ${kind}
|
|
433
|
-
if (await readTokenAsync(n, token, identity.command) !== true) { log(`no record for the ${kind}
|
|
449
|
+
if (String(identity.uid ?? '') !== at.uid) { log(`no record for the ${kind} ${noun} on port ${port}: process ${n} is not this user's`); return null; }
|
|
450
|
+
if (await readTokenAsync(n, token, identity.command) !== true) { log(`no record for the ${kind} ${noun} on port ${port}: process ${n} does not carry this start's token`); return null; }
|
|
434
451
|
}
|
|
435
452
|
const onFile = readFile(`${n}.json`);
|
|
436
453
|
if (onFile && str(onFile.token) && onFile.token !== token && !issued.has(onFile.token) && await verify(onFile) === 'same') {
|
|
437
|
-
log(`no record for the ${kind}
|
|
454
|
+
log(`no record for the ${kind} ${noun} on port ${port}: process ${n} is on record for another start`);
|
|
438
455
|
return null;
|
|
439
456
|
}
|
|
440
457
|
if (!write(entry)) return null;
|
|
@@ -451,7 +468,7 @@ export function createServeRecords({
|
|
|
451
468
|
renameSync(tmp, path);
|
|
452
469
|
return true;
|
|
453
470
|
} catch (error) {
|
|
454
|
-
log(`could not write the record of the ${entry.kind}
|
|
471
|
+
log(`could not write the record of the ${entry.kind} ${noun} on port ${entry.port}: ${error?.message || error}`);
|
|
455
472
|
return false;
|
|
456
473
|
}
|
|
457
474
|
}
|
|
@@ -470,7 +487,7 @@ export function createServeRecords({
|
|
|
470
487
|
function list({ kind = null, port = null } = {}) {
|
|
471
488
|
return entries()
|
|
472
489
|
.map(({ record: r }) => r)
|
|
473
|
-
.filter((r) =>
|
|
490
|
+
.filter((r) => whole(r) && (!kind || r.kind === kind) && (port == null || r.port === Number(port)))
|
|
474
491
|
.sort((a, b) => String(b.recordedAt || '').localeCompare(String(a.recordedAt || '')));
|
|
475
492
|
}
|
|
476
493
|
|
|
@@ -565,7 +582,7 @@ export function createServeRecords({
|
|
|
565
582
|
// The running server's own serves: its own stops end them, and their exits remove their records.
|
|
566
583
|
if (ownedHere(entry)) continue;
|
|
567
584
|
// A file that is no whole record proves nothing: it goes, and nothing is signalled.
|
|
568
|
-
if (!
|
|
585
|
+
if (!whole(entry) || entry.pid !== pid) { unlink(name); result.dropped.push({ pid, why: 'not-a-record' }); continue; }
|
|
569
586
|
// An earlier boot ended every process it had: the record goes, and nothing is signalled.
|
|
570
587
|
if (there.boot !== at.boot) { remove(entry); result.dropped.push(about('earlier-boot')); continue; }
|
|
571
588
|
const serveNow = await verify(entry);
|
|
@@ -575,7 +592,7 @@ export function createServeRecords({
|
|
|
575
592
|
const ownerNow = await ownerEnded(entry.owner);
|
|
576
593
|
if (ownerNow !== 'ended') { result.kept.push(about(ownerNow === 'running' ? 'owner-running' : 'owner-unknown')); continue; }
|
|
577
594
|
// SynaBun's own serve, started by a SynaBun that has ended: nothing uses it any more.
|
|
578
|
-
log(`stopping a ${entry.kind}
|
|
595
|
+
log(`stopping a ${entry.kind} ${noun} an earlier SynaBun left running on port ${entry.port} (pid ${entry.pid})`);
|
|
579
596
|
const outcome = await stopLeftover(entry);
|
|
580
597
|
if (outcome === 'stopped') { remove(entry); result.stopped.push(about('leftover')); continue; }
|
|
581
598
|
if (outcome === 'gone') { remove(entry); result.dropped.push(about('process-gone')); continue; }
|
|
@@ -598,8 +615,9 @@ export function createServeRecords({
|
|
|
598
615
|
|
|
599
616
|
return {
|
|
600
617
|
dir, record, remove, list, verify, verifySync, claimable, ownedHere, answering, sweep,
|
|
601
|
-
/** A fresh token for one spawn, to put in its environment as SERVE_TOKEN_ENV. */
|
|
618
|
+
/** A fresh token for one spawn, to put in its environment as SERVE_TOKEN_ENV (`tokenEnv`). */
|
|
602
619
|
newToken: () => newToken(),
|
|
620
|
+
tokenEnv: SERVE_TOKEN_ENV,
|
|
603
621
|
/** Where this server runs: `{ machine, uid, boot }`, or null while the OS cannot tell all three. */
|
|
604
622
|
scope: scopeNow,
|
|
605
623
|
};
|
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
-
// OpenCode
|
|
3
|
-
//
|
|
2
|
+
// OpenCode client wrapper — the only OpenCode client SynaBun has (the "v2" in
|
|
3
|
+
// the name is the OpenCode panel's generation, not OpenCode's version).
|
|
4
4
|
//
|
|
5
|
-
// Wraps
|
|
6
|
-
//
|
|
5
|
+
// Wraps lib/opencode2-client.js (OpenCode 2's API: /api/*, a password per
|
|
6
|
+
// launch) and exposes:
|
|
7
|
+
// • connect({ port, password, version }) / disconnect()
|
|
7
8
|
// • event.onEvent(listener) — broadcast SSE envelopes
|
|
8
9
|
// • session.list/create/get/delete/abort/prompt
|
|
9
10
|
// • permission.reply
|
|
10
11
|
// • mcp.status/connect/disconnect
|
|
11
12
|
//
|
|
12
|
-
// Pass-through philosophy — NO event normalizers, NO system-prompt injection
|
|
13
|
-
//
|
|
14
|
-
//
|
|
13
|
+
// Pass-through philosophy — NO event normalizers, NO system-prompt injection.
|
|
14
|
+
// Whatever the client emits, we forward verbatim in `{ eventType, event }`
|
|
15
|
+
// envelopes (event = the event's `properties`). The client answers in the
|
|
16
|
+
// shapes SynaBun's consumers read (lib/opencode2-translate.js), so the panel,
|
|
17
|
+
// the Assistant's OpenCode brain, workers and loops read one set of shapes.
|
|
15
18
|
// Anything beyond what's listed above is reachable via getClient().
|
|
16
19
|
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// revert / fork / share / …, permission.list, command.list, …) exposed as
|
|
20
|
+
// • EXTRA_CLIENT_METHODS — one table of further client calls (session.status
|
|
21
|
+
// / revert / fork / …, permission.list, command.list, …) exposed as
|
|
20
22
|
// `extra.<group>.<method>` on the singleton and on every
|
|
21
23
|
// createClientInstance(), with the same `{ status, data }` contract.
|
|
22
24
|
// They live under `extra` on purpose: the loop runtime and the Assistant's
|
|
23
25
|
// OpenCode brain feature-detect `client.session.children`, so adding a
|
|
24
26
|
// method to an existing group would change what they do.
|
|
25
|
-
// •
|
|
26
|
-
//
|
|
27
|
-
// neither used to surface as the literal "opencode SDK error".
|
|
28
|
-
//
|
|
29
|
-
// OpenCode 2 (a different API: /api/*, a password per launch) gets the same
|
|
30
|
-
// wrapper: `connect` and `createClientInstance` take `{ protocol: 2, password }`
|
|
31
|
-
// and build lib/opencode2-client.js instead of the SDK client. It has the
|
|
32
|
-
// SDK client's methods and answers in OpenCode 1's shapes, so nothing below
|
|
33
|
-
// (and nothing that uses this module) changes with the major.
|
|
27
|
+
// • describeOpencodeError() — the message for an error body (`{ _tag,
|
|
28
|
+
// message }`, `{ name, data: { message } }`, a string or nothing).
|
|
34
29
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
35
30
|
|
|
36
|
-
import { createOpencodeClient } from '@opencode-ai/sdk/v2';
|
|
37
31
|
import { createOpencode2Client } from './opencode2-client.js';
|
|
38
32
|
|
|
39
33
|
let _client = null;
|
|
40
34
|
let _port = null;
|
|
41
|
-
let _protocol = 1;
|
|
42
35
|
let _password = null;
|
|
43
36
|
let _abort = null;
|
|
44
37
|
let _running = false;
|
|
@@ -67,26 +60,22 @@ export const event = {
|
|
|
67
60
|
},
|
|
68
61
|
};
|
|
69
62
|
|
|
70
|
-
/** The
|
|
71
|
-
function clientFor({ port,
|
|
72
|
-
|
|
73
|
-
if (protocol === 2) return createOpencode2Client({ baseUrl, password, version, ...(fetchImpl ? { fetchImpl } : {}) });
|
|
74
|
-
return clientFactory({ baseUrl });
|
|
63
|
+
/** The OpenCode 2 client of the serve on `port`. `clientFactory` builds it (tests pass a stand-in). */
|
|
64
|
+
function clientFor({ port, password, version, clientFactory = createOpencode2Client, fetchImpl }) {
|
|
65
|
+
return clientFactory({ baseUrl: `http://127.0.0.1:${port}`, password, version, ...(fetchImpl ? { fetchImpl } : {}) });
|
|
75
66
|
}
|
|
76
67
|
|
|
77
|
-
export async function connect({ port,
|
|
68
|
+
export async function connect({ port, password = null, version = '' }) {
|
|
78
69
|
if (!port) throw new Error('opencode-v2-client.connect: port required');
|
|
79
|
-
|
|
80
|
-
if (_client && _port === port && _running && _protocol === wanted && _password === (wanted === 2 ? password : null)) {
|
|
70
|
+
if (_client && _port === port && _running && _password === password) {
|
|
81
71
|
logv('connect: already connected to', port);
|
|
82
72
|
return;
|
|
83
73
|
}
|
|
84
74
|
await disconnect();
|
|
85
75
|
_stopRequested = false;
|
|
86
76
|
_port = port;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
_client = clientFor({ port, protocol: wanted, password, version });
|
|
77
|
+
_password = password;
|
|
78
|
+
_client = clientFor({ port, password, version });
|
|
90
79
|
_attempt = 0;
|
|
91
80
|
startSubscribeLoop().catch((err) => {
|
|
92
81
|
console.error('[ocp-v2-client] subscribe loop crashed:', err);
|
|
@@ -101,7 +90,6 @@ export async function disconnect() {
|
|
|
101
90
|
_abort = null;
|
|
102
91
|
_client = null;
|
|
103
92
|
_port = null;
|
|
104
|
-
_protocol = 1;
|
|
105
93
|
_password = null;
|
|
106
94
|
_connected = false;
|
|
107
95
|
_running = false;
|
|
@@ -110,8 +98,6 @@ export async function disconnect() {
|
|
|
110
98
|
export function getClient() { return _client; }
|
|
111
99
|
export function isConnected() { return _connected; }
|
|
112
100
|
export function getPort() { return _port; }
|
|
113
|
-
/** 1 or 2: the OpenCode major the shared client speaks. */
|
|
114
|
-
export function getProtocol() { return _protocol; }
|
|
115
101
|
|
|
116
102
|
async function startSubscribeLoop() {
|
|
117
103
|
_running = true;
|
|
@@ -119,9 +105,7 @@ async function startSubscribeLoop() {
|
|
|
119
105
|
while (_client && !_stopRequested) {
|
|
120
106
|
try {
|
|
121
107
|
_abort = new AbortController();
|
|
122
|
-
//
|
|
123
|
-
// that emits server.connected then writes the chunked terminator and
|
|
124
|
-
// closes — which produces a 1Hz reconnect loop).
|
|
108
|
+
// The serve's one event stream (GET /api/event), every session's events.
|
|
125
109
|
const result = await _client.global.event({ signal: _abort.signal });
|
|
126
110
|
_connected = true;
|
|
127
111
|
_attempt = 0;
|
|
@@ -130,7 +114,7 @@ async function startSubscribeLoop() {
|
|
|
130
114
|
|
|
131
115
|
for await (const raw of result.stream) {
|
|
132
116
|
if (_stopRequested) break;
|
|
133
|
-
//
|
|
117
|
+
// Each event comes as { payload: { id, type, properties } } (lib/opencode2-translate.js)
|
|
134
118
|
const ev = (raw && typeof raw === 'object' && 'payload' in raw) ? raw.payload : raw;
|
|
135
119
|
const eventType = String(ev?.type || 'unknown');
|
|
136
120
|
const eventPayload = (ev && typeof ev === 'object' && 'properties' in ev) ? ev.properties : ev;
|
|
@@ -155,11 +139,11 @@ async function startSubscribeLoop() {
|
|
|
155
139
|
log('subscribe-loop ended, totalEvents=', _evCount);
|
|
156
140
|
}
|
|
157
141
|
|
|
158
|
-
// The text and tag of an
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
// and a non-JSON body as a string.
|
|
162
|
-
export function
|
|
142
|
+
// The text and tag of an error body. OpenCode answers a failed call with
|
|
143
|
+
// `{ _tag, message }` (a tagged error, e.g. SessionBusyError); a body in the
|
|
144
|
+
// `{ name, data: { message } }` shape is read too, an empty body arrives as
|
|
145
|
+
// `{}` and a non-JSON body as a string.
|
|
146
|
+
export function describeOpencodeError(error, status) {
|
|
163
147
|
const tag = (error && typeof error === 'object')
|
|
164
148
|
? String(error._tag || error.name || '')
|
|
165
149
|
: '';
|
|
@@ -169,12 +153,12 @@ export function describeSdkError(error, status) {
|
|
|
169
153
|
if (typeof error.message === 'string' && error.message) message = error.message;
|
|
170
154
|
else if (typeof error.data?.message === 'string' && error.data.message) message = error.data.message;
|
|
171
155
|
}
|
|
172
|
-
if (!message) message = tag || (status ? `
|
|
156
|
+
if (!message) message = tag || (status ? `OpenCode error (HTTP ${status})` : 'OpenCode error');
|
|
173
157
|
return { message: message.length > 2000 ? `${message.slice(0, 2000)}…` : message, tag };
|
|
174
158
|
}
|
|
175
159
|
|
|
176
|
-
//
|
|
177
|
-
//
|
|
160
|
+
// The client answers { data, error, response }. Throw on error; otherwise
|
|
161
|
+
// return { status, data } so callers can match server.js conventions.
|
|
178
162
|
async function unwrap(promise) {
|
|
179
163
|
let result;
|
|
180
164
|
try { result = await promise; }
|
|
@@ -185,7 +169,7 @@ async function unwrap(promise) {
|
|
|
185
169
|
}
|
|
186
170
|
if (result && result.error) {
|
|
187
171
|
const status = result.response?.status;
|
|
188
|
-
const described =
|
|
172
|
+
const described = describeOpencodeError(result.error, status);
|
|
189
173
|
const err = new Error(described.message);
|
|
190
174
|
err.cause = result.error;
|
|
191
175
|
err.status = status;
|
|
@@ -207,15 +191,16 @@ const requireClient = () => {
|
|
|
207
191
|
return _client;
|
|
208
192
|
};
|
|
209
193
|
|
|
210
|
-
// Further
|
|
194
|
+
// Further client calls, by group. Each becomes `extra.<group>.<method>(params,
|
|
211
195
|
// options)` on the singleton and on every instance, resolving `{ status, data }`
|
|
212
196
|
// like the hand-written wrappers. The existing groups (`session`, `permission`,
|
|
213
197
|
// `mcp`, …) keep exactly the methods they had.
|
|
214
198
|
// tests/opencode-v2-client-extra.test.mjs checks every entry against the
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
199
|
+
// OpenCode 2 client (lib/opencode2-client.js), so a missing method fails there
|
|
200
|
+
// instead of at runtime.
|
|
201
|
+
export const EXTRA_CLIENT_METHODS = Object.freeze({
|
|
202
|
+
session: ['status', 'children', 'todo', 'diff', 'fork', 'revert', 'unrevert', 'summarize', 'init',
|
|
203
|
+
'command', 'shell', 'message'],
|
|
219
204
|
permission: ['list'],
|
|
220
205
|
command: ['list'],
|
|
221
206
|
app: ['agents', 'skills'],
|
|
@@ -223,7 +208,6 @@ export const EXTRA_SDK_METHODS = Object.freeze({
|
|
|
223
208
|
find: ['text', 'files', 'symbols'],
|
|
224
209
|
file: ['list', 'read', 'status'],
|
|
225
210
|
vcs: ['get', 'status', 'diff'],
|
|
226
|
-
worktree: ['list', 'create', 'remove', 'reset'],
|
|
227
211
|
mcp: ['add'],
|
|
228
212
|
lsp: ['status'],
|
|
229
213
|
formatter: ['status'],
|
|
@@ -231,13 +215,13 @@ export const EXTRA_SDK_METHODS = Object.freeze({
|
|
|
231
215
|
|
|
232
216
|
function extraGroups(getRaw) {
|
|
233
217
|
const out = {};
|
|
234
|
-
for (const [group, methods] of Object.entries(
|
|
218
|
+
for (const [group, methods] of Object.entries(EXTRA_CLIENT_METHODS)) {
|
|
235
219
|
out[group] = {};
|
|
236
220
|
for (const method of methods) {
|
|
237
221
|
out[group][method] = async (params = {}, options) => {
|
|
238
222
|
const target = getRaw()?.[group];
|
|
239
223
|
if (typeof target?.[method] !== 'function') {
|
|
240
|
-
throw new Error(`OpenCode
|
|
224
|
+
throw new Error(`The OpenCode client does not expose ${group}.${method}`);
|
|
241
225
|
}
|
|
242
226
|
return unwrap(target[method](clean(params), options));
|
|
243
227
|
};
|
|
@@ -246,73 +230,6 @@ function extraGroups(getRaw) {
|
|
|
246
230
|
return out;
|
|
247
231
|
}
|
|
248
232
|
|
|
249
|
-
// v2.session.compact answers 503 "Session compact is not available yet" on
|
|
250
|
-
// OpenCode 1.18.34, so compaction of a v1 session has to go through
|
|
251
|
-
// session.summarize, which needs the model to summarise with.
|
|
252
|
-
export function isCompactUnavailable(err) {
|
|
253
|
-
return err?.status === 503
|
|
254
|
-
|| err?.tag === 'ServiceUnavailableError'
|
|
255
|
-
|| /not available yet/i.test(String(err?.message || ''));
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// `{ providerID, modelID }` from that object or from a "provider/model" string.
|
|
259
|
-
function modelRefOf(value) {
|
|
260
|
-
if (typeof value === 'string') {
|
|
261
|
-
const slash = value.trim().indexOf('/');
|
|
262
|
-
const text = value.trim();
|
|
263
|
-
return slash > 0 && slash < text.length - 1
|
|
264
|
-
? { providerID: text.slice(0, slash), modelID: text.slice(slash + 1) }
|
|
265
|
-
: null;
|
|
266
|
-
}
|
|
267
|
-
const providerID = typeof value?.providerID === 'string' ? value.providerID.trim() : '';
|
|
268
|
-
const modelID = typeof value?.modelID === 'string' ? value.modelID.trim() : '';
|
|
269
|
-
return providerID && modelID ? { providerID, modelID } : null;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// The model a transcript last ran on: assistant rows carry providerID/modelID,
|
|
273
|
-
// user rows carry `model: { providerID, modelID }`.
|
|
274
|
-
export function lastModelOf(rows) {
|
|
275
|
-
const list = Array.isArray(rows) ? rows : [];
|
|
276
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
277
|
-
const info = list[i]?.info;
|
|
278
|
-
const found = modelRefOf(info) || modelRefOf(info?.model);
|
|
279
|
-
if (found) return found;
|
|
280
|
-
}
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Compact a session on any serve: `client.session.compact`, and when the serve
|
|
286
|
-
* answers "not available yet" (isCompactUnavailable), `session.summarize` on
|
|
287
|
-
* `model` (an object or "provider/model"), else on the model the transcript
|
|
288
|
-
* last ran on. `client` is this module or a createClientInstance().
|
|
289
|
-
* Resolves `{ status, data, via: 'compact' | 'summarize' }`. Throws what compact
|
|
290
|
-
* threw for any other failure, and a 400 when no model can be found.
|
|
291
|
-
* The sidepanel and the Assistant's OpenCode brain both compact through here;
|
|
292
|
-
* `session.compact` itself is left as it was for every other caller.
|
|
293
|
-
*/
|
|
294
|
-
export async function compactOrSummarize(client, { sessionID, directory, model } = {}) {
|
|
295
|
-
try {
|
|
296
|
-
const r = await client.session.compact({ sessionID, directory });
|
|
297
|
-
return { status: r?.status, data: r?.data, via: 'compact' };
|
|
298
|
-
} catch (err) {
|
|
299
|
-
const summarize = client?.extra?.session?.summarize;
|
|
300
|
-
if (!isCompactUnavailable(err) || typeof summarize !== 'function') throw err;
|
|
301
|
-
let target = modelRefOf(model);
|
|
302
|
-
if (!target) {
|
|
303
|
-
const transcript = await Promise.resolve(client.session.messages({ sessionID, directory })).catch(() => null);
|
|
304
|
-
target = lastModelOf(transcript?.data);
|
|
305
|
-
}
|
|
306
|
-
if (!target) {
|
|
307
|
-
const noModel = new Error('Pick a model first: OpenCode needs one to summarise this session.');
|
|
308
|
-
noModel.status = 400;
|
|
309
|
-
throw noModel;
|
|
310
|
-
}
|
|
311
|
-
const r = await summarize({ sessionID, directory, ...target });
|
|
312
|
-
return { status: r?.status, data: r?.data, via: 'summarize' };
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
233
|
export const session = {
|
|
317
234
|
list: (params = {}) => unwrap(requireClient().session.list(clean(params))),
|
|
318
235
|
create: (params = {}) => unwrap(requireClient().session.create(clean(params))),
|
|
@@ -361,19 +278,7 @@ export const session = {
|
|
|
361
278
|
const t = Date.now();
|
|
362
279
|
log(`session.compact -> sid=${sessionID}`);
|
|
363
280
|
try {
|
|
364
|
-
const
|
|
365
|
-
let target = client.v2?.session;
|
|
366
|
-
let endpoint = target?.compact;
|
|
367
|
-
if (!endpoint && client.session?.compact) {
|
|
368
|
-
target = client.session;
|
|
369
|
-
endpoint = target.compact;
|
|
370
|
-
}
|
|
371
|
-
if (!endpoint && client.session?.summarize) {
|
|
372
|
-
target = client.session;
|
|
373
|
-
endpoint = target.summarize;
|
|
374
|
-
}
|
|
375
|
-
if (!endpoint) throw new Error('OpenCode SDK does not expose session compact');
|
|
376
|
-
const r = await unwrap(endpoint.call(target, clean({ sessionID, ...rest })));
|
|
281
|
+
const r = await unwrap(requireClient().v2.session.compact(clean({ sessionID, ...rest })));
|
|
377
282
|
log(`session.compact <- status=${r?.status} ms=${Date.now() - t}`);
|
|
378
283
|
return r;
|
|
379
284
|
} catch (err) {
|
|
@@ -399,7 +304,7 @@ export const mcp = {
|
|
|
399
304
|
disconnect: (params = {}) => unwrap(requireClient().mcp.disconnect(clean(params))),
|
|
400
305
|
};
|
|
401
306
|
|
|
402
|
-
// extra.<group>.<method> — see
|
|
307
|
+
// extra.<group>.<method> — see EXTRA_CLIENT_METHODS.
|
|
403
308
|
export const extra = extraGroups(requireClient);
|
|
404
309
|
|
|
405
310
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -409,10 +314,9 @@ export const extra = extraGroups(requireClient);
|
|
|
409
314
|
// completely untouched — it remains the shared-serve default, so the common path
|
|
410
315
|
// carries zero risk from this addition. Reuses the module-level unwrap()/clean().
|
|
411
316
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
412
|
-
export function createClientInstance({ port, clientFactory =
|
|
317
|
+
export function createClientInstance({ port, clientFactory = createOpencode2Client, password = null, version = '', fetchImpl = null }) {
|
|
413
318
|
if (!port) throw new Error('createClientInstance: port required');
|
|
414
|
-
|
|
415
|
-
let client = clientFor({ port, protocol: wanted, password, version, clientFactory, fetchImpl });
|
|
319
|
+
let client = clientFor({ port, password, version, clientFactory, fetchImpl });
|
|
416
320
|
let abort = null;
|
|
417
321
|
let stopRequested = false;
|
|
418
322
|
let connected = false;
|
|
@@ -453,8 +357,7 @@ export function createClientInstance({ port, clientFactory = createOpencodeClien
|
|
|
453
357
|
|
|
454
358
|
const instance = {
|
|
455
359
|
port,
|
|
456
|
-
|
|
457
|
-
/** The client underneath (the SDK's, or the OpenCode 2 one): raw requests the wrapper has no method for. */
|
|
360
|
+
/** The client underneath (lib/opencode2-client.js): raw requests the wrapper has no method for. */
|
|
458
361
|
getClient: () => client,
|
|
459
362
|
onEvent(fn) { listeners.add(fn); return () => listeners.delete(fn); },
|
|
460
363
|
start() { subscribeLoop().catch((e) => console.error('[ocp-v2-iso] subscribe crashed:', e)); },
|
|
@@ -479,14 +382,7 @@ export function createClientInstance({ port, clientFactory = createOpencodeClien
|
|
|
479
382
|
context: (p) => unwrap(req().v2.session.context(clean(p))),
|
|
480
383
|
prompt: ({ signal, ...rest } = {}) => unwrap(req().session.prompt(clean(rest), signal ? { signal } : undefined)),
|
|
481
384
|
promptAsync: ({ signal, ...rest } = {}) => unwrap(req().session.promptAsync(clean(rest), signal ? { signal } : undefined)),
|
|
482
|
-
compact:
|
|
483
|
-
const c = req();
|
|
484
|
-
let target = c.v2?.session; let endpoint = target?.compact;
|
|
485
|
-
if (!endpoint && c.session?.compact) { target = c.session; endpoint = target.compact; }
|
|
486
|
-
if (!endpoint && c.session?.summarize) { target = c.session; endpoint = target.summarize; }
|
|
487
|
-
if (!endpoint) throw new Error('OpenCode SDK does not expose session compact');
|
|
488
|
-
return unwrap(endpoint.call(target, clean(rest)));
|
|
489
|
-
},
|
|
385
|
+
compact: (p) => unwrap(req().v2.session.compact(clean(p))),
|
|
490
386
|
},
|
|
491
387
|
permission: { reply: (p) => unwrap(req().permission.reply(clean(p))) },
|
|
492
388
|
question: {
|
|
@@ -506,8 +402,7 @@ export function createClientInstance({ port, clientFactory = createOpencodeClien
|
|
|
506
402
|
}
|
|
507
403
|
|
|
508
404
|
export default {
|
|
509
|
-
connect, disconnect, getClient, isConnected, getPort,
|
|
405
|
+
connect, disconnect, getClient, isConnected, getPort,
|
|
510
406
|
event, session, permission, question, mcp, createClientInstance,
|
|
511
|
-
extra,
|
|
512
|
-
compactOrSummarize, lastModelOf,
|
|
407
|
+
extra, describeOpencodeError, EXTRA_CLIENT_METHODS,
|
|
513
408
|
};
|