mulmoterminal 13.2.0 → 13.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +46 -4
  2. package/common/bundledSkills.ts +1 -0
  3. package/common/ghItems.ts +4 -0
  4. package/common/githubBoard.ts +9 -0
  5. package/common/libraryMemory.ts +76 -3
  6. package/common/libraryPromote.ts +32 -0
  7. package/common/libraryRepeats.ts +86 -0
  8. package/common/libraryRetrospective.ts +36 -0
  9. package/common/librarySettings.ts +61 -0
  10. package/common/libraryStorage.ts +105 -0
  11. package/common/libraryTools.ts +52 -0
  12. package/common/ptyOpenedChannel.ts +18 -0
  13. package/common/trimEndOf.ts +8 -0
  14. package/dist/assets/{Notation-CypJd7OM-Bkj3ugvx.js → Notation-CypJd7OM-CcAoh9pA.js} +1 -1
  15. package/dist/assets/{abnfDiagram-S7VZAUFO-D1ywcxJJ.js → abnfDiagram-S7VZAUFO-D13KTofT.js} +1 -1
  16. package/dist/assets/{architecture-WOLXFQ4H-CzxWOh7g.js → architecture-WOLXFQ4H-B2gjnwqK.js} +1 -1
  17. package/dist/assets/{architectureDiagram-YGSQEFNW-DXkBxnZB.js → architectureDiagram-YGSQEFNW-iMtOdrr2.js} +1 -1
  18. package/dist/assets/{blockDiagram-APKKGZFW-C93vJZ60.js → blockDiagram-APKKGZFW-bo7TwBof.js} +1 -1
  19. package/dist/assets/{c4Diagram-KJ2TOQU5-CzhIrSPv.js → c4Diagram-KJ2TOQU5-qthPlhtP.js} +1 -1
  20. package/dist/assets/{chunk-6MUBBAK2-B8dba2D5.js → chunk-6MUBBAK2-CrLRLC6u.js} +1 -1
  21. package/dist/assets/{chunk-AXFCVDMN-BF1BaeZM.js → chunk-AXFCVDMN-BK6aKu1g.js} +1 -1
  22. package/dist/assets/{chunk-BG4553SI-CrlLpYyS.js → chunk-BG4553SI-COmu46y4.js} +1 -1
  23. package/dist/assets/{chunk-DQASFODM-31XKM8G5.js → chunk-DQASFODM-Cs8qXy7U.js} +1 -1
  24. package/dist/assets/{chunk-HFQBQIA3-hdZEPui0.js → chunk-HFQBQIA3-DPExyYtk.js} +1 -1
  25. package/dist/assets/{chunk-KQLB2F66-pq29Bwny.js → chunk-KQLB2F66-DX3aqYLA.js} +1 -1
  26. package/dist/assets/{chunk-KS47KZWR-D8euv6BW.js → chunk-KS47KZWR--x1Bg0Of.js} +1 -1
  27. package/dist/assets/{chunk-LEVMRMFU-DxfgjwMM.js → chunk-LEVMRMFU-BBgVMvM4.js} +1 -1
  28. package/dist/assets/{chunk-M57EVK23-CbRhplaG.js → chunk-M57EVK23-DByfaqiH.js} +1 -1
  29. package/dist/assets/{chunk-OY52VR5R-WRzw8fSZ.js → chunk-OY52VR5R-BmwIRhY4.js} +1 -1
  30. package/dist/assets/{chunk-QB3YPZ4I-BomH8StZ.js → chunk-QB3YPZ4I-CZMCE8Fr.js} +1 -1
  31. package/dist/assets/{chunk-R3KSYZAL-U5ZTWDjT.js → chunk-R3KSYZAL-HwV7HnnK.js} +1 -1
  32. package/dist/assets/{chunk-STOXU5M4-Cwsfrp8s.js → chunk-STOXU5M4-DK-UbpVr.js} +1 -1
  33. package/dist/assets/{chunk-TU62E6Q5-CgTV0yCN.js → chunk-TU62E6Q5-WOnDNNxQ.js} +1 -1
  34. package/dist/assets/{chunk-X4PVCEUW-DkeipGOD.js → chunk-X4PVCEUW-CtFI2M6p.js} +1 -1
  35. package/dist/assets/{classDiagram-v2-L25IHNXF-D_SUDLFf.js → classDiagram-v2-L25IHNXF-BnnA4uVf.js} +1 -1
  36. package/dist/assets/cynefin-EF2NZ3EQ-CDcy_Xkc.js +1 -0
  37. package/dist/assets/{cynefinDiagram-L36ESFBY-SGjnYvMu.js → cynefinDiagram-L36ESFBY-Bb7nSFAf.js} +1 -1
  38. package/dist/assets/{dagre-SPEB5RXH-BgdOh_QS.js → dagre-SPEB5RXH-Ch7W1xIn.js} +1 -1
  39. package/dist/assets/{diagram-3B7GL73J-BpgZlDn8.js → diagram-3B7GL73J-BYSyWa4l.js} +1 -1
  40. package/dist/assets/{diagram-DNEMPZML-xrSdIhy8.js → diagram-DNEMPZML-fG9ZJmuo.js} +1 -1
  41. package/dist/assets/{diagram-L3MUGCDN-CQsJbFFT.js → diagram-L3MUGCDN-bN7hfThw.js} +1 -1
  42. package/dist/assets/{diagram-LA4NIPWU-kJV1gdXE.js → diagram-LA4NIPWU-BroZvh0F.js} +1 -1
  43. package/dist/assets/{diagram-MHCOC4E2-CNBRjzg8.js → diagram-MHCOC4E2-B1GBLoxQ.js} +1 -1
  44. package/dist/assets/{diagram-XPFHEONP-BuoqzWAD.js → diagram-XPFHEONP-D4Cz9fX5.js} +1 -1
  45. package/dist/assets/dist-B9y9qzTt.js +2 -0
  46. package/dist/assets/{dist-CkwWFeBg.js → dist-CMzXmH6c.js} +1 -1
  47. package/dist/assets/{dist-CaAdsmKa.js → dist-CZimQHff.js} +1 -1
  48. package/dist/assets/{dist-BGAjB1Pl.js → dist-Co3L4E3G.js} +1 -1
  49. package/dist/assets/{dist-CH6Es3_d.js → dist-DJFjvpV2.js} +1 -1
  50. package/dist/assets/{dist-BoBnhiwu.js → dist-Dm_rRznY.js} +1 -1
  51. package/dist/assets/{ebnfDiagram-UZSYDL2S-COZ_UYsS.js → ebnfDiagram-UZSYDL2S-p1aGjKcD.js} +1 -1
  52. package/dist/assets/{echarts-gl-Cju9Hjy8.js → echarts-gl-IAeCoJ7J.js} +1 -1
  53. package/dist/assets/{elk-XV6XMXQE-Bf_zpXJ-.js → elk-XV6XMXQE-C8bdlN2N.js} +1 -1
  54. package/dist/assets/{emscripten-module-Q67P5WYC-C2pz9hud.js → emscripten-module-Q67P5WYC-DyEOKyUf.js} +1 -1
  55. package/dist/assets/{erDiagram-EYBAPDEH-B_wEcY9d.js → erDiagram-EYBAPDEH-Dne3gV82.js} +1 -1
  56. package/dist/assets/{eventmodeling-K75KTNOO-Bz-7Ov6a.js → eventmodeling-K75KTNOO-C4Yh636f.js} +1 -1
  57. package/dist/assets/flowDiagram-MALGAFMO-BoSrMJ2v.js +1 -0
  58. package/dist/assets/{ganttDiagram-23REXITY-9dI4Sb-Y.js → ganttDiagram-23REXITY-DLP5NHnA.js} +1 -1
  59. package/dist/assets/gitGraph-VSP46ZUC-D1_AprX1.js +1 -0
  60. package/dist/assets/{gitGraphDiagram-STJD7YCW-CJrcuSxh.js → gitGraphDiagram-STJD7YCW-CYYzWxfm.js} +1 -1
  61. package/dist/assets/index--APEAsVF.css +1 -0
  62. package/dist/assets/{index-2biruWQx.js → index-Cy5KfYfp.js} +637 -626
  63. package/dist/assets/info-OHQRW6UA-DsqlZPoG.js +1 -0
  64. package/dist/assets/{infoDiagram-KBXO4MBG-CFuszPhx.js → infoDiagram-KBXO4MBG-D2YFE80l.js} +1 -1
  65. package/dist/assets/{ishikawaDiagram-M35NCXHK-0cLJulAY.js → ishikawaDiagram-M35NCXHK-DdrOzOoL.js} +1 -1
  66. package/dist/assets/{journeyDiagram-OPLOXDXO-BLj4TqPQ.js → journeyDiagram-OPLOXDXO-yZuKtTFq.js} +1 -1
  67. package/dist/assets/{kanban-definition-BZKZHSQY-BwxUFQi3.js → kanban-definition-BZKZHSQY-6h4DeMxp.js} +1 -1
  68. package/dist/assets/{line-BY6Cr-hg.js → line-B1FV3VGK.js} +1 -1
  69. package/dist/assets/{manifold-CHW6v47O.js → manifold-B_HWGAJe.js} +1 -1
  70. package/dist/assets/{mermaid-parser.core-DCy09sdt.js → mermaid-parser.core-XiDx5d7t.js} +3 -3
  71. package/dist/assets/{mermaid.core-DII2m8Jh.js → mermaid.core-BxKoKtxR.js} +4 -4
  72. package/dist/assets/{mindmap-definition-I2QAS2VK-DPuWv7ac.js → mindmap-definition-I2QAS2VK-DrmNZIqz.js} +1 -1
  73. package/dist/assets/packet-JDAUHWVQ-BMz3vbpf.js +1 -0
  74. package/dist/assets/{pegDiagram-FD4XPPHP-RxkPvHT3.js → pegDiagram-FD4XPPHP-BSWOnL2h.js} +1 -1
  75. package/dist/assets/pie-XZMESJXO-DkFKeEMJ.js +1 -0
  76. package/dist/assets/{pieDiagram-J4AKIIQI-CLtu6zfB.js → pieDiagram-J4AKIIQI-B-2-tttl.js} +1 -1
  77. package/dist/assets/{quadrantDiagram-XTYBLID2-CzWQe7_L.js → quadrantDiagram-XTYBLID2-CP15NOPc.js} +1 -1
  78. package/dist/assets/radar-ABXABTNO-O4iX34HC.js +1 -0
  79. package/dist/assets/railroad-I3PHUGI6-Yz24H2QJ.js +1 -0
  80. package/dist/assets/{railroad-abnf-LNEFI6M7-BD6waUQF.js → railroad-abnf-LNEFI6M7-CjKNQTU_.js} +1 -1
  81. package/dist/assets/{railroad-ebnf-DWYD2UWJ-ClBqanFH.js → railroad-ebnf-DWYD2UWJ-BkPDClG2.js} +1 -1
  82. package/dist/assets/{railroad-peg-JR7BVNR7-VMHl1tcR.js → railroad-peg-JR7BVNR7-MlgXBZ7v.js} +1 -1
  83. package/dist/assets/{railroadDiagram-MRQ6NCDL-RiGAgMaB.js → railroadDiagram-MRQ6NCDL-C8SExJMH.js} +1 -1
  84. package/dist/assets/{requirementDiagram-Y7LWUY3S-gMasSNPL.js → requirementDiagram-Y7LWUY3S-CJCKax-9.js} +1 -1
  85. package/dist/assets/{sankeyDiagram-WGJFYUXA-DWRWy9ya.js → sankeyDiagram-WGJFYUXA-CzkbFiL6.js} +1 -1
  86. package/dist/assets/{sequenceDiagram-5NDRBG5M-Cc0GMFmT.js → sequenceDiagram-5NDRBG5M-BwCzq5GQ.js} +1 -1
  87. package/dist/assets/{stateDiagram-v2-FJ4FJNEA-kZUOgUaG.js → stateDiagram-v2-FJ4FJNEA-WgFhEoSP.js} +1 -1
  88. package/dist/assets/{swimlanes-UMQ2AFYF-Cc3zY4p-.js → swimlanes-UMQ2AFYF-oz-jeOS8.js} +1 -1
  89. package/dist/assets/swimlanesDiagram-OMPLPG4O-Cuvkq_2_.js +8 -0
  90. package/dist/assets/{timeline-definition-SEUHKTQE-CJQzhcUU.js → timeline-definition-SEUHKTQE-BR9fsbMX.js} +1 -1
  91. package/dist/assets/treeView-D4JQ5SDB-PGiP9ywS.js +1 -0
  92. package/dist/assets/treemap-SAJKECNS-BZ2THXeo.js +1 -0
  93. package/dist/assets/{usecaseDiagram-AFA6YXN4-BNz1ziZs.js → usecaseDiagram-AFA6YXN4-D2EfYHPx.js} +1 -1
  94. package/dist/assets/{vennDiagram-NNMJR3RB-BGNM3y1D.js → vennDiagram-NNMJR3RB-Bfny4Xz6.js} +1 -1
  95. package/dist/assets/wardley-7MLQ67FV-C1E1LEgT.js +1 -0
  96. package/dist/assets/{wardleyDiagram-S7YFUSEH-DdgXJ6yj.js → wardleyDiagram-S7YFUSEH-DaoHaZyl.js} +1 -1
  97. package/dist/assets/{xychartDiagram-GGNKY7IX-CnD9_h1u.js → xychartDiagram-GGNKY7IX-djduqZCe.js} +1 -1
  98. package/dist/index.html +2 -2
  99. package/docs/ChangeLog.md +81 -0
  100. package/docs/facts.json +1 -1
  101. package/docs/guide/en/conversation.md +5 -2
  102. package/docs/guide/en/feature-list.md +18 -1
  103. package/docs/guide/en/features.md +4 -4
  104. package/docs/guide/en/github.md +19 -1
  105. package/docs/guide/en/index.md +3 -2
  106. package/docs/guide/en/v13.3.0.md +227 -0
  107. package/docs/guide/en/v13.4.0.md +65 -0
  108. package/docs/guide/ja/conversation.md +5 -2
  109. package/docs/guide/ja/feature-list.md +18 -1
  110. package/docs/guide/ja/features.md +4 -4
  111. package/docs/guide/ja/github.md +17 -1
  112. package/docs/guide/ja/index.md +3 -2
  113. package/docs/guide/ja/v13.3.0.md +214 -0
  114. package/docs/guide/ja/v13.4.0.md +65 -0
  115. package/package.json +1 -1
  116. package/server/agents/antigravity/antigravity-last-turn.ts +61 -0
  117. package/server/agents/antigravity/antigravity-session.ts +3 -0
  118. package/server/agents/antigravity/antigravity-sessions.ts +3 -2
  119. package/server/agents/copilot/copilot-last-turn.ts +76 -0
  120. package/server/agents/copilot/copilot-sessions.ts +3 -0
  121. package/server/agents/cursor/cursor-last-turn.ts +2 -24
  122. package/server/agents/cursor/cursor-sessions.ts +2 -2
  123. package/server/agents/grok/grok-last-turn.ts +66 -0
  124. package/server/agents/grok/grok-sessions.ts +3 -0
  125. package/server/agents/user-query.ts +24 -0
  126. package/server/backends/library/cleanup-period.ts +20 -0
  127. package/server/backends/library/conversation-fold.ts +16 -0
  128. package/server/backends/library/index-queries.ts +35 -0
  129. package/server/backends/library/index-store.ts +7 -4
  130. package/server/backends/library/instruction-files-read.ts +282 -0
  131. package/server/backends/library/instruction-files.ts +113 -0
  132. package/server/backends/library/instruction-references.ts +72 -0
  133. package/server/backends/library/library-client.ts +1 -1
  134. package/server/backends/library/library-dispatch.ts +21 -1
  135. package/server/backends/library/library-service.ts +71 -2
  136. package/server/backends/library/library-worker.ts +2 -2
  137. package/server/backends/library/memory-folders.ts +31 -12
  138. package/server/backends/library/memory-health-read.ts +155 -0
  139. package/server/backends/library/memory-health.ts +145 -0
  140. package/server/backends/library/memory-index-lines.ts +33 -0
  141. package/server/backends/library/memory-link-rewrite.ts +99 -0
  142. package/server/backends/library/memory-merge-links.ts +82 -0
  143. package/server/backends/library/memory-source.ts +30 -0
  144. package/server/backends/library/memory-trash.ts +343 -0
  145. package/server/backends/library/memory-workcopies.ts +50 -0
  146. package/server/backends/library/memory-write.ts +59 -0
  147. package/server/backends/library/project-folders.ts +82 -0
  148. package/server/backends/library/repeat-detect.ts +207 -0
  149. package/server/backends/library/repeat-source.ts +59 -0
  150. package/server/backends/library/retrospective.ts +67 -0
  151. package/server/backends/library/settings-layers-read.ts +32 -0
  152. package/server/backends/library/settings-layers.ts +82 -0
  153. package/server/backends/library/storage-home.ts +80 -0
  154. package/server/backends/library/storage-measurer.ts +101 -0
  155. package/server/backends/library/storage-projects.ts +56 -0
  156. package/server/backends/library/storage-walk.ts +72 -0
  157. package/server/backends/library/storage-worker.ts +18 -0
  158. package/server/backends/skills/skillCatalog.ts +9 -4
  159. package/server/backends/skills/skillEdit.ts +19 -0
  160. package/server/files/files-tree-routes.ts +1 -4
  161. package/server/files/tree-ops.ts +15 -3
  162. package/server/git/board-fetch.ts +60 -25
  163. package/server/git/board-repos.ts +34 -0
  164. package/server/git/board.ts +19 -4
  165. package/server/index.ts +3 -0
  166. package/server/routes/app-routes.ts +1 -1
  167. package/server/routes/library-memory-routes.ts +192 -10
  168. package/server/routes/library-memory-tidy-routes.ts +36 -0
  169. package/server/routes/library-promote-routes.ts +57 -0
  170. package/server/routes/library-repeat-routes.ts +48 -0
  171. package/server/routes/library-routes.ts +25 -1
  172. package/server/routes/library-storage-routes.ts +108 -0
  173. package/server/routes/library-tools-routes.ts +80 -0
  174. package/server/routes/repo-routes.ts +16 -10
  175. package/server/routes/session-routes.ts +57 -1
  176. package/server/routes/skill-catalog-routes.ts +27 -1
  177. package/server/routes/ws-routes.ts +5 -3
  178. package/server/session/activity/task-push.ts +9 -7
  179. package/server/session/pty/agent-pty-start.ts +2 -2
  180. package/server/session/pty/pty-register.ts +25 -0
  181. package/server/session/session-reads.ts +51 -3
  182. package/server/session/spawn/agents/permission-mode-log.ts +25 -0
  183. package/server/session/spawn/agents/session-permission-mode.ts +49 -0
  184. package/server/session/spawn/agents/spawn-claude.ts +15 -4
  185. package/server/session/spawn/issue-session-spawn.ts +19 -5
  186. package/server/session/spawn/issue-spawn-options.ts +2 -1
  187. package/server/session/spawn/spawn-shell.ts +3 -3
  188. package/server/session/transcript/handoff-text.ts +39 -0
  189. package/server/session/transcript/relay-mark-store.ts +48 -0
  190. package/server/session/transcript/relay-marks.ts +41 -0
  191. package/server/session/transcript/relay-range.ts +116 -0
  192. package/server/session/transcript/relay-read.ts +64 -0
  193. package/server/session/transcript/transcript-view-antigravity.ts +104 -0
  194. package/server/session/transcript/transcript-view-cursor.ts +4 -3
  195. package/server/session/transcript/transcript-view-grok.ts +98 -0
  196. package/server/session/transcript/transcript-view-read.ts +36 -17
  197. package/server/skills/mulmoterminal-decisions/SKILL.md +1 -1
  198. package/server/skills/mulmoterminal-library/SKILL.md +127 -0
  199. package/dist/assets/cynefin-EF2NZ3EQ-BO6sbOTe.js +0 -1
  200. package/dist/assets/dist-CvoDRBOB.js +0 -2
  201. package/dist/assets/flowDiagram-MALGAFMO-BNCQgw2W.js +0 -1
  202. package/dist/assets/gitGraph-VSP46ZUC-C1LDt_Ps.js +0 -1
  203. package/dist/assets/index-Bosx0ygR.css +0 -1
  204. package/dist/assets/info-OHQRW6UA-DRlKlOwD.js +0 -1
  205. package/dist/assets/packet-JDAUHWVQ-D5o3cjnq.js +0 -1
  206. package/dist/assets/pie-XZMESJXO-M5OsFE3Z.js +0 -1
  207. package/dist/assets/radar-ABXABTNO-FzD2sCnH.js +0 -1
  208. package/dist/assets/railroad-I3PHUGI6-D5_ZVXhN.js +0 -1
  209. package/dist/assets/swimlanesDiagram-OMPLPG4O-DtDwYrQ2.js +0 -8
  210. package/dist/assets/treeView-D4JQ5SDB-Bw6TRccc.js +0 -1
  211. package/dist/assets/treemap-SAJKECNS-DV1Ic9Gc.js +0 -1
  212. package/dist/assets/wardley-7MLQ67FV-BMhRQwOU.js +0 -1
