@openchamber/web 1.18.4 → 1.20.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.
Files changed (251) hide show
  1. package/README.md +1 -0
  2. package/dist/assets/{CodeMirrorCommentWidgets-4qZbrEXU.js → CodeMirrorCommentWidgets-C36E738Y.js} +1 -1
  3. package/dist/assets/{CommitSection-MJmntVPJ.js → CommitSection-C-F3AX6D.js} +1 -1
  4. package/dist/assets/{DiagramEditor-jnG3Hbxg.js → DiagramEditor-BPECg1jS.js} +1 -1
  5. package/dist/assets/DiagramView-D0YNMix8.js +1 -0
  6. package/dist/assets/DiffView-BHWaMYCC.js +4 -0
  7. package/dist/assets/FilesView-NMBCW2Tm.js +14 -0
  8. package/dist/assets/{GitView-DBFrDDBv.js → GitView-Rp8P1KEI.js} +4 -4
  9. package/dist/assets/{JsonTreeView-DLW2Wy1g.js → JsonTreeView-KnXFN2A-.js} +1 -1
  10. package/dist/assets/MarkdownImageGallery-BMn3mtor.js +1 -0
  11. package/dist/assets/MarkdownRendererImpl-kD6N03pH.js +12 -0
  12. package/dist/assets/OnboardingScreen-CenIeD4v.js +1 -0
  13. package/dist/assets/{PatchDiff-BuLPx7AN.js → PatchDiff-BzVOVog8.js} +1 -1
  14. package/dist/assets/{PierreDiffViewer-BHm4Yr0X.js → PierreDiffViewer-Dlby4XqT.js} +2 -2
  15. package/dist/assets/PlanView-Czu1KMJa.js +4 -0
  16. package/dist/assets/SessionSwitcherDropdown-IETz58DB.js +1 -0
  17. package/dist/assets/SettingsView-B6vmuf-c.js +28 -0
  18. package/dist/assets/SettingsWindow-CauZpdD3.js +1 -0
  19. package/dist/assets/ToolOutputDialog-BB1c--Zr.js +15 -0
  20. package/dist/assets/ToolPartDiffPreview-DaOIDISD.js +8 -0
  21. package/dist/assets/{VirtualizedFileDiff-CwGocYQd.js → VirtualizedFileDiff-lESMT-2b.js} +4 -4
  22. package/dist/assets/{WalkthroughView-5DyvN03T.js → WalkthroughView-CaSYE0lw.js} +2 -2
  23. package/dist/assets/{computeVirtualFileMetrics-Da00Jg7M.js → computeVirtualFileMetrics-DkRR5b75.js} +2 -2
  24. package/dist/assets/contextPanelEmbeddedChat-BEARQjgn.js +1 -0
  25. package/dist/assets/de-DFdX3ABv.js +9 -0
  26. package/dist/assets/document-attachments-DFAWlG3U.js +31 -0
  27. package/dist/assets/es-iC-FKvV9.js +15 -0
  28. package/dist/assets/fr-BBbi_1AL.js +13 -0
  29. package/dist/assets/index-BiEgzzkg.js +1 -0
  30. package/dist/assets/index-Cwmuwk3V.js +7 -0
  31. package/dist/assets/index-GNm1wgUH.css +1 -0
  32. package/dist/assets/{isDiffPlainText-D9YpoLrV.js → isDiffPlainText-BG53Ixxy.js} +1 -1
  33. package/dist/assets/{isFilePlainText-gTibdNIe.js → isFilePlainText-BbV-39jl.js} +1 -1
  34. package/dist/assets/ja-DQLQJL2J.js +15 -0
  35. package/dist/assets/ko-BeElEB4Y.js +15 -0
  36. package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
  37. package/dist/assets/main-Dpzo18z7.js +2 -0
  38. package/dist/assets/main-WMjtYzJs.js +921 -0
  39. package/dist/assets/markdownCore--tDmyI_v.js +2 -0
  40. package/dist/assets/miniChat-ldEghBLB.js +2 -0
  41. package/dist/assets/mobile-Dk-VGreF.js +2 -0
  42. package/dist/assets/{patchFileDiff-KNkxM1C1.js → patchFileDiff-BcFaMtMu.js} +1 -1
  43. package/dist/assets/pl-CLHt2_vV.js +15 -0
  44. package/dist/assets/pt-BR-C_MPUq7e.js +15 -0
  45. package/dist/assets/renderElectronMiniChatApp-DIgCOmXY.js +2 -0
  46. package/dist/assets/renderMobileApp-CDfHS5rr.js +25 -0
  47. package/dist/assets/runtimeEndpointReset-ovNbaZ-x.js +15 -0
  48. package/dist/assets/scheduledTasksApi-BFSlqgnG.js +1 -0
  49. package/dist/assets/{shikiHighlight-C7LTbwFx.js → shikiHighlight-DCT2Sq_z.js} +1 -1
  50. package/dist/assets/uk-PhsC-c4-.js +15 -0
  51. package/dist/assets/{useAppFontEffects-BikB6enL.js → useAppFontEffects-B53Rb6m7.js} +168 -164
  52. package/dist/assets/useInlineCommentController-DSfrIBKT.js +2 -0
  53. package/dist/assets/{vendor-base-ui-D_V6hAcE.js → vendor-base-ui-DsHmyMwp.js} +1 -1
  54. package/dist/assets/vendor-codemirror-autocomplete-DzPz9Wgq.js +1 -0
  55. package/dist/assets/vendor-codemirror-commands-B7H_j0iU.js +1 -0
  56. package/dist/assets/{vendor-codemirror-lang-angular-CgY7_gQ1.js → vendor-codemirror-lang-angular-DEPs2M5t.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-cpp-B5Ta4enQ.js → vendor-codemirror-lang-cpp-DhkseaMo.js} +1 -1
  58. package/dist/assets/{vendor-codemirror-lang-css-VgNqFSH-.js → vendor-codemirror-lang-css-O0cZX78y.js} +1 -1
  59. package/dist/assets/{vendor-codemirror-lang-go-LxLz62pp.js → vendor-codemirror-lang-go-fMdQYcON.js} +1 -1
  60. package/dist/assets/vendor-codemirror-lang-html-CfgK872x.js +1 -0
  61. package/dist/assets/{vendor-codemirror-lang-java-Bksi1PH4.js → vendor-codemirror-lang-java-CQj4S3zl.js} +1 -1
  62. package/dist/assets/vendor-codemirror-lang-javascript-Cc2ZYbgX.js +13 -0
  63. package/dist/assets/{vendor-codemirror-lang-jinja-C7npuDD7.js → vendor-codemirror-lang-jinja-BmZZv8g-.js} +1 -1
  64. package/dist/assets/{vendor-codemirror-lang-json-ryCw7nab.js → vendor-codemirror-lang-json-CMBS2tG9.js} +1 -1
  65. package/dist/assets/{vendor-codemirror-lang-less-BxsZJD6N.js → vendor-codemirror-lang-less-C6Eo8hVS.js} +1 -1
  66. package/dist/assets/{vendor-codemirror-lang-liquid-De6qch10.js → vendor-codemirror-lang-liquid-DSTR47-H.js} +1 -1
  67. package/dist/assets/vendor-codemirror-lang-markdown-BPGOH9ye.js +1 -0
  68. package/dist/assets/{vendor-codemirror-lang-php-Cm1es33p.js → vendor-codemirror-lang-php-DD9udfPH.js} +1 -1
  69. package/dist/assets/{vendor-codemirror-lang-python-N414WYK-.js → vendor-codemirror-lang-python-HahnQaAS.js} +1 -1
  70. package/dist/assets/{vendor-codemirror-lang-rust-C_WuUStH.js → vendor-codemirror-lang-rust-nLTovbjv.js} +1 -1
  71. package/dist/assets/{vendor-codemirror-lang-sass-8UHTCAOM.js → vendor-codemirror-lang-sass-pL2Yc72v.js} +1 -1
  72. package/dist/assets/{vendor-codemirror-lang-sql-CV3sMA5D.js → vendor-codemirror-lang-sql-BVBnan19.js} +1 -1
  73. package/dist/assets/{vendor-codemirror-lang-vue-DzvC1Dhk.js → vendor-codemirror-lang-vue-BqGzJVm1.js} +1 -1
  74. package/dist/assets/{vendor-codemirror-lang-wast-jlr-LDdA.js → vendor-codemirror-lang-wast-B0_m5DqU.js} +1 -1
  75. package/dist/assets/{vendor-codemirror-lang-xml-CrO63OVp.js → vendor-codemirror-lang-xml-Dj3voadT.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-lang-yaml-dxi6CISW.js → vendor-codemirror-lang-yaml-yu-9Z5u7.js} +1 -1
  77. package/dist/assets/vendor-codemirror-language-BgPj_McA.js +3 -0
  78. package/dist/assets/{vendor-codemirror-language-data-CLHw8NWn.js → vendor-codemirror-language-data-vch3tJ4c.js} +2 -2
  79. package/dist/assets/vendor-codemirror-search-BmS-GmcX.js +2 -0
  80. package/dist/assets/{vendor-codemirror-state-CNWM3Q8V.js → vendor-codemirror-state-C9awkmn-.js} +5 -5
  81. package/dist/assets/vendor-codemirror-view-CiLROUVV.js +4 -0
  82. package/dist/assets/vendor-replit-codemirror-vim-B2DJlAhT.js +6 -0
  83. package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
  84. package/dist/assets/vendor-zod-C9ioTTSo.js +39 -0
  85. package/dist/assets/{web-components-GMc3oR3i.js → web-components-pcwCTWjC.js} +4 -4
  86. package/dist/assets/zh-CN-wF-NOFHM.js +15 -0
  87. package/dist/assets/zh-TW-4m4-A7rT.js +15 -0
  88. package/dist/index.html +5 -4
  89. package/dist/mini-chat.html +4 -3
  90. package/dist/mobile.html +4 -3
  91. package/package.json +3 -5
  92. package/server/index.js +152 -3
  93. package/server/lib/agent-memory/actions.js +243 -0
  94. package/server/lib/agent-memory/actions.test.js +343 -0
  95. package/server/lib/agent-memory/feature-flag.js +19 -0
  96. package/server/lib/agent-memory/feature-flag.test.js +38 -0
  97. package/server/lib/agent-memory/project-resolution.js +65 -0
  98. package/server/lib/agent-memory/project-resolution.test.js +94 -0
  99. package/server/lib/agent-memory/routes.http.test.js +270 -0
  100. package/server/lib/agent-memory/routes.js +169 -0
  101. package/server/lib/agent-memory/runtime.js +432 -0
  102. package/server/lib/agent-memory/runtime.test.js +344 -0
  103. package/server/lib/agent-memory/threat-patterns.js +61 -0
  104. package/server/lib/agent-memory/threat-patterns.test.js +61 -0
  105. package/server/lib/agent-tool/DOCUMENTATION.md +14 -0
  106. package/server/lib/agent-tool/runtime.js +63 -13
  107. package/server/lib/agent-tool/runtime.test.js +85 -2
  108. package/server/lib/context-obligatory/runtime.js +34 -3
  109. package/server/lib/context-obligatory/runtime.test.js +114 -0
  110. package/server/lib/dictation/DOCUMENTATION.md +32 -8
  111. package/server/lib/dictation/local/sherpa-recognizer.js +35 -78
  112. package/server/lib/dictation/local/worker-process.js +2 -2
  113. package/server/lib/dictation/openai-compatible-session.js +3 -2
  114. package/server/lib/dictation/stream-manager.js +77 -34
  115. package/server/lib/dictation/stream-manager.test.js +60 -2
  116. package/server/lib/fs/DOCUMENTATION.md +3 -0
  117. package/server/lib/fs/routes.js +149 -32
  118. package/server/lib/fs/routes.test.js +301 -0
  119. package/server/lib/git/DOCUMENTATION.md +8 -0
  120. package/server/lib/git/routes.js +43 -0
  121. package/server/lib/git/service.js +206 -72
  122. package/server/lib/git/service.test.js +222 -0
  123. package/server/lib/github/DOCUMENTATION.md +14 -3
  124. package/server/lib/github/pr-status.js +188 -83
  125. package/server/lib/github/pr-status.test.js +182 -0
  126. package/server/lib/github/routes.js +36 -30
  127. package/server/lib/notifications/template-runtime.js +2 -3
  128. package/server/lib/openchamber-control/action-resolution.test.js +65 -0
  129. package/server/lib/openchamber-control/actions.js +78 -0
  130. package/server/lib/openchamber-control/service.js +7 -0
  131. package/server/lib/openchamber-sessions/routes.js +14 -0
  132. package/server/lib/opencode/DOCUMENTATION.md +12 -6
  133. package/server/lib/opencode/claude-cli-auth.js +60 -0
  134. package/server/lib/opencode/claude-cli-auth.test.js +54 -0
  135. package/server/lib/opencode/feature-routes-runtime.js +16 -9
  136. package/server/lib/opencode/lifecycle.js +202 -26
  137. package/server/lib/opencode/lifecycle.test.js +179 -1
  138. package/server/lib/opencode/plugins.js +12 -3
  139. package/server/lib/opencode/plugins.test.js +18 -0
  140. package/server/lib/opencode/providers.js +9 -4
  141. package/server/lib/opencode/providers.test.js +27 -0
  142. package/server/lib/opencode/proxy-agent-wiring.test.js +152 -0
  143. package/server/lib/opencode/proxy.js +116 -6
  144. package/server/lib/opencode/proxy.test.js +158 -1
  145. package/server/lib/opencode/restart-session-recovery.test.js +59 -0
  146. package/server/lib/opencode/routes.js +4 -1
  147. package/server/lib/opencode/session-runtime.js +39 -2
  148. package/server/lib/opencode/session-runtime.test.js +74 -0
  149. package/server/lib/opencode/settings-helpers.js +26 -0
  150. package/server/lib/opencode/settings-helpers.test.js +57 -0
  151. package/server/lib/opencode/settings-normalization-runtime.js +3 -0
  152. package/server/lib/opencode/settings-normalization-runtime.test.js +16 -0
  153. package/server/lib/opencode/settings-runtime.js +83 -10
  154. package/server/lib/opencode/settings-runtime.test.js +85 -0
  155. package/server/lib/opencode/shared.js +120 -16
  156. package/server/lib/opencode/shared.test.js +185 -1
  157. package/server/lib/opencode/skill-routes.js +29 -73
  158. package/server/lib/opencode/skill-routes.test.js +2 -5
  159. package/server/lib/project-context/DOCUMENTATION.md +160 -0
  160. package/server/lib/project-context/routes.http.test.js +264 -0
  161. package/server/lib/project-context/routes.js +237 -0
  162. package/server/lib/project-context/runtime.js +672 -0
  163. package/server/lib/project-context/runtime.test.js +498 -0
  164. package/server/lib/projects/project-config.js +7 -2
  165. package/server/lib/quota/DOCUMENTATION.md +17 -2
  166. package/server/lib/quota/providers/claude/auth.js +113 -0
  167. package/server/lib/quota/providers/claude/auth.test.js +117 -0
  168. package/server/lib/quota/providers/claude/index.js +151 -0
  169. package/server/lib/quota/providers/claude/index.test.js +147 -0
  170. package/server/lib/quota/providers/claude/transforms.js +127 -0
  171. package/server/lib/quota/providers/claude/transforms.test.js +82 -0
  172. package/server/lib/quota/providers/command-code.js +90 -0
  173. package/server/lib/quota/providers/command-code.test.js +85 -0
  174. package/server/lib/quota/providers/index.js +30 -2
  175. package/server/lib/quota/providers/index.test.js +10 -1
  176. package/server/lib/quota/providers/zai.js +26 -6
  177. package/server/lib/quota/providers/zai.test.js +33 -0
  178. package/server/lib/quota/utils/formatters.js +2 -1
  179. package/server/lib/scheduled-tasks/runtime.js +21 -2
  180. package/server/lib/session-knowledge/DOCUMENTATION.md +89 -0
  181. package/server/lib/session-knowledge/routes.js +107 -0
  182. package/server/lib/session-knowledge/runtime.js +331 -0
  183. package/server/lib/session-knowledge/runtime.test.js +275 -0
  184. package/server/lib/skills-catalog/DOCUMENTATION.md +18 -45
  185. package/server/lib/skills-catalog/cache.js +120 -1
  186. package/server/lib/skills-catalog/cache.test.js +77 -0
  187. package/server/lib/skills-catalog/curated-sources.js +21 -5
  188. package/server/lib/skills-catalog/curated-sources.test.js +10 -0
  189. package/server/lib/skills-catalog/disk-cache.js +52 -0
  190. package/server/lib/skills-catalog/github-meta.js +139 -0
  191. package/server/lib/skills-catalog/github-meta.test.js +71 -0
  192. package/server/lib/skills-catalog/source.js +0 -5
  193. package/server/lib/small-model/DOCUMENTATION.md +74 -6
  194. package/server/lib/small-model/call.js +46 -12
  195. package/server/lib/small-model/call.test.js +79 -0
  196. package/server/lib/small-model/index.js +57 -6
  197. package/server/lib/small-model/index.test.js +102 -2
  198. package/server/lib/small-model/routes.js +4 -2
  199. package/server/lib/small-model/runtime-providers.js +156 -0
  200. package/server/lib/small-model/runtime-providers.test.js +112 -0
  201. package/dist/assets/DiagramView-CFXxgg_a.js +0 -1
  202. package/dist/assets/DiffView-DZIoOnV7.js +0 -4
  203. package/dist/assets/FilesView-BKL6YlKG.js +0 -14
  204. package/dist/assets/MarkdownImageGallery-DKIylIK7.js +0 -1
  205. package/dist/assets/MarkdownRendererImpl-CLv8hxvv.js +0 -12
  206. package/dist/assets/OnboardingScreen-D2Y6djMw.js +0 -1
  207. package/dist/assets/PlanView-ZYEJn8A_.js +0 -4
  208. package/dist/assets/SessionSwitcherDropdown-rro-SsaO.js +0 -1
  209. package/dist/assets/SettingsView-5RmswFZe.js +0 -28
  210. package/dist/assets/SettingsWindow-BZhAYFdS.js +0 -1
  211. package/dist/assets/ToolOutputDialog-Za6V4VMJ.js +0 -15
  212. package/dist/assets/ToolPartDiffPreview-BL-9ixyC.js +0 -8
  213. package/dist/assets/contextPanelEmbeddedChat-B-bSg3P5.js +0 -1
  214. package/dist/assets/de-u7gSnqWs.js +0 -9
  215. package/dist/assets/document-attachments-CX_YaDsu.js +0 -30
  216. package/dist/assets/es-T9O7aAOr.js +0 -15
  217. package/dist/assets/fr-Oor7ewbE.js +0 -13
  218. package/dist/assets/index-BzIpNlNE.css +0 -1
  219. package/dist/assets/index-C0yNhuZw.js +0 -1
  220. package/dist/assets/index-DRpChWux.js +0 -7
  221. package/dist/assets/ja-DHpqbVmr.js +0 -15
  222. package/dist/assets/ko-CwLkS3nx.js +0 -15
  223. package/dist/assets/main-D7UcL3VQ.js +0 -2
  224. package/dist/assets/main-DPMd2iKS.js +0 -915
  225. package/dist/assets/markdownCore-DDrHVneM.js +0 -2
  226. package/dist/assets/miniChat-O_GVoEbc.js +0 -2
  227. package/dist/assets/mobile-Br4TtAqc.js +0 -2
  228. package/dist/assets/pl-CcZILN8q.js +0 -15
  229. package/dist/assets/pt-BR-DYHhVK6o.js +0 -15
  230. package/dist/assets/renderElectronMiniChatApp-CJpdxTT1.js +0 -2
  231. package/dist/assets/renderMobileApp-toj9cXoh.js +0 -25
  232. package/dist/assets/runtimeEndpointReset-BVmispdD.js +0 -13
  233. package/dist/assets/scheduledTasksApi-ByKya3Un.js +0 -1
  234. package/dist/assets/uk-BA2kZR38.js +0 -15
  235. package/dist/assets/useInlineCommentController-CYPvYJDt.js +0 -2
  236. package/dist/assets/vendor-codemirror-autocomplete-BjbBRsUA.js +0 -1
  237. package/dist/assets/vendor-codemirror-commands-ARAOgp1x.js +0 -1
  238. package/dist/assets/vendor-codemirror-lang-html-B3Qe3OpS.js +0 -1
  239. package/dist/assets/vendor-codemirror-lang-javascript-Bbw3D7r0.js +0 -13
  240. package/dist/assets/vendor-codemirror-lang-markdown-FGQydhTc.js +0 -1
  241. package/dist/assets/vendor-codemirror-language-DUOssd4j.js +0 -3
  242. package/dist/assets/vendor-codemirror-search-8kyQdB3f.js +0 -2
  243. package/dist/assets/vendor-codemirror-view-DSzLbZiS.js +0 -4
  244. package/dist/assets/vendor-replit-codemirror-vim-B0Ecqnlh.js +0 -39
  245. package/dist/assets/zh-CN-dlOQK6v9.js +0 -15
  246. package/dist/assets/zh-TW-BnqQ-WL5.js +0 -15
  247. package/server/lib/quota/providers/claude.js +0 -107
  248. package/server/lib/skills-catalog/clawdhub/api.js +0 -126
  249. package/server/lib/skills-catalog/clawdhub/install.js +0 -238
  250. package/server/lib/skills-catalog/clawdhub/install.test.js +0 -100
  251. package/server/lib/skills-catalog/clawdhub/scan.js +0 -61
