@openchambery/web 1.19.7-beta.9 → 1.19.7

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 (201) hide show
  1. package/dist/assets/AgentAvatar-CX0a1rKE.js +1 -0
  2. package/dist/assets/AssistantView-nVF0kdFh.js +2 -0
  3. package/dist/assets/DiagramView-B2UtQ8mw.js +1 -0
  4. package/dist/assets/FadeInOnReveal-CK4asqVR.js +1 -0
  5. package/dist/assets/Icon-BYM02QyU.js +1 -0
  6. package/dist/assets/MarkdownLoadingSkeleton-DWs4Jg7b.js +3 -0
  7. package/dist/assets/MarkdownRenderer-DT_GN1Ex.js +2 -0
  8. package/dist/assets/MarkdownRendererImpl-Cslh4XN_.js +7 -0
  9. package/dist/assets/MarkstreamRendererImpl-CsNwy1T5.css +1 -0
  10. package/dist/assets/MarkstreamRendererImpl-Ymm12x6J.js +1 -0
  11. package/dist/assets/MobileDetailNavigation-DD29ENgU.js +1 -0
  12. package/dist/assets/MobileShareBridge-CrTe_QND.js +4 -0
  13. package/dist/assets/MobileSurface-DjxchpUC.js +2 -0
  14. package/dist/assets/{MultiRunWindow-Ohj6UbWj.js → MultiRunWindow-jG5dCEMH.js} +1 -1
  15. package/dist/assets/OnboardingScreen-C3-wzeSX.js +1 -0
  16. package/dist/assets/OverlayScrollbar-KUpvYHdv.js +2 -0
  17. package/dist/assets/SettingsView-UKlEewdq.js +25 -0
  18. package/dist/assets/{SettingsWindow-B4lzhAbO.js → SettingsWindow-DO1aAplT.js} +1 -1
  19. package/dist/assets/TerminalView-BG1UPLsz.js +8 -0
  20. package/dist/assets/ToolOutputDialog-CWr5eVTK.js +10 -0
  21. package/dist/assets/appThemeRegistry-BI5drVpC.js +1 -0
  22. package/dist/assets/{button-z0GOBtWi.js → button-C0cth9tl.js} +1 -1
  23. package/dist/assets/clipboard-DJ4nQEuY.js +1 -0
  24. package/dist/assets/{collapsible-D9zJRpeB.js → collapsible-DFT9cE80.js} +1 -1
  25. package/dist/assets/context-menu-CAp74NfV.js +1 -0
  26. package/dist/assets/desktopHosts-CWxex1c3.js +1 -0
  27. package/dist/assets/desktopRelayRestore-9EbBYQ9s.js +1 -0
  28. package/dist/assets/{diagram-CoEqmReY.js → diagram-BryzMuta.js} +1 -1
  29. package/dist/assets/{dialog-x2hirWBd.js → dialog-CgbV5ljg.js} +1 -1
  30. package/dist/assets/dropdown-menu.styles-Bzo6L3FH.js +1 -0
  31. package/dist/assets/{es-C8Sqjsia.js → es-BHqnSjoZ.js} +1 -1
  32. package/dist/assets/fileQueries-BY-9OWzp.js +1 -0
  33. package/dist/assets/fileReferenceActions-BJJtX_S5.js +1 -0
  34. package/dist/assets/{fr-p-Zwm_j2.js → fr-BfrlJY9i.js} +1 -1
  35. package/dist/assets/{gitApi-CtS4kWoo.js → gitApi-D9hFlE3T.js} +3 -3
  36. package/dist/assets/{input-BG3VWTIF.js → input-DFLpqjGR.js} +1 -1
  37. package/dist/assets/insertionBoundaries-D2L7D0Oe.js +4 -0
  38. package/dist/assets/{ja-B6REu1qP.js → ja-DP-7qt-x.js} +1 -1
  39. package/dist/assets/{ko-CJBNH9IZ.js → ko-E2B5vGQP.js} +1 -1
  40. package/dist/assets/main-BRedOs_V.js +169 -0
  41. package/dist/assets/main-DlXpJ0Vw.js +2 -0
  42. package/dist/assets/markdown-worker-BuveaH3O.js +1 -0
  43. package/dist/assets/markdownTheme-CzZm3riB.js +2 -0
  44. package/dist/assets/miniChat-CBLbFpfy.js +2 -0
  45. package/dist/assets/mobile-CoZsWdWk.js +2 -0
  46. package/dist/assets/multirun-BF-I0r2_.js +4 -0
  47. package/dist/assets/outsideFileGrants-DnplRxr-.js +1 -0
  48. package/dist/assets/path-utils-jGozTg9d.js +1 -0
  49. package/dist/assets/persistence-DdUac14I.js +3 -0
  50. package/dist/assets/{pl-B2cBI_7K.js → pl-r8X5gRM5.js} +1 -1
  51. package/dist/assets/platform-B4KKLnZ5.js +2 -0
  52. package/dist/assets/projectMeta-2t4L5_4a.js +3 -0
  53. package/dist/assets/{pt-BR-CrCc9hmt.js → pt-BR-DcpdXCf5.js} +1 -1
  54. package/dist/assets/renderElectronMiniChatApp-fl7O3iHy.js +2 -0
  55. package/dist/assets/renderMobileApp-CKYDwf4U.js +28 -0
  56. package/dist/assets/runtimeConfig-B4eb4ZiU.js +2 -0
  57. package/dist/assets/runtimeEndpointReset-BHuTYyzc.js +147 -0
  58. package/dist/assets/sessionChangeSummary-DOq8EN_H.js +1 -0
  59. package/dist/assets/sessionLookup-DNc0ZeR3.js +1 -0
  60. package/dist/assets/sortable-tabs-strip-C8_9kHqu.js +1 -0
  61. package/dist/assets/src-DasvfkEg.css +2 -0
  62. package/dist/assets/{store-CL3WP48T.js → store-BDFdnk6l.js} +2 -2
  63. package/dist/assets/terminalApi-947l7Ra3.js +1 -0
  64. package/dist/assets/textarea-Cgo_nWUU.js +1 -0
  65. package/dist/assets/toolHelpers-DEvVP9U0.js +2 -0
  66. package/dist/assets/{tooltip-CtH61mQh.js → tooltip-BifLJ8o0.js} +1 -1
  67. package/dist/assets/{uk-C8YKAz0x.js → uk-Di0vl9V-.js} +1 -1
  68. package/dist/assets/url-Pk6tQ1EZ.js +1 -0
  69. package/dist/assets/{ChatContainer-CDExXwgn.js → useAppFontEffects-Dle8xs5h.js} +44 -39
  70. package/dist/assets/useAssistantUIStore-me6s63b2.js +1 -0
  71. package/dist/assets/useDesktopWindowControlsLayout-_QAwKcQn.js +1 -0
  72. package/dist/assets/useEffectiveDirectory-BSyuAgz6.js +1 -0
  73. package/dist/assets/useFontPreferences-BCOBlaAd.js +1 -0
  74. package/dist/assets/useMobileNavigationStore-f8xHJk7C.js +413 -0
  75. package/dist/assets/useSessionAutoCleanup-BHiXaW0J.js +1 -0
  76. package/dist/assets/useUIStore-CuaA8-Hp.js +1 -0
  77. package/dist/assets/useWorkerHighlightedLines-DuvXTSm_.js +7 -0
  78. package/dist/assets/utils-BiK3tBGM.js +1 -0
  79. package/dist/assets/{vendor-markstream-react-CwvbEg9R.js → vendor-markstream-react-C3K8YH0d.js} +4 -4
  80. package/dist/assets/{zh-CN-CCYwUnmB.js → zh-CN-coFCfeQE.js} +1 -1
  81. package/dist/assets/{zh-TW-D8Y6py08.js → zh-TW-oDRZ1-yb.js} +1 -1
  82. package/dist/index.html +9 -11
  83. package/dist/mini-chat.html +9 -11
  84. package/dist/mobile.html +15 -17
  85. package/package.json +2 -1
  86. package/server/index.js +2 -0
  87. package/server/lib/assistant-delivery-parts.js +3 -1
  88. package/server/lib/assistant-delivery-parts.test.js +11 -0
  89. package/server/lib/assistants/DOCUMENTATION.md +76 -3
  90. package/server/lib/assistants/assign.js +225 -0
  91. package/server/lib/assistants/assign.test.js +118 -0
  92. package/server/lib/assistants/bubbles.js +45 -0
  93. package/server/lib/assistants/bubbles.test.js +36 -0
  94. package/server/lib/assistants/cards.js +148 -0
  95. package/server/lib/assistants/cards.test.js +116 -0
  96. package/server/lib/assistants/contact-store.js +284 -0
  97. package/server/lib/assistants/contact-store.test.js +131 -0
  98. package/server/lib/assistants/contact-tools.js +761 -0
  99. package/server/lib/assistants/contact-tools.test.js +328 -0
  100. package/server/lib/assistants/contracts.js +20 -1
  101. package/server/lib/assistants/harness.js +551 -0
  102. package/server/lib/assistants/harness.test.js +607 -0
  103. package/server/lib/assistants/routes.js +44 -4
  104. package/server/lib/assistants/service.js +930 -17
  105. package/server/lib/assistants/service.test.js +1163 -45
  106. package/server/lib/event-stream/DOCUMENTATION.md +12 -1
  107. package/server/lib/event-stream/directory-ws-bridge.js +11 -2
  108. package/server/lib/event-stream/global-ws-bridge.js +19 -3
  109. package/server/lib/event-stream/protocol.js +11 -1
  110. package/server/lib/event-stream/reasoning-projection.js +425 -0
  111. package/server/lib/event-stream/reasoning-projection.test.js +300 -0
  112. package/server/lib/event-stream/runtime.js +10 -0
  113. package/server/lib/event-stream/runtime.test.js +53 -0
  114. package/server/lib/llm/DOCUMENTATION.md +84 -0
  115. package/server/lib/llm/catalog.js +100 -0
  116. package/server/lib/llm/catalog.test.js +78 -0
  117. package/server/lib/llm/completions.js +151 -0
  118. package/server/lib/llm/completions.test.js +127 -0
  119. package/server/lib/llm/generate.js +570 -0
  120. package/server/lib/llm/generate.test.js +459 -0
  121. package/server/lib/llm/routes.js +47 -0
  122. package/server/lib/llm/temp-directory.js +37 -0
  123. package/server/lib/notifications/APNS.md +19 -13
  124. package/server/lib/notifications/DOCUMENTATION.md +4 -3
  125. package/server/lib/notifications/runtime.js +148 -37
  126. package/server/lib/notifications/runtime.test.js +100 -0
  127. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  128. package/server/lib/opencode/feature-routes-runtime.js +30 -0
  129. package/server/lib/opencode/feature-routes-runtime.test.js +20 -0
  130. package/server/lib/opencode/proxy.js +103 -9
  131. package/server/lib/opencode/proxy.test.js +177 -1
  132. package/server/lib/opencode/settings-runtime.js +2 -2
  133. package/server/lib/relay/reasoning-projection.e2e.test.ts +529 -0
  134. package/server/lib/session-goal/DOCUMENTATION.md +8 -1
  135. package/server/lib/session-goal/runtime.js +20 -0
  136. package/server/lib/session-index/DOCUMENTATION.md +3 -1
  137. package/server/lib/session-index/service.js +10 -4
  138. package/server/lib/session-index/service.test.js +37 -0
  139. package/server/lib/session-title/runtime.js +1 -0
  140. package/server/lib/session-title/runtime.test.js +11 -0
  141. package/server/lib/session-turn-pages/DOCUMENTATION.md +2 -1
  142. package/server/lib/session-turn-pages/routes.js +22 -3
  143. package/server/lib/session-turn-pages/routes.test.js +43 -0
  144. package/server/lib/transcript-cache/DOCUMENTATION.md +2 -2
  145. package/server/lib/transcript-cache/routes.js +9 -2
  146. package/server/lib/transcript-cache/routes.test.js +32 -0
  147. package/dist/assets/AgentAvatar-Di8F4QJh.js +0 -1
  148. package/dist/assets/AssistantView-DSxVAAb_.js +0 -1
  149. package/dist/assets/ContextPanel-DgwEIdqR.js +0 -285
  150. package/dist/assets/DiagramView-BKQO61y8.js +0 -1
  151. package/dist/assets/FadeInOnReveal-CV2s6YN8.js +0 -1
  152. package/dist/assets/Icon-CLpn1mIz.js +0 -1
  153. package/dist/assets/MarkdownRendererImpl-CTgmghSh.js +0 -7
  154. package/dist/assets/MarkstreamRendererImpl-BKsc-avF.js +0 -1
  155. package/dist/assets/MarkstreamRendererImpl-CxeWpDCK.css +0 -1
  156. package/dist/assets/MobileDetailNavigation-BcA6rd8Q.js +0 -1
  157. package/dist/assets/MobileShareBridge-w6T2ZrsW.js +0 -4
  158. package/dist/assets/MobileSurface-CG1n7v0h.js +0 -2
  159. package/dist/assets/OnboardingScreen-D6rtE7rj.js +0 -1
  160. package/dist/assets/OverlayScrollbar-DlNZho3q.js +0 -2
  161. package/dist/assets/SettingsView-CiF3r83e.js +0 -25
  162. package/dist/assets/TerminalView-Ctx_Jt_b.js +0 -8
  163. package/dist/assets/ToolOutputDialog-Dv9_fUYl.js +0 -10
  164. package/dist/assets/appThemeRegistry-DnwUIQB9.js +0 -2
  165. package/dist/assets/clipboard-D35XSwID.js +0 -1
  166. package/dist/assets/desktop-CfLlmafK.js +0 -1
  167. package/dist/assets/desktopHosts-C1Ns3DUu.js +0 -1
  168. package/dist/assets/desktopRelayRestore-8pvI_dSc.js +0 -1
  169. package/dist/assets/fileQueries-DGHZqZHc.js +0 -1
  170. package/dist/assets/insertionBoundaries-hK4mQj4W.js +0 -4
  171. package/dist/assets/main-BmbZFoO4.js +0 -29
  172. package/dist/assets/main-BwNhn8ml.js +0 -2
  173. package/dist/assets/markdown-worker-y3ewaqAK.js +0 -4
  174. package/dist/assets/markdownTheme-SPe4jOwX.js +0 -2
  175. package/dist/assets/miniChat-BN89siC3.js +0 -2
  176. package/dist/assets/mobile-DE9rVo5D.js +0 -2
  177. package/dist/assets/multirun-BiEuyDq3.js +0 -4
  178. package/dist/assets/persistence-w-AiX2i4.js +0 -3
  179. package/dist/assets/platform-4eCmsdol.js +0 -2
  180. package/dist/assets/projectMeta-DSLKcH1a.js +0 -3
  181. package/dist/assets/radio-HD5AB2Qf.js +0 -1
  182. package/dist/assets/renderElectronMiniChatApp-f_UxpFjv.js +0 -2
  183. package/dist/assets/renderMobileApp-BAhCai6d.js +0 -28
  184. package/dist/assets/runtime-switch-BkpTTbEi.js +0 -1
  185. package/dist/assets/runtimeConfig-qG_oNBoa.js +0 -2
  186. package/dist/assets/runtimeEndpointReset-BDeKD3EM.js +0 -4
  187. package/dist/assets/shikiHighlight-BphLZnac.js +0 -1
  188. package/dist/assets/sortable-tabs-strip-CNDgyX0B.js +0 -1
  189. package/dist/assets/src-DZt1nWf5.css +0 -2
  190. package/dist/assets/terminalApi-CGtOtc8I.js +0 -1
  191. package/dist/assets/url-KeihbE0d.js +0 -1
  192. package/dist/assets/useAppFontEffects--0dwVTSm.js +0 -7
  193. package/dist/assets/useAssistantUIStore-I0VWrB5V.js +0 -1
  194. package/dist/assets/useDesktopWindowControlsLayout-DsbeBLvv.js +0 -1
  195. package/dist/assets/useEffectiveDirectory-CHvvohcG.js +0 -1
  196. package/dist/assets/useFontPreferences-BLZ3y6mN.js +0 -1
  197. package/dist/assets/useMobileNavigationStore-peTDuC00.js +0 -412
  198. package/dist/assets/useSessionAutoCleanup-D_ZC9E5g.js +0 -1
  199. package/dist/assets/useUIStore-CNLmCoPU.js +0 -1
  200. package/dist/assets/useWorkerHighlightedLines-B1YzuMYR.js +0 -7
  201. package/dist/assets/utils-CTL16t2f.js +0 -1
