@openchamber/web 1.18.3 → 1.19.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 (215) hide show
  1. package/README.md +1 -0
  2. package/dist/assets/{CodeMirrorCommentWidgets-DbUi6I9s.js → CodeMirrorCommentWidgets-DAvopJvy.js} +1 -1
  3. package/dist/assets/{CommitSection-Jc2_hNPE.js → CommitSection-D9cV-qR9.js} +1 -1
  4. package/dist/assets/{DiagramEditor-PCrYHBko.js → DiagramEditor-B9NCadU7.js} +1 -1
  5. package/dist/assets/DiagramView-LKGBwf4G.js +1 -0
  6. package/dist/assets/{DiffView-DEGlNjMH.js → DiffView-BWNq-0ov.js} +2 -2
  7. package/dist/assets/FilesView-DB-Q0Gkz.js +14 -0
  8. package/dist/assets/{GitView-C-n17voy.js → GitView-DsWXqWx3.js} +3 -3
  9. package/dist/assets/{JsonTreeView-BYcgdTOQ.js → JsonTreeView-h4dHASlq.js} +1 -1
  10. package/dist/assets/MarkdownImageGallery-n0ikH-xm.js +1 -0
  11. package/dist/assets/MarkdownRendererImpl-CT2mjx-s.js +12 -0
  12. package/dist/assets/OnboardingScreen-CDjgzxEe.js +1 -0
  13. package/dist/assets/{PatchDiff-Bn7bfgUv.js → PatchDiff-jPKTJje5.js} +1 -1
  14. package/dist/assets/{PierreDiffViewer-D1fWvrUn.js → PierreDiffViewer-D_Gt4A_6.js} +1 -1
  15. package/dist/assets/PlanView-UvuxIl9-.js +4 -0
  16. package/dist/assets/SessionSwitcherDropdown-xKU4LRuQ.js +1 -0
  17. package/dist/assets/SettingsView-3B9VN6Ys.js +28 -0
  18. package/dist/assets/SettingsWindow-CqQNDKNd.js +1 -0
  19. package/dist/assets/{ToolOutputDialog-BtIJkFno.js → ToolOutputDialog-PmjlAxVE.js} +6 -6
  20. package/dist/assets/{ToolPartDiffPreview-i3PQo6_0.js → ToolPartDiffPreview-B34Xw9wq.js} +1 -1
  21. package/dist/assets/{VirtualizedFileDiff-DkcusvMa.js → VirtualizedFileDiff-B37yB9jZ.js} +3 -3
  22. package/dist/assets/{WalkthroughView-Cc5Hd6P5.js → WalkthroughView-Bxun3k66.js} +2 -2
  23. package/dist/assets/{computeVirtualFileMetrics-xPena3W2.js → computeVirtualFileMetrics-DYFv_yZS.js} +2 -2
  24. package/dist/assets/contextPanelEmbeddedChat-BO1wRpaN.js +1 -0
  25. package/dist/assets/de-DbV6CLxv.js +9 -0
  26. package/dist/assets/document-attachments-DFAWlG3U.js +31 -0
  27. package/dist/assets/es-CVDlyzZ4.js +15 -0
  28. package/dist/assets/fr-Czc-p0g-.js +13 -0
  29. package/dist/assets/index-1OhiMDBz.css +1 -0
  30. package/dist/assets/index-BSvmTvZl.js +1 -0
  31. package/dist/assets/index-DzriVon2.js +7 -0
  32. package/dist/assets/{isDiffPlainText-Dudf-dWx.js → isDiffPlainText-DwHKxDYc.js} +1 -1
  33. package/dist/assets/{isFilePlainText-DS4QV1dd.js → isFilePlainText-Dwq6ILxo.js} +1 -1
  34. package/dist/assets/ja-dwc9NM_S.js +15 -0
  35. package/dist/assets/ko-Ds1DZ8FX.js +15 -0
  36. package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
  37. package/dist/assets/main-BF51IOVF.js +921 -0
  38. package/dist/assets/{main-C0DyIwTb.js → main-D7UPARut.js} +2 -2
  39. package/dist/assets/markdownCore-BgeBDwD3.js +2 -0
  40. package/dist/assets/{miniChat-CGfrxKpJ.js → miniChat-BISXSGOo.js} +2 -2
  41. package/dist/assets/mobile-BnYxVuvw.js +2 -0
  42. package/dist/assets/{patchFileDiff-C5D1OPCa.js → patchFileDiff-BEDPDypx.js} +2 -2
  43. package/dist/assets/pl-CLiTO7i-.js +15 -0
  44. package/dist/assets/pt-BR-GIimJgpK.js +15 -0
  45. package/dist/assets/renderElectronMiniChatApp-BaOy72Gi.js +2 -0
  46. package/dist/assets/{renderMobileApp-B5HA4qbi.js → renderMobileApp-BiMbzPq9.js} +7 -7
  47. package/dist/assets/runtimeEndpointReset-BMBRhIbf.js +15 -0
  48. package/dist/assets/scheduledTasksApi-01zzfzqH.js +1 -0
  49. package/dist/assets/{shikiHighlight-CmanopUB.js → shikiHighlight-DXYW46vW.js} +1 -1
  50. package/dist/assets/uk-DLfgD1ki.js +15 -0
  51. package/dist/assets/{useAppFontEffects-sHmU5b8u.js → useAppFontEffects-CbzHzFop.js} +139 -142
  52. package/dist/assets/{useInlineCommentController-gt56WkxJ.js → useInlineCommentController-CegKdDXi.js} +2 -2
  53. package/dist/assets/{vendor-base-ui-D_V6hAcE.js → vendor-base-ui-BYlZTzrw.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-Dihw9MtL.js → vendor-codemirror-language-data-CiAYDJXN.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-adaMkgkm.js +39 -0
  85. package/dist/assets/{web-components-BL-Ur2Tb.js → web-components-DCLjCO9n.js} +1 -1
  86. package/dist/assets/zh-CN-DkeP5awK.js +15 -0
  87. package/dist/assets/zh-TW-BocaFm3d.js +15 -0
  88. package/dist/index.html +4 -4
  89. package/dist/mini-chat.html +3 -3
  90. package/dist/mobile.html +3 -3
  91. package/package.json +1 -1
  92. package/server/index.js +116 -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 +56 -0
  98. package/server/lib/agent-memory/project-resolution.test.js +85 -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 +427 -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/dev-tunnel/client.js +20 -1
  111. package/server/lib/dev-tunnel/tunnel.test.js +9 -0
  112. package/server/lib/fs/DOCUMENTATION.md +3 -0
  113. package/server/lib/fs/routes.js +149 -32
  114. package/server/lib/fs/routes.test.js +225 -0
  115. package/server/lib/git/DOCUMENTATION.md +8 -0
  116. package/server/lib/git/service.js +121 -67
  117. package/server/lib/git/service.test.js +129 -0
  118. package/server/lib/github/DOCUMENTATION.md +14 -3
  119. package/server/lib/github/pr-status.js +188 -83
  120. package/server/lib/github/pr-status.test.js +182 -0
  121. package/server/lib/github/routes.js +36 -30
  122. package/server/lib/markdown-image-grants/DOCUMENTATION.md +36 -0
  123. package/server/lib/markdown-image-grants/routes.js +340 -0
  124. package/server/lib/markdown-image-grants/routes.test.js +221 -0
  125. package/server/lib/notifications/template-runtime.js +2 -3
  126. package/server/lib/openchamber-control/action-resolution.test.js +65 -0
  127. package/server/lib/openchamber-control/actions.js +78 -0
  128. package/server/lib/openchamber-control/service.js +7 -0
  129. package/server/lib/openchamber-sessions/routes.js +14 -0
  130. package/server/lib/opencode/DOCUMENTATION.md +6 -4
  131. package/server/lib/opencode/claude-cli-auth.js +60 -0
  132. package/server/lib/opencode/claude-cli-auth.test.js +54 -0
  133. package/server/lib/opencode/feature-routes-runtime.js +22 -0
  134. package/server/lib/opencode/plugins.js +12 -3
  135. package/server/lib/opencode/plugins.test.js +18 -0
  136. package/server/lib/opencode/proxy-agent-wiring.test.js +152 -0
  137. package/server/lib/opencode/proxy.js +116 -6
  138. package/server/lib/opencode/proxy.test.js +158 -1
  139. package/server/lib/opencode/routes.js +4 -1
  140. package/server/lib/opencode/server-startup-runtime.js +22 -1
  141. package/server/lib/opencode/server-startup-runtime.test.js +44 -0
  142. package/server/lib/opencode/settings-helpers.js +11 -0
  143. package/server/lib/opencode/settings-helpers.test.js +35 -0
  144. package/server/lib/opencode/settings-runtime.js +51 -0
  145. package/server/lib/opencode/shared.js +120 -16
  146. package/server/lib/opencode/shared.test.js +185 -1
  147. package/server/lib/project-context/DOCUMENTATION.md +158 -0
  148. package/server/lib/project-context/routes.http.test.js +264 -0
  149. package/server/lib/project-context/routes.js +237 -0
  150. package/server/lib/project-context/runtime.js +667 -0
  151. package/server/lib/project-context/runtime.test.js +498 -0
  152. package/server/lib/quota/DOCUMENTATION.md +16 -1
  153. package/server/lib/quota/providers/claude/auth.js +113 -0
  154. package/server/lib/quota/providers/claude/auth.test.js +117 -0
  155. package/server/lib/quota/providers/claude/index.js +151 -0
  156. package/server/lib/quota/providers/claude/index.test.js +147 -0
  157. package/server/lib/quota/providers/claude/transforms.js +127 -0
  158. package/server/lib/quota/providers/claude/transforms.test.js +82 -0
  159. package/server/lib/quota/providers/command-code.js +90 -0
  160. package/server/lib/quota/providers/command-code.test.js +72 -0
  161. package/server/lib/quota/providers/index.js +22 -2
  162. package/server/lib/quota/providers/index.test.js +10 -1
  163. package/server/lib/quota/utils/formatters.js +2 -1
  164. package/server/lib/scheduled-tasks/runtime.js +21 -2
  165. package/server/lib/session-knowledge/DOCUMENTATION.md +87 -0
  166. package/server/lib/session-knowledge/routes.js +107 -0
  167. package/server/lib/session-knowledge/runtime.js +331 -0
  168. package/server/lib/session-knowledge/runtime.test.js +275 -0
  169. package/server/lib/skills-catalog/DOCUMENTATION.md +22 -22
  170. package/server/lib/skills-catalog/curated-sources.js +1 -1
  171. package/server/lib/skills-catalog/curated-sources.test.js +10 -0
  172. package/server/lib/small-model/index.js +8 -0
  173. package/server/lib/small-model/index.test.js +31 -1
  174. package/server/lib/small-model/routes.js +3 -1
  175. package/dist/assets/DiagramView-CndEcZNu.js +0 -1
  176. package/dist/assets/FilesView-CzUgIvUm.js +0 -14
  177. package/dist/assets/MarkdownImageGallery-DzHwkVIH.js +0 -1
  178. package/dist/assets/MarkdownRendererImpl-DUcIcWgs.js +0 -12
  179. package/dist/assets/OnboardingScreen-BmN0lhk4.js +0 -1
  180. package/dist/assets/PlanView-CWM0iyFk.js +0 -4
  181. package/dist/assets/SessionSwitcherDropdown-Cez-9xRh.js +0 -1
  182. package/dist/assets/SettingsView-Bl1drwPw.js +0 -28
  183. package/dist/assets/SettingsWindow-DL5axjDZ.js +0 -1
  184. package/dist/assets/contextPanelEmbeddedChat-tQekJUAF.js +0 -1
  185. package/dist/assets/de-u7gSnqWs.js +0 -9
  186. package/dist/assets/document-attachments-CX_YaDsu.js +0 -30
  187. package/dist/assets/es-T9O7aAOr.js +0 -15
  188. package/dist/assets/fr-Oor7ewbE.js +0 -13
  189. package/dist/assets/index-CVNuER6G.css +0 -1
  190. package/dist/assets/index-Crz1YOFl.js +0 -1
  191. package/dist/assets/index-iFY_N5aO.js +0 -7
  192. package/dist/assets/ja-DHpqbVmr.js +0 -15
  193. package/dist/assets/ko-CwLkS3nx.js +0 -15
  194. package/dist/assets/main-CAxX6DAN.js +0 -915
  195. package/dist/assets/markdownCore-DhfzuGXu.js +0 -2
  196. package/dist/assets/markdownImageAssets-BTNlRyjd.js +0 -1
  197. package/dist/assets/mobile-DEmhwNcV.js +0 -2
  198. package/dist/assets/pl-CcZILN8q.js +0 -15
  199. package/dist/assets/pt-BR-DYHhVK6o.js +0 -15
  200. package/dist/assets/renderElectronMiniChatApp-Dpbswpom.js +0 -2
  201. package/dist/assets/runtimeEndpointReset-cbahJ3hD.js +0 -13
  202. package/dist/assets/scheduledTasksApi-BxgGWTL8.js +0 -1
  203. package/dist/assets/uk-BA2kZR38.js +0 -15
  204. package/dist/assets/vendor-codemirror-autocomplete-BjbBRsUA.js +0 -1
  205. package/dist/assets/vendor-codemirror-commands-ARAOgp1x.js +0 -1
  206. package/dist/assets/vendor-codemirror-lang-html-B3Qe3OpS.js +0 -1
  207. package/dist/assets/vendor-codemirror-lang-javascript-Bbw3D7r0.js +0 -13
  208. package/dist/assets/vendor-codemirror-lang-markdown-FGQydhTc.js +0 -1
  209. package/dist/assets/vendor-codemirror-language-DUOssd4j.js +0 -3
  210. package/dist/assets/vendor-codemirror-search-8kyQdB3f.js +0 -2
  211. package/dist/assets/vendor-codemirror-view-DSzLbZiS.js +0 -4
  212. package/dist/assets/vendor-replit-codemirror-vim-B0Ecqnlh.js +0 -39
  213. package/dist/assets/zh-CN-dlOQK6v9.js +0 -15
  214. package/dist/assets/zh-TW-BnqQ-WL5.js +0 -15
  215. package/server/lib/quota/providers/claude.js +0 -107
package/dist/index.html CHANGED
@@ -509,15 +509,15 @@
509
509
  pointer-events: none;
510
510
  }
