@weavecode/weave 0.1.0 → 0.1.1

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 (273) hide show
  1. package/node_modules/@weavecode/cli/dist/cli.js +4 -4
  2. package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
  3. package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
  4. package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
  5. package/node_modules/@weavecode/cli/dist/commands/dashboard.d.ts +0 -2
  6. package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -1
  7. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  8. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  9. package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
  10. package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
  11. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  12. package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
  13. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +5 -3
  14. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +44 -1
  15. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +6 -4
  16. package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
  17. package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
  18. package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +4 -4
  19. package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
  20. package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
  21. package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
  22. package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
  23. package/node_modules/@weavecode/cli/dist/init/helpers-gen.d.ts +4 -0
  24. package/node_modules/@weavecode/cli/dist/init/helpers-gen.js +1 -20
  25. package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
  26. package/node_modules/@weavecode/cli/dist/init/mcp-gen.d.ts +3 -20
  27. package/node_modules/@weavecode/cli/dist/init/mcp-gen.js +1 -1
  28. package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
  29. package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
  30. package/node_modules/@weavecode/cli/dist/init/settings-gen.d.ts +3 -30
  31. package/node_modules/@weavecode/cli/dist/init/settings-gen.js +1 -1
  32. package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
  33. package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
  34. package/node_modules/@weavecode/cli/dist/parser.js +1 -1
  35. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  36. package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
  37. package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
  38. package/node_modules/@weavecode/cli/package.json +5 -5
  39. package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
  40. package/node_modules/@weavecode/core/dist/harness.d.ts +45 -2
  41. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  42. package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
  43. package/node_modules/@weavecode/core/dist/index.js +1 -1
  44. package/node_modules/@weavecode/core/dist/platform.js +1 -1
  45. package/node_modules/@weavecode/core/dist/terminal.d.ts +28 -4
  46. package/node_modules/@weavecode/core/dist/terminal.js +1 -1
  47. package/node_modules/@weavecode/core/dist/types.d.ts +188 -11
  48. package/node_modules/@weavecode/core/dist/types.js +1 -1
  49. package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
  50. package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
  51. package/node_modules/@weavecode/core/package.json +1 -1
  52. package/node_modules/@weavecode/harness/dist/claude/assets.js +1 -1
  53. package/node_modules/@weavecode/harness/dist/claude/capture.d.ts +11 -1
  54. package/node_modules/@weavecode/harness/dist/claude/capture.js +5 -5
  55. package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
  56. package/node_modules/@weavecode/harness/dist/claude/event-source.d.ts +1 -1
  57. package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
  58. package/node_modules/@weavecode/harness/dist/claude/helpers-gen.d.ts +5 -0
  59. package/node_modules/@weavecode/harness/dist/claude/helpers-gen.js +20 -0
  60. package/node_modules/@weavecode/harness/dist/claude/index.d.ts +5 -1
  61. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  62. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.d.ts +22 -0
  63. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -0
  64. package/node_modules/@weavecode/harness/dist/claude/messaging.d.ts +11 -2
  65. package/node_modules/@weavecode/harness/dist/claude/messaging.js +4 -1
  66. package/node_modules/@weavecode/harness/dist/claude/model-aliases.d.ts +25 -0
  67. package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -0
  68. package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
  69. package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
  70. package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
  71. package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
  72. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -1
  73. package/node_modules/@weavecode/harness/dist/claude/settings-gen.d.ts +32 -0
  74. package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -0
  75. package/node_modules/@weavecode/harness/dist/claude/transcript.d.ts +16 -0
  76. package/node_modules/@weavecode/harness/dist/claude/transcript.js +4 -2
  77. package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
  78. package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
  79. package/node_modules/@weavecode/harness/dist/codex/messaging.js +1 -1
  80. package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
  81. package/node_modules/@weavecode/harness/dist/codex/toml.js +9 -9
  82. package/node_modules/@weavecode/harness/dist/driver.d.ts +58 -1
  83. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  84. package/node_modules/@weavecode/harness/dist/index.d.ts +1 -0
  85. package/node_modules/@weavecode/harness/dist/index.js +1 -1
  86. package/node_modules/@weavecode/harness/dist/init/generated.d.ts +37 -0
  87. package/node_modules/@weavecode/harness/dist/init/generated.js +2 -0
  88. package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
  89. package/node_modules/@weavecode/harness/dist/registry-wiring.d.ts +3 -1
  90. package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
  91. package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
  92. package/node_modules/@weavecode/harness/package.json +2 -2
  93. package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
  94. package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
  95. package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
  96. package/node_modules/@weavecode/server/dist/daemon/api-log.d.ts +48 -0
  97. package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -0
  98. package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
  99. package/node_modules/@weavecode/server/dist/daemon/auto-start.js +6 -6
  100. package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
  101. package/node_modules/@weavecode/server/dist/daemon/claude-liveness.js +1 -1
  102. package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
  103. package/node_modules/@weavecode/server/dist/daemon/data-bus.js +1 -1
  104. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  105. package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
  106. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.d.ts +6 -1
  107. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
  108. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  109. package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
  110. package/node_modules/@weavecode/server/dist/daemon/opener.d.ts +102 -19
  111. package/node_modules/@weavecode/server/dist/daemon/opener.js +97 -7
  112. package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
  113. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
  114. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.d.ts +4 -3
  115. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
  116. package/node_modules/@weavecode/server/dist/daemon/server.d.ts +8 -0
  117. package/node_modules/@weavecode/server/dist/daemon/server.js +6 -6
  118. package/node_modules/@weavecode/server/dist/daemon/session-probe.d.ts +59 -2
  119. package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
  120. package/node_modules/@weavecode/server/dist/daemon/settings.d.ts +10 -0
  121. package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
  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.d.ts +4 -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/db/db.js +20 -2
  129. package/node_modules/@weavecode/server/dist/db/paths.d.ts +4 -0
  130. package/node_modules/@weavecode/server/dist/db/paths.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.js +1 -1
  133. package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
  134. package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
  135. package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
  136. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.d.ts +17 -4
  137. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -1
  138. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.d.ts +20 -6
  139. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
  140. package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
  141. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.d.ts +171 -13
  142. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +3 -2
  143. package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
  144. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
  145. package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
  146. package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
  147. package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
  148. package/node_modules/@weavecode/server/dist/hooks/promptbox.d.ts +13 -0
  149. package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
  150. package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
  151. package/node_modules/@weavecode/server/dist/hooks/question-tracker.d.ts +6 -4
  152. package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
  153. package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
  154. package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
  155. package/node_modules/@weavecode/server/dist/hooks/sequence-engine.js +1 -1
  156. package/node_modules/@weavecode/server/dist/hooks/session-purge.d.ts +4 -0
  157. package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
  158. package/node_modules/@weavecode/server/dist/hooks/session-sweeper.d.ts +5 -8
  159. package/node_modules/@weavecode/server/dist/hooks/session-sweeper.js +1 -1
  160. package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
  161. package/node_modules/@weavecode/server/dist/hooks/toolkit.d.ts +8 -0
  162. package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
  163. package/node_modules/@weavecode/server/dist/hooks/watch-engine.d.ts +7 -0
  164. package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
  165. package/node_modules/@weavecode/server/dist/index.d.ts +1 -1
  166. package/node_modules/@weavecode/server/dist/install/apply-update.d.ts +1 -1
  167. package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
  168. package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
  169. package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
  170. package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
  171. package/node_modules/@weavecode/server/dist/install/fingerprint.d.ts +5 -1
  172. package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
  173. package/node_modules/@weavecode/server/dist/install/git-classify.d.ts +30 -0
  174. package/node_modules/@weavecode/server/dist/install/git-classify.js +1 -0
  175. package/node_modules/@weavecode/server/dist/install/global-config.js +2 -2
  176. package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
  177. package/node_modules/@weavecode/server/dist/install/init-files.d.ts +46 -0
  178. package/node_modules/@weavecode/server/dist/install/init-files.js +2 -0
  179. package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
  180. package/node_modules/@weavecode/server/dist/install/installer.js +3 -3
  181. package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
  182. package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
  183. package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
  184. package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
  185. package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
  186. package/node_modules/@weavecode/server/dist/install/project-config.d.ts +0 -2
  187. package/node_modules/@weavecode/server/dist/install/project-config.js +2 -2
  188. package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
  189. package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
  190. package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
  191. package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
  192. package/node_modules/@weavecode/server/dist/install/updates.d.ts +17 -5
  193. package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
  194. package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
  195. package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
  196. package/node_modules/@weavecode/server/dist/market/import.js +2 -2
  197. package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
  198. package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
  199. package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
  200. package/node_modules/@weavecode/server/dist/registry.js +2 -2
  201. package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +5 -5
  202. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +2 -2
  203. package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
  204. package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
  205. package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
  206. package/node_modules/@weavecode/server/dist/repositories/projects.d.ts +7 -0
  207. package/node_modules/@weavecode/server/dist/repositories/projects.js +2 -2
  208. package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
  209. package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
  210. package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +17 -4
  211. package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
  212. package/node_modules/@weavecode/server/dist/repositories/uploads.d.ts +66 -0
  213. package/node_modules/@weavecode/server/dist/repositories/uploads.js +7 -0
  214. package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
  215. package/node_modules/@weavecode/server/dist/statusline/generator.js +81 -40
  216. package/node_modules/@weavecode/server/dist/statusline/manager.d.ts +2 -0
  217. package/node_modules/@weavecode/server/dist/statusline/manager.js +4 -4
  218. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  219. package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
  220. package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
  221. package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
  222. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.d.ts +8 -4
  223. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
  224. package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
  225. package/node_modules/@weavecode/server/package.json +4 -4
  226. package/node_modules/@weavecode/server/web/dist/assets/index-D5WFh77i.css +11 -0
  227. package/node_modules/@weavecode/server/web/dist/assets/index-DJibaGnJ.js +585 -0
  228. package/node_modules/@weavecode/server/web/dist/index.html +14 -2
  229. package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-plugin-creator/skills/weave-plugin-creator/SKILL.md +2 -2
  230. package/node_modules/@weavecode/templates/package.json +2 -2
  231. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/asn1js/README.md +50 -32
  232. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/asn1js/build/index.d.ts +86 -40
  233. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/asn1js/build/index.es.js +860 -353
  234. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/asn1js/build/index.js +860 -353
  235. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/asn1js/package.json +20 -17
  236. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/node_modules/asn1js/README.md +50 -32
  237. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/node_modules/asn1js/build/index.d.ts +86 -40
  238. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/node_modules/asn1js/build/index.es.js +860 -353
  239. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/node_modules/asn1js/build/index.js +860 -353
  240. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/node_modules/asn1js/package.json +20 -17
  241. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/node_modules/asn1js/README.md +50 -32
  242. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/node_modules/asn1js/build/index.d.ts +86 -40
  243. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/node_modules/asn1js/build/index.es.js +860 -353
  244. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/node_modules/asn1js/build/index.js +860 -353
  245. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/node_modules/asn1js/package.json +20 -17
  246. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/asn1js/README.md +50 -32
  247. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/asn1js/build/index.d.ts +86 -40
  248. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/asn1js/build/index.es.js +860 -353
  249. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/asn1js/build/index.js +860 -353
  250. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/asn1js/package.json +20 -17
  251. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/node_modules/asn1js/README.md +50 -32
  252. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/node_modules/asn1js/build/index.d.ts +86 -40
  253. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/node_modules/asn1js/build/index.es.js +860 -353
  254. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/node_modules/asn1js/build/index.js +860 -353
  255. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/node_modules/asn1js/package.json +20 -17
  256. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/node_modules/asn1js/README.md +50 -32
  257. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/node_modules/asn1js/build/index.d.ts +86 -40
  258. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/node_modules/asn1js/build/index.es.js +860 -353
  259. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/node_modules/asn1js/build/index.js +860 -353
  260. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/node_modules/asn1js/package.json +20 -17
  261. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/node_modules/asn1js/README.md +50 -32
  262. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/node_modules/asn1js/build/index.d.ts +86 -40
  263. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/node_modules/asn1js/build/index.es.js +860 -353
  264. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/node_modules/asn1js/build/index.js +860 -353
  265. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/node_modules/asn1js/package.json +20 -17
  266. package/node_modules/selfsigned/node_modules/pkijs/node_modules/asn1js/README.md +50 -32
  267. package/node_modules/selfsigned/node_modules/pkijs/node_modules/asn1js/build/index.d.ts +86 -40
  268. package/node_modules/selfsigned/node_modules/pkijs/node_modules/asn1js/build/index.es.js +860 -353
  269. package/node_modules/selfsigned/node_modules/pkijs/node_modules/asn1js/build/index.js +860 -353
  270. package/node_modules/selfsigned/node_modules/pkijs/node_modules/asn1js/package.json +20 -17
  271. package/package.json +6 -6
  272. package/node_modules/@weavecode/server/web/dist/assets/index-BOzaRlQE.js +0 -560
  273. package/node_modules/@weavecode/server/web/dist/assets/index-ChX8G8cT.css +0 -11
