@weavecode/weave 0.1.3 → 0.1.4

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 (451) hide show
  1. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/.editorconfig +1 -1
  2. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/CHANGELOG.md +45 -22
  3. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/README.md +26 -1
  4. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/dist/qs.js +27 -27
  5. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/eslint.config.mjs +61 -50
  6. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/formats.js +7 -2
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/parse.js +13 -6
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/stringify.js +5 -3
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/lib/utils.js +15 -7
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/qs/package.json +6 -6
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/dist/common.js +2 -2
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/express-rate-limit/node_modules/ip-address/package.json +2 -2
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/README.md +2 -3
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/common.js +8 -3
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/index.js +1 -1
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/route/index.js +3 -1
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/jsx/base.js +1 -1
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +8 -0
  19. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/serve-static/index.js +3 -1
  20. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/trie-router/node.js +2 -2
  21. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/url.js +11 -6
  22. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/common.js +8 -3
  23. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/index.js +1 -1
  24. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/route/index.js +3 -1
  25. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/jsx/base.js +1 -1
  26. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/bearer-auth/index.js +8 -0
  27. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/serve-static/index.js +3 -1
  28. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/trie-router/node.js +2 -2
  29. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +1 -1
  30. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +1 -1
  31. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +1 -1
  32. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +1 -1
  33. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +1 -1
  34. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +1 -1
  35. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +1 -1
  36. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +1 -1
  37. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +1 -1
  38. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +1 -1
  39. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/helper/testing/index.d.ts +2 -1
  40. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/hono-base.d.ts +21 -9
  41. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/index.d.ts +1 -1
  42. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/components.d.ts +2 -2
  43. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/context.d.ts +2 -2
  44. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/dom/components.d.ts +2 -2
  45. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/dom/css.d.ts +2 -2
  46. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/jsx/streaming.d.ts +4 -3
  47. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +2 -1
  48. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +3 -3
  49. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +3 -3
  50. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/ipaddr.d.ts +1 -1
  51. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/url.js +11 -6
  52. package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/package.json +1 -1
  53. package/node_modules/@weavecode/cli/dist/cli.js +4 -4
  54. package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
  55. package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
  56. package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
  57. package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
  58. package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
  59. package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
  60. package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
  61. package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
  62. package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
  63. package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +2 -1
  64. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +14 -0
  65. package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +4 -3
  66. package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
  67. package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
  68. package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +3 -3
  69. package/node_modules/@weavecode/cli/dist/init/executor.d.ts +5 -4
  70. package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
  71. package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
  72. package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
  73. package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
  74. package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
  75. package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
  76. package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
  77. package/node_modules/@weavecode/cli/dist/init/provision.d.ts +25 -0
  78. package/node_modules/@weavecode/cli/dist/init/provision.js +1 -0
  79. package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
  80. package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
  81. package/node_modules/@weavecode/cli/dist/parser.js +1 -1
  82. package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
  83. package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
  84. package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
  85. package/node_modules/@weavecode/cli/package.json +5 -5
  86. package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
  87. package/node_modules/@weavecode/core/dist/harness.d.ts +13 -1
  88. package/node_modules/@weavecode/core/dist/harness.js +1 -1
  89. package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
  90. package/node_modules/@weavecode/core/dist/index.js +1 -1
  91. package/node_modules/@weavecode/core/dist/platform.js +1 -1
  92. package/node_modules/@weavecode/core/dist/types.js +1 -1
  93. package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
  94. package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
  95. package/node_modules/@weavecode/core/package.json +1 -1
  96. package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -4
  97. package/node_modules/@weavecode/harness/dist/claude/capture.js +9 -9
  98. package/node_modules/@weavecode/harness/dist/claude/commands.js +3 -3
  99. package/node_modules/@weavecode/harness/dist/claude/config.d.ts +9 -0
  100. package/node_modules/@weavecode/harness/dist/claude/config.js +2 -2
  101. package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
  102. package/node_modules/@weavecode/harness/dist/claude/edits.js +1 -1
  103. package/node_modules/@weavecode/harness/dist/claude/event-source.d.ts +2 -0
  104. package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
  105. package/node_modules/@weavecode/harness/dist/claude/images.js +2 -2
  106. package/node_modules/@weavecode/harness/dist/claude/index.d.ts +4 -2
  107. package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
  108. package/node_modules/@weavecode/harness/dist/claude/liveness.d.ts +64 -0
  109. package/node_modules/@weavecode/harness/dist/claude/liveness.js +1 -0
  110. package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
  111. package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
  112. package/node_modules/@weavecode/harness/dist/claude/model-aliases.d.ts +4 -0
  113. package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
  114. package/node_modules/@weavecode/harness/dist/claude/narration.d.ts +13 -0
  115. package/node_modules/@weavecode/harness/dist/claude/narration.js +1 -0
  116. package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
  117. package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -1
  118. package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
  119. package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
  120. package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
  121. package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
  122. package/node_modules/@weavecode/harness/dist/claude/resume.js +1 -1
  123. package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
  124. package/node_modules/@weavecode/harness/dist/claude/side-question.js +2 -2
  125. package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +14 -14
  126. package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -1
  127. package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -2
  128. package/node_modules/@weavecode/harness/dist/claude/transcript.d.ts +13 -0
  129. package/node_modules/@weavecode/harness/dist/claude/transcript.js +7 -6
  130. package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
  131. package/node_modules/@weavecode/harness/dist/codex/capture.d.ts +1 -2
  132. package/node_modules/@weavecode/harness/dist/codex/capture.js +2 -2
  133. package/node_modules/@weavecode/harness/dist/codex/commands.js +4 -4
  134. package/node_modules/@weavecode/harness/dist/codex/config.d.ts +10 -0
  135. package/node_modules/@weavecode/harness/dist/codex/config.js +2 -2
  136. package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
  137. package/node_modules/@weavecode/harness/dist/codex/event-source.d.ts +1 -1
  138. package/node_modules/@weavecode/harness/dist/codex/event-source.js +2 -2
  139. package/node_modules/@weavecode/harness/dist/codex/images.d.ts +2 -0
  140. package/node_modules/@weavecode/harness/dist/codex/images.js +1 -0
  141. package/node_modules/@weavecode/harness/dist/codex/index.d.ts +13 -2
  142. package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
  143. package/node_modules/@weavecode/harness/dist/codex/liveness.d.ts +38 -0
  144. package/node_modules/@weavecode/harness/dist/codex/liveness.js +1 -0
  145. package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -1
  146. package/node_modules/@weavecode/harness/dist/codex/messaging.d.ts +7 -3
  147. package/node_modules/@weavecode/harness/dist/codex/messaging.js +3 -3
  148. package/node_modules/@weavecode/harness/dist/codex/narration.d.ts +10 -0
  149. package/node_modules/@weavecode/harness/dist/codex/narration.js +1 -0
  150. package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
  151. package/node_modules/@weavecode/harness/dist/codex/plugins.js +3 -3
  152. package/node_modules/@weavecode/harness/dist/codex/provision.d.ts +12 -0
  153. package/node_modules/@weavecode/harness/dist/codex/provision.js +1 -0
  154. package/node_modules/@weavecode/harness/dist/codex/questions.d.ts +9 -0
  155. package/node_modules/@weavecode/harness/dist/codex/questions.js +2 -0
  156. package/node_modules/@weavecode/harness/dist/codex/resume.js +1 -1
  157. package/node_modules/@weavecode/harness/dist/codex/rollout.d.ts +8 -5
  158. package/node_modules/@weavecode/harness/dist/codex/rollout.js +5 -5
  159. package/node_modules/@weavecode/harness/dist/codex/side-question.d.ts +12 -0
  160. package/node_modules/@weavecode/harness/dist/codex/side-question.js +4 -0
  161. package/node_modules/@weavecode/harness/dist/codex/titles.d.ts +8 -0
  162. package/node_modules/@weavecode/harness/dist/codex/titles.js +4 -0
  163. package/node_modules/@weavecode/harness/dist/codex/toml.js +13 -13
  164. package/node_modules/@weavecode/harness/dist/codex/transcript.js +2 -2
  165. package/node_modules/@weavecode/harness/dist/driver.d.ts +162 -8
  166. package/node_modules/@weavecode/harness/dist/driver.js +1 -1
  167. package/node_modules/@weavecode/harness/dist/index.d.ts +1 -0
  168. package/node_modules/@weavecode/harness/dist/index.js +1 -1
  169. package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
  170. package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
  171. package/node_modules/@weavecode/harness/dist/install.d.ts +9 -0
  172. package/node_modules/@weavecode/harness/dist/install.js +1 -0
  173. package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
  174. package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
  175. package/node_modules/@weavecode/harness/dist/shared/json-cap.js +1 -1
  176. package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
  177. package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
  178. package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
  179. package/node_modules/@weavecode/harness/package.json +2 -2
  180. package/node_modules/@weavecode/server/dist/config/dotted.js +1 -1
  181. package/node_modules/@weavecode/server/dist/config/profiles.d.ts +10 -1
  182. package/node_modules/@weavecode/server/dist/config/profiles.js +2 -2
  183. package/node_modules/@weavecode/server/dist/daemon/ai-config.js +2 -2
  184. package/node_modules/@weavecode/server/dist/daemon/ai-context.js +6 -6
  185. package/node_modules/@weavecode/server/dist/daemon/ai-routes.js +4 -4
  186. package/node_modules/@weavecode/server/dist/daemon/api-log.js +3 -3
  187. package/node_modules/@weavecode/server/dist/daemon/auth-routes.js +1 -1
  188. package/node_modules/@weavecode/server/dist/daemon/auto-start.js +6 -6
  189. package/node_modules/@weavecode/server/dist/daemon/capture-routes.js +1 -1
  190. package/node_modules/@weavecode/server/dist/daemon/claude-liveness.d.ts +4 -55
  191. package/node_modules/@weavecode/server/dist/daemon/claude-liveness.js +1 -1
  192. package/node_modules/@weavecode/server/dist/daemon/config-routes.js +1 -1
  193. package/node_modules/@weavecode/server/dist/daemon/cron.js +1 -1
  194. package/node_modules/@weavecode/server/dist/daemon/dashboard-auth.js +2 -2
  195. package/node_modules/@weavecode/server/dist/daemon/dashboard-pusher.js +1 -1
  196. package/node_modules/@weavecode/server/dist/daemon/data-bus.js +1 -1
  197. package/node_modules/@weavecode/server/dist/daemon/decision-config.js +2 -2
  198. package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
  199. package/node_modules/@weavecode/server/dist/daemon/fs-browser.js +1 -1
  200. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.d.ts +2 -0
  201. package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
  202. package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
  203. package/node_modules/@weavecode/server/dist/daemon/http.js +1 -1
  204. package/node_modules/@weavecode/server/dist/daemon/liveness.d.ts +7 -0
  205. package/node_modules/@weavecode/server/dist/daemon/liveness.js +1 -0
  206. package/node_modules/@weavecode/server/dist/daemon/mcp-orchestration.js +1 -1
  207. package/node_modules/@weavecode/server/dist/daemon/narration-watcher.d.ts +28 -0
  208. package/node_modules/@weavecode/server/dist/daemon/narration-watcher.js +2 -0
  209. package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.d.ts +16 -0
  210. package/node_modules/@weavecode/server/dist/daemon/opener/backend-ghostty.js +1 -0
  211. package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.d.ts +20 -0
  212. package/node_modules/@weavecode/server/dist/daemon/opener/backend-iterm.js +12 -0
  213. package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.d.ts +23 -0
  214. package/node_modules/@weavecode/server/dist/daemon/opener/backend-konsole.js +2 -0
  215. package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.d.ts +19 -0
  216. package/node_modules/@weavecode/server/dist/daemon/opener/backend-terminal-app.js +1 -0
  217. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.d.ts +87 -0
  218. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wezterm.js +1 -0
  219. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.d.ts +45 -0
  220. package/node_modules/@weavecode/server/dist/daemon/opener/backend-wt.js +1 -0
  221. package/node_modules/@weavecode/server/dist/daemon/opener/backend.d.ts +115 -0
  222. package/node_modules/@weavecode/server/dist/daemon/opener/backend.js +1 -0
  223. package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
  224. package/node_modules/@weavecode/server/dist/daemon/opener/pty-terminals.js +4 -4
  225. package/node_modules/@weavecode/server/dist/daemon/opener/shared.js +1 -1
  226. package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.d.ts +8 -5
  227. package/node_modules/@weavecode/server/dist/daemon/opener/wezterm-mux.js +1 -1
  228. package/node_modules/@weavecode/server/dist/daemon/opener/wt.js +3 -3
  229. package/node_modules/@weavecode/server/dist/daemon/opener.d.ts +23 -120
  230. package/node_modules/@weavecode/server/dist/daemon/opener.js +1 -13
  231. package/node_modules/@weavecode/server/dist/daemon/port.js +1 -1
  232. package/node_modules/@weavecode/server/dist/daemon/project-files.d.ts +17 -2
  233. package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -1
  234. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.d.ts +2 -0
  235. package/node_modules/@weavecode/server/dist/daemon/project-harnesses.js +2 -2
  236. package/node_modules/@weavecode/server/dist/daemon/project-updates-refresher.js +1 -1
  237. package/node_modules/@weavecode/server/dist/daemon/prompt-images.js +1 -1
  238. package/node_modules/@weavecode/server/dist/daemon/routes/hooks-admin.js +1 -1
  239. package/node_modules/@weavecode/server/dist/daemon/routes/market.js +1 -1
  240. package/node_modules/@weavecode/server/dist/daemon/routes/orchestration.js +1 -1
  241. package/node_modules/@weavecode/server/dist/daemon/routes/path-refs.js +1 -1
  242. package/node_modules/@weavecode/server/dist/daemon/routes/project-files.d.ts +6 -0
  243. package/node_modules/@weavecode/server/dist/daemon/routes/project-files.js +1 -0
  244. package/node_modules/@weavecode/server/dist/daemon/routes/projects.js +1 -1
  245. package/node_modules/@weavecode/server/dist/daemon/routes/search.d.ts +38 -0
  246. package/node_modules/@weavecode/server/dist/daemon/routes/search.js +1 -0
  247. package/node_modules/@weavecode/server/dist/daemon/routes/session-control.js +1 -1
  248. package/node_modules/@weavecode/server/dist/daemon/routes/session-insights.js +1 -1
  249. package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
  250. package/node_modules/@weavecode/server/dist/daemon/routes/uploads.js +1 -1
  251. package/node_modules/@weavecode/server/dist/daemon/routes/watches.js +1 -1
  252. package/node_modules/@weavecode/server/dist/daemon/server.d.ts +8 -2
  253. package/node_modules/@weavecode/server/dist/daemon/server.js +8 -8
  254. package/node_modules/@weavecode/server/dist/daemon/session-open.d.ts +10 -1
  255. package/node_modules/@weavecode/server/dist/daemon/session-open.js +1 -1
  256. package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
  257. package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
  258. package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
  259. package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -1
  260. package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
  261. package/node_modules/@weavecode/server/dist/daemon/state.js +2 -2
  262. package/node_modules/@weavecode/server/dist/daemon/static.js +1 -1
  263. package/node_modules/@weavecode/server/dist/daemon/terminal-topology-refresher.js +1 -1
  264. package/node_modules/@weavecode/server/dist/daemon/tls.js +1 -1
  265. package/node_modules/@weavecode/server/dist/daemon/toolkit-routes.js +1 -1
  266. package/node_modules/@weavecode/server/dist/daemon/upload-sessions.js +1 -1
  267. package/node_modules/@weavecode/server/dist/db/db.js +5 -2
  268. package/node_modules/@weavecode/server/dist/db/layout.js +1 -1
  269. package/node_modules/@weavecode/server/dist/hooks/answer-keys.js +1 -1
  270. package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +10 -0
  271. package/node_modules/@weavecode/server/dist/hooks/bus.js +1 -1
  272. package/node_modules/@weavecode/server/dist/hooks/dashboard-rate.js +1 -1
  273. package/node_modules/@weavecode/server/dist/hooks/decision-judge.js +1 -1
  274. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.d.ts +20 -0
  275. package/node_modules/@weavecode/server/dist/hooks/delivery/ack-gate.js +1 -1
  276. package/node_modules/@weavecode/server/dist/hooks/delivery/channels.js +1 -1
  277. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.d.ts +7 -1
  278. package/node_modules/@weavecode/server/dist/hooks/delivery/keys.js +1 -1
  279. package/node_modules/@weavecode/server/dist/hooks/delivery/queue.d.ts +4 -4
  280. package/node_modules/@weavecode/server/dist/hooks/delivery/queue.js +1 -1
  281. package/node_modules/@weavecode/server/dist/hooks/delivery/relay.js +1 -1
  282. package/node_modules/@weavecode/server/dist/hooks/delivery/send.js +2 -2
  283. package/node_modules/@weavecode/server/dist/hooks/delivery/views.d.ts +3 -1
  284. package/node_modules/@weavecode/server/dist/hooks/delivery/views.js +1 -1
  285. package/node_modules/@weavecode/server/dist/hooks/dispatcher.d.ts +5 -0
  286. package/node_modules/@weavecode/server/dist/hooks/dispatcher.js +6 -6
  287. package/node_modules/@weavecode/server/dist/hooks/edge-extract.js +1 -1
  288. package/node_modules/@weavecode/server/dist/hooks/handlers/webhook.js +1 -1
  289. package/node_modules/@weavecode/server/dist/hooks/headless-runner.js +2 -2
  290. package/node_modules/@weavecode/server/dist/hooks/inbox-socket.js +2 -2
  291. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.d.ts +15 -0
  292. package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
  293. package/node_modules/@weavecode/server/dist/hooks/match.js +1 -1
  294. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.d.ts +64 -6
  295. package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +3 -2
  296. package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
  297. package/node_modules/@weavecode/server/dist/hooks/orchestration-engine.js +7 -7
  298. package/node_modules/@weavecode/server/dist/hooks/orchestration-graph.js +1 -1
  299. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.d.ts +5 -0
  300. package/node_modules/@weavecode/server/dist/hooks/plugin-installer.js +3 -3
  301. package/node_modules/@weavecode/server/dist/hooks/plugin-loader.js +1 -1
  302. package/node_modules/@weavecode/server/dist/hooks/plugin-project-state.js +1 -1
  303. package/node_modules/@weavecode/server/dist/hooks/prompt-flusher.js +1 -1
  304. package/node_modules/@weavecode/server/dist/hooks/promptbox.js +8 -8
  305. package/node_modules/@weavecode/server/dist/hooks/push-notify.js +2 -2
  306. package/node_modules/@weavecode/server/dist/hooks/question-tracker.js +1 -1
  307. package/node_modules/@weavecode/server/dist/hooks/registry.js +1 -1
  308. package/node_modules/@weavecode/server/dist/hooks/resume-runner.js +1 -1
  309. package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
  310. package/node_modules/@weavecode/server/dist/hooks/session-sweeper.d.ts +2 -0
  311. package/node_modules/@weavecode/server/dist/hooks/session-sweeper.js +1 -1
  312. package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -1
  313. package/node_modules/@weavecode/server/dist/hooks/synthetic-sessions.js +1 -1
  314. package/node_modules/@weavecode/server/dist/hooks/toolkit-scan.js +1 -1
  315. package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
  316. package/node_modules/@weavecode/server/dist/hooks/watch-engine.js +1 -1
  317. package/node_modules/@weavecode/server/dist/index.d.ts +1 -0
  318. package/node_modules/@weavecode/server/dist/index.js +1 -1
  319. package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
  320. package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
  321. package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
  322. package/node_modules/@weavecode/server/dist/install/file-assets.js +1 -1
  323. package/node_modules/@weavecode/server/dist/install/fingerprint.js +1 -1
  324. package/node_modules/@weavecode/server/dist/install/global-config.js +1 -1
  325. package/node_modules/@weavecode/server/dist/install/global-file-assets.js +1 -1
  326. package/node_modules/@weavecode/server/dist/install/init-files.js +2 -2
  327. package/node_modules/@weavecode/server/dist/install/install-ledger.js +1 -1
  328. package/node_modules/@weavecode/server/dist/install/installer.js +1 -1
  329. package/node_modules/@weavecode/server/dist/install/library-index.js +1 -1
  330. package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
  331. package/node_modules/@weavecode/server/dist/install/plugin-install.js +1 -1
  332. package/node_modules/@weavecode/server/dist/install/plugin-rows.js +1 -1
  333. package/node_modules/@weavecode/server/dist/install/plugin-templates.js +1 -1
  334. package/node_modules/@weavecode/server/dist/install/project-config.js +1 -1
  335. package/node_modules/@weavecode/server/dist/install/reader.js +1 -1
  336. package/node_modules/@weavecode/server/dist/install/scan-cache.js +1 -1
  337. package/node_modules/@weavecode/server/dist/install/scanner.js +1 -1
  338. package/node_modules/@weavecode/server/dist/install/settings-mcp.js +2 -2
  339. package/node_modules/@weavecode/server/dist/install/updates.js +1 -1
  340. package/node_modules/@weavecode/server/dist/market/builtin.js +1 -1
  341. package/node_modules/@weavecode/server/dist/market/identity.js +1 -1
  342. package/node_modules/@weavecode/server/dist/market/import.js +2 -2
  343. package/node_modules/@weavecode/server/dist/market/refresh.js +1 -1
  344. package/node_modules/@weavecode/server/dist/market/resolve.js +1 -1
  345. package/node_modules/@weavecode/server/dist/market/updates.js +1 -1
  346. package/node_modules/@weavecode/server/dist/registry.js +2 -2
  347. package/node_modules/@weavecode/server/dist/repositories/hook-dispatches.js +5 -5
  348. package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +19 -1
  349. package/node_modules/@weavecode/server/dist/repositories/hook-events.js +9 -3
  350. package/node_modules/@weavecode/server/dist/repositories/hook-rules.js +4 -4
  351. package/node_modules/@weavecode/server/dist/repositories/libraries.js +1 -1
  352. package/node_modules/@weavecode/server/dist/repositories/orchestrations.js +7 -7
  353. package/node_modules/@weavecode/server/dist/repositories/plugin-states.js +1 -1
  354. package/node_modules/@weavecode/server/dist/repositories/projects.js +2 -2
  355. package/node_modules/@weavecode/server/dist/repositories/push-subscriptions.js +2 -2
  356. package/node_modules/@weavecode/server/dist/repositories/session-watches.js +4 -4
  357. package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +12 -2
  358. package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
  359. package/node_modules/@weavecode/server/dist/repositories/side-questions.d.ts +7 -0
  360. package/node_modules/@weavecode/server/dist/repositories/side-questions.js +8 -5
  361. package/node_modules/@weavecode/server/dist/repositories/uploads.js +11 -11
  362. package/node_modules/@weavecode/server/dist/statusline/cache-sweeper.js +1 -1
  363. package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -1
  364. package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -3
  365. package/node_modules/@weavecode/server/dist/surfaces.d.ts +8 -1
  366. package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
  367. package/node_modules/@weavecode/server/dist/version.d.ts +1 -11
  368. package/node_modules/@weavecode/server/dist/version.js +1 -1
  369. package/node_modules/@weavecode/server/dist/watch/cache.js +1 -1
  370. package/node_modules/@weavecode/server/dist/watch/classifier.js +1 -1
  371. package/node_modules/@weavecode/server/dist/watch/plugin-mods.js +1 -1
  372. package/node_modules/@weavecode/server/dist/watch/sync-scheduler.js +1 -1
  373. package/node_modules/@weavecode/server/dist/watch/watch-service.js +1 -1
  374. package/node_modules/@weavecode/server/package.json +4 -4
  375. package/node_modules/@weavecode/server/web/dist/assets/{abnfDiagram-WEYOIA3C-etRkSvQM.js → abnfDiagram-WEYOIA3C-DA-K085F.js} +1 -1
  376. package/node_modules/@weavecode/server/web/dist/assets/{arc-FxRZALAZ.js → arc-BI1jnmdZ.js} +1 -1
  377. package/node_modules/@weavecode/server/web/dist/assets/{architectureDiagram-ZHVYKT53-5OxZ-ffz.js → architectureDiagram-ZHVYKT53-DbdBgric.js} +1 -1
  378. package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-C-CgMF0O.js → blockDiagram-RJAE7QA3-BPRBmzb-.js} +1 -1
  379. package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-B6TqN1Pw.js → c4Diagram-XDPPPE54-C4D5sRs1.js} +1 -1
  380. package/node_modules/@weavecode/server/web/dist/assets/channel-DcCJrvon.js +1 -0
  381. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-Bdzr5RRj.js → chunk-2E7WHVMD-9ZSKiNU3.js} +1 -1
  382. package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-gBZASjAC.js → chunk-2Q5K7J3B-i0AOjw_8.js} +1 -1
  383. package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-DSlUhKMw.js → chunk-4EMNKR2T-DTpLfX1H.js} +1 -1
  384. package/node_modules/@weavecode/server/web/dist/assets/{chunk-55XCU76K-BDQ6zpGR.js → chunk-55XCU76K-COQYRD4q.js} +1 -1
  385. package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-DPnewKbl.js → chunk-5VM5RSS4-VsftEbvo.js} +1 -1
  386. package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-DagmT8Cc.js → chunk-JWPE2WC7-DonektJN.js} +1 -1
  387. package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-Da_2PxfM.js → chunk-VQ5W62QI-CaKUwuul.js} +1 -1
  388. package/node_modules/@weavecode/server/web/dist/assets/{chunk-XXDRQBXY-Cdaysois.js → chunk-XXDRQBXY-DXH3D_MT.js} +1 -1
  389. package/node_modules/@weavecode/server/web/dist/assets/{chunk-ZCHMQSOR-CvgYfbjU.js → chunk-ZCHMQSOR-COwyAuGn.js} +2 -2
  390. package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-ahplYD2h.js → classDiagram-v2-4MYWR3UA-DEvMZ6mX.js} +1 -1
  391. package/node_modules/@weavecode/server/web/dist/assets/{cose-bilkent-JH36ORCC-DFyUfgKj.js → cose-bilkent-JH36ORCC-6JBJHfH6.js} +1 -1
  392. package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-mr2qRwod.js → cynefin-EF2NZ3EQ-C4GM4sjT.js} +1 -1
  393. package/node_modules/@weavecode/server/web/dist/assets/{cynefinDiagram-WF24UDRP-BC26VqNp.js → cynefinDiagram-WF24UDRP-Cqgi0MBP.js} +1 -1
  394. package/node_modules/@weavecode/server/web/dist/assets/{dagre-NK4GIZVX-DoKn_P1x.js → dagre-NK4GIZVX-CljrnkCY.js} +1 -1
  395. package/node_modules/@weavecode/server/web/dist/assets/{diagram-CBK3MWTC-C9WfEmt3.js → diagram-CBK3MWTC-C3PyOj5J.js} +1 -1
  396. package/node_modules/@weavecode/server/web/dist/assets/{diagram-I5XIIV2D-D4Ibieda.js → diagram-I5XIIV2D-I5brQlaZ.js} +1 -1
  397. package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-wsLbYLi0.js → diagram-ODIL2UCW-BX9uFNbU.js} +1 -1
  398. package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-DBioMmDk.js → diagram-PFBEJUXE-y7D-VmqJ.js} +1 -1
  399. package/node_modules/@weavecode/server/web/dist/assets/{diagram-RJA3I4VV-Cl5gKsWm.js → diagram-RJA3I4VV-DLUL8W42.js} +1 -1
  400. package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-BSXOaZic.js → diagram-TYUNFSNR-DLCC3ILi.js} +1 -1
  401. package/node_modules/@weavecode/server/web/dist/assets/{ebnfDiagram-V4P3TTPT-CJIGOag6.js → ebnfDiagram-V4P3TTPT-D7vALia7.js} +1 -1
  402. package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-D6nd2OVX.js → elk-QONTBCTQ-Ct2_hatz.js} +1 -1
  403. package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-gmXjWsuF.js → erDiagram-KYQIGQAA-DxLai58T.js} +1 -1
  404. package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-DWAiZ43K.js → flowDiagram-IUGLLWBU-AWn2IHrF.js} +1 -1
  405. package/node_modules/@weavecode/server/web/dist/assets/{ganttDiagram-R7GPNTJY-De4v6Wtt.js → ganttDiagram-R7GPNTJY-DmRHd4Wz.js} +1 -1
  406. package/node_modules/@weavecode/server/web/dist/assets/{gitGraphDiagram-PDYL7XHY-CouLBWOB.js → gitGraphDiagram-PDYL7XHY-Ccj-t3zg.js} +1 -1
  407. package/node_modules/@weavecode/server/web/dist/assets/index-BSxzia7U.js +1031 -0
  408. package/node_modules/@weavecode/server/web/dist/assets/index-CEpJpR7P.css +11 -0
  409. package/node_modules/@weavecode/server/web/dist/assets/{infoDiagram-MVDRKAX5-CeMCdduD.js → infoDiagram-MVDRKAX5-BHquFlQa.js} +1 -1
  410. package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-DK6hETwg.js → ishikawaDiagram-HPEHV2GE-CVogEbdm.js} +1 -1
  411. package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-BcgwTlST.js → journeyDiagram-BOSHW7O7-DC9XG9oh.js} +1 -1
  412. package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-CTVMJNz2.js → kanban-definition-FNSA4HC5-C_eu7DC_.js} +1 -1
  413. package/node_modules/@weavecode/server/web/dist/assets/{linear-CqQf5eWO.js → linear-keTbWHJ-.js} +1 -1
  414. package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-B6KZaljU.js → mermaid.core-4sbg0MnY.js} +4 -4
  415. package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-cpKvrQTI.js → mindmap-definition-6OY57UG3-kMQS0S2l.js} +1 -1
  416. package/node_modules/@weavecode/server/web/dist/assets/{pegDiagram-ECIUJNBX-Bv2bNqMZ.js → pegDiagram-ECIUJNBX-DcUFoEwP.js} +1 -1
  417. package/node_modules/@weavecode/server/web/dist/assets/{pieDiagram-GNMPY74T-CXOnA429.js → pieDiagram-GNMPY74T-BQJ7WDCx.js} +1 -1
  418. package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-BFDUpWZb.js → quadrantDiagram-D57K4MC3-C7Oi1-sq.js} +1 -1
  419. package/node_modules/@weavecode/server/web/dist/assets/{railroadDiagram-Y72NRBL7-BHoDSO0D.js → railroadDiagram-Y72NRBL7-CEF2QbOF.js} +1 -1
  420. package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-B8JGji7q.js → requirementDiagram-EQYSW5RA-CTjjFS7X.js} +1 -1
  421. package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-BbE2-6ZM.js → sankeyDiagram-SY24JHO5-j0S5kubS.js} +1 -1
  422. package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-DwK4X2MT.js → sequenceDiagram-BLEHNHQU-B76EsZp4.js} +1 -1
  423. package/node_modules/@weavecode/server/web/dist/assets/{sizeCapture-INFHLROL-CY10zRMe.js → sizeCapture-INFHLROL-r0DZuqAy.js} +1 -1
  424. package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-32t4Zx8b.js → stateDiagram-v2-A6IESKWZ-B4DR9LHz.js} +1 -1
  425. package/node_modules/@weavecode/server/web/dist/assets/{swimlanes-B3ENRKFQ-CZlYQ8_g.js → swimlanes-B3ENRKFQ-Dbcl85ro.js} +1 -1
  426. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-CZ_6SSBd.js +8 -0
  427. package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-8VsB-Jwg.js → timeline-definition-JXYKGLGB-BlBXXRNf.js} +1 -1
  428. package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-CKOTONay.js → usecaseDiagram-WPOLBNNX-Ck1M0dpc.js} +1 -1
  429. package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-BzrNjxtm.js → vennDiagram-Q3Y3IDCW-N8B-ohWk.js} +1 -1
  430. package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-CrSd-v8I.js → wardleyDiagram-IVAIDKWA-DX-AMXq_.js} +1 -1
  431. package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-t9cV9_9b.js → xychartDiagram-4URNHDU4-4fgL48Yl.js} +1 -1
  432. package/node_modules/@weavecode/server/web/dist/index.html +5 -4
  433. package/node_modules/@weavecode/templates/package.json +2 -2
  434. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/node_modules/@peculiar/asn1-x509-attr/package.json +3 -3
  435. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-cms/package.json +4 -4
  436. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-csr/package.json +3 -3
  437. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-ecc/package.json +3 -3
  438. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-pfx/package.json +5 -5
  439. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-pkcs8/package.json +3 -3
  440. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/node_modules/@peculiar/asn1-x509-attr/package.json +3 -3
  441. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-pkcs9/package.json +7 -7
  442. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-rsa/package.json +3 -3
  443. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-schema/package.json +1 -1
  444. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/build/cjs/time.js +1 -1
  445. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/build/es2015/time.js +1 -1
  446. package/node_modules/selfsigned/node_modules/@peculiar/x509/node_modules/@peculiar/asn1-x509/package.json +2 -2
  447. package/package.json +6 -6
  448. package/node_modules/@weavecode/server/web/dist/assets/channel-Dv4QUMOJ.js +0 -1
  449. package/node_modules/@weavecode/server/web/dist/assets/index-BXhLerZ4.js +0 -1008
  450. package/node_modules/@weavecode/server/web/dist/assets/index-BYRxC-Zz.css +0 -11
  451. package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-BlIxQLON.js +0 -8
