@weavecode/weave 0.1.5 → 0.1.6

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 (292) 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/daemon.d.ts +2 -0
  22. package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
  23. package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
  24. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  25. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  26. package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
  27. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  28. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +4 -4
  29. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +5 -1
  30. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +4 -4
  31. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  32. package/node_modules/@weavecode/cli/package.json +5 -5
  33. package/node_modules/@weavecode/core/dist/harness.d.ts +14 -0
  34. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  35. package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
  36. package/node_modules/@weavecode/core/dist/index.js +1 -1
  37. package/node_modules/@weavecode/core/package.json +1 -1
  38. package/node_modules/@weavecode/harness/dist/claude/assets.js +1 -1
  39. package/node_modules/@weavecode/harness/dist/claude/commands.d.ts +3 -0
  40. package/node_modules/@weavecode/harness/dist/claude/commands.js +2 -3
  41. package/node_modules/@weavecode/harness/dist/claude/index.d.ts +1 -0
  42. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  43. package/node_modules/@weavecode/harness/dist/claude/narration.d.ts +0 -11
  44. package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
  45. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
  46. package/node_modules/@weavecode/harness/dist/claude/rewind.d.ts +8 -0
  47. package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -0
  48. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +31 -10
  49. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.d.ts +26 -0
  50. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -0
  51. package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
  52. package/node_modules/@weavecode/harness/dist/driver.d.ts +49 -1
  53. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  54. package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
  55. package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
  56. package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
  57. package/node_modules/@weavecode/harness/package.json +2 -2
  58. package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
  59. package/node_modules/@weavecode/server/dist/config/profiles.d.ts +19 -13
  60. package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
  61. package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
  62. package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
  63. package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
  64. package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
  65. package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
  66. package/node_modules/@weavecode/server/dist/daemon/auto-start.js +6 -6
  67. package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
  68. package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
  69. package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
  70. package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
  71. package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
  72. package/node_modules/@weavecode/server/dist/daemon/data-bus.js +1 -1
  73. package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
  74. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  75. package/node_modules/@weavecode/server/dist/daemon/entry.js +7 -1
  76. package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
  77. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
  78. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  79. package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
  80. package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
  81. package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
  82. package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
  83. package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
  84. package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
  85. package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
  86. package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
  87. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
  88. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
  89. package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
  90. package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +4 -4
  91. package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
  92. package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
  93. package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
  94. package/node_modules/@weavecode/server/dist/daemon/opener.d.ts +2 -0
  95. package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
  96. package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
  97. package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
  98. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
  99. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
  100. package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
  101. package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
  102. package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
  103. package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
  104. package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
  105. package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -1
  106. package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
  107. package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -1
  108. package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
  109. package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
  110. package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
  111. package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
  112. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.d.ts +3 -0
  113. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +1 -0
  114. package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
  115. package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
  116. package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
  117. package/node_modules/@weavecode/server/dist/daemon/session-probe.d.ts +5 -4
  118. package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
  119. package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
  120. package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
  121. package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
  122. package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
  123. package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
  124. package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
  125. package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
  126. package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
  127. package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
  128. package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
  129. package/node_modules/@weavecode/server/dist/db/db.js +6 -2
  130. package/node_modules/@weavecode/server/dist/db/layout.js +1 -1
  131. package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
  132. package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +3 -1
  133. package/node_modules/@weavecode/server/dist/hooks/bus.js +1 -1
  134. package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
  135. package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
  136. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.d.ts +12 -6
  137. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
  138. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.d.ts +3 -3
  139. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
  140. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.d.ts +19 -9
  141. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
  142. package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
  143. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.d.ts +2 -2
  144. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
  145. package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
  146. package/node_modules/@weavecode/server/dist/hooks/delivery/views.d.ts +3 -1
  147. package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
  148. package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
  149. package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
  150. package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
  151. package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
  152. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
  153. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
  154. package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
  155. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.d.ts +45 -38
  156. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -3
  157. package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
  158. package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
  159. package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
  160. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
  161. package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
  162. package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
  163. package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
  164. package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
  165. package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
  166. package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
  167. package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
  168. package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
  169. package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
  170. package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
  171. package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
  172. package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
  173. package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
  174. package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
  175. package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
  176. package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
  177. package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
  178. package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
  179. package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
  180. package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
  181. package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
  182. package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
  183. package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
  184. package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
  185. package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
  186. package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
  187. package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
  188. package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
  189. package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
  190. package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
  191. package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
  192. package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
  193. package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
  194. package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
  195. package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
  196. package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
  197. package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
  198. package/node_modules/@weavecode/server/dist/market/import.js +2 -2
  199. package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
  200. package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
  201. package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
  202. package/node_modules/@weavecode/server/dist/registry.js +2 -2
  203. package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +5 -5
  204. package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +1 -1
  205. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +5 -5
  206. package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
  207. package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
  208. package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
  209. package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
  210. package/node_modules/@weavecode/server/dist/repositories/projects.js +2 -2
  211. package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
  212. package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
  213. package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +11 -1
  214. package/node_modules/@weavecode/server/dist/repositories/sessions.js +4 -2
  215. package/node_modules/@weavecode/server/dist/repositories/uploads.d.ts +14 -4
  216. package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
  217. package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
  218. package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
  219. package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
  220. package/node_modules/@weavecode/server/dist/surfaces.d.ts +3 -1
  221. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  222. package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
  223. package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
  224. package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
  225. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
  226. package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
  227. package/node_modules/@weavecode/server/package.json +4 -4
  228. package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-C-f9WfD3.js → abnfDiagram-WEYOIA3C-CbIFQh0R.js} +1 -1
  229. package/node_modules/@weavecode/server/web/dist/assets/{arc-D62qulAD.js → arc-DH8-rYAa.js} +1 -1
  230. package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-B6ZJRpcL.js → architectureDiagram-ZHVYKT53-qnv6S0sc.js} +1 -1
  231. package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-DOtDFeiT.js → blockDiagram-RJAE7QA3-pT5eO-cB.js} +1 -1
  232. package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-DWn3ng8X.js → c4Diagram-XDPPPE54-DHDBDMb1.js} +1 -1
  233. package/node_modules/@weavecode/server/web/dist/assets/channel-BHPeeuzN.js +1 -0
  234. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-B5IIc9cn.js → chunk-2E7WHVMD-CT951PH5.js} +1 -1
  235. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-BUU9Zvt8.js → chunk-2Q5K7J3B-E5AD7_ZY.js} +1 -1
  236. package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-CqEGIghP.js → chunk-4EMNKR2T-DWz9qkcy.js} +1 -1
  237. package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-D36o_E2b.js → chunk-55XCU76K-D-SgWD8w.js} +1 -1
  238. package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-sxws8ERh.js → chunk-5VM5RSS4-ci6YzbO5.js} +1 -1
  239. package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-CJo_rEEb.js → chunk-JWPE2WC7-CY4mr2f4.js} +1 -1
  240. package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-9UlLCpsb.js → chunk-VQ5W62QI-CON8zyg8.js} +1 -1
  241. package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-CX9CPbWb.js → chunk-XXDRQBXY-DXXXZ4pW.js} +1 -1
  242. package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-DwEfdZcF.js → chunk-ZCHMQSOR-CukvPvkM.js} +2 -2
  243. package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-CFCmIyt8.js → classDiagram-v2-4MYWR3UA-GiWZ9xtF.js} +1 -1
  244. package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-qWXeXJTn.js → cose-bilkent-JH36ORCC-D7aJ-akq.js} +1 -1
  245. package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-CXabWQxz.js → cynefin-EF2NZ3EQ-9B__MaRM.js} +1 -1
  246. package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-Bzpj8Qbj.js → cynefinDiagram-WF24UDRP-B2ujZh2k.js} +1 -1
  247. package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-CXsL8t30.js → dagre-NK4GIZVX-nHaB6IWf.js} +1 -1
  248. package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-xfR-zlAD.js → diagram-CBK3MWTC-xKfjDvgr.js} +1 -1
  249. package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-BjMqEsXr.js → diagram-I5XIIV2D-BHT2-5mY.js} +1 -1
  250. package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-QZpf8KhT.js → diagram-ODIL2UCW-CckywF4W.js} +1 -1
  251. package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-Cw1ESWft.js → diagram-PFBEJUXE-Dpjlc7Wh.js} +1 -1
  252. package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-CAy2RYYZ.js → diagram-RJA3I4VV-M6WznOaW.js} +1 -1
  253. package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-B09WciWt.js → diagram-TYUNFSNR-DgRJ3zL1.js} +1 -1
  254. package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-DuLmHG0U.js → ebnfDiagram-V4P3TTPT-BzzVN__a.js} +1 -1
  255. package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ--zzx0EVP.js → elk-QONTBCTQ-Ch6Gs9G9.js} +1 -1
  256. package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-BPDjG5vB.js → erDiagram-KYQIGQAA-COxT-Pxb.js} +1 -1
  257. package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-DtE2M9a_.js → flowDiagram-IUGLLWBU-CJVWnTBa.js} +1 -1
  258. package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-B-4AaWVa.js → ganttDiagram-R7GPNTJY-BkRpWPUl.js} +1 -1
  259. package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-CYj5FGYx.js → gitGraphDiagram-PDYL7XHY-Ba8BJcvZ.js} +1 -1
  260. package/node_modules/@weavecode/server/web/dist/assets/index-CtifxEiF.css +11 -0
  261. package/node_modules/@weavecode/server/web/dist/assets/index-FwH9INgS.js +1090 -0
  262. package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-DHYSDj-3.js → infoDiagram-MVDRKAX5-HTQ5FUNK.js} +1 -1
  263. package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-CumAEBoU.js → ishikawaDiagram-HPEHV2GE-BNjEDIZy.js} +1 -1
  264. package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-ES3O3X05.js → journeyDiagram-BOSHW7O7-Cao6h91a.js} +1 -1
  265. package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-BMIrf0d9.js → kanban-definition-FNSA4HC5-CXIx2CHQ.js} +1 -1
  266. package/node_modules/@weavecode/server/web/dist/assets/{linear-DEZ5FO1r.js → linear-65WmlvQb.js} +1 -1
  267. package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-D7gm2szA.js → mermaid.core-D39fi_iR.js} +4 -4
  268. package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-BBQP8lyN.js → mindmap-definition-6OY57UG3-DHqpz_AK.js} +1 -1
  269. package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-DzkKsqmg.js → pegDiagram-ECIUJNBX-Cpy1nsER.js} +1 -1
  270. package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-zR3q7Qs1.js → pieDiagram-GNMPY74T-B1IyNqzr.js} +1 -1
  271. package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-B4xuIsMW.js → quadrantDiagram-D57K4MC3-zSM6o7mB.js} +1 -1
  272. package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-D2I52m9D.js → railroadDiagram-Y72NRBL7-oM4XJIwA.js} +1 -1
  273. package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-aJ1KfKj2.js → requirementDiagram-EQYSW5RA-CbCLBjHf.js} +1 -1
  274. package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-CEq16Ecf.js → sankeyDiagram-SY24JHO5-BucVk6EP.js} +1 -1
  275. package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-Bc66KG9f.js → sequenceDiagram-BLEHNHQU-Dg8CYEnT.js} +1 -1
  276. package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-Ddizw_UG.js → sizeCapture-INFHLROL-C51zb7Oc.js} +1 -1
  277. package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-C1eVtEX9.js → stateDiagram-v2-A6IESKWZ-BvK2l3is.js} +1 -1
  278. package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-CCd_KlpZ.js → swimlanes-B3ENRKFQ-Ds7QOfXW.js} +1 -1
  279. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-ByBF02UJ.js +8 -0
  280. package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-DqpBhIII.js → timeline-definition-JXYKGLGB-CadU4Qq4.js} +1 -1
  281. package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-bX_jNjSt.js → usecaseDiagram-WPOLBNNX-BYuZwTDZ.js} +1 -1
  282. package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-D07CUHl3.js → vennDiagram-Q3Y3IDCW-C7zgxe07.js} +1 -1
  283. package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-CZ5ovcWa.js → wardleyDiagram-IVAIDKWA-DA4Otf4s.js} +1 -1
  284. package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-CBTh52hU.js → xychartDiagram-4URNHDU4-Bs5YGwMU.js} +1 -1
  285. package/node_modules/@weavecode/server/web/dist/index.html +2 -2
  286. package/node_modules/@weavecode/server/web/dist/sw.js +14 -12
  287. package/node_modules/@weavecode/templates/package.json +2 -2
  288. package/package.json +6 -6
  289. package/node_modules/@weavecode/server/web/dist/assets/channel-CjSr3Zfg.js +0 -1
  290. package/node_modules/@weavecode/server/web/dist/assets/index-BGdTLG4q.js +0 -1031
  291. package/node_modules/@weavecode/server/web/dist/assets/index-CEpJpR7P.css +0 -11
  292. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-yIifcHaR.js +0 -8
