@weavecode/weave 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/README.md +14 -0
  2. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/index.js +5 -10
  3. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/encodeurl/package.json +10 -6
  4. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/CHANGELOG.md +42 -0
  5. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/README.md +38 -10
  6. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/dist/qs.js +18 -18
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/parse.js +16 -4
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/utils.js +13 -2
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/package.json +1 -1
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.cjs +6 -2
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/dist/index.mjs +6 -2
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/package.json +10 -10
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +8 -0
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  19. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  20. package/node_modules/@weavecode/cli/dist/cli.js +4 -4
  21. package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
  22. package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
  23. package/node_modules/@weavecode/cli/dist/commands/daemon.d.ts +2 -0
  24. package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
  25. package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
  26. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  27. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  28. package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
  29. package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
  30. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  31. package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
  32. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +5 -5
  33. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +6 -1
  34. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +5 -5
  35. package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
  36. package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
  37. package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +3 -3
  38. package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
  39. package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
  40. package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
  41. package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
  42. package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
  43. package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
  44. package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
  45. package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
  46. package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
  47. package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
  48. package/node_modules/@weavecode/cli/dist/parser.js +1 -1
  49. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  50. package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
  51. package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
  52. package/node_modules/@weavecode/cli/package.json +5 -5
  53. package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
  54. package/node_modules/@weavecode/core/dist/harness.d.ts +25 -0
  55. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  56. package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
  57. package/node_modules/@weavecode/core/dist/index.js +1 -1
  58. package/node_modules/@weavecode/core/dist/platform.js +1 -1
  59. package/node_modules/@weavecode/core/dist/types.js +1 -1
  60. package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
  61. package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
  62. package/node_modules/@weavecode/core/package.json +1 -1
  63. package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -4
  64. package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
  65. package/node_modules/@weavecode/harness/dist/claude/commands.d.ts +3 -0
  66. package/node_modules/@weavecode/harness/dist/claude/commands.js +2 -3
  67. package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
  68. package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
  69. package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
  70. package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
  71. package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
  72. package/node_modules/@weavecode/harness/dist/claude/index.d.ts +1 -0
  73. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  74. package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -1
  75. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
  76. package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
  77. package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
  78. package/node_modules/@weavecode/harness/dist/claude/narration.d.ts +0 -11
  79. package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
  80. package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
  81. package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
  82. package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
  83. package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
  84. package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
  85. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
  86. package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
  87. package/node_modules/@weavecode/harness/dist/claude/rewind.d.ts +8 -0
  88. package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -0
  89. package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
  90. package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
  91. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +36 -15
  92. package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
  93. package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
  94. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.d.ts +26 -0
  95. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -0
  96. package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -7
  97. package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
  98. package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
  99. package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
  100. package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
  101. package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
  102. package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
  103. package/node_modules/@weavecode/harness/dist/codex/images.js +1 -1
  104. package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
  105. package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -1
  106. package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
  107. package/node_modules/@weavecode/harness/dist/codex/messaging.js +2 -2
  108. package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -1
  109. package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
  110. package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
  111. package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -1
  112. package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -2
  113. package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
  114. package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -4
  115. package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -4
  116. package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
  117. package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
  118. package/node_modules/@weavecode/harness/dist/driver.d.ts +56 -1
  119. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  120. package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
  121. package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
  122. package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
  123. package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
  124. package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
  125. package/node_modules/@weavecode/harness/package.json +2 -2
  126. package/node_modules/@weavecode/server/dist/config/profiles.d.ts +19 -13
  127. package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
  128. package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
  129. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  130. package/node_modules/@weavecode/server/dist/daemon/entry.js +7 -1
  131. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  132. package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
  133. package/node_modules/@weavecode/server/dist/daemon/opener.d.ts +2 -0
  134. package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
  135. package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
  136. package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
  137. package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
  138. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.d.ts +3 -0
  139. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +1 -0
  140. package/node_modules/@weavecode/server/dist/daemon/server.js +2 -2
  141. package/node_modules/@weavecode/server/dist/daemon/session-open.d.ts +17 -0
  142. package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
  143. package/node_modules/@weavecode/server/dist/daemon/session-probe.d.ts +5 -4
  144. package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
  145. package/node_modules/@weavecode/server/dist/db/db.js +6 -2
  146. package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +3 -1
  147. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.d.ts +12 -6
  148. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
  149. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.d.ts +3 -3
  150. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
  151. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.d.ts +19 -9
  152. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
  153. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.d.ts +2 -2
  154. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
  155. package/node_modules/@weavecode/server/dist/hooks/delivery/views.d.ts +5 -1
  156. package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
  157. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.d.ts +45 -38
  158. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -3
  159. package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +1 -1
  160. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +4 -4
  161. package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +11 -1
  162. package/node_modules/@weavecode/server/dist/repositories/sessions.js +4 -2
  163. package/node_modules/@weavecode/server/dist/repositories/uploads.d.ts +14 -4
  164. package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
  165. package/node_modules/@weavecode/server/dist/surfaces.d.ts +3 -1
  166. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  167. package/node_modules/@weavecode/server/package.json +4 -4
  168. package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-C-f9WfD3.js → abnfDiagram-WEYOIA3C-DDeQkTf5.js} +1 -1
  169. package/node_modules/@weavecode/server/web/dist/assets/{arc-D62qulAD.js → arc-CRZTRyjb.js} +1 -1
  170. package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-B6ZJRpcL.js → architectureDiagram-ZHVYKT53-Dj54DE3O.js} +1 -1
  171. package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-DOtDFeiT.js → blockDiagram-RJAE7QA3-BIH8mSIZ.js} +1 -1
  172. package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-DWn3ng8X.js → c4Diagram-XDPPPE54-5YoKWFOD.js} +1 -1
  173. package/node_modules/@weavecode/server/web/dist/assets/channel-5VM93AJ8.js +1 -0
  174. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-B5IIc9cn.js → chunk-2E7WHVMD-B653kMXt.js} +1 -1
  175. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-BUU9Zvt8.js → chunk-2Q5K7J3B-f_A4_eDz.js} +1 -1
  176. package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-CqEGIghP.js → chunk-4EMNKR2T-v5j5qNGj.js} +1 -1
  177. package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-D36o_E2b.js → chunk-55XCU76K-CgEqeP7j.js} +1 -1
  178. package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-sxws8ERh.js → chunk-5VM5RSS4-BeROhLXN.js} +1 -1
  179. package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-CJo_rEEb.js → chunk-JWPE2WC7-D6dXb_jr.js} +1 -1
  180. package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-9UlLCpsb.js → chunk-VQ5W62QI-CnHdSEMi.js} +1 -1
  181. package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-CX9CPbWb.js → chunk-XXDRQBXY-BkG_e6PE.js} +1 -1
  182. package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-DwEfdZcF.js → chunk-ZCHMQSOR-DxR-fxzs.js} +2 -2
  183. package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-CFCmIyt8.js → classDiagram-v2-4MYWR3UA-DQe1b_k8.js} +1 -1
  184. package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-qWXeXJTn.js → cose-bilkent-JH36ORCC-DThrA8S5.js} +1 -1
  185. package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-CXabWQxz.js → cynefin-EF2NZ3EQ-OZotFKUu.js} +1 -1
  186. package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-Bzpj8Qbj.js → cynefinDiagram-WF24UDRP-DJjq2hfT.js} +1 -1
  187. package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-CXsL8t30.js → dagre-NK4GIZVX-C2vH93HT.js} +1 -1
  188. package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-xfR-zlAD.js → diagram-CBK3MWTC-DrF_ScM-.js} +1 -1
  189. package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-BjMqEsXr.js → diagram-I5XIIV2D-D1qoUJ4t.js} +1 -1
  190. package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-QZpf8KhT.js → diagram-ODIL2UCW-D9A6W8oB.js} +1 -1
  191. package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-Cw1ESWft.js → diagram-PFBEJUXE-PeI-eyu2.js} +1 -1
  192. package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-CAy2RYYZ.js → diagram-RJA3I4VV-DITY0Rd8.js} +1 -1
  193. package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-B09WciWt.js → diagram-TYUNFSNR-D5KieEw5.js} +1 -1
  194. package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-DuLmHG0U.js → ebnfDiagram-V4P3TTPT-DDylK-gz.js} +1 -1
  195. package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ--zzx0EVP.js → elk-QONTBCTQ-D3xrVg0U.js} +1 -1
  196. package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-BPDjG5vB.js → erDiagram-KYQIGQAA-y_V1cor7.js} +1 -1
  197. package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-DtE2M9a_.js → flowDiagram-IUGLLWBU-BJ8Z0MkF.js} +1 -1
  198. package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-B-4AaWVa.js → ganttDiagram-R7GPNTJY-C0q-CS1T.js} +1 -1
  199. package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-CYj5FGYx.js → gitGraphDiagram-PDYL7XHY-BYTComiB.js} +1 -1
  200. package/node_modules/@weavecode/server/web/dist/assets/index-BKxAxaVG.js +1091 -0
  201. package/node_modules/@weavecode/server/web/dist/assets/index-C0Sd4MH7.css +11 -0
  202. package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-DHYSDj-3.js → infoDiagram-MVDRKAX5-DtixgjLP.js} +1 -1
  203. package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-CumAEBoU.js → ishikawaDiagram-HPEHV2GE-ChEnND76.js} +1 -1
  204. package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-ES3O3X05.js → journeyDiagram-BOSHW7O7-DHcNtpYF.js} +1 -1
  205. package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-BMIrf0d9.js → kanban-definition-FNSA4HC5-Dft7qpW5.js} +1 -1
  206. package/node_modules/@weavecode/server/web/dist/assets/{linear-DEZ5FO1r.js → linear-DEo11t-X.js} +1 -1
  207. package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-D7gm2szA.js → mermaid.core-D_Dp_Kl2.js} +4 -4
  208. package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-BBQP8lyN.js → mindmap-definition-6OY57UG3-CM6OAd_-.js} +1 -1
  209. package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-DzkKsqmg.js → pegDiagram-ECIUJNBX-_QkY0h8Q.js} +1 -1
  210. package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-zR3q7Qs1.js → pieDiagram-GNMPY74T-ZGr5vtDj.js} +1 -1
  211. package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-B4xuIsMW.js → quadrantDiagram-D57K4MC3-D8pQ_PU2.js} +1 -1
  212. package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-D2I52m9D.js → railroadDiagram-Y72NRBL7-DUIo-WmA.js} +1 -1
  213. package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-aJ1KfKj2.js → requirementDiagram-EQYSW5RA-C90DU5Ny.js} +1 -1
  214. package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-CEq16Ecf.js → sankeyDiagram-SY24JHO5-B_poYGgJ.js} +1 -1
  215. package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-Bc66KG9f.js → sequenceDiagram-BLEHNHQU-DDW7b2Dn.js} +1 -1
  216. package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-Ddizw_UG.js → sizeCapture-INFHLROL-CmKoqX6K.js} +1 -1
  217. package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-C1eVtEX9.js → stateDiagram-v2-A6IESKWZ-CkVMAyxG.js} +1 -1
  218. package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-CCd_KlpZ.js → swimlanes-B3ENRKFQ-Dm_Omzky.js} +1 -1
  219. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-Bjj8ZA4d.js +8 -0
  220. package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-DqpBhIII.js → timeline-definition-JXYKGLGB-DnhkRGLb.js} +1 -1
  221. package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-bX_jNjSt.js → usecaseDiagram-WPOLBNNX-_TdIjC6Z.js} +1 -1
  222. package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-D07CUHl3.js → vennDiagram-Q3Y3IDCW-FzgsymXB.js} +1 -1
  223. package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-CZ5ovcWa.js → wardleyDiagram-IVAIDKWA-BwqimStC.js} +1 -1
  224. package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-CBTh52hU.js → xychartDiagram-4URNHDU4-CFjjVPIV.js} +1 -1
  225. package/node_modules/@weavecode/server/web/dist/icons/apple-touch-icon.png +0 -0
  226. package/node_modules/@weavecode/server/web/dist/icons/icon-192.png +0 -0
  227. package/node_modules/@weavecode/server/web/dist/icons/icon-512.png +0 -0
  228. package/node_modules/@weavecode/server/web/dist/icons/icon-maskable-512.png +0 -0
  229. package/node_modules/@weavecode/server/web/dist/index.html +11 -2
  230. package/node_modules/@weavecode/server/web/dist/manifest.webmanifest +16 -0
  231. package/node_modules/@weavecode/server/web/dist/sw.js +14 -12
  232. package/node_modules/@weavecode/templates/package.json +2 -2
  233. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/README.md +3 -8
  234. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/package.json +1 -1
  235. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.d.ts +4 -2
  236. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.es6.js +10 -1
  237. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.es6.mjs +10 -1
  238. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.js +10 -1
  239. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/README.md +3 -8
  240. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/package.json +1 -1
  241. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.d.ts +4 -2
  242. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.es6.js +10 -1
  243. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.es6.mjs +10 -1
  244. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.js +10 -1
  245. package/package.json +6 -6
  246. package/node_modules/@weavecode/server/web/dist/assets/channel-CjSr3Zfg.js +0 -1
  247. package/node_modules/@weavecode/server/web/dist/assets/index-BGdTLG4q.js +0 -1031
  248. package/node_modules/@weavecode/server/web/dist/assets/index-CEpJpR7P.css +0 -11
  249. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-yIifcHaR.js +0 -8
@@ -225,6 +225,31 @@ export declare const HARNESS_SESSION_CONTROL: {
225
225
  effortLevels: never[];
226
226
  };
227
227
  };