@@ -181,7 +181,7 @@ describe('managed agent tool runtime', () => {
181
181
 
182
182
  it('omits a tool the user turned off', async () => {
183
183
  const { runtime, dataDir } = await createRuntime();
184
- await runtime.prepareManagedOpenCodeEnv({ includeControl: false, includeWeb: true });
184
+ await runtime.prepareManagedOpenCodeEnv({ includeControl: false, includeWeb: true, includeMemory: false });
185
185
  const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
186
186
  const pluginModule = await import(`${pathToFileURL(pluginPath).href}?web=${Date.now()}`);
187
187
  const { tool } = await pluginModule.OpenChamberPlugin();
@@ -189,17 +189,100 @@ describe('managed agent tool runtime', () => {
189
189
  expect(Object.keys(tool)).toEqual(['openchamber_web']);
190
190
  });
191
191
 
192
+ it('exposes memory as its own tool carrying only its own inputs', async () => {
193
+ const { runtime, dataDir } = await createRuntime();
194
+ await runtime.prepareManagedOpenCodeEnv({ includeControl: true, includeWeb: false, includeMemory: true });
195
+ const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
196
+ const pluginModule = await import(`${pathToFileURL(pluginPath).href}?memory=${Date.now()}`);
197
+ const { tool } = await pluginModule.OpenChamberPlugin();
198
+
199
+ expect(Object.keys(tool)).toEqual(['openchamber', 'openchamber_memory']);
200
+ expect(Object.keys(tool.openchamber_memory.args.parameters.properties).sort())
201
+ .toEqual(['body', 'memoryId', 'scope', 'title', 'type']);
202
+ // Memory inputs must not leak into the control tool's schema, which the
203
+ // model pays for on every unrelated call.
204
+ expect(Object.keys(tool.openchamber.args.parameters.properties)).not.toContain('memoryId');
205
+ });
206
+
207
+ it('omits memory entirely when the user turns it off', async () => {
208
+ const { runtime, dataDir } = await createRuntime();
209
+ await runtime.prepareManagedOpenCodeEnv({ includeControl: true, includeWeb: false, includeMemory: false });
210
+ const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
211
+ const pluginModule = await import(`${pathToFileURL(pluginPath).href}?nomemory=${Date.now()}`);
212
+ const { tool } = await pluginModule.OpenChamberPlugin();
213
+
214
+ expect(Object.keys(tool)).toEqual(['openchamber']);
215
+ });
216
+
217
+ it('injects the plugin when memory is the only tool left on', async () => {
218
+ const { runtime, dataDir } = await createRuntime();
219
+ await runtime.prepareManagedOpenCodeEnv({ includeControl: false, includeWeb: false, includeMemory: true });
220
+ const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
221
+ const pluginModule = await import(`${pathToFileURL(pluginPath).href}?onlymemory=${Date.now()}`);
222
+ const { tool } = await pluginModule.OpenChamberPlugin();
223
+
224
+ expect(Object.keys(tool)).toEqual(['openchamber_memory']);
225
+ });
226
+
192
227
  it('refuses to inject a plugin with no tools in it', async () => {
193
228
  const { runtime } = await createRuntime();
194
229
  let failed = false;
195
230
  try {
196
- await runtime.prepareManagedOpenCodeEnv({ includeControl: false, includeWeb: false });
231
+ await runtime.prepareManagedOpenCodeEnv({ includeControl: false, includeWeb: false, includeMemory: false });
197
232
  } catch {
198
233
  failed = true;
199
234
  }
200
235
  expect(failed).toBe(true);
201
236
  });
202
237
 
238
+ it('accepts the bare action a tool name already qualifies', async () => {
239
+ // Observed: the model called `read` on openchamber_memory, having taken the
240
+ // tool's own name for the namespace.
241
+ const executeAction = vi.fn(async () => ({ memory: {} }));
242
+ const { runtime } = await createRuntime({ executeAction });
243
+
244
+ const result = await runtime.execute({
245
+ input: { action: 'read', title: 'Uses bun' },
246
+ contextDirectory: '/work/project',
247
+ tool: 'openchamber_memory',
248
+ });
249
+
250
+ expect(result.ok).toBe(true);
251
+ expect(result.action).toBe('memory.read');
252
+ expect(executeAction).toHaveBeenCalledWith(
253
+ 'memory.read',
254
+ { action: 'memory.read', title: 'Uses bun' },
255
+ '/work/project',
256
+ {},
257
+ );
258
+ });
259
+
260
+ it('tells an unresolvable action what the calling tool can do', async () => {
261
+ const { runtime } = await createRuntime();
262
+
263
+ const result = await runtime.execute({
264
+ input: { action: 'get' },
265
+ tool: 'openchamber_memory',
266
+ });
267
+
268
+ expect(result.ok).toBe(false);
269
+ expect(result.error.message).toContain('memory.read');
270
+ expect(result.error.message).not.toContain('browser.open');
271
+ });
272
+
273
+ it('does not let one tool reach another tool\'s actions', async () => {
274
+ const executeAction = vi.fn(async () => ({}));
275
+ const { runtime } = await createRuntime({ executeAction });
276
+
277
+ const result = await runtime.execute({
278
+ input: { action: 'open', url: 'https://example.test' },
279
+ tool: 'openchamber_memory',
280
+ });
281
+
282
+ expect(result.ok).toBe(false);
283
+ expect(executeAction).not.toHaveBeenCalled();
284
+ });
285
+
203
286
  it('executes actions through the shared control service', async () => {
204
287
  const executeAction = vi.fn(async () => ({ projects: [] }));
205
288
  const { runtime } = await createRuntime({ executeAction });
@@ -33,6 +33,7 @@ const buildContextPrompt = (entries) => {
33
33
  export const createContextObligatoryRuntime = ({
34
34
  buildOpenCodeUrl,
35
35
  getOpenCodeAuthHeaders,
36
+ sessionKnowledgeRuntime = null,
36
37
  }) => {
37
38
  const inflight = new Set();
38
39
  let stopped = false;
@@ -59,7 +60,26 @@ export const createContextObligatoryRuntime = ({
59
60
  const session = await openCodeFetch(`/session/${encodeURIComponent(sessionId)}`, { directory });
60
61
  if (session?.parentID) return;
61
62
  const state = readContextState(session);
62
- if (state.messages.length === 0) return;
63
+
64
+ /**
65
+ * Project knowledge rides along with the pinned messages. Compaction takes
66
+ * both away, and both are restored for the same reason, so they travel as
67
+ * one message: two synthetic turns back to back would read as the agent
68
+ * being interrupted twice.
69
+ */
70
+ const knowledge = sessionKnowledgeRuntime
71
+ ? await sessionKnowledgeRuntime
72
+ .resolvePending(
73
+ directory,
74
+ // Compaction removed the previously delivered block, so its stored
75
+ // signature is no longer evidence that the session still carries it.
76
+ '',
77
+ sessionKnowledgeRuntime.readPins(session),
78
+ )
79
+ .catch(() => ({ text: '', signature: '' }))
80
+ : { text: '', signature: '' };
81
+
82
+ if (state.messages.length === 0 && !knowledge.text) return;
63
83
 
64
84
  const recent = await openCodeFetch(`/session/${encodeURIComponent(sessionId)}/message`, {
65
85
  directory,
@@ -86,7 +106,7 @@ export const createContextObligatoryRuntime = ({
86
106
  .filter((result) => result.status === 'fulfilled' && result.value.text)
87
107
  .map((result) => result.value)
88
108
  .sort((left, right) => left.pinned.createdAt - right.pinned.createdAt);
89
- if (entries.length === 0) return;
109
+ if (entries.length === 0 && !knowledge.text) return;
90
110
 
91
111
  const executionInfo = recent.toReversed().find((message) =>
92
112
  message?.info?.role === 'assistant' && message.info.summary !== true)?.info;
@@ -100,7 +120,13 @@ export const createContextObligatoryRuntime = ({
100
120
  body: {
101
121
  model: { providerID, modelID },
102
122
  ...(typeof agent === 'string' && agent ? { agent } : {}),
103
- parts: [{ type: 'text', text: buildContextPrompt(entries), synthetic: true }],
123
+ parts: [{
124
+ type: 'text',
125
+ text: [knowledge.text, entries.length > 0 ? buildContextPrompt(entries) : '']
126
+ .filter(Boolean)
127
+ .join('\n\n---\n\n'),
128
+ synthetic: true,
129
+ }],
104
130
  },
105
131
  });
106
132
 
@@ -115,6 +141,11 @@ export const createContextObligatoryRuntime = ({
115
141
  openchamber: {
116
142
  ...freshState.openchamber,
117
143
  context_obligatory_last_compaction_message_id: summary.id,
144
+ // Recorded together with the cursor: the session now carries this
145
+ // knowledge again, so the next send must not repeat it.
146
+ ...(knowledge.signature
147
+ ? { [sessionKnowledgeRuntime.metadataKey]: knowledge.signature }
148
+ : {}),
118
149
  },
119
150
  },
120
151
  },
@@ -63,6 +63,120 @@ describe('context obligatory runtime', () => {
63
63
  runtime.stop();
64
64
  });
65
65
 
66
+
67
+ it('restores project knowledge after compaction even with nothing pinned', async () => {
68
+ // Pinned messages are already in the conversation until compaction removes
69
+ // them; project knowledge was never there at all, so a session with no
70
+ // pinned messages still has something to get back.
71
+ const requests = [];
72
+ vi.stubGlobal('fetch', vi.fn(async (input, init = {}) => {
73
+ const url = new URL(typeof input === 'string' ? input : input.url);
74
+ requests.push({ path: url.pathname, method: init.method ?? 'GET', body: init.body });
75
+ if (url.pathname === '/session/ses_1' && init.method === 'PATCH') return json({});
76
+ if (url.pathname === '/session/ses_1') return json({
77
+ id: 'ses_1',
78
+ metadata: { openchamber: { knowledge_context_delivered: 'sig-before-compaction' } },
79
+ });
80
+ if (url.pathname === '/session/ses_1/message') return json([
81
+ { info: { id: 'msg_agent', role: 'assistant', providerID: 'provider', modelID: 'model', agent: 'build' } },
82
+ { info: { id: 'msg_summary', role: 'assistant', summary: true, time: { completed: 30 } } },
83
+ ]);
84
+ if (url.pathname === '/session/ses_1/prompt_async') return json({});
85
+ throw new Error(`Unexpected ${url.pathname}`);
86
+ }));
87
+ const resolvePending = vi.fn(async () => ({
88
+ text: '## Pinned notes\n\n- Remember this.',
89
+ signature: 'sig-1',
90
+ }));
91
+ const runtime = createContextObligatoryRuntime({
92
+ buildOpenCodeUrl: (path) => `http://opencode.test${path}`,
93
+ getOpenCodeAuthHeaders: () => ({}),
94
+ sessionKnowledgeRuntime: {
95
+ metadataKey: 'knowledge_context_delivered',
96
+ readPins: () => ({ notes: ['n1'], plans: [] }),
97
+ resolvePending,
98
+ },
99
+ });
100
+
101
+ await runtime.processPayload({
102
+ type: 'session.compacted',
103
+ properties: { sessionID: 'ses_1', directory: '/work/project' },
104
+ });
105
+
106
+ expect(resolvePending).toHaveBeenCalledWith(
107
+ '/work/project',
108
+ '',
109
+ { notes: ['n1'], plans: [] },
110
+ );
111
+ const prompt = requests.find((request) => request.path.endsWith('/prompt_async'));
112
+ expect(JSON.parse(prompt.body).parts[0].text).toContain('Remember this.');
113
+ const patch = requests.find((request) => request.method === 'PATCH');
114
+ // Recorded with the cursor, so the next ordinary send does not repeat it.
115
+ expect(JSON.parse(patch.body).metadata.openchamber.knowledge_context_delivered).toBe('sig-1');
116
+ });
117
+
118
+ it('sends pinned messages and project knowledge as one message', async () => {
119
+ const requests = [];
120
+ vi.stubGlobal('fetch', vi.fn(async (input, init = {}) => {
121
+ const url = new URL(typeof input === 'string' ? input : input.url);
122
+ requests.push({ path: url.pathname, method: init.method ?? 'GET', body: init.body });
123
+ if (url.pathname === '/session/ses_1' && init.method === 'PATCH') return json({});
124
+ if (url.pathname === '/session/ses_1') return json({
125
+ id: 'ses_1',
126
+ metadata: { openchamber: { context_obligatory_messages: [{ id: 'msg_1', createdAt: 10, role: 'user' }] } },
127
+ });
128
+ if (url.pathname === '/session/ses_1/message') return json([
129
+ { info: { id: 'msg_agent', role: 'assistant', providerID: 'provider', modelID: 'model', agent: 'build' } },
130
+ { info: { id: 'msg_summary', role: 'assistant', summary: true, time: { completed: 30 } } },
131
+ ]);
132
+ if (url.pathname === '/session/ses_1/message/msg_1') return json({ parts: [{ type: 'text', text: 'Pinned message' }] });
133
+ if (url.pathname === '/session/ses_1/prompt_async') return json({});
134
+ throw new Error(`Unexpected ${url.pathname}`);
135
+ }));
136
+ const runtime = createContextObligatoryRuntime({
137
+ buildOpenCodeUrl: (path) => `http://opencode.test${path}`,
138
+ getOpenCodeAuthHeaders: () => ({}),
139
+ sessionKnowledgeRuntime: {
140
+ metadataKey: 'knowledge_context_delivered',
141
+ readPins: () => ({ notes: ['n1'], plans: [] }),
142
+ resolvePending: async () => ({ text: 'Pinned notes block', signature: 'sig-1' }),
143
+ },
144
+ });
145
+
146
+ await runtime.processPayload({ type: 'session.compacted', properties: { sessionID: 'ses_1' } });
147
+
148
+ // One turn, not two: back-to-back synthetic messages read as the agent
149
+ // being interrupted twice.
150
+ const prompts = requests.filter((request) => request.path.endsWith('/prompt_async'));
151
+ expect(prompts).toHaveLength(1);
152
+ const text = JSON.parse(prompts[0].body).parts[0].text;
153
+ expect(text).toContain('Pinned notes block');
154
+ expect(text).toContain('Pinned message');
155
+ });
156
+
157
+ it('does nothing when the session already carries the knowledge and has no pins', async () => {
158
+ const requests = [];
159
+ vi.stubGlobal('fetch', vi.fn(async (input, init = {}) => {
160
+ const url = new URL(typeof input === 'string' ? input : input.url);
161
+ requests.push({ path: url.pathname, method: init.method ?? 'GET' });
162
+ if (url.pathname === '/session/ses_1') return json({ id: 'ses_1', metadata: {} });
163
+ throw new Error(`Unexpected ${url.pathname}`);
164
+ }));
165
+ const runtime = createContextObligatoryRuntime({
166
+ buildOpenCodeUrl: (path) => `http://opencode.test${path}`,
167
+ getOpenCodeAuthHeaders: () => ({}),
168
+ sessionKnowledgeRuntime: {
169
+ metadataKey: 'knowledge_context_delivered',
170
+ readPins: () => ({ notes: [], plans: [] }),
171
+ resolvePending: async () => ({ text: '', signature: 'sig-1' }),
172
+ },
173
+ });
174
+
175
+ await runtime.processPayload({ type: 'session.compacted', properties: { sessionID: 'ses_1' } });
176
+
177
+ expect(requests.some((request) => request.path.endsWith('/prompt_async'))).toBe(false);
178
+ });
179
+
66
180
  it('ignores ordinary idle events without making requests', async () => {
67
181
  const fetchImpl = vi.fn();
68
182
  vi.stubGlobal('fetch', fetchImpl);
@@ -1,9 +1,15 @@
1
1
  # Dictation module
2
2
 
3
- Server-authoritative streaming speech-to-text for the chat composer, plus
4
- local text-to-speech. The client streams 16 kHz mono PCM16 chunks (base64)
5
- over a WebSocket; the server runs the transcription and streams live partial
6
- transcripts back.
3
+ Server-authoritative speech-to-text for the chat composer, plus local
4
+ text-to-speech. The client streams 16 kHz mono PCM16 chunks (base64) over a
5
+ WebSocket while the user speaks; the server buffers them and transcribes each
6
+ segment exactly once, when the segment is committed.
7
+
8
+ Transcription is deliberately not incremental. Parakeet is an offline model
9
+ trained on whole utterances, so re-decoding the growing buffer to animate a
10
+ live transcript costs O(n^2) work for a result the final decode replaces. The
11
+ composer shows no text while recording and inserts the full transcript on
12
+ stop.
7
13
 
8
14
  Local TTS (Kokoro via sherpa-onnx OfflineTts) runs in the same worker process
9
15
  and is exposed as `POST /api/dictation/tts/speak` (JSON `{text, speakerId?,
@@ -21,9 +27,9 @@ same status/download/delete routes.
21
27
  Created from the startup pipeline (`startup-pipeline-runtime.js`) before
22
28
  the generic OpenCode proxy so routes are not shadowed.
23
29
  - `stream-manager.js` — `DictationStreamManager`, one per WS connection.
24
- Chunk reordering by `seq` + ack, resampling to the provider rate,
25
- auto-commit every ~15 s of audio, silence suppression by PCM peak,
26
- partial-transcript concatenation, adaptive finalization timeout.
30
+ Chunk reordering by `seq` + ack, resampling to the provider rate, segment
31
+ splitting, silence suppression by PCM peak, partial-transcript
32
+ concatenation, adaptive finalization timeout.
27
33
  - `service.js` — provider resolution and readiness. Providers:
28
34
  - `local` (default): sherpa-onnx Parakeet TDT in a forked worker process.
29
35
  Models auto-download in the background on first use; while missing, the
@@ -33,7 +39,7 @@ same status/download/delete routes.
33
39
  OpenAI-compatible `/v1/audio/transcriptions` endpoint
34
40
  (`openai-compatible-session.js`, reuses `../tts/stt.js`).
35
41
  - `local/` — worker process + client (IPC, idle shutdown TTL), sherpa
36
- recognizer engine and realtime session (throttled re-decode for partials),
42
+ recognizer engine and segment session (one decode per committed segment),
37
43
  model catalog and downloader. The native `sherpa-onnx-node` addon is only
38
44
  ever loaded inside the worker process.
39
45
  - `audio.js` — PCM16 helpers: format parsing, peak, WAV wrapping, streaming
@@ -53,9 +59,27 @@ Server → client: `ready`, `ack {ackSeq}`, `partial {text}`,
53
59
  `{ provider: 'local' | 'openai-compatible', language?, localModel?,
54
60
  openaiCompatible?: { baseUrl, model, apiKey } }`.
55
61
 
62
+ ## Segmentation
63
+
64
+ A dictation is one segment unless it runs long. Past `segmentMinSeconds`
65
+ (60 s) the manager commits on the first silent chunk, so cuts land at a pause
66
+ rather than mid-word; `segmentMaxSeconds` (90 s) is a hard cap for speech with
67
+ no pause in it. Client chunks are ~1 s, so "silent chunk" is roughly a second
68
+ of silence.
69
+
70
+ The bounds exist because Parakeet is a full-attention conformer: decode cost
71
+ and peak memory grow quadratically with segment length. Measured on Parakeet
72
+ v3 int8 with 2 threads: 60 s took 2.1 s and +90 MB, 180 s took 9.3 s and
73
+ +490 MB, 300 s took 21.3 s and +1.5 GB. Committed segments decode while the
74
+ user is still speaking, so only the tail is left to transcribe on stop.
75
+
56
76
  ## Invariants
57
77
 
58
78
  - Never load `sherpa-onnx-node` in the main server process.
79
+ - Transcription happens on commit only; sessions never emit non-final
80
+ transcripts. The `partial` messages a client receives are the concatenation
81
+ of already-committed segments, and exist so a dictation that fails partway
82
+ can be salvaged instead of losing minutes of speech.
59
83
  - The stream manager acks only the highest contiguous seq; the client is
60
84
  expected to retain unacked segments for retry/replay.
61
85
  - Silence-only segments (peak < 300) are cleared, never committed, so
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * Sherpa-onnx offline recognizer engine (NeMo transducer / Parakeet) plus a
3
- * realtime streaming transcription session that re-decodes the accumulated
4
- * segment audio on a throttle to produce live partial transcripts.
3
+ * segment transcription session that decodes each segment exactly once, when
4
+ * the segment is committed.
5
+ *
6
+ * Parakeet is an offline model: it is trained to see a whole utterance at
7
+ * once. Decoding the accumulated audio repeatedly to animate a live transcript
8
+ * costs O(n^2) work for a result the final decode throws away, so this session
9
+ * only decodes on commit.
5
10
  *
6
11
  * Runs inside the dictation worker process only — never load the native
7
12
  * addon in the main server process.
@@ -147,31 +152,26 @@ export class SherpaOfflineRecognizerEngine {
147
152
  }
148
153
 
149
154
  /**
150
- * Streaming transcription session backed by the offline recognizer.
151
- * Accumulates the current segment's PCM and re-decodes it at most every
152
- * `minDecodeIntervalMs` to emit non-final partial transcripts; `commit()`
153
- * finalizes the segment and starts a new one.
155
+ * Segment transcription session backed by the offline recognizer.
156
+ * Accumulates the current segment's PCM and decodes it once in `commit()`,
157
+ * which emits the segment's final transcript and starts a new segment.
154
158
  *
155
159
  * Implements the StreamingTranscriptionSession contract used by
156
- * DictationStreamManager.
160
+ * DictationStreamManager. It never emits non-final transcripts: the manager's
161
+ * live `partial` messages are the concatenation of already-committed segments.
157
162
  */
158
- export class SherpaRealtimeTranscriptionSession extends EventEmitter {
163
+ export class SherpaSegmentTranscriptionSession extends EventEmitter {
159
164
  /**
160
- * @param {{ engine: SherpaOfflineRecognizerEngine, minDecodeIntervalMs?: number }} params
165
+ * @param {{ engine: SherpaOfflineRecognizerEngine }} params
161
166
  */
162
- constructor({ engine, minDecodeIntervalMs }) {
167
+ constructor({ engine }) {
163
168
  super();
164
169
  this.engine = engine;
165
170
  this.requiredSampleRate = engine.sampleRate;
166
- this.minDecodeIntervalMs = minDecodeIntervalMs ?? 350;
167
171
  this.connected = false;
168
172
  this.currentSegmentId = null;
169
173
  this.previousSegmentId = null;
170
- this.lastPartialText = '';
171
174
  this.pcm16 = Buffer.alloc(0);
172
- this.lastDecodeAt = 0;
173
- this.decoding = false;
174
- this.pendingDecode = false;
175
175
  }
176
176
 
177
177
  async connect() {
@@ -184,39 +184,38 @@ export class SherpaRealtimeTranscriptionSession extends EventEmitter {
184
184
 
185
185
  appendPcm16(chunk) {
186
186
  if (!this.connected || !this.currentSegmentId) {
187
- this.emit('error', new Error('Sherpa realtime session not connected'));
187
+ this.emit('error', new Error('Sherpa transcription session not connected'));
188
188
  return;
189
189
  }
190
190
  this.pcm16 = this.pcm16.length === 0 ? chunk : Buffer.concat([this.pcm16, chunk]);
191
- this.maybeDecode(false).catch((err) => {
192
- this.emit('error', err instanceof Error ? err : new Error(String(err)));
193
- });
194
191
  }
195
192
 
196
193
  commit() {
197
194
  if (!this.connected || !this.currentSegmentId) {
198
- this.emit('error', new Error('Sherpa realtime session not connected'));
195
+ this.emit('error', new Error('Sherpa transcription session not connected'));
199
196
  return;
200
197
  }
201
198
 
202
- void (async () => {
203
- try {
204
- await this.maybeDecode(true);
205
- const finalText = this.lastPartialText;
206
- const segmentId = this.currentSegmentId;
207
- const previousSegmentId = this.previousSegmentId;
199
+ const segmentId = this.currentSegmentId;
200
+ const previousSegmentId = this.previousSegmentId;
201
+ const pcm16 = this.pcm16;
208
202
 
209
- this.emit('committed', { segmentId, previousSegmentId });
210
- this.emit('transcript', { segmentId, transcript: finalText, isFinal: true });
203
+ // Start the next segment before decoding: decoding blocks the worker for
204
+ // seconds on long segments, and audio for the next one keeps arriving.
205
+ this.previousSegmentId = segmentId;
206
+ this.currentSegmentId = randomUUID();
207
+ this.pcm16 = Buffer.alloc(0);
211
208
 
212
- this.previousSegmentId = segmentId;
213
- this.currentSegmentId = randomUUID();
214
- this.lastPartialText = '';
215
- this.pcm16 = Buffer.alloc(0);
216
- } catch (err) {
217
- this.emit('error', err instanceof Error ? err : new Error(String(err)));
218
- }
219
- })();
209
+ this.emit('committed', { segmentId, previousSegmentId });
210
+
211
+ let transcript;
212
+ try {
213
+ transcript = this.engine.decodePcm16(pcm16);
214
+ } catch (err) {
215
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
216
+ return;
217
+ }
218
+ this.emit('transcript', { segmentId, transcript, isFinal: true });
220
219
  }
221
220
 
222
221
  clear() {
@@ -225,7 +224,6 @@ export class SherpaRealtimeTranscriptionSession extends EventEmitter {
225
224
  }
226
225
  this.pcm16 = Buffer.alloc(0);
227
226
  this.currentSegmentId = randomUUID();
228
- this.lastPartialText = '';
229
227
  }
230
228
 
231
229
  close() {
@@ -233,45 +231,4 @@ export class SherpaRealtimeTranscriptionSession extends EventEmitter {
233
231
  this.currentSegmentId = null;
234
232
  this.pcm16 = Buffer.alloc(0);
235
233
  }
236
-
237
- async maybeDecode(force) {
238
- if (!this.connected || !this.currentSegmentId) {
239
- return;
240
- }
241
-
242
- const now = Date.now();
243
- if (!force && now - this.lastDecodeAt < this.minDecodeIntervalMs) {
244
- return;
245
- }
246
-
247
- if (this.decoding) {
248
- this.pendingDecode = true;
249
- return;
250
- }
251
-
252
- this.decoding = true;
253
- try {
254
- const decodeStartedAt = Date.now();
255
- const text = this.engine.decodePcm16(this.pcm16);
256
- this.lastDecodeAt = Date.now();
257
- // Adaptive throttle: on slow hardware (or heavy models) re-decoding the
258
- // growing segment every 350ms would monopolize the worker. Space partial
259
- // decodes to ~1.5x the observed decode time.
260
- this.minDecodeIntervalMs = Math.max(350, (this.lastDecodeAt - decodeStartedAt) * 1.5);
261
- if (text !== this.lastPartialText) {
262
- this.lastPartialText = text;
263
- this.emit('transcript', {
264
- segmentId: this.currentSegmentId,
265
- transcript: text,
266
- isFinal: false,
267
- });
268
- }
269
- } finally {
270
- this.decoding = false;
271
- if (this.pendingDecode) {
272
- this.pendingDecode = false;
273
- await this.maybeDecode(true);
274
- }
275
- }
276
- }
277
234
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  import {
19
19
  SherpaOfflineRecognizerEngine,
20
- SherpaRealtimeTranscriptionSession,
20
+ SherpaSegmentTranscriptionSession,
21
21
  } from './sherpa-recognizer.js';
22
22
  import { SherpaTtsEngine } from './sherpa-tts.js';
23
23
  import { getLocalSttModelDir, getLocalSttModelSpec } from './model-catalog.js';
@@ -126,7 +126,7 @@ async function handleRequest(message) {
126
126
  case 'session.create': {
127
127
  cleanupSession(message.sessionId);
128
128
  const engine = getEngine(message.modelsDir, message.modelId);
129
- const session = new SherpaRealtimeTranscriptionSession({ engine });
129
+ const session = new SherpaSegmentTranscriptionSession({ engine });
130
130
  session.on('committed', (payload) => {
131
131
  sendToParent({ type: 'session.committed', sessionId: message.sessionId, payload });
132
132
  });
@@ -3,8 +3,9 @@
3
3
  * endpoints (faster-whisper, whisper.cpp, OpenAI, ...).
4
4
  *
5
5
  * The Whisper HTTP API cannot stream, so audio is buffered per segment and
6
- * transcribed on commit(). Live partials therefore only advance at segment
7
- * boundaries (the DictationStreamManager auto-commits every ~15s of speech).
6
+ * transcribed on commit(). This matches how the local session behaves: the
7
+ * DictationStreamManager splits long dictations at pauses, and everything
8
+ * shorter is one request on stop.
8
9
  *
9
10
  * Implements the StreamingTranscriptionSession contract used by
10
11
  * DictationStreamManager.