@openchamber/web 1.23.1 → 1.24.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 (187) hide show
  1. package/dist/assets/{CodeMirrorCommentWidgets-DL0imnlI.js → CodeMirrorCommentWidgets-C9kV-n7r.js} +1 -1
  2. package/dist/assets/DiffView-B7YkbY-u.js +4 -0
  3. package/dist/assets/DirtyBranchSwitchDialog-CU0A93Zx.js +1 -0
  4. package/dist/assets/FilesView-vjJx7VaM.js +13 -0
  5. package/dist/assets/GitView-BLhlMYEY.js +6 -0
  6. package/dist/assets/GuestAttachDialog-B-fwE8r3.js +3 -0
  7. package/dist/assets/{JsonTreeView-BPBDPY9B.js → JsonTreeView-D_4G5X6-.js} +1 -1
  8. package/dist/assets/LinearIssuesView-1uKhePfH.js +1 -0
  9. package/dist/assets/{MarkdownImageGallery-BNjimjiI.js → MarkdownImageGallery-Ix7N_2wp.js} +1 -1
  10. package/dist/assets/MarkdownRendererImpl-Deel_y5S.js +12 -0
  11. package/dist/assets/{OnboardingScreen-CWXxIIAH.js → OnboardingScreen-ToIakxb_.js} +1 -1
  12. package/dist/assets/{PatchDiff-B6J3p3br.js → PatchDiff-BjMgezr1.js} +1 -1
  13. package/dist/assets/{PierreDiffViewer-BjTRJJ1D.js → PierreDiffViewer-53Ghfnlr.js} +5 -5
  14. package/dist/assets/PlanView-BGAzxDwD.js +5 -0
  15. package/dist/assets/SettingsView-n2X-jfBB.js +29 -0
  16. package/dist/assets/SettingsWindow-Bi8LE9XI.js +1 -0
  17. package/dist/assets/SubmoduleDiffSummary--YFqK6Ih.js +1 -0
  18. package/dist/assets/ToolOutputDialog-DRWBvdaJ.js +15 -0
  19. package/dist/assets/{ToolPartDiffPreview-DRifZ2YH.js → ToolPartDiffPreview-BxZJCU28.js} +2 -2
  20. package/dist/assets/{VirtualizedFileDiff-BOeQtAWV.js → VirtualizedFileDiff-DCXjBGRf.js} +3 -3
  21. package/dist/assets/{WalkthroughView-BD4p0vhD.js → WalkthroughView-CfIPvWWa.js} +2 -2
  22. package/dist/assets/appThemeRegistry-DDROzcUO.js +1 -0
  23. package/dist/assets/{computeVirtualFileMetrics-FZI1j1rE.js → computeVirtualFileMetrics-DHgQIkUq.js} +1 -1
  24. package/dist/assets/de-CX_f-T5U.js +10 -0
  25. package/dist/assets/es-BERmWNn_.js +16 -0
  26. package/dist/assets/fr-BjYYE_-z.js +14 -0
  27. package/dist/assets/index-DpzTz2UH.css +1 -0
  28. package/dist/assets/index-Dy8xgawx.js +40 -0
  29. package/dist/assets/{index-DddhnFNK.js → index-WjufPkIV.js} +1 -1
  30. package/dist/assets/{isDiffPlainText-D4ld2G-2.js → isDiffPlainText-D9faP70y.js} +1 -1
  31. package/dist/assets/{isFilePlainText-BW1Xfw0F.js → isFilePlainText-6qOcz5Ky.js} +1 -1
  32. package/dist/assets/ja-DxqeAk9N.js +16 -0
  33. package/dist/assets/ko-Dty1aUod.js +16 -0
  34. package/dist/assets/main-BOYSXfYn.js +896 -0
  35. package/dist/assets/{main-BBqRX3Po.js → main-Bjcre_GE.js} +2 -2
  36. package/dist/assets/{markdown-shiki.worker-D5fBU-lw.js → markdown-shiki.worker-CahLvHIq.js} +5 -5
  37. package/dist/assets/markdownCore-DPrwM1rU.js +5 -0
  38. package/dist/assets/{miniChat-CygpKLC_.js → miniChat-Dz_bPgMc.js} +2 -2
  39. package/dist/assets/{mobile-CSmUm4vb.js → mobile-BbZPBJrK.js} +2 -2
  40. package/dist/assets/{patchFileDiff-u4JuidC_.js → patchFileDiff-BvU6KOQC.js} +3 -3
  41. package/dist/assets/pl-CX-_ROkr.js +16 -0
  42. package/dist/assets/pt-BR-DhRR1arx.js +16 -0
  43. package/dist/assets/renderElectronMiniChatApp-uNEUkeAI.js +2 -0
  44. package/dist/assets/renderMobileApp-BK1kFlcJ.js +25 -0
  45. package/dist/assets/runtimeEndpointReset-BULHvOwb.js +25 -0
  46. package/dist/assets/{scheduledTasksApi-Og3jfb4K.js → scheduledTasksApi-DW3xqMQ8.js} +1 -1
  47. package/dist/assets/shikiHighlight-DsxD9QEa.js +1 -0
  48. package/dist/assets/textMateThemeFromAppTheme-Da7ed8qM.js +1 -0
  49. package/dist/assets/tr-cIQtYBpg.js +7 -0
  50. package/dist/assets/uk-CD21CXFV.js +16 -0
  51. package/dist/assets/useAppFontEffects-hfv2s6mZ.js +7333 -0
  52. package/dist/assets/useInlineCommentController-BmtfVbo8.js +2 -0
  53. package/dist/assets/useRootScrollLock-Cwc4kSl2.js +1 -0
  54. package/dist/assets/{vendor-base-ui-BY_5qla_.js → vendor-base-ui-CsXYnR5c.js} +1 -1
  55. package/dist/assets/{vendor-codemirror-language-data-D5hG1bL9.js → vendor-codemirror-language-data-BPMJpOpT.js} +2 -2
  56. package/dist/assets/vendor-framer-motion-Bq3iTZ6r.js +1 -0
  57. package/dist/assets/{vendor-motion-dom-D_o3BTI3.js → vendor-motion-dom-DcCgeG69.js} +1 -1
  58. package/dist/assets/{vendor-remixicon-react-Dil0zKKT.js → vendor-remixicon-react-BDmGmFCA.js} +1 -1
  59. package/dist/assets/vendor-strip-json-comments-5dJlOkP1.js +4 -0
  60. package/dist/assets/{vendor-zod-B6551dwG.js → vendor-zod-fZppILAM.js} +4 -4
  61. package/dist/assets/{web-components-DCyJti1c.js → web-components-U-hWbgJo.js} +2 -2
  62. package/dist/assets/zh-CN-BWvlPHY-.js +16 -0
  63. package/dist/assets/zh-TW-CRp5dJU2.js +16 -0
  64. package/dist/index.html +4 -4
  65. package/dist/mini-chat.html +4 -4
  66. package/dist/mobile.html +4 -4
  67. package/package.json +8 -6
  68. package/server/built-in-extensions/registry.json +4 -0
  69. package/server/index.d.ts +2 -0
  70. package/server/index.js +15 -3
  71. package/server/lib/fs/DOCUMENTATION.md +8 -0
  72. package/server/lib/fs/git-process.test.js +77 -0
  73. package/server/lib/fs/routes.js +2 -1
  74. package/server/lib/fs/search.js +2 -1
  75. package/server/lib/git/DOCUMENTATION.md +3 -1
  76. package/server/lib/git/routes.js +16 -3
  77. package/server/lib/git/service.js +112 -8
  78. package/server/lib/git/service.test.js +127 -0
  79. package/server/lib/guests/DOCUMENTATION.md +66 -0
  80. package/server/lib/guests/auth-store.js +184 -0
  81. package/server/lib/guests/auth-store.test.js +112 -0
  82. package/server/lib/guests/builtins.js +34 -0
  83. package/server/lib/guests/builtins.test.js +174 -0
  84. package/server/lib/guests/catalog.js +466 -0
  85. package/server/lib/guests/catalog.test.js +390 -0
  86. package/server/lib/guests/clone.js +297 -0
  87. package/server/lib/guests/extract-zip.js +136 -0
  88. package/server/lib/guests/extract-zip.test.js +109 -0
  89. package/server/lib/guests/files.js +308 -0
  90. package/server/lib/guests/files.test.js +262 -0
  91. package/server/lib/guests/grant-scope.js +81 -0
  92. package/server/lib/guests/grant-scope.test.js +75 -0
  93. package/server/lib/guests/host-session.js +73 -0
  94. package/server/lib/guests/host-session.test.js +30 -0
  95. package/server/lib/guests/html-styles.js +6 -0
  96. package/server/lib/guests/html-styles.test.js +45 -0
  97. package/server/lib/guests/html-tokens.js +73 -0
  98. package/server/lib/guests/html-tokens.test.js +53 -0
  99. package/server/lib/guests/install.js +406 -0
  100. package/server/lib/guests/install.test.js +338 -0
  101. package/server/lib/guests/oauth.js +501 -0
  102. package/server/lib/guests/oauth.test.js +481 -0
  103. package/server/lib/guests/persist.js +336 -0
  104. package/server/lib/guests/persist.test.js +288 -0
  105. package/server/lib/guests/request.js +112 -0
  106. package/server/lib/guests/request.test.js +206 -0
  107. package/server/lib/guests/routes.js +838 -0
  108. package/server/lib/guests/service.js +538 -0
  109. package/server/lib/guests/service.test.js +277 -0
  110. package/server/lib/guests/sockets.js +129 -0
  111. package/server/lib/guests/sockets.test.js +110 -0
  112. package/server/lib/guests/ssh-install.test.js +188 -0
  113. package/server/lib/guests/storage.js +68 -0
  114. package/server/lib/guests/storage.test.js +59 -0
  115. package/server/lib/guests/updates.js +294 -0
  116. package/server/lib/guests/updates.test.js +334 -0
  117. package/server/lib/guests/upload.js +50 -0
  118. package/server/lib/guests/upload.test.js +131 -0
  119. package/server/lib/linear/DOCUMENTATION.md +1 -1
  120. package/server/lib/openchamber-control/DOCUMENTATION.md +6 -0
  121. package/server/lib/openchamber-sessions/routes.js +44 -11
  122. package/server/lib/openchamber-sessions/routes.test.js +47 -0
  123. package/server/lib/opencode/DOCUMENTATION.md +54 -0
  124. package/server/lib/opencode/core-routes.js +39 -1
  125. package/server/lib/opencode/feature-routes-runtime.js +10 -0
  126. package/server/lib/opencode/lifecycle-process.test.js +84 -0
  127. package/server/lib/opencode/lifecycle.js +54 -67
  128. package/server/lib/opencode/openchamber-routes.js +72 -14
  129. package/server/lib/opencode/openchamber-routes.test.js +71 -3
  130. package/server/lib/opencode/settings-helpers.js +5 -0
  131. package/server/lib/opencode/settings-helpers.test.js +13 -1
  132. package/server/lib/opencode/settings-normalization-runtime.js +2 -0
  133. package/server/lib/opencode/settings-normalization-runtime.test.js +13 -0
  134. package/server/lib/opencode/settings-registry.json +7 -0
  135. package/server/lib/opencode/shutdown-runtime.js +3 -0
  136. package/server/lib/opencode/shutdown-runtime.test.js +24 -0
  137. package/server/lib/opencode/theme-archive.js +53 -0
  138. package/server/lib/opencode/theme-catalog.js +171 -0
  139. package/server/lib/opencode/theme-catalog.test.js +125 -0
  140. package/server/lib/opencode/theme-import.test.js +144 -0
  141. package/server/lib/opencode/theme-runtime.js +100 -28
  142. package/server/lib/opencode/theme-runtime.test.js +15 -0
  143. package/server/lib/quota/DOCUMENTATION.md +0 -1
  144. package/server/lib/quota/providers/index.js +0 -7
  145. package/server/lib/terminal/DOCUMENTATION.md +2 -0
  146. package/server/lib/terminal/runtime.js +17 -2
  147. package/server/lib/terminal/runtime.test.js +45 -0
  148. package/server/lib/ui-auth/ui-auth.js +43 -8
  149. package/server/lib/ui-auth/ui-auth.test.js +40 -0
  150. package/dist/assets/DiffView-q6z6MFdZ.js +0 -4
  151. package/dist/assets/DirtyBranchSwitchDialog-to6K1rXL.js +0 -1
  152. package/dist/assets/FilesView-uwvKGOeu.js +0 -13
  153. package/dist/assets/GitView-CAqrkFYg.js +0 -6
  154. package/dist/assets/LinearIssuesView-Dq4Nz_DL.js +0 -1
  155. package/dist/assets/MarkdownRendererImpl-BIYG3j5A.js +0 -12
  156. package/dist/assets/PlanView-Cs7Aa22g.js +0 -5
  157. package/dist/assets/SettingsView-DROvkdyX.js +0 -28
  158. package/dist/assets/SettingsWindow-AtPQGcRJ.js +0 -1
  159. package/dist/assets/ToolOutputDialog-DmAZDzlT.js +0 -15
  160. package/dist/assets/appThemeRegistry-BK0dHKa6.js +0 -1
  161. package/dist/assets/de-Byg3syd1.js +0 -10
  162. package/dist/assets/es-B-FGkjnQ.js +0 -16
  163. package/dist/assets/fr-Dvzik_Jj.js +0 -14
  164. package/dist/assets/index-zhgg-SDz.css +0 -1
  165. package/dist/assets/index-zzfsbdBe.js +0 -40
  166. package/dist/assets/ja-CFnftYdc.js +0 -16
  167. package/dist/assets/ko-CgZ13aWV.js +0 -16
  168. package/dist/assets/main-BX3ip8Oc.js +0 -930
  169. package/dist/assets/markdownCore-TRGNObm0.js +0 -5
  170. package/dist/assets/pl-BDk6AWIE.js +0 -16
  171. package/dist/assets/pt-BR-DV5hPNsk.js +0 -16
  172. package/dist/assets/registerCustomTheme-BBXUCRnG.js +0 -1
  173. package/dist/assets/renderElectronMiniChatApp-Bfh77YcY.js +0 -2
  174. package/dist/assets/renderMobileApp-DsYwHQBL.js +0 -25
  175. package/dist/assets/runtimeEndpointReset-MtnTGkZz.js +0 -41
  176. package/dist/assets/shikiHighlight-CVE7qsu3.js +0 -1
  177. package/dist/assets/tr-BwS5J324.js +0 -7
  178. package/dist/assets/uk-Dp60Q7VN.js +0 -16
  179. package/dist/assets/useAppFontEffects-DQXEYu1N.js +0 -7282
  180. package/dist/assets/useGitComparison-DjFXbxbu.js +0 -1
  181. package/dist/assets/useInlineCommentController-B4Vhtx-T.js +0 -2
  182. package/dist/assets/useRootScrollLock-B32nj08w.js +0 -1
  183. package/dist/assets/vendor-framer-motion-livSKyyV.js +0 -1
  184. package/dist/assets/zh-CN-D1MXOnJ7.js +0 -16
  185. package/dist/assets/zh-TW-MqRc5ECP.js +0 -16
  186. package/server/lib/quota/providers/crof.js +0 -96
  187. package/server/lib/quota/providers/crof.test.js +0 -98