package/README.md CHANGED
@@ -1882,8 +1882,12 @@ narrow and tall for one record you are discussing — and each position keeps it
1882
1882
  **Resume** (or `Enter`) to open it in a terminal in the directory it ran in. `/` focuses the
1883
1883
  search, the arrow keys move. The **⋯** menu pins a conversation to the top of the list or renames
1884
1884
  it; pins and names are MulmoTerminal's own (`~/.mulmoterminal/library/marks.json`) and the
1885
- conversation's file is never written. `claude -p` and SDK runs, and runs from temp directories, are left
1886
- out. The index behind it is built in the background the first time you open it and kept up to
1885
+ conversation's file is never written. **⋯** → **Promote to** turns the conversation into a memory,
1886
+ a `CLAUDE.md` rule, a plan under `plans/`, an issue or a skill: it opens a Claude cell in plan mode in the
1887
+ directory the conversation ran in, running the bundled `mulmoterminal-library` skill, which reads
1888
+ the conversation, shows the change as a diff, and writes nothing until you approve its plan (it backs up every
1889
+ file it changes first, and says how to undo). **Repeats** lists instructions you typed 3 times or more, in 2 conversations or more, in the last 90 days, read from `~/.claude/history.jsonl` (commands, pastes, automated runs and one-prompt sessions left out; short ones alike in a project grouped), with the conversations each was typed in lately; **Make a rule** / **Make a skill** start the same skill on it, in plan mode. **Storage** shows what each entry of `~/.claude` (or `CLAUDE_CONFIG_DIR`) takes on disk, and under `projects/` each project, largest first, with temp-directory ones marked; it is measured in the background and measured again when the last one is over an hour old, and it says what `cleanupPeriodDays` is set to. The conversation list leaves out `claude -p` and SDK runs, and runs from temp
1890
+ directories. The index behind it is built in the background the first time you open it and kept up to
1887
1891
  date from what is appended; it is `~/.mulmoterminal/library/index.db` and can be deleted at any
