@openchamber/web 2.0.0 → 2.0.1

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 (162) hide show
  1. package/dist/assets/{CodeMirrorCommentWidgets-hJbl3JX4.js → CodeMirrorCommentWidgets-zm3C1FvM.js} +1 -1
  2. package/dist/assets/DiffView-DNExNi1z.js +4 -0
  3. package/dist/assets/FilesView-DUCLmHBi.js +17 -0
  4. package/dist/assets/{GitView-DY4pelsO.js → GitView-Bz9z6gZA.js} +4 -4
  5. package/dist/assets/{GuestAttachDialog-D6mHDTB2.js → GuestAttachDialog-UGp4KDlK.js} +1 -1
  6. package/dist/assets/GuestSurfacePane-B3pdB_2u.js +1 -0
  7. package/dist/assets/{JsonTreeView-DEXI2NvJ.js → JsonTreeView-7lVecnZl.js} +1 -1
  8. package/dist/assets/{LinearIssuesView-BTNc-4dN.js → LinearIssuesView-CTGRS9Vq.js} +1 -1
  9. package/dist/assets/{MarkdownImageGallery-wcUUcf8l.js → MarkdownImageGallery-DQk5adUs.js} +1 -1
  10. package/dist/assets/MarkdownRendererImpl-DPF8fZpX.js +12 -0
  11. package/dist/assets/{OnboardingScreen-FJUreEgI.js → OnboardingScreen-CBx6cXPP.js} +1 -1
  12. package/dist/assets/{PatchDiff-C0oOkKnO.js → PatchDiff-D7VVpR_l.js} +1 -1
  13. package/dist/assets/{PierreDiffViewer-asuSQAsf.js → PierreDiffViewer-Gbfks1pk.js} +3 -3
  14. package/dist/assets/{PlanView-DGbasNHP.js → PlanView-CPSK0x97.js} +4 -4
  15. package/dist/assets/PluginPane-BIGsUx69.js +3 -0
  16. package/dist/assets/SettingsView-Dql7z6Ww.js +30 -0
  17. package/dist/assets/{SettingsWindow-By4cqnqy.js → SettingsWindow-D6oi-UmV.js} +1 -1
  18. package/dist/assets/{SubmoduleDiffSummary-C0P2tXLU.js → SubmoduleDiffSummary-BXA0FAWj.js} +1 -1
  19. package/dist/assets/{ToolOutputDialog-Cayc-yIM.js → ToolOutputDialog-BQJsSbDm.js} +6 -6
  20. package/dist/assets/{ToolPartDiffPreview-B0jmpPQz.js → ToolPartDiffPreview-FY9w0TVT.js} +2 -2
  21. package/dist/assets/{VirtualizedFileDiff-DsOpvWZD.js → VirtualizedFileDiff-B9YhAya5.js} +1 -1
  22. package/dist/assets/{WalkthroughView-CCakjyn9.js → WalkthroughView-CmFgOUFN.js} +2 -2
  23. package/dist/assets/{appThemeRegistry-Bw5oTm41.js → appThemeRegistry-BebxalUt.js} +1 -1
  24. package/dist/assets/changesTree-CePHbFcj.js +1 -0
  25. package/dist/assets/commitAndPush-Wfxng_IK.js +1 -0
  26. package/dist/assets/{computeVirtualFileMetrics-B-4aLf4A.js → computeVirtualFileMetrics-BCOqgixN.js} +2 -2
  27. package/dist/assets/de-CMA45TC-.js +10 -0
  28. package/dist/assets/es-DPL4fBtl.js +16 -0
  29. package/dist/assets/fr-OHBKBseP.js +14 -0
  30. package/dist/assets/{index-B6r0Kv-B.js → index-3TiDNtfN.js} +1 -1
  31. package/dist/assets/index-BLUZa5u0.js +41 -0
  32. package/dist/assets/index-Cm2rrq69.css +1 -0
  33. package/dist/assets/{isDiffPlainText-Ok-kgtJA.js → isDiffPlainText-DnDYQmWK.js} +1 -1
  34. package/dist/assets/{isFilePlainText-0dLnkYm8.js → isFilePlainText-BA_AHX7d.js} +1 -1
  35. package/dist/assets/ja-DvX4WSRf.js +16 -0
  36. package/dist/assets/ko-BUcLd8YZ.js +16 -0
  37. package/dist/assets/main-B_jri4i-.js +896 -0
  38. package/dist/assets/{main-CjXBM_Xe.js → main-DtUmJp9B.js} +2 -2
  39. package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
  40. package/dist/assets/markdownCore-BSnlUXBf.js +7 -0
  41. package/dist/assets/{miniChat-DZ3OAeLN.js → miniChat-BYfLUnDK.js} +2 -2
  42. package/dist/assets/{mobile-CH0LOIF-.js → mobile-DH3hI6gd.js} +2 -2
  43. package/dist/assets/patchFileDiff--L7lt_GZ.js +13 -0
  44. package/dist/assets/pl-BkI_xHqz.js +16 -0
  45. package/dist/assets/pt-BR-7wFtQlV9.js +16 -0
  46. package/dist/assets/{renderElectronMiniChatApp-CB1uLYvh.js → renderElectronMiniChatApp-C7kpNW_-.js} +2 -2
  47. package/dist/assets/renderMobileApp-i0nq7Dwy.js +25 -0
  48. package/dist/assets/runtimeEndpointReset-CfEYbcCc.js +27 -0
  49. package/dist/assets/scheduledTasksApi-Cy7uZCaI.js +1 -0
  50. package/dist/assets/{shikiHighlight-CocY80VR.js → shikiHighlight-D4vxipfr.js} +1 -1
  51. package/dist/assets/{textMateThemeFromAppTheme-CF77r8FA.js → textMateThemeFromAppTheme-BYAHtJwQ.js} +1 -1
  52. package/dist/assets/tr-TsD-AqEH.js +7 -0
  53. package/dist/assets/uk-B-qspCmD.js +16 -0
  54. package/dist/assets/{useAppFontEffects-Dc5nTHi8.js → useAppFontEffects-DHZ9-L30.js} +158 -157
  55. package/dist/assets/{useInlineCommentController-Dbza5c8l.js → useInlineCommentController-CvpOMK-R.js} +2 -2
  56. package/dist/assets/{useRootScrollLock-CSCLv396.js → useRootScrollLock-DzNFi-fn.js} +2 -2
  57. package/dist/assets/{vendor-codemirror-language-data-CkmYWcRI.js → vendor-codemirror-language-data-j3fhlwUM.js} +2 -2
  58. package/dist/assets/{vendor-opencode-client-_BAHQo4R.js → vendor-opencode-client-DYdsLbCM.js} +2 -2
  59. package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
  60. package/dist/assets/{web-components-nsStrYq9.js → web-components-BvHNFSEG.js} +1 -1
  61. package/dist/assets/zh-CN-DYuPJV5i.js +16 -0
  62. package/dist/assets/zh-TW-BX_2D_lV.js +16 -0
  63. package/dist/index.html +5 -5
  64. package/dist/mini-chat.html +5 -5
  65. package/dist/mobile.html +5 -5
  66. package/package.json +4 -4
  67. package/server/index.js +18 -0
  68. package/server/lib/agent-tool/DOCUMENTATION.md +5 -0
  69. package/server/lib/agent-tool/runtime.js +34 -6
  70. package/server/lib/agent-tool/runtime.test.js +15 -0
  71. package/server/lib/browser-control/DOCUMENTATION.md +14 -2
  72. package/server/lib/git/DOCUMENTATION.md +1 -1
  73. package/server/lib/git/service.js +22 -0
  74. package/server/lib/git/service.test.js +8 -0
  75. package/server/lib/guests/DOCUMENTATION.md +4 -3
  76. package/server/lib/guests/catalog.js +19 -1
  77. package/server/lib/guests/catalog.test.js +22 -0
  78. package/server/lib/guests/html-styles.js +5 -3
  79. package/server/lib/guests/html-styles.test.js +3 -1
  80. package/server/lib/guests/routes.js +11 -3
  81. package/server/lib/guests/service.js +5 -0
  82. package/server/lib/guests/surface.js +55 -9
  83. package/server/lib/guests/surface.test.js +56 -6
  84. package/server/lib/notifications/DOCUMENTATION.md +10 -0
  85. package/server/lib/notifications/emit-route.js +118 -0
  86. package/server/lib/notifications/emit-route.test.js +112 -0
  87. package/server/lib/openchamber-control/actions.js +16 -2
  88. package/server/lib/openchamber-control/service.js +23 -0
  89. package/server/lib/openchamber-control/service.test.js +31 -0
  90. package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
  91. package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
  92. package/server/lib/openchamber-sessions/routes.js +11 -0
  93. package/server/lib/openchamber-sessions/routes.test.js +18 -0
  94. package/server/lib/opencode/DOCUMENTATION.md +31 -22
  95. package/server/lib/opencode/bootstrap-runtime.js +12 -0
  96. package/server/lib/opencode/compatibility.js +6 -3
  97. package/server/lib/opencode/compatibility.test.js +8 -0
  98. package/server/lib/opencode/config-v2.d.ts +2 -0
  99. package/server/lib/opencode/config-v2.js +42 -0
  100. package/server/lib/opencode/config-v2.test.js +17 -0
  101. package/server/lib/opencode/core-routes.js +3 -0
  102. package/server/lib/opencode/core-routes.test.js +15 -0
  103. package/server/lib/opencode/env-runtime.js +1 -8
  104. package/server/lib/opencode/feature-routes-runtime.js +2 -1
  105. package/server/lib/opencode/lifecycle.js +30 -2
  106. package/server/lib/opencode/lifecycle.test.js +27 -0
  107. package/server/lib/opencode/managed-config-file.js +18 -6
  108. package/server/lib/opencode/managed-config-file.test.js +23 -7
  109. package/server/lib/opencode/openchamber-routes.js +29 -11
  110. package/server/lib/opencode/openchamber-routes.test.js +18 -0
  111. package/server/lib/opencode/provider-source-route.test.js +59 -0
  112. package/server/lib/opencode/providers.js +3 -0
  113. package/server/lib/opencode/providers.test.js +62 -0
  114. package/server/lib/opencode/routes-upgrade.test.js +1 -1
  115. package/server/lib/opencode/routes.js +18 -1
  116. package/server/lib/opencode/settings-helpers.js +7 -0
  117. package/server/lib/opencode/settings-helpers.test.js +2 -2
  118. package/server/lib/opencode/settings-registry.json +14 -0
  119. package/server/lib/opencode/settings-runtime.js +1 -0
  120. package/server/lib/opencode/shared.js +32 -2
  121. package/server/lib/opencode/shared.test.js +79 -1
  122. package/server/lib/opencode/skill-routes.js +28 -12
  123. package/server/lib/opencode/skill-routes.test.js +121 -1
  124. package/server/lib/opencode/upgrade-capability.js +0 -14
  125. package/server/lib/opencode/v1-migration-topup.js +21 -15
  126. package/server/lib/opencode/v1-migration-topup.test.js +14 -6
  127. package/server/lib/opencode/v2-install.d.ts +1 -0
  128. package/server/lib/opencode/v2-install.js +8 -7
  129. package/server/lib/opencode/v2-install.test.js +13 -4
  130. package/server/lib/opencode/websearch-config.js +13 -1
  131. package/server/lib/quota/providers/kimi.js +1 -1
  132. package/server/lib/session-assist/DOCUMENTATION.md +17 -5
  133. package/server/lib/session-assist/runtime.js +19 -2
  134. package/server/lib/session-assist/runtime.test.js +8 -0
  135. package/server/lib/session-goal/DOCUMENTATION.md +11 -0
  136. package/dist/assets/DiffView-BucGEJYa.js +0 -4
  137. package/dist/assets/FilesView-CQcaaAVP.js +0 -17
  138. package/dist/assets/GuestSurfacePane--DJ7rsmY.js +0 -1
  139. package/dist/assets/MarkdownRendererImpl-BPe2TVV2.js +0 -12
  140. package/dist/assets/PluginPane-DImv8hV2.js +0 -3
  141. package/dist/assets/SettingsView-DOjuOljf.js +0 -29
  142. package/dist/assets/commitAndPush-sGEelpjh.js +0 -1
  143. package/dist/assets/de-CD9utsNj.js +0 -10
  144. package/dist/assets/es-NNum2rX8.js +0 -16
  145. package/dist/assets/fr-CJLGmduQ.js +0 -14
  146. package/dist/assets/index-DjGPR5vW.js +0 -41
  147. package/dist/assets/index-fCXJ-8Qt.css +0 -1
  148. package/dist/assets/ja-BuddHNi6.js +0 -16
  149. package/dist/assets/ko-BrwMbHmf.js +0 -16
  150. package/dist/assets/main-CxVyUDU_.js +0 -896
  151. package/dist/assets/markdownCore-B6PpX409.js +0 -5
  152. package/dist/assets/patchFileDiff-BFRGKaGH.js +0 -13
  153. package/dist/assets/pl-BwN4TNlP.js +0 -16
  154. package/dist/assets/pt-BR-BhMtownO.js +0 -16
  155. package/dist/assets/renderMobileApp-nQ4sjQtb.js +0 -25
  156. package/dist/assets/runtimeEndpointReset-9ZGlXU4J.js +0 -27
  157. package/dist/assets/scheduledTasksApi-6DsL_SwM.js +0 -1
  158. package/dist/assets/tr-DRzvqMdi.js +0 -7
  159. package/dist/assets/uk-b2aYOSNh.js +0 -16
  160. package/dist/assets/vendor-zod-Gea9uBlY.js +0 -39
  161. package/dist/assets/zh-CN-DZeUThm_.js +0 -16
  162. package/dist/assets/zh-TW-2fRE7uc6.js +0 -16