package/dist/index.html CHANGED
@@ -509,16 +509,16 @@
509
509
  pointer-events: none;
510
510
  }
511
511
  </style>
512
- <script type="module" crossorigin src="/assets/main-BBqRX3Po.js"></script>
512
+ <script type="module" crossorigin src="/assets/main-Bjcre_GE.js"></script>
513
513
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
514
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-B6551dwG.js">
514
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.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-zzfsbdBe.js">
519
+ <link rel="modulepreload" crossorigin href="/assets/index-Dy8xgawx.js">
520
520
  <link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
521
- <link rel="stylesheet" crossorigin href="/assets/index-zhgg-SDz.css">
521
+ <link rel="stylesheet" crossorigin href="/assets/index-DpzTz2UH.css">
522
522
  </head>
523
523
  <body class="h-full bg-background text-foreground">
524
524
  <div id="root" class="h-full">
@@ -74,15 +74,15 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-CygpKLC_.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-Dz_bPgMc.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
79
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-B6551dwG.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.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-zzfsbdBe.js">
85
- <link rel="stylesheet" crossorigin href="/assets/index-zhgg-SDz.css">
84
+ <link rel="modulepreload" crossorigin href="/assets/index-Dy8xgawx.js">
85
+ <link rel="stylesheet" crossorigin href="/assets/index-DpzTz2UH.css">
86
86
  </head>