@@ -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",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,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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
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
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
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"}};
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===".claude/worktrees"||e.startsWith(".claude/worktrees/"):e!==".mcp.json"&&e!=="CLAUDE.md"}};
@@ -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 c from"node:path";import{execCli as j}from"./plugins.js";import{readNewLines as A,transcriptSize as M}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(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(e=>e.trim()!==""&&!e.startsWith("#"))?.trim()??"")}async function v(i){try{const t=await H(i);return t.isDirectory()?"dir":t.isFile()?"file":"other"}catch{return"other"}}async function $(i){try{const t=[];for(const n of await w(i,{withFileTypes:!0})){if(!n.name.endsWith(".md"))continue;const e=c.join(i,n.name);(n.isFile()||n.isSymbolicLink()&&await v(e)==="file")&&t.push(e)}return t}catch{return[]}}async function m(i){try{const t=[];for(const n of await w(i,{withFileTypes:!0})){const e=c.join(i,n.name);(n.isDirectory()||n.isSymbolicLink()&&await v(e)==="dir")&&t.push(e)}return t}catch{return[]}}async function C(i){const t=[],n=async(e,s)=>{for(const o of await $(e)){const r=`${s}${c.basename(o,".md")}`,a=k(await y(o,"utf8").catch(()=>""));t.push({name:r,description:a,source:"command"})}for(const o of await m(e))await n(o,`${s}${c.basename(o)}:`)};return await n(i,""),t}async function g(i,t="",n="skill"){const e=[];for(const s of await m(i)){const o=k(await y(c.join(s,"SKILL.md"),"utf8").catch(()=>""));e.push({name:`${t}${c.basename(s)}`,description:o,source:n})}return e}async function I(i){const t=[],n=new Set;for(const e of await m(c.join(i,"plugins","cache")))for(const s of await m(e)){const o=c.basename(s);if(!n.has(o))for(const r of await m(s)){const a=await g(c.join(r,"skills"),`${o}:`,"plugin");if(a.length>0){n.add(o),t.push(...a);break}}}return t}async function D(i){try{const{stdout:t}=await i(["plugin","list","--json"],{timeoutMs:15e3}),n=JSON.parse(t);if(!Array.isArray(n))return null;const e=[];for(const s of n){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 E(i){const t=await D(i);if(!t)return null;const n=[];for(const e of t)e.enabled&&n.push(...await g(c.join(e.installPath,"skills"),`${e.plugin}:`,"plugin"));return n}function z(i){const t=new Set,n=[];for(const e of i)t.has(e.name)||(t.add(e.name),n.push(e));return n}const P=i=>typeof i=="string"?i:"";function O(i){return/<command-args>([\s\S]*?)<\/command-args>/.exec(i)?.[1]?.trim()??""}const d=new Map,F=64;export async function commandExecutions(i){const t=M(i);if(t===null)return d.delete(i),null;const n=d.get(i);d.delete(i);const e=n??{cur:{offset:0},out:[],pending:null};t<e.cur.offset&&(e.cur.offset=0,e.out=[],e.pending=null);const s=A(i,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 u;try{u=JSON.parse(a)}catch{continue}if(u===null||typeof u!="object")continue;const p=u,l=p.message?.content;if(typeof l!="string")continue;const S=P(p.timestamp),b=/<command-name>([^<]*)<\/command-name>/.exec(l)?.[1]?.trim();if(b?.startsWith("/")){r={name:b.slice(1),args:O(l),at:S};continue}const f=/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/.exec(l)?.[1];if(f===void 0||r===null)continue;const h=f.replace(/\u001b\[[0-9;]*m/g,"").trim();o.push({...r,...h!==""?{output:h}:{}}),r=null}if(e.pending=r,d.size>=F){const a=d.keys().next().value;a!==void 0&&d.delete(a)}return d.set(i,e),o}const R=6e4,T=16;export function createClaudeCommandSurface(i={}){const t=i.exec??j,n=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=n.get(o);if(a&&r-a.at<R)return a.rows;const u=c.join(s,".claude"),p=z([...L,...await C(c.join(e,".claude","commands")),...await C(c.join(u,"commands")),...await g(c.join(e,".claude","skills")),...await g(c.join(u,"skills")),...await E(t)??await I(u)]);if(n.size>=T){const l=n.keys().next().value;l!==void 0&&n.delete(l)}return n.set(o,{at:r,rows:p}),p},executions:e=>e?commandExecutions(e):Promise.resolve(null)}}export const CLAUDE_COMMANDS=createClaudeCommandSurface();
@@ -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 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 L}from"./commands.js";import{CLAUDE_LIVENESS as U}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:m,detect:p,plugins:s,pluginState:a,messaging:t,questions:E,capture:r,statusline:A,config:i,edits:C,images:n,narration:f,commands:L,liveness:U,rewind:_};
@@ -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 a,transcriptSize as c}from"./transcript-cursor.js";const r=new Map,f=64;export const CLAUDE_NARRATION={async sessionNarration({transcriptPath:t}){if(!t)return null;const e=c(t);if(e===null)return r.delete(t),null;const i=r.get(t);r.delete(t);const n=i??{cur:{offset:0},segs:[]};e<n.cur.offset&&(n.cur.offset=0,n.segs=[]);const s=a(t,n.cur,e);if(s===null)return null;for(const l of s){const o=u(l);o&&n.segs.push(o)}if(r.size>=f){const l=r.keys().next().value;l!==void 0&&r.delete(l)}return r.set(t,n),n.segs},lineParser:u};function u(t){if(!t.includes('"type":"assistant"'))return null;let e;try{e=JSON.parse(t)}catch{return null}if(e.type!=="assistant"||e.isSidechain===!0)return null;const i=e.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 e.timestamp=="string"?e.timestamp:null,text:n}:null}
@@ -1,2 +1,2 @@
1
- import{readFile as b}from"node:fs/promises";import{HARNESS_LIFECYCLE as k}from"@weavecode/core";import{CLAUDE_PLAN as g}from"./plan.js";import{defaultPermissionModeOf as w}from"./model-aliases.js";import{preQuestionTextAt as S}from"./transcript.js";const m="\x1B[B",u=" ",v="\x1B[Z",A=2e3,f="(preview cannot be shown in full \u2014 compare the option labels and descriptions instead)",x="No preview available",N="n",T="press n to add notes",C=/[\p{M}\u200b-\u200f\u2028-\u202e\u2060-\u206f\u180b-\u180f\ufe0e\ufe0f]/u,P=[{keys:["1"],label:"Yes, and switch to default (ask each time) for this session"},{keys:["2"],label:"No"}],q={bypassPermissions:"BYPASS PERMISSIONS (no further prompts)"};export function planApprovalOptions(e){return e==null||e==="default"||e==="plan"?P.map(t=>({...t})):[{keys:["1"],label:`Yes, and switch to ${q[e]??e} for this session`},{keys:["2"],label:"Yes, manually approve edits"},{keys:["3"],label:"Tell Claude what to change",description:"shift+tab to approve with this feedback",input:!0,textTail:[v]}]}const Y=[{keys:["1"],label:"Yes"},{keys:["2"],label:"Yes, and don't ask again for this tool"},{keys:["3"],label:"No, and tell Claude what to do differently (esc)"}],$=[{keys:["1"],label:"Yes, and tell Claude what to do next"},{keys:["2"],label:"No"}],h={key:"AskUserQuestion:opaque",header:null,question:"The session is asking a question (options unavailable \u2014 answer in its terminal)",multiSelect:!1,options:[]};function M(e){if(!e||typeof e!="object")return null;const t=e,n=r(t.to_model),s=r(t.from_model);return!n||!s||n===s||t.prompt_cache_warm!==!0?null:{key:"model:switch",header:"Switch model?",question:`Your next response will be slower and use more tokens. This conversation is cached for the current model. Switching to ${n} means the full history gets re-read on your next message.`,multiSelect:!1,options:[{keys:["1"],label:`Yes, switch to ${n}`},{keys:["2"],label:"No, go back"}]}}function Q(e){if(e==null||typeof e!="object")return"";try{const t=JSON.stringify(e);return!t||t==="{}"?"":t.length>160?`${t.slice(0,160)}\u2026`:t}catch{return""}}function _(e,t){return[t?{keys:[String(e+1)],label:"Type something",input:!0,textFocus:Array.from({length:e},()=>m),textTail:[u,"\r"]}:{keys:[String(e+1)],label:"Type something",input:!0,textTail:["\r"]},{keys:[String(e+2)],label:"Chat about this",chat:!0}]}function E(){return{key:"AskUserQuestion:submit",header:"Submit",question:"Review your answers",multiSelect:!1,submit:!0,options:[{keys:[u,"1"],label:"Submit answers"},{keys:[u,"2"],label:"Cancel"}]}}function r(e){return typeof e=="string"&&e?e:null}function I(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=r(n.label);if(!s)continue;const o=n.description;t.push({keys:[String(t.length+1)],label:s,description:typeof o=="string"&&o?o:null,preview:L(n.preview)})}return t}function L(e){return typeof e!="string"?null:e.length>A?f:e.replace(/�/g,"").trim()?C.test(e)?f:e:null}function O(e,t){return t<2?[String(e+1)]:[String(e===0?2:1),String(e+1)]}function U(e){return e.map((t,n)=>({keys:O(n,e.length),commit:["\r"],label:t.label,description:t.description,preview:t.preview??x}))}function j(e){const t=[];return e>=2&&t.push({keys:[N],label:"Notes:",description:T,input:!0,textTail:["\r"]}),t.push({keys:[String(e),m,"\r"],label:"Chat about this",chat:!0}),t}export const CLAUDE_BLOCKING_PROMPT={plan:g,blockingTools:k.claude.questionTools,permissionNotificationType:"permission_prompt",silentPermissionModes:["bypassPermissions","dontAsk"],permissionQuestion(e){const t=e.toolName?`${e.toolName}${e.toolInput?` ${Q(e.toolInput)}`:""}`:"",n=e.permissionMode==="auto"||/classifier/i.test(e.message??""),s=e.message?.trim()||"Claude needs your permission";return{key:"permission:confirm",header:n?"Permission (auto mode)":"Permission",question:t?`${s}
2
- ${t}`:s,multiSelect:!1,options:[...n?$:Y]}},parseQuestions(e,t){if(e==="AskUserQuestion"){const n=t&&typeof t=="object"?t.questions:void 0;if(!Array.isArray(n))return[h];const s=[];for(const o of n){if(!o||typeof o!="object")continue;const l=r(o.question),p=r(o.header),a=o.multiSelect===!0,i=I(o.options);if(!l||i.length===0)continue;const d=p??l.slice(0,24),c=!a&&i.some(y=>y.preview!=null);s.push({key:`AskUserQuestion:${d}`,header:p,question:l,options:c?[...U(i),...j(i.length)]:[...i,..._(i.length,a)],multiSelect:a,previewMode:c})}return s.length===0?[h]:((s.length>=2||s.some(o=>o.multiSelect))&&s.push(E()),s)}return[{key:"ExitPlanMode:approve",header:"Exit plan mode?",question:"Claude wants to exit plan mode",multiSelect:!1,options:planApprovalOptions(w())}]},eventQuestion(e,t){return e==="PreModelSwitch"?M(t.raw):null},async preQuestion(e){if(!e)return null;let t;try{t=await b(e,"utf8")}catch{return null}return S(t)}};
1
+ import{HARNESS_LIFECYCLE as b}from"@weavecode/core";import{CLAUDE_PLAN as k}from"./plan.js";import{defaultPermissionModeOf as g}from"./model-aliases.js";import{preQuestionTextAt as w}from"./transcript.js";import{readTail as S}from"./transcript-cursor.js";const v=512*1024,m="\x1B[B",u=" ",A="\x1B[Z",x=2e3,f="(preview cannot be shown in full \u2014 compare the option labels and descriptions instead)",T="No preview available",N="n",C="press n to add notes",P=/[\p{M}\u200b-\u200f\u2028-\u202e\u2060-\u206f\u180b-\u180f\ufe0e\ufe0f]/u,q=[{keys:["1"],label:"Yes, and switch to default (ask each time) for this session"},{keys:["2"],label:"No"}],Y={bypassPermissions:"BYPASS PERMISSIONS (no further prompts)"};export function planApprovalOptions(e){return e==null||e==="default"||e==="plan"?q.map(t=>({...t})):[{keys:["1"],label:`Yes, and switch to ${Y[e]??e} for this session`},{keys:["2"],label:"Yes, manually approve edits"},{keys:["3"],label:"Tell Claude what to change",description:"shift+tab to approve with this feedback",input:!0,textTail:[A]}]}const $=[{keys:["1"],label:"Yes"},{keys:["2"],label:"Yes, and don't ask again for this tool"},{keys:["3"],label:"No, and tell Claude what to do differently (esc)"}],M=[{keys:["1"],label:"Yes, and tell Claude what to do next"},{keys:["2"],label:"No"}],h={key:"AskUserQuestion:opaque",header:null,question:"The session is asking a question (options unavailable \u2014 answer in its terminal)",multiSelect:!1,options:[]};function Q(e){if(!e||typeof e!="object")return null;const t=e,n=r(t.to_model),s=r(t.from_model);return!n||!s||n===s||t.prompt_cache_warm!==!0?null:{key:"model:switch",header:"Switch model?",question:`Your next response will be slower and use more tokens. This conversation is cached for the current model. Switching to ${n} means the full history gets re-read on your next message.`,multiSelect:!1,options:[{keys:["1"],label:`Yes, switch to ${n}`},{keys:["2"],label:"No, go back"}]}}function _(e){if(e==null||typeof e!="object")return"";try{const t=JSON.stringify(e);return!t||t==="{}"?"":t.length>160?`${t.slice(0,160)}\u2026`:t}catch{return""}}function E(e,t){return[t?{keys:[String(e+1)],label:"Type something",input:!0,textFocus:Array.from({length:e},()=>m),textTail:[u,"\r"]}:{keys:[String(e+1)],label:"Type something",input:!0,textTail:["\r"]},{keys:[String(e+2)],label:"Chat about this",chat:!0}]}function I(){return{key:"AskUserQuestion:submit",header:"Submit",question:"Review your answers",multiSelect:!1,submit:!0,options:[{keys:[u,"1"],label:"Submit answers"},{keys:[u,"2"],label:"Cancel"}]}}function r(e){return typeof e=="string"&&e?e:null}function L(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const s=r(n.label);if(!s)continue;const o=n.description;t.push({keys:[String(t.length+1)],label:s,description:typeof o=="string"&&o?o:null,preview:O(n.preview)})}return t}function O(e){return typeof e!="string"?null:e.length>x?f:e.replace(/�/g,"").trim()?P.test(e)?f:e:null}function U(e,t){return t<2?[String(e+1)]:[String(e===0?2:1),String(e+1)]}function B(e){return e.map((t,n)=>({keys:U(n,e.length),commit:["\r"],label:t.label,description:t.description,preview:t.preview??T}))}function j(e){const t=[];return e>=2&&t.push({keys:[N],label:"Notes:",description:C,input:!0,textTail:["\r"]}),t.push({keys:[String(e),m,"\r"],label:"Chat about this",chat:!0}),t}export const CLAUDE_BLOCKING_PROMPT={plan:k,blockingTools:b.claude.questionTools,permissionNotificationType:"permission_prompt",silentPermissionModes:["bypassPermissions","dontAsk"],permissionQuestion(e){const t=e.toolName?`${e.toolName}${e.toolInput?` ${_(e.toolInput)}`:""}`:"",n=e.permissionMode==="auto"||/classifier/i.test(e.message??""),s=e.message?.trim()||"Claude needs your permission";return{key:"permission:confirm",header:n?"Permission (auto mode)":"Permission",question:t?`${s}
2
+ ${t}`:s,multiSelect:!1,options:[...n?M:$]}},parseQuestions(e,t){if(e==="AskUserQuestion"){const n=t&&typeof t=="object"?t.questions:void 0;if(!Array.isArray(n))return[h];const s=[];for(const o of n){if(!o||typeof o!="object")continue;const l=r(o.question),p=r(o.header),a=o.multiSelect===!0,i=L(o.options);if(!l||i.length===0)continue;const d=p??l.slice(0,24),c=!a&&i.some(y=>y.preview!=null);s.push({key:`AskUserQuestion:${d}`,header:p,question:l,options:c?[...B(i),...j(i.length)]:[...i,...E(i.length,a)],multiSelect:a,previewMode:c})}return s.length===0?[h]:((s.length>=2||s.some(o=>o.multiSelect))&&s.push(I()),s)}return[{key:"ExitPlanMode:approve",header:"Exit plan mode?",question:"Claude wants to exit plan mode",multiSelect:!1,options:planApprovalOptions(g())}]},eventQuestion(e,t){return e==="PreModelSwitch"?Q(t.raw):null},async preQuestion(e){if(!e)return null;const t=S(e,v);return t===null?null:w(t)}};
@@ -0,0 +1,8 @@
1
+ import type { RewindSurface, RewindMark } from '../driver.js';
2
+ export declare const CLAUDE_REWIND: RewindSurface;
3
+ /**
4
+ * 一行转录 → 一条回退锚点(全量读与增量监视共用这份文法)。`seenRoot` =
5
+ * 此前是否已见过链根——会话开头第一条 user 与斜杠命令展开(`<command-message>`
6
+ * 开头,实测每次执行都立新根)都算,rewind 后的普通消息是**下一个**根。
7
+ */
8
+ export declare function parseRewindLine(line: string, seenRoot: boolean): RewindMark | null;
@@ -0,0 +1 @@
1
+ import{readNewLines as l,transcriptSize as a}from"./transcript-cursor.js";const s=new Map,f=64;export const CLAUDE_REWIND={async sessionRewinds({transcriptPath:t}){if(!t)return null;const e=a(t);if(e===null)return s.delete(t),null;const o=s.get(t);s.delete(t);const n=o??{cur:{offset:0},marks:[],seenRoot:!1};e<n.cur.offset&&(n.cur.offset=0,n.marks=[],n.seenRoot=!1);const u=l(t,n.cur,e);if(u===null)return null;for(const r of u){if(!r.includes('"type":"user"'))continue;const i=parseRewindLine(r,n.seenRoot);i&&n.marks.push(i);try{c(JSON.parse(r))&&(n.seenRoot=!0)}catch{}}if(s.size>=f){const r=s.keys().next().value;r!==void 0&&s.delete(r)}return s.set(t,n),n.marks}};export function parseRewindLine(t,e){if(!t.includes('"type":"user"'))return null;let o;try{o=JSON.parse(t)}catch{return null}if(!c(o)||!e)return null;const n=o.timestamp;return typeof n!="string"?null:{at:n,boundaryAt:null}}function c(t){if(t.type!=="user"||t.parentUuid!==null||t.isSidechain===!0)return!1;const e=t.message?.content;return!(typeof e=="string"&&e.startsWith("<command-message>"))}
@@ -1,4 +1,4 @@
1
- import{CONTEXT_STYLE_FORMAT as c,POWERLINE_DEFAULT_GLYPHS as e,SEGMENT_DEFAULT_FORMAT as d,SEGMENT_ORDER as p}from"./config.js";const h={gray:"90",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36"},f={gray:"100",red:"41",green:"42",yellow:"43",blue:"44",magenta:"45",cyan:"46"},g="\u2588",m="\u2591",v=10,E=8*1024*1024,r=5e3,y=3600,F=60,b=60,w=60,C=5;export function generateStatuslineScript(n,t){const u=JSON.stringify(n),i=JSON.stringify(t.cacheDir),s=JSON.stringify(h),a=JSON.stringify(f),o=JSON.stringify(d),l=JSON.stringify(c);return`#!/usr/bin/env node
1
+ import{CONTEXT_STYLE_FORMAT as c,POWERLINE_DEFAULT_GLYPHS as e,SEGMENT_DEFAULT_FORMAT as d,SEGMENT_ORDER as p}from"./config.js";const h={gray:"90",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36"},f={gray:"100",red:"41",green:"42",yellow:"43",blue:"44",magenta:"45",cyan:"46"},g="\u2588",m="\u2591",E=10,F=8*1024*1024,r=5e3,v=3600,y=60,b=60,w=60,C=5;export function generateStatuslineScript(n,t){const u=JSON.stringify(n),a=JSON.stringify(t.cacheDir),i=JSON.stringify(h),s=JSON.stringify(f),o=JSON.stringify(d),l=JSON.stringify(c);return`#!/usr/bin/env node
2
2
  /**
3
3
  * weave statusline \u2014 generated by the weave dashboard.
4
4
  * Reads Claude Code's statusline JSON from stdin and prints a summary.
@@ -8,19 +8,19 @@ import{CONTEXT_STYLE_FORMAT as c,POWERLINE_DEFAULT_GLYPHS as e,SEGMENT_DEFAULT_F
8
8
  'use strict';
9
9
 
10
10
  const CONFIG = ${u};
11
- const ANSI = ${s};
12
- const BG = ${a};
11
+ const ANSI = ${i};
12
+ const BG = ${s};
13
13
  const SEGMENT_FORMAT = ${o};
14
14
  const CONTEXT_FORMAT = ${l};
15
15
  const BAR_FILL = '${g}';
16
16
  const BAR_EMPTY = '${m}';
17
- const BAR_CELLS = ${v};
18
- const GIT_IDENTITY_TTL = ${y};
19
- const GIT_CHANGES_TTL = ${F};
17
+ const BAR_CELLS = ${E};
18
+ const GIT_IDENTITY_TTL = ${v};
19
+ const GIT_CHANGES_TTL = ${y};
20
20
  const GIT_BRANCH_TTL = ${b};
21
21
  const GIT_SYNC_TTL = ${w};
22
22
  const GIT_RETRY_TTL = ${C};
23
- const CACHE_DIR = ${i};
23
+ const CACHE_DIR = ${a};
24
24
  // Stamped into the row-0 logo so the running version is always visible.
25
25
  const WEAVE_VERSION = ${JSON.stringify(t.version)};
26
26
  // Powerline glyphs (Nerd Font), configurable via CONFIG.powerline: undefined
@@ -124,14 +124,35 @@ function cacheKeyOf(input) {
124
124
  return crypto.createHash('sha1').update(cwd).digest('hex').slice(0, 16);
125
125
  }
126
126
 
127
+ // \u5206\u7247\u6587\u4EF6\u7684\u952E\u6052\u4E3A\u9879\u76EE\u6839\uFF1A\u4F1A\u8BDD\u53EF\u4EE5 cd \u8FDB\u5B50\u76EE\u5F55\uFF0C\u800C dashboard \u5E95\u6761\u6309\u9879\u76EE\u8DEF\u5F84\u627E
128
+ // \u540C\u4E00\u4E2A\u6587\u4EF6\u2014\u2014\u4E24\u8FB9\u5FC5\u987B\u54C8\u5E0C\u540C\u4E00\u4E2A\u5B57\u7B26\u4E32\uFF08\u5426\u5219\u5E95\u6761\u6C38\u8FDC\u8BFB\u4E0D\u5230\uFF09\u3002\u9879\u76EE\u6839\u4F18\u5148\u53D6
129
+ // \u811A\u672C\u81EA\u8EAB\u4F4D\u7F6E\uFF08\u672C\u6587\u4EF6\u56FA\u5B9A\u5728 <\u9879\u76EE>/.claude/helpers/ \u4E0B = weave init \u7684\u90A3\u4E2A\u76EE\u5F55\uFF09\uFF0C
130
+ // \u5176\u6B21\u5BBF\u4E3B\u7684 workspace.project_dir\uFF0C\u6700\u540E\u624D\u56DE\u843D\u5230\u5F53\u524D\u76EE\u5F55\u3002
131
+ // \u6CE8\u610F\uFF1A\u63A2\u6D4B\u4ECD\u7528\u4F1A\u8BDD\u771F\u5B9E\u7684\u5DE5\u4F5C\u76EE\u5F55\uFF08cwd\uFF09\u2014\u2014\u72B6\u6001\u680F\u8981\u663E\u793A\u7528\u6237\u6B64\u523B\u6240\u5728\u7684\u4F4D\u7F6E\u4E0E
132
+ // \u90A3\u91CC\u7684\u6539\u52A8\uFF0C\u53EA\u6709\u6587\u4EF6\u843D\u5728\u54EA\u4E0D\u8DDF\u7740\u6F02\u3002
133
+ function projectRootOf(input) {
134
+ var path = require('path');
135
+ // \u53EA\u5728\u811A\u672C\u786E\u5B9E\u8EBA\u5728 <\u9879\u76EE>/.claude/helpers/<name> \u4E0B\u65F6\u624D\u7528\u4F4D\u7F6E\u63A8\u5BFC\u2014\u2014
136
+ // \u522B\u5904\u8DD1\u7684\u526F\u672C\uFF08\u6D4B\u8BD5\u3001\u624B\u5DE5\u8C03\u7528\uFF09\u4F4D\u7F6E\u6CA1\u6709\u610F\u4E49\uFF0C\u8D70\u5BBF\u4E3B\u7ED9\u7684\u9879\u76EE\u6839\u3002
137
+ try {
138
+ var helpers = path.dirname(__filename);
139
+ if (path.basename(helpers) === 'helpers' && path.basename(path.dirname(helpers)) === '.claude') {
140
+ return path.dirname(path.dirname(helpers));
141
+ }
142
+ } catch (e) {}
143
+ var dir = input.workspace && input.workspace.project_dir;
144
+ if (typeof dir === 'string' && dir) return dir;
145
+ return (input.workspace && input.workspace.current_dir) || process.cwd();
146
+ }
147
+
127
148
  function initCache(input) {
128
149
  var path = require('path');
129
150
  var crypto = require('crypto');
130
151
  CACHE_FILE = path.join(CACHE_DIR, cacheKeyOf(input) + '.json');
131
- var cwd = (input.workspace && input.workspace.current_dir) || process.cwd();
152
+ var root = projectRootOf(input);
132
153
  // \u4E00\u4E2A\u76EE\u5F55\u4E00\u4E2A\u6587\u4EF6\uFF1A\u5927\u5C0F\u5199\u4E0D\u654F\u611F\uFF08Windows\uFF09\uFF0C\u5206\u9694\u7B26\u4E0E\u5C3E\u659C\u6760\u7684\u4E0D\u540C\u5199\u6CD5\u4E5F\u7B97\u540C\u4E00\u4E2A
133
154
  var dirKey = crypto.createHash('sha1')
134
- .update(String(cwd).toLowerCase().replace(/\\\\/g, '/').replace(/\\/+$/, ''))
155
+ .update(String(root).toLowerCase().replace(/\\\\/g, '/').replace(/\\/+$/, ''))
135
156
  .digest('hex').slice(0, 16);
136
157
  GIT_FILE = path.join(CACHE_DIR, 'git-' + dirKey + '.json');
137
158
  }
@@ -355,7 +376,7 @@ function sessionTokens(transcriptPath) {
355
376
  store.tokens[transcriptPath] = entry;
356
377
  if (stat.size === entry.offset) return entry.total || null;
357
378
 
358
- var len = Math.min(stat.size - entry.offset, ${E});
379
+ var len = Math.min(stat.size - entry.offset, ${F});
359
380
  var buf = Buffer.alloc(len);
360
381
  var read = 0;
361
382
  var fd = -1;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 转录的两种读法(旁白 / 回退 / 命令回显共用):
3
+ *
4
+ * - **按行增量**:转录只追加,故记住「已消费到哪个字节」即可,每拍只读新增部分。
5
+ * 游标必须落在行边界上——读一块、找最后一个 `\n`、只推进到那里,尾部那条没写完
6
+ * 的长行下一拍连同新字节一起读(不押字符串、避免多字节字符被切断的偏移漂)。
7
+ * - **尾窗**:只关心文件末尾那点事实的(提问前说明)就别整份读进内存。
8
+ */
9
+ /** 行级游标:已经完整消费掉的字节数(恒落在行边界)。 */
10
+ export interface LineCursor {
11
+ offset: number;
12
+ }
13
+ /** 文件大小;读不到(已删/无权限)= null。 */
14
+ export declare function transcriptSize(path: string): number | null;
15
+ /** 一行是不是完整的 JSON:转录每行一条 JSON,文件末尾没换行时用它判「写完了没」。 */
16
+ export declare function isCompleteJsonLine(line: string): boolean;
17
+ /**
18
+ * 从游标处读到文件尾,返回其中**完整的行**;游标推进到最后一个换行之后。
19
+ * 末尾那条没有换行的行,只有 `isComplete` 认它写完了才一并返回并推进游标
20
+ * (写了一半的行留给下一拍,否则半行会被当成坏行永久跳过)。
21
+ * 文件被截断/换掉(size < offset)→ 游标归零从头来。读失败返回 null(调用方
22
+ * 按「这一刻读不到」处理,不猜)。
23
+ */
24
+ export declare function readNewLines(path: string, cursor: LineCursor, size: number, isComplete?: (line: string) => boolean): string[] | null;
25
+ /** 读文件尾部 `bytes` 字节(不足则整份)。读不到 = null。 */
26
+ export declare function readTail(path: string, bytes: number): string | null;
@@ -0,0 +1,2 @@
1
+ import{closeSync as y,openSync as p,readSync as S,statSync as h}from"node:fs";export function transcriptSize(e){try{return h(e).size}catch{return null}}export function isCompleteJsonLine(e){try{return JSON.parse(e),!0}catch{return!1}}export function readNewLines(e,t,s,o=isCompleteJsonLine){if(s<t.offset&&(t.offset=0),s===t.offset)return[];const r=t.offset,n=Buffer.alloc(s-r);let f;const c=p(e,"r");try{f=S(c,n,0,n.length,r)}catch{return null}finally{y(c)}const u=n.lastIndexOf(10,f-1);if(u<0){const i=n.subarray(0,f).toString("utf8");return o(i)?(t.offset=r+f,[i]):[]}const l=n.subarray(0,u+1).toString("utf8").split(`
2
+ `).slice(0,-1),a=n.subarray(u+1,f).toString("utf8");return a!==""&&o(a)?(l.push(a),t.offset=r+f):t.offset=r+u+1,l}export function readTail(e,t){const s=transcriptSize(e);if(s===null)return null;const o=Math.max(0,s-t),r=Buffer.alloc(s-o),n=p(e,"r");try{const f=S(n,r,0,r.length,o);return r.subarray(0,f).toString("utf8")}catch{return null}finally{y(n)}}
@@ -1,4 +1,4 @@
1
- import{spawn as p}from"node:child_process";import{readdir as m,readFile as f,stat as b}from"node:fs/promises";import{homedir as S}from"node:os";import r from"node:path";import{codexCommandLine as x}from"./plugins.js";const v=[{name:"model",description:"Choose what model and reasoning effort to use",source:"builtin"},{name:"approvals",description:"Choose what Codex can do without approval",source:"builtin"},{name:"new",description:"Start a new chat during a conversation",source:"builtin"},{name:"init",description:"Create an AGENTS.md file with project instructions",source:"builtin"},{name:"compact",description:"Summarize the conversation to free context",source:"builtin"},{name:"diff",description:"Show the diff of the working tree",source:"builtin"},{name:"mention",description:"Mention a file in the conversation",argsHint:"<path>",source:"builtin"},{name:"status",description:"Show session configuration and token usage",source:"builtin"},{name:"mcp",description:"List configured MCP tools",source:"builtin"},{name:"prompts",description:"Browse and use custom prompts",source:"builtin"},{name:"skills",description:"Browse and use skills",source:"builtin"},{name:"plugins",description:"Browse and manage plugins",source:"builtin"},{name:"review",description:"Review the current changes",source:"builtin"},{name:"undo",description:"Undo the last turn",source:"builtin"},{name:"statusline",description:"Configure the status line",source:"builtin"},{name:"logout",description:"Sign out of your account",source:"builtin"},{name:"quit",description:"Exit Codex",source:"builtin"}];function h(t){const n=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t)?.[1]??"";return/^description:\s*(.+)$/m.exec(n)?.[1]?.trim().replace(/^["']|["']$/g,"")||(t.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
- `).find(e=>e.trim()!==""&&!e.startsWith("#"))?.trim()??"")}async function w(t){try{const n=await b(t);return n.isDirectory()?"dir":n.isFile()?"file":"other"}catch{return"other"}}async function k(t){try{const n=[];for(const i of await m(t,{withFileTypes:!0})){if(!i.name.endsWith(".md"))continue;const e=r.join(t,i.name);(i.isFile()||i.isSymbolicLink()&&await w(e)==="file")&&n.push(e)}return n}catch{return[]}}async function C(t){try{const n=[];for(const i of await m(t,{withFileTypes:!0})){const e=r.join(t,i.name);(i.isDirectory()||i.isSymbolicLink()&&await w(e)==="dir")&&n.push(e)}return n}catch{return[]}}async function j(t){const n=[];for(const i of await k(t)){const e=h(await f(i,"utf8").catch(()=>""));n.push({name:r.basename(i,".md"),description:e,source:"command"})}return n}async function L(t){const n=[];for(const i of await C(t)){const e=h(await f(r.join(i,"SKILL.md"),"utf8").catch(()=>""));n.push({name:r.basename(i),description:e,source:"skill",sigil:"$"})}return n}function O(t){const n=t?.data;if(!Array.isArray(n))return null;const i=[];for(const e of n){const s=e?.skills;if(Array.isArray(s))for(const c of s){const o=c;typeof o.name!="string"||o.enabled===!1||i.push({name:o.name,description:typeof o.description=="string"?o.description:"",source:typeof o.pluginId=="string"?"plugin":"skill",sigil:"$"})}}return i}const A=1e4;function E(t){return new Promise(n=>{const i=process.platform==="win32",e=p(i?process.env.ComSpec||"cmd.exe":"codex",i?["/d","/s","/c",x(["app-server"])]:["app-server"],{windowsHide:!0,windowsVerbatimArguments:i,stdio:["pipe","pipe","pipe"]});let s=!1,c="";const o=a=>{s||(s=!0,clearTimeout(g),i&&e.pid!==void 0?p("taskkill",["/pid",String(e.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref():e.kill("SIGKILL"),n(a))},g=setTimeout(()=>o(null),A),l=a=>{e.stdin?.write(`${JSON.stringify(a)}
3
- `)};e.on("error",()=>o(null)),e.on("exit",()=>o(null)),e.stdin?.on("error",()=>o(null)),l({jsonrpc:"2.0",id:1,method:"initialize",params:{clientInfo:{name:"weave",title:"weave",version:"1.0.0"}}}),e.stdout?.setEncoding("utf8"),e.stdout?.on("data",a=>{c+=a;let d;for(;(d=c.indexOf(`
4
- `))>=0;){const y=c.slice(0,d);c=c.slice(d+1);let u=null;try{u=JSON.parse(y)}catch{continue}if(u?.id===1){l({jsonrpc:"2.0",method:"initialized",params:{}}),l({jsonrpc:"2.0",id:2,method:"skills/list",params:{cwds:[t]}});continue}u?.id===2&&o(O(u.result))}})})}function I(t){const n=new Set;return t.filter(i=>n.has(i.name)?!1:(n.add(i.name),!0))}export function createCodexCommandSurface(t={}){const n=t.skills??E;return{harness:"codex",async list({projectPath:i,homedir:e=S()}){const s=process.env.CODEX_HOME??r.join(e,".codex");return I([...v,...await j(r.join(s,"prompts")),...await n(i)??await L(r.join(s,"skills"))])},executions:()=>Promise.resolve(null)}}export const CODEX_COMMANDS=createCodexCommandSurface();
1
+ import{spawn as p}from"node:child_process";import{readdir as m,readFile as f,stat as b}from"node:fs/promises";import{homedir as S}from"node:os";import r from"node:path";import{codexCommandLine as x}from"./plugins.js";const k=[{name:"model",description:"Choose what model and reasoning effort to use",source:"builtin"},{name:"approvals",description:"Choose what Codex can do without approval",source:"builtin"},{name:"new",description:"Start a new chat during a conversation",source:"builtin"},{name:"init",description:"Create an AGENTS.md file with project instructions",source:"builtin"},{name:"compact",description:"Summarize the conversation to free context",source:"builtin"},{name:"diff",description:"Show the diff of the working tree",source:"builtin"},{name:"mention",description:"Mention a file in the conversation",argsHint:"<path>",source:"builtin"},{name:"status",description:"Show session configuration and token usage",source:"builtin"},{name:"mcp",description:"List configured MCP tools",source:"builtin"},{name:"prompts",description:"Browse and use custom prompts",source:"builtin"},{name:"skills",description:"Browse and use skills",source:"builtin"},{name:"plugins",description:"Browse and manage plugins",source:"builtin"},{name:"review",description:"Review the current changes",source:"builtin"},{name:"undo",description:"Undo the last turn",source:"builtin"},{name:"statusline",description:"Configure the status line",source:"builtin"},{name:"logout",description:"Sign out of your account",source:"builtin"},{name:"quit",description:"Exit Codex",source:"builtin"}];function h(t){const n=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t)?.[1]??"";return/^description:\s*(.+)$/m.exec(n)?.[1]?.trim().replace(/^["']|["']$/g,"")||(t.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").split(`
2
+ `).find(e=>e.trim()!==""&&!e.startsWith("#"))?.trim()??"")}async function w(t){try{const n=await b(t);return n.isDirectory()?"dir":n.isFile()?"file":"other"}catch{return"other"}}async function v(t){try{const n=[];for(const i of await m(t,{withFileTypes:!0})){if(!i.name.endsWith(".md"))continue;const e=r.join(t,i.name);(i.isFile()||i.isSymbolicLink()&&await w(e)==="file")&&n.push(e)}return n}catch{return[]}}async function C(t){try{const n=[];for(const i of await m(t,{withFileTypes:!0})){const e=r.join(t,i.name);(i.isDirectory()||i.isSymbolicLink()&&await w(e)==="dir")&&n.push(e)}return n}catch{return[]}}async function j(t){const n=[];for(const i of await v(t)){const e=h(await f(i,"utf8").catch(()=>""));n.push({name:r.basename(i,".md"),description:e,source:"command"})}return n}async function L(t){const n=[];for(const i of await C(t)){const e=h(await f(r.join(i,"SKILL.md"),"utf8").catch(()=>""));n.push({name:r.basename(i),description:e,source:"skill",sigil:"$"})}return n}function O(t){const n=t?.data;if(!Array.isArray(n))return null;const i=[];for(const e of n){const s=e?.skills;if(Array.isArray(s))for(const a of s){const o=a;typeof o.name!="string"||o.enabled===!1||i.push({name:o.name,description:typeof o.description=="string"?o.description:"",source:typeof o.pluginId=="string"?"plugin":"skill",sigil:"$"})}}return i}const A=1e4;function M(t){return new Promise(n=>{const i=process.platform==="win32",e=p(i?process.env.ComSpec||"cmd.exe":"codex",i?["/d","/s","/c",x(["app-server"])]:["app-server"],{windowsHide:!0,windowsVerbatimArguments:i,stdio:["pipe","pipe","pipe"]});let s=!1,a="";const o=c=>{s||(s=!0,clearTimeout(g),i&&e.pid!==void 0?p("taskkill",["/pid",String(e.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref():e.kill("SIGKILL"),n(c))},g=setTimeout(()=>o(null),A),l=c=>{e.stdin?.write(`${JSON.stringify(c)}
3
+ `)};e.on("error",()=>o(null)),e.on("exit",()=>o(null)),e.stdin?.on("error",()=>o(null)),l({jsonrpc:"2.0",id:1,method:"initialize",params:{clientInfo:{name:"weave",title:"weave",version:"1.0.0"}}}),e.stdout?.setEncoding("utf8"),e.stdout?.on("data",c=>{a+=c;let d;for(;(d=a.indexOf(`
4
+ `))>=0;){const y=a.slice(0,d);a=a.slice(d+1);let u=null;try{u=JSON.parse(y)}catch{continue}if(u?.id===1){l({jsonrpc:"2.0",method:"initialized",params:{}}),l({jsonrpc:"2.0",id:2,method:"skills/list",params:{cwds:[t]}});continue}u?.id===2&&o(O(u.result))}})})}function E(t){const n=new Set;return t.filter(i=>n.has(i.name)?!1:(n.add(i.name),!0))}export function createCodexCommandSurface(t={}){const n=t.skills??M;return{harness:"codex",inputModes:[{kind:"slash",sigil:"/",named:!0}],async list({projectPath:i,homedir:e=S()}){const s=process.env.CODEX_HOME??r.join(e,".codex");return E([...k,...await j(r.join(s,"prompts")),...await n(i)??await L(r.join(s,"skills"))])},executions:()=>Promise.resolve(null)}}export const CODEX_COMMANDS=createCodexCommandSurface();
@@ -7,7 +7,7 @@ import type { FileAssetCategory } from './shared/file-specs.js';
7
7
  * 依赖硬约束:本包仅依赖 @weavecode/core(永不依赖 server/cli,防 statusline/i18n 成环)。
8
8
  */
9
9
  /** 可插拔能力槽——driver 声明持有哪些,注册表按能力检索。 */
10
- export type HarnessCapability = 'init' | 'events' | 'assets' | 'resume' | 'detect' | 'plugins' | 'pluginState' | 'messaging' | 'questions' | 'capture' | 'statusline' | 'logs' | 'config' | 'edits' | 'images' | 'narration' | 'commands' | 'provision' | 'liveness';
10
+ export type HarnessCapability = 'init' | 'events' | 'assets' | 'resume' | 'detect' | 'plugins' | 'pluginState' | 'messaging' | 'questions' | 'capture' | 'statusline' | 'logs' | 'config' | 'edits' | 'images' | 'narration' | 'commands' | 'provision' | 'liveness' | 'rewind';
11
11
  /**
12
12
  * 采集集成的 user 档状态(tool-object-model §2.6 基石)。
13
13
  */
@@ -1000,6 +1000,22 @@ export interface HarnessCommand {
1000
1000
  /** 触发符:缺省 `/`;codex 的 skill 是 `$name`。前端按它展示与插胶囊。 */
1001
1001
  sigil?: '/' | '$';
1002
1002
  }
1003
+ /**
1004
+ * 输入框里的一种「命令形态」:宿主自己执行、**不当作一条 prompt 提交**的敲法。
1005
+ * 触发符归 harness(claude = `/` 斜杠命令与 `!` bash 模式,codex = `/` 命令),
1006
+ * 投递闸据此走命令的短回执窗口(这类输入多半不发 prompt 提交事件),前端据此
1007
+ * 给输入框上色(颜色是渲染层的事,这里只答形态)。
1008
+ */
1009
+ export interface CommandInputMode {
1010
+ /** 形态。`bash` = 宿主本地 shell 模式(claude 输入框在此时变品红)。 */
1011
+ readonly kind: 'slash' | 'bash';
1012
+ /** 触发符:trim 后以此开头即该形态。 */
1013
+ readonly sigil: string;
1014
+ /** 触发符后必须紧跟命令名(`/name`)才算;bash 模式是整行命令行,不要求。 */
1015
+ readonly named: boolean;
1016
+ }
1017
+ /** 这段输入命中哪种命令形态(触发符表归 harness);null = 普通 prompt。 */
1018
+ export declare function commandModeAt(text: string, modes: readonly CommandInputMode[]): CommandInputMode | null;
1003
1019
  /** 转录里的一条命令执行记录(内建命令不发 hook 事件,只有转录记着)。 */
1004
1020
  export interface CommandExecution {
1005
1021
  name: string;
@@ -1015,6 +1031,8 @@ export interface CommandExecution {
1015
1031
  */
1016
1032
  export interface CommandsSurface {
1017
1033
  readonly harness: Harness;
1034
+ /** 输入框的命令形态表(触发符 + 形态);空表 = 该 harness 没有命令形态。 */
1035
+ readonly inputModes: readonly CommandInputMode[];
1018
1036
  /** 该会话此刻可用的命令(项目级命令按项目路径现扫;`homedir` 缺省 = 本机家目录)。 */
1019
1037
  list(req: {
1020
1038
  projectPath: string;
@@ -1056,6 +1074,35 @@ export interface LivenessSurface {
1056
1074
  */
1057
1075
  alive(ids?: readonly string[]): Promise<Map<string, boolean>>;
1058
1076
  }
1077
+ /** 一次对话回退(宿主 rewind):何时发生的、退回到了哪里之前。 */
1078
+ export interface RewindMark {
1079
+ /**
1080
+ * 回退发生的时刻(ISO)。claude 的锚点行自身不带 timestamp,取锚点行之前
1081
+ * 最近一条带 timestamp 转录行的时刻——rewind 只能发生在最后活动之后。
1082
+ */
1083
+ at: string;
1084
+ /**
1085
+ * 回退边界(退回到哪条消息之前)的时刻;宿主锚点只给 uuid 不给时刻,
1086
+ * server 按事件时刻近似——这里恒 null(不猜)。
1087
+ */
1088
+ boundaryAt: string | null;
1089
+ }
1090
+ /**
1091
+ * 对话回退面:宿主的 rewind(claude = Esc Esc / `/rewind`,退回代码与/或对话)
1092
+ * 在转录里留下的痕迹归 harness 解析,server 只把「哪些气泡被回退了」交给前端
1093
+ * 置灰展示。缺这个槽 = 该 harness 的回退不可观测(前端不摆「已回退」标记)。
1094
+ */
1095
+ export interface RewindSurface {
1096
+ /**
1097
+ * 该会话的全部回退(时间序);读不到(无转录 / 路径未知 / 半路出错)→
1098
+ * null(不猜)。没有回退 = 空数组。
1099
+ */
1100
+ sessionRewinds(req: {
1101
+ sessionId: string;
1102
+ /** 转录路径(server 的探针答,宿主不自己拼目录);null = 不知道在哪。 */
1103
+ transcriptPath: string | null;
1104
+ }): Promise<RewindMark[] | null>;
1105
+ }
1059
1106
  /**
1060
1107
  * 会话标题读写面:宿主侧**用户自定义名**(codex = thread name,落 session_index
1061
1108
  * 与 sqlite threads.name)的读/写通道。读 = 宿主持久层 diff 采纳(TUI 改名反显
@@ -1093,6 +1140,7 @@ export interface HarnessDriver {
1093
1140
  commands?: CommandsSurface;
1094
1141
  provision?: ProvisionSurface;
1095
1142
  liveness?: LivenessSurface;
1143
+ rewind?: RewindSurface;
1096
1144
  /** 不入 capabilities 清单——无 web 面,消费点仅 server 两处(dispatcher diff 采纳 / PATCH rename RPC)。 */
1097
1145
  titles?: SessionTitleSurface;
1098
1146
  }
@@ -1 +1 @@
1
- export class HarnessRegistry{drivers=new Map;register(r){if(this.drivers.has(r.id))throw new Error(`harness driver already registered: ${r.id}`);this.drivers.set(r.id,r);let i=!1;return()=>{i||(i=!0,this.drivers.get(r.id)===r&&this.drivers.delete(r.id))}}get(r){return this.drivers.get(r)}all(){return[...this.drivers.values()]}byCapability(r){return this.all().filter(i=>i.capabilities.includes(r))}initFor(r){return this.drivers.get(r)?.init}unregister(r){return this.drivers.delete(r)}}export function supports(e,r){return e.capabilities.includes(r)}
1
+ export function commandModeAt(i,r){const t=i.trim();for(const e of r)if(t.startsWith(e.sigil)&&!(e.named&&!/^[A-Za-z][A-Za-z0-9:_-]*(\s|$)/.test(t.slice(e.sigil.length))))return e;return null}export class HarnessRegistry{drivers=new Map;register(r){if(this.drivers.has(r.id))throw new Error(`harness driver already registered: ${r.id}`);this.drivers.set(r.id,r);let t=!1;return()=>{t||(t=!0,this.drivers.get(r.id)===r&&this.drivers.delete(r.id))}}get(r){return this.drivers.get(r)}all(){return[...this.drivers.values()]}byCapability(r){return this.all().filter(t=>t.capabilities.includes(r))}initFor(r){return this.drivers.get(r)?.init}unregister(r){return this.drivers.delete(r)}}export function supports(i,r){return i.capabilities.includes(r)}
@@ -1 +1 @@
1
- import c from"node:path";import{readZcodeMcp as l,removeZcodeMcp as n,upsertZcodeMcp as d,zcodeMcpFile as r}from"./mcp.js";const p=o=>c.join(o,".zcode","cli","config.json");export const ZCODE_ASSETS={harness:"zcode",targetDir(o){throw new Error(`"${o}" has no ZCode file-asset surface`)},projectSkillsDir:()=>".zcode/skills",globalSkillsRoots:o=>[c.join(o,...".zcode/skills".split("/")),c.join(o,...".agents/skills".split("/"))],userConfigFile:o=>p(o),mcpScopes:()=>["project","user"],mcpDest:(o,s)=>o==="project"?".zcode/config.json":c.join(s,...".zcode/cli/config.json".split("/")),mcpRead:(o,s,e)=>l(r(o,s,e)),mcpWrite:(o,s,e,i,t)=>d(r(o,s,e),i,t),mcpRemove:(o,s,e,i)=>n(r(o,s,e),i),classify(o){return o===".zcode"||o.startsWith(".zcode/")?!0:o.slice(o.lastIndexOf("/")+1)==="AGENTS.md"},ignore(o){return!(o===".zcode"||o.startsWith(".zcode/")||o==="AGENTS.md")}};
1
+ import c from"node:path";import{readZcodeMcp as l,removeZcodeMcp as n,upsertZcodeMcp as d,zcodeMcpFile as r}from"./mcp.js";const p=e=>c.join(e,".zcode","cli","config.json");export const ZCODE_ASSETS={harness:"zcode",targetDir(e){throw new Error(`"${e}" has no ZCode file-asset surface`)},projectSkillsDir:()=>".zcode/skills",globalSkillsRoots:e=>[c.join(e,...".zcode/skills".split("/")),c.join(e,...".agents/skills".split("/"))],userConfigFile:e=>p(e),mcpScopes:()=>["project","user"],mcpDest:(e,s)=>e==="project"?".zcode/config.json":c.join(s,...".zcode/cli/config.json".split("/")),mcpRead:(e,s,o)=>l(r(e,s,o)),mcpWrite:(e,s,o,i,t)=>d(r(e,s,o),i,t),mcpRemove:(e,s,o,i)=>n(r(e,s,o),i),classify(e){return e===".zcode"||e.startsWith(".zcode/")?!0:e.slice(e.lastIndexOf("/")+1)==="AGENTS.md"},ignore(e){return!(e===".zcode"||e.startsWith(".zcode/")||e==="AGENTS.md")}};
@@ -1,3 +1,3 @@
1
- import{access as k,mkdir as y,readFile as l,unlink as A,writeFile as f}from"node:fs/promises";import{homedir as i}from"node:os";import c from"node:path";import{detectPlatform as S,HARNESS_EVENTS as b}from"@weavecode/core";import{generateHookHandler as j}from"../claude/capture.js";export const zcodeConfigFile=e=>c.join(e,".zcode","cli","config.json");export function zcodeHookScript(e=S().configDir){return c.join(e,"weave","hooks","zcode","hook-handler.cjs")}const w="@version weave@",g="weave/hooks/zcode/hook-handler.cjs";function a(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function p(e){return e.replace(/\\/g,"/")}async function x(e){try{return await k(e),!0}catch{return!1}}async function d(e){let r;try{r=await l(e,"utf-8")}catch{return{}}let t;try{t=JSON.parse(r)}catch{throw new Error(`user config is not parseable JSON: ${e}`)}if(!a(t))throw new Error(`user config is not a JSON object: ${e}`);return t}export function groupIsWeave(e){if(!a(e))return!1;const r=e.hooks;return Array.isArray(r)?r.some(t=>{if(!a(t))return!1;const o=Array.isArray(t.args)?t.args.map(n=>p(String(n))):[];return(typeof t.command=="string"?p(t.command):"").includes(g)||o.some(n=>n.includes(g))}):!1}export function captureHookGroup(e){return[{hooks:[{type:"process",command:"node",args:[p(e)]}]}]}function v(e){if(!a(e))return{};const r={};for(const[t,o]of Object.entries(e)){if(!Array.isArray(o)){r[t]=o;continue}const n=o.filter(s=>!groupIsWeave(s));n.length>0&&(r[t]=n)}return r}function C(e){if(!a(e))return!1;const r=e.hooks;if(!a(r))return!1;const t=r.events;return a(t)?Object.values(t).some(o=>Array.isArray(o)&&o.some(groupIsWeave)):!1}export async function readUserCapture(e={}){const r=e.home??i(),t=await d(zcodeConfigFile(r)).catch(()=>({}));return{installed:C(t),helperPresent:await x(zcodeHookScript(e.configDir))}}export async function readScriptHealth(e={}){const r=e.home??i(),t=(await readUserCapture({home:r,configDir:e.configDir})).installed,o=zcodeHookScript(e.configDir);let n=null;try{n=await l(o,"utf-8")}catch{n=null}return{source:t?"user":"none",present:n!==null,weaveOwned:n!==null&&n.includes(w),generatedVersion:n?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:!1,reportsPaneEnv:n!==null&&n.includes("terminalEnv()")}}export async function installUserCapture(e){const r=e.home??i(),t=zcodeHookScript(e.configDir);await y(c.dirname(t),{recursive:!0}),await f(t,j(e.version,"zcode"),"utf-8");const o=zcodeConfigFile(r),n=await d(o),s=a(n.hooks)?n.hooks:{};typeof s.enabled!="boolean"&&(s.enabled=!0),typeof s.timeoutMs!="number"&&(s.timeoutMs=5e3);const u=v(s.events);for(const h of b.zcode){const m=u[h];u[h]=Array.isArray(m)?[...m,...captureHookGroup(t)]:captureHookGroup(t)}s.events=u,n.hooks=s,await y(c.dirname(o),{recursive:!0}),await f(o,JSON.stringify(n,null,2)+`
2
- `,"utf-8")}export async function uninstallUserCapture(e={}){const r=e.home??i(),t=zcodeConfigFile(r);try{const o=await d(t),n=o.hooks;if(a(n)){const s=v(n.events);Object.keys(s).length>0?n.events=s:delete n.events,o.hooks=n,await f(t,JSON.stringify(o,null,2)+`
3
- `,"utf-8")}}catch{}try{const o=zcodeHookScript(e.configDir);(await l(o,"utf-8")).includes(w)&&await A(o)}catch{}}export const ZCODE_CAPTURE={harness:"zcode",readUserCapture:e=>readUserCapture(e),installUserCapture:e=>installUserCapture(e),uninstallUserCapture:e=>uninstallUserCapture(e),stripProjectCapture:async()=>{},scriptHealth:e=>readScriptHealth(e)};
1
+ import{access as k,mkdir as y,readFile as l,unlink as A,writeFile as f}from"node:fs/promises";import{homedir as i}from"node:os";import c from"node:path";import{detectPlatform as S,HARNESS_EVENTS as b}from"@weavecode/core";import{generateHookHandler as j}from"../claude/capture.js";export const zcodeConfigFile=r=>c.join(r,".zcode","cli","config.json");export function zcodeHookScript(r=S().configDir){return c.join(r,"weave","hooks","zcode","hook-handler.cjs")}const w="@version weave@",g="weave/hooks/zcode/hook-handler.cjs";function a(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function p(r){return r.replace(/\\/g,"/")}async function x(r){try{return await k(r),!0}catch{return!1}}async function d(r){let o;try{o=await l(r,"utf-8")}catch{return{}}let t;try{t=JSON.parse(o)}catch{throw new Error(`user config is not parseable JSON: ${r}`)}if(!a(t))throw new Error(`user config is not a JSON object: ${r}`);return t}export function groupIsWeave(r){if(!a(r))return!1;const o=r.hooks;return Array.isArray(o)?o.some(t=>{if(!a(t))return!1;const n=Array.isArray(t.args)?t.args.map(e=>p(String(e))):[];return(typeof t.command=="string"?p(t.command):"").includes(g)||n.some(e=>e.includes(g))}):!1}export function captureHookGroup(r){return[{hooks:[{type:"process",command:"node",args:[p(r)]}]}]}function v(r){if(!a(r))return{};const o={};for(const[t,n]of Object.entries(r)){if(!Array.isArray(n)){o[t]=n;continue}const e=n.filter(s=>!groupIsWeave(s));e.length>0&&(o[t]=e)}return o}function C(r){if(!a(r))return!1;const o=r.hooks;if(!a(o))return!1;const t=o.events;return a(t)?Object.values(t).some(n=>Array.isArray(n)&&n.some(groupIsWeave)):!1}export async function readUserCapture(r={}){const o=r.home??i(),t=await d(zcodeConfigFile(o)).catch(()=>({}));return{installed:C(t),helperPresent:await x(zcodeHookScript(r.configDir))}}export async function readScriptHealth(r={}){const o=r.home??i(),t=(await readUserCapture({home:o,configDir:r.configDir})).installed,n=zcodeHookScript(r.configDir);let e=null;try{e=await l(n,"utf-8")}catch{e=null}return{source:t?"user":"none",present:e!==null,weaveOwned:e!==null&&e.includes(w),generatedVersion:e?.match(/@version weave@(\S+)/)?.[1]??null,reportsInbox:!1,reportsPaneEnv:e!==null&&e.includes("terminalEnv()")}}export async function installUserCapture(r){const o=r.home??i(),t=zcodeHookScript(r.configDir);await y(c.dirname(t),{recursive:!0}),await f(t,j(r.version,"zcode"),"utf-8");const n=zcodeConfigFile(o),e=await d(n),s=a(e.hooks)?e.hooks:{};typeof s.enabled!="boolean"&&(s.enabled=!0),typeof s.timeoutMs!="number"&&(s.timeoutMs=5e3);const u=v(s.events);for(const h of b.zcode){const m=u[h];u[h]=Array.isArray(m)?[...m,...captureHookGroup(t)]:captureHookGroup(t)}s.events=u,e.hooks=s,await y(c.dirname(n),{recursive:!0}),await f(n,JSON.stringify(e,null,2)+`
2
+ `,"utf-8")}export async function uninstallUserCapture(r={}){const o=r.home??i(),t=zcodeConfigFile(o);try{const n=await d(t),e=n.hooks;if(a(e)){const s=v(e.events);Object.keys(s).length>0?e.events=s:delete e.events,n.hooks=e,await f(t,JSON.stringify(n,null,2)+`
3
+ `,"utf-8")}}catch{}try{const n=zcodeHookScript(r.configDir);(await l(n,"utf-8")).includes(w)&&await A(n)}catch{}}export const ZCODE_CAPTURE={harness:"zcode",readUserCapture:r=>readUserCapture(r),installUserCapture:r=>installUserCapture(r),uninstallUserCapture:r=>uninstallUserCapture(r),stripProjectCapture:async()=>{},scriptHealth:r=>readScriptHealth(r)};
@@ -1,2 +1,2 @@
1
- import{mkdir as m,readFile as p,writeFile as d}from"node:fs/promises";import a from"node:path";function i(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}async function s(r){let e;try{e=await p(r,"utf-8")}catch{return{}}let t;try{t=JSON.parse(e)}catch(n){throw new Error(`${r} is not valid JSON \u2014 refusing to write: ${n instanceof Error?n.message:String(n)}`)}if(!i(t))throw new Error(`${r} is not a JSON object \u2014 refusing to write`);return t}async function f(r,e){await m(a.dirname(r),{recursive:!0}),await d(r,`${JSON.stringify(e,null,2)}
2
- `,"utf-8")}function u(r){const e=r.mcp;return i(e)&&i(e.servers)?e.servers:{}}export async function readZcodeMcp(r){const e=u(await s(r)),t={};for(const[n,o]of Object.entries(e)){if(!i(o)||typeof o.command!="string")continue;const c={command:o.command};Array.isArray(o.args)&&(c.args=o.args),i(o.env)&&(c.env=o.env),t[n]=c}return t}export async function upsertZcodeMcp(r,e,t){const n=await s(r),o=i(n.mcp)?n.mcp:{},c={type:"stdio",command:t.command};t.args&&(c.args=t.args),t.env&&(c.env=t.env),o.servers={...u(n),[e]:c},n.mcp=o,await f(r,n)}export async function removeZcodeMcp(r,e){const t=await s(r),n=u(t);if(!(e in n))return!1;delete n[e];const o=i(t.mcp)?t.mcp:{};return o.servers=n,t.mcp=o,await f(r,t),!0}export function zcodeMcpFile(r,e,t){return r==="project"?a.join(e,".zcode","config.json"):a.join(t,".zcode","cli","config.json")}
1
+ import{mkdir as m,readFile as p,writeFile as d}from"node:fs/promises";import a from"node:path";function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}async function s(n){let e;try{e=await p(n,"utf-8")}catch{return{}}let r;try{r=JSON.parse(e)}catch(t){throw new Error(`${n} is not valid JSON \u2014 refusing to write: ${t instanceof Error?t.message:String(t)}`)}if(!i(r))throw new Error(`${n} is not a JSON object \u2014 refusing to write`);return r}async function f(n,e){await m(a.dirname(n),{recursive:!0}),await d(n,`${JSON.stringify(e,null,2)}
2
+ `,"utf-8")}function u(n){const e=n.mcp;return i(e)&&i(e.servers)?e.servers:{}}export async function readZcodeMcp(n){const e=u(await s(n)),r={};for(const[t,o]of Object.entries(e)){if(!i(o)||typeof o.command!="string")continue;const c={command:o.command};Array.isArray(o.args)&&(c.args=o.args),i(o.env)&&(c.env=o.env),r[t]=c}return r}export async function upsertZcodeMcp(n,e,r){const t=await s(n),o=i(t.mcp)?t.mcp:{},c={type:"stdio",command:r.command};r.args&&(c.args=r.args),r.env&&(c.env=r.env),o.servers={...u(t),[e]:c},t.mcp=o,await f(n,t)}export async function removeZcodeMcp(n,e){const r=await s(n),t=u(r);if(!(e in t))return!1;delete t[e];const o=i(r.mcp)?r.mcp:{};return o.servers=t,r.mcp=o,await f(n,r),!0}export function zcodeMcpFile(n,e,r){return n==="project"?a.join(e,".zcode","config.json"):a.join(r,".zcode","cli","config.json")}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/harness",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Pluggable harness drivers — registry, init pipeline template method, and harness integration modules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "node": ">=22.5.0"
21
21
  },
22
22
  "dependencies": {
23
- "@weavecode/core": "^0.1.5",
23
+ "@weavecode/core": "^0.1.6",
24
24
  "smol-toml": "^1.3.0"
25
25
  }
26
26
  }
@@ -1 +1 @@
1
- function i(n){return n==="__proto__"||n==="constructor"||n==="prototype"}function f(n){const e=n.split(".");if(e.some(t=>!t||i(t)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${n}`);return e}function c(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const u=Symbol("absent");function s(n,e){let t=n;for(const o of e){if(!c(t))return u;t=t[o]}return t===void 0?u:t}function l(n,e){let t=n;for(const o of e.slice(0,-1)){const r=t[o];if(!c(r))return;t=r}delete t[e[e.length-1]]}function p(n,e,t){let o=n;for(const r of e.slice(0,-1))c(o[r])||(o[r]={}),o=o[r];o[e[e.length-1]]=t}export function getDotted(n,e){const t=s(n,f(e));return t===u?void 0:t}export function applyUpdates(n,e){const t=structuredClone(n);for(const o of e){const r=f(o.path);o.remove?l(t,r):p(t,r,o.value)}return t}
1
+ function s(o){return o==="__proto__"||o==="constructor"||o==="prototype"}function f(o){const r=o.split(".");if(r.some(t=>!t||s(t)))throw new Error(`\u975E\u6CD5\u914D\u7F6E\u952E\uFF1A${o}`);return r}function u(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}const c=Symbol("absent");function i(o,r){let t=o;for(const n of r){if(!u(t))return c;t=t[n]}return t===void 0?c:t}function l(o,r){let t=o;for(const n of r.slice(0,-1)){const e=t[n];if(!u(e))return;t=e}delete t[r[r.length-1]]}function p(o,r,t){let n=o;for(const e of r.slice(0,-1))u(n[e])||(n[e]={}),n=n[e];n[r[r.length-1]]=t}export function getDotted(o,r){const t=i(o,f(r));return t===c?void 0:t}export function applyUpdates(o,r){const t=structuredClone(o);for(const n of r){const e=f(n.path);n.remove?l(t,e):p(t,e,n.value)}return t}