@openchamber/web 1.24.1 → 1.24.2

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 (169) hide show
  1. package/bin/cli.test.js +22 -0
  2. package/bin/lib/commands-status.js +5 -0
  3. package/dist/assets/{CodeMirrorCommentWidgets-DvUH815P.js → CodeMirrorCommentWidgets-B_vBPQYm.js} +1 -1
  4. package/dist/assets/DiffView-Ce0oBXXQ.js +4 -0
  5. package/dist/assets/{FilesView-D0bM9FVB.js → FilesView-DtXueAWP.js} +5 -5
  6. package/dist/assets/{GitView-Bxuv3dfP.js → GitView-k0hUF8KB.js} +4 -4
  7. package/dist/assets/{GuestAttachDialog-B0u3Q5uO.js → GuestAttachDialog-DIf2U85Z.js} +1 -1
  8. package/dist/assets/{JsonTreeView-BBVPFM5K.js → JsonTreeView-4AnJ04Pw.js} +1 -1
  9. package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  10. package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  11. package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  12. package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  13. package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  14. package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  15. package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  16. package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  17. package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  18. package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  19. package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  20. package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  21. package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  22. package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  23. package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  24. package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  25. package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  26. package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  27. package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  28. package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  29. package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  30. package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  31. package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  32. package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  33. package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  34. package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  35. package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  36. package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  37. package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  38. package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  39. package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  40. package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  41. package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  42. package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  43. package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  44. package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  45. package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  46. package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  47. package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  48. package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  49. package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  50. package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  51. package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  52. package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  53. package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  54. package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  55. package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  56. package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  57. package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  58. package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  59. package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  60. package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  61. package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  62. package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  63. package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  64. package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  65. package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  66. package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  67. package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  68. package/dist/assets/{LinearIssuesView-UI1FcSC8.js → LinearIssuesView-z_9p2GuO.js} +1 -1
  69. package/dist/assets/{MarkdownImageGallery-CUJxH8Le.js → MarkdownImageGallery-BC-BNN-s.js} +1 -1
  70. package/dist/assets/{MarkdownRendererImpl-D5BZOg8X.js → MarkdownRendererImpl-DyaBTUbH.js} +6 -6
  71. package/dist/assets/{OnboardingScreen-5Gou9cGD.js → OnboardingScreen-DKU_yTb6.js} +1 -1
  72. package/dist/assets/{PatchDiff-C4rE5k6z.js → PatchDiff-DpGmHRnV.js} +1 -1
  73. package/dist/assets/PierreDiffViewer-CgLl_tp7.js +210 -0
  74. package/dist/assets/{PlanView-u2yi5XGJ.js → PlanView-CrfB4qqY.js} +4 -4
  75. package/dist/assets/{PluginPane-QxjsKYeO.js → PluginPane-B5cn-jPy.js} +1 -1
  76. package/dist/assets/{SettingsView-Fo5ZqMaT.js → SettingsView-DMKKwezx.js} +12 -12
  77. package/dist/assets/{SettingsWindow-HVDVANjJ.js → SettingsWindow-DwbnVzOC.js} +1 -1
  78. package/dist/assets/{SubmoduleDiffSummary-D3hzkybB.js → SubmoduleDiffSummary-hkGcvs0E.js} +1 -1
  79. package/dist/assets/{ToolOutputDialog-3J6IRayW.js → ToolOutputDialog-DuoIOc0j.js} +6 -6
  80. package/dist/assets/{ToolPartDiffPreview-DarxPjSd.js → ToolPartDiffPreview-t1Bvq_2Y.js} +2 -2
  81. package/dist/assets/{VirtualizedFileDiff-CZgXWHjU.js → VirtualizedFileDiff-BK4aU5qJ.js} +4 -4
  82. package/dist/assets/{WalkthroughView-wSpED5L4.js → WalkthroughView-Bk6TPNFw.js} +2 -2
  83. package/dist/assets/{appThemeRegistry-Cf8KitzT.js → appThemeRegistry-DnOVbJjF.js} +1 -1
  84. package/dist/assets/{commitAndPush-DZnzlhvc.js → commitAndPush-DLWNZkkY.js} +1 -1
  85. package/dist/assets/{computeVirtualFileMetrics-VYnT_A2h.js → computeVirtualFileMetrics-BVTujWSX.js} +1 -1
  86. package/dist/assets/{de-BM_8EDD3.js → de-zEHaAIi3.js} +4 -4
  87. package/dist/assets/{es-CxZjlqpo.js → es-CBDgEzgk.js} +3 -3
  88. package/dist/assets/{fr-VCixCnMW.js → fr-DjiTptT_.js} +4 -4
  89. package/dist/assets/{index-B9Hvzjwl.css → index-AgOdanig.css} +1 -1
  90. package/dist/assets/index-B-2_X4DD.js +40 -0
  91. package/dist/assets/{index-3U4CtS9b.js → index-CkA4p2IK.js} +1 -1
  92. package/dist/assets/{isDiffPlainText-ImDG3Uhg.js → isDiffPlainText-D3yX_vx4.js} +1 -1
  93. package/dist/assets/{isFilePlainText-D_YDVYDb.js → isFilePlainText-CZR9TcHV.js} +1 -1
  94. package/dist/assets/{ja-CZ5k_GyD.js → ja-CerMgj3r.js} +4 -4
  95. package/dist/assets/{ko-7YM3A1Xh.js → ko-DHYDAze5.js} +4 -4
  96. package/dist/assets/main-BDka4W43.js +896 -0
  97. package/dist/assets/main-Dl7Dyge_.js +2 -0
  98. package/dist/assets/{markdownCore-DHvqMxPn.js → markdownCore-DFmr0rUR.js} +4 -4
  99. package/dist/assets/miniChat-CLKQPPpO.js +2 -0
  100. package/dist/assets/mobile--giD2Q1L.js +2 -0
  101. package/dist/assets/{patchFileDiff-DDQ6Rq5e.js → patchFileDiff-DRh-AQvd.js} +3 -3
  102. package/dist/assets/{pl-BcgDO_w5.js → pl-BTB_93bq.js} +4 -4
  103. package/dist/assets/{pt-BR-CU2u_1q5.js → pt-BR-BwA3oyCK.js} +3 -3
  104. package/dist/assets/renderElectronMiniChatApp-DmB7zpVK.js +2 -0
  105. package/dist/assets/{renderMobileApp-D0Y8DtkA.js → renderMobileApp-pMfOuQfl.js} +7 -7
  106. package/dist/assets/runtimeEndpointReset-Gqhmkm3U.js +25 -0
  107. package/dist/assets/{scheduledTasksApi-D8pq6gQz.js → scheduledTasksApi-CeRAIUmW.js} +1 -1
  108. package/dist/assets/{shikiHighlight-1imXsir9.js → shikiHighlight-BfjuB3CD.js} +1 -1
  109. package/dist/assets/{textMateThemeFromAppTheme-Dgqc63LZ.js → textMateThemeFromAppTheme-BP60t9SX.js} +1 -1
  110. package/dist/assets/{tr-DuYhOzNe.js → tr-CcPsJoNM.js} +3 -3
  111. package/dist/assets/{uk-Cuk7-uvq.js → uk-B68WibXi.js} +3 -3
  112. package/dist/assets/{useAppFontEffects-BItUWdo4.js → useAppFontEffects-DcdrFv2Z.js} +144 -144
  113. package/dist/assets/{useInlineCommentController-CkbKsm7m.js → useInlineCommentController-Cq4SUjsA.js} +2 -2
  114. package/dist/assets/{useRootScrollLock-vmzxZjWA.js → useRootScrollLock-CSdR6Wnm.js} +2 -2
  115. package/dist/assets/{vendor-codemirror-language-data-BDyxuqK4.js → vendor-codemirror-language-data-BFm1Ju2w.js} +2 -2
  116. package/dist/assets/vendor-katex-Cp579UoJ.css +1 -0
  117. package/dist/assets/{vendor-zod-fZppILAM.js → vendor-zod-CgAdXWZO.js} +4 -4
  118. package/dist/assets/{web-components-D7FinaeH.js → web-components-2vo9YsZc.js} +1 -1
  119. package/dist/assets/{zh-CN-CUWoiRHd.js → zh-CN-DbFHYXwP.js} +3 -3
  120. package/dist/assets/{zh-TW-CQ8EBSBN.js → zh-TW-DmXAwdty.js} +3 -3
  121. package/dist/index.html +6 -4
  122. package/dist/mini-chat.html +6 -4
  123. package/dist/mobile.html +6 -4
  124. package/package.json +4 -4
  125. package/server/index.js +3 -0
  126. package/server/lib/agent-tool/DOCUMENTATION.md +17 -4
  127. package/server/lib/agent-tool/runtime.js +62 -15
  128. package/server/lib/agent-tool/runtime.test.js +88 -2
  129. package/server/lib/fs/DOCUMENTATION.md +2 -1
  130. package/server/lib/fs/routes.js +56 -4
  131. package/server/lib/fs/routes.test.js +116 -0
  132. package/server/lib/git/DOCUMENTATION.md +2 -2
  133. package/server/lib/git/service.js +94 -9
  134. package/server/lib/git/service.test.js +18 -0
  135. package/server/lib/message-queue/DOCUMENTATION.md +4 -1
  136. package/server/lib/message-queue/runtime.js +16 -1
  137. package/server/lib/message-queue/runtime.test.js +21 -5
  138. package/server/lib/notifications/routes.js +5 -0
  139. package/server/lib/openchamber-sessions/routes.js +18 -18
  140. package/server/lib/openchamber-sessions/routes.test.js +49 -0
  141. package/server/lib/opencode/DOCUMENTATION.md +1 -1
  142. package/server/lib/opencode/bootstrap-runtime.js +1 -0
  143. package/server/lib/opencode/session-runtime.js +68 -0
  144. package/server/lib/opencode/session-runtime.test.js +43 -0
  145. package/server/lib/projects/project-config.js +2 -2
  146. package/server/lib/realtime-proxy-terminal.test.js +150 -0
  147. package/server/lib/realtime-proxy.js +2 -0
  148. package/server/lib/routing/DOCUMENTATION.md +5 -3
  149. package/server/lib/scheduled-tasks/runtime.js +2 -2
  150. package/server/lib/scheduled-tasks/runtime.test.js +14 -0
  151. package/server/lib/small-model/DOCUMENTATION.md +14 -2
  152. package/server/lib/small-model/call.js +37 -6
  153. package/server/lib/small-model/call.test.js +182 -0
  154. package/server/lib/terminal/DOCUMENTATION.md +21 -2
  155. package/server/lib/terminal/runtime.js +10 -3
  156. package/server/lib/terminal/runtime.test.js +22 -0
  157. package/server/lib/terminal/shutdown.js +106 -0
  158. package/server/lib/terminal/shutdown.test.js +84 -0
  159. package/server/lib/tts/service.test.js +78 -0
  160. package/dist/assets/DiffView-DkC3xlRJ.js +0 -4
  161. package/dist/assets/PierreDiffViewer-ByRVu6ss.js +0 -161
  162. package/dist/assets/index-DLHQogv8.js +0 -40
  163. package/dist/assets/main-CycplCph.js +0 -2
  164. package/dist/assets/main-DFYTCx5o.js +0 -896
  165. package/dist/assets/miniChat-DIQKfY2V.js +0 -2
  166. package/dist/assets/mobile-BMwz5q-m.js +0 -2
  167. package/dist/assets/renderElectronMiniChatApp-3_d6g6CU.js +0 -2
  168. package/dist/assets/runtimeEndpointReset-DhC3REb2.js +0 -25
  169. /package/dist/assets/{vendor-katex-k3Ppq1Ha.js → vendor-katex-CHD9BdDO.js} +0 -0
