@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,201 @@
1
+ import { basename } from "node:path";
2
+ import { deriveCommandMatchCandidates, getSourcePriority } from "./command-match.js";
3
+ import { stripLeadingCdPrefix, tokenizeCommand } from "./command-shell.js";
4
+ const FILE_CONTENT_INSPECTION_COMMANDS = new Set(["cat", "sed", "head", "tail", "nl", "bat", "batcat", "jq", "yq"]);
5
+ const REPO_INVENTORY_COMMANDS = new Set(["find", "fd", "fdfind", "ls", "tree"]);
6
+ function getNormalizedArgv(input) {
7
+ if (input.argv?.length) {
8
+ return input.argv;
9
+ }
10
+ if (!input.command) {
11
+ return [];
12
+ }
13
+ return tokenizeCommand(input.command);
14
+ }
15
+ export function getCommandName(argv) {
16
+ const first = argv[0];
17
+ if (!first) {
18
+ return null;
19
+ }
20
+ return basename(first.replace(/^["']|["']$/gu, ""));
21
+ }
22
+ function gitGlobalOptionTakesValue(option) {
23
+ return option === "-C"
24
+ || option === "-c"
25
+ || option === "--git-dir"
26
+ || option === "--work-tree"
27
+ || option === "--namespace"
28
+ || option === "--exec-path"
29
+ || option === "--super-prefix"
30
+ || option === "--config-env";
31
+ }
32
+ function isGitGlobalOptionWithInlineValue(option) {
33
+ return option.startsWith("--git-dir=")
34
+ || option.startsWith("--work-tree=")
35
+ || option.startsWith("--namespace=")
36
+ || option.startsWith("--exec-path=")
37
+ || option.startsWith("--super-prefix=")
38
+ || option.startsWith("--config-env=");
39
+ }
40
+ export function getGitSubcommand(argv) {
41
+ const index = getGitSubcommandIndex(argv);
42
+ return index === null ? null : argv[index] ?? null;
43
+ }
44
+ function getGitSubcommandIndex(argv) {
45
+ if (getCommandName(argv) !== "git") {
46
+ return null;
47
+ }
48
+ for (let index = 1; index < argv.length; index += 1) {
49
+ const arg = argv[index];
50
+ if (!arg) {
51
+ continue;
52
+ }
53
+ if (gitGlobalOptionTakesValue(arg)) {
54
+ index += 1;
55
+ continue;
56
+ }
57
+ if (isGitGlobalOptionWithInlineValue(arg)) {
58
+ continue;
59
+ }
60
+ if (arg.startsWith("-")) {
61
+ continue;
62
+ }
63
+ return index;
64
+ }
65
+ return null;
66
+ }
67
+ function isGitBlobSpecifier(arg) {
68
+ return /^[^:]+:.+/u.test(arg);
69
+ }
70
+ function isGitShowFileContentArgv(argv) {
71
+ const subcommandIndex = getGitSubcommandIndex(argv);
72
+ if (subcommandIndex === null || argv[subcommandIndex] !== "show") {
73
+ return false;
74
+ }
75
+ for (let index = subcommandIndex + 1; index < argv.length; index += 1) {
76
+ const arg = argv[index];
77
+ if (!arg) {
78
+ continue;
79
+ }
80
+ if (arg === "--") {
81
+ return false;
82
+ }
83
+ if (arg.startsWith("-")) {
84
+ continue;
85
+ }
86
+ if (isGitBlobSpecifier(arg)) {
87
+ return true;
88
+ }
89
+ }
90
+ return false;
91
+ }
92
+ export function isFileContentInspectionArgv(argv) {
93
+ const argv0 = getCommandName(argv);
94
+ if (!argv0) {
95
+ return false;
96
+ }
97
+ return FILE_CONTENT_INSPECTION_COMMANDS.has(argv0) || isGitShowFileContentArgv(argv);
98
+ }
99
+ function isGhApiContentsDecodeCommand(command) {
100
+ if (!command) {
101
+ return false;
102
+ }
103
+ return /\bgh\s+api\b/u.test(command)
104
+ && /\/contents\//u.test(command)
105
+ && /--jq(?:=|\s+)['"]?\.content['"]?/u.test(command)
106
+ && /\|\s*base64\s+(?:-[dD]\b|--decode\b)/u.test(command);
107
+ }
108
+ export function isRepositoryInspectionArgv(argv) {
109
+ const argv0 = getCommandName(argv);
110
+ if (!argv0) {
111
+ return false;
112
+ }
113
+ if (isFileContentInspectionArgv(argv)) {
114
+ return true;
115
+ }
116
+ if (REPO_INVENTORY_COMMANDS.has(argv0)) {
117
+ return true;
118
+ }
119
+ if (argv0 === "rg" && argv.includes("--files")) {
120
+ return true;
121
+ }
122
+ if (getGitSubcommand(argv) === "ls-files") {
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+ function getMostDerivedCandidate(input) {
128
+ return deriveCommandMatchCandidates(input).reduce((best, candidate) => (getSourcePriority(candidate.source) >= getSourcePriority(best.source) ? candidate : best));
129
+ }
130
+ function extractPipelineSourceCommand(command) {
131
+ let current = "";
132
+ let quote = null;
133
+ let escaping = false;
134
+ for (let index = 0; index < command.length; index += 1) {
135
+ const char = command[index];
136
+ if (escaping) {
137
+ current += char;
138
+ escaping = false;
139
+ continue;
140
+ }
141
+ if (char === "\\") {
142
+ current += char;
143
+ escaping = true;
144
+ continue;
145
+ }
146
+ if (quote) {
147
+ current += char;
148
+ if (char === quote) {
149
+ quote = null;
150
+ }
151
+ continue;
152
+ }
153
+ if (char === "'" || char === "\"") {
154
+ current += char;
155
+ quote = char;
156
+ continue;
157
+ }
158
+ if (char === "|" && command[index + 1] !== "|") {
159
+ break;
160
+ }
161
+ current += char;
162
+ }
163
+ return current.trim();
164
+ }
165
+ function getInspectionArgv(input) {
166
+ const candidate = getMostDerivedCandidate(input);
167
+ if (candidate.argv.length > 0) {
168
+ return candidate.argv;
169
+ }
170
+ if (typeof input.command !== "string") {
171
+ return [];
172
+ }
173
+ const sourceCommand = extractPipelineSourceCommand(stripLeadingCdPrefix(input.command));
174
+ return sourceCommand ? tokenizeCommand(sourceCommand) : [];
175
+ }
176
+ export function isFileContentInspectionCommand(input) {
177
+ return isFileContentInspectionArgv(getInspectionArgv(input))
178
+ || deriveCommandMatchCandidates(input).some((candidate) => isGhApiContentsDecodeCommand(candidate.command));
179
+ }
180
+ export function isRepositoryInspectionCommand(input) {
181
+ return isRepositoryInspectionArgv(getMostDerivedCandidate(input).argv);
182
+ }
183
+ export function normalizeCommandSignature(command) {
184
+ if (!command || command === "stdin" || command.startsWith("reduce:")) {
185
+ return null;
186
+ }
187
+ const argv = getNormalizedArgv({ command });
188
+ if (argv.length === 0) {
189
+ return null;
190
+ }
191
+ const normalized = getCommandName(argv);
192
+ return normalized || null;
193
+ }
194
+ export function normalizeEffectiveCommandSignature(command) {
195
+ if (!command || command === "stdin" || command.startsWith("reduce:")) {
196
+ return null;
197
+ }
198
+ const candidate = getMostDerivedCandidate({ command });
199
+ const normalized = getCommandName(candidate.argv);
200
+ return normalized || null;
201
+ }
@@ -0,0 +1,16 @@
1
+ import type { CommandMatchSource, ToolExecutionInput } from "../types.js";
2
+ export type CommandMatchCandidate = {
3
+ argv: string[];
4
+ source: CommandMatchSource;
5
+ command?: string;
6
+ };
7
+ export declare function getSourcePriority(source: CommandMatchSource): number;
8
+ export declare function getCandidateArgv(input: Pick<ToolExecutionInput, "argv" | "command">): string[];
9
+ export declare function dedupeCandidates(candidates: CommandMatchCandidate[]): CommandMatchCandidate[];
10
+ export declare function unwrapShellRunner(input: Pick<ToolExecutionInput, "argv" | "command">): string | null;
11
+ export declare function stripLeadingEnvAssignments(argv: string[]): string[];
12
+ export declare function isSetupWrapperSegment(argv: string[], command?: string): boolean;
13
+ export declare function buildEffectiveCandidate(argv: string[], transformed: boolean, command?: string): CommandMatchCandidate | null;
14
+ export declare function resolveEffectiveCommand(input: Pick<ToolExecutionInput, "argv" | "command">): CommandMatchCandidate | null;
15
+ export declare function getEffectiveCommandArgv(input: Pick<ToolExecutionInput, "argv" | "command">): string[];
16
+ export declare function deriveCommandMatchCandidates(input: Pick<ToolExecutionInput, "argv" | "command">): CommandMatchCandidate[];
@@ -0,0 +1,443 @@
1
+ import { ENV_ASSIGNMENT_PATTERN, isCompoundShellCommand, splitTopLevelCommandChain, stripLeadingEnvAssignmentsFromCommand, tokenizeCommand, } from "./command-shell.js";
2
+ const SETUP_WRAPPER_COMMANDS = new Set(["cd", "pwd", "set", "source", ".", "export", "unset", "trap", "true"]);
3
+ const SHELL_COMMAND_LAUNCHERS = new Set(["bash", "sh", "zsh", "fish"]);
4
+ const ENV_FLAGS_WITH_VALUES = new Set(["-u", "--unset", "-C", "--chdir", "-S", "--split-string"]);
5
+ const ENV_FLAGS = new Set(["-i", "--ignore-environment", "-0", "--null", "--debug"]);
6
+ function splitTopLevelOrChain(command) {
7
+ const trimmed = command.trim();
8
+ if (!trimmed) {
9
+ return [];
10
+ }
11
+ const segments = [];
12
+ let current = "";
13
+ let quote = null;
14
+ let escaping = false;
15
+ for (let index = 0; index < trimmed.length; index += 1) {
16
+ const char = trimmed[index];
17
+ if (escaping) {
18
+ current += char;
19
+ escaping = false;
20
+ continue;
21
+ }
22
+ if (char === "\\") {
23
+ current += char;
24
+ escaping = true;
25
+ continue;
26
+ }
27
+ if (quote) {
28
+ current += char;
29
+ if (char === quote) {
30
+ quote = null;
31
+ }
32
+ continue;
33
+ }
34
+ if (char === "'" || char === "\"") {
35
+ current += char;
36
+ quote = char;
37
+ continue;
38
+ }
39
+ if (char === "|" && trimmed[index + 1] === "|") {
40
+ const segment = current.trim();
41
+ if (segment) {
42
+ segments.push(segment);
43
+ }
44
+ current = "";
45
+ index += 1;
46
+ continue;
47
+ }
48
+ current += char;
49
+ }
50
+ if (quote || escaping) {
51
+ return [trimmed];
52
+ }
53
+ const segment = current.trim();
54
+ if (segment) {
55
+ segments.push(segment);
56
+ }
57
+ return segments;
58
+ }
59
+ function isFullyParenthesized(command) {
60
+ if (!command.startsWith("(") || !command.endsWith(")")) {
61
+ return false;
62
+ }
63
+ let quote = null;
64
+ let escaping = false;
65
+ let depth = 0;
66
+ for (let index = 0; index < command.length; index += 1) {
67
+ const char = command[index];
68
+ if (escaping) {
69
+ escaping = false;
70
+ continue;
71
+ }
72
+ if (char === "\\") {
73
+ escaping = true;
74
+ continue;
75
+ }
76
+ if (quote) {
77
+ if (char === quote) {
78
+ quote = null;
79
+ }
80
+ continue;
81
+ }
82
+ if (char === "'" || char === "\"") {
83
+ quote = char;
84
+ continue;
85
+ }
86
+ if (char === "(") {
87
+ depth += 1;
88
+ continue;
89
+ }
90
+ if (char === ")") {
91
+ depth -= 1;
92
+ if (depth === 0 && index < command.length - 1) {
93
+ return false;
94
+ }
95
+ }
96
+ }
97
+ return depth === 0 && !quote && !escaping;
98
+ }
99
+ function stripSetupShellDecorators(command) {
100
+ let trimmed = command.trim();
101
+ while (isFullyParenthesized(trimmed)) {
102
+ trimmed = trimmed.slice(1, -1).trim();
103
+ }
104
+ return trimmed;
105
+ }
106
+ function getArgv0Name(argv) {
107
+ const first = argv[0];
108
+ if (!first) {
109
+ return null;
110
+ }
111
+ const normalized = first.replace(/^["']|["']$/gu, "");
112
+ const slashIndex = Math.max(normalized.lastIndexOf("/"), normalized.lastIndexOf("\\"));
113
+ return slashIndex >= 0 ? normalized.slice(slashIndex + 1) : normalized;
114
+ }
115
+ function getNormalizedArgv(input) {
116
+ if (input.argv?.length) {
117
+ return input.argv;
118
+ }
119
+ if (!input.command) {
120
+ return [];
121
+ }
122
+ return tokenizeCommand(input.command);
123
+ }
124
+ function isShellCommandStringOption(token) {
125
+ return /^-[A-Za-z]*c[A-Za-z]*$/u.test(token);
126
+ }
127
+ export function getSourcePriority(source) {
128
+ switch (source) {
129
+ case "effective":
130
+ return 2;
131
+ case "shell-body":
132
+ return 1;
133
+ case "original":
134
+ default:
135
+ return 0;
136
+ }
137
+ }
138
+ export function getCandidateArgv(input) {
139
+ if (input.argv?.length) {
140
+ return input.argv;
141
+ }
142
+ const command = typeof input.command === "string" ? input.command.trim() : "";
143
+ if (!command || isCompoundShellCommand(command)) {
144
+ return [];
145
+ }
146
+ return tokenizeCommand(command);
147
+ }
148
+ function buildCandidate(input, source) {
149
+ return {
150
+ ...(typeof input.command === "string" && input.command.trim()
151
+ ? { command: input.command.trim() }
152
+ : {}),
153
+ argv: getCandidateArgv(input),
154
+ source,
155
+ };
156
+ }
157
+ export function dedupeCandidates(candidates) {
158
+ const deduped = [];
159
+ const indexes = new Map();
160
+ for (const candidate of candidates) {
161
+ const key = `${candidate.command ?? ""}\0${candidate.argv.join("\0")}`;
162
+ const existingIndex = indexes.get(key);
163
+ if (existingIndex === undefined) {
164
+ indexes.set(key, deduped.length);
165
+ deduped.push(candidate);
166
+ continue;
167
+ }
168
+ const existing = deduped[existingIndex];
169
+ if (getSourcePriority(candidate.source) > getSourcePriority(existing.source)) {
170
+ deduped[existingIndex] = candidate;
171
+ }
172
+ }
173
+ return deduped;
174
+ }
175
+ function isLikelyShellLauncher(launcherName, launcherPath) {
176
+ const normalized = launcherName.toLowerCase().replace(/\.exe$/u, "");
177
+ if (SHELL_COMMAND_LAUNCHERS.has(normalized)) {
178
+ return true;
179
+ }
180
+ if (normalized === "dash"
181
+ || normalized === "ksh"
182
+ || normalized === "mksh"
183
+ || normalized === "ash"
184
+ || normalized === "csh"
185
+ || normalized === "tcsh") {
186
+ return true;
187
+ }
188
+ const pathNormalized = launcherPath?.toLowerCase().replace(/\\/gu, "/");
189
+ if (!pathNormalized) {
190
+ return false;
191
+ }
192
+ if (!pathNormalized.includes("/bin/")) {
193
+ return false;
194
+ }
195
+ return (pathNormalized.endsWith("/bash")
196
+ || pathNormalized.endsWith("/sh")
197
+ || pathNormalized.endsWith("/zsh")
198
+ || pathNormalized.endsWith("/fish")
199
+ || pathNormalized.endsWith("/dash")
200
+ || pathNormalized.endsWith("/ksh")
201
+ || pathNormalized.endsWith("/mksh")
202
+ || pathNormalized.endsWith("/ash")
203
+ || pathNormalized.endsWith("/csh")
204
+ || pathNormalized.endsWith("/tcsh")
205
+ || pathNormalized.endsWith("/bash.exe")
206
+ || pathNormalized.endsWith("/sh.exe")
207
+ || pathNormalized.endsWith("/zsh.exe")
208
+ || pathNormalized.endsWith("/fish.exe"));
209
+ }
210
+ export function unwrapShellRunner(input) {
211
+ const argv = getNormalizedArgv(input);
212
+ const argv0 = getArgv0Name(argv);
213
+ if (!argv0 || !isLikelyShellLauncher(argv0, argv[0])) {
214
+ return null;
215
+ }
216
+ for (let index = 1; index < argv.length - 1; index += 1) {
217
+ if (!isShellCommandStringOption(argv[index] ?? "")) {
218
+ continue;
219
+ }
220
+ const shellBody = argv[index + 1]?.trim();
221
+ return shellBody ? shellBody : null;
222
+ }
223
+ return null;
224
+ }
225
+ export function stripLeadingEnvAssignments(argv) {
226
+ let index = 0;
227
+ while (index < argv.length && ENV_ASSIGNMENT_PATTERN.test(argv[index] ?? "")) {
228
+ index += 1;
229
+ }
230
+ if (getArgv0Name(argv.slice(index)) !== "env") {
231
+ return argv.slice(index);
232
+ }
233
+ index += 1;
234
+ while (index < argv.length) {
235
+ const arg = argv[index] ?? "";
236
+ if (arg === "--") {
237
+ index += 1;
238
+ break;
239
+ }
240
+ if (ENV_ASSIGNMENT_PATTERN.test(arg)) {
241
+ index += 1;
242
+ continue;
243
+ }
244
+ if (ENV_FLAGS.has(arg)) {
245
+ index += 1;
246
+ continue;
247
+ }
248
+ if (ENV_FLAGS_WITH_VALUES.has(arg)) {
249
+ index += 2;
250
+ continue;
251
+ }
252
+ if (arg.startsWith("--unset=") || arg.startsWith("--chdir=") || arg.startsWith("--split-string=")) {
253
+ index += 1;
254
+ continue;
255
+ }
256
+ break;
257
+ }
258
+ return argv.slice(index);
259
+ }
260
+ function isSimpleSetupWrapperSegment(argv) {
261
+ if (argv.length === 0) {
262
+ return true;
263
+ }
264
+ const argv0 = getArgv0Name(argv);
265
+ if (!argv0) {
266
+ return true;
267
+ }
268
+ if (isQuietCommandProbe(argv)) {
269
+ return true;
270
+ }
271
+ if (argv0 === "tt" && (argv[1] === "title" || argv[1] === "sync")) {
272
+ return true;
273
+ }
274
+ if (argv0 === "tmux" && argv[1] === "select-pane" && argv.includes("-T")) {
275
+ return true;
276
+ }
277
+ return SETUP_WRAPPER_COMMANDS.has(argv0);
278
+ }
279
+ function isQuietCommandProbe(argv) {
280
+ const argv0 = getArgv0Name(argv);
281
+ return argv0 === "command"
282
+ && (argv[1] === "-v" || argv[1] === "-V")
283
+ && argv.slice(2).some(redirectsStdout);
284
+ }
285
+ function redirectsStdout(arg) {
286
+ return arg === ">"
287
+ || arg === ">>"
288
+ || arg === "1>"
289
+ || arg === "1>>"
290
+ || arg === "&>"
291
+ || arg === "&>>"
292
+ || /^(?:>|>>|1>|1>>|&>|&>>)\S/u.test(arg);
293
+ }
294
+ function isFailFastSetupGuard(argv) {
295
+ const argv0 = getArgv0Name(argv);
296
+ return argv0 === "exit" || argv0 === "return";
297
+ }
298
+ export function isSetupWrapperSegment(argv, command) {
299
+ const normalizedCommand = command ? stripSetupShellDecorators(command) : "";
300
+ const orSegments = normalizedCommand ? splitTopLevelOrChain(normalizedCommand) : [];
301
+ if (orSegments.length > 1) {
302
+ return orSegments.every((segment) => {
303
+ const segmentArgv = tokenizeCommand(stripSetupShellDecorators(segment));
304
+ return isSimpleSetupWrapperSegment(segmentArgv) || isFailFastSetupGuard(segmentArgv);
305
+ });
306
+ }
307
+ return isSimpleSetupWrapperSegment(normalizedCommand ? tokenizeCommand(normalizedCommand) : argv);
308
+ }
309
+ function isSetupWrapperCommand(command) {
310
+ const segments = splitTopLevelCommandChain(command);
311
+ return segments.length > 0
312
+ && segments.every((segment) => isSetupWrapperSegment(tokenizeCommand(segment), segment));
313
+ }
314
+ function isSingleSetupConditionSegment(argv, command) {
315
+ const argv0 = getArgv0Name(argv);
316
+ return argv0 === "[" || argv0 === "[[" || argv0 === "test" || isSetupWrapperSegment(argv, command);
317
+ }
318
+ function isSetupConditionSegment(argv, command) {
319
+ const normalizedCommand = command ? stripSetupShellDecorators(command) : "";
320
+ const orSegments = normalizedCommand ? splitTopLevelOrChain(normalizedCommand) : [];
321
+ if (orSegments.length > 1) {
322
+ return orSegments.every((segment) => {
323
+ const segmentCommand = stripSetupShellDecorators(segment);
324
+ const segmentArgv = tokenizeCommand(segmentCommand);
325
+ return isSingleSetupConditionSegment(segmentArgv, segmentCommand) || isFailFastSetupGuard(segmentArgv);
326
+ });
327
+ }
328
+ return isSingleSetupConditionSegment(normalizedCommand ? tokenizeCommand(normalizedCommand) : argv, normalizedCommand || command);
329
+ }
330
+ function isSetupConditionCommand(command) {
331
+ const segments = splitTopLevelCommandChain(command);
332
+ return segments.length > 0
333
+ && segments.every((segment) => isSetupConditionSegment(tokenizeCommand(segment), segment));
334
+ }
335
+ function stripLeadingSetupIfBlock(command) {
336
+ const match = /^if\s+([\s\S]+?)(?:;|\n)\s*then\s+([\s\S]+?)(?:(?:;|\n)\s*else\s+([\s\S]+?))?(?:;|\n)\s*fi\s*(?:;|&&|\n)\s*(.+)$/u.exec(command.trim());
337
+ if (!match) {
338
+ return null;
339
+ }
340
+ const [, condition, thenCommand, elseCommand, tail] = match;
341
+ if (!condition || !thenCommand || !tail) {
342
+ return null;
343
+ }
344
+ if (!isSetupConditionCommand(condition) || !isSetupWrapperCommand(thenCommand)) {
345
+ return null;
346
+ }
347
+ if (elseCommand && !isSetupWrapperCommand(elseCommand)) {
348
+ return null;
349
+ }
350
+ return tail.trim() || null;
351
+ }
352
+ function stripLeadingSetupSegment(command) {
353
+ const trimmed = command.trim();
354
+ const segments = splitTopLevelCommandChain(trimmed);
355
+ const first = segments[0]?.trim();
356
+ if (!first || segments.length < 2 || !isSetupWrapperSegment(tokenizeCommand(first), first)) {
357
+ return null;
358
+ }
359
+ if (!trimmed.startsWith(first)) {
360
+ return null;
361
+ }
362
+ let index = first.length;
363
+ while (/\s/u.test(trimmed[index] ?? "")) {
364
+ index += 1;
365
+ }
366
+ if (trimmed[index] === "&" && trimmed[index + 1] === "&") {
367
+ index += 2;
368
+ }
369
+ else if (trimmed[index] === ";" || trimmed[index] === "\n") {
370
+ index += 1;
371
+ }
372
+ else {
373
+ return null;
374
+ }
375
+ return trimmed.slice(index).trim() || null;
376
+ }
377
+ export function buildEffectiveCandidate(argv, transformed, command) {
378
+ const strippedArgv = stripLeadingEnvAssignments(argv);
379
+ if (strippedArgv.length === 0 || isSetupWrapperSegment(strippedArgv, command)) {
380
+ return null;
381
+ }
382
+ if (!transformed && strippedArgv.length === argv.length) {
383
+ return null;
384
+ }
385
+ return {
386
+ ...(command ? { command: strippedArgv.length === argv.length ? command : strippedArgv.join(" ") } : {}),
387
+ argv: strippedArgv,
388
+ source: "effective",
389
+ };
390
+ }
391
+ export function resolveEffectiveCommand(input) {
392
+ const command = typeof input.command === "string" ? input.command.trim() : "";
393
+ const argv = getNormalizedArgv(input);
394
+ if (!command && argv.length === 0) {
395
+ return null;
396
+ }
397
+ if (!command) {
398
+ return buildEffectiveCandidate(argv, false);
399
+ }
400
+ let effectiveCommand = command;
401
+ for (let iteration = 0; iteration < 16; iteration += 1) {
402
+ const setupIfTail = stripLeadingSetupIfBlock(effectiveCommand);
403
+ const setupSegmentTail = setupIfTail ?? stripLeadingSetupSegment(effectiveCommand);
404
+ if (!setupSegmentTail) {
405
+ break;
406
+ }
407
+ effectiveCommand = setupSegmentTail;
408
+ }
409
+ if (effectiveCommand !== command) {
410
+ return resolveEffectiveCommand({ command: effectiveCommand })
411
+ ?? buildEffectiveCandidate(tokenizeCommand(effectiveCommand), true, effectiveCommand);
412
+ }
413
+ const segments = splitTopLevelCommandChain(effectiveCommand);
414
+ const transformedByChain = segments.length > 1;
415
+ for (const segment of segments) {
416
+ const trimmedSegment = segment.trim();
417
+ const segmentArgv = tokenizeCommand(trimmedSegment);
418
+ if (segmentArgv.length === 0) {
419
+ continue;
420
+ }
421
+ const effectiveCommand = stripLeadingEnvAssignmentsFromCommand(trimmedSegment) ?? undefined;
422
+ const candidate = buildEffectiveCandidate(segmentArgv, transformedByChain, effectiveCommand);
423
+ if (candidate) {
424
+ return candidate;
425
+ }
426
+ }
427
+ return null;
428
+ }
429
+ export function getEffectiveCommandArgv(input) {
430
+ return resolveEffectiveCommand(input)?.argv ?? getCandidateArgv(input);
431
+ }
432
+ export function deriveCommandMatchCandidates(input) {
433
+ const candidates = [buildCandidate(input, "original")];
434
+ const shellBody = unwrapShellRunner(input);
435
+ if (shellBody) {
436
+ candidates.push(buildCandidate({ command: shellBody }, "shell-body"));
437
+ }
438
+ const effective = resolveEffectiveCommand(shellBody ? { command: shellBody } : input);
439
+ if (effective) {
440
+ candidates.push(effective);
441
+ }
442
+ return dedupeCandidates(candidates);
443
+ }
@@ -0,0 +1,18 @@
1
+ export declare const ENV_ASSIGNMENT_PATTERN: RegExp;
2
+ export declare function tokenizeCommand(command: string): string[];
3
+ export declare function splitTopLevelCommandChain(command: string): string[];
4
+ export declare function isCompoundShellCommand(command: string): boolean;
5
+ export declare function hasSequentialShellCommands(command: string): boolean;
6
+ export declare function stripLeadingEnvAssignmentsFromCommand(command: string): string | null;
7
+ /**
8
+ * Strip trivial leading `cd <dir> && ` (or `pushd`) prefixes from a shell
9
+ * command. Models sometimes emit `cd /path && git status` even when the
10
+ * harness provides a cwd, which causes downstream compound-command heuristics
11
+ * to skip compaction. Stripping the prefix lets classification and the
12
+ * rewrite policy reason about the effective command.
13
+ *
14
+ * Only handles trivially safe chains — a single shell token argument, no
15
+ * redirections, no nested pipelines. Anything fancier returns the input
16
+ * unchanged.
17
+ */
18
+ export declare function stripLeadingCdPrefix(command: string): string;