@openclaw/tokenjuice 2026.5.28

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 (586) hide show
  1. package/README.md +35 -0
  2. package/dist/index.js +13 -0
  3. package/dist/runtime-api.js +2 -0
  4. package/dist/tool-result-middleware.js +34 -0
  5. package/node_modules/tokenjuice/LICENSE +21 -0
  6. package/node_modules/tokenjuice/README.md +311 -0
  7. package/node_modules/tokenjuice/SECURITY.md +50 -0
  8. package/node_modules/tokenjuice/dist/cli/doctor-output.d.ts +2 -0
  9. package/node_modules/tokenjuice/dist/cli/doctor-output.js +92 -0
  10. package/node_modules/tokenjuice/dist/cli/install-output.d.ts +5 -0
  11. package/node_modules/tokenjuice/dist/cli/install-output.js +11 -0
  12. package/node_modules/tokenjuice/dist/cli/main.d.ts +34 -0
  13. package/node_modules/tokenjuice/dist/cli/main.js +6614 -0
  14. package/node_modules/tokenjuice/dist/core/analysis.d.ts +88 -0
  15. package/node_modules/tokenjuice/dist/core/analysis.js +313 -0
  16. package/node_modules/tokenjuice/dist/core/artifacts.d.ts +9 -0
  17. package/node_modules/tokenjuice/dist/core/artifacts.js +210 -0
  18. package/node_modules/tokenjuice/dist/core/builtin-rules.generated.d.ts +2 -0
  19. package/node_modules/tokenjuice/dist/core/builtin-rules.generated.js +262 -0
  20. package/node_modules/tokenjuice/dist/core/classify.d.ts +18 -0
  21. package/node_modules/tokenjuice/dist/core/classify.js +181 -0
  22. package/node_modules/tokenjuice/dist/core/cli-client.d.ts +2 -0
  23. package/node_modules/tokenjuice/dist/core/cli-client.js +127 -0
  24. package/node_modules/tokenjuice/dist/core/command-identity.d.ts +9 -0
  25. package/node_modules/tokenjuice/dist/core/command-identity.js +201 -0
  26. package/node_modules/tokenjuice/dist/core/command-match.d.ts +16 -0
  27. package/node_modules/tokenjuice/dist/core/command-match.js +443 -0
  28. package/node_modules/tokenjuice/dist/core/command-shell.d.ts +18 -0
  29. package/node_modules/tokenjuice/dist/core/command-shell.js +291 -0
  30. package/node_modules/tokenjuice/dist/core/command.d.ts +5 -0
  31. package/node_modules/tokenjuice/dist/core/command.js +4 -0
  32. package/node_modules/tokenjuice/dist/core/compaction-metadata.d.ts +10 -0
  33. package/node_modules/tokenjuice/dist/core/compaction-metadata.js +28 -0
  34. package/node_modules/tokenjuice/dist/core/env.d.ts +1 -0
  35. package/node_modules/tokenjuice/dist/core/env.js +5 -0
  36. package/node_modules/tokenjuice/dist/core/execution-input.d.ts +2 -0
  37. package/node_modules/tokenjuice/dist/core/execution-input.js +51 -0
  38. package/node_modules/tokenjuice/dist/core/fixtures.d.ts +14 -0
  39. package/node_modules/tokenjuice/dist/core/fixtures.js +190 -0
  40. package/node_modules/tokenjuice/dist/core/github-actions-summary.d.ts +6 -0
  41. package/node_modules/tokenjuice/dist/core/github-actions-summary.js +105 -0
  42. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.d.ts +33 -0
  43. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.js +85 -0
  44. package/node_modules/tokenjuice/dist/core/integrations/rewrite-policy.d.ts +8 -0
  45. package/node_modules/tokenjuice/dist/core/integrations/rewrite-policy.js +25 -0
  46. package/node_modules/tokenjuice/dist/core/inventory-safety.d.ts +11 -0
  47. package/node_modules/tokenjuice/dist/core/inventory-safety.js +347 -0
  48. package/node_modules/tokenjuice/dist/core/json-protocol.d.ts +2 -0
  49. package/node_modules/tokenjuice/dist/core/json-protocol.js +131 -0
  50. package/node_modules/tokenjuice/dist/core/reduce-formatters.d.ts +15 -0
  51. package/node_modules/tokenjuice/dist/core/reduce-formatters.js +611 -0
  52. package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.d.ts +9 -0
  53. package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.js +125 -0
  54. package/node_modules/tokenjuice/dist/core/reduce-utils.d.ts +12 -0
  55. package/node_modules/tokenjuice/dist/core/reduce-utils.js +117 -0
  56. package/node_modules/tokenjuice/dist/core/reduce.d.ts +5 -0
  57. package/node_modules/tokenjuice/dist/core/reduce.js +511 -0
  58. package/node_modules/tokenjuice/dist/core/rules.d.ts +22 -0
  59. package/node_modules/tokenjuice/dist/core/rules.js +265 -0
  60. package/node_modules/tokenjuice/dist/core/source.d.ts +6 -0
  61. package/node_modules/tokenjuice/dist/core/source.js +113 -0
  62. package/node_modules/tokenjuice/dist/core/text.d.ts +23 -0
  63. package/node_modules/tokenjuice/dist/core/text.js +204 -0
  64. package/node_modules/tokenjuice/dist/core/time.d.ts +2 -0
  65. package/node_modules/tokenjuice/dist/core/time.js +82 -0
  66. package/node_modules/tokenjuice/dist/core/validate-rules.d.ts +10 -0
  67. package/node_modules/tokenjuice/dist/core/validate-rules.js +198 -0
  68. package/node_modules/tokenjuice/dist/core/wrap.d.ts +2 -0
  69. package/node_modules/tokenjuice/dist/core/wrap.js +104 -0
  70. package/node_modules/tokenjuice/dist/hosts/adal/index.d.ts +23 -0
  71. package/node_modules/tokenjuice/dist/hosts/adal/index.js +157 -0
  72. package/node_modules/tokenjuice/dist/hosts/aether/index.d.ts +30 -0
  73. package/node_modules/tokenjuice/dist/hosts/aether/index.js +671 -0
  74. package/node_modules/tokenjuice/dist/hosts/agent-layer/index.d.ts +25 -0
  75. package/node_modules/tokenjuice/dist/hosts/agent-layer/index.js +173 -0
  76. package/node_modules/tokenjuice/dist/hosts/agentinit/index.d.ts +27 -0
  77. package/node_modules/tokenjuice/dist/hosts/agentinit/index.js +252 -0
  78. package/node_modules/tokenjuice/dist/hosts/agentlink/index.d.ts +26 -0
  79. package/node_modules/tokenjuice/dist/hosts/agentlink/index.js +310 -0
  80. package/node_modules/tokenjuice/dist/hosts/agentloom/index.d.ts +24 -0
  81. package/node_modules/tokenjuice/dist/hosts/agentloom/index.js +161 -0
  82. package/node_modules/tokenjuice/dist/hosts/agents-cli/index.d.ts +26 -0
  83. package/node_modules/tokenjuice/dist/hosts/agents-cli/index.js +136 -0
  84. package/node_modules/tokenjuice/dist/hosts/agents-md/index.d.ts +24 -0
  85. package/node_modules/tokenjuice/dist/hosts/agents-md/index.js +240 -0
  86. package/node_modules/tokenjuice/dist/hosts/agentsge/index.d.ts +23 -0
  87. package/node_modules/tokenjuice/dist/hosts/agentsge/index.js +119 -0
  88. package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.d.ts +26 -0
  89. package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.js +337 -0
  90. package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.d.ts +24 -0
  91. package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.js +392 -0
  92. package/node_modules/tokenjuice/dist/hosts/aictl/index.d.ts +24 -0
  93. package/node_modules/tokenjuice/dist/hosts/aictl/index.js +271 -0
  94. package/node_modules/tokenjuice/dist/hosts/aider/index.d.ts +23 -0
  95. package/node_modules/tokenjuice/dist/hosts/aider/index.js +79 -0
  96. package/node_modules/tokenjuice/dist/hosts/amazon-q/index.d.ts +23 -0
  97. package/node_modules/tokenjuice/dist/hosts/amazon-q/index.js +169 -0
  98. package/node_modules/tokenjuice/dist/hosts/amp/index.d.ts +26 -0
  99. package/node_modules/tokenjuice/dist/hosts/amp/index.js +306 -0
  100. package/node_modules/tokenjuice/dist/hosts/antigravity/index.d.ts +23 -0
  101. package/node_modules/tokenjuice/dist/hosts/antigravity/index.js +172 -0
  102. package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.d.ts +26 -0
  103. package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.js +260 -0
  104. package/node_modules/tokenjuice/dist/hosts/augment/index.d.ts +23 -0
  105. package/node_modules/tokenjuice/dist/hosts/augment/index.js +171 -0
  106. package/node_modules/tokenjuice/dist/hosts/avante/index.d.ts +23 -0
  107. package/node_modules/tokenjuice/dist/hosts/avante/index.js +68 -0
  108. package/node_modules/tokenjuice/dist/hosts/baz/index.d.ts +25 -0
  109. package/node_modules/tokenjuice/dist/hosts/baz/index.js +286 -0
  110. package/node_modules/tokenjuice/dist/hosts/bito/index.d.ts +28 -0
  111. package/node_modules/tokenjuice/dist/hosts/bito/index.js +363 -0
  112. package/node_modules/tokenjuice/dist/hosts/blackbox/index.d.ts +25 -0
  113. package/node_modules/tokenjuice/dist/hosts/blackbox/index.js +305 -0
  114. package/node_modules/tokenjuice/dist/hosts/blocks/index.d.ts +25 -0
  115. package/node_modules/tokenjuice/dist/hosts/blocks/index.js +317 -0
  116. package/node_modules/tokenjuice/dist/hosts/bob/index.d.ts +23 -0
  117. package/node_modules/tokenjuice/dist/hosts/bob/index.js +155 -0
  118. package/node_modules/tokenjuice/dist/hosts/builder/index.d.ts +23 -0
  119. package/node_modules/tokenjuice/dist/hosts/builder/index.js +177 -0
  120. package/node_modules/tokenjuice/dist/hosts/charlie/index.d.ts +25 -0
  121. package/node_modules/tokenjuice/dist/hosts/charlie/index.js +275 -0
  122. package/node_modules/tokenjuice/dist/hosts/claude-code/index.d.ts +30 -0
  123. package/node_modules/tokenjuice/dist/hosts/claude-code/index.js +364 -0
  124. package/node_modules/tokenjuice/dist/hosts/clawdbot/index.d.ts +25 -0
  125. package/node_modules/tokenjuice/dist/hosts/clawdbot/index.js +320 -0
  126. package/node_modules/tokenjuice/dist/hosts/cline/index.d.ts +27 -0
  127. package/node_modules/tokenjuice/dist/hosts/cline/index.js +156 -0
  128. package/node_modules/tokenjuice/dist/hosts/codeant/index.d.ts +25 -0
  129. package/node_modules/tokenjuice/dist/hosts/codeant/index.js +370 -0
  130. package/node_modules/tokenjuice/dist/hosts/codebuddy/index.d.ts +29 -0
  131. package/node_modules/tokenjuice/dist/hosts/codebuddy/index.js +379 -0
  132. package/node_modules/tokenjuice/dist/hosts/codebuff/index.d.ts +23 -0
  133. package/node_modules/tokenjuice/dist/hosts/codebuff/index.js +155 -0
  134. package/node_modules/tokenjuice/dist/hosts/codegen/index.d.ts +23 -0
  135. package/node_modules/tokenjuice/dist/hosts/codegen/index.js +155 -0
  136. package/node_modules/tokenjuice/dist/hosts/coder-agents/index.d.ts +24 -0
  137. package/node_modules/tokenjuice/dist/hosts/coder-agents/index.js +339 -0
  138. package/node_modules/tokenjuice/dist/hosts/coderabbit/index.d.ts +25 -0
  139. package/node_modules/tokenjuice/dist/hosts/coderabbit/index.js +599 -0
  140. package/node_modules/tokenjuice/dist/hosts/codex/index.d.ts +93 -0
  141. package/node_modules/tokenjuice/dist/hosts/codex/index.js +945 -0
  142. package/node_modules/tokenjuice/dist/hosts/command-code/index.d.ts +29 -0
  143. package/node_modules/tokenjuice/dist/hosts/command-code/index.js +366 -0
  144. package/node_modules/tokenjuice/dist/hosts/continue/index.d.ts +23 -0
  145. package/node_modules/tokenjuice/dist/hosts/continue/index.js +81 -0
  146. package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.d.ts +29 -0
  147. package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.js +497 -0
  148. package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.d.ts +31 -0
  149. package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.js +428 -0
  150. package/node_modules/tokenjuice/dist/hosts/crush/index.d.ts +23 -0
  151. package/node_modules/tokenjuice/dist/hosts/crush/index.js +135 -0
  152. package/node_modules/tokenjuice/dist/hosts/cursor/index.d.ts +30 -0
  153. package/node_modules/tokenjuice/dist/hosts/cursor/index.js +293 -0
  154. package/node_modules/tokenjuice/dist/hosts/deepagents/index.d.ts +23 -0
  155. package/node_modules/tokenjuice/dist/hosts/deepagents/index.js +157 -0
  156. package/node_modules/tokenjuice/dist/hosts/devin/index.d.ts +31 -0
  157. package/node_modules/tokenjuice/dist/hosts/devin/index.js +283 -0
  158. package/node_modules/tokenjuice/dist/hosts/docker-agent/index.d.ts +23 -0
  159. package/node_modules/tokenjuice/dist/hosts/docker-agent/index.js +206 -0
  160. package/node_modules/tokenjuice/dist/hosts/dot-agents/index.d.ts +26 -0
  161. package/node_modules/tokenjuice/dist/hosts/dot-agents/index.js +171 -0
  162. package/node_modules/tokenjuice/dist/hosts/droid/index.d.ts +26 -0
  163. package/node_modules/tokenjuice/dist/hosts/droid/index.js +313 -0
  164. package/node_modules/tokenjuice/dist/hosts/eca/index.d.ts +24 -0
  165. package/node_modules/tokenjuice/dist/hosts/eca/index.js +347 -0
  166. package/node_modules/tokenjuice/dist/hosts/elyra/index.d.ts +24 -0
  167. package/node_modules/tokenjuice/dist/hosts/elyra/index.js +382 -0
  168. package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.d.ts +23 -0
  169. package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.js +155 -0
  170. package/node_modules/tokenjuice/dist/hosts/forgecode/index.d.ts +24 -0
  171. package/node_modules/tokenjuice/dist/hosts/forgecode/index.js +273 -0
  172. package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.d.ts +26 -0
  173. package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.js +234 -0
  174. package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.d.ts +23 -0
  175. package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.js +155 -0
  176. package/node_modules/tokenjuice/dist/hosts/goose/index.d.ts +26 -0
  177. package/node_modules/tokenjuice/dist/hosts/goose/index.js +288 -0
  178. package/node_modules/tokenjuice/dist/hosts/gptme/index.d.ts +23 -0
  179. package/node_modules/tokenjuice/dist/hosts/gptme/index.js +155 -0
  180. package/node_modules/tokenjuice/dist/hosts/greptile/index.d.ts +25 -0
  181. package/node_modules/tokenjuice/dist/hosts/greptile/index.js +299 -0
  182. package/node_modules/tokenjuice/dist/hosts/grok-build/index.d.ts +23 -0
  183. package/node_modules/tokenjuice/dist/hosts/grok-build/index.js +155 -0
  184. package/node_modules/tokenjuice/dist/hosts/grok-cli/index.d.ts +26 -0
  185. package/node_modules/tokenjuice/dist/hosts/grok-cli/index.js +262 -0
  186. package/node_modules/tokenjuice/dist/hosts/jean2/index.d.ts +23 -0
  187. package/node_modules/tokenjuice/dist/hosts/jean2/index.js +155 -0
  188. package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.d.ts +23 -0
  189. package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.js +202 -0
  190. package/node_modules/tokenjuice/dist/hosts/jules/index.d.ts +23 -0
  191. package/node_modules/tokenjuice/dist/hosts/jules/index.js +155 -0
  192. package/node_modules/tokenjuice/dist/hosts/junie/index.d.ts +23 -0
  193. package/node_modules/tokenjuice/dist/hosts/junie/index.js +68 -0
  194. package/node_modules/tokenjuice/dist/hosts/kilo/index.d.ts +30 -0
  195. package/node_modules/tokenjuice/dist/hosts/kilo/index.js +497 -0
  196. package/node_modules/tokenjuice/dist/hosts/kimi/index.d.ts +29 -0
  197. package/node_modules/tokenjuice/dist/hosts/kimi/index.js +255 -0
  198. package/node_modules/tokenjuice/dist/hosts/kiro/index.d.ts +23 -0
  199. package/node_modules/tokenjuice/dist/hosts/kiro/index.js +116 -0
  200. package/node_modules/tokenjuice/dist/hosts/knowns/index.d.ts +24 -0
  201. package/node_modules/tokenjuice/dist/hosts/knowns/index.js +273 -0
  202. package/node_modules/tokenjuice/dist/hosts/leanctl/index.d.ts +24 -0
  203. package/node_modules/tokenjuice/dist/hosts/leanctl/index.js +317 -0
  204. package/node_modules/tokenjuice/dist/hosts/localcode/index.d.ts +31 -0
  205. package/node_modules/tokenjuice/dist/hosts/localcode/index.js +539 -0
  206. package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.d.ts +24 -0
  207. package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.js +302 -0
  208. package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.d.ts +23 -0
  209. package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.js +226 -0
  210. package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.d.ts +23 -0
  211. package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.js +155 -0
  212. package/node_modules/tokenjuice/dist/hosts/mux/index.d.ts +28 -0
  213. package/node_modules/tokenjuice/dist/hosts/mux/index.js +411 -0
  214. package/node_modules/tokenjuice/dist/hosts/novakit/index.d.ts +24 -0
  215. package/node_modules/tokenjuice/dist/hosts/novakit/index.js +273 -0
  216. package/node_modules/tokenjuice/dist/hosts/ona/index.d.ts +41 -0
  217. package/node_modules/tokenjuice/dist/hosts/ona/index.js +596 -0
  218. package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.d.ts +26 -0
  219. package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.js +348 -0
  220. package/node_modules/tokenjuice/dist/hosts/openclaw/extension.d.ts +8 -0
  221. package/node_modules/tokenjuice/dist/hosts/openclaw/extension.js +104 -0
  222. package/node_modules/tokenjuice/dist/hosts/openclaw/index.d.ts +1 -0
  223. package/node_modules/tokenjuice/dist/hosts/openclaw/index.js +1 -0
  224. package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.d.ts +17 -0
  225. package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.js +9094 -0
  226. package/node_modules/tokenjuice/dist/hosts/opencode/index.d.ts +21 -0
  227. package/node_modules/tokenjuice/dist/hosts/opencode/index.js +163 -0
  228. package/node_modules/tokenjuice/dist/hosts/openhands/index.d.ts +28 -0
  229. package/node_modules/tokenjuice/dist/hosts/openhands/index.js +211 -0
  230. package/node_modules/tokenjuice/dist/hosts/openwebui/index.d.ts +23 -0
  231. package/node_modules/tokenjuice/dist/hosts/openwebui/index.js +245 -0
  232. package/node_modules/tokenjuice/dist/hosts/pi/extension/pi-types.d.ts +79 -0
  233. package/node_modules/tokenjuice/dist/hosts/pi/extension/pi-types.js +3 -0
  234. package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.d.ts +5 -0
  235. package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.js +9372 -0
  236. package/node_modules/tokenjuice/dist/hosts/pi/extension/settings.d.ts +1 -0
  237. package/node_modules/tokenjuice/dist/hosts/pi/extension/settings.js +26 -0
  238. package/node_modules/tokenjuice/dist/hosts/pi/extension/status-panel.d.ts +3 -0
  239. package/node_modules/tokenjuice/dist/hosts/pi/extension/status-panel.js +72 -0
  240. package/node_modules/tokenjuice/dist/hosts/pi/extension/status.d.ts +20 -0
  241. package/node_modules/tokenjuice/dist/hosts/pi/extension/status.js +58 -0
  242. package/node_modules/tokenjuice/dist/hosts/pi/extension/tool-result.d.ts +4 -0
  243. package/node_modules/tokenjuice/dist/hosts/pi/extension/tool-result.js +24 -0
  244. package/node_modules/tokenjuice/dist/hosts/pi/extension/utils.d.ts +1 -0
  245. package/node_modules/tokenjuice/dist/hosts/pi/extension/utils.js +6 -0
  246. package/node_modules/tokenjuice/dist/hosts/pi/index.d.ts +26 -0
  247. package/node_modules/tokenjuice/dist/hosts/pi/index.js +228 -0
  248. package/node_modules/tokenjuice/dist/hosts/pi-go/index.d.ts +24 -0
  249. package/node_modules/tokenjuice/dist/hosts/pi-go/index.js +352 -0
  250. package/node_modules/tokenjuice/dist/hosts/plandex/index.d.ts +23 -0
  251. package/node_modules/tokenjuice/dist/hosts/plandex/index.js +164 -0
  252. package/node_modules/tokenjuice/dist/hosts/qoder/index.d.ts +23 -0
  253. package/node_modules/tokenjuice/dist/hosts/qoder/index.js +155 -0
  254. package/node_modules/tokenjuice/dist/hosts/qodo/index.d.ts +24 -0
  255. package/node_modules/tokenjuice/dist/hosts/qodo/index.js +584 -0
  256. package/node_modules/tokenjuice/dist/hosts/qwen-code/index.d.ts +28 -0
  257. package/node_modules/tokenjuice/dist/hosts/qwen-code/index.js +276 -0
  258. package/node_modules/tokenjuice/dist/hosts/replit/index.d.ts +23 -0
  259. package/node_modules/tokenjuice/dist/hosts/replit/index.js +155 -0
  260. package/node_modules/tokenjuice/dist/hosts/roo/index.d.ts +23 -0
  261. package/node_modules/tokenjuice/dist/hosts/roo/index.js +101 -0
  262. package/node_modules/tokenjuice/dist/hosts/rovo/index.d.ts +23 -0
  263. package/node_modules/tokenjuice/dist/hosts/rovo/index.js +155 -0
  264. package/node_modules/tokenjuice/dist/hosts/ruler/index.d.ts +23 -0
  265. package/node_modules/tokenjuice/dist/hosts/ruler/index.js +157 -0
  266. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.d.ts +19 -0
  267. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.js +32 -0
  268. package/node_modules/tokenjuice/dist/hosts/shared/hook-command.d.ts +5 -0
  269. package/node_modules/tokenjuice/dist/hosts/shared/hook-command.js +94 -0
  270. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.d.ts +212 -0
  271. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.js +270 -0
  272. package/node_modules/tokenjuice/dist/hosts/shared/hook-output.d.ts +4 -0
  273. package/node_modules/tokenjuice/dist/hosts/shared/hook-output.js +15 -0
  274. package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.d.ts +18 -0
  275. package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.js +108 -0
  276. package/node_modules/tokenjuice/dist/hosts/shared/host-command.d.ts +10 -0
  277. package/node_modules/tokenjuice/dist/hosts/shared/host-command.js +70 -0
  278. package/node_modules/tokenjuice/dist/hosts/shared/instruction-doctor.d.ts +16 -0
  279. package/node_modules/tokenjuice/dist/hosts/shared/instruction-doctor.js +13 -0
  280. package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.d.ts +29 -0
  281. package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.js +121 -0
  282. package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.d.ts +7 -0
  283. package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.js +12 -0
  284. package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.d.ts +32 -0
  285. package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.js +100 -0
  286. package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.d.ts +91 -0
  287. package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.js +186 -0
  288. package/node_modules/tokenjuice/dist/hosts/shared/tool-result.d.ts +15 -0
  289. package/node_modules/tokenjuice/dist/hosts/shared/tool-result.js +52 -0
  290. package/node_modules/tokenjuice/dist/hosts/stagewise/index.d.ts +25 -0
  291. package/node_modules/tokenjuice/dist/hosts/stagewise/index.js +468 -0
  292. package/node_modules/tokenjuice/dist/hosts/swe-agent/index.d.ts +23 -0
  293. package/node_modules/tokenjuice/dist/hosts/swe-agent/index.js +223 -0
  294. package/node_modules/tokenjuice/dist/hosts/tabby/index.d.ts +24 -0
  295. package/node_modules/tokenjuice/dist/hosts/tabby/index.js +469 -0
  296. package/node_modules/tokenjuice/dist/hosts/tabnine/index.d.ts +23 -0
  297. package/node_modules/tokenjuice/dist/hosts/tabnine/index.js +155 -0
  298. package/node_modules/tokenjuice/dist/hosts/trae/index.d.ts +23 -0
  299. package/node_modules/tokenjuice/dist/hosts/trae/index.js +155 -0
  300. package/node_modules/tokenjuice/dist/hosts/uipath/index.d.ts +23 -0
  301. package/node_modules/tokenjuice/dist/hosts/uipath/index.js +155 -0
  302. package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.d.ts +32 -0
  303. package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.js +416 -0
  304. package/node_modules/tokenjuice/dist/hosts/warp/index.d.ts +23 -0
  305. package/node_modules/tokenjuice/dist/hosts/warp/index.js +181 -0
  306. package/node_modules/tokenjuice/dist/hosts/windsurf/index.d.ts +23 -0
  307. package/node_modules/tokenjuice/dist/hosts/windsurf/index.js +99 -0
  308. package/node_modules/tokenjuice/dist/hosts/zed/index.d.ts +23 -0
  309. package/node_modules/tokenjuice/dist/hosts/zed/index.js +68 -0
  310. package/node_modules/tokenjuice/dist/hosts/zencoder/index.d.ts +23 -0
  311. package/node_modules/tokenjuice/dist/hosts/zencoder/index.js +227 -0
  312. package/node_modules/tokenjuice/dist/index.d.ts +214 -0
  313. package/node_modules/tokenjuice/dist/index.js +113 -0
  314. package/node_modules/tokenjuice/dist/rules/archive/tar.json +30 -0
  315. package/node_modules/tokenjuice/dist/rules/archive/unzip.json +30 -0
  316. package/node_modules/tokenjuice/dist/rules/archive/zip.json +30 -0
  317. package/node_modules/tokenjuice/dist/rules/build/cmake.json +35 -0
  318. package/node_modules/tokenjuice/dist/rules/build/dotnet.json +36 -0
  319. package/node_modules/tokenjuice/dist/rules/build/esbuild.json +35 -0
  320. package/node_modules/tokenjuice/dist/rules/build/go-build.json +31 -0
  321. package/node_modules/tokenjuice/dist/rules/build/gradle.json +35 -0
  322. package/node_modules/tokenjuice/dist/rules/build/maven.json +35 -0
  323. package/node_modules/tokenjuice/dist/rules/build/msbuild.json +35 -0
  324. package/node_modules/tokenjuice/dist/rules/build/pnpm-build.json +44 -0
  325. package/node_modules/tokenjuice/dist/rules/build/swift-build.json +56 -0
  326. package/node_modules/tokenjuice/dist/rules/build/tsc.json +74 -0
  327. package/node_modules/tokenjuice/dist/rules/build/tsdown.json +35 -0
  328. package/node_modules/tokenjuice/dist/rules/build/vite.json +42 -0
  329. package/node_modules/tokenjuice/dist/rules/build/webpack.json +51 -0
  330. package/node_modules/tokenjuice/dist/rules/build/xcodebuild.json +80 -0
  331. package/node_modules/tokenjuice/dist/rules/cloud/aws.json +30 -0
  332. package/node_modules/tokenjuice/dist/rules/cloud/az.json +30 -0
  333. package/node_modules/tokenjuice/dist/rules/cloud/flyctl.json +30 -0
  334. package/node_modules/tokenjuice/dist/rules/cloud/gcloud.json +30 -0
  335. package/node_modules/tokenjuice/dist/rules/cloud/gh.json +30 -0
  336. package/node_modules/tokenjuice/dist/rules/cloud/vercel.json +30 -0
  337. package/node_modules/tokenjuice/dist/rules/database/mongosh.json +30 -0
  338. package/node_modules/tokenjuice/dist/rules/database/mysql.json +30 -0
  339. package/node_modules/tokenjuice/dist/rules/database/psql.json +30 -0
  340. package/node_modules/tokenjuice/dist/rules/database/redis-cli.json +30 -0
  341. package/node_modules/tokenjuice/dist/rules/database/sqlite3.json +30 -0
  342. package/node_modules/tokenjuice/dist/rules/devops/docker-build.json +53 -0
  343. package/node_modules/tokenjuice/dist/rules/devops/docker-compose.json +44 -0
  344. package/node_modules/tokenjuice/dist/rules/devops/docker-images.json +30 -0
  345. package/node_modules/tokenjuice/dist/rules/devops/docker-logs.json +43 -0
  346. package/node_modules/tokenjuice/dist/rules/devops/docker-ps.json +30 -0
  347. package/node_modules/tokenjuice/dist/rules/devops/helm.json +35 -0
  348. package/node_modules/tokenjuice/dist/rules/devops/kubectl-describe.json +45 -0
  349. package/node_modules/tokenjuice/dist/rules/devops/kubectl-get.json +35 -0
  350. package/node_modules/tokenjuice/dist/rules/devops/kubectl-logs.json +43 -0
  351. package/node_modules/tokenjuice/dist/rules/devops/pulumi.json +35 -0
  352. package/node_modules/tokenjuice/dist/rules/devops/terraform.json +35 -0
  353. package/node_modules/tokenjuice/dist/rules/devops/terragrunt.json +35 -0
  354. package/node_modules/tokenjuice/dist/rules/filesystem/fd.json +33 -0
  355. package/node_modules/tokenjuice/dist/rules/filesystem/find.json +42 -0
  356. package/node_modules/tokenjuice/dist/rules/filesystem/git-ls-files.json +35 -0
  357. package/node_modules/tokenjuice/dist/rules/filesystem/ls.json +29 -0
  358. package/node_modules/tokenjuice/dist/rules/filesystem/rg-files.json +34 -0
  359. package/node_modules/tokenjuice/dist/rules/fixtures/archive/tar.fixture.json +16 -0
  360. package/node_modules/tokenjuice/dist/rules/fixtures/archive/unzip.fixture.json +16 -0
  361. package/node_modules/tokenjuice/dist/rules/fixtures/archive/zip.fixture.json +16 -0
  362. package/node_modules/tokenjuice/dist/rules/fixtures/build/cmake.fixture.json +16 -0
  363. package/node_modules/tokenjuice/dist/rules/fixtures/build/dotnet.fixture.json +16 -0
  364. package/node_modules/tokenjuice/dist/rules/fixtures/build/esbuild.fixture.json +15 -0
  365. package/node_modules/tokenjuice/dist/rules/fixtures/build/go-build.fixture.json +16 -0
  366. package/node_modules/tokenjuice/dist/rules/fixtures/build/gradle.fixture.json +16 -0
  367. package/node_modules/tokenjuice/dist/rules/fixtures/build/maven.fixture.json +16 -0
  368. package/node_modules/tokenjuice/dist/rules/fixtures/build/msbuild.fixture.json +16 -0
  369. package/node_modules/tokenjuice/dist/rules/fixtures/build/pnpm-build-failure.fixture.json +16 -0
  370. package/node_modules/tokenjuice/dist/rules/fixtures/build/pnpm-build.fixture.json +18 -0
  371. package/node_modules/tokenjuice/dist/rules/fixtures/build/swift-build.fixture.json +29 -0
  372. package/node_modules/tokenjuice/dist/rules/fixtures/build/tsc.fixture.json +15 -0
  373. package/node_modules/tokenjuice/dist/rules/fixtures/build/tsdown.fixture.json +15 -0
  374. package/node_modules/tokenjuice/dist/rules/fixtures/build/vite.fixture.json +15 -0
  375. package/node_modules/tokenjuice/dist/rules/fixtures/build/webpack.fixture.json +20 -0
  376. package/node_modules/tokenjuice/dist/rules/fixtures/build/xcodebuild.fixture.json +27 -0
  377. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/aws.fixture.json +16 -0
  378. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/az.fixture.json +16 -0
  379. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/flyctl.fixture.json +16 -0
  380. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/gcloud.fixture.json +16 -0
  381. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/gh.fixture.json +17 -0
  382. package/node_modules/tokenjuice/dist/rules/fixtures/cloud/vercel.fixture.json +16 -0
  383. package/node_modules/tokenjuice/dist/rules/fixtures/database/mongosh.fixture.json +16 -0
  384. package/node_modules/tokenjuice/dist/rules/fixtures/database/mysql.fixture.json +16 -0
  385. package/node_modules/tokenjuice/dist/rules/fixtures/database/psql.fixture.json +16 -0
  386. package/node_modules/tokenjuice/dist/rules/fixtures/database/redis-cli.fixture.json +16 -0
  387. package/node_modules/tokenjuice/dist/rules/fixtures/database/sqlite3.fixture.json +16 -0
  388. package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-build.fixture.json +16 -0
  389. package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-compose.fixture.json +16 -0
  390. package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-images.fixture.json +16 -0
  391. package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-logs.fixture.json +16 -0
  392. package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-ps.fixture.json +16 -0
  393. package/node_modules/tokenjuice/dist/rules/fixtures/devops/helm.fixture.json +16 -0
  394. package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-describe.fixture.json +16 -0
  395. package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-get.fixture.json +16 -0
  396. package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-logs.fixture.json +16 -0
  397. package/node_modules/tokenjuice/dist/rules/fixtures/devops/pulumi.fixture.json +16 -0
  398. package/node_modules/tokenjuice/dist/rules/fixtures/devops/terraform.fixture.json +16 -0
  399. package/node_modules/tokenjuice/dist/rules/fixtures/devops/terragrunt.fixture.json +16 -0
  400. package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/fd.fixture.json +16 -0
  401. package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/find.fixture.json +16 -0
  402. package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/git-ls-files.fixture.json +16 -0
  403. package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/ls.fixture.json +16 -0
  404. package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/rg-files.fixture.json +16 -0
  405. package/node_modules/tokenjuice/dist/rules/fixtures/generic/fallback.fixture.json +15 -0
  406. package/node_modules/tokenjuice/dist/rules/fixtures/generic/help.fixture.json +17 -0
  407. package/node_modules/tokenjuice/dist/rules/fixtures/git/branch.fixture.json +16 -0
  408. package/node_modules/tokenjuice/dist/rules/fixtures/git/diff-name-only.fixture.json +16 -0
  409. package/node_modules/tokenjuice/dist/rules/fixtures/git/diff-stat.fixture.json +16 -0
  410. package/node_modules/tokenjuice/dist/rules/fixtures/git/diff.fixture.json +26 -0
  411. package/node_modules/tokenjuice/dist/rules/fixtures/git/log-oneline.fixture.json +16 -0
  412. package/node_modules/tokenjuice/dist/rules/fixtures/git/remote-v.fixture.json +16 -0
  413. package/node_modules/tokenjuice/dist/rules/fixtures/git/show.fixture.json +16 -0
  414. package/node_modules/tokenjuice/dist/rules/fixtures/git/stash-list.fixture.json +16 -0
  415. package/node_modules/tokenjuice/dist/rules/fixtures/git/status.fixture.json +17 -0
  416. package/node_modules/tokenjuice/dist/rules/fixtures/git/worktree-list.fixture.json +17 -0
  417. package/node_modules/tokenjuice/dist/rules/fixtures/install/bun-install-up-to-date.fixture.json +19 -0
  418. package/node_modules/tokenjuice/dist/rules/fixtures/install/bun-install.fixture.json +16 -0
  419. package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-ci-up-to-date.fixture.json +19 -0
  420. package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-ci.fixture.json +16 -0
  421. package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-install-up-to-date.fixture.json +19 -0
  422. package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-install.fixture.json +16 -0
  423. package/node_modules/tokenjuice/dist/rules/fixtures/install/pnpm-install-up-to-date.fixture.json +19 -0
  424. package/node_modules/tokenjuice/dist/rules/fixtures/install/pnpm-install.fixture.json +16 -0
  425. package/node_modules/tokenjuice/dist/rules/fixtures/install/yarn-install-up-to-date.fixture.json +19 -0
  426. package/node_modules/tokenjuice/dist/rules/fixtures/install/yarn-install.fixture.json +16 -0
  427. package/node_modules/tokenjuice/dist/rules/fixtures/lint/biome.fixture.json +15 -0
  428. package/node_modules/tokenjuice/dist/rules/fixtures/lint/eslint.fixture.json +15 -0
  429. package/node_modules/tokenjuice/dist/rules/fixtures/lint/oxlint.fixture.json +15 -0
  430. package/node_modules/tokenjuice/dist/rules/fixtures/lint/prettier-check.fixture.json +15 -0
  431. package/node_modules/tokenjuice/dist/rules/fixtures/media/ffmpeg.fixture.json +16 -0
  432. package/node_modules/tokenjuice/dist/rules/fixtures/media/mediainfo.fixture.json +16 -0
  433. package/node_modules/tokenjuice/dist/rules/fixtures/network/curl.fixture.json +16 -0
  434. package/node_modules/tokenjuice/dist/rules/fixtures/network/dig.fixture.json +16 -0
  435. package/node_modules/tokenjuice/dist/rules/fixtures/network/nslookup.fixture.json +16 -0
  436. package/node_modules/tokenjuice/dist/rules/fixtures/network/ping.fixture.json +16 -0
  437. package/node_modules/tokenjuice/dist/rules/fixtures/network/ssh.fixture.json +16 -0
  438. package/node_modules/tokenjuice/dist/rules/fixtures/network/traceroute.fixture.json +16 -0
  439. package/node_modules/tokenjuice/dist/rules/fixtures/network/wget.fixture.json +16 -0
  440. package/node_modules/tokenjuice/dist/rules/fixtures/observability/free.fixture.json +16 -0
  441. package/node_modules/tokenjuice/dist/rules/fixtures/observability/htop.fixture.json +16 -0
  442. package/node_modules/tokenjuice/dist/rules/fixtures/observability/iostat.fixture.json +16 -0
  443. package/node_modules/tokenjuice/dist/rules/fixtures/observability/top.fixture.json +16 -0
  444. package/node_modules/tokenjuice/dist/rules/fixtures/observability/vmstat.fixture.json +16 -0
  445. package/node_modules/tokenjuice/dist/rules/fixtures/openclaw/sessions-history.fixture.json +33 -0
  446. package/node_modules/tokenjuice/dist/rules/fixtures/package/apt-install.fixture.json +16 -0
  447. package/node_modules/tokenjuice/dist/rules/fixtures/package/apt-upgrade.fixture.json +16 -0
  448. package/node_modules/tokenjuice/dist/rules/fixtures/package/brew-install.fixture.json +16 -0
  449. package/node_modules/tokenjuice/dist/rules/fixtures/package/brew-upgrade.fixture.json +16 -0
  450. package/node_modules/tokenjuice/dist/rules/fixtures/package/composer.fixture.json +16 -0
  451. package/node_modules/tokenjuice/dist/rules/fixtures/package/dnf-install.fixture.json +16 -0
  452. package/node_modules/tokenjuice/dist/rules/fixtures/package/fnm.fixture.json +16 -0
  453. package/node_modules/tokenjuice/dist/rules/fixtures/package/npm-ls.fixture.json +16 -0
  454. package/node_modules/tokenjuice/dist/rules/fixtures/package/yum-install.fixture.json +16 -0
  455. package/node_modules/tokenjuice/dist/rules/fixtures/search/git-grep.fixture.json +16 -0
  456. package/node_modules/tokenjuice/dist/rules/fixtures/search/grep.fixture.json +16 -0
  457. package/node_modules/tokenjuice/dist/rules/fixtures/search/rg.fixture.json +16 -0
  458. package/node_modules/tokenjuice/dist/rules/fixtures/service/journalctl.fixture.json +16 -0
  459. package/node_modules/tokenjuice/dist/rules/fixtures/service/launchctl.fixture.json +16 -0
  460. package/node_modules/tokenjuice/dist/rules/fixtures/service/lsof.fixture.json +16 -0
  461. package/node_modules/tokenjuice/dist/rules/fixtures/service/netstat.fixture.json +16 -0
  462. package/node_modules/tokenjuice/dist/rules/fixtures/service/pm2.fixture.json +16 -0
  463. package/node_modules/tokenjuice/dist/rules/fixtures/service/service.fixture.json +16 -0
  464. package/node_modules/tokenjuice/dist/rules/fixtures/service/ss.fixture.json +16 -0
  465. package/node_modules/tokenjuice/dist/rules/fixtures/service/systemctl-status.fixture.json +16 -0
  466. package/node_modules/tokenjuice/dist/rules/fixtures/system/df.fixture.json +16 -0
  467. package/node_modules/tokenjuice/dist/rules/fixtures/system/du.fixture.json +16 -0
  468. package/node_modules/tokenjuice/dist/rules/fixtures/system/file.fixture.json +16 -0
  469. package/node_modules/tokenjuice/dist/rules/fixtures/system/ps.fixture.json +16 -0
  470. package/node_modules/tokenjuice/dist/rules/fixtures/task/env.fixture.json +16 -0
  471. package/node_modules/tokenjuice/dist/rules/fixtures/task/just.fixture.json +16 -0
  472. package/node_modules/tokenjuice/dist/rules/fixtures/task/make.fixture.json +16 -0
  473. package/node_modules/tokenjuice/dist/rules/fixtures/task/mise.fixture.json +16 -0
  474. package/node_modules/tokenjuice/dist/rules/fixtures/task/node.fixture.json +16 -0
  475. package/node_modules/tokenjuice/dist/rules/fixtures/task/php.fixture.json +16 -0
  476. package/node_modules/tokenjuice/dist/rules/fixtures/task/python.fixture.json +16 -0
  477. package/node_modules/tokenjuice/dist/rules/fixtures/task/ruby.fixture.json +16 -0
  478. package/node_modules/tokenjuice/dist/rules/fixtures/task/uv.fixture.json +16 -0
  479. package/node_modules/tokenjuice/dist/rules/fixtures/tests/bun-test.fixture.json +16 -0
  480. package/node_modules/tokenjuice/dist/rules/fixtures/tests/cargo-test.fixture.json +16 -0
  481. package/node_modules/tokenjuice/dist/rules/fixtures/tests/go-test.fixture.json +16 -0
  482. package/node_modules/tokenjuice/dist/rules/fixtures/tests/jest.fixture.json +15 -0
  483. package/node_modules/tokenjuice/dist/rules/fixtures/tests/mocha.fixture.json +15 -0
  484. package/node_modules/tokenjuice/dist/rules/fixtures/tests/npm-test.fixture.json +16 -0
  485. package/node_modules/tokenjuice/dist/rules/fixtures/tests/playwright.fixture.json +15 -0
  486. package/node_modules/tokenjuice/dist/rules/fixtures/tests/pnpm-test.fixture.json +16 -0
  487. package/node_modules/tokenjuice/dist/rules/fixtures/tests/pytest.fixture.json +19 -0
  488. package/node_modules/tokenjuice/dist/rules/fixtures/tests/rspec.fixture.json +16 -0
  489. package/node_modules/tokenjuice/dist/rules/fixtures/tests/swift-test.fixture.json +30 -0
  490. package/node_modules/tokenjuice/dist/rules/fixtures/tests/vitest.fixture.json +15 -0
  491. package/node_modules/tokenjuice/dist/rules/fixtures/tests/yarn-test.fixture.json +16 -0
  492. package/node_modules/tokenjuice/dist/rules/fixtures/text/wc.fixture.json +16 -0
  493. package/node_modules/tokenjuice/dist/rules/fixtures/transfer/rsync.fixture.json +16 -0
  494. package/node_modules/tokenjuice/dist/rules/fixtures/transfer/scp.fixture.json +16 -0
  495. package/node_modules/tokenjuice/dist/rules/generic/fallback.json +32 -0
  496. package/node_modules/tokenjuice/dist/rules/generic/help.json +25 -0
  497. package/node_modules/tokenjuice/dist/rules/git/branch.json +29 -0
  498. package/node_modules/tokenjuice/dist/rules/git/diff-name-only.json +29 -0
  499. package/node_modules/tokenjuice/dist/rules/git/diff-stat.json +37 -0
  500. package/node_modules/tokenjuice/dist/rules/git/diff.json +65 -0
  501. package/node_modules/tokenjuice/dist/rules/git/log-oneline.json +30 -0
  502. package/node_modules/tokenjuice/dist/rules/git/remote-v.json +29 -0
  503. package/node_modules/tokenjuice/dist/rules/git/show.json +50 -0
  504. package/node_modules/tokenjuice/dist/rules/git/stash-list.json +30 -0
  505. package/node_modules/tokenjuice/dist/rules/git/status.json +54 -0
  506. package/node_modules/tokenjuice/dist/rules/git/worktree-list.json +31 -0
  507. package/node_modules/tokenjuice/dist/rules/install/bun-install.json +43 -0
  508. package/node_modules/tokenjuice/dist/rules/install/npm-ci.json +49 -0
  509. package/node_modules/tokenjuice/dist/rules/install/npm-install.json +49 -0
  510. package/node_modules/tokenjuice/dist/rules/install/pnpm-install.json +43 -0
  511. package/node_modules/tokenjuice/dist/rules/install/yarn-install.json +42 -0
  512. package/node_modules/tokenjuice/dist/rules/lint/biome.json +35 -0
  513. package/node_modules/tokenjuice/dist/rules/lint/eslint.json +45 -0
  514. package/node_modules/tokenjuice/dist/rules/lint/oxlint.json +35 -0
  515. package/node_modules/tokenjuice/dist/rules/lint/prettier-check.json +34 -0
  516. package/node_modules/tokenjuice/dist/rules/media/ffmpeg.json +30 -0
  517. package/node_modules/tokenjuice/dist/rules/media/mediainfo.json +30 -0
  518. package/node_modules/tokenjuice/dist/rules/network/curl.json +30 -0
  519. package/node_modules/tokenjuice/dist/rules/network/dig.json +30 -0
  520. package/node_modules/tokenjuice/dist/rules/network/nslookup.json +30 -0
  521. package/node_modules/tokenjuice/dist/rules/network/ping.json +35 -0
  522. package/node_modules/tokenjuice/dist/rules/network/ssh.json +30 -0
  523. package/node_modules/tokenjuice/dist/rules/network/traceroute.json +30 -0
  524. package/node_modules/tokenjuice/dist/rules/network/wget.json +30 -0
  525. package/node_modules/tokenjuice/dist/rules/observability/free.json +30 -0
  526. package/node_modules/tokenjuice/dist/rules/observability/htop.json +30 -0
  527. package/node_modules/tokenjuice/dist/rules/observability/iostat.json +30 -0
  528. package/node_modules/tokenjuice/dist/rules/observability/top.json +30 -0
  529. package/node_modules/tokenjuice/dist/rules/observability/vmstat.json +30 -0
  530. package/node_modules/tokenjuice/dist/rules/openclaw/sessions-history.json +59 -0
  531. package/node_modules/tokenjuice/dist/rules/package/apt-install.json +36 -0
  532. package/node_modules/tokenjuice/dist/rules/package/apt-upgrade.json +36 -0
  533. package/node_modules/tokenjuice/dist/rules/package/brew-install.json +31 -0
  534. package/node_modules/tokenjuice/dist/rules/package/brew-upgrade.json +31 -0
  535. package/node_modules/tokenjuice/dist/rules/package/composer.json +35 -0
  536. package/node_modules/tokenjuice/dist/rules/package/dnf-install.json +31 -0
  537. package/node_modules/tokenjuice/dist/rules/package/fnm.json +35 -0
  538. package/node_modules/tokenjuice/dist/rules/package/npm-ls.json +31 -0
  539. package/node_modules/tokenjuice/dist/rules/package/yum-install.json +31 -0
  540. package/node_modules/tokenjuice/dist/rules/search/git-grep.json +30 -0
  541. package/node_modules/tokenjuice/dist/rules/search/grep.json +38 -0
  542. package/node_modules/tokenjuice/dist/rules/search/rg.json +38 -0
  543. package/node_modules/tokenjuice/dist/rules/service/journalctl.json +42 -0
  544. package/node_modules/tokenjuice/dist/rules/service/launchctl.json +41 -0
  545. package/node_modules/tokenjuice/dist/rules/service/lsof.json +29 -0
  546. package/node_modules/tokenjuice/dist/rules/service/netstat.json +29 -0
  547. package/node_modules/tokenjuice/dist/rules/service/pm2.json +35 -0
  548. package/node_modules/tokenjuice/dist/rules/service/service.json +46 -0
  549. package/node_modules/tokenjuice/dist/rules/service/ss.json +29 -0
  550. package/node_modules/tokenjuice/dist/rules/service/systemctl-status.json +45 -0
  551. package/node_modules/tokenjuice/dist/rules/system/df.json +29 -0
  552. package/node_modules/tokenjuice/dist/rules/system/du.json +29 -0
  553. package/node_modules/tokenjuice/dist/rules/system/file.json +30 -0
  554. package/node_modules/tokenjuice/dist/rules/system/ps.json +29 -0
  555. package/node_modules/tokenjuice/dist/rules/task/env.json +31 -0
  556. package/node_modules/tokenjuice/dist/rules/task/just.json +30 -0
  557. package/node_modules/tokenjuice/dist/rules/task/make.json +30 -0
  558. package/node_modules/tokenjuice/dist/rules/task/mise.json +35 -0
  559. package/node_modules/tokenjuice/dist/rules/task/node.json +30 -0
  560. package/node_modules/tokenjuice/dist/rules/task/php.json +30 -0
  561. package/node_modules/tokenjuice/dist/rules/task/python.json +30 -0
  562. package/node_modules/tokenjuice/dist/rules/task/ruby.json +30 -0
  563. package/node_modules/tokenjuice/dist/rules/task/uv.json +35 -0
  564. package/node_modules/tokenjuice/dist/rules/tests/bun-test.json +56 -0
  565. package/node_modules/tokenjuice/dist/rules/tests/cargo-test.json +41 -0
  566. package/node_modules/tokenjuice/dist/rules/tests/go-test.json +49 -0
  567. package/node_modules/tokenjuice/dist/rules/tests/jest.json +41 -0
  568. package/node_modules/tokenjuice/dist/rules/tests/mocha.json +35 -0
  569. package/node_modules/tokenjuice/dist/rules/tests/npm-test.json +56 -0
  570. package/node_modules/tokenjuice/dist/rules/tests/playwright.json +37 -0
  571. package/node_modules/tokenjuice/dist/rules/tests/pnpm-test.json +56 -0
  572. package/node_modules/tokenjuice/dist/rules/tests/pytest.json +54 -0
  573. package/node_modules/tokenjuice/dist/rules/tests/rspec.json +31 -0
  574. package/node_modules/tokenjuice/dist/rules/tests/swift-test.json +66 -0
  575. package/node_modules/tokenjuice/dist/rules/tests/vitest.json +56 -0
  576. package/node_modules/tokenjuice/dist/rules/tests/yarn-test.json +56 -0
  577. package/node_modules/tokenjuice/dist/rules/text/wc.json +35 -0
  578. package/node_modules/tokenjuice/dist/rules/tokenjuice-rule.schema.json +155 -0
  579. package/node_modules/tokenjuice/dist/rules/transfer/rsync.json +30 -0
  580. package/node_modules/tokenjuice/dist/rules/transfer/scp.json +30 -0
  581. package/node_modules/tokenjuice/dist/types.d.ts +212 -0
  582. package/node_modules/tokenjuice/dist/types.js +1 -0
  583. package/node_modules/tokenjuice/package.json +80 -0
  584. package/npm-shrinkwrap.json +39 -0
  585. package/openclaw.plugin.json +16 -0
  586. package/package.json +55 -0