package/dist/index.html CHANGED
@@ -509,16 +509,18 @@
509
509
  pointer-events: none;
510
510
  }
511
511
  </style>
512
- <script type="module" crossorigin src="/assets/main-CycplCph.js"></script>
512
+ <script type="module" crossorigin src="/assets/main-Dl7Dyge_.js"></script>
513
513
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
514
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.js">
514
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-CgAdXWZO.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
518
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
519
- <link rel="modulepreload" crossorigin href="/assets/index-DLHQogv8.js">
519
+ <link rel="modulepreload" crossorigin href="/assets/index-B-2_X4DD.js">
520
520
  <link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
521
- <link rel="stylesheet" crossorigin href="/assets/index-B9Hvzjwl.css">
521
+ <link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
522
+ <link rel="stylesheet" crossorigin href="/assets/index-AgOdanig.css">
523
+ <link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
522
524
  </head>
523
525
  <body class="h-full bg-background text-foreground">
524
526
  <div id="root" class="h-full">
@@ -74,15 +74,17 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-DIQKfY2V.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-CLKQPPpO.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
79
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-CgAdXWZO.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
83
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
84
- <link rel="modulepreload" crossorigin href="/assets/index-DLHQogv8.js">
85
- <link rel="stylesheet" crossorigin href="/assets/index-B9Hvzjwl.css">
84
+ <link rel="modulepreload" crossorigin href="/assets/index-B-2_X4DD.js">
85
+ <link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
86
+ <link rel="stylesheet" crossorigin href="/assets/index-AgOdanig.css">
87
+ <link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
86
88
  </head>
