@openchamber/web 2.3.2 → 2.3.3

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 (213) hide show
  1. package/dist/assets/{AboutDialog-MZbHWRua.js → AboutDialog-Ctk2zvrv.js} +1 -1
  2. package/dist/assets/{ArchiveView-CkeSWPcI.js → ArchiveView-sbNreasJ.js} +1 -1
  3. package/dist/assets/{CommandPalette-CtKzNzwW.js → CommandPalette-BICwnwAZ.js} +2 -2
  4. package/dist/assets/{DiffView-DaXjHTAq.js → DiffView-B5yeuxv8.js} +1 -1
  5. package/dist/assets/{FilesView-DMNYEydF.js → FilesView-ni2zfAwL.js} +7 -7
  6. package/dist/assets/{GitView-HXttTpUw.js → GitView-C0QgeC9O.js} +3 -3
  7. package/dist/assets/{GuestSurfacePane-KzguENQG.js → GuestSurfacePane-D1gLktSj.js} +1 -1
  8. package/dist/assets/{HelpDialog-9YZGhBgT.js → HelpDialog-CxC6qTaS.js} +1 -1
  9. package/dist/assets/{InProgressOperationBanner-DzGIwGH2.js → InProgressOperationBanner-JFV70YFh.js} +1 -1
  10. package/dist/assets/{JsonTreeView-D9rP8jM8.js → JsonTreeView-RsbV4Usa.js} +1 -1
  11. package/dist/assets/MarkdownRendererImpl-CZK5DoOX.js +1 -0
  12. package/dist/assets/{MemoryDebugPanel-Ct0h3RWh.js → MemoryDebugPanel-caUWOKiz.js} +1 -1
  13. package/dist/assets/{OnboardingScreen-B5Zzb1Mp.js → OnboardingScreen-BDT-J2JP.js} +1 -1
  14. package/dist/assets/{OpenCodeStatusDialog-CXBWWRh8.js → OpenCodeStatusDialog-Cxa2yqOB.js} +1 -1
  15. package/dist/assets/{PatchDiff-DhDAQ5em.js → PatchDiff-C1pnbAsJ.js} +1 -1
  16. package/dist/assets/{PierreDiffViewer-DPa08AmN.js → PierreDiffViewer-D0zX2Msu.js} +1 -1
  17. package/dist/assets/PlanView-BxRCMuGe.js +5 -0
  18. package/dist/assets/{ProjectActionsDialog-DATu0aBc.js → ProjectActionsDialog-D660By4K.js} +1 -1
  19. package/dist/assets/{RunOverview-D6xy_vME.js → RunOverview-C1uTMnQS.js} +2 -2
  20. package/dist/assets/{ScheduledTasksDialog-BWXVnfrf.js → ScheduledTasksDialog-S-gAgo7Z.js} +5 -5
  21. package/dist/assets/SettingsView-CVpfbdob.js +30 -0
  22. package/dist/assets/{SettingsWindow-Cx6TrtY0.js → SettingsWindow-Dd1hHvgh.js} +1 -1
  23. package/dist/assets/SourceBoardView-DbGWAxtS.js +1 -0
  24. package/dist/assets/SpaceAccessDialog-muTSsEJ9.js +1 -0
  25. package/dist/assets/{SpaceApplyDialog-BtuwtlaG.js → SpaceApplyDialog-Dsf6MNGm.js} +1 -1
  26. package/dist/assets/{SpaceRow-MXqvd-dr.js → SpaceRow-7Z6ebRtm.js} +1 -1
  27. package/dist/assets/{SpaceSetupOutput-Uo5LS7Jy.js → SpaceSetupOutput-BytPfCOC.js} +1 -1
  28. package/dist/assets/{SpacesView-DvoOh4sM.js → SpacesView-CYCrlp0D.js} +1 -1
  29. package/dist/assets/{SubmoduleDiffSummary-CyMwDeoP.js → SubmoduleDiffSummary-VrNUbIqF.js} +1 -1
  30. package/dist/assets/{ToolOutputDialog-BaUZIVzc.js → ToolOutputDialog-DHORjBND.js} +7 -7
  31. package/dist/assets/{ToolPartDiffPreview-DmMwdcF4.js → ToolPartDiffPreview-BLAXe7C5.js} +1 -1
  32. package/dist/assets/{UsageStatsView-D7WrDBTC.js → UsageStatsView-BxtYEAa0.js} +1 -1
  33. package/dist/assets/{Virtualizer-CnU8pYMb.js → Virtualizer-Bl4Cf-H-.js} +1 -1
  34. package/dist/assets/{WalkthroughView-r0Ho9F4Z.js → WalkthroughView-B2BJJ4u5.js} +2 -2
  35. package/dist/assets/{WorktreesView-C-t7uxq1.js → WorktreesView-Dv0AO9dF.js} +1 -1
  36. package/dist/assets/{appThemeRegistry-BUY7Ge9i.js → appThemeRegistry-xm_W0svA.js} +1 -1
  37. package/dist/assets/{ar-HauNhDvN.js → ar-Cj8UF12m.js} +4 -4
  38. package/dist/assets/{computeVirtualFileMetrics-CUof18z3.js → computeVirtualFileMetrics-Cx05cmWI.js} +2 -2
  39. package/dist/assets/{de-fEoJ_Yyp.js → de-fSQ1ho01.js} +4 -4
  40. package/dist/assets/{decorate-BkTSGAlD.js → decorate-jpF7GA6t.js} +2 -2
  41. package/dist/assets/{es-CKNTBsZW.js → es-DrdzhSlK.js} +5 -5
  42. package/dist/assets/{fileContentPoller-BJWgy1fX.js → fileContentPoller-C0f20jNG.js} +3 -3
  43. package/dist/assets/{flexokiTheme-BArobfXV.js → flexokiTheme-DKNCYSqL.js} +1 -1
  44. package/dist/assets/{fr-C23655Pi.js → fr-Cmz6Da4q.js} +4 -4
  45. package/dist/assets/{he-CphXS_Fv.js → he-COJRUNy4.js} +4 -4
  46. package/dist/assets/{index-B27cSA9V.js → index-C8Mw8uvl.js} +1 -1
  47. package/dist/assets/{initializeSharedPreferences-CucsmDMw.js → initializeSharedPreferences-U9-v9mfq.js} +1 -1
  48. package/dist/assets/{isDiffPlainText-DSCjvV0m.js → isDiffPlainText-DW43IghW.js} +1 -1
  49. package/dist/assets/{isFilePlainText-C7g4UPox.js → isFilePlainText-Duq5CiuG.js} +1 -1
  50. package/dist/assets/{ja-BmsU2iQe.js → ja-Ce0NvDHZ.js} +4 -4
  51. package/dist/assets/katex-BZNCT55U.css +1 -0
  52. package/dist/assets/katex.min-EZjpSwGK.js +65 -0
  53. package/dist/assets/{ko-CxISpkje.js → ko-BGFcCLLq.js} +4 -4
  54. package/dist/assets/main-BUetg9hg.js +1048 -0
  55. package/dist/assets/{main-CGPiw9fS.js → main-Be_jmIlF.js} +2 -2
  56. package/dist/assets/markdownCore-BkTeS4gA.js +10 -0
  57. package/dist/assets/{miniChat-DVEKVYKe.js → miniChat-g1RgiLLS.js} +2 -2
  58. package/dist/assets/{mobile-Q_FVBe4I.js → mobile-DBli3U-T.js} +2 -2
  59. package/dist/assets/{moveWorkspacePath-CyZJ-2aD.js → moveWorkspacePath-CnYc96Xo.js} +1 -1
  60. package/dist/assets/{nl-jnTBQ_gU.js → nl-Cu1nxo5t.js} +4 -4
  61. package/dist/assets/{parseDiffFromFile-OHXXXyzL.js → parseDiffFromFile-DEjkjYod.js} +3 -3
  62. package/dist/assets/{patchFileDiff-BZrb6h2u.js → patchFileDiff-D__42sau.js} +5 -5
  63. package/dist/assets/{pierreDiffTint-DHf2xvyt.js → pierreDiffTint-3oatL635.js} +4 -4
  64. package/dist/assets/pl-4LdEMgWI.js +20 -0
  65. package/dist/assets/{pt-BR-BfpsFrHv.js → pt-BR-2UbEBNgC.js} +5 -5
  66. package/dist/assets/{relocateRestoredSession-DInneXVI.js → relocateRestoredSession-pkxyd_lV.js} +1 -1
  67. package/dist/assets/renderElectronMiniChatApp-D0tKJFBB.js +2 -0
  68. package/dist/assets/renderMobileApp-D6bOYHuP.js +25 -0
  69. package/dist/assets/{restartOpenCode-DwBaMPJK.js → restartOpenCode-FYqjpaWc.js} +1 -1
  70. package/dist/assets/runtimeEndpointReset-6CNNzem4.js +74 -0
  71. package/dist/assets/{scheduledTasksApi-ClJplEhR.js → scheduledTasksApi-BbnQ4W-W.js} +1 -1
  72. package/dist/assets/{selectionMarkdown-BuveYuup.js → selectionMarkdown-D8QAxC44.js} +1 -1
  73. package/dist/assets/sessionOwnership-BBuf0UCB.js +1 -0
  74. package/dist/assets/{shikiHighlight-DJAESrna.js → shikiHighlight-CweIj1cL.js} +1 -1
  75. package/dist/assets/{space-apply-DWFLwXbI.js → space-apply-CEi013sa.js} +1 -1
  76. package/dist/assets/{space-close-BYDbwdWc.js → space-close-BuStkLrZ.js} +1 -1
  77. package/dist/assets/{spaceNetwork-DHrhfbKM.js → spaceNetwork-tH2d5Mgs.js} +1 -1
  78. package/dist/assets/{textMateThemeFromAppTheme-DcAZmUlv.js → textMateThemeFromAppTheme-DLJBL6al.js} +1 -1
  79. package/dist/assets/tr-Bg0Qt-mG.js +11 -0
  80. package/dist/assets/{uk-C82aEtvs.js → uk-vcnOugr0.js} +5 -5
  81. package/dist/assets/useAppFontEffects-Cs6k0JKv.js +773 -0
  82. package/dist/assets/{useCallableModelProviders-BU_455MN.js → useCallableModelProviders-BsGEzsl2.js} +1 -1
  83. package/dist/assets/{useInlineCommentController-AuUrVz9U.js → useInlineCommentController-CVYaPzfO.js} +2 -2
  84. package/dist/assets/{useRootScrollLock-Cpk7NmBa.js → useRootScrollLock-Dov-44ov.js} +2 -2
  85. package/dist/assets/{vendor-codemirror-language-data-BYGweLoh.js → vendor-codemirror-language-data-DBekkZIx.js} +2 -2
  86. package/dist/assets/vendor-tanstack-react-virtual-Dozz-7fb.js +1 -0
  87. package/dist/assets/vendor-tanstack-virtual-core-DKBj55Em.js +1 -0
  88. package/dist/assets/{vendor-yaml-3778uTud.js → vendor-yaml-CE-D_49-.js} +1 -1
  89. package/dist/assets/{zh-CN-DEq7j9I5.js → zh-CN-C3UhwFsk.js} +5 -5
  90. package/dist/assets/{zh-TW-DgCN99T-.js → zh-TW-D0CmmMvp.js} +5 -5
  91. package/dist/index.html +3 -3
  92. package/dist/mini-chat.html +3 -3
  93. package/dist/mobile.html +3 -3
  94. package/package.json +5 -5
  95. package/server/index.js +13 -1
  96. package/server/lib/agent-memory/actions.js +22 -9
  97. package/server/lib/agent-memory/actions.test.js +57 -0
  98. package/server/lib/agent-memory/runtime.js +8 -5
  99. package/server/lib/agent-tool/DOCUMENTATION.md +17 -1
  100. package/server/lib/agent-tool/runtime.js +41 -7
  101. package/server/lib/agent-tool/runtime.test.js +11 -0
  102. package/server/lib/git/DOCUMENTATION.md +17 -5
  103. package/server/lib/git/lfs-discovery.js +7 -4
  104. package/server/lib/git/lfs-discovery.test.js +60 -0
  105. package/server/lib/git/network-operations.js +9 -3
  106. package/server/lib/git/network-operations.test.js +31 -2
  107. package/server/lib/git/service.js +72 -12
  108. package/server/lib/git/service.test.js +65 -0
  109. package/server/lib/github/DOCUMENTATION.md +1 -0
  110. package/server/lib/github/reference-search.js +49 -18
  111. package/server/lib/github/reference-search.test.js +28 -6
  112. package/server/lib/github/routes.js +87 -1
  113. package/server/lib/github/routes.mutations.test.js +38 -0
  114. package/server/lib/github/routes.test.js +1 -0
  115. package/server/lib/gitlab/DOCUMENTATION.md +4 -0
  116. package/server/lib/gitlab/client.js +23 -0
  117. package/server/lib/gitlab/client.test.js +28 -1
  118. package/server/lib/gitlab/mappers.js +9 -0
  119. package/server/lib/gitlab/resources.js +153 -4
  120. package/server/lib/gitlab/resources.test.js +107 -0
  121. package/server/lib/gitlab/routes.js +120 -1
  122. package/server/lib/gitlab/routes.test.js +59 -0
  123. package/server/lib/markdown-image-grants/DOCUMENTATION.md +4 -0
  124. package/server/lib/markdown-image-grants/routes.js +14 -2
  125. package/server/lib/markdown-image-grants/routes.test.js +23 -0
  126. package/server/lib/notifications/APNS.md +24 -23
  127. package/server/lib/notifications/DOCUMENTATION.md +2 -2
  128. package/server/lib/notifications/apns-runtime.js +8 -5
  129. package/server/lib/notifications/apns-runtime.test.js +26 -0
  130. package/server/lib/notifications/message.js +5 -3
  131. package/server/lib/notifications/message.test.js +9 -0
  132. package/server/lib/notifications/runtime.js +44 -9
  133. package/server/lib/notifications/trigger-runtime.test.js +84 -0
  134. package/server/lib/openchamber-control/DOCUMENTATION.md +6 -1
  135. package/server/lib/openchamber-control/actions.js +18 -2
  136. package/server/lib/openchamber-control/project-knowledge.js +17 -3
  137. package/server/lib/openchamber-control/project-knowledge.test.js +14 -0
  138. package/server/lib/openchamber-control/render-page.js +58 -0
  139. package/server/lib/openchamber-control/service.js +9 -0
  140. package/server/lib/openchamber-control/service.test.js +43 -0
  141. package/server/lib/openchamber-sessions/routes.js +1 -0
  142. package/server/lib/openchamber-sessions/worktree-move.js +26 -10
  143. package/server/lib/openchamber-sessions/worktree-move.test.js +36 -0
  144. package/server/lib/opencode/DOCUMENTATION.md +1 -1
  145. package/server/lib/opencode/managed-config-file.js +3 -2
  146. package/server/lib/opencode/managed-config-file.test.js +20 -6
  147. package/server/lib/opencode/settings-helpers.js +3 -0
  148. package/server/lib/opencode/settings-helpers.test.js +1 -1
  149. package/server/lib/opencode/settings-registry.json +3 -0
  150. package/server/lib/opencode/settings-runtime.js +1 -0
  151. package/server/lib/project-context/DOCUMENTATION.md +25 -1
  152. package/server/lib/project-context/plan-progress.js +69 -0
  153. package/server/lib/project-context/plan-progress.test.js +58 -0
  154. package/server/lib/project-context/routes.http.test.js +22 -0
  155. package/server/lib/project-context/routes.js +20 -0
  156. package/server/lib/project-context/runtime.js +132 -18
  157. package/server/lib/project-context/runtime.test.js +58 -0
  158. package/server/lib/provider-read-cache/index.js +7 -1
  159. package/server/lib/provider-read-cache/index.test.js +12 -0
  160. package/server/lib/relay/DOCUMENTATION.md +17 -1
  161. package/server/lib/session-knowledge/DOCUMENTATION.md +17 -0
  162. package/server/lib/session-knowledge/runtime.js +29 -6
  163. package/server/lib/session-knowledge/runtime.test.js +26 -1
  164. package/server/lib/source-control/audit-storage.js +1 -0
  165. package/server/lib/source-control/mutation-storage.js +3 -0
  166. package/server/lib/spaces/DOCUMENTATION.md +14 -9
  167. package/server/lib/spaces/code-out.js +13 -4
  168. package/server/lib/spaces/code-out.test.js +5 -3
  169. package/server/lib/spaces/dispatcher.js +12 -5
  170. package/server/lib/spaces/dispatcher.test.js +19 -1
  171. package/server/lib/spaces/gatekeeper-channel.js +8 -7
  172. package/server/lib/spaces/gatekeeper-channel.test.js +10 -0
  173. package/server/lib/spaces/gatekeeper-program.cjs +38 -3
  174. package/server/lib/spaces/gatekeeper-program.test.js +20 -0
  175. package/server/lib/spaces/hardening.js +14 -1
  176. package/server/lib/spaces/hardening.test.js +5 -0
  177. package/server/lib/spaces/host-providers.js +165 -0
  178. package/server/lib/spaces/host-providers.test.js +100 -0
  179. package/server/lib/spaces/host.js +16 -4
  180. package/server/lib/spaces/journey.js +87 -17
  181. package/server/lib/spaces/journey.test.js +90 -2
  182. package/server/lib/spaces/layout.js +15 -5
  183. package/server/lib/spaces/places/docker-live-support.js +2 -0
  184. package/server/lib/spaces/places/docker.test.js +2 -0
  185. package/server/lib/spaces/places/fake-docker.js +3 -0
  186. package/server/lib/spaces/places/grants.docker.live.test.js +71 -7
  187. package/server/lib/spaces/routes.js +9 -0
  188. package/server/lib/spaces/routes.test.js +4 -2
  189. package/server/lib/spaces/space-opencode.js +31 -14
  190. package/server/lib/spaces/space-opencode.test.js +15 -2
  191. package/server/lib/spaces/space-records.js +8 -0
  192. package/server/lib/spaces/space-records.test.js +7 -3
  193. package/server/lib/spaces/websocket.test.js +13 -1
  194. package/server/lib/ui-auth/ui-auth.js +28 -3
  195. package/server/lib/ui-auth/ui-auth.test.js +31 -0
  196. package/dist/assets/MarkdownRendererImpl-B2LsA09C.js +0 -1
  197. package/dist/assets/PlanView-Dt5EN_JK.js +0 -5
  198. package/dist/assets/SettingsView-BolP_tuu.js +0 -30
  199. package/dist/assets/SourceBoardView-yca1qvgB.js +0 -1
  200. package/dist/assets/SpaceAccessDialog-CZ-u75py.js +0 -1
  201. package/dist/assets/katex-rNcbfUj4.css +0 -1
  202. package/dist/assets/katex.min-DQ8qF6NR.js +0 -65
  203. package/dist/assets/main-CVHM3_8W.js +0 -1048
  204. package/dist/assets/markdownCore-D5ZOJXeO.js +0 -9
  205. package/dist/assets/pl-Bj-Hy0X5.js +0 -20
  206. package/dist/assets/renderElectronMiniChatApp-B_5BeSF6.js +0 -2
  207. package/dist/assets/renderMobileApp-DGEXUTk-.js +0 -25
  208. package/dist/assets/runtimeEndpointReset-CIpvn8QG.js +0 -59
  209. package/dist/assets/sessionOwnership-BZoGed9N.js +0 -1
  210. package/dist/assets/tr-qMRMBQ8r.js +0 -11
  211. package/dist/assets/useAppFontEffects-Bih1DxXi.js +0 -745
  212. package/dist/assets/vendor-tanstack-react-virtual-CvuLsk7D.js +0 -1
  213. package/dist/assets/vendor-tanstack-virtual-core-DPaNcJcT.js +0 -1