511
511
  </style>
512
- <script type="module" crossorigin src="/assets/main-C0DyIwTb.js"></script>
512
+ <script type="module" crossorigin src="/assets/main-D7UPARut.js"></script>
513
513
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
514
514
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
515
515
  <link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
516
516
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
517
517
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
518
- <link rel="modulepreload" crossorigin href="/assets/index-iFY_N5aO.js">
519
- <link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-tQekJUAF.js">
520
- <link rel="stylesheet" crossorigin href="/assets/index-CVNuER6G.css">
518
+ <link rel="modulepreload" crossorigin href="/assets/index-DzriVon2.js">
519
+ <link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-BO1wRpaN.js">
520
+ <link rel="stylesheet" crossorigin href="/assets/index-1OhiMDBz.css">
521
521
  </head>
522
522
  <body class="h-full bg-background text-foreground">
523
523
  <div id="root" class="h-full">
@@ -74,14 +74,14 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-CGfrxKpJ.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-BISXSGOo.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.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/index-iFY_N5aO.js">
84
- <link rel="stylesheet" crossorigin href="/assets/index-CVNuER6G.css">
83
+ <link rel="modulepreload" crossorigin href="/assets/index-DzriVon2.js">
84
+ <link rel="stylesheet" crossorigin href="/assets/index-1OhiMDBz.css">
85
85
  </head>