87
89
  <body class="h-full bg-background text-foreground">
88
90
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,15 +63,17 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-BMwz5q-m.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile--giD2Q1L.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
68
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-CgAdXWZO.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
72
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
73
- <link rel="modulepreload" crossorigin href="/assets/index-DLHQogv8.js">
74
- <link rel="stylesheet" crossorigin href="/assets/index-B9Hvzjwl.css">
73
+ <link rel="modulepreload" crossorigin href="/assets/index-B-2_X4DD.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
75
+ <link rel="stylesheet" crossorigin href="/assets/index-AgOdanig.css">
76
+ <link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
75
77
  </head>
76
78
  <body class="h-full bg-background text-foreground">
77
79
  <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.24.1",
3
+ "version": "1.24.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -26,19 +26,19 @@
26
26
  "dependencies": {
27
27
  "@clack/prompts": "^1.1.0",
28
28
  "@octokit/rest": "^22.0.1",
29
- "@openchamber/sdk": "1.24.1",
29
+ "@openchamber/sdk": "1.24.2",
30
30
  "@opencode-ai/sdk": "1.18.31",
31
31
  "@simplewebauthn/server": "13.3.1",
32
32
  "bun-pty": "^0.4.5",
33
33
  "compression": "^1.8.1",
34
- "cron-parser": "^4.9.0",
34
+ "cron-parser": "^5.10.1",
35
35
  "express": "^5.1.0",
36
36
  "http-proxy-middleware": "^3.0.5",
37
37
  "jose": "^6.1.3",
38
38
  "jsonc-parser": "^3.3.1",
39
39
  "luxon": "^3.5.0",
40
40
  "node-pty": "1.2.0-beta.12",
41
- "openai": "^4.79.0",
41
+ "openai": "^7.18.0",
42
42
  "qrcode-terminal": "^0.12.0",
43
43
  "reflect-metadata": "^0.2.2",
44
44
  "sherpa-onnx-node": "1.12.28",
package/server/index.js CHANGED
@@ -1399,6 +1399,7 @@ const openChamberSessionService = createOpenChamberSessionService({
1399
1399
  waitForOpenCodeReady,
1400
1400
  emitSessionCreatedEvent,
1401
1401
  sessionKnowledgeRuntime,
1402
+ resolvePromptBody: (body, target) => routingRuntime.resolvePromptBody(body, target),
1402
1403
  });
1403
1404
  // Browser actions are published to whichever OpenChamber clients are connected;
1404
1405
  // the one owning the browser panel answers. `emitRequest` returns the number of
@@ -1547,6 +1548,8 @@ async function main(options = {}) {
1547
1548
  const address = server?.address?.();
1548
1549
  return typeof address === 'object' && address ? address.port : null;
1549
1550
  },
1551
+ // A pipe listener reports a string here, which has no address to bind back to.
1552
+ getActiveHost: () => server?.address?.()?.address ?? null,
1550
1553
  });