@@ -14,6 +14,7 @@
14
14
 
15
15
  import { asNonEmptyString, isRecord as isObjectRecord } from '../shared/guards.js';
16
16
  import { projectConfigFileStemOf } from '../projects/project-id.js';
17
+ import { createPlanSummaryCache } from './plan-progress.js';
17
18
  import { z } from 'zod';
18
19
 
19
20
  const optionalTextInput = z.string().optional();
@@ -184,17 +185,48 @@ const sanitizePlanLinks = (value, now) => {
184
185
  return result.sort((a, b) => b.createdAt - a.createdAt);
185
186
  };
186
187
 
188
+ /**
189
+ * The session a plan was last sent to with Implement or Improve, keyed by plan
190
+ * id. A map beside the manifest rather than a field on the link, because a
191
+ * plan that only lives in the team's folder has no link to carry it.
192
+ */
193
+ const sanitizePlanSessions = (value) => {
194
+ if (!isObjectRecord(value)) return {};
195
+ const result = {};
196
+ for (const [planId, entry] of Object.entries(value).slice(0, PROJECT_PLAN_MAX_ITEMS)) {
197
+ if (!asNonEmptyString(planId) || !isObjectRecord(entry)) continue;
198
+ const sessionId = asNonEmptyString(entry.sessionId);
199
+ if (!sessionId) continue;
200
+ result[planId] = {
201
+ sessionId,
202
+ linkedAt: Number.isFinite(entry.linkedAt) && entry.linkedAt >= 0 ? entry.linkedAt : 0,
203
+ };
204
+ }
205
+ return result;
206
+ };
207
+
187
208
  const createEmptyContext = () => ({
188
209
  version: PROJECT_CONTEXT_VERSION,
189
210
  notes: [],
190
211
  todos: [],
191
212
  plans: [],
213
+ planSessions: {},
192
214
  });