228
+ /**
229
+ * 渲染块协议——对话内嵌可视化的引用行文法与 fragment 契约(跨 harness 统一,
230
+ * 模型侧由 skill 教;文法与 codex Desktop 的 visualize 引用行兼容)。
231
+ * 识别唯一实现 = web 的 visualizeSegments;服务端只读端点的白名单与大小上限
232
+ * 亦从此表取值。suffix 可缺席(codex TUI 实测如此)。
233
+ */
234
+ export declare const VISUALIZATION_PROTOCOL: {
235
+ /** 引用行开头:U+E200 + `visualize` + U+E202,其后紧跟 JSON。 */
236
+ readonly referencePrefix: "visualize";
237
+ /** 引用行结尾(可缺席)。 */
238
+ readonly referenceSuffix: "";
239
+ /**
240
+ * 同义写法(识别侧一并接受,生成侧仍以上面的 canonical 形为准):模型实测
241
+ * 会把三枚私有区字符整组写成 LANGUAGE TAG 区(U+E200→U+E0000、U+E202→
242
+ * U+E0001、U+E201→U+E0002)——屏上全不可见、语义一致,认不出整块就静默
243
+ * 退化成普通文本(2026-10-30 转录实测)。**降级形(裸 `visualize`)也认**:
244
+ * 压缩摘要这一层常把不可见字符整个吃掉,模型据摘要复述时写出的就是裸行
245
+ * (同日实测两条,都在压缩之后)。裸行只在一整行恰好是 `visualize` + 合法
246
+ * JSON 且带 path 时才成立,正文里的提及(带前缀文字 / 反引号包裹)不命中。
247
+ */
248
+ readonly referencePrefixAliases: readonly ["󠀀visualize󠀁", "visualize"];
249
+ readonly referenceSuffixAliases: readonly ["󠀂"];
250
+ /** fragment 文件大小上限(字节)。 */
251
+ readonly maxFragmentBytes: number;
252
+ };
228
253
  /**
229
254
  * 可选 harness 键序(= 名单表):`--harness` flag 值域与 init 交互多选的
230
255
  * 选项表共用(批 5)。经名单表派生而非 `Object.keys(HARNESS_EVENTS)`——
@@ -1 +1 @@
1
- export const HARNESS_NAMES=["claude","codex"];export function isHarness(e){return typeof e=="string"&&HARNESS_NAMES.includes(e)}export const HARNESS_EVENTS={claude:["PreToolUse","PostToolUse","UserPromptSubmit","SessionStart","Stop","StopFailure","SubagentStop","Notification","PostToolUseFailure","PermissionRequest","PermissionDenied","SubagentStart","PreCompact","SessionEnd","PreModelSwitch","PostModelSwitch"],codex:["SessionStart","UserPromptSubmit","Stop","TurnAborted","PostToolUse","SessionEnd","PreCompact","PostCompact","SubagentStart","SubagentStop","PermissionRequest"]},HARNESS_TOOL_EVENTS={claude:["PreToolUse","PostToolUse","PostToolUseFailure"],codex:["PostToolUse"]},INJECTABLE_EVENTS={claude:["PostToolUse","UserPromptSubmit","SessionStart","Stop","SubagentStop"],codex:[]},TITLE_EFFECTIVE_EVENTS={claude:["SessionStart","UserPromptSubmit"],codex:[]},HARNESS_EVENT_UNION=[...new Set(Object.values(HARNESS_EVENTS).flat())],HARNESS_DIRS={claude:{projectDir:".claude",userDir:".claude"},codex:{projectDir:".codex",userDir:".codex"}},HARNESS_INSTRUCTION_FILES={claude:["CLAUDE.md"],codex:["AGENTS.md"]},HARNESS_LIFECYCLE={claude:{open:"UserPromptSubmit",close:["Stop","StopFailure"],closeFailed:["StopFailure"],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:["AskUserQuestion","ExitPlanMode"],sessionExit:"SessionEnd"},codex:{open:"UserPromptSubmit",close:["Stop","TurnAborted"],closeFailed:[],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:[],sessionExit:"SessionEnd"}},HARNESS_COMPACTION={claude:{start:"PreCompact",end:"SessionStart",endSource:"compact"},codex:{start:null,end:null,endSource:null}},HARNESS_SESSION_CONTROL={claude:{modeNames:["default","acceptEdits","plan","auto","dontAsk","bypassPermissions"],modelNames:["default","opus","sonnet","haiku","fable"],modelFactEvents:["PostModelSwitch","SessionStart"],effortLevels:["low","medium","high","xhigh","max"]},codex:{modeNames:[],modelNames:[],modelFactEvents:[],effortLevels:[]}},HARNESS_KEYS=HARNESS_NAMES,INSTRUCTION_FILES=[...new Set(HARNESS_KEYS.flatMap(e=>[...HARNESS_INSTRUCTION_FILES[e]]))];
1
+ export const HARNESS_NAMES=["claude","codex"];export function isHarness(e){return typeof e=="string"&&HARNESS_NAMES.includes(e)}export const HARNESS_EVENTS={claude:["PreToolUse","PostToolUse","UserPromptSubmit","SessionStart","Stop","StopFailure","SubagentStop","Notification","PostToolUseFailure","PermissionRequest","PermissionDenied","SubagentStart","PreCompact","SessionEnd","PreModelSwitch","PostModelSwitch"],codex:["SessionStart","UserPromptSubmit","Stop","TurnAborted","PostToolUse","SessionEnd","PreCompact","PostCompact","SubagentStart","SubagentStop","PermissionRequest"]},HARNESS_TOOL_EVENTS={claude:["PreToolUse","PostToolUse","PostToolUseFailure"],codex:["PostToolUse"]},INJECTABLE_EVENTS={claude:["PostToolUse","UserPromptSubmit","SessionStart","Stop","SubagentStop"],codex:[]},TITLE_EFFECTIVE_EVENTS={claude:["SessionStart","UserPromptSubmit"],codex:[]},HARNESS_EVENT_UNION=[...new Set(Object.values(HARNESS_EVENTS).flat())],HARNESS_DIRS={claude:{projectDir:".claude",userDir:".claude"},codex:{projectDir:".codex",userDir:".codex"}},HARNESS_INSTRUCTION_FILES={claude:["CLAUDE.md"],codex:["AGENTS.md"]},HARNESS_LIFECYCLE={claude:{open:"UserPromptSubmit",close:["Stop","StopFailure"],closeFailed:["StopFailure"],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:["AskUserQuestion","ExitPlanMode"],sessionExit:"SessionEnd"},codex:{open:"UserPromptSubmit",close:["Stop","TurnAborted"],closeFailed:[],sessionMarkers:["SessionStart","SessionEnd"],subagentStop:"SubagentStop",questionTools:[],sessionExit:"SessionEnd"}},HARNESS_COMPACTION={claude:{start:"PreCompact",end:"SessionStart",endSource:"compact"},codex:{start:null,end:null,endSource:null}},HARNESS_SESSION_CONTROL={claude:{modeNames:["default","acceptEdits","plan","auto","dontAsk","bypassPermissions"],modelNames:["default","opus","sonnet","haiku","fable"],modelFactEvents:["PostModelSwitch","SessionStart"],effortLevels:["low","medium","high","xhigh","max"]},codex:{modeNames:[],modelNames:[],modelFactEvents:[],effortLevels:[]}},VISUALIZATION_PROTOCOL={referencePrefix:"\uE200visualize\uE202",referenceSuffix:"\uE201",referencePrefixAliases:["\u{E0000}visualize\u{E0001}","visualize"],referenceSuffixAliases:["\u{E0002}"],maxFragmentBytes:1024*1024},HARNESS_KEYS=HARNESS_NAMES,INSTRUCTION_FILES=[...new Set(HARNESS_KEYS.flatMap(e=>[...HARNESS_INSTRUCTION_FILES[e]]))];
@@ -4,7 +4,7 @@ export type { HookRule, HookRuleSource, HookRuleFilter, HookRuleOrigin, HandlerC
4
4
  export { HookRuleSchema, HookRuleSourceSchema, HookRuleFilterSchema, HookRuleOriginSchema, HandlerConfigSchema, HookDispatchStatusSchema, HookDispatchModeSchema, PluginRuleEntrySchema, WeavePluginManifestSchema, WEAVE_PLUGIN_MANIFEST, CLAUDE_HOOK_EVENTS, INJECTABLE_HOOK_EVENTS, } from './types.js';
5
5
  export { InitOptionsSchema, PresetSchema, resolveComponents } from './types.js';
6
6
  export { normalizeHookRuleSource, hookSourceHarness } from './types.js';
7
- export { type Harness, type InstructionFile, HARNESS_EVENTS, HARNESS_KEYS, HARNESS_NAMES, HARNESS_EVENT_UNION, HARNESS_TOOL_EVENTS, HARNESS_INSTRUCTION_FILES, INSTRUCTION_FILES, INJECTABLE_EVENTS, TITLE_EFFECTIVE_EVENTS, HARNESS_DIRS, HARNESS_LIFECYCLE, HARNESS_COMPACTION, HARNESS_SESSION_CONTROL, type HarnessCompaction, isHarness, } from './harness.js';
7
+ export { type Harness, type InstructionFile, HARNESS_EVENTS, HARNESS_KEYS, HARNESS_NAMES, HARNESS_EVENT_UNION, HARNESS_TOOL_EVENTS, HARNESS_INSTRUCTION_FILES, INSTRUCTION_FILES, INJECTABLE_EVENTS, TITLE_EFFECTIVE_EVENTS, HARNESS_DIRS, HARNESS_LIFECYCLE, HARNESS_COMPACTION, HARNESS_SESSION_CONTROL, VISUALIZATION_PROTOCOL, type HarnessCompaction, isHarness, } from './harness.js';
8
8
  export { TERMINAL_LOCATOR_ENV, TERMINAL_LOCATOR_ENV_KEYS } from './terminal.js';
9
9
  export { type ToolScope, type ToolCategory, type EnableOverride, type InstallState, type ToolStateRow, } from './tool.js';
10
10
  export { DEFAULT_COMPONENTS, FULL_COMPONENTS, MINIMAL_COMPONENTS } from './types.js';
@@ -1 +1 @@
1
- export{HookRuleSchema,HookRuleSourceSchema,HookRuleFilterSchema,HookRuleOriginSchema,HandlerConfigSchema,HookDispatchStatusSchema,HookDispatchModeSchema,PluginRuleEntrySchema,WeavePluginManifestSchema,WEAVE_PLUGIN_MANIFEST,CLAUDE_HOOK_EVENTS,INJECTABLE_HOOK_EVENTS}from"./types.js";export{InitOptionsSchema,PresetSchema,resolveComponents}from"./types.js";export{normalizeHookRuleSource,hookSourceHarness}from"./types.js";export{HARNESS_EVENTS,HARNESS_KEYS,HARNESS_NAMES,HARNESS_EVENT_UNION,HARNESS_TOOL_EVENTS,HARNESS_INSTRUCTION_FILES,INSTRUCTION_FILES,INJECTABLE_EVENTS,TITLE_EFFECTIVE_EVENTS,HARNESS_DIRS,HARNESS_LIFECYCLE,HARNESS_COMPACTION,HARNESS_SESSION_CONTROL,isHarness}from"./harness.js";export{TERMINAL_LOCATOR_ENV,TERMINAL_LOCATOR_ENV_KEYS}from"./terminal.js";export{DEFAULT_COMPONENTS,FULL_COMPONENTS,MINIMAL_COMPONENTS}from"./types.js";export{DEFAULT_HOOKS,DEFAULT_SKILLS,DEFAULT_COMMANDS,DEFAULT_AGENTS,DEFAULT_MCP}from"./types.js";export{detectPlatform}from"./platform.js";export{checkHarness}from"./harness-checks.js";export{ensureDir,writeFileIfAbsent,fileExists}from"./utils/fs.js";export{logger,formatTable}from"./utils/logger.js";
1
+ export{HookRuleSchema,HookRuleSourceSchema,HookRuleFilterSchema,HookRuleOriginSchema,HandlerConfigSchema,HookDispatchStatusSchema,HookDispatchModeSchema,PluginRuleEntrySchema,WeavePluginManifestSchema,WEAVE_PLUGIN_MANIFEST,CLAUDE_HOOK_EVENTS,INJECTABLE_HOOK_EVENTS}from"./types.js";export{InitOptionsSchema,PresetSchema,resolveComponents}from"./types.js";export{normalizeHookRuleSource,hookSourceHarness}from"./types.js";export{HARNESS_EVENTS,HARNESS_KEYS,HARNESS_NAMES,HARNESS_EVENT_UNION,HARNESS_TOOL_EVENTS,HARNESS_INSTRUCTION_FILES,INSTRUCTION_FILES,INJECTABLE_EVENTS,TITLE_EFFECTIVE_EVENTS,HARNESS_DIRS,HARNESS_LIFECYCLE,HARNESS_COMPACTION,HARNESS_SESSION_CONTROL,VISUALIZATION_PROTOCOL,isHarness}from"./harness.js";export{TERMINAL_LOCATOR_ENV,TERMINAL_LOCATOR_ENV_KEYS}from"./terminal.js";export{DEFAULT_COMPONENTS,FULL_COMPONENTS,MINIMAL_COMPONENTS}from"./types.js";export{DEFAULT_HOOKS,DEFAULT_SKILLS,DEFAULT_COMMANDS,DEFAULT_AGENTS,DEFAULT_MCP}from"./types.js";export{detectPlatform}from"./platform.js";export{checkHarness}from"./harness-checks.js";export{ensureDir,writeFileIfAbsent,fileExists}from"./utils/fs.js";export{logger,formatTable}from"./utils/logger.js";
@@ -1 +1 @@
1
- import n from"node:os";import i from"node:path";export function detectPlatform(){const c=n.platform(),a=n.arch(),e=n.homedir();let s,o,r;switch(c){case"win32":s="windows",o=process.env.PSModulePath?"powershell":"cmd",r=process.env.APPDATA||i.join(e,"AppData","Roaming");break;case"darwin":s="darwin",o=process.env.SHELL?.includes("zsh")?"zsh":"bash",r=i.join(e,"Library","Application Support");break;default:s="linux",o=process.env.SHELL?.includes("zsh")?"zsh":process.env.SHELL?.includes("bash")?"bash":"sh",r=process.env.XDG_CONFIG_HOME||i.join(e,".config")}return{os:s,arch:a,nodeVersion:process.version,shell:o,homeDir:e,configDir:r}}
1
+ import n from"node:os";import i from"node:path";export function detectPlatform(){const c=n.platform(),a=n.arch(),s=n.homedir();let e,o,r;switch(c){case"win32":e="windows",o=process.env.PSModulePath?"powershell":"cmd",r=process.env.APPDATA||i.join(s,"AppData","Roaming");break;case"darwin":e="darwin",o=process.env.SHELL?.includes("zsh")?"zsh":"bash",r=i.join(s,"Library","Application Support");break;default:e="linux",o=process.env.SHELL?.includes("zsh")?"zsh":process.env.SHELL?.includes("bash")?"bash":"sh",r=process.env.XDG_CONFIG_HOME||i.join(s,".config")}return{os:e,arch:a,nodeVersion:process.version,shell:o,homeDir:s,configDir:r}}
@@ -1 +1 @@
1
- import{z as e}from"zod";import{HARNESS_EVENTS as r,HARNESS_NAMES as a,INJECTABLE_EVENTS as s}from"./harness.js";export const PresetSchema=e.enum(["minimal","default","full"]),InitComponentsSchema=e.object({settings:e.boolean(),skills:e.boolean(),commands:e.boolean(),agents:e.boolean(),helpers:e.boolean(),mcp:e.boolean(),claudeMd:e.boolean(),agentsMd:e.boolean()}),HooksConfigSchema=e.object({preToolUse:e.boolean(),postToolUse:e.boolean(),userPromptSubmit:e.boolean(),sessionStart:e.boolean(),stop:e.boolean(),stopFailure:e.boolean(),subagentStop:e.boolean(),subagentStart:e.boolean(),notification:e.boolean(),postToolUseFailure:e.boolean(),permissionRequest:e.boolean(),permissionDenied:e.boolean(),preCompact:e.boolean(),sessionEnd:e.boolean(),preModelSwitch:e.boolean(),timeout:e.number().default(5e3),continueOnError:e.boolean().default(!0)}),CLAUDE_HOOK_EVENTS=r.claude,INJECTABLE_HOOK_EVENTS=s.claude;const i=e.enum(a),l=e.enum([...a,"any"]);export const HookRuleSourceSchema=e.discriminatedUnion("kind",[e.object({kind:e.literal("hook-event"),harness:l,event:e.string().min(1)}),e.object({kind:e.literal("webhook"),routeId:e.string().min(1)}),e.object({kind:e.literal("claude-event"),event:e.string().min(1)})]);export function normalizeHookRuleSource(n){return n.kind==="claude-event"?{kind:"hook-event",harness:"claude",event:n.event}:n}export function hookSourceHarness(n){return n.kind==="claude-event"?"claude":n.kind==="hook-event"?n.harness:null}export const HookRuleFilterSchema=e.object({toolNames:e.array(e.string().min(1)).optional(),pathGlobs:e.array(e.string().min(1)).optional(),crossProjectOnly:e.boolean().optional()}),HandlerConfigSchema=e.discriminatedUnion("type",[e.object({type:e.literal("log")}),e.object({type:e.literal("webhook"),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()}),e.object({type:e.literal("inject"),template:e.string().min(1)}),e.object({type:e.literal("manual"),template:e.string().min(1)}),e.object({type:e.literal("plugin"),pluginId:e.string().min(1),handlerType:e.string().min(1),config:e.record(e.string(),e.unknown()).optional()}),e.object({type:e.literal("classify"),prompt:e.string().min(1),prefilter:e.array(e.string().min(1)).optional(),cooldownMs:e.number().int().positive().optional(),routes:e.array(e.object({label:e.string().min(1),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()})).min(1)})]),HookRuleOriginSchema=e.enum(["user","plugin","builtin"]),HookRuleSchema=e.object({id:e.string().min(1),name:e.string().min(1),enabled:e.boolean(),priority:e.number().int(),projectId:e.number().int().nullable(),source:HookRuleSourceSchema,filter:HookRuleFilterSchema.default({}),handler:HandlerConfigSchema,timeoutMs:e.number().int().positive().default(5e3),record:e.boolean().default(!0),origin:HookRuleOriginSchema.default("user"),pluginId:e.string().min(1).nullable().default(null)}),WEAVE_PLUGIN_MANIFEST="weave-plugin.json",PluginRuleEntrySchema=HookRuleSchema.omit({id:!0,projectId:!0}).extend({enabled:e.boolean().optional(),priority:e.number().int().optional()}),WeavePluginManifestSchema=e.object({manifestVersion:e.literal(1),id:e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),name:e.string().min(1),version:e.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),description:e.string().optional(),author:e.string().optional(),engines:e.object({weave:e.string().optional()}).optional(),rules:e.array(e.string().min(1)).default([]),handlers:e.array(e.object({type:e.string().min(1),entry:e.string().min(1)})).default([]),requires:e.object({events:e.array(e.string().min(1)).optional()}).optional(),templates:e.object({skills:e.array(e.string().min(1)).optional(),commands:e.array(e.string().min(1)).optional(),agents:e.array(e.string().min(1)).optional()}).optional(),mcpServers:e.record(e.string(),e.unknown()).optional(),subscribe:e.object({events:e.array(e.string().min(1)),entry:e.string().min(1)}).optional(),statusline:e.object({entry:e.string().min(1)}).optional(),config:e.record(e.string(),e.unknown()).optional()}),HookDispatchStatusSchema=e.enum(["pending","injected","running","succeeded","failed","timeout"]),HookDispatchModeSchema=e.enum(["auto","manual"]),SkillsConfigSchema=e.object({core:e.boolean()}),CommandsConfigSchema=e.object({core:e.boolean()}),AgentsConfigSchema=e.object({core:e.boolean()}),MCPConfigSchema=e.object({weave:e.boolean(),autoStart:e.boolean().default(!1)}),RuntimeConfigSchema=e.object({initVersion:e.string(),initTimestamp:e.string(),preset:PresetSchema,harnesses:e.array(i).optional(),components:InitComponentsSchema,hooks:HooksConfigSchema.partial().optional(),mcp:MCPConfigSchema.partial().optional()}),PlatformInfoSchema=e.object({os:e.enum(["windows","darwin","linux"]),arch:e.enum(["x64","arm64"]),nodeVersion:e.string(),shell:e.enum(["powershell","cmd","bash","zsh","sh"]),homeDir:e.string(),configDir:e.string()}),InitOptionsSchema=e.object({targetDir:e.string().default(process.cwd()),force:e.boolean().default(!1),interactive:e.boolean().default(!0),preset:PresetSchema.default("default"),harnesses:e.array(i).optional(),components:InitComponentsSchema.partial().default({}),hooks:HooksConfigSchema.partial().default({}),skills:SkillsConfigSchema.partial().default({}),commands:CommandsConfigSchema.partial().default({}),agents:AgentsConfigSchema.partial().default({}),mcp:MCPConfigSchema.partial().default({})}),InitResultSchema=e.object({success:e.boolean(),platform:PlatformInfoSchema,created:e.object({directories:e.array(e.string()),files:e.array(e.string())}),skipped:e.array(e.string()),merged:e.array(e.string()),updated:e.array(e.string()),errors:e.array(e.string()),removed:e.array(e.string()),summary:e.object({skillsCount:e.number(),commandsCount:e.number(),agentsCount:e.number(),hooksEnabled:e.number()})}),MINIMAL_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!1,mcp:!1,claudeMd:!0,agentsMd:!0},DEFAULT_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},FULL_COMPONENTS={settings:!0,skills:!0,commands:!0,agents:!0,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},DEFAULT_HOOKS={preToolUse:!0,postToolUse:!0,userPromptSubmit:!0,sessionStart:!0,stop:!0,stopFailure:!0,subagentStop:!0,subagentStart:!0,notification:!0,postToolUseFailure:!0,permissionRequest:!0,permissionDenied:!0,preCompact:!0,sessionEnd:!0,preModelSwitch:!0,timeout:5e3,continueOnError:!0},DEFAULT_SKILLS={core:!0},DEFAULT_COMMANDS={core:!0},DEFAULT_AGENTS={core:!0},DEFAULT_MCP={weave:!1,autoStart:!1};export function resolveComponents(n,o){const t=n==="minimal"?MINIMAL_COMPONENTS:n==="full"?FULL_COMPONENTS:DEFAULT_COMPONENTS;return o?{...t,...o}:{...t}}
1
+ import{z as e}from"zod";import{HARNESS_EVENTS as i,HARNESS_NAMES as r,INJECTABLE_EVENTS as s}from"./harness.js";export const PresetSchema=e.enum(["minimal","default","full"]),InitComponentsSchema=e.object({settings:e.boolean(),skills:e.boolean(),commands:e.boolean(),agents:e.boolean(),helpers:e.boolean(),mcp:e.boolean(),claudeMd:e.boolean(),agentsMd:e.boolean()}),HooksConfigSchema=e.object({preToolUse:e.boolean(),postToolUse:e.boolean(),userPromptSubmit:e.boolean(),sessionStart:e.boolean(),stop:e.boolean(),stopFailure:e.boolean(),subagentStop:e.boolean(),subagentStart:e.boolean(),notification:e.boolean(),postToolUseFailure:e.boolean(),permissionRequest:e.boolean(),permissionDenied:e.boolean(),preCompact:e.boolean(),sessionEnd:e.boolean(),preModelSwitch:e.boolean(),timeout:e.number().default(5e3),continueOnError:e.boolean().default(!0)}),CLAUDE_HOOK_EVENTS=i.claude,INJECTABLE_HOOK_EVENTS=s.claude;const a=e.enum(r),l=e.enum([...r,"any"]);export const HookRuleSourceSchema=e.discriminatedUnion("kind",[e.object({kind:e.literal("hook-event"),harness:l,event:e.string().min(1)}),e.object({kind:e.literal("webhook"),routeId:e.string().min(1)}),e.object({kind:e.literal("claude-event"),event:e.string().min(1)})]);export function normalizeHookRuleSource(t){return t.kind==="claude-event"?{kind:"hook-event",harness:"claude",event:t.event}:t}export function hookSourceHarness(t){return t.kind==="claude-event"?"claude":t.kind==="hook-event"?t.harness:null}export const HookRuleFilterSchema=e.object({toolNames:e.array(e.string().min(1)).optional(),pathGlobs:e.array(e.string().min(1)).optional(),crossProjectOnly:e.boolean().optional()}),HandlerConfigSchema=e.discriminatedUnion("type",[e.object({type:e.literal("log")}),e.object({type:e.literal("webhook"),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()}),e.object({type:e.literal("inject"),template:e.string().min(1)}),e.object({type:e.literal("manual"),template:e.string().min(1)}),e.object({type:e.literal("plugin"),pluginId:e.string().min(1),handlerType:e.string().min(1),config:e.record(e.string(),e.unknown()).optional()}),e.object({type:e.literal("classify"),prompt:e.string().min(1),prefilter:e.array(e.string().min(1)).optional(),cooldownMs:e.number().int().positive().optional(),routes:e.array(e.object({label:e.string().min(1),url:e.string().url(),secret:e.string().optional(),headers:e.record(e.string(),e.string()).optional()})).min(1)})]),HookRuleOriginSchema=e.enum(["user","plugin","builtin"]),HookRuleSchema=e.object({id:e.string().min(1),name:e.string().min(1),enabled:e.boolean(),priority:e.number().int(),projectId:e.number().int().nullable(),source:HookRuleSourceSchema,filter:HookRuleFilterSchema.default({}),handler:HandlerConfigSchema,timeoutMs:e.number().int().positive().default(5e3),record:e.boolean().default(!0),origin:HookRuleOriginSchema.default("user"),pluginId:e.string().min(1).nullable().default(null)}),WEAVE_PLUGIN_MANIFEST="weave-plugin.json",PluginRuleEntrySchema=HookRuleSchema.omit({id:!0,projectId:!0}).extend({enabled:e.boolean().optional(),priority:e.number().int().optional()}),WeavePluginManifestSchema=e.object({manifestVersion:e.literal(1),id:e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),name:e.string().min(1),version:e.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/),description:e.string().optional(),author:e.string().optional(),engines:e.object({weave:e.string().optional()}).optional(),rules:e.array(e.string().min(1)).default([]),handlers:e.array(e.object({type:e.string().min(1),entry:e.string().min(1)})).default([]),requires:e.object({events:e.array(e.string().min(1)).optional()}).optional(),templates:e.object({skills:e.array(e.string().min(1)).optional(),commands:e.array(e.string().min(1)).optional(),agents:e.array(e.string().min(1)).optional()}).optional(),mcpServers:e.record(e.string(),e.unknown()).optional(),subscribe:e.object({events:e.array(e.string().min(1)),entry:e.string().min(1)}).optional(),statusline:e.object({entry:e.string().min(1)}).optional(),config:e.record(e.string(),e.unknown()).optional()}),HookDispatchStatusSchema=e.enum(["pending","injected","running","succeeded","failed","timeout"]),HookDispatchModeSchema=e.enum(["auto","manual"]),SkillsConfigSchema=e.object({core:e.boolean()}),CommandsConfigSchema=e.object({core:e.boolean()}),AgentsConfigSchema=e.object({core:e.boolean()}),MCPConfigSchema=e.object({weave:e.boolean(),autoStart:e.boolean().default(!1)}),RuntimeConfigSchema=e.object({initVersion:e.string(),initTimestamp:e.string(),preset:PresetSchema,harnesses:e.array(a).optional(),components:InitComponentsSchema,hooks:HooksConfigSchema.partial().optional(),mcp:MCPConfigSchema.partial().optional()}),PlatformInfoSchema=e.object({os:e.enum(["windows","darwin","linux"]),arch:e.enum(["x64","arm64"]),nodeVersion:e.string(),shell:e.enum(["powershell","cmd","bash","zsh","sh"]),homeDir:e.string(),configDir:e.string()}),InitOptionsSchema=e.object({targetDir:e.string().default(process.cwd()),force:e.boolean().default(!1),interactive:e.boolean().default(!0),preset:PresetSchema.default("default"),harnesses:e.array(a).optional(),components:InitComponentsSchema.partial().default({}),hooks:HooksConfigSchema.partial().default({}),skills:SkillsConfigSchema.partial().default({}),commands:CommandsConfigSchema.partial().default({}),agents:AgentsConfigSchema.partial().default({}),mcp:MCPConfigSchema.partial().default({})}),InitResultSchema=e.object({success:e.boolean(),platform:PlatformInfoSchema,created:e.object({directories:e.array(e.string()),files:e.array(e.string())}),skipped:e.array(e.string()),merged:e.array(e.string()),updated:e.array(e.string()),errors:e.array(e.string()),removed:e.array(e.string()),summary:e.object({skillsCount:e.number(),commandsCount:e.number(),agentsCount:e.number(),hooksEnabled:e.number()})}),MINIMAL_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!1,mcp:!1,claudeMd:!0,agentsMd:!0},DEFAULT_COMPONENTS={settings:!0,skills:!0,commands:!1,agents:!1,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},FULL_COMPONENTS={settings:!0,skills:!0,commands:!0,agents:!0,helpers:!0,mcp:!0,claudeMd:!0,agentsMd:!0},DEFAULT_HOOKS={preToolUse:!0,postToolUse:!0,userPromptSubmit:!0,sessionStart:!0,stop:!0,stopFailure:!0,subagentStop:!0,subagentStart:!0,notification:!0,postToolUseFailure:!0,permissionRequest:!0,permissionDenied:!0,preCompact:!0,sessionEnd:!0,preModelSwitch:!0,timeout:5e3,continueOnError:!0},DEFAULT_SKILLS={core:!0},DEFAULT_COMMANDS={core:!0},DEFAULT_AGENTS={core:!0},DEFAULT_MCP={weave:!1,autoStart:!1};export function resolveComponents(t,o){const n=t==="minimal"?MINIMAL_COMPONENTS:t==="full"?FULL_COMPONENTS:DEFAULT_COMPONENTS;return o?{...n,...o}:{...n}}
@@ -1 +1 @@
1
- import{mkdir as i,readFile as e,writeFile as n,stat as s}from"node:fs/promises";import c from"node:path";export async function ensureDir(t){await i(t,{recursive:!0})}export async function writeFileIfAbsent(t,r,a){try{if(await e(t,"utf-8"),!a)return!1}catch{}return await ensureDir(c.dirname(t)),await n(t,r,"utf-8"),!0}export async function fileExists(t){try{return await s(t),!0}catch{return!1}}
1
+ import{mkdir as i,readFile as a,writeFile as n,stat as u}from"node:fs/promises";import c from"node:path";export async function ensureDir(t){await i(t,{recursive:!0})}export async function writeFileIfAbsent(t,r,e){try{if(await a(t,"utf-8"),!e)return!1}catch{}return await ensureDir(c.dirname(t)),await n(t,r,"utf-8"),!0}export async function fileExists(t){try{return await u(t),!0}catch{return!1}}
@@ -1,2 +1,2 @@
1
- const l={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"};function o(e,n){return process.env.NO_COLOR?e:`${l[n]}${e}${l.reset}`}export const logger={info(e){console.log(o(e,"cyan"))},success(e){console.log(o(e,"green"))},warn(e){console.log(o(e,"yellow"))},error(e){console.error(o(e,"red"))},dim(e){console.log(o(e,"dim"))}};export function formatTable(e){const n=Math.max(...e.map(([r])=>r.length));return e.map(([r,c])=>` ${r.padEnd(n+2)}${c}`).join(`
1
+ const l={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"};function e(o,n){return process.env.NO_COLOR?o:`${l[n]}${o}${l.reset}`}export const logger={info(o){console.log(e(o,"cyan"))},success(o){console.log(e(o,"green"))},warn(o){console.log(e(o,"yellow"))},error(o){console.error(e(o,"red"))},dim(o){console.log(e(o,"dim"))}};export function formatTable(o){const n=Math.max(...o.map(([r])=>r.length));return o.map(([r,c])=>` ${r.padEnd(n+2)}${c}`).join(`
2
2
  `)}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Core types, schemas, and utilities for weave",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,4 +1,4 @@
1
- import{readFile as j,writeFile as u}from"node:fs/promises";import c from"node:path";import{FILE_ASSET_SPECS as m}from"../shared/file-specs.js";const l=".mcp.json",p=".claude.json";export class ClaudeJsonCorruptError extends Error{constructor(r){super(r),this.name="ClaudeJsonCorruptError"}}function f(e){if(!e||e.includes("/")||e.includes("\\")||e.includes(".."))throw new Error(`Invalid asset name: "${e}"`)}async function d(e){try{const r=JSON.parse(await j(e,"utf-8"));return r&&typeof r=="object"?r:{}}catch{return{}}}export async function readClaudeJson(e){const r=c.join(e,p);let o;try{o=await j(r,"utf-8")}catch{return{}}let t;try{t=JSON.parse(o)}catch(s){throw new ClaudeJsonCorruptError(`~/.claude.json is not valid JSON \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}if(!t||typeof t!="object"||Array.isArray(t))throw new ClaudeJsonCorruptError("~/.claude.json is not a JSON object \u2014 refusing to write");return t}export const CLAUDE_ASSETS={harness:"claude",targetDir(e,r,o,t){const s=m[e].dirs.claude;if(r==="user"){if(!s?.user)throw new Error(`"${e}" is project-scoped only (no user-level directory)`);return c.join(t,...s.user.split("/"))}if(!s?.project)throw new Error(`"${e}" has no Claude project surface`);return c.join(o,...s.project.split("/"))},projectSkillsRoots:()=>[".claude/skills"],globalSkillsRoots:e=>[c.join(e,...".claude/skills".split("/"))],userConfigFile:e=>c.join(e,".claude","settings.json"),mcpScopes:()=>["project","user"],mcpDest:(e,r)=>e==="project"?".mcp.json":c.join(r,".claude.json"),pluginCacheDir:e=>c.join(e,".claude","plugins","cache"),async mcpRead(e,r,o){if(e==="project")return(await d(c.join(r,l))).mcpServers??{};const t=(await readClaudeJson(o)).mcpServers;return!t||typeof t!="object"||Array.isArray(t)?{}:t},async mcpWrite(e,r,o,t,s){if(f(t),e==="project"){const a=c.join(r,l),i=await d(a);i.mcpServers={...i.mcpServers??{},[t]:s},await u(a,`${JSON.stringify(i,null,2)}
2
- `,"utf-8");return}const n=await readClaudeJson(o);n.mcpServers={...n.mcpServers??{},[t]:s},await u(c.join(o,p),`${JSON.stringify(n,null,2)}
3
- `,"utf-8")},async mcpRemove(e,r,o,t){f(t);const s=e==="project"?c.join(r,l):c.join(o,p),n=e==="project"?await d(s):await readClaudeJson(o),a=n.mcpServers??{};return t in a?(delete a[t],n.mcpServers=a,await u(s,`${JSON.stringify(n,null,2)}
4
- `,"utf-8"),!0):!1},classify(e){return e===".claude"||e.startsWith(".claude/")||e===".mcp.json"?!0:e.slice(e.lastIndexOf("/")+1)==="CLAUDE.md"},ignore(e){return e===".claude"||e.startsWith(".claude/")?e===".claude/projects"||e.startsWith(".claude/projects/")||e===".claude/cache"||e.startsWith(".claude/cache/"):e!==".mcp.json"&&e!=="CLAUDE.md"}};
1
+ import{readFile as d,writeFile as u}from"node:fs/promises";import n from"node:path";import{FILE_ASSET_SPECS as S}from"../shared/file-specs.js";const l=".mcp.json",p=".claude.json";export class ClaudeJsonCorruptError extends Error{constructor(t){super(t),this.name="ClaudeJsonCorruptError"}}function f(r){if(!r||r.includes("/")||r.includes("\\")||r.includes(".."))throw new Error(`Invalid asset name: "${r}"`)}async function j(r){try{const t=JSON.parse(await d(r,"utf-8"));return t&&typeof t=="object"?t:{}}catch{return{}}}export async function readClaudeJson(r){const t=n.join(r,p);let o;try{o=await d(t,"utf-8")}catch{return{}}let e;try{e=JSON.parse(o)}catch(s){throw new ClaudeJsonCorruptError(`~/.claude.json is not valid JSON \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}if(!e||typeof e!="object"||Array.isArray(e))throw new ClaudeJsonCorruptError("~/.claude.json is not a JSON object \u2014 refusing to write");return e}export const CLAUDE_ASSETS={harness:"claude",targetDir(r,t,o,e){const s=S[r].dirs.claude;if(t==="user"){if(!s?.user)throw new Error(`"${r}" is project-scoped only (no user-level directory)`);return n.join(e,...s.user.split("/"))}if(!s?.project)throw new Error(`"${r}" has no Claude project surface`);return n.join(o,...s.project.split("/"))},projectSkillsRoots:()=>[".claude/skills"],globalSkillsRoots:r=>[n.join(r,...".claude/skills".split("/"))],userConfigFile:r=>n.join(r,".claude","settings.json"),mcpScopes:()=>["project","user"],mcpDest:(r,t)=>r==="project"?".mcp.json":n.join(t,".claude.json"),pluginCacheDir:r=>n.join(r,".claude","plugins","cache"),async mcpRead(r,t,o){if(r==="project")return(await j(n.join(t,l))).mcpServers??{};const e=(await readClaudeJson(o)).mcpServers;return!e||typeof e!="object"||Array.isArray(e)?{}:e},async mcpWrite(r,t,o,e,s){if(f(e),r==="project"){const i=n.join(t,l),a=await j(i);a.mcpServers={...a.mcpServers??{},[e]:s},await u(i,`${JSON.stringify(a,null,2)}
2
+ `,"utf-8");return}const c=await readClaudeJson(o);c.mcpServers={...c.mcpServers??{},[e]:s},await u(n.join(o,p),`${JSON.stringify(c,null,2)}
3
+ `,"utf-8")},async mcpRemove(r,t,o,e){f(e);const s=r==="project"?n.join(t,l):n.join(o,p),c=r==="project"?await j(s):await readClaudeJson(o),i=c.mcpServers??{};return e in i?(delete i[e],c.mcpServers=i,await u(s,`${JSON.stringify(c,null,2)}
4
+ `,"utf-8"),!0):!1},classify(r){return r===".claude"||r.startsWith(".claude/")||r===".mcp.json"?!0:r.slice(r.lastIndexOf("/")+1)==="CLAUDE.md"},ignore(r){return r===".claude"||r.startsWith(".claude/")?r===".claude/projects"||r.startsWith(".claude/projects/")||r===".claude/cache"||r.startsWith(".claude/cache/")||r===".claude/worktrees"||r.startsWith(".claude/worktrees/"):r!==".mcp.json"&&r!=="CLAUDE.md"}};
@@ -1,4 +1,4 @@
1
- import{homedir as l}from"node:os";import{access as A,mkdir as E,readFile as f,unlink as C,writeFile as h}from"node:fs/promises";import o from"node:path";import{HARNESS_DIRS as d,HARNESS_EVENTS as S,INJECTABLE_EVENTS as D,TERMINAL_LOCATOR_ENV_KEYS as w,TITLE_EFFECTIVE_EVENTS as j}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as v}from"./prompt-inbox.js";export function generateHookHandler(e,t="claude"){return`#!/usr/bin/env node
1
+ import{homedir as u}from"node:os";import{access as j,mkdir as f,readFile as h,unlink as _,writeFile as v}from"node:fs/promises";import i from"node:path";import{HARNESS_DIRS as d,HARNESS_EVENTS as N,INJECTABLE_EVENTS as k,TERMINAL_LOCATOR_ENV_KEYS as b,TITLE_EFFECTIVE_EVENTS as T}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as m}from"./prompt-inbox.js";export function generateHookHandler(e,t="claude"){return`#!/usr/bin/env node
2
2
  /**
3
3
  * weave hook-handler \u2014 collects Claude Code hook events into the global weave
4
4
  * data directory and renders locally-mirrored injections. No network, no
@@ -28,15 +28,15 @@ const crypto = require('crypto');
28
28
  const HOOK_GUARD_MS = 2000;
29
29
  // Events that can carry additionalContext back via hook output (harness
30
30
  // contract; mirrors INJECTABLE_EVENTS server-side).
31
- const INJECTABLE_EVENTS = ${JSON.stringify(D[t])};
31
+ const INJECTABLE_EVENTS = ${JSON.stringify(k[t])};
32
32
  // The host applies hookSpecificOutput.sessionTitle ONLY on these events (mirrors
33
33
  // TITLE_EFFECTIVE_EVENTS) \u2014 tool events record hook_success but drop the field
34
34
  // (verified against Claude Code 2.1.296).
35
- const TITLE_EVENTS = ${JSON.stringify(j[t])};
35
+ const TITLE_EVENTS = ${JSON.stringify(T[t])};
36
36
  // Terminal pane locator env (mirrors TERMINAL_LOCATOR_ENV_KEYS in @weavecode/core):
37
37
  // captured in the pane's own child process and reported on the inbox line's side
38
38
  // channel, so the daemon can address THIS session's pane exactly.
39
- const TERMINAL_ENV_KEYS = ${JSON.stringify(w)};
39
+ const TERMINAL_ENV_KEYS = ${JSON.stringify(b)};
40
40
  const INBOX_MAX_BYTES = 4 * 1024 * 1024;
41
41
  const INBOX_MAX_LINES = 1000;
42
42
  const OUTBOX_MAX_LINES = 200;
@@ -80,9 +80,9 @@ function hooksDir() {
80
80
  // \u8BE5\u4F1A\u8BDD\u7684 hooks \u4E0E Bash\uFF09\uFF1Adaemon \u4FA7\u53EA\u653E\u5185\u5B58\u3001\u4E0D\u843D\u5E93\u4E0D\u8FDB UI \u2014\u2014 \u4E0A\u62A5\u8D70 inbox
81
81
  // \u884C\u7684\u65C1\u8DEF\u5B57\u6BB5\uFF08\u4E0D\u8FDB report/payload\uFF09\u3002
82
82
  function messagingEnv() {
83
- var sock = process.env.${v.socketEnv};
83
+ var sock = process.env.${m.socketEnv};
84
84
  if (!sock) return null;
85
- return { socket: sock, token: process.env.${v.tokenEnv} || null };
85
+ return { socket: sock, token: process.env.${m.tokenEnv} || null };
86
86
  }
87
87
 
88
88
  // \u7EC8\u7AEF\u628A\u300C\u672C pane\u300D\u5BFC\u51FA\u7684\u73AF\u5883\u53D8\u91CF\uFF08wezterm \u7B49\uFF09\u3002\u672C\u8FDB\u7A0B\u751F\u5728\u4F1A\u8BDD\u81EA\u5DF1\u7684 pane \u91CC\uFF0C
@@ -381,6 +381,6 @@ async function main() {
381
381
  }
382
382
 
383
383
  main().catch(function () { process.exit(0); });
384
- `}export const HOOK_HANDLER_MARKER=".claude/helpers/hook-handler.cjs";function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){return e.replace(/\\/g,"/")}export function groupIsWeave(e){if(!c(e))return!1;const t=e.hooks;return Array.isArray(t)?t.some(r=>c(r)&&typeof r.command=="string"&&y(r.command).includes(HOOK_HANDLER_MARKER)):!1}export function captureHookGroup(e,t){const r=`node "${y(t)}/hook-handler.cjs"`,u=!D.claude.includes(e);return[{matcher:"*",hooks:[{type:"command",command:r,...u?{async:!0}:{}}]}]}export function sweepWeaveHookEvents(e){if(!c(e))return;const t={};for(const[r,u]of Object.entries(e)){if(!Array.isArray(u)){t[r]=u;continue}const i=u.filter(s=>!groupIsWeave(s));i.length>0&&(t[r]=i)}return Object.keys(t).length>0?t:void 0}export function captureGroupsPresent(e){if(!c(e))return!1;const t=e.hooks;return c(t)?Object.values(t).some(r=>Array.isArray(r)&&r.some(groupIsWeave)):!1}function F(e){return o.join(e,d.claude.userDir,"settings.json")}function p(e){return o.join(e,d.claude.userDir,"helpers")}const g="@version weave@";async function B(e){try{return await A(e),!0}catch{return!1}}async function m(e){let t;try{t=await f(e,"utf-8")}catch{return{}}let r;try{r=JSON.parse(t)}catch{throw new Error(`user settings is not parseable JSON: ${e}`)}if(!c(r))throw new Error(`user settings is not a JSON object: ${e}`);return r}async function k(e){let t;try{t=await m(e)}catch{return}const r=sweepWeaveHookEvents(t.hooks);r===void 0?delete t.hooks:t.hooks=r,await E(o.dirname(e),{recursive:!0}),await h(e,JSON.stringify(t,null,2)+`
385
- `,"utf-8")}export async function readUserCapture(e={}){const t=e.home??l(),r=await m(F(t));return{installed:captureGroupsPresent(r),helperPresent:await B(o.join(p(t),"hook-handler.cjs"))}}export async function readScriptHealth(e={}){const t=e.home??l(),r=o.join(p(t),"hook-handler.cjs"),u=e.projectPath?o.join(e.projectPath,d.claude.projectDir,"helpers","hook-handler.cjs"):null,i=(await readUserCapture({home:t})).installed,s=i?"user":u?"project":"none",a=i?r:u??r;let n=null;try{n=await f(a,"utf-8")}catch{n=null}return{source:s,present:n!==null,weaveOwned:n!==null&&n.includes(g),generatedVersion:n?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:n!==null&&n.includes(v.socketEnv),reportsPaneEnv:n!==null&&n.includes("terminalEnv()")}}export async function installUserCapture(e){const t=e.home??l(),r=p(t);await E(r,{recursive:!0}),await h(o.join(r,"hook-handler.cjs"),generateHookHandler(e.version),"utf-8");const u=F(t),i=await m(u),s=sweepWeaveHookEvents(i.hooks)??{};for(const a of S.claude){const n=s[a];s[a]=Array.isArray(n)?[...n,...captureHookGroup(a,r)]:captureHookGroup(a,r)}i.hooks=s,await E(o.dirname(u),{recursive:!0}),await h(u,JSON.stringify(i,null,2)+`
386
- `,"utf-8")}export async function uninstallUserCapture(e={}){const t=e.home??l();await k(F(t));const r=o.join(p(t),"hook-handler.cjs");try{(await f(r,"utf-8")).includes(g)&&await C(r)}catch{}}export async function stripProjectCapture(e){await k(o.join(e,d.claude.projectDir,"settings.json"))}export const CLAUDE_CAPTURE={harness:"claude",readUserCapture:e=>readUserCapture(e),installUserCapture:e=>installUserCapture(e),uninstallUserCapture:e=>uninstallUserCapture(e),stripProjectCapture,scriptHealth:e=>readScriptHealth(e)};
384
+ `}export const HOOK_HANDLER_MARKER=".claude/helpers/hook-handler.cjs";function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e){return e.replace(/\\/g,"/")}export function groupIsWeave(e){if(!l(e))return!1;const t=e.hooks;return Array.isArray(t)?t.some(n=>l(n)&&typeof n.command=="string"&&E(n.command).includes(HOOK_HANDLER_MARKER)):!1}export function captureHookGroup(e,t){const n=`node "${E(t)}/hook-handler.cjs"`,r=!k.claude.includes(e);return[{matcher:"*",hooks:[{type:"command",command:n,...r?{async:!0}:{}}]}]}export function sweepWeaveHookEvents(e){if(!l(e))return;const t={};for(const[n,r]of Object.entries(e)){if(!Array.isArray(r)){t[n]=r;continue}const s=r.filter(a=>!groupIsWeave(a));s.length>0&&(t[n]=s)}return Object.keys(t).length>0?t:void 0}export function captureGroupsPresent(e){if(!l(e))return!1;const t=e.hooks;return l(t)?Object.values(t).some(n=>Array.isArray(n)&&n.some(groupIsWeave)):!1}function y(e){return i.join(e,d.claude.userDir,"settings.json")}function p(e){return i.join(e,d.claude.userDir,"helpers")}const S="@version weave@";async function I(e){try{return await j(e),!0}catch{return!1}}async function g(e){let t;try{t=await h(e,"utf-8")}catch{return{}}let n;try{n=JSON.parse(t)}catch{throw new Error(`user settings is not parseable JSON: ${e}`)}if(!l(n))throw new Error(`user settings is not a JSON object: ${e}`);return n}async function w(e){let t;try{t=await g(e)}catch{return}const n=sweepWeaveHookEvents(t.hooks);n===void 0?delete t.hooks:t.hooks=n,await f(i.dirname(e),{recursive:!0}),await v(e,JSON.stringify(t,null,2)+`
385
+ `,"utf-8")}export async function readUserCapture(e={}){const t=e.home??u(),n=await g(y(t));return{installed:captureGroupsPresent(n),helperPresent:await I(i.join(p(t),"hook-handler.cjs"))}}export async function readScriptHealth(e={}){const t=e.home??u(),n=i.join(p(t),"hook-handler.cjs"),r=e.projectPath?i.join(e.projectPath,d.claude.projectDir,"helpers","hook-handler.cjs"):null,s=(await readUserCapture({home:t})).installed,a=s?"user":r?"project":"none",c=s?n:r??n;let o=null;try{o=await h(c,"utf-8")}catch{o=null}return{source:a,present:o!==null,weaveOwned:o!==null&&o.includes(S),generatedVersion:o?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:o!==null&&o.includes(m.socketEnv),reportsPaneEnv:o!==null&&o.includes("terminalEnv()")}}export async function installUserCapture(e){const t=e.home??u(),n=p(t);await f(n,{recursive:!0}),await v(i.join(n,"hook-handler.cjs"),generateHookHandler(e.version),"utf-8");const r=y(t),s=await g(r),a=sweepWeaveHookEvents(s.hooks)??{};for(const c of N.claude){const o=a[c];a[c]=Array.isArray(o)?[...o,...captureHookGroup(c,n)]:captureHookGroup(c,n)}s.hooks=a,await f(i.dirname(r),{recursive:!0}),await v(r,JSON.stringify(s,null,2)+`
386
+ `,"utf-8")}export async function uninstallUserCapture(e={}){const t=e.home??u();await w(y(t));const n=i.join(p(t),"hook-handler.cjs");try{(await h(n,"utf-8")).includes(S)&&await _(n)}catch{}}export async function stripProjectCapture(e){await w(i.join(e,d.claude.projectDir,"settings.json"))}export const CLAUDE_CAPTURE={harness:"claude",readUserCapture:e=>readUserCapture(e),installUserCapture:e=>installUserCapture(e),uninstallUserCapture:e=>uninstallUserCapture(e),stripProjectCapture,scriptHealth:e=>readScriptHealth(e)};
@@ -3,6 +3,9 @@ import { type PluginExecutor } from './plugins.js';
3
3
  /**
4
4
  * 转录里的命令执行:`<command-name>` 那一条之后若紧跟 `<local-command-stdout>`,
5
5
  * 就是一次内建命令(skill 命令后面跟的是 isMeta 展开正文,不算——它已经有 UPS 气泡)。
6
+ *
7
+ * 按**字节游标**增量累积(同 narration):`pending`(等 stdout 的那条命令)是跨行
8
+ * 状态,跟着游标一起存——两行可能分在两次读里。文件被截断/换掉 ⇒ 全部作废重来。
6
9
  */