86
86
  <body class="h-full bg-background text-foreground">
87
87
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,14 +63,14 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-DEmhwNcV.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-BnYxVuvw.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.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/index-iFY_N5aO.js">
73
- <link rel="stylesheet" crossorigin href="/assets/index-CVNuER6G.css">
72
+ <link rel="modulepreload" crossorigin href="/assets/index-DzriVon2.js">
73
+ <link rel="stylesheet" crossorigin href="/assets/index-1OhiMDBz.css">
74
74
  </head>
75
75
  <body class="h-full bg-background text-foreground">
76
76
  <div id="root" class="h-full"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchamber/web",
3
- "version": "1.18.3",
3
+ "version": "1.19.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
package/server/index.js CHANGED
@@ -76,6 +76,7 @@ import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
76
76
  import { createSessionAssistRuntime } from './lib/session-assist/runtime.js';
77
77
  import { createSessionGoalRuntime } from './lib/session-goal/runtime.js';
78
78
  import { createContextObligatoryRuntime } from './lib/context-obligatory/runtime.js';
79
+ import { createSessionKnowledgeRuntime } from './lib/session-knowledge/runtime.js';
79
80
  import { createScheduledTasksRuntime } from './lib/scheduled-tasks/runtime.js';
80
81
  import { createServerStartupRuntime } from './lib/opencode/server-startup-runtime.js';