193
215
 
194
216
  const SHARED_PLAN_ID_PREFIX = 'shared:';
195
217
 
196
218
  const mutationError = (message, status) => Object.assign(new Error(message), { status });
197
219
 
220
+ /** A listed plan with its checklist counts, when it has a checklist. */
221
+ const withProgress = (plan, progress) => (progress ? { ...plan, progress } : plan);
222
+
223
+ const withoutKey = (record, key) => {
224
+ if (!Object.prototype.hasOwnProperty.call(record, key)) return record;
225
+ const next = { ...record };
226
+ delete next[key];
227
+ return next;
228
+ };
229
+
198
230
  const insertTodoBeforeCompleted = (items, item) => {
199
231
  const firstCompletedIndex = items.findIndex((todo) => todo.completed);
200
232
  if (firstCompletedIndex === -1) return [...items, item];
@@ -218,6 +250,8 @@ export const createProjectContextRuntime = (deps) => {
218
250
  ? resolveSharedPlansDir
219
251
  : async () => null;
220
252
 
253
+ const planSummaries = createPlanSummaryCache({ fsPromises, parseTitle: (raw) => parsePlanMarkdown(raw).title });
254
+
221
255
  const idFactory = typeof createId === 'function'
222
256
  ? createId
223
257
  : () => (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
@@ -406,6 +440,7 @@ export const createProjectContextRuntime = (deps) => {
406
440
  notes: sanitizeNotes(migrated.notes, now),
407
441
  todos: sanitizeTodos(migrated.todos, now),
408
442
  plans: sanitizePlanLinks(migrated.plans, now),
443
+ planSessions: {},
409
444
  };
410
445
  }
411
446
  return createEmptyContext();
@@ -416,6 +451,7 @@ export const createProjectContextRuntime = (deps) => {
416
451
  notes: sanitizeNotes(stored.value.notes, now),
417
452
  todos: sanitizeTodos(stored.value.todos, now),
418
453
  plans: sanitizePlanLinks(stored.value.plans, now),
454
+ planSessions: sanitizePlanSessions(stored.value.planSessions),
419
455
  };
420
456
  };
421
457
 
@@ -446,37 +482,67 @@ export const createProjectContextRuntime = (deps) => {
446
482
  if (!entry.isFile() || !PLAN_FILE_PATTERN.test(entry.name)) continue;
447
483
  // Listed under its own id by the manifest entry that moved it there.
448
484
  if (claimedFiles.has(entry.name)) continue;
449
- const filePath = path.join(dir, entry.name);
450
- const [raw, stat] = await Promise.all([fsPromises.readFile(filePath, 'utf8'), fsPromises.stat(filePath)]);
451
- plans.push({
485
+ const summary = await planSummaries.summaryOf(path.join(dir, entry.name));
486
+ // Removed between the directory read and this one.
487
+ if (!summary) continue;
488
+ plans.push(withProgress({
452
489
  id: `${SHARED_PLAN_ID_PREFIX}${entry.name}`,
453
490
  file: entry.name,
454
- title: parsePlanMarkdown(raw).title,
455
- createdAt: Math.round(stat.mtimeMs),
491
+ title: summary.title,
492
+ createdAt: Math.round(summary.mtimeMs),
456
493
  pinned: false,
457
494
  source: 'shared',
458
- });
495
+ }, summary.progress));
459
496
  }
460
497
  plans.sort((left, right) => right.createdAt - left.createdAt);
461
498
  return { dir, plans };
462
499
  };