87
87
  <body class="h-full bg-background text-foreground">
88
88
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,15 +63,15 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-CSmUm4vb.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-BbZPBJrK.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
68
- <link rel="modulepreload" crossorigin href="/assets/vendor-zod-B6551dwG.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/vendor-zod-fZppILAM.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-zzfsbdBe.js">
74
- <link rel="stylesheet" crossorigin href="/assets/index-zhgg-SDz.css">
73
+ <link rel="modulepreload" crossorigin href="/assets/index-Dy8xgawx.js">
74
+ <link rel="stylesheet" crossorigin href="/assets/index-DpzTz2UH.css">
75
75
  </head>
76
76
  <body class="h-full bg-background text-foreground">
77
77
  <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.23.1",
3
+ "version": "1.24.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -13,10 +13,11 @@
13
13
  },
14
14
  "scripts": {
15
15
  "dev": "bun run build:watch",
16
- "dev:server": "OPENCHAMBER_RELAY_HOST=${OPENCHAMBER_RELAY_HOST:-off} bun server/index.js --port ${OPENCHAMBER_PORT:-3001}",
17
- "dev:server:watch": "node ./scripts/dev-server-watch.mjs",
18
- "build": "vite build",
19
- "build:watch": "vite build --watch",
16
+ "dev:server": "bun ../../scripts/build-builtin-extensions.mjs && OPENCHAMBER_RELAY_HOST=${OPENCHAMBER_RELAY_HOST:-off} bun server/index.js --port ${OPENCHAMBER_PORT:-3001}",
17
+ "dev:server:watch": "bun ../../scripts/build-builtin-extensions.mjs && node ./scripts/dev-server-watch.mjs",
18
+ "build": "bun ../../scripts/build-builtin-extensions.mjs && vite build",
19
+ "build:watch": "bun ../../scripts/build-builtin-extensions.mjs && vite build --watch",
20
+ "prepack": "bun ../../scripts/build-builtin-extensions.mjs",
20
21
  "type-check": "tsc --noEmit",
21
22
  "lint": "eslint \"./src/**/*.{ts,tsx}\" --config ../../eslint.config.js",
22
23
  "test": "vitest run",
@@ -25,7 +26,8 @@
25
26
  "dependencies": {
26
27
  "@clack/prompts": "^1.1.0",
27
28
  "@octokit/rest": "^22.0.1",
28
- "@opencode-ai/sdk": "1.18.30",
29
+ "@openchamber/sdk": "1.23.1",
30
+ "@opencode-ai/sdk": "1.18.31",
29
31
  "@simplewebauthn/server": "13.3.1",
30
32
  "bun-pty": "^0.4.5",
31
33
  "compression": "^1.8.1",
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "extensions": []
4
+ }
package/server/index.d.ts CHANGED
@@ -32,6 +32,8 @@ export interface StartWebUiServerOptions {
32
32
  exitOnShutdown?: boolean;
33
33
  uiPassword?: string | null;
34
34
  desktopUpdater?: DesktopUpdater;
35
+ /** App-owned built-in resources outside Electron's ASAR archive. */
36
+ builtInExtensionsDir?: string;
35
37
  }
36
38
 
37
39
  export declare function startWebUiServer(
package/server/index.js CHANGED
@@ -93,6 +93,7 @@ import { createNotificationTemplateRuntime } from './lib/notifications/template-
93
93
  import { createPermissionAutoAcceptRuntime } from './lib/permission-auto-accept/runtime.js';
94
94
  import { createMessageQueueRuntime } from './lib/message-queue/runtime.js';
95
95
  import { createGracefulShutdownRuntime } from './lib/opencode/shutdown-runtime.js';
96
+ import { stopAllGuestServices } from './lib/guests/service.js';
96
97
  import { createProjectConfigRuntime } from './lib/projects/project-config.js';
97
98
  import { migrateLegacyUserDirs } from './lib/data-dir-migration.js';
98
99
  import { createProjectContextRuntime } from './lib/project-context/runtime.js';
@@ -297,6 +298,8 @@ const themeRuntime = createThemeRuntime({
297
298
  });
298
299
 
299
300
  const readCustomThemesFromDisk = (...args) => themeRuntime.readCustomThemesFromDisk(...args);
301
+ const saveImportedTheme = (...args) => themeRuntime.saveImportedTheme(...args);
302
+ const deleteImportedTheme = (...args) => themeRuntime.deleteImportedTheme(...args);
300
303
 
301
304
  let notificationTemplateRuntime = null;
302
305
  let agentToolRuntime = null;
@@ -1345,14 +1348,14 @@ const resolveMemoryProjectId = createMemoryProjectResolver({
1345
1348
  });
1346
1349
 
1347
1350
  /**
1348
- * Tells open panels that the agent changed what it remembers, so what it just
1351
+ * Tells open panels that the service changed what it remembers, so what it just
1349
1352
  * stored is visible without reopening anything.
1350
1353
  */
1351
1354
  const emitAgentMemoryChangedEvent = (event) => {
1352
1355
  for (const client of uiOpenChamberEventClients) {
1353
1356
  try {
1354
1357
  writeSseEvent(client, {
1355
- type: 'openchamber:agent-memory-changed',
1358
+ type: 'openchamber:service-memory-changed',
1356
1359
  properties: {
1357
1360
  scope: event.scope,
1358
1361
  ...(event.projectId ? { projectId: event.projectId } : {}),
@@ -1933,6 +1936,8 @@ async function main(options = {}) {
1933
1936
  resolveGitBinaryForSpawn,
1934
1937
  createFsSearchRuntime: createFsSearchRuntimeFactory,
1935
1938
  openchamberDataDir: OPENCHAMBER_DATA_DIR,
1939
+ openchamberVersion: OPENCHAMBER_VERSION,
1940
+ builtInExtensionsDir: options.builtInExtensionsDir,
1936
1941
  openchamberUserConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
1937
1942
  managedChatsRoot: OPENCHAMBER_CHATS_DIR,
1938
1943
  normalizeDirectoryPath,
@@ -1940,6 +1945,8 @@ async function main(options = {}) {
1940
1945
  resolveOptionalProjectDirectory,
1941
1946
  validateDirectoryPath,
1942
1947
  readCustomThemesFromDisk,
1948
+ saveImportedTheme,
1949
+ deleteImportedTheme,
1943
1950
  refreshOpenCodeAfterConfigChange,
1944
1951
  getOpenCodeResolutionSnapshot,
1945
1952
  getOpenCodeUpgradeCapability,
@@ -2077,7 +2084,7 @@ async function main(options = {}) {
2077
2084
  port: managed ? openCodePort : null,
2078
2085
  };
2079
2086
  },
2080
- stop: (shutdownOptions = {}) => {
2087
+ stop: async (shutdownOptions = {}) => {
2081
2088
  realtimeProxyRuntime.stop();
2082
2089
  clearInterval(relayReconcileTimer);
2083
2090
  try {
@@ -2090,6 +2097,11 @@ async function main(options = {}) {
2090
2097
  } catch {
2091
2098
  // best-effort shutdown of the dictation worker
2092
2099
  }
2100
+ // Guest services are child processes; leaving before SIGTERM lands
2101
+ // (and the SIGKILL fallback fires) orphans them on the user's machine.
2102
+ await stopAllGuestServices().catch(() => {
2103
+ // best-effort teardown of guest service processes
2104
+ });
2093
2105
  return gracefulShutdown({ exitProcess: shutdownOptions.exitProcess ?? false });
2094
2106
  }
2095
2107
  };
@@ -36,6 +36,14 @@ Own filesystem API behavior for the web server runtime, including workspace-boun
36
36
  - Returns `{ searchFilesystemFiles(rootPath, options) }`.
37
37
  - Supports fuzzy matching, hidden-file handling, and optional `git check-ignore` filtering.
38
38
 
39
+ Both search and directory listing discard `git check-ignore` stderr at spawn.
40
+ They consume stdout for ignore matches. Never create an unread stderr pipe:
41
+ Git diagnostics can fill it and block the child indefinitely, so repeated
42
+ searches accumulate live Git processes. `git-process.test.js` exercises both
43
+ paths with real OS pipes, twelve concurrent checks, and 2 MiB of diagnostics
44
+ per child. Successful completion must preserve ignore filtering and reap all
45
+ twelve children.
46
+
39
47
  ## Composition contract with `index.js`
40
48
  - `index.js` provides composition-time dependencies only (platform primitives + callbacks such as `resolveProjectDirectory`, `normalizeDirectoryPath`, and `buildAugmentedPath`).
41
49
  - `index.js` no longer owns FS route handlers or FS exec job state.
@@ -0,0 +1,77 @@
1
+ import { spawn } from 'node:child_process';
2
+ import crypto from 'node:crypto';
3
+ import fs from 'node:fs/promises';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { describe, expect, it } from 'vitest';
7
+ import { createFsSearchRuntime } from './search.js';
8
+ import { registerFsRoutes } from './routes.js';
9
+
10
+ // Use real OS pipes. A mocked data event cannot reproduce a full stderr pipe.
11
+ const noisyGit = `
12
+ const fs = require('node:fs');
13
+ const chunk = Buffer.alloc(65536, 'x');
14
+ for (let i = 0; i < 32; i++) fs.writeSync(2, chunk);
15
+ fs.writeSync(1, 'ignored.txt\\n');
16
+ `;
17
+
18
+ describe('filesystem Git process ownership', () => {
19
+ for (const operation of ['search', 'list']) {
20
+ it(`${operation} completes repeated checks with more diagnostics than an OS pipe can hold`, async () => {
21
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-git-pipes-'));
22
+ const children = [];
23
+ const exits = [];
24
+ const launch = (binary, args, options) => {
25
+ expect(binary).toBe('git');
26
+ expect(args).toContain('check-ignore');
27
+ expect(args).toContain('ignored.txt');
28
+ const child = spawn(process.execPath, ['-e', noisyGit], options);
29
+ children.push(child);
30
+ exits.push(new Promise((resolve) => child.once('close', (code) => resolve(code))));
31
+ return child;
32
+ };
33
+ let deadline;
34
+ try {
35
+ await fs.writeFile(path.join(root, 'ignored.txt'), 'ignored');
36
+ await fs.writeFile(path.join(root, 'visible.txt'), 'visible');
37
+ const dependencies = { fsPromises: fs, path, spawn: launch, resolveGitBinaryForSpawn: () => 'git' };
38
+ const search = createFsSearchRuntime(dependencies);
39
+ const routes = new Map();
40
+ registerFsRoutes({
41
+ get(route, handler) { routes.set(route, handler); }, post() {}, put() {}, delete() {},
42
+ }, {
43
+ ...dependencies, os, crypto, normalizeDirectoryPath: (value) => value,
44
+ resolveProjectDirectory: async () => ({ directory: root }),
45
+ buildAugmentedPath: () => process.env.PATH,
46
+ openchamberUserConfigRoot: root,
47
+ gitCheckIgnoreTimeoutMs: 10_000,
48
+ });
49
+ const work = Array.from({ length: 12 }, async () => {
50
+ if (operation === 'search') {
51
+ const files = await search.searchFilesystemFiles(root, { query: '', limit: 10, respectGitignore: true });
52
+ expect(files.map((file) => file.name)).toEqual(['visible.txt']);
53
+ } else {
54
+ const response = { status() { return this; }, json(value) { this.body = value; } };
55
+ await routes.get('/api/fs/list')({ query: { path: root, respectGitignore: 'true' } }, response);
56
+ expect(response.body.entries.map((entry) => entry.name)).toEqual(['visible.txt']);
57
+ }
58
+ });
59
+ await Promise.race([
60
+ Promise.all(work),
61
+ new Promise((_, reject) => { deadline = setTimeout(() => reject(new Error('Git blocked on unread diagnostics')), 5000); }),
62
+ ]);
63
+ expect(children).toHaveLength(12);
64
+ expect(await Promise.all(exits)).toEqual(Array(12).fill(0));
65
+ for (const child of children) expect(child.exitCode).toBe(0);
66
+ } finally {
67
+ clearTimeout(deadline);
68
+ for (const child of children) {
69
+ child.stderr?.resume();
70
+ if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL');
71
+ }
72
+ await Promise.all(exits);
73
+ await fs.rm(root, { recursive: true, force: true });
74
+ }
75
+ }, 15_000);
76
+ }
77
+ });
@@ -1619,7 +1619,8 @@ export const registerFsRoutes = (app, dependencies) => {
1619
1619
  const child = spawn(resolveGitBinaryForSpawn(), ['check-ignore', '--', ...pathsToCheck], {
1620
1620
  cwd: resolvedPath,
1621
1621
  windowsHide: true,
1622
- stdio: ['ignore', 'pipe', 'pipe'],
1622
+ // Diagnostics are unused here. An unread pipe can block Git forever.
1623
+ stdio: ['ignore', 'pipe', 'ignore'],
1623
1624
  });
1624
1625
 
1625
1626
  let stdout = '';
@@ -127,7 +127,8 @@ export const createFsSearchRuntime = ({ fsPromises, path, spawn, resolveGitBinar
127
127
  const child = spawn(resolveGitBinaryForSpawn(), ['check-ignore', '--', ...pathsToCheck], {
128
128
  cwd: dir,
129
129
  windowsHide: true,
130
- stdio: ['ignore', 'pipe', 'pipe'],
130
+ // Diagnostics are unused here. An unread pipe can block Git forever.
131
+ stdio: ['ignore', 'pipe', 'ignore'],
131
132
  });
132
133
 
133
134
  let stdout = '';
@@ -26,11 +26,13 @@ The following functions are exported and used by the web server:
26
26
  ### Status and Diff Operations
27
27
  - `getStatus(directory)`: Get comprehensive Git status including current branch, tracking, ahead/behind, file changes, diff stats, merge/rebase state.
28
28
  - `getDiff(directory, { path, staged, contextLines })`: Get diff output for files or entire working tree with full Git blob identities. Untracked symbolic links are represented as link entries without following their targets.
29
+ - `getPathDiff(directory, { path, staged, contextLines })`: `getDiff` for one path, returning `{ diff, submodule }`. `submodule` is `null` for ordinary paths. For a gitlink it is `{ headCommit, indexCommit, worktreeCommit, hasTrackedChanges, hasUntrackedFiles, hasConflict }`, because a submodule that only gained untracked files shows as modified in status while its patch is empty. `worktreeCommit` is `null` when the submodule is not checked out. An unmerged gitlink has no single index commit, so it reports `hasConflict: true` with `indexCommit: null`. Exposed as `GET /api/git/diff`.
30
+ - Paths come from an earlier status listing and can stop resolving. Per-path operations reject with `error.code`: `path_not_found` when the path is absent from the working tree, index, and HEAD (for example, a file removed after the listing), and `nested_repository` when the path is a directory holding its own `.git` that is not a submodule (status lists it as `dir/`). `GET /api/git/diff` and `GET /api/git/file-diff` answer these with 404 and 422 and a `{ error, code }` body instead of 500. Entry existence is read from `ls-files --stage` and `ls-tree` modes, not `cat-file -e`: a gitlink's commit is not in the parent's object store, and simple-git reports that silent exit 1 as success.
29
31
  - `getRangeDiff(directory, { base, head, path, contextLines, includeWorkingTree })`: Compare the merge base of the exact selected refs with `head`. With `includeWorkingTree: true`, compare with the checked-out branch's current files instead, including committed, staged, unstaged, and untracked work in one net diff. This mode rejects a head that is not the checked-out branch. Exposed as `GET /api/git/range-diff`; omit `path` for the whole comparison.
30
32
  - `getRangeFiles(directory, { base, head, includeWorkingTree })`: List changed paths using the same comparison as `getRangeDiff`. A successful empty list means the final files match the merge base, even if staging and working-tree changes cancel each other out.
31
33
  - Both range operations honor refs literally. A local `main` is never replaced with `origin/main`, and an unavailable ref fails rather than choosing a different remote. The UI picker sends qualified refs to distinguish local and remote branches with matching display names.
32
34
  - Working-tree comparisons use the real index read-only. When untracked paths exist, a temporary copy of the index receives intent-to-add entries so Git computes additions, deletions, recreations, and renames together. Current contents come from the working tree, symlinks remain links, ignored files stay excluded, and temporary files are removed on success or failure.
33
- - `getFileDiff(directory, { path, staged })`: Get original and modified file contents for a single file (handles images as data URLs and symbolic links as their link-target text).
35
+ - `getFileDiff(directory, { path, staged })`: Get original and modified file contents for a single file (handles images as data URLs and symbolic links as their link-target text). For a submodule, both sides are Git's `Subproject commit <sha>` text (HEAD against the worktree checkout, or against the index when `staged`) and the result carries the same `submodule` state as `getPathDiff`; other paths return no `submodule`, which the route sends as `null`.
34
36
  - `listUntrackedPaths(directory)`: List individual untracked file paths honoring ignore rules. Much cheaper than `getStatus` when that is all a caller needs. Deliberately not `--directory`: collapsed directory entries end in a slash and are rejected by the per-file diff helpers, so a caller would silently lose every file inside a new directory.
35
37
  - `getUntrackedDiffs(directory, filePaths, { concurrency, contextLines })`: Diffs for untracked files against an empty tree. Resolves the repository context once instead of per file (`getDiff` re-resolves every call, costing an extra `rev-parse` each time) and bounds how many diff processes run at once. Returns one entry per input path in order; unreadable paths yield `''` rather than failing the batch.
36
38
  - `collectDiffs(directory, files)`: Collect diff output for multiple files.
@@ -10,6 +10,16 @@ export function registerGitRoutes(app, { emitWorktreeChanged } = {}) {
10
10
  return gitLibraries;
11
11
  };
12
12
 
13
+ // A path from an earlier status listing that no longer resolves is a stale
14
+ // row or a nested repository, not a server fault.
15
+ const GIT_PATH_ERROR_STATUS = new Map([['path_not_found', 404], ['nested_repository', 422]]);
16
+ const sendGitPathError = (res, error) => {
17
+ const status = GIT_PATH_ERROR_STATUS.get(error?.code);
18
+ if (!status) return false;
19
+ res.status(status).json({ error: error.message, code: error.code });
20
+ return true;
21
+ };
22
+
13
23
  const resolveDirectoryQuery = (value, preserveWhitespace = false) => {
14
24
  const raw = Array.isArray(value) ? value[0] : value;
15
25
  if (typeof raw !== 'string') {
@@ -345,7 +355,7 @@ export function registerGitRoutes(app, { emitWorktreeChanged } = {}) {
345
355
  });
346
356
 
347
357
  app.get('/api/git/diff', async (req, res) => {
348
- const { getDiff } = await getGitLibraries();
358
+ const { getPathDiff } = await getGitLibraries();
349
359
  try {
350
360
  const directory = req.query.directory;
351
361
  if (!directory) {
@@ -360,14 +370,15 @@ export function registerGitRoutes(app, { emitWorktreeChanged } = {}) {
360
370
  const staged = req.query.staged === 'true';
361
371
  const context = req.query.context ? parseInt(String(req.query.context), 10) : undefined;
362
372
 
363
- const diff = await getDiff(directory, {
373
+ const { diff, submodule } = await getPathDiff(directory, {
364
374
  path,
365
375
  staged,
366
376
  contextLines: Number.isFinite(context) ? context : 3,
367
377
  });
368
378
 
369
- res.json({ diff });
379
+ res.json({ diff, submodule });
370
380
  } catch (error) {
381
+ if (sendGitPathError(res, error)) return;
371
382
  console.error('Failed to get git diff:', error);
372
383
  res.status(500).json({ error: error.message || 'Failed to get git diff' });
373
384
  }
@@ -398,8 +409,10 @@ export function registerGitRoutes(app, { emitWorktreeChanged } = {}) {
398
409
  modified: result.modified,
399
410
  path: result.path,
400
411
  isBinary: Boolean(result.isBinary),
412
+ submodule: result.submodule ?? null,
401
413
  });
402
414
  } catch (error) {
415
+ if (sendGitPathError(res, error)) return;
403
416
  console.error('Failed to get git file diff:', error);
404
417
  res.status(500).json({ error: error.message || 'Failed to get git file diff' });
405
418
  }
@@ -510,12 +510,43 @@ const resolveGitInternalPath = async (repoRoot, git, gitPath) => {
510
510
  return path.resolve(repoRoot, resolved.trim());
511
511
  };
512
512
 
513
+ const GITLINK_MODE = '160000';
514
+
515
+ // Paths from `git status` can stop resolving: the file was removed after the
516
+ // listing, or the entry is a nested repository git reports as `dir/`. Callers
517
+ // tell these apart by `code`, and diff routes send the code to clients as is.
518
+ const GIT_PATH_NOT_FOUND = 'path_not_found';
519
+ const GIT_PATH_IS_NESTED_REPOSITORY = 'nested_repository';
520
+
521
+ const createGitPathError = (code, filePath) => {
522
+ const message = code === GIT_PATH_IS_NESTED_REPOSITORY
523
+ ? `Path is a separate Git repository: ${filePath}`
524
+ : `Path not found in working tree, index, or HEAD: ${filePath}`;
525
+ return Object.assign(new Error(message), { code });
526
+ };
527
+
528
+ // Mode of the exact entry at `repoPath`, or null. `cat-file -e` cannot answer
529
+ // this: a gitlink's commit lives in the submodule's object store, so git exits 1
530
+ // without stderr, which simple-git reports as success.
531
+ const readGitEntryMode = async (repoRoot, args, repoPath) => {
532
+ const result = await runGitCommand(repoRoot, args);
533
+ if (!result.success) return null;
534
+ for (const record of result.stdout.split('\0')) {
535
+ const tab = record.indexOf('\t');
536
+ if (tab !== -1 && record.slice(tab + 1) === repoPath) {
537
+ return record.slice(0, record.indexOf(' '));
538
+ }
539
+ }
540
+ return null;
541
+ };
542
+
513
543
  const resolveGitFileContext = async (directoryPath, git, filePath, repoRootOverride = null) => {
514
544
  const repoRoot = repoRootOverride || await resolveGitRepositoryRoot(directoryPath, git);
515
545
  const candidates = Array.from(new Set([
516
546
  path.resolve(repoRoot, filePath),
517
547
  path.resolve(directoryPath, filePath),
518
548
  ]));
549
+ let nestedRepository = false;
519
550
 
520
551
  for (const absolutePath of candidates) {
521
552
  if (!isInsideOrSameDirectory(repoRoot, absolutePath)) {
@@ -526,20 +557,60 @@ const resolveGitFileContext = async (directoryPath, git, filePath, repoRootOverr
526
557
  const worktreeEntry = await fsp.lstat(absolutePath).catch(() => null);
527
558
  const isSymbolicLink = worktreeEntry?.isSymbolicLink() ?? false;
528
559
  const existsInWorktree = worktreeEntry?.isFile() || isSymbolicLink;
529
- const existsInIndex = await git.raw(['cat-file', '-e', `:${repoPath}`]).then(() => true).catch(() => false);
530
- const existsInHead = await git.raw(['cat-file', '-e', `HEAD:${repoPath}`]).then(() => true).catch(() => false);
560
+ const indexMode = await readGitEntryMode(repoRoot, ['ls-files', '--stage', '-z', '--', `:(literal)${repoPath}`], repoPath);
561
+ const headMode = await readGitEntryMode(repoRoot, ['ls-tree', '-z', 'HEAD', '--', repoPath], repoPath);
531
562
 
532
- if (existsInWorktree || existsInIndex || existsInHead) {
563
+ if (existsInWorktree || indexMode || headMode) {
533
564
  return {
534
565
  absolutePath,
535
566
  repoPath,
536
567
  repoRoot,
537
568
  isSymbolicLink,
569
+ isSubmodule: indexMode === GITLINK_MODE || headMode === GITLINK_MODE,
538
570
  };
539
571
  }
572
+
573
+ if (worktreeEntry?.isDirectory() && await fsp.lstat(path.join(absolutePath, '.git')).then(() => true, () => false)) {
574
+ nestedRepository = true;
575
+ }
540
576
  }
541
577
 
542
- throw new Error('Invalid file path');
578
+ throw createGitPathError(nestedRepository ? GIT_PATH_IS_NESTED_REPOSITORY : GIT_PATH_NOT_FOUND, filePath);
579
+ };
580
+
581
+ /**
582
+ * What a submodule entry records, since its text patch cannot show everything:
583
+ * with only untracked files inside, `git status` marks it modified while
584
+ * `git diff` prints nothing.
585
+ */
586
+ const readSubmoduleState = async (repoRoot, fileContext) => {
587
+ const status = await runGitCommand(repoRoot, ['status', '--porcelain=v2', '-z', '--', `:(literal)${fileContext.repoPath}`]);
588
+ if (!status.success) {
589
+ throw new Error(status.message || 'Failed to read submodule status');
590
+ }
591
+ // Changed: "1 XY S<c><m><u> mH mI mW hH hI path" ("2" adds rename fields
592
+ // after hI). Unmerged: "u XY S<c><m><u> m1 m2 m3 mW h1 h2 h3 path", with no
593
+ // stage-0 index entry. A clean submodule has no record, so HEAD and the index
594
+ // record the same commit.
595
+ const record = status.stdout.split('\0').find((entry) => /^[12u] /.test(entry))?.split(' ');
596
+ const hasConflict = record?.[0] === 'u';
597
+ const readHead = async () => (await runGitCommand(repoRoot, ['rev-parse', '--verify', '--quiet', `HEAD:${fileContext.repoPath}`])).stdout.trim();
598
+ const head = record && !hasConflict ? record[6] : await readHead();
599
+ const index = hasConflict ? '' : (record ? record[7] : head);
600
+ const flags = record ? record[2] : 'S...';
601
+ // Without its own `.git`, rev-parse would answer for the parent repository.
602
+ const initialized = await fsp.lstat(path.join(fileContext.absolutePath, '.git')).then(() => true, () => false);
603
+ const worktree = initialized ? await runGitCommand(fileContext.absolutePath, ['rev-parse', '--verify', 'HEAD']) : null;
604
+ const commitOrNull = (value) => (value && !/^0+$/.test(value) ? value : null);
605
+
606
+ return {
607
+ headCommit: commitOrNull(head),
608
+ indexCommit: commitOrNull(index),
609
+ worktreeCommit: worktree?.success ? worktree.stdout.trim() : null,
610
+ hasTrackedChanges: flags[2] === 'M',
611
+ hasUntrackedFiles: flags[3] === 'U',
612
+ hasConflict,
613
+ };
543
614
  };
544
615
 
545
616
  const cleanBranchName = (branch) => {
@@ -2481,11 +2552,29 @@ const getNoIndexDiff = async (repoRoot, repoPath, contextLines) => {
2481
2552
  };
2482
2553
 
2483
2554
  export async function getDiff(directory, { path: filePath, staged = false, contextLines = 3 } = {}) {
2484
- const { directoryPath, directoryGit, repoRoot, git } = await createRepositoryGitContext(directory);
2555
+ const context = await createRepositoryGitContext(directory);
2556
+ const fileContext = filePath
2557
+ ? await resolveGitFileContext(context.directoryPath, context.directoryGit, filePath, context.repoRoot)
2558
+ : null;
2559
+ return readDiff(context, fileContext, { staged, contextLines });
2560
+ }
2485
2561
 
2562
+ /**
2563
+ * `getDiff` for one path, plus what a submodule records. A submodule patch is
2564
+ * empty when only untracked files changed inside it, so callers need the state
2565
+ * to show anything truthful.
2566
+ */
2567
+ export async function getPathDiff(directory, { path: filePath, staged = false, contextLines = 3 } = {}) {
2568
+ const context = await createRepositoryGitContext(directory);
2569
+ const fileContext = await resolveGitFileContext(context.directoryPath, context.directoryGit, filePath, context.repoRoot);
2570
+ const diff = await readDiff(context, fileContext, { staged, contextLines });
2571
+ if (!fileContext.isSubmodule) return { diff, submodule: null };
2572
+ return { diff, submodule: await readSubmoduleState(context.repoRoot, fileContext) };
2573
+ }
2574
+
2575
+ async function readDiff({ repoRoot, git }, fileContext, { staged, contextLines }) {
2486
2576
  try {
2487
2577
  const args = ['diff', '--no-color', '--full-index'];
2488
- const fileContext = filePath ? await resolveGitFileContext(directoryPath, directoryGit, filePath, repoRoot) : null;
2489
2578
 
2490
2579
  if (typeof contextLines === 'number' && !Number.isNaN(contextLines)) {
2491
2580
  args.push(`-U${Math.max(0, contextLines)}`);
@@ -2682,7 +2771,7 @@ export async function getRangeDiff(directory, { base, head, path: filePath, cont
2682
2771
  const fileContext = await resolveGitFileContext(directoryPath, directoryGit, filePath, repoRoot);
2683
2772
  paths.push(fileContext.repoPath);
2684
2773
  } catch (error) {
2685
- if (error.message !== 'Invalid file path') throw error;
2774
+ if (error.code !== GIT_PATH_NOT_FOUND) throw error;
2686
2775
  // A committed deletion is absent from HEAD, the index, and the working
2687
2776
  // tree. It is still a valid range path when it exists at the merge base.
2688
2777
  const mergeBase = (await git.raw(['merge-base', baseRef, headRef])).trim();
@@ -2907,7 +2996,22 @@ export async function getFileDiff(directory, { path: filePath, staged = false }
2907
2996
  const { directoryPath, directoryGit, repoRoot, git } = await createRepositoryGitContext(directory);
2908
2997
  const isImage = isImageFile(filePath);
2909
2998
  const mimeType = isImage ? getImageMimeType(filePath) : null;
2910
- const { absolutePath, repoPath, isSymbolicLink } = await resolveGitFileContext(directoryPath, directoryGit, filePath, repoRoot);
2999
+ const fileContext = await resolveGitFileContext(directoryPath, directoryGit, filePath, repoRoot);
3000
+ const { absolutePath, repoPath, isSymbolicLink } = fileContext;
3001
+
3002
+ if (fileContext.isSubmodule) {
3003
+ // Git's own text form of a gitlink, so a plain two-pane view still shows
3004
+ // the recorded commits; `submodule` carries what the text cannot.
3005
+ const submodule = await readSubmoduleState(repoRoot, fileContext);
3006
+ const describeCommit = (commit) => (commit ? `Subproject commit ${commit}\n` : '');
3007
+ return {
3008
+ original: describeCommit(submodule.headCommit),
3009
+ modified: describeCommit(staged ? submodule.indexCommit : submodule.worktreeCommit),
3010
+ path: filePath,
3011
+ isBinary: false,
3012
+ submodule,
3013
+ };
3014
+ }
2911
3015
 
2912
3016
  if (!isImage && !isSymbolicLink) {
2913
3017
  const isBinaryBySniff = await looksBinaryBySniff(absolutePath);