1888
1892
  time (it is rebuilt). `marks.json` beside it holds your pins and names and is not rebuilt.
1889
1893
  A conversation's PR numbers open the PR; in the GitHub view, a PR a conversation made has a
@@ -1892,12 +1896,48 @@ narrow and tall for one record you are discussing — and each position keeps it
1892
1896
  the whole change or of one turn's (read only; read from Claude Code's own file history).
1893
1897
  **Memory** beside **Conversations** lists Claude Code's auto memory for every project, with how
1894
1898
  full each `MEMORY.md` is against what Claude Code loads (200 lines / 25,000 bytes); a memory
1895
- reads as Markdown and its `[[name]]` links open the memory they name (read only for now). Design: [`docs/library-design.md`](docs/library-design.md).
1899
+ reads as Markdown and its `[[name]]` links open the memory they name (read only for now).
1900
+ Memory that can be tidied is marked with a dot and counted above the list (**Show** narrows to
1901
+ it): a memory missing from `MEMORY.md`, missing frontmatter, a `[[link]]` to no memory, a file it
1902
+ names that is gone, a memory of the same name in another work copy of the repository (a directory
1903
+ whose `origin` is the same remote; the reader says which copies hold the same text), or an index
1904
+ that is missing, overfull or pointing at a file that is gone. For a copy that differs, the reader
1905
+ offers **Add its text here** (opens the editor with that copy's body added; saving writes this
1906
+ memory only) and **Write this text there** (writes this memory's text over that copy, refused if
1907
+ it changed since it was read, with **Undo**), so the copies can be made one. Under a memory's title,
1908
+ **Written in** names the conversation that last wrote it (from the file writes its transcript
1909
+ recorded) and opens it. Each project heading has a tidy-up button: it opens Claude in plan mode in
1910
+ the project's directory with the `mulmoterminal-library` skill, which proposes merging duplicate
1911
+ memories, removing ones the code shows no longer hold, fixing what the health check found and
1912
+ moving standing rules into a `CLAUDE.md` or a skill, backs up every file it changes, and writes
1913
+ nothing until you approve.
1914
+ **Edit** (`Enter`) changes a memory's whole text in place (`⌘Enter` saves, `Esc` cancels); a save
1915
+ is refused when the file changed on disk since it was opened, and a running session there is warned of.
1916
+ **⋯** → **Move to Trash** moves a memory to the system Trash with its lines in `MEMORY.md`, and
1917
+ **Undo** in the notice puts both back. **⋯** → **Merge into another memory** picks another memory of
1918
+ the same project and opens it in the editor with this one's body added at its end; saving writes it
1919
+ and moves this one to the Trash with its lines. It also points the `[[links]]` to this memory, in
1920
+ the merged text and in the project's other memories (as listed when the merge starts), at the one kept (never one inside code or by
1921
+ a name another memory also has; how many is said before saving, and a link that cannot be rewritten exactly stops the merge). **Undo**
1922
+ puts all of it back. **Tools** picks a directory a conversation ran in and lists the instruction
1923
+ files Claude Code loads there, in the order it loads them: the managed `CLAUDE.md`, yours and your
1924
+ `~/.claude/rules`, every `CLAUDE.md` / `.claude/CLAUDE.md` / `CLAUDE.local.md` from the filesystem root
1925
+ down, the project's `.claude/rules` (a rule with `paths` marked as loading only for matching files),
1926
+ and what their `@path` imports bring in — or `AGENTS.md` where no `CLAUDE.md` counts. Each is read
1927
+ beside the list, with the paths it names (Markdown links, code-span paths) that are not there. Above them, **Settings, laid over each other** reads the user, project, local and
1928
+ managed `settings.json` files in Claude Code's order and shows the permission rules (every file's,
1929
+ added up), environment variables, hooks and other keys in effect, each naming the file that set it.
1930
+ Read only. **More features** → **Usage** adds a retrospective of the last twelve weeks from the
1931
+ same index: money, conversations and the PRs they made, by week, project and agent (a conversation
1932
+ counts in the week it started); the token windows appear above it while token rotation is on. Design: [`docs/library-design.md`](docs/library-design.md).
1896
1933
  - **Skills viewer** — **More features** → **Skills** lists every Claude skill on disk in three