81
82
  import { createTunnelWiringRuntime } from './lib/opencode/tunnel-wiring-runtime.js';
@@ -90,6 +91,12 @@ import { createNotificationTemplateRuntime } from './lib/notifications/template-
90
91
  import { createPermissionAutoAcceptRuntime } from './lib/permission-auto-accept/runtime.js';
91
92
  import { createGracefulShutdownRuntime } from './lib/opencode/shutdown-runtime.js';
92
93
  import { createProjectConfigRuntime } from './lib/projects/project-config.js';
94
+ import { createProjectContextRuntime } from './lib/project-context/runtime.js';
95
+ import { createAgentMemoryRuntime } from './lib/agent-memory/runtime.js';
96
+ import { createAgentMemoryActions } from './lib/agent-memory/actions.js';
97
+ import { createMemoryProjectResolver } from './lib/agent-memory/project-resolution.js';
98
+ import { isAgentMemoryFeatureAvailable } from './lib/agent-memory/feature-flag.js';
99
+ import { resolvePrimaryWorktreeRoot } from './lib/git/service.js';
93
100
  import { createRemoteClientAuthRuntime } from './lib/client-auth/remote-clients.js';
94
101
  import { createClientPairingRuntime } from './lib/client-auth/pairing.js';
95
102
  import { attachRealtimeProxy } from './lib/realtime-proxy.js';
@@ -104,6 +111,7 @@ import { createSystemPromptRuntime } from './lib/system-prompt/runtime.js';
104
111
  import { createOpenChamberSessionService } from './lib/openchamber-sessions/routes.js';
105
112
  import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
106
113
  import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
114
+ import { OpenChamberControlError } from './lib/openchamber-control/error.js';
107
115
  import webPush from 'web-push';
108
116
 
109
117
  const __filename = fileURLToPath(import.meta.url);
@@ -472,6 +480,34 @@ const projectConfigRuntime = createProjectConfigRuntime({
472
480
  projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
473
481
  });
474
482
 