7
10
  export declare function commandExecutions(transcriptPath: string): Promise<CommandExecution[] | null>;
8
11
  export declare function createClaudeCommandSurface(deps?: {
@@ -1,3 +1,2 @@
1
- import{readdir as g,readFile as d,stat as k}from"node:fs/promises";import{homedir as v}from"node:os";import r from"node:path";import{execCli as C}from"./plugins.js";const S=[{name:"add-dir",description:"Add a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"artifacts",description:"Browse your published and shared artifacts",source:"builtin"},{name:"auto-mode-setup",description:"Teach auto mode about your environment, plus optional rule tweaks",source:"builtin"},{name:"autocompact",description:"Set how full the context gets before auto-summarizing",argsHint:"[auto|<tokens>]",source:"builtin"},{name:"background",description:"Send this session to the background and free the terminal",argsHint:"[prompt]",source:"builtin"},{name:"branch",description:"Create a branch of the current conversation at this point",argsHint:"[name]",source:"builtin"},{name:"brief",description:"Toggle brief-only mode",source:"builtin"},{name:"btw",description:"Ask a quick side question without interrupting the main conversation",argsHint:"[question]",source:"builtin"},{name:"bug",description:"Report a bug or share your conversation",argsHint:"[report]",source:"builtin"},{name:"cd",description:"Move this session to a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"clear",description:"Start a new session with empty context; previous session stays on disk (resumable with /resume)",source:"builtin"},{name:"cloud-plugins",description:"Choose whether cloud sessions use the plugins enabled on this machine",source:"builtin"},{name:"code-review",description:"Review the current diff or a PR for bugs and cleanups",source:"builtin"},{name:"color",description:"Set the prompt bar color for this session",source:"builtin"},{name:"compact",description:"Free up context by summarizing the conversation so far",argsHint:"[instructions]",source:"builtin"},{name:"config",description:"Open settings",argsHint:"[key=value]",source:"builtin"},{name:"context",description:"Visualize current context usage as a colored grid",argsHint:"[all]",source:"builtin"},{name:"copy",description:"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",source:"builtin"},{name:"daemon",description:"Manage background services and routines",source:"builtin"},{name:"debug",description:"Turn on debug logging and investigate problems",argsHint:"[issue description]",source:"builtin"},{name:"design-login",description:"Authorize design-system access for /design-sync with your claude.ai account",source:"builtin"},{name:"diff",description:"View uncommitted changes and per-turn diffs",source:"builtin"},{name:"doctor",description:"Health-check your setup and fix issues: installation, unused extensions, duplicated or bloated memory files, slow hooks, updates, permissions",source:"builtin"},{name:"effort",description:"Set effort level for model usage",argsHint:"[level]",source:"builtin"},{name:"exit",description:"Exit the CLI",source:"builtin"},{name:"export",description:"Export the current conversation to a file or clipboard",argsHint:"[filename]",source:"builtin"},{name:"feedback",description:"Send feedback to Anthropic or report a bug",argsHint:"[report]",source:"builtin"},{name:"focus",description:"Toggle focus view: just your prompt, summary, and response",source:"builtin"},{name:"fork",description:"Spawn a background agent that inherits the full conversation",argsHint:"[<directive>]",source:"builtin"},{name:"goal",description:"Set a goal Claude checks before stopping",argsHint:"[<condition> | clear]",source:"builtin"},{name:"help",description:"Show help and available commands",source:"builtin"},{name:"hooks",description:"View hook configurations for tool events",argsHint:"[name]",source:"builtin"},{name:"ide",description:"Manage IDE integrations and show status",argsHint:"[open]",source:"builtin"},{name:"init",description:"Initialize a CLAUDE.md for this project",source:"builtin"},{name:"insights",description:"Generate a report analyzing your Claude Code sessions",source:"builtin"},{name:"install",description:"Install Claude Code native build",argsHint:"[options]",source:"builtin"},{name:"install-github-app",description:"Set up Claude GitHub Actions for a repository",source:"builtin"},{name:"install-slack-app",description:"Install the Claude Slack app",source:"builtin"},{name:"keybindings",description:"Open your keyboard shortcuts file",source:"builtin"},{name:"list-agents",description:"List subagents, teammates, and other Claude sessions you can message",source:"builtin"},{name:"login",description:"Sign in with your Anthropic account",source:"builtin"},{name:"logout",description:"Sign out from your Anthropic account",source:"builtin"},{name:"loops",description:"List, create, and delete loops",argsHint:"[name]",source:"builtin"},{name:"mcp",description:"Manage MCP servers",source:"builtin"},{name:"memory",description:"Edit CLAUDE.md files and memory settings",source:"builtin"},{name:"mobile",description:"Show QR code to download the Claude mobile app",source:"builtin"},{name:"model",description:"Set the AI model for Claude Code",argsHint:"[model]",source:"builtin"},{name:"permissions",description:"Manage allow and deny tool permission rules",argsHint:"[open|<description>]",source:"builtin"},{name:"plan",description:"Enable plan mode or view the current session plan",argsHint:"[open|<description>]",source:"builtin"},{name:"plugin",description:"Manage Claude Code plugins",source:"builtin"},{name:"powerup",description:"Discover Claude Code features through quick interactive lessons",argsHint:"[name]",source:"builtin"},{name:"privacy-settings",description:"View and update your privacy settings",source:"builtin"},{name:"radio",description:"Listen to Claude FM lo-fi radio",source:"builtin"},{name:"rate-limit-options",description:"Manage usage limits and upgrade options",source:"builtin"},{name:"recap",description:"Generate a one-line session recap now",source:"builtin"},{name:"release-notes",description:"View release notes",source:"builtin"},{name:"reload-plugins",description:"Activate pending plugin changes in the current session",argsHint:"[--force]",source:"builtin"},{name:"reload-skills",description:"Pick up skills added or changed on disk during this session",source:"builtin"},{name:"rename",description:"Rename the current conversation",argsHint:"[name]",source:"builtin"},{name:"resume",description:"Resume a previous conversation",argsHint:"[conversation id or search term]",source:"builtin"},{name:"rewind",description:"Restore the code and/or conversation to a previous point",source:"builtin"},{name:"scroll-speed",description:"Adjust mouse wheel scroll speed",source:"builtin"},{name:"security-review",description:"Complete a security review of the pending changes on the current branch",source:"builtin"},{name:"skill-doctor",description:"Show which loaded skills are unused and costing context",source:"builtin"},{name:"skills",description:"List available skills",source:"builtin"},{name:"status",description:"Show Claude Code status including version, model, account, API connectivity, and tool statuses",source:"builtin"},{name:"statusline",description:"Set up Claude Code's status line UI",source:"builtin"},{name:"stickers",description:"Order Claude Code stickers",source:"builtin"},{name:"stop",description:"Stop this background session; transcript and worktree are kept",source:"builtin"},{name:"subtask",description:"Send a subagent off with your full context; its result comes back here",argsHint:"[<task>]",source:"builtin"},{name:"tasks",description:"View and manage everything running in the background",source:"builtin"},{name:"terminal-setup",description:"Check terminal setup for key bindings like Shift+Enter",source:"builtin"},{name:"theme",description:"Change the theme",source:"builtin"},{name:"tui",description:"Set the terminal UI renderer (default | fullscreen)",argsHint:"[default|fullscreen]",source:"builtin"},{name:"ultraplan",description:"Draft an editable plan in a cloud session",argsHint:"[<prompt>]",source:"builtin"},{name:"ultrareview",description:"Start a cloud agent that finds and verifies bugs in your branch",source:"builtin"},{name:"upgrade",description:"Upgrade to Max for higher rate limits and more Opus",source:"builtin"},{name:"usage",description:"Show session cost, plan usage, and activity stats",source:"builtin"},{name:"usage-credits",description:"Configure usage credits or request them from your admin when you hit a limit",source:"builtin"},{name:"version",description:"Show this session's version (autoupdate may have a newer one)",source:"builtin"},{name:"wellbeing",description:"Configure optional break reminders and quiet-hours nudges",source:"builtin"},{name:"workflows",description:"Browse running and completed workflows",source:"builtin"}];function h(i){const t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(i)?.[1]??"";return/^description:\s*(.+)$/m.exec(t)?.[1]?.trim().replace(/^["']|["']$/g,"")||(i.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
- `).find(n=>n.trim()!==""&&!n.startsWith("#"))?.trim()??"")}async function f(i){try{const t=await k(i);return t.isDirectory()?"dir":t.isFile()?"file":"other"}catch{return"other"}}async function H(i){try{const t=[];for(const e of await g(i,{withFileTypes:!0})){if(!e.name.endsWith(".md"))continue;const n=r.join(i,e.name);(e.isFile()||e.isSymbolicLink()&&await f(n)==="file")&&t.push(n)}return t}catch{return[]}}async function u(i){try{const t=[];for(const e of await g(i,{withFileTypes:!0})){const n=r.join(i,e.name);(e.isDirectory()||e.isSymbolicLink()&&await f(n)==="dir")&&t.push(n)}return t}catch{return[]}}async function w(i){const t=[],e=async(n,s)=>{for(const o of await H(n)){const a=`${s}${r.basename(o,".md")}`,c=h(await d(o,"utf8").catch(()=>""));t.push({name:a,description:c,source:"command"})}for(const o of await u(n))await e(o,`${s}${r.basename(o)}:`)};return await e(i,""),t}async function l(i,t="",e="skill"){const n=[];for(const s of await u(i)){const o=h(await d(r.join(s,"SKILL.md"),"utf8").catch(()=>""));n.push({name:`${t}${r.basename(s)}`,description:o,source:e})}return n}async function x(i){const t=[],e=new Set;for(const n of await u(r.join(i,"plugins","cache")))for(const s of await u(n)){const o=r.basename(s);if(!e.has(o))for(const a of await u(s)){const c=await l(r.join(a,"skills"),`${o}:`,"plugin");if(c.length>0){e.add(o),t.push(...c);break}}}return t}async function j(i){try{const{stdout:t}=await i(["plugin","list","--json"],{timeoutMs:15e3}),e=JSON.parse(t);if(!Array.isArray(e))return null;const n=[];for(const s of e){if(!s||typeof s!="object")continue;const o=s;if(typeof o.id!="string"||typeof o.installPath!="string")continue;const a=o.id.lastIndexOf("@");n.push({plugin:a>0?o.id.slice(0,a):o.id,enabled:o.enabled===!0,installPath:o.installPath})}return n}catch{return null}}async function A(i){const t=await j(i);if(!t)return null;const e=[];for(const n of t)n.enabled&&e.push(...await l(r.join(n.installPath,"skills"),`${n.plugin}:`,"plugin"));return e}function M(i){const t=new Set,e=[];for(const n of i)t.has(n.name)||(t.add(n.name),e.push(n));return e}const L=i=>typeof i=="string"?i:"";function I(i){return/<command-args>([\s\S]*?)<\/command-args>/.exec(i)?.[1]?.trim()??""}export async function commandExecutions(i){let t;try{t=await d(i,"utf8")}catch{return null}const e=[];let n=null;for(const s of t.split(`
3
- `)){if(!s.includes("<command-name>")&&!s.includes("<local-command-stdout>"))continue;let o;try{o=JSON.parse(s)}catch{continue}if(o===null||typeof o!="object")continue;const a=o,c=a.message?.content;if(typeof c!="string")continue;const y=L(a.timestamp),p=/<command-name>([^<]*)<\/command-name>/.exec(c)?.[1]?.trim();if(p?.startsWith("/")){n={name:p.slice(1),args:I(c),at:y};continue}const m=/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/.exec(c)?.[1];if(m===void 0||n===null)continue;const b=m.replace(/\u001b\[[0-9;]*m/g,"").trim();e.push({...n,...b!==""?{output:b}:{}}),n=null}return e}export function createClaudeCommandSurface(i={}){const t=i.exec??C;return{harness:"claude",async list({projectPath:e,homedir:n=v()}){const s=r.join(n,".claude");return M([...S,...await w(r.join(e,".claude","commands")),...await w(r.join(s,"commands")),...await l(r.join(e,".claude","skills")),...await l(r.join(s,"skills")),...await A(t)??await x(s)])},executions:e=>e?commandExecutions(e):Promise.resolve(null)}}export const CLAUDE_COMMANDS=createClaudeCommandSurface();
1
+ import{readdir as w,readFile as y,stat as H}from"node:fs/promises";import{homedir as x}from"node:os";import u from"node:path";import{execCli as A}from"./plugins.js";import{readNewLines as M,transcriptSize as I}from"./transcript-cursor.js";const L=[{name:"add-dir",description:"Add a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"artifacts",description:"Browse your published and shared artifacts",source:"builtin"},{name:"auto-mode-setup",description:"Teach auto mode about your environment, plus optional rule tweaks",source:"builtin"},{name:"autocompact",description:"Set how full the context gets before auto-summarizing",argsHint:"[auto|<tokens>]",source:"builtin"},{name:"background",description:"Send this session to the background and free the terminal",argsHint:"[prompt]",source:"builtin"},{name:"branch",description:"Create a branch of the current conversation at this point",argsHint:"[name]",source:"builtin"},{name:"brief",description:"Toggle brief-only mode",source:"builtin"},{name:"btw",description:"Ask a quick side question without interrupting the main conversation",argsHint:"[question]",source:"builtin"},{name:"bug",description:"Report a bug or share your conversation",argsHint:"[report]",source:"builtin"},{name:"cd",description:"Move this session to a new working directory",argsHint:"[<path>]",source:"builtin"},{name:"clear",description:"Start a new session with empty context; previous session stays on disk (resumable with /resume)",source:"builtin"},{name:"cloud-plugins",description:"Choose whether cloud sessions use the plugins enabled on this machine",source:"builtin"},{name:"code-review",description:"Review the current diff or a PR for bugs and cleanups",source:"builtin"},{name:"color",description:"Set the prompt bar color for this session",source:"builtin"},{name:"compact",description:"Free up context by summarizing the conversation so far",argsHint:"[instructions]",source:"builtin"},{name:"config",description:"Open settings",argsHint:"[key=value]",source:"builtin"},{name:"context",description:"Visualize current context usage as a colored grid",argsHint:"[all]",source:"builtin"},{name:"copy",description:"Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",source:"builtin"},{name:"daemon",description:"Manage background services and routines",source:"builtin"},{name:"debug",description:"Turn on debug logging and investigate problems",argsHint:"[issue description]",source:"builtin"},{name:"design-login",description:"Authorize design-system access for /design-sync with your claude.ai account",source:"builtin"},{name:"diff",description:"View uncommitted changes and per-turn diffs",source:"builtin"},{name:"doctor",description:"Health-check your setup and fix issues: installation, unused extensions, duplicated or bloated memory files, slow hooks, updates, permissions",source:"builtin"},{name:"effort",description:"Set effort level for model usage",argsHint:"[level]",source:"builtin"},{name:"exit",description:"Exit the CLI",source:"builtin"},{name:"export",description:"Export the current conversation to a file or clipboard",argsHint:"[filename]",source:"builtin"},{name:"feedback",description:"Send feedback to Anthropic or report a bug",argsHint:"[report]",source:"builtin"},{name:"focus",description:"Toggle focus view: just your prompt, summary, and response",source:"builtin"},{name:"fork",description:"Spawn a background agent that inherits the full conversation",argsHint:"[<directive>]",source:"builtin"},{name:"goal",description:"Set a goal Claude checks before stopping",argsHint:"[<condition> | clear]",source:"builtin"},{name:"help",description:"Show help and available commands",source:"builtin"},{name:"hooks",description:"View hook configurations for tool events",argsHint:"[name]",source:"builtin"},{name:"ide",description:"Manage IDE integrations and show status",argsHint:"[open]",source:"builtin"},{name:"init",description:"Initialize a CLAUDE.md for this project",source:"builtin"},{name:"insights",description:"Generate a report analyzing your Claude Code sessions",source:"builtin"},{name:"install",description:"Install Claude Code native build",argsHint:"[options]",source:"builtin"},{name:"install-github-app",description:"Set up Claude GitHub Actions for a repository",source:"builtin"},{name:"install-slack-app",description:"Install the Claude Slack app",source:"builtin"},{name:"keybindings",description:"Open your keyboard shortcuts file",source:"builtin"},{name:"list-agents",description:"List subagents, teammates, and other Claude sessions you can message",source:"builtin"},{name:"login",description:"Sign in with your Anthropic account",source:"builtin"},{name:"logout",description:"Sign out from your Anthropic account",source:"builtin"},{name:"loops",description:"List, create, and delete loops",argsHint:"[name]",source:"builtin"},{name:"mcp",description:"Manage MCP servers",source:"builtin"},{name:"memory",description:"Edit CLAUDE.md files and memory settings",source:"builtin"},{name:"mobile",description:"Show QR code to download the Claude mobile app",source:"builtin"},{name:"model",description:"Set the AI model for Claude Code",argsHint:"[model]",source:"builtin"},{name:"permissions",description:"Manage allow and deny tool permission rules",argsHint:"[open|<description>]",source:"builtin"},{name:"plan",description:"Enable plan mode or view the current session plan",argsHint:"[open|<description>]",source:"builtin"},{name:"plugin",description:"Manage Claude Code plugins",source:"builtin"},{name:"powerup",description:"Discover Claude Code features through quick interactive lessons",argsHint:"[name]",source:"builtin"},{name:"privacy-settings",description:"View and update your privacy settings",source:"builtin"},{name:"radio",description:"Listen to Claude FM lo-fi radio",source:"builtin"},{name:"rate-limit-options",description:"Manage usage limits and upgrade options",source:"builtin"},{name:"recap",description:"Generate a one-line session recap now",source:"builtin"},{name:"release-notes",description:"View release notes",source:"builtin"},{name:"reload-plugins",description:"Activate pending plugin changes in the current session",argsHint:"[--force]",source:"builtin"},{name:"reload-skills",description:"Pick up skills added or changed on disk during this session",source:"builtin"},{name:"rename",description:"Rename the current conversation",argsHint:"[name]",source:"builtin"},{name:"resume",description:"Resume a previous conversation",argsHint:"[conversation id or search term]",source:"builtin"},{name:"rewind",description:"Restore the code and/or conversation to a previous point",source:"builtin"},{name:"scroll-speed",description:"Adjust mouse wheel scroll speed",source:"builtin"},{name:"security-review",description:"Complete a security review of the pending changes on the current branch",source:"builtin"},{name:"skill-doctor",description:"Show which loaded skills are unused and costing context",source:"builtin"},{name:"skills",description:"List available skills",source:"builtin"},{name:"status",description:"Show Claude Code status including version, model, account, API connectivity, and tool statuses",source:"builtin"},{name:"statusline",description:"Set up Claude Code's status line UI",source:"builtin"},{name:"stickers",description:"Order Claude Code stickers",source:"builtin"},{name:"stop",description:"Stop this background session; transcript and worktree are kept",source:"builtin"},{name:"subtask",description:"Send a subagent off with your full context; its result comes back here",argsHint:"[<task>]",source:"builtin"},{name:"tasks",description:"View and manage everything running in the background",source:"builtin"},{name:"terminal-setup",description:"Check terminal setup for key bindings like Shift+Enter",source:"builtin"},{name:"theme",description:"Change the theme",source:"builtin"},{name:"tui",description:"Set the terminal UI renderer (default | fullscreen)",argsHint:"[default|fullscreen]",source:"builtin"},{name:"ultraplan",description:"Draft an editable plan in a cloud session",argsHint:"[<prompt>]",source:"builtin"},{name:"ultrareview",description:"Start a cloud agent that finds and verifies bugs in your branch",source:"builtin"},{name:"upgrade",description:"Upgrade to Max for higher rate limits and more Opus",source:"builtin"},{name:"usage",description:"Show session cost, plan usage, and activity stats",source:"builtin"},{name:"usage-credits",description:"Configure usage credits or request them from your admin when you hit a limit",source:"builtin"},{name:"version",description:"Show this session's version (autoupdate may have a newer one)",source:"builtin"},{name:"wellbeing",description:"Configure optional break reminders and quiet-hours nudges",source:"builtin"},{name:"workflows",description:"Browse running and completed workflows",source:"builtin"}];function k(n){const t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(n)?.[1]??"",i=/^description:\s*(.+)$/m.exec(t)?.[1]?.trim().replace(/^["']|["']$/g,"");return i||(n.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
+ `).find(s=>s.trim()!==""&&!s.startsWith("#"))?.trim()??"")}async function v(n){try{const t=await H(n);return t.isDirectory()?"dir":t.isFile()?"file":"other"}catch{return"other"}}async function j(n){try{const t=[];for(const i of await w(n,{withFileTypes:!0})){if(!i.name.endsWith(".md"))continue;const e=u.join(n,i.name);(i.isFile()||i.isSymbolicLink()&&await v(e)==="file")&&t.push(e)}return t}catch{return[]}}async function m(n){try{const t=[];for(const i of await w(n,{withFileTypes:!0})){const e=u.join(n,i.name);(i.isDirectory()||i.isSymbolicLink()&&await v(e)==="dir")&&t.push(e)}return t}catch{return[]}}async function S(n){const t=[],i=async(e,s)=>{for(const o of await j(e)){const r=`${s}${u.basename(o,".md")}`,a=k(await y(o,"utf8").catch(()=>""));t.push({name:r,description:a,source:"command",inline:!0})}for(const o of await m(e))await i(o,`${s}${u.basename(o)}:`)};return await i(n,""),t}async function g(n,t="",i="skill"){const e=[];for(const s of await m(n)){const o=k(await y(u.join(s,"SKILL.md"),"utf8").catch(()=>""));e.push({name:`${t}${u.basename(s)}`,description:o,source:i,inline:!0})}return e}async function E(n){const t=[],i=new Set;for(const e of await m(u.join(n,"plugins","cache")))for(const s of await m(e)){const o=u.basename(s);if(!i.has(o))for(const r of await m(s)){const a=await g(u.join(r,"skills"),`${o}:`,"plugin");if(a.length>0){i.add(o),t.push(...a);break}}}return t}async function T(n){try{const{stdout:t}=await n(["plugin","list","--json"],{timeoutMs:15e3}),i=JSON.parse(t);if(!Array.isArray(i))return null;const e=[];for(const s of i){if(!s||typeof s!="object")continue;const o=s;if(typeof o.id!="string"||typeof o.installPath!="string")continue;const r=o.id.lastIndexOf("@");e.push({plugin:r>0?o.id.slice(0,r):o.id,enabled:o.enabled===!0,installPath:o.installPath})}return e}catch{return null}}async function $(n){const t=await T(n);if(!t)return null;const i=[];for(const e of t)e.enabled&&i.push(...await g(u.join(e.installPath,"skills"),`${e.plugin}:`,"plugin"));return i}const O=new Set(["init","statusline","insights"]);function z(n){const t=new Set,i=[];for(const e of n)t.has(e.name)||(t.add(e.name),i.push(e));return i}const D=n=>typeof n=="string"?n:"";function N(n){return/<command-args>([\s\S]*?)<\/command-args>/.exec(n)?.[1]?.trim()??""}const d=new Map,_=64;export async function commandExecutions(n){const t=I(n);if(t===null)return d.delete(n),null;const i=d.get(n);d.delete(n);const e=i??{cur:{offset:0},out:[],pending:null};t<e.cur.offset&&(e.cur.offset=0,e.out=[],e.pending=null);const s=M(n,e.cur,t);if(s===null)return null;const o=e.out;let r=e.pending;for(const a of s){if(!a.includes("<command-name>")&&!a.includes("<local-command-stdout>"))continue;let l;try{l=JSON.parse(a)}catch{continue}if(l===null||typeof l!="object")continue;const p=l,c=p.message?.content;if(typeof c!="string")continue;const C=D(p.timestamp),f=/<command-name>([^<]*)<\/command-name>/.exec(c)?.[1]?.trim();if(f?.startsWith("/")){r={name:f.slice(1),args:N(c),at:C};continue}const b=/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/.exec(c)?.[1];if(b===void 0||r===null)continue;const h=b.replace(/\u001b\[[0-9;]*m/g,"").trim();o.push({...r,...h!==""?{output:h}:{}}),r=null}if(e.pending=r,d.size>=_){const a=d.keys().next().value;a!==void 0&&d.delete(a)}return d.set(n,e),o}const R=6e4,U=16;export function createClaudeCommandSurface(n={}){const t=n.exec??A,i=new Map;return{harness:"claude",inputModes:[{kind:"slash",sigil:"/",named:!0},{kind:"bash",sigil:"!",named:!1}],async list({projectPath:e,homedir:s=x()}){const o=`${e}\0${s}`,r=Date.now(),a=i.get(o);if(a&&r-a.at<R)return a.rows;const l=u.join(s,".claude"),p=z([...L.map(c=>O.has(c.name)?{...c,inline:!0}:c),...await S(u.join(e,".claude","commands")),...await S(u.join(l,"commands")),...await g(u.join(e,".claude","skills")),...await g(u.join(l,"skills")),...await $(t)??await E(l)]);if(i.size>=U){const c=i.keys().next().value;c!==void 0&&i.delete(c)}return i.set(o,{at:r,rows:p}),p},executions:e=>e?commandExecutions(e):Promise.resolve(null)}}export const CLAUDE_COMMANDS=createClaudeCommandSurface();
@@ -1,3 +1,3 @@
1
- import d from"node:fs/promises";import{homedir as y}from"node:os";import f from"node:path";import{CONFIG_SHAPE_OVERRIDES as _}from"./config-shapes.js";import{WEAVE_MARKETPLACE as P}from"./plugins.js";import{CLAUDE_ENV_VARS as C,CLAUDE_SETTINGS_GROUPS as S,CLAUDE_SETTINGS_KEYS as w}from"./settings-catalog.generated.js";import{WEAVE_PERMISSIONS_ALLOW as D,WEAVE_PERMISSIONS_DENY as I,statusLineIsWeave as R}from"./settings-gen.js";const F=2*1024*1024,v="https://api.anthropic.com",$="2023-06-01",L=["$comment","hooks","env.WEAVE_ENABLED"],b=[{id:"user",profiles:!0},{id:"project",profiles:!1},{id:"projectLocal",profiles:!1},{id:"global",profiles:!0}];function A(e,r){switch(e){case"user":return f.join(r.homedir,".claude","settings.json");case"project":return r.projectPath?f.join(r.projectPath,".claude","settings.json"):"";case"projectLocal":return r.projectPath?f.join(r.projectPath,".claude","settings.local.json"):"";case"global":return f.join(r.homedir,".claude.json")}}function H(e){return e==="projectLocal"?"local":e}function g(e){if(e==="global")return w.filter(t=>t.scope==="global");const r=H(e);return w.filter(t=>t.scope==="any"||t.scope===r)}function U(e){return e.map(r=>r.key in _?{...r,..._[r.key]}:r)}function j(e){return new Set(g(e).map(r=>r.key.split(".")[0]))}function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function k(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function m(e,r){let t=e;for(const o of r.split(".")){if(!c(t))return;t=t[o]}return t}function N(e,r,t){const o=r.split(".");if(o.some(a=>!a||k(a)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${r}`);let n=e;for(const a of o.slice(0,-1))c(n[a])||(n[a]={}),n=n[a];n[o[o.length-1]]=t}async function h(e){let r;try{if((await d.stat(e)).size>F)throw new Error(`\u914D\u7F6E\u6587\u4EF6\u8D85\u8FC7 ${F} \u5B57\u8282\uFF1A${e}`);r=await d.readFile(e,"utf8")}catch(n){if(n.code==="ENOENT")return{};throw n}const t=r.replace(/^/,"").trim();if(!t)return{};let o;try{o=JSON.parse(t)}catch{throw new Error(`\u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${e}`)}if(!c(o))throw new Error(`\u914D\u7F6E\u6587\u4EF6\u9876\u5C42\u4E0D\u662F\u5BF9\u8C61\uFF1A${e}`);return o}async function O(e,r){await d.mkdir(f.dirname(e),{recursive:!0});const t=`${e}.${process.pid}.${Date.now()}.tmp`;await d.writeFile(t,`${JSON.stringify(r,null,2)}
2
- `,"utf8"),await d.rename(t,e)}function T(e,r){const t=A(e,r);if(!t)throw new Error(`\u914D\u7F6E\u6863\u4F4D ${e} \u9700\u8981\u9879\u76EE\u8DEF\u5F84`);return t}function B(e,r,t){const o=p=>p&&c(p.env)?p.env:{},n=(p,E)=>typeof p[E]=="string"?p[E]:"",a=o(e),s=o(r),i=t.apiKey||n(a,"ANTHROPIC_API_KEY")||(n(a,"ANTHROPIC_AUTH_TOKEN")?"":n(s,"ANTHROPIC_API_KEY")),l=t.authToken||n(a,"ANTHROPIC_AUTH_TOKEN")||(n(a,"ANTHROPIC_API_KEY")?"":n(s,"ANTHROPIC_AUTH_TOKEN"));return i?{header:{"x-api-key":i},credential:"apiKey"}:l?{header:{authorization:`Bearer ${l}`},credential:"authToken"}:{header:{},credential:"none"}}export async function ensureTrustAccepted(e){const r=A("global",{projectPath:null,homedir:y()}),t=await h(r),o=f.resolve(e).replace(/\\/g,"/"),n=c(t.projects)?t.projects:{},a=c(n[o])?n[o]:{};a.hasTrustDialogAccepted!==!0&&(n[o]={...a,hasTrustDialogAccepted:!0},t.projects=n,await O(r,t))}export const CLAUDE_CONFIG={harness:"claude",files(){return b.map(e=>({id:e.id,profiles:e.profiles,path:r=>A(e.id,r)}))},catalog(e){const r=U(g(e));return{groups:S.filter(t=>r.some(o=>o.group===t)),keys:r,envVars:e==="global"?[]:C}},async read(e,r){const t=await h(T(e,r)),o=j(e),n={};for(const a of o)a in t&&N(n,a,t[a]);return n},async write(e,r,t){const o=T(e,r),n=await h(o),a=j(e),s={...n};for(const i of Object.keys(n))a.has(i)&&!(i in t)&&delete s[i];for(const[i,l]of Object.entries(t))a.has(i.split(".")[0])&&N(s,i,l);await O(o,s)},managedKeys(e){const r=L.filter(t=>m(e,t)!==void 0);return e.statusLine!==void 0&&R(e.statusLine)&&r.push("statusLine"),r},managedEntries(e){const r=[];for(const[o,n]of[["permissions.allow",D],["permissions.deny",I]]){const a=m(e,o);if(Array.isArray(a))for(const s of n)a.includes(s)&&r.push({path:o,entry:s})}const t=m(e,"enabledPlugins");if(c(t))for(const o of Object.keys(t))o.endsWith(`@${P}`)&&r.push({path:"enabledPlugins",entry:o});return r},async models(e){const r=c(e.values.env)?e.values.env:{},t=typeof r.ANTHROPIC_BASE_URL=="string"?r.ANTHROPIC_BASE_URL:"",o=e.file&&e.file!=="user"?await h(A("user",{projectPath:null,homedir:e.homedir??y()})):null,n=o&&c(o.env)&&typeof o.env.ANTHROPIC_BASE_URL=="string"?o.env.ANTHROPIC_BASE_URL:"",a=(e.baseUrl||t||n||v).replace(/\/+$/,"").replace(/\/v1$/,""),{header:s,credential:i}=B(e.values,o,e),l=await fetch(`${a}/v1/models?limit=1000`,{headers:{"anthropic-version":$,...s},signal:AbortSignal.timeout(e.timeoutMs??1e4)});if(!l.ok){const u=(await l.text().catch(()=>"")).slice(0,200);throw new Error(`\u6A21\u578B\u5217\u8868\u8BF7\u6C42\u5931\u8D25\uFF1AHTTP ${l.status}${u?` ${u}`:""}`)}const p=await l.json(),E=[];if(Array.isArray(p.data))for(const u of p.data)!c(u)||typeof u.id!="string"||E.push({id:u.id,...typeof u.display_name=="string"?{name:u.display_name}:{},...typeof u.created_at=="string"?{createdAt:u.created_at}:{}});return{models:E,baseUrl:a,credential:i}},rawFormat:"json",parseRaw(e){const r=JSON.parse(e);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u5BF9\u8C61");return r},serializeRaw(e){return`${JSON.stringify(e,null,2)}
1
+ import h from"node:fs/promises";import{homedir as m}from"node:os";import p from"node:path";import{CONFIG_SHAPE_OVERRIDES as _}from"./config-shapes.js";import{WEAVE_MARKETPLACE as P}from"./plugins.js";import{CLAUDE_ENV_VARS as R,CLAUDE_SETTINGS_GROUPS as I,CLAUDE_SETTINGS_KEYS as w}from"./settings-catalog.generated.js";import{WEAVE_PERMISSIONS_ALLOW as L,WEAVE_PERMISSIONS_DENY as b,statusLineIsWeave as $}from"./settings-gen.js";const O=2*1024*1024,C="https://api.anthropic.com",H="2023-06-01",U=["$comment","hooks","env.WEAVE_ENABLED"],k=[{id:"user",profiles:!0},{id:"project",profiles:!1},{id:"projectLocal",profiles:!1},{id:"global",profiles:!0}];function A(t,e){switch(t){case"user":return p.join(e.homedir,".claude","settings.json");case"project":return e.projectPath?p.join(e.projectPath,".claude","settings.json"):"";case"projectLocal":return e.projectPath?p.join(e.projectPath,".claude","settings.local.json"):"";case"global":return p.join(e.homedir,".claude.json")}}function v(t){return t==="projectLocal"?"local":t}function g(t){if(t==="global")return w.filter(r=>r.scope==="global");const e=v(t);return w.filter(r=>r.scope==="any"||r.scope===e)}function K(t){return t.map(e=>e.key in _?{...e,..._[e.key]}:e)}function T(t){return new Set(g(t).map(e=>e.key.split(".")[0]))}function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function E(t,e){let r=t;for(const o of e.split(".")){if(!u(r))return;r=r[o]}return r}function j(t,e,r){const o=e.split(".");if(o.some(s=>!s||D(s)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${e}`);let n=t;for(const s of o.slice(0,-1))u(n[s])||(n[s]={}),n=n[s];n[o[o.length-1]]=r}async function y(t){let e;try{if((await h.stat(t)).size>O)throw new Error(`\u914D\u7F6E\u6587\u4EF6\u8D85\u8FC7 ${O} \u5B57\u8282\uFF1A${t}`);e=await h.readFile(t,"utf8")}catch(n){if(n.code==="ENOENT")return{};throw n}const r=e.replace(/^/,"").trim();if(!r)return{};let o;try{o=JSON.parse(r)}catch{throw new Error(`\u914D\u7F6E\u6587\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${t}`)}if(!u(o))throw new Error(`\u914D\u7F6E\u6587\u4EF6\u9876\u5C42\u4E0D\u662F\u5BF9\u8C61\uFF1A${t}`);return o}async function S(t,e){await h.mkdir(p.dirname(t),{recursive:!0});const r=`${t}.${process.pid}.${Date.now()}.tmp`;await h.writeFile(r,`${JSON.stringify(e,null,2)}
2
+ `,"utf8"),await h.rename(r,t)}function N(t,e){const r=A(t,e);if(!r)throw new Error(`\u914D\u7F6E\u6863\u4F4D ${t} \u9700\u8981\u9879\u76EE\u8DEF\u5F84`);return r}function V(t,e,r){const o=f=>f&&u(f.env)?f.env:{},n=(f,d)=>typeof f[d]=="string"?f[d]:"",s=o(t),a=o(e),i=r.apiKey||n(s,"ANTHROPIC_API_KEY")||(n(s,"ANTHROPIC_AUTH_TOKEN")?"":n(a,"ANTHROPIC_API_KEY")),l=r.authToken||n(s,"ANTHROPIC_AUTH_TOKEN")||(n(s,"ANTHROPIC_API_KEY")?"":n(a,"ANTHROPIC_AUTH_TOKEN"));return i?{header:{"x-api-key":i},credential:"apiKey"}:l?{header:{authorization:`Bearer ${l}`},credential:"authToken"}:{header:{},credential:"none"}}export async function ensureTrustAccepted(t){const e=A("global",{projectPath:null,homedir:m()}),r=await y(e),o=p.resolve(t).replace(/\\/g,"/"),n=u(r.projects)?r.projects:{},s=u(n[o])?n[o]:{};s.hasTrustDialogAccepted!==!0&&(n[o]={...s,hasTrustDialogAccepted:!0},r.projects=n,await S(e,r))}export const CLAUDE_CONFIG={harness:"claude",files(){return k.map(t=>({id:t.id,profiles:t.profiles,path:e=>A(t.id,e)}))},catalog(t){const e=K(g(t));return{groups:I.filter(r=>e.some(o=>o.group===r)),keys:e,envVars:t==="global"?[]:R}},async read(t,e){const r=await y(N(t,e)),o=T(t),n={};for(const s of o)s in r&&j(n,s,r[s]);return n},async write(t,e,r){const o=N(t,e),n=await y(o),s=T(t),a={...n};for(const i of Object.keys(n))s.has(i)&&!(i in r)&&delete a[i];for(const[i,l]of Object.entries(r))s.has(i.split(".")[0])&&j(a,i,l);await S(o,a)},managedKeys(t){const e=U.filter(r=>E(t,r)!==void 0);return t.statusLine!==void 0&&$(t.statusLine)&&e.push("statusLine"),e},managedEntries(t){const e=[];for(const[o,n]of[["permissions.allow",L],["permissions.deny",b]]){const s=E(t,o);if(Array.isArray(s))for(const a of n)s.includes(a)&&e.push({path:o,entry:a})}const r=E(t,"enabledPlugins");if(u(r))for(const o of Object.keys(r))o.endsWith(`@${P}`)&&e.push({path:"enabledPlugins",entry:o});return e},async models(t){const e=u(t.values.env)?t.values.env:{},r=typeof e.ANTHROPIC_BASE_URL=="string"?e.ANTHROPIC_BASE_URL:"",o=t.file&&t.file!=="user"?await y(A("user",{projectPath:null,homedir:t.homedir??m()})):null,n=o&&u(o.env)&&typeof o.env.ANTHROPIC_BASE_URL=="string"?o.env.ANTHROPIC_BASE_URL:"",s=(t.baseUrl||r||n||C).replace(/\/+$/,"").replace(/\/v1$/,""),{header:a,credential:i}=V(t.values,o,t),l=await fetch(`${s}/v1/models?limit=1000`,{headers:{"anthropic-version":H,...a},signal:AbortSignal.timeout(t.timeoutMs??1e4)});if(!l.ok){const c=(await l.text().catch(()=>"")).slice(0,200);throw new Error(`\u6A21\u578B\u5217\u8868\u8BF7\u6C42\u5931\u8D25\uFF1AHTTP ${l.status}${c?` ${c}`:""}`)}const f=await l.json(),d=[];if(Array.isArray(f.data))for(const c of f.data)!u(c)||typeof c.id!="string"||d.push({id:c.id,...typeof c.display_name=="string"?{name:c.display_name}:{},...typeof c.created_at=="string"?{createdAt:c.created_at}:{}});return{models:d,baseUrl:s,credential:i}},rawFormat:"json",parseRaw(t){const e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u5BF9\u8C61");return e},serializeRaw(t){return`${JSON.stringify(t,null,2)}
3
3
  `}};
@@ -1 +1 @@
1
- import{existsSync as o}from"node:fs";import n from"node:path";const r=[".claude","CLAUDE.md"];function t(e){return r.some(s=>o(n.join(e,s)))}export const CLAUDE_DETECTOR={markers:r,present:t,detect:e=>({harness:"claude",present:t(e)})};
1
+ import{existsSync as o}from"node:fs";import s from"node:path";const t=[".claude","CLAUDE.md"];function r(e){return t.some(n=>o(s.join(e,n)))}export const CLAUDE_DETECTOR={markers:t,present:r,detect:e=>({harness:"claude",present:r(e)})};
@@ -1 +1 @@
1
- import{createReadStream as _}from"node:fs";import{createInterface as g}from"node:readline";const E=new Set(["Edit","Write","MultiEdit"]),n=t=>typeof t=="string"?t:null,p=t=>t&&typeof t=="object"?t:{};function w(t,e){if(t==="Write"){const r=n(e.content);return r===null?[]:[{before:"",after:r}]}if(t==="MultiEdit")return(Array.isArray(e.edits)?e.edits:[]).flatMap(r=>{const o=p(r),c=n(o.old_string),a=n(o.new_string);return c===null||a===null?[]:[{before:c,after:a}]});const i=n(e.old_string),s=n(e.new_string);return i===null||s===null?[]:[{before:i,after:s}]}export const CLAUDE_EDITS={async sessionEdits({transcriptPath:t}){if(!t)return null;const e=[],i=new Set,s=g({input:_(t,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const r of s){if(!r.includes('"tool_use"'))continue;let o;try{o=JSON.parse(r)}catch{continue}const c=o.message?.content;if(Array.isArray(c))for(const a of c){const f=p(a);if(f.type!=="tool_use")continue;const l=n(f.name);if(!l||!E.has(l))continue;const u=n(f.id);if(u){if(i.has(u))continue;i.add(u)}const d=p(f.input),y=n(d.file_path);if(!y)continue;const h=n(o.timestamp);for(const m of w(l,d))e.push({path:y,hunk:m,at:h})}}}catch{return null}finally{s.close()}return e}};
1
+ import{createReadStream as h}from"node:fs";import{createInterface as g}from"node:readline";const E=new Set(["Edit","Write","MultiEdit"]),n=t=>typeof t=="string"?t:null,d=t=>t&&typeof t=="object"?t:{};function w(t,e){if(t==="Write"){const r=n(e.content);return r===null?[]:[{before:"",after:r}]}if(t==="MultiEdit")return(Array.isArray(e.edits)?e.edits:[]).flatMap(c=>{const f=d(c),l=n(f.old_string),o=n(f.new_string);return l===null||o===null?[]:[{before:l,after:o}]});const s=n(e.old_string),i=n(e.new_string);return s===null||i===null?[]:[{before:s,after:i}]}export const CLAUDE_EDITS={async sessionEdits({transcriptPath:t}){if(!t)return null;const e=[],s=new Set,i=g({input:h(t,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const r of i){if(!r.includes('"tool_use"'))continue;let c;try{c=JSON.parse(r)}catch{continue}const f=c.message?.content;if(Array.isArray(f))for(const l of f){const o=d(l);if(o.type!=="tool_use")continue;const u=n(o.name);if(!u||!E.has(u))continue;const a=n(o.id);if(a){if(s.has(a))continue;s.add(a)}const y=d(o.input),p=n(y.file_path);if(!p)continue;const m=n(c.timestamp);for(const _ of w(u,y))e.push({path:p,hunk:_,at:m})}}}catch{return null}finally{i.close()}return e}};
@@ -1 +1 @@
1
- import{HARNESS_EVENTS as d}from"@weavecode/core";import{capFields as l}from"../shared/json-cap.js";import{CLAUDE_PLAN as y}from"./plan.js";function _(o){try{const t=JSON.parse(o);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function c(o,...t){for(const e of t)if(o[e]!=null)return o[e];return null}const g=[["toolName",["tool_name","toolName"]],["toolInput",["tool_input","toolInput"]],["toolResponse",["tool_response","toolResponse"]],["cwd",["cwd"]],["transcriptPath",["transcript_path","transcriptPath"]]],m=/^<\$\.([A-Za-z0-9_]+(?:\.[A-Za-z0-9_]+)*)>$/;function A(o,t,e){return typeof o!="string"?null:y.draftOf(o,t,e)?.text?{input:t,response:e}:null}function w(o){const t={...o};for(const[e,n]of g)for(const s of n)s in t&&(t[s]=`<$.${e}>`);return t}export function expandPayloadRefs(o){const t=o.raw;if(!t||typeof t!="object"||Array.isArray(t))return o;const e={...t};for(const[n,s]of Object.entries(e)){const a=typeof s=="string"?m.exec(s):null;a&&(e[n]=I(o,a[1]))}return{...o,raw:e}}function I(o,t){let e=o;for(const n of t.split(".")){if(!e||typeof e!="object")return null;e=e[n]}return e??null}export class ClaudeEventSource{source="claude";events=d.claude;normalize(t,e){const n=_(t.payload),s=t.eventType||String(n.hook_event_name??"unknown"),a=t.sessionId??c(n,"session_id","sessionId"),i=c(n,"tool_name","toolName"),r=c(n,"tool_input","toolInput"),p=c(n,"tool_response","toolResponse"),u=A(i,r,p),f={eventType:s,toolName:i,toolInput:u?.input??l(r),toolResponse:u?.response??l(p),cwd:t.cwd??c(n,"cwd"),transcriptPath:c(n,"transcript_path","transcriptPath"),raw:w(n)};return{projectId:e,source:"claude",eventType:s,sessionId:a??void 0,payload:JSON.stringify(f)}}}export const CLAUDE_EVENT_SOURCE=new ClaudeEventSource;export function frameFacts(o){const t=o?.raw,e=t&&typeof t=="object"&&typeof t.agent_id=="string"?t.agent_id:void 0;let n;if(o?.eventType==="PostToolUse"&&o.toolName==="Agent"){const r=o.toolResponse;r?.isAsync&&typeof r.agentId=="string"&&(n=r.agentId)}let s;Array.isArray(t&&typeof t=="object"?t.background_tasks:void 0)&&(s=t.background_tasks.filter(r=>r&&typeof r.id=="string"&&typeof r.status=="string").map(r=>({id:r.id,status:r.status})));const a={};e&&(a.agentId=e),n&&(a.spawnAgentId=n),s&&(a.backgroundTasks=s);const i=t&&typeof t=="object"&&typeof t.source=="string"?t.source:void 0;return i&&(a.rawSource=i),a}
1
+ import{HARNESS_EVENTS as d}from"@weavecode/core";import{capFields as p}from"../shared/json-cap.js";import{CLAUDE_PLAN as y}from"./plan.js";function g(o){try{const t=JSON.parse(o);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function a(o,...t){for(const n of t)if(o[n]!=null)return o[n];return null}const _=[["toolName",["tool_name","toolName"]],["toolInput",["tool_input","toolInput"]],["toolResponse",["tool_response","toolResponse"]],["cwd",["cwd"]],["transcriptPath",["transcript_path","transcriptPath"]]],m=/^<\$\.([A-Za-z0-9_]+(?:\.[A-Za-z0-9_]+)*)>$/;function w(o,t,n){return typeof o!="string"?null:y.draftOf(o,t,n)?.text?{input:t,response:n}:null}function A(o){const t={...o};for(const[n,e]of _)for(const r of e)r in t&&(t[r]=`<$.${n}>`);return t}export function expandPayloadRefs(o){const t=o.raw;if(!t||typeof t!="object"||Array.isArray(t))return o;const n={...t};for(const[e,r]of Object.entries(n)){const c=typeof r=="string"?m.exec(r):null;c&&(n[e]=k(o,c[1]))}return{...o,raw:n}}function k(o,t){let n=o;for(const e of t.split(".")){if(!n||typeof n!="object")return null;n=n[e]}return n??null}export class ClaudeEventSource{source="claude";events=d.claude;normalize(t,n){const e=g(t.payload),r=t.eventType||String(e.hook_event_name??"unknown"),c=t.sessionId??a(e,"session_id","sessionId"),i=a(e,"tool_name","toolName"),s=a(e,"tool_input","toolInput"),u=a(e,"tool_response","toolResponse"),f=w(i,s,u),l={eventType:r,toolName:i,toolInput:f?.input??p(s),toolResponse:f?.response??p(u),cwd:t.cwd??a(e,"cwd"),transcriptPath:a(e,"transcript_path","transcriptPath"),raw:A(e)};return{projectId:n,source:"claude",eventType:r,sessionId:c??void 0,payload:JSON.stringify(l)}}}export const CLAUDE_EVENT_SOURCE=new ClaudeEventSource;export function frameFacts(o){const t=o?.raw,n=t&&typeof t=="object"&&typeof t.agent_id=="string"?t.agent_id:void 0;let e;if(o?.eventType==="PostToolUse"&&o.toolName==="Agent"){const s=o.toolResponse;s?.isAsync&&typeof s.agentId=="string"&&(e=s.agentId)}let r;Array.isArray(t&&typeof t=="object"?t.background_tasks:void 0)&&(r=t.background_tasks.filter(s=>s&&typeof s.id=="string"&&typeof s.status=="string").map(s=>({id:s.id,status:s.status})));const c={};n&&(c.agentId=n),e&&(c.spawnAgentId=e),r&&(c.backgroundTasks=r);const i=t&&typeof t=="object"&&typeof t.source=="string"?t.source:void 0;return i&&(c.rawSource=i),c}
@@ -1,2 +1,2 @@
1
- import{createReadStream as f}from"node:fs";import{createInterface as p}from"node:readline";const u=new Set(["image/png","image/jpeg","image/gif","image/webp"]),l=10*1024*1024,o=e=>e&&typeof e=="object"?e:{};function m(e){if(!Array.isArray(e))return[];const t=[];for(const s of e){const a=o(s);if(a.type!=="image")continue;const n=o(a.source),r=typeof n.media_type=="string"?n.media_type:null,i=typeof n.data=="string"?n.data:null;if(!r||!i||!u.has(r))continue;const c=Buffer.from(i,"base64");c.length===0||c.length>l||t.push({mediaType:r,bytes:c})}return t}function y(e){return Array.isArray(e)?e.map(o).filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
2
- `):""}export const CLAUDE_IMAGES={async sessionImages({transcriptPath:e}){if(!e)return null;const t=[],s=p({input:f(e,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const a of s){if(!a.includes('"type":"image"'))continue;const n=JSON.parse(a);if(n.type!=="user"||n.toolUseResult!=null)continue;const r=o(n.message).content,i=m(r);i.length!==0&&t.push({text:y(r),at:typeof n.timestamp=="string"?n.timestamp:null,images:i})}}catch{return null}finally{s.close()}return t}};
1
+ import{createReadStream as f}from"node:fs";import{createInterface as u}from"node:readline";const l=new Set(["image/png","image/jpeg","image/gif","image/webp"]),m=10*1024*1024,a=t=>t&&typeof t=="object"?t:{};function p(t){if(!Array.isArray(t))return[];const e=[];for(const s of t){const i=a(s);if(i.type!=="image")continue;const n=a(i.source),o=typeof n.media_type=="string"?n.media_type:null,r=typeof n.data=="string"?n.data:null;if(!o||!r||!l.has(o))continue;const c=Buffer.from(r,"base64");c.length===0||c.length>m||e.push({mediaType:o,bytes:c})}return e}function y(t){return Array.isArray(t)?t.map(a).filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join(`
2
+ `):""}export const CLAUDE_IMAGES={async sessionImages({transcriptPath:t}){if(!t)return null;const e=[],s=u({input:f(t,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const i of s){if(!i.includes('"type":"image"'))continue;const n=JSON.parse(i);if(n.type!=="user"||n.toolUseResult!=null)continue;const o=a(n.message).content,r=p(o);r.length!==0&&e.push({text:y(o),at:typeof n.timestamp=="string"?n.timestamp:null,images:r})}}catch{return null}finally{s.close()}return e}};
@@ -16,6 +16,7 @@ export { interruptMarkerAt, currentModelAt, currentModeAt, currentEffortAt, curr
16
16
  export { CLAUDE_EDITS } from './edits.js';
17
17
  export { CLAUDE_IMAGES } from './images.js';
18
18
  export { CLAUDE_NARRATION } from './narration.js';
19
+ export { CLAUDE_REWIND, parseRewindLine } from './rewind.js';
19
20
  export { CLAUDE_COMMANDS, commandExecutions } from './commands.js';
20
21
  export { CLAUDE_LIVENESS, claudeLivenessById, parseClaudeSessionReg, pidAlive, pidAliveOf, shellDiscardedByClaude, CLAUDE_REG_GRACE_MS, type ClaudeSessionReg, } from './liveness.js';
21
22
  export { modelAliasTargets, aliasOfModel, bareModelName, defaultModelOf, startedModelOf, switchedModelOf, effortLevelOf, permissionModeOf, type ModelAliasTarget, type ModelSwitchFact } from './model-aliases.js';
@@ -1 +1 @@
1
- import{CLAUDE_ASSETS as e}from"./assets.js";import{CLAUDE_CAPTURE as r}from"./capture.js";import{CLAUDE_EVENT_SOURCE as o}from"./event-source.js";import{CLAUDE_MESSAGING as t}from"./messaging.js";import{CLAUDE_PLUGINS as s}from"./plugins.js";import{CLAUDE_PLUGIN_STATE as a}from"./plugin-state.js";import{CLAUDE_BLOCKING_PROMPT as E}from"./questions.js";import{CLAUDE_RESUME as m}from"./resume.js";import{CLAUDE_DETECTOR as p}from"./detect.js";import{CLAUDE_STATUSLINE as A}from"./statusline/surface.js";import{CLAUDE_CONFIG as i}from"./config.js";import{CLAUDE_EDITS as C}from"./edits.js";import{CLAUDE_IMAGES as n}from"./images.js";import{CLAUDE_NARRATION as f}from"./narration.js";import{CLAUDE_COMMANDS as U}from"./commands.js";import{CLAUDE_LIVENESS as L}from"./liveness.js";export{ClaudeEventSource,CLAUDE_EVENT_SOURCE,frameFacts,expandPayloadRefs}from"./event-source.js";export{CLAUDE_ASSETS,ClaudeJsonCorruptError,readClaudeJson}from"./assets.js";export{CLAUDE_PLUGINS,createClaudePluginSurface,WEAVE_MARKETPLACE}from"./plugins.js";export{CLAUDE_PLUGIN_STATE}from"./plugin-state.js";export{CLAUDE_RESUME}from"./resume.js";export{CLAUDE_DETECTOR}from"./detect.js";export{CLAUDE_MESSAGING}from"./messaging.js";export{CLAUDE_BLOCKING_PROMPT}from"./questions.js";export{CLAUDE_PROMPT_RELAY}from"./prompt.js";export{CLAUDE_PROMPT_INBOX}from"./prompt-inbox.js";export{CLAUDE_SIDE_QUESTION}from"./side-question.js";export{interruptMarkerAt,currentModelAt,currentModeAt,currentEffortAt,currentContextTokensAt,preQuestionTextAt}from"./transcript.js";export{CLAUDE_EDITS}from"./edits.js";export{CLAUDE_IMAGES}from"./images.js";export{CLAUDE_NARRATION}from"./narration.js";export{CLAUDE_COMMANDS,commandExecutions}from"./commands.js";export{CLAUDE_LIVENESS,claudeLivenessById,parseClaudeSessionReg,pidAlive,pidAliveOf,shellDiscardedByClaude,CLAUDE_REG_GRACE_MS}from"./liveness.js";export{modelAliasTargets,aliasOfModel,bareModelName,defaultModelOf,startedModelOf,switchedModelOf,effortLevelOf,permissionModeOf}from"./model-aliases.js";export{resolveClaudePeer}from"./peers.js";export{CLAUDE_CAPTURE,generateHookHandler,captureHookGroup,sweepWeaveHookEvents,groupIsWeave,captureGroupsPresent,readUserCapture,installUserCapture,uninstallUserCapture,stripProjectCapture,HOOK_HANDLER_MARKER}from"./capture.js";export{generateSettingsJson,mergeSettingsJson,stripWeaveSettings}from"./settings-gen.js";export{generateMcpJson,mergeMcpJson,stripWeaveMcp}from"./mcp-gen.js";export{generateAutoMemoryHook}from"./helpers-gen.js";export{CLAUDE_STATUSLINE}from"./statusline/surface.js";export{CLAUDE_CONFIG,ensureTrustAccepted as ensureClaudeTrustAccepted}from"./config.js";export{generateStatuslineScript}from"./statusline/generator.js";export*from"./statusline/config.js";export const CLAUDE_DRIVER={id:"claude",displayName:"Claude Code",capabilities:["assets","events","resume","detect","plugins","pluginState","messaging","questions","capture","statusline","config","edits","images","narration","commands","liveness"],assets:e,events:o,resume:m,detect:p,plugins:s,pluginState:a,messaging:t,questions:E,capture:r,statusline:A,config:i,edits:C,images:n,narration:f,commands:U,liveness:L};
1
+ import{CLAUDE_ASSETS as e}from"./assets.js";import{CLAUDE_CAPTURE as r}from"./capture.js";import{CLAUDE_EVENT_SOURCE as o}from"./event-source.js";import{CLAUDE_MESSAGING as t}from"./messaging.js";import{CLAUDE_PLUGINS as E}from"./plugins.js";import{CLAUDE_PLUGIN_STATE as s}from"./plugin-state.js";import{CLAUDE_BLOCKING_PROMPT as m}from"./questions.js";import{CLAUDE_RESUME as p}from"./resume.js";import{CLAUDE_DETECTOR as A}from"./detect.js";import{CLAUDE_STATUSLINE as a}from"./statusline/surface.js";import{CLAUDE_CONFIG as i}from"./config.js";import{CLAUDE_EDITS as C}from"./edits.js";import{CLAUDE_IMAGES as n}from"./images.js";import{CLAUDE_NARRATION as f}from"./narration.js";import{CLAUDE_COMMANDS as U}from"./commands.js";import{CLAUDE_LIVENESS as L}from"./liveness.js";import{CLAUDE_REWIND as _}from"./rewind.js";export{ClaudeEventSource,CLAUDE_EVENT_SOURCE,frameFacts,expandPayloadRefs}from"./event-source.js";export{CLAUDE_ASSETS,ClaudeJsonCorruptError,readClaudeJson}from"./assets.js";export{CLAUDE_PLUGINS,createClaudePluginSurface,WEAVE_MARKETPLACE}from"./plugins.js";export{CLAUDE_PLUGIN_STATE}from"./plugin-state.js";export{CLAUDE_RESUME}from"./resume.js";export{CLAUDE_DETECTOR}from"./detect.js";export{CLAUDE_MESSAGING}from"./messaging.js";export{CLAUDE_BLOCKING_PROMPT}from"./questions.js";export{CLAUDE_PROMPT_RELAY}from"./prompt.js";export{CLAUDE_PROMPT_INBOX}from"./prompt-inbox.js";export{CLAUDE_SIDE_QUESTION}from"./side-question.js";export{interruptMarkerAt,currentModelAt,currentModeAt,currentEffortAt,currentContextTokensAt,preQuestionTextAt}from"./transcript.js";export{CLAUDE_EDITS}from"./edits.js";export{CLAUDE_IMAGES}from"./images.js";export{CLAUDE_NARRATION}from"./narration.js";export{CLAUDE_REWIND,parseRewindLine}from"./rewind.js";export{CLAUDE_COMMANDS,commandExecutions}from"./commands.js";export{CLAUDE_LIVENESS,claudeLivenessById,parseClaudeSessionReg,pidAlive,pidAliveOf,shellDiscardedByClaude,CLAUDE_REG_GRACE_MS}from"./liveness.js";export{modelAliasTargets,aliasOfModel,bareModelName,defaultModelOf,startedModelOf,switchedModelOf,effortLevelOf,permissionModeOf}from"./model-aliases.js";export{resolveClaudePeer}from"./peers.js";export{CLAUDE_CAPTURE,generateHookHandler,captureHookGroup,sweepWeaveHookEvents,groupIsWeave,captureGroupsPresent,readUserCapture,installUserCapture,uninstallUserCapture,stripProjectCapture,HOOK_HANDLER_MARKER}from"./capture.js";export{generateSettingsJson,mergeSettingsJson,stripWeaveSettings}from"./settings-gen.js";export{generateMcpJson,mergeMcpJson,stripWeaveMcp}from"./mcp-gen.js";export{generateAutoMemoryHook}from"./helpers-gen.js";export{CLAUDE_STATUSLINE}from"./statusline/surface.js";export{CLAUDE_CONFIG,ensureTrustAccepted as ensureClaudeTrustAccepted}from"./config.js";export{generateStatuslineScript}from"./statusline/generator.js";export*from"./statusline/config.js";export const CLAUDE_DRIVER={id:"claude",displayName:"Claude Code",capabilities:["assets","events","resume","detect","plugins","pluginState","messaging","questions","capture","statusline","config","edits","images","narration","commands","liveness","rewind"],assets:e,events:o,resume:p,detect:A,plugins:E,pluginState:s,messaging:t,questions:m,capture:r,statusline:a,config:i,edits:C,images:n,narration:f,commands:U,liveness:L,rewind:_};
@@ -1 +1 @@
1
- import{readdirSync as u,readFileSync as a}from"node:fs";import{join as c}from"node:path";export function parseClaudeSessionReg(e){let n;try{n=JSON.parse(e)}catch{return null}const t=n;return typeof t?.pid!="number"||!Number.isInteger(t.pid)||t.pid<0||typeof t.sessionId!="string"||!t.sessionId?null:{pid:t.pid,sessionId:t.sessionId}}export function pidAlive(e){try{return process.kill(e,0),!0}catch(n){return n.code!=="ESRCH"}}export const CLAUDE_REG_GRACE_MS=9e4;export function pidAliveOf(e,n,t=Date.now()){const s=n.get(e.sessionId);if(s!==void 0)return s;if(e.harness!=="claude"||e.lastEventType==="SessionStart"&&(e.eventCount??0)<=1)return null;const r=Date.parse(e.lastSeenAt);return!Number.isFinite(r)||t-r<CLAUDE_REG_GRACE_MS?null:!1}export function shellDiscardedByClaude(e,n,t=Date.now()){if(e.harness!=="claude"||e.lastEventType!=="SessionStart"||(e.eventCount??0)>1||n.has(e.sessionId))return!1;const s=Date.parse(e.lastSeenAt);return Number.isFinite(s)&&t-s>=CLAUDE_REG_GRACE_MS}export function claudeLivenessById(e=null){const n=e??l(),t=new Map;if(!n)return t;let s;try{s=u(n)}catch{return t}for(const r of s){if(!/^\d+\.json$/.test(r))continue;let i;try{i=a(c(n,r),"utf8")}catch{continue}const o=parseClaudeSessionReg(i);o&&t.set(o.sessionId,pidAlive(o.pid))}return t}function l(){const e=process.platform==="win32"?process.env.USERPROFILE:process.env.HOME;return e?c(e,".claude","sessions"):null}export const CLAUDE_LIVENESS={harness:"claude",async alive(e){const n=claudeLivenessById();if(!e)return n;const t=new Map;for(const s of e){const r=n.get(s);r!==void 0&&t.set(s,r)}return t}};
1
+ import{readdirSync as a,readFileSync as c}from"node:fs";import{join as u}from"node:path";export function parseClaudeSessionReg(e){let t;try{t=JSON.parse(e)}catch{return null}const n=t;return typeof n?.pid!="number"||!Number.isInteger(n.pid)||n.pid<0||typeof n.sessionId!="string"||!n.sessionId?null:{pid:n.pid,sessionId:n.sessionId}}export function pidAlive(e){try{return process.kill(e,0),!0}catch(t){return t.code!=="ESRCH"}}export const CLAUDE_REG_GRACE_MS=9e4;export function pidAliveOf(e,t,n=Date.now()){const s=t.get(e.sessionId);if(s!==void 0)return s;if(e.harness!=="claude"||e.lastEventType==="SessionStart"&&(e.eventCount??0)<=1)return null;const r=Date.parse(e.lastSeenAt);return!Number.isFinite(r)||n-r<CLAUDE_REG_GRACE_MS?null:!1}export function shellDiscardedByClaude(e,t,n=Date.now()){if(e.harness!=="claude"||e.lastEventType!=="SessionStart"||(e.eventCount??0)>1||t.has(e.sessionId))return!1;const s=Date.parse(e.lastSeenAt);return Number.isFinite(s)&&n-s>=CLAUDE_REG_GRACE_MS}export function claudeLivenessById(e=null){const t=e??l(),n=new Map;if(!t)return n;let s;try{s=a(t)}catch{return n}for(const r of s){if(!/^\d+\.json$/.test(r))continue;let o;try{o=c(u(t,r),"utf8")}catch{continue}const i=parseClaudeSessionReg(o);i&&n.set(i.sessionId,pidAlive(i.pid))}return n}function l(){const e=process.platform==="win32"?process.env.USERPROFILE:process.env.HOME;return e?u(e,".claude","sessions"):null}export const CLAUDE_LIVENESS={harness:"claude",async alive(e){const t=claudeLivenessById();if(!e)return t;const n=new Map;for(const s of e){const r=t.get(s);r!==void 0&&n.set(s,r)}return n}};
@@ -1 +1 @@
1
- export function generateMcpJson(e){const r={};if(e.includeWeaveServer){const t=e.platform.os==="windows"?"cmd":"npx",c=e.platform.os==="windows"?["/c","npx","weave","mcp","start"]:["weave","mcp","start"];r.weave={command:t,args:c,env:{WEAVE_MCP:"true"}}}return{mcpServers:r}}export function mergeMcpJson(e,r){const t={...e},c=o(r.mcpServers)?r.mcpServers:{},n=o(t.mcpServers)?{...t.mcpServers}:{};for(const[s,p]of Object.entries(c))(s==="weave"||n[s]===void 0)&&(n[s]=p);return t.mcpServers=n,t}function o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export function stripWeaveMcp(e){const r={...e};if(o(r.mcpServers)){const t={...r.mcpServers};delete t.weave,Object.keys(t).length>0?r.mcpServers=t:delete r.mcpServers}return r}
1
+ export function generateMcpJson(e){const r={};if(e.includeWeaveServer){const s=e.platform.os==="windows"?"cmd":"npx",c=e.platform.os==="windows"?["/c","npx","weave","mcp","start"]:["weave","mcp","start"];r.weave={command:s,args:c,env:{WEAVE_MCP:"true"}}}return{mcpServers:r}}export function mergeMcpJson(e,r){const s={...e},c=o(r.mcpServers)?r.mcpServers:{},n=o(s.mcpServers)?{...s.mcpServers}:{};for(const[t,p]of Object.entries(c))(t==="weave"||n[t]===void 0)&&(n[t]=p);return s.mcpServers=n,s}function o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export function stripWeaveMcp(e){const r={...e};if(o(r.mcpServers)){const s={...r.mcpServers};delete s.weave,Object.keys(s).length>0?r.mcpServers=s:delete r.mcpServers}return r}
@@ -1,4 +1,4 @@
1
- import{HARNESS_LIFECYCLE as m,INJECTABLE_EVENTS as E}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as f}from"./prompt-inbox.js";import{CLAUDE_PROMPT_RELAY as A}from"./prompt.js";import{CLAUDE_RESUME as L}from"./resume.js";import{CLAUDE_SIDE_QUESTION as g}from"./side-question.js";export const CLAUDE_ATTACH={kinds:["image","file"],composePrompt(e,l){const s=l.filter(n=>!e.includes(n.path));if(s.length===0)return e;const t=s.map(n=>n.path).join(`
1
+ import{HARNESS_LIFECYCLE as h,INJECTABLE_EVENTS as E}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as p}from"./prompt-inbox.js";import{CLAUDE_PROMPT_RELAY as A}from"./prompt.js";import{CLAUDE_RESUME as L}from"./resume.js";import{CLAUDE_SIDE_QUESTION as g}from"./side-question.js";export const CLAUDE_ATTACH={kinds:["image","file"],composePrompt(e,c){const t=c.filter(s=>!e.includes(s.path));if(t.length===0)return e;const n=t.map(s=>s.path).join(`
2
2
  `);return e?`${e}
3
3
 
4
- ${t}`:t}};const _={kinds:["file","dir"],lines:!0,expression:({path:e,kind:l,lines:s})=>{const t=/\s/.test(e)?`"${e}"`:e;return l==="dir"?`@${t}/`:s?s.start===s.end?`@${t}#L${s.start}`:`@${t}#L${s.start}-${s.end}`:`@${t}`},recognize:e=>{const l=[];for(const s of e.matchAll(/(?:^|\s)@"([^"@,。;:!?、()【】「」『』《》…]+)"/g)){const t=s[1],n=s.index+s[0].length-t.length-3;let i=n+t.length+3;const r=/#L(\d+)(?:-(\d+))?/.exec(e.slice(i,i+16));r&&r.index===0&&(i+=r[0].length);const o=e[i];o!==void 0&&!/\s/.test(o)||!t||t.startsWith("/")||t.includes(":")||t.includes("#")||l.push({start:n,end:i,ref:e.slice(n,i),path:t,kind:"file",...r?{lines:{start:Number(r[1]),end:Number(r[2]??r[1])}}:{}})}for(const s of e.matchAll(/(?:^|\s)@([^\s@,。;:!?、()【】「」『』《》“”‘’…]+)/g)){const t=s[1],n=s.index+s[0].length-t.length-1,i=n+1+t.length,r=e[i];if(r!==void 0&&!/\s/.test(r))continue;const o=/#L(\d+)(?:-(\d+))?$/.exec(t),d=o?t.slice(0,o.index):t,u=d.endsWith("/"),c=u?d.slice(0,-1):d;if(!c||c.startsWith("/")||c.includes(":")||c.includes("#")||c.startsWith('"')||l.some(h=>n>=h.start&&i<=h.end))continue;const a=o?Number(o[1]):null,p=o?.[2]?Number(o[2]):a;l.push({start:n,end:i,ref:e.slice(n,i),path:c,kind:u?"dir":"file",...a!=null?{lines:{start:a,end:p}}:{}})}return l.sort((s,t)=>s.start-t.start)}};export const CLAUDE_MESSAGING={harness:"claude",discovery:!0,prompt:A,promptInbox:f,queuedPrompt:null,inject:{rideEvents:E.claude},headless:L,idleSignals:[...m.claude.close,"SessionEnd"],paneEnvSource:"hook",attach:CLAUDE_ATTACH,pathRefs:_,sideQuestion:g};
4
+ ${n}`:n}};const _={kinds:["file","dir"],lines:!0,expression:({path:e,kind:c,lines:t})=>{const n=/\s/.test(e)?`"${e}"`:e;return c==="dir"?`@${n}/`:t?t.start===t.end?`@${n}#L${t.start}`:`@${n}#L${t.start}-${t.end}`:`@${n}`},recognize:e=>{const c=[];for(const t of e.matchAll(/(?:^|\s)@"([^"@,。;:!?、()【】「」『』《》…]+)"/g)){const n=t[1],s=t.index+t[0].length-n.length-3;let o=s+n.length+3;const i=/#L(\d+)(?:-(\d+))?/.exec(e.slice(o,o+16));i&&i.index===0&&(o+=i[0].length);const r=e[o];r!==void 0&&!/\s/.test(r)||!n||n.startsWith("/")||n.includes(":")||n.includes("#")||c.push({start:s,end:o,ref:e.slice(s,o),path:n,kind:"file",...i?{lines:{start:Number(i[1]),end:Number(i[2]??i[1])}}:{}})}for(const t of e.matchAll(/(?:^|\s)@([^\s@,。;:!?、()【】「」『』《》“”‘’…]+)/g)){const n=t[1],s=t.index+t[0].length-n.length-1,o=s+1+n.length,i=e[o];if(i!==void 0&&!/\s/.test(i))continue;const r=/#L(\d+)(?:-(\d+))?$/.exec(n),l=r?n.slice(0,r.index):n,a=l.endsWith("/"),d=a?l.slice(0,-1):l;if(!d||d.startsWith("/")||d.includes(":")||d.includes("#")||d.startsWith('"')||c.some(f=>s>=f.start&&o<=f.end))continue;const u=r?Number(r[1]):null,m=r?.[2]?Number(r[2]):u;c.push({start:s,end:o,ref:e.slice(s,o),path:d,kind:a?"dir":"file",...u!=null?{lines:{start:u,end:m}}:{}})}return c.sort((t,n)=>t.start-n.start)}};export const CLAUDE_MESSAGING={harness:"claude",discovery:!0,prompt:A,promptInbox:p,queuedPrompt:null,inject:{rideEvents:E.claude},headless:L,idleSignals:[...h.claude.close,"SessionEnd"],paneEnvSource:"hook",attach:CLAUDE_ATTACH,pathRefs:_,sideQuestion:g};
@@ -1 +1 @@
1
- import c from"node:fs";import i from"node:os";import{CLAUDE_ASSETS as p}from"./assets.js";export function modelAliasTargets(t,e=process.env,r=i.homedir()){const o=f(r);return t.map(n=>{const s=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,l=o[s]??o[`${s}_NAME`]??e[s]??e[`${s}_NAME`]??n;return{alias:n,actual:l}})}export function switchedModelOf(t,e){if(t!=="PostModelSwitch")return null;const r=e,o=r?.to_model;if(typeof o!="string"||!o)return null;const n=r?.from_model;return{from:typeof n=="string"&&n?n:null,to:o}}export function defaultModelOf(t=i.homedir(),e=process.env){const r=f(t).ANTHROPIC_MODEL??e.ANTHROPIC_MODEL;if(r)return r;const o=u(t)?.model;return modelAliasTargets([typeof o=="string"&&o?o:"sonnet"],e,t)[0].actual}export function startedModelOf(t,e,r=i.homedir(),o=process.env){if(t!=="SessionStart")return null;const n=e??{},s=n.model;if(typeof s=="string"&&s)return{model:s};const l=typeof n.source=="string"?n.source:null;return l!=null&&!a.has(l)?null:{model:defaultModelOf(r,o)}}const a=new Set(["startup","resume","compact","clear"]);export function effortLevelOf(t){const e=t?.effort?.level;return typeof e=="string"&&e?e:null}export function permissionModeOf(t){const e=t?.permission_mode;return typeof e=="string"&&e?e:null}export function bareModelName(t){return t.slice(t.lastIndexOf("/")+1).replace(/\[1m\]$/i,"")}export function aliasOfModel(t,e){if(!e)return null;const r=bareModelName(e);return t.find(o=>bareModelName(o.actual)===r)?.alias??null}export function defaultPermissionModeOf(t=i.homedir()){const e=u(t)?.permissions?.defaultMode;return typeof e=="string"&&e!==""?e:null}function u(t){try{return JSON.parse(c.readFileSync(p.userConfigFile(t),"utf8"))}catch{return null}}function f(t){const e=u(t),r={};for(const[o,n]of Object.entries(e?.env??{}))typeof n=="string"&&(r[o]=n);return r}
1
+ import l from"node:fs";import f from"node:os";import{CLAUDE_ASSETS as p}from"./assets.js";export function modelAliasTargets(t,e=process.env,o=f.homedir()){const r=c(o);return t.map(n=>{const s=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=r[s]??r[`${s}_NAME`]??e[s]??e[`${s}_NAME`]??n;return{alias:n,actual:i}})}export function switchedModelOf(t,e){if(t!=="PostModelSwitch")return null;const o=e,r=o?.to_model;if(typeof r!="string"||!r)return null;const n=o?.from_model;return{from:typeof n=="string"&&n?n:null,to:r}}export function defaultModelOf(t=f.homedir(),e=process.env){const r=c(t).ANTHROPIC_MODEL??e.ANTHROPIC_MODEL;if(r)return r;const n=u(t)?.model;return modelAliasTargets([typeof n=="string"&&n?n:"sonnet"],e,t)[0].actual}export function startedModelOf(t,e,o=f.homedir(),r=process.env){if(t!=="SessionStart")return null;const n=e??{},s=n.model;if(typeof s=="string"&&s)return{model:s};const i=typeof n.source=="string"?n.source:null;return i!=null&&!m.has(i)?null:{model:defaultModelOf(o,r)}}const m=new Set(["startup","resume","compact","clear"]);export function effortLevelOf(t){const e=t?.effort?.level;return typeof e=="string"&&e?e:null}export function permissionModeOf(t){const e=t?.permission_mode;return typeof e=="string"&&e?e:null}export function bareModelName(t){return t.slice(t.lastIndexOf("/")+1).replace(/\[1m\]$/i,"")}export function aliasOfModel(t,e){if(!e)return null;const o=bareModelName(e);return t.find(r=>bareModelName(r.actual)===o)?.alias??null}export function defaultPermissionModeOf(t=f.homedir()){const o=u(t)?.permissions?.defaultMode;return typeof o=="string"&&o!==""?o:null}function u(t){try{return JSON.parse(l.readFileSync(p.userConfigFile(t),"utf8"))}catch{return null}}function c(t){const e=u(t),o={};for(const[r,n]of Object.entries(e?.env??{}))typeof n=="string"&&(o[r]=n);return o}
@@ -1,13 +1,2 @@
1
1
  import type { NarrationSurface } from '../driver.js';
2
- /**
3
- * 旁白(claude):模型在一轮里的全部 assistant 正文——hook 域只有 Stop 的
4
- * `last_assistant_message` 一个文本载体,一轮里多次输出(写工具后又补一段收尾)
5
- * 只有最后一句能进对话气泡,前面的没有任何事件照会,转录是唯一来源。
6
- *
7
- * 只认主链 assistant 条目的 text 分区:
8
- * - `isSidechain` 条目是子代理的(away 总结等),不是对用户说的话;
9
- * - thinking 分区是模型的内部推理,不是输出;
10
- * - 同一条 assistant 消息宿主拆成相邻多行(同 `message.id`),text 分区各自成段
11
- * ——按行原样保留(每行一段、时刻取该行 timestamp),拼接语义留给消费方。
12
- */
13
2
  export declare const CLAUDE_NARRATION: NarrationSurface;
@@ -1 +1 @@
1
- import{createReadStream as i}from"node:fs";import{createInterface as l}from"node:readline";export const CLAUDE_NARRATION={async sessionNarration({transcriptPath:e}){if(!e)return null;const t=[],n=l({input:i(e,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const s of n){const r=a(s);r&&t.push(r)}}catch{return null}finally{n.close()}return t},lineParser:a};function a(e){if(!e.includes('"type":"assistant"'))return null;let t;try{t=JSON.parse(e)}catch{return null}if(t.type!=="assistant"||t.isSidechain===!0)return null;const n=t.message?.content;if(!Array.isArray(n))return null;const s=n.filter(r=>!!r&&typeof r=="object"&&r.type==="text"&&typeof r.text=="string").map(r=>r.text).join("").trim();return s?{at:typeof t.timestamp=="string"?t.timestamp:null,text:s}:null}
1
+ import{readNewLines as f,transcriptSize as c}from"./transcript-cursor.js";const r=new Map,y=64;export const CLAUDE_NARRATION={async sessionNarration({transcriptPath:e}){if(!e)return null;const t=c(e);if(t===null)return r.delete(e),null;const i=r.get(e);r.delete(e);const n=i??{cur:{offset:0},segs:[]};t<n.cur.offset&&(n.cur.offset=0,n.segs=[]);const s=f(e,n.cur,t);if(s===null)return null;for(const l of s){const o=u(l);o&&n.segs.push(o)}if(r.size>=y){const l=r.keys().next().value;l!==void 0&&r.delete(l)}return r.set(e,n),n.segs},lineParser:u};function u(e){if(!e.includes('"type":"assistant"'))return null;let t;try{t=JSON.parse(e)}catch{return null}if(t.type!=="assistant"||t.isSidechain===!0)return null;const i=t.message?.content;if(!Array.isArray(i))return null;const n=i.filter(s=>!!s&&typeof s=="object"&&s.type==="text"&&typeof s.text=="string").map(s=>s.text).join("").trim();return n?{at:typeof t.timestamp=="string"?t.timestamp:null,text:n}:null}
@@ -1 +1 @@
1
- import{readdirSync as i,readFileSync as c}from"node:fs";import{homedir as m}from"node:os";import{join as s}from"node:path";export function resolveClaudePeer(a,r=s(m(),".claude","sessions")){let t;try{t=i(r)}catch{return null}for(const n of t){if(!/^\d+\.json$/.test(n))continue;let o;try{o=JSON.parse(c(s(r,n),"utf8"))}catch{continue}const e=o;if(e?.sessionId===a&&typeof e.name=="string"&&e.name)return{name:e.name}}return null}
1
+ import{readdirSync as a,readFileSync as c}from"node:fs";import{homedir as m}from"node:os";import{join as i}from"node:path";export function resolveClaudePeer(s,n=i(m(),".claude","sessions")){let r;try{r=a(n)}catch{return null}for(const t of r){if(!/^\d+\.json$/.test(t))continue;let o;try{o=JSON.parse(c(i(n,t),"utf8"))}catch{continue}const e=o;if(e?.sessionId===s&&typeof e.name=="string"&&e.name)return{name:e.name}}return null}
@@ -1 +1 @@
1
- const f=/[\\/]plans[\\/][^\\/]+\.md$/i,l=t=>typeof t=="string"&&t.trim()?t:null,o=t=>t&&typeof t=="object"?t:{};export const CLAUDE_PLAN={tool:"ExitPlanMode",writeTools:["Write","Edit","MultiEdit"],fileHint:"plans",draftOf(t,a,r){const e=o(a),n=o(r);if(t==="ExitPlanMode")return{text:l(e.plan)??l(n.plan),filePath:l(e.planFilePath)??l(n.filePath)};if(t==null||!CLAUDE_PLAN.writeTools.includes(t))return null;const i=l(e.file_path)??l(n.filePath);return!i||!f.test(i)?null:{text:l(e.content),filePath:i}}};
1
+ const f=/[\\/]plans[\\/][^\\/]+\.md$/i,n=t=>typeof t=="string"&&t.trim()?t:null,r=t=>t&&typeof t=="object"?t:{};export const CLAUDE_PLAN={tool:"ExitPlanMode",writeTools:["Write","Edit","MultiEdit"],fileHint:"plans",draftOf(t,s,o){const e=r(s),i=r(o);if(t==="ExitPlanMode")return{text:n(e.plan)??n(i.plan),filePath:n(e.planFilePath)??n(i.filePath)};if(t==null||!CLAUDE_PLAN.writeTools.includes(t))return null;const l=n(e.file_path)??n(i.filePath);return!l||!f.test(l)?null:{text:n(e.content),filePath:l}}};