@@ -294,6 +294,31 @@ describe('file.open', () => {
294
294
  });
295
295
  });
296
296
 
297
+ describe('notify.send', () => {
298
+ it('sends the notice for the calling session and returns what was delivered', async () => {
299
+ const notifyUser = vi.fn(async () => ({ status: 200, body: { delivered: true } }));
300
+ const { service } = createService({ notifyUser });
301
+
302
+ const result = await service.execute('notify.send', { title: 'Done', body: 'All green', showWhenFocused: true }, '/repo', { contextSessionId: 'ses_1' });
303
+
304
+ expect(notifyUser).toHaveBeenCalledWith({ title: 'Done', body: 'All green', showWhenFocused: true, sessionId: 'ses_1', directory: '/repo' });
305
+ expect(result).toEqual({ delivered: true });
306
+ });
307
+
308
+ it('turns a refused notice into an error the agent can read', async () => {
309
+ const notifyUser = vi.fn(async () => ({ status: 429, retryAfter: 4, body: { error: 'too many notifications' } }));
310
+ const { service } = createService({ notifyUser });
311
+
312
+ await expect(service.execute('notify.send', { title: 'Done' }, '/repo'))
313
+ .rejects.toMatchObject({ statusCode: 429, message: 'too many notifications' });
314
+ });
315
+
316
+ it('answers 503 when this server has no notifier wired', async () => {
317
+ const { service } = createService({});
318
+ await expect(service.execute('notify.send', { title: 'Done' }, '/repo')).rejects.toMatchObject({ statusCode: 503 });
319
+ });
320
+ });
321
+
297
322
  describe('browser capture', () => {
298
323
  const pixel = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==';
299
324
 
@@ -338,6 +363,12 @@ describe('browser capture', () => {
338
363
  await expect(service.execute('browser.capture', {})).rejects.toThrow(/directory is required/);
339
364
  });
340
365
 
366
+ it('passes the tab the agent named to the browser', async () => {
367
+ const { service, directory, request } = await createBrowserService({ base64: pixel, mime: 'image/png' });
368
+ await service.execute('browser.capture', { tabId: ' tab-2 ' }, directory);
369
+ expect(request).toHaveBeenCalledWith('browser.capture', { tabId: 'tab-2' }, expect.anything());
370
+ });
371
+
341
372
  it('passes a label through to the browser and leaves other actions untouched', async () => {
342
373
  const { service, directory, request } = await createBrowserService({ base64: pixel, mime: 'image/png' });
343
374
  await service.execute('browser.capture', { label: 'before' }, directory);
@@ -0,0 +1,103 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * What a fork made through the OpenChamber sessions API (CLI, scheduled tasks)
5
+ * keeps from its source session's OpenChamber metadata. Server twin of the UI's
6
+ * `packages/ui/src/lib/sessionForkInheritance.ts`: UI forks call OpenCode
7
+ * directly and repair themselves; forks made here are repaired here.
8
+ *
9
+ * OpenCode 2.x copies the source's `metadata` wholesale into the fork, so the
10
+ * goal already arrives. Two repairs remain:
11
+ *
12
+ * - Source-owned links: the source's btw fork (`btwSessionID`), its review
13
+ * session (`reviewSessionID`), and the btw marker when the source is itself a
14
+ * btw side thread.
15
+ * - A file-backed goal objective: the text lives in a file keyed by the session
16
+ * id, so the fork needs its own copy. When the copy cannot be written the
17
+ * fork's goal carries the text inline instead.
18
+ */
19
+
20
+ const NamespaceSchema = z.looseObject({
21
+ btwSessionID: z.unknown().optional(),
22
+ reviewSessionID: z.unknown().optional(),
23
+ kind: z.unknown().optional(),
24
+ goal: z.unknown().optional(),
25
+ });
26
+ const FileBackedGoalSchema = z.looseObject({ id: z.string().min(1), objectiveFile: z.literal(true) });
27
+
28
+ const openChamberNamespace = (metadata) => {
29
+ const parsed = z.looseObject({ openchamber: NamespaceSchema }).safeParse(metadata);
30
+ return parsed.success ? parsed.data.openchamber : null;
31
+ };
32
+
33
+ /** Merge patch (RFC 7386) removing source-owned links; null when there are none. */
34
+ export const sourceOwnedLinksPatch = (metadata) => {
35
+ const namespace = openChamberNamespace(metadata);
36
+ if (!namespace) return null;
37
+ const patch = {};
38
+ for (const key of ['btwSessionID', 'reviewSessionID']) {
39
+ if (key in namespace) patch[key] = null;
40
+ }
41
+ if (namespace.kind === 'btw') {
42
+ for (const key of ['kind', 'originalSessionID', 'btwBoundaryMessageID']) {
43
+ if (key in namespace) patch[key] = null;
44
+ }
45
+ }
46
+ // A fork must not pursue the source's goal in parallel: an active goal
47
+ // arrives paused and the user resumes it (same rule as UI forks).
48
+ const goal = namespace.goal;
49
+ if (goal && typeof goal === 'object' && !Array.isArray(goal) && goal.status === 'active') {
50
+ patch.goal = { status: 'paused', statusReason: 'paused in fork' };
51
+ }
52
+ return Object.keys(patch).length > 0 ? patch : null;
53
+ };
54
+
55
+ const fileBackedGoal = (metadata) => {
56
+ const parsed = FileBackedGoalSchema.safeParse(openChamberNamespace(metadata)?.goal);
57
+ return parsed.success ? parsed.data : null;
58
+ };
59
+
60
+ /**
61
+ * Repair a freshly created fork. Best-effort: the fork already exists and is
62
+ * usable, so every failure is logged and swallowed.
63
+ *
64
+ * @param {object} options
65
+ * @param {string} options.sourceSessionID
66
+ * @param {{ id: string, metadata?: object }} options.fork The fork record OpenCode returned.
67
+ * @param {(sessionID: string) => Promise<string | null>} options.readObjective
68
+ * @param {(sessionID: string, content: string) => Promise<unknown>} options.writeObjective Throws on failure.
69
+ * @param {(sessionID: string, patch: object) => Promise<unknown>} options.writeMetadata
70
+ */
71
+ export const applyForkInheritance = async ({ sourceSessionID, fork, readObjective, writeObjective, writeMetadata }) => {
72
+ const metadata = fork?.metadata;
73
+ const goal = fileBackedGoal(metadata);
74
+ let inlineObjective = null;
75
+ if (goal) {
76
+ try {
77
+ const content = await readObjective(sourceSessionID);
78
+ if (content === null) {
79
+ console.warn('[fork] source goal objective unavailable; fork keeps the inline fallback');
80
+ } else {
81
+ try {
82
+ await writeObjective(fork.id, content);
83
+ } catch (error) {
84
+ console.warn('[fork] failed to copy the goal objective file; inlining it', error?.message ?? error);
85
+ inlineObjective = content;
86
+ }
87
+ }
88
+ } catch (error) {
89
+ console.warn('[fork] failed to read the source goal objective', error?.message ?? error);
90
+ }
91
+ }
92
+
93
+ const namespacePatch = sourceOwnedLinksPatch(metadata) ?? {};
94
+ if (inlineObjective !== null) {
95
+ namespacePatch.goal = { ...namespacePatch.goal, objective: inlineObjective, objectiveFile: false };
96
+ }
97
+ if (Object.keys(namespacePatch).length === 0) return;
98
+ try {
99
+ await writeMetadata(fork.id, { openchamber: namespacePatch });
100
+ } catch (error) {
101
+ console.warn('[fork] failed to update the fork metadata', error?.message ?? error);
102
+ }
103
+ };
@@ -0,0 +1,69 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { applyForkInheritance, sourceOwnedLinksPatch } from './fork-inheritance.js';
3
+
4
+ const goal = (objectiveFile) => ({ id: 'goal_1', objective: objectiveFile ? '' : 'Ship it', objectiveFile, status: 'paused' });
5
+
6
+ const harness = (metadata, overrides = {}) => {
7
+ const deps = {
8
+ readObjective: vi.fn(async () => 'Objective from file'),
9
+ writeObjective: vi.fn(async () => undefined),
10
+ writeMetadata: vi.fn(async () => undefined),
11
+ ...overrides,
12
+ };
13
+ const run = () => applyForkInheritance({ sourceSessionID: 'ses_source', fork: { id: 'ses_fork', metadata }, ...deps });
14
+ return { deps, run };
15
+ };
16
+
17
+ describe('sourceOwnedLinksPatch', () => {
18
+ it('pauses an active goal so the fork does not pursue it in parallel', () => {
19
+ expect(sourceOwnedLinksPatch({ openchamber: { goal: { id: 'g', status: 'active' } } }))
20
+ .toEqual({ goal: { status: 'paused', statusReason: 'paused in fork' } });
21
+ expect(sourceOwnedLinksPatch({ openchamber: { goal: { id: 'g', status: 'complete' } } })).toBeNull();
22
+ });
23
+
24
+ it('removes the btw and review links but keeps the goal', () => {
25
+ expect(sourceOwnedLinksPatch({ openchamber: { goal: goal(false), btwSessionID: 'b', reviewSessionID: 'r' } }))
26
+ .toEqual({ btwSessionID: null, reviewSessionID: null });
27
+ });
28
+
29
+ it('removes the btw marker of a btw source, keeps a review marker', () => {
30
+ expect(sourceOwnedLinksPatch({ openchamber: { kind: 'btw', originalSessionID: 'p', btwBoundaryMessageID: 'm' } }))
31
+ .toEqual({ kind: null, originalSessionID: null, btwBoundaryMessageID: null });
32
+ expect(sourceOwnedLinksPatch({ openchamber: { kind: 'review', originalSessionID: 'p' } })).toBeNull();
33
+ expect(sourceOwnedLinksPatch(undefined)).toBeNull();
34
+ });
35
+ });
36
+
37
+ describe('applyForkInheritance', () => {
38
+ it('does nothing for an inline goal without source links', async () => {
39
+ const h = harness({ openchamber: { goal: goal(false) } });
40
+ await h.run();
41
+ expect(h.deps.readObjective).not.toHaveBeenCalled();
42
+ expect(h.deps.writeMetadata).not.toHaveBeenCalled();
43
+ });
44
+
45
+ it('copies a file-backed objective and strips source links', async () => {
46
+ const h = harness({ openchamber: { goal: goal(true), btwSessionID: 'b' } });
47
+ await h.run();
48
+ expect(h.deps.readObjective).toHaveBeenCalledWith('ses_source');
49
+ expect(h.deps.writeObjective).toHaveBeenCalledWith('ses_fork', 'Objective from file');
50
+ expect(h.deps.writeMetadata).toHaveBeenCalledWith('ses_fork', { openchamber: { btwSessionID: null } });
51
+ });
52
+
53
+ it('inlines the objective when the file copy fails', async () => {
54
+ const h = harness({ openchamber: { goal: goal(true) } }, {
55
+ writeObjective: vi.fn(async () => { throw new Error('disk full'); }),
56
+ });
57
+ await h.run();
58
+ expect(h.deps.writeMetadata).toHaveBeenCalledWith('ses_fork', {
59
+ openchamber: { goal: { objective: 'Objective from file', objectiveFile: false } },
60
+ });
61
+ });
62
+
63
+ it('swallows a metadata write failure', async () => {
64
+ const h = harness({ openchamber: { reviewSessionID: 'r' } }, {
65
+ writeMetadata: vi.fn(async () => { throw new Error('offline'); }),
66
+ });
67
+ await expect(h.run()).resolves.toBeUndefined();
68
+ });
69
+ });
@@ -9,7 +9,9 @@ import { AUTO_MODEL_REF, isAutoModel } from '../routing/defaults.js';
9
9
  import { parseScheduledCommandPrompt } from '../scheduled-tasks/runtime.js';
10
10
  import { buildGoalIntroText, createSessionGoal } from '../session-goal/create.js';
11
11
  import { OpenChamberControlError, asControlError } from '../openchamber-control/error.js';
12
+ import { readObjective, writeObjective } from '../session-goal/objectives.js';
12
13
  import { createArchiveStore } from './archive-store.js';
14
+ import { applyForkInheritance } from './fork-inheritance.js';
13
15
  import { createOpenCodeClient as defaultCreateOpenCodeClient } from './opencode-client.js';
14
16
  import { createSessionMetadataStore, createOpenCodeSessionMetadata } from './session-metadata-store.js';
15
17
 
@@ -889,6 +891,15 @@ export const createOpenChamberSessionService = (dependencies) => {
889
891
  messageID: asNonEmptyString(payload.messageId) || undefined,
890
892
  });
891
893
  targetSessionID = targetSession.id;
894
+ // Before the prompt goes out, so a goal armed by this dispatch writes
895
+ // over the copied objective rather than the other way round.
896
+ await applyForkInheritance({
897
+ sourceSessionID,
898
+ fork: targetSession,
899
+ readObjective,
900
+ writeObjective,
901
+ writeMetadata: (sessionID, patch) => writeMetadata(sessionID, patch, directory),
902
+ });
892
903
  }
893
904
 
894
905
  const baselineAssistantMessageId = await latestCompletedAssistantMessageID({
@@ -920,6 +920,24 @@ describe('openchamber session routes', () => {
920
920
  }));
921
921
  });
922
922
 
923
+ it('strips source-owned links from a fork before dispatching', async () => {
924
+ sessionForkMock.mockImplementationOnce(async () => ({
925
+ id: 'ses_fork',
926
+ title: 'Forked session',
927
+ metadata: { openchamber: { btwSessionID: 'ses_btw', reviewSessionID: 'ses_review', assist: { recap: 'kept' } } },
928
+ }));
929
+ const { app, sessionMetadataStore } = createApp();
930
+ sessionMetadataStore.entries.set('ses_fork', {
931
+ openchamber: { btwSessionID: 'ses_btw', reviewSessionID: 'ses_review', assist: { recap: 'kept' } },
932
+ });
933
+ await request(app)
934
+ .post('/api/openchamber/sessions/ses_source/fork')
935
+ .send({ directory: '/repo/app', prompt: 'Carry on', model: 'openai/gpt-5.5', agent: 'build' })
936
+ .expect(200);
937
+
938
+ expect(sessionMetadataStore.entries.get('ses_fork')).toEqual({ openchamber: { assist: { recap: 'kept' } } });
939
+ });
940
+
923
941
  it('rejects send and fork requests without a prompt before calling OpenCode', async () => {
924
942
  const { app } = createApp();
925
943
  await request(app)
@@ -10,7 +10,7 @@ This module provides OpenCode server integration utilities for the web server ru
10
10
  - `packages/web/server/lib/opencode/cli-options.js`: CLI/environment option parsing for server startup arguments.
11
11
  - `packages/web/server/lib/opencode/cli-entry-runtime.js`: CLI entrypoint runtime that detects direct execution, parses CLI options, and starts server bootstrap.
12
12
  - `packages/web/server/lib/opencode/routes.js`: OpenCode/provider settings and auth-related route registration.
13
- - `packages/web/server/lib/opencode/v1-migration-topup.js`: re-arms OpenCode's own V1 -> V2 session import for V1 sessions created after that migration already completed; runs only before a managed spawn. See "v1-migration-topup.js" below.
13
+ - `packages/web/server/lib/opencode/v1-migration-topup.js`: re-arms OpenCode's own V1 -> V2 session import for V1 sessions changed by 1.x after the last completed import; runs only before a managed spawn. See "v1-migration-topup.js" below.
14
14
  - `packages/web/server/lib/opencode/lifecycle.js`: OpenCode process lifecycle runtime (startup, restart, readiness, health monitoring). After readiness it warms the most recently used directories (`getWarmupDirectories` dep, sequential and best-effort) because OpenCode initializes each directory lazily on first request and that cost would otherwise be paid by the user's first interactive session open.
15
15
  - `packages/web/server/lib/opencode/provider-env-aliases.js`: mirrors known provider credential env aliases into the managed OpenCode process environment (for example `GEMINI_API_KEY` → `GOOGLE_GENERATIVE_AI_API_KEY`) so OpenCode connection detection and the upstream AI SDK agree on the same key names. Canonical implementation shared by web lifecycle and the VS Code managed spawn path (`packages/vscode/src/provider-env-aliases.ts` re-exports this module).
16
16
  - `packages/web/server/lib/opencode/env-runtime.js`: OpenCode CLI/binary resolution and shell environment runtime.
@@ -150,13 +150,14 @@ with the same loader strategy as `credential-db.js` — `node:sqlite` on Node,
150
150
  and logs one line; there is no HTTP route and no UI.
151
151
 
152
152
  What it does: when the migration row says `completed` and some `session` rows
153
- have no `session_v2` twin AND were created after the migration completed
154
- (`time_created` past the row's `time_updated`), it sets the row to
155
- `{"phase":"sessions","cursor":…}`. The time test matters because a v2 delete
156
- leaves the legacy row behind (`Session.remove` publishes `session.deleted`,
157
- `bus.remove` then wipes that session's durable events, `session_v2` cascades):
158
- a legacy session the migration already walked and that is absent now was
159
- deleted, not missed, and is never re-imported.
153
+ have no `session_v2` twin AND were changed by 1.x after the last completed
154
+ import (`session.time_updated` past the row's `time_updated`, which OpenCode
155
+ stamps on completion), it sets the row to `{"phase":"sessions","cursor":…}`.
156
+ The time test matters because a v2 delete leaves the legacy row behind
157
+ (`Session.remove` publishes `session.deleted`, `bus.remove` then wipes that
158
+ session's durable events, `session_v2` cascades), and only OpenCode 1.x writes
159
+ the legacy table: when nobody ran 1.x since the last import, nothing qualifies
160
+ and the top-up skips, so sessions deleted in v2 stay deleted.
160
161
  The cursor is the largest missing id plus `U+FFFF`, because OpenCode's loop
161
162
  walks `id < cursor` in descending id order and ids are fixed width, so nothing
162
163
  real can fall between an id and that cursor. Ids are compared the way SQLite
@@ -165,7 +166,7 @@ encode time descending in a field that wraps, so id order is **not** time
165
166
  order — an August session can sort far below a newer one, and the code never
166
167
  assumes otherwise.
167
168
 
168
- Two hard rules, both verified against v2.0.8
169
+ Hard rules, verified against v2.0.8 (the completion stamp against v2.0.16)
169
170
  `packages/core/src/database/v1-migration.bun.ts`:
170
171
 
171
172
  - **Never clear or delete the `migration.v1-v2` row.** With no row at all
@@ -180,11 +181,10 @@ Two hard rules, both verified against v2.0.8
180
181
  `compaction`). Any hit and nothing is written: the outcome is `unsafe`
181
182
  (`revisited-sessions-have-v2-activity`) and a single warning names how many
182
183
  sessions stay missing.
183
- - **Never resurrect a session deleted in v2.** OpenCode's loop walks every
184
- legacy row under the cursor, so a deleted session sorting below a
185
- never-imported one would come back. The top-up refuses that too
186
- (`unsafe`, `deleted-sessions-would-return`); the never-imported sessions
187
- then stay missing until upstream offers an import route.
184
+ - **Only 1.x activity triggers an import** (maintainer, 2026-09-24). When 1.x
185
+ was used again, OpenCode's loop still walks every legacy row under the
186
+ cursor, so a deleted session sorting below a fresh one comes back with it;
187
+ avoiding that needs an upstream import route that takes explicit ids.
188
188
 
189
189
  ## Public exports (providers.js)
190
190
  - `getProviderSources(providerId, workingDirectory)`: Resolves which OpenCode config layers define a provider.
@@ -231,8 +231,8 @@ Two hard rules, both verified against v2.0.8
231
231
  `upgrade`, without a shell or client-supplied arguments. OpenCode chooses the
232
232
  installer. Web, hosted mobile, Capacitor, and Desktop with a separately installed
233
233
  CLI use this server path. VS Code uses the same executor from its extension host.
234
- Bundled Desktop, external URL connections, unavailable CLIs, and the Windows
235
- ARM64 workaround remain unsupported at the host boundary.
234
+ Bundled Desktop, external URL connections, and unavailable CLIs remain
235
+ unsupported at the host boundary.
236
236
 
237
237
  An upgrade leaves the current server running. The toast's Reload action restarts
238
238
  it using the installed version. Failed installations return an error and can be
@@ -244,7 +244,11 @@ limit, and the VS Code bridge does not apply its usual 30-second request timeout
244
244
  ### Migrating an installed v1 CLI
245
245
 
246
246
  `GET /api/opencode/compatibility` reads the local CLI version without starting
247
- its server, or probes an external server's JSON version contract. A confirmed
247
+ its server, or probes an external server's JSON version contract (`/api/info`,
248
+ then v1's `/global/health` even when the first probe fails or hangs). When
249
+ `OPENCODE_HOST`/`OPENCODE_PORT` points at a server that identifies as v1 or a
250
+ 2.x below the minimum, startup attaches to it as external and not ready rather
251
+ than spawning a managed instance, so this check reports its version. A confirmed
248
252
  managed v1 CLI on macOS, Linux or Windows (x64/arm64) advertises `canInstall`;
249
253
  bundled binaries and external connections do not.
250
254
 
@@ -253,8 +257,8 @@ across concurrent clients. `v2-install.js` resolves a validated stable v2
253
257
  release from npm. On macOS/Linux it downloads the official
254
258
  `https://opencode.ai/v2/install` script and runs it with that release and
255
259
  `--no-modify-path`. That script is bash, so on Windows it downloads the npm
256
- platform package the script would fetch, `@opencode/cli-windows-x64-baseline`
257
- (arm64 too, like the desktop bundle), checks it against the `sha512` integrity
260
+ platform package the script would fetch (`@opencode/cli-windows-arm64` on
261
+ arm64, `@opencode/cli-windows-x64-baseline` on x64, like the desktop bundle), checks it against the `sha512` integrity
258
262
  npm publishes, and unpacks `opencode.exe` with the system `tar.exe`. Both
259
263
  paths then verify the resulting executable.
260
264
  It installs into the host user's standard `~/.opencode/bin`. Existing npm/Bun
@@ -916,8 +920,12 @@ through the process environment, because an environment variable cannot change
916
920
  under a running child.
917
921
 
918
922
  - Contract: the managed child gets `OPENCODE_CONFIG=<data-dir>/opencode.managed.json`.
919
- The file contains only `plugins`, holding the absolute directory of every
920
- OpenChamber plugin currently switched on. Its layer sits above the user's
923
+ The file contains only `plugins`: `-opencode.browser` first, then the absolute
924
+ directory of every OpenChamber plugin currently switched on. OpenCode's
925
+ built-in browser tools need OpenCode's own desktop app to attach a browser;
926
+ OpenChamber does not, so they would always fail with `browser.disconnected`
927
+ and steer agents away from `openchamber_web`. A project config listing
928
+ `opencode.browser` re-enables it. The fallback path merges the same entry. Its layer sits above the user's
921
929
  global `opencode.json` and below their project config.
922
930
  - `OPENCODE_CONFIG_CONTENT` is passed through untouched, so whatever the user
923
931
  put there still applies.
@@ -925,7 +933,8 @@ under a running child.
925
933
  always in the child environment, including while every managed tool is off —
926
934
  a tool switched on later then reaches a process that can already call back.
927
935
  - `persistSettings` rewrites the file (temp + rename) whenever
928
- `agentControlToolEnabled`, `agentWebToolEnabled` or `agentMemoryToolEnabled`
936
+ `agentControlToolEnabled`, `agentWebToolEnabled`, `agentMemoryToolEnabled` or
937
+ `agentNotifyToolEnabled`
929
938
  changes. Plugin directories are written before the
930
939
  file names them, and a disabled plugin is removed from the list. OpenCode
931
940
  reloads within a couple of seconds; no restart is involved.
@@ -1,3 +1,5 @@
1
+ import { registerNotificationEmitRoutes } from '../notifications/emit-route.js';
2
+
1
3
  export const createBootstrapRuntime = (dependencies) => {
2
4
  const {
3
5
  createUiAuth,
@@ -63,6 +65,7 @@ export const createBootstrapRuntime = (dependencies) => {
63
65
  getCachedZenModels,
64
66
  setAutoAcceptSession,
65
67
  agentToolRuntime,
68
+ pluginNotificationEmitter,
66
69
  desktopUpdater,
67
70
  } = options;
68
71
 
@@ -94,6 +97,13 @@ export const createBootstrapRuntime = (dependencies) => {
94
97
 
95
98
  registerAgentToolRoutes(app, { express, agentToolRuntime });
96
99
 
100
+ const notificationEmitRoutes = registerNotificationEmitRoutes(app, {
101
+ express,
102
+ isAgentToolRequestAuthorized: (req) => agentToolRuntime?.authorizeRequest?.(req) === true,
103
+ emitter: pluginNotificationEmitter,
104
+ });
105
+ notificationEmitRoutes.registerPluginRoute();
106
+
97
107
  registerAuthAndAccessRoutes(app, {
98
108
  express,
99
109
  tunnelAuthController,
@@ -110,6 +120,8 @@ export const createBootstrapRuntime = (dependencies) => {
110
120
  normalizeTunnelSessionTtlMs,
111
121
  });
112
122
 
123
+ notificationEmitRoutes.registerApiRoute();
124
+
113
125
  registerTtsRoutes(app, { sayTTSCapability });
114
126
 
115
127
  registerNotificationRoutes(app, {
@@ -63,13 +63,16 @@ export const requireOpenCodeV2 = async (launch, options) => {
63
63
 
64
64
  // External URLs have no local executable. A legacy probe identifies v1 only
65
65
  // from its JSON contract; neither HTML fallbacks nor auth failures imply v1.
66
+ // v1 has no `/api/info`: its catch-all serves the web UI, and a v1 build
67
+ // without the embedded UI proxies that path to app.opencode.ai, which can hang
68
+ // or fail. A failed v2 probe therefore still falls through to the v1 probe.
66
69
  export const readExternalOpenCodeVersion = async (baseUrl, headers, fetchImpl = fetch) => {
67
70
  const request = (pathname) => fetchImpl(new URL(pathname, baseUrl), {
68
71
  headers: { ...headers, Accept: 'application/json' }, redirect: 'error', signal: AbortSignal.timeout(5000),
69
72
  });
70
- const response = await request('/api/info');
71
- if (response.status === 401 || response.status === 403) return null;
72
- const info = await readOpenCodeInfo(response);
73
+ const response = await request('/api/info').catch(() => null);
74
+ if (response && (response.status === 401 || response.status === 403)) return null;
75
+ const info = response ? await readOpenCodeInfo(response) : null;
73
76
  if (info) return info.version;
74
77
  const legacy = await request('/global/health');
75
78
  if (!legacy.ok) return null;
@@ -30,6 +30,14 @@ describe('OpenCode compatibility', () => {
30
30
  expect(requests).toEqual(['/api/info', '/global/health']);
31
31
  });
32
32
 
33
+ it('still identifies v1 when its /api/info fallback hangs or fails', async () => {
34
+ const fetchImpl = async (url) => {
35
+ if (url.pathname === '/api/info') throw new DOMException('The operation timed out.', 'TimeoutError');
36
+ return Response.json({ healthy: true, version: '1.18.32' });
37
+ };
38
+ expect(await readExternalOpenCodeVersion('http://localhost:4096', {}, fetchImpl)).toBe('1.18.32');
39
+ });
40
+
33
41
  it.each([401, 403])('does not call an auth failure v1 (%s)', async (status) => {
34
42
  let requests = 0;
35
43
  expect(await readExternalOpenCodeVersion('http://localhost:4096', {}, async () => {
@@ -162,6 +162,7 @@ export function deleteMcpEntry(config: Record<string, unknown>, name: string): b
162
162
  export function toProviderPackage(value: unknown): string | undefined;
163
163
  export function toNpmPackage(value: unknown): string | undefined;
164
164
  export function toProviderEntity(raw: unknown): ProviderEntity;
165
+ export function readStoredProviderEntry(configs: unknown[], providerId: string): ProviderEntity | null;
165
166
 
166
167
  export function toPluginEntity(raw: unknown): PluginEntity | null;
167
168
  export function fromPluginEntity(entity: unknown): string | PluginEntity | null;
@@ -171,6 +172,7 @@ export function readPluginList(config: unknown): Array<{ entry: PluginEntity; ke
171
172
  export type WebSearchSelection = false | string | null;
172
173
  export function parseWebSearchSelection(value: unknown): WebSearchSelection | undefined;
173
174
  export function writeWebSearchSelection(config: Record<string, unknown>, selection: WebSearchSelection): boolean;
175
+ export function writeWarmingEnabled(config: Record<string, unknown>, enabled: boolean): boolean;
174
176
  export interface WebSearchConfigLayers {
175
177
  userConfig: object | null;
176
178
  projectConfig: object | null;
@@ -668,6 +668,28 @@ function toProviderEntity(raw) {
668
668
  ]);
669
669
  }
670
670
 
671
+ /**
672
+ * The provider entry an editor should start from: the winning config layer's
673
+ * stored entry (layers passed highest precedence first) in v2 shape, without
674
+ * the literal `settings.apiKey` secret. Returns null when no layer defines it.
675
+ * Unlike the live provider OpenCode serves, this carries `env` and only the
676
+ * reasoning levels the user wrote.
677
+ */
678
+ function readStoredProviderEntry(configs, providerId) {
679
+ for (const config of configs) {
680
+ const { value } = readSectionEntry(config, 'providers', providerId);
681
+ if (value === undefined) continue;
682
+ const entity = toProviderEntity(value);
683
+ if (entity.settings && 'apiKey' in entity.settings) {
684
+ const { apiKey: _secret, ...settings } = entity.settings;
685
+ if (Object.keys(settings).length) entity.settings = settings;
686
+ else delete entity.settings;
687
+ }
688
+ return entity;
689
+ }
690
+ return null;
691
+ }
692
+
671
693
  // ============== PLUGINS ==============
672
694
 
673
695
  const PLUGIN_SECTION = { v2: 'plugins', v1: 'plugin' };
@@ -742,6 +764,24 @@ function writeWebSearchSelection(config, selection) {
742
764
  return JSON.stringify(config.websearch) !== before;
743
765
  }
744
766
 
767
+ // ============== SESSION WARMING ==============
768
+
769
+ /**
770
+ * The `warming` key: `true` keeps idle sessions' prompt cache warm with
771
+ * OpenCode's defaults, an object tunes prompt/interval/duration. Turning it on
772
+ * keeps a hand-tuned object as is; turning it off removes the key (OpenCode's
773
+ * default is off). Returns whether the config changed.
774
+ */
775
+ function writeWarmingEnabled(config, enabled) {
776
+ const before = JSON.stringify(config.warming);
777
+ if (!enabled) {
778
+ delete config.warming;
779
+ } else if (typeof config.warming !== 'object' || config.warming === null) {
780
+ config.warming = true;
781
+ }
782
+ return JSON.stringify(config.warming) !== before;
783
+ }
784
+
745
785
  const hasWebSearchKey = (config) => config != null && Object.hasOwn(config, 'websearch');
746
786
 
747
787
  /**
@@ -792,10 +832,12 @@ export {
792
832
  toProviderPackage,
793
833
  toNpmPackage,
794
834
  toProviderEntity,
835
+ readStoredProviderEntry,
795
836
  toPluginEntity,
796
837
  fromPluginEntity,
797
838
  readPluginList,
798
839
  parseWebSearchSelection,
799
840
  writeWebSearchSelection,
800
841
  findWebSearchProjectOverride,
842
+ writeWarmingEnabled,
801
843
  };
@@ -9,6 +9,7 @@ import {
9
9
  parseModelSelection,
10
10
  formatModelSelection,
11
11
  toAgentEntity,
12
+ writeWarmingEnabled,
12
13
  fromAgentEntity,
13
14
  isLegacyAgentFrontmatter,
14
15
  toCommandEntity,
@@ -464,3 +465,19 @@ describe('findWebSearchProjectOverride', () => {
464
465
  expect(findWebSearchProjectOverride(layers(), [{ path: userPath, config: { websearch: false } }])).toBeNull();
465
466
  });
466
467
  });
468
+
469
+ describe('session warming', () => {
470
+ it('turns warming on and off, keeping a hand-tuned object', () => {
471
+ const config = { model: 'openai/gpt-5' };
472
+ expect(writeWarmingEnabled(config, true)).toBe(true);
473
+ expect(config.warming).toBe(true);
474
+ expect(writeWarmingEnabled(config, true)).toBe(false);
475
+ expect(writeWarmingEnabled(config, false)).toBe(true);
476
+ expect(config).toEqual({ model: 'openai/gpt-5' });
477
+ expect(writeWarmingEnabled(config, false)).toBe(false);
478
+
479
+ const tuned = { warming: { interval: '3 minutes' } };
480
+ expect(writeWarmingEnabled(tuned, true)).toBe(false);
481
+ expect(tuned.warming).toEqual({ interval: '3 minutes' });
482
+ });
483
+ });
@@ -94,6 +94,7 @@ export const registerServerStatusRoutes = (app, dependencies) => {
94
94
  'api.health.v1',
95
95
  'api.runtime-url.v1',
96
96
  'api.raw-file.v1',
97
+ 'api.notifications.emit.v1',
97
98
  'realtime.sse.v1',
98
99
  'realtime.websocket.global-events.v1',
99
100
  'terminal.websocket.v1',
@@ -1093,6 +1094,8 @@ export const registerCommonRequestMiddleware = (app, dependencies) => {
1093
1094
  req.path.startsWith('/api/config/settings') ||
1094
1095
  req.path.startsWith('/api/config/skills') ||
1095
1096
  req.path.startsWith('/api/config/plugins') ||
1097
+ req.path.startsWith('/api/config/websearch') ||
1098
+ req.path.startsWith('/api/config/warming') ||
1096
1099
  req.path.startsWith('/api/projects') ||
1097
1100
  req.path.startsWith('/api/fs') ||
1098
1101
  req.path.startsWith('/api/git') ||
@@ -127,6 +127,21 @@ describe('core-routes', () => {
127
127
  expect(response.body).toEqual({ body: { content: 'Snippet body' } });
128
128
  });
129
129
 
130
+ it('should parse JSON bodies for the web search config route', async () => {
131
+ const app = express();
132
+ registerCommonRequestMiddleware(app, { express });
133
+ app.put('/api/config/websearch', (req, res) => {
134
+ res.json({ body: req.body });
135
+ });
136
+
137
+ const response = await request(app)
138
+ .put('/api/config/websearch')
139
+ .send({ selection: 'random' })
140
+ .expect(200);
141
+
142
+ expect(response.body).toEqual({ body: { selection: 'random' } });
143
+ });
144
+
130
145
  it('should parse JSON bodies for custom provider upsert routes', async () => {
131
146
  const app = express();
132
147
  registerCommonRequestMiddleware(app, { express });
@@ -698,15 +698,8 @@ export const createOpenCodeEnvRuntime = (deps) => {
698
698
  ];
699
699
 
700
700
  const getWindowsNativeOpencodePackageNames = () => {
701
- // TEMPORARY WORKAROUND — Windows ARM64: native opencode.exe fails with a Bun
702
- // FFI/TinyCC dlopen error (https://github.com/anomalyco/opencode/issues/19130).
703
- // prepare-opencode-cli.mjs bundles x64-baseline instead; match that here so
704
- // the runtime resolver looks for the same x64-baseline package. Restore the
705
- // arm64 branch below when the upstream issue is resolved.
706
701
  if (process.arch === 'arm64') {
707
- // --- ORIGINAL (restore when ARM64 is fixed) ---
708
- // return ['@opencode/cli-windows-arm64', 'opencode-windows-arm64'];
709
- return WINDOWS_X64_NATIVE_PACKAGES;
702
+ return [path.join('@opencode', 'cli-windows-arm64'), 'opencode-windows-arm64'];
710
703
  }
711
704
  if (process.arch === 'x64') {
712
705
  // Prefer the baseline build when bypassing package-manager wrappers so the
@@ -103,6 +103,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
103
103
  createFsSearchRuntime,
104
104
  openchamberDataDir,
105
105
  onGuestDeactivated,
106
+ surfaceViewerHeaders,
106
107
  openchamberUserConfigRoot,
107
108
  managedChatsRoot,
108
109
  normalizeDirectoryPath,
@@ -331,7 +332,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
331
332
  registerGitHubRoutes(app);
332
333
  registerLinearRoutes(app);
333
334
  await registerBuiltInGuests({ persistPath: extensionsPersistPath(openchamberDataDir), root: routeDependencies.builtInExtensionsDir });
334
- registerGuestRoutes(app, { openchamberDataDir, openchamberVersion, resolveGitBinaryForSpawn, resolveOptionalProjectDirectory, getSmallModelService, onGuestDeactivated });
335
+ registerGuestRoutes(app, { openchamberDataDir, openchamberVersion, resolveGitBinaryForSpawn, resolveOptionalProjectDirectory, getSmallModelService, onGuestDeactivated, surfaceViewerHeaders });
335
336
  registerGitRoutes(app, {
336
337
  emitWorktreeChanged: ({ directories, at }) => {
337
338
  const clients = getOpenChamberEventClients();