synabun 2.0.9 → 2.0.10
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 +29 -0
- package/README.md +1 -1
- package/THIRD-PARTY-LICENSES.md +46 -4
- package/launcher.mjs +9 -3
- package/lib/start-launcher.js +6 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/neural-interface/i18n/en.json +218 -7
- package/neural-interface/i18n/pt-BR.json +220 -9
- package/neural-interface/lib/account-usage.js +5 -3
- package/neural-interface/lib/app-controls-api.js +161 -0
- package/neural-interface/lib/assistant-api.js +21 -7
- package/neural-interface/lib/assistant-brains/opencode.js +13 -1
- package/neural-interface/lib/assistant-brains/opencode2-browser-policy/index.js +44 -0
- package/neural-interface/lib/assistant-brains/opencode2-route-gate/index.js +57 -0
- package/neural-interface/lib/assistant-catalog.js +17 -2
- package/neural-interface/lib/assistant-dispatch.js +3 -0
- package/neural-interface/lib/assistant-envelope.js +19 -1
- package/neural-interface/lib/assistant-runtime.js +127 -8
- package/neural-interface/lib/claude-model-catalog.js +64 -14
- package/neural-interface/lib/codex-settings-schema.js +109 -47
- package/neural-interface/lib/editor-completion-opencode.js +132 -35
- package/neural-interface/lib/exec-loop-command.js +8 -1
- package/neural-interface/lib/launch-cache.js +293 -0
- package/neural-interface/lib/login-start.js +524 -0
- package/neural-interface/lib/native-loop-providers.js +18 -3
- package/neural-interface/lib/native-loop-runtime.js +19 -0
- package/neural-interface/lib/opencode-db-schema.js +75 -0
- package/neural-interface/lib/opencode-history.js +16 -1
- package/neural-interface/lib/opencode-protocol.js +173 -0
- package/neural-interface/lib/opencode-provider-view.js +81 -0
- package/neural-interface/lib/opencode-runtime-config.js +10 -3
- package/neural-interface/lib/opencode-serve-records.js +606 -0
- package/neural-interface/lib/opencode-v2-client.js +33 -6
- package/neural-interface/lib/opencode-v2-ws-requests.js +19 -5
- package/neural-interface/lib/opencode-worker-activity.js +229 -0
- package/neural-interface/lib/opencode2-client.js +760 -0
- package/neural-interface/lib/opencode2-proxy.js +116 -0
- package/neural-interface/lib/opencode2-translate.js +1008 -0
- package/neural-interface/lib/process-identity.js +361 -0
- package/neural-interface/lib/session-cache-builder.js +26 -5
- package/neural-interface/lib/session-title-generator.js +18 -0
- package/neural-interface/lib/style-guide/api.js +4 -3
- package/neural-interface/lib/untrusted-file-headers.js +27 -0
- package/neural-interface/package-lock.json +1343 -45
- package/neural-interface/package.json +5 -1
- package/neural-interface/public/index.html +2 -2
- package/neural-interface/public/shared/agent-runtime-options.js +55 -11
- package/neural-interface/public/shared/assistant/asst-agents-dock.js +172 -17
- package/neural-interface/public/shared/assistant/asst-api.js +11 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +195 -80
- package/neural-interface/public/shared/assistant/asst-composer.js +1 -1
- package/neural-interface/public/shared/assistant/asst-hosts.js +49 -2
- package/neural-interface/public/shared/assistant/asst-menu.js +77 -6
- package/neural-interface/public/shared/assistant/asst-panel.js +197 -33
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +28 -10
- package/neural-interface/public/shared/assistant/asst-redact.js +186 -0
- package/neural-interface/public/shared/assistant/asst-render.js +382 -36
- package/neural-interface/public/shared/assistant/asst-run-stage.js +231 -0
- package/neural-interface/public/shared/assistant/asst-sanitize.js +193 -3
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +273 -0
- package/neural-interface/public/shared/assistant/asst-scenes.js +528 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel-styles.js +3 -15
- package/neural-interface/public/shared/assistant/asst-state.js +14 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +43 -0
- package/neural-interface/public/shared/assistant/asst-tool-kinds.js +13 -1
- package/neural-interface/public/shared/cc-dropdown.js +480 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +13 -1
- package/neural-interface/public/shared/cdx/cdx-render.js +15 -3
- package/neural-interface/public/shared/cdx/cdx-styles.js +4 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +149 -35
- package/neural-interface/public/shared/cp/cp-markdown.js +4 -57
- package/neural-interface/public/shared/data-cache.js +223 -0
- package/neural-interface/public/shared/desktop-bridge.js +11 -0
- package/neural-interface/public/shared/desktop-titlebar-view.js +78 -1
- package/neural-interface/public/shared/desktop-titlebar.js +214 -28
- package/neural-interface/public/shared/desktop-update-view.js +15 -5
- package/neural-interface/public/shared/file-links.js +73 -8
- package/neural-interface/public/shared/html-shell.js +74 -80
- package/neural-interface/public/shared/launch-prefetch.js +59 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-caps.js +3 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +7 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +54 -17
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +93 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-providers.js +11 -9
- package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +15 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +1 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +401 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +16 -9
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +60 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +48 -19
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +195 -19
- package/neural-interface/public/shared/opencode-providers.js +39 -0
- package/neural-interface/public/shared/schedules-view.js +318 -0
- package/neural-interface/public/shared/settings/settings-app-pane.js +335 -0
- package/neural-interface/public/shared/settings/settings-app.js +243 -0
- package/neural-interface/public/shared/settings/settings-data.js +88 -0
- package/neural-interface/public/shared/settings/settings-ia.js +17 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +49 -0
- package/neural-interface/public/shared/styles.css +540 -371
- package/neural-interface/public/shared/ui-assistant.js +27 -5
- package/neural-interface/public/shared/ui-automation-studio.js +67 -27
- package/neural-interface/public/shared/ui-bookmarks.js +2 -1
- package/neural-interface/public/shared/ui-claude-panel.js +76 -8
- package/neural-interface/public/shared/ui-codex-panel.js +1 -0
- package/neural-interface/public/shared/ui-detail.js +6 -6
- package/neural-interface/public/shared/ui-file-links.js +1 -0
- package/neural-interface/public/shared/ui-image-gallery.js +6 -5
- package/neural-interface/public/shared/ui-invite.js +18 -2
- package/neural-interface/public/shared/ui-link.js +9 -9
- package/neural-interface/public/shared/ui-menubar.js +232 -33
- package/neural-interface/public/shared/ui-native-loop-router.js +2 -0
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +1 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +2099 -869
- package/neural-interface/public/shared/ui-sessions.js +15 -4
- package/neural-interface/public/shared/ui-settings.js +87 -36
- package/neural-interface/public/shared/ui-sidebar.js +4 -4
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +13 -0
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +55 -4
- package/neural-interface/public/shared/ui-sidepanel-tray.js +84 -8
- package/neural-interface/public/shared/ui-skills.js +70 -12
- package/neural-interface/public/shared/ui-sync.js +7 -0
- package/neural-interface/public/shared/ui-terminal.js +36 -20
- package/neural-interface/public/shared/ui-trash.js +8 -1
- package/neural-interface/public/shared/ui-tutorial-steps.js +7 -3
- package/neural-interface/public/shared/ui-tutorial.js +15 -5
- package/neural-interface/public/shared/ui-update.js +83 -14
- package/neural-interface/public/shared/ui-whiteboard.js +2 -1
- package/neural-interface/public/variant/2d/main.js +4 -1
- package/neural-interface/public/variant/3d/main.js +3 -0
- package/neural-interface/public/vendor/highlight/LICENSE +29 -0
- package/neural-interface/public/vendor/highlight/github-dark-dimmed-11.12.0.min.css +9 -0
- package/neural-interface/public/vendor/highlight/highlight-11.12.0.min.js +1262 -0
- package/neural-interface/public/vendor/highlight/manifest.json +5 -0
- package/neural-interface/public/vendor/html2canvas/LICENSE +22 -0
- package/neural-interface/public/vendor/html2canvas/html2canvas-1.4.1.min.js +20 -0
- package/neural-interface/public/vendor/html2canvas/manifest.json +4 -0
- package/neural-interface/public/vendor/marked/LICENSE.md +44 -0
- package/neural-interface/public/vendor/marked/manifest.json +4 -0
- package/neural-interface/public/vendor/marked/marked-14.1.4.esm.js +2502 -0
- package/neural-interface/public/vendor/mermaid/LICENSE +21 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/abnfDiagram-PAR5IXJI.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/architecture-7GRP2DOG-M7G3SWCO.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/architectureDiagram-2PNWDENW.mjs +36 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/blockDiagram-PUWGUBOA.mjs +129 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/c4Diagram-3NLNHZP5.mjs +38 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-2NMSUPJH.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-32MCUW2P.mjs +206 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-3NPNU5GP.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-3SMGFRGC.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-4CAJECRU.mjs +14 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-4OADUZ5Q.mjs +10 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-5IMINLNL.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-5IQCK5RY.mjs +3 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-5MVFYWFU.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-AQ6EADP3.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-AZZRMDJM.mjs +15 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-CLS4B6BI.mjs +168 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-DZP67EKU.mjs +70 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-EICP7K5X.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-GDY2UAB4.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-H7VHZCWX.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-IJBDOHL6.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-JFFVMJIA.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-JQRUD6KW.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-JZGDI5JK.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-KD6SPIPN.mjs +2 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-NF366YI6.mjs +231 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-NUDPKBEF.mjs +32 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-OJINMHTS.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-Q6NGPIAH.mjs +2 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-QJSWEUOL.mjs +132 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-R7JDMUKV.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-RCXAM2GK.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-RT4MAWR3.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-SFMINX4W.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-SLDQ463B.mjs +88 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-STOV2HOB.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-T5OCTHI4.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-TCEHX7R3.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-VQC2EELJ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-VRZKL3EH.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-VTHDQ7BV.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-VY2OSTJR.mjs +2 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-WUBWJARI.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-YBMQ5JGJ.mjs +2 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-YDMLL4PJ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-Z6V44ARX.mjs +62 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-ZJJ7VQJP.mjs +339 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-ZNLK7HRR.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-ZQN7UHIL.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-ZS6VBONO.mjs +174 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/chunk-ZUNWM646.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/classDiagram-FGAMPOII.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/classDiagram-v2-AI5RJEK4.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/cose-bilkent-Q72C2OJ3.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/cynefin-OW5HDTMX-6OCTWOGG.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/cynefinDiagram-2OOWUY4M.mjs +62 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/dagre-MPVFI544.mjs +4 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/diagram-AE4NWXFW.mjs +24 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/diagram-BUJID5UG.mjs +41 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/diagram-C44CZ5NI.mjs +24 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/diagram-EYOLEXXS.mjs +30 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/diagram-P7B6PWOJ.mjs +3 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/ebnfDiagram-FTPZ3PV6.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/erDiagram-H3ERR26V.mjs +99 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/eventmodeling-NTZA5JFV-WKSWQHFS.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/flowDiagram-YHGXBVSY.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/ganttDiagram-RWFTB7ED.mjs +292 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/gitGraph-4MIJSDKK-JH2HKYUO.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/gitGraphDiagram-MAR6GKOP.mjs +106 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/info-A6RAGUB7-3TX3OFWW.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/infoDiagram-LV547AFH.mjs +2 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/ishikawaDiagram-PUJQGNDS.mjs +70 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/journeyDiagram-EW5QJT4W.mjs +139 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/kanban-definition-JSQERAZB.mjs +89 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/katex-CZ4GXH2S.mjs +257 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/mindmap-definition-VBJCLQLM.mjs +96 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/packet-AYTQ26CC-MKII6P3Y.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/pegDiagram-7WILOQTJ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/pie-WAS4IAKB-6B4OPMJ5.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/pieDiagram-EFA7CBSB.mjs +39 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/quadrantDiagram-WARVYA7P.mjs +7 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/radar-RG4KPBEZ-UPTR3XUL.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/railroad-74A4TZTK-MEFUPFMS.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/railroad-abnf-HS5TGJTU-R5YG2S5D.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/railroad-ebnf-LZEXJU2U-G5QEX2L6.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/railroad-peg-WCYAUIDC-H5I2ZRY2.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/railroadDiagram-5NIQVNLQ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/requirementDiagram-SXREGOKZ.mjs +84 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/sankeyDiagram-VV74M2VP.mjs +40 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/sequenceDiagram-52ZFIFDL.mjs +162 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/sizeCapture-FGA5AGYP.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/stateDiagram-3QAKPIVI.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/stateDiagram-v2-HN2P4RDZ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/swimlanes-QLVP42QD.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/swimlanesDiagram-JKPDBFCN.mjs +8 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/timeline-definition-GS45XAXW.mjs +120 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/treeView-Q6P3EWNA-ZRJGANNQ.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/treemap-WGGIJYW6-K64VN5AS.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/vennDiagram-QIQU2ZRJ.mjs +34 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/wardley-WFR3VGLG-D67OWCCH.mjs +1 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/wardleyDiagram-U6YNM66N.mjs +78 -0
- package/neural-interface/public/vendor/mermaid/chunks/mermaid.esm.min/xychartDiagram-XJAZEDNM.mjs +7 -0
- package/neural-interface/public/vendor/mermaid/manifest.json +4 -0
- package/neural-interface/public/vendor/mermaid/mermaid-11.17.2.esm.min.mjs +14 -0
- package/neural-interface/scripts/build-vendor.mjs +84 -3
- package/neural-interface/server.js +1099 -286
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/skills/synabun/modules/schedule.md +1 -1
|
@@ -13,7 +13,8 @@ import { registerAutomationSession } from './ocp-v2-automation-ownership.js';
|
|
|
13
13
|
import { applyEvent, resolveEventTargets } from './ocp-v2-events.js';
|
|
14
14
|
import { createCapabilities, gatedRequest } from './ocp-v2-caps.js';
|
|
15
15
|
import { shouldAutoAccept, autoAcceptRequest, autoAcceptInherited } from './ocp-v2-approvals.js';
|
|
16
|
-
import { verifyDescendant, knownDescendant, createReconnectNotifier, requestOwner } from './ocp-v2-rehydrate.js';
|
|
16
|
+
import { verifyDescendant, descendantState, knownDescendant, createReconnectNotifier, requestOwner } from './ocp-v2-rehydrate.js';
|
|
17
|
+
import { createAskTracker, createTurnClock, readOpenAsks, unreadAsksNotice, TURN_LIMIT_MS } from './ocp-v2-send-logic.js';
|
|
17
18
|
|
|
18
19
|
// Request types the connected server answers. Empty against a server that
|
|
19
20
|
// predates the list; cleared on every disconnect and refilled on reconnect.
|
|
@@ -99,6 +100,7 @@ export async function connect() {
|
|
|
99
100
|
catch (err) { console.warn('[ocp-v2-ws] identify failed', err); }
|
|
100
101
|
_connecting = null;
|
|
101
102
|
_reconnects.opened();
|
|
103
|
+
asksOpened();
|
|
102
104
|
resolve(ws);
|
|
103
105
|
});
|
|
104
106
|
|
|
@@ -114,7 +116,11 @@ export async function connect() {
|
|
|
114
116
|
_connecting = null;
|
|
115
117
|
capabilities.clear();
|
|
116
118
|
_reconnects.closed();
|
|
117
|
-
for (const [, p] of _pending) p.reject(new Error('websocket closed'));
|
|
119
|
+
for (const [, p] of _pending) { p.timeout.cancel(); p.reject(new Error('websocket closed')); }
|
|
120
|
+
// What waits on the user is not known again until the server's lists are read after the reconnect
|
|
121
|
+
// (rebuildAsks): until then no turn's clock counts. A socket that never opened lost nothing.
|
|
122
|
+
if (opened) _asks.hold();
|
|
123
|
+
asksClosed();
|
|
118
124
|
_pending.clear();
|
|
119
125
|
broadcastServerStatus({ status: 'reconnecting' });
|
|
120
126
|
setTimeout(() => { connect().catch(() => {}); }, 1500);
|
|
@@ -139,6 +145,21 @@ function broadcastServerStatus(payload) {
|
|
|
139
145
|
for (const store of _allStores) store.setServerStatus(payload);
|
|
140
146
|
}
|
|
141
147
|
|
|
148
|
+
// Why OpenCode cannot be used, as the server says it (an OpenCode version
|
|
149
|
+
// SynaBun does not speak, a port held by an OpenCode 2 server it did not start,
|
|
150
|
+
// a web page where the API should be): one line in each panel's error list,
|
|
151
|
+
// never a second copy of the same sentence while the panel keeps retrying.
|
|
152
|
+
function broadcastServerProblem(text) {
|
|
153
|
+
const message = typeof text === 'string' ? text.trim().slice(0, 600) : '';
|
|
154
|
+
if (!message) return;
|
|
155
|
+
const stores = _allStores.size ? [..._allStores] : [getDefaultStore()];
|
|
156
|
+
for (const store of stores) {
|
|
157
|
+
const errors = store.getState?.().errors || [];
|
|
158
|
+
if (errors.some((err) => err?.message === message)) continue;
|
|
159
|
+
store.pushError?.({ message, kind: 'server' });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
142
163
|
export function disconnect() {
|
|
143
164
|
if (_ws) {
|
|
144
165
|
try { _ws.close(); } catch {}
|
|
@@ -160,6 +181,7 @@ export function subscribeSession(sessionId, store) {
|
|
|
160
181
|
let set = _storesBySession.get(sessionId);
|
|
161
182
|
if (!set) { set = new Set(); _storesBySession.set(sessionId, set); }
|
|
162
183
|
set.add(store);
|
|
184
|
+
readAsksOf(sessionId);
|
|
163
185
|
return () => {
|
|
164
186
|
const s = _storesBySession.get(sessionId);
|
|
165
187
|
if (s) {
|
|
@@ -195,6 +217,7 @@ function handleMessage(msg) {
|
|
|
195
217
|
// Broadcast to every registered store; also poke the default singleton
|
|
196
218
|
// so legacy callers (no panel registered yet) still see status.
|
|
197
219
|
broadcastServerStatus(payload);
|
|
220
|
+
if (msg.status === 'error' && msg.error) broadcastServerProblem(msg.error);
|
|
198
221
|
return;
|
|
199
222
|
}
|
|
200
223
|
|
|
@@ -206,6 +229,7 @@ function handleMessage(msg) {
|
|
|
206
229
|
if (msg.type === 'capabilities') {
|
|
207
230
|
capabilities.set(msg.capabilities);
|
|
208
231
|
_reconnects.capabilities();
|
|
232
|
+
asksReady();
|
|
209
233
|
return;
|
|
210
234
|
}
|
|
211
235
|
|
|
@@ -216,6 +240,7 @@ function handleMessage(msg) {
|
|
|
216
240
|
if (msg.nativeRunId && msg.nativeRootSessionId) {
|
|
217
241
|
registerAutomationSession(msg.nativeRootSessionId, msg.nativeRunId);
|
|
218
242
|
}
|
|
243
|
+
_asks.note(msg.eventType, msg.event || {});
|
|
219
244
|
handleEvent(msg.eventType, msg.event || {});
|
|
220
245
|
fanout(msg.eventType, msg.event || {});
|
|
221
246
|
return;
|
|
@@ -224,10 +249,12 @@ function handleMessage(msg) {
|
|
|
224
249
|
if (msg.id != null && _pending.has(msg.id)) {
|
|
225
250
|
const p = _pending.get(msg.id);
|
|
226
251
|
_pending.delete(msg.id);
|
|
227
|
-
|
|
252
|
+
p.timeout.cancel();
|
|
228
253
|
if (msg.type === 'init:result') {
|
|
229
254
|
capabilities.set(msg.capabilities);
|
|
230
255
|
if (typeof msg.sdkVersion === 'string') _sdkVersion = msg.sdkVersion;
|
|
256
|
+
if (msg.ready === false && msg.problem) broadcastServerProblem(msg.problem);
|
|
257
|
+
asksReady();
|
|
231
258
|
}
|
|
232
259
|
p.resolve(msg);
|
|
233
260
|
return;
|
|
@@ -265,6 +292,18 @@ function handleEvent(eventType, ev) {
|
|
|
265
292
|
// Lets a sub-agent's permission or question reach the panel of its parent
|
|
266
293
|
// when no child panel is open for it.
|
|
267
294
|
const _parentOf = new Map();
|
|
295
|
+
|
|
296
|
+
// Requests that wait on the user, by session (a sub-agent's count for its parent): a turn's send does not
|
|
297
|
+
// count the time they wait (createTurnClock). A permission left open for more than 30 minutes used to end
|
|
298
|
+
// the turn's send with "request timeout: message:send" while the turn went on in OpenCode. Across a lost
|
|
299
|
+
// socket they are held from the close and read again from the server after the reconnect (rebuildAsks); a
|
|
300
|
+
// session a panel is bound to after the page loaded has its own read once (readAsksOf).
|
|
301
|
+
const _asks = createAskTracker({ parentOf: _parentOf });
|
|
302
|
+
/** True while `sessionId`, or a sub-agent below it, waits on a permission or a question. */
|
|
303
|
+
export const sessionWaitsOnUser = (sessionId) => _asks.waits(sessionId);
|
|
304
|
+
/** `listener()` whenever what waits on the user may have changed; returns an unsubscribe. */
|
|
305
|
+
export const onAsksChanged = (listener) => _asks.subscribe(listener);
|
|
306
|
+
|
|
268
307
|
function rememberParent(ev) {
|
|
269
308
|
const info = ev?.info || ev?.session || ev || {};
|
|
270
309
|
const childId = info.id || ev?.sessionID || ev?.sessionId;
|
|
@@ -316,15 +355,19 @@ const _rootSessions = new Set();
|
|
|
316
355
|
* from the session itself. Anything that cannot be established is false.
|
|
317
356
|
*/
|
|
318
357
|
export function isDescendantSession(sessionId, ancestorId) {
|
|
319
|
-
return verifyDescendant(sessionId, ancestorId, {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
358
|
+
return verifyDescendant(sessionId, ancestorId, { parentOf: _parentOf, roots: _rootSessions, fetchParent: fetchSessionParent });
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// The same question with "could not be read" kept apart from "no" (true, false or null): what the open
|
|
362
|
+
// requests read from the server need, so that a sub-agent whose place is unknown keeps its parent waiting.
|
|
363
|
+
function sessionAncestry(sessionId, ancestorId) {
|
|
364
|
+
return descendantState(sessionId, ancestorId, { parentOf: _parentOf, roots: _rootSessions, fetchParent: fetchSessionParent });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async function fetchSessionParent(id) {
|
|
368
|
+
const res = await api.sessionGet(id);
|
|
369
|
+
if (!res || res.error || (typeof res.status === 'number' && res.status >= 400) || !res.data?.id) return null;
|
|
370
|
+
return String(res.data.parentID || res.data.parentId || '');
|
|
328
371
|
}
|
|
329
372
|
|
|
330
373
|
/**
|
|
@@ -336,11 +379,135 @@ export function isKnownDescendantSession(sessionId, ancestorId) {
|
|
|
336
379
|
return knownDescendant(sessionId, ancestorId, _parentOf);
|
|
337
380
|
}
|
|
338
381
|
|
|
382
|
+
// ── What waits on the user, read from the server ───────────────────────────
|
|
383
|
+
// The stream says what is asked and answered while the socket is up. What was asked before (the page loaded,
|
|
384
|
+
// a panel was bound to another session, the socket was down) is read from the server (permission:list and
|
|
385
|
+
// question:list, on OpenCode 1 and 2 alike), one session at a time: its clocks wait until then. After a
|
|
386
|
+
// reconnect every bound session is read again (rebuildAsks). A list that cannot be read is read again a few
|
|
387
|
+
// times; then the session's clocks count again and its panel says so (noteUnreadAsks).
|
|
388
|
+
|
|
389
|
+
// A sub-agent runs on its parent's serve, in its folder: a bound parent's lists hold its requests too.
|
|
390
|
+
function underSession(sessionId, isAncestor) {
|
|
391
|
+
let cursor = parentSessionOf(sessionId);
|
|
392
|
+
for (let depth = 0; cursor && depth < 12; depth++) {
|
|
393
|
+
if (isAncestor(cursor)) return true;
|
|
394
|
+
cursor = parentSessionOf(cursor);
|
|
395
|
+
}
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// The sessions whose lists were read (or are out) since the socket opened.
|
|
400
|
+
const _asksRead = new Set();
|
|
401
|
+
// Bound sessions waiting for the socket to say what it serves before their lists are read.
|
|
402
|
+
const _asksUnread = new Set();
|
|
403
|
+
let _asksReady = false;
|
|
404
|
+
let _asksReadyTimer = null;
|
|
405
|
+
let _asksFlushTimer = null;
|
|
406
|
+
const asksKnown = (sessionId) => _asksRead.has(sessionId) || underSession(sessionId, (id) => _asksRead.has(id));
|
|
407
|
+
|
|
408
|
+
function askSession(sessionId, kinds) {
|
|
409
|
+
const s = [...(_storesBySession.get(sessionId) || [])][0]?.getState?.() || {};
|
|
410
|
+
return { sessionId, cwd: s.cwd || s.sessionInfo?.directory || undefined, ...(kinds ? { kinds } : {}) };
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// `want`: null for every bound session (not one under another), else the sessions (and lists) to read.
|
|
414
|
+
// The first read of sessions bound at a page load (or later) looks up no sub-agent's place: the panel manager
|
|
415
|
+
// reads the session tree right then, for the pills, and the read again a second later finds the links it
|
|
416
|
+
// learned (a list holding a request whose place is not known yet is unresolved meanwhile: its session waits).
|
|
417
|
+
// After a reconnect the tree is known; only a sub-agent spawned during the outage is looked up.
|
|
418
|
+
function readAsks(want, { attempt = 1, partial = false } = {}) {
|
|
419
|
+
const bound = new Set(_storesBySession.keys());
|
|
420
|
+
const sessions = want
|
|
421
|
+
? want.filter(({ sessionId }) => bound.has(sessionId)).map(({ sessionId, kinds }) => askSession(sessionId, kinds))
|
|
422
|
+
: [...bound].filter((sessionId) => !underSession(sessionId, (id) => bound.has(id))).map((sessionId) => askSession(sessionId));
|
|
423
|
+
for (const { sessionId } of sessions) _asksRead.add(sessionId);
|
|
424
|
+
return readOpenAsks(api, sessions, {
|
|
425
|
+
ancestry: sessionAncestry,
|
|
426
|
+
known: (owner, root) => knownDescendant(owner, root, _parentOf),
|
|
427
|
+
...(partial && attempt === 1 ? { maxLookups: 0 } : {}),
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// The tracker gave up on some lists: the panels of those sessions say that their clock counts again.
|
|
432
|
+
function noteUnreadAsks(result) {
|
|
433
|
+
if (!result) return;
|
|
434
|
+
const lost = result.unread
|
|
435
|
+
? [..._storesBySession.keys()].map((sessionId) => ({ sessionId, kinds: undefined }))
|
|
436
|
+
: result.gaveUp || [];
|
|
437
|
+
for (const { sessionId, kinds } of lost) {
|
|
438
|
+
const message = unreadAsksNotice(kinds);
|
|
439
|
+
for (const store of _storesBySession.get(sessionId) || []) {
|
|
440
|
+
if ((store.getState?.().errors || []).some((err) => err?.message === message)) continue;
|
|
441
|
+
store.pushError?.({ message, notice: true });
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function rebuildAsks() {
|
|
447
|
+
return _asks.rebuild(readAsks).then(noteUnreadAsks);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// A session a panel was bound to: unless its lists (or a bound parent's) were read since the socket opened,
|
|
451
|
+
// its clocks wait from now and its lists are read once the socket can serve them.
|
|
452
|
+
function readAsksOf(sessionId) {
|
|
453
|
+
if (!sessionId || asksKnown(sessionId) || _asksUnread.has(sessionId)) return;
|
|
454
|
+
_asksUnread.add(sessionId);
|
|
455
|
+
_asks.expect([sessionId]);
|
|
456
|
+
flushAsksSoon();
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function flushAsksSoon() {
|
|
460
|
+
if (_asksFlushTimer || !_asksReady || !_asksUnread.size) return;
|
|
461
|
+
_asksFlushTimer = setTimeout(() => {
|
|
462
|
+
_asksFlushTimer = null;
|
|
463
|
+
if (!_asksReady) return;
|
|
464
|
+
// Those no panel is bound to any more are let go by the tracker (not in its answer); those whose lists
|
|
465
|
+
// were read meanwhile (their own, or a bound parent's) wait for nothing more.
|
|
466
|
+
// A sub-agent read in the same go as its parent is read with it.
|
|
467
|
+
const batch = [..._asksUnread];
|
|
468
|
+
const known = batch.filter((sessionId) => _storesBySession.has(sessionId)
|
|
469
|
+
&& (asksKnown(sessionId) || underSession(sessionId, (id) => id !== sessionId && batch.includes(id) && _storesBySession.has(id))));
|
|
470
|
+
const sessions = batch.filter((sessionId) => !known.includes(sessionId));
|
|
471
|
+
_asksUnread.clear();
|
|
472
|
+
if (known.length) _asks.release(known);
|
|
473
|
+
if (!sessions.length) return;
|
|
474
|
+
_asks.rebuild(readAsks, { sessions }).then(noteUnreadAsks)
|
|
475
|
+
.catch((err) => console.warn('[ocp-v2-ws] reading the open questions failed', err));
|
|
476
|
+
}, 0);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// The lists can be asked for once the socket said what it serves (capabilities, init:result), or, from a
|
|
480
|
+
// server that does not say, a moment after it opened.
|
|
481
|
+
function asksOpened() {
|
|
482
|
+
clearTimeout(_asksReadyTimer);
|
|
483
|
+
_asksReadyTimer = setTimeout(asksReady, 1500);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function asksReady() {
|
|
487
|
+
clearTimeout(_asksReadyTimer);
|
|
488
|
+
_asksReadyTimer = null;
|
|
489
|
+
if (!isConnected()) return;
|
|
490
|
+
_asksReady = true;
|
|
491
|
+
flushAsksSoon();
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// (A session still to be read stays so: a socket that never opened read nothing, and after a reconnect
|
|
495
|
+
// rebuildAsks reads every bound session anyway.)
|
|
496
|
+
function asksClosed() {
|
|
497
|
+
clearTimeout(_asksReadyTimer);
|
|
498
|
+
clearTimeout(_asksFlushTimer);
|
|
499
|
+
_asksReadyTimer = null;
|
|
500
|
+
_asksFlushTimer = null;
|
|
501
|
+
_asksReady = false;
|
|
502
|
+
_asksRead.clear();
|
|
503
|
+
}
|
|
504
|
+
|
|
339
505
|
// The socket came back after an outage: whatever was sent meanwhile reached no
|
|
340
506
|
// panel. Listeners re-read their session (the primary panel does it through its
|
|
341
507
|
// auto-heal; the panel manager does it for the sub-agent panel).
|
|
342
508
|
const _reconnectListeners = new Set();
|
|
343
509
|
const _reconnects = createReconnectNotifier(() => {
|
|
510
|
+
rebuildAsks().catch((err) => console.warn('[ocp-v2-ws] reading the open questions again failed', err));
|
|
344
511
|
for (const fn of _reconnectListeners) {
|
|
345
512
|
try { fn(); } catch (e) { console.warn('[ocp-v2-ws] reconnect listener error', e); }
|
|
346
513
|
}
|
|
@@ -462,14 +629,23 @@ function fanout(eventType, ev) {
|
|
|
462
629
|
|
|
463
630
|
// ── Request/response (id-correlated, 30s default timeout) ──
|
|
464
631
|
|
|
465
|
-
|
|
632
|
+
// `turnOf`: the session whose turn the request waits for (a prompt, a command). Its clock stops while that
|
|
633
|
+
// session waits on the user, so only working time counts toward `timeoutMs` (createTurnClock).
|
|
634
|
+
function request(payload, timeoutMs = 30000, { turnOf = '' } = {}) {
|
|
466
635
|
return new Promise(async (resolve, reject) => {
|
|
467
636
|
try { await connect(); } catch (e) { return reject(e); }
|
|
468
637
|
const id = ++_reqSeq;
|
|
469
|
-
const
|
|
638
|
+
const expire = () => {
|
|
470
639
|
_pending.delete(id);
|
|
471
640
|
reject(new Error(`request timeout: ${payload.type}`));
|
|
472
|
-
}
|
|
641
|
+
};
|
|
642
|
+
let timeout;
|
|
643
|
+
if (turnOf) {
|
|
644
|
+
timeout = createTurnClock({ ms: timeoutMs, paused: () => sessionWaitsOnUser(turnOf), subscribe: onAsksChanged, onExpire: expire });
|
|
645
|
+
} else {
|
|
646
|
+
const timer = setTimeout(expire, timeoutMs);
|
|
647
|
+
timeout = { cancel: () => clearTimeout(timer) };
|
|
648
|
+
}
|
|
473
649
|
_pending.set(id, { resolve, reject, timeout });
|
|
474
650
|
_ws.send(JSON.stringify({ ...payload, id }));
|
|
475
651
|
});
|
|
@@ -488,7 +664,7 @@ export const api = {
|
|
|
488
664
|
sessionContext: ({ sessionId, cwd } = {}) => request({ type: 'session:context', sessionId, cwd }),
|
|
489
665
|
// `human` / `greetingId`: lib/greeting/ (a server that does not know them ignores them).
|
|
490
666
|
send: ({ sessionId, parts, model, agent, mode, variant, cwd, mcpProfile, noAbortPrev, human, greetingId }) =>
|
|
491
|
-
request({ type: 'message:send', sessionId, parts, model, agent, mode, variant, cwd, mcpProfile, noAbortPrev: !!noAbortPrev, ...(human ? { human: true } : {}), ...(greetingId ? { greetingId } : {}) },
|
|
667
|
+
request({ type: 'message:send', sessionId, parts, model, agent, mode, variant, cwd, mcpProfile, noAbortPrev: !!noAbortPrev, ...(human ? { human: true } : {}), ...(greetingId ? { greetingId } : {}) }, TURN_LIMIT_MS, { turnOf: sessionId }),
|
|
492
668
|
abort: (sessionId) => request({ type: 'message:abort', sessionId }),
|
|
493
669
|
compact: ({ sessionId, cwd, mcpProfile, model } = {}) => request({ type: 'session:compact', sessionId, cwd, mcpProfile, model }, 5 * 60 * 1000),
|
|
494
670
|
permissionReply: ({ sessionId, permissionId, response, cwd, message }) =>
|
|
@@ -515,7 +691,7 @@ export const api = {
|
|
|
515
691
|
commandList: ({ cwd } = {}) => gated({ type: 'command:list', cwd }),
|
|
516
692
|
// A command is a turn: it can run as long as a prompt does.
|
|
517
693
|
commandRun: ({ sessionId, command, arguments: args, agent, model, variant, parts, cwd, mcpProfile } = {}) =>
|
|
518
|
-
gated({ type: 'command:run', sessionId, command, arguments: args, agent, model, variant, parts, cwd, mcpProfile },
|
|
694
|
+
gated({ type: 'command:run', sessionId, command, arguments: args, agent, model, variant, parts, cwd, mcpProfile }, TURN_LIMIT_MS, { turnOf: sessionId }),
|
|
519
695
|
sessionShell: ({ sessionId, command, agent, model, cwd, mcpProfile } = {}) =>
|
|
520
696
|
gated({ type: 'session:shell', sessionId, command, agent, model, cwd, mcpProfile }, 10 * 60 * 1000),
|
|
521
697
|
findFiles: ({ query, cwd, dirs } = {}) => gated({ type: 'find:files', query, cwd, dirs }, 10000),
|
|
@@ -541,6 +717,6 @@ export const api = {
|
|
|
541
717
|
envStatus: ({ sessionId, cwd } = {}) => gated({ type: 'env:status', sessionId, cwd }),
|
|
542
718
|
};
|
|
543
719
|
|
|
544
|
-
function gated(payload, timeoutMs) {
|
|
545
|
-
return gatedRequest(capabilities, request, payload, timeoutMs);
|
|
720
|
+
function gated(payload, timeoutMs, options) {
|
|
721
|
+
return gatedRequest(capabilities, request, payload, timeoutMs, options);
|
|
546
722
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — OpenCode's providers, as the pickers read them
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
// GET /api/opencode/providers/full?view=compact: the connected providers only,
|
|
5
|
+
// with every field their models carry (the whole models.dev catalog is
|
|
6
|
+
// megabytes, and only Settings → OpenCode lists it). One copy in the data
|
|
7
|
+
// cache (data-cache.js) for every module that reads it: the OpenCode panel's
|
|
8
|
+
// model and variant pickers, its context gauge and composer, the Assistant's
|
|
9
|
+
// and the Studios' model lists. A provider change (`ocp-providers-changed`,
|
|
10
|
+
// which reaches every window: the OpenCode socket where a panel is open, the
|
|
11
|
+
// sync socket everywhere) drops it and asks for it again at once.
|
|
12
|
+
|
|
13
|
+
import { createDataCache } from './data-cache.js';
|
|
14
|
+
import { registerLaunchPrefetch } from './launch-prefetch.js';
|
|
15
|
+
|
|
16
|
+
export const OPENCODE_PROVIDERS_URL = '/api/opencode/providers/full?view=compact';
|
|
17
|
+
|
|
18
|
+
export const opencodeProviders = createDataCache('opencode-providers', {
|
|
19
|
+
ttlMs: 5 * 60_000,
|
|
20
|
+
persist: true,
|
|
21
|
+
load: async (_key, { force }) => {
|
|
22
|
+
const resp = await fetch(force ? `${OPENCODE_PROVIDERS_URL}&refresh=1` : OPENCODE_PROVIDERS_URL);
|
|
23
|
+
// A body that is not JSON (a web page) throws: nothing is kept.
|
|
24
|
+
return resp.json();
|
|
25
|
+
},
|
|
26
|
+
// Only a provider list is kept: `{ ok: false }` (the serve is not running, an error) never is.
|
|
27
|
+
accept: (body) => !!body && body.ok !== false && !!body.data && typeof body.data === 'object' && !Array.isArray(body.data),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** The parsed body `{ ok, data: { all, default, connected } }`, connected providers only. */
|
|
31
|
+
export function fetchOpencodeProviders({ force = false } = {}) {
|
|
32
|
+
return opencodeProviders.get('', { force });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeof document !== 'undefined') {
|
|
36
|
+
document.addEventListener('ocp-providers-changed', () => opencodeProviders.invalidate('', { refetch: true }));
|
|
37
|
+
// Launch: read once the page has painted, so the first OpenCode picker opens from it.
|
|
38
|
+
registerLaunchPrefetch('opencode-providers', () => opencodeProviders.prefetch(''), { order: 8, owner: true });
|
|
39
|
+
}
|