463
500
 
464
- /** What clients see: the stored context plus the team's shared plans, each marked with its source. */
501
+ /**
502
+ * Progress of one of the user's own plans. The list must not fail because
503
+ * one plan file could not be read, so an unreadable file shows no progress,
504
+ * the same as a plan without a checklist.
505
+ */
506
+ const progressOfLink = async (projectId, link, sharedDir) => {
507
+ const folder = link.shared ? sharedDir : plansDirFor(projectId);
508
+ if (!folder) return null;
509
+ try {
510
+ return (await planSummaries.summaryOf(path.join(folder, link.file)))?.progress ?? null;
511
+ } catch {
512
+ return null;
513
+ }
514
+ };
515
+
516
+ /**
517
+ * What clients see: the stored context plus the team's shared plans, each
518
+ * marked with its source, its checklist progress and the session it was
519
+ * last sent to.
520
+ */
465
521
  const readContext = async (projectId) => {
466
- const stored = await readStoredContext(projectId);
522
+ const { planSessions, ...stored } = await readStoredContext(projectId);
467
523
  const claimed = new Set(stored.plans.filter((plan) => plan.shared).map((plan) => plan.file));
468
524
  const shared = await listSharedPlans(projectId, claimed);
469
- const own = stored.plans
525
+ const own = await Promise.all(stored.plans
470
526
  // A moved plan is only reachable while the project still has a shared folder.
471
527
  .filter((plan) => !plan.shared || shared.dir)
472
- .map(({ shared: isShared, ...plan }) => ({ ...plan, source: isShared ? 'shared' : 'personal' }));
528
+ .map(async ({ shared: isShared, ...plan }) => {
529
+ const progress = await progressOfLink(projectId, { ...plan, shared: isShared }, shared.dir);
530
+ return withProgress({ ...plan, source: isShared ? 'shared' : 'personal' }, progress);
531
+ }));
532
+ const withSession = (plan) => (planSessions[plan.id] ? { ...plan, session: planSessions[plan.id] } : plan);
473
533
  return {
474
534
  ...stored,
475
- plans: [...own, ...shared.plans],
535
+ plans: [...own, ...shared.plans].map(withSession),
476
536
  sharedPlansDir: shared.dir,
477
537
  };
478
538
  };
479
539
 
540
+ /** One plan as clients see it, read back from the committed context. */
541
+ const publicPlanOf = async (projectId, planId) => {
542
+ const context = await readContext(projectId);
543
+ return { plan: context.plans.find((entry) => entry.id === planId) ?? null, context };
544
+ };
545
+
480
546
  /** The folder a manifest plan's file lives in; null for a moved plan when the project lost its shared folder. */
