@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
@@ -1,4 +1,4 @@
1
- import c from"node:path";import{CONTEXT_STYLE_FORMAT as d,POWERLINE_DEFAULT_GLYPHS as e,SEGMENT_DEFAULT_FORMAT as p,SEGMENT_ORDER as f}from"./config.js";import{getDataDir as h}from"../db/paths.js";import{WEAVE_VERSION as g}from"../version.js";export function statuslineCacheDir(){return c.join(h(),"statusline")}const m={gray:"90",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36"},v={gray:"100",red:"41",green:"42",yellow:"43",blue:"44",magenta:"45",cyan:"46"},y="\u2588",b="\u2591",w=10,_=8*1024*1024,t=5e3,k=3600,E=5,C=5;export function generateStatuslineScript(r,n={}){const s=JSON.stringify(r),i=JSON.stringify(n.cacheDir??statuslineCacheDir()),a=JSON.stringify(m),o=JSON.stringify(v),u=JSON.stringify(p),l=JSON.stringify(d);return`#!/usr/bin/env node
1
+ import c from"node:path";import{CONTEXT_STYLE_FORMAT as d,POWERLINE_DEFAULT_GLYPHS as e,SEGMENT_DEFAULT_FORMAT as p,SEGMENT_ORDER as f}from"./config.js";import{getDataDir as h}from"../db/paths.js";import{WEAVE_VERSION as g}from"../version.js";export function statuslineCacheDir(){return c.join(h(),"statusline")}const m={gray:"90",red:"31",green:"32",yellow:"33",blue:"34",magenta:"35",cyan:"36"},v={gray:"100",red:"41",green:"42",yellow:"43",blue:"44",magenta:"45",cyan:"46"},b="\u2588",y="\u2591",w=10,_=8*1024*1024,t=5e3,C=3600,k=60,T=60,I=5;export function generateStatuslineScript(r,n={}){const s=JSON.stringify(r),i=JSON.stringify(n.cacheDir??statuslineCacheDir()),a=JSON.stringify(m),o=JSON.stringify(v),l=JSON.stringify(p),u=JSON.stringify(d);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.
@@ -10,14 +10,15 @@ import c from"node:path";import{CONTEXT_STYLE_FORMAT as d,POWERLINE_DEFAULT_GLYP
10
10
  const CONFIG = ${s};
11
11
  const ANSI = ${a};
12
12
  const BG = ${o};
13
- const SEGMENT_FORMAT = ${u};
14
- const CONTEXT_FORMAT = ${l};
15
- const BAR_FILL = '${y}';
16
- const BAR_EMPTY = '${b}';
13
+ const SEGMENT_FORMAT = ${l};
14
+ const CONTEXT_FORMAT = ${u};
15
+ const BAR_FILL = '${b}';
16
+ const BAR_EMPTY = '${y}';
17
17
  const BAR_CELLS = ${w};
18
- const GIT_IDENTITY_TTL = ${k};
19
- const GIT_CHANGES_TTL = ${E};
20
- const GIT_RETRY_TTL = ${C};
18
+ const GIT_IDENTITY_TTL = ${C};
19
+ const GIT_CHANGES_TTL = ${k};
20
+ const GIT_BRANCH_TTL = ${T};
21
+ const GIT_RETRY_TTL = ${I};
21
22
  const CACHE_DIR = ${i};
22
23
  // Stamped into the row-0 logo so the running version is always visible.
23
24
  const WEAVE_VERSION = ${JSON.stringify(g)};
@@ -87,11 +88,10 @@ function dim(text) {
87
88
 
88
89
  // --- render cache -----------------------------------------------------------
89
90
  // Every render is a fresh process, so the file \u2014 not the process \u2014 is what
90
- // carries the git segment values and the transcript scan across renders. One
91
- // file per session under CACHE_DIR; the layers inside it are keyed by directory
92
- // (git) and transcript (tokens), so a session that moves between directories
93
- // adds an entry instead of a file. The daemon's sweeper drops expired entries
94
- // and files of sessions that stopped rendering.
91
+ // carries the transcript scan across renders. One file per session under
92
+ // CACHE_DIR; the git segments do NOT live here (see GIT_FILE below) because
93
+ // they describe the worktree rather than the session. The daemon's sweeper
94
+ // drops expired entries and files of sessions that stopped rendering.
95
95
  //
96
96
  // Top level on purpose: flush() below writes it after main() returns, so a
97
97
  // render that throws half-way still keeps what it had already scanned.
@@ -100,6 +100,15 @@ var CACHE = null;
100
100
  // \u53EA\u5728\u771F\u6709\u6761\u76EE\u843D\u5B9A\u65F6\u624D\u56DE\u5199\uFF1A\u7EAF\u547D\u4E2D\u7684\u6E32\u67D3\u96F6\u5199\u76D8\uFF08\u65E7\u5B9E\u73B0\u540C\u6837\u53EA\u5728\u672A\u547D\u4E2D\u65F6\u5199\uFF09\u3002
101
101
  var CACHE_DIRTY = false;
102
102
 
103
+ // Git \u6BB5\u63CF\u8FF0\u7684\u662F\u5DE5\u4F5C\u533A\uFF0C\u4E0D\u662F\u4F1A\u8BDD\uFF1A\u540C\u4E00\u9879\u76EE\u7684\u6BCF\u4E2A\u4F1A\u8BDD\u90FD\u5728\u95EE\u540C\u4E00\u4E2A\u95EE\u9898\u3002\u6240\u4EE5
104
+ // \u5B83\u53E6\u5B58\u4E00\u4EFD\u6309\u76EE\u5F55\u5206\u7247\u7684\u6587\u4EF6\uFF08git-<cwd \u6458\u8981>.json\uFF09\uFF0C\u5404\u4F1A\u8BDD\u5171\u4EAB\u2014\u2014\u4E00\u4E2A TTL \u5185
105
+ // \u6574\u4E2A\u9879\u76EE\u53EA\u4ED8\u4E00\u6B21 git \u5B50\u8FDB\u7A0B\uFF0C\u6709\u591A\u5C11\u4F1A\u8BDD\u5728\u6E32\u67D3\u90FD\u4E00\u6837\u3002\u6761\u76EE\u952E\u56E0\u6B64\u53EA\u662F
106
+ // branch / git_user / changes \u4E09\u6837\uFF0C\u4E0D\u5E26\u76EE\u5F55\uFF08\u76EE\u5F55\u5DF2\u7ECF\u662F\u6587\u4EF6\u540D\u4E86\uFF09\u3002\u5E76\u53D1\u5199\u7528\u540C\u4E00\u5957
107
+ // tmp+rename\uFF0C\u540E\u5199\u7684\u6574\u4EFD\u8986\u76D6\u5148\u5199\u7684\uFF08\u4E22\u4E00\u6761\u8FC7\u671F\u6761\u76EE\u53EA\u4F1A\u8BA9\u4E0B\u6B21\u91CD\u63A2\u4E00\u6B21\uFF09\u3002
108
+ var GIT_FILE = null;
109
+ var GIT_CACHE = null;
110
+ var GIT_DIRTY = false;
111
+
103
112
  // Session key: Claude Code's session id, then the transcript basename, then a
104
113
  // cwd digest for hosts that send neither.
105
114
  function cacheKeyOf(input) {
@@ -116,7 +125,14 @@ function cacheKeyOf(input) {
116
125
 
117
126
  function initCache(input) {
118
127
  var path = require('path');
128
+ var crypto = require('crypto');
119
129
  CACHE_FILE = path.join(CACHE_DIR, cacheKeyOf(input) + '.json');
130
+ var cwd = (input.workspace && input.workspace.current_dir) || process.cwd();
131
+ // \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
132
+ var dirKey = crypto.createHash('sha1')
133
+ .update(String(cwd).toLowerCase().replace(/\\\\/g, '/').replace(/\\/+$/, ''))
134
+ .digest('hex').slice(0, 16);
135
+ GIT_FILE = path.join(CACHE_DIR, 'git-' + dirKey + '.json');
120
136
  }
121
137
 
122
138
  // Lazily read once per render: a render that touches no cached segment must not
@@ -128,28 +144,49 @@ function cache() {
128
144
  try { loaded = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8')); } catch (e) {}
129
145
  CACHE = loaded && typeof loaded === 'object' ? loaded : {};
130
146
  CACHE.v = 1;
131
- if (!CACHE.git || typeof CACHE.git !== 'object') CACHE.git = {};
132
147
  if (!CACHE.tokens || typeof CACHE.tokens !== 'object') CACHE.tokens = {};
133
148
  return CACHE;
134
149
  }
135
150
 
136
- function flushCache() {
137
- if (!CACHE || !CACHE_FILE || !CACHE_DIRTY) return;
151
+ // \u5F62\u72B6\u4E0E sweeper \u7684\u5224\u636E\u4E00\u81F4\uFF08git \u6761\u76EE + tokens\uFF09\uFF0C\u5171\u4EAB\u6587\u4EF6\u56E0\u6B64\u4E0D\u5FC5\u53E6\u7ACB\u56DE\u6536\u89C4\u5219\uFF1A
152
+ // \u6761\u76EE\u5168\u90E8\u8FC7\u671F\u65F6\u5B83\u6309\u300C\u4E24\u680F\u90FD\u7A7A\u300D\u628A\u6587\u4EF6\u5220\u6389\u3002
153
+ function gitCache() {
154
+ if (GIT_CACHE) return GIT_CACHE;
155
+ var fs = require('fs');
156
+ var loaded = null;
157
+ try { loaded = JSON.parse(fs.readFileSync(GIT_FILE, 'utf8')); } catch (e) {}
158
+ GIT_CACHE = loaded && typeof loaded === 'object' ? loaded : {};
159
+ GIT_CACHE.v = 1;
160
+ if (!GIT_CACHE.git || typeof GIT_CACHE.git !== 'object') GIT_CACHE.git = {};
161
+ return GIT_CACHE;
162
+ }
163
+
164
+ function writeCacheFile(file, data) {
138
165
  var fs = require('fs');
139
166
  var path = require('path');
140
- CACHE.updatedAt = Date.now();
141
- var tmp = CACHE_FILE + '.' + process.pid + '.tmp';
142
- var payload = JSON.stringify(CACHE);
167
+ data.updatedAt = Date.now();
168
+ var tmp = file + '.' + process.pid + '.tmp';
169
+ var payload = JSON.stringify(data);
143
170
  // atomic replace: renders overlap while Claude Code re-runs on a debounce
144
- function put() { fs.writeFileSync(tmp, payload); fs.renameSync(tmp, CACHE_FILE); }
171
+ function put() { fs.writeFileSync(tmp, payload); fs.renameSync(tmp, file); }
145
172
  try {
146
173
  put();
147
174
  } catch (e) {
148
175
  // steady state the directory is already there \u2014 pay mkdir only when it is not
149
- try { fs.mkdirSync(path.dirname(CACHE_FILE), { recursive: true }); put(); } catch (e2) {}
176
+ try { fs.mkdirSync(path.dirname(file), { recursive: true }); put(); } catch (e2) {}
150
177
  }
151
178
  }
152
179
 
180
+ function flushCache() {
181
+ if (!CACHE || !CACHE_FILE || !CACHE_DIRTY) return;
182
+ writeCacheFile(CACHE_FILE, CACHE);
183
+ }
184
+
185
+ function flushGitCache() {
186
+ if (!GIT_CACHE || !GIT_FILE || !GIT_DIRTY) return;
187
+ writeCacheFile(GIT_FILE, GIT_CACHE);
188
+ }
189
+
153
190
  // Git-derived segments cost a subprocess each, and Claude Code re-invokes us far
154
191
  // more often than the value changes. A failed lookup \u2014 not a repo, git missing
155
192
  // from PATH \u2014 is cached too, so a directory that never has git stops being
@@ -157,13 +194,13 @@ function flushCache() {
157
194
  // a failure for an identity's full TTL would hide the segment for an hour.
158
195
  function cachedGit(key, ttlSec, produce) {
159
196
  var now = Date.now();
160
- var store = cache();
197
+ var store = gitCache();
161
198
  var hit = store.git[key];
162
199
  if (hit && hit.expires > now) return hit.value;
163
200
  var value = produce();
164
201
  var ttl = value == null ? Math.min(ttlSec, GIT_RETRY_TTL) : ttlSec;
165
202
  store.git[key] = { expires: now + ttl * 1000, value: value };
166
- CACHE_DIRTY = true;
203
+ GIT_DIRTY = true;
167
204
  return value;
168
205
  }
169
206
 
@@ -365,30 +402,33 @@ function segmentTokens(key, seg) {
365
402
  var name = path.basename(cwd);
366
403
  return cwd ? { name: name, path: cwd } : null;
367
404
  }
368
- case 'git':
369
- try {
370
- var branch = require('child_process').execFileSync(
371
- 'git', ['rev-parse', '--abbrev-ref', 'HEAD'],
372
- { cwd: cwd, stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000, windowsHide: true }
373
- ).toString().trim();
374
- if (!branch) return null;
375
- // workspace.repo is optional (parsed from the git remote) \u2014 the token
376
- // stays empty when absent so the default {branch} format is unaffected.
377
- var repoInfo = input.workspace && input.workspace.repo;
378
- return {
379
- branch: branch,
380
- repo: repoInfo && repoInfo.owner ? repoInfo.owner + '/' + repoInfo.name : ''
381
- };
382
- } catch (e) { return null; }
405
+ case 'git': {
406
+ var branch = cachedGit('branch', GIT_BRANCH_TTL, function () {
407
+ try {
408
+ return require('child_process').execFileSync(
409
+ 'git', ['rev-parse', '--abbrev-ref', 'HEAD'],
410
+ { cwd: cwd, stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000, windowsHide: true }
411
+ ).toString().trim() || null;
412
+ } catch (e) { return null; }
413
+ });
414
+ if (!branch) return null;
415
+ // workspace.repo is optional (parsed from the git remote) \u2014 the token
416
+ // stays empty when absent so the default {branch} format is unaffected.
417
+ var repoInfo = input.workspace && input.workspace.repo;
418
+ return {
419
+ branch: branch,
420
+ repo: repoInfo && repoInfo.owner ? repoInfo.owner + '/' + repoInfo.name : ''
421
+ };
422
+ }
383
423
  case 'git_user':
384
- return cachedGit('git_user:' + cwd, GIT_IDENTITY_TTL, function () {
424
+ return cachedGit('git_user', GIT_IDENTITY_TTL, function () {
385
425
  // Both fields must be set \u2014 a partial identity would render 'name <>'
386
426
  var gitUser = gitConfigValue(cwd, 'user.name');
387
427
  var gitEmail = gitConfigValue(cwd, 'user.email');
388
428
  return gitUser && gitEmail ? { user: gitUser, email: gitEmail } : null;
389
429
  });
390
430
  case 'changes':
391
- return cachedGit('changes:' + cwd, GIT_CHANGES_TTL, function () {
431
+ return cachedGit('changes', GIT_CHANGES_TTL, function () {
392
432
  var diff = gitNumstat(cwd);
393
433
  return diff ? { added: diff.added, deleted: diff.deleted, files: diff.files } : null;
394
434
  });
@@ -665,6 +705,7 @@ function flush() {
665
705
  try { main(raw); } catch (e) {}
666
706
  // \u7F13\u5B58\u56DE\u5199\u5728\u6E32\u67D3\u4E4B\u540E\uFF1A\u4E3B\u6D41\u7A0B\u4E2D\u9014\u629B\u9519\u4E5F\u4FDD\u4F4F\u8FD9\u4E00\u8F6E\u626B\u5230\u7684\u589E\u91CF
667
707
  try { flushCache(); } catch (e) {}
708
+ try { flushGitCache(); } catch (e) {}
668
709
  process.exit(0);
669
710
  }
670
711
  process.stdin.setEncoding('utf8');
@@ -1,4 +1,6 @@
1
1
  import { type StatuslineConfig } from './config.js';
2
+ /** 生成脚本的项目根相对落点(posix)——init 文件漂移检测的比对面。 */
3
+ export declare function statuslineScriptRelPath(): string;
2
4
  /** Point the global template directory elsewhere (tests use a temp dir). */
3
5
  export declare function setGlobalStatuslineDir(dir: string): void;
4
6
  /** Read the user's global statusline template; falls back to the default. */
@@ -1,4 +1,4 @@
1
- import{readFile as u,writeFile as f,mkdir as p,access as C}from"node:fs/promises";import{homedir as j}from"node:os";import s from"node:path";import{DEFAULT_STATUSLINE_CONFIG as i,LEGACY_IDENTITY_LINE as v,LEGACY_METRICS_LINE as x,NAMED_COLORS as N,SEGMENT_ORDER as y}from"./config.js";import{generateStatuslineScript as $}from"./generator.js";const b=".weave",S="statusline.json",g=".claude/helpers",m="statusline.cjs",E=".claude/settings.json",h="statusline.json";let d=s.join(j(),".weave");export function setGlobalStatuslineDir(e){d=e}async function I(e){try{return await C(e),!0}catch{return!1}}export async function readGlobalStatuslineConfig(){try{const e=await u(s.join(d,h),"utf-8");return{...l(JSON.parse(e)),source:"global"}}catch{return i}}export async function writeGlobalStatuslineConfig(e){await p(d,{recursive:!0});const r={...l(e),source:"global"};await f(s.join(d,h),`${JSON.stringify(r,null,2)}
2
- `,"utf-8")}export async function readStatuslineConfig(e){const r=await readGlobalStatuslineConfig();try{const t=await u(s.join(e,b,S),"utf-8"),n=JSON.parse(t);return n.source==="custom"?l(n):r}catch{return r}}export async function writeStatuslineConfig(e,r){const t=s.join(e,b);await p(t,{recursive:!0});const n=(r.source??"global")==="global"?{source:"global"}:l(r);await f(s.join(t,S),`${JSON.stringify(n,null,2)}
3
- `,"utf-8")}export async function writeStatuslineScript(e,r){const t=s.join(e,g);await p(t,{recursive:!0});const n=s.join(t,m);return await f(n,r,"utf-8"),n}export async function readStatuslineScript(e){try{return await u(s.join(e,g,m),"utf-8")}catch{return""}}export async function ensureSettingsStatusLine(e,r=30){const t=s.join(e,E),n=process.platform==="win32";let o={};if(await I(t))try{o=JSON.parse(await u(t,"utf-8"))}catch{o={}}const a=s.join(e,g,m),c=n?`node "${a}"`:`node ${a}`;o.statusLine={type:"command",command:c,padding:0,refreshInterval:Math.max(1,Math.round(r))},await p(s.dirname(t),{recursive:!0}),await f(t,`${JSON.stringify(o,null,2)}
4
- `,"utf-8")}export async function applyStatuslineConfig(e,r){await writeStatuslineConfig(e,r);const t=(r.source??"global")==="global"?await readGlobalStatuslineConfig():l(r),n=$(t);await writeStatuslineScript(e,n),await ensureSettingsStatusLine(e,t.refreshInterval)}function L(e){let r,t=!1;if(e.lines?.length)r=e.lines.map(o=>[...o]);else if(e.order?.length){t=!0;const o=e.order;e.layout==="multi"?r=[v.filter(a=>o.includes(a)),x.filter(a=>o.includes(a))].filter(a=>a.length>0):r=[o]}else t=!0,r=i.lines.map(o=>[...o]);const n=new Set;if(r=r.map(o=>o.filter(a=>!y.includes(a)||n.has(a)?!1:(n.add(a),!0))),r.length===0&&(r=[[]]),t){const o=y.filter(a=>{if(n.has(a))return!1;const c=e.segments?.[a];return typeof c?.enabled=="boolean"?c.enabled:i.segments[a].enabled});o.length&&(r[0]=[...r[0],...o])}return r}const O=/^#[0-9a-fA-F]{6}$/,_=/^#([0-9a-fA-F]{3})$/,T=/^ansi256:(\d{1,3})$/;function w(e,r){if(typeof e!="string")return r;if(N.includes(e))return e;const t=T.exec(e);if(t){const o=Number(t[1]);return o>=0&&o<=255?`ansi256:${o}`:r}if(O.test(e))return e.toLowerCase();const n=_.exec(e);if(n){const[,o]=n;return`#${o[0]}${o[0]}${o[1]}${o[1]}${o[2]}${o[2]}`.toLowerCase()}return r}function A(e,r){if(!e||typeof e!="object")return{...r};const t=e,n={...r,...t,color:w(t.color,r.color),backgroundColor:t.backgroundColor==null?null:w(t.backgroundColor,r.backgroundColor??"gray")};return(typeof t.label!="string"||t.label==="")&&delete n.label,(typeof t.format!="string"||t.format==="")&&delete n.format,t.metric!=="session"&&t.metric!=="context"&&delete n.metric,t.window!=="five_hour"&&t.window!=="seven_day"&&t.window!=="spend"&&delete n.window,n}function F(e){const r=i.bar;if(!e||typeof e!="object")return{...r};const t=e,n=Math.round(Number(t.cells));return{cells:Number.isFinite(n)?Math.max(1,Math.min(40,n)):r.cells,fill:typeof t.fill=="string"&&t.fill!==""?t.fill:r.fill,empty:typeof t.empty=="string"&&t.empty!==""?t.empty:r.empty}}function l(e){const r={...i.segments};for(const n of Object.keys(r))r[n]=A(e.segments?.[n],r[n]);const t=e.refreshInterval;return{separator:e.separator??i.separator,align:e.align??i.align,logoText:i.logoText,logoColor:w(e.logoColor,i.logoColor),powerline:{...e.powerline,enabled:e.powerline?.enabled??i.powerline.enabled},lines:L(e),refreshInterval:t!=null&&t>=1?t:i.refreshInterval,source:e.source??i.source,bar:F(e.bar),divider:typeof e.divider=="string"?e.divider:i.divider,labelSeparator:typeof e.labelSeparator=="string"?e.labelSeparator:i.labelSeparator,segments:r}}
1
+ import{readFile as u,writeFile as f,mkdir as g,access as E}from"node:fs/promises";import{homedir as I}from"node:os";import l from"node:path";import{DEFAULT_STATUSLINE_CONFIG as s,LEGACY_IDENTITY_LINE as C,LEGACY_METRICS_LINE as L,NAMED_COLORS as N,SEGMENT_ORDER as w}from"./config.js";import{generateStatuslineScript as x}from"./generator.js";const y=".weave",b="statusline.json",m=".claude/helpers",d="statusline.cjs",T=".claude/settings.json",h="statusline.json";export function statuslineScriptRelPath(){return`${m}/${d}`}let p=l.join(I(),".weave");export function setGlobalStatuslineDir(t){p=t}async function _(t){try{return await E(t),!0}catch{return!1}}export async function readGlobalStatuslineConfig(){try{const t=await u(l.join(p,h),"utf-8");return{...a(JSON.parse(t)),source:"global"}}catch{return s}}export async function writeGlobalStatuslineConfig(t){await g(p,{recursive:!0});const n={...a(t),source:"global"};await f(l.join(p,h),`${JSON.stringify(n,null,2)}
2
+ `,"utf-8")}export async function readStatuslineConfig(t){const n=await readGlobalStatuslineConfig();try{const e=await u(l.join(t,y,b),"utf-8"),r=JSON.parse(e);return r.source==="custom"?a(r):n}catch{return n}}export async function writeStatuslineConfig(t,n){const e=l.join(t,y);await g(e,{recursive:!0});const o=(n.source??"global")==="global"?{source:"global"}:a(n);await f(l.join(e,b),`${JSON.stringify(o,null,2)}
3
+ `,"utf-8")}export async function writeStatuslineScript(t,n){const e=l.join(t,m);await g(e,{recursive:!0});const r=l.join(e,d);return await f(r,n,"utf-8"),r}export async function readStatuslineScript(t){try{return await u(l.join(t,m,d),"utf-8")}catch{return""}}export async function ensureSettingsStatusLine(t,n=30){const e=l.join(t,T),r=process.platform==="win32";let o={};if(await _(e))try{o=JSON.parse(await u(e,"utf-8"))}catch{o={}}const i=l.join(t,m,d),c=r?`node "${i}"`:`node ${i}`;o.statusLine={type:"command",command:c,padding:0,refreshInterval:Math.max(1,Math.round(n))},await g(l.dirname(e),{recursive:!0}),await f(e,`${JSON.stringify(o,null,2)}
4
+ `,"utf-8")}export async function applyStatuslineConfig(t,n){await writeStatuslineConfig(t,n);const e=(n.source??"global")==="global"?await readGlobalStatuslineConfig():a(n),r=x(e);await writeStatuslineScript(t,r),await ensureSettingsStatusLine(t,e.refreshInterval)}function $(t){let n,e=!1;if(t.lines?.length)n=t.lines.map(o=>[...o]);else if(t.order?.length){e=!0;const o=t.order;t.layout==="multi"?n=[C.filter(i=>o.includes(i)),L.filter(i=>o.includes(i))].filter(i=>i.length>0):n=[o]}else e=!0,n=s.lines.map(o=>[...o]);const r=new Set;if(n=n.map(o=>o.filter(i=>!w.includes(i)||r.has(i)?!1:(r.add(i),!0))),n.length===0&&(n=[[]]),e){const o=w.filter(i=>{if(r.has(i))return!1;const c=t.segments?.[i];return typeof c?.enabled=="boolean"?c.enabled:s.segments[i].enabled});o.length&&(n[0]=[...n[0],...o])}return n}const j=/^#[0-9a-fA-F]{6}$/,v=/^#([0-9a-fA-F]{3})$/,A=/^ansi256:(\d{1,3})$/;function S(t,n){if(typeof t!="string")return n;if(N.includes(t))return t;const e=A.exec(t);if(e){const o=Number(e[1]);return o>=0&&o<=255?`ansi256:${o}`:n}if(j.test(t))return t.toLowerCase();const r=v.exec(t);if(r){const[,o]=r;return`#${o[0]}${o[0]}${o[1]}${o[1]}${o[2]}${o[2]}`.toLowerCase()}return n}function O(t,n){if(!t||typeof t!="object")return{...n};const e=t,r={...n,...e,color:S(e.color,n.color),backgroundColor:e.backgroundColor==null?null:S(e.backgroundColor,n.backgroundColor??"gray")};return(typeof e.label!="string"||e.label==="")&&delete r.label,(typeof e.format!="string"||e.format==="")&&delete r.format,e.metric!=="session"&&e.metric!=="context"&&delete r.metric,e.window!=="five_hour"&&e.window!=="seven_day"&&e.window!=="spend"&&delete r.window,r}function F(t){const n=s.bar;if(!t||typeof t!="object")return{...n};const e=t,r=Math.round(Number(e.cells));return{cells:Number.isFinite(r)?Math.max(1,Math.min(40,r)):n.cells,fill:typeof e.fill=="string"&&e.fill!==""?e.fill:n.fill,empty:typeof e.empty=="string"&&e.empty!==""?e.empty:n.empty}}function a(t){const n={...s.segments};for(const r of Object.keys(n))n[r]=O(t.segments?.[r],n[r]);const e=t.refreshInterval;return{separator:t.separator??s.separator,align:t.align??s.align,logoText:s.logoText,logoColor:S(t.logoColor,s.logoColor),powerline:{...t.powerline,enabled:t.powerline?.enabled??s.powerline.enabled},lines:$(t),refreshInterval:e!=null&&e>=1?e:s.refreshInterval,source:t.source??s.source,bar:F(t.bar),divider:typeof t.divider=="string"?t.divider:s.divider,labelSeparator:typeof t.labelSeparator=="string"?t.labelSeparator:s.labelSeparator,segments:n}}
@@ -1 +1 @@
1
- import{createRuntimeRegistry as n}from"@weavecode/harness";const t=n();export function assetSurfaceFor(r){const e=t.get(r)?.assets;if(!e)throw new Error(`no asset surface registered for harness: ${r}`);return e}export function assetSurfaces(){return t.all().map(r=>r.assets).filter(r=>r!==void 0)}export function pluginSurfaceFor(r){const e=t.get(r)?.plugins;if(!e)throw new Error(`no plugin surface registered for harness: ${r}`);return e}export function pluginSurfaces(){return t.all().filter(r=>r.plugins!==void 0).map(r=>({harness:r.id,surface:r.plugins}))}export function pluginStateFor(r){const e=t.get(r)?.pluginState;if(!e)throw new Error(`no plugin state surface registered for harness: ${r}`);return e}export function pluginStateSurfaces(){return t.all().filter(r=>r.pluginState!==void 0).map(r=>({harness:r.id,state:r.pluginState}))}export function messagingSurfaceFor(r){const e=t.get(r)?.messaging;if(!e)throw new Error(`no messaging surface registered for harness: ${r}`);return e}export function messagingSurfaces(){return t.all().filter(r=>r.messaging!==void 0).map(r=>({harness:r.id,surface:r.messaging}))}export function captureSurfaces(){return t.all().filter(r=>r.capture!==void 0).map(r=>({harness:r.id,surface:r.capture}))}export function blockingPromptFor(r){return t.get(r)?.questions??null}
1
+ import{createRuntimeRegistry as n}from"@weavecode/harness";const t=n();export function assetSurfaceFor(e){const r=t.get(e)?.assets;if(!r)throw new Error(`no asset surface registered for harness: ${e}`);return r}export function assetSurfaces(){return t.all().map(e=>e.assets).filter(e=>e!==void 0)}export function pluginSurfaceFor(e){const r=t.get(e)?.plugins;if(!r)throw new Error(`no plugin surface registered for harness: ${e}`);return r}export function pluginSurfaces(){return t.all().filter(e=>e.plugins!==void 0).map(e=>({harness:e.id,surface:e.plugins}))}export function pluginStateFor(e){const r=t.get(e)?.pluginState;if(!r)throw new Error(`no plugin state surface registered for harness: ${e}`);return r}export function pluginStateSurfaces(){return t.all().filter(e=>e.pluginState!==void 0).map(e=>({harness:e.id,state:e.pluginState}))}export function messagingSurfaceFor(e){const r=t.get(e)?.messaging;if(!r)throw new Error(`no messaging surface registered for harness: ${e}`);return r}export function messagingSurfaces(){return t.all().filter(e=>e.messaging!==void 0).map(e=>({harness:e.id,surface:e.messaging}))}export function captureSurfaces(){return t.all().filter(e=>e.capture!==void 0).map(e=>({harness:e.id,surface:e.capture}))}export function blockingPromptFor(e){return t.get(e)?.questions??null}
@@ -1 +1 @@
1
- export class WatchCache{byProject=new Map;upsert(e,t){let r=this.byProject.get(e);r||(r=new Map,this.byProject.set(e,r)),r.set(t.relPath,t)}remove(e,t){this.byProject.get(e)?.delete(t)}list(e){const t=this.byProject.get(e);return t?[...t.values()].sort((r,l)=>r.relPath.localeCompare(l.relPath)):[]}clear(e){this.byProject.delete(e)}clearAll(){this.byProject.clear()}}
1
+ export class WatchCache{byProject=new Map;upsert(e,t){let r=this.byProject.get(e);r||(r=new Map,this.byProject.set(e,r)),r.set(t.relPath,t)}remove(e,t){this.byProject.get(e)?.delete(t)}list(e){const t=this.byProject.get(e);return t?[...t.values()].sort((r,c)=>r.relPath.localeCompare(c.relPath)):[]}clear(e){this.byProject.delete(e)}clearAll(){this.byProject.clear()}}
@@ -1 +1 @@
1
- import{assetSurfaces as r}from"../surfaces.js";export function classifyAsset(s){const t=normalizeRelPath(s);if(t===".mcp.json")return"mcp";if(t.startsWith(".claude/skills/")||t.startsWith(".codex/skills/"))return"skill";if(t===".claude/settings.json"||t===".claude/settings.local.json"||t===".codex/config.toml")return"settings";if(t.startsWith(".claude/commands/")||t.startsWith(".codex/prompts/"))return"command";if(t.startsWith(".claude/agents/"))return"agent";if(t.startsWith(".claude/helpers/"))return"helper";if(t.startsWith(".claude/workflows/"))return"workflow";if(t.startsWith(".claude/rules/"))return"rule";if(t.startsWith(".claude/output-styles/"))return"output-style";if(t.startsWith(".claude/plugins/")||t.startsWith(".weave/plugins/"))return"plugin";const e=t.slice(t.lastIndexOf("/")+1);return e==="CLAUDE.md"||e==="AGENTS.md"?"instructions":"other"}export function classifyAgent(s){const t=normalizeRelPath(s);return r().find(e=>e.classify(t))?.harness??"claude"}export function normalizeRelPath(s){let t=s.replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);for(;t.startsWith("/");)t=t.slice(1);return t}
1
+ import{assetSurfaces as i}from"../surfaces.js";export function classifyAsset(s){const t=normalizeRelPath(s);if(t===".mcp.json")return"mcp";if(t.startsWith(".claude/skills/")||t.startsWith(".codex/skills/"))return"skill";if(t===".claude/settings.json"||t===".claude/settings.local.json"||t===".codex/config.toml")return"settings";if(t.startsWith(".claude/commands/")||t.startsWith(".codex/prompts/"))return"command";if(t.startsWith(".claude/agents/"))return"agent";if(t.startsWith(".claude/helpers/"))return"helper";if(t.startsWith(".claude/workflows/"))return"workflow";if(t.startsWith(".claude/rules/"))return"rule";if(t.startsWith(".claude/output-styles/"))return"output-style";if(t.startsWith(".claude/plugins/")||t.startsWith(".weave/plugins/"))return"plugin";const e=t.slice(t.lastIndexOf("/")+1);return e==="CLAUDE.md"||e==="AGENTS.md"?"instructions":"other"}export function classifyAgent(s){const t=normalizeRelPath(s);return i().find(r=>r.classify(t))?.harness??"claude"}export function normalizeRelPath(s){let t=s.replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);for(;t.startsWith("/");)t=t.slice(1);return t}
@@ -1 +1 @@
1
- import{readFileSync as c,statSync as u,existsSync as a}from"node:fs";import n from"node:path";const h=8;export class PluginModsSniffer{cache=new Map;verdicts=new Map;revalidate;constructor(t={}){this.revalidate=t.revalidate??!0}refine(t,e,s){return t!=="plugin"?t:this.sniff(n.dirname(s))?"mods":"plugin"}sniff(t){if(!this.revalidate){const s=this.verdicts.get(t);if(s!==void 0)return s}const e=this.walkUp(t);return this.revalidate||this.verdicts.set(t,e),e}walkUp(t){let e=t;for(let s=0;s<h;s++){if(f(e))return!1;if(this.hooksMods(e))return!0;if(a(n.join(e,".claude-plugin","plugin.json")))return!1;const i=n.dirname(e);if(i===e)return!1;e=i}return!1}hooksMods(t){const e=n.join(t,"hooks","hooks.json"),s=this.cache.get(t);let i=-1;if(a(e))try{i=u(e).mtimeMs}catch{}if(i===-1)return s?.hooksMtimeMs!==-1&&this.cache.set(t,{mods:!1,hooksMtimeMs:-1}),!1;if(s&&s.hooksMtimeMs===i)return s.mods;const o=d(e);return this.cache.set(t,{mods:o,hooksMtimeMs:i}),o}}function f(r){if(n.basename(r)!=="plugins")return!1;const t=n.basename(n.dirname(r));return t===".claude"||t===".weave"}export function hasNonEmptyModules(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const t=r.modules;return Array.isArray(t)&&t.length>0}function d(r){try{return hasNonEmptyModules(JSON.parse(c(r,"utf8")))}catch{return!1}}
1
+ import{readFileSync as f,statSync as u,existsSync as o}from"node:fs";import n from"node:path";const l=8;export class PluginModsSniffer{cache=new Map;verdicts=new Map;revalidate;constructor(e={}){this.revalidate=e.revalidate??!0}refine(e,t,s){return e!=="plugin"?e:this.sniff(n.dirname(s))?"mods":"plugin"}sniff(e){if(!this.revalidate){const s=this.verdicts.get(e);if(s!==void 0)return s}const t=this.walkUp(e);return this.revalidate||this.verdicts.set(e,t),t}walkUp(e){let t=e;for(let s=0;s<l;s++){if(c(t))return!1;if(this.hooksMods(t))return!0;if(o(n.join(t,".claude-plugin","plugin.json")))return!1;const i=n.dirname(t);if(i===t)return!1;t=i}return!1}hooksMods(e){const t=n.join(e,"hooks","hooks.json"),s=this.cache.get(e);let i=-1;if(o(t))try{i=u(t).mtimeMs}catch{}if(i===-1)return s?.hooksMtimeMs!==-1&&this.cache.set(e,{mods:!1,hooksMtimeMs:-1}),!1;if(s&&s.hooksMtimeMs===i)return s.mods;const a=h(t);return this.cache.set(e,{mods:a,hooksMtimeMs:i}),a}}function c(r){if(n.basename(r)!=="plugins")return!1;const e=n.basename(n.dirname(r));return e===".claude"||e===".weave"}export function hasNonEmptyModules(r){if(!r||typeof r!="object"||Array.isArray(r))return!1;const e=r.modules;return Array.isArray(e)&&e.length>0}function h(r){try{return hasNonEmptyModules(JSON.parse(f(r,"utf8")))}catch{return!1}}
@@ -3,8 +3,12 @@ import type { LibraryRepository } from '../repositories/libraries.js';
3
3
  import type { PluginManager } from '../hooks/plugin-loader.js';
4
4
  import { FingerprintCache } from '../install/fingerprint.js';
5
5
  /**
6
- * SyncScheduler — periodically applies outdated updates to projects that have
7
- * opted into auto-sync (`.weave/config.json` → `autoSync: true`).
6
+ * SyncScheduler — periodically applies outdated updates to every project.
7
+ *
8
+ * **自动/手动由 git 分类单点决定,不再是 per-project 开关**(用户裁决):不进 git
9
+ * 的 init 生成物与资产由这里自动刷新;会进 git 的一律只报不写,dashboard 提醒
10
+ * 用户跑 `weave init`。所以 tick 无条件扫全部项目,落盘范围由 `syncAll` 内部按
11
+ * git 归类分流。
8
12
  *
9
13
  * This is decoupled from the WatchService's 5s reconcile: sync runs on a longer
10
14
  * cadence (default 60s) because it rehashes source directories and writes
@@ -21,7 +25,7 @@ export interface SyncSchedulerOptions {
21
25
  /**
22
26
  * 一轮同步落地后的对账面(项目角标刷新器)。资产写盘会经 watch → SSE 回流,
23
27
  * 但项目插件模板的物化落点(`.claude/` 副本)不带 plugin.reloaded——角标只能
24
- * 靠这一下对账,否则 autoSync 清掉漂移后角标会一直亮着。
28
+ * 靠这一下对账,否则自动同步清掉漂移后角标会一直亮着。
25
29
  */
26
30
  onSynced?: () => void;
27
31
  }
@@ -37,6 +41,6 @@ export declare class SyncScheduler {
37
41
  constructor(projects: ProjectRepository, libraries: LibraryRepository, options?: SyncSchedulerOptions);
38
42
  start(): void;
39
43
  stop(): void;
40
- /** One sync sweep across all projects opted into auto-sync. */
44
+ /** One sync sweep across all projects. */
41
45
  tick(): Promise<void>;
42
46
  }
@@ -1 +1 @@
1
- import{FingerprintCache as a}from"../install/fingerprint.js";import{buildLibraryIndex as e}from"../install/library-index.js";import{detectUpdates as n}from"../install/updates.js";import{syncAll as c}from"../install/apply-update.js";import{readProjectConfig as h,markSynced as o}from"../install/project-config.js";import{syncPlugins as l}from"../hooks/plugin-project-state.js";export class SyncScheduler{projects;libraries;timer;intervalMs;cache;plugins;onSynced;running=!1;constructor(s,r,i={}){this.projects=s,this.libraries=r,this.intervalMs=i.intervalMs??6e4,this.cache=i.cache??new a,this.plugins=i.plugins,this.onSynced=i.onSynced}start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs))}stop(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}async tick(){if(!this.running&&this.libraries){this.running=!0;try{const s=this.libraries.list(),r=await e(s),i=this.plugins?.list().map(t=>t.id);for(const t of this.projects.list())if((await h(t.path)).autoSync){if(i)try{l(t,i,{projects:this.projects})}catch{}(await n(t.path,s,this.cache,r)).available!==0&&(await c(t.path,s,this.cache,r),await o(t.path,new Date().toISOString()),this.onSynced?.())}}finally{this.running=!1}}}}
1
+ import{FingerprintCache as e}from"../install/fingerprint.js";import{buildLibraryIndex as n}from"../install/library-index.js";import{detectUpdates as a}from"../install/updates.js";import{syncAll as c}from"../install/apply-update.js";import{markSynced as h}from"../install/project-config.js";import{syncPlugins as o}from"../hooks/plugin-project-state.js";export class SyncScheduler{projects;libraries;timer;intervalMs;cache;plugins;onSynced;running=!1;constructor(r,s,t={}){this.projects=r,this.libraries=s,this.intervalMs=t.intervalMs??6e4,this.cache=t.cache??new e,this.plugins=t.plugins,this.onSynced=t.onSynced}start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs))}stop(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}async tick(){if(!this.running&&this.libraries){this.running=!0;try{const r=this.libraries.list(),s=await n(r),t=this.plugins?.list().map(i=>i.id);for(const i of this.projects.list()){if(t)try{o(i,t,{projects:this.projects})}catch{}(await a(i.path,r,this.cache,s)).available!==0&&(await c(i.path,r,this.cache,s),await h(i.path,new Date().toISOString()),this.onSynced?.())}}finally{this.running=!1}}}}
@@ -1 +1 @@
1
- import{EventEmitter as p}from"node:events";import{existsSync as b,lstatSync as w,readdirSync as y,realpathSync as P,statSync as f,watch as d}from"node:fs";import h from"node:path";import{watch as j}from"chokidar";import{WatchCache as v}from"./cache.js";import{classifyAgent as R,classifyAsset as S,normalizeRelPath as g}from"./classifier.js";import{PluginModsSniffer as T}from"./plugin-mods.js";import{globalPersonalSkillRootsOwned as M}from"../install/global-config.js";import{assetSurfaces as G}from"../surfaces.js";const k="<global>",I=new T;export function shouldIgnore(l){return l===""||l==="."||l===".weave"||l.startsWith(".weave/")?!1:G().every(t=>t.ignore(l))}export class WatchService{projects;emitter=new p;watchers=new Map;cache=new v;debounceMs;reconcileMs;isIgnored;globalRootSource;timers=new Map;pending=new Map;reconcileTimer;globalRoots=new Map;globalPending=new Map;globalTimer;constructor(t,e={}){this.projects=t,this.debounceMs=e.debounceMs??300,this.reconcileMs=e.reconcileMs??5e3,this.isIgnored=e.isIgnored??shouldIgnore,this.globalRootSource=e.globalRootSource??M}start(){this.reconcile(),this.reconcileTimer=setInterval(()=>this.reconcile(),this.reconcileMs)}stop(){for(const t of this.watchers.values())t.close();this.watchers.clear();for(const t of[...this.globalRoots.keys()])this.unwatchGlobalRoot(t);for(const t of this.timers.values())clearTimeout(t);this.timers.clear(),this.pending.clear(),this.globalPending.clear(),this.globalTimer&&(clearTimeout(this.globalTimer),this.globalTimer=void 0),this.cache.clearAll(),this.reconcileTimer&&(clearInterval(this.reconcileTimer),this.reconcileTimer=void 0)}reconcile(){const t=new Set(this.projects.list().map(e=>e.path));for(const e of t)this.watchers.has(e)||(this.watchProject(e),this.watchers.has(e)&&this.emitter.emit("project",{action:"added",projectPath:e}));for(const e of[...this.watchers.keys()])t.has(e)||(this.unwatchProject(e),this.emitter.emit("project",{action:"removed",projectPath:e}));this.reconcileGlobalRoots()}reconcileGlobalRoots(){const t=this.globalRootSource(),e=new Set(t.map(s=>s.root));for(const{harness:s,root:o}of t){if(this.globalRoots.has(o)){this.syncGlobalEntries(o);continue}b(o)&&this.watchGlobalRoot(o,s)}for(const s of[...this.globalRoots.keys()])(!e.has(s)||!b(s))&&this.unwatchGlobalRoot(s)}getAssets(t){return this.cache.list(t)}subscribe(t){return this.emitter.on("change",t),()=>this.emitter.off("change",t)}subscribeProjects(t){return this.emitter.on("project",t),()=>this.emitter.off("project",t)}watchProject(t){if(!b(t))return;const e=this.projects.getByPath(t)?.name??h.basename(t),s=j(".",{cwd:t,ignored:o=>this.isIgnored(g(h.relative(t,o))),ignoreInitial:!1,awaitWriteFinish:{stabilityThreshold:200,pollInterval:50}});this.watchers.set(t,s),s.on("add",o=>this.onFile(t,e,o,"add")),s.on("change",o=>this.onFile(t,e,o,"change")),s.on("unlink",o=>this.onFile(t,e,o,"unlink")),s.on("error",o=>this.emitter.emit("watch-error",o))}unwatchProject(t){const e=this.watchers.get(t);e&&(e.close(),this.watchers.delete(t));const s=this.timers.get(t);s&&(clearTimeout(s),this.timers.delete(t)),this.pending.delete(t),this.cache.clear(t)}watchGlobalRoot(t,e){const s=d(t,(o,i)=>{this.syncGlobalEntries(t),i&&this.emitGlobalPath(t,g(String(i)))});s.on("error",o=>this.emitter.emit("watch-error",o)),this.globalRoots.set(t,{harness:e,root:s,entries:new Map}),this.syncGlobalEntries(t)}syncGlobalEntries(t){const e=this.globalRoots.get(t);if(!e)return;let s;try{s=y(t)}catch{return}const o=new Set;for(const i of s){if(i.startsWith("."))continue;const r=h.join(t,i);let a;try{if(!f(r).isDirectory())continue;a=P(r)}catch{continue}o.add(i);const c=e.entries.get(i);if(c?.real===a)continue;c&&(c.watcher.close(),e.entries.delete(i));const n=d(a,{recursive:!0},(u,m)=>{m&&this.emitGlobalPath(t,g(h.join(i,String(m))))});n.on("error",()=>{n.close(),e.entries.delete(i)}),e.entries.set(i,{real:a,watcher:n})}for(const[i,r]of e.entries)o.has(i)||(r.watcher.close(),e.entries.delete(i))}unwatchGlobalRoot(t){const e=this.globalRoots.get(t);if(e){e.root.close();for(const s of e.entries.values())s.watcher.close();this.globalRoots.delete(t)}}emitGlobalPath(t,e){if(!e||e.split("/").some(i=>i.startsWith(".")))return;const s=h.join(t,e);let o="unlink";try{if(!f(s).isFile())return;o="change"}catch{}this.enqueueGlobal({projectPath:k,projectName:"global",category:"skill",agent:this.globalRoots.get(t)?.harness??"claude",relPath:e,absPath:s,kind:o})}enqueueGlobal(t){this.globalPending.set(t.absPath,t),this.globalTimer&&clearTimeout(this.globalTimer),this.globalTimer=setTimeout(()=>this.flushGlobal(),this.debounceMs)}flushGlobal(){this.globalTimer=void 0;for(const t of this.globalPending.values())this.emitter.emit("change",t);this.globalPending.clear()}onFile(t,e,s,o){const i=g(s),r=h.join(t,i);let a=S(i);o!=="unlink"&&a==="plugin"&&(a=I.refine(a,i,r));const c=R(i);let n;if(o==="unlink")this.cache.remove(t,i);else try{const u=w(r);n=u.isSymbolicLink()||void 0;const m=n?f(r).mtimeMs:u.mtimeMs;this.cache.upsert(t,{absPath:r,relPath:i,category:a,agent:c,mtimeMs:m,...n?{isSymlink:!0}:{}})}catch{this.cache.remove(t,i)}this.enqueue(t,{projectPath:t,projectName:e,category:a,agent:c,relPath:i,absPath:r,kind:o,...n?{isSymlink:!0}:{}})}enqueue(t,e){let s=this.pending.get(t);s||(s=new Map,this.pending.set(t,s)),s.set(e.relPath,e);const o=this.timers.get(t);o&&clearTimeout(o),this.timers.set(t,setTimeout(()=>this.flush(t),this.debounceMs))}flush(t){this.timers.delete(t);const e=this.pending.get(t);if(this.pending.delete(t),!!e)for(const s of e.values())this.emitter.emit("change",s)}}
1
+ import{EventEmitter as w}from"node:events";import{existsSync as g,lstatSync as y,readdirSync as p,realpathSync as S,statSync as b,watch as d}from"node:fs";import h from"node:path";import{watch as v}from"chokidar";import{WatchCache as R}from"./cache.js";import{classifyAgent as T,classifyAsset as M,normalizeRelPath as f}from"./classifier.js";import{PluginModsSniffer as G}from"./plugin-mods.js";import{globalPersonalSkillRootsOwned as k}from"../install/global-config.js";import{assetSurfaces as I}from"../surfaces.js";const E="<global>",W=new G;export function shouldIgnore(c){return c===""||c==="."||c===".weave"||c.startsWith(".weave/")?!1:I().every(e=>e.ignore(c))}export class WatchService{projects;emitter=new w;watchers=new Map;cache=new R;debounceMs;reconcileMs;isIgnored;globalRootSource;timers=new Map;pending=new Map;reconcileTimer;globalRoots=new Map;globalPending=new Map;globalTimer;constructor(e,t={}){this.projects=e,this.debounceMs=t.debounceMs??300,this.reconcileMs=t.reconcileMs??5e3,this.isIgnored=t.isIgnored??shouldIgnore,this.globalRootSource=t.globalRootSource??k}start(){this.reconcile(),this.reconcileTimer=setInterval(()=>this.reconcile(),this.reconcileMs)}stop(){for(const e of this.watchers.values())e.close();this.watchers.clear();for(const e of[...this.globalRoots.keys()])this.unwatchGlobalRoot(e);for(const e of this.timers.values())clearTimeout(e);this.timers.clear(),this.pending.clear(),this.globalPending.clear(),this.globalTimer&&(clearTimeout(this.globalTimer),this.globalTimer=void 0),this.cache.clearAll(),this.reconcileTimer&&(clearInterval(this.reconcileTimer),this.reconcileTimer=void 0)}reconcile(){const e=new Set(this.projects.list().map(t=>t.path));for(const t of e)this.watchers.has(t)||(this.watchProject(t),this.watchers.has(t)&&this.emitter.emit("project",{action:"added",projectPath:t}));for(const t of[...this.watchers.keys()])e.has(t)||(this.unwatchProject(t),this.emitter.emit("project",{action:"removed",projectPath:t}));this.reconcileGlobalRoots()}reconcileGlobalRoots(){const e=this.globalRootSource(),t=new Set(e.map(s=>s.root));for(const{harness:s,root:o}of e){if(this.globalRoots.has(o)){this.syncGlobalEntries(o);continue}g(o)&&this.watchGlobalRoot(o,s)}for(const s of[...this.globalRoots.keys()])(!t.has(s)||!g(s))&&this.unwatchGlobalRoot(s)}getAssets(e){return this.cache.list(e)}subscribe(e){return this.emitter.on("change",e),()=>this.emitter.off("change",e)}subscribeProjects(e){return this.emitter.on("project",e),()=>this.emitter.off("project",e)}watchProject(e){if(!g(e))return;const s=this.projects.getByPath(e)?.name??h.basename(e),o=v(".",{cwd:e,ignored:i=>this.isIgnored(f(h.relative(e,i))),ignoreInitial:!1,awaitWriteFinish:{stabilityThreshold:200,pollInterval:50}});this.watchers.set(e,o),o.on("add",i=>this.onFile(e,s,i,"add")),o.on("change",i=>this.onFile(e,s,i,"change")),o.on("unlink",i=>this.onFile(e,s,i,"unlink")),o.on("error",i=>this.emitter.emit("watch-error",i))}unwatchProject(e){const t=this.watchers.get(e);t&&(t.close(),this.watchers.delete(e));const s=this.timers.get(e);s&&(clearTimeout(s),this.timers.delete(e)),this.pending.delete(e),this.cache.clear(e)}watchGlobalRoot(e,t){const s=d(e,(o,i)=>{this.syncGlobalEntries(e),i&&this.emitGlobalPath(e,f(String(i)))});s.on("error",o=>this.emitter.emit("watch-error",o)),this.globalRoots.set(e,{harness:t,root:s,entries:new Map}),this.syncGlobalEntries(e)}syncGlobalEntries(e){const t=this.globalRoots.get(e);if(!t)return;let s;try{s=p(e)}catch{return}const o=new Set;for(const i of s){if(i.startsWith("."))continue;const n=h.join(e,i);let r;try{if(!b(n).isDirectory())continue;r=S(n)}catch{continue}o.add(i);const a=t.entries.get(i);if(a?.real===r)continue;a&&(a.watcher.close(),t.entries.delete(i));const l=d(r,{recursive:!0},(u,m)=>{m&&this.emitGlobalPath(e,f(h.join(i,String(m))))});l.on("error",()=>{l.close(),t.entries.delete(i)}),t.entries.set(i,{real:r,watcher:l})}for(const[i,n]of t.entries)o.has(i)||(n.watcher.close(),t.entries.delete(i))}unwatchGlobalRoot(e){const t=this.globalRoots.get(e);if(t){t.root.close();for(const s of t.entries.values())s.watcher.close();this.globalRoots.delete(e)}}emitGlobalPath(e,t){if(!t||t.split("/").some(i=>i.startsWith(".")))return;const s=h.join(e,t);let o="unlink";try{if(!b(s).isFile())return;o="change"}catch{}this.enqueueGlobal({projectPath:E,projectName:"global",category:"skill",agent:this.globalRoots.get(e)?.harness??"claude",relPath:t,absPath:s,kind:o})}enqueueGlobal(e){this.globalPending.set(e.absPath,e),this.globalTimer&&clearTimeout(this.globalTimer),this.globalTimer=setTimeout(()=>this.flushGlobal(),this.debounceMs)}flushGlobal(){this.globalTimer=void 0;for(const e of this.globalPending.values())this.emitter.emit("change",e);this.globalPending.clear()}onFile(e,t,s,o){const i=f(s),n=h.join(e,i);let r=M(i);o!=="unlink"&&r==="plugin"&&(r=W.refine(r,i,n));const a=T(i);let l;if(o==="unlink")this.cache.remove(e,i);else try{const u=y(n);l=u.isSymbolicLink()||void 0;const m=l?b(n).mtimeMs:u.mtimeMs;this.cache.upsert(e,{absPath:n,relPath:i,category:r,agent:a,mtimeMs:m,...l?{isSymlink:!0}:{}})}catch{this.cache.remove(e,i)}this.enqueue(e,{projectPath:e,projectName:t,category:r,agent:a,relPath:i,absPath:n,kind:o,...l?{isSymlink:!0}:{}})}enqueue(e,t){let s=this.pending.get(e);s||(s=new Map,this.pending.set(e,s)),s.set(t.relPath,t);const o=this.timers.get(e);o&&clearTimeout(o),this.timers.set(e,setTimeout(()=>this.flush(e),this.debounceMs))}flush(e){this.timers.delete(e);const t=this.pending.get(e);if(this.pending.delete(e),!!t)for(const s of t.values())this.emitter.emit("change",s)}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavecode/server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Weave daemon — HTTP server, SQLite data layer, and hook ingestion",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,9 +20,9 @@
20
20
  "node": ">=22.5.0"
21
21
  },
22
22
  "dependencies": {
23
- "@weavecode/core": "^0.1.0",
24
- "@weavecode/harness": "^0.1.0",
25
- "@weavecode/templates": "^0.1.0",
23
+ "@weavecode/core": "^0.1.1",
24
+ "@weavecode/harness": "^0.1.1",
25
+ "@weavecode/templates": "^0.1.1",
26
26
  "chokidar": "^4.0.0",
27
27
  "selfsigned": "^5.5.0",
28
28
  "smol-toml": "^1.3.0",