@weavecode/weave 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/node_modules/@weavecode/cli/dist/cli.js +3 -3
  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.js +2 -2
  6. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  7. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  8. package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
  9. package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
  10. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  11. package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
  12. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +1 -1
  13. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +1 -0
  14. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +2 -2
  15. package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
  16. package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
  17. package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +3 -3
  18. package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
  19. package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
  20. package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
  21. package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
  22. package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
  23. package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
  24. package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
  25. package/node_modules/@weavecode/cli/dist/init/provision.js +1 -1
  26. package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
  27. package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
  28. package/node_modules/@weavecode/cli/dist/parser.js +1 -1
  29. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  30. package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
  31. package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
  32. package/node_modules/@weavecode/cli/package.json +5 -5
  33. package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
  34. package/node_modules/@weavecode/core/dist/harness.d.ts +11 -0
  35. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  36. package/node_modules/@weavecode/core/dist/platform.js +1 -1
  37. package/node_modules/@weavecode/core/dist/types.js +1 -1
  38. package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
  39. package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
  40. package/node_modules/@weavecode/core/package.json +1 -1
  41. package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -4
  42. package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
  43. package/node_modules/@weavecode/harness/dist/claude/commands.js +2 -2
  44. package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
  45. package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
  46. package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
  47. package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
  48. package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
  49. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  50. package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -1
  51. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
  52. package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
  53. package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
  54. package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -1
  55. package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
  56. package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
  57. package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
  58. package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
  59. package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
  60. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
  61. package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
  62. package/node_modules/@weavecode/harness/dist/claude/rewind.js +1 -1
  63. package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
  64. package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
  65. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +14 -14
  66. package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
  67. package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
  68. package/node_modules/@weavecode/harness/dist/claude/transcript-cursor.js +2 -2
  69. package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -7
  70. package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
  71. package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
  72. package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
  73. package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
  74. package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
  75. package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
  76. package/node_modules/@weavecode/harness/dist/codex/images.js +1 -1
  77. package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
  78. package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -1
  79. package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
  80. package/node_modules/@weavecode/harness/dist/codex/messaging.js +2 -2
  81. package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -1
  82. package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
  83. package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
  84. package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -1
  85. package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -2
  86. package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
  87. package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -4
  88. package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -4
  89. package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
  90. package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
  91. package/node_modules/@weavecode/harness/dist/driver.d.ts +7 -0
  92. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  93. package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
  94. package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
  95. package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
  96. package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
  97. package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
  98. package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
  99. package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
  100. package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
  101. package/node_modules/@weavecode/harness/package.json +2 -2
  102. package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
  103. package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
  104. package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
  105. package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
  106. package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
  107. package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
  108. package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
  109. package/node_modules/@weavecode/server/dist/daemon/auto-start.js +6 -6
  110. package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
  111. package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
  112. package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
  113. package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
  114. package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
  115. package/node_modules/@weavecode/server/dist/daemon/data-bus.js +1 -1
  116. package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
  117. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  118. package/node_modules/@weavecode/server/dist/daemon/entry.js +2 -2
  119. package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
  120. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
  121. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  122. package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
  123. package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -1
  124. package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
  125. package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -2
  126. package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -1
  127. package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +1 -1
  128. package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -2
  129. package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -1
  130. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -1
  131. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -1
  132. package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -1
  133. package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
  134. package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +4 -4
  135. package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
  136. package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
  137. package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
  138. package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -1
  139. package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
  140. package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
  141. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
  142. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
  143. package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
  144. package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
  145. package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
  146. package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
  147. package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
  148. package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -1
  149. package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
  150. package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -1
  151. package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
  152. package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
  153. package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
  154. package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
  155. package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +1 -1
  156. package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
  157. package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
  158. package/node_modules/@weavecode/server/dist/daemon/session-open.d.ts +17 -0
  159. package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
  160. package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
  161. package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
  162. package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
  163. package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
  164. package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
  165. package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
  166. package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
  167. package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
  168. package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
  169. package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
  170. package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
  171. package/node_modules/@weavecode/server/dist/db/db.js +2 -2
  172. package/node_modules/@weavecode/server/dist/db/layout.js +1 -1
  173. package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
  174. package/node_modules/@weavecode/server/dist/hooks/bus.js +1 -1
  175. package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
  176. package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
  177. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
  178. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
  179. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
  180. package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
  181. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
  182. package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
  183. package/node_modules/@weavecode/server/dist/hooks/delivery/views.d.ts +3 -1
  184. package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
  185. package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
  186. package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
  187. package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
  188. package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
  189. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
  190. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
  191. package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
  192. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +5 -5
  193. package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
  194. package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
  195. package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
  196. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
  197. package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
  198. package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
  199. package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
  200. package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
  201. package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
  202. package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
  203. package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
  204. package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
  205. package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
  206. package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
  207. package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
  208. package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
  209. package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
  210. package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
  211. package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
  212. package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
  213. package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
  214. package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
  215. package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
  216. package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
  217. package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
  218. package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
  219. package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
  220. package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
  221. package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
  222. package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
  223. package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
  224. package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
  225. package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
  226. package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
  227. package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
  228. package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
  229. package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
  230. package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
  231. package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
  232. package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
  233. package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
  234. package/node_modules/@weavecode/server/dist/market/import.js +2 -2
  235. package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
  236. package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
  237. package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
  238. package/node_modules/@weavecode/server/dist/registry.js +2 -2
  239. package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +5 -5
  240. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +4 -4
  241. package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
  242. package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
  243. package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
  244. package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
  245. package/node_modules/@weavecode/server/dist/repositories/projects.js +2 -2
  246. package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
  247. package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
  248. package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
  249. package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
  250. package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
  251. package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
  252. package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
  253. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  254. package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
  255. package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
  256. package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
  257. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
  258. package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
  259. package/node_modules/@weavecode/server/package.json +4 -4
  260. package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-CbIFQh0R.js → abnfDiagram-WEYOIA3C-DDeQkTf5.js} +1 -1
  261. package/node_modules/@weavecode/server/web/dist/assets/{arc-DH8-rYAa.js → arc-CRZTRyjb.js} +1 -1
  262. package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-qnv6S0sc.js → architectureDiagram-ZHVYKT53-Dj54DE3O.js} +1 -1
  263. package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-pT5eO-cB.js → blockDiagram-RJAE7QA3-BIH8mSIZ.js} +1 -1
  264. package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-DHDBDMb1.js → c4Diagram-XDPPPE54-5YoKWFOD.js} +1 -1
  265. package/node_modules/@weavecode/server/web/dist/assets/channel-5VM93AJ8.js +1 -0
  266. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-CT951PH5.js → chunk-2E7WHVMD-B653kMXt.js} +1 -1
  267. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-E5AD7_ZY.js → chunk-2Q5K7J3B-f_A4_eDz.js} +1 -1
  268. package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-DWz9qkcy.js → chunk-4EMNKR2T-v5j5qNGj.js} +1 -1
  269. package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-D-SgWD8w.js → chunk-55XCU76K-CgEqeP7j.js} +1 -1
  270. package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-ci6YzbO5.js → chunk-5VM5RSS4-BeROhLXN.js} +1 -1
  271. package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-CY4mr2f4.js → chunk-JWPE2WC7-D6dXb_jr.js} +1 -1
  272. package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-CON8zyg8.js → chunk-VQ5W62QI-CnHdSEMi.js} +1 -1
  273. package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-DXXXZ4pW.js → chunk-XXDRQBXY-BkG_e6PE.js} +1 -1
  274. package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-CukvPvkM.js → chunk-ZCHMQSOR-DxR-fxzs.js} +2 -2
  275. package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-GiWZ9xtF.js → classDiagram-v2-4MYWR3UA-DQe1b_k8.js} +1 -1
  276. package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-D7aJ-akq.js → cose-bilkent-JH36ORCC-DThrA8S5.js} +1 -1
  277. package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-9B__MaRM.js → cynefin-EF2NZ3EQ-OZotFKUu.js} +1 -1
  278. package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-B2ujZh2k.js → cynefinDiagram-WF24UDRP-DJjq2hfT.js} +1 -1
  279. package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-nHaB6IWf.js → dagre-NK4GIZVX-C2vH93HT.js} +1 -1
  280. package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-xKfjDvgr.js → diagram-CBK3MWTC-DrF_ScM-.js} +1 -1
  281. package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-BHT2-5mY.js → diagram-I5XIIV2D-D1qoUJ4t.js} +1 -1
  282. package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-CckywF4W.js → diagram-ODIL2UCW-D9A6W8oB.js} +1 -1
  283. package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-Dpjlc7Wh.js → diagram-PFBEJUXE-PeI-eyu2.js} +1 -1
  284. package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-M6WznOaW.js → diagram-RJA3I4VV-DITY0Rd8.js} +1 -1
  285. package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-DgRJ3zL1.js → diagram-TYUNFSNR-D5KieEw5.js} +1 -1
  286. package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-BzzVN__a.js → ebnfDiagram-V4P3TTPT-DDylK-gz.js} +1 -1
  287. package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-Ch6Gs9G9.js → elk-QONTBCTQ-D3xrVg0U.js} +1 -1
  288. package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-COxT-Pxb.js → erDiagram-KYQIGQAA-y_V1cor7.js} +1 -1
  289. package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-CJVWnTBa.js → flowDiagram-IUGLLWBU-BJ8Z0MkF.js} +1 -1
  290. package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-BkRpWPUl.js → ganttDiagram-R7GPNTJY-C0q-CS1T.js} +1 -1
  291. package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-Ba8BJcvZ.js → gitGraphDiagram-PDYL7XHY-BYTComiB.js} +1 -1
  292. package/node_modules/@weavecode/server/web/dist/assets/index-BKxAxaVG.js +1091 -0
  293. package/node_modules/@weavecode/server/web/dist/assets/index-C0Sd4MH7.css +11 -0
  294. package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-HTQ5FUNK.js → infoDiagram-MVDRKAX5-DtixgjLP.js} +1 -1
  295. package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-BNjEDIZy.js → ishikawaDiagram-HPEHV2GE-ChEnND76.js} +1 -1
  296. package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-Cao6h91a.js → journeyDiagram-BOSHW7O7-DHcNtpYF.js} +1 -1
  297. package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-CXIx2CHQ.js → kanban-definition-FNSA4HC5-Dft7qpW5.js} +1 -1
  298. package/node_modules/@weavecode/server/web/dist/assets/{linear-65WmlvQb.js → linear-DEo11t-X.js} +1 -1
  299. package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-D39fi_iR.js → mermaid.core-D_Dp_Kl2.js} +4 -4
  300. package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-DHqpz_AK.js → mindmap-definition-6OY57UG3-CM6OAd_-.js} +1 -1
  301. package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-Cpy1nsER.js → pegDiagram-ECIUJNBX-_QkY0h8Q.js} +1 -1
  302. package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-B1IyNqzr.js → pieDiagram-GNMPY74T-ZGr5vtDj.js} +1 -1
  303. package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-zSM6o7mB.js → quadrantDiagram-D57K4MC3-D8pQ_PU2.js} +1 -1
  304. package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-oM4XJIwA.js → railroadDiagram-Y72NRBL7-DUIo-WmA.js} +1 -1
  305. package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-CbCLBjHf.js → requirementDiagram-EQYSW5RA-C90DU5Ny.js} +1 -1
  306. package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-BucVk6EP.js → sankeyDiagram-SY24JHO5-B_poYGgJ.js} +1 -1
  307. package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-Dg8CYEnT.js → sequenceDiagram-BLEHNHQU-DDW7b2Dn.js} +1 -1
  308. package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-C51zb7Oc.js → sizeCapture-INFHLROL-CmKoqX6K.js} +1 -1
  309. package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-BvK2l3is.js → stateDiagram-v2-A6IESKWZ-CkVMAyxG.js} +1 -1
  310. package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-Ds7QOfXW.js → swimlanes-B3ENRKFQ-Dm_Omzky.js} +1 -1
  311. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-Bjj8ZA4d.js +8 -0
  312. package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-CadU4Qq4.js → timeline-definition-JXYKGLGB-DnhkRGLb.js} +1 -1
  313. package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-BYuZwTDZ.js → usecaseDiagram-WPOLBNNX-_TdIjC6Z.js} +1 -1
  314. package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-C7zgxe07.js → vennDiagram-Q3Y3IDCW-FzgsymXB.js} +1 -1
  315. package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-DA4Otf4s.js → wardleyDiagram-IVAIDKWA-BwqimStC.js} +1 -1
  316. package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-Bs5YGwMU.js → xychartDiagram-4URNHDU4-CFjjVPIV.js} +1 -1
  317. package/node_modules/@weavecode/server/web/dist/icons/apple-touch-icon.png +0 -0
  318. package/node_modules/@weavecode/server/web/dist/icons/icon-192.png +0 -0
  319. package/node_modules/@weavecode/server/web/dist/icons/icon-512.png +0 -0
  320. package/node_modules/@weavecode/server/web/dist/icons/icon-maskable-512.png +0 -0
  321. package/node_modules/@weavecode/server/web/dist/index.html +11 -2
  322. package/node_modules/@weavecode/server/web/dist/manifest.webmanifest +16 -0
  323. package/node_modules/@weavecode/templates/package.json +2 -2
  324. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/README.md +3 -8
  325. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/package.json +1 -1
  326. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.d.ts +4 -2
  327. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.es6.js +10 -1
  328. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.es6.mjs +10 -1
  329. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/tslib/tslib.js +10 -1
  330. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/README.md +3 -8
  331. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/package.json +1 -1
  332. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.d.ts +4 -2
  333. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.es6.js +10 -1
  334. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.es6.mjs +10 -1
  335. package/node_modules/selfsigned/node_modules/pkijs/node_modules/tslib/tslib.js +10 -1
  336. package/package.json +6 -6
  337. package/node_modules/@weavecode/server/web/dist/assets/channel-BHPeeuzN.js +0 -1
  338. package/node_modules/@weavecode/server/web/dist/assets/index-CtifxEiF.css +0 -11
  339. package/node_modules/@weavecode/server/web/dist/assets/index-FwH9INgS.js +0 -1090
  340. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-ByBF02UJ.js +0 -8