481
547
  const folderOfLink = async (projectId, link) => (link.shared ? sharedPlansDirFor(projectId) : plansDirFor(projectId));
482
548
 
@@ -486,6 +552,7 @@ export const createProjectContextRuntime = (deps) => {
486
552
  notes: context.notes,
487
553
  todos: context.todos,
488
554
  plans: context.plans,
555
+ planSessions: context.planSessions ?? {},
489
556
  });
490
557
  onChanged?.(sanitizeProjectId(projectId));
491
558
  };
@@ -791,8 +858,9 @@ export const createProjectContextRuntime = (deps) => {
791
858
  };
792
859
  await writeContext(projectId, next);
793
860
 
861
+ const { plan, context } = await publicPlanOf(projectId, id);
794
862
  const { shared: isShared, ...publicLink } = nextLink;
795
- return { plan: { ...publicLink, source: isShared ? 'shared' : 'personal' }, context: await readContext(projectId), title: parsed.title, body: parsed.body, raw };
863
+ return { plan: plan ?? { ...publicLink, source: isShared ? 'shared' : 'personal' }, context, title: parsed.title, body: parsed.body, raw };
796
864
  });
797
865
  };
798
866
 
@@ -830,7 +898,8 @@ export const createProjectContextRuntime = (deps) => {
830
898
  const link = { id: idFactory(), file, title, createdAt, pinned: false };
831
899
  const next = { ...current, plans: [link, ...current.plans] };
832
900
  await writeContext(projectId, next);
833
- return { plan: { ...link, source: 'personal' }, context: await readContext(projectId) };
901
+ const { plan, context } = await publicPlanOf(projectId, link.id);
902
+ return { plan: plan ?? { ...link, source: 'personal' }, context };
834
903
  });
835
904
  };
836
905
 
@@ -857,8 +926,9 @@ export const createProjectContextRuntime = (deps) => {
857
926
  const plan = { ...existing, pinned: pinned === true };
858
927
  const next = { ...current, plans: current.plans.map((entry) => (entry.id === id ? plan : entry)) };
859
928
  await writeContext(projectId, next);
929
+ const committed = await publicPlanOf(projectId, id);
860
930
  const { shared: isShared, ...publicPlan } = plan;
861
- return { plan: { ...publicPlan, source: isShared ? 'shared' : 'personal' }, context: await readContext(projectId) };
931
+ return { plan: committed.plan ?? { ...publicPlan, source: isShared ? 'shared' : 'personal' }, context: committed.context };
862
932
  });
863
933
  };
864
934
 
@@ -876,7 +946,12 @@ export const createProjectContextRuntime = (deps) => {
876
946
  const exists = filePath ? await fsPromises.access(filePath).then(() => true, () => false) : false;
877
947
  if (!exists) return { deleted: false, context: await readContext(projectId) };
878
948
  await fsPromises.rm(filePath, { force: true });
879
- onChanged?.(sanitizeProjectId(projectId));
949
+ const current = await readStoredContext(projectId);
950
+ if (current.planSessions[id]) {
951
+ await writeContext(projectId, { ...current, planSessions: withoutKey(current.planSessions, id) });
952
+ } else {
953
+ onChanged?.(sanitizeProjectId(projectId));
954
+ }
880
955
  return { deleted: true, context: await readContext(projectId) };
881
956
  });
882
957
  }
@@ -888,7 +963,11 @@ export const createProjectContextRuntime = (deps) => {
888
963
  return { deleted: false, context: await readContext(projectId) };
889
964
  }
890
965
 
891
- const next = { ...current, plans: current.plans.filter((entry) => entry.id !== id) };
966
+ const next = {
967
+ ...current,
968
+ plans: current.plans.filter((entry) => entry.id !== id),
969
+ planSessions: withoutKey(current.planSessions, id),
970
+ };
892
971
  await writeContext(projectId, next);
893
972
  const folder = await folderOfLink(projectId, link);
894
973
  if (folder) await fsPromises.rm(path.join(folder, link.file), { force: true });
@@ -984,14 +1063,49 @@ export const createProjectContextRuntime = (deps) => {
984
1063
  const plans = ownLink
985
1064
  ? current.plans.map((entry) => (entry.id === id ? link : entry))
986
1065
  : [link, ...current.plans];
987
- await writeContext(projectId, { ...current, plans });
1066
+ // A plan that only lived in the team's folder gets a new id here; the
1067
+ // session it was sent to follows it.
1068
+ const planSessions = !ownLink && current.planSessions[id]
1069
+ ? { ...withoutKey(current.planSessions, id), [link.id]: current.planSessions[id] }
1070
+ : current.planSessions;
1071
+ await writeContext(projectId, { ...current, plans, planSessions });
988
1072
  const { shared: _movedFlag, ...publicLink } = link;
989
- return { plan: { ...publicLink, source: 'personal' }, context: await readContext(projectId) };
1073
+ const committed = await publicPlanOf(projectId, link.id);
1074
+ return { plan: committed.plan ?? { ...publicLink, source: 'personal' }, context: committed.context };
1075
+ });
1076
+ };
1077
+
1078
+ /**
1079
+ * Record the session a plan was just sent to, so its card can lead there.
1080
+ * One session per plan: sending it again replaces the previous one.
1081
+ */
1082
+ const setPlanSession = async (projectId, planId, value) => {
1083
+ const id = asNonEmptyString(planId);
1084
+ if (!id) throw new Error('planId is required');
1085
+ const sessionId = asNonEmptyString(value?.sessionId);
1086
+ if (!sessionId) throw mutationError('sessionId is required', 400);
1087
+
1088
+ return withWriteLock(projectId, async () => {
1089
+ const current = await readStoredContext(projectId);
1090
+ const sharedFile = sharedPlanFileOf(id);
1091
+ if (sharedFile) {
1092
+ const dir = await sharedPlansDirFor(projectId);
1093
+ const exists = dir ? await fsPromises.access(path.join(dir, sharedFile)).then(() => true, () => false) : false;
1094
+ if (!exists) return null;
1095
+ } else if (!current.plans.some((entry) => entry.id === id)) {
1096
+ return null;
1097
+ }
1098
+ await writeContext(projectId, {
1099
+ ...current,
1100
+ planSessions: { ...current.planSessions, [id]: { sessionId, linkedAt: Date.now() } },
1101
+ });
1102
+ return publicPlanOf(projectId, id);
990
1103
  });
991
1104
  };
992
1105
 
993
1106
  return {
994
1107
  readContext,
1108
+ setPlanSession,
995
1109
  saveTodos,
996
1110
  createTodo,
997
1111
  updateTodo,
@@ -985,3 +985,61 @@ describe('parsePlanMarkdown', () => {
985
985
  expect(parsePlanMarkdown('')).toEqual({ title: 'Plan', body: '' });
986
986
  });
987
987
  });