@@ -0,0 +1,416 @@
1
+ import { constants as fsConstants } from "node:fs";
2
+ import { access, mkdir, readFile, rename, rm } from "node:fs/promises";
3
+ import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
4
+ import { homedir } from "node:os";
5
+ import { stripLeadingCdPrefix } from "../../core/command.js";
6
+ import { extractHookCommandPaths, parseShellWords, shellQuote } from "../shared/hook-command.js";
7
+ import { ensureHooksDir, findStrayTokenjuiceHookFiles, isRecord, loadCopilotHooksConfigWithBackup, readCopilotHooksConfig, sanitizeCopilotHooksConfig, writeCopilotHooksConfigAtomic, } from "../shared/hooks-json-file.js";
8
+ const TOKENJUICE_VSCODE_COPILOT_FIX_COMMAND = "tokenjuice install vscode-copilot";
9
+ const TOKENJUICE_VSCODE_COPILOT_FILENAME = "tokenjuice-vscode.json";
10
+ const TOKENJUICE_VSCODE_COPILOT_LEGACY_FILENAME = "tokenjuice.json";
11
+ const TOKENJUICE_VSCODE_COPILOT_LEGACY_TOOL_NAME = "run_in_terminal";
12
+ const TOKENJUICE_VSCODE_COPILOT_TOOL_NAME = "runTerminalCommand";
13
+ const TOKENJUICE_VSCODE_COPILOT_MATCHER = `${TOKENJUICE_VSCODE_COPILOT_TOOL_NAME}|${TOKENJUICE_VSCODE_COPILOT_LEGACY_TOOL_NAME}`;
14
+ const TOKENJUICE_VSCODE_COPILOT_SUBCOMMAND = "vscode-copilot-pre-tool-use";
15
+ const TOKENJUICE_VSCODE_COPILOT_SOURCE = "vscode-copilot";
16
+ const TOKENJUICE_VSCODE_COPILOT_ADVISORY = "enable `chat.useHooks` in VS Code settings and trust the workspace; both are required for the hook to fire.";
17
+ const TOKENJUICE_VSCODE_COPILOT_INSTRUCTIONS_ADVISORY = "paste the snippet from `tokenjuice doctor vscode-copilot --print-instructions` into `.github/copilot-instructions.md` or `AGENTS.md` so the agent respects compacted output and knows when to prefix a command with `tokenjuice wrap --raw --`.";
18
+ const TOKENJUICE_VSCODE_COPILOT_INSTRUCTIONS_SNIPPET = `<!-- tokenjuice:vscode-copilot BEGIN -->
19
+ ## Terminal output compaction (tokenjuice)
20
+
21
+ Terminal commands in this workspace are routed through tokenjuice, which
22
+ deterministically compacts noisy output (long file listings, install logs,
23
+ build transcripts, etc.) before returning it to you.
24
+
25
+ - Output ending with a \`[tokenjuice] ...\` footer is the **complete,
26
+ authoritative result** for that command. The omitted content is not
27
+ retrievable by re-running the command, varying flags, or switching tools.
28
+ Proceed with the task using the compacted output.
29
+ - If a specific command genuinely requires raw, uncompacted bytes (e.g.,
30
+ reading exact file contents for a diff, inspecting a log line-by-line),
31
+ prefix that single command with \`tokenjuice wrap --raw --\`:
32
+
33
+ tokenjuice wrap --raw -- cat path/to/file
34
+ tokenjuice wrap --raw -- git log --oneline -n 50
35
+
36
+ Use sparingly; do not use this to route around compaction for routine
37
+ listings or searches.
38
+ <!-- tokenjuice:vscode-copilot END -->
39
+ `;
40
+ export function getVscodeCopilotInstructionsSnippet() {
41
+ return TOKENJUICE_VSCODE_COPILOT_INSTRUCTIONS_SNIPPET;
42
+ }
43
+ // VS Code Copilot Chat resolves the hooks dir via pathService.userHome() and
44
+ // does NOT honor COPILOT_HOME. Only HOME matters here; COPILOT_HOME is a
45
+ // Copilot-CLI-only concern and is intentionally ignored by this adapter.
46
+ function getVscodeCopilotHooksDir() {
47
+ return join(homedir(), ".copilot", "hooks");
48
+ }
49
+ function getDefaultHooksPath() {
50
+ return join(getVscodeCopilotHooksDir(), TOKENJUICE_VSCODE_COPILOT_FILENAME);
51
+ }
52
+ async function isExecutableFile(path) {
53
+ try {
54
+ await access(path, fsConstants.X_OK);
55
+ return true;
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
61
+ async function pathExists(path) {
62
+ try {
63
+ await access(path);
64
+ return true;
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }
70
+ async function resolveInstalledTokenjuicePath() {
71
+ const pathValue = process.env.PATH;
72
+ if (!pathValue) {
73
+ return undefined;
74
+ }
75
+ const candidateNames = process.platform === "win32"
76
+ ? ["tokenjuice.exe", "tokenjuice.cmd", "tokenjuice.bat", "tokenjuice"]
77
+ : ["tokenjuice"];
78
+ for (const segment of pathValue.split(delimiter)) {
79
+ if (!segment) {
80
+ continue;
81
+ }
82
+ for (const candidateName of candidateNames) {
83
+ const candidatePath = join(segment, candidateName);
84
+ if (await isExecutableFile(candidatePath)) {
85
+ return candidatePath;
86
+ }
87
+ }
88
+ }
89
+ return undefined;
90
+ }
91
+ async function buildVscodeCopilotHookCommand(options = {}) {
92
+ const rawBinaryPath = options.binaryPath ?? process.argv[1];
93
+ const binaryPath = rawBinaryPath && !isAbsolute(rawBinaryPath) ? resolve(rawBinaryPath) : rawBinaryPath;
94
+ const nodePath = options.nodePath ?? process.execPath;
95
+ if (!binaryPath) {
96
+ throw new Error("unable to resolve tokenjuice binary path for vscode-copilot install");
97
+ }
98
+ let launcher = binaryPath;
99
+ if (!options.local) {
100
+ const installedBinaryPath = await resolveInstalledTokenjuicePath();
101
+ launcher = installedBinaryPath ?? binaryPath;
102
+ }
103
+ const launcherCommand = launcher.endsWith(".js")
104
+ ? `${shellQuote(nodePath)} ${shellQuote(launcher)}`
105
+ : shellQuote(launcher);
106
+ return `${launcherCommand} ${TOKENJUICE_VSCODE_COPILOT_SUBCOMMAND} --wrap-launcher ${shellQuote(launcher)}`;
107
+ }
108
+ function getVscodeCopilotFixCommand(local = false) {
109
+ return local
110
+ ? `${TOKENJUICE_VSCODE_COPILOT_FIX_COMMAND} --local`
111
+ : TOKENJUICE_VSCODE_COPILOT_FIX_COMMAND;
112
+ }
113
+ function isTokenjuiceVscodeCopilotHook(rawHook) {
114
+ if (!isRecord(rawHook) || typeof rawHook.command !== "string") {
115
+ return false;
116
+ }
117
+ return rawHook.command.includes(TOKENJUICE_VSCODE_COPILOT_SUBCOMMAND);
118
+ }
119
+ function createTokenjuiceVscodeCopilotHook(command) {
120
+ return {
121
+ type: "command",
122
+ matcher: TOKENJUICE_VSCODE_COPILOT_MATCHER,
123
+ command,
124
+ };
125
+ }
126
+ function getPreToolUseHooks(config) {
127
+ const current = Array.isArray(config.hooks.PreToolUse) ? config.hooks.PreToolUse : [];
128
+ const legacy = Array.isArray(config.hooks.preToolUse) ? config.hooks.preToolUse : [];
129
+ return [...current, ...legacy];
130
+ }
131
+ function findTokenjuiceVscodeCopilotHookCommand(config) {
132
+ for (const hook of getPreToolUseHooks(config)) {
133
+ if (isTokenjuiceVscodeCopilotHook(hook) && isRecord(hook) && typeof hook.command === "string") {
134
+ return hook.command;
135
+ }
136
+ }
137
+ return undefined;
138
+ }
139
+ async function migrateLegacyInstall(hooksDir, hooksPath) {
140
+ const legacyPath = join(hooksDir, TOKENJUICE_VSCODE_COPILOT_LEGACY_FILENAME);
141
+ if (legacyPath === hooksPath) {
142
+ return undefined;
143
+ }
144
+ if (!(await pathExists(legacyPath))) {
145
+ return undefined;
146
+ }
147
+ if (await pathExists(hooksPath)) {
148
+ return undefined;
149
+ }
150
+ try {
151
+ const rawText = await readFile(legacyPath, "utf8");
152
+ const parsed = JSON.parse(rawText);
153
+ const config = sanitizeCopilotHooksConfig(parsed);
154
+ if (!findTokenjuiceVscodeCopilotHookCommand(config)) {
155
+ return undefined;
156
+ }
157
+ }
158
+ catch {
159
+ return undefined;
160
+ }
161
+ await mkdir(hooksDir, { recursive: true });
162
+ await rename(legacyPath, hooksPath);
163
+ return legacyPath;
164
+ }
165
+ export async function installVscodeCopilotHook(hooksPath = getDefaultHooksPath(), options = {}) {
166
+ const hooksDir = dirname(hooksPath);
167
+ const migratedFromPath = await migrateLegacyInstall(hooksDir, hooksPath);
168
+ const { config, backupPath } = await loadCopilotHooksConfigWithBackup(hooksPath, "vscode-copilot");
169
+ const command = await buildVscodeCopilotHookCommand(options);
170
+ const currentPreToolUse = Array.isArray(config.hooks.PreToolUse) ? config.hooks.PreToolUse : [];
171
+ const legacyPreToolUse = Array.isArray(config.hooks.preToolUse) ? config.hooks.preToolUse : [];
172
+ const retainedCurrent = currentPreToolUse.filter((hook) => !isTokenjuiceVscodeCopilotHook(hook));
173
+ const retainedLegacy = legacyPreToolUse.filter((hook) => !isTokenjuiceVscodeCopilotHook(hook));
174
+ config.hooks.PreToolUse = [...retainedCurrent, createTokenjuiceVscodeCopilotHook(command)];
175
+ if (retainedLegacy.length > 0) {
176
+ config.hooks.preToolUse = retainedLegacy;
177
+ }
178
+ else {
179
+ delete config.hooks.preToolUse;
180
+ }
181
+ if (typeof config.version !== "number") {
182
+ config.version = 1;
183
+ }
184
+ await ensureHooksDir(hooksDir);
185
+ await writeCopilotHooksConfigAtomic(hooksPath, config);
186
+ return {
187
+ hooksPath,
188
+ ...(backupPath ? { backupPath } : {}),
189
+ ...(migratedFromPath ? { migratedFromPath } : {}),
190
+ command,
191
+ };
192
+ }
193
+ export async function uninstallVscodeCopilotHook(hooksPath = getDefaultHooksPath()) {
194
+ const { config, exists } = await readCopilotHooksConfig(hooksPath, "vscode-copilot");
195
+ if (!exists) {
196
+ return { hooksPath, removed: 0, deletedFile: false };
197
+ }
198
+ const currentPreToolUse = Array.isArray(config.hooks.PreToolUse) ? config.hooks.PreToolUse : [];
199
+ const legacyPreToolUse = Array.isArray(config.hooks.preToolUse) ? config.hooks.preToolUse : [];
200
+ const retainedCurrent = currentPreToolUse.filter((hook) => !isTokenjuiceVscodeCopilotHook(hook));
201
+ const retainedLegacy = legacyPreToolUse.filter((hook) => !isTokenjuiceVscodeCopilotHook(hook));
202
+ const removed = currentPreToolUse.length + legacyPreToolUse.length - retainedCurrent.length - retainedLegacy.length;
203
+ if (removed === 0) {
204
+ return { hooksPath, removed: 0, deletedFile: false };
205
+ }
206
+ if (retainedCurrent.length === 0) {
207
+ delete config.hooks.PreToolUse;
208
+ }
209
+ else {
210
+ config.hooks.PreToolUse = retainedCurrent;
211
+ }
212
+ if (retainedLegacy.length === 0) {
213
+ delete config.hooks.preToolUse;
214
+ }
215
+ else {
216
+ config.hooks.preToolUse = retainedLegacy;
217
+ }
218
+ // If the file has no remaining meaningful content (no hook events, no other
219
+ // top-level keys), remove it entirely rather than leave an empty shell.
220
+ const fileIsEmpty = Object.keys(config.hooks).length === 0
221
+ && Object.keys(config).filter((key) => key !== "hooks" && key !== "version").length === 0;
222
+ if (fileIsEmpty) {
223
+ await rm(hooksPath, { force: true });
224
+ return { hooksPath, removed, deletedFile: true };
225
+ }
226
+ await writeCopilotHooksConfigAtomic(hooksPath, config);
227
+ return { hooksPath, removed, deletedFile: false };
228
+ }
229
+ async function findStrayVscodeCopilotHookFiles(hooksDir, canonicalPath) {
230
+ return findStrayTokenjuiceHookFiles(hooksDir, canonicalPath, (command) => command.includes(TOKENJUICE_VSCODE_COPILOT_SUBCOMMAND));
231
+ }
232
+ export async function doctorVscodeCopilotHook(hooksPath = getDefaultHooksPath(), options = {}) {
233
+ const expectedCommand = await buildVscodeCopilotHookCommand(options);
234
+ const fixCommand = getVscodeCopilotFixCommand(options.local);
235
+ const advisories = [
236
+ TOKENJUICE_VSCODE_COPILOT_ADVISORY,
237
+ TOKENJUICE_VSCODE_COPILOT_INSTRUCTIONS_ADVISORY,
238
+ ];
239
+ const { config, exists } = await readCopilotHooksConfig(hooksPath, "vscode-copilot");
240
+ if (!exists) {
241
+ return {
242
+ hooksPath,
243
+ status: "disabled",
244
+ issues: [],
245
+ advisories,
246
+ fixCommand,
247
+ expectedCommand,
248
+ checkedPaths: [],
249
+ missingPaths: [],
250
+ };
251
+ }
252
+ if (config.disableAllHooks === true) {
253
+ const detectedCommand = findTokenjuiceVscodeCopilotHookCommand(config);
254
+ return {
255
+ hooksPath,
256
+ status: "disabled",
257
+ issues: ["vscode-copilot hook file sets disableAllHooks: true"],
258
+ advisories,
259
+ fixCommand,
260
+ expectedCommand,
261
+ ...(detectedCommand ? { detectedCommand } : {}),
262
+ checkedPaths: [],
263
+ missingPaths: [],
264
+ };
265
+ }
266
+ const detectedCommand = findTokenjuiceVscodeCopilotHookCommand(config);
267
+ if (!detectedCommand) {
268
+ return {
269
+ hooksPath,
270
+ status: "disabled",
271
+ issues: [],
272
+ advisories,
273
+ fixCommand,
274
+ expectedCommand,
275
+ checkedPaths: [],
276
+ missingPaths: [],
277
+ };
278
+ }
279
+ const strayFiles = await findStrayVscodeCopilotHookFiles(dirname(hooksPath), hooksPath);
280
+ const checkedPaths = extractHookCommandPaths(detectedCommand);
281
+ const missingPaths = [];
282
+ for (const path of checkedPaths) {
283
+ if (!(await isExecutableFile(path)) && !(path.endsWith(".js") && await pathExists(path))) {
284
+ missingPaths.push(path);
285
+ }
286
+ }
287
+ const issues = [];
288
+ if (detectedCommand !== expectedCommand) {
289
+ if (detectedCommand.includes("/Cellar/")) {
290
+ issues.push("configured vscode-copilot hook is pinned to a versioned Homebrew Cellar path");
291
+ }
292
+ else {
293
+ issues.push("configured vscode-copilot hook command does not match the current recommended command");
294
+ }
295
+ }
296
+ if (missingPaths.length > 0) {
297
+ issues.push(`configured vscode-copilot hook points at missing path${missingPaths.length === 1 ? "" : "s"}`);
298
+ }
299
+ for (const stray of strayFiles) {
300
+ issues.push(`stray tokenjuice entry in sibling hook file: ${stray}`);
301
+ }
302
+ return {
303
+ hooksPath,
304
+ status: missingPaths.length > 0 ? "broken" : issues.length > 0 ? "warn" : "ok",
305
+ issues,
306
+ advisories,
307
+ fixCommand,
308
+ expectedCommand,
309
+ detectedCommand,
310
+ checkedPaths,
311
+ missingPaths,
312
+ };
313
+ }
314
+ function commandRequestsTokenjuiceRawBypass(command) {
315
+ const argv = parseShellWords(stripLeadingCdPrefix(command));
316
+ if (argv.length < 2) {
317
+ return false;
318
+ }
319
+ let wrapIndex = -1;
320
+ const first = argv[0];
321
+ const second = argv[1];
322
+ if (first === "tokenjuice") {
323
+ wrapIndex = 1;
324
+ }
325
+ else if (typeof first === "string"
326
+ && /(?:^|[\\/])node(?:\.exe)?$/iu.test(first)
327
+ && typeof second === "string"
328
+ && second.endsWith(".js")
329
+ && argv.slice(2).includes("wrap")) {
330
+ wrapIndex = 2;
331
+ }
332
+ if (wrapIndex === -1 || argv[wrapIndex] !== "wrap") {
333
+ return false;
334
+ }
335
+ const optionEndIndex = argv.indexOf("--", wrapIndex + 1);
336
+ const optionArgs = argv.slice(wrapIndex + 1, optionEndIndex === -1 ? undefined : optionEndIndex);
337
+ return optionArgs.includes("--raw") || optionArgs.includes("--full");
338
+ }
339
+ function commandAlreadyWrapped(command) {
340
+ const argv = parseShellWords(stripLeadingCdPrefix(command));
341
+ if (argv.length < 2) {
342
+ return false;
343
+ }
344
+ if (argv[0] === "tokenjuice" && argv[1] === "wrap") {
345
+ return true;
346
+ }
347
+ const first = argv[0];
348
+ const second = argv[1];
349
+ if (typeof first === "string"
350
+ && /(?:^|[\\/])node(?:\.exe)?$/iu.test(first)
351
+ && typeof second === "string"
352
+ && second.endsWith(".js")
353
+ && argv.slice(2).includes("wrap")) {
354
+ return true;
355
+ }
356
+ return false;
357
+ }
358
+ function resolveWrapperShell() {
359
+ if (process.platform === "win32") {
360
+ return { path: "powershell", flag: "-Command", platform: "win32" };
361
+ }
362
+ const shell = process.env.SHELL && process.env.SHELL.trim() ? process.env.SHELL : "sh";
363
+ return { path: shell, flag: "-lc", platform: "posix" };
364
+ }
365
+ function readPayloadField(payload, snakeKey, camelKey) {
366
+ return payload[snakeKey] ?? payload[camelKey];
367
+ }
368
+ function isTerminalToolName(value) {
369
+ return value === TOKENJUICE_VSCODE_COPILOT_TOOL_NAME || value === TOKENJUICE_VSCODE_COPILOT_LEGACY_TOOL_NAME;
370
+ }
371
+ export async function runVscodeCopilotPreToolUseHook(rawText, wrapLauncher = "tokenjuice") {
372
+ let payload;
373
+ try {
374
+ payload = JSON.parse(rawText);
375
+ }
376
+ catch {
377
+ process.stdout.write("{}\n");
378
+ return 0;
379
+ }
380
+ const toolInputValue = readPayloadField(payload, "tool_input", "toolInput");
381
+ if (!isTerminalToolName(readPayloadField(payload, "tool_name", "toolName")) || !isRecord(toolInputValue)) {
382
+ process.stdout.write("{}\n");
383
+ return 0;
384
+ }
385
+ const toolInput = toolInputValue;
386
+ const command = typeof toolInput.command === "string" ? toolInput.command : undefined;
387
+ if (!command || !command.trim()) {
388
+ process.stdout.write("{}\n");
389
+ return 0;
390
+ }
391
+ if (commandAlreadyWrapped(command)) {
392
+ process.stdout.write("{}\n");
393
+ return 0;
394
+ }
395
+ if (commandRequestsTokenjuiceRawBypass(command)) {
396
+ process.stdout.write("{}\n");
397
+ return 0;
398
+ }
399
+ const shell = resolveWrapperShell();
400
+ const launcherCommand = wrapLauncher.endsWith(".js")
401
+ ? `${shellQuote(process.execPath)} ${shellQuote(wrapLauncher)}`
402
+ : shellQuote(wrapLauncher);
403
+ const wrappedCommand = `${launcherCommand} wrap --source ${TOKENJUICE_VSCODE_COPILOT_SOURCE} -- ${shellQuote(shell.path)} ${shell.flag} ${shellQuote(command)}`;
404
+ const updatedInput = {
405
+ ...toolInput,
406
+ command: wrappedCommand,
407
+ };
408
+ const response = {
409
+ hookSpecificOutput: {
410
+ hookEventName: "PreToolUse",
411
+ updatedInput,
412
+ },
413
+ };
414
+ process.stdout.write(`${JSON.stringify(response)}\n`);
415
+ return 0;
416
+ }
@@ -0,0 +1,23 @@
1
+ export type WarpInstructionsOptions = {
2
+ projectDir?: string;
3
+ };
4
+ export type InstallWarpInstructionsResult = {
5
+ instructionsPath: string;
6
+ backupPath?: string;
7
+ };
8
+ export type UninstallWarpInstructionsResult = {
9
+ instructionsPath: string;
10
+ removed: boolean;
11
+ };
12
+ export type WarpDoctorReport = {
13
+ instructionsPath: string;
14
+ status: "ok" | "warn" | "broken" | "disabled";
15
+ issues: string[];
16
+ advisories: string[];
17
+ fixCommand: string;
18
+ checkedPaths: string[];
19
+ missingPaths: string[];
20
+ };
21
+ export declare function installWarpInstructions(instructionsPath?: string, options?: WarpInstructionsOptions): Promise<InstallWarpInstructionsResult>;
22
+ export declare function uninstallWarpInstructions(instructionsPath?: string, options?: WarpInstructionsOptions): Promise<UninstallWarpInstructionsResult>;
23
+ export declare function doctorWarpInstructions(instructionsPath?: string, options?: WarpInstructionsOptions): Promise<WarpDoctorReport>;
@@ -0,0 +1,181 @@
1
+ import { stat } from "node:fs/promises";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { collectMarkerDelimitedBlockIssues, inspectMarkerDelimitedBlock, installMarkerDelimitedBlock, uninstallMarkerDelimitedBlock, } from "../shared/marker-instructions.js";
4
+ import { buildTokenjuiceGuidanceBullets, TOKENJUICE_FULL_COMMAND, TOKENJUICE_RAW_COMMAND, TOKENJUICE_WRAP_COMMAND, } from "../shared/instruction-guidance.js";
5
+ import { buildInstructionDoctorReportFields, instructionDoctorStatusFromIssues, } from "../shared/instruction-doctor.js";
6
+ import { collectGuidanceIssues, readInstructionFile } from "../shared/instruction-file.js";
7
+ const TOKENJUICE_WARP_FIX_COMMAND = "tokenjuice install warp";
8
+ const TOKENJUICE_WARP_BEGIN = "<!-- tokenjuice:warp begin -->";
9
+ const TOKENJUICE_WARP_END = "<!-- tokenjuice:warp end -->";
10
+ const TOKENJUICE_WARP_ADVISORY = "Warp support is beta and instruction-based; Warp loads AGENTS.md project rules, with WARP.md taking priority when it exists, but still owns command execution.";
11
+ function getExplicitProjectDir(options = {}) {
12
+ return options.projectDir || process.env.WARP_PROJECT_DIR;
13
+ }
14
+ async function pathExists(path) {
15
+ try {
16
+ await stat(path);
17
+ return true;
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ async function hasGitMetadata(dir) {
24
+ return await pathExists(join(dir, ".git"));
25
+ }
26
+ async function findGitRoot(startDir) {
27
+ let current = resolve(startDir);
28
+ while (true) {
29
+ if (await hasGitMetadata(current)) {
30
+ return current;
31
+ }
32
+ const parent = dirname(current);
33
+ if (parent === current) {
34
+ return undefined;
35
+ }
36
+ current = parent;
37
+ }
38
+ }
39
+ async function resolveProjectDir(options = {}) {
40
+ const explicitProjectDir = getExplicitProjectDir(options);
41
+ if (explicitProjectDir) {
42
+ return resolve(explicitProjectDir);
43
+ }
44
+ return (await findGitRoot(process.cwd())) ?? process.cwd();
45
+ }
46
+ async function getDefaultInstructionsPath(options = {}) {
47
+ const projectDir = await resolveProjectDir(options);
48
+ const existingInstructionsPath = await findExistingTokenjuiceInstructionsPath(projectDir);
49
+ if (existingInstructionsPath) {
50
+ return existingInstructionsPath;
51
+ }
52
+ const warpPath = join(projectDir, "WARP.md");
53
+ if (await pathExists(warpPath)) {
54
+ return warpPath;
55
+ }
56
+ return join(projectDir, "AGENTS.md");
57
+ }
58
+ const TOKENJUICE_WARP_BLOCK = [
59
+ TOKENJUICE_WARP_BEGIN,
60
+ "## tokenjuice terminal output compaction",
61
+ "",
62
+ ...buildTokenjuiceGuidanceBullets({
63
+ wrapBullet: "- When running terminal commands through Warp, prefer `tokenjuice wrap -- <command>` for commands likely to produce long output.",
64
+ }),
65
+ TOKENJUICE_WARP_END,
66
+ ].join("\n");
67
+ const TOKENJUICE_WARP_BLOCK_CONFIG = {
68
+ beginMarker: TOKENJUICE_WARP_BEGIN,
69
+ endMarker: TOKENJUICE_WARP_END,
70
+ block: TOKENJUICE_WARP_BLOCK,
71
+ };
72
+ function getTokenjuiceBlockText(text) {
73
+ const beginIndex = text.indexOf(TOKENJUICE_WARP_BEGIN);
74
+ if (beginIndex === -1) {
75
+ return "";
76
+ }
77
+ const endIndex = text.indexOf(TOKENJUICE_WARP_END, beginIndex + TOKENJUICE_WARP_BEGIN.length);
78
+ if (endIndex === -1) {
79
+ return text.slice(beginIndex);
80
+ }
81
+ return text.slice(beginIndex, endIndex + TOKENJUICE_WARP_END.length);
82
+ }
83
+ function countMarker(text, marker) {
84
+ return text.split(marker).length - 1;
85
+ }
86
+ function hasMalformedMarkerStructure(text, completeBlockCount) {
87
+ const beginCount = countMarker(text, TOKENJUICE_WARP_BEGIN);
88
+ const endCount = countMarker(text, TOKENJUICE_WARP_END);
89
+ return beginCount !== endCount || beginCount !== completeBlockCount || endCount !== completeBlockCount;
90
+ }
91
+ function hasTokenjuiceWarpMarker(text) {
92
+ return text.includes(TOKENJUICE_WARP_BEGIN) || text.includes(TOKENJUICE_WARP_END);
93
+ }
94
+ async function findExistingTokenjuiceInstructionsPath(projectDir) {
95
+ const warpPath = join(projectDir, "WARP.md");
96
+ const agentsPath = join(projectDir, "AGENTS.md");
97
+ for (const candidatePath of [warpPath, agentsPath]) {
98
+ const existing = await readInstructionFile(candidatePath);
99
+ if (existing.exists && hasTokenjuiceWarpMarker(existing.text)) {
100
+ return candidatePath;
101
+ }
102
+ }
103
+ return undefined;
104
+ }
105
+ export async function installWarpInstructions(instructionsPath, options = {}) {
106
+ const resolvedInstructionsPath = instructionsPath ?? (await getDefaultInstructionsPath(options));
107
+ const existing = await readInstructionFile(resolvedInstructionsPath);
108
+ const markerState = inspectMarkerDelimitedBlock(existing.text, TOKENJUICE_WARP_BLOCK_CONFIG);
109
+ if (existing.exists && hasMalformedMarkerStructure(existing.text, markerState.completeBlockCount)) {
110
+ throw new Error(`cannot safely repair malformed tokenjuice markers in ${resolvedInstructionsPath}; remove the dangling marker manually, then rerun tokenjuice install warp`);
111
+ }
112
+ const result = await installMarkerDelimitedBlock(resolvedInstructionsPath, TOKENJUICE_WARP_BLOCK_CONFIG);
113
+ return {
114
+ instructionsPath: result.filePath,
115
+ ...(result.backupPath ? { backupPath: result.backupPath } : {}),
116
+ };
117
+ }
118
+ export async function uninstallWarpInstructions(instructionsPath, options = {}) {
119
+ const resolvedInstructionsPath = instructionsPath ?? (await getDefaultInstructionsPath(options));
120
+ const existing = await readInstructionFile(resolvedInstructionsPath);
121
+ const markerState = inspectMarkerDelimitedBlock(existing.text, TOKENJUICE_WARP_BLOCK_CONFIG);
122
+ if (existing.exists && hasMalformedMarkerStructure(existing.text, markerState.completeBlockCount)) {
123
+ throw new Error(`cannot safely uninstall malformed tokenjuice markers in ${resolvedInstructionsPath}; remove the dangling marker manually, then rerun tokenjuice uninstall warp`);
124
+ }
125
+ const result = await uninstallMarkerDelimitedBlock(resolvedInstructionsPath, TOKENJUICE_WARP_BLOCK_CONFIG);
126
+ return { instructionsPath: result.filePath, removed: result.removed };
127
+ }
128
+ export async function doctorWarpInstructions(instructionsPath, options = {}) {
129
+ const resolvedInstructionsPath = instructionsPath ?? (await getDefaultInstructionsPath(options));
130
+ const existing = await readInstructionFile(resolvedInstructionsPath);
131
+ const markerState = inspectMarkerDelimitedBlock(existing.text, TOKENJUICE_WARP_BLOCK_CONFIG);
132
+ if (!existing.exists || (!markerState.hasBegin && !markerState.hasEnd)) {
133
+ return {
134
+ instructionsPath: resolvedInstructionsPath,
135
+ ...buildInstructionDoctorReportFields({
136
+ status: "disabled",
137
+ issues: ["tokenjuice Warp instructions are not installed"],
138
+ advisory: TOKENJUICE_WARP_ADVISORY,
139
+ fixCommand: TOKENJUICE_WARP_FIX_COMMAND,
140
+ }),
141
+ };
142
+ }
143
+ const markerIssues = collectMarkerDelimitedBlockIssues(markerState, {
144
+ configuredLabel: "Warp instructions",
145
+ repairCommand: TOKENJUICE_WARP_FIX_COMMAND,
146
+ });
147
+ const hasMalformedMarkers = hasMalformedMarkerStructure(existing.text, markerState.completeBlockCount);
148
+ const issues = [
149
+ ...markerIssues,
150
+ ...(hasMalformedMarkers ? ["configured Warp instructions have malformed tokenjuice markers"] : []),
151
+ ...collectGuidanceIssues(getTokenjuiceBlockText(existing.text), {
152
+ required: [
153
+ {
154
+ requiredText: TOKENJUICE_WRAP_COMMAND,
155
+ missingIssue: "configured Warp instructions are missing tokenjuice wrap guidance",
156
+ },
157
+ {
158
+ requiredText: TOKENJUICE_RAW_COMMAND,
159
+ missingIssue: "configured Warp instructions are missing the raw escape hatch",
160
+ },
161
+ ],
162
+ forbidden: [
163
+ {
164
+ forbiddenText: TOKENJUICE_FULL_COMMAND,
165
+ presentIssue: "configured Warp instructions still suggest the full escape hatch",
166
+ },
167
+ ],
168
+ }),
169
+ ];
170
+ return {
171
+ instructionsPath: resolvedInstructionsPath,
172
+ ...buildInstructionDoctorReportFields({
173
+ status: instructionDoctorStatusFromIssues(issues),
174
+ issues,
175
+ advisory: TOKENJUICE_WARP_ADVISORY,
176
+ fixCommand: hasMalformedMarkers
177
+ ? "remove unmatched tokenjuice markers from AGENTS.md or WARP.md, then run tokenjuice install warp"
178
+ : TOKENJUICE_WARP_FIX_COMMAND,
179
+ }),
180
+ };
181
+ }
@@ -0,0 +1,23 @@
1
+ export type WindsurfRuleOptions = {
2
+ projectDir?: string;
3
+ };
4
+ export type InstallWindsurfRuleResult = {
5
+ rulePath: string;
6
+ backupPath?: string;
7
+ };
8
+ export type UninstallWindsurfRuleResult = {
9
+ rulePath: string;
10
+ removed: boolean;
11
+ };
12
+ export type WindsurfDoctorReport = {
13
+ rulePath: string;
14
+ status: "ok" | "warn" | "broken" | "disabled";
15
+ issues: string[];
16
+ advisories: string[];
17
+ fixCommand: string;
18
+ checkedPaths: string[];
19
+ missingPaths: string[];
20
+ };
21
+ export declare function installWindsurfRule(rulePath?: string, options?: WindsurfRuleOptions): Promise<InstallWindsurfRuleResult>;
22
+ export declare function uninstallWindsurfRule(rulePath?: string, options?: WindsurfRuleOptions): Promise<UninstallWindsurfRuleResult>;
23
+ export declare function doctorWindsurfRule(rulePath?: string, options?: WindsurfRuleOptions): Promise<WindsurfDoctorReport>;