@@ -0,0 +1,22 @@
1
+ import type { PlatformInfo } from '@weavecode/core';
2
+ export interface McpGeneratorInput {
3
+ platform: PlatformInfo;
4
+ /** Whether to include the weave MCP server entry */
5
+ includeWeaveServer: boolean;
6
+ }
7
+ export declare function generateMcpJson(input: McpGeneratorInput): Record<string, unknown>;
8
+ /**
9
+ * Merge weave's generated servers into an existing user .mcp.json.
10
+ *
11
+ * Policy (weave init never overwrites user files):
12
+ * - user-authored server entries and unknown top-level keys are preserved
13
+ * - missing weave entries are appended
14
+ * - the `weave` server entry is weave's own config key: when present it is
15
+ * refreshed to the current generated value
16
+ */
17
+ export declare function mergeMcpJson(existing: Record<string, unknown>, generated: Record<string, unknown>): Record<string, unknown>;
18
+ /**
19
+ * uninstall 用的剥除:删 `weave` 服务键(weave 自己的配置键);mcpServers 清空
20
+ * 删键;顶层清空返回空对象,调用方据此删文件。用户自己的服务键不动。
21
+ */
22
+ export declare function stripWeaveMcp(existing: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export function generateMcpJson(e){const r={};if(e.includeWeaveServer){const s=e.platform.os==="windows"?"cmd":"npx",c=e.platform.os==="windows"?["/c","npx","weave","mcp","start"]:["weave","mcp","start"];r.weave={command:s,args:c,env:{WEAVE_MCP:"true"}}}return{mcpServers:r}}export function mergeMcpJson(e,r){const s={...e},c=o(r.mcpServers)?r.mcpServers:{},n=o(s.mcpServers)?{...s.mcpServers}:{};for(const[t,p]of Object.entries(c))(t==="weave"||n[t]===void 0)&&(n[t]=p);return s.mcpServers=n,s}function o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export function stripWeaveMcp(e){const r={...e};if(o(r.mcpServers)){const s={...r.mcpServers};delete s.weave,Object.keys(s).length>0?r.mcpServers=s:delete r.mcpServers}return r}
@@ -1,10 +1,19 @@
1
- import type { MessagingSurface } from '../driver.js';
1
+ import type { ImageAttachSpec, MessagingSurface } from '../driver.js';
2
+ /**
3
+ * Claude 图片对齐面:**裸绝对路径、不加任何说明**——用户自己往输入框粘贴一条图片
4
+ * 路径时它就是这么认的(粘贴处理器按 `\.(png|jpe?g|gif|webp)$` 切出路径 → 读文件 →
5
+ * 输入框变 `[Image #N]` + 消息里出真 image block)。路径放**独立一行**:粘贴处理器
6
+ * 先按空格切路径边界、再按换行切行,行首的路径照样命中;落在原文后面则原文被原样
7
+ * 留在输入框、图单独挂上。
8
+ */
9
+ export declare const CLAUDE_IMAGE_ATTACH: ImageAttachSpec;
2
10
  /**
3
11
  * Claude 消息能力面(完整参考实现):四通道全支持——
4
12
  * - prompt:原生 peer 消息经受限中继(SendMessage,寻址 = peer 注册表);
5
13
  * - promptInbox:会话本地 inbox socket 直投(毫秒级、零进程零 LLM);
6
14
  * - inject:outbox → 会话下一拍 hook 事件随 additionalContext 进会话(非抢占);
7
15
  * - headless:resume 槽规格**对象直接引用**(单源,不复制);
8
- * - watch:空闲信号取值源自 HARNESS_LIFECYCLE(close + 会话级终点),不手抄。
16
+ * - watch:空闲信号取值源自 HARNESS_LIFECYCLE(close + 会话级终点),不手抄;
17
+ * - imageAttach:图片按 claude 自己的「粘贴路径」文法对齐(见上)。
9
18
  */
10
19
  export declare const CLAUDE_MESSAGING: MessagingSurface;
@@ -1 +1,4 @@
1
- import{HARNESS_LIFECYCLE as E,INJECTABLE_EVENTS as o}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as s}from"./prompt-inbox.js";import{CLAUDE_PROMPT_RELAY as e}from"./prompt.js";import{CLAUDE_RESUME as r}from"./resume.js";export const CLAUDE_MESSAGING={harness:"claude",discovery:!0,prompt:e,promptInbox:s,inject:{rideEvents:o.claude},headless:r,idleSignals:[...E.claude.close,"SessionEnd"]};
1
+ import{HARNESS_LIFECYCLE as t,INJECTABLE_EVENTS as n}from"@weavecode/core";import{CLAUDE_PROMPT_INBOX as p}from"./prompt-inbox.js";import{CLAUDE_PROMPT_RELAY as s}from"./prompt.js";import{CLAUDE_RESUME as m}from"./resume.js";export const CLAUDE_IMAGE_ATTACH={composePrompt(o,E){const r=E.map(e=>e.path).join(`
2
+ `);return o?`${o}
3
+
4
+ ${r}`:r}},CLAUDE_MESSAGING={harness:"claude",discovery:!0,prompt:s,promptInbox:p,inject:{rideEvents:n.claude},headless:m,idleSignals:[...t.claude.close,"SessionEnd"],imageAttach:CLAUDE_IMAGE_ATTACH};
@@ -0,0 +1,25 @@
1
+ /** 别名 → 真名这一对(`/model` 收别名,跑起来的是真名)。 */
2
+ export interface ModelAliasTarget {
3
+ /** 稳定别名(claude 的 default/opus/sonnet/haiku/fable),`/model` 收的就是它。 */
4
+ alias: string;
5
+ /** 该别名此刻真跑的模型 ID;等于 alias = 没被换过名。 */
6
+ actual: string;
7
+ }
8
+ /**
9
+ * 别名 → 真名。网关把 claude 的稳定别名换成自家模型 ID(本机 opus→ftm、
10
+ * sonnet→deepseek-flash…),出处 = Claude Code 的 `ANTHROPIC_DEFAULT_<别名>_MODEL`
11
+ * 约定。daemon 是独立进程、未必带着宿主那套 env,故先读 settings.json 的 env 块、
12
+ * 进程 env 兜底;两处都没有就原样回落别名(`/model opus` 仍然认,只是看不出真名)。
13
+ */
14
+ export declare function modelAliasTargets(aliases: readonly string[], env?: NodeJS.ProcessEnv, homedir?: string): ModelAliasTarget[];
15
+ /**
16
+ * 换模型**落定**的那条事件里的真名(`PostModelSwitch.to_model`)。宿主答
17
+ * 「No, go back」不发事件,故收到这条 = 已经换了;比转录条目早一步——转录只在
18
+ * assistant 消息上照会模型,切完不跑一轮就什么都读不到。
19
+ */
20
+ export declare function switchedModelOf(eventType: string, raw: unknown): string | null;
21
+ /**
22
+ * 真名 → 别名:转录里照会的是真名(`custom_openai/ftm`),下拉得认成别名那档。
23
+ * 认不出返回 null,调用方回落显示真名——不猜。
24
+ */
25
+ export declare function aliasOfModel(targets: readonly ModelAliasTarget[], model: string | null): string | null;
@@ -0,0 +1 @@
1
+ import f from"node:fs";import u from"node:os";import{CLAUDE_ASSETS as c}from"./assets.js";export function modelAliasTargets(n,t=process.env,r=u.homedir()){const e=l(r);return n.map(o=>{const s=`ANTHROPIC_DEFAULT_${o.toUpperCase()}_MODEL`,i=e[s]??e[`${s}_NAME`]??t[s]??t[`${s}_NAME`]??o;return{alias:o,actual:i}})}export function switchedModelOf(n,t){if(n!=="PostModelSwitch")return null;const r=t?.to_model;return typeof r=="string"&&r?r:null}export function aliasOfModel(n,t){if(!t)return null;const r=t.slice(t.lastIndexOf("/")+1);return n.find(e=>e.actual===t||e.actual===r)?.alias??null}function l(n){let t=null;try{t=JSON.parse(f.readFileSync(c.userConfigFile(n),"utf8"))}catch{return{}}const r={};for(const[e,o]of Object.entries(t?.env??{}))typeof o=="string"&&(r[e]=o);return r}
@@ -1 +1 @@
1
- import{readdirSync as i,readFileSync as c}from"node:fs";import{homedir as m}from"node:os";import{join as s}from"node:path";export function resolveClaudePeer(a,r=s(m(),".claude","sessions")){let t;try{t=i(r)}catch{return null}for(const n of t){if(!/^\d+\.json$/.test(n))continue;let o;try{o=JSON.parse(c(s(r,n),"utf8"))}catch{continue}const e=o;if(e?.sessionId===a&&typeof e.name=="string"&&e.name)return{name:e.name}}return null}
1
+ import{readdirSync as a,readFileSync as c}from"node:fs";import{homedir as m}from"node:os";import{join as i}from"node:path";export function resolveClaudePeer(s,n=i(m(),".claude","sessions")){let r;try{r=a(n)}catch{return null}for(const t of r){if(!/^\d+\.json$/.test(t))continue;let o;try{o=JSON.parse(c(i(n,t),"utf8"))}catch{continue}const e=o;if(e?.sessionId===s&&typeof e.name=="string"&&e.name)return{name:e.name}}return null}
@@ -1,4 +1,4 @@
1
- import{spawn as _}from"node:child_process";import{homedir as P}from"node:os";import{cp as U,lstat as D,mkdir as O,readFile as M,readdir as H,writeFile as N}from"node:fs/promises";import s from"node:path";import{linkOrCopy as V,removeInstalled as q}from"../shared/install-link.js";import{CLAUDE_ASSETS as B}from"./assets.js";export const WEAVE_MARKETPLACE="weave";const R="weave-marketplace",W=6e4,T=2e3,G=64*1024;export function claudeCommandLine(o){return["claude",...o.map(p=>`"${p.replace(/"/g,'\\"')}"`)].join(" ")}function z(o){if(!(o.exitCode!==null||o.signalCode!==null)){if(process.platform==="win32"&&o.pid!==void 0){_("taskkill",["/pid",String(o.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}o.kill("SIGKILL")}}function S(o){return o.length>T?`${o.slice(0,T)}\u2026`:o}function J(o){try{const p=JSON.parse(o);return p&&typeof p=="object"&&!Array.isArray(p)?p:null}catch{return null}}const Q=(o,p)=>new Promise((b,h)=>{const $=process.platform==="win32",g=_($?process.env.ComSpec||"cmd.exe":"claude",$?["/d","/s","/c",claudeCommandLine(o)]:o,{windowsHide:!0,windowsVerbatimArguments:$,stdio:["ignore","pipe","pipe"]}),w=`claude ${o.join(" ")}`;let v="",m="",l=!1;const y=u=>{l||(l=!0,clearTimeout(j),h(new Error(S(u))))},j=setTimeout(()=>{z(g),y(`${w}: timed out after ${p.timeoutMs}ms`)},p.timeoutMs);g.stdout?.setEncoding("utf8"),g.stdout?.on("data",u=>{v.length<G&&(v+=u)}),g.stderr?.setEncoding("utf8"),g.stderr?.on("data",u=>{m.length<G&&(m+=u)}),g.on("error",u=>y(`${w}: ${u.message}`)),g.on("close",u=>{if(l)return;if(l=!0,clearTimeout(j),u===0){b({stdout:v,stderr:m});return}const A=[m,v].filter(Boolean).join(`
2
- `).trim()||`exit ${u}`;h(new Error(S(`${w}: ${A}`)))})});export function createClaudePluginSurface(o={}){const p=o.exec??Q,b=e=>p(e,{timeoutMs:W}),h=()=>B.userConfigFile(P()),$=()=>s.join(P(),".claude","plugins","installed_plugins.json"),g=()=>s.join(P(),".claude",R),w=e=>s.join(e,".claude","settings.json"),v=e=>s.join(e,".claude","settings.local.json"),m=(e,n)=>`${e}@${n??WEAVE_MARKETPLACE}`,l=async e=>{try{const n=JSON.parse(await M(e,"utf8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}},y=async(e,n)=>{await O(s.dirname(e),{recursive:!0}),await N(e,`${JSON.stringify(n,null,2)}
3
- `,"utf8")},j=e=>{const n=e.enabledPlugins;return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([,a])=>typeof a=="boolean"))},u=e=>{const n=e.enabledPlugins;return n&&typeof n=="object"&&!Array.isArray(n)?{...n}:{}},A=async()=>{const e=(await l($())).plugins;if(!e||typeof e!="object"||Array.isArray(e))return{};const n={};for(const[a,t]of Object.entries(e))Array.isArray(t)&&(n[a]=t);return n},x=(e,n,a)=>{const t=n?.[n.length-1];return{key:e,alreadyInstalled:a,...t?.scope?{scope:t.scope}:{},...t?.installPath?{installPath:t.installPath}:{},...t?.version?{version:t.version}:{}}},K=async(e,n,a={})=>{const t=g(),i=s.join(t,"plugins",n);await q(i),await O(s.dirname(i),{recursive:!0});const r=await M(s.join(e,".claude-plugin","plugin.json"),"utf8").then(()=>!0,()=>!1),d=await H(e).catch(()=>[]);if(r&&!d.includes("node_modules")&&!d.includes(".git"))await V(e,i);else if(await U(e,i,{recursive:!0,filter:k=>{const L=s.basename(k);return L!=="node_modules"&&L!==".git"}}),!r){const k=s.join(i,".claude-plugin","plugin.json");await O(s.dirname(k),{recursive:!0}),await N(k,JSON.stringify({name:n,version:a.version??"0.0.0",...a.description?{description:a.description}:{}},null,2)+`
4
- `,"utf8")}const f=s.join(t,".claude-plugin","marketplace.json"),c=await l(f),E=Array.isArray(c.plugins)?[...c.plugins]:[],I={name:n,source:`./plugins/${n}`},C=E.findIndex(k=>k?.name===n);return C>=0?E[C]=I:E.push(I),c.name=WEAVE_MARKETPLACE,c.owner||(c.owner={name:"weave"}),c.plugins=E,await y(f,c),t},F=async(e,n,a)=>{if(!e.dir)throw new Error(`marketplace dir required for ${n}@${e.name}`);if((await D(e.dir)).isSymbolicLink())return;const t=s.join(e.dir,".claude-plugin","marketplace.json"),i=await l(t),r=Array.isArray(i.plugins)?[...i.plugins]:[],d=`./${s.relative(e.dir,a).split(s.sep).join("/")}`,f={name:n,source:d},c=r.findIndex(E=>E?.name===n);c>=0?r[c]=f:r.push(f),i.name=e.name,i.owner||(i.owner={name:"weave"}),i.plugins=r,await y(t,i)};return{projectPluginDir:e=>s.join(e,".claude","plugins"),pluginKey:m,parsePluginKey(e){const n=e.lastIndexOf("@");return n>0?{name:e.slice(0,n),market:e.slice(n+1)}:{name:e,market:WEAVE_MARKETPLACE}},async globalInstall(e,n={}){let a=n.name;if(!a){const c=await l(s.join(e,".claude-plugin","plugin.json"));a=typeof c.name=="string"?c.name:void 0}if(!a)throw new Error(`plugin manifest missing name: ${e}`);const t=n.marketplace,i=m(a,t?.name),r=(await A())[i];if(r&&r.length>0)return x(i,r,!0);if(t)await F(t,a,e),await b(["plugin","marketplace","add",t.dir??""]);else{const c=await K(e,a,n);await b(["plugin","marketplace","add",c])}const{stdout:d}=await b(["plugin","install",i,"--scope","user","--json"]),f=J(d);if(f?.outcome==="failed")throw new Error(S(String(f.message??"plugin install failed")));return x(i,(await A())[i],!1)},readInstalled:A,async isInstalled(e,n){const a=(await A())[m(e,n)];return!!a&&a.length>0},async uninstall(e,n){const a=m(e,n),t=(await A())[a];if(!t||t.length===0)return;const i=[...new Set(t.map(r=>r.scope??"user"))];for(const r of i){const{stdout:d}=await b(["plugin","uninstall",a,"--scope",r,"--json"]),f=J(d);if(f?.outcome==="failed")throw new Error(S(String(f.message??"plugin uninstall failed")))}},async removeMarketplace(e){const n=await l(s.join(P(),".claude","plugins","known_marketplaces.json")),a=s.resolve(e),t=Object.entries(n).find(([,i])=>i&&typeof i=="object"&&typeof i.installLocation=="string"&&s.resolve(i.installLocation)===a)?.[0];t&&await b(["plugin","marketplace","remove",t])},async readProjectEnabled(e,n,a){return j(await l(w(e)))[m(n,a)]??!1},async setProjectEnabled(e,n,a,t){const i=w(e),r=await l(i);r.enabledPlugins={...u(r),[m(n,t)]:a},await y(i,r)},async readGlobalEnabled(){return j(await l(h()))},async writeGlobalEnabled(e,n){const a=h(),t=await l(a);t.enabledPlugins={...u(t),[e]:n},await y(a,t)},pluginScopes:()=>["user","project","local"],async readEnabledOverrides(e){const[n,a,t]=await Promise.all([l(h()).then(j),l(w(e)).then(j),l(v(e)).then(j)]);return{user:n,project:a,local:t}},async setEnabledOverride(e,n,a,t){const i=n==="user"?h():n==="project"?w(e):v(e),r=await l(i),d=u(r);t==="inherit"?delete d[a]:d[a]=t==="on",r.enabledPlugins=d,await y(i,r)}}}export const CLAUDE_PLUGINS=createClaudePluginSurface();
1
+ import{spawn as C}from"node:child_process";import{homedir as O}from"node:os";import{cp as R,lstat as H,mkdir as x,readFile as L,readdir as V,writeFile as F}from"node:fs/promises";import r from"node:path";import{linkOrCopy as q,removeInstalled as B}from"../shared/install-link.js";import{CLAUDE_ASSETS as W}from"./assets.js";export const WEAVE_MARKETPLACE="weave";const z="weave-marketplace",Q=6e4,U=2e3,J=64*1024;export function claudeCommandLine(o){return["claude",...o.map(d=>`"${d.replace(/"/g,'\\"')}"`)].join(" ")}function X(o){if(!(o.exitCode!==null||o.signalCode!==null)){if(process.platform==="win32"&&o.pid!==void 0){C("taskkill",["/pid",String(o.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}o.kill("SIGKILL")}}function $(o){return o.length>U?`${o.slice(0,U)}\u2026`:o}function K(o){try{const d=JSON.parse(o);return d&&typeof d=="object"&&!Array.isArray(d)?d:null}catch{return null}}const Y=(o,d)=>new Promise((E,A)=>{const v=process.platform==="win32",g=C(v?process.env.ComSpec||"cmd.exe":"claude",v?["/d","/s","/c",claudeCommandLine(o)]:o,{windowsHide:!0,windowsVerbatimArguments:v,stdio:["ignore","pipe","pipe"]}),y=`claude ${o.join(" ")}`;let k="",p="",l=!1;const j=c=>{l||(l=!0,clearTimeout(b),A(new Error($(c))))},b=setTimeout(()=>{X(g),j(`${y}: timed out after ${d.timeoutMs}ms`)},d.timeoutMs);g.stdout?.setEncoding("utf8"),g.stdout?.on("data",c=>{k.length<J&&(k+=c)}),g.stderr?.setEncoding("utf8"),g.stderr?.on("data",c=>{p.length<J&&(p+=c)}),g.on("error",c=>j(`${y}: ${c.message}`)),g.on("close",c=>{if(l)return;if(l=!0,clearTimeout(b),c===0){E({stdout:k,stderr:p});return}const h=[p,k].filter(Boolean).join(`
2
+ `).trim()||`exit ${c}`;A(new Error($(`${y}: ${h}`)))})});export function createClaudePluginSurface(o={}){const d=o.exec??Y,E=e=>d(e,{timeoutMs:Q}),A=()=>W.userConfigFile(O()),v=()=>r.join(O(),".claude","plugins","installed_plugins.json"),g=()=>r.join(O(),".claude",z),y=e=>r.join(e,".claude","settings.json"),k=e=>r.join(e,".claude","settings.local.json"),p=(e,n)=>`${e}@${n??WEAVE_MARKETPLACE}`,l=async e=>{try{const n=JSON.parse(await L(e,"utf8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}},j=async(e,n)=>{await x(r.dirname(e),{recursive:!0}),await F(e,`${JSON.stringify(n,null,2)}
3
+ `,"utf8")},b=e=>{const n=e.enabledPlugins;return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([,t])=>typeof t=="boolean"))},c=e=>{const n=e.enabledPlugins;return n&&typeof n=="object"&&!Array.isArray(n)?{...n}:{}},h=async()=>{const n=(await l(v())).plugins;if(!n||typeof n!="object"||Array.isArray(n))return{};const t={};for(const[i,s]of Object.entries(n))Array.isArray(s)&&(t[i]=s);return t},I=(e,n,t)=>{const i=n?.[n.length-1];return{key:e,alreadyInstalled:t,...i?.scope?{scope:i.scope}:{},...i?.installPath?{installPath:i.installPath}:{},...i?.version?{version:i.version}:{}}},N=async(e,n,t={})=>{const i=g(),s=r.join(i,"plugins",n);await B(s),await x(r.dirname(s),{recursive:!0});const a=await L(r.join(e,".claude-plugin","plugin.json"),"utf8").then(()=>!0,()=>!1),u=await V(e).catch(()=>[]);if(a&&!u.includes("node_modules")&&!u.includes(".git"))await q(e,s);else if(await R(e,s,{recursive:!0,filter:S=>{const _=r.basename(S);return _!=="node_modules"&&_!==".git"}}),!a){const S=r.join(s,".claude-plugin","plugin.json");await x(r.dirname(S),{recursive:!0}),await F(S,JSON.stringify({name:n,version:t.version??"0.0.0",...t.description?{description:t.description}:{}},null,2)+`
4
+ `,"utf8")}const f=r.join(i,".claude-plugin","marketplace.json"),w=await l(f),P=Array.isArray(w.plugins)?[...w.plugins]:[],M={name:n,source:`./plugins/${n}`},T=P.findIndex(S=>S?.name===n);return T>=0?P[T]=M:P.push(M),w.name=WEAVE_MARKETPLACE,w.owner||(w.owner={name:"weave"}),w.plugins=P,await j(f,w),i},G=async(e,n,t)=>{if(!e.dir)throw new Error(`marketplace dir required for ${n}@${e.name}`);if((await H(e.dir)).isSymbolicLink())return;const i=r.join(e.dir,".claude-plugin","marketplace.json"),s=await l(i),a=Array.isArray(s.plugins)?[...s.plugins]:[],u=`./${r.relative(e.dir,t).split(r.sep).join("/")}`,m={name:n,source:u},f=a.findIndex(w=>w?.name===n);f>=0?a[f]=m:a.push(m),s.name=e.name,s.owner||(s.owner={name:"weave"}),s.plugins=a,await j(i,s)};return{projectPluginDir:e=>r.join(e,".claude","plugins"),pluginKey:p,parsePluginKey(e){const n=e.lastIndexOf("@");return n>0?{name:e.slice(0,n),market:e.slice(n+1)}:{name:e,market:WEAVE_MARKETPLACE}},async globalInstall(e,n={}){let t=n.name;if(!t){const f=await l(r.join(e,".claude-plugin","plugin.json"));t=typeof f.name=="string"?f.name:void 0}if(!t)throw new Error(`plugin manifest missing name: ${e}`);const i=n.marketplace,s=p(t,i?.name),a=(await h())[s];if(a&&a.length>0)return I(s,a,!0);if(i)await G(i,t,e),await E(["plugin","marketplace","add",i.dir??""]);else{const f=await N(e,t,n);await E(["plugin","marketplace","add",f])}const{stdout:u}=await E(["plugin","install",s,"--scope","user","--json"]),m=K(u);if(m?.outcome==="failed")throw new Error($(String(m.message??"plugin install failed")));return I(s,(await h())[s],!1)},readInstalled:h,async isInstalled(e,n){const t=(await h())[p(e,n)];return!!t&&t.length>0},async uninstall(e,n){const t=p(e,n),i=(await h())[t];if(!i||i.length===0)return;const s=[...new Set(i.map(a=>a.scope??"user"))];for(const a of s){const{stdout:u}=await E(["plugin","uninstall",t,"--scope",a,"--json"]),m=K(u);if(m?.outcome==="failed")throw new Error($(String(m.message??"plugin uninstall failed")))}},async removeMarketplace(e){const n=await l(r.join(O(),".claude","plugins","known_marketplaces.json")),t=r.resolve(e),i=Object.entries(n).find(([,s])=>s&&typeof s=="object"&&typeof s.installLocation=="string"&&r.resolve(s.installLocation)===t)?.[0];i&&await E(["plugin","marketplace","remove",i])},async readProjectEnabled(e,n,t){return b(await l(y(e)))[p(n,t)]??!1},async setProjectEnabled(e,n,t,i){const s=y(e),a=await l(s);a.enabledPlugins={...c(a),[p(n,i)]:t},await j(s,a)},async readGlobalEnabled(){return b(await l(A()))},async writeGlobalEnabled(e,n){const t=A(),i=await l(t);i.enabledPlugins={...c(i),[e]:n},await j(t,i)},pluginScopes:()=>["user","project","local"],async readEnabledOverrides(e){const[n,t,i]=await Promise.all([l(A()).then(b),l(y(e)).then(b),l(k(e)).then(b)]);return{user:n,project:t,local:i}},async setEnabledOverride(e,n,t,i){const s=n==="user"?A():n==="project"?y(e):k(e),a=await l(s),u=c(a);i==="inherit"?delete u[t]:u[t]=i==="on",a.enabledPlugins=u,await j(s,a)}}}export const CLAUDE_PLUGINS=createClaudePluginSurface();
@@ -1,3 +1,3 @@
1
- export const CLAUDE_PROMPT_INBOX={socketEnv:"CLAUDE_CODE_MESSAGING_SOCKET",tokenEnv:"CLAUDE_CODE_MESSAGING_TOKEN",requiresAuthOn:t=>t==="win32",frame:({token:t,text:n})=>{const e=[];return t&&e.push(JSON.stringify({type:"auth",token:t})),e.push(JSON.stringify({type:"user",message:{role:"user",content:n}})),e.join(`
1
+ export const CLAUDE_PROMPT_INBOX={socketEnv:"CLAUDE_CODE_MESSAGING_SOCKET",tokenEnv:"CLAUDE_CODE_MESSAGING_TOKEN",requiresAuthOn:e=>e==="win32",frame:({token:e,text:s})=>{const n=[];return e&&n.push(JSON.stringify({type:"auth",token:e})),n.push(JSON.stringify({type:"user",message:{role:"user",content:s}})),n.join(`
2
2
  `)+`
3
3
  `}};
@@ -1,5 +1,5 @@
1
- import{resolveClaudePeer as t}from"./peers.js";const n="[weave one-way injection \u2014 no reply is expected: do not call SendMessage or ListAgents, just act on this prompt in this session.]";export const CLAUDE_PROMPT_RELAY={bin:"claude",args:["-p","--no-session-persistence","--strict-mcp-config","--disable-slash-commands","--tools","SendMessage,ListAgents","-n","weave"],senderName:"weave",instruction:(e,s,o)=>`Send the following message verbatim to the Claude session named "${e}" using the SendMessage tool, then stop immediately. Do not use any other tool and do not wait for a reply \u2014 the handover is done once the tool call returns, so this process must exit promptly.
1
+ import{resolveClaudePeer as n}from"./peers.js";const t="[weave one-way injection \u2014 no reply is expected: do not call SendMessage or ListAgents, just act on this prompt in this session.]";export const CLAUDE_PROMPT_RELAY={bin:"claude",args:["-p","--no-session-persistence","--strict-mcp-config","--disable-slash-commands","--tools","SendMessage,ListAgents","-n","weave"],senderName:"weave",instruction:(e,s,o)=>`Send the following message verbatim to the Claude session named "${e}" using the SendMessage tool, then stop immediately. Do not use any other tool and do not wait for a reply \u2014 the handover is done once the tool call returns, so this process must exit promptly.
2
2
 
3
- ${o.oneWay?`${n}
3
+ ${o.oneWay?`${t}
4
4
 
5
- `:""}${s}`,resolve:t};
5
+ `:""}${s}`,resolve:n};
@@ -1 +1,2 @@
1
- import{HARNESS_LIFECYCLE as d}from"@weavecode/core";const y="\x1B[B",u=" ",g=2e3,f="(preview cannot be shown in full \u2014 compare the option labels and descriptions instead)",k="No preview available",S="n",v="press n to add notes",w=/[\p{M}\u200b-\u200f\u2028-\u202e\u2060-\u206f\u180b-\u180f\ufe0e\ufe0f]/u,A={key:"ExitPlanMode:approve",header:"Plan approval",question:"Approve this plan and start execution?",multiSelect:!1,options:[{keys:["1"],label:"Yes, and auto-accept edits"},{keys:["2"],label:"Yes, and manually approve edits"},{keys:["3"],label:"No, keep planning"}]},m={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==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 N(e,t){return[t?{keys:[String(e+1)],label:"Type something",input:!0,textFocus:Array.from({length:e},()=>y),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 T(){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 a(e){return typeof e=="string"&&e?e:null}function C(e){if(!Array.isArray(e))return[];const t=[];for(const s of e){if(!s||typeof s!="object")continue;const i=a(s.label);if(!i)continue;const n=s.description;t.push({keys:[String(t.length+1)],label:i,description:typeof n=="string"&&n?n:null,preview:x(s.preview)})}return t}function x(e){return typeof e!="string"?null:e.length>g?f:e.replace(/�/g,"").trim()?w.test(e)?f:e:null}function P(e,t){return t<2?[String(e+1)]:[String(e===0?2:1),String(e+1)]}function E(e){return e.map((t,s)=>({keys:P(s,e.length),commit:["\r"],label:t.label,description:t.description,preview:t.preview??k}))}function Q(e){const t=[];return e>=2&&t.push({keys:[S],label:"Notes:",description:v,input:!0,textTail:["\r"]}),t.push({keys:[String(e),y,"\r"],label:"Chat about this",chat:!0}),t}export const CLAUDE_BLOCKING_PROMPT={blockingTools:d.claude.questionTools,permissionNotificationType:"permission_prompt",silentPermissionModes:["bypassPermissions","dontAsk"],permissionQuestion(e){const t=e.toolName?`${e.toolName}${e.toolInput?` ${q(e.toolInput)}`:""}`:"";return{key:"permission:confirm",header:"Permission",question:t?`Claude needs your permission: ${t}`:"Claude needs your permission",multiSelect:!1,options:[{keys:["1"],label:"Yes"},{keys:["2"],label:"Yes, and don't ask again this session"},{keys:["3"],label:"No (esc)"}]}},parseQuestions(e,t){if(e==="AskUserQuestion"){const s=t&&typeof t=="object"?t.questions:void 0;if(!Array.isArray(s))return[m];const i=[];for(const n of s){if(!n||typeof n!="object")continue;const r=a(n.question),p=a(n.header),l=n.multiSelect===!0,o=C(n.options);if(!r||o.length===0)continue;const b=p??r.slice(0,24),c=!l&&o.some(h=>h.preview!=null);i.push({key:`AskUserQuestion:${b}`,header:p,question:r,options:c?[...E(o),...Q(o.length)]:[...o,...N(o.length,l)],multiSelect:l,previewMode:c})}return i.length===0?[m]:((i.length>=2||i.some(n=>n.multiSelect))&&i.push(T()),i)}return[A]}};
1
+ import{HARNESS_LIFECYCLE as b}from"@weavecode/core";const f="\x1B[B",a=" ",S=2e3,m="(preview cannot be shown in full \u2014 compare the option labels and descriptions instead)",k="No preview available",g="n",w="press n to add notes",N=/[\p{M}\u200b-\u200f\u2028-\u202e\u2060-\u206f\u180b-\u180f\ufe0e\ufe0f]/u,T={key:"ExitPlanMode:approve",header:"Plan approval",question:"Approve this plan and start execution?",multiSelect:!1,options:[{keys:["1"],label:"Yes, auto-accept edits"},{keys:["2"],label:"Yes, manually approve edits"},{keys:["3"],label:"No, keep planning"}]},E=[{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)"}],v=[{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 A(e){if(!e||typeof e!="object")return null;const t=e,s=r(t.to_model),n=r(t.from_model);return!s||!n||s===n||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 ${s} means the full history gets re-read on your next message.`,multiSelect:!1,options:[{keys:["1"],label:`Yes, switch to ${s}`},{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 O(e,t){return[t?{keys:[String(e+1)],label:"Type something",input:!0,textFocus:Array.from({length:e},()=>f),textTail:[a,"\r"]}:{keys:[String(e+1)],label:"Type something",input:!0,textTail:["\r"]},{keys:[String(e+2)],label:"Chat about this",chat:!0}]}function P(){return{key:"AskUserQuestion:submit",header:"Submit",question:"Review your answers",multiSelect:!1,submit:!0,options:[{keys:[a,"1"],label:"Submit answers"},{keys:[a,"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 s of e){if(!s||typeof s!="object")continue;const n=r(s.label);if(!n)continue;const o=s.description;t.push({keys:[String(t.length+1)],label:n,description:typeof o=="string"&&o?o:null,preview:q(s.preview)})}return t}function q(e){return typeof e!="string"?null:e.length>S?m:e.replace(/�/g,"").trim()?N.test(e)?m:e:null}function R(e,t){return t<2?[String(e+1)]:[String(e===0?2:1),String(e+1)]}function C(e){return e.map((t,s)=>({keys:R(s,e.length),commit:["\r"],label:t.label,description:t.description,preview:t.preview??k}))}function M(e){const t=[];return e>=2&&t.push({keys:[g],label:"Notes:",description:w,input:!0,textTail:["\r"]}),t.push({keys:[String(e),f,"\r"],label:"Chat about this",chat:!0}),t}export const CLAUDE_BLOCKING_PROMPT={blockingTools:b.claude.questionTools,permissionNotificationType:"permission_prompt",silentPermissionModes:["bypassPermissions","dontAsk"],permissionQuestion(e){const t=e.toolName?`${e.toolName}${e.toolInput?` ${_(e.toolInput)}`:""}`:"",s=e.permissionMode==="auto"||/classifier/i.test(e.message??""),n=e.message?.trim()||"Claude needs your permission";return{key:"permission:confirm",header:s?"Permission (auto mode)":"Permission",question:t?`${n}
2
+ ${t}`:n,multiSelect:!1,options:[...s?v:E]}},parseQuestions(e,t){if(e==="AskUserQuestion"){const s=t&&typeof t=="object"?t.questions:void 0;if(!Array.isArray(s))return[h];const n=[];for(const o of s){if(!o||typeof o!="object")continue;const l=r(o.question),c=r(o.header),u=o.multiSelect===!0,i=I(o.options);if(!l||i.length===0)continue;const d=c??l.slice(0,24),p=!u&&i.some(y=>y.preview!=null);n.push({key:`AskUserQuestion:${d}`,header:c,question:l,options:p?[...C(i),...M(i.length)]:[...i,...O(i.length,u)],multiSelect:u,previewMode:p})}return n.length===0?[h]:((n.length>=2||n.some(o=>o.multiSelect))&&n.push(P()),n)}return[T]},eventQuestion(e,t){return e==="PreModelSwitch"?A(t):null}};
@@ -0,0 +1,32 @@
1
+ import type { InitComponents, HooksConfig, PlatformInfo } from '@weavecode/core';
2
+ export interface SettingsGeneratorInput {
3
+ components: InitComponents;
4
+ hooks: HooksConfig;
5
+ platform: PlatformInfo;
6
+ /** Absolute path to the helpers directory in the target project */
7
+ helpersDir: string;
8
+ }
9
+ export declare function generateSettingsJson(input: SettingsGeneratorInput): Record<string, unknown>;
10
+ /**
11
+ * Merge weave's generated settings into an existing user settings.json.
12
+ *
13
+ * Policy (weave init never overwrites user files):
14
+ * - every existing key is preserved as-is (including unknown keys)
15
+ * - weave entries are appended where missing
16
+ * - weave's own hooks entries are REPLACED wholesale by this generation: first
17
+ * every group carrying the weave marker is dropped from all events (events
18
+ * no longer generated no longer linger), then the generated groups are
19
+ * appended. User-authored hook groups are never touched.
20
+ * - statusLine pointing at `statusline.cjs` is refreshed in place
21
+ * - user-authored statusLine, permissions, and env values are never touched
22
+ *
23
+ * Idempotent: merging the same `generated` twice yields the same result.
24
+ */
25
+ export declare function mergeSettingsJson(existing: Record<string, unknown>, generated: Record<string, unknown>): Record<string, unknown>;
26
+ /**
27
+ * uninstall 用的剥除:把 merge 的加法原样减回去。weave 的 hook 组、weave 的
28
+ * statusLine、weave 写入的默认 permissions/env 条目与 $comment 一并移除;
29
+ * 用户自己的键(含 weave 之外的一切)永远不动。返回剩余 settings——键全空
30
+ * 时为空对象,调用方据此删文件。
31
+ */
32
+ export declare function stripWeaveSettings(existing: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ import{captureHookGroup as r,sweepWeaveHookEvents as m}from"./capture.js";const v=".claude/helpers/statusline.cjs",d="Generated by weave \u2014 do not edit manually",S=["Bash(npx weave:*)","Bash(pnpm:*)","Bash(npm:*)"],h=["Read(./.env)","Read(./.env.*)","Read(./secrets/*)"];export function generateSettingsJson(n){const{components:s,hooks:e,platform:p,helpersDir:o}=n,c={$comment:d};if(s.helpers){const t={};e.preToolUse&&(t.PreToolUse=r("PreToolUse",o)),e.postToolUse&&(t.PostToolUse=r("PostToolUse",o)),e.userPromptSubmit&&(t.UserPromptSubmit=r("UserPromptSubmit",o)),e.sessionStart&&(t.SessionStart=r("SessionStart",o)),e.stop&&(t.Stop=r("Stop",o)),e.stopFailure&&(t.StopFailure=r("StopFailure",o)),e.subagentStop&&(t.SubagentStop=r("SubagentStop",o)),e.subagentStart&&(t.SubagentStart=r("SubagentStart",o)),e.notification&&(t.Notification=r("Notification",o)),e.postToolUseFailure&&(t.PostToolUseFailure=r("PostToolUseFailure",o)),e.permissionRequest&&(t.PermissionRequest=r("PermissionRequest",o)),e.permissionDenied&&(t.PermissionDenied=r("PermissionDenied",o)),e.preCompact&&(t.PreCompact=r("PreCompact",o)),e.sessionEnd&&(t.SessionEnd=r("SessionEnd",o)),e.preModelSwitch&&(t.PreModelSwitch=r("PreModelSwitch",o),t.PostModelSwitch=r("PostModelSwitch",o)),c.hooks=t}return c.permissions={allow:[...S],deny:[...h]},c.env={WEAVE_ENABLED:"true"},s.helpers&&(c.statusLine={type:"command",command:p.os==="windows"?`node "${o}/statusline.cjs"`:"node "+o+"/statusline.cjs",padding:0,refreshInterval:30}),c}export function mergeSettingsJson(n,s){const e={...n},p=s.hooks;if(p&&typeof p=="object"){const i=m(l(e.hooks)?{...e.hooks}:{})??{};for(const[a,f]of Object.entries(p)){const u=i[a];u===void 0?i[a]=f:Array.isArray(u)&&(i[a]=[...u,...Array.isArray(f)?f:[]])}e.hooks=i}const o=e.statusLine;s.statusLine&&(o===void 0||E(o))&&(e.statusLine=s.statusLine);const c=s.permissions;if(c&&typeof c=="object"){const i=l(e.permissions)?e.permissions:{};for(const a of["allow","deny"]){const f=c[a],u=i[a];Array.isArray(f)?i[a]=A(u,f):u===void 0&&(i[a]=f)}e.permissions=i}const t=s.env;if(t&&typeof t=="object"){const i=l(e.env)?e.env:{};for(const[a,f]of Object.entries(t))i[a]===void 0&&(i[a]=f);e.env=i}return e}function l(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function E(n){if(!l(n))return!1;const s=n.command;return typeof s=="string"&&y(s,v)}function y(n,s){return n.replace(/\\/g,"/").includes(s)}function A(n,s){return Array.isArray(n)?[...n,...s.filter(e=>!n.includes(e))]:[...s]}export function stripWeaveSettings(n){const s={...n};if(l(s.hooks)){const e=m(s.hooks);e?s.hooks=e:delete s.hooks}if(E(s.statusLine)&&delete s.statusLine,l(s.permissions)){const e={...s.permissions},p=(o,c)=>{const t=e[o];if(!Array.isArray(t))return;const i=t.filter(a=>!c.includes(a));i.length>0?e[o]=i:delete e[o]};p("allow",S),p("deny",h),Object.keys(e).length>0?s.permissions=e:delete s.permissions}if(l(s.env)){const e={...s.env};delete e.WEAVE_ENABLED,Object.keys(e).length>0?s.env=e:delete s.env}return s.$comment===d&&delete s.$comment,s}
@@ -9,3 +9,19 @@
9
9
  */
10
10
  /** 转录尾部文本里最后一条中断标记的时刻(ms);没有/解析不出 → null。 */
11
11
  export declare function interruptMarkerAt(tail: string): number | null;
12
+ /**
13
+ * 转录尾部最后一次**真跑过**的模型(assistant 的 `message.model`)。
14
+ *
15
+ * 为什么绕到转录:hook 事件只在 `SessionStart` 带 `raw.model`,之后换模型没有
16
+ * 任何事件照会——实时态只在转录里。宿主的 `/model <名>` 切换是会话级、不落盘,
17
+ * 故这里只答「最近这一轮用的是什么」,不猜配置。
18
+ */
19
+ export declare function currentModelAt(tail: string): string | null;
20
+ /**
21
+ * 转录尾部最后一次的执行模式(条目上的 `permissionMode`)。
22
+ *
23
+ * 同模型一样绕到转录:Shift+Tab **不发任何 hook 事件、不写任何转录条目**——模式
24
+ * 只在之后的条目上照会,故这答的永远是「最后一次活动时是什么模式」,不是此刻。
25
+ * 宿主自己算下一个模式(还会被计划提案、auto 闸插手),这里只读不猜。
26
+ */
27
+ export declare function currentModeAt(tail: string): string | null;
@@ -1,2 +1,4 @@
1
- const o="[Request interrupted by user";function u(t){return typeof t=="string"?t:Array.isArray(t)?t.map(e=>{const n=e?.text;return typeof n=="string"?n:""}).join(""):""}export function interruptMarkerAt(t){let e=null;for(const n of t.split(`
2
- `)){if(!n.includes(o))continue;let s;try{s=JSON.parse(n)}catch{continue}const r=s;if(r?.type!=="user"||!u(r.message?.content).startsWith(o))continue;const i=Date.parse(String(r.timestamp));Number.isFinite(i)&&(e===null||i>e)&&(e=i)}return e}
1
+ const s="[Request interrupted by user";function c(n){return typeof n=="string"?n:Array.isArray(n)?n.map(t=>{const e=t?.text;return typeof e=="string"?e:""}).join(""):""}export function interruptMarkerAt(n){let t=null;for(const e of n.split(`
2
+ `)){if(!e.includes(s))continue;let i;try{i=JSON.parse(e)}catch{continue}const r=i;if(r?.type!=="user"||!c(r.message?.content).startsWith(s))continue;const o=Date.parse(String(r.timestamp));Number.isFinite(o)&&(t===null||o>t)&&(t=o)}return t}const u="<synthetic>";export function currentModelAt(n){let t=null;for(const e of n.split(`
3
+ `)){if(!e.includes('"model"'))continue;let i;try{i=JSON.parse(e)}catch{continue}const r=i,o=r?.message?.model??r?.model;typeof o!="string"||!o||o===u||(t=o)}return t}export function currentModeAt(n){let t=null;for(const e of n.split(`
4
+ `)){if(!e.includes("permissionMode"))continue;let i;try{i=JSON.parse(e)}catch{continue}const r=i?.permissionMode;typeof r!="string"||!r||(t=r)}return t}
@@ -1 +1 @@
1
- import e from"node:path";import{FILE_ASSET_SPECS as t}from"../shared/file-specs.js";export const CODEX_ASSETS={harness:"codex",targetDir(o,r,c,s){const i=t[o].dirs.codex;if(r!=="user"||!i?.user)throw new Error(`"${o}" has no Codex ${r==="user"?"user":"project"} surface`);return e.join(s,...i.user.split("/"))},projectSkillsDir:()=>".codex/skills",globalSkillsRoots:o=>[e.join(o,...".agents/skills".split("/")),e.join(o,...".codex/skills".split("/"))],userConfigFile:o=>e.join(o,".codex","config.toml"),mcpScopes:()=>["user"],mcpDest:(o,r)=>o==="user"?e.join(r,".codex","config.toml"):void 0,pluginCacheDir:o=>e.join(o,".codex","plugins","cache"),classify(o){return o===".codex"||o.startsWith(".codex/")?!0:o.slice(o.lastIndexOf("/")+1)==="AGENTS.md"},ignore(o){return!(o===".codex"||o.startsWith(".codex/")||o==="AGENTS.md")}};
1
+ import o from"node:path";import{FILE_ASSET_SPECS as t}from"../shared/file-specs.js";export const CODEX_ASSETS={harness:"codex",targetDir(s,e,c,r){const i=t[s].dirs.codex;if(e!=="user"||!i?.user)throw new Error(`"${s}" has no Codex ${e==="user"?"user":"project"} surface`);return o.join(r,...i.user.split("/"))},projectSkillsDir:()=>".codex/skills",globalSkillsRoots:s=>[o.join(s,...".agents/skills".split("/")),o.join(s,...".codex/skills".split("/"))],userConfigFile:s=>o.join(s,".codex","config.toml"),mcpScopes:()=>["user"],mcpDest:(s,e)=>s==="user"?o.join(e,".codex","config.toml"):void 0,pluginCacheDir:s=>o.join(s,".codex","plugins","cache"),classify(s){return s===".codex"||s.startsWith(".codex/")?!0:s.slice(s.lastIndexOf("/")+1)==="AGENTS.md"},ignore(s){return!(s===".codex"||s.startsWith(".codex/")||s==="AGENTS.md")}};
@@ -1 +1 @@
1
- import{existsSync as s}from"node:fs";import n from"node:path";const o=[".codex","AGENTS.md"];function t(e){return o.some(r=>s(n.join(e,r)))}export const CODEX_DETECTOR={markers:o,present:t,detect:e=>({harness:"codex",present:t(e)})};
1
+ import{existsSync as n}from"node:fs";import s from"node:path";const t=[".codex","AGENTS.md"];function o(e){return t.some(r=>n(s.join(e,r)))}export const CODEX_DETECTOR={markers:t,present:o,detect:e=>({harness:"codex",present:o(e)})};
@@ -1 +1 @@
1
- export const CODEX_MESSAGING={harness:"codex",discovery:!1,prompt:null,promptInbox:null,inject:null,headless:null,idleSignals:[],unsupportedReasons:{discovery:"Codex event ingestion is pending research (BACKLOG \xA710-6); sessions are not discoverable",prompt:"Codex has no native peer-messaging channel; prompts can only reach it via terminal text injection where the configured terminal supports it",inject:"Codex has no synchronous injection channel yet (pending research)",headless:"Codex resume is pending research",watch:"Codex idle signals are pending research; watch is unavailable"}};
1
+ export const CODEX_MESSAGING={harness:"codex",discovery:!1,prompt:null,promptInbox:null,inject:null,headless:null,idleSignals:[],imageAttach:null,unsupportedReasons:{discovery:"Codex event ingestion is pending research (BACKLOG \xA710-6); sessions are not discoverable",prompt:"Codex has no native peer-messaging channel; prompts can only reach it via terminal text injection where the configured terminal supports it",inject:"Codex has no synchronous injection channel yet (pending research)",headless:"Codex resume is pending research",watch:"Codex idle signals are pending research; watch is unavailable"}};
@@ -1 +1 @@
1
- import{access as l,mkdir as m,readFile as i,writeFile as u}from"node:fs/promises";import{homedir as n}from"node:os";import p from"node:path";import{parse as s}from"smol-toml";import{CODEX_ASSETS as f}from"./assets.js";import{CodexTomlCorruptError as d,upsertCodexPluginEnabledInText as b}from"./toml.js";const c=e=>l(e).then(()=>!0,()=>!1);async function w(e){if(!await c(e))return{};try{const o=s(await i(e,"utf-8")).plugins;if(!o||typeof o!="object"||Array.isArray(o))return{};const r={};for(const[a,t]of Object.entries(o))t&&typeof t=="object"&&typeof t.enabled=="boolean"&&(r[a]=t.enabled);return r}catch{return{}}}export const CODEX_PLUGIN_STATE={readGlobalEnabled:()=>w(f.userConfigFile(n())),async writeGlobalEnabled(e,o){const r=f.userConfigFile(n());let a="";if(await c(r)){a=await i(r,"utf-8");try{s(a)}catch(t){throw new d(`${r} is not valid TOML \u2014 refusing to write: ${t instanceof Error?t.message:String(t)}`)}}await m(p.dirname(r),{recursive:!0}),await u(r,b(a,e,o),"utf-8")}};
1
+ import{access as u,mkdir as p,readFile as n,writeFile as d}from"node:fs/promises";import{homedir as s}from"node:os";import m from"node:path";import{parse as f}from"smol-toml";import{CODEX_ASSETS as l}from"./assets.js";import{CodexTomlCorruptError as b,upsertCodexPluginEnabledInText as w}from"./toml.js";const c=r=>u(r).then(()=>!0,()=>!1);async function E(r){if(!await c(r))return{};try{const t=f(await n(r,"utf-8")).plugins;if(!t||typeof t!="object"||Array.isArray(t))return{};const e={};for(const[o,a]of Object.entries(t))a&&typeof a=="object"&&typeof a.enabled=="boolean"&&(e[o]=a.enabled);return e}catch{return{}}}export const CODEX_PLUGIN_STATE={readGlobalEnabled:()=>E(l.userConfigFile(s())),async writeGlobalEnabled(r,i){const t=l.userConfigFile(s());let e="";if(await c(t)){e=await n(t,"utf-8");try{f(e)}catch(o){throw new b(`${t} is not valid TOML \u2014 refusing to write: ${o instanceof Error?o.message:String(o)}`)}}await p(m.dirname(t),{recursive:!0}),await d(t,w(e,r,i),"utf-8")}};
@@ -1,13 +1,13 @@
1
- export class CodexTomlCorruptError extends Error{constructor(r){super(r),this.name="CodexTomlCorruptError"}}function $(t){return/[A-Za-z0-9_-]/.test(t)}function p(t){return t===" "||t===" "}const a={b:"\b",t:" ",n:`
2
- `,f:"\f",r:"\r",'"':'"',"\\":"\\"};export function parseDottedKey(t){const r=[];let n=0;for(;;){for(;n<t.length&&p(t[n]);)n++;if(n>=t.length)return null;const e=t[n];if(e==='"'||e==="'"){n++;let o="";for(;n<t.length;){const l=t[n];if(e==='"'&&l==="\\"){const u=t[n+1];if(u===void 0||!(u in a))return null;o+=a[u],n+=2;continue}if(l===e)break;o+=l,n++}if(n>=t.length)return null;n++,r.push(o)}else{const o=n;for(;n<t.length&&$(t[n]);)n++;if(n===o)return null;r.push(t.slice(o,n))}for(;n<t.length&&p(t[n]);)n++;if(n>=t.length)return r;if(t[n]!==".")return null;n++}}export function sectionHeaderKey(t){const r=t.trim();if(!r.startsWith("["))return null;const n=r.startsWith("[[");let e=n?2:1,o="",l=!1;for(;e<r.length;){const s=r[e];if(s==='"'||s==="'"){const c=s;for(o+=c,e++;e<r.length;){if(c==='"'&&r[e]==="\\"){if(e+1>=r.length)return null;o+=r[e]+r[e+1],e+=2;continue}if(r[e]===c)break;o+=r[e],e++}if(e>=r.length)return null;o+=c,e++;continue}if(s==="]"){if(n){if(r[e+1]!=="]")return null;e+=2}else e++;l=!0;break}o+=s,e++}if(!l)return null;const u=r.slice(e).trim();return u!==""&&!u.startsWith("#")?null:parseDottedKey(o)}export function renderTomlKey(t){return/^[A-Za-z0-9_-]+$/.test(t)?t:`"${d(t)}"`}export function renderTomlHeader(t){return`[${t.map(renderTomlKey).join(".")}]`}function d(t){let r="";for(const n of t)n==="\\"?r+="\\\\":n==='"'?r+='\\"':n===`
3
- `?r+="\\n":n==="\r"?r+="\\r":n===" "?r+="\\t":n<" "||n==="\x7F"?r+=`\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`:r+=n;return r}export function renderTomlString(t){const r=t.includes("\\"),n=!t.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(t);return r&&n?`'${t}'`:`"${d(t)}"`}export function splitTomlSections(t){const r=t.split(`
4
- `),n=[];let e={key:null,lines:[]};for(const o of r){const l=sectionHeaderKey(o);l!==null?(n.push(e),e={key:l,lines:[o]}):e.lines.push(o)}return n.push(e),n}export function sameKey(t,r){return t!==null&&t.length===r.length&&t.every((n,e)=>n===r[e])}function g(t,r){return t!==null&&t.length>r.length&&r.every((n,e)=>t[e]===n)}function y(t){let r=0;for(let n=t.length-1;n>=0&&t[n].trim()==="";n--)r++;return r}function x(t){const r=t.replace(/(?:\r?\n)+[ \t]*$/,"");return r===""?"":`${r}
5
- `}function b(t,r){const n=t.replace(/(?:\r?\n)+[ \t]*$/,"");return n.trim()===""?`${r.join(`
1
+ export class CodexTomlCorruptError extends Error{constructor(t){super(t),this.name="CodexTomlCorruptError"}}function S(e){return/[A-Za-z0-9_-]/.test(e)}function h(e){return e===" "||e===" "}const p={b:"\b",t:" ",n:`
2
+ `,f:"\f",r:"\r",'"':'"',"\\":"\\"};export function parseDottedKey(e){const t=[];let n=0;for(;;){for(;n<e.length&&h(e[n]);)n++;if(n>=e.length)return null;const r=e[n];if(r==='"'||r==="'"){n++;let o="";for(;n<e.length;){const i=e[n];if(r==='"'&&i==="\\"){const l=e[n+1];if(l===void 0||!(l in p))return null;o+=p[l],n+=2;continue}if(i===r)break;o+=i,n++}if(n>=e.length)return null;n++,t.push(o)}else{const o=n;for(;n<e.length&&S(e[n]);)n++;if(n===o)return null;t.push(e.slice(o,n))}for(;n<e.length&&h(e[n]);)n++;if(n>=e.length)return t;if(e[n]!==".")return null;n++}}export function sectionHeaderKey(e){const t=e.trim();if(!t.startsWith("["))return null;const n=t.startsWith("[[");let r=n?2:1,o="",i=!1;for(;r<t.length;){const u=t[r];if(u==='"'||u==="'"){const c=u;for(o+=c,r++;r<t.length;){if(c==='"'&&t[r]==="\\"){if(r+1>=t.length)return null;o+=t[r]+t[r+1],r+=2;continue}if(t[r]===c)break;o+=t[r],r++}if(r>=t.length)return null;o+=c,r++;continue}if(u==="]"){if(n){if(t[r+1]!=="]")return null;r+=2}else r++;i=!0;break}o+=u,r++}if(!i)return null;const l=t.slice(r).trim();return l!==""&&!l.startsWith("#")?null:parseDottedKey(o)}export function renderTomlKey(e){return/^[A-Za-z0-9_-]+$/.test(e)?e:`"${d(e)}"`}export function renderTomlHeader(e){return`[${e.map(renderTomlKey).join(".")}]`}function d(e){let t="";for(const n of e)n==="\\"?t+="\\\\":n==='"'?t+='\\"':n===`
3
+ `?t+="\\n":n==="\r"?t+="\\r":n===" "?t+="\\t":n<" "||n==="\x7F"?t+=`\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`:t+=n;return t}export function renderTomlString(e){const t=e.includes("\\"),n=!e.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(e);return t&&n?`'${e}'`:`"${d(e)}"`}export function splitTomlSections(e){const t=e.split(`
4
+ `),n=[];let r={key:null,lines:[]};for(const o of t){const i=sectionHeaderKey(o);i!==null?(n.push(r),r={key:i,lines:[o]}):r.lines.push(o)}return n.push(r),n}export function sameKey(e,t){return e!==null&&e.length===t.length&&e.every((n,r)=>n===t[r])}function g(e,t){return e!==null&&e.length>t.length&&t.every((n,r)=>e[r]===n)}function $(e){let t=0;for(let n=e.length-1;n>=0&&e[n].trim()==="";n--)t++;return t}function m(e){const t=e.replace(/(?:\r?\n)+[ \t]*$/,"");return t===""?"":`${t}
5
+ `}function b(e,t){const n=e.replace(/(?:\r?\n)+[ \t]*$/,"");return n.trim()===""?`${t.join(`
6
6
  `)}
7
7
  `:`${n}
8
8
 
9
- ${r.join(`
9
+ ${t.join(`
10
10
  `)}
11
- `}export function upsertTomlSection(t,r,n){const e=splitTomlSections(t);let o=-1,l=-1;const u=new Set;for(let i=0;i<e.length;i++){const h=e[i].key;sameKey(h,r)?(o<0&&(o=i),u.add(i),l=i):g(h,r)&&(u.add(i),l=i)}if(o<0)return b(t,[renderTomlHeader(r),...n]);const s=e[l].lines,c=s.slice(s.length-y(s)),m=[renderTomlHeader(r),...n,...c],f=[];for(let i=0;i<e.length;i++)i===o&&f.push(...m),!u.has(i)&&f.push(...e[i].lines);return x(f.join(`
12
- `))}export function removeTomlSection(t,r){const n=splitTomlSections(t),e=new Set;for(let l=0;l<n.length;l++){const u=n[l].key;(sameKey(u,r)||g(u,r))&&e.add(l)}if(e.size===0)return{text:t,removed:!1};const o=[];for(let l=0;l<n.length;l++)e.has(l)||o.push(...n[l].lines);return{text:x(o.join(`
13
- `)),removed:!0}}export function parseSectionEntries(t){const r=[];for(const n of t){const e=n.trim();if(e===""||e.startsWith("#")||e.startsWith("["))continue;const o=/^("[^"]*"|'[^']*'|[A-Za-z0-9_-]+)\s*=/.exec(e);if(!o)continue;const l=parseDottedKey(o[1]);l===null||l.length!==1||r.push([l[0],n])}return r}export function upsertCodexPluginEnabledInText(t,r,n){const e=["plugins",r],o=splitTomlSections(t).find(u=>sameKey(u.key,e)),l=[`enabled = ${n?"true":"false"}`];if(o)for(const[u,s]of parseSectionEntries(o.lines.slice(1)))u!=="enabled"&&l.push(s);return upsertTomlSection(t,e,l)}
11
+ `}export function upsertTomlSection(e,t,n){const r=splitTomlSections(e);let o=-1,i=-1;const l=new Set;for(let s=0;s<r.length;s++){const a=r[s].key;sameKey(a,t)?(o<0&&(o=s),l.add(s),i=s):g(a,t)&&(l.add(s),i=s)}if(o<0)return b(e,[renderTomlHeader(t),...n]);const u=r[i].lines,c=u.slice(u.length-$(u)),x=[renderTomlHeader(t),...n,...c],f=[];for(let s=0;s<r.length;s++)s===o&&f.push(...x),!l.has(s)&&f.push(...r[s].lines);return m(f.join(`
12
+ `))}export function removeTomlSection(e,t){const n=splitTomlSections(e),r=new Set;for(let i=0;i<n.length;i++){const l=n[i].key;(sameKey(l,t)||g(l,t))&&r.add(i)}if(r.size===0)return{text:e,removed:!1};const o=[];for(let i=0;i<n.length;i++)r.has(i)||o.push(...n[i].lines);return{text:m(o.join(`
13
+ `)),removed:!0}}export function parseSectionEntries(e){const t=[];for(const n of e){const r=n.trim();if(r===""||r.startsWith("#")||r.startsWith("["))continue;const o=/^("[^"]*"|'[^']*'|[A-Za-z0-9_-]+)\s*=/.exec(r);if(!o)continue;const i=parseDottedKey(o[1]);i===null||i.length!==1||t.push([i[0],n])}return t}export function upsertCodexPluginEnabledInText(e,t,n){const r=["plugins",t],i=splitTomlSections(e).find(u=>sameKey(u.key,r)),l=[`enabled = ${n?"true":"false"}`];if(i)for(const[u,c]of parseSectionEntries(i.lines.slice(1)))u!=="enabled"&&l.push(c);return upsertTomlSection(e,r,l)}
@@ -22,6 +22,24 @@ export interface CaptureDeps {
22
22
  /** 覆盖用户主目录(测试注入);缺省 os.homedir()。 */
23
23
  home?: string;
24
24
  }
25
+ /**
26
+ * 生成脚本的健康(诊断面只读):脚本正文即 harness 知识(它上报哪些旁路事实),
27
+ * 故判据归各 harness,server 只聚合不自拼。
28
+ */
29
+ export interface CaptureScriptHealth {
30
+ /** 生效的是哪一支:user 档采集 installed 即 user,否则项目档;两处都没有 = none。 */
31
+ source: 'user' | 'project' | 'none';
32
+ /** 生效脚本文件在。 */
33
+ present: boolean;
34
+ /** 带 weave 版本标记(weave 生成物;无标记 = 用户自写,weave 不认)。 */
35
+ weaveOwned: boolean;
36
+ /** 标记里读到的生成版本;读不到 = null。 */
37
+ generatedVersion: string | null;
38
+ /** 脚本含会话 inbox 凭据上报(判据 = 正文出现 PromptInboxSpec.socketEnv)。 */
39
+ reportsInbox: boolean;
40
+ /** 脚本含 pane 定位 env 上报。 */
41
+ reportsPaneEnv: boolean;
42
+ }
25
43
  /**
26
44
  * 采集安装面:weave 事件采集集成(整个 dashboard 的地基)按工具对象建模,
27
45
  * user 档安装/启用是硬性要求——跨项目采集,不依赖逐项目 init。安装即启用
@@ -39,6 +57,10 @@ export interface CaptureSurface {
39
57
  uninstallUserCapture(deps?: CaptureDeps): Promise<void>;
40
58
  /** 项目档去重:user 档接管时清扫该项目 settings 的采集组(缺/坏文件 = 已达目的)。 */
41
59
  stripProjectCapture(projectPath: string): Promise<void>;
60
+ /** 生效采集脚本的健康(诊断面;`projectPath` 缺省只判 user 档)。 */
61
+ scriptHealth(deps?: CaptureDeps & {
62
+ projectPath?: string;
63
+ }): Promise<CaptureScriptHealth>;
42
64
  }
43
65
  /**
44
66
  * 插件**启用态**槽:只读/写「某 harness 的插件是否启用」,不含安装与市场
@@ -161,6 +183,24 @@ export interface PromptRelaySpec {
161
183
  name: string;
162
184
  } | null;
163
185
  }
186
+ /**
187
+ * 图片随 prompt 投递的对齐面:「一张图怎么被这个 harness 认出来」是 harness 表示法
188
+ * (claude = 裸绝对路径,它自己的粘贴处理器按 `\.(png|jpe?g|gif|webp)$` 把路径转成
189
+ * `[Image #N]` + 真 image block),server 只传语义参数(原文 + 落盘图的可读路径 /
190
+ * 媒体类型 / 原文件名),怎么引用归这里。null = 该 harness 不支持收图。
191
+ */
192
+ export interface ImageAttachSpec {
193
+ /**
194
+ * 把「用户原文 + 已落盘图片」合成投递 prompt 文本。images 恒非空;text 可为空
195
+ * (纯图发送)。返回值走三条层投递,**用户原文不得被改写**(回执比对靠它做包含
196
+ * 匹配)——只允许追加引用形态。
197
+ */
198
+ composePrompt(text: string, images: readonly {
199
+ path: string;
200
+ mediaType: string;
201
+ name: string;
202
+ }[]): string;
203
+ }
164
204
  /** 信封渲染入参。 */
165
205
  export interface MessageMeta {
166
206
  /** 发起方展示名(dashboard / 会话标题 / cli)。 */
@@ -221,13 +261,28 @@ export interface BlockingPromptSpec {
221
261
  * 该时段的权限 Notification 恒为噪声,server 直接忽略;空数组 = 无模式概念。
222
262
  */
223
263
  readonly silentPermissionModes: readonly string[];
224
- /** 权限确认的问题面(选项键序随宿主 UI 固定;上文 = 最近一次 PreToolUse)。 */
264
+ /**
265
+ * 权限确认的问题面。选项行数与键义**随宿主形态变**(同一份 3 行面发给 2 行对话框
266
+ * 会把「别再问」打成「拒绝」),故上下文要带齐形态判据:最近一次 PreToolUse 的
267
+ * 工具面 + Notification 正文 + 会话当时的权限模式。
268
+ */
225
269
  permissionQuestion(context: {
226
270
  toolName: string | null;
227
271
  toolInput: unknown;
272
+ /** 宿主对话框原文(Notification 的 raw.message);缺键 = null。 */
273
+ message: string | null;
274
+ /** 会话当时的权限模式(latch 自 raw.permission_mode);null = 未知。 */
275
+ permissionMode: string | null;
228
276
  }): BlockingQuestion;
229
277
  /** 阻塞工具的 PreToolUse toolInput → 问题列表(含合成问题:计划确认的 toolInput 恒空)。 */
230
278
  parseQuestions(toolName: string, toolInput: unknown): BlockingQuestion[];
279
+ /**
280
+ * 事件弹框(不是工具、也非权限提醒的对话框,如 claude 的「Switch model?」):
281
+ * 事件到达且**对话框确实要弹**时返回问题面,否则 null。条件(弹不弹)是 harness
282
+ * 知识——宿主自己有一套触发判据,猜错就成幽灵问题(面板有问、终端无框,键序
283
+ * 会打进输入框)。落定沿用 permission 态口径(后续任何非 Notification 事件即了结)。
284
+ */
285
+ eventQuestion(eventType: string, raw: unknown): BlockingQuestion | null;
231
286
  }
232
287
  /**
233
288
  * 会话本地收件箱直投规格(层①-a,**harness 专属机制**:claude = inbox socket)。
@@ -269,6 +324,8 @@ export interface MessagingSurface {
269
324
  readonly idleSignals: readonly string[];
270
325
  /** 注入信封渲染(缺省 = server 的 weave 统一信封)。 */
271
326
  renderEnvelope?(text: string, meta: MessageMeta): string;
327
+ /** 图片随 prompt 的对齐面;null = 该 harness 不支持收图(web 据此置灰附件钮)。 */
328
+ readonly imageAttach: ImageAttachSpec | null;
272
329
  /** 不支持通道的语义原因(409 文案与 UI tooltip 直用)。 */
273
330
  readonly unsupportedReasons?: Partial<Record<MessagingChannel, string>>;
274
331
  }
@@ -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 class HarnessRegistry{drivers=new Map;register(e){if(this.drivers.has(e.id))throw new Error(`harness driver already registered: ${e.id}`);this.drivers.set(e.id,e);let r=!1;return()=>{r||(r=!0,this.drivers.get(e.id)===e&&this.drivers.delete(e.id))}}get(e){return this.drivers.get(e)}all(){return[...this.drivers.values()]}byCapability(e){return this.all().filter(r=>r.capabilities.includes(e))}initFor(e){return this.drivers.get(e)?.init}unregister(e){return this.drivers.delete(e)}}export function supports(i,e){return i.capabilities.includes(e)}
@@ -1,5 +1,6 @@
1
1
  export * from './driver.js';
2
2
  export * from './init/pipeline.js';
3
+ export * from './init/generated.js';
3
4
  export * from './registry-wiring.js';
4
5
  export * from './shared/file-specs.js';
5
6
  export * from './shared/install-link.js';
@@ -1 +1 @@
1
- export*from"./driver.js";export*from"./init/pipeline.js";export*from"./registry-wiring.js";export*from"./shared/file-specs.js";export*from"./shared/install-link.js";export*from"./claude/index.js";export*from"./codex/index.js";
1
+ export*from"./driver.js";export*from"./init/pipeline.js";export*from"./init/generated.js";export*from"./registry-wiring.js";export*from"./shared/file-specs.js";export*from"./shared/install-link.js";export*from"./claude/index.js";export*from"./codex/index.js";
@@ -0,0 +1,37 @@
1
+ import type { Harness, HooksConfig, InitComponents, MCPConfig, PlatformInfo } from '@weavecode/core';
2
+ /** weave 特性文件的覆写判据:内容带它 = weave 自己的生成物,可覆写刷新。 */
3
+ export declare const WEAVE_CONTENT_MARKER = "@version weave@";
4
+ /**
5
+ * init 生成物的期望态。**落点(`relPath`)与内容都是 harness 知识**——server 只
6
+ * 比对与落盘,不自拼路径、不自造内容。
7
+ */
8
+ export interface InitGeneratedFile {
9
+ /** 项目根相对路径(posix 分隔)。 */
10
+ relPath: string;
11
+ /**
12
+ * 整文件类的覆写判据:盘上内容含它 = weave 生成物,可整文件刷新;不含 =
13
+ * 用户手写的同名文件,永不碰。缺省 = merge 类(见 `merge`)。
14
+ */
15
+ weaveMarker?: string;
16
+ /** weave 自有内容:整文件类的全文,或 merge 类要并进用户文件的片段。 */
17
+ content: string;
18
+ /**
19
+ * merge 类:把 `content` 并进盘上原文,返回应写回的全文;null = 盘上不可
20
+ * 合并(JSON 坏了之类)→ 保持不动。缺省 = 整文件覆盖。
21
+ */
22
+ merge?(onDisk: string, content: string): string | null;
23
+ }
24
+ /** 生成期望态所需的项目上下文(与 init 落盘同一套输入)。 */
25
+ export interface InitFileContext {
26
+ projectPath: string;
27
+ version: string;
28
+ platform: PlatformInfo;
29
+ components: InitComponents;
30
+ hooks: HooksConfig;
31
+ mcp: MCPConfig;
32
+ }
33
+ /**
34
+ * 取某 harness 在该项目下的 init 生成物期望态。daemon 的 init 文件漂移检测与
35
+ * 自动同步走这里——与 `weave init` 落盘同一套生成器,不存在第二份期望态。
36
+ */
37
+ export declare function generateInitFiles(harness: Harness, ctx: InitFileContext): Promise<InitGeneratedFile[]>;
@@ -0,0 +1,2 @@
1
+ import i from"node:path";import{generateHookHandler as p,readUserCapture as u}from"../claude/capture.js";import{generateAutoMemoryHook as m}from"../claude/helpers-gen.js";import{generateMcpJson as c,mergeMcpJson as f}from"../claude/mcp-gen.js";import{generateSettingsJson as h,mergeSettingsJson as g}from"../claude/settings-gen.js";export const WEAVE_CONTENT_MARKER="@version weave@";const d={preToolUse:!1,postToolUse:!1,userPromptSubmit:!1,sessionStart:!1,stop:!1,stopFailure:!1,subagentStop:!1,subagentStart:!1,notification:!1,postToolUseFailure:!1,permissionRequest:!1,permissionDenied:!1,preCompact:!1,sessionEnd:!1,preModelSwitch:!1,timeout:5e3,continueOnError:!0};function a(e){try{const o=JSON.parse(e);return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null}catch{return null}}function t(e){return JSON.stringify(e,null,2)+`
2
+ `}function l(e){return(o,s)=>{const n=a(o),r=a(s);return n===null||r===null?null:t(e(n,r))}}async function S(e){const o=i.join(e.projectPath,".claude","helpers"),n=(await u({home:e.platform.homeDir})).installed?d:e.hooks,r=[];return e.components.helpers&&r.push({relPath:".claude/helpers/hook-handler.cjs",weaveMarker:WEAVE_CONTENT_MARKER,content:p(e.version)},{relPath:".claude/helpers/auto-memory-hook.mjs",weaveMarker:WEAVE_CONTENT_MARKER,content:m(e.version)}),e.components.settings&&r.push({relPath:".claude/settings.json",content:t(h({components:e.components,hooks:n,platform:e.platform,helpersDir:o})),merge:l(g)}),e.components.mcp&&e.mcp.weave&&r.push({relPath:".mcp.json",content:t(c({platform:e.platform,includeWeaveServer:!0})),merge:l(f)}),r}const E={claude:S,codex:async()=>[]};export function generateInitFiles(e,o){return E[e](o)}
@@ -1,2 +1,2 @@
1
- import{readdir as h,readFile as p,unlink as g,writeFile as A}from"node:fs/promises";import r from"node:path";import{ensureDir as m,fileExists as S,writeFileIfAbsent as b}from"@weavecode/core";export class InitPipeline{ctx;skipped=[];skipReasons=new Map;constructor(t){this.ctx=t}async runSurface(){await this.ensureDirs(),await this.writeSettings(),await this.writeMcp(),await this.copySkills(),await this.copyCommands(),await this.copyAgents(),await this.injectPluginTemplates(),await this.writeHelpers()}injectPluginTemplates(){}skip(t,i){this.skipped.push(t),this.skipReasons.set(t,i)}async writeOrMergeJson(t,i,n){if(!n&&await S(t)){const s=await D(t);return s===void 0?!1:(await j(t,d(s,i)),!0)}return await j(t,i),!0}async copyDirIfAbsent(t,i,n=!1){let s;try{s=await h(t,{withFileTypes:!0})}catch{return}await m(i);for(const e of s){const o=r.join(t,e.name),c=r.join(i,e.name);if(e.isDirectory())await this.copyDirIfAbsent(o,c,n);else{const u=await p(o,"utf-8");await b(c,u,n)}}}async sweepMarked(t,i,n){const s=new Set(i),e=[],o=async c=>{let u;try{u=await h(c,{withFileTypes:!0})}catch{return}for(const f of u){const w=r.join(c,f.name);if(f.isDirectory()){await o(w);continue}const k=r.relative(t,w).split(r.sep).join("/");if(s.has(k))continue;const y=await p(w,"utf-8").catch(()=>null);y!==null&&y.includes(n)&&(await g(w),e.push(w))}};return await o(t),e}}function d(a,t){const i={...a};for(const[n,s]of Object.entries(t)){const e=i[n];i[n]=l(e)&&l(s)?d(e,s):s}return i}function l(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}async function D(a){try{const t=await p(a,"utf-8"),i=JSON.parse(t);return l(i)?i:void 0}catch{return}}async function j(a,t){await m(r.dirname(a)),await A(a,JSON.stringify(t,null,2)+`
1
+ import{readdir as d,readFile as p,unlink as g,writeFile as S}from"node:fs/promises";import r from"node:path";import{ensureDir as h,fileExists as b,writeFileIfAbsent as A}from"@weavecode/core";export class InitPipeline{ctx;skipped=[];skipReasons=new Map;constructor(t){this.ctx=t}async runSurface(){await this.ensureDirs(),await this.writeSettings(),await this.writeMcp(),await this.copySkills(),await this.copyCommands(),await this.copyAgents(),await this.injectPluginTemplates(),await this.writeHelpers()}injectPluginTemplates(){}skip(t,e){this.skipped.push(t),this.skipReasons.set(t,e)}async writeOrMergeJson(t,e,s){if(!s&&await b(t)){const n=await x(t);return n===void 0?!1:(await k(t,m(n,e)),!0)}return await k(t,e),!0}async copyDirIfAbsent(t,e,s=!1){let n;try{n=await d(t,{withFileTypes:!0})}catch{return}await h(e);for(const a of n){const o=r.join(t,a.name),c=r.join(e,a.name);if(a.isDirectory())await this.copyDirIfAbsent(o,c,s);else{const w=await p(o,"utf-8");await A(c,w,s)}}}async sweepMarked(t,e,s){const n=new Set(e),a=[],o=async c=>{let w;try{w=await d(c,{withFileTypes:!0})}catch{return}for(const l of w){const u=r.join(c,l.name);if(l.isDirectory()){await o(u);continue}const j=r.relative(t,u).split(r.sep).join("/");if(n.has(j))continue;const y=await p(u,"utf-8").catch(()=>null);y!==null&&y.includes(s)&&(await g(u),a.push(u))}};return await o(t),a}}function m(i,t){const e={...i};for(const[s,n]of Object.entries(t)){const a=e[s];e[s]=f(a)&&f(n)?m(a,n):n}return e}function f(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}async function x(i){try{const t=await p(i,"utf-8"),e=JSON.parse(t);return f(e)?e:void 0}catch{return}}async function k(i,t){await h(r.dirname(i)),await S(i,JSON.stringify(t,null,2)+`
2
2
  `,"utf-8")}
@@ -4,7 +4,9 @@ import { HarnessRegistry, type HarnessDriver } from './driver.js';
4
4
  * 编译失败);注册与消费皆由本表派生,不再手写 id 清单。
5
5
  *
6
6
  * init 槽不在此(init 实现半球留 cli,由 `weave-cli/src/init/wiring.ts`
7
- * unregister + 携带 init 重新注册)。
7
+ * unregister + 携带 init 重新注册)——但 init 的**生成期望态**在 harness
8
+ * (`init/generated.ts`),daemon 的 init 文件漂移检测/自动同步直接调它,
9
+ * 与 cli 落盘同一套生成器。
8
10
  */
9
11
  export declare const HARNESS_DRIVERS: {
10
12
  claude: HarnessDriver;
@@ -1 +1 @@
1
- import{CLAUDE_DRIVER as t}from"./claude/index.js";import{CODEX_DRIVER as o}from"./codex/index.js";import{HarnessRegistry as s}from"./driver.js";export const HARNESS_DRIVERS={claude:t,codex:o};export function registerRuntimeDrivers(r){for(const e of Object.values(HARNESS_DRIVERS))r.register(e)}export function createRuntimeRegistry(){const r=new s;return registerRuntimeDrivers(r),r}
1
+ import{CLAUDE_DRIVER as t}from"./claude/index.js";import{CODEX_DRIVER as o}from"./codex/index.js";import{HarnessRegistry as i}from"./driver.js";export const HARNESS_DRIVERS={claude:t,codex:o};export function registerRuntimeDrivers(r){for(const e of Object.values(HARNESS_DRIVERS))r.register(e)}export function createRuntimeRegistry(){const r=new i;return registerRuntimeDrivers(r),r}
@@ -1 +1 @@
1
- import{cp as c,lstat as e,mkdir as s,rm as l,symlink as m,unlink as u}from"node:fs/promises";import o from"node:path";export async function linkOrCopy(r,t){const n=o.resolve(r);await s(o.dirname(t),{recursive:!0});try{return await m(n,t,process.platform==="win32"?"junction":"dir"),"link"}catch(a){const i=a.code;if(i!=="EPERM"&&i!=="EEXIST"&&i!=="ENOTSUP")throw a}return await c(n,t,{recursive:!0}),"copy"}export async function removeInstalled(r){let t;try{t=await e(r)}catch{return"absent"}return t.isSymbolicLink()?(await u(r),"link"):(await l(r,{recursive:!0,force:!0}),"removed")}export async function installForm(r){try{return(await e(r)).isSymbolicLink()?"link":"copy"}catch{return"absent"}}
1
+ import{cp as a,lstat as c,mkdir as s,rm as u,symlink as l,unlink as m}from"node:fs/promises";import o from"node:path";export async function linkOrCopy(r,t){const i=o.resolve(r);await s(o.dirname(t),{recursive:!0});try{return await l(i,t,process.platform==="win32"?"junction":"dir"),"link"}catch(e){const n=e.code;if(n!=="EPERM"&&n!=="EEXIST"&&n!=="ENOTSUP")throw e}return await a(i,t,{recursive:!0}),"copy"}export async function removeInstalled(r){let t;try{t=await c(r)}catch{return"absent"}return t.isSymbolicLink()?(await m(r),"link"):(await u(r,{recursive:!0,force:!0}),"removed")}export async function installForm(r){try{return(await c(r)).isSymbolicLink()?"link":"copy"}catch{return"absent"}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/harness",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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.0",
23
+ "@weavecode/core": "^0.1.1",
24
24
  "smol-toml": "^1.3.0"
25
25
  }
26
26
  }