988
+
989
+ describe('plan progress and session', () => {
990
+ test('the list carries each plan\'s step counts, and a change to the file shows on the next read', async () => {
991
+ const { plan } = await runtime.createPlan(PROJECT_ID, { title: 'Ship', body: '## Steps\n- [ ] one\n- [ ] two' });
992
+ const { plan: loose } = await runtime.createPlan(PROJECT_ID, { title: 'Loose', body: 'no checklist' });
993
+ expect(plan.progress).toEqual({ done: 0, total: 2 });
994
+
995
+ // An agent ticks a step with its own file tools, outside the API.
996
+ const file = path.join(plansDir(), (await readJson(contextPath())).plans.find((entry) => entry.id === plan.id).file);
997
+ await fsPromises.writeFile(file, '# Ship\n\n## Steps\n- [x] one\n- [ ] two\n');
998
+
999
+ const context = await runtime.readContext(PROJECT_ID);
1000
+ expect(context.plans.find((entry) => entry.id === plan.id).progress).toEqual({ done: 1, total: 2 });
1001
+ expect(context.plans.find((entry) => entry.id === loose.id)).not.toHaveProperty('progress');
1002
+ });
1003
+
1004
+ test('a plan whose file is missing still lists, without progress', async () => {
1005
+ const { plan } = await runtime.createPlan(PROJECT_ID, { title: 'Gone', body: '## Steps\n- [ ] one' });
1006
+ await fsPromises.rm(plansDir(), { recursive: true, force: true });
1007
+ const listed = (await runtime.readContext(PROJECT_ID)).plans.find((entry) => entry.id === plan.id);
1008
+ expect(listed).toBeDefined();
1009
+ expect(listed).not.toHaveProperty('progress');
1010
+ });
1011
+
1012
+ test('a plan remembers the session it was sent to until it is deleted', async () => {
1013
+ const { plan } = await runtime.createPlan(PROJECT_ID, { title: 'Ship', body: 'x' });
1014
+ const linked = await runtime.setPlanSession(PROJECT_ID, plan.id, { sessionId: 'ses_1' });
1015
+ expect(linked.plan.session).toEqual({ sessionId: 'ses_1', linkedAt: expect.any(Number) });
1016
+
1017
+ await runtime.setPlanSession(PROJECT_ID, plan.id, { sessionId: 'ses_2' });
1018
+ const pinned = await runtime.setPlanPinned(PROJECT_ID, plan.id, true);
1019
+ expect(pinned.plan.session.sessionId).toBe('ses_2');
1020
+
1021
+ await runtime.deletePlan(PROJECT_ID, plan.id);
1022
+ expect((await readJson(contextPath())).planSessions).toEqual({});
1023
+ });
1024
+
1025
+ test('linking an unknown plan changes nothing, and a session id is required', async () => {
1026
+ expect(await runtime.setPlanSession(PROJECT_ID, 'missing', { sessionId: 'ses_1' })).toBeNull();
1027
+ const { plan } = await runtime.createPlan(PROJECT_ID, { title: 'Ship', body: 'x' });
1028
+ await expect(runtime.setPlanSession(PROJECT_ID, plan.id, {})).rejects.toMatchObject({ status: 400 });
1029
+ });
1030
+
1031
+ test('a shared plan carries progress and keeps its session when it becomes personal', async () => {
1032
+ const sharedDir = path.join(projectsDirPath, 'repo', 'plans');
1033
+ const shared = createProjectContextRuntime({
1034
+ fsPromises, path, projectsDirPath, createId: () => `plan-${++idCounter}`, resolveSharedPlansDir: async () => sharedDir,
1035
+ });
1036
+ await fsPromises.mkdir(sharedDir, { recursive: true });
1037
+ await fsPromises.writeFile(path.join(sharedDir, 'team.md'), '# Team\n\n## Steps\n- [x] a\n- [x] b\n');
1038
+ expect((await shared.readContext(PROJECT_ID)).plans[0].progress).toEqual({ done: 2, total: 2 });
1039
+
1040
+ await shared.setPlanSession(PROJECT_ID, 'shared:team.md', { sessionId: 'ses_team' });
1041
+ const moved = await shared.unsharePlan(PROJECT_ID, 'shared:team.md');
1042
+ expect(moved.plan.session.sessionId).toBe('ses_team');
1043
+ expect(moved.plan.progress).toEqual({ done: 2, total: 2 });
1044
+ });
1045
+ });
@@ -10,7 +10,9 @@
10
10
  // failure or "not connected" is never replayed. Anything that changes a
11
11
  // provider (a POST to its routes: mutations, sign-in, account switch) clears
12
12
  // that provider's answers, and so does an agent turn finishing, since the
13
- // agent may have opened or changed something.
13
+ // agent may have opened or changed something. `POST <prefix>/read-cache/refresh`
14
+ // clears them on request: the board's refresh button, for a change made on the
15
+ // provider's own site.
14
16
 
15
17
  const SECOND = 1000;
16
18
  const MAX_ENTRIES = 300;
@@ -69,6 +71,10 @@ export function createProviderReadCache({ now = Date.now } = {}) {
69
71
  const middleware = (req, res, next) => {
70
72
  const route = routeOf(req.path);
71
73
  if (!route) return next();
74
+ if (req.method === 'POST' && req.path === `${route.prefix}/read-cache/refresh`) {
75
+ clear(route.provider);
76
+ return res.json({ ok: true });
77
+ }
72
78
  if (req.method !== 'GET') {
73
79
  // A change to this provider makes every kept answer of it suspect.
74
80
  res.on('finish', () => { if (res.statusCode < 400) clear(route.provider); });
@@ -85,4 +85,16 @@ describe('provider read cache', () => {
85
85
  await request(app).get('/api/source-control/github/pulls/list?page=2').expect(200);
86
86
  expect(calls.list).toBe(4);
87
87
  });
88
+
89
+ it('forgets a provider\'s answers when asked to refresh, and only that provider\'s', async () => {
90
+ const { app, calls } = setup();
91
+ await request(app).get('/api/source-control/github/pulls/list').expect(200);
92
+ await request(app).post('/api/source-control/gitlab/read-cache/refresh').expect(200, { ok: true });
93
+ await request(app).get('/api/source-control/github/pulls/list').expect(200);
94
+ expect(calls.list).toBe(1);
95
+
96
+ await request(app).post('/api/source-control/github/read-cache/refresh').expect(200, { ok: true });
97
+ await request(app).get('/api/source-control/github/pulls/list').expect(200);
98
+ expect(calls.list).toBe(2);
99
+ });
88
100
  });
@@ -188,7 +188,23 @@ left by a host restart), so the client keeps its wake listeners armed and the
188
188
  next `online` event or return to the foreground clears the error and makes one
189
189
  fresh attempt. There is still no background loop. Transient failures use the
190
190
  existing reconnect/backoff path. The client status marks such a parked error