@@ -47,9 +47,20 @@ export const createNotificationTriggerRuntime = (deps) => {
47
47
  return pendingPushTags.size;
48
48
  };
49
49
 
50
+ const stringifyApnsData = (data) => {
51
+ if (!data || typeof data !== 'object') return undefined;
52
+ const next = {};
53
+ for (const [key, value] of Object.entries(data)) {
54
+ if (typeof value !== 'string' || value.length === 0) continue;
55
+ next[key] = value;
56
+ }
57
+ return Object.keys(next).length > 0 ? next : undefined;
58
+ };
59
+
50
60
  // Generic notification for native push (per the mobile design): a fixed, scenario-based
51
61
  // title + the session name as the body. No model/project/message content crosses the relay.
52
62
  // Title strings are localized per device token locale inside sendApnsToAllUiSessions.
63
+ // Contact turns opt out via preserveAlert — those keep nickname + spoken text.
53
64
  const toApnsGenericPayload = (payload) => {
54
65
  const data = payload?.data && typeof payload.data === 'object' ? payload.data : {};
55
66
  const sessionName = typeof data.sessionName === 'string' && data.sessionName.trim().length > 0
@@ -66,15 +77,39 @@ export const createNotificationTriggerRuntime = (deps) => {
66
77
  };
67
78
  };