483
+ const projectContextRuntime = createProjectContextRuntime({
484
+ fsPromises,
485
+ path,
486
+ projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
487
+ });
488
+
489
+ const agentMemoryRuntime = createAgentMemoryRuntime({
490
+ fsPromises,
491
+ path,
492
+ projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
493
+ userConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
494
+ });
495
+
496
+ /**
497
+ * One switch for everything memory-related. It gates the tool, these routes,
498
+ * and the session index alike, so turning memory off leaves nothing behind
499
+ * that still reads or writes the store.
500
+ */
501
+ const isAgentMemoryEnabled = async () => {
502
+ // The feature gate comes first: unreleased means absent, not merely switched
503
+ // off, so no stored setting can bring it back.
504
+ if (!isAgentMemoryFeatureAvailable()) {
505
+ return false;
506
+ }
507
+ const settings = await readSettingsFromDiskMigrated().catch(() => null);
508
+ return settings?.agentMemoryToolEnabled === true;
509
+ };
510
+
475
511
  // HMR-persistent state via globalThis
476
512
  // These values survive Vite HMR reloads to prevent zombie OpenCode processes
477
513
  const hmrStateRuntime = createHmrStateRuntime({
@@ -774,9 +810,41 @@ const sessionGoalRuntime = createSessionGoalRuntime({
774
810
  });
775
811
  },
776
812
  });
813
+ /**
814
+ * Owns what a session must be told about the project's knowledge. Every sender
815
+ * asks it — the UI over HTTP, scheduled tasks and agent-dispatched sessions in
816
+ * process — so the answer cannot differ between them.
817
+ */
818
+ const sessionKnowledgeRuntime = createSessionKnowledgeRuntime({
819
+ projectContextRuntime,
820
+ agentMemoryRuntime,
821
+ // Called, not captured: the resolver is declared further down, and taking a
822
+ // reference here would read it before it exists.
823
+ resolveProjectId: (directory) => resolveMemoryProjectId(directory),
824
+ isAgentMemoryEnabled,
825
+ openCodeFetch: async (fetchPath, { directory, method = 'GET', body } = {}) => {
826
+ const params = new URLSearchParams();
827
+ if (directory) params.set('directory', directory);
828
+ const search = params.toString();
829
+ const response = await fetch(`${buildOpenCodeUrl(fetchPath, '')}${search ? `?${search}` : ''}`, {
830
+ method,
831
+ headers: {
832
+ Accept: 'application/json',
833
+ ...(body ? { 'Content-Type': 'application/json' } : {}),
834
+ ...getOpenCodeAuthHeaders(),
835
+ },
836
+ ...(body ? { body: JSON.stringify(body) } : {}),
837
+ signal: AbortSignal.timeout(15_000),
838
+ });
839
+ if (!response.ok) throw new Error(`OpenCode ${method} ${fetchPath} failed with ${response.status}`);
840
+ return response.json().catch(() => null);
841
+ },
842
+ });
843
+
777
844
  const contextObligatoryRuntime = createContextObligatoryRuntime({
778
845
  buildOpenCodeUrl,
779
846
  getOpenCodeAuthHeaders,
847
+ sessionKnowledgeRuntime,
780
848
  });
781
849
 