191
- with `terminal: true`, so callers can tell it apart from a pending reconnect.
191
+ with `terminal: true` and the relay's `closeCode`, so callers can tell it apart
192
+ from a pending reconnect, and `retry()` makes the same one fresh attempt on
193
+ request.
194
+
195
+ The limit refusal (4029: more than 16 clients at once, or more than 60 client
196
+ connects a minute, per server) gets its own user-facing state, read from
197
+ `closeCode` through `isRelayLimitReached`, never from the message text. A probe
198
+ that hits it reports `relay-limit` instead of unreachable: the phone's connect
199
+ screen and error text, and the desktop instance switcher and Remote Instances
200
+ rows, say the relay refused the connection. When the runtime tunnel itself
201
+ parks on it, the phone runs its resume re-probe, which hot-switches to a
202
+ reachable LAN address or drops to the connect screen with that notice; the
203
+ connect screen sends no immediate background retry, since a dial right away
204
+ only counts against the same limits. A desktop window shows a toast with a
205
+ retry action, because a visible desktop window gets no foreground event to
206
+ wake the tunnel. `subscribeActiveRelayTunnelStatus` in `runtime-tunnel.ts`
207
+ follows whichever tunnel is the runtime's at the time.
192
208
 
193
209
  Mobile connect flows (`packages/ui/src/apps/mobileConnections.ts`, helpers in
194
210
  `mobileRelayFetch.ts`) log the relay failure reason (close message or
@@ -57,6 +57,10 @@ store. The tool description alone is read only when the agent already means to
57
57
  call it, so agents told nothing here saved only when the user said "remember".
58
58
  The session hears "nothing is stored yet" only when both scopes loaded.
59
59
 
60
+ The save rule also says to save before the final reply. The chat shows only the
61
+ last step's text as the answer, so an agent that answered, then saved, then
62
+ wrote one closing line had its whole answer folded into Activity.
63
+
60
64
  A source that will not load never blanks the rest: an unreadable memory store
61
65
  still delivers the pinned notes. A memory scope that failed to load is left out
62
66
  rather than indexed as empty, which would teach the agent to store again what it
@@ -87,6 +91,19 @@ there. It is part of the signature (`w:ask`, `w:auto`), so flipping the setting
87
91
  re-sends the rule. The tool description carries the same text
88
92
  (`../agent-tool/runtime.js`, `WORKTREE_MOVE_RULES`); change both together.
89
93
 
94
+ ## When to draw a page
95
+
96
+ A session whose agent has the managed `openchamber_render` tool (the setting is
97
+ on and OpenChamber launched OpenCode, read through `isPageRenderingAvailable`)
98
+ is told when a chart, table, diagram or interface mockup beats prose
99
+ (`RENDER_PAGE_GUIDANCE`).
100
+ Stated only in the tool description, it went unread: asked for a breakdown of
101
+ lines of code per package, an agent answered with a list and drew the chart
102
+ only when asked again. The cases and the limits (no page for a few numbers, at
103
+ most one per answer) are `RENDER_PAGE_WHEN` in
104
+ `../openchamber-control/render-page.js`, which the tool description shares. It
105
+ rides the signature as `r:on`.
106
+
90
107
  ## Entries that read as instructions
91
108
 
92
109
  Memory is the one place where text from outside can settle permanently. The
@@ -15,6 +15,7 @@
15
15
  * that has just been summarised away.
16
16
  */
17
17
  import { isRecord } from '../shared/guards.js';
18
+ import { RENDER_PAGE_WHEN } from '../openchamber-control/render-page.js';
18
19
 
19
20
  const KNOWLEDGE_METADATA_KEY = 'knowledge_context_delivered';
20
21
  const PINS_METADATA_KEY = 'project_context_pins';
@@ -33,7 +34,7 @@ const WORKTREE_MOVE_SIGNATURE = { off: [], ask: ['w:ask'], auto: ['w:auto'] };
33
34
  * Identity of everything the session should be carrying, content revisions
34
35
  * included: editing a pinned note must re-send it, not merely renaming one.
35
36
  */
36
- export const buildKnowledgeSignature = ({ notes, plans, memory, linking = false, worktreeMove = 'off' }) => {
37
+ export const buildKnowledgeSignature = ({ notes, plans, memory, linking = false, worktreeMove = 'off', rendering = false }) => {
37
38
  const parts = [
38
39
  ...notes.map((note) => `n:${note.id}:${note.updatedAt}`),
39
40
  ...plans.map((plan) => `p:${plan.id}:${plan.title}`),
@@ -43,6 +44,7 @@ export const buildKnowledgeSignature = ({ notes, plans, memory, linking = false,
43
44
  // store sends nothing, and an agent never told when to save never does.
44
45
  ...(memory.enabled ? [`m:on:${memory.complete ? 'c' : 'p'}`] : []),
45
46
  ...(linking ? ['l:on'] : []),
47
+ ...(rendering ? ['r:on'] : []),
46
48
  // Flipping the setting changes the rule, so the session hears it again.
47
49
  ...WORKTREE_MOVE_SIGNATURE[worktreeMove],
48
50
  ];
@@ -64,9 +66,14 @@ const MEMORY_SAVE_GUIDANCE = 'You have memory that persists across sessions, thr
64
66
  + ' openchamber_memory tool. Save to it in the moment, without asking first, when:'
65
67
  + ' the user corrects how you work or states a preference; the user confirms that'
66
68
  + ' a non-obvious approach worked; or you learn a project fact that took real'
67
- + ' effort to find and is not in the code or docs. One fact per entry. The user'
69
+ + ' effort to find and is not in the code or docs. Before saving a project fact,'
70
+ + ' check: would an agent reading the relevant code, docs and skills learn it,'
71
+ + ' including why and whether it may change? Then skip it; otherwise save only'
72
+ + ' the part they do not state. One fact per entry. The user'
68
73
  + ' can review and remove what you save, so save when it fits and mention it'
69
- + ' briefly.';
74
+ + ' briefly. Save before you write your final reply and mention the save in it:'
75
+ + ' the app shows only the text after a turn\'s last tool call as the reply and'
76
+ + ' folds everything earlier into its activity log.';
70
77
 
71
78
  /**
72
79
  * When to link, stated in every session that has the `openchamber` tool. The
@@ -78,7 +85,8 @@ export const SESSION_LINK_GUIDANCE = "When the user gives you an issue or a chan
78
85
  + " review (a pull or merge request) to work on, fix, investigate or review, when you"
79
86
  + " open one for this work, and when the work resolves one, link it to this session"
80
87
  + " with the openchamber tool's session.link as soon as you know it, so the user"
81
- + " sees it with the session. Not one merely mentioned in passing.";
88
+ + " sees it with the session. Not one merely mentioned in passing. No need to"
89
+ + " mention in your reply that you linked it.";
82
90
 
83
91
  /**
84
92
  * When to leave a busy branch, in the form the user chose: `ask` offers the
@@ -99,6 +107,16 @@ export const WORKTREE_MOVE_GUIDANCE = {
99
107
  + " without asking, and tell the user in one line where the work now lives.",
100
108
  };
101
109
 
110
+ /**
111
+ * When to draw a page, stated in every session that has the
112
+ * `openchamber_render` tool, for the reason the link rule is: the tool
113
+ * description is read only once the agent already means to draw. The cases
114
+ * are shared with the tool description (RENDER_PAGE_WHEN).
115
+ */
116
+ export const RENDER_PAGE_GUIDANCE = "You can show the user a chart, table, diagram or a mockup of an interface inline in the chat with the openchamber_render tool. "
117
+ + RENDER_PAGE_WHEN
118
+ + " Draw it before your final reply, and keep the reply to what the page does not show.";
119
+
102
120
  /**
103
121
  * Titles only for memory, never bodies: an index carrying full text grows
104
122
  * without bound until it crowds out the conversation it was meant to inform.
@@ -157,12 +175,13 @@ const buildPinnedBlock = ({ notes, plans }) => {
157
175
  ].join('\n\n');
158
176
  };
159
177
 
160
- export const buildKnowledgeText = ({ notes, plans, memory, linking = false, worktreeMove = 'off' }) => {
178
+ export const buildKnowledgeText = ({ notes, plans, memory, linking = false, worktreeMove = 'off', rendering = false }) => {
161
179
  const blocks = [
162
180
  buildPinnedBlock({ notes, plans }),
163
181
  buildMemoryBlock(memory),
164
182
  linking ? SESSION_LINK_GUIDANCE : '',
165
183
  worktreeMove === 'off' ? '' : WORKTREE_MOVE_GUIDANCE[worktreeMove],
184
+ rendering ? RENDER_PAGE_GUIDANCE : '',
166
185
  ].filter(Boolean);
167
186
  if (blocks.length === 0) return '';
168
187
 
@@ -183,6 +202,8 @@ export const createSessionKnowledgeRuntime = (dependencies) => {
183
202
  // Whether that tool moves a session into a worktree unasked (the setting);
184
203
  // read only when the tool is there.
185
204
  isWorktreeMoveWithoutAsking = null,
205
+ // Whether this session's agent has the `openchamber_render` tool.
206
+ isPageRenderingAvailable = async () => false,
186
207
  // Pins and the delivered-signature cursor live in OpenChamber's own session
187
208
  // metadata store: OpenCode 2.x accepts session metadata only at create time.
188
209
  readSessionMetadata = null,
@@ -274,7 +295,9 @@ export const createSessionKnowledgeRuntime = (dependencies) => {
274
295
  : false;
275
296
  const worktreeMove = linking ? (unasked ? 'auto' : 'ask') : 'off';
276
297
 
277
- return { notes, plans, memory, linking, worktreeMove };
298
+ const rendering = await Promise.resolve(isPageRenderingAvailable()).catch(() => false);
299
+
300
+ return { notes, plans, memory, linking, worktreeMove, rendering };
278
301
  };
279
302
 
280
303
  /**
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
2
 
3
- import { SESSION_LINK_GUIDANCE, WORKTREE_MOVE_GUIDANCE, buildKnowledgeSignature, buildKnowledgeText, createSessionKnowledgeRuntime } from './runtime.js';
3
+ import { RENDER_PAGE_GUIDANCE, SESSION_LINK_GUIDANCE, WORKTREE_MOVE_GUIDANCE, buildKnowledgeSignature, buildKnowledgeText, createSessionKnowledgeRuntime } from './runtime.js';
4
4
 
5
5
  const DIRECTORY = '/work/project';
6
6
  const PROJECT_ID = 'path_project';
@@ -34,6 +34,7 @@ const createRuntime = (overrides = {}) => {
34
34
  ...('isSessionLinkingAvailable' in overrides ? { isSessionLinkingAvailable: overrides.isSessionLinkingAvailable } : {}),
35
35
  };
36
36
  if ('isWorktreeMoveWithoutAsking' in overrides) dependencies.isWorktreeMoveWithoutAsking = overrides.isWorktreeMoveWithoutAsking;
37
+ if ('isPageRenderingAvailable' in overrides) dependencies.isPageRenderingAvailable = overrides.isPageRenderingAvailable;
37
38
  return createSessionKnowledgeRuntime(dependencies);
38
39
  };
39
40
 
@@ -80,6 +81,30 @@ describe('when to link', () => {
80
81
  });
81
82
  });
82
83
 
84
+ describe('when to draw a page', () => {
85
+ const bare = {
86
+ isAgentMemoryEnabled: async () => false,
87
+ projectContextRuntime: { readContext: async () => ({ notes: [], todos: [], plans: [] }) },
88
+ };
89
+
90
+ test('is told in a session whose agent has the render tool, once', async () => {
91
+ const runtime = createRuntime({ ...bare, isPageRenderingAvailable: async () => true });
92
+ const { text, signature } = await runtime.resolvePending(DIRECTORY, '', { notes: [], plans: [] });
93
+
94
+ expect(text).toBe(RENDER_PAGE_GUIDANCE);
95
+ expect(text).toContain('Do not use it for a few numbers');
96
+ expect(signature).toBe('r:on');
97
+ expect((await runtime.resolvePending(DIRECTORY, signature, { notes: [], plans: [] })).text).toBe('');
98
+ });
99
+
100
+ test('is left out without the tool, or when the check fails', async () => {
101
+ for (const isPageRenderingAvailable of [async () => false, async () => { throw new Error('settings unreadable'); }]) {
102
+ const { text } = await createRuntime({ ...bare, isPageRenderingAvailable }).resolvePending(DIRECTORY, '', { notes: [], plans: [] });
103
+ expect(text).toBe('');
104
+ }
105
+ });
106
+ });
107
+
83
108
  describe('when to move into a worktree', () => {
84
109
  const runtimeWith = (overrides) => createRuntime({
85
110
  isSessionLinkingAvailable: async () => true,
@@ -19,6 +19,7 @@ const PROVIDER_OPERATIONS = new Set([
19
19
  'change-request-create', 'change-request-update', 'change-request-merge', 'change-request-ready',
20
20
  'change-request-comment', 'change-request-review', 'issue-comment', 'change-request-state', 'issue-state',
21
21
  'change-request-labels', 'issue-labels', 'change-request-reviewers',
22
+ 'change-request-thread-reply', 'change-request-thread-resolve', 'change-request-thread-start',
22
23
  ]);
23
24
  // What a provider write acts on: `issue-*` names an issue, everything else a change request.
24
25
  const providerTargetKind = (operation) => (operation.startsWith('issue-') ? 'issue' : 'change-request');
@@ -20,6 +20,9 @@ const KINDS = [
20
20
  'change-request-labels',
21
21
  'issue-labels',
22
22
  'change-request-reviewers',
23
+ 'change-request-thread-reply',
24
+ 'change-request-thread-resolve',
25
+ 'change-request-thread-start',
23
26
  ];
24
27
  const STATES = ['running', 'succeeded', 'failed', 'outcome-unknown'];
25
28
  const TERMINAL_STATES = ['succeeded', 'failed'];