@@ -0,0 +1,45 @@
1
+ import { TerminalBackend, type LaunchOrigin, type TerminalLaunch } from './backend.js';
2
+ import type { AttachTarget } from './wezterm-mux.js';
3
+ /**
4
+ * Windows Terminal(win32):无官方枚举 API,反查走进程树——每个 pane 的
5
+ * shell 是 `WindowsTerminal.exe` 的直接子进程(`OpenConsole.exe` 是 ConPTY
6
+ * 宿主、兄弟进程),shell 的 PEB cwd 即 pane 实时工作目录。pane 归属不到
7
+ * 具体窗口(多窗口共进程、窗口名不外露),角标口径 = 本项目 pane 数(前端
8
+ * 文案「N 个终端已打开」对窗口/pane 皆成立)。开窗/落点走 wt 命名窗口:
9
+ * `-w <name>` 在则进 tab、不在则重建——天然就是「复用项目窗口」的落点语义,
10
+ * 零簿记;定点附加 = 命名窗口里 split-pane(分屏)。
11
+ */
12
+ export declare class WtBackend extends TerminalBackend {
13
+ constructor(platform: NodeJS.Platform);
14
+ candidates(dir: string, run?: string[]): TerminalLaunch[];
15
+ countWindows(dirs: readonly string[]): Promise<Map<string, number>>;
16
+ /**
17
+ * 目标列表 = 项目命名窗口一条(pane 反查只判「项目有没有 wt 终端」,归属
18
+ * 不了用户手开的未命名窗口——那些列了也无处落子)。走缓存:wt 的落点
19
+ * 自愈(命名窗口不在则重建),不像 wezterm 分屏会落进刚关掉的 pane。
20
+ */
21
+ listTargets(dir: string): Promise<AttachTarget[]>;
22
+ /** 定点附加:命名窗口里分屏跑命令;窗口已关则 wt 重建(原生语义,落点自愈)。 */
23
+ runAt(dir: string, argv: string[], targetId: string): Promise<LaunchOrigin | null>;
24
+ /**
25
+ * 唤出:wt 的 CLI 只有 stdin 通道、进程本身也拿不到窗口号,所以按「这个项目的
26
+ * pane 进程」反查窗口——往上找到宿主 `WindowsTerminal.exe`(wt 一窗一进程),
27
+ * 那个进程的顶层窗口就是要抬的那个;进程和窗口对不上就抛真相,不瞎抬。
28
+ */
29
+ focusTarget(dir: string, targetId: string): Promise<void>;
30
+ /**
31
+ * 层② 定位:会话自己上报的 `CLAUDE_PID` 就是那个 pane 的 console 客户端
32
+ * (hook 是它的子进程,跑在同一个 ConPTY 里)。WT 没有 pane 号通道,故 pane
33
+ * id = 该 pid;存在性校验 = pid 还活着(死了宁可 null,回落标题+cwd)。
34
+ */
35
+ locatePane(env: Record<string, string>): Promise<string | null>;
36
+ /** 本后端的 pane id 表示法 = `wt:<pid>`(见 parseWtPaneId)。 */
37
+ ownsPaneId(paneId: string): boolean;
38
+ /**
39
+ * prompt 层② 注入:bracketed paste 打原文(内含 CR 是字面内容、不提交)→
40
+ * 补一记 CR 提交。与 wezterm 那条通道同语义,只是键记录直写 console。
41
+ */
42
+ sendPromptText(paneId: string, text: string): Promise<void>;
43
+ /** 裸键序(阻塞问答作答 / 中断 ESC):控制字符按真键记录下发(见 wtInjectKeys)。 */
44
+ sendKeys(paneId: string, keys: string): Promise<void>;
45
+ }
@@ -0,0 +1 @@
1
+ import{basename as c}from"node:path";import{pidAlive as f}from"../claude-liveness.js";import{countWindowsByDir as s,normalizeDirKey as l}from"./wezterm-mux.js";import{BRACKETED_PASTE_END as d,BRACKETED_PASTE_START as h,parseWtPaneId as a,parseWtTargetId as w,wtInjectKeys as p,wtPanePidFromEnv as E,wtPanesAsWindows as m,wtPanesCached as i,wtWindowSlug as u}from"./wt.js";import{winRaiseTerminalWindow as T}from"./win-raise.js";import{throughCmd as y}from"./shared.js";import{PRESET_CANDIDATES as P,TerminalBackend as g}from"./backend.js";export class WtBackend extends g{constructor(t){super("wt",t==="win32",t,t==="win32")}candidates(t,n){return P.wt(t,n,this.platform)}async countWindows(t){if(t.length===0||this.platform!=="win32")return new Map(t.map(e=>[e,0]));const n=await i();return n.length===0?new Map(t.map(e=>[e,0])):s(t,m(n))}async listTargets(t){if(this.platform!=="win32")return[];const n=await i(),e=s([t],m(n)).get(t)??0;return e===0?[]:[{id:`wt:${u(t)}`,windowId:0,tabId:0,title:c(t),matchCount:e,paneCount:e,active:!1,full:!1}]}async runAt(t,n,e){if(this.platform!=="win32")throw new Error(`Terminal preset "${this.preset}" is unavailable on this platform`);if(!w(e))throw new Error(`Invalid terminal target "${e}"`);return await this.spawnFirst([{command:"wt.exe",args:["-w",u(t),"split-pane","-d",t,...y(n,!0)??[]]}],`Terminal preset "${this.preset}" is unavailable on this platform`),null}async focusTarget(t,n){if(!w(n))throw new Error(`Invalid terminal target "${n}"`);const e=l(t,this.platform),o=(await i()).filter(r=>e!==null&&l(r.cwd,this.platform)===e).map(r=>r.pid);if(!o.length)throw new Error("That terminal is gone \u2014 reopen the list");await T({panePids:o,exe:"windowsterminal.exe"})}async locatePane(t){const n=E(t);return n==null||!f(n)?null:`wt:${n}`}ownsPaneId(t){return a(t)!==null}async sendPromptText(t,n){const e=a(t);if(e==null)throw new Error(`Invalid prompt pane "${t}"`);await p(e,`${h}${n}${d}\r`)}async sendKeys(t,n){const e=a(t);if(e==null)throw new Error(`Invalid prompt pane "${t}"`);await p(e,n)}}
@@ -0,0 +1,115 @@
1
+ import type { TerminalPreset, TerminalSettings } from '../settings.js';
2
+ import type { AttachTarget, SessionTerminal } from './wezterm-mux.js';
3
+ /**
4
+ * 终端后端基类与共享件:模板方法骨架(「取候选 → 按序尝试 → 全失败抛真相」)、
5
+ * 候选表驱动的通用后端、custom 后端、各 preset 的候选表。各终端自己的后端类在
6
+ * 同级 `backend-<preset>.ts`;工厂表与 `auto` 组合在 opener.ts(门面层,避免
7
+ * 基类 ← 子类 → 工厂的循环 import)。
8
+ *
9
+ * **能力全归后端**,一律「覆写 = 有,基类空实现 = 没有」:
10
+ * enumerable(能否反查已开窗口,不是调用方散写的 `preset === 'wezterm'` 白名单)、
11
+ * textAddressable(能否注入文本 / 裸键序)、locatePane(能否把 hook 上报的 pane env
12
+ * 解析回本后端的 pane 表示法——pane 表示法是后端私有知识,调用方只见不透明 id)、
13
+ * ownsPaneId(这个 id 是不是本后端发的——**击键/文本按 id 认领后端**,故「往哪个终端
14
+ * 打键」不随设置里的 preset 走)。
15
+ * 不支持就走基类空实现(角标不显示 / 层② 诚实置灰 / 回落标题+cwd 启发式,不谎报)。
16
+ */
17
+ /** One spawn candidate: earlier entries are tried first (auto-probing). */
18
+ export interface TerminalLaunch {
19
+ command: string;
20
+ args: string[];
21
+ /** Working directory for the spawned process (inherited cwd). */
22
+ cwd?: string;
23
+ /** Run through the platform shell (custom commands only). */
24
+ shell?: boolean;
25
+ }
26
+ /**
27
+ * prompt 层② 兜底的注入落点:后端枚举出的可打文本 pane。
28
+ * id 不透明、格式归各后端(wezterm = `<mux 短哈希>:<paneId>`)。
29
+ */
30
+ export interface PromptPaneTarget {
31
+ id: string;
32
+ /** pane 标题(claude 的 OSC 标题)——与会话标题匹配的素材;取不到 = null。 */
33
+ title: string | null;
34
+ /** pane 实时工作目录;取不到 = null(匹配不上任何项目)。 */
35
+ cwd: string | null;
36
+ }
37
+ /**
38
+ * 起会话落子的起点定位(spawn 回执):env 形状与 hook 旁路上报同构(键形归
39
+ * 后端、出 core 表),paneEnvSource='launch' 的 harness 据此关联会话。拿不到
40
+ * 回执的后端(wt 等 stdio ignore 路径)不产出——那些会话不分组,不猜。
41
+ */
42
+ export interface LaunchOrigin {
43
+ readonly env: Record<string, string>;
44
+ }
45
+ /** 终端后端基类。模板方法定义骨架,子类只填候选与真正不同的流程。 */
46
+ export declare abstract class TerminalBackend {
47
+ readonly preset: TerminalPreset;
48
+ /** 能否反查已开窗口 / 可附加目标(默认否:不是每种终端都问得到)。 */
49
+ readonly enumerable: boolean;
50
+ protected readonly platform: NodeJS.Platform;
51
+ /** 能否给已开 pane 注入文本(prompt 层② send-text 兜底;默认否,不谎报)。 */
52
+ readonly textAddressable: boolean;
53
+ protected constructor(preset: TerminalPreset,
54
+ /** 能否反查已开窗口 / 可附加目标(默认否:不是每种终端都问得到)。 */
55
+ enumerable: boolean, platform?: NodeJS.Platform,
56
+ /** 能否给已开 pane 注入文本(prompt 层② send-text 兜底;默认否,不谎报)。 */
57
+ textAddressable?: boolean);
58
+ /** 启动候选(按序尝试,第一个起的算成功);空 = 本平台不支持该 preset。 */
59
+ abstract candidates(dir: string, run?: string[]): TerminalLaunch[];
60
+ /** 开一个终端(模板方法)。 */
61
+ open(dir: string): Promise<void>;
62
+ /**
63
+ * 开一个终端并把 `argv` 送进去(模板方法)。缺省把命令并进候选参数;wezterm
64
+ * 覆写为走 mux——唯一流程真正不同的 preset(legacy `start -- PROG` 绕过
65
+ * default_prog,且 mux 在时会挂死出无窗僵尸而 trySpawn 假成功)。返回落子的
66
+ * 起点(spawn 回执);候选路径无回执 = null。
67
+ */
68
+ run(dir: string, argv: string[]): Promise<LaunchOrigin | null>;
69
+ /** 每目录已开终端数(单位 = 本后端的可见屏幕);不支持的 preset 走这里(空表 = 角标不显示,不谎报)。 */
70
+ countWindows(_dirs: readonly string[]): Promise<Map<string, number>>;
71
+ /** 可附加目标(窗口内的 tab);不支持的 preset 走这里。 */
72
+ listTargets(_dir: string): Promise<AttachTarget[]>;
73
+ /** 定点附加(多终端弹窗选定的目标);无通道的 preset 明确拒绝,不静默忽略。 */
74
+ runAt(_dir: string, _argv: string[], _targetId: string): Promise<LaunchOrigin | null>;
75
+ /** 唤出(切到前台)已开终端;无通道的 preset 明确拒绝。 */
76
+ focusTarget(_dir: string, _targetId: string): Promise<void>;
77
+ /** prompt 层② 兜底:枚举可注入文本的 pane;无通道的后端空表(不谎报)。 */
78
+ listPromptPanes(): Promise<PromptPaneTarget[]>;
79
+ /** 层② 定位:pane env → pane id;无定位能力的后端 null(回落标题+cwd,不猜)。 */
80
+ locatePane(_env: Record<string, string>): Promise<string | null>;
81
+ /** 这个 pane id 是不是本后端发的(id 表示法归本后端);默认不是,不抢别人的 id。 */
82
+ ownsPaneId(_paneId: string): boolean;
83
+ /** 会话 → 所在可见屏幕(会话列表分块);无枚举能力的后端空表(不分组,不猜)。 */
84
+ locateScreens(_envs: Record<string, Record<string, string>>): Promise<Record<string, SessionTerminal | null>>;
85
+ /** prompt 层② 兜底:向枚举所得 pane 注入 prompt 原文并提交;无通道的后端明确拒绝。 */
86
+ sendPromptText(_paneId: string, _text: string): Promise<void>;
87
+ /** 阻塞问答作答:裸键序注入(模态框只吃键盘,不吃粘贴文本);无通道的后端明确拒绝。 */
88
+ sendKeys(_paneId: string, _keys: string): Promise<void>;
89
+ /**
90
+ * 读 pane 可视屏文本(旁路会话读屏通道用);无读屏能力的后端 null(不谎报)。
91
+ * 只回可视屏(scrollback 不取)——读屏消费方(侧问回答提取)只需要当下画面。
92
+ */
93
+ getPaneText(_paneId: string): Promise<string | null>;
94
+ /** 关掉这个 pane(会话生命周期收尾 / 项目关终端共用);无通道的后端明确拒绝。 */
95
+ closePane(_paneId: string): Promise<void>;
96
+ /** 按候选顺序起一个;全失败抛真相(含试过哪些命令)。 */
97
+ protected spawnFirst(candidates: TerminalLaunch[], emptyReason: string): Promise<void>;
98
+ }
99
+ /** 候选数据驱动的后端:绝大多数 preset 只差一张候选表。 */
100
+ export declare class CandidatesBackend extends TerminalBackend {
101
+ private readonly make;
102
+ constructor(preset: TerminalPreset, platform: NodeJS.Platform, make: (dir: string, run: string[] | undefined, platform: NodeJS.Platform) => TerminalLaunch[]);
103
+ candidates(dir: string, run?: string[]): TerminalLaunch[];
104
+ }
105
+ /** 各 preset 的候选表(纯数据);`auto` 由这些具名条目组合,不再各抄一遍。 */
106
+ export declare const PRESET_CANDIDATES: Record<Exclude<TerminalPreset, 'auto' | 'custom' | 'wezterm'>, (dir: string, run: string[] | undefined, platform: NodeJS.Platform) => TerminalLaunch[]>;
107
+ /** custom:用户自撰命令模板(唯一需要读 settings 的后端)。 */
108
+ export declare class CustomBackend extends TerminalBackend {
109
+ private readonly terminal;
110
+ constructor(terminal: TerminalSettings, platform: NodeJS.Platform);
111
+ candidates(dir: string, run?: string[]): TerminalLaunch[];
112
+ }
113
+ /** Spawn detached and forget: the child outlives the daemon, its window is
114
+ * its own, and I/O is dropped so a GUI process never blocks on pipes. */
115
+ export declare function trySpawn(launch: TerminalLaunch): Promise<boolean>;
@@ -0,0 +1 @@
1
+ import{spawn as m}from"node:child_process";import{joinCmd as s,quotePath as i,throughCmd as l}from"./shared.js";import{wtWindowSlug as p}from"./wt.js";export class TerminalBackend{preset;enumerable;platform;textAddressable;constructor(e,t,r=process.platform,a=!1){this.preset=e,this.enumerable=t,this.platform=r,this.textAddressable=a}async open(e){await this.spawnFirst(this.candidates(e),`Terminal preset "${this.preset}" is unavailable on this platform`)}async run(e,t){return await this.spawnFirst(this.candidates(e,t),`Terminal preset "${this.preset}" cannot run a command here \u2014 pick another preset in settings`),null}async countWindows(e){return new Map}async listTargets(e){return[]}async runAt(e,t,r){throw new Error(`Terminal preset "${this.preset}" cannot attach to a chosen pane \u2014 pick wezterm, wt or Terminal.app in settings`)}async focusTarget(e,t){throw new Error(`Terminal preset "${this.preset}" cannot bring an open terminal to the front \u2014 pick wezterm or wt in settings`)}async listPromptPanes(){return[]}async locatePane(e){return null}ownsPaneId(e){return!1}async locateScreens(e){return{}}async sendPromptText(e,t){throw new Error(`Terminal preset "${this.preset}" cannot send text into an open pane \u2014 pick a preset with text injection in settings`)}async sendKeys(e,t){throw new Error(`Terminal preset "${this.preset}" cannot send keys to an open pane \u2014 pick a preset with key injection in settings`)}async getPaneText(e){return null}async closePane(e){throw new Error(`Terminal preset "${this.preset}" cannot close an open pane \u2014 pick wezterm in settings`)}async spawnFirst(e,t){for(const r of e)if(await trySpawn(r))return;throw new Error(e.length===0?t:"No usable terminal found (tried: "+e.map(r=>r.command).join(", ")+")")}}export class CandidatesBackend extends TerminalBackend{make;constructor(e,t,r){super(e,!1,t),this.make=r}candidates(e,t){return this.make(e,t,this.platform)}}export const PRESET_CANDIDATES={wt:(n,e,t)=>t==="win32"?[{command:"wt.exe",args:["-w",p(n),"-d",n,...l(e,!0)??[]]}]:[],powershell:(n,e,t)=>t==="win32"?[e?{command:"powershell.exe",args:["-NoExit","-Command",s(e,"win32")],cwd:n}:{command:"powershell.exe",args:["-NoExit"],cwd:n}]:[],cmd:(n,e,t)=>t==="win32"?[e?{command:"cmd.exe",args:["/K",s(e,"win32")],cwd:n}:{command:"cmd.exe",args:["/K"],cwd:n}]:[],terminal:(n,e,t)=>t!=="darwin"?[]:e?[{command:"osascript",args:c("Terminal",n,e)}]:[{command:"open",args:["-a","Terminal",n]}],iterm:(n,e,t)=>t!=="darwin"?[]:e?[{command:"osascript",args:c("iTerm",n,e)}]:[{command:"open",args:["-a","iTerm",n]}],gnome:(n,e)=>[{command:"gnome-terminal",args:[`--working-directory=${n}`,...e?["--",...e]:[]]}],konsole:(n,e)=>[{command:"konsole",args:["--workdir",n,...e?["-e",...e]:[]]}],ghostty:(n,e,t)=>t==="win32"?[]:t==="darwin"?e?[]:[{command:"open",args:["-a","Ghostty",n]}]:[{command:"ghostty",args:[`--working-directory=${n}`,...e?["-e",...e]:[]]}]};function c(n,e,t){const a=`cd ${i(e,"darwin")} && ${s(t,"darwin")}`.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return n==="Terminal"?["-e",`tell application "Terminal" to do script "${a}"`,"-e",'tell application "Terminal" to activate']:["-e",'tell application "iTerm" to create window with default profile',"-e",`tell application "iTerm" to tell current window to write text "${a}"`]}export class CustomBackend extends TerminalBackend{terminal;constructor(e,t){super("custom",!1,t),this.terminal=e}candidates(e,t){const r=this.terminal.customCommand.trim();if(!r)return[];let a=r.replace(/\{path\}/g,i(e,this.platform));const o=t?s(t,this.platform):"";return a=a.includes("{command}")?a.replace(/\{command\}/g,o):t?`${a} ${o}`:a,[{command:a,args:[],shell:!0}]}}export function trySpawn(n){return new Promise(e=>{let t;try{t=m(n.command,n.args,{cwd:n.cwd,shell:n.shell,detached:!0,stdio:"ignore"})}catch{e(!1);return}t.on("error",()=>e(!1)),t.on("spawn",()=>{t.unref(),e(!0)})})}
@@ -1 +1 @@
1
- import{spawn as a}from"node:child_process";export function resolveTerminalLaunch(e,n,r=process.platform,o){return terminalBackendFor(n,r).candidates(e,o)}export function resolveExplorerLaunch(e,n=process.platform){return n==="win32"?{command:"explorer.exe",args:[e]}:n==="darwin"?{command:"open",args:[e]}:{command:"xdg-open",args:[e]}}export function trySpawn(e){return new Promise(n=>{let r;try{r=a(e.command,e.args,{cwd:e.cwd,shell:e.shell,detached:!0,stdio:"ignore"})}catch{n(!1);return}r.on("error",()=>n(!1)),r.on("spawn",()=>{r.unref(),n(!0)})})}export async function openInExplorer(e){const n=resolveExplorerLaunch(e);if(!await trySpawn(n))throw new Error(`Failed to open file manager (${n.command})`)}export async function openInTerminal(e,n){await terminalBackendFor(n).open(e)}
1
+ import{spawn as a}from"node:child_process";export function resolveTerminalLaunch(n,e,r=process.platform,o){return terminalBackendFor(e,r).candidates(n,o)}export function resolveExplorerLaunch(n,e=process.platform){return e==="win32"?{command:"explorer.exe",args:[n]}:e==="darwin"?{command:"open",args:[n]}:{command:"xdg-open",args:[n]}}export function trySpawn(n){return new Promise(e=>{let r;try{r=a(n.command,n.args,{cwd:n.cwd,shell:n.shell,detached:!0,stdio:"ignore"})}catch{e(!1);return}r.on("error",()=>e(!1)),r.on("spawn",()=>{r.unref(),e(!0)})})}export async function openInExplorer(n){const e=resolveExplorerLaunch(n);if(!await trySpawn(e))throw new Error(`Failed to open file manager (${e.command})`)}export async function openInTerminal(n,e){await terminalBackendFor(e).open(n)}
@@ -1,5 +1,5 @@
1
1
  import{captureCommand as p,normalizeDirKey as d}from"./wezterm-mux.js";import{joinCmd as l,quotePath as f}from"./shared.js";const m=['if application "Terminal" is not running then return ""','tell application "Terminal"',' set out to ""'," repeat with w in windows"," set wid to id of w"," set fm to frontmost of w as text"," repeat with t in tabs of w",' set out to out & wid & "\\t" & (index of t) & "\\t" & tty of t & "\\t" & (selected of t as text) & "\\t" & fm & linefeed'," end repeat"," end repeat"," return out","end tell"].join(`
2
- `);export function parseTerminalAppDump(r){const t=[];for(const o of r.split(`
3
- `)){const e=o.trim().split(" ");if(e.length!==5)continue;const n=Number(e[0]),i=Number(e[1]);!Number.isInteger(n)||!Number.isInteger(i)||t.push({windowId:n,tabIndex:i,tty:e[2],selected:e[3]==="true",frontmost:e[4]==="true"})}return t}export function parsePsRootPids(r){const t=new Map,o=new Map;for(const n of r.split(`
4
- `)){const i=/^\s*(\d+)\s+(\d+)\s+(\S+)/.exec(n);if(!i)continue;const s=Number(i[1]),c=i[3];if(c==="??")continue;const a=t.get(c)??new Set;a.add(s),t.set(c,a),o.set(s,Number(i[2]))}const e=new Map;for(const[n,i]of t)for(const s of i)if(!i.has(o.get(s)??-1)){e.set(n,s);break}return e}export function parseLsofCwds(r){const t=new Map;let o=-1;for(const e of r.split(`
5
- `))e.startsWith("p")&&/^\d+$/.test(e.slice(1))?o=Number(e.slice(1)):e.startsWith("n")&&o!==-1&&(t.set(o,e.slice(1)),o=-1);return t}export async function listTerminalAppSurfaces(r){if(r!=="darwin")return[];const t=await p("osascript",["-e",m]);if(!t?.ok)return[];const o=parseTerminalAppDump(t.out);if(o.length===0)return[];const e=await p("ps",["-axo","pid=,ppid=,tty="]);if(!e?.ok)return o.map(a=>({...a,cwd:null}));const n=parsePsRootPids(e.out),i=[...new Set(o.map(a=>n.get(a.tty.replace(/^\/dev\//,""))??-1))].filter(a=>a!==-1),s=i.length>0?await p("lsof",["-a","-p",i.join(","),"-d","cwd","-Fn"]):null,c=parseLsofCwds(s?.out??"");return o.map(a=>({...a,cwd:c.get(n.get(a.tty.replace(/^\/dev\//,""))??-1)??null}))}let u=null;export async function terminalAppSurfacesCached(r){if(u&&Date.now()-u.at<1e4)return u.surfaces;const t=await listTerminalAppSurfaces(r);return u={at:Date.now(),surfaces:t},t}export function terminalAppTargetId(r,t){return`terminal:${r}:${t}`}export function parseTerminalAppTargetId(r){const t=/^terminal:(\d+):(\d+)$/.exec(r);return t?{windowId:Number(t[1]),tabIndex:Number(t[2])}:null}export function terminalAppMatches(r,t,o){const e=d(t,o);return e?r.filter(n=>n.cwd!==null&&d(n.cwd,o)===e):[]}export function terminalAppTargets(r,t,o=process.platform){const e=terminalAppMatches(t,r,o);return e.sort((n,i)=>Number(i.frontmost)-Number(n.frontmost)||Number(i.selected)-Number(n.selected)||i.tabIndex-n.tabIndex),e.map(n=>({id:terminalAppTargetId(n.windowId,n.tabIndex),windowId:n.windowId,tabId:n.tabIndex,title:null,matchCount:1,paneCount:1,active:n.frontmost&&n.selected,full:!1}))}export function pickTerminalAppWindow(r,t,o=process.platform){const e=terminalAppMatches(r,t,o);return e.length===0?null:(e.sort((n,i)=>Number(i.frontmost)-Number(n.frontmost)||i.windowId-n.windowId),{windowId:e[0].windowId,tabIndex:e[0].tabIndex})}export async function listTerminalAppTargets(r,t){return terminalAppTargets(r,await listTerminalAppSurfaces(t),t)}export async function doScriptInTerminalWindow(r,t,o){const e=`cd ${f(r,"darwin")} && ${l(t,"darwin")}`.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return(await p("osascript",["-e",`tell application "Terminal" to do script "${e}" in window id ${o}`]))?.ok===!0}
2
+ `);export function parseTerminalAppDump(o){const t=[];for(const r of o.split(`
3
+ `)){const e=r.trim().split(" ");if(e.length!==5)continue;const n=Number(e[0]),i=Number(e[1]);!Number.isInteger(n)||!Number.isInteger(i)||t.push({windowId:n,tabIndex:i,tty:e[2],selected:e[3]==="true",frontmost:e[4]==="true"})}return t}export function parsePsRootPids(o){const t=new Map,r=new Map;for(const n of o.split(`
4
+ `)){const i=/^\s*(\d+)\s+(\d+)\s+(\S+)/.exec(n);if(!i)continue;const a=Number(i[1]),c=i[3];if(c==="??")continue;const s=t.get(c)??new Set;s.add(a),t.set(c,s),r.set(a,Number(i[2]))}const e=new Map;for(const[n,i]of t)for(const a of i)if(!i.has(r.get(a)??-1)){e.set(n,a);break}return e}export function parseLsofCwds(o){const t=new Map;let r=-1;for(const e of o.split(`
5
+ `))e.startsWith("p")&&/^\d+$/.test(e.slice(1))?r=Number(e.slice(1)):e.startsWith("n")&&r!==-1&&(t.set(r,e.slice(1)),r=-1);return t}export async function listTerminalAppSurfaces(o){if(o!=="darwin")return[];const t=await p("osascript",["-e",m]);if(!t?.ok)return[];const r=parseTerminalAppDump(t.out);if(r.length===0)return[];const e=await p("ps",["-axo","pid=,ppid=,tty="]);if(!e?.ok)return r.map(s=>({...s,cwd:null}));const n=parsePsRootPids(e.out),i=[...new Set(r.map(s=>n.get(s.tty.replace(/^\/dev\//,""))??-1))].filter(s=>s!==-1),a=i.length>0?await p("lsof",["-a","-p",i.join(","),"-d","cwd","-Fn"]):null,c=parseLsofCwds(a?.out??"");return r.map(s=>({...s,cwd:c.get(n.get(s.tty.replace(/^\/dev\//,""))??-1)??null}))}let u=null;export async function terminalAppSurfacesCached(o){if(u&&Date.now()-u.at<1e4)return u.surfaces;const t=await listTerminalAppSurfaces(o);return u={at:Date.now(),surfaces:t},t}export function terminalAppTargetId(o,t){return`terminal:${o}:${t}`}export function parseTerminalAppTargetId(o){const t=/^terminal:(\d+):(\d+)$/.exec(o);return t?{windowId:Number(t[1]),tabIndex:Number(t[2])}:null}export function terminalAppMatches(o,t,r){const e=d(t,r);return e?o.filter(n=>n.cwd!==null&&d(n.cwd,r)===e):[]}export function terminalAppTargets(o,t,r=process.platform){const e=terminalAppMatches(t,o,r);return e.sort((n,i)=>Number(i.frontmost)-Number(n.frontmost)||Number(i.selected)-Number(n.selected)||i.tabIndex-n.tabIndex),e.map(n=>({id:terminalAppTargetId(n.windowId,n.tabIndex),windowId:n.windowId,tabId:n.tabIndex,title:null,matchCount:1,paneCount:1,active:n.frontmost&&n.selected,full:!1}))}export function pickTerminalAppWindow(o,t,r=process.platform){const e=terminalAppMatches(o,t,r);return e.length===0?null:(e.sort((n,i)=>Number(i.frontmost)-Number(n.frontmost)||i.windowId-n.windowId),{windowId:e[0].windowId,tabIndex:e[0].tabIndex})}export async function listTerminalAppTargets(o,t){return terminalAppTargets(o,await listTerminalAppSurfaces(t),t)}export async function doScriptInTerminalWindow(o,t,r){const n=`cd ${f(o,"darwin")} && ${l(t,"darwin")}`.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return(await p("osascript",["-e",`tell application "Terminal" to do script "${n}" in window id ${r}`]))?.ok===!0}
@@ -1 +1 @@
1
- export function quotePath(t,n){return n==="win32"?`"${t}"`:`'${t.replace(/'/g,"'\\''")}'`}export function quoteArg(t,n){return n==="win32"?t!==""&&!/[\s"&|<>^%]/.test(t)?t:`"${t.replace(/"/g,'\\"')}"`:/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}export function joinCmd(t,n){return t.map(r=>quoteArg(r,n)).join(" ")}export function throughCmd(t,n){return!n||!t||t.length===0?t:["cmd.exe","/k",joinCmd(t,"win32")]}
1
+ export function quotePath(e,t){return t==="win32"?`"${e}"`:`'${e.replace(/'/g,"'\\''")}'`}export function quoteArg(e,t){return t==="win32"?e!==""&&!/[\s"&|<>^%]/.test(e)?e:`"${e.replace(/"/g,'\\"')}"`:/^[A-Za-z0-9_@%+=:,./-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}export function joinCmd(e,t){return e.map(n=>quoteArg(n,t)).join(" ")}export function throughCmd(e,t){return!t||!e||e.length===0?e:["cmd.exe","/k",joinCmd(e,"win32")]}
@@ -1,3 +1,4 @@
1
+ import type { LaunchOrigin } from '../opener.js';
1
2
  export interface WeztermPaneInfo {
2
3
  windowId: number;
3
4
  tabId: number;
@@ -259,11 +260,12 @@ export declare function openInWezterm(dir: string): Promise<boolean>;
259
260
  /**
260
261
  * wezterm run 主通道:同项目 → 分屏复用(复用目标长满 = 没有可复用落点);
261
262
  * 否则 → 最活跃 mux 开新窗口;命令一律 send-text。**一个活 mux 都没有 → 返回
262
- * false**(调用方回落 legacy `start` 起新 GUI——那是另一套流程,不在这条里猜)。
263
+ * null**(调用方回落 legacy `start` 起新 GUI——那是另一套流程,不在这条里猜)。
263
264
  * 有 mux 之后的任何失败(某步 rc≠0 / 超时)一律 throw:错误经路由 400 转 toast,
264
- * 绝不静默落到假成功的 legacy start。
265
+ * 绝不静默落到假成功的 legacy start。成功带回落子的起点 pane(spawn 回执),
266
+ * paneEnvSource='launch' 的 harness 据此定位会话。
265
267
  */
266
- export declare function runInWezterm(dir: string, argv: string[]): Promise<boolean>;
268
+ export declare function runInWezterm(dir: string, argv: string[]): Promise<LaunchOrigin | null>;
267
269
  /**
268
270
  * spawn 落 pane(分屏 / 新窗):runInWezterm、开终端、定点附加共用的前半步。
269
271
  * split = null → 开新窗口。返回新 pane id;任何一步失败一律 throw。
@@ -271,7 +273,8 @@ export declare function runInWezterm(dir: string, argv: string[]): Promise<boole
271
273
  export declare function weztermSpawnPane(socket: string, dir: string, split: WeztermSplitTarget | null, workspace: string | null): Promise<string>;
272
274
  /**
273
275
  * spawn + send-text 投递:runInWezterm 与定点附加共用的尾部。任何一步失败一律
274
- * throw(路由 400 → 前端报因)。
276
+ * throw(路由 400 → 前端报因)。成功回起点 pane 的定位 env(键形出 core 表,
277
+ * paneEnvSource='launch' 的 harness 据此反查这块屏)。
275
278
  */
276
- export declare function weztermSpawnAndSend(socket: string, dir: string, argv: string[], split: WeztermSplitTarget | null, workspace: string | null, platform?: NodeJS.Platform): Promise<void>;
279
+ export declare function weztermSpawnAndSend(socket: string, dir: string, argv: string[], split: WeztermSplitTarget | null, workspace: string | null, platform?: NodeJS.Platform): Promise<LaunchOrigin>;
277
280
  export {};
@@ -1 +1 @@
1
- import{spawn as k}from"node:child_process";import{createHash as $}from"node:crypto";import{readdirSync as z}from"node:fs";import{basename as x,join as I}from"node:path";import{TERMINAL_LOCATOR_ENV as b}from"@weavecode/core";import{joinCmd as M}from"./shared.js";export function parseWeztermPanes(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=[];for(const r of t){const o=r;typeof o?.pane_id!="number"||typeof o?.tab_id!="number"||n.push({windowId:typeof o.window_id=="number"?o.window_id:0,tabId:o.tab_id,paneId:o.pane_id,cwd:typeof o.cwd=="string"?o.cwd:null,left:typeof o.left_col=="number"?o.left_col:0,top:typeof o.top_row=="number"?o.top_row:0,isActive:o.is_active===!0,title:typeof o.title=="string"&&o.title?o.title:null})}return n}export function normalizeDirKey(e,t){if(!e)return null;let n=e;if(n.startsWith("file://")){n=n.slice(7);try{n=decodeURIComponent(n)}catch{return null}t==="win32"&&(n=n.replace(/^\//,""))}return n=n.replace(/\\/g,"/").replace(/\/+$/,""),n?t==="win32"?n.toLowerCase():n:null}export function countWindowsByDir(e,t,n=process.platform){const r=e.map(s=>normalizeDirKey(s,n)),o=e.map(()=>new Set);for(const s of t){const i=normalizeDirKey(s.cwd,n);if(!i)continue;const c=s.tabId==null?`${s.muxKey}#${s.windowId}`:`${s.muxKey}#${s.windowId}#${s.tabId}`;for(let a=0;a<e.length;a++)r[a]!==null&&r[a]===i&&o[a].add(c)}return new Map(e.map((s,i)=>[s,o[i].size]))}export const MAX_PANES_PER_SCREEN=6;function S(e,t,n){const r=new Map,o=new Map;for(const c of t)o.set(c.tabId,(o.get(c.tabId)??0)+1),normalizeDirKey(c.cwd,n)===e&&r.set(c.tabId,(r.get(c.tabId)??0)+1);let s=null,i=0;for(const[c,a]of r)(o.get(c)??0)>=MAX_PANES_PER_SCREEN||(s===null||a>i||a===i&&c<s)&&(s=c,i=a);return s}export function planWeztermGrid(e){if(e.length===0||e.length>=MAX_PANES_PER_SCREEN)return null;if(e.length===1)return{paneId:e[0].paneId,direction:"right"};const t=new Map;for(const o of e){const s=t.get(o.left)??[];s.push(o),t.set(o.left,s)}const n=[...t.entries()].sort(([o],[s])=>o-s).map(([,o])=>[...o].sort((s,i)=>i.top-s.top));if(n.length===1)return{paneId:n[0][0].paneId,direction:"right"};let r=n[0];for(const o of n)o.length<r.length&&(r=o);return{paneId:r[0].paneId,direction:"bottom"}}export function planWeztermReuse(e,t,n=process.platform){const r=normalizeDirKey(e,n);if(!r)return null;const o=S(r,t,n);return o===null?null:planWeztermGrid(t.filter(s=>s.tabId===o))}export function planWeztermNewWindow(e,t){const n=["cli","spawn","--new-window","--cwd",e];return t&&n.push("--workspace",t),n}export function weztermMuxKey(e){return $("sha256").update(normalizeDirKey(e,process.platform)??e).digest("hex").slice(0,8)}export function weztermPaneFromEnv(e,t,n){const[r,o]=b.wezterm,s=e[r],i=e[o];if(!s||!i)return null;const c=normalizeDirKey(i,n),a=t.find(u=>normalizeDirKey(u.socket,n)===c);return!a||!a.panes.some(u=>String(u.paneId)===s)?null:`${weztermMuxKey(a.socket)}:${s}`}export function sessionScreensFromEnvs(e,t,n,r=process.platform){const[o,s]=b.wezterm,i=new Set(n.map(a=>normalizeDirKey(a,r))),c={};for(const[a,u]of Object.entries(e)){const d=u[o],l=u[s],w=l?t.find(f=>normalizeDirKey(f.socket,r)===normalizeDirKey(l,r)):void 0,p=w?.panes.find(f=>String(f.paneId)===d);if(w){c[a]=p?{id:`${weztermMuxKey(w.socket)}:${p.windowId}:${p.tabId}`,windowId:p.windowId,tabId:p.tabId,tabsInWindow:new Set(w.panes.filter(f=>f.windowId===p.windowId).map(f=>f.tabId)).size}:null;continue}l&&i.has(normalizeDirKey(l,r))||(c[a]=null)}return c}export function parseAttachTargetId(e){const t=/^([0-9a-f]{8}):(\d+):(\d+)$/.exec(e);return t?{muxKey:t[1],windowId:Number(t[2]),tabId:Number(t[3])}:null}export function attachTargetsFromMuxes(e,t,n=process.platform){const r=normalizeDirKey(e,n);if(!r)return[];const o=[];for(const s of[...t].sort((i,c)=>i.idleMs-c.idleMs)){const i=weztermMuxKey(s.socket),c=new Map;for(const u of s.panes){const d=`${u.windowId}:${u.tabId}`,l=c.get(d)??[];l.push(u),c.set(d,l)}const a=[];for(const[u,d]of c){const l=d.filter(m=>normalizeDirKey(m.cwd,n)===r);if(l.length===0)continue;const w=Number(u.slice(0,u.indexOf(":"))),p=Number(u.slice(u.indexOf(":")+1)),f=d.find(m=>m.isActive)??d[0];a.push({id:`${i}:${w}:${p}`,windowId:w,tabId:p,title:f.title,matchCount:l.length,paneCount:d.length,active:d.some(m=>m.isActive),full:d.length>=MAX_PANES_PER_SCREEN,paneIds:l.map(m=>`${i}:${m.paneId}`)})}a.sort((u,d)=>Number(d.active)-Number(u.active)||d.tabId-u.tabId),o.push(...a)}return o}export async function listAttachTargets(e,t=process.platform){const{muxes:n}=await weztermLiveMuxes();return attachTargetsFromMuxes(e,n,t)}export function weztermActiveClient(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!Array.isArray(t))return null;let n=null;for(const r of t){const o=r;if(typeof o?.workspace!="string"||!o.workspace)continue;const s=o.idle_time,i=(typeof s?.secs=="number"?s.secs*1e3:0)+(typeof s?.nanos=="number"?s.nanos/1e6:0);(n===null||i<n.idleMs)&&(n={workspace:o.workspace,idleMs:i})}return n}export function weztermActiveWorkspaceOf(e){return weztermActiveClient(e)?.workspace??null}const g=5e3;export function captureCommand(e,t,n,r=g){return new Promise(o=>{let s;try{s=k(e,t,{windowsHide:!0,env:n??process.env})}catch{o(null);return}let i="",c="",a=!1;const u=l=>{a||(a=!0,clearTimeout(d),o(l))};s.stdout.on("data",l=>{i+=l.toString()}),s.stderr?.on("data",l=>{c+=l.toString()});const d=setTimeout(()=>{s.stdout.destroy(),s.stderr?.destroy(),s.unref(),s.kill(),u({ok:!1,out:i,err:c.trim(),timedOut:!0})},r);d.unref(),s.on("error",()=>u(null)),s.on("close",l=>{u({ok:l===0,out:i,err:c.trim(),timedOut:!1})})})}export function weztermCli(e,t){return captureCommand("wezterm",weztermCliArgs(e),{...process.env,WEZTERM_UNIX_SOCKET:t})}export function weztermCliArgs(e){return e[0]==="cli"?["cli","--no-auto-start",...e.slice(1)]:[...e]}export function weztermStepError(e,t,n){const r=`wezterm[${x(t)}] ${e.join(" ")}`;return n===null?`${r}: executable not found`:n.timedOut?`${r}: timed out after ${g}ms`:n.err?`${r}: ${n.err}`:`${r}: exited with failure`}function h(e){try{return process.kill(e,0),!0}catch{return!1}}export async function weztermGuiAlive(e){if(!h(e))return!1;if(process.platform!=="win32")return!0;const t=await captureCommand("tasklist",["/FI",`PID eq ${e}`,"/FO","CSV","/NH"],void 0,2e3);return t?.ok===!0&&/wezterm-gui\.exe/i.test(t.out)}export function weztermGuiPidOf(e){const t=/gui-sock-(\d+)$/.exec(e.replace(/\\/g,"/"));return t?Number(t[1]):null}function y(e){let t;try{t=z(e)}catch{return[]}const n=[];for(const r of t){const o=/^gui-sock-(\d+)$/.exec(r);if(!o)continue;const s=Number(o[1]);h(s)&&n.push({path:I(e,r),pid:s})}return n.sort((r,o)=>o.pid-r.pid).map(r=>r.path)}function E(e,t){const n=e.replace(/\\/g,"/");return t==="win32"?n.toLowerCase():n}export function weztermSocketCandidates(e){const t=[],n=new Set,r=i=>{const c=E(i,e);n.has(c)||(n.add(c),t.push(i))},o=process.env.WEZTERM_UNIX_SOCKET;if(o){const i=weztermGuiPidOf(o);(i===null||h(i))&&r(o)}const s=e==="win32"?process.env.USERPROFILE:process.env.HOME;return s&&y(I(s,".local","share","wezterm")).forEach(r),e!=="win32"&&process.env.XDG_RUNTIME_DIR&&y(I(process.env.XDG_RUNTIME_DIR,"wezterm")).forEach(r),t}const _=6e4;export class SocketProbeGate{dead=new Set;cooling=new Map;shouldProbe(t,n=Date.now()){if(this.dead.has(t))return!1;const r=this.cooling.get(t);return r===void 0||n>=r}succeeded(t){this.cooling.delete(t)}failed(t){this.dead.add(t),this.cooling.delete(t)}cooledDown(t,n=Date.now()){this.dead.has(t)||this.cooling.set(t,n+_)}}export const probeGate=new SocketProbeGate;export async function weztermLiveMuxes(e=!1,t=null){const n=t?[t]:weztermSocketCandidates(process.platform);return{muxes:(await Promise.all(n.map(async r=>{if(!t&&!probeGate.shouldProbe(r))return null;const o=await weztermCli(["cli","list","--format","json"],r);if(!o?.ok){const a=weztermGuiPidOf(r);return o&&!o.timedOut&&a!==null&&!await weztermGuiAlive(a)?probeGate.failed(r):probeGate.cooledDown(r),null}probeGate.succeeded(r);const s=parseWeztermPanes(o.out);if(e)return{socket:r,panes:s,workspace:null,idleMs:Number.POSITIVE_INFINITY};const i=await weztermCli(["cli","list-clients","--format","json"],r),c=weztermActiveClient(i?.ok?i.out:null);return{socket:r,panes:s,workspace:c?.workspace??null,idleMs:c?.idleMs??Number.POSITIVE_INFINITY}}))).filter(r=>r!==null),candidates:n}}export async function weztermMuxForId(e){const t=weztermSocketCandidates(process.platform).find(r=>weztermMuxKey(r)===e);if(!t)return null;const{muxes:n}=await weztermLiveMuxes(!0,t);return n.find(r=>weztermMuxKey(r.socket)===e)??null}export async function openInWezterm(e){const{muxes:t}=await weztermLiveMuxes();if(t.length===0)return!1;const n=t.reduce((r,o)=>o.idleMs<r.idleMs?o:r);return await weztermSpawnPane(n.socket,e,null,n.workspace),!0}export async function runInWezterm(e,t){const n=process.platform,{muxes:r}=await weztermLiveMuxes();if(r.length===0)return!1;let o=null,s=null;for(const i of r){const c=planWeztermReuse(e,i.panes,n);c&&(o===null||i.idleMs<o.idleMs)&&(o=i,s=c)}return o??=r.reduce((i,c)=>c.idleMs<i.idleMs?c:i),await weztermSpawnAndSend(o.socket,e,t,s,o.workspace),!0}export async function weztermSpawnPane(e,t,n,r){const o=n?["cli","split-pane","--pane-id",String(n.paneId),`--${n.direction}`,"--cwd",t]:planWeztermNewWindow(t,r),s=await weztermCli(o,e);if(!s?.ok)throw new Error(weztermStepError(o,e,s));const i=s.out.trim();if(!/^\d+$/.test(i))throw new Error(`wezterm[${x(e)}] ${o.join(" ")}: unexpected pane id "${i}"`);return i}export async function weztermSpawnAndSend(e,t,n,r,o,s=process.platform){const i=["cli","send-text","--pane-id",await weztermSpawnPane(e,t,r,o),"--no-paste",`${M(n,s)}\r`],c=await weztermCli(i,e);if(!c?.ok)throw new Error(weztermStepError(i,e,c))}
1
+ import{spawn as $}from"node:child_process";import{createHash as z}from"node:crypto";import{readdirSync as M}from"node:fs";import{basename as y,join as I}from"node:path";import{TERMINAL_LOCATOR_ENV as h}from"@weavecode/core";import{joinCmd as k}from"./shared.js";export function parseWeztermPanes(t){if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}if(!Array.isArray(n))return[];const r=[];for(const s of n){const e=s;typeof e?.pane_id!="number"||typeof e?.tab_id!="number"||r.push({windowId:typeof e.window_id=="number"?e.window_id:0,tabId:e.tab_id,paneId:e.pane_id,cwd:typeof e.cwd=="string"?e.cwd:null,left:typeof e.left_col=="number"?e.left_col:0,top:typeof e.top_row=="number"?e.top_row:0,isActive:e.is_active===!0,title:typeof e.title=="string"&&e.title?e.title:null})}return r}export function normalizeDirKey(t,n){if(!t)return null;let r=t;if(r.startsWith("file://")){r=r.slice(7);try{r=decodeURIComponent(r)}catch{return null}n==="win32"&&(r=r.replace(/^\//,""))}return r=r.replace(/\\/g,"/").replace(/\/+$/,""),r?n==="win32"?r.toLowerCase():r:null}export function countWindowsByDir(t,n,r=process.platform){const s=t.map(o=>normalizeDirKey(o,r)),e=t.map(()=>new Set);for(const o of n){const i=normalizeDirKey(o.cwd,r);if(!i)continue;const c=o.tabId==null?`${o.muxKey}#${o.windowId}`:`${o.muxKey}#${o.windowId}#${o.tabId}`;for(let u=0;u<t.length;u++)s[u]!==null&&s[u]===i&&e[u].add(c)}return new Map(t.map((o,i)=>[o,e[i].size]))}export const MAX_PANES_PER_SCREEN=6;function _(t,n,r){const s=new Map,e=new Map;for(const c of n)e.set(c.tabId,(e.get(c.tabId)??0)+1),normalizeDirKey(c.cwd,r)===t&&s.set(c.tabId,(s.get(c.tabId)??0)+1);let o=null,i=0;for(const[c,u]of s)(e.get(c)??0)>=MAX_PANES_PER_SCREEN||(o===null||u>i||u===i&&c<o)&&(o=c,i=u);return o}export function planWeztermGrid(t){if(t.length===0||t.length>=MAX_PANES_PER_SCREEN)return null;if(t.length===1)return{paneId:t[0].paneId,direction:"right"};const n=new Map;for(const e of t){const o=n.get(e.left)??[];o.push(e),n.set(e.left,o)}const r=[...n.entries()].sort(([e],[o])=>e-o).map(([,e])=>[...e].sort((o,i)=>i.top-o.top));if(r.length===1)return{paneId:r[0][0].paneId,direction:"right"};let s=r[0];for(const e of r)e.length<s.length&&(s=e);return{paneId:s[0].paneId,direction:"bottom"}}export function planWeztermReuse(t,n,r=process.platform){const s=normalizeDirKey(t,r);if(!s)return null;const e=_(s,n,r);return e===null?null:planWeztermGrid(n.filter(o=>o.tabId===e))}export function planWeztermNewWindow(t,n){const r=["cli","spawn","--new-window","--cwd",t];return n&&r.push("--workspace",n),r}export function weztermMuxKey(t){return z("sha256").update(normalizeDirKey(t,process.platform)??t).digest("hex").slice(0,8)}export function weztermPaneFromEnv(t,n,r){const[s,e]=h.wezterm,o=t[s],i=t[e];if(!o||!i)return null;const c=normalizeDirKey(i,r),u=n.find(l=>normalizeDirKey(l.socket,r)===c);return!u||!u.panes.some(l=>String(l.paneId)===o)?null:`${weztermMuxKey(u.socket)}:${o}`}export function sessionScreensFromEnvs(t,n,r,s=process.platform){const[e,o]=h.wezterm,i=new Set(r.map(u=>normalizeDirKey(u,s))),c={};for(const[u,l]of Object.entries(t)){const a=l[e],d=l[o],w=d?n.find(f=>normalizeDirKey(f.socket,s)===normalizeDirKey(d,s)):void 0,p=w?.panes.find(f=>String(f.paneId)===a);if(w){c[u]=p?{id:`${weztermMuxKey(w.socket)}:${p.windowId}:${p.tabId}`,windowId:p.windowId,tabId:p.tabId,tabsInWindow:new Set(w.panes.filter(f=>f.windowId===p.windowId).map(f=>f.tabId)).size}:null;continue}d&&i.has(normalizeDirKey(d,s))||(c[u]=null)}return c}export function parseAttachTargetId(t){const n=/^([0-9a-f]{8}):(\d+):(\d+)$/.exec(t);return n?{muxKey:n[1],windowId:Number(n[2]),tabId:Number(n[3])}:null}export function attachTargetsFromMuxes(t,n,r=process.platform){const s=normalizeDirKey(t,r);if(!s)return[];const e=[];for(const o of[...n].sort((i,c)=>i.idleMs-c.idleMs)){const i=weztermMuxKey(o.socket),c=new Map;for(const l of o.panes){const a=`${l.windowId}:${l.tabId}`,d=c.get(a)??[];d.push(l),c.set(a,d)}const u=[];for(const[l,a]of c){const d=a.filter(m=>normalizeDirKey(m.cwd,r)===s);if(d.length===0)continue;const w=Number(l.slice(0,l.indexOf(":"))),p=Number(l.slice(l.indexOf(":")+1)),f=a.find(m=>m.isActive)??a[0];u.push({id:`${i}:${w}:${p}`,windowId:w,tabId:p,title:f.title,matchCount:d.length,paneCount:a.length,active:a.some(m=>m.isActive),full:a.length>=MAX_PANES_PER_SCREEN,paneIds:d.map(m=>`${i}:${m.paneId}`)})}u.sort((l,a)=>Number(a.active)-Number(l.active)||a.tabId-l.tabId),e.push(...u)}return e}export async function listAttachTargets(t,n=process.platform){const{muxes:r}=await weztermLiveMuxes();return attachTargetsFromMuxes(t,r,n)}export function weztermActiveClient(t){if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n))return null;let r=null;for(const s of n){const e=s;if(typeof e?.workspace!="string"||!e.workspace)continue;const o=e.idle_time,i=(typeof o?.secs=="number"?o.secs*1e3:0)+(typeof o?.nanos=="number"?o.nanos/1e6:0);(r===null||i<r.idleMs)&&(r={workspace:e.workspace,idleMs:i})}return r}export function weztermActiveWorkspaceOf(t){return weztermActiveClient(t)?.workspace??null}const g=5e3;export function captureCommand(t,n,r,s=g){return new Promise(e=>{let o;try{o=$(t,n,{windowsHide:!0,env:r??process.env})}catch{e(null);return}let i="",c="",u=!1;const l=d=>{u||(u=!0,clearTimeout(a),e(d))};o.stdout.on("data",d=>{i+=d.toString()}),o.stderr?.on("data",d=>{c+=d.toString()});const a=setTimeout(()=>{o.stdout.destroy(),o.stderr?.destroy(),o.unref(),o.kill(),l({ok:!1,out:i,err:c.trim(),timedOut:!0})},s);a.unref(),o.on("error",()=>l(null)),o.on("close",d=>{l({ok:d===0,out:i,err:c.trim(),timedOut:!1})})})}export function weztermCli(t,n){return captureCommand("wezterm",weztermCliArgs(t),{...process.env,WEZTERM_UNIX_SOCKET:n})}export function weztermCliArgs(t){return t[0]==="cli"?["cli","--no-auto-start",...t.slice(1)]:[...t]}export function weztermStepError(t,n,r){const s=`wezterm[${y(n)}] ${t.join(" ")}`;return r===null?`${s}: executable not found`:r.timedOut?`${s}: timed out after ${g}ms`:r.err?`${s}: ${r.err}`:`${s}: exited with failure`}function x(t){try{return process.kill(t,0),!0}catch{return!1}}export async function weztermGuiAlive(t){if(!x(t))return!1;if(process.platform!=="win32")return!0;const n=await captureCommand("tasklist",["/FI",`PID eq ${t}`,"/FO","CSV","/NH"],void 0,2e3);return n?.ok===!0&&/wezterm-gui\.exe/i.test(n.out)}export function weztermGuiPidOf(t){const n=/gui-sock-(\d+)$/.exec(t.replace(/\\/g,"/"));return n?Number(n[1]):null}function b(t){let n;try{n=M(t)}catch{return[]}const r=[];for(const s of n){const e=/^gui-sock-(\d+)$/.exec(s);if(!e)continue;const o=Number(e[1]);x(o)&&r.push({path:I(t,s),pid:o})}return r.sort((s,e)=>e.pid-s.pid).map(s=>s.path)}function S(t,n){const r=t.replace(/\\/g,"/");return n==="win32"?r.toLowerCase():r}export function weztermSocketCandidates(t){const n=[],r=new Set,s=i=>{const c=S(i,t);r.has(c)||(r.add(c),n.push(i))},e=process.env.WEZTERM_UNIX_SOCKET;if(e){const i=weztermGuiPidOf(e);(i===null||x(i))&&s(e)}const o=t==="win32"?process.env.USERPROFILE:process.env.HOME;return o&&b(I(o,".local","share","wezterm")).forEach(s),t!=="win32"&&process.env.XDG_RUNTIME_DIR&&b(I(process.env.XDG_RUNTIME_DIR,"wezterm")).forEach(s),n}const E=6e4;export class SocketProbeGate{dead=new Set;cooling=new Map;shouldProbe(n,r=Date.now()){if(this.dead.has(n))return!1;const s=this.cooling.get(n);return s===void 0||r>=s}succeeded(n){this.cooling.delete(n)}failed(n){this.dead.add(n),this.cooling.delete(n)}cooledDown(n,r=Date.now()){this.dead.has(n)||this.cooling.set(n,r+E)}}export const probeGate=new SocketProbeGate;export async function weztermLiveMuxes(t=!1,n=null){const r=n?[n]:weztermSocketCandidates(process.platform);return{muxes:(await Promise.all(r.map(async e=>{if(!n&&!probeGate.shouldProbe(e))return null;const o=await weztermCli(["cli","list","--format","json"],e);if(!o?.ok){const l=weztermGuiPidOf(e);return o&&!o.timedOut&&l!==null&&!await weztermGuiAlive(l)?probeGate.failed(e):probeGate.cooledDown(e),null}probeGate.succeeded(e);const i=parseWeztermPanes(o.out);if(t)return{socket:e,panes:i,workspace:null,idleMs:Number.POSITIVE_INFINITY};const c=await weztermCli(["cli","list-clients","--format","json"],e),u=weztermActiveClient(c?.ok?c.out:null);return{socket:e,panes:i,workspace:u?.workspace??null,idleMs:u?.idleMs??Number.POSITIVE_INFINITY}}))).filter(e=>e!==null),candidates:r}}export async function weztermMuxForId(t){const n=weztermSocketCandidates(process.platform).find(s=>weztermMuxKey(s)===t);if(!n)return null;const{muxes:r}=await weztermLiveMuxes(!0,n);return r.find(s=>weztermMuxKey(s.socket)===t)??null}export async function openInWezterm(t){const{muxes:n}=await weztermLiveMuxes();if(n.length===0)return!1;const r=n.reduce((s,e)=>e.idleMs<s.idleMs?e:s);return await weztermSpawnPane(r.socket,t,null,r.workspace),!0}export async function runInWezterm(t,n){const r=process.platform,{muxes:s}=await weztermLiveMuxes();if(s.length===0)return null;let e=null,o=null;for(const i of s){const c=planWeztermReuse(t,i.panes,r);c&&(e===null||i.idleMs<e.idleMs)&&(e=i,o=c)}return e??=s.reduce((i,c)=>c.idleMs<i.idleMs?c:i),weztermSpawnAndSend(e.socket,t,n,o,e.workspace)}export async function weztermSpawnPane(t,n,r,s){const e=r?["cli","split-pane","--pane-id",String(r.paneId),`--${r.direction}`,"--cwd",n]:planWeztermNewWindow(n,s),o=await weztermCli(e,t);if(!o?.ok)throw new Error(weztermStepError(e,t,o));const i=o.out.trim();if(!/^\d+$/.test(i))throw new Error(`wezterm[${y(t)}] ${e.join(" ")}: unexpected pane id "${i}"`);return i}export async function weztermSpawnAndSend(t,n,r,s,e,o=process.platform){const i=await weztermSpawnPane(t,n,s,e),c=["cli","send-text","--pane-id",i,"--no-paste",`${k(r,o)}\r`],u=await weztermCli(c,t);if(!u?.ok)throw new Error(weztermStepError(c,t,u));const[l,a]=h.wezterm;return{env:{[l]:i,[a]:t}}}
@@ -1,6 +1,6 @@
1
- import{createHash as p}from"node:crypto";import{TERMINAL_LOCATOR_ENV as f}from"@weavecode/core";import{captureCommand as c,normalizeDirKey as I}from"./wezterm-mux.js";const h=["$ErrorActionPreference = 'SilentlyContinue'","$src = @'","using System; using System.Runtime.InteropServices;","public class WeaveWtCwd {",' [DllImport("ntdll.dll")] static extern int NtQueryInformationProcess(IntPtr h, int c, ref PBI pbi, int size, out int rl);',' [DllImport("kernel32.dll")] static extern IntPtr OpenProcess(int a, bool inh, int pid);',' [DllImport("kernel32.dll")] static extern bool ReadProcessMemory(IntPtr h, IntPtr addr, byte[] buf, int size, out IntPtr read);',' [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);'," [StructLayout(LayoutKind.Sequential)] struct PBI { public IntPtr r1; public IntPtr Peb; public IntPtr r2; public IntPtr r3; public IntPtr Pid; public IntPtr r4; }"," static IntPtr ReadPtr(IntPtr h, IntPtr addr) { var b = new byte[8]; IntPtr r; if (!ReadProcessMemory(h, addr, b, 8, out r)) return IntPtr.Zero; long v = BitConverter.ToInt64(b, 0); return v == 0 ? IntPtr.Zero : (IntPtr)v; }"," static ushort ReadU16(IntPtr h, IntPtr addr) { var b = new byte[2]; IntPtr r; if (!ReadProcessMemory(h, addr, b, 2, out r)) return 0; return BitConverter.ToUInt16(b, 0); }"," public static string GetCwd(int pid) {"," var h = OpenProcess(0x0410, false, pid);"," if (h == IntPtr.Zero) return null;"," try {"," var pbi = new PBI(); int rl;"," if (NtQueryInformationProcess(h, 0, ref pbi, Marshal.SizeOf(typeof(PBI)), out rl) != 0) return null;"," var pp = ReadPtr(h, (IntPtr)((long)pbi.Peb + 0x20));"," if (pp == IntPtr.Zero) return null;"," ushort len = ReadU16(h, (IntPtr)((long)pp + 0x38));"," var buf = ReadPtr(h, (IntPtr)((long)pp + 0x40));"," if (buf == IntPtr.Zero || len == 0 || len > 2048) return null;"," var b = new byte[len]; IntPtr r;"," if (!ReadProcessMemory(h, buf, b, len, out r)) return null;"," return System.Text.Encoding.Unicode.GetString(b).TrimEnd('\\0');"," } finally { CloseHandle(h); }"," }","}","'@","Add-Type -TypeDefinition $src","foreach ($p in Get-CimInstance Win32_Process) {"," $cwd = [WeaveWtCwd]::GetCwd($p.ProcessId)"," if ($null -ne $cwd -or $p.Name -eq 'WindowsTerminal.exe' -or $p.Name -eq 'OpenConsole.exe') {"," $created = if ($p.CreationDate) { $p.CreationDate.ToString('yyyyMMddHHmmss') } else { '' }"," '{0}|{1}|{2}|{3}|{4}' -f $p.ProcessId, $p.ParentProcessId, $p.Name, $created, $cwd"," }","}"].join(`
2
- `),P=15e3;export function parseWtProcDump(t){const e=[];for(const n of t.split(`
3
- `)){const o=n.trimEnd().split("|");if(o.length!==5)continue;const r=Number(o[0]),i=Number(o[1]);!Number.isInteger(r)||!Number.isInteger(i)||r<=0||i<0||o[2]&&e.push({pid:r,parentPid:i,name:o[2].toLowerCase(),created:o[3],cwd:o[4]===""?null:o[4]})}return e}const d=new Set(["bash.exe","zsh.exe","sh.exe","fish.exe","pwsh.exe","powershell.exe","cmd.exe"]);export function wtPanes(t){const e=new Set(t.filter(r=>r.name==="windowsterminal.exe").map(r=>r.pid));if(e.size===0)return[];const n=new Map;for(const r of t){if(r.parentPid===r.pid)continue;const i=n.get(r.parentPid)??[];i.push(r),n.set(r.parentPid,i)}const o=[];for(const r of t){if(!e.has(r.parentPid)||r.name==="openconsole.exe")continue;let i=r;for(;d.has(i.name);){const u=(n.get(i.pid)??[]).filter(a=>d.has(a.name));if(u.length===0)break;i=u.reduce((a,s)=>s.created>a.created||s.created===a.created&&s.pid>a.pid?s:a)}o.push({pid:r.pid,cwd:i.cwd})}return o}export function wtPanesAsWindows(t){return t.map(e=>({muxKey:`wt:${e.pid}`,windowId:e.pid,cwd:e.cwd}))}async function w(){if(process.platform!=="win32")return[];const t=await c("powershell.exe",["-NoProfile","-Command",h],void 0,P);return t?.ok?wtPanes(parseWtProcDump(t.out)):[]}let l=null;export async function wtPanesCached(){if(l&&Date.now()-l.at<1e4)return l.panes;const t=await w();return l={at:Date.now(),panes:t},t}export function wtWindowSlug(t){const e=I(t,"win32")??"root",n=e.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),o=p("sha1").update(e).digest("hex").slice(0,8);return`weave-${n.slice(0,48)||"root"}-${o}`}export function parseWtTargetId(t){const e=/^wt:(weave-[a-z0-9-]+)$/.exec(t);return e?e[1]:null}export function parseWtPaneId(t){const e=/^wt:(\d+)$/.exec(t);if(!e)return null;const n=Number(e[1]);return Number.isInteger(n)&&n>0?n:null}export function wtPanePidFromEnv(t){const[e,n]=f.wt;if(!t[e])return null;const o=t[n];if(!o||!/^\d+$/.test(o))return null;const r=Number(o);return r>0?r:null}export const BRACKETED_PASTE_START="\x1B[200~",BRACKETED_PASTE_END="\x1B[201~";export async function wtInjectKeys(t,e){const n=await c("powershell",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",wtInjectEncodedScript()],{...process.env,WEAVE_WT_PID:String(t),WEAVE_WT_KEYS:Buffer.from(e,"utf8").toString("base64")},15e3);if(!n)throw new Error("powershell is unavailable \u2014 cannot send keys into Windows Terminal");if(!n.ok)throw n.timedOut?new Error("Windows Terminal key injection timed out"):new Error(`Windows Terminal key injection failed: ${n.err||n.out||"unknown error"}`)}export function wtInjectEncodedScript(){const t=`$ErrorActionPreference = 'Stop'
1
+ import{createHash as p}from"node:crypto";import{TERMINAL_LOCATOR_ENV as f}from"@weavecode/core";import{captureCommand as u,normalizeDirKey as P}from"./wezterm-mux.js";const h=["$ErrorActionPreference = 'SilentlyContinue'","$src = @'","using System; using System.Runtime.InteropServices;","public class WeaveWtCwd {",' [DllImport("ntdll.dll")] static extern int NtQueryInformationProcess(IntPtr h, int c, ref PBI pbi, int size, out int rl);',' [DllImport("kernel32.dll")] static extern IntPtr OpenProcess(int a, bool inh, int pid);',' [DllImport("kernel32.dll")] static extern bool ReadProcessMemory(IntPtr h, IntPtr addr, byte[] buf, int size, out IntPtr read);',' [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);'," [StructLayout(LayoutKind.Sequential)] struct PBI { public IntPtr r1; public IntPtr Peb; public IntPtr r2; public IntPtr r3; public IntPtr Pid; public IntPtr r4; }"," static IntPtr ReadPtr(IntPtr h, IntPtr addr) { var b = new byte[8]; IntPtr r; if (!ReadProcessMemory(h, addr, b, 8, out r)) return IntPtr.Zero; long v = BitConverter.ToInt64(b, 0); return v == 0 ? IntPtr.Zero : (IntPtr)v; }"," static ushort ReadU16(IntPtr h, IntPtr addr) { var b = new byte[2]; IntPtr r; if (!ReadProcessMemory(h, addr, b, 2, out r)) return 0; return BitConverter.ToUInt16(b, 0); }"," public static string GetCwd(int pid) {"," var h = OpenProcess(0x0410, false, pid);"," if (h == IntPtr.Zero) return null;"," try {"," var pbi = new PBI(); int rl;"," if (NtQueryInformationProcess(h, 0, ref pbi, Marshal.SizeOf(typeof(PBI)), out rl) != 0) return null;"," var pp = ReadPtr(h, (IntPtr)((long)pbi.Peb + 0x20));"," if (pp == IntPtr.Zero) return null;"," ushort len = ReadU16(h, (IntPtr)((long)pp + 0x38));"," var buf = ReadPtr(h, (IntPtr)((long)pp + 0x40));"," if (buf == IntPtr.Zero || len == 0 || len > 2048) return null;"," var b = new byte[len]; IntPtr r;"," if (!ReadProcessMemory(h, buf, b, len, out r)) return null;"," return System.Text.Encoding.Unicode.GetString(b).TrimEnd('\\0');"," } finally { CloseHandle(h); }"," }","}","'@","Add-Type -TypeDefinition $src","foreach ($p in Get-CimInstance Win32_Process) {"," $cwd = [WeaveWtCwd]::GetCwd($p.ProcessId)"," if ($null -ne $cwd -or $p.Name -eq 'WindowsTerminal.exe' -or $p.Name -eq 'OpenConsole.exe') {"," $created = if ($p.CreationDate) { $p.CreationDate.ToString('yyyyMMddHHmmss') } else { '' }"," '{0}|{1}|{2}|{3}|{4}' -f $p.ProcessId, $p.ParentProcessId, $p.Name, $created, $cwd"," }","}"].join(`
2
+ `),I=15e3;export function parseWtProcDump(t){const e=[];for(const n of t.split(`
3
+ `)){const o=n.trimEnd().split("|");if(o.length!==5)continue;const r=Number(o[0]),i=Number(o[1]);!Number.isInteger(r)||!Number.isInteger(i)||r<=0||i<0||o[2]&&e.push({pid:r,parentPid:i,name:o[2].toLowerCase(),created:o[3],cwd:o[4]===""?null:o[4]})}return e}const d=new Set(["bash.exe","zsh.exe","sh.exe","fish.exe","pwsh.exe","powershell.exe","cmd.exe"]);export function wtPanes(t){const e=new Set(t.filter(r=>r.name==="windowsterminal.exe").map(r=>r.pid));if(e.size===0)return[];const n=new Map;for(const r of t){if(r.parentPid===r.pid)continue;const i=n.get(r.parentPid)??[];i.push(r),n.set(r.parentPid,i)}const o=[];for(const r of t){if(!e.has(r.parentPid)||r.name==="openconsole.exe")continue;let i=r;for(;d.has(i.name);){const c=(n.get(i.pid)??[]).filter(s=>d.has(s.name));if(c.length===0)break;i=c.reduce((s,a)=>a.created>s.created||a.created===s.created&&a.pid>s.pid?a:s)}o.push({pid:r.pid,cwd:i.cwd})}return o}export function wtPanesAsWindows(t){return t.map(e=>({muxKey:`wt:${e.pid}`,windowId:e.pid,cwd:e.cwd}))}async function w(){if(process.platform!=="win32")return[];const t=await u("powershell.exe",["-NoProfile","-Command",h],void 0,I);return t?.ok?wtPanes(parseWtProcDump(t.out)):[]}let l=null;export async function wtPanesCached(){if(l&&Date.now()-l.at<1e4)return l.panes;const t=await w();return l={at:Date.now(),panes:t},t}export function wtWindowSlug(t){const e=P(t,"win32")??"root",n=e.replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),o=p("sha1").update(e).digest("hex").slice(0,8);return`weave-${n.slice(0,48)||"root"}-${o}`}export function parseWtTargetId(t){const e=/^wt:(weave-[a-z0-9-]+)$/.exec(t);return e?e[1]:null}export function parseWtPaneId(t){const e=/^wt:(\d+)$/.exec(t);if(!e)return null;const n=Number(e[1]);return Number.isInteger(n)&&n>0?n:null}export function wtPanePidFromEnv(t){const[e,n]=f.wt;if(!t[e])return null;const o=t[n];if(!o||!/^\d+$/.test(o))return null;const r=Number(o);return r>0?r:null}export const BRACKETED_PASTE_START="\x1B[200~",BRACKETED_PASTE_END="\x1B[201~";export async function wtInjectKeys(t,e){const n=await u("powershell",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",wtInjectEncodedScript()],{...process.env,WEAVE_WT_PID:String(t),WEAVE_WT_KEYS:Buffer.from(e,"utf8").toString("base64")},15e3);if(!n)throw new Error("powershell is unavailable \u2014 cannot send keys into Windows Terminal");if(!n.ok)throw n.timedOut?new Error("Windows Terminal key injection timed out"):new Error(`Windows Terminal key injection failed: ${n.err||n.out||"unknown error"}`)}export function wtInjectEncodedScript(){const t=`$ErrorActionPreference = 'Stop'
4
4
  Add-Type -TypeDefinition @'
5
5
  ${m}
6
6
  '@
@@ -1,98 +1,30 @@
1
1
  import { type TerminalPreset, type TerminalSettings } from './settings.js';
2
- export { parseTerminalAppDump, parseTerminalAppTargetId, parsePsRootPids, parseLsofCwds, pickTerminalAppWindow, terminalAppTargets, } from './opener/pty-terminals.js';
3
- export type { TerminalAppSurface } from './opener/pty-terminals.js';
4
- export { winRaiseEncodedScript } from './opener/win-raise.js';
5
- export { parseWtPaneId, parseWtProcDump, parseWtTargetId, wtInjectEncodedScript, wtPanePidFromEnv, wtPanes, wtWindowSlug, } from './opener/wt.js';
6
- export { planWeztermGrid } from './opener/wezterm-mux.js';
7
- export type { WtProcRow } from './opener/wt.js';
8
- export { quotePath } from './opener/shared.js';
9
- import { type WeztermMux } from './opener/wezterm-mux.js';
2
+ import { TerminalBackend, type LaunchOrigin, type PromptPaneTarget, type TerminalLaunch } from './opener/backend.js';
10
3
  import type { AttachTarget, SessionTerminal } from './opener/wezterm-mux.js';
11
- export { attachTargetsFromMuxes, countWindowsByDir, listAttachTargets, normalizeDirKey, parseAttachTargetId, parseWeztermPanes, planWeztermNewWindow, planWeztermReuse, sessionScreensFromEnvs, SocketProbeGate, weztermActiveWorkspaceOf, weztermCliArgs, weztermMuxKey, weztermPaneFromEnv, weztermSocketCandidates, } from './opener/wezterm-mux.js';
12
- export type { AttachTarget, SessionTerminal, WeztermMuxPane, } from './opener/wezterm-mux.js';
13
4
  /**
14
- * Cross-platform "open this directory" helpers behind the project context
15
- * menu: the OS file manager (Explorer/Finder/xdg-open) and a terminal at that
16
- * directory.
5
+ * 终端后端门面:工厂表(settings.preset → TerminalBackend)+ `auto` 组合 +
6
+ * 顶层便捷函数 + prompt 层② 通道适配。各终端实现各自一个文件
7
+ * (`opener/backend-<preset>.ts`),基类与共享件在 `opener/backend.ts`。
17
8
  *
18
9
  * Launches use argument-array spawns (never a shell string), so directory
19
10
  * names cannot inject commands. The one exception is the `custom` terminal
20
11
  * preset, which is a user-authored command template and deliberately goes
21
12
  * through a shell — the daemon is localhost-only and token-authenticated.
22
13
  */
23
- /** One spawn candidate: earlier entries are tried first (auto-probing). */
24
- export interface TerminalLaunch {
25
- command: string;
26
- args: string[];
27
- /** Working directory for the spawned process (inherited cwd). */
28
- cwd?: string;
29
- /** Run through the platform shell (custom commands only). */
30
- shell?: boolean;
31
- }
32
- /**
33
- * prompt 层② 兜底的注入落点:后端枚举出的可打文本 pane。
34
- * id 不透明、格式归各后端(wezterm = `<mux 短哈希>:<paneId>`)。
35
- */
36
- export interface PromptPaneTarget {
37
- id: string;
38
- /** pane 标题(claude 的 OSC 标题)——与会话标题匹配的素材;取不到 = null。 */
39
- title: string | null;
40
- /** pane 实时工作目录;取不到 = null(匹配不上任何项目)。 */
41
- cwd: string | null;
42
- }
43
- /** prompt pane id ↔ (mux, paneId) 解码;坏 id → null。 */
44
- export declare function parsePromptPaneId(id: string): {
45
- muxKey: string;
46
- paneId: number;
47
- } | null;
48
- /** 终端后端基类。模板方法定义骨架,子类只填候选与真正不同的流程。 */
49
- export declare abstract class TerminalBackend {
50
- readonly preset: TerminalPreset;
51
- /** 能否反查已开窗口 / 可附加目标(默认否:不是每种终端都问得到)。 */
52
- readonly enumerable: boolean;
53
- protected readonly platform: NodeJS.Platform;
54
- /** 能否给已开 pane 注入文本(prompt 层② send-text 兜底;默认否,不谎报)。 */
55
- readonly textAddressable: boolean;
56
- protected constructor(preset: TerminalPreset,
57
- /** 能否反查已开窗口 / 可附加目标(默认否:不是每种终端都问得到)。 */
58
- enumerable: boolean, platform?: NodeJS.Platform,
59
- /** 能否给已开 pane 注入文本(prompt 层② send-text 兜底;默认否,不谎报)。 */
60
- textAddressable?: boolean);
61
- /** 启动候选(按序尝试,第一个起的算成功);空 = 本平台不支持该 preset。 */
62
- abstract candidates(dir: string, run?: string[]): TerminalLaunch[];
63
- /** 开一个终端(模板方法)。 */
64
- open(dir: string): Promise<void>;
65
- /**
66
- * 开一个终端并把 `argv` 送进去(模板方法)。缺省把命令并进候选参数;wezterm
67
- * 覆写为走 mux——唯一流程真正不同的 preset(legacy `start -- PROG` 绕过
68
- * default_prog,且 mux 在时会挂死出无窗僵尸而 trySpawn 假成功)。
69
- */
70
- run(dir: string, argv: string[]): Promise<void>;
71
- /** 每目录已开终端数(单位 = 本后端的可见屏幕);不支持的 preset 走这里(空表 = 角标不显示,不谎报)。 */
72
- countWindows(_dirs: readonly string[]): Promise<Map<string, number>>;
73
- /** 可附加目标(窗口内的 tab);不支持的 preset 走这里。 */
74
- listTargets(_dir: string): Promise<AttachTarget[]>;
75
- /** 定点附加(多终端弹窗选定的目标);无通道的 preset 明确拒绝,不静默忽略。 */
76
- runAt(_dir: string, _argv: string[], _targetId: string): Promise<void>;
77
- /** 唤出(切到前台)已开终端;无通道的 preset 明确拒绝。 */
78
- focusTarget(_dir: string, _targetId: string): Promise<void>;
79
- /** prompt 层② 兜底:枚举可注入文本的 pane;无通道的后端空表(不谎报)。 */
80
- listPromptPanes(): Promise<PromptPaneTarget[]>;
81
- /** 层② 定位:pane env → pane id;无定位能力的后端 null(回落标题+cwd,不猜)。 */
82
- locatePane(_env: Record<string, string>): Promise<string | null>;
83
- /** 这个 pane id 是不是本后端发的(id 表示法归本后端);默认不是,不抢别人的 id。 */
84
- ownsPaneId(_paneId: string): boolean;
85
- /** 会话 → 所在可见屏幕(会话列表分块);无枚举能力的后端空表(不分组,不猜)。 */
86
- locateScreens(_envs: Record<string, Record<string, string>>): Promise<Record<string, SessionTerminal | null>>;
87
- /** prompt 层② 兜底:向枚举所得 pane 注入 prompt 原文并提交;无通道的后端明确拒绝。 */
88
- sendPromptText(_paneId: string, _text: string): Promise<void>;
89
- /** 阻塞问答作答:裸键序注入(模态框只吃键盘,不吃粘贴文本);无通道的后端明确拒绝。 */
90
- sendKeys(_paneId: string, _keys: string): Promise<void>;
91
- /** 关掉这个 pane(会话生命周期收尾 / 项目关终端共用);无通道的后端明确拒绝。 */
92
- closePane(_paneId: string): Promise<void>;
93
- /** 按候选顺序起一个;全失败抛真相(含试过哪些命令)。 */
94
- protected spawnFirst(candidates: TerminalLaunch[], emptyReason: string): Promise<void>;
95
- }
14
+ export { parseTerminalAppDump, parseTerminalAppTargetId, parsePsRootPids, parseLsofCwds, pickTerminalAppWindow, terminalAppTargets, } from './opener/pty-terminals.js';
15
+ export type { TerminalAppSurface } from './opener/pty-terminals.js';
16
+ export { winRaiseEncodedScript } from './opener/win-raise.js';
17
+ export { parseWtPaneId, parseWtProcDump, parseWtTargetId, wtInjectEncodedScript, wtPanePidFromEnv, wtPanes, wtWindowSlug, } from './opener/wt.js';
18
+ export type { WtProcRow } from './opener/wt.js';
19
+ export { quotePath } from './opener/shared.js';
20
+ export { attachTargetsFromMuxes, countWindowsByDir, listAttachTargets, normalizeDirKey, parseAttachTargetId, parseWeztermPanes, planWeztermNewWindow, planWeztermReuse, sessionScreensFromEnvs, SocketProbeGate, weztermActiveWorkspaceOf, weztermCliArgs, weztermMuxKey, weztermPaneFromEnv, weztermSocketCandidates, } from './opener/wezterm-mux.js';
21
+ export type { AttachTarget, SessionTerminal, WeztermMuxPane, } from './opener/wezterm-mux.js';
22
+ export { planWeztermGrid } from './opener/wezterm-mux.js';
23
+ export { konsolePaneFromEnv, parseKonsolePaneId, qtKeyOf, } from './opener/backend-konsole.js';
24
+ export { applescriptString, itermPaneFromEnv, parseItermPaneId, } from './opener/backend-iterm.js';
25
+ export { parsePromptPaneId, runInWeztermAt, } from './opener/backend-wezterm.js';
26
+ export { CandidatesBackend, CustomBackend, PRESET_CANDIDATES, TerminalBackend, trySpawn, } from './opener/backend.js';
27
+ export type { LaunchOrigin, PromptPaneTarget, TerminalLaunch, } from './opener/backend.js';
96
28
  /** settings → 后端(未知 preset 回落 auto,与旧的 switch default 一致)。 */
97
29
  export declare function terminalBackendFor(terminal: TerminalSettings, platform?: NodeJS.Platform): TerminalBackend;
98
30
  /**
@@ -129,15 +61,9 @@ export declare function promptTerminalChannel(settings: () => TerminalSettings):
129
61
  * 一律 0(角标不显示,不谎报)。
130
62
  */
131
63
  /** Open a terminal at `dir` that runs `argv` (e.g. `claude --resume <id>`).
132
- * Same detached semantics as `openInTerminal` — the process outlives the daemon. */
133
- export declare function runInTerminal(dir: string, argv: string[], terminal: TerminalSettings): Promise<void>;
134
- /**
135
- * 定点附加(用户在会话终端弹窗里选的 tab):实时重枚举定位目标,目标不在了
136
- * 就 throw——让前端报「该终端已关闭,请重选」,绝不静默换到别处(换了就是
137
- * 「我点了 A,命令进了 B」);已长满同样明确拒绝(**不擅自另开窗口**,那也是
138
- * 换地方),前端同一事实置灰,用户自己决定开新终端还是挑别的。
139
- */
140
- export declare function runInWeztermAt(dir: string, argv: string[], targetId: string, platform?: NodeJS.Platform): Promise<void>;
64
+ * Same detached semantics as `openInTerminal` — the process outlives the daemon.
65
+ * Returns the launch origin (spawn receipt) when the backend can get one. */
66
+ export declare function runInTerminal(dir: string, argv: string[], terminal: TerminalSettings): Promise<LaunchOrigin | null>;
141
67
  export declare function countOpenTerminals(dirs: string[], terminal: TerminalSettings): Promise<Map<string, number>>;
142
68
  /**
143
69
  * cwd **恰为** `dir` 的 pane = 这个项目的终端(关终端的命中判据,与
@@ -168,10 +94,6 @@ export declare function readTerminalCounts(projects: readonly {
168
94
  id: number;
169
95
  path: string;
170
96
  }[], opener?: ProjectOpener | undefined): Promise<Record<number, number>>;
171
- export declare function weztermLiveMuxesCached(): Promise<{
172
- muxes: WeztermMux[];
173
- candidates: string[];
174
- }>;
175
97
  /**
176
98
  * Resolve the spawn candidates that would open a terminal at `dir`. 兼容入口:
177
99
  * 候选解析已归后端(`TerminalBackend.candidates`),这里只做分发。
@@ -182,10 +104,6 @@ export declare function weztermLiveMuxesCached(): Promise<{
182
104
  export declare function resolveTerminalLaunch(dir: string, terminal: TerminalSettings, platform?: NodeJS.Platform, run?: string[]): TerminalLaunch[];
183
105
  /** File-manager command that opens `dir` (per platform). */
184
106
  export declare function resolveExplorerLaunch(dir: string, platform?: NodeJS.Platform): TerminalLaunch;
185
- /** Spawn detached and forget: the child outlives the daemon, its window is
186
- * its own, and I/O is dropped so a GUI process never blocks on pipes. */
187
- export declare function trySpawn(launch: TerminalLaunch): Promise<boolean>;
188
- /** Try candidates in order until one launches (auto-probe fallback). */
189
107
  /** Open the OS file manager at `dir`. */
190
108
  export declare function openInExplorer(dir: string): Promise<void>;
191
109
  /** Open a terminal at `dir` following the configured preset. `auto` tries the
@@ -195,7 +113,7 @@ export declare function openInTerminal(dir: string, terminal: TerminalSettings):
195
113
  export interface ProjectOpener {
196
114
  openExplorer(dir: string): Promise<void>;
197
115
  openTerminal(dir: string, terminal: TerminalSettings): Promise<void>;
198
- runInTerminal(dir: string, argv: string[], terminal: TerminalSettings): Promise<void>;
116
+ runInTerminal(dir: string, argv: string[], terminal: TerminalSettings): Promise<LaunchOrigin | null>;
199
117
  /** 已打开终端窗口计数(可选:不实现的 spy 由路由回落到默认实现)。 */
200
118
  countTerminals?(dirs: string[], terminal: TerminalSettings): Promise<Map<string, number>>;
201
119
  /** 关掉本目录的已开终端(可选):只关清单里的 pane,回关掉几个。 */
@@ -205,22 +123,7 @@ export interface ProjectOpener {
205
123
  /** 可附加终端目标列表(可选):多终端选择弹窗的数据面。 */
206
124
  listTerminals?(dir: string, terminal: TerminalSettings): Promise<AttachTarget[]>;
207
125
  /** 定点附加到指定目标 tab(可选):会话终端选择后的落点。 */
208
- runInTerminalAt?(dir: string, argv: string[], targetId: string, terminal: TerminalSettings): Promise<void>;
126
+ runInTerminalAt?(dir: string, argv: string[], targetId: string, terminal: TerminalSettings): Promise<LaunchOrigin | null>;
209
127
  focusTerminal?(dir: string, targetId: string, terminal: TerminalSettings): Promise<void>;
210
128
  }
211
- /** Konsole 的 pane id ↔ (D-Bus 服务名, 会话路径);坏 id → null。 */
212
- export declare function parseKonsolePaneId(id: string): {
213
- service: string;
214
- session: string;
215
- } | null;
216
- /** 上报的 pane env → Konsole 的 pane id;不是 Konsole 会话(缺键)→ null。 */
217
- export declare function konsolePaneFromEnv(env: Record<string, string>): string | null;
218
- /** 字符 → Qt 键值:控制键给真值,其余用码位(ASCII 与 Qt::Key 一致)。 */
219
- export declare function qtKeyOf(ch: string): number;
220
- /** iTerm2 的 pane id ↔ 会话 unique id;坏 id → null。 */
221
- export declare function parseItermPaneId(paneId: string): string | null;
222
- /** 上报的 pane env → iTerm2 的 pane id;不是 iTerm 会话(缺键)→ null。 */
223
- export declare function itermPaneFromEnv(env: Record<string, string>): string | null;
224
- /** AppleScript 字符串字面量转义(反斜杠先转,免把引号转义再转一遍)。 */
225
- export declare function applescriptString(text: string): string;
226
129
  export declare const defaultProjectOpener: ProjectOpener;