782
850
  const globalMessageStreamHub = createGlobalMessageStreamHub({
@@ -1100,8 +1168,9 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
1100
1168
  // injected while at least one of them is on.
1101
1169
  const includeControl = settings?.agentControlToolEnabled !== false;
1102
1170
  const includeWeb = settings?.agentWebToolEnabled !== false;
1103
- const managedEnv = includeControl || includeWeb
1104
- ? await (agentToolRuntime?.prepareManagedOpenCodeEnv({ includeControl, includeWeb }) || {})
1171
+ const includeMemory = isAgentMemoryFeatureAvailable() && settings?.agentMemoryToolEnabled === true;
1172
+ const managedEnv = includeControl || includeWeb || includeMemory
1173
+ ? await (agentToolRuntime?.prepareManagedOpenCodeEnv({ includeControl, includeWeb, includeMemory }) || {})
1105
1174
  : {};
1106
1175
  if (settings?.optimizeSystemPrompt !== true) return managedEnv;
1107
1176
 
@@ -1138,6 +1207,7 @@ const scheduledTasksRuntime = createScheduledTasksRuntime({
1138
1207
  buildOpenCodeUrl,
1139
1208
  getOpenCodeAuthHeaders,
1140
1209
  waitForOpenCodeReady,
1210
+ sessionKnowledgeRuntime,
1141
1211
  setSessionAutoAccept: (sessionId, enabled, directory) => permissionAutoAcceptRuntime.setSessionPolicy(sessionId, enabled, directory),
1142
1212
  emitTaskRunEvent: (event) => {
1143
1213
  for (const client of uiOpenChamberEventClients) {
@@ -1179,6 +1249,37 @@ const emitSessionCreatedEvent = (event) => {
1179
1249
  }
1180
1250
  }
1181
1251
  };
1252
+ /**
1253
+ * Maps a session directory onto the project whose memory it belongs to, so a
1254
+ * session running in a worktree writes to the project the panel shows.
1255
+ */
1256
+ const resolveMemoryProjectId = createMemoryProjectResolver({
1257
+ listProjectPaths: async () => {
1258
+ const settings = await readSettingsFromDiskMigrated().catch(() => null);
1259
+ return sanitizeProjects(settings?.projects || []).map((project) => project.path);
1260
+ },
1261
+ resolvePrimaryWorktreeRoot,
1262
+ });
1263
+
1264
+ /**
1265
+ * Tells open panels that the agent changed what it remembers, so what it just
1266
+ * stored is visible without reopening anything.
1267
+ */
1268
+ const emitAgentMemoryChangedEvent = (event) => {
1269
+ for (const client of uiOpenChamberEventClients) {
1270
+ try {
1271
+ writeSseEvent(client, {
1272
+ type: 'openchamber:agent-memory-changed',
1273
+ properties: {
1274
+ scope: event.scope,
1275
+ ...(event.projectId ? { projectId: event.projectId } : {}),
1276
+ },
1277
+ });
1278
+ } catch {
1279
+ uiOpenChamberEventClients.delete(client);
1280
+ }
1281
+ }
1282
+ };
1182
1283
  const scheduledTaskService = createScheduledTaskService({
1183
1284
  readSettingsFromDiskMigrated,
1184
1285
  sanitizeProjects,
@@ -1193,6 +1294,7 @@ const openChamberSessionService = createOpenChamberSessionService({
1193
1294
  getOpenCodeAuthHeaders,
1194
1295
  waitForOpenCodeReady,
1195
1296
  emitSessionCreatedEvent,
1297
+ sessionKnowledgeRuntime,
1196
1298
  });
1197
1299
  // Browser actions are published to whichever OpenChamber clients are connected;
1198
1300
  // the one owning the browser panel answers. `emitRequest` returns the number of
@@ -1234,6 +1336,13 @@ const openChamberControlService = createOpenChamberControlService({
1234
1336
  sessionService: openChamberSessionService,
1235
1337
  scheduledTaskService,
1236
1338
  browserControl: browserControlBroker,
1339
+ agentMemoryActions: createAgentMemoryActions({
1340
+ agentMemoryRuntime,
1341
+ createError: (message, status) => new OpenChamberControlError(message, status),
1342
+ onMemoryChanged: emitAgentMemoryChangedEvent,
1343
+ isAgentMemoryEnabled,
1344
+ resolveProjectId: resolveMemoryProjectId,
1345
+ }),
1237
1346
  });
1238
1347
 
1239
1348
  const ensureGlobalWatcherStarted = async () => {
@@ -1499,7 +1608,7 @@ async function main(options = {}) {
1499
1608
  res.setHeader('Access-Control-Allow-Origin', origin);
1500
1609
  res.setHeader('Access-Control-Allow-Credentials', 'true');
1501
1610
  res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
1502
- res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding');
1611
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding,Ngrok-Skip-Browser-Warning');
1503
1612
  res.setHeader('Access-Control-Expose-Headers', 'x-next-cursor');
1504
1613
  res.setHeader('Vary', 'Origin');
1505
1614
  if (req.method === 'OPTIONS') {
@@ -1744,6 +1853,10 @@ async function main(options = {}) {
1744
1853
  devServerScanner,
1745
1854
  buildAugmentedPath,
1746
1855
  projectConfigRuntime,
1856
+ projectContextRuntime,
1857
+ agentMemoryRuntime,
1858
+ isAgentMemoryEnabled,
1859
+ sessionKnowledgeRuntime,
1747
1860
  scheduledTasksRuntime,
1748
1861
  scheduledTaskService,
1749
1862
  openChamberSessionService,
@@ -0,0 +1,243 @@
1
+ /**
2
+ * Dispatch for the `memory.*` actions the `openchamber_memory` tool calls.
3
+ *
4
+ * Kept beside the store rather than inside the control service, because the
5
+ * control service already owns sessions, schedules and the browser; memory
6
+ * shares none of that machinery and only needs the same envelope.
7
+ *
8
+ * Project scope is derived from the session's directory, never from the model.
9
+ * Letting the agent name a project id would let a memory learned in one
10
+ * checkout be filed against another, which the user would have no way to
11
+ * notice.
12
+ *
13
+ * The directory is resolved to the project first. A session running in a
14
+ * worktree has the worktree's own path, and keying memory by that path filed it
15
+ * under a project the panel never looks at — the memory was written, stored,
16
+ * and invisible. Every worktree of a repository shares one project memory,
17
+ * which is also what the user means by "this project".
18
+ */
19
+
20
+ const MEMORY_TYPES = new Set(['fact', 'preference', 'reference']);
21
+
22
+ const asNonEmptyString = (value) => {
23
+ if (typeof value !== 'string') return null;
24
+ const trimmed = value.trim();
25
+ return trimmed.length > 0 ? trimmed : null;
26
+ };
27
+
28
+ /** Everything the agent is told about an entry it has not opened yet. */
29
+ const toSummary = (entry, scope) => ({
30
+ memoryId: entry.id,
31
+ title: entry.title,
32
+ type: entry.type,
33
+ scope,
34
+ });
35
+
36
+ const toFullEntry = (entry, scope) => ({ ...toSummary(entry, scope), body: entry.body });
37
+
38
+ export const createAgentMemoryActions = (dependencies) => {
39
+ const {
40
+ agentMemoryRuntime,
41
+ createError,
42
+ onMemoryChanged,
43
+ resolveProjectId: resolveProjectIdForDirectory,
44
+ isAgentMemoryEnabled,
45
+ } = dependencies;
46
+
47
+ /**
48
+ * Announce a write so an open panel shows it without being reopened. The
49
+ * agent writes here on its own initiative, so without this the user only
50
+ * learns what was stored the next time something else happens to reload.
51
+ *
52
+ * Never allowed to fail the action: the memory is already on disk, and a
53
+ * broken notification must not report the write as failed.
54
+ */
55
+ const announce = (scope, projectId) => {
56
+ if (typeof onMemoryChanged !== 'function') return;
57
+ try {
58
+ onMemoryChanged({ scope, ...(projectId ? { projectId } : {}) });
59
+ } catch {
60
+ // A listener that throws must not take the write down with it.
61
+ }
62
+ };
63
+
64
+ const fail = (message, status = 400) => {
65
+ throw createError(message, status);
66
+ };
67
+
68
+ const resolveProjectId = async (contextDirectory) => {
69
+ const directory = asNonEmptyString(contextDirectory);
70
+ const projectId = directory ? await resolveProjectIdForDirectory(directory) : '';
71
+ if (!projectId) {
72
+ fail('Project memory needs a session directory, and this session has none', 400);
73
+ }
74
+ return projectId;
75
+ };
76
+
77
+ const resolveTarget = async (input, contextDirectory) => {
78
+ const scope = asNonEmptyString(input.scope);
79
+ if (scope === 'global') return { scope: 'global' };
80
+ if (scope === 'project') {
81
+ return { scope: 'project', projectId: await resolveProjectId(contextDirectory) };
82
+ }
83
+ return fail('scope must be global or project', 400);
84
+ };
85
+
86
+ const listBothScopes = async (contextDirectory) => {
87
+ const directory = asNonEmptyString(contextDirectory);
88
+ const projectId = directory ? await resolveProjectIdForDirectory(directory) : null;
89
+ const result = await agentMemoryRuntime.readAll(projectId);
90
+
91
+ // A scope that failed to load is reported, never rendered as empty: an
92
+ // agent told it has no memories will happily store them all again.
93
+ return {
94
+ memories: [
95
+ ...result.global.map((entry) => toSummary(entry, 'global')),
96
+ ...result.project.map((entry) => toSummary(entry, 'project')),
97
+ ],
98
+ ...(result.globalFailed ? { globalUnavailable: true } : {}),
99
+ ...(result.projectFailed ? { projectUnavailable: true } : {}),
100
+ };
101
+ };
102
+
103
+ const list = async (input, contextDirectory) => {
104
+ const scope = asNonEmptyString(input.scope);
105
+ if (!scope || scope === 'both') {
106
+ return listBothScopes(contextDirectory);
107
+ }
108
+ const target = await resolveTarget(input, contextDirectory);
109
+ const { entries } = await agentMemoryRuntime.read(target);
110
+ return { memories: entries.map((entry) => toSummary(entry, target.scope)) };
111
+ };
112
+
113
+ /**
114
+ * Reading by title as well as by id is deliberate: the session index lists
115
+ * titles only, so requiring an id would force a list call before every read
116
+ * just to translate what the agent can already see.
117
+ *
118
+ * Scope is optional here. It decides everything for a write — a fact filed
119
+ * globally reaches every project — but for a read it is only which drawer to
120
+ * open, and demanding it turned a legible request into an error the model had
121
+ * to recover from. Omitted, both stores are searched.
122
+ */
123
+ const read = async (input, contextDirectory) => {
124
+ const memoryId = asNonEmptyString(input.memoryId);
125
+ const title = asNonEmptyString(input.title);
126
+ if (!memoryId && !title) {
127
+ fail('memory.read requires memoryId or title', 400);
128
+ }
129
+
130
+ const matches = (entry) => (memoryId
131
+ ? entry.id === memoryId
132
+ : entry.title.toLowerCase() === title.toLowerCase());
133
+
134
+ const requestedScope = asNonEmptyString(input.scope);
135
+ if (requestedScope === 'global' || requestedScope === 'project') {
136
+ const target = await resolveTarget(input, contextDirectory);
137
+ const { entries } = await agentMemoryRuntime.read(target);
138
+ const found = entries.find(matches);
139
+ if (!found) {
140
+ fail('No memory matches that id or title in this scope', 404);
141
+ }
142
+ return { memory: toFullEntry(found, target.scope) };
143
+ }
144
+
145
+ const directory = asNonEmptyString(contextDirectory);
146
+ const projectId = directory ? await resolveProjectIdForDirectory(directory) : null;
147
+ const result = await agentMemoryRuntime.readAll(projectId);
148
+
149
+ const projectMatch = result.project.find(matches);
150
+ if (projectMatch) {
151
+ // Project first: when both stores hold the same title, the one about this
152
+ // codebase is the one being asked about.
153
+ return { memory: toFullEntry(projectMatch, 'project') };
154
+ }
155
+ const globalMatch = result.global.find(matches);
156
+ if (globalMatch) {
157
+ return { memory: toFullEntry(globalMatch, 'global') };
158
+ }
159
+ if (result.globalFailed || result.projectFailed) {
160
+ // Never reported as "no such memory": a store that failed to load may well
161
+ // hold it, and the agent would go on to store it a second time.
162
+ fail('Stored memory could not be read; try again before assuming it is absent', 503);
163
+ }
164
+ fail('No memory matches that id or title', 404);
165
+ };
166
+
167
+ const save = async (input, contextDirectory) => {
168
+ const target = await resolveTarget(input, contextDirectory);
169
+ const title = asNonEmptyString(input.title);
170
+ const body = asNonEmptyString(input.body);
171
+ if (!title) fail('title is required for memory.save', 400);
172
+ if (!body) fail('body is required for memory.save', 400);
173
+ if (input.type !== undefined && !MEMORY_TYPES.has(input.type)) {
174
+ fail('type must be fact, preference, or reference', 400);
175
+ }
176
+
177
+ const result = await agentMemoryRuntime.create(target, {
178
+ title,
179
+ body,
180
+ type: input.type,
181
+ sessionId: asNonEmptyString(input.sessionId),
182
+ });
183
+ announce(target.scope, target.projectId);
184
+ // Deliberately does not echo the text back. Handing the model what it just
185
+ // wrote invites it to find something to improve and re-save, and the store
186
+ // is not the place to discover that a save worked — the confirmation is.
187
+ return {
188
+ saved: true,
189
+ memory: toSummary(result.entry, target.scope),
190
+ // Told plainly so the agent does not report storing a second memory when
191
+ // it actually corrected one it had already written.
192
+ replaced: result.replaced,
193
+ ...(result.entry.flagged
194
+ ? { warning: 'Stored, but held back from future sessions: this text reads as an instruction to the model rather than a fact. The user can see it in the Memory panel.' }
195
+ : {}),
196
+ };
197
+ };
198
+
199
+ const remove = async (input, contextDirectory) => {
200
+ const target = await resolveTarget(input, contextDirectory);
201
+ const memoryId = asNonEmptyString(input.memoryId);
202
+ if (!memoryId) fail('memoryId is required for memory.delete', 400);
203
+
204
+ const result = await agentMemoryRuntime.remove(target, memoryId);
205
+ if (!result.deleted) {
206
+ fail('No memory has that id in this scope', 404);
207
+ }
208
+ announce(target.scope, target.projectId);
209
+ return { deleted: true, memoryId };
210
+ };
211
+
212
+ const execute = async (action, input = {}, contextDirectory) => {
213
+ /**
214
+ * The tool lives in the managed OpenCode child and only disappears when
215
+ * that child restarts, so between switching memory off and restarting it
216
+ * the agent can still call this. Ungated, those writes would land on disk
217
+ * while the panel that shows them is hidden and the index that carries
218
+ * them is suppressed — memory accumulating where nobody can see it.
219
+ */
220
+ if (typeof isAgentMemoryEnabled === 'function') {
221
+ let enabled = false;
222
+ try {
223
+ enabled = await isAgentMemoryEnabled();
224
+ } catch {
225
+ // An unreadable setting closes the surface rather than opening it.
226
+ enabled = false;
227
+ }
228
+ if (!enabled) {
229
+ return fail('Agent memory is switched off in OpenChamber settings', 403);
230
+ }
231
+ }
232
+
233
+ switch (action) {
234
+ case 'memory.list': return list(input, contextDirectory);
235
+ case 'memory.read': return read(input, contextDirectory);
236
+ case 'memory.save': return save(input, contextDirectory);
237
+ case 'memory.delete': return remove(input, contextDirectory);
238
+ default: return fail(`Unsupported memory action: ${action || 'missing'}`, 400);
239
+ }
240
+ };
241
+
242
+ return { execute };
243
+ };