@@ -1,3 +1,3 @@
1
- import f from"node:fs/promises";import{homedir as _}from"node:os";import l from"node:path";import{parse as d}from"smol-toml";import{CODEX_CONFIG_GROUPS as A,CODEX_CONFIG_KEYS as F}from"./config-catalog.generated.js";import{codexHome as h}from"./home.js";import{CodexTomlCorruptError as w,setTomlValueInText as C}from"./toml.js";const b=[{id:"user",profiles:!0},{id:"project",profiles:!1}];function g(t,r){switch(t){case"user":return l.join(h(r.homedir),"config.toml");case"project":return l.join(r.projectPath??"",".codex","config.toml");default:return""}}function O(t){return t==="project"?F.filter(r=>r.scope!=="user"):F}function $(t){return new Set(O(t).map(r=>r.key.split(".")[0]))}function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function v(t){const r=[],e=t.mcp_servers;return p(e)&&"weave"in e&&r.push("mcp_servers.weave"),r}function S(t,r){let e=t.trim();return e==="~"?r:((e.startsWith("~/")||e.startsWith("~\\"))&&(e=l.join(r,e.slice(2))),l.isAbsolute(e)?e:l.join(h(r),e))}async function N(t){const r=t.values.model_catalog_json;if(typeof r!="string"||!r.trim())return{models:[],baseUrl:"",credential:"none"};const e=S(r,t.homedir??_());let n;try{n=await f.readFile(e,"utf-8")}catch{throw new Error(`model_catalog_json \u6307\u5411\u7684\u6587\u4EF6\u8BFB\u4E0D\u5230\uFF1A${e}`)}let i;try{i=JSON.parse(n)}catch{throw new Error(`model_catalog_json \u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${e}`)}const a=p(i)?i.models:null;if(!Array.isArray(a))throw new Error("model catalog \u7F3A models \u6570\u7EC4");const c=[];for(const o of a)!p(o)||typeof o.slug!="string"||c.push({id:o.slug,...typeof o.display_name=="string"?{name:o.display_name}:{},...typeof o.description=="string"?{createdAt:o.description}:{}});return{models:c,baseUrl:"",credential:"none"}}export async function ensureTrustAccepted(t){const r=l.join(h(),"config.toml");let e="";try{e=await f.readFile(r,"utf-8")}catch{}let n;try{n=d(e)}catch(s){throw new w(`${r} is not valid TOML \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}const i=l.resolve(t),a=p(n.projects)?n.projects:{},c=(s,m)=>process.platform==="win32"?s.toLowerCase().replaceAll("/","\\")===m.toLowerCase().replaceAll("/","\\"):s===m,o=Object.keys(a).find(s=>c(s,i))??k(i),u=C(e,["projects",o,"trust_level"],"trusted");u!==e&&(await f.mkdir(l.dirname(r),{recursive:!0}),await f.writeFile(r,u,"utf-8"))}function k(t){return process.platform==="win32"?t.toLowerCase():t}export const CODEX_CONFIG={harness:"codex",files(t){return b.map(r=>({id:r.id,profiles:r.profiles,path:e=>g(r.id,e)}))},catalog(t){const r=O(t);return{groups:A.filter(e=>r.some(n=>n.group===e)),keys:r,envVars:[]}},async read(t,r){const e=g(t,r);let n;try{n=await f.readFile(e,"utf-8")}catch{return{}}let i;try{i=d(n)}catch(o){throw new w(`${e} is not valid TOML \u2014 refusing to read: ${o instanceof Error?o.message:String(o)}`)}if(!p(i))return{};const a=$(t),c={};for(const o of a)o in i&&(c[o]=i[o]);return c},async write(t,r,e){const n=g(t,r);let i="";try{i=await f.readFile(n,"utf-8")}catch{}let a;try{a=d(i)}catch(s){throw new w(`${n} is not valid TOML \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}const c=$(t),o={...a};for(const s of Object.keys(a))c.has(s)&&!(s in e)&&delete o[s];for(const[s,m]of Object.entries(e))c.has(s.split(".")[0])&&(o[s]=m);const u=E(o);await f.mkdir(l.dirname(n),{recursive:!0}),await f.writeFile(n,u,"utf-8")},managedKeys:v,managedEntries(){return[]},models:N,rawFormat:"toml",parseRaw(t){const r=d(t);if(!p(r))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u8868");return r},serializeRaw(t){return E(t)}};function E(t){const r=[],e=(n,i)=>{const a=[],c=[];for(const[o,u]of Object.entries(i))p(u)&&!x(u)?c.push([o,u]):a.push(`${y(o)} = ${j(u)}`);n.length>0&&(a.length>0||c.length===0)&&(r.length>0&&r.push(""),r.push(`[${n.map(y).join(".")}]`)),r.push(...a);for(const[o,u]of c)e([...n,o],u)};return e([],t),r.length>0?`${r.join(`
1
+ import d from"node:fs/promises";import{homedir as k}from"node:os";import f from"node:path";import{parse as m}from"smol-toml";import{CODEX_CONFIG_GROUPS as S,CODEX_CONFIG_KEYS as b}from"./config-catalog.generated.js";import{codexHome as g}from"./home.js";import{CodexTomlCorruptError as y,setTomlValueInText as x}from"./toml.js";const A=[{id:"user",profiles:!0},{id:"project",profiles:!1}];function h(e,t){switch(e){case"user":return f.join(g(t.homedir),"config.toml");case"project":return f.join(t.projectPath??"",".codex","config.toml");default:return""}}function _(e){return e==="project"?b.filter(t=>t.scope!=="user"):b}function $(e){return new Set(_(e).map(t=>t.key.split(".")[0]))}function p(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function C(e){const t=[],r=e.mcp_servers;return p(r)&&"weave"in r&&t.push("mcp_servers.weave"),t}function F(e,t){let r=e.trim();return r==="~"?t:((r.startsWith("~/")||r.startsWith("~\\"))&&(r=f.join(t,r.slice(2))),f.isAbsolute(r)?r:f.join(g(t),r))}async function T(e){const t=e.values.model_catalog_json;if(typeof t!="string"||!t.trim())return{models:[],baseUrl:"",credential:"none"};const r=F(t,e.homedir??k());let o;try{o=await d.readFile(r,"utf-8")}catch{throw new Error(`model_catalog_json \u6307\u5411\u7684\u6587\u4EF6\u8BFB\u4E0D\u5230\uFF1A${r}`)}let s;try{s=JSON.parse(o)}catch{throw new Error(`model_catalog_json \u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${r}`)}const i=p(s)?s.models:null;if(!Array.isArray(i))throw new Error("model catalog \u7F3A models \u6570\u7EC4");const a=[];for(const n of i)!p(n)||typeof n.slug!="string"||a.push({id:n.slug,...typeof n.display_name=="string"?{name:n.display_name}:{},...typeof n.description=="string"?{createdAt:n.description}:{}});return{models:a,baseUrl:"",credential:"none"}}export async function ensureTrustAccepted(e){const t=f.join(g(),"config.toml");let r="";try{r=await d.readFile(t,"utf-8")}catch{}let o;try{o=m(r)}catch(u){throw new y(`${t} is not valid TOML \u2014 refusing to write: ${u instanceof Error?u.message:String(u)}`)}const s=f.resolve(e),i=p(o.projects)?o.projects:{},a=(u,O)=>process.platform==="win32"?u.toLowerCase().replaceAll("/","\\")===O.toLowerCase().replaceAll("/","\\"):u===O,l=Object.keys(i).find(u=>a(u,s))??L(s),c=x(r,["projects",l,"trust_level"],"trusted");c!==r&&(await d.mkdir(f.dirname(t),{recursive:!0}),await d.writeFile(t,c,"utf-8"))}function L(e){return process.platform==="win32"?e.toLowerCase():e}export const CODEX_CONFIG={harness:"codex",files(e){return A.map(t=>({id:t.id,profiles:t.profiles,path:r=>h(t.id,r)}))},catalog(e){const t=_(e);return{groups:S.filter(r=>t.some(o=>o.group===r)),keys:t,envVars:[]}},async read(e,t){const r=h(e,t);let o;try{o=await d.readFile(r,"utf-8")}catch{return{}}let s;try{s=m(o)}catch(n){throw new y(`${r} is not valid TOML \u2014 refusing to read: ${n instanceof Error?n.message:String(n)}`)}if(!p(s))return{};const i=$(e),a={};for(const n of i)n in s&&(a[n]=s[n]);return a},async write(e,t,r){const o=h(e,t);let s="";try{s=await d.readFile(o,"utf-8")}catch{}let i;try{i=m(s)}catch(c){throw new y(`${o} is not valid TOML \u2014 refusing to write: ${c instanceof Error?c.message:String(c)}`)}const a=$(e),n={...i};for(const c of Object.keys(i))a.has(c)&&!(c in r)&&delete n[c];for(const[c,u]of Object.entries(r))a.has(c.split(".")[0])&&(n[c]=u);const l=E(n);await d.mkdir(f.dirname(o),{recursive:!0}),await d.writeFile(o,l,"utf-8")},managedKeys:C,managedEntries(){return[]},models:T,rawFormat:"toml",parseRaw(e){const t=m(e);if(!p(t))throw new Error("\u9876\u5C42\u5FC5\u987B\u662F\u8868");return t},serializeRaw(e){return E(e)}};function E(e){const t=[],r=(o,s)=>{const i=[],a=[];for(const[n,l]of Object.entries(s))p(l)&&!N(l)?a.push([n,l]):i.push(`${w(n)} = ${j(l)}`);o.length>0&&(i.length>0||a.length===0)&&(t.length>0&&t.push(""),t.push(`[${o.map(w).join(".")}]`)),t.push(...i);for(const[n,l]of a)r([...o,n],l)};return r([],e),t.length>0?`${t.join(`
2
2
  `)}
3
- `:""}function x(t){return Object.keys(t).length===0}function y(t){return/^[A-Za-z0-9_-]+$/.test(t)?t:JSON.stringify(t)}function j(t){return t==null?'""':typeof t=="boolean"?t?"true":"false":typeof t=="number"?Number.isFinite(t)?String(t):'""':typeof t=="string"?T(t):Array.isArray(t)?`[${t.map(j).join(", ")}]`:`{ ${Object.entries(t).filter(([,r])=>r!==void 0).map(([r,e])=>`${y(r)} = ${j(e)}`).join(", ")} }`}function T(t){const r=t.includes("\\"),e=!t.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(t);return r&&e?`'${t}'`:JSON.stringify(t)}
3
+ `:""}function N(e){return Object.keys(e).length===0}function w(e){return/^[A-Za-z0-9_-]+$/.test(e)?e:JSON.stringify(e)}function j(e){return e==null?'""':typeof e=="boolean"?e?"true":"false":typeof e=="number"?Number.isFinite(e)?String(e):'""':typeof e=="string"?K(e):Array.isArray(e)?`[${e.map(j).join(", ")}]`:`{ ${Object.entries(e).filter(([,r])=>r!==void 0).map(([r,o])=>`${w(r)} = ${j(o)}`).join(", ")} }`}function K(e){const t=e.includes("\\"),r=!e.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(e);return t&&r?`'${e}'`:JSON.stringify(e)}
@@ -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,2 +1,2 @@
1
- import{HARNESS_EVENTS as _}from"@weavecode/core";import{capFields as r}from"../shared/json-cap.js";import{CLAUDE_EVENT_SOURCE as g}from"../claude/event-source.js";const i={Interrupt:"TurnAborted"};export const CANONICAL_TO_WIRE=Object.fromEntries(Object.entries(i).map(([o,e])=>[e,o]));export function metaOfLine(o){if(o.type!=="session_meta")return null;const e=o.payload??{};return typeof e.session_id!="string"||!e.session_id?null:{sessionId:e.session_id,cwd:typeof e.cwd=="string"&&e.cwd?e.cwd:null}}function p(o){return Array.isArray(o)&&o.map(e=>{const t=e;return(typeof t?.type=="string"?t.type.toLowerCase():"")==="text"&&typeof t.text=="string"?t.text:""}).filter(Boolean).join(`
2
- `)||null}export function promptOfLine(o){const e=o.payload??{};if(e.type==="user_message")return typeof e.message=="string"&&e.message?e.message:null;if(e.type!=="item_completed")return null;const t=e.item;return t?.type!=="UserMessage"?null:p(t.content)}function u(o){const e=o.payload??{};if(e.type!=="item_completed")return null;const t=e.item;if(!t||typeof t!="object")return null;const n=t.type;return typeof n=="string"?{type:n,item:t}:null}export class CodexTurnBuffer{last=null;report(e){const t=e.payload??{},n=typeof t.type=="string"?t.type:null,l=u(e);if(n==="agent_message")return typeof t.message=="string"&&t.message&&(this.last=t.message),null;if(l?.type==="AgentMessage"){const s=p(l.item.content);return s&&(this.last=s),null}if(promptOfLine(e)!==null)return this.last=null,{eventType:"UserPromptSubmit",payload:{line:e}};if(e.type==="session_meta")return{eventType:"SessionStart",payload:{line:e}};if(n==="task_started")return this.last=null,null;if(n==="task_complete"){const s=this.last;return this.last=null,{eventType:"Stop",payload:{line:e,lastAgentMessage:s}}}return n==="turn_aborted"?{eventType:"TurnAborted",payload:{line:e}}:n==="exec_command_end"||n==="patch_apply_end"?{eventType:"PostToolUse",payload:{line:e}}:l?.type==="CommandExecution"||l?.type==="FileChange"||l?.type==="McpToolCall"?{eventType:"PostToolUse",payload:{line:e}}:null}}function c(o){return Array.isArray(o)?o.filter(e=>typeof e=="string").join(" "):typeof o=="string"?o:null}function x(o){const e=o.payload??{};if(e.type==="exec_command_end")return{toolName:"exec_command",toolInput:{command:c(e.command),cwd:e.cwd??null},toolResponse:{exit_code:e.exit_code??null,status:e.status??null}};if(e.type==="patch_apply_end"){const n=e.changes&&typeof e.changes=="object"?e.changes:{};return{toolName:"apply_patch",toolInput:{paths:Object.keys(n)},toolResponse:{success:e.success??null}}}const t=u(o);if(t?.type==="CommandExecution")return{toolName:"exec_command",toolInput:{command:c(t.item.command),cwd:t.item.cwd??null},toolResponse:{exit_code:t.item.exit_code??null,status:t.item.status??null}};if(t?.type==="FileChange"){const n=t.item.changes&&typeof t.item.changes=="object"?t.item.changes:{};return{toolName:"apply_patch",toolInput:{paths:Object.keys(n)},toolResponse:{status:t.item.status??null}}}return t?.type==="McpToolCall"?{toolName:typeof t.item.name=="string"?t.item.name:"mcp_tool_call",toolInput:t.item.arguments??null,toolResponse:t.item.result??t.item.status??null}:{toolName:null,toolInput:null,toolResponse:null}}function T(o,e){return typeof o.last_agent_message=="string"&&o.last_agent_message?o.last_agent_message:e??null}function h(o){const e=o.error;if(typeof e=="string"&&e)return e;if(e&&typeof e=="object"){const t=e.message;if(typeof t=="string"&&t)return t}return null}export class CodexEventSource{source="codex";events=_.codex;normalize(e,t){const n=e??{};return typeof n.payload=="string"?w(n,t):E(n,t)}}function w(o,e){const t=o.eventType||"unknown",n=i[t]??t;return{...g.normalize({...o,eventType:n},e),source:"codex"}}function E(o,e){const t=o.payload?.line??{},n=t.payload??{},l=o.eventType||"unknown",s={};if(l==="UserPromptSubmit")s.prompt=promptOfLine(t)??"";else if(l==="Stop"){s.last_assistant_message=T(n,o.payload?.lastAgentMessage);const a=h(n);a&&(s.error=a)}else l==="TurnAborted"?(s.reason=n.reason??null,s.duration_ms=n.duration_ms??null):l==="SessionStart"&&(s.source="rollout");t.ordinal!==void 0&&(s.seq=t.ordinal);const{toolName:m,toolInput:y,toolResponse:d}=x(t),f={eventType:l,toolName:m,toolInput:r(y),toolResponse:r(d),cwd:o.cwd??null,raw:r({...s,turn_id:n.turn_id??null,call_id:n.call_id??null})};return{projectId:e,source:"codex",eventType:l,sessionId:o.sessionId,payload:JSON.stringify(f)}}export const CODEX_EVENT_SOURCE=new CodexEventSource;
1
+ import{HARNESS_EVENTS as _}from"@weavecode/core";import{capFields as a}from"../shared/json-cap.js";import{CLAUDE_EVENT_SOURCE as g}from"../claude/event-source.js";const u={Interrupt:"TurnAborted"};export const CANONICAL_TO_WIRE=Object.fromEntries(Object.entries(u).map(([n,t])=>[t,n]));export function metaOfLine(n){if(n.type!=="session_meta")return null;const t=n.payload??{};return typeof t.session_id!="string"||!t.session_id?null:{sessionId:t.session_id,cwd:typeof t.cwd=="string"&&t.cwd?t.cwd:null}}function i(n){return Array.isArray(n)&&n.map(e=>{const o=e;return(typeof o?.type=="string"?o.type.toLowerCase():"")==="text"&&typeof o.text=="string"?o.text:""}).filter(Boolean).join(`
2
+ `)||null}export function promptOfLine(n){const t=n.payload??{};if(t.type==="user_message")return typeof t.message=="string"&&t.message?t.message:null;if(t.type!=="item_completed")return null;const e=t.item;return e?.type!=="UserMessage"?null:i(e.content)}function p(n){const t=n.payload??{};if(t.type!=="item_completed")return null;const e=t.item;if(!e||typeof e!="object")return null;const o=e.type;return typeof o=="string"?{type:o,item:e}:null}export class CodexTurnBuffer{last=null;report(t){const e=t.payload??{},o=typeof e.type=="string"?e.type:null,s=p(t);if(o==="agent_message")return typeof e.message=="string"&&e.message&&(this.last=e.message),null;if(s?.type==="AgentMessage"){const r=i(s.item.content);return r&&(this.last=r),null}if(promptOfLine(t)!==null)return this.last=null,{eventType:"UserPromptSubmit",payload:{line:t}};if(t.type==="session_meta")return{eventType:"SessionStart",payload:{line:t}};if(o==="task_started")return this.last=null,null;if(o==="task_complete"){const r=this.last;return this.last=null,{eventType:"Stop",payload:{line:t,lastAgentMessage:r}}}return o==="turn_aborted"?{eventType:"TurnAborted",payload:{line:t}}:o==="exec_command_end"||o==="patch_apply_end"?{eventType:"PostToolUse",payload:{line:t}}:s?.type==="CommandExecution"||s?.type==="FileChange"||s?.type==="McpToolCall"?{eventType:"PostToolUse",payload:{line:t}}:null}}function c(n){return Array.isArray(n)?n.filter(t=>typeof t=="string").join(" "):typeof n=="string"?n:null}function x(n){const t=n.payload??{};if(t.type==="exec_command_end")return{toolName:"exec_command",toolInput:{command:c(t.command),cwd:t.cwd??null},toolResponse:{exit_code:t.exit_code??null,status:t.status??null}};if(t.type==="patch_apply_end"){const o=t.changes&&typeof t.changes=="object"?t.changes:{};return{toolName:"apply_patch",toolInput:{paths:Object.keys(o)},toolResponse:{success:t.success??null}}}const e=p(n);if(e?.type==="CommandExecution")return{toolName:"exec_command",toolInput:{command:c(e.item.command),cwd:e.item.cwd??null},toolResponse:{exit_code:e.item.exit_code??null,status:e.item.status??null}};if(e?.type==="FileChange"){const o=e.item.changes&&typeof e.item.changes=="object"?e.item.changes:{};return{toolName:"apply_patch",toolInput:{paths:Object.keys(o)},toolResponse:{status:e.item.status??null}}}return e?.type==="McpToolCall"?{toolName:typeof e.item.name=="string"?e.item.name:"mcp_tool_call",toolInput:e.item.arguments??null,toolResponse:e.item.result??e.item.status??null}:{toolName:null,toolInput:null,toolResponse:null}}function T(n,t){return typeof n.last_agent_message=="string"&&n.last_agent_message?n.last_agent_message:t??null}function h(n){const t=n.error;if(typeof t=="string"&&t)return t;if(t&&typeof t=="object"){const e=t.message;if(typeof e=="string"&&e)return e}return null}export class CodexEventSource{source="codex";events=_.codex;normalize(t,e){const o=t??{};return typeof o.payload=="string"?O(o,e):w(o,e)}}function O(n,t){const e=n.eventType||"unknown",o=u[e]??e;return{...g.normalize({...n,eventType:o},t),source:"codex"}}function w(n,t){const e=n.payload?.line??{},o=e.payload??{},s=n.eventType||"unknown",r={};if(s==="UserPromptSubmit")r.prompt=promptOfLine(e)??"";else if(s==="Stop"){r.last_assistant_message=T(o,n.payload?.lastAgentMessage);const l=h(o);l&&(r.error=l)}else s==="TurnAborted"?(r.reason=o.reason??null,r.duration_ms=o.duration_ms??null):s==="SessionStart"&&(r.source="rollout");e.ordinal!==void 0&&(r.seq=e.ordinal);const{toolName:m,toolInput:f,toolResponse:y}=x(e),d={eventType:s,toolName:m,toolInput:a(f),toolResponse:a(y),cwd:n.cwd??null,raw:{...r,turn_id:o.turn_id??null,call_id:o.call_id??null}};return{projectId:t,source:"codex",eventType:s,sessionId:n.sessionId,payload:JSON.stringify(d)}}export const CODEX_EVENT_SOURCE=new CodexEventSource;
@@ -1 +1 @@
1
- import{createReadStream as f}from"node:fs";import{createInterface as u}from"node:readline";const p=new Set(["image/png","image/jpeg","image/gif","image/webp"]),m=10*1024*1024,g=/^data:([^;,]+);base64,(.*)$/s;function l(e){if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!i||typeof i!="object")continue;const o=i;if(o.type!=="image")continue;const n=typeof o.image_url=="string"?o.image_url:null;if(!n)continue;const r=g.exec(n);if(!r)continue;const a=r[1];if(!p.has(a))continue;const s=Buffer.from(r[2],"base64");s.length===0||s.length>m||t.push({mediaType:a,bytes:s})}return t}function y(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&t.type==="text"?String(t.text??""):"").join(""):""}export const CODEX_IMAGES={async sessionImages({transcriptPath:e}){if(!e)return null;const t=[],i=u({input:f(e,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const o of i){if(!o.includes('"type":"image"'))continue;const n=JSON.parse(o);if(n.type!=="event_msg")continue;const r=n.payload;if(r?.type!=="item_completed")continue;const a=r.item;if(a?.type!=="UserMessage")continue;const s=a.content,c=l(s);c.length!==0&&t.push({text:y(s),at:typeof n.timestamp=="string"?n.timestamp:null,images:c})}}catch{return null}finally{i.close()}return t}};
1
+ import{createReadStream as f}from"node:fs";import{createInterface as u}from"node:readline";const m=new Set(["image/png","image/jpeg","image/gif","image/webp"]),p=10*1024*1024,l=/^data:([^;,]+);base64,(.*)$/s;function y(e){if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!i||typeof i!="object")continue;const o=i;if(o.type!=="image")continue;const n=typeof o.image_url=="string"?o.image_url:null;if(!n)continue;const c=l.exec(n);if(!c)continue;const r=c[1];if(!m.has(r))continue;const s=Buffer.from(c[2],"base64");s.length===0||s.length>p||t.push({mediaType:r,bytes:s})}return t}function g(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&t.type==="text"?String(t.text??""):"").join(""):""}export const CODEX_IMAGES={async sessionImages({transcriptPath:e}){if(!e)return null;const t=[],i=u({input:f(e,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const o of i){if(!o.includes('"type":"image"'))continue;const n=JSON.parse(o);if(n.type!=="event_msg")continue;const c=n.payload;if(c?.type!=="item_completed")continue;const r=c.item;if(r?.type!=="UserMessage")continue;const s=r.content,a=y(s);a.length!==0&&t.push({text:g(s),at:typeof n.timestamp=="string"?n.timestamp:null,images:a})}}catch{return null}finally{i.close()}return t}};
@@ -1 +1 @@
1
- import{CODEX_ASSETS as o}from"./assets.js";import{CODEX_CAPTURE as r}from"./capture.js";import{CODEX_CONFIG as e}from"./config.js";import{CODEX_DETECTOR as E}from"./detect.js";import{CODEX_EVENT_SOURCE as t}from"./event-source.js";import{CODEX_IMAGES as s}from"./images.js";import{CODEX_NARRATION as m}from"./narration.js";import{CODEX_MESSAGING as C}from"./messaging.js";import{CODEX_PLUGINS as O}from"./plugins.js";import{CODEX_PLUGIN_STATE as i}from"./plugin-state.js";import{CODEX_PROVISION as p}from"./provision.js";import{CODEX_QUESTIONS as _}from"./questions.js";import{CODEX_RESUME as f}from"./resume.js";import{CODEX_LOG_SOURCE as D}from"./rollout.js";import{CODEX_COMMANDS as S}from"./commands.js";import{CODEX_LIVENESS as a}from"./liveness.js";import{CODEX_TITLES as X}from"./titles.js";export{CODEX_DETECTOR}from"./detect.js";export{CODEX_PLUGIN_STATE}from"./plugin-state.js";export{CODEX_IMAGES}from"./images.js";export{CODEX_NARRATION}from"./narration.js";export{CODEX_MESSAGING}from"./messaging.js";export{CODEX_QUESTIONS}from"./questions.js";export{CODEX_RESUME}from"./resume.js";export{CODEX_EVENT_SOURCE,CodexEventSource,CodexTurnBuffer}from"./event-source.js";export{CODEX_LOG_SOURCE,CodexLogSource}from"./rollout.js";export{CODEX_CAPTURE}from"./capture.js";export{codexInterruptMarkerAt}from"./transcript.js";export{CODEX_PLUGINS,createCodexPluginSurface,CODEX_MARKETPLACE}from"./plugins.js";export{CODEX_CONFIG,ensureTrustAccepted as ensureCodexTrustAccepted}from"./config.js";export{CODEX_PROVISION,codexProvisionCheck}from"./provision.js";export*from"./mcp.js";export*from"./toml.js";export{CODEX_COMMANDS}from"./commands.js";export{CODEX_LIVENESS,codexLivenessById,codexThreadLockDir,CODEX_LOCK_GRACE_MS}from"./liveness.js";export{CODEX_TITLES,codexSessionTitleOf,codexSetSessionTitle}from"./titles.js";export const CODEX_DRIVER={id:"codex",displayName:"Codex",capabilities:["assets","detect","plugins","pluginState","messaging","resume","events","capture","logs","config","commands","provision","liveness","images","narration","questions"],assets:o,detect:E,plugins:O,pluginState:i,messaging:C,resume:f,events:t,capture:r,logs:D,config:e,commands:S,provision:p,liveness:a,images:s,narration:m,questions:_,titles:X};
1
+ import{CODEX_ASSETS as o}from"./assets.js";import{CODEX_CAPTURE as r}from"./capture.js";import{CODEX_CONFIG as e}from"./config.js";import{CODEX_DETECTOR as E}from"./detect.js";import{CODEX_EVENT_SOURCE as t}from"./event-source.js";import{CODEX_IMAGES as m}from"./images.js";import{CODEX_NARRATION as C}from"./narration.js";import{CODEX_MESSAGING as O}from"./messaging.js";import{CODEX_PLUGINS as i}from"./plugins.js";import{CODEX_PLUGIN_STATE as p}from"./plugin-state.js";import{CODEX_PROVISION as s}from"./provision.js";import{CODEX_QUESTIONS as _}from"./questions.js";import{CODEX_RESUME as f}from"./resume.js";import{CODEX_LOG_SOURCE as D}from"./rollout.js";import{CODEX_COMMANDS as S}from"./commands.js";import{CODEX_LIVENESS as X}from"./liveness.js";import{CODEX_TITLES as n}from"./titles.js";export{CODEX_DETECTOR}from"./detect.js";export{CODEX_PLUGIN_STATE}from"./plugin-state.js";export{CODEX_IMAGES}from"./images.js";export{CODEX_NARRATION}from"./narration.js";export{CODEX_MESSAGING}from"./messaging.js";export{CODEX_QUESTIONS}from"./questions.js";export{CODEX_RESUME}from"./resume.js";export{CODEX_EVENT_SOURCE,CodexEventSource,CodexTurnBuffer}from"./event-source.js";export{CODEX_LOG_SOURCE,CodexLogSource}from"./rollout.js";export{CODEX_CAPTURE}from"./capture.js";export{codexInterruptMarkerAt}from"./transcript.js";export{CODEX_PLUGINS,createCodexPluginSurface,CODEX_MARKETPLACE}from"./plugins.js";export{CODEX_CONFIG,ensureTrustAccepted as ensureCodexTrustAccepted}from"./config.js";export{CODEX_PROVISION,codexProvisionCheck}from"./provision.js";export*from"./mcp.js";export*from"./toml.js";export{CODEX_COMMANDS}from"./commands.js";export{CODEX_LIVENESS,codexLivenessById,codexThreadLockDir,CODEX_LOCK_GRACE_MS}from"./liveness.js";export{CODEX_TITLES,codexSessionTitleOf,codexSetSessionTitle}from"./titles.js";export const CODEX_DRIVER={id:"codex",displayName:"Codex",capabilities:["assets","detect","plugins","pluginState","messaging","resume","events","capture","logs","config","commands","provision","liveness","images","narration","questions"],assets:o,detect:E,plugins:i,pluginState:p,messaging:O,resume:f,events:t,capture:r,logs:D,config:e,commands:S,provision:s,liveness:X,images:m,narration:C,questions:_,titles:n};
@@ -1 +1 @@
1
- import{readdirSync as u,statSync as m}from"node:fs";import l from"node:path";import{codexHome as w}from"./home.js";export const CODEX_LOCK_GRACE_MS=9e4;const d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.lock$/i;export function codexThreadLockDir(n){return l.join(w(n),"thread-writer-locks")}async function S(n,p){const{spawn:o}=await import("node:child_process"),r=t=>t.replace(/'/g,"''"),i=["$results = @()",...n.map(t=>{const s=l.win32.join(p,t);return`try { [void][IO.File]::Open('${r(s)}','Open','ReadWrite','None') } catch [IO.IOException] { $results += '${r(t)}' }`}),'$results -join "`n"'].join("; ");return new Promise(t=>{let s="";const e=o("powershell",["-NoProfile","-NonInteractive","-Command",i],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),c=setTimeout(()=>{e.kill("SIGKILL"),t(new Set)},5e3);e.stdout?.on("data",a=>s+=a.toString()),e.on("error",()=>{clearTimeout(c),t(new Set)}),e.on("close",()=>{clearTimeout(c),t(new Set(s.split(/\r?\n/).map(a=>a.trim()).filter(Boolean)))})})}async function h(){return new Set}const f=new Map;export async function codexLivenessById(n,p=Date.now()){const o=codexThreadLockDir(n);let r;try{r=u(o)}catch{return new Map}const i=r.filter(e=>d.test(e)),t=await(i.length===0?async()=>new Set:process.platform==="win32"?e=>S(e,o):()=>h())(i),s=new Map;for(const e of i){const c=e.replace(/\.lock$/i,"");if(t.has(e)){f.set(c,p),s.set(c,!0);continue}let a=f.get(c);if(a===void 0){try{a=m(l.join(o,e)).mtimeMs}catch{continue}f.set(c,a)}p-a>=CODEX_LOCK_GRACE_MS&&s.set(c,!1)}return s}export const CODEX_LIVENESS={harness:"codex",alive(n){return codexLivenessById().then(p=>{if(!n)return p;const o=new Map;for(const r of n){const i=p.get(r);i!==void 0&&o.set(r,i)}return o})}};
1
+ import{readdirSync as f,statSync as m}from"node:fs";import u from"node:path";import{codexHome as w}from"./home.js";export const CODEX_LOCK_GRACE_MS=9e4;const h=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.lock$/i;export function codexThreadLockDir(o){return u.join(w(o),"thread-writer-locks")}async function S(o,a){const{spawn:r}=await import("node:child_process"),i=t=>t.replace(/'/g,"''"),s=["$results = @()",...o.map(t=>{const p=u.win32.join(a,t);return`try { [void][IO.File]::Open('${i(p)}','Open','ReadWrite','None') } catch [IO.IOException] { $results += '${i(t)}' }`}),'$results -join "`n"'].join("; ");return new Promise(t=>{let p="";const c=r("powershell",["-NoProfile","-NonInteractive","-Command",s],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),e=setTimeout(()=>{c.kill("SIGKILL"),t(new Set)},5e3);c.stdout?.on("data",n=>p+=n.toString()),c.on("error",()=>{clearTimeout(e),t(new Set)}),c.on("close",()=>{clearTimeout(e),t(new Set(p.split(/\r?\n/).map(n=>n.trim()).filter(Boolean)))})})}async function y(){return new Set}const d=new Map;export async function codexLivenessById(o,a=Date.now()){const r=codexThreadLockDir(o);let i;try{i=f(r)}catch{return new Map}const s=i.filter(e=>h.test(e)),p=await(s.length===0?async()=>new Set:process.platform==="win32"?e=>S(e,r):()=>y())(s),c=new Map;for(const e of s){const n=e.replace(/\.lock$/i,"");if(p.has(e)){d.set(n,a),c.set(n,!0);continue}let l=d.get(n);if(l===void 0){try{l=m(u.join(r,e)).mtimeMs}catch{continue}d.set(n,l)}a-l>=CODEX_LOCK_GRACE_MS&&c.set(n,!1)}return c}export const CODEX_LIVENESS={harness:"codex",alive(o){return codexLivenessById().then(a=>{if(!o)return a;const r=new Map;for(const i of o){const s=a.get(i);s!==void 0&&r.set(i,s)}return r})}};
@@ -1 +1 @@
1
- import{readFile as l,writeFile as g,access as T,mkdir as $}from"node:fs/promises";import j from"node:path";import{parse as m}from"smol-toml";import{CodexTomlCorruptError as v,parseSectionEntries as w,removeTomlSection as k,renderTomlHeader as S,renderTomlKey as _,renderTomlString as f,sameKey as y,splitTomlSections as d,upsertTomlSection as x}from"./toml.js";export function readCodexMcpFromText(r){let e;try{e=m(r)}catch{return{}}const n=e.mcp_servers;if(!n||typeof n!="object"||Array.isArray(n))return{};const t={};for(const[s,o]of Object.entries(n)){const c=M(o);c&&(t[s]=c)}return t}function A(r){if(!r||typeof r!="object"||Array.isArray(r))return;const e={};for(const[n,t]of Object.entries(r))typeof t=="string"&&(e[n]=t);return Object.keys(e).length>0?e:void 0}function M(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const e=r;if(typeof e.url=="string"){const t={url:e.url},s=A(e.http_headers);return s&&(t.headers=s),typeof e.bearer_token_env_var=="string"&&(t.bearerTokenEnvVar=e.bearer_token_env_var),t}if(typeof e.command!="string")return null;const n={command:e.command};if(Array.isArray(e.args)){const t=e.args.filter(s=>typeof s=="string");t.length>0&&(n.args=t)}if(e.env&&typeof e.env=="object"&&!Array.isArray(e.env)){const t={};for(const[s,o]of Object.entries(e.env))typeof o=="string"&&(t[s]=o);Object.keys(t).length>0&&(n.env=t)}return n}function b(r,e,n,t,s){const o=[];if("command"in e)o.push(`command = ${f(e.command)}`),e.args&&e.args.length>0&&o.push(`args = [${e.args.map(f).join(", ")}]`);else{o.push(`url = ${f(e.url)}`),e.bearerTokenEnvVar&&o.push(`bearer_token_env_var = ${f(e.bearerTokenEnvVar)}`);const a=Object.entries(e.headers??{});a.length>0&&o.push(`http_headers = { ${a.map(([i,u])=>`${_(i)} = ${f(u)}`).join(", ")} }`)}if(s&&n){const a=new Set(["command","args","env","url","http_headers","bearer_token_env_var"]);for(const[i,u]of w(n.lines.slice(1)))a.has(i)||o.push(u)}const c=Object.entries("env"in e?e.env??{}:{}),p=s&&t?w(t.lines.slice(1)).filter(([a])=>!(a in("env"in e?e.env??{}:{}))):[];if(c.length>0||p.length>0){o.push(""),o.push(S([...r,"env"]));for(const[a,i]of c)o.push(`${_(a)} = ${f(i)}`);for(const[,a]of p)o.push(a)}return o}export function upsertCodexMcpInText(r,e,n){const t=["mcp_servers",e],s=O(r);if(s)throw s;const o=d(r),c=o.find(i=>y(i.key,t)),p=o.find(i=>y(i.key,[...t,"env"])),a=x(r,t,b(t,n,c,p,!0));try{return m(a),a}catch{const i=x(r,t,b(t,n,c,p,!1));try{return m(i),i}catch(u){throw new v(`unable to produce valid TOML for [mcp_servers.${e}]: ${u instanceof Error?u.message:String(u)}`)}}}export function removeCodexMcpFromText(r,e){return k(r,["mcp_servers",e])}function O(r){return d(r)[0].lines.find(e=>/^\s*mcp_servers\s*=/.test(e))?new v('~/.codex/config.toml defines "mcp_servers" as an inline value \u2014 weave only manages the [mcp_servers.<name>] section form'):null}async function E(r){try{return await l(r,"utf-8")}catch{return""}}async function h(r){try{return await T(r),!0}catch{return!1}}export async function readCodexMcpServers(r){return await h(r)?readCodexMcpFromText(await l(r,"utf-8")):{}}export async function codexMcpExists(r,e){return await h(e)?C(await l(e,"utf-8"),["mcp_servers",r]):!1}function C(r,e){return d(r).some(n=>y(n.key,e))}export async function writeCodexMcpServer(r,e,n){const t=await E(n);if(t.trim()!=="")try{m(t)}catch(s){throw new v(`${n} is not valid TOML \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}await $(j.dirname(n),{recursive:!0}),await g(n,upsertCodexMcpInText(t,r,e),"utf-8")}export async function removeCodexMcpServer(r,e){if(!await h(e))return!1;const n=await l(e,"utf-8");try{m(n)}catch(o){throw new v(`${e} is not valid TOML \u2014 refusing to write: ${o instanceof Error?o.message:String(o)}`)}const{text:t,removed:s}=removeCodexMcpFromText(n,r);return s&&await g(e,t,"utf-8"),s}
1
+ import{readFile as d,writeFile as g,access as T,mkdir as k}from"node:fs/promises";import $ from"node:path";import{parse as m}from"smol-toml";import{CodexTomlCorruptError as v,parseSectionEntries as w,removeTomlSection as M,renderTomlHeader as S,renderTomlKey as x,renderTomlString as f,sameKey as y,splitTomlSections as l,upsertTomlSection as _}from"./toml.js";export function readCodexMcpFromText(r){let e;try{e=m(r)}catch{return{}}const n=e.mcp_servers;if(!n||typeof n!="object"||Array.isArray(n))return{};const t={};for(const[o,s]of Object.entries(n)){const c=E(s);c&&(t[o]=c)}return t}function j(r){if(!r||typeof r!="object"||Array.isArray(r))return;const e={};for(const[n,t]of Object.entries(r))typeof t=="string"&&(e[n]=t);return Object.keys(e).length>0?e:void 0}function E(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const e=r;if(typeof e.url=="string"){const t={url:e.url},o=j(e.http_headers);return o&&(t.headers=o),typeof e.bearer_token_env_var=="string"&&(t.bearerTokenEnvVar=e.bearer_token_env_var),t}if(typeof e.command!="string")return null;const n={command:e.command};if(Array.isArray(e.args)){const t=e.args.filter(o=>typeof o=="string");t.length>0&&(n.args=t)}if(e.env&&typeof e.env=="object"&&!Array.isArray(e.env)){const t={};for(const[o,s]of Object.entries(e.env))typeof s=="string"&&(t[o]=s);Object.keys(t).length>0&&(n.env=t)}return n}function b(r,e,n,t,o){const s=[];if("command"in e)s.push(`command = ${f(e.command)}`),e.args&&e.args.length>0&&s.push(`args = [${e.args.map(f).join(", ")}]`);else{s.push(`url = ${f(e.url)}`),e.bearerTokenEnvVar&&s.push(`bearer_token_env_var = ${f(e.bearerTokenEnvVar)}`);const a=Object.entries(e.headers??{});a.length>0&&s.push(`http_headers = { ${a.map(([i,u])=>`${x(i)} = ${f(u)}`).join(", ")} }`)}if(o&&n){const a=new Set(["command","args","env","url","http_headers","bearer_token_env_var"]);for(const[i,u]of w(n.lines.slice(1)))a.has(i)||s.push(u)}const c=Object.entries("env"in e?e.env??{}:{}),p=o&&t?w(t.lines.slice(1)).filter(([a])=>!(a in("env"in e?e.env??{}:{}))):[];if(c.length>0||p.length>0){s.push(""),s.push(S([...r,"env"]));for(const[a,i]of c)s.push(`${x(a)} = ${f(i)}`);for(const[,a]of p)s.push(a)}return s}export function upsertCodexMcpInText(r,e,n){const t=["mcp_servers",e],o=A(r);if(o)throw o;const s=l(r),c=s.find(i=>y(i.key,t)),p=s.find(i=>y(i.key,[...t,"env"])),a=_(r,t,b(t,n,c,p,!0));try{return m(a),a}catch{const i=_(r,t,b(t,n,c,p,!1));try{return m(i),i}catch(u){throw new v(`unable to produce valid TOML for [mcp_servers.${e}]: ${u instanceof Error?u.message:String(u)}`)}}}export function removeCodexMcpFromText(r,e){return M(r,["mcp_servers",e])}function A(r){return l(r)[0].lines.find(t=>/^\s*mcp_servers\s*=/.test(t))?new v('~/.codex/config.toml defines "mcp_servers" as an inline value \u2014 weave only manages the [mcp_servers.<name>] section form'):null}async function O(r){try{return await d(r,"utf-8")}catch{return""}}async function h(r){try{return await T(r),!0}catch{return!1}}export async function readCodexMcpServers(r){return await h(r)?readCodexMcpFromText(await d(r,"utf-8")):{}}export async function codexMcpExists(r,e){return await h(e)?C(await d(e,"utf-8"),["mcp_servers",r]):!1}function C(r,e){return l(r).some(n=>y(n.key,e))}export async function writeCodexMcpServer(r,e,n){const t=await O(n);if(t.trim()!=="")try{m(t)}catch(o){throw new v(`${n} is not valid TOML \u2014 refusing to write: ${o instanceof Error?o.message:String(o)}`)}await k($.dirname(n),{recursive:!0}),await g(n,upsertCodexMcpInText(t,r,e),"utf-8")}export async function removeCodexMcpServer(r,e){if(!await h(e))return!1;const n=await d(e,"utf-8");try{m(n)}catch(s){throw new v(`${e} is not valid TOML \u2014 refusing to write: ${s instanceof Error?s.message:String(s)}`)}const{text:t,removed:o}=removeCodexMcpFromText(n,r);return o&&await g(e,t,"utf-8"),o}
@@ -1,4 +1,4 @@
1
- import{existsSync as a,readFileSync as l}from"node:fs";import d from"node:path";import{HARNESS_LIFECYCLE as u}from"@weavecode/core";import{CODEX_SIDE_QUESTION as f}from"./side-question.js";function h(){const n=process.env.WEAVE_CODEX_BIN;if(n&&n.trim())return{bin:n.trim(),prefix:[]};if(process.platform!=="win32")return{bin:"codex",prefix:[]};for(const t of(process.env.PATH??"").split(d.delimiter)){if(!t)continue;const s=d.join(t,"codex.exe");if(a(s))return{bin:s,prefix:[]};const e=d.join(t,"codex.cmd");if(a(e))try{const o=l(e,"utf8").split(/\r?\n/).map(c=>c.trim()).find(c=>/^".+?\.exe"/.test(c)),r=/^"(.+?\.exe)"/.exec(o??"");if(r&&a(r[1]))return{bin:r[1],prefix:[]}}catch{}const i=d.join(t,"node_modules","@openai","codex","bin","codex.js");if(a(i))return{bin:process.execPath,prefix:[i]}}return{bin:"codex",prefix:[]}}export const CODEX_QUEUED_PROMPT={command(n,t){const{bin:s,prefix:e}=h();return{bin:s,args:[...e,"queue","--thread",n,"--message",t]}},timeoutMs:3e4},CODEX_ATTACH={kinds:["file","image"],composePrompt(n,t){const s=t.filter(i=>!n.includes(i.path));if(s.length===0)return n;const e=s.map(i=>i.path).join(`
1
+ import{existsSync as d,readFileSync as l}from"node:fs";import a from"node:path";import{HARNESS_LIFECYCLE as u}from"@weavecode/core";import{CODEX_SIDE_QUESTION as f}from"./side-question.js";function m(){const n=process.env.WEAVE_CODEX_BIN;if(n&&n.trim())return{bin:n.trim(),prefix:[]};if(process.platform!=="win32")return{bin:"codex",prefix:[]};for(const t of(process.env.PATH??"").split(a.delimiter)){if(!t)continue;const s=a.join(t,"codex.exe");if(d(s))return{bin:s,prefix:[]};const e=a.join(t,"codex.cmd");if(d(e))try{const o=l(e,"utf8").split(/\r?\n/).map(c=>c.trim()).find(c=>/^".+?\.exe"/.test(c)),r=/^"(.+?\.exe)"/.exec(o??"");if(r&&d(r[1]))return{bin:r[1],prefix:[]}}catch{}const i=a.join(t,"node_modules","@openai","codex","bin","codex.js");if(d(i))return{bin:process.execPath,prefix:[i]}}return{bin:"codex",prefix:[]}}export const CODEX_QUEUED_PROMPT={command(n,t){const{bin:s,prefix:e}=m();return{bin:s,args:[...e,"queue","--thread",n,"--message",t]}},timeoutMs:3e4},CODEX_ATTACH={kinds:["file","image"],composePrompt(n,t){const s=t.filter(i=>!n.includes(i.path));if(s.length===0)return n;const e=s.map(i=>i.path).join(`
2
2
  `);return n?`${n}
3
3
 
4
- ${e}`:e}};const m={kinds:["file","dir"],lines:!1,expression:({path:n,kind:t})=>t==="dir"?`${n}/`:n,recognize:n=>{const t=[];for(const s of n.matchAll(/(?:^|\s)"([^"]*\s[^"]*)"(?=\s|$)/g)){const e=s[1],i=s.index+(s[0].startsWith(" ")?1:0),o=i+e.length+2;e.startsWith("/")||e.includes(":")||t.push({start:i,end:o,ref:n.slice(i,o),path:e,kind:"file"})}for(const s of n.matchAll(/(?:^|\s)([^\s"]+)(?=\s|$)/g)){const e=s[1];if(!/[./]/.test(e))continue;const i=s.index+(s[0].startsWith(" ")?1:0),o=i+e.length;if(e.startsWith("/")||e.includes(":")||e.includes("\\")||t.some(p=>i>=p.start&&o<=p.end))continue;const r=e.endsWith("/"),c=r?e.slice(0,-1):e;c&&t.push({start:i,end:o,ref:n.slice(i,o),path:c,kind:r?"dir":"file"})}return t.sort((s,e)=>s.start-e.start)}};export const CODEX_MESSAGING={harness:"codex",discovery:!1,prompt:null,promptInbox:null,queuedPrompt:CODEX_QUEUED_PROMPT,inject:null,headless:null,idleSignals:[...u.codex.close,"SessionEnd"],paneEnvSource:"launch",attach:CODEX_ATTACH,pathRefs:m,sideQuestion:f,unsupportedReasons:{discovery:"Codex event ingestion is pending research (BACKLOG \xA710-6); sessions are not discoverable",prompt:"Codex has no native peer-messaging channel; prompts reach it via its own queue or terminal text injection",inject:"Codex has no synchronous injection channel yet (pending research)",headless:"Codex resume is pending research",watch:"Codex error-ended turns emit no Stop; those rounds never fire idle/turnEnd"}};
4
+ ${e}`:e}};const h={kinds:["file","dir"],lines:!1,expression:({path:n,kind:t})=>t==="dir"?`${n}/`:n,recognize:n=>{const t=[];for(const s of n.matchAll(/(?:^|\s)"([^"]*\s[^"]*)"(?=\s|$)/g)){const e=s[1],i=s.index+(s[0].startsWith(" ")?1:0),o=i+e.length+2;e.startsWith("/")||e.includes(":")||t.push({start:i,end:o,ref:n.slice(i,o),path:e,kind:"file"})}for(const s of n.matchAll(/(?:^|\s)([^\s"]+)(?=\s|$)/g)){const e=s[1];if(!/[./]/.test(e))continue;const i=s.index+(s[0].startsWith(" ")?1:0),o=i+e.length;if(e.startsWith("/")||e.includes(":")||e.includes("\\")||t.some(p=>i>=p.start&&o<=p.end))continue;const r=e.endsWith("/"),c=r?e.slice(0,-1):e;c&&t.push({start:i,end:o,ref:n.slice(i,o),path:c,kind:r?"dir":"file"})}return t.sort((s,e)=>s.start-e.start)}};export const CODEX_MESSAGING={harness:"codex",discovery:!1,prompt:null,promptInbox:null,queuedPrompt:CODEX_QUEUED_PROMPT,inject:null,headless:null,idleSignals:[...u.codex.close,"SessionEnd"],paneEnvSource:"launch",attach:CODEX_ATTACH,pathRefs:h,sideQuestion:f,unsupportedReasons:{discovery:"Codex event ingestion is pending research (BACKLOG \xA710-6); sessions are not discoverable",prompt:"Codex has no native peer-messaging channel; prompts reach it via its own queue or terminal text injection",inject:"Codex has no synchronous injection channel yet (pending research)",headless:"Codex resume is pending research",watch:"Codex error-ended turns emit no Stop; those rounds never fire idle/turnEnd"}};
@@ -1 +1 @@
1
- import{createReadStream as l}from"node:fs";import{createInterface as i}from"node:readline";export const CODEX_NARRATION={async sessionNarration({transcriptPath:r}){if(!r)return null;const t=[],e=i({input:l(r,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const n of e){const s=a(n);s&&t.push(s)}}catch{return null}finally{e.close()}return t},lineParser:a};function a(r){if(!r.includes('"AgentMessage"'))return null;let t;try{t=JSON.parse(r)}catch{return null}if(t.type!=="event_msg")return null;const e=t.payload;if(e?.type!=="AgentMessage")return null;const n=typeof e.message=="string"?e.message:"";return n.trim()?{at:typeof t.timestamp=="string"?t.timestamp:null,text:n}:null}
1
+ import{createReadStream as a}from"node:fs";import{createInterface as i}from"node:readline";export const CODEX_NARRATION={async sessionNarration({transcriptPath:n}){if(!n)return null;const e=[],t=i({input:a(n,{encoding:"utf8"}),crlfDelay:1/0});try{for await(const r of t){const s=l(r);s&&e.push(s)}}catch{return null}finally{t.close()}return e},lineParser:l};function l(n){if(!n.includes('"AgentMessage"'))return null;let e;try{e=JSON.parse(n)}catch{return null}if(e.type!=="event_msg")return null;const t=e.payload;if(t?.type!=="AgentMessage")return null;const r=typeof t.message=="string"?t.message:"";return r.trim()?{at:typeof e.timestamp=="string"?e.timestamp:null,text:r}:null}
@@ -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,3 +1,3 @@
1
- import{spawn as T}from"node:child_process";import{homedir as I}from"node:os";import{lstat as M,mkdir as v,readFile as S,readdir as j,writeFile as x}from"node:fs/promises";import l from"node:path";import{CODEX_ASSETS as K}from"./assets.js";import{parseSectionEntries as L,removeTomlSection as N,splitTomlSections as O,upsertCodexPluginEnabledInText as P}from"./toml.js";export const CODEX_MARKETPLACE="weave";const _=6e4,D=2e3,A=64*1024;export function codexCommandLine(a){return["codex",...a.map(y=>`"${y.replace(/"/g,'\\"')}"`)].join(" ")}function q(a){if(!(a.exitCode!==null||a.signalCode!==null)){if(process.platform==="win32"&&a.pid!==void 0){T("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}a.kill("SIGKILL")}}function F(a){return a.length>D?`${a.slice(0,D)}\u2026`:a}const J=(a,y)=>new Promise((h,u)=>{const k=process.platform==="win32",c=T(k?process.env.ComSpec||"cmd.exe":"codex",k?["/d","/s","/c",codexCommandLine(a)]:a,{windowsHide:!0,windowsVerbatimArguments:k,stdio:["ignore","pipe","pipe"]}),d=`codex ${a.join(" ")}`;let p="",m="",f=!1;const E=e=>{f||(f=!0,clearTimeout(t),u(new Error(F(e))))},t=setTimeout(()=>{q(c),E(`${d}: timed out after ${y.timeoutMs}ms`)},y.timeoutMs);c.stdout?.setEncoding("utf8"),c.stdout?.on("data",e=>{p.length<A&&(p+=e)}),c.stderr?.setEncoding("utf8"),c.stderr?.on("data",e=>{m.length<A&&(m+=e)}),c.on("error",e=>E(`${d}: ${e.message}`)),c.on("close",e=>{if(f)return;if(f=!0,clearTimeout(t),e===0){h({stdout:p,stderr:m});return}const i=[m,p].filter(Boolean).join(`
2
- `).trim()||`exit ${e}`;u(new Error(F(`${d}: ${i}`)))})});export function createCodexPluginSurface(a={}){const y=a.exec??J,h=t=>y(t,{timeoutMs:_}),u=()=>K.userConfigFile(I()),k=()=>l.join(I(),".codex","plugins","cache"),c=(t,e)=>`${t}@${e??CODEX_MARKETPLACE}`,d=async()=>{try{return await S(u(),"utf8")}catch{return null}},p=t=>{if(!t)return{};const e=O(t),i={};for(const n of e)if(!(!n.key||n.key.length!==2||n.key[0]!=="plugins"))for(const[r,o]of L(n.lines.slice(1))){if(r!=="enabled")continue;const s=o.split("=")[1]?.trim();(s==="true"||s==="false")&&(i[n.key[1]]=s==="true")}return i},m=async()=>{const t=k(),e={};let i;try{i=await j(t,{withFileTypes:!0})}catch{return e}for(const n of i){if(!n.isDirectory()&&!n.isSymbolicLink())continue;const r=l.join(t,n.name);let o;try{o=await j(r,{withFileTypes:!0})}catch{continue}for(const s of o){if(!s.isDirectory()&&!s.isSymbolicLink())continue;const w=l.join(r,s.name);let g;try{g=await j(w,{withFileTypes:!0})}catch{continue}const $=g.filter(b=>b.isDirectory()||b.isSymbolicLink());if($.length===0)continue;const C=$.map(b=>b.name).sort().pop(),G=`${s.name}@${n.name}`;e[G]=[{scope:"user",installPath:l.join(w,C),version:C}]}}return e},f=(t,e,i)=>{const n=e?.[e.length-1];return{key:t,alreadyInstalled:i,...n?.scope?{scope:n.scope}:{},...n?.installPath?{installPath:n.installPath}:{},...n?.version?{version:n.version}:{}}},E=async(t,e,i)=>{if(!t.dir)throw new Error(`marketplace dir required for ${e}@${t.name}`);if((await M(t.dir)).isSymbolicLink())return;const n=l.join(t.dir,".claude-plugin","marketplace.json");let r={};try{r=JSON.parse(await S(n,"utf8"))}catch{r={}}const o=Array.isArray(r.plugins)?[...r.plugins]:[],s=`./${l.relative(t.dir,i).split(l.sep).join("/")}`,w={name:e,source:s},g=o.findIndex($=>$?.name===e);g>=0?o[g]=w:o.push(w),r.name=t.name,r.owner||(r.owner={name:"weave"}),r.plugins=o,await v(l.dirname(n),{recursive:!0}),await x(n,`${JSON.stringify(r,null,2)}
3
- `,"utf8")};return{projectPluginDir:t=>l.join(t,".codex","plugins"),pluginKey:c,parsePluginKey(t){const e=t.lastIndexOf("@");return e>0?{name:t.slice(0,e),market:t.slice(e+1)}:{name:t,market:CODEX_MARKETPLACE}},async globalInstall(t,e={}){let i=e.name;if(!i)try{const s=JSON.parse(await S(l.join(t,".claude-plugin","plugin.json"),"utf8"));i=typeof s.name=="string"?s.name:void 0}catch{i=void 0}if(!i)throw new Error(`plugin manifest missing name: ${t}`);const n=e.marketplace,r=c(i,n?.name),o=(await m())[r];if(o&&o.length>0)return f(r,o,!0);if(n)await E(n,i,t),await h(["plugin","marketplace","add",n.dir??""]);else throw new Error(`codex plugin install requires a marketplace (got none for ${r}); weave-managed packs must come from a market directory`);return await h(["plugin","add",r,"--json"]),f(r,(await m())[r],!1)},readInstalled:m,async isInstalled(t,e){const i=(await m())[c(t,e)];return!!i&&i.length>0},async uninstall(t,e){const i=c(t,e),n=(await m())[i];!n||n.length===0||await h(["plugin","remove",i,"--json"])},async removeMarketplace(t){const e=await d();if(!e)return;const i=l.resolve(t),n=O(e);let r;for(const o of n)if(!(!o.key||o.key.length!==2||o.key[0]!=="marketplaces")){for(const[s,w]of L(o.lines.slice(1))){if(s!=="source")continue;const g=w.split("=").slice(1).join("=").trim().replace(/^"(.*)"$/,"$1");if(l.resolve(g)===i){r=o.key[1];break}}if(r)break}r&&await h(["plugin","marketplace","remove",r])},async readProjectEnabled(t,e,i){return p(await d())[c(e,i)]??!1},async setProjectEnabled(t,e,i,n){const r=c(e,n),o=await d()??"";await v(l.dirname(u()),{recursive:!0}),await x(u(),P(o,r,i),"utf8")},async readGlobalEnabled(){return p(await d())},async writeGlobalEnabled(t,e){const i=await d()??"";await v(l.dirname(u()),{recursive:!0}),await x(u(),P(i,t,e),"utf8")},pluginScopes:()=>["user"],async readEnabledOverrides(t){return{user:await this.readGlobalEnabled(),project:{},local:{}}},async setEnabledOverride(t,e,i,n){if(e!=="user")throw new Error(`codex plugins only support user-scope overrides (got ${e})`);const r=await d()??"";if(n==="inherit"){const{text:o,removed:s}=N(r,["plugins",i]);if(!s)return;await v(l.dirname(u()),{recursive:!0}),await x(u(),o,"utf8");return}await v(l.dirname(u()),{recursive:!0}),await x(u(),P(r,i,n==="on"),"utf8")}}}export const CODEX_PLUGINS=createCodexPluginSurface();
1
+ import{spawn as C}from"node:child_process";import{homedir as I}from"node:os";import{lstat as A,mkdir as v,readFile as $,readdir as P,writeFile as E}from"node:fs/promises";import c from"node:path";import{CODEX_ASSETS as U}from"./assets.js";import{parseSectionEntries as L,removeTomlSection as G,splitTomlSections as O,upsertCodexPluginEnabledInText as S}from"./toml.js";export const CODEX_MARKETPLACE="weave";const K=6e4,_=2e3,M=64*1024;export function codexCommandLine(a){return["codex",...a.map(g=>`"${g.replace(/"/g,'\\"')}"`)].join(" ")}function N(a){if(!(a.exitCode!==null||a.signalCode!==null)){if(process.platform==="win32"&&a.pid!==void 0){C("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref();return}a.kill("SIGKILL")}}function D(a){return a.length>_?`${a.slice(0,_)}\u2026`:a}const q=(a,g)=>new Promise((y,u)=>{const x=process.platform==="win32",l=C(x?process.env.ComSpec||"cmd.exe":"codex",x?["/d","/s","/c",codexCommandLine(a)]:a,{windowsHide:!0,windowsVerbatimArguments:x,stdio:["ignore","pipe","pipe"]}),d=`codex ${a.join(" ")}`;let p="",f="",m=!1;const b=e=>{m||(m=!0,clearTimeout(t),u(new Error(D(e))))},t=setTimeout(()=>{N(l),b(`${d}: timed out after ${g.timeoutMs}ms`)},g.timeoutMs);l.stdout?.setEncoding("utf8"),l.stdout?.on("data",e=>{p.length<M&&(p+=e)}),l.stderr?.setEncoding("utf8"),l.stderr?.on("data",e=>{f.length<M&&(f+=e)}),l.on("error",e=>b(`${d}: ${e.message}`)),l.on("close",e=>{if(m)return;if(m=!0,clearTimeout(t),e===0){y({stdout:p,stderr:f});return}const i=[f,p].filter(Boolean).join(`
2
+ `).trim()||`exit ${e}`;u(new Error(D(`${d}: ${i}`)))})});export function createCodexPluginSurface(a={}){const g=a.exec??q,y=t=>g(t,{timeoutMs:K}),u=()=>U.userConfigFile(I()),x=()=>c.join(I(),".codex","plugins","cache"),l=(t,e)=>`${t}@${e??CODEX_MARKETPLACE}`,d=async()=>{try{return await $(u(),"utf8")}catch{return null}},p=t=>{if(!t)return{};const e=O(t),i={};for(const n of e)if(!(!n.key||n.key.length!==2||n.key[0]!=="plugins"))for(const[r,o]of L(n.lines.slice(1))){if(r!=="enabled")continue;const s=o.split("=")[1]?.trim();(s==="true"||s==="false")&&(i[n.key[1]]=s==="true")}return i},f=async()=>{const t=x(),e={};let i;try{i=await P(t,{withFileTypes:!0})}catch{return e}for(const n of i){if(!n.isDirectory()&&!n.isSymbolicLink())continue;const r=c.join(t,n.name);let o;try{o=await P(r,{withFileTypes:!0})}catch{continue}for(const s of o){if(!s.isDirectory()&&!s.isSymbolicLink())continue;const w=c.join(r,s.name);let h;try{h=await P(w,{withFileTypes:!0})}catch{continue}const k=h.filter(j=>j.isDirectory()||j.isSymbolicLink());if(k.length===0)continue;const T=k.map(j=>j.name).sort().pop(),F=`${s.name}@${n.name}`;e[F]=[{scope:"user",installPath:c.join(w,T),version:T}]}}return e},m=(t,e,i)=>{const n=e?.[e.length-1];return{key:t,alreadyInstalled:i,...n?.scope?{scope:n.scope}:{},...n?.installPath?{installPath:n.installPath}:{},...n?.version?{version:n.version}:{}}},b=async(t,e,i)=>{if(!t.dir)throw new Error(`marketplace dir required for ${e}@${t.name}`);if((await A(t.dir)).isSymbolicLink())return;const n=c.join(t.dir,".claude-plugin","marketplace.json");let r={};try{r=JSON.parse(await $(n,"utf8"))}catch{r={}}const o=Array.isArray(r.plugins)?[...r.plugins]:[],s=`./${c.relative(t.dir,i).split(c.sep).join("/")}`,w={name:e,source:s},h=o.findIndex(k=>k?.name===e);h>=0?o[h]=w:o.push(w),r.name=t.name,r.owner||(r.owner={name:"weave"}),r.plugins=o,await v(c.dirname(n),{recursive:!0}),await E(n,`${JSON.stringify(r,null,2)}
3
+ `,"utf8")};return{projectPluginDir:t=>c.join(t,".codex","plugins"),pluginKey:l,parsePluginKey(t){const e=t.lastIndexOf("@");return e>0?{name:t.slice(0,e),market:t.slice(e+1)}:{name:t,market:CODEX_MARKETPLACE}},async globalInstall(t,e={}){let i=e.name;if(!i)try{const s=JSON.parse(await $(c.join(t,".claude-plugin","plugin.json"),"utf8"));i=typeof s.name=="string"?s.name:void 0}catch{i=void 0}if(!i)throw new Error(`plugin manifest missing name: ${t}`);const n=e.marketplace,r=l(i,n?.name),o=(await f())[r];if(o&&o.length>0)return m(r,o,!0);if(n)await b(n,i,t),await y(["plugin","marketplace","add",n.dir??""]);else throw new Error(`codex plugin install requires a marketplace (got none for ${r}); weave-managed packs must come from a market directory`);return await y(["plugin","add",r,"--json"]),m(r,(await f())[r],!1)},readInstalled:f,async isInstalled(t,e){const i=(await f())[l(t,e)];return!!i&&i.length>0},async uninstall(t,e){const i=l(t,e),n=(await f())[i];!n||n.length===0||await y(["plugin","remove",i,"--json"])},async removeMarketplace(t){const e=await d();if(!e)return;const i=c.resolve(t),n=O(e);let r;for(const o of n)if(!(!o.key||o.key.length!==2||o.key[0]!=="marketplaces")){for(const[s,w]of L(o.lines.slice(1))){if(s!=="source")continue;const k=w.split("=").slice(1).join("=").trim().replace(/^"(.*)"$/,"$1");if(c.resolve(k)===i){r=o.key[1];break}}if(r)break}r&&await y(["plugin","marketplace","remove",r])},async readProjectEnabled(t,e,i){return p(await d())[l(e,i)]??!1},async setProjectEnabled(t,e,i,n){const r=l(e,n),o=await d()??"";await v(c.dirname(u()),{recursive:!0}),await E(u(),S(o,r,i),"utf8")},async readGlobalEnabled(){return p(await d())},async writeGlobalEnabled(t,e){const i=await d()??"";await v(c.dirname(u()),{recursive:!0}),await E(u(),S(i,t,e),"utf8")},pluginScopes:()=>["user"],async readEnabledOverrides(t){return{user:await this.readGlobalEnabled(),project:{},local:{}}},async setEnabledOverride(t,e,i,n){if(e!=="user")throw new Error(`codex plugins only support user-scope overrides (got ${e})`);const r=await d()??"";if(n==="inherit"){const{text:o,removed:s}=G(r,["plugins",i]);if(!s)return;await v(c.dirname(u()),{recursive:!0}),await E(u(),o,"utf8");return}await v(c.dirname(u()),{recursive:!0}),await E(u(),S(r,i,n==="on"),"utf8")}}}export const CODEX_PLUGINS=createCodexPluginSurface();
@@ -1 +1 @@
1
- import{existsSync as d}from"node:fs";import{homedir as c}from"node:os";import p from"node:path";import{codexHome as m}from"./home.js";function l(o){return p.join(process.env.LOCALAPPDATA||p.join(o,"AppData","Local"),"OpenAI","Codex")}function u(o){return p.join(m(o),"packages","app-server-daemon")}async function f(o){const{spawn:a}=await import("node:child_process");return new Promise(s=>{let i="";const r=process.platform==="win32"?a(`${o} app-server daemon version`,{windowsHide:!0,shell:!0,stdio:["ignore","pipe","pipe"]}):a(o,["app-server","daemon","version"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),n=setTimeout(()=>{r.kill("SIGKILL"),s(null)},8e3);r.stdout?.on("data",e=>i+=e.toString()),r.on("error",()=>{clearTimeout(n),s(null)}),r.on("close",()=>{clearTimeout(n);try{const e=JSON.parse(i);typeof e.managedCodexVersion=="string"&&typeof e.cliVersion=="string"?s({managedCodexVersion:e.managedCodexVersion,cliVersion:e.cliVersion}):s(null)}catch{s(null)}})})}export async function codexProvisionCheck(o,a=()=>f(o),s=c()){const i=[],r=[],n=d(l(s)),e=d(u(s));if(n&&!e&&(i.push("codex desktop app detected without the shared app-server daemon package \u2014 the two faces share ~/.codex, and version skew makes the older side rewrite config.toml from its stale snapshot (wiping manual provider / hooks-trust edits)"),r.push("codex app-server daemon update --from-cli --yes")),e){const t=await a();t&&t.managedCodexVersion!==t.cliVersion&&(i.push(`codex shared daemon (${t.managedCodexVersion}) differs from CLI (${t.cliVersion}) \u2014 the older side rewrites ~/.codex/config.toml from its stale snapshot on startup, wiping manual edits`),r.push("codex app-server daemon update --from-cli --yes"))}return{desktopApp:n,daemonPackage:e,warnings:i,hints:r}}export const CODEX_PROVISION={harness:"codex",check:codexProvisionCheck};
1
+ import{existsSync as d}from"node:fs";import{homedir as c}from"node:os";import p from"node:path";import{codexHome as m}from"./home.js";function l(o){return p.join(process.env.LOCALAPPDATA||p.join(o,"AppData","Local"),"OpenAI","Codex")}function u(o){return p.join(m(o),"packages","app-server-daemon")}async function f(o){const{spawn:a}=await import("node:child_process");return new Promise(n=>{let r="";const s=process.platform==="win32"?a(`${o} app-server daemon version`,{windowsHide:!0,shell:!0,stdio:["ignore","pipe","pipe"]}):a(o,["app-server","daemon","version"],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),i=setTimeout(()=>{s.kill("SIGKILL"),n(null)},8e3);s.stdout?.on("data",e=>r+=e.toString()),s.on("error",()=>{clearTimeout(i),n(null)}),s.on("close",()=>{clearTimeout(i);try{const e=JSON.parse(r);typeof e.managedCodexVersion=="string"&&typeof e.cliVersion=="string"?n({managedCodexVersion:e.managedCodexVersion,cliVersion:e.cliVersion}):n(null)}catch{n(null)}})})}export async function codexProvisionCheck(o,a=()=>f(o),n=c()){const r=[],s=[],i=d(l(n)),e=d(u(n));if(i&&!e&&(r.push("codex desktop app detected without the shared app-server daemon package \u2014 the two faces share ~/.codex, and version skew makes the older side rewrite config.toml from its stale snapshot (wiping manual provider / hooks-trust edits)"),s.push("codex app-server daemon update --from-cli --yes")),e){const t=await a();t&&t.managedCodexVersion!==t.cliVersion&&(r.push(`codex shared daemon (${t.managedCodexVersion}) differs from CLI (${t.cliVersion}) \u2014 the older side rewrites ~/.codex/config.toml from its stale snapshot on startup, wiping manual edits`),s.push("codex app-server daemon update --from-cli --yes"))}return{desktopApp:i,daemonPackage:e,warnings:r,hints:s}}export const CODEX_PROVISION={harness:"codex",check:codexProvisionCheck};
@@ -1,2 +1,2 @@
1
- const c="y",m="n",d="d",y="1",a={key:"codex:opaque",header:null,question:"The session is waiting for input (options unavailable \u2014 answer in its terminal)",multiSelect:!1,options:[]};function r(s){const e=s&&typeof s=="object"?s:{},n=Array.isArray(e.command)?e.command.filter(i=>typeof i=="string").join(" "):typeof e.command=="string"?e.command:"",o=typeof e.description=="string"?e.description:null,t=n||o||"Codex wants to run a command";return t.length>200?`${t.slice(0,200)}\u2026`:t}function p(s){const e=s&&typeof s=="object"?s:{},n=typeof e.command=="string"?e.command:"";if(!n)return"Codex wants to apply a patch";const o=[...n.matchAll(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm)].map(i=>i[1]),t=o.length>0?o.join(", "):n.split(`
2
- `)[0]??"patch";return t.length>200?`${t.slice(0,200)}\u2026`:t}function u(s,e){const n=e&&typeof e=="object"&&Object.keys(e).length>0?JSON.stringify(e):"",o=`Codex wants to call ${s}`,t=n?`${o} ${n}`:o;return t.length>200?`${t.slice(0,200)}\u2026`:t}function l(s,e){return[{keys:["y"],label:s},{keys:["n"],label:e}]}export const CODEX_QUESTIONS={plan:null,blockingTools:[],permissionNotificationType:null,silentPermissionModes:["bypassPermissions"],permissionQuestion(){return{...a,key:"codex:permission"}},parseQuestions(){return[{...a}]},eventQuestion(s,e){if(s!=="PermissionRequest")return null;const n=e.raw&&typeof e.raw=="object"?e.raw:{},o=e.toolName,t=e.toolInput;return(typeof n.permission_mode=="string"?n.permission_mode:null)==="bypassPermissions"||o==null?null:o.startsWith("mcp__")?{key:"PermissionRequest:mcp",header:"MCP tool approval",question:u(o,t),multiSelect:!1,options:[{keys:["1"],label:"Yes, run the tool and continue"}]}:o==="apply_patch"?{key:"PermissionRequest:patch",header:"Apply patch",question:p(t),multiSelect:!1,options:l("Yes, proceed","No, and tell Codex what to do differently")}:o==="request_permissions"?{key:"PermissionRequest:permissions",header:"Permissions",question:r(t),multiSelect:!1,options:[{keys:["y"],label:"Yes, grant these permissions for this turn"},{keys:["d"],label:"No, continue without permissions"}]}:o==="write_stdin"?{key:"PermissionRequest:write_stdin",header:"Command approval",question:r(t),multiSelect:!1,options:l("Yes, proceed","No, cancel")}:{key:"PermissionRequest:exec",header:"Command approval",question:r(t),multiSelect:!1,options:l("Yes, proceed","No, and tell Codex what to do differently")}}};
1
+ const m="y",p="n",d="d",f="1",c={key:"codex:opaque",header:null,question:"The session is waiting for input (options unavailable \u2014 answer in its terminal)",multiSelect:!1,options:[]};function r(n){const e=n&&typeof n=="object"?n:{},o=Array.isArray(e.command)?e.command.filter(i=>typeof i=="string").join(" "):typeof e.command=="string"?e.command:"",s=typeof e.description=="string"?e.description:null,t=o||s||"Codex wants to run a command";return t.length>200?`${t.slice(0,200)}\u2026`:t}function a(n){const e=n&&typeof n=="object"?n:{},o=typeof e.command=="string"?e.command:"";if(!o)return"Codex wants to apply a patch";const s=[...o.matchAll(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm)].map(i=>i[1]),t=s.length>0?s.join(", "):o.split(`
2
+ `)[0]??"patch";return t.length>200?`${t.slice(0,200)}\u2026`:t}function u(n,e){const o=e&&typeof e=="object"&&Object.keys(e).length>0?JSON.stringify(e):"",s=`Codex wants to call ${n}`,t=o?`${s} ${o}`:s;return t.length>200?`${t.slice(0,200)}\u2026`:t}function l(n,e){return[{keys:["y"],label:n},{keys:["n"],label:e}]}export const CODEX_QUESTIONS={plan:null,blockingTools:[],permissionNotificationType:null,silentPermissionModes:["bypassPermissions"],permissionQuestion(){return{...c,key:"codex:permission"}},parseQuestions(){return[{...c}]},eventQuestion(n,e){if(n!=="PermissionRequest")return null;const o=e.raw&&typeof e.raw=="object"?e.raw:{},s=e.toolName,t=e.toolInput;return(typeof o.permission_mode=="string"?o.permission_mode:null)==="bypassPermissions"||s==null?null:s.startsWith("mcp__")?{key:"PermissionRequest:mcp",header:"MCP tool approval",question:u(s,t),multiSelect:!1,options:[{keys:["1"],label:"Yes, run the tool and continue"}]}:s==="apply_patch"?{key:"PermissionRequest:patch",header:"Apply patch",question:a(t),multiSelect:!1,options:l("Yes, proceed","No, and tell Codex what to do differently")}:s==="request_permissions"?{key:"PermissionRequest:permissions",header:"Permissions",question:r(t),multiSelect:!1,options:[{keys:["y"],label:"Yes, grant these permissions for this turn"},{keys:["d"],label:"No, continue without permissions"}]}:s==="write_stdin"?{key:"PermissionRequest:write_stdin",header:"Command approval",question:r(t),multiSelect:!1,options:l("Yes, proceed","No, cancel")}:{key:"PermissionRequest:exec",header:"Command approval",question:r(t),multiSelect:!1,options:l("Yes, proceed","No, and tell Codex what to do differently")}}};
@@ -1,5 +1,5 @@
1
- import{mkdir as z,open as I,readdir as _,readFile as E,stat as k,utimes as A,writeFile as O}from"node:fs/promises";import u from"node:path";import{CodexTurnBuffer as J,metaOfLine as W}from"./event-source.js";import{readUserCapture as $}from"./capture.js";import{codexHome as x}from"./home.js";const v=512*1024,P=256*1024,T=2*6e4,U=1024*1024,G=10080*6e4,H=400,X=4*1024*1024,D=128*1024,N="cursors.json",q=".lock",K=6e4;function Q(){const n=x();return[u.join(n,"sessions"),u.join(n,"archived_sessions")]}function B(n){const t=u.resolve(n);return process.platform==="win32"?t.toLowerCase():t}function C(n){try{const t=JSON.parse(n);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}async function V(){const n=[],t=async(e,i)=>{if(i>4)return;let a;try{a=await _(e,{withFileTypes:!0})}catch{return}for(const o of a){const c=u.join(e,o.name);if(o.isDirectory()){await t(c,i+1);continue}if(!o.isFile()||!o.name.startsWith("rollout-")||!o.name.endsWith(".jsonl"))continue;const h=await k(c).catch(()=>null);h&&n.push({path:c,size:h.size,mtimeMs:h.mtimeMs})}};for(const e of Q())await t(e,0);return n}async function Y(n){const t=await I(n,"r").catch(()=>null);if(!t)return null;try{const e=Buffer.alloc(D),{bytesRead:i}=await t.read(e,0,D,0),a=e.subarray(0,i).toString("utf8"),o=a.indexOf(`
2
- `);if(o<0)return i<D?"pending":null;const c=C(a.slice(0,o));return c?W(c):null}finally{await t.close()}}async function Z(n,t,e){const i=await I(n,"r").catch(()=>null);if(!i)return null;try{const a=Buffer.alloc(e),{bytesRead:o}=await i.read(a,0,e,t);return{text:a.subarray(0,o).toString("utf8"),bytes:o}}finally{await i.close()}}async function L(n){try{const t=await E(u.join(n,N),"utf8"),e=JSON.parse(t);if(e&&typeof e=="object"&&e.files&&typeof e.files=="object")return e}catch{}return{at:null,files:{}}}async function tt(n,t){t.at=new Date().toISOString(),await z(n,{recursive:!0}),await O(u.join(n,N),JSON.stringify(t))}function et(n){const t=Number(n);if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function st(n){await z(n,{recursive:!0});const t=u.join(n,q),e=`${process.pid}`;try{return await O(t,e,{flag:"wx"}),!0}catch{}const i=(await E(t,"utf8").catch(()=>"")).trim();if(i===e){const a=await k(t).catch(()=>null);if(!a||Date.now()-a.mtimeMs>K){const o=new Date;await A(t,o,o).catch(()=>{})}return!0}return i&&et(i)?!1:O(t,e).then(()=>!0,()=>!1)}const nt=1e4;export class CodexLogSource{harness="codex";buffers=new Map;lastError=null;capture=null;async captureInstalled(){const t=Date.now(),e=x();if(this.capture&&this.capture.root===e&&t-this.capture.at<nt)return this.capture.on;const i=(await $()).installed;return this.capture={root:e,at:t,on:i},i}async poll(t){const e=await this.captureInstalled();if(!await st(t.stateDir))return[];const i=(await V()).sort((s,r)=>s.mtimeMs-r.mtimeMs),a=await L(t.stateDir);if(i.length===0&&Object.keys(a.files).length===0)return[];const o=new Map(t.cwdWhitelist.map(s=>[B(s),s])),c=t.maxRecords??H;let h=t.maxBytes??X;const m=[];let l=!1;for(const s of i){if(m.length>=c||h<=0)break;let r=a.files[s.path],g=!1;if(!r){const f=await Y(s.path);if(f==="pending")continue;if(!f){a.files[s.path]={offset:s.size,sessionId:null,cwd:null},l=!0;continue}r={offset:0,sessionId:f.sessionId,cwd:f.cwd},a.files[s.path]=r,l=!0,Date.now()-s.mtimeMs>G?r.offset=s.size:Date.now()-s.mtimeMs<T&&s.size<U?r.offset=0:(r.offset=Math.max(0,s.size-P),g=!0)}const j=r.cwd?o.get(B(r.cwd)):void 0;if(!j){r.offset!==s.size&&(r.offset=s.size,l=!0);continue}if(s.size<r.offset&&(r.offset=0,g=!1,this.buffers.delete(s.path),l=!0),s.size===r.offset)continue;const w=await Z(s.path,r.offset,Math.min(s.size-r.offset,h));if(!w){this.lastError=`read failed: ${s.path}`;continue}h-=w.bytes;let p=w.text,d=r.offset;if(g){const f=p.indexOf(`
3
- `);if(f<0){r.offset=d+w.bytes,l=!0;continue}d+=Buffer.byteLength(p.slice(0,f+1),"utf8"),p=p.slice(f+1)}const S=p.lastIndexOf(`
4
- `);if(S<0){p.length>v&&(r.offset=d+w.bytes,this.lastError=`oversized line skipped: ${u.basename(s.path)}`,l=!0);continue}let M=d;const F=this.bufferOf(s.path);for(const f of p.slice(0,S).split(`
5
- `)){if(m.length>=c)break;if(M+=Buffer.byteLength(f,"utf8")+1,!f||f.length>v)continue;const y=C(f);if(!y||e&&y.type!=="session_meta")continue;const b=F.report(y);b&&(b.sessionId=r.sessionId??void 0,b.cwd=j,m.push({report:b,at:it(y,s.mtimeMs)}))}r.offset=M,l=!0}const R=new Set(i.map(s=>s.path));for(const s of Object.keys(a.files))R.has(s)||(delete a.files[s],this.buffers.delete(s),l=!0);return l&&await tt(t.stateDir,a).catch(()=>{}),m}async health(t){const e=await L(t.stateDir),i=x();let a=0;for(const o of Object.values(e.files))o.cwd&&a++;return{root:i,files:a,lastPollAt:e.at,lastError:this.lastError}}bufferOf(t){let e=this.buffers.get(t);return e||(e=new J,this.buffers.set(t,e)),e}}function it(n,t){if(typeof n.timestamp=="string"&&n.timestamp){const e=Date.parse(n.timestamp);if(!Number.isNaN(e))return new Date(e).toISOString()}return new Date(t).toISOString()}export const CODEX_LOG_SOURCE=new CodexLogSource;
1
+ import{mkdir as x,open as C,readdir as N,readFile as I,stat as L,utimes as T,writeFile as _}from"node:fs/promises";import l from"node:path";import{CodexTurnBuffer as B,metaOfLine as H}from"./event-source.js";import{readUserCapture as U}from"./capture.js";import{codexHome as O}from"./home.js";const A=512*1024,X=256*1024,W=2*6e4,J=1024*1024,K=10080*6e4,Y=400,P=4*1024*1024,E=128*1024,R="cursors.json",$=".lock",G=6e4;function q(){const n=O();return[l.join(n,"sessions"),l.join(n,"archived_sessions")]}function j(n){const t=l.resolve(n);return process.platform==="win32"?t.toLowerCase():t}function k(n){try{const t=JSON.parse(n);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}async function Q(){const n=[],t=async(e,r)=>{if(r>4)return;let i;try{i=await N(e,{withFileTypes:!0})}catch{return}for(const a of i){const f=l.join(e,a.name);if(a.isDirectory()){await t(f,r+1);continue}if(!a.isFile()||!a.name.startsWith("rollout-")||!a.name.endsWith(".jsonl"))continue;const h=await L(f).catch(()=>null);h&&n.push({path:f,size:h.size,mtimeMs:h.mtimeMs})}};for(const e of q())await t(e,0);return n}async function V(n){const t=await C(n,"r").catch(()=>null);if(!t)return null;try{const e=Buffer.alloc(E),{bytesRead:r}=await t.read(e,0,E,0),i=e.subarray(0,r).toString("utf8"),a=i.indexOf(`
2
+ `);if(a<0)return r<E?"pending":null;const f=k(i.slice(0,a));return f?H(f):null}finally{await t.close()}}async function Z(n,t,e){const r=await C(n,"r").catch(()=>null);if(!r)return null;try{const i=Buffer.alloc(e),{bytesRead:a}=await r.read(i,0,e,t);return{text:i.subarray(0,a).toString("utf8"),bytes:a}}finally{await r.close()}}async function z(n){try{const t=await I(l.join(n,R),"utf8"),e=JSON.parse(t);if(e&&typeof e=="object"&&e.files&&typeof e.files=="object")return e}catch{}return{at:null,files:{}}}async function tt(n,t){t.at=new Date().toISOString(),await x(n,{recursive:!0}),await _(l.join(n,R),JSON.stringify(t))}function et(n){const t=Number(n);if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function st(n){await x(n,{recursive:!0});const t=l.join(n,$),e=`${process.pid}`;try{return await _(t,e,{flag:"wx"}),!0}catch{}const r=(await I(t,"utf8").catch(()=>"")).trim();if(r===e){const i=await L(t).catch(()=>null);if(!i||Date.now()-i.mtimeMs>G){const a=new Date;await T(t,a,a).catch(()=>{})}return!0}return r&&et(r)?!1:_(t,e).then(()=>!0,()=>!1)}const nt=1e4;export class CodexLogSource{harness="codex";buffers=new Map;lastError=null;capture=null;async captureInstalled(){const t=Date.now(),e=O();if(this.capture&&this.capture.root===e&&t-this.capture.at<nt)return this.capture.on;const r=(await U()).installed;return this.capture={root:e,at:t,on:r},r}async poll(t){const e=await this.captureInstalled();if(!await st(t.stateDir))return[];const r=(await Q()).sort((s,o)=>s.mtimeMs-o.mtimeMs),i=await z(t.stateDir);if(r.length===0&&Object.keys(i.files).length===0)return[];const a=new Map(t.cwdWhitelist.map(s=>[j(s),s])),f=t.maxRecords??Y;let h=t.maxBytes??P;const d=[];let u=!1;for(const s of r){if(d.length>=f||h<=0)break;let o=i.files[s.path],S=!1;if(!o){const c=await V(s.path);if(c==="pending")continue;if(!c){i.files[s.path]={offset:s.size,sessionId:null,cwd:null},u=!0;continue}o={offset:0,sessionId:c.sessionId,cwd:c.cwd},i.files[s.path]=o,u=!0,Date.now()-s.mtimeMs>K?o.offset=s.size:Date.now()-s.mtimeMs<W&&s.size<J?o.offset=0:(o.offset=Math.max(0,s.size-X),S=!0)}const M=o.cwd?a.get(j(o.cwd)):void 0;if(!M){o.offset!==s.size&&(o.offset=s.size,u=!0);continue}if(s.size<o.offset&&(o.offset=0,S=!1,this.buffers.delete(s.path),u=!0),s.size===o.offset)continue;const p=await Z(s.path,o.offset,Math.min(s.size-o.offset,h));if(!p){this.lastError=`read failed: ${s.path}`;continue}h-=p.bytes;let w=p.text,m=o.offset;if(S){const c=w.indexOf(`
3
+ `);if(c<0){o.offset=m+p.bytes,u=!0;continue}m+=Buffer.byteLength(w.slice(0,c+1),"utf8"),w=w.slice(c+1)}const g=w.lastIndexOf(`
4
+ `);if(g<0){w.length>A&&(o.offset=m+p.bytes,this.lastError=`oversized line skipped: ${l.basename(s.path)}`,u=!0);continue}let D=m;const F=this.bufferOf(s.path);for(const c of w.slice(0,g).split(`
5
+ `)){if(d.length>=f)break;if(D+=Buffer.byteLength(c,"utf8")+1,!c||c.length>A)continue;const y=k(c);if(!y||e&&y.type!=="session_meta")continue;const b=F.report(y);b&&(b.sessionId=o.sessionId??void 0,b.cwd=M,d.push({report:b,at:rt(y,s.mtimeMs)}))}o.offset=D,u=!0}const v=new Set(r.map(s=>s.path));for(const s of Object.keys(i.files))v.has(s)||(delete i.files[s],this.buffers.delete(s),u=!0);return u&&await tt(t.stateDir,i).catch(()=>{}),d}async health(t){const e=await z(t.stateDir),r=O();let i=0;for(const a of Object.values(e.files))a.cwd&&i++;return{root:r,files:i,lastPollAt:e.at,lastError:this.lastError}}bufferOf(t){let e=this.buffers.get(t);return e||(e=new B,this.buffers.set(t,e)),e}}function rt(n,t){if(typeof n.timestamp=="string"&&n.timestamp){const e=Date.parse(n.timestamp);if(!Number.isNaN(e))return new Date(e).toISOString()}return new Date(t).toISOString()}export const CODEX_LOG_SOURCE=new CodexLogSource;
@@ -1,4 +1,4 @@
1
- const k=2e3,f=/^[^\x00-\x1f\x7f]+$/,a="Side from main thread",E=/•\s+Working\s*\(/,c=/^\s*Worked for\s+/,D=/^\s*└\s+Tip:/,m="\u203A ";function A(u,e,n){const l="\u203A "+u,o=n.split(`
2
- `);let F=-1;for(let t=o.length-1;t>=0;t--){const i=o[t].trim();if(i===l&&!B(e,l)){F=t;break}if(i===l){F=t;break}}if(F<0)return null;const s=[];for(let t=F+1;t<o.length;t++){const i=o[t],r=i.trim();if(r){if(c.test(r))break;if(E.test(r))return null;if(!D.test(i)){if(r.startsWith("\u203A ".trim()))break;if(r.startsWith("\u2022")){s.push(r.replace(/^•\s*/,""));continue}s.length>0&&s.push(r)}}}return s.length>0?s.join(`
3
- `):null}function B(u,e){return u.split(`
4
- `).some(n=>n.trim()===e)}export const CODEX_SIDE_QUESTION={command(u){return u},validate(u){const e=u.trim();return e?e.length>2e3?{ok:!1,error:"\u95EE\u9898\u8FC7\u957F\uFF08\u4E0A\u9650 2000 \u5B57\u7B26\uFF09"}:f.test(e)?{ok:!0,text:e}:{ok:!1,error:"\u95EE\u9898\u4E0D\u80FD\u542B\u6362\u884C\u6216\u63A7\u5236\u5B57\u7B26\uFF08\u4F1A\u63D0\u524D\u63D0\u4EA4\uFF09"}:{ok:!1,error:"\u95EE\u9898\u4E0D\u80FD\u4E3A\u7A7A"}},answerOf(){return null},prerequisite:"\u4E3B\u7EBF\u7A0B\u81F3\u5C11\u53D1\u8FC7\u4E00\u6761\u6D88\u606F\u540E\u624D\u80FD\u5F00\u4FA7\u8FB9\u4F1A\u8BDD\uFF08\u5BBF\u4E3B\u9650\u5236\uFF09",screen:{openKeys:"/side",submitKey:"\r",closeKey:"",panelOpen(u){return u.includes(a)},extractAnswer(u,e,n){return E.test(n)?{answer:null,done:!1}:{answer:A(u,e,n),done:!0}}}};
1
+ const I=2e3,a=/^[^\x00-\x1f\x7f]+$/,_="Side from main thread",f=/•\s+Working\s*\(/,E=/^\s*Worked for\s+/,O=/^\s*└\s+Tip:/,P="\u203A ";function R(e,t,s){const l="\u203A "+e,c=s.split(`
2
+ `);let u=-1;for(let n=c.length-1;n>=0;n--){const i=c[n].trim();if(i===l&&!k(t,l)){u=n;break}if(i===l){u=n;break}}if(u<0)return null;const o=[];for(let n=u+1;n<c.length;n++){const i=c[n],r=i.trim();if(r){if(E.test(r))break;if(f.test(r))return null;if(!O.test(i)){if(r.startsWith("\u203A ".trim()))break;if(r.startsWith("\u2022")){o.push(r.replace(/^•\s*/,""));continue}o.length>0&&o.push(r)}}}return o.length>0?o.join(`
3
+ `):null}function k(e,t){return e.split(`
4
+ `).some(s=>s.trim()===t)}export const CODEX_SIDE_QUESTION={command(e){return e},validate(e){const t=e.trim();return t?t.length>2e3?{ok:!1,error:"\u95EE\u9898\u8FC7\u957F\uFF08\u4E0A\u9650 2000 \u5B57\u7B26\uFF09"}:a.test(t)?{ok:!0,text:t}:{ok:!1,error:"\u95EE\u9898\u4E0D\u80FD\u542B\u6362\u884C\u6216\u63A7\u5236\u5B57\u7B26\uFF08\u4F1A\u63D0\u524D\u63D0\u4EA4\uFF09"}:{ok:!1,error:"\u95EE\u9898\u4E0D\u80FD\u4E3A\u7A7A"}},answerOf(){return null},prerequisite:"\u4E3B\u7EBF\u7A0B\u81F3\u5C11\u53D1\u8FC7\u4E00\u6761\u6D88\u606F\u540E\u624D\u80FD\u5F00\u4FA7\u8FB9\u4F1A\u8BDD\uFF08\u5BBF\u4E3B\u9650\u5236\uFF09",screen:{openKeys:"/side",submitKey:"\r",closeKey:"",panelOpen(e){return e.includes(_)},extractAnswer(e,t,s){return f.test(s)?{answer:null,done:!1}:{answer:R(e,t,s),done:!0}}}};
@@ -1,4 +1,4 @@
1
- import{spawn as w}from"node:child_process";import{readFileSync as S,statSync as g}from"node:fs";import v from"node:path";import{codexHome as y}from"./home.js";import{codexCommandLine as E}from"./plugins.js";const T=1e4,u=new Map;export function codexSessionTitleOf(m,s){const r=v.join(y(s),"session_index.jsonl");let o;try{o=g(r)}catch{return null}const a=u.get(r);if(!a||a.mtimeMs!==o.mtimeMs||a.size!==o.size){const e=new Map;try{for(const p of S(r,"utf8").split(`
2
- `)){const i=p.trim();if(i)try{const t=JSON.parse(i);typeof t.id=="string"&&typeof t.thread_name=="string"&&e.set(t.id,t.thread_name)}catch{}}}catch{return null}u.set(r,{mtimeMs:o.mtimeMs,size:o.size,names:e})}const n=u.get(r).names.get(m)??null;return n!=null&&n.trim()?n:null}export function codexSetSessionTitle(m,s){return new Promise((r,o)=>{const a=s.trim();if(!a){o(new Error("thread name must not be empty"));return}const n=process.platform==="win32",e=w(n?process.env.ComSpec||"cmd.exe":"codex",n?["/d","/s","/c",E(["app-server"])]:["app-server"],{windowsHide:!0,windowsVerbatimArguments:n,stdio:["pipe","pipe","pipe"]});let p=!1,i="";const t=d=>{p||(p=!0,clearTimeout(x),n&&e.pid!==void 0?w("taskkill",["/pid",String(e.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref():e.kill("SIGKILL"),d?o(d):r())},x=setTimeout(()=>t(new Error("codex app-server thread/name/set timed out")),T),l=d=>{e.stdin?.write(`${JSON.stringify(d)}
3
- `)};e.on("error",()=>t(new Error("failed to spawn codex app-server"))),e.on("exit",()=>t(new Error("codex app-server exited before thread/name/set"))),e.stdin?.on("error",()=>t(new Error("codex app-server stdin closed"))),l({jsonrpc:"2.0",id:1,method:"initialize",params:{clientInfo:{name:"weave",title:"weave",version:"1.0.0"}}}),e.stdout?.setEncoding("utf8"),e.stdout?.on("data",d=>{i+=d;let f;for(;(f=i.indexOf(`
4
- `))>=0;){const h=i.slice(0,f);i=i.slice(f+1);let c=null;try{c=JSON.parse(h)}catch{continue}if(c?.id===1){l({jsonrpc:"2.0",method:"initialized",params:{}}),l({jsonrpc:"2.0",id:2,method:"thread/name/set",params:{threadId:m,name:a}});continue}c?.id===2&&t(c.error?new Error(String(c.error.message??"thread/name/set failed")):null)}})})}export function createCodexTitleSurface(m={}){return{harness:"codex",sessionTitleOf:s=>Promise.resolve(codexSessionTitleOf(s,m.home)),setSessionTitle:(s,r)=>codexSetSessionTitle(s,r)}}export const CODEX_TITLES=createCodexTitleSurface();
1
+ import{spawn as h}from"node:child_process";import{readFileSync as S,statSync as g}from"node:fs";import v from"node:path";import{codexHome as y}from"./home.js";import{codexCommandLine as T}from"./plugins.js";const E=1e4,u=new Map;export function codexSessionTitleOf(c,s){const n=v.join(y(s),"session_index.jsonl");let r;try{r=g(n)}catch{return null}const d=u.get(n);if(!d||d.mtimeMs!==r.mtimeMs||d.size!==r.size){const e=new Map;try{for(const l of S(n,"utf8").split(`
2
+ `)){const o=l.trim();if(o)try{const t=JSON.parse(o);typeof t.id=="string"&&typeof t.thread_name=="string"&&e.set(t.id,t.thread_name)}catch{}}}catch{return null}u.set(n,{mtimeMs:r.mtimeMs,size:r.size,names:e})}const i=u.get(n).names.get(c)??null;return i!=null&&i.trim()?i:null}export function codexSetSessionTitle(c,s){return new Promise((n,r)=>{const d=s.trim();if(!d){r(new Error("thread name must not be empty"));return}const i=process.platform==="win32",e=h(i?process.env.ComSpec||"cmd.exe":"codex",i?["/d","/s","/c",T(["app-server"])]:["app-server"],{windowsHide:!0,windowsVerbatimArguments:i,stdio:["pipe","pipe","pipe"]});let l=!1,o="";const t=a=>{l||(l=!0,clearTimeout(w),i&&e.pid!==void 0?h("taskkill",["/pid",String(e.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).unref():e.kill("SIGKILL"),a?r(a):n())},w=setTimeout(()=>t(new Error("codex app-server thread/name/set timed out")),E),p=a=>{e.stdin?.write(`${JSON.stringify(a)}
3
+ `)};e.on("error",()=>t(new Error("failed to spawn codex app-server"))),e.on("exit",()=>t(new Error("codex app-server exited before thread/name/set"))),e.stdin?.on("error",()=>t(new Error("codex app-server stdin closed"))),p({jsonrpc:"2.0",id:1,method:"initialize",params:{clientInfo:{name:"weave",title:"weave",version:"1.0.0"}}}),e.stdout?.setEncoding("utf8"),e.stdout?.on("data",a=>{o+=a;let f;for(;(f=o.indexOf(`
4
+ `))>=0;){const x=o.slice(0,f);o=o.slice(f+1);let m=null;try{m=JSON.parse(x)}catch{continue}if(m?.id===1){p({jsonrpc:"2.0",method:"initialized",params:{}}),p({jsonrpc:"2.0",id:2,method:"thread/name/set",params:{threadId:c,name:d}});continue}m?.id===2&&t(m.error?new Error(String(m.error.message??"thread/name/set failed")):null)}})})}export function createCodexTitleSurface(c={}){return{harness:"codex",sessionTitleOf:s=>Promise.resolve(codexSessionTitleOf(s,c.home)),setSessionTitle:(s,n)=>codexSetSessionTitle(s,n)}}export const CODEX_TITLES=createCodexTitleSurface();
@@ -1,17 +1,17 @@
1
- import{parse as W}from"smol-toml";export class CodexTomlCorruptError extends Error{constructor(n){super(n),this.name="CodexTomlCorruptError"}}function S(t){return/[A-Za-z0-9_-]/.test(t)}function x(t){return t===" "||t===" "}const $={b:"\b",t:" ",n:`
2
- `,f:"\f",r:"\r",'"':'"',"\\":"\\"};export function parseDottedKey(t){const n=[];let e=0;for(;;){for(;e<t.length&&x(t[e]);)e++;if(e>=t.length)return null;const r=t[e];if(r==='"'||r==="'"){e++;let i="";for(;e<t.length;){const o=t[e];if(r==='"'&&o==="\\"){const s=t[e+1];if(s===void 0||!(s in $))return null;i+=$[s],e+=2;continue}if(o===r)break;i+=o,e++}if(e>=t.length)return null;e++,n.push(i)}else{const i=e;for(;e<t.length&&S(t[e]);)e++;if(e===i)return null;n.push(t.slice(i,e))}for(;e<t.length&&x(t[e]);)e++;if(e>=t.length)return n;if(t[e]!==".")return null;e++}}export function sectionHeaderKey(t){const n=t.trim();if(!n.startsWith("["))return null;const e=n.startsWith("[[");let r=e?2:1,i="",o=!1;for(;r<n.length;){const l=n[r];if(l==='"'||l==="'"){const u=l;for(i+=u,r++;r<n.length;){if(u==='"'&&n[r]==="\\"){if(r+1>=n.length)return null;i+=n[r]+n[r+1],r+=2;continue}if(n[r]===u)break;i+=n[r],r++}if(r>=n.length)return null;i+=u,r++;continue}if(l==="]"){if(e){if(n[r+1]!=="]")return null;r+=2}else r++;o=!0;break}i+=l,r++}if(!o)return null;const s=n.slice(r).trim();return s!==""&&!s.startsWith("#")?null:parseDottedKey(i)}export function renderTomlKey(t){return/^[A-Za-z0-9_-]+$/.test(t)?t:`"${y(t)}"`}export function renderTomlHeader(t){return`[${t.map(renderTomlKey).join(".")}]`}function y(t){let n="";for(const e of t)e==="\\"?n+="\\\\":e==='"'?n+='\\"':e===`
3
- `?n+="\\n":e==="\r"?n+="\\r":e===" "?n+="\\t":e<" "||e==="\x7F"?n+=`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`:n+=e;return n}export function renderTomlString(t){const n=t.includes("\\"),e=!t.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(t);return n&&e?`'${t}'`:`"${y(t)}"`}export function splitTomlSections(t){const n=t.split(`
4
- `),e=[];let r={key:null,lines:[]};for(const i of n){const o=sectionHeaderKey(i);o!==null?(e.push(r),r={key:o,lines:[i]}):r.lines.push(i)}return e.push(r),e}export function sameKey(t,n){return t!==null&&t.length===n.length&&t.every((e,r)=>e===n[r])}function g(t,n){return t!==null&&t.length>n.length&&n.every((e,r)=>t[r]===e)}function A(t){let n=0;for(let e=t.length-1;e>=0&&t[e].trim()==="";e--)n++;return n}function p(t){const n=t.replace(/(?:\r?\n)+[ \t]*$/,"");return n===""?"":`${n}
5
- `}function C(t,n){const e=t.replace(/(?:\r?\n)+[ \t]*$/,"");return e.trim()===""?`${n.join(`
1
+ import{parse as W}from"smol-toml";export class CodexTomlCorruptError extends Error{constructor(t){super(t),this.name="CodexTomlCorruptError"}}function A(n){return/[A-Za-z0-9_-]/.test(n)}function y(n){return n===" "||n===" "}const $={b:"\b",t:" ",n:`
2
+ `,f:"\f",r:"\r",'"':'"',"\\":"\\"};export function parseDottedKey(n){const t=[];let e=0;for(;;){for(;e<n.length&&y(n[e]);)e++;if(e>=n.length)return null;const r=n[e];if(r==='"'||r==="'"){e++;let o="";for(;e<n.length;){const i=n[e];if(r==='"'&&i==="\\"){const s=n[e+1];if(s===void 0||!(s in $))return null;o+=$[s],e+=2;continue}if(i===r)break;o+=i,e++}if(e>=n.length)return null;e++,t.push(o)}else{const o=e;for(;e<n.length&&A(n[e]);)e++;if(e===o)return null;t.push(n.slice(o,e))}for(;e<n.length&&y(n[e]);)e++;if(e>=n.length)return t;if(n[e]!==".")return null;e++}}export function sectionHeaderKey(n){const t=n.trim();if(!t.startsWith("["))return null;const e=t.startsWith("[[");let r=e?2:1,o="",i=!1;for(;r<t.length;){const l=t[r];if(l==='"'||l==="'"){const c=l;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(l==="]"){if(e){if(t[r+1]!=="]")return null;r+=2}else r++;i=!0;break}o+=l,r++}if(!i)return null;const s=t.slice(r).trim();return s!==""&&!s.startsWith("#")?null:parseDottedKey(o)}export function renderTomlKey(n){return/^[A-Za-z0-9_-]+$/.test(n)?n:`"${x(n)}"`}export function renderTomlHeader(n){return`[${n.map(renderTomlKey).join(".")}]`}function x(n){let t="";for(const e of n)e==="\\"?t+="\\\\":e==='"'?t+='\\"':e===`
3
+ `?t+="\\n":e==="\r"?t+="\\r":e===" "?t+="\\t":e<" "||e==="\x7F"?t+=`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`:t+=e;return t}export function renderTomlString(n){const t=n.includes("\\"),e=!n.includes("'")&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\n]/.test(n);return t&&e?`'${n}'`:`"${x(n)}"`}export function splitTomlSections(n){const t=n.split(`
4
+ `),e=[];let r={key:null,lines:[]};for(const o of t){const i=sectionHeaderKey(o);i!==null?(e.push(r),r={key:i,lines:[o]}):r.lines.push(o)}return e.push(r),e}export function sameKey(n,t){return n!==null&&n.length===t.length&&n.every((e,r)=>e===t[r])}function m(n,t){return n!==null&&n.length>t.length&&t.every((e,r)=>n[r]===e)}function C(n){let t=0;for(let e=n.length-1;e>=0&&n[e].trim()==="";e--)t++;return t}function h(n){const t=n.replace(/(?:\r?\n)+[ \t]*$/,"");return t===""?"":`${t}
5
+ `}function w(n,t){const e=n.replace(/(?:\r?\n)+[ \t]*$/,"");return e.trim()===""?`${t.join(`
6
6
  `)}
7
7
  `:`${e}
8
8
 
9
- ${n.join(`
9
+ ${t.join(`
10
10
  `)}
11
- `}export function upsertTomlSection(t,n,e){const r=splitTomlSections(t);let i=-1,o=-1;const s=new Set;for(let f=0;f<r.length;f++){const h=r[f].key;sameKey(h,n)?(i<0&&(i=f),s.add(f),o=f):g(h,n)&&(s.add(f),o=f)}if(i<0)return C(t,[renderTomlHeader(n),...e]);const l=r[o].lines,u=l.slice(l.length-A(l)),c=[renderTomlHeader(n),...e,...u],a=[];for(let f=0;f<r.length;f++)f===i&&a.push(...c),!s.has(f)&&a.push(...r[f].lines);return p(a.join(`
12
- `))}export function removeTomlSection(t,n){const e=splitTomlSections(t),r=new Set;for(let o=0;o<e.length;o++){const s=e[o].key;(sameKey(s,n)||g(s,n))&&r.add(o)}if(r.size===0)return{text:t,removed:!1};const i=[];for(let o=0;o<e.length;o++)r.has(o)||i.push(...e[o].lines);return{text:p(i.join(`
13
- `)),removed:!0}}export function parseSectionEntries(t){const n=[];for(const e of t){const r=e.trim();if(r===""||r.startsWith("#")||r.startsWith("["))continue;const i=/^("[^"]*"|'[^']*'|[A-Za-z0-9_-]+)\s*=/.exec(r);if(!i)continue;const o=parseDottedKey(i[1]);o===null||o.length!==1||n.push([o[0],e])}return n}export function upsertCodexPluginEnabledInText(t,n,e){const r=["plugins",n],i=splitTomlSections(t).find(s=>sameKey(s.key,r)),o=[`enabled = ${e?"true":"false"}`];if(i)for(const[s,l]of parseSectionEntries(i.lines.slice(1)))s!=="enabled"&&o.push(l);return upsertTomlSection(t,r,o)}export function renderTomlValue(t){return t==null?'""':typeof t=="boolean"?t?"true":"false":typeof t=="number"?Number.isFinite(t)?String(t):'""':typeof t=="string"?renderTomlString(t):Array.isArray(t)?`[${t.map(renderTomlValue).join(", ")}]`:`{ ${Object.entries(t).filter(([,n])=>n!==void 0).map(([n,e])=>`${renderTomlKey(n)} = ${renderTomlValue(e)}`).join(", ")} }`}export function setTomlValueInText(t,n,e){if(n.length===0)return t;const r=`${renderTomlKey(n[n.length-1])} = ${renderTomlValue(e)}`,i=n.slice(0,-1);if(i.length===0){const h=splitTomlSections(t),d=h[0],k=n[0],m=b(d.lines,k,r);if(m===d.lines)return t;const j=h.flatMap((T,v)=>v===0?m:T.lines);return p(j.join(`
14
- `))}let o=I(t,i);const s=splitTomlSections(o),l=s.findIndex(h=>sameKey(h.key,i));if(l<0)return o;const u=s[l],c=n[n.length-1],a=b(u.lines,c,r);if(a===u.lines)return o;const f=s.flatMap((h,d)=>d===l?a:h.lines);return p(f.join(`
15
- `))}export function removeTomlValueInText(t,n){if(n.length===0)return{text:t,removed:!1};const e=splitTomlSections(t),r=n.slice(0,-1),i=n[n.length-1];for(let o=0;o<e.length;o++){const s=e[o];if(!(r.length===0?s.key===null:sameKey(s.key,r)))continue;const l=E(s.lines,i);if(l!==s.lines){const u=e.flatMap((c,a)=>a===o?l:c.lines);return{text:p(u.join(`
16
- `)),removed:!0}}}return{text:t,removed:!1}}function b(t,n,e){const r=[];let i=!1;for(let s=0;s<t.length;s++){const l=t[s],u=l.trim();if(!i&&(u.startsWith(`${n} =`)||u.startsWith(`${n}=`))){r.push(e),i=!0;continue}r.push(l)}if(i)return r;let o=-1;for(let s=t.length-1;s>=0;s--){const l=t[s].trim();if(l!==""&&!l.startsWith("#")){o=s;break}}return r.splice(o+1,0,e),r}function E(t,n){const e=[];let r=!1;for(const i of t){const o=i.trim();if(!r&&(o.startsWith(`${n} =`)||o.startsWith(`${n}=`))){r=!0;continue}e.push(i)}return r?e:t}function I(t,n){let e=t;for(let r=1;r<=n.length;r++){const i=n.slice(0,r),o=splitTomlSections(e);if(o.some(c=>sameKey(c.key,i)||c.key!==null&&g(c.key,i)))continue;const s=i.slice(0,-1),l=s.length===0?o[0]:o.find(c=>sameKey(c.key,s)),u=i[r-1];if(l){const c=K(l.lines,u);if(c){const a=o.indexOf(l);e=p([...o.flatMap((f,h)=>h===a?c.lines:f.lines),...c.sectionLines].join(`
17
- `));continue}}e=upsertTomlSection(e,[...i],[])}return e}function K(t,n){const e=t.findIndex(c=>{const a=c.trim();return a.startsWith(`${n} =`)&&a.includes("{")});if(e<0)return null;const r=t[e].trim(),i=r.slice(r.indexOf("=")+1).trim();let o;try{o=W(`v = ${i}`)}catch{return null}const s=o.v;if(!s||typeof s!="object"||Array.isArray(s))return null;const l=Object.entries(s).map(([c,a])=>`${renderTomlKey(c)} = ${renderTomlValue(a)}`),u=[...t];return u.splice(e,1),{lines:u,sectionLines:[`[${n}]`,...l]}}
11
+ `}export function upsertTomlSection(n,t,e){const r=splitTomlSections(n);let o=-1,i=-1;const s=new Set;for(let u=0;u<r.length;u++){const d=r[u].key;sameKey(d,t)?(o<0&&(o=u),s.add(u),i=u):m(d,t)&&(s.add(u),i=u)}if(o<0)return w(n,[renderTomlHeader(t),...e]);const l=r[i].lines,c=l.slice(l.length-C(l)),f=[renderTomlHeader(t),...e,...c],a=[];for(let u=0;u<r.length;u++)u===o&&a.push(...f),!s.has(u)&&a.push(...r[u].lines);return h(a.join(`
12
+ `))}export function removeTomlSection(n,t){const e=splitTomlSections(n),r=new Set;for(let i=0;i<e.length;i++){const s=e[i].key;(sameKey(s,t)||m(s,t))&&r.add(i)}if(r.size===0)return{text:n,removed:!1};const o=[];for(let i=0;i<e.length;i++)r.has(i)||o.push(...e[i].lines);return{text:h(o.join(`
13
+ `)),removed:!0}}export function parseSectionEntries(n){const t=[];for(const e of n){const r=e.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],e])}return t}export function upsertCodexPluginEnabledInText(n,t,e){const r=["plugins",t],i=splitTomlSections(n).find(l=>sameKey(l.key,r)),s=[`enabled = ${e?"true":"false"}`];if(i)for(const[l,c]of parseSectionEntries(i.lines.slice(1)))l!=="enabled"&&s.push(c);return upsertTomlSection(n,r,s)}export function renderTomlValue(n){return n==null?'""':typeof n=="boolean"?n?"true":"false":typeof n=="number"?Number.isFinite(n)?String(n):'""':typeof n=="string"?renderTomlString(n):Array.isArray(n)?`[${n.map(renderTomlValue).join(", ")}]`:`{ ${Object.entries(n).filter(([,e])=>e!==void 0).map(([e,r])=>`${renderTomlKey(e)} = ${renderTomlValue(r)}`).join(", ")} }`}export function setTomlValueInText(n,t,e){if(t.length===0)return n;const r=`${renderTomlKey(t[t.length-1])} = ${renderTomlValue(e)}`,o=t.slice(0,-1);if(o.length===0){const d=splitTomlSections(n),p=d[0],k=t[0],g=b(p.lines,k,r);if(g===p.lines)return n;const S=d.flatMap((T,j)=>j===0?g:T.lines);return h(S.join(`
14
+ `))}let i=I(n,o);const s=splitTomlSections(i),l=s.findIndex(d=>sameKey(d.key,o));if(l<0)return i;const c=s[l],f=t[t.length-1],a=b(c.lines,f,r);if(a===c.lines)return i;const u=s.flatMap((d,p)=>p===l?a:d.lines);return h(u.join(`
15
+ `))}export function removeTomlValueInText(n,t){if(t.length===0)return{text:n,removed:!1};const e=splitTomlSections(n),r=t.slice(0,-1),o=t[t.length-1];for(let i=0;i<e.length;i++){const s=e[i];if(!(r.length===0?s.key===null:sameKey(s.key,r)))continue;const c=E(s.lines,o);if(c!==s.lines){const f=e.flatMap((a,u)=>u===i?c:a.lines);return{text:h(f.join(`
16
+ `)),removed:!0}}}return{text:n,removed:!1}}function b(n,t,e){const r=[];let o=!1;for(let s=0;s<n.length;s++){const l=n[s],c=l.trim();if(!o&&(c.startsWith(`${t} =`)||c.startsWith(`${t}=`))){r.push(e),o=!0;continue}r.push(l)}if(o)return r;let i=-1;for(let s=n.length-1;s>=0;s--){const l=n[s].trim();if(l!==""&&!l.startsWith("#")){i=s;break}}return r.splice(i+1,0,e),r}function E(n,t){const e=[];let r=!1;for(const o of n){const i=o.trim();if(!r&&(i.startsWith(`${t} =`)||i.startsWith(`${t}=`))){r=!0;continue}e.push(o)}return r?e:n}function I(n,t){let e=n;for(let r=1;r<=t.length;r++){const o=t.slice(0,r),i=splitTomlSections(e);if(i.some(f=>sameKey(f.key,o)||f.key!==null&&m(f.key,o)))continue;const s=o.slice(0,-1),l=s.length===0?i[0]:i.find(f=>sameKey(f.key,s)),c=o[r-1];if(l){const f=K(l.lines,c);if(f){const a=i.indexOf(l);e=h([...i.flatMap((u,d)=>d===a?f.lines:u.lines),...f.sectionLines].join(`
17
+ `));continue}}e=upsertTomlSection(e,[...o],[])}return e}function K(n,t){const e=n.findIndex(f=>{const a=f.trim();return a.startsWith(`${t} =`)&&a.includes("{")});if(e<0)return null;const r=n[e].trim(),o=r.slice(r.indexOf("=")+1).trim();let i;try{i=W(`v = ${o}`)}catch{return null}const s=i.v;if(!s||typeof s!="object"||Array.isArray(s))return null;const l=Object.entries(s).map(([f,a])=>`${renderTomlKey(f)} = ${renderTomlValue(a)}`),c=[...n];return c.splice(e,1),{lines:c,sectionLines:[`[${t}]`,...l]}}
@@ -1,2 +1,2 @@
1
- export function codexInterruptMarkerAt(o){let t=null;for(const n of o.split(`
2
- `)){if(!n.includes('"turn_aborted"'))continue;let r;try{r=JSON.parse(n)}catch{continue}const i=r;if(i?.payload?.type!=="turn_aborted")continue;const e=Date.parse(String(i.timestamp??""));Number.isFinite(e)&&(t===null||e>t)&&(t=e)}return t}
1
+ export function codexInterruptMarkerAt(o){let t=null;for(const e of o.split(`
2
+ `)){if(!e.includes('"turn_aborted"'))continue;let r;try{r=JSON.parse(e)}catch{continue}const i=r;if(i?.payload?.type!=="turn_aborted")continue;const n=Date.parse(String(i.timestamp??""));Number.isFinite(n)&&(t===null||n>t)&&(t=n)}return t}
@@ -999,6 +999,13 @@ export interface HarnessCommand {
999
999
  source: 'builtin' | 'command' | 'skill' | 'plugin';
1000
1000
  /** 触发符:缺省 `/`;codex 的 skill 是 `$name`。前端按它展示与插胶囊。 */
1001
1001
  sigil?: '/' | '$';
1002
+ /**
1003
+ * 宿主能不能在**句子中间**(前后空白)认出这条命令:claude 的 skill / 插件 /
1004
+ * 自定义命令走 mention 扫描可以,内建只在整条输入开头分派;codex 只有
1005
+ * `$skill` 是 mention(且无前置边界),`/` 命令一律只在开头。缺省 = 只在
1006
+ * 开头可用——前端据此决定句中敲触发符时菜单还弹不弹、气泡还认不认。
1007
+ */
1008
+ inline?: boolean;
1002
1009
  }
1003
1010
  /**
1004
1011
  * 输入框里的一种「命令形态」:宿主自己执行、**不当作一条 prompt 提交**的敲法。
@@ -1 +1 @@
1
- export function commandModeAt(i,r){const t=i.trim();for(const e of r)if(t.startsWith(e.sigil)&&!(e.named&&!/^[A-Za-z][A-Za-z0-9:_-]*(\s|$)/.test(t.slice(e.sigil.length))))return e;return null}export class HarnessRegistry{drivers=new Map;register(r){if(this.drivers.has(r.id))throw new Error(`harness driver already registered: ${r.id}`);this.drivers.set(r.id,r);let t=!1;return()=>{t||(t=!0,this.drivers.get(r.id)===r&&this.drivers.delete(r.id))}}get(r){return this.drivers.get(r)}all(){return[...this.drivers.values()]}byCapability(r){return this.all().filter(t=>t.capabilities.includes(r))}initFor(r){return this.drivers.get(r)?.init}unregister(r){return this.drivers.delete(r)}}export function supports(i,r){return i.capabilities.includes(r)}
1
+ export function commandModeAt(i,e){const t=i.trim();for(const r of e)if(t.startsWith(r.sigil)&&!(r.named&&!/^[A-Za-z][A-Za-z0-9:_-]*(\s|$)/.test(t.slice(r.sigil.length))))return r;return null}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 t=!1;return()=>{t||(t=!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(t=>t.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,2 +1,2 @@
1
- import l from"node:path";import{generateHookHandler as i,readUserCapture as c}from"../claude/capture.js";import{generateAutoMemoryHook as u}from"../claude/helpers-gen.js";import{generateMcpJson as m,mergeMcpJson as h}from"../claude/mcp-gen.js";import{generateSettingsJson as f,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 n(e){return JSON.stringify(e,null,2)+`
2
- `}function p(e){return(o,r)=>{const t=a(o),s=a(r);return t===null||s===null?null:n(e(t,s))}}async function S(e){const o=l.join(e.projectPath,".claude","helpers"),r=(await c({home:e.platform.homeDir})).installed?d:e.hooks,t=[];return e.components.helpers&&t.push({relPath:".claude/helpers/hook-handler.cjs",weaveMarker:WEAVE_CONTENT_MARKER,content:i(e.version)},{relPath:".claude/helpers/auto-memory-hook.mjs",weaveMarker:WEAVE_CONTENT_MARKER,content:u(e.version)}),e.components.settings&&t.push({relPath:".claude/settings.json",content:n(f({components:e.components,hooks:r,platform:e.platform,helpersDir:o})),merge:p(g)}),e.components.mcp&&e.mcp.weave&&t.push({relPath:".mcp.json",content:n(m({platform:e.platform,includeWeaveServer:!0})),merge:p(h)}),t}const v={claude:S,codex:async()=>[]};export function generateInitFiles(e,o){return v[e](o)}
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")}
@@ -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 +1 @@
1
- export const MAX_FIELD_CHARS=4e3,MAX_ARRAY_ITEMS=200;export function capFields(e){if(typeof e=="string")return e.length>4e3?`${e.slice(0,4e3)}\u2026`:e;if(Array.isArray(e))return e.slice(0,200).map(capFields);if(e&&typeof e=="object"){const r={};for(const[n,o]of Object.entries(e))r[n]=capFields(o);return r}return e}
1
+ export const MAX_FIELD_CHARS=4e3,MAX_ARRAY_ITEMS=200;export function capFields(t){if(typeof t=="string")return t.length>4e3?`${t.slice(0,4e3)}\u2026`:t;if(Array.isArray(t))return t.slice(0,200).map(capFields);if(t&&typeof t=="object"){const r={};for(const[o,A]of Object.entries(t))r[o]=capFields(A);return r}return t}
@@ -1 +1 @@
1
- import c from"node:path";import{readZcodeMcp as l,removeZcodeMcp as n,upsertZcodeMcp as d,zcodeMcpFile as r}from"./mcp.js";const p=e=>c.join(e,".zcode","cli","config.json");export const ZCODE_ASSETS={harness:"zcode",targetDir(e){throw new Error(`"${e}" has no ZCode file-asset surface`)},projectSkillsDir:()=>".zcode/skills",globalSkillsRoots:e=>[c.join(e,...".zcode/skills".split("/")),c.join(e,...".agents/skills".split("/"))],userConfigFile:e=>p(e),mcpScopes:()=>["project","user"],mcpDest:(e,s)=>e==="project"?".zcode/config.json":c.join(s,...".zcode/cli/config.json".split("/")),mcpRead:(e,s,o)=>l(r(e,s,o)),mcpWrite:(e,s,o,i,t)=>d(r(e,s,o),i,t),mcpRemove:(e,s,o,i)=>n(r(e,s,o),i),classify(e){return e===".zcode"||e.startsWith(".zcode/")?!0:e.slice(e.lastIndexOf("/")+1)==="AGENTS.md"},ignore(e){return!(e===".zcode"||e.startsWith(".zcode/")||e==="AGENTS.md")}};
1
+ import c from"node:path";import{readZcodeMcp as l,removeZcodeMcp as n,upsertZcodeMcp as d,zcodeMcpFile as r}from"./mcp.js";const p=o=>c.join(o,".zcode","cli","config.json");export const ZCODE_ASSETS={harness:"zcode",targetDir(o){throw new Error(`"${o}" has no ZCode file-asset surface`)},projectSkillsDir:()=>".zcode/skills",globalSkillsRoots:o=>[c.join(o,...".zcode/skills".split("/")),c.join(o,...".agents/skills".split("/"))],userConfigFile:o=>p(o),mcpScopes:()=>["project","user"],mcpDest:(o,s)=>o==="project"?".zcode/config.json":c.join(s,...".zcode/cli/config.json".split("/")),mcpRead:(o,s,e)=>l(r(o,s,e)),mcpWrite:(o,s,e,i,t)=>d(r(o,s,e),i,t),mcpRemove:(o,s,e,i)=>n(r(o,s,e),i),classify(o){return o===".zcode"||o.startsWith(".zcode/")?!0:o.slice(o.lastIndexOf("/")+1)==="AGENTS.md"},ignore(o){return!(o===".zcode"||o.startsWith(".zcode/")||o==="AGENTS.md")}};