68
79
 
80
+ const toApnsContactPayload = (payload) => {
81
+ const data = payload?.data && typeof payload.data === 'object' ? payload.data : {};
82
+ const title = typeof payload?.title === 'string' && payload.title.trim()
83
+ ? payload.title.trim()
84
+ : 'Assistant';
85
+ const body = typeof payload?.body === 'string' ? payload.body : '';
86
+ return {
87
+ title,
88
+ body,
89
+ badge: trackPushAndCountBadge(typeof payload?.tag === 'string' ? payload.tag : undefined),
90
+ tag: payload?.tag,
91
+ data: stringifyApnsData({
92
+ assistantID: data.assistantID,
93
+ url: typeof data.assistantID === 'string' && data.assistantID.trim()
94
+ ? `openchamber://assistant/${encodeURIComponent(data.assistantID.trim())}`
95
+ : (typeof data.url === 'string' ? data.url : undefined),
96
+ }),
97
+ };
98
+ };
99
+
69
100
  // Fan a notification out to every delivery channel: browser web-push (full templated
70
- // payload) and native iOS APNs (generic model-based text). Both share the dedup tag;
71
- // a failure in one channel must not block the other. Visibility on any other client
72
- // never suppresses delivery — every subscribed surface gets the push.
73
- const fanoutPush = (payload, options) => Promise.all([
101
+ // payload) and native iOS APNs (generic model-based text, unless preserveAlert).
102
+ // Both share the dedup tag; a failure in one channel must not block the other.
103
+ // Visibility on any other client never suppresses delivery — every subscribed
104
+ // surface gets the push.
105
+ const fanoutPush = (payload, options = {}) => Promise.all([
74
106
  Promise.resolve(sendPushToAllUiSessions?.(payload, options)).catch((error) => {
75
107
  console.warn('[Push] web-push fanout failed:', error?.message ?? error);
76
108
  }),
77
- Promise.resolve(sendApnsToAllUiSessions?.(toApnsGenericPayload(payload), options)).catch((error) => {
109
+ Promise.resolve(sendApnsToAllUiSessions?.(
110
+ options.preserveAlert === true ? toApnsContactPayload(payload) : toApnsGenericPayload(payload),
111
+ options,
112
+ )).catch((error) => {
78
113
  console.warn('[APNs] fanout failed:', error?.message ?? error);
79
114
  }),
80
115
  ]);
@@ -97,6 +132,8 @@ export const createNotificationTriggerRuntime = (deps) => {
97
132
 
98
133
  const sessionMetaCache = new Map();
99
134
  const SESSION_META_CACHE_TTL_MS = 60 * 1000;
135
+ const HIDDEN_SESSION_TITLES = new Set(['smartfetch-secondary']);
136
+ const nonEmptySystemID = (value) => typeof value === 'string' && value.length > 0;
100
137
 
101
138
  // Sessions where the client has enabled Permission Auto-Accept. Mirrored
102
139
  // from the client-side permissionStore via POST /api/notifications/auto-accept
@@ -148,32 +185,47 @@ export const createNotificationTriggerRuntime = (deps) => {
148
185
  smallModelPurpose: meta.smallModelPurpose !== undefined
149
186
  ? meta.smallModelPurpose
150
187
  : (previous?.smallModelPurpose ?? null),
188
+ assistantID: meta.assistantID !== undefined ? meta.assistantID : (previous?.assistantID ?? null),
189
+ assignedFrom: meta.assignedFrom !== undefined ? meta.assignedFrom : (previous?.assignedFrom ?? null),
190
+ scheduledTaskID: meta.scheduledTaskID !== undefined
191
+ ? meta.scheduledTaskID
192
+ : (previous?.scheduledTaskID ?? null),
193
+ title: meta.title !== undefined ? meta.title : (previous?.title ?? null),
194
+ complete: meta.complete === true || previous?.complete === true,
151
195
  at: Date.now(),
152
196
  });
153
197
  };
154
198
 
155
- const getParentIdFromPayload = (payload) => {
156
- if (!payload || typeof payload !== 'object') return undefined;
157
- if (payload.type !== 'session.created' && payload.type !== 'session.updated') return undefined;
158
- return normalizeParentID(payload.properties?.info?.parentID);
159
- };
160
-
161
- const getSmallModelPurposeFromPayload = (payload) => {
162
- if (!payload || typeof payload !== 'object') return undefined;
163
- if (payload.type !== 'session.created' && payload.type !== 'session.updated') return undefined;
164
- return normalizeSmallModelPurpose(payload.properties?.info?.metadata?.openchamber?.smallModel?.purpose);
199
+ const metaFromOpenchamber = (openchamber, extras = {}) => {
200
+ const assignedFrom = typeof openchamber?.assigned?.from === 'string'
201
+ ? openchamber.assigned.from
202
+ : null;
203
+ return {
204
+ smallModelPurpose: normalizeSmallModelPurpose(openchamber?.smallModel?.purpose),
205
+ assistantID: nonEmptySystemID(openchamber?.assistant?.assistantID)
206
+ ? openchamber.assistant.assistantID
207
+ : null,
208
+ assignedFrom,
209
+ scheduledTaskID: nonEmptySystemID(openchamber?.scheduledTask?.taskID)
210
+ ? openchamber.scheduledTask.taskID
211
+ : null,
212
+ ...extras,
213
+ };
165
214
  };
166
215
 
167
216
  const maybeCacheSessionMetaFromPayload = (payload) => {
217
+ if (!payload || typeof payload !== 'object') return;
218
+ if (payload.type !== 'session.created' && payload.type !== 'session.updated') return;
219
+ const info = payload.properties?.info;
220
+ if (!info || typeof info !== 'object') return;
168
221
  const sessionId = extractSessionIdFromPayload(payload);
169
222
  if (typeof sessionId !== 'string' || sessionId.length === 0) return;
170
223
  const directory = extractDirectoryFromPayload(payload);
171
- const parentID = getParentIdFromPayload(payload);
172
- const smallModelPurpose = getSmallModelPurposeFromPayload(payload);
173
- if (parentID === undefined && smallModelPurpose === undefined) return;
174
224
  setCachedSessionMeta(sessionId, directory, {
175
- ...(parentID !== undefined ? { parentID } : {}),
176
- ...(smallModelPurpose !== undefined ? { smallModelPurpose } : {}),
225
+ parentID: normalizeParentID(info.parentID),
226
+ title: typeof info.title === 'string' ? info.title : null,
227
+ complete: true,
228
+ ...metaFromOpenchamber(info.metadata?.openchamber),
177
229
  });
178
230
  };
179
231
 
@@ -181,7 +233,7 @@ export const createNotificationTriggerRuntime = (deps) => {
181
233
  if (!sessionId) return undefined;
182
234
 
183
235
  const cached = getCachedSessionMeta(sessionId, directory);
184
- if (cached !== undefined) return cached;
236
+ if (cached?.complete) return cached;
185
237
 
186
238
  try {
187
239
  const base = buildOpenCodeUrl(`/session/${encodeURIComponent(sessionId)}`, '');
@@ -195,21 +247,23 @@ export const createNotificationTriggerRuntime = (deps) => {
195
247
  signal: AbortSignal.timeout(2000),
196
248
  });
197
249
  if (!response.ok) {
198
- return undefined;
250
+ return cached;
199
251
  }
200
252
  const session = await response.json().catch(() => null);
201
253
  if (!session || typeof session !== 'object') {
202
- return undefined;
254
+ return cached;
203
255
  }
204
256
 
205
257
  const meta = {
206
258
  parentID: normalizeParentID(session.parentID),
207
- smallModelPurpose: normalizeSmallModelPurpose(session.metadata?.openchamber?.smallModel?.purpose),
259
+ title: typeof session.title === 'string' ? session.title : null,
260
+ complete: true,
261
+ ...metaFromOpenchamber(session.metadata?.openchamber),
208
262
  };
209
263
  setCachedSessionMeta(sessionId, directory, meta);
210
- return meta;
264
+ return getCachedSessionMeta(sessionId, directory) ?? meta;
211
265
  } catch {
212
- return undefined;
266
+ return cached;
213
267
  }
214
268
  };
215
269
 
@@ -234,20 +288,25 @@ export const createNotificationTriggerRuntime = (deps) => {
234
288
  return false;
235
289
  };
236
290
 
237
- const isSubtaskSession = async (sessionId, directory) => {
238
- const parentID = await fetchSessionParentId(sessionId, directory);
239
- return typeof parentID === 'string' && parentID.length > 0;
240
- };
241
-
242
- const isSmallModelSession = async (sessionId, directory) => {
243
- const meta = await fetchSessionMeta(sessionId, directory);
244
- return typeof meta?.smallModelPurpose === 'string' && meta.smallModelPurpose.length > 0;
291
+ const isHiddenFromNavSession = (meta) => {
292
+ if (!meta) return false;
293
+ if (typeof meta.parentID === 'string' && meta.parentID.length > 0) return true;
294
+ if (typeof meta.smallModelPurpose === 'string' && meta.smallModelPurpose.length > 0) return true;
295
+ if (typeof meta.assistantID === 'string' && meta.assistantID.length > 0 && meta.assignedFrom !== 'contact') {
296
+ return true;
297
+ }
298
+ if (typeof meta.scheduledTaskID === 'string' && meta.scheduledTaskID.length > 0) return true;
299
+ if (typeof meta.title === 'string' && HIDDEN_SESSION_TITLES.has(meta.title)) return true;
300
+ return false;
245
301
  };
246
302
 
303
+ // Only sessions that can appear as sidebar roots get ordinary push. Child /
304
+ // subagent sessions, archived Assistant bindings, scheduled-task sessions,
305
+ // small-model system sessions, and SmartFetch secondaries are excluded.
306
+ // Contact-assigned worker sessions stay visible and still notify.
247
307
  const shouldSkipSystemSessionNotification = async (sessionId, directory) => {
248
- if (await isSubtaskSession(sessionId, directory)) return true;
249
- if (await isSmallModelSession(sessionId, directory)) return true;
250
- return false;
308
+ const meta = await fetchSessionMeta(sessionId, directory);
309
+ return isHiddenFromNavSession(meta);
251
310
  };
252
311
 
253
312
  const extractSessionIdFromPayload = (payload) => {
@@ -693,6 +752,57 @@ export const createNotificationTriggerRuntime = (deps) => {
693
752
  );
694
753
  };
695
754
 
755
+ const contactNotificationTitle = (name) => {
756
+ if (typeof name !== 'string' || !name.trim()) return 'Assistant';
757
+ const stripped = name.replace(/^(?:\p{Extended_Pictographic}|\p{Regional_Indicator}|[\uFE0F\u200D])+\s*/u, '').trim();
758
+ return stripped || name.trim();
759
+ };
760
+
761
+ const sendContactTurnNotification = async ({ assistantID, name, body, status } = {}) => {
762
+ if (typeof assistantID !== 'string' || !assistantID.trim()) return;
763
+ const settings = await readSettingsFromDisk();
764
+ if (settings.notifyOnCompletion === false) return;
765
+
766
+ const title = contactNotificationTitle(name);
767
+ const rawBody = typeof body === 'string' ? body : '';
768
+ let text = '';
769
+ try {
770
+ text = await prepareNotificationLastMessage({ message: rawBody, settings });
771
+ } catch {
772
+ text = '';
773
+ }
774
+ if (!text) text = status === 'error' ? 'Something went wrong' : 'New message';
775
+ const tag = `contact-${assistantID.trim()}`;
776
+
777
+ if (settings.nativeNotificationsEnabled) {
778
+ const notificationPayload = {
779
+ title,
780
+ body: text,
781
+ tag,
782
+ kind: 'contact',
783
+ assistantID: assistantID.trim(),
784
+ requireHidden: false,
785
+ };
786
+ const desktopNotificationDelivered = emitDesktopNotification(notificationPayload);
787
+ broadcastUiNotification(notificationPayload, { desktopNotificationDelivered });
788
+ }
789
+
790
+ const assistantPath = `/assistant/${encodeURIComponent(assistantID.trim())}`;
791
+ await fanoutPush(
792
+ {
793
+ title,
794
+ body: text,
795
+ tag,
796
+ data: {
797
+ url: assistantPath,
798
+ assistantID: assistantID.trim(),
799
+ type: 'contact',
800
+ },
801
+ },
802
+ { requireNoSse: true, preserveAlert: true },
803
+ );
804
+ };
805
+
696
806
  return {
697
807
  maybeSendPushForTrigger,
698
808
  setAutoAcceptSession,
@@ -700,5 +810,6 @@ export const createNotificationTriggerRuntime = (deps) => {
700
810
  setGetIsSessionAutoAccepting,
701
811
  clearPendingPushBadge,
702
812
  sendGoalSettlePush,
813
+ sendContactTurnNotification,
703
814
  };
704
815
  };
@@ -175,6 +175,58 @@ describe('notification trigger runtime smallModel suppression', () => {
175
175
  expect(emitDesktopNotification).toHaveBeenCalledTimes(1);
176
176
  expect(sendPushToAllUiSessions).toHaveBeenCalledTimes(1);
177
177
  });
178
+
179
+ it('skips ready notifications for child sessions', async () => {
180
+ vi.stubGlobal('fetch', vi.fn(async () => jsonResponse({
181
+ id: 'ses_child',
182
+ parentID: 'ses_parent',
183
+ title: 'Fixer',
184
+ metadata: {},
185
+ })));
186
+ const { runtime, emitDesktopNotification, sendPushToAllUiSessions } = createRuntime();
187
+ await runtime.maybeSendPushForTrigger(completionPayload('ses_child'));
188
+ expect(emitDesktopNotification).not.toHaveBeenCalled();
189
+ expect(sendPushToAllUiSessions).not.toHaveBeenCalled();
190
+ });
191
+
192
+ it('skips ready notifications for Assistant binding sessions', async () => {
193
+ vi.stubGlobal('fetch', vi.fn(async () => jsonResponse({
194
+ id: 'ses_binding',
195
+ parentID: null,
196
+ title: '大小白',
197
+ metadata: { openchamber: { assistant: { assistantID: 'asst_1', name: '大小白' } } },
198
+ })));
199
+ const { runtime, emitDesktopNotification, sendPushToAllUiSessions } = createRuntime();
200
+ await runtime.maybeSendPushForTrigger(completionPayload('ses_binding'));
201
+ expect(emitDesktopNotification).not.toHaveBeenCalled();
202
+ expect(sendPushToAllUiSessions).not.toHaveBeenCalled();
203
+ });
204
+
205
+ it('skips ready notifications for scheduled-task sessions', async () => {
206
+ vi.stubGlobal('fetch', vi.fn(async () => jsonResponse({
207
+ id: 'ses_sched',
208
+ parentID: null,
209
+ title: 'Nightly',
210
+ metadata: { openchamber: { scheduledTask: { taskID: 'task_1' } } },
211
+ })));
212
+ const { runtime, emitDesktopNotification, sendPushToAllUiSessions } = createRuntime();
213
+ await runtime.maybeSendPushForTrigger(completionPayload('ses_sched'));
214
+ expect(emitDesktopNotification).not.toHaveBeenCalled();
215
+ expect(sendPushToAllUiSessions).not.toHaveBeenCalled();
216
+ });
217
+
218
+ it('still notifies contact-assigned worker sessions that appear in the sidebar', async () => {
219
+ vi.stubGlobal('fetch', vi.fn(async () => jsonResponse({
220
+ id: 'ses_worker',
221
+ parentID: null,
222
+ title: 'Assigned work',
223
+ metadata: { openchamber: { assigned: { from: 'contact', assistantID: 'asst_1', name: '大小白' } } },
224
+ })));
225
+ const { runtime, emitDesktopNotification, sendPushToAllUiSessions } = createRuntime();
226
+ await runtime.maybeSendPushForTrigger(completionPayload('ses_worker'));
227
+ expect(emitDesktopNotification).toHaveBeenCalledTimes(1);
228
+ expect(sendPushToAllUiSessions).toHaveBeenCalledTimes(1);
229
+ });
178
230
  });
179
231
 
180
232
  const rootSessionResponse = () => jsonResponse({
@@ -199,6 +251,54 @@ const completionPayload = (sessionId = 'ses_root', finish = 'stop') => ({
199
251
  },
200
252
  });
201
253
 
254
+ describe('contact turn notifications', () => {
255
+ it('sends an SMS-style title and body when a contact turn completes', async () => {
256
+ const { runtime, emitDesktopNotification, broadcastUiNotification, sendPushToAllUiSessions, sendApnsToAllUiSessions } = createRuntime();
257
+ await runtime.sendContactTurnNotification({
258
+ assistantID: 'asst_1',
259
+ name: '大小白',
260
+ body: '我去找一下',
261
+ status: 'complete',
262
+ });
263
+ expect(emitDesktopNotification).toHaveBeenCalledWith(expect.objectContaining({
264
+ title: '大小白',
265
+ body: '我去找一下',
266
+ tag: 'contact-asst_1',
267
+ kind: 'contact',
268
+ assistantID: 'asst_1',
269
+ }));
270
+ expect(broadcastUiNotification).toHaveBeenCalled();
271
+ expect(sendPushToAllUiSessions).toHaveBeenCalledWith(expect.objectContaining({
272
+ title: '大小白',
273
+ body: '我去找一下',
274
+ data: expect.objectContaining({ assistantID: 'asst_1', type: 'contact', url: '/assistant/asst_1' }),
275
+ }), expect.objectContaining({ requireNoSse: true, preserveAlert: true }));
276
+ expect(sendApnsToAllUiSessions).toHaveBeenCalledWith(expect.objectContaining({
277
+ title: '大小白',
278
+ body: '我去找一下',
279
+ data: expect.objectContaining({
280
+ assistantID: 'asst_1',
281
+ url: 'openchamber://assistant/asst_1',
282
+ }),
283
+ }), expect.objectContaining({ preserveAlert: true }));
284
+ expect(sendApnsToAllUiSessions.mock.calls[0][0].type).toBeUndefined();
285
+ });
286
+
287
+ it('skips contact notifications when completion notices are disabled', async () => {
288
+ const { runtime, emitDesktopNotification, sendPushToAllUiSessions } = createRuntime({
289
+ readSettingsFromDisk: vi.fn(async () => ({ ...defaultSettings, notifyOnCompletion: false })),
290
+ });
291
+ await runtime.sendContactTurnNotification({
292
+ assistantID: 'asst_1',
293
+ name: '大小白',
294
+ body: 'hi',
295
+ status: 'complete',
296
+ });
297
+ expect(emitDesktopNotification).not.toHaveBeenCalled();
298
+ expect(sendPushToAllUiSessions).not.toHaveBeenCalled();
299
+ });
300
+ });
301
+
202
302
  describe('notification trigger live activity end', () => {
203
303
  it('ends the live activity on top-level completion and error', async () => {
204
304
  vi.stubGlobal('fetch', vi.fn(async () => rootSessionResponse()));
@@ -377,7 +377,8 @@ When adding or changing Host HTTP APIs that mobile/desktop clients reach over Pr
377
377
  - `registerOpenCodeProxy(app, dependencies)`: registers OpenCode proxy routes and middleware.
378
378
  - `resolveSessionTurnAdmissionRequest(req)`: extracts the directory/session scope for client POST turn endpoints so queue automatic admission can be invalidated without delaying the proxied request.
379
379
  - Owns:
380
- - SSE forwarders: `GET /api/global/event`, `GET /api/event`
380
+ - SSE forwarders: `GET /api/global/event`, `GET /api/event` (optional `includeReasoning=false` parse-filters reasoning events on the Host send path; param never forwarded upstream; enabled path remains byte passthrough)
381
+ - Official session.messages list: `GET /api/session/:sessionID/message` (optional `includeReasoning=false` strips reasoning parts; exact message GET is owned by session-turn-pages)
381
382
  - Session message forwarder: `POST /api/session/:sessionId/message`
382
383
  - Generic `/api/*` forwarding with hop-by-hop header filtering
383
384
  - Windows `/session` merge fallback path behavior
@@ -15,6 +15,7 @@ import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-
15
15
  import { registerConversationRoutes } from '../conversations/routes.js';
16
16
  import { registerSessionTurnPageRoutes } from '../session-turn-pages/routes.js';
17
17
  import { registerAssistantRoutes } from '../assistants/routes.js';
18
+ import { registerLlmRoutes } from '../llm/routes.js';
18
19
  import { registerMessageQueueRoutes } from '../message-queue/routes.js';
19
20
  import { registerSkillRoutes } from './skill-routes.js';
20
21
  import { registerPluginRoutes } from './plugin-routes.js';
@@ -126,6 +127,8 @@ export const createFeatureRoutesRuntime = (dependencies) => {
126
127
  broadcastGlobalUiEvent,
127
128
  globalMessageStreamHub,
128
129
  getServerId,
130
+ sessionIndexService,
131
+ notifyContactTurnComplete,
129
132
  } = routeDependencies;
130
133
 
131
134
  registerSettingsUtilityRoutes(app, {
@@ -215,6 +218,15 @@ export const createFeatureRoutesRuntime = (dependencies) => {
215
218
  getOpenChamberEventClients,
216
219
  writeSseEvent,
217
220
  });
221
+ // Contact turn lifecycle / bubble deltas — same SSE bus, not revision watermark.
222
+ const broadcastContactTurnEvent = createOpenChamberEventBroadcaster({
223
+ getOpenChamberEventClients,
224
+ writeSseEvent,
225
+ });
226
+ registerLlmRoutes(app, {
227
+ buildOpenCodeUrl,
228
+ getOpenCodeAuthHeaders,
229
+ });
218
230
  assistantRoutesRuntime = registerAssistantRoutes(app, {
219
231
  openchamberDataDir,
220
232
  dbPath: path.join(openchamberDataDir, 'assistants.sqlite'),
@@ -222,12 +234,30 @@ export const createFeatureRoutesRuntime = (dependencies) => {
222
234
  getOpenCodeAuthHeaders,
223
235
  getServerId,
224
236
  getAllowedRoots: () => assistantAllowedRoots,
237
+ listProjects: async () => {
238
+ const settings = await readSettingsFromDiskMigrated();
239
+ return sanitizeProjects(settings?.projects ?? [])
240
+ .filter((project) => project && typeof project.id === 'string' && typeof project.path === 'string')
241
+ .map((project) => ({
242
+ id: project.id,
243
+ path: project.path,
244
+ ...(typeof project.label === 'string' && project.label.trim()
245
+ ? { label: project.label.trim() }
246
+ : {}),
247
+ }));
248
+ },
249
+ listScheduledTasks: (projectID) => projectConfigRuntime.listScheduledTasks(projectID),
250
+ sessionIndexService,
251
+ upsertScheduledTask: (projectID, task) => projectConfigRuntime.upsertScheduledTask(projectID, task),
252
+ syncScheduledTaskProject: (projectID) => scheduledTasksRuntime.syncProject(projectID),
225
253
  refreshAllowedRoots: refreshAssistantAllowedRoots,
226
254
  globalEventHub: globalMessageStreamHub,
227
255
  onRevisionTip: (tip) => broadcastAssistantRevisionTip({
228
256
  type: 'openchamber:assistants-changed',
229
257
  properties: tip,
230
258
  }),
259
+ onContactTurnEvent: (event) => broadcastContactTurnEvent(event),
260
+ onContactTurnComplete: (event) => notifyContactTurnComplete?.(event),
231
261
  });
232
262
  messageQueueRuntime?.setAssistantDeliveryService?.(assistantRoutesRuntime.service);
233
263
 
@@ -3,6 +3,26 @@ import { describe, expect, it, vi } from 'vitest';
3
3
  import { createWorktreeTopologyBroadcaster } from './feature-routes-runtime.js';
4
4
 
5
5
  describe('feature routes runtime composition', () => {
6
+ it('wires scheduled-task upsert into assistant contact tools', async () => {
7
+ const source = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
8
+ expect(source).toMatch(/registerAssistantRoutes\(app, \{[\s\S]*upsertScheduledTask:[\s\S]*projectConfigRuntime\.upsertScheduledTask/);
9
+ expect(source).toMatch(/registerAssistantRoutes\(app, \{[\s\S]*syncScheduledTaskProject:[\s\S]*scheduledTasksRuntime\.syncProject/);
10
+ expect(source).toMatch(/registerAssistantRoutes\(app, \{[\s\S]*listProjects:/);
11
+ expect(source).toMatch(/registerAssistantRoutes\(app, \{[\s\S]*listScheduledTasks:[\s\S]*projectConfigRuntime\.listScheduledTasks/);
12
+ expect(source).toMatch(/registerAssistantRoutes\(app, \{[\s\S]*sessionIndexService/);
13
+ expect(source).toMatch(/label: project\.label\.trim\(\)/);
14
+ });
15
+
16
+ it('fans contact turn events out on the OpenChamber SSE bus separately from revision tips', async () => {
17
+ const source = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
18
+ expect(source).toMatch(/const broadcastContactTurnEvent = createOpenChamberEventBroadcaster\(/);
19
+ expect(source).toMatch(/onContactTurnEvent: \(event\) => broadcastContactTurnEvent\(event\)/);
20
+ expect(source).toMatch(/onContactTurnComplete: \(event\) => notifyContactTurnComplete\?\.\(event\)/);
21
+ expect(source).toMatch(/onRevisionTip: \(tip\) => broadcastAssistantRevisionTip\(\{\s*type: 'openchamber:assistants-changed'/);
22
+ // Contact turn envelopes stay off the assistants-changed revision watermark path.
23
+ expect(source).not.toMatch(/onRevisionTip:[\s\S]*contact-turn/);
24
+ });
25
+
6
26
  it('registers the managed scheduled-task tool route with its required dependencies', async () => {
7
27
  const source = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
8
28
  expect(source).toContain("import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-route.js';");
@@ -11,6 +11,15 @@ import {
11
11
  extractDirectoryFromRequest,
12
12
  isDirectoryTurnAdmissionPath,
13
13
  } from './instance-recovery-runtime.js';
14
+ import {
15
+ createReasoningOutboundFilter,
16
+ createSseBlockSplitter,
17
+ filterSseBlock,
18
+ projectMessagesPayloadForReasoning,
19
+ readIncludeReasoningFromUrl,
20
+ readIncludeReasoningQuery,
21
+ stripIncludeReasoningParam,
22
+ } from '../event-stream/reasoning-projection.js';
14
23
 
15
24
  export const createDirectoryQueryCanonicalizer = ({ realpath, ...cacheOptions } = {}) => {
16
25
  const realpathCache = createRealpathCache({ fallbackOnError: true, realpath, ...cacheOptions });
@@ -379,6 +388,14 @@ export const registerOpenCodeProxy = (app, deps) => {
379
388
  let connectTimedOut = false;
380
389
  let writeQueue = Promise.resolve(true);
381
390
  const sseBoundary = createSseBoundaryTracker();
391
+ const requestUrl = typeof req.originalUrl === 'string' && req.originalUrl.length > 0
392
+ ? req.originalUrl
393
+ : (typeof req.url === 'string' ? req.url : '');
394
+ // OpenChamber projection control — never forwarded to OpenCode.
395
+ const includeReasoning = readIncludeReasoningQuery(req.query)
396
+ && readIncludeReasoningFromUrl(requestUrl);
397
+ const reasoningFilter = includeReasoning ? null : createReasoningOutboundFilter();
398
+ const sseSplitter = includeReasoning ? null : createSseBlockSplitter();
382
399
 
383
400
  req.on('close', closeUpstream);
384
401
 
@@ -400,10 +417,9 @@ export const registerOpenCodeProxy = (app, deps) => {
400
417
  };
401
418
 
402
419
  try {
403
- const requestUrl = typeof req.originalUrl === 'string' && req.originalUrl.length > 0
404
- ? req.originalUrl
405
- : (typeof req.url === 'string' ? req.url : '');
406
- const upstreamPath = requestUrl.startsWith('/api') ? requestUrl.slice(4) || '/' : requestUrl;
420
+ // Strip includeReasoning before building the upstream OpenCode path.
421
+ const strippedUrl = stripIncludeReasoningParam(requestUrl);
422
+ const upstreamPath = strippedUrl.startsWith('/api') ? strippedUrl.slice(4) || '/' : strippedUrl;
407
423
  const headers = normalizeForwardedDirectoryHeaders(
408
424
  collectForwardProxyHeaders(req.headers, getOpenCodeAuthHeaders())
409
425
  );
@@ -495,10 +511,40 @@ export const registerOpenCodeProxy = (app, deps) => {
495
511
  }
496
512
  if (value && value.length > 0) {
497
513
  resetStallTimer();
498
- sseBoundary.observe(value);
499
- const canContinue = await enqueueSseWrite(value);
500
- if (!canContinue) {
501
- break;
514
+ if (includeReasoning) {
515
+ // Enabled path: byte-identical passthrough (existing behavior).
516
+ sseBoundary.observe(value);
517
+ const canContinue = await enqueueSseWrite(value);
518
+ if (!canContinue) {
519
+ break;
520
+ }
521
+ } else {
522
+ // Disabled path: parse SSE blocks, drop reasoning, re-serialize.
523
+ // Preserves id/event lines and GlobalEvent wrap when unchanged drop-only.
524
+ const blocks = sseSplitter.push(value);
525
+ let canContinue = true;
526
+ for (const block of blocks) {
527
+ const filtered = filterSseBlock(block, reasoningFilter);
528
+ if (!filtered) {
529
+ continue;
530
+ }
531
+ sseBoundary.observe(filtered);
532
+ canContinue = await enqueueSseWrite(filtered);
533
+ if (!canContinue) break;
534
+ }
535
+ if (!canContinue) {
536
+ break;
537
+ }
538
+ }
539
+ }
540
+ }
541
+
542
+ if (!includeReasoning && sseSplitter) {
543
+ for (const block of sseSplitter.finish()) {
544
+ const filtered = filterSseBlock(block, reasoningFilter);
545
+ if (filtered) {
546
+ sseBoundary.observe(filtered);
547
+ await enqueueSseWrite(filtered);
502
548
  }
503
549
  }
504
550
  }
@@ -524,6 +570,7 @@ export const registerOpenCodeProxy = (app, deps) => {
524
570
  } finally {
525
571
  clearConnectTimer();
526
572
  clearStallTimer();
573
+ reasoningFilter?.dispose?.();
527
574
  if (heartbeatTimer) {
528
575
  clearTimeout(heartbeatTimer);
529
576
  heartbeatTimer = null;
@@ -584,7 +631,7 @@ export const registerOpenCodeProxy = (app, deps) => {
584
631
 
585
632
  const forwardSanitizedSessionListRequest = async (req, res, next, logLabel) => {
586
633
  try {
587
- const upstreamPath = await getRequestUpstreamPath(req);
634
+ const upstreamPath = stripIncludeReasoningParam(await getRequestUpstreamPath(req));
588
635
  const result = await fetchSessionListPayload(upstreamPath, { req });
589
636
 
590
637
  res.status(result.upstream.status);
@@ -617,6 +664,47 @@ export const registerOpenCodeProxy = (app, deps) => {
617
664
  }
618
665
  };
619
666
 
667
+ /**
668
+ * Official session.messages list (`GET /api/session/:id/message`).
669
+ * When includeReasoning=false, strip reasoning parts from the JSON body.
670
+ * includeReasoning is never forwarded upstream.
671
+ */
672
+ const forwardSessionMessagesListRequest = async (req, res, next) => {
673
+ try {
674
+ const includeReasoning = readIncludeReasoningQuery(req.query);
675
+ const upstreamPath = stripIncludeReasoningParam(await getRequestUpstreamPath(req));
676
+ const result = await fetchSessionListPayload(upstreamPath, { req });
677
+
678
+ res.status(result.upstream.status);
679
+ applyForwardProxyResponseHeaders(result.upstream.headers, res);
680
+
681
+ if (!result.isJson) {
682
+ res.setHeader('content-type', result.contentType);
683
+ res.end(result.bodyText);
684
+ return;
685
+ }
686
+
687
+ if (result.parseError || result.payload == null) {
688
+ res.setHeader('content-type', result.contentType);
689
+ res.end(result.bodyText);
690
+ return;
691
+ }
692
+
693
+ res.setHeader('content-type', result.contentType);
694
+ res.json(projectMessagesPayloadForReasoning(result.payload, includeReasoning));
695
+ } catch (error) {
696
+ if (isAbortError(error)) {
697
+ return;
698
+ }
699
+ console.error('[proxy] OpenCode session.messages proxy error:', error?.message ?? error);
700
+ if (!res.headersSent) {
701
+ res.status(503).json({ error: 'OpenCode service unavailable' });
702
+ return;
703
+ }
704
+ next(error);
705
+ }
706
+ };
707
+
620
708
  // Ensure API prefix is detected before proxying
621
709
  app.use('/api', (_req, _res, next) => {
622
710
  ensureOpenCodeApiPrefix();
@@ -776,6 +864,12 @@ export const registerOpenCodeProxy = (app, deps) => {
776
864
  return forwardSanitizedSessionListRequest(req, res, next, 'session.list');
777
865
  });
778
866
 
867
+ // Official session.messages list (not exact message — that is owned by
868
+ // session-turn-pages and registered before this proxy).
869
+ app.get('/api/session/:sessionID/message', (req, res, next) => {
870
+ return forwardSessionMessagesListRequest(req, res, next);
871
+ });
872
+
779
873
  app.get('/api/global/event', forwardSseRequest);
780
874
  app.get('/api/event', forwardSseRequest);
781
875