1897
1934
  columns — where it lives, its skills, its `SKILL.md`. The places are your `~/.claude/skills`,
1898
1935
  each enabled plugin (skills shown as `plugin:skill`), and the `.claude/skills` of each folder a
1899
1936
  terminal has run in (folders with none are left out). A project skill with the same name as one
1900
1937
  of yours is marked as overriding it. The search (name, description or folder) narrows both lists.
1938
+ **Edit** changes one of your own or a project's `SKILL.md` in place (`⌘Enter` saves, `Esc`
1939
+ cancels), refused if it changed on disk since it was opened; a plugin's skills and the ones
1940
+ MulmoTerminal ships (copied over at every start) are read only.
1901
1941
  Switch to **skills.sh** to search the public directory at [skills.sh](https://skills.sh) for
1902
1942
  skills you do not have yet and read one before installing it: its `SKILL.md`, every file it would
1903
1943
  bring, and a warning listing the files that can run code. Nothing is installed from the viewer —
@@ -1978,7 +2018,7 @@ narrow and tall for one record you are discussing — and each position keeps it
1978
2018
  - **Tool traffic is folded away**, one line saying what ran (`Bash · Read`); click to open it.
1979
2019
  It is most of a turn's bulk and almost none of what you came back to read.
1980
2020
  - A **snapshot**, not a live tail — the terminal beside it is the live view — and the header's
1981
- reload fetches the newest turns again. Claude, Codex, Cursor and Copilot; an agent whose
2021
+ reload fetches the newest turns again. Claude, Codex, Cursor, Copilot, Grok and Antigravity; an agent whose
1982
2022
  conversation no reader here can read yet says so rather than showing an empty pane.
1983
2023
  - **Notifications** (🔔) — a toolbar bell with an unread badge and a dropdown of active
1984
2024
  notifications; click a row to jump to its session.
@@ -2199,6 +2239,8 @@ name in `MULMOTERMINAL_HOST` / `MULMOTERMINAL_ALLOWED_ORIGINS`, against DNS rebi
2199
2239
  | `GET /api/cursor/sessions?cwd=` | Cursor chats for the project, newest first. Cursor's project directory name is a truncated-and-hashed slug of the path, so this reads each directory's own `.workspace-trusted` to learn which one it stands for and omits any that does not say. |
2200
2240
  | `GET /api/cost?cwd=&session=` | Estimated $ cost — session / today / month. |
2201
2241
  | `GET /api/transcript/timeline?session=&cwd=` | Per-session activity timeline (tools run). |
2242
+ | `GET /api/transcript/relay?session=&cwd=&agent=&dest=` | Every exchange of that session since the last relay to directory `dest`: `status` (`ok` / `nothing-new` / `no-turn`), the `text` to paste, and the `mark` to record. |
2243
+ | `POST /api/transcript/relay-mark?session=&cwd=&agent=&dest=` | Body `{ mark }`. Records where the relay to `dest` ended, once the text was pasted. |
2202
2244
  | `GET /api/transcript/last-turn?session=&cwd=&agent=` | A session's last completed exchange (`prompt`, `reply`) plus the `text` to paste into another terminal. `agent=codex` reads the codex rollout instead of the Claude transcript. |
2203
2245
  | `GET /api/decisions?cwd=&limit=` | The decisions a human was asked to make in this project, newest first — each question with the options it offered, their descriptions, and the answer. `answerKind` says whether the answer was one of the options, text the user wrote instead (the question was wrong), or never given. Read out of Claude's own transcripts; writes nothing. `scanned` reports how many transcripts were read (the scan is capped) and `unreadable` how many could not be, so a partial answer is visible rather than implied. A `cwd` that is not an existing directory answers an empty response rather than falling back to the default workspace. |
2204
2246
  | `GET /api/decisions/digest?cwd=` | The same decisions as Markdown, for an agent to read (`{ enabled, markdown }`). `enabled: false` means the `decisionDigest` setting is off — a different answer from an empty digest, so a reader can tell "switched off" from "nothing decided here". |
@@ -27,6 +27,7 @@ export const BUNDLED_SKILL_NAMES = [
27
27
  "mulmoterminal-data-analysis",
28
28
  "mulmoterminal-video-edit",
29
29
  "mulmoterminal-html-plan",
30
+ "mulmoterminal-library",
30
31
  ] as const;
31
32
 
32
33
  export type BundledSkillName = (typeof BUNDLED_SKILL_NAMES)[number];
package/common/ghItems.ts CHANGED
@@ -29,6 +29,8 @@ export interface RepoPrs {
29
29
  // True when the repo has at least PR_LIMIT open PRs, so the list may be incomplete —
30
30
  // surfaced in the UI so a truncated view isn't mistaken for full coverage.
31
31
  truncated?: boolean;
32
+ /** Read only because a live cell is in it: not in `prRepos`. */
33
+ unregistered?: boolean;
32
34
  }
33
35
 
34
36
  export interface RepoIssues {
@@ -40,4 +42,6 @@ export interface RepoIssues {
40
42
  truncated?: boolean;
41
43
  // The repo's GitHub issues page, used as the "see the rest" target when truncated.
42
44
  url?: string;
45
+ /** Read only because a live cell is in it: not in `prRepos`. */
46
+ unregistered?: boolean;
43
47
  }
@@ -49,6 +49,11 @@ export interface BoardCell {
49
49
  waiting: boolean;
50
50
  }
51
51
 
52
+ /** A live cell on no piece of work: on the default branch, which `branch` names, or on no branch (null). */
53
+ export interface BoardMainlineCell extends BoardCell {
54
+ branch: string | null;
55
+ }
56
+
52
57
  export interface BoardCard {
53
58
  /** Stable within a repo: `pr-N`, `issue-N` or `branch-<name>`. */
54
59
  key: string;
@@ -64,6 +69,10 @@ export interface RepoBoard {
64
69
  repo: string;
65
70
  cards?: BoardCard[];
66
71
  error?: string;
72
+ /** Read only because a live cell is in it: not in `prRepos`. */
73
+ unregistered?: boolean;
74
+ /** The cells on the default branch or on no branch, which belong to no card. Absent when none. */
75
+ mainlineCells?: BoardMainlineCell[];
67
76
  }
68
77
 
69
78
  export interface BoardResponse {
@@ -6,12 +6,14 @@ import { isRecord } from "./isRecord.js";
6
6
  * bytes). Past either, the rest of the index is not in the agent's context. */
7
7
  export const MEMORY_INDEX_LINES_MAX = 200;
8
8
  export const MEMORY_INDEX_BYTES_MAX = 25_000;
9
+ /** The most a memory edit may write: far past any real memory, and what the editor refuses to send. */
10
+ export const MEMORY_EDIT_MAX_BYTES = 256 * 1024;
11
+
9
12
  /** The index's own name in a memory folder. */
10
13
  export const MEMORY_INDEX_FILE = "MEMORY.md";
11
14
 
12
- /** The folder Claude Code keeps a directory's data under: every character outside `[A-Za-z0-9_-]`
13
- * becomes `-` (its own rule, so a directory is matched to its memory without guessing). */
14
- export const projectSlug = (cwd: string): string => cwd.replace(/[^a-zA-Z0-9\-_]/g, "-") || "unknown";
15
+ /** A project folder's name as Claude Code makes them (`encodeProjectDirName`, server/session/project-dir.ts). */
16
+ export const isProjectSlug = (slug: string): boolean => /^[A-Za-z0-9_-]{1,255}$/.test(slug);
15
17
 
16
18
  export interface LibraryMemoryFile {
17
19
  /** The file's name in the folder. */
@@ -76,6 +78,28 @@ export function frontmatterStillOpen(text: string): boolean {
76
78
  return normalized.startsWith("---\n") && frontmatterEnd(normalized) === -1;
77
79
  }
78
80
 
81
+ /** Where a memory's body starts in its text as written — after the frontmatter's closing line, or 0 when
82
+ * there is none — found as `parseMemoryFrontmatter` finds it, but on the text itself rather than its
83
+ * normalised copy, so the body can be edited and the frontmatter left byte for byte. */
84
+ export function memoryBodyStart(text: string): number {
85
+ const open = /^\uFEFF?---\r?\n/.exec(text);
86
+ if (open === null) return 0;
87
+ const close = /\r?\n---(?:\r?\n|$)/.exec(text.slice(open[0].length - 1));
88
+ return close === null ? 0 : open[0].length - 1 + close.index + close[0].length;
89
+ }
90
+
91
+ /** Whether a `[[link]]` names a memory: by its file name without `.md`, or by its frontmatter `name`,
92
+ * either side's surrounding spaces aside (a link's own are, and a quoted value can carry some). The one
93
+ * rule the reader, the health check and a merge's rewrite all decide a link's memory by. */
94
+ export const linkNamesMemory = (link: string, memory: { file: string; name: string | null }): boolean => {
95
+ const wanted = link.trim();
96
+ return wanted !== "" && (wanted === memory.file.replace(/\.md$/, "") || wanted === (memory.name ?? "").trim());
97
+ };
98
+
99
+ /** The names a `[[link]]` reaches a memory by, as `linkNamesMemory` decides it. */
100
+ export const memoryLinkNames = (memory: { file: string; name: string | null }): string[] =>
101
+ [memory.file.replace(/\.md$/, ""), (memory.name ?? "").trim()].filter((name, at, all) => name !== "" && all.indexOf(name) === at);
102
+
79
103
  export function parseMemoryFrontmatter(text: string): MemoryFrontmatter {
80
104
  const normalized = normalizedMemory(text);
81
105
  const end = frontmatterEnd(normalized);
@@ -115,3 +139,52 @@ export const isLibraryMemoryProject = (value: unknown): value is LibraryMemoryPr
115
139
  (value.index === null || (isRecord(value.index) && typeof value.index.lines === "number" && typeof value.index.bytes === "number")) &&
116
140
  Array.isArray(value.files) &&
117
141
  value.files.every(isMemoryFile);
142
+
143
+ /** A memory's type: `metadata.type`, or a top-level `type` as some memory files write it — an empty one
144
+ * falls through. The list and the health check both decide it here. */
145
+ export const memoryType = (frontmatter: Pick<MemoryFrontmatter, "fields" | "metadata">): string | null =>
146
+ frontmatter.metadata.type?.trim() || frontmatter.fields.type?.trim() || null;
147
+
148
+ /** What can be tidied in one memory file (#3331). */
149
+ export type MemoryFileIssue =
150
+ | { kind: "not-in-index" }
151
+ | { kind: "no-frontmatter"; missing: string[] }
152
+ | { kind: "broken-link"; names: string[] }
153
+ | { kind: "missing-path"; paths: string[] }
154
+ /** A memory of the same name in other work copies of the repository, each the same text or not. */
155
+ | { kind: "in-work-copies"; copies: { slug: string; same: boolean }[] };
156
+
157
+ /** What can be tidied in a project's memory as a whole: its index. */
158
+ export type MemoryProjectIssue = { kind: "index-over-limit" } | { kind: "no-index" } | { kind: "dead-index-entry"; files: string[] };
159
+
160
+ export interface LibraryMemoryHealth {
161
+ slug: string;
162
+ issues: MemoryProjectIssue[];
163
+ /** By file name; a file with nothing to tidy is not listed. */
164
+ files: Record<string, MemoryFileIssue[]>;
165
+ }
166
+
167
+ const isStringList = (value: unknown): value is string[] => Array.isArray(value) && value.every((item) => typeof item === "string");
168
+
169
+ const isFileIssue = (value: unknown): value is MemoryFileIssue => {
170
+ if (!isRecord(value)) return false;
171
+ if (value.kind === "not-in-index") return true;
172
+ if (value.kind === "no-frontmatter") return isStringList(value.missing);
173
+ if (value.kind === "broken-link") return isStringList(value.names);
174
+ if (value.kind === "in-work-copies") return Array.isArray(value.copies) && value.copies.length > 0 && value.copies.every(isWorkCopy);
175
+ return value.kind === "missing-path" && isStringList(value.paths);
176
+ };
177
+
178
+ const isWorkCopy = (value: unknown): value is { slug: string; same: boolean } =>
179
+ isRecord(value) && typeof value.slug === "string" && typeof value.same === "boolean";
180
+
181
+ const isProjectIssue = (value: unknown): value is MemoryProjectIssue =>
182
+ isRecord(value) && (value.kind === "index-over-limit" || value.kind === "no-index" || (value.kind === "dead-index-entry" && isStringList(value.files)));
183
+
184
+ export const isLibraryMemoryHealth = (value: unknown): value is LibraryMemoryHealth =>
185
+ isRecord(value) &&
186
+ typeof value.slug === "string" &&
187
+ Array.isArray(value.issues) &&
188
+ value.issues.every(isProjectIssue) &&
189
+ isRecord(value.files) &&
190
+ Object.values(value.files).every((issues) => Array.isArray(issues) && issues.every(isFileIssue));
@@ -0,0 +1,32 @@
1
+ // Promoting a conversation from the Library (#3334): what it can become, and the turn that asks the
2
+ // bundled skill to make it. Both sides decide from these — the reader lists the targets, the server
3
+ // refuses any other and writes the turn — so they are named once, here.
4
+ import type { BundledSkillName } from "./bundledSkills.js";
5
+ import { isProjectSlug } from "./libraryMemory.js";
6
+
7
+ /** What a conversation can be promoted to: a memory, a `CLAUDE.md` rule, a plan under `plans/`, an
8
+ * issue, or a skill. */
9
+ export const PROMOTE_TARGETS = ["memory", "rule", "plan", "issue", "skill"] as const;
10
+
11
+ export type PromoteTarget = (typeof PROMOTE_TARGETS)[number];
12
+
13
+ export const isPromoteTarget = (value: unknown): value is PromoteTarget => PROMOTE_TARGETS.some((target) => target === value);
14
+
15
+ /** The skill that reads the conversation and writes what it is promoted to, once the person approves. */
16
+ export const PROMOTE_SKILL: BundledSkillName = "mulmoterminal-library";
17
+
18
+ /** A Claude session id, a UUID: the only shape the transcript routes the skill reads it through take
19
+ * (a subagent's file name is not one, so a subagent's conversation is not promoted). Only such an id
20
+ * is put into the turn, so nothing the browser sent can become words the agent reads. */
21
+ const SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
22
+
23
+ /** The first turn of the session that promotes `sessionId`, or null for an id that is not one. */
24
+ export function promoteTurn(target: PromoteTarget, sessionId: string): string | null {
25
+ return SESSION_ID.test(sessionId) ? `/${PROMOTE_SKILL} promote ${target} ${sessionId}` : null;
26
+ }
27
+
28
+ /** The first turn of the session that proposes how to tidy one project's memory, or null for a
29
+ * folder name that is not one Claude Code makes. */
30
+ export function tidyTurn(slug: string): string | null {
31
+ return isProjectSlug(slug) ? `/${PROMOTE_SKILL} tidy ${slug}` : null;
32
+ }
@@ -0,0 +1,86 @@
1
+ // Instructions typed again and again (#3334), for the Library's Repeats view: candidates for a
2
+ // CLAUDE.md rule or a skill. The server finds them; the browser shows them; a candidate is promoted by
3
+ // its id, so nothing the browser sends becomes words the agent reads.
4
+ import { isRecord } from "./isRecord.js";
5
+ import { PROMOTE_SKILL } from "./libraryPromote.js";
6
+
7
+ /** How far back, how many times and in how many conversations an instruction has to be typed to count
8
+ * as repeated. The server decides by them and the view says them. */
9
+ export const REPEAT_WINDOW_DAYS = 90;
10
+ export const REPEAT_MIN_COUNT = 3;
11
+ export const REPEAT_MIN_SESSIONS = 2;
12
+
13
+ /** What a repeated instruction can become. */
14
+ export const REPEAT_TARGETS = ["rule", "skill"] as const;
15
+
16
+ export type RepeatTarget = (typeof REPEAT_TARGETS)[number];
17
+
18
+ export const isRepeatTarget = (value: unknown): value is RepeatTarget => REPEAT_TARGETS.some((target) => target === value);
19
+
20
+ /** One time the instruction was typed. */
21
+ export interface RepeatOccurrence {
22
+ sessionId: string;
23
+ project: string | null;
24
+ at: number;
25
+ text: string;
26
+ }
27
+
28
+ export interface RepeatCandidate {
29
+ /** Stable while the instruction's most typed form stays the most typed: hex. */
30
+ id: string;
31
+ /** Its most typed form. */
32
+ text: string;
33
+ /** The forms it was typed in, most typed first. */
34
+ variants: string[];
35
+ count: number;
36
+ sessions: number;
37
+ /** The directories it was typed in, most first. */
38
+ projects: string[];
39
+ lastAt: number;
40
+ }
41
+
42
+ /** GET /api/library/repeats: the most typed candidates, and how many there are in all. */
43
+ export interface RepeatList {
44
+ candidates: RepeatCandidate[];
45
+ total: number;
46
+ }
47
+
48
+ /** One candidate with the latest times it was typed, newest first (for the skill that promotes it);
49
+ * `count` is how many there were in all, and `projects` names every directory it was typed in. */
50
+ export interface RepeatDetail extends RepeatCandidate {
51
+ occurrences: RepeatOccurrence[];
52
+ }
53
+
54
+ const REPEAT_ID = /^[0-9a-f]{16}$/;
55
+
56
+ export const isRepeatId = (value: string): boolean => REPEAT_ID.test(value);
57
+
58
+ /** The first turn of the session that promotes a candidate, or null for an id that is not one. */
59
+ export function repeatTurn(target: RepeatTarget, id: string): string | null {
60
+ return isRepeatId(id) ? `/${PROMOTE_SKILL} repeat ${target} ${id}` : null;
61
+ }
62
+
63
+ const isStrings = (value: unknown): value is string[] => Array.isArray(value) && value.every((item) => typeof item === "string");
64
+
65
+ export const isRepeatCandidate = (value: unknown): value is RepeatCandidate =>
66
+ isRecord(value) &&
67
+ typeof value.id === "string" &&
68
+ typeof value.text === "string" &&
69
+ isStrings(value.variants) &&
70
+ typeof value.count === "number" &&
71
+ typeof value.sessions === "number" &&
72
+ isStrings(value.projects) &&
73
+ typeof value.lastAt === "number";
74
+
75
+ const isOccurrence = (value: unknown): value is RepeatOccurrence =>
76
+ isRecord(value) &&
77
+ typeof value.sessionId === "string" &&
78
+ (value.project === null || typeof value.project === "string") &&
79
+ typeof value.at === "number" &&
80
+ typeof value.text === "string";
81
+
82
+ export const isRepeatDetail = (value: unknown): value is RepeatDetail =>
83
+ isRepeatCandidate(value) && isRecord(value) && Array.isArray(value.occurrences) && value.occurrences.every(isOccurrence);
84
+
85
+ export const isRepeatList = (value: unknown): value is RepeatList =>
86
+ isRecord(value) && Array.isArray(value.candidates) && value.candidates.every(isRepeatCandidate) && typeof value.total === "number";
@@ -0,0 +1,36 @@
1
+ // The retrospective in /usage (#3335): what the last weeks went on — money, conversations and the PRs
2
+ // they made — by week, by project and by agent, computed from the Library's index rather than Claude
3
+ // Code's own stats cache, which can stop updating. Shared by the route and the view.
4
+ import { isRecord } from "./isRecord.js";
5
+
6
+ /** How far back the retrospective reaches. */
7
+ export const RETROSPECTIVE_WEEKS = 12;
8
+
9
+ export interface RetrospectiveTotals {
10
+ costUsd: number;
11
+ conversations: number;
12
+ prs: number;
13
+ }
14
+
15
+ export interface LibraryRetrospective {
16
+ /** Each week's totals, oldest first, every week present (an empty one is all zeros). `start_ms` is the
17
+ * Monday the week starts on, at local midnight on the server. */
18
+ weeks: (RetrospectiveTotals & { start_ms: number })[];
19
+ /** By project directory, the most spent first; a conversation with no directory is under "". */
20
+ projects: (RetrospectiveTotals & { cwd: string })[];
21
+ /** By agent, the most spent first. */
22
+ agents: (RetrospectiveTotals & { agent: string })[];
23
+ total: RetrospectiveTotals;
24
+ }
25
+
26
+ const isTotals = (value: unknown): value is RetrospectiveTotals =>
27
+ isRecord(value) && typeof value.costUsd === "number" && typeof value.conversations === "number" && typeof value.prs === "number";
28
+ const listOf = (value: unknown, key: string, kind: "string" | "number"): boolean =>
29
+ Array.isArray(value) && value.every((entry) => isTotals(entry) && isRecord(entry) && typeof entry[key] === kind);
30
+
31
+ export const isLibraryRetrospective = (value: unknown): value is LibraryRetrospective =>
32
+ isRecord(value) &&
33
+ listOf(value.weeks, "start_ms", "number") &&
34
+ listOf(value.projects, "cwd", "string") &&
35
+ listOf(value.agents, "agent", "string") &&
36
+ isTotals(value.total);
@@ -0,0 +1,61 @@
1
+ // What the Library's tools kind shows of Claude Code's settings for one directory (#3332): each file it
2
+ // reads, and the result of laying them over each other, every value naming the file it came from.
3
+ // Shared by the route and the view.
4
+ import { isRecord } from "./isRecord.js";
5
+
6
+ /** The settings files, weakest first: a key in a later one overrides the same key in an earlier one, and
7
+ * a list adds to it (code.claude.com/docs/en/settings, "Settings precedence"). */
8
+ export const SETTINGS_SOURCES = ["user", "project", "local", "managed"] as const;
9
+ export type SettingsSource = (typeof SETTINGS_SOURCES)[number];
10
+
11
+ export const PERMISSION_KINDS = ["allow", "ask", "deny"] as const;
12
+ export type PermissionKind = (typeof PERMISSION_KINDS)[number];
13
+
14
+ export interface SettingsFile {
15
+ source: SettingsSource;
16
+ path: string;
17
+ /** "absent": no such file; "invalid": not a JSON object, so Claude Code skips it. */
18
+ state: "ok" | "absent" | "invalid";
19
+ }
20
+
21
+ export interface FromSource<T> {
22
+ value: T;
23
+ source: SettingsSource;
24
+ }
25
+
26
+ export interface LibrarySettings {
27
+ cwd: string;
28
+ files: SettingsFile[];
29
+ /** Every rule of each kind, from every file: the lists merge. */
30
+ permissions: Record<PermissionKind, FromSource<string>[]>;
31
+ /** Each variable's value from the strongest file that sets it. */
32
+ env: (FromSource<string> & { name: string })[];
33
+ /** Each hook event's entries, from every file. */
34
+ hooks: (FromSource<string> & { event: string })[];
35
+ /** Every other top-level key, from the strongest file that sets it, as JSON. */
36
+ other: (FromSource<string> & { key: string })[];
37
+ }
38
+
39
+ const isSource = (value: unknown): value is SettingsSource => SETTINGS_SOURCES.some((source) => source === value);
40
+ const isFrom = (value: unknown, extra: string | null = null): boolean =>
41
+ isRecord(value) && typeof value.value === "string" && isSource(value.source) && (extra === null || typeof value[extra] === "string");
42
+ const isFile = (value: unknown): value is SettingsFile =>
43
+ isRecord(value) &&
44
+ isSource(value.source) &&
45
+ typeof value.path === "string" &&
46
+ (value.state === "ok" || value.state === "absent" || value.state === "invalid");
47
+
48
+ const listOf = (value: unknown, extra: string | null): boolean => Array.isArray(value) && value.every((entry) => isFrom(entry, extra));
49
+
50
+ const isPermissions = (value: unknown): value is LibrarySettings["permissions"] =>
51
+ isRecord(value) && PERMISSION_KINDS.every((kind) => listOf(value[kind], null));
52
+
53
+ export const isLibrarySettings = (value: unknown): value is LibrarySettings =>
54
+ isRecord(value) &&
55
+ typeof value.cwd === "string" &&
56
+ Array.isArray(value.files) &&
57
+ value.files.every(isFile) &&
58
+ isPermissions(value.permissions) &&
59
+ listOf(value.env, "name") &&
60
+ listOf(value.hooks, "event") &&
61
+ listOf(value.other, "key");
@@ -0,0 +1,105 @@
1
+ // What Claude Code's home takes on disk, for the Library's Storage view (#3333). The server measures
2
+ // it on a worker thread and answers in this shape; the browser only shows it.
3
+ import { isRecord } from "./isRecord.js";
4
+
5
+ /** Space taken under one path: bytes on disk, how many files, and how many entries could not be read
6
+ * (counted, then skipped). */
7
+ export interface StorageSize {
8
+ bytes: number;
9
+ files: number;
10
+ unreadable: number;
11
+ }
12
+
13
+ /** One entry directly under Claude Code's home (`projects`, `debug`, `history.jsonl`, …). */
14
+ export interface StorageEntry extends StorageSize {
15
+ name: string;
16
+ directory: boolean;
17
+ }
18
+
19
+ /** One project folder under `projects/`, with the directory it is named after when the Library's
20
+ * index knows it. */
21
+ export interface StorageProject extends StorageSize {
22
+ slug: string;
23
+ cwd: string | null;
24
+ temporary: boolean;
25
+ }
26
+
27
+ /** The projects matching a query beyond the ones listed, summed. */
28
+ export interface StorageProjectRest extends StorageSize {
29
+ count: number;
30
+ }
31
+
32
+ export interface StorageMeasure {
33
+ /** Epoch ms the measurement finished. */
34
+ measuredAt: number;
35
+ total: StorageSize;
36
+ entries: StorageEntry[];
37
+ /** The largest projects matching the query, largest first. */
38
+ projects: StorageProject[];
39
+ otherProjects: StorageProjectRest;
40
+ }
41
+
42
+ /** Claude Code's `cleanupPeriodDays`: as set, its default when unset, or unreadable settings. */
43
+ export type CleanupPeriod = { state: "set" | "default"; days: number } | { state: "unreadable" };
44
+
45
+ /** Claude Code's default for `cleanupPeriodDays`, from its own settings documentation. */
46
+ export const CLEANUP_PERIOD_DEFAULT_DAYS = 30;
47
+
48
+ export interface StorageProgress {
49
+ done: number;
50
+ of: number;
51
+ }
52
+
53
+ /** GET /api/library/storage. `measure` is the last finished measurement (null before the first);
54
+ * `measuring` is the one running now, if any; `measureFailed` says the last one ended without an
55
+ * answer, `measure` then being an older one or null. */
56
+ export interface LibraryStorageAnswer {
57
+ root: string;
58
+ measure: StorageMeasure | null;
59
+ measuring: StorageProgress | null;
60
+ measureFailed: boolean;
61
+ cleanup: CleanupPeriod;
62
+ }
63
+
64
+ /** The entry that holds the project folders. */
65
+ export const PROJECTS_ENTRY = "projects";
66
+
67
+ const isSize = (value: Record<string, unknown>): boolean =>
68
+ typeof value.bytes === "number" && typeof value.files === "number" && typeof value.unreadable === "number";
69
+
70
+ const isEntry = (value: unknown): value is StorageEntry =>
71
+ isRecord(value) && isSize(value) && typeof value.name === "string" && typeof value.directory === "boolean";
72
+
73
+ const isProject = (value: unknown): value is StorageProject =>
74
+ isRecord(value) &&
75
+ isSize(value) &&
76
+ typeof value.slug === "string" &&
77
+ (value.cwd === null || typeof value.cwd === "string") &&
78
+ typeof value.temporary === "boolean";
79
+
80
+ const isMeasure = (value: unknown): value is StorageMeasure =>
81
+ isRecord(value) &&
82
+ typeof value.measuredAt === "number" &&
83
+ isRecord(value.total) &&
84
+ isSize(value.total) &&
85
+ Array.isArray(value.entries) &&
86
+ value.entries.every(isEntry) &&
87
+ Array.isArray(value.projects) &&
88
+ value.projects.every(isProject) &&
89
+ isRecord(value.otherProjects) &&
90
+ isSize(value.otherProjects) &&
91
+ typeof value.otherProjects.count === "number";
92
+
93
+ const isCleanup = (value: unknown): value is CleanupPeriod =>
94
+ isRecord(value) && (value.state === "unreadable" || ((value.state === "set" || value.state === "default") && typeof value.days === "number"));
95
+
96
+ export const isStorageProgress = (value: unknown): value is StorageProgress =>
97
+ isRecord(value) && typeof value.done === "number" && typeof value.of === "number";
98
+
99
+ export const isLibraryStorageAnswer = (value: unknown): value is LibraryStorageAnswer =>
100
+ isRecord(value) &&
101
+ typeof value.root === "string" &&
102
+ (value.measure === null || isMeasure(value.measure)) &&
103
+ (value.measuring === null || isStorageProgress(value.measuring)) &&
104
+ typeof value.measureFailed === "boolean" &&
105
+ isCleanup(value.cleanup);
@@ -0,0 +1,52 @@
1
+ // What the Library's tools kind shows for one directory (#3332): the instruction files Claude Code
2
+ // loads there, in the order it loads them. Shared by the route and the view.
3
+ import { isRecord } from "./isRecord.js";
4
+
5
+ export const INSTRUCTION_SCOPES = ["managed", "user", "user-rule", "directory", "project", "local", "rule", "agents", "import"] as const;
6
+ export type LibraryInstructionScope = (typeof INSTRUCTION_SCOPES)[number];
7
+
8
+ /** Claude Code skips an instruction file larger than this and loads none of it. */
9
+ export const INSTRUCTION_FILE_MAX_BYTES = 4 * 1024 * 1024;
10
+
11
+ export interface LibraryInstructionFile {
12
+ scope: LibraryInstructionScope;
13
+ path: string;
14
+ /** "launch": read at session start; "on-demand": only when Claude works with matching files;
15
+ * "approval": outside the directory, read only once external imports are approved for it. */
16
+ loads: "launch" | "on-demand" | "approval";
17
+ /** The file whose `@path` import brought this one in, for an import. */
18
+ importedBy: string | null;
19
+ lines: number;
20
+ bytes: number;
21
+ /** "too-large": over the size Claude Code reads at all, so none of it loads. */
22
+ state: "ok" | "too-large" | "unreadable";
23
+ }
24
+
25
+ export interface LibraryInstructions {
26
+ cwd: string;
27
+ files: LibraryInstructionFile[];
28
+ /** No CLAUDE.md counts here, so Claude Code reads AGENTS.md instead (the default setting). */
29
+ agentsMd: boolean;
30
+ /** The listing stopped at its bound: more files load than are listed. */
31
+ truncated: boolean;
32
+ }
33
+
34
+ const isScope = (value: unknown): value is LibraryInstructionScope => INSTRUCTION_SCOPES.some((scope) => scope === value);
35
+
36
+ const isInstructionFile = (value: unknown): value is LibraryInstructionFile =>
37
+ isRecord(value) &&
38
+ isScope(value.scope) &&
39
+ typeof value.path === "string" &&
40
+ (value.loads === "launch" || value.loads === "on-demand" || value.loads === "approval") &&
41
+ (value.importedBy === null || typeof value.importedBy === "string") &&
42
+ typeof value.lines === "number" &&
43
+ typeof value.bytes === "number" &&
44
+ (value.state === "ok" || value.state === "too-large" || value.state === "unreadable");
45
+
46
+ export const isLibraryInstructions = (value: unknown): value is LibraryInstructions =>
47
+ isRecord(value) &&
48
+ typeof value.cwd === "string" &&
49
+ Array.isArray(value.files) &&
50
+ value.files.every(isInstructionFile) &&
51
+ typeof value.agentsMd === "boolean" &&
52
+ typeof value.truncated === "boolean";
@@ -0,0 +1,18 @@
1
+ import { isRecord } from "./isRecord.js";
2
+
3
+ // The pub/sub channel carrying "a terminal process was just registered for this session" — a fresh
4
+ // spawn, or a tmux session re-attached after a server restart. The GitHub board listens so a
5
+ // terminal opened anywhere shows on its card without waiting for the next read (#3363).
6
+ //
7
+ // A channel of its own rather than the `sessions` row: every consumer of that channel reads a row
8
+ // as attention state (the sound, the favicon, the cell's status), so a row that only says "opened"
9
+ // would be taken as idle and could even end a turn that was working before a restart. And a quiet
10
+ // shell never moves a flag, so the row is never published for it at all.
11
+ export const PTY_OPENED_CHANNEL = "pty-opened";
12
+
13
+ export interface PtyOpenedEvent {
14
+ sessionId: string;
15
+ cwd: string;
16
+ }
17
+
18
+ export const isPtyOpenedEvent = (data: unknown): data is PtyOpenedEvent => isRecord(data) && typeof data.sessionId === "string" && typeof data.cwd === "string";
@@ -0,0 +1,8 @@
1
+ // A string without the characters of a set at its end — `trimEnd` for characters other than spaces.
2
+
3
+ /** `text` without any of `chars` at its end. Measured in UTF-16 units, as `slice` is. */
4
+ export function trimEndOf(text: string, chars: ReadonlySet<string>): string {
5
+ let end = text.length;
6
+ while (end > 0 && chars.has(text.charAt(end - 1))) end -= 1;
7
+ return text.slice(0, end);
8
+ }