@openchamber/web 2.0.4 → 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/dist/assets/{CodeMirrorCommentWidgets-C_zL-eri.js → CodeMirrorCommentWidgets-qlshRzAf.js} +1 -1
- package/dist/assets/{DiffView-BeN2_YYF.js → DiffView-BI_YgdKl.js} +3 -3
- package/dist/assets/FilesView-B_NJFLBH.js +17 -0
- package/dist/assets/{GitView-DLDazOo1.js → GitView-BWKg6TNS.js} +4 -4
- package/dist/assets/{GuestAttachDialog-C0xe_Lyy.js → GuestAttachDialog-DO4x4vIR.js} +1 -1
- package/dist/assets/{GuestSurfacePane-BdaurnDr.js → GuestSurfacePane-4PY11vEP.js} +1 -1
- package/dist/assets/JsonTreeView-u4yx65zn.js +1 -0
- package/dist/assets/{LinearIssuesView-BryoAHow.js → LinearIssuesView-C4gGBhU8.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-DfuEoaGq.js → MarkdownImageGallery-fqVRCTdC.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-Cfb5fTnq.js +39 -0
- package/dist/assets/OnboardingScreen-CiTV2_OT.js +1 -0
- package/dist/assets/PatchDiff-BrjhzXDM.js +1 -0
- package/dist/assets/{PierreDiffViewer-BC950e3F.js → PierreDiffViewer-CVx2e1cx.js} +5 -5
- package/dist/assets/{PlanView-B7Xgihqk.js → PlanView-DP9DOnI-.js} +4 -4
- package/dist/assets/{PluginPane-2C71F8uF.js → PluginPane-rZvoMQSi.js} +3 -3
- package/dist/assets/SettingsView-Dp9jubRs.js +30 -0
- package/dist/assets/SettingsWindow-Dst0yiV7.js +1 -0
- package/dist/assets/{SubmoduleDiffSummary-BSA9gnIO.js → SubmoduleDiffSummary-CixkM4fI.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DprkVKcj.js → ToolOutputDialog-f0cS2DIf.js} +6 -6
- package/dist/assets/ToolPartDiffPreview-CFFIAFFY.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-Kp8hKJdT.js → VirtualizedFileDiff-B-U_aQwV.js} +4 -4
- package/dist/assets/{WalkthroughView-DGnTzqIU.js → WalkthroughView-C1uB3Pl3.js} +2 -2
- package/dist/assets/{appThemeRegistry-BdEHBA4s.js → appThemeRegistry-DU-UKEHq.js} +1 -1
- package/dist/assets/{commitAndPush-LwtVa2Oc.js → commitAndPush-CtWGqrtW.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-6V1xNpO9.js → computeVirtualFileMetrics-BmhViPMt.js} +1 -1
- package/dist/assets/de-D4hpTCNY.js +10 -0
- package/dist/assets/es-Bw9m3H62.js +16 -0
- package/dist/assets/fileTreeStatus-CvPnAWSi.js +1 -0
- package/dist/assets/fr-Bhll42P0.js +14 -0
- package/dist/assets/index-Btd2mmYT.js +42 -0
- package/dist/assets/index-C-7hQnEc.css +1 -0
- package/dist/assets/{index-CmNPYddV.js → index-DwtCnbiK.js} +1 -1
- package/dist/assets/{isDiffPlainText-1bXcWCrw.js → isDiffPlainText-CPDhzF1K.js} +1 -1
- package/dist/assets/{isFilePlainText-CBAppvy1.js → isFilePlainText-n8k0lMTZ.js} +1 -1
- package/dist/assets/ja-CsHoT43d.js +16 -0
- package/dist/assets/ko-BBNdtFa4.js +16 -0
- package/dist/assets/{main-CzjTMTfW.js → main-D6rlXjug.js} +2 -2
- package/dist/assets/main-kYkr_urz.js +1000 -0
- package/dist/assets/markdownCore-CHm8ycaW.js +7 -0
- package/dist/assets/{miniChat-CP68IL8Q.js → miniChat-2JY8K3Qw.js} +2 -2
- package/dist/assets/mobile-CviaXnnU.js +2 -0
- package/dist/assets/nl-DszyktfH.js +16 -0
- package/dist/assets/openSessionFromRoute-BIlcJIf3.js +1 -0
- package/dist/assets/{web-components-ngpHPEDU.js → parseDiffFromFile-DeZzEah8.js} +5 -5
- package/dist/assets/{patchFileDiff-pqRSHLHI.js → patchFileDiff-BnEHIdM2.js} +2 -2
- package/dist/assets/pl-Bk9_mUXc.js +16 -0
- package/dist/assets/pt-BR-BIXmm3Gw.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-DKIilR7N.js → renderElectronMiniChatApp-DvUphkjj.js} +2 -2
- package/dist/assets/renderMobileApp-Cdc49X8Y.js +25 -0
- package/dist/assets/runtimeEndpointReset-Cu6RUve4.js +56 -0
- package/dist/assets/shikiHighlight-CcVzlYit.js +1 -0
- package/dist/assets/space-apply-CgJ5JYPK.js +1 -0
- package/dist/assets/space-close-C1tL-_0t.js +1 -0
- package/dist/assets/{textMateThemeFromAppTheme-BSUFChBY.js → textMateThemeFromAppTheme-CAOCeVjl.js} +1 -1
- package/dist/assets/tr-C_13w7CX.js +7 -0
- package/dist/assets/uk-BZTsG-q_.js +16 -0
- package/dist/assets/{useAppFontEffects-Dsl_sLrj.js → useAppFontEffects-CeMgbeVa.js} +185 -177
- package/dist/assets/{useInlineCommentController-d5vntsQ_.js → useInlineCommentController-U97JJifS.js} +2 -2
- package/dist/assets/useRootScrollLock-DMBY2aTT.js +2 -0
- package/dist/assets/{vendor-base-ui-DnNniUWp.js → vendor-base-ui-DWgyZK2k.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-DetzHhtC.js +1 -0
- package/dist/assets/{vendor-codemirror-commands-B7H_j0iU.js → vendor-codemirror-commands-ConqfjLn.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-DEPs2M5t.js → vendor-codemirror-lang-angular-Dbpx8qe-.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp-DhkseaMo.js → vendor-codemirror-lang-cpp-TRtQWrpl.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-O0cZX78y.js → vendor-codemirror-lang-css-DY4CGDG2.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-fMdQYcON.js → vendor-codemirror-lang-go-CLKXh6B8.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-CfgK872x.js → vendor-codemirror-lang-html-CQnNjmg9.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-CQj4S3zl.js → vendor-codemirror-lang-java-CokZKqls.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-Cc2ZYbgX.js → vendor-codemirror-lang-javascript-Kgp6fZRE.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-BmZZv8g-.js → vendor-codemirror-lang-jinja-DZchyrN1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-CMBS2tG9.js → vendor-codemirror-lang-json-CkdBRvqj.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-C6Eo8hVS.js → vendor-codemirror-lang-less-_k-GKz0A.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-DSTR47-H.js → vendor-codemirror-lang-liquid-DuHUMKoh.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-BPGOH9ye.js → vendor-codemirror-lang-markdown-CdG1RXm1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-DD9udfPH.js → vendor-codemirror-lang-php-Ca15KQSA.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-HahnQaAS.js → vendor-codemirror-lang-python-B4MRHRva.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-nLTovbjv.js → vendor-codemirror-lang-rust-8fLJdxQA.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-pL2Yc72v.js → vendor-codemirror-lang-sass-CASr_yQ1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-BVBnan19.js → vendor-codemirror-lang-sql-Dc4ER-re.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-BqGzJVm1.js → vendor-codemirror-lang-vue-fu2BqdK2.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-B0_m5DqU.js → vendor-codemirror-lang-wast-BkCOgSpV.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-Dj3voadT.js → vendor-codemirror-lang-xml-7e-kPepH.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-yu-9Z5u7.js → vendor-codemirror-lang-yaml-Cq3p_9DI.js} +1 -1
- package/dist/assets/vendor-codemirror-language-CZcLdzDM.js +3 -0
- package/dist/assets/{vendor-codemirror-language-data-B1EetJur.js → vendor-codemirror-language-data-B8HKnqZy.js} +2 -2
- package/dist/assets/vendor-codemirror-search-BZNojiZO.js +2 -0
- package/dist/assets/{vendor-codemirror-state-C9awkmn-.js → vendor-codemirror-state--21VQleR.js} +1 -1
- package/dist/assets/vendor-codemirror-view-8PpN-8l4.js +4 -0
- package/dist/assets/vendor-opencode-client-Byb4ZSqI.js +12 -0
- package/dist/assets/vendor-remend-DcBOpbSu.js +24 -0
- package/dist/assets/{vendor-replit-codemirror-vim-B2DJlAhT.js → vendor-replit-codemirror-vim-EX7OnecQ.js} +1 -1
- package/dist/assets/zh-CN-C62wm2Tg.js +16 -0
- package/dist/assets/zh-TW-BgGTiQA6.js +16 -0
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +4 -4
- package/server/index.js +58 -1
- package/server/lib/browser-control/DOCUMENTATION.md +8 -1
- package/server/lib/dev-tunnel/DOCUMENTATION.md +6 -0
- package/server/lib/dev-tunnel/runtime.js +94 -38
- package/server/lib/dev-tunnel/tunnel.test.js +16 -2
- package/server/lib/dictation/DOCUMENTATION.md +23 -10
- package/server/lib/dictation/audio.js +28 -0
- package/server/lib/dictation/local/sherpa-recognizer.js +33 -7
- package/server/lib/dictation/local/sherpa-recognizer.test.js +94 -0
- package/server/lib/dictation/local/worker-client.js +28 -10
- package/server/lib/dictation/local/worker-process.js +25 -1
- package/server/lib/dictation/stream-manager.js +160 -53
- package/server/lib/dictation/stream-manager.test.js +108 -7
- package/server/lib/enterprise-mode.d.ts +2 -0
- package/server/lib/enterprise-mode.js +84 -9
- package/server/lib/enterprise-mode.test.js +115 -0
- package/server/lib/fs/DOCUMENTATION.md +3 -2
- package/server/lib/fs/routes.js +28 -1
- package/server/lib/fs/routes.test.js +31 -5
- package/server/lib/git/DOCUMENTATION.md +1 -1
- package/server/lib/git/service.js +61 -2
- package/server/lib/git/service.test.js +141 -0
- package/server/lib/github/DOCUMENTATION.md +18 -0
- package/server/lib/github/checks-summary.js +76 -0
- package/server/lib/github/pr-summaries.js +282 -0
- package/server/lib/github/pr-summaries.test.js +209 -0
- package/server/lib/github/routes.js +42 -77
- package/server/lib/github/routes.test.js +77 -0
- package/server/lib/inherited-env.js +51 -0
- package/server/lib/inherited-env.test.js +59 -0
- package/server/lib/message-search/DOCUMENTATION.md +83 -0
- package/server/lib/message-search/indexer.js +336 -0
- package/server/lib/message-search/indexer.test.js +341 -0
- package/server/lib/message-search/routes.js +92 -0
- package/server/lib/message-search/runtime.js +234 -0
- package/server/lib/message-search/runtime.test.js +108 -0
- package/server/lib/message-search/sqlite.js +74 -0
- package/server/lib/message-search/store.js +289 -0
- package/server/lib/openchamber-control/DOCUMENTATION.md +6 -1
- package/server/lib/openchamber-control/actions.js +1 -1
- package/server/lib/openchamber-control/service.js +21 -2
- package/server/lib/openchamber-control/service.test.js +50 -0
- package/server/lib/openchamber-sessions/routes.js +15 -0
- package/server/lib/openchamber-sessions/routes.test.js +31 -0
- package/server/lib/opencode/DOCUMENTATION.md +43 -38
- package/server/lib/opencode/auth.d.ts +24 -0
- package/server/lib/opencode/auth.js +130 -66
- package/server/lib/opencode/auth.test.js +114 -70
- package/server/lib/opencode/compatibility.js +4 -3
- package/server/lib/opencode/compatibility.test.js +10 -10
- package/server/lib/opencode/feature-routes-runtime.js +3 -0
- package/server/lib/opencode/lifecycle.js +21 -12
- package/server/lib/opencode/lifecycle.test.js +38 -5
- package/server/lib/opencode/provider-source-route.test.js +55 -2
- package/server/lib/opencode/routes.js +17 -4
- package/server/lib/opencode/settings-helpers.js +6 -0
- package/server/lib/opencode/settings-helpers.test.js +1 -1
- package/server/lib/opencode/settings-registry.json +16 -0
- package/server/lib/opencode/settings-runtime.js +9 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/opencode/v1-migration-topup.js +13 -3
- package/server/lib/opencode/v2-install.test.js +13 -13
- package/server/lib/quota/DOCUMENTATION.md +11 -5
- package/server/lib/quota/providers/claude/auth.js +19 -6
- package/server/lib/quota/providers/claude/auth.test.js +22 -9
- package/server/lib/quota/providers/claude/index.js +3 -3
- package/server/lib/quota/providers/claude/index.test.js +3 -2
- package/server/lib/quota/providers/cline-pass.js +4 -4
- package/server/lib/quota/providers/codex.js +3 -4
- package/server/lib/quota/providers/codex.test.js +1 -1
- package/server/lib/quota/providers/copilot.js +4 -5
- package/server/lib/quota/providers/copilot.test.js +1 -1
- package/server/lib/quota/providers/deepseek.js +3 -4
- package/server/lib/quota/providers/deepseek.test.js +1 -1
- package/server/lib/quota/providers/google/auth.js +1 -3
- package/server/lib/quota/providers/google/index.js +3 -2
- package/server/lib/quota/providers/hyper.js +4 -4
- package/server/lib/quota/providers/index.js +9 -2
- package/server/lib/quota/providers/index.test.js +5 -3
- package/server/lib/quota/providers/kimi.js +16 -11
- package/server/lib/quota/providers/kimi.test.js +81 -38
- package/server/lib/quota/providers/minimax-shared.js +3 -4
- package/server/lib/quota/providers/nanogpt.js +3 -4
- package/server/lib/quota/providers/neuralwatt.js +3 -4
- package/server/lib/quota/providers/neuralwatt.test.js +1 -1
- package/server/lib/quota/providers/openai.js +2 -8
- package/server/lib/quota/providers/opencode-go.js +5 -5
- package/server/lib/quota/providers/opencode-go.test.js +1 -1
- package/server/lib/quota/providers/openrouter.js +30 -6
- package/server/lib/quota/providers/openrouter.test.js +122 -1
- package/server/lib/quota/providers/wafer.js +3 -4
- package/server/lib/quota/providers/xai.js +12 -12
- package/server/lib/quota/providers/zai.js +3 -4
- package/server/lib/quota/providers/zai.test.js +1 -1
- package/server/lib/quota/providers/zhipuai-coding-plan.js +5 -6
- package/server/lib/quota/providers/zhipuai-coding-plan.test.js +1 -1
- package/server/lib/quota/routes.js +1 -1
- package/server/lib/routing/DOCUMENTATION.md +4 -0
- package/server/lib/routing/runtime.js +45 -4
- package/server/lib/routing/runtime.test.js +35 -6
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +27 -0
- package/server/lib/scheduled-tasks/chats-scope.js +50 -0
- package/server/lib/scheduled-tasks/runtime.js +57 -23
- package/server/lib/scheduled-tasks/runtime.test.js +103 -1
- package/server/lib/scheduled-tasks/service.js +37 -29
- package/server/lib/scheduled-tasks/service.test.js +39 -0
- package/server/lib/spaces/DOCUMENTATION.md +54 -9
- package/server/lib/spaces/host.js +24 -3
- package/server/lib/spaces/journey.js +111 -11
- package/server/lib/spaces/journey.test.js +189 -8
- package/server/lib/spaces/places/docker-disk.js +151 -0
- package/server/lib/spaces/places/docker-disk.test.js +167 -0
- package/server/lib/spaces/places/docker-tools.js +11 -1
- package/server/lib/spaces/places/docker.js +4 -2
- package/server/lib/spaces/places/fake-docker.js +36 -2
- package/server/lib/spaces/routes.js +21 -4
- package/server/lib/spaces/routes.test.js +6 -2
- package/server/lib/spaces/space-archive.js +275 -0
- package/server/lib/spaces/space-archive.test.js +194 -0
- package/server/lib/spaces/space-opencode.js +139 -6
- package/server/lib/spaces/space-opencode.test.js +82 -1
- package/server/lib/spaces/space-records.js +3 -0
- package/server/lib/spaces/space-setup.js +10 -5
- package/server/lib/spaces/space-setup.test.js +8 -2
- package/server/lib/terminal/DOCUMENTATION.md +1 -0
- package/server/lib/terminal/runtime.js +6 -1
- package/server/lib/terminal/runtime.test.js +19 -0
- package/server/lib/tts/routes.js +2 -2
- package/server/lib/tts/service.js +8 -8
- package/dist/assets/FilesView-CN34wm_N.js +0 -17
- package/dist/assets/JsonTreeView-B1Xq-k2t.js +0 -1
- package/dist/assets/MarkdownRendererImpl-B_ZcWOvX.js +0 -12
- package/dist/assets/OnboardingScreen-C22bGmnP.js +0 -1
- package/dist/assets/PatchDiff-0xd6UeFB.js +0 -1
- package/dist/assets/SettingsView-m_zoFiaT.js +0 -30
- package/dist/assets/SettingsWindow-CofS020b.js +0 -1
- package/dist/assets/ToolPartDiffPreview-Dq0go_fX.js +0 -8
- package/dist/assets/de-DlgBHUAI.js +0 -10
- package/dist/assets/es-BC8G41U8.js +0 -16
- package/dist/assets/fr-I0z3vVjy.js +0 -14
- package/dist/assets/index-CgR5rJq_.js +0 -41
- package/dist/assets/index-adyy_sEk.css +0 -1
- package/dist/assets/ja-BIElEsY8.js +0 -16
- package/dist/assets/ko-DRnnHetA.js +0 -16
- package/dist/assets/main-DVX34beR.js +0 -886
- package/dist/assets/markdownCore-Cxbkn5NR.js +0 -7
- package/dist/assets/mobile-BrlBrNfZ.js +0 -2
- package/dist/assets/nl-DzUV-kwp.js +0 -16
- package/dist/assets/pl-Bb-cb7k7.js +0 -16
- package/dist/assets/pt-BR-CyIWrTcE.js +0 -16
- package/dist/assets/renderMobileApp-B0z6-x58.js +0 -25
- package/dist/assets/runtimeEndpointReset-uu1DBwLL.js +0 -52
- package/dist/assets/scheduledTasksApi-BuzWT445.js +0 -1
- package/dist/assets/shikiHighlight-BWGrY5YU.js +0 -1
- package/dist/assets/tr-DXEDSoYO.js +0 -7
- package/dist/assets/uk-C8hN--q_.js +0 -16
- package/dist/assets/useRootScrollLock-2rd5Y6gR.js +0 -2
- package/dist/assets/vendor-codemirror-autocomplete-DzPz9Wgq.js +0 -1
- package/dist/assets/vendor-codemirror-language-BgPj_McA.js +0 -3
- package/dist/assets/vendor-codemirror-search-BmS-GmcX.js +0 -2
- package/dist/assets/vendor-codemirror-view-CiLROUVV.js +0 -4
- package/dist/assets/vendor-opencode-client-DSZl7jSi.js +0 -12
- package/dist/assets/vendor-remend-BWYYytN3.js +0 -22
- package/dist/assets/zh-CN-CtzXdjMZ.js +0 -16
- package/dist/assets/zh-TW-Ds0CADSz.js +0 -16
- package/server/lib/opencode/credential-db.js +0 -144
- package/server/lib/opencode/credential-db.test.js +0 -104
package/dist/index.html
CHANGED
|
@@ -515,17 +515,17 @@
|
|
|
515
515
|
pointer-events: none;
|
|
516
516
|
}
|
|
517
517
|
</style>
|
|
518
|
-
<script type="module" crossorigin src="/assets/main-
|
|
518
|
+
<script type="module" crossorigin src="/assets/main-D6rlXjug.js"></script>
|
|
519
519
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
520
520
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-CxRSdNoV.js">
|
|
521
521
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
522
522
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
523
523
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
524
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
525
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
524
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-Byb4ZSqI.js">
|
|
525
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Btd2mmYT.js">
|
|
526
526
|
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
|
|
527
527
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
528
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
528
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C-7hQnEc.css">
|
|
529
529
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
530
530
|
</head>
|
|
531
531
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-2JY8K3Qw.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-CxRSdNoV.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-Byb4ZSqI.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Btd2mmYT.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
86
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
86
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C-7hQnEc.css">
|
|
87
87
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
88
88
|
</head>
|
|
89
89
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-CviaXnnU.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-CxRSdNoV.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-Byb4ZSqI.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Btd2mmYT.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
75
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C-7hQnEc.css">
|
|
76
76
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
77
77
|
</head>
|
|
78
78
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@clack/prompts": "^1.1.0",
|
|
28
28
|
"@octokit/rest": "^22.0.1",
|
|
29
|
-
"@openchamber/sdk": "2.0
|
|
30
|
-
"@opencode/client": "2.0.
|
|
31
|
-
"@opencode/schema": "2.0.
|
|
29
|
+
"@openchamber/sdk": "2.1.0",
|
|
30
|
+
"@opencode/client": "2.0.21",
|
|
31
|
+
"@opencode/schema": "2.0.21",
|
|
32
32
|
"@simplewebauthn/server": "13.3.3",
|
|
33
33
|
"bun-pty": "^0.4.5",
|
|
34
34
|
"compression": "^1.8.1",
|
package/server/index.js
CHANGED
|
@@ -81,13 +81,16 @@ import { resolveOpenCodeUpgradeCapability } from './lib/opencode/upgrade-capabil
|
|
|
81
81
|
import { createBootstrapRuntime } from './lib/opencode/bootstrap-runtime.js';
|
|
82
82
|
import { createSessionRuntime } from './lib/opencode/session-runtime.js';
|
|
83
83
|
import { configureOpenCodeRuntimeProviders, resetOpenCodeRuntimeProviders } from './lib/small-model/client.js';
|
|
84
|
+
import { configureOpenCodeCredentials, openCodeCredentialSource } from './lib/opencode/auth.js';
|
|
84
85
|
import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
|
|
85
86
|
import { createSessionAssistRuntime } from './lib/session-assist/runtime.js';
|
|
86
87
|
import { createSessionGoalRuntime } from './lib/session-goal/runtime.js';
|
|
87
88
|
import { createContextObligatoryRuntime } from './lib/context-obligatory/runtime.js';
|
|
88
89
|
import { createLinearSessionStatusRuntime } from './lib/linear/status-runtime.js';
|
|
89
90
|
import { createSessionKnowledgeRuntime } from './lib/session-knowledge/runtime.js';
|
|
91
|
+
import { createMessageSearchRuntime } from './lib/message-search/runtime.js';
|
|
90
92
|
import { createScheduledTasksRuntime } from './lib/scheduled-tasks/runtime.js';
|
|
93
|
+
import { createChatsScope } from './lib/scheduled-tasks/chats-scope.js';
|
|
91
94
|
import { createServerStartupRuntime } from './lib/opencode/server-startup-runtime.js';
|
|
92
95
|
import { createTunnelWiringRuntime } from './lib/opencode/tunnel-wiring-runtime.js';
|
|
93
96
|
import { createStartupPipelineRuntime } from './lib/opencode/startup-pipeline-runtime.js';
|
|
@@ -118,6 +121,7 @@ import { createAgentMemoryActions } from './lib/agent-memory/actions.js';
|
|
|
118
121
|
import { createMemoryProjectResolver } from './lib/agent-memory/project-resolution.js';
|
|
119
122
|
import { isAgentMemoryFeatureAvailable } from './lib/agent-memory/feature-flag.js';
|
|
120
123
|
import { createSpacesHost } from './lib/spaces/host.js';
|
|
124
|
+
import { createSpaceArchive } from './lib/spaces/space-archive.js';
|
|
121
125
|
import { readIdleStopSetting, startIdleStop } from './lib/spaces/idle-stop.js';
|
|
122
126
|
import { SPACE_IDLE_EXIT_CODE } from './lib/spaces/layout.js';
|
|
123
127
|
import { createSwitchController, registerSpaceRoutes } from './lib/spaces/routes.js';
|
|
@@ -136,6 +140,7 @@ import { registerBrowserControlRoutes } from './lib/browser-control/routes.js';
|
|
|
136
140
|
import { createManagedConfigRuntime } from './lib/opencode/managed-config-file.js';
|
|
137
141
|
import { createOpenChamberSessionService } from './lib/openchamber-sessions/routes.js';
|
|
138
142
|
import { createSessionMetadataStore, createOpenCodeSessionMetadata } from './lib/openchamber-sessions/session-metadata-store.js';
|
|
143
|
+
import { createOpenCodeClient } from './lib/openchamber-sessions/opencode-client.js';
|
|
139
144
|
import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
140
145
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
141
146
|
import { createPluginNotificationEmitter } from './lib/notifications/emit-route.js';
|
|
@@ -423,6 +428,9 @@ const settingsRuntime = createSettingsRuntime({
|
|
|
423
428
|
syncManagedRemoteTunnelConfigWithPresets,
|
|
424
429
|
upsertManagedRemoteTunnelToken,
|
|
425
430
|
onManagedPluginSettingsChanged: () => managedConfigRuntime?.refreshManagedConfigFile(),
|
|
431
|
+
// Declared further down; settings are only saved once the server serves requests.
|
|
432
|
+
onMessageSearchEnabledChanged: (enabled) => messageSearchRuntime.setEnabled(enabled),
|
|
433
|
+
onMessageSearchReasoningChanged: (enabled) => messageSearchRuntime.setReasoningEnabled(enabled),
|
|
426
434
|
});
|
|
427
435
|
|
|
428
436
|
const readSettingsFromDiskMigrated = (...args) => settingsRuntime.readSettingsFromDiskMigrated(...args);
|
|
@@ -1051,6 +1059,20 @@ const messageQueueRuntime = createMessageQueueRuntime({
|
|
|
1051
1059
|
});
|
|
1052
1060
|
messageQueueRuntime.start();
|
|
1053
1061
|
|
|
1062
|
+
// Full-text search over this server's conversations (user messages and agent
|
|
1063
|
+
// replies). Opt-in: off by default, and off means idle. The index is derived
|
|
1064
|
+
// data in the data dir, fed from the same event stream; see lib/message-search.
|
|
1065
|
+
const messageSearchRuntime = createMessageSearchRuntime({
|
|
1066
|
+
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1067
|
+
buildOpenCodeUrl,
|
|
1068
|
+
getOpenCodeAuthHeaders,
|
|
1069
|
+
globalEventHub: globalMessageStreamHub,
|
|
1070
|
+
readSettings: async () => {
|
|
1071
|
+
const settings = await readSettingsFromDisk();
|
|
1072
|
+
return { enabled: settings.messageSearchEnabled === true, reasoning: settings.messageSearchReasoningEnabled === true };
|
|
1073
|
+
},
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1054
1076
|
const openCodeWatcherRuntime = createOpenCodeWatcherRuntime({
|
|
1055
1077
|
waitForOpenCodePort: (...args) => waitForOpenCodePort(...args),
|
|
1056
1078
|
buildOpenCodeUrl,
|
|
@@ -1402,6 +1424,15 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
|
|
|
1402
1424
|
getManagedOpenCodeEnv: async () => (managedConfigRuntime ? managedConfigRuntime.buildManagedChildEnv() : {}),
|
|
1403
1425
|
});
|
|
1404
1426
|
|
|
1427
|
+
// Quota lookups, voice keys and routing read provider credentials from the
|
|
1428
|
+
// running OpenCode (`GET /api/credential`), plus the values of the variables a
|
|
1429
|
+
// managed OpenCode takes keys from, read from the environment it was given.
|
|
1430
|
+
configureOpenCodeCredentials(openCodeCredentialSource({
|
|
1431
|
+
buildOpenCodeUrl,
|
|
1432
|
+
getOpenCodeAuthHeaders,
|
|
1433
|
+
getLaunchEnvironment: () => openCodeLifecycleRuntime.getManagedOpenCodeProcessEnv(),
|
|
1434
|
+
}));
|
|
1435
|
+
|
|
1405
1436
|
const getOpenCodeCompatibility = async () => {
|
|
1406
1437
|
if (isExternalOpenCode || ENV_SKIP_OPENCODE_START) {
|
|
1407
1438
|
const base = ENV_CONFIGURED_OPENCODE_HOST?.origin || openCodeBaseUrl || `http://127.0.0.1:${openCodePort || ENV_EFFECTIVE_PORT}`;
|
|
@@ -1432,8 +1463,10 @@ const waitForAgentPresence = (...args) => openCodeLifecycleRuntime.waitForAgentP
|
|
|
1432
1463
|
const refreshOpenCodeAfterConfigChange = (...args) => openCodeLifecycleRuntime.refreshOpenCodeAfterConfigChange(...args);
|
|
1433
1464
|
const startHealthMonitoring = () => openCodeLifecycleRuntime.startHealthMonitoring(HEALTH_CHECK_INTERVAL);
|
|
1434
1465
|
const triggerHealthCheck = () => openCodeLifecycleRuntime.triggerHealthCheck();
|
|
1466
|
+
const scheduledChatsScope = createChatsScope(OPENCHAMBER_CHATS_DIR);
|
|
1435
1467
|
const scheduledTasksRuntime = createScheduledTasksRuntime({
|
|
1436
1468
|
projectConfigRuntime,
|
|
1469
|
+
chatsScope: scheduledChatsScope,
|
|
1437
1470
|
listProjects: async () => {
|
|
1438
1471
|
const settings = await readSettingsFromDiskMigrated();
|
|
1439
1472
|
return sanitizeProjects(settings?.projects || []);
|
|
@@ -1451,7 +1484,7 @@ const scheduledTasksRuntime = createScheduledTasksRuntime({
|
|
|
1451
1484
|
writeSseEvent(client, {
|
|
1452
1485
|
type: 'openchamber:scheduled-task-ran',
|
|
1453
1486
|
properties: {
|
|
1454
|
-
projectId: event.projectID,
|
|
1487
|
+
projectId: scheduledChatsScope.toPublicID(event.projectID),
|
|
1455
1488
|
taskId: event.taskID,
|
|
1456
1489
|
ranAt: event.ranAt,
|
|
1457
1490
|
status: event.status,
|
|
@@ -1522,6 +1555,7 @@ const scheduledTaskService = createScheduledTaskService({
|
|
|
1522
1555
|
sanitizeProjects,
|
|
1523
1556
|
projectConfigRuntime,
|
|
1524
1557
|
scheduledTasksRuntime,
|
|
1558
|
+
chatsScope: scheduledChatsScope,
|
|
1525
1559
|
});
|
|
1526
1560
|
const openChamberSessionService = createOpenChamberSessionService({
|
|
1527
1561
|
readSettingsFromDiskMigrated,
|
|
@@ -1707,6 +1741,7 @@ const gracefulShutdownRuntime = createGracefulShutdownRuntime({
|
|
|
1707
1741
|
sessionGoalRuntime,
|
|
1708
1742
|
contextObligatoryRuntime,
|
|
1709
1743
|
messageQueueRuntime,
|
|
1744
|
+
messageSearchRuntime,
|
|
1710
1745
|
sessionRuntime,
|
|
1711
1746
|
getHealthCheckInterval: () => healthCheckInterval,
|
|
1712
1747
|
clearHealthCheckInterval: (value) => clearInterval(value),
|
|
@@ -1927,11 +1962,28 @@ async function main(options = {}) {
|
|
|
1927
1962
|
// but do not hold server listen or managed OpenCode startup on `say -v "?"`.
|
|
1928
1963
|
const sayTTSCapability = detectSayTtsCapability(process);
|
|
1929
1964
|
|
|
1965
|
+
// The chats of deleted spaces, imported into the host's OpenCode and kept read-only there
|
|
1966
|
+
// (DESIGN.md, decision 9). It reads a folder of the data directory and runs nothing else, so it
|
|
1967
|
+
// exists with the switch on or off: an archived chat must stay read-only either way.
|
|
1968
|
+
const hostOpenCodeClient = () => createOpenCodeClient({
|
|
1969
|
+
baseUrl: buildOpenCodeUrl('/', '').replace(/\/$/, ''),
|
|
1970
|
+
headers: getOpenCodeAuthHeaders(),
|
|
1971
|
+
});
|
|
1972
|
+
const spaceArchive = createSpaceArchive({
|
|
1973
|
+
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1974
|
+
hostOpenCode: {
|
|
1975
|
+
importChat: (chat) => hostOpenCodeClient().session.import(chat),
|
|
1976
|
+
removeChat: (sessionID) => hostOpenCodeClient().session.remove({ sessionID }),
|
|
1977
|
+
},
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1930
1980
|
// The isolated-spaces switch, read here at start and changed live through its route below.
|
|
1931
1981
|
// While it is off the feature has no place, no manager, no route and runs no `docker`.
|
|
1932
1982
|
const buildSpacesHost = () => createSpacesHost({
|
|
1933
1983
|
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1934
1984
|
dockerPath: searchPathFor('docker', buildAugmentedPath()) ?? 'docker',
|
|
1985
|
+
// Only for a clean-up of the spaces' disk on Colima, to give the freed space back; null without it.
|
|
1986
|
+
colimaPath: searchPathFor('colima', buildAugmentedPath()),
|
|
1935
1987
|
gitPath: searchPathFor('git', buildAugmentedPath()) ?? 'git',
|
|
1936
1988
|
// git starts `docker exec` itself when code moves in or out, so its PATH must find docker.
|
|
1937
1989
|
hostEnvironment: { ...process.env, PATH: buildAugmentedPath() },
|
|
@@ -1942,6 +1994,7 @@ async function main(options = {}) {
|
|
|
1942
1994
|
},
|
|
1943
1995
|
readIdleStop: async () => readIdleStopSetting((await readSettingsFromDiskMigrated())?.isolatedSpacesIdleStop),
|
|
1944
1996
|
saveIdleStop: (setting) => persistSettings({ isolatedSpacesIdleStop: setting }),
|
|
1997
|
+
archive: spaceArchive,
|
|
1945
1998
|
});
|
|
1946
1999
|
const startupSettings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
1947
2000
|
if (startupSettings?.isolatedSpacesEnabled === true) {
|
|
@@ -2134,6 +2187,8 @@ async function main(options = {}) {
|
|
|
2134
2187
|
// After the API auth gate, before every route that reads a directory, before the OpenCode proxy.
|
|
2135
2188
|
// The slot is mounted once and reads the host at call time, so the switch can turn the feature
|
|
2136
2189
|
// on and off live: with no host it passes every request on and no upgrade is taken.
|
|
2190
|
+
// An archived chat of a deleted space is read and deleted, never run or changed.
|
|
2191
|
+
app.use(spaceArchive.guard);
|
|
2137
2192
|
app.use((req, res, next) => (spacesHost ? spacesHost.middleware(req, res, next) : next()));
|
|
2138
2193
|
server.on('upgrade', (...args) => { spacesHost?.upgradeHandler(...args); });
|
|
2139
2194
|
const startSpacesHost = (host) => {
|
|
@@ -2156,6 +2211,7 @@ async function main(options = {}) {
|
|
|
2156
2211
|
getPlaces: () => spacesHost?.places() ?? [],
|
|
2157
2212
|
readSwitch: spacesSwitch.readSwitch,
|
|
2158
2213
|
setSwitch: spacesSwitch.setSwitch,
|
|
2214
|
+
getArchive: () => spaceArchive,
|
|
2159
2215
|
});
|
|
2160
2216
|
realtimeProxyRuntime = attachRealtimeProxy({
|
|
2161
2217
|
app,
|
|
@@ -2236,6 +2292,7 @@ async function main(options = {}) {
|
|
|
2236
2292
|
});
|
|
2237
2293
|
|
|
2238
2294
|
await featureRoutesRuntime.registerRoutes(app, {
|
|
2295
|
+
messageSearchRuntime,
|
|
2239
2296
|
crypto,
|
|
2240
2297
|
fs,
|
|
2241
2298
|
os,
|
|
@@ -57,7 +57,14 @@ itself; it can only ask and wait.
|
|
|
57
57
|
carries its `tabId`. `browser.snapshot` answers carry `tabs`
|
|
58
58
|
(`id`, `title`, `url`, `active`). A client without the named tab waits
|
|
59
59
|
briefly, so the client that has it claims first, then claims and answers
|
|
60
|
-
"no such tab".
|
|
60
|
+
"no such tab". A tab restored from a previous run has no pane until it is
|
|
61
|
+
shown or used, so `ContextPanel` registers it as sleeping
|
|
62
|
+
(`registerSleepingBrowserTab`): it is listed in `tabs` without being loaded,
|
|
63
|
+
and an action that lands on it wakes it after the claim and waits for its
|
|
64
|
+
pane. `browser.capture` never opens the panel or switches its tab: a hidden
|
|
65
|
+
pane is drawn at zero opacity inside the window for the screenshot, because
|
|
66
|
+
Chromium composites a transparent webview but not a hidden or clipped one.
|
|
67
|
+
`tabId` is validated and passed through by
|
|
61
68
|
`../openchamber-control/service.js` for every action, so an extension
|
|
62
69
|
provider receives it untouched (`BrowserTabTarget` in `@openchamber/sdk`).
|
|
63
70
|
|
|
@@ -52,6 +52,12 @@ and what made it fragile per framework.
|
|
|
52
52
|
- Through the E2EE relay, the trusted renderer mints a short-lived URL token
|
|
53
53
|
and includes it in the virtual WebSocket URL. The relay host and URL-token
|
|
54
54
|
allowlists accept exactly `/api/dev-tunnel`, not subpaths.
|
|
55
|
+
- The host dials `127.0.0.1` and falls back to `::1` when nothing answers
|
|
56
|
+
there. Discovery offers ports bound to either loopback family, and a dev
|
|
57
|
+
server started with `localhost` defaults often listens on IPv6 only.
|
|
58
|
+
- Every refused upgrade and every failed dial is logged on the host with its
|
|
59
|
+
reason. The desktop only sees its local connection close, which the panel
|
|
60
|
+
cannot tell apart from a dev server that is still starting.
|
|
55
61
|
- Concurrency is capped per host, not per page, because one page load opens
|
|
56
62
|
many sockets.
|
|
57
63
|
- A connection that cannot be established fails the socket rather than holding
|
|
@@ -31,6 +31,15 @@ const DEV_TUNNEL_WS_PATH = '/api/dev-tunnel';
|
|
|
31
31
|
/** One page load opens many sockets; the cap is per host, not per page. */
|
|
32
32
|
const MAX_CONCURRENT_SOCKETS = 64;
|
|
33
33
|
const CONNECT_TIMEOUT_MS = 5_000;
|
|
34
|
+
/**
|
|
35
|
+
* Discovery offers a port bound to either loopback family, and `localhost`
|
|
36
|
+
* resolves to `::1` first on many systems, so a dev server started with its
|
|
37
|
+
* defaults may listen on IPv6 only. Dialing just `127.0.0.1` refused every
|
|
38
|
+
* connection to such a server while the panel listed it as available.
|
|
39
|
+
*/
|
|
40
|
+
const LOOPBACK_HOSTS = ['127.0.0.1', '::1'];
|
|
41
|
+
/** Bytes the page may send before the dev server connection is up. */
|
|
42
|
+
const MAX_PENDING_BYTES = 256 * 1024;
|
|
34
43
|
|
|
35
44
|
const parseRequestedPort = (url) => {
|
|
36
45
|
try {
|
|
@@ -81,48 +90,90 @@ export function createDevTunnelRuntime({
|
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
openSockets += 1;
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
let upstream = null;
|
|
94
|
+
let connected = false;
|
|
95
|
+
let pendingWrites = [];
|
|
96
|
+
let pendingBytes = 0;
|
|
86
97
|
|
|
87
98
|
let settled = false;
|
|
88
99
|
const teardown = () => {
|
|
89
100
|
if (settled) return;
|
|
90
101
|
settled = true;
|
|
91
102
|
openSockets -= 1;
|
|
92
|
-
|
|
103
|
+
clearTimeout(connectTimer);
|
|
104
|
+
pendingWrites = [];
|
|
105
|
+
try { upstream?.destroy(); } catch { /* already gone */ }
|
|
93
106
|
try { socket.close(); } catch { /* already closing */ }
|
|
94
107
|
};
|
|
95
108
|
|
|
96
109
|
const connectTimer = setTimeout(() => {
|
|
97
|
-
if (
|
|
98
|
-
logger.warn?.(`[dev-tunnel] timed out connecting to
|
|
110
|
+
if (connected) return;
|
|
111
|
+
logger.warn?.(`[dev-tunnel] timed out connecting to loopback port ${port}`);
|
|
99
112
|
teardown();
|
|
100
113
|
}, CONNECT_TIMEOUT_MS);
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
const pipeUpstream = () => {
|
|
116
|
+
upstream.on('data', (chunk) => {
|
|
117
|
+
if (socket.readyState !== socket.OPEN) return;
|
|
118
|
+
socket.send(chunk);
|
|
119
|
+
// Stop reading from the dev server while the socket drains, otherwise a
|
|
120
|
+
// fast response against a slow client buffers the whole body in memory.
|
|
121
|
+
if (socket.bufferedAmount > 1_000_000) {
|
|
122
|
+
upstream.pause();
|
|
123
|
+
const resume = () => {
|
|
124
|
+
if (socket.bufferedAmount > 1_000_000) {
|
|
125
|
+
setTimeout(resume, 20);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
upstream.resume();
|
|
129
|
+
};
|
|
130
|
+
setTimeout(resume, 20);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
upstream.on('error', teardown);
|
|
134
|
+
upstream.on('close', teardown);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const dial = (hostIndex) => {
|
|
138
|
+
const host = LOOPBACK_HOSTS[hostIndex];
|
|
139
|
+
const candidate = net.connect({ host, port });
|
|
140
|
+
upstream = candidate;
|
|
141
|
+
candidate.setNoDelay(true);
|
|
142
|
+
candidate.once('connect', () => {
|
|
143
|
+
if (settled) return;
|
|
144
|
+
connected = true;
|
|
145
|
+
clearTimeout(connectTimer);
|
|
146
|
+
candidate.removeAllListeners('error');
|
|
147
|
+
pipeUpstream();
|
|
148
|
+
for (const chunk of pendingWrites) candidate.write(chunk);
|
|
149
|
+
pendingWrites = [];
|
|
150
|
+
pendingBytes = 0;
|
|
151
|
+
});
|
|
152
|
+
candidate.once('error', (error) => {
|
|
153
|
+
candidate.destroy();
|
|
154
|
+
if (settled) return;
|
|
155
|
+
if (hostIndex + 1 < LOOPBACK_HOSTS.length) {
|
|
156
|
+
dial(hostIndex + 1);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
logger.warn?.(`[dev-tunnel] could not connect to port ${port} on ${LOOPBACK_HOSTS.join(' or ')}: ${error?.code || error?.message || error}`);
|
|
160
|
+
teardown();
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
dial(0);
|
|
122
164
|
|
|
123
165
|
socket.on('message', (data) => {
|
|
124
|
-
if (
|
|
125
|
-
|
|
166
|
+
if (settled) return;
|
|
167
|
+
if (connected) {
|
|
168
|
+
upstream.write(data);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
pendingWrites.push(data);
|
|
172
|
+
pendingBytes += data.length;
|
|
173
|
+
if (pendingBytes > MAX_PENDING_BYTES) {
|
|
174
|
+
logger.warn?.(`[dev-tunnel] dropped a connection that buffered too much before port ${port} answered`);
|
|
175
|
+
teardown();
|
|
176
|
+
}
|
|
126
177
|
});
|
|
127
178
|
socket.on('close', teardown);
|
|
128
179
|
socket.on('error', teardown);
|
|
@@ -130,45 +181,50 @@ export function createDevTunnelRuntime({
|
|
|
130
181
|
|
|
131
182
|
const upgradeHandler = (req, socket, head) => {
|
|
132
183
|
if (!isDevTunnelPath(req.url)) return;
|
|
184
|
+
const port = parseRequestedPort(req.url);
|
|
185
|
+
// Every refusal is logged with its reason: the desktop only sees its local
|
|
186
|
+
// connection close, which the panel cannot tell apart from a dev server
|
|
187
|
+
// that is still starting. Never logs the URL, which may carry a token.
|
|
188
|
+
const refuse = (status, reason) => {
|
|
189
|
+
logger.warn?.(`[dev-tunnel] refused port ${port ?? 'unknown'}: ${reason}`);
|
|
190
|
+
rejectWebSocketUpgrade(socket, status, reason);
|
|
191
|
+
};
|
|
133
192
|
void (async () => {
|
|
134
193
|
try {
|
|
135
194
|
if (uiAuthController?.enabled) {
|
|
136
195
|
const auth = await uiAuthController.resolveAuthContext(req, null, { allowUrlToken: true });
|
|
137
196
|
if (!auth) {
|
|
138
|
-
|
|
197
|
+
refuse(401, 'UI authentication required');
|
|
139
198
|
return;
|
|
140
199
|
}
|
|
141
200
|
const hasOrigin = typeof req.headers?.origin === 'string' && req.headers.origin.trim() !== '';
|
|
142
201
|
if (hasOrigin) {
|
|
143
202
|
if (!await isRequestOriginAllowed(req)) {
|
|
144
|
-
|
|
203
|
+
refuse(403, 'Invalid origin');
|
|
145
204
|
return;
|
|
146
205
|
}
|
|
147
206
|
} else if (auth.type !== 'client') {
|
|
148
|
-
|
|
207
|
+
refuse(403, 'Client authentication required');
|
|
149
208
|
return;
|
|
150
209
|
}
|
|
151
210
|
}
|
|
152
211
|
|
|
153
|
-
const port = parseRequestedPort(req.url);
|
|
154
212
|
if (port === null) {
|
|
155
|
-
|
|
213
|
+
refuse(400, 'Invalid port');
|
|
156
214
|
return;
|
|
157
215
|
}
|
|
158
216
|
if (openSockets >= MAX_CONCURRENT_SOCKETS) {
|
|
159
|
-
|
|
217
|
+
refuse(503, 'Too many tunnel connections');
|
|
160
218
|
return;
|
|
161
219
|
}
|
|
162
220
|
if (!await isAllowedPort(port)) {
|
|
163
|
-
|
|
164
|
-
// the panel with nothing anywhere explaining why.
|
|
165
|
-
logger.warn?.(`[dev-tunnel] refused port ${port}: not reported by dev-server discovery`);
|
|
166
|
-
rejectWebSocketUpgrade(socket, 403, 'That port is not an available dev server');
|
|
221
|
+
refuse(403, 'That port is not an available dev server');
|
|
167
222
|
return;
|
|
168
223
|
}
|
|
169
224
|
|
|
170
225
|
wsServer.handleUpgrade(req, socket, head, (ws) => wsServer.emit('connection', ws, req));
|
|
171
|
-
} catch {
|
|
226
|
+
} catch (error) {
|
|
227
|
+
logger.warn?.(`[dev-tunnel] upgrade for port ${port ?? 'unknown'} failed: ${error?.message || error}`);
|
|
172
228
|
rejectWebSocketUpgrade(socket, 500, 'Upgrade failed');
|
|
173
229
|
}
|
|
174
230
|
})();
|
|
@@ -35,10 +35,10 @@ const stopServer = (server, sockets) => async () => {
|
|
|
35
35
|
await new Promise((resolve) => server.close(resolve));
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const startDevServer = async (handler) => {
|
|
38
|
+
const startDevServer = async (handler, host = '127.0.0.1') => {
|
|
39
39
|
const server = http.createServer(handler);
|
|
40
40
|
const sockets = trackSockets(server);
|
|
41
|
-
const port = await listen(server);
|
|
41
|
+
const port = await listen(server, host);
|
|
42
42
|
started.push(stopServer(server, sockets));
|
|
43
43
|
return port;
|
|
44
44
|
};
|
|
@@ -114,6 +114,20 @@ describe('dev tunnel end to end', () => {
|
|
|
114
114
|
expect(response.headers['x-dev-header']).toBe('kept');
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
test('reaches a dev server that listens on IPv6 loopback only', async () => {
|
|
118
|
+
// `localhost` resolves to ::1 first on many systems, so a dev server started
|
|
119
|
+
// with its defaults often never binds 127.0.0.1. Discovery lists it anyway.
|
|
120
|
+
const devPort = await startDevServer((req, res) => res.end(`v6:${req.url}`), '::1');
|
|
121
|
+
const host = await startHost({ allowedPorts: [devPort] });
|
|
122
|
+
const client = createDevTunnelClient({ logger: { warn: () => {} } });
|
|
123
|
+
started.push(() => client.closeAll());
|
|
124
|
+
|
|
125
|
+
const { localPort } = await client.open({ baseUrl: host.baseUrl, port: devPort });
|
|
126
|
+
const response = await httpGet(localPort, '/page');
|
|
127
|
+
expect(response.status).toBe(200);
|
|
128
|
+
expect(response.body).toBe('v6:/page');
|
|
129
|
+
});
|
|
130
|
+
|
|
117
131
|
test('drops a connection that floods a handshake that never completes', async () => {
|
|
118
132
|
// A host that accepts the TCP connection and then says nothing: the
|
|
119
133
|
// WebSocket handshake hangs, which is when buffering could run away.
|
|
@@ -41,7 +41,7 @@ response carries `X-Speech-Model` and `X-Speech-Language`.
|
|
|
41
41
|
the generic OpenCode proxy so routes are not shadowed.
|
|
42
42
|
- `stream-manager.js` — `DictationStreamManager`, one per WS connection.
|
|
43
43
|
Chunk reordering by `seq` + ack, resampling to the provider rate, segment
|
|
44
|
-
splitting, silence suppression by PCM peak, partial-transcript
|
|
44
|
+
splitting inside pauses, silence suppression by PCM peak, partial-transcript
|
|
45
45
|
concatenation, adaptive finalization timeout.
|
|
46
46
|
- `service.js` — provider resolution and readiness. Providers:
|
|
47
47
|
- `local` (default): sherpa-onnx Parakeet TDT in a forked worker process.
|
|
@@ -58,8 +58,8 @@ response carries `X-Speech-Model` and `X-Speech-Language`.
|
|
|
58
58
|
recognizer engine and segment session (one decode per committed segment),
|
|
59
59
|
model catalog and downloader. The native `sherpa-onnx-node` addon is only
|
|
60
60
|
ever loaded inside the worker process.
|
|
61
|
-
- `audio.js` — PCM16 helpers: format parsing, peak,
|
|
62
|
-
linear resampler.
|
|
61
|
+
- `audio.js` — PCM16 helpers: format parsing, peak, per-frame RMS, WAV
|
|
62
|
+
wrapping, streaming linear resampler.
|
|
63
63
|
|
|
64
64
|
## WebSocket protocol (JSON text frames)
|
|
65
65
|
|
|
@@ -78,16 +78,29 @@ openaiCompatible?: { baseUrl, model, apiKey } }`.
|
|
|
78
78
|
## Segmentation
|
|
79
79
|
|
|
80
80
|
A dictation is one segment unless it runs long. Past `segmentMinSeconds`
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
(15 s) the manager cuts inside the first pause it finds, so cuts land between
|
|
82
|
+
words; `segmentMaxSeconds` (25 s) is a hard cap for speech with no pause in it.
|
|
83
|
+
|
|
84
|
+
Pauses are found inside each ~1 s client chunk, not at chunk boundaries: the
|
|
85
|
+
chunk is scored in 50 ms RMS frames; a frame is quiet when it is close to the
|
|
86
|
+
stream's noise floor (the quietest frame in the last ~10 s, so a fan or a
|
|
87
|
+
boosted mic does not hide every pause and a silent first second from a gated
|
|
88
|
+
mic is soon forgotten) and well below its loudest frame (so soft speech does
|
|
89
|
+
not pass for a pause), a pause is a quiet run of at least 200 ms, and the cut
|
|
90
|
+
goes into the middle of that run — a pause that straddles two chunks still
|
|
91
|
+
counts, cut at the chunk boundary when its middle already went by. At the
|
|
92
|
+
hard cap the cut goes into the quietest frame of the chunk that crosses it.
|
|
93
|
+
Bytes before the cut end the committed segment, bytes after it start the next
|
|
94
|
+
one; the client's `seq` and ack are untouched because the whole chunk is
|
|
95
|
+
consumed either way.
|
|
85
96
|
|
|
86
97
|
The bounds exist because Parakeet is a full-attention conformer: decode cost
|
|
87
98
|
and peak memory grow quadratically with segment length. Measured on Parakeet
|
|
88
|
-
v3 int8 with 2 threads: 60 s
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
v3 int8 with 2 threads: 15 s ≈ 0.6 s, 60 s ≈ 2.9 s / 1.17 GB, 90 s ≈ 4.9 s /
|
|
100
|
+
1.60 GB, and a single ~165 s+ segment aborts the worker (native `onnxruntime`
|
|
101
|
+
`SIGTRAP` in `BFCArena::Extend`). Short segments keep a long dictation far from
|
|
102
|
+
that cliff: 24 × 25 s stayed flat at ~1.17 GB. Committed segments decode while
|
|
103
|
+
the user is still speaking, so only the tail is left to transcribe on stop.
|
|
91
104
|
|
|
92
105
|
## Invariants
|
|
93
106
|
|
|
@@ -63,6 +63,34 @@ export function pcm16lePeakAbs(pcm16le) {
|
|
|
63
63
|
return peak;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* RMS of each `frameSamples`-sample frame of a PCM16LE buffer, on the same
|
|
68
|
+
* 0..32767 scale as the samples. A trailing partial frame is dropped. Used to
|
|
69
|
+
* find pauses inside a chunk, where a single peak says nothing about where the
|
|
70
|
+
* speech stops.
|
|
71
|
+
* @param {Buffer} pcm16le
|
|
72
|
+
* @param {number} frameSamples
|
|
73
|
+
* @returns {number[]}
|
|
74
|
+
*/
|
|
75
|
+
export function pcm16leFrameRms(pcm16le, frameSamples) {
|
|
76
|
+
if (!pcm16le || pcm16le.length === 0 || frameSamples <= 0) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
if (pcm16le.length % 2 !== 0) {
|
|
80
|
+
throw new Error(`PCM16 chunk byteLength must be even, got ${pcm16le.length}`);
|
|
81
|
+
}
|
|
82
|
+
const samples = toInt16Samples(pcm16le);
|
|
83
|
+
const frames = [];
|
|
84
|
+
for (let start = 0; start + frameSamples <= samples.length; start += frameSamples) {
|
|
85
|
+
let sumSquares = 0;
|
|
86
|
+
for (let i = start; i < start + frameSamples; i += 1) {
|
|
87
|
+
sumSquares += samples[i] * samples[i];
|
|
88
|
+
}
|
|
89
|
+
frames.push(Math.sqrt(sumSquares / frameSamples));
|
|
90
|
+
}
|
|
91
|
+
return frames;
|
|
92
|
+
}
|
|
93
|
+
|
|
66
94
|
/**
|
|
67
95
|
* Convert PCM16LE to Float32 samples in [-1, 1], with optional gain.
|
|
68
96
|
* @param {Buffer} pcm16le
|