1551
1554
  systemPromptRuntime = createSystemPromptRuntime({
1552
1555
  fsPromises,
@@ -30,8 +30,10 @@ both settings are `false`.
30
30
  2. `prepareManagedOpenCodeEnv()` materializes the plugin under
31
31
  `<openchamber-data-dir>/agent-tool/` and appends its `file://` URL to
32
32
  `OPENCODE_CONFIG_CONTENT` without replacing existing plugin entries.
33
- 3. A random per-child token and loopback callback URL are added only to the
34
- managed OpenCode child environment.
33
+ 3. A random per-child token and callback URL are added only to the managed
34
+ OpenCode child environment. The URL points at loopback, except when the
35
+ listener is bound to one concrete address (`--host <ip>`): that socket does
36
+ not answer on loopback, so the URL uses the bound address instead.
35
37
  4. The plugin calls `POST /api/openchamber/agent-tool` with its typed input and
36
38
  OpenCode's authoritative session directory.
37
39
  5. The route delegates the fixed action allowlist directly to the shared
@@ -48,6 +50,9 @@ both settings are `false`.
48
50
  - The tool exposes one shared parameter object rather than repeating parameters
49
51
  in a large per-action union. Action descriptions carry only required inputs,
50
52
  defaults, or one non-obvious semantic detail.
53
+ - The action schema carries `oneOf` and no `enum`. A node combining `enum` and
54
+ `oneOf` is valid JSON Schema, but some OpenAI-compatible gateways reject it
55
+ and answer with an empty completion instead of an error.
51
56
  - Obvious fields rely on their names and JSON types. Parameter descriptions are
52
57
  reserved for formats, dependencies, scope, and behavior that cannot be safely
53
58
  inferred from the field name.
@@ -69,10 +74,18 @@ both settings are `false`.
69
74
 
70
75
  ## Security invariants
71
76
 
72
- - The callback accepts loopback requests only and requires the current
73
- per-child bearer token using a timing-safe comparison.
77
+ - The callback accepts same-machine requests only and requires the current
78
+ per-child bearer token using a timing-safe comparison. Same-machine means a
79
+ loopback source, or, for a listener bound to one concrete address, a source
80
+ equal to that address: the OS sources a local connection to `<ip>` from
81
+ `<ip>`. A wildcard bind keeps the loopback-only rule, and another machine on
82
+ the network always arrives with its own address.
74
83
  - The token is never persisted, logged, returned to the UI, or written into
75
84
  the materialized plugin.
85
+ - The plugin adds the callback host to `NO_PROXY`/`no_proxy` inside the managed
86
+ child when it loads. Without that, an `HTTP_PROXY` in the child's environment
87
+ would receive a non-loopback callback, token included, because `fetch` has no
88
+ per-request way to skip the environment proxy.
76
89
  - Inputs map to a fixed action and parameter allowlist. There is no arbitrary
77
90
  CLI, shell, route, or URL forwarding.
78
91
  - Session/worktree deletion and project-path registration are not exposed.
@@ -129,11 +129,24 @@ const createResult = ({ ok, action, data, error, exitCode }) => ({
129
129
  ...(Number.isInteger(exitCode) ? { exitCode } : {}),
130
130
  });
131
131
 
132
+ // Node reports an IPv4 peer on a dual-stack socket as `::ffff:<ipv4>`.
133
+ const normalizeAddress = (value) => {
134
+ const address = (asNonEmptyString(value) || '').toLowerCase();
135
+ return address.startsWith('::ffff:') ? address.slice('::ffff:'.length) : address;
136
+ };
137
+
132
138
  const isLoopbackAddress = (value) => {
133
- const address = typeof value === 'string' ? value.toLowerCase() : '';
134
- return address === '127.0.0.1'
135
- || address === '::1'
136
- || address === '::ffff:127.0.0.1';
139
+ const address = normalizeAddress(value);
140
+ return address === '127.0.0.1' || address === '::1';
141
+ };
142
+
143
+ const WILDCARD_ADDRESSES = new Set(['0.0.0.0', '::']);
144
+
145
+ // A wildcard listener answers on loopback. A listener bound to one concrete
146
+ // address answers only there, so that address is the only way back in.
147
+ const resolveConcreteBoundAddress = (value) => {
148
+ const address = normalizeAddress(value);
149
+ return address && !WILDCARD_ADDRESSES.has(address) ? address : null;
137
150
  };
138
151
 
139
152
  /**
@@ -143,11 +156,16 @@ const isLoopbackAddress = (value) => {
143
156
  * set, the inputs and the description differ. Generating them from one template
144
157
  * keeps the transport, metadata and failure handling identical, which is what
145
158
  * the caller depends on.
159
+ *
160
+ * The action schema carries `oneOf` only. A node combining `enum` and `oneOf`
161
+ * is valid JSON Schema, but some OpenAI-compatible gateways reject it and
162
+ * answer with an empty completion instead of an error, and the `oneOf` branches
163
+ * are what carry the per-action descriptions the model reads.
146
164
  */
147
- const createToolEntry = ({ name, description, actions, definitions, parameters }) => String.raw` ${name}: {
165
+ const createToolEntry = ({ name, description, definitions, parameters }) => String.raw` ${name}: {
148
166
  description: ${JSON.stringify(description)},
149
167
  args: {
150
- action: { type: "string", enum: ${JSON.stringify(actions)}, oneOf: ${JSON.stringify(definitions.map((entry) => ({ const: entry.action, description: entry.description })))}, description: "OpenChamber action to perform" },
168
+ action: { type: "string", oneOf: ${JSON.stringify(definitions.map((entry) => ({ const: entry.action, description: entry.description })))}, description: "OpenChamber action to perform" },
151
169
  parameters: { type: "object", properties: ${JSON.stringify(parameters)}, additionalProperties: false, description: "Inputs for the action; use an empty object when none are needed" },
152
170
  },
153
171
  async execute(input, context) {
@@ -221,7 +239,6 @@ const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
221
239
  entries.push(createToolEntry({
222
240
  name: 'openchamber',
223
241
  description: CONTROL_TOOL_DESCRIPTION,
224
- actions: OPENCHAMBER_AGENT_TOOL_ACTIONS,
225
242
  definitions: OPENCHAMBER_AGENT_TOOL_ACTION_DEFINITIONS,
226
243
  parameters: CONTROL_PARAMETER_PROPERTIES,
227
244
  }));
@@ -230,7 +247,6 @@ const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
230
247
  entries.push(createToolEntry({
231
248
  name: 'openchamber_web',
232
249
  description: WEB_TOOL_DESCRIPTION,
233
- actions: OPENCHAMBER_WEB_ACTIONS,
234
250
  definitions: OPENCHAMBER_WEB_ACTION_DEFINITIONS,
235
251
  parameters: WEB_PARAMETER_PROPERTIES,
236
252
  }));
@@ -239,16 +255,33 @@ const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
239
255
  entries.push(createToolEntry({
240
256
  name: 'openchamber_memory',
241
257
  description: MEMORY_TOOL_DESCRIPTION,
242
- actions: OPENCHAMBER_MEMORY_ACTIONS,
243
258
  definitions: OPENCHAMBER_MEMORY_ACTION_DEFINITIONS,
244
259
  parameters: MEMORY_PARAMETER_PROPERTIES,
245
260
  }));
246
261
  }
247
262
 
248
- return `export const OpenChamberPlugin = async () => ({
249
- tool: {
250
- ${entries.join('')} },
251
- })
263
+ // The callback carries the per-child token over plain HTTP. With a proxy in
264
+ // the child's environment, fetch would hand a non-loopback callback, token
265
+ // included, to that proxy, and no per-request option turns that off. The
266
+ // exemption is added inside the child because only there is the final
267
+ // NO_PROXY, merged from the shell and server environments, visible.
268
+ return `const exemptCallbackFromProxy = () => {
269
+ const endpoint = process.env.OPENCHAMBER_AGENT_TOOL_URL
270
+ if (!endpoint || !URL.canParse(endpoint)) return
271
+ const host = new URL(endpoint).hostname.replace(/^\\[|\\]$/g, "")
272
+ for (const key of ["NO_PROXY", "no_proxy"]) {
273
+ const entries = (process.env[key] || "").split(",").map((entry) => entry.trim()).filter(Boolean)
274
+ if (!entries.includes(host)) process.env[key] = [...entries, host].join(",")
275
+ }
276
+ }
277
+
278
+ export const OpenChamberPlugin = async () => {
279
+ exemptCallbackFromProxy()
280
+ return {
281
+ tool: {
282
+ ${entries.join('')} },
283
+ }
284
+ }
252
285
  `;
253
286
  };
254
287
 
@@ -259,6 +292,7 @@ export const createAgentToolRuntime = (dependencies) => {
259
292
  path,
260
293
  dataDir,
261
294
  getActivePort,
295
+ getActiveHost = () => null,
262
296
  executeAction,
263
297
  env = process.env,
264
298
  } = dependencies;
@@ -266,6 +300,8 @@ export const createAgentToolRuntime = (dependencies) => {
266
300
  const pluginPath = path.join(pluginDirectory, 'openchamber-plugin.js');
267
301
  let activeToken = null;
268
302
 
303
+ const getConcreteBoundAddress = () => resolveConcreteBoundAddress(getActiveHost());
304
+
269
305
  const prepareManagedOpenCodeEnv = async ({ includeControl = true, includeWeb = true, includeMemory = true } = {}) => {
270
306
  const port = getActivePort();
271
307
  if (!Number.isInteger(port) || port <= 0) {
@@ -278,15 +314,26 @@ export const createAgentToolRuntime = (dependencies) => {
278
314
  await fsPromises.writeFile(pluginPath, createPluginSource({ includeControl, includeWeb, includeMemory }), { mode: 0o600 });
279
315
  activeToken = crypto.randomBytes(32).toString('base64url');
280
316
  const pluginUrl = pathToFileURL(pluginPath).href;
317
+ const callbackAddress = getConcreteBoundAddress() || '127.0.0.1';
318
+ const callbackHost = callbackAddress.includes(':') ? `[${callbackAddress}]` : callbackAddress;
281
319
  return {
282
320
  OPENCODE_CONFIG_CONTENT: appendManagedPlugin(env.OPENCODE_CONFIG_CONTENT, pluginUrl, 'managed tool'),
283
- OPENCHAMBER_AGENT_TOOL_URL: `http://127.0.0.1:${port}/api/openchamber/agent-tool`,
321
+ OPENCHAMBER_AGENT_TOOL_URL: `http://${callbackHost}:${port}/api/openchamber/agent-tool`,
284
322
  OPENCHAMBER_AGENT_TOOL_TOKEN: activeToken,
285
323
  };
286
324
  };
287
325
 
326
+ // The managed child runs on this machine. Reaching a listener bound to one
327
+ // concrete address makes the OS source the connection from that same address,
328
+ // so it stands in for loopback there; any other machine arrives as itself.
329
+ const isSameMachineAddress = (value) => {
330
+ if (isLoopbackAddress(value)) return true;
331
+ const boundAddress = getConcreteBoundAddress();
332
+ return boundAddress !== null && normalizeAddress(value) === boundAddress;
333
+ };
334
+
288
335
  const authorize = (req) => {
289
- if (!activeToken || !isLoopbackAddress(req.socket?.remoteAddress)) return false;
336
+ if (!activeToken || !isSameMachineAddress(req.socket?.remoteAddress)) return false;
290
337
  const header = asNonEmptyString(req.headers?.authorization);
291
338
  if (!header?.startsWith('Bearer ')) return false;
292
339
  const provided = Buffer.from(header.slice(7));
@@ -121,8 +121,8 @@ describe('managed agent tool runtime', () => {
121
121
  const pluginModule = await import(`${pathToFileURL(pluginPath).href}?both=${Date.now()}`);
122
122
  const { tool } = await pluginModule.OpenChamberPlugin();
123
123
 
124
- const controlActions = tool.openchamber.args.action.enum;
125
- const webActions = tool.openchamber_web.args.action.enum;
124
+ const controlActions = tool.openchamber.args.action.oneOf.map((entry) => entry.const);
125
+ const webActions = tool.openchamber_web.args.action.oneOf.map((entry) => entry.const);
126
126
  expect(webActions).toContain('browser.open');
127
127
  expect(controlActions).not.toContain('browser.open');
128
128
  expect(webActions).not.toContain('session.create');
@@ -133,6 +133,23 @@ describe('managed agent tool runtime', () => {
133
133
  expect(Object.keys(tool.openchamber.args.parameters.properties)).toContain('sessionId');
134
134
  });
135
135
 
136
+ it('keeps the action schema to one validator keyword', async () => {
137
+ // A node carrying both `enum` and `oneOf` is valid JSON Schema, but some
138
+ // OpenAI-compatible gateways reject it and answer with an empty completion
139
+ // instead of an error. `oneOf` is the keyword that stayed. Its branches
140
+ // carry the per-action descriptions the model reads.
141
+ const { runtime, dataDir } = await createRuntime();
142
+ await runtime.prepareManagedOpenCodeEnv();
143
+ const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
144
+ const pluginModule = await import(`${pathToFileURL(pluginPath).href}?validator=${Date.now()}`);
145
+ const { tool } = await pluginModule.OpenChamberPlugin();
146
+
147
+ for (const entry of Object.values(tool)) {
148
+ expect(entry.args.action.oneOf).toBeInstanceOf(Array);
149
+ expect(entry.args.action).not.toHaveProperty('enum');
150
+ }
151
+ });
152
+
136
153
  it('accepts inputs passed beside the action, not only inside parameters', async () => {
137
154
  const { runtime, dataDir } = await createRuntime();
138
155
  const prepared = await runtime.prepareManagedOpenCodeEnv();
@@ -354,6 +371,75 @@ describe('managed agent tool runtime', () => {
354
371
  expect(response.body).toEqual(expect.objectContaining({ ok: true, action: 'projects.list' }));
355
372
  });
356
373
 
374
+ it.each([
375
+ ['0.0.0.0', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
376
+ ['::', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
377
+ [null, 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
378
+ ['127.0.0.1', 'http://127.0.0.1:3901/api/openchamber/agent-tool'],
379
+ ['100.100.0.3', 'http://100.100.0.3:3901/api/openchamber/agent-tool'],
380
+ ['fd7a:115c::3', 'http://[fd7a:115c::3]:3901/api/openchamber/agent-tool'],
381
+ ])('points the callback at where a listener bound to %s answers', async (boundAddress, expectedUrl) => {
382
+ const { runtime } = await createRuntime({ getActiveHost: () => boundAddress });
383
+ const env = await runtime.prepareManagedOpenCodeEnv();
384
+ expect(env.OPENCHAMBER_AGENT_TOOL_URL).toBe(expectedUrl);
385
+ });
386
+
387
+ it.each([
388
+ ['100.100.0.3', '100.100.0.3', 200],
389
+ ['100.100.0.3', '::ffff:100.100.0.3', 200],
390
+ ['100.100.0.3', '100.100.0.7', 401],
391
+ ['fd7a:115c::3', 'fd7a:115c::3', 200],
392
+ ['fd7a:115c::3', 'fd7a:115c::7', 401],
393
+ ['0.0.0.0', '192.168.1.20', 401],
394
+ ['0.0.0.0', '0.0.0.0', 401],
395
+ [null, '192.168.1.20', 401],
396
+ ])('bound to %s, answers a token-bearing caller from %s with %i', async (boundAddress, remoteAddress, status) => {
397
+ const { runtime } = await createRuntime({ getActiveHost: () => boundAddress });
398
+ const env = await runtime.prepareManagedOpenCodeEnv();
399
+ const app = express();
400
+ app.use((req, _res, next) => {
401
+ Object.defineProperty(req.socket, 'remoteAddress', { value: remoteAddress, configurable: true });
402
+ next();
403
+ });
404
+ runtime.registerRoutes(app, express);
405
+
406
+ await request(app)
407
+ .post('/api/openchamber/agent-tool')
408
+ .set('authorization', `Bearer ${env.OPENCHAMBER_AGENT_TOOL_TOKEN}`)
409
+ .send({ input: { action: 'projects.list' } })
410
+ .expect(status);
411
+ });
412
+
413
+ it.each([
414
+ ['http://100.100.0.3:3901/api/openchamber/agent-tool', 'localhost,127.0.0.1', 'localhost,127.0.0.1,100.100.0.3'],
415
+ ['http://[fd7a:115c::3]:3901/api/openchamber/agent-tool', undefined, 'fd7a:115c::3'],
416
+ ['http://100.100.0.3:3901/api/openchamber/agent-tool', '100.100.0.3', '100.100.0.3'],
417
+ ['not a url', 'localhost', 'localhost'],
418
+ ])('keeps the callback %s away from an environment proxy', async (callbackUrl, existing, expected) => {
419
+ const { runtime, dataDir } = await createRuntime();
420
+ await runtime.prepareManagedOpenCodeEnv();
421
+ const keys = ['OPENCHAMBER_AGENT_TOOL_URL', 'NO_PROXY', 'no_proxy'];
422
+ const previous = keys.map((key) => process.env[key]);
423
+ try {
424
+ process.env.OPENCHAMBER_AGENT_TOOL_URL = callbackUrl;
425
+ for (const key of ['NO_PROXY', 'no_proxy']) {
426
+ if (existing === undefined) delete process.env[key];
427
+ else process.env[key] = existing;
428
+ }
429
+ const pluginPath = path.join(dataDir, 'agent-tool', 'openchamber-plugin.js');
430
+ const pluginModule = await import(`${pathToFileURL(pluginPath).href}?test=${Date.now()}`);
431
+ await pluginModule.OpenChamberPlugin();
432
+
433
+ expect(process.env.NO_PROXY).toBe(expected);
434
+ expect(process.env.no_proxy).toBe(expected);
435
+ } finally {
436
+ keys.forEach((key, index) => {
437
+ if (previous[index] === undefined) delete process.env[key];
438
+ else process.env[key] = previous[index];
439
+ });
440
+ }
441
+ });
442
+
357
443
  it('executes through the materialized plugin and authenticated callback', async () => {
358
444
  let activePort = null;
359
445
  const { runtime, dataDir } = await createRuntime({ getActivePort: () => activePort });
@@ -51,7 +51,8 @@ twelve children.
51
51
  ## Notes for contributors
52
52
  - Keep filesystem policy (workspace root checks, error mapping, exec timeout behavior) inside this module, not in the composition root.
53
53
  - Workspace checks accept, besides the active workspace and its worktrees, the **managed roots**: the OpenChamber config root and the managed chats root (`managedChatsRoot` dependency; `OPENCHAMBER_CHATS_DIR` upstream, default `<config root>/chats`). Chat worktrees may legitimately live outside every project workspace.
54
- - `GET /api/fs/home` answers `{ home, chatsRoot }`. `chatsRoot` is the server-resolved managed chats root; clients must use it instead of joining `home` + the well-known segment (a relocated root does not contain that segment).
54
+ - `GET /api/fs/home` preserves `{ home, chatsRoot }` and adds `canonicalChatsRoot` and `canonicalLegacyChatsRoot`, resolved by the server's filesystem. If a root does not exist yet, it resolves the nearest existing ancestor and appends the missing segments, without creating directories. Errors resolving the configured root fail the request. A failed legacy lookup warns and omits only that optional alias, retaining exact legacy matching without blocking an accessible relocated root. Clients use confirmed aliases for exact membership while keeping the original roots as folder/scope identities. `chatsRoot` is the server-resolved managed chats root; clients must use it instead of joining `home` + the well-known segment (a relocated root does not contain that segment).
55
+ - Workspace authorization accepts both the configured managed paths and their filesystem-confirmed canonical roots. Canonical lookup runs only when lexical workspace/managed-root checks fail. One failed managed-root lookup cannot reject an independently authorized root or worktree. Path comparisons remain case-sensitive on POSIX: distinct Linux directories named `chats` and `Chats` never become aliases through string folding. Shared UI keeps exact root membership for classification and directory cleanup.
55
56
  - Filesystem `EPERM`/`EACCES` failures use the stable `reason: "os-permission"` response marker. Policy denials such as workspace-boundary or missing-grant failures must not use that marker because a native folder picker cannot remediate them.
56
57
  - `GET /api/fs/directory-stat?path=...` uses one `stat` without listing contents or resolving project topology. It follows the same authenticated directory-discovery path policy as `/api/fs/list`, including targets outside the active workspace. A directory returns `{ isDirectory: true }`; `ENOENT` returns `not-found`, and a file or `ENOTDIR` returns `not-directory`. Permission and other failures remain distinct from a missing path. VS Code explicitly returns 501, so the shared client treats its probe as unknown.
57
58
  - Read-only routes authorize the requested path against the workspace before resolving symlinks. A symlink reached through the workspace may therefore target a file outside it, while a directly requested outside path still requires an exact-path grant. Write routes keep canonical-target boundary checks.
@@ -196,6 +196,23 @@ const isPathWithinRoot = (resolvedPath, rootPath, path, os) => {
196
196
  return true;
197
197
  };
198
198
 
199
+ // A chats root may not exist until the first draft. Resolve its existing
200
+ // ancestor so both that first mkdir and later OpenCode sessions use disk casing.
201
+ const canonicalDirectoryPath = async (directory, fsPromises, path) => {
202
+ let ancestor = path.resolve(directory);
203
+ const missing = [];
204
+ for (;;) {
205
+ try {
206
+ return path.join(await fsPromises.realpath(ancestor), ...missing);
207
+ } catch (error) {
208
+ const parent = path.dirname(ancestor);
209
+ if (error.code !== 'ENOENT' || parent === ancestor) throw error;
210
+ missing.unshift(path.basename(ancestor));
211
+ ancestor = parent;
212
+ }
213
+ }
214
+ };
215
+
199
216
  const resolveWorkspacePath = ({ targetPath, baseDirectory, path, os, normalizeDirectoryPath, managedRoots }) => {
200
217
  const normalized = normalizeDirectoryPath(targetPath);
201
218
  if (!normalized || typeof normalized !== 'string') {
@@ -253,7 +270,7 @@ const resolveWorkspacePathFromWorktrees = async ({ targetPath, baseDirectory, pa
253
270
  return { ok: false, error: 'Path is outside of active workspace' };
254
271
  };
255
272
 
256
- const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProjectDirectory, path, os, normalizeDirectoryPath, managedRoots }) => {
273
+ const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProjectDirectory, path, os, fsPromises, normalizeDirectoryPath, managedRoots }) => {
257
274
  const resolvedProject = await resolveProjectDirectory(req);
258
275
  if (!resolvedProject.directory) {
259
276
  return { ok: false, error: resolvedProject.error || 'Active workspace is required' };
@@ -292,13 +309,30 @@ const resolveWorkspacePathFromContext = async ({ req, targetPath, resolveProject
292
309
  }
293
310
  }
294
311
 
295
- return resolveWorkspacePathFromWorktrees({
312
+ // Keep legacy lexical paths valid, but also accept the canonical roots
313
+ // returned by /fs/home. Never infer filesystem identity from letter case.
314
+ let resolutionError;
315
+ for (const root of managedRoots) {
316
+ try {
317
+ const canonicalRoot = await canonicalDirectoryPath(root, fsPromises, path);
318
+ const resolvedPath = path.resolve(normalizeDirectoryPath(targetPath));
319
+ if (isPathWithinRoot(resolvedPath, canonicalRoot, path, os)) {
320
+ return { ok: true, base: canonicalRoot, resolved: resolvedPath };
321
+ }
322
+ } catch (error) {
323
+ resolutionError ??= error;
324
+ }
325
+ }
326
+ const worktree = await resolveWorkspacePathFromWorktrees({
296
327
  targetPath,
297
328
  baseDirectory: resolvedProject.directory,
298
329
  path,
299
330
  os,
300
331
  normalizeDirectoryPath,
301
332
  });
333
+ if (worktree.ok) return worktree;
334
+ if (resolutionError) throw resolutionError;
335
+ return worktree;
302
336
  };
303
337
 
304
338
  // Nested repository discovery bounds: only shallow walks are useful for the
@@ -437,6 +471,7 @@ const resolveReadPathFromContext = async ({ req, targetPath, scope, resolveProje
437
471
  resolveProjectDirectory,
438
472
  path,
439
473
  os,
474
+ fsPromises,
440
475
  normalizeDirectoryPath,
441
476
  managedRoots,
442
477
  });
@@ -704,13 +739,22 @@ export const registerFsRoutes = (app, dependencies) => {
704
739
  job.updatedAt = Date.now();
705
740
  };
706
741
 
707
- app.get('/api/fs/home', (_req, res) => {
742
+ app.get('/api/fs/home', async (_req, res) => {
708
743
  try {
709
744
  const home = os.homedir();
710
745
  if (!home || typeof home !== 'string' || home.length === 0) {
711
746
  return res.status(500).json({ error: 'Failed to resolve home directory' });
712
747
  }
713
- return res.json({ home, chatsRoot });
748
+ const [canonicalChatsRoot, canonicalLegacyChatsRoot] = await Promise.all([
749
+ canonicalDirectoryPath(chatsRoot, fsPromises, path),
750
+ canonicalDirectoryPath(path.join(home, '.config', 'openchamber', 'chats'), fsPromises, path).catch((error) => {
751
+ // A relocated root must remain usable if the old root is inaccessible.
752
+ // Omit only this optional alias; clients retain exact legacy matching.
753
+ console.warn('Failed to resolve legacy chats root:', error);
754
+ return undefined;
755
+ }),
756
+ ]);
757
+ return res.json({ home, chatsRoot, canonicalChatsRoot, canonicalLegacyChatsRoot });
714
758
  } catch (error) {
715
759
  console.error('Failed to resolve home directory:', error);
716
760
  return res.status(500).json({ error: (error && error.message) || 'Failed to resolve home directory' });
@@ -730,6 +774,7 @@ export const registerFsRoutes = (app, dependencies) => {
730
774
  return res.status(403).json({ error: 'Outside workspace directory creation requires a grant' });
731
775
  } else {
732
776
  const resolved = await resolveWorkspacePathFromContext({
777
+ fsPromises,
733
778
  req,
734
779
  targetPath: dirPath,
735
780
  resolveProjectDirectory,
@@ -1153,6 +1198,7 @@ export const registerFsRoutes = (app, dependencies) => {
1153
1198
 
1154
1199
  try {
1155
1200
  const resolved = await resolveWorkspacePathFromContext({
1201
+ fsPromises,
1156
1202
  req,
1157
1203
  targetPath: filePath,
1158
1204
  resolveProjectDirectory,
@@ -1223,6 +1269,7 @@ export const registerFsRoutes = (app, dependencies) => {
1223
1269
 
1224
1270
  try {
1225
1271
  const resolved = await resolveWorkspacePathFromContext({
1272
+ fsPromises,
1226
1273
  req,
1227
1274
  targetPath: filePath,
1228
1275
  resolveProjectDirectory,
@@ -1330,6 +1377,7 @@ export const registerFsRoutes = (app, dependencies) => {
1330
1377
 
1331
1378
  try {
1332
1379
  const resolved = await resolveWorkspacePathFromContext({
1380
+ fsPromises,
1333
1381
  req,
1334
1382
  targetPath,
1335
1383
  resolveProjectDirectory,
@@ -1368,6 +1416,7 @@ export const registerFsRoutes = (app, dependencies) => {
1368
1416
 
1369
1417
  try {
1370
1418
  const resolvedOld = await resolveWorkspacePathFromContext({
1419
+ fsPromises,
1371
1420
  req,
1372
1421
  targetPath: oldPath,
1373
1422
  resolveProjectDirectory,
@@ -1381,6 +1430,7 @@ export const registerFsRoutes = (app, dependencies) => {
1381
1430
  }
1382
1431
 
1383
1432
  const resolvedNew = await resolveWorkspacePathFromContext({
1433
+ fsPromises,
1384
1434
  req,
1385
1435
  targetPath: newPath,
1386
1436
  resolveProjectDirectory,
@@ -1487,6 +1537,7 @@ export const registerFsRoutes = (app, dependencies) => {
1487
1537
  }
1488
1538
  const resolvedCwdCandidate = path.resolve(normalizeDirectoryPath(cwd));
1489
1539
  const resolvedForWorkspace = await resolveWorkspacePathFromContext({
1540
+ fsPromises,
1490
1541
  req,
1491
1542
  targetPath: resolvedCwdCandidate,
1492
1543
  resolveProjectDirectory,
@@ -1726,6 +1777,7 @@ export const registerFsRoutes = (app, dependencies) => {
1726
1777
 
1727
1778
  try {
1728
1779
  const resolved = await resolveWorkspacePathFromContext({
1780
+ fsPromises,
1729
1781
  req,
1730
1782
  targetPath: rawPath,
1731
1783
  